kivio

kivio_layer.h

00001 /*
00002  * Kivio - Visual Modelling and Flowcharting
00003  * Copyright (C) 2000-2001 theKompany.com & Dave Marotti
00004  *
00005  * This program is free software; you can redistribute it and/or
00006  * modify it under the terms of the GNU General Public License
00007  * as published by the Free Software Foundation; either version 2
00008  * of the License, or (at your option) any later version.
00009  *
00010  * This program is distributed in the hope that it will be useful,
00011  * but WITHOUT ANY WARRANTY; without even the implied warranty of
00012  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
00013  * GNU General Public License for more details.
00014  *
00015  * You should have received a copy of the GNU General Public License
00016  * along with this program; if not, write to the Free Software
00017  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
00018  */
00019 #ifndef KIVIO_LAYER_H
00020 #define KIVIO_LAYER_H
00021 
00022 #include <qdom.h>
00023 #include <qptrlist.h>
00024 #include <qobject.h>
00025 #include <KoPoint.h>
00026 class KivioConnectorPoint;
00027 class KivioConnectorTarget;
00028 class KivioPage;
00029 class KivioPainter;
00030 class KoPoint;
00031 class DCOPObject;
00032 class KoZoomHandler;
00033 class QDomElement;
00034 class KoStore;
00035 class KoXmlWriter;
00036 
00037 #include "kivio_stencil.h"
00038 
00039 #define FLOW_LAYER_VISIBLE 0x0001
00040 #define FLOW_LAYER_CONNECTABLE 0x0002
00041 #define FLOW_LAYER_NOT_EDITABLE 0x0004
00042 #define FLOW_LAYER_NOT_PRINTABLE 0x0008
00043 
00044 class KivioLayer
00045 {
00046 protected:
00047     friend class KivioGroupStencil;
00048 
00049     int m_flags;
00050     QPtrList <KivioStencil> *m_pStencilList;
00051     QPtrList <KivioStencil> *m_pDeletedStencilList;
00052     QString m_name;
00053     KivioPage *m_pPage;
00054     DCOPObject* m_dcop;
00055 
00056     KivioStencil *loadSMLStencil( const QDomElement & );
00057     KivioStencil *loadGroupStencil( const QDomElement & );
00058     KivioStencil *loadPluginStencil( const QDomElement & );
00059 
00060 
00061 public:
00062     KivioLayer( KivioPage * );
00063     virtual ~KivioLayer();
00064 
00065     KivioPage *page()const{return m_pPage;}
00066 
00067     virtual DCOPObject* dcopObject();
00068 
00069     QPtrList<KivioStencil> *stencilList() { return m_pStencilList; }
00070 
00071     bool visible() { return (m_flags & FLOW_LAYER_VISIBLE); }
00072     void setVisible( bool f );
00073 
00074     bool connectable() { return (m_flags & FLOW_LAYER_CONNECTABLE); }
00075     void setConnectable( bool f );
00076 
00077     void setEditable(bool f);
00078     bool editable() { return !(m_flags & FLOW_LAYER_NOT_EDITABLE); }
00079 
00080     void setPrintable(bool f);
00081     bool printable() { return !(m_flags & FLOW_LAYER_NOT_PRINTABLE); }
00082 
00083     QString name() const { return m_name; }
00084     void setName( const QString &n ) { m_name = QString(n); }
00085 
00086     bool addStencil( KivioStencil * );
00087     bool removeStencil( KivioStencil * );
00088 
00089     bool loadXML( const QDomElement & );
00090     void loadOasis(const QDomElement& layer);
00091     QDomElement saveXML( QDomDocument & );
00092     void saveOasis(KoXmlWriter* layerWriter);
00093 
00094     KivioStencil *checkForStencil( KoPoint *, int *, float, bool );
00095 
00096     void printContent( KivioPainter& painter, int xdpi = 0, int ydpi = 0 );
00097     void printContent(KivioPainter& painter, KoZoomHandler* zoomHandler);
00098     void paintContent( KivioPainter& painter, const QRect& rect, bool transparent, QPoint p0,
00099       KoZoomHandler* zoom );
00100     void paintConnectorTargets( KivioPainter& painter, const QRect& rect, bool transparent,
00101       QPoint p0, KoZoomHandler* zoom );
00102     void paintSelectionHandles( KivioPainter& painter, const QRect& rect, bool transparent,
00103       QPoint p0, KoZoomHandler* zoom );
00104 
00105     KivioStencil *firstStencil() { return m_pStencilList->first(); }
00106     KivioStencil *nextStencil() { return m_pStencilList->next(); }
00107     KivioStencil *prevStencil() { return m_pStencilList->prev(); }
00108     KivioStencil *takeStencil() { return m_pStencilList->take(); }
00109     KivioStencil *currentStencil() { return m_pStencilList->current(); }
00110     KivioStencil *lastStencil() { return m_pStencilList->last(); }
00111 
00112     KivioStencil *takeStencil( KivioStencil * );
00113 
00114     KivioConnectorTarget *connectPointToTarget( KivioConnectorPoint *, float );
00115 
00116     KoPoint snapToTarget( const KoPoint& p, double thresh, bool& hit );
00117 
00118     int generateStencilIds( int );
00119 
00120     void searchForConnections( KivioPage * );
00121     void takeStencilFromList(  KivioStencil *pStencil );
00122     void insertStencil( KivioStencil *pStencil );
00123 
00124 };
00125 
00126 #endif
00127 
00128 
KDE Home | KDE Accessibility Home | Description of Access Keys