kivio

kivio_view.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_gui_h__
00020 #define __kivio_gui_h__
00021 
00022 class KivioView;
00023 class KivioCanvas;
00024 class KivioPage;
00025 class KivioDoc;
00026 class KivioPainter;
00027 class KivioPaperLayout;
00028 class KivioShell;
00029 class KivioStackBar;
00030 class KivioStencilSpawner;
00031 class KivioStencilSpawnerSet;
00032 class KivioTabBar;
00033 class TKSelectColorAction;
00034 class StencilBarDockManager;
00035 class KivioArrowHeadAction;
00036 
00037 namespace Kivio {
00038   class ToolController;
00039   class PluginManager;
00040   class AddStencilSetDialog;
00041   class AddStencilTool;
00042   class ObjectListPalette;
00043 }
00044 
00045 class KivioBirdEyePanel;
00046 class KivioLayerPanel;
00047 class KivioProtectionPanel;
00048 class KivioStencilGeometryPanel;
00049 
00050 class KoDocumentEntry;
00051 class KoTabBar;
00052 
00053 class KAction;
00054 class KFontAction;
00055 class KFontSizeAction;
00056 class KToggleAction;
00057 
00058 class KSelectColorAction;
00059 class KActionMenu;
00060 
00061 class QStringList;
00062 class QPushButton;
00063 class QProgressBar;
00064 class QScrollBar;
00065 class DCOPObject;
00066 class KoRuler;
00067 class KoZoomHandler;
00068 class KoUnitDoubleSpinBox;
00069 class KStatusBarLabel;
00070 class KoLineWidthAction;
00071 class KoLineStyleAction;
00072 class KoPaletteManager;
00073 
00074 #include <qdom.h>
00075 #include <qptrlist.h>
00076 #include <qframe.h>
00077 
00078 #include <KoView.h>
00079 #include <KoDocument.h>
00080 #include <KoUnit.h>
00081 
00082 #include <koffice_export.h>
00083 using namespace Kivio;
00084 
00085 class KIVIO_EXPORT KivioView : public KoView
00086 {
00087   Q_OBJECT
00088   friend class KivioCanvas;
00089 
00090   public:
00091     KivioView( QWidget *_parent, const char *_name, KivioDoc *_doc );
00092     ~KivioView();
00093 
00094     virtual DCOPObject* dcopObject();
00095 
00096     KivioCanvas* canvasWidget() const { return m_pCanvas; }
00097     KivioDoc* doc()const { return m_pDoc; }
00098 
00099     KivioPage* activePage() const;
00100 
00101     void setActiveSpawnerSet( KivioStencilSpawnerSet* );
00102     KivioStencilSpawnerSet *activeSpawnerSet();
00103 
00104     KoTabBar* tabBar()const { return  m_pTabBar;}
00105     KoPaletteManager* paletteManager() { return m_pPaletteManager; };
00106     void updateMenuPage( );
00107 
00108     virtual void setupPrinter(KPrinter&);
00109     virtual void print(KPrinter&);
00110 
00111     virtual QWidget* canvas() const;
00112     virtual int canvasXOffset() const;
00113     virtual int canvasYOffset() const;
00114 
00115     bool isSnapGuides()const { return m_bSnapGuides; }
00116     bool isShowGuides()const { return m_bShowGuides; }
00117     bool isShowRulers()const { return m_bShowRulers; }
00118     bool isShowPageMargins()const { return m_bShowPageMargins; }
00119 
00120     virtual int leftBorder() const;
00121     virtual int rightBorder() const;
00122     virtual int topBorder() const;
00123     virtual int bottomBorder() const;
00124 
00125 
00126     // Returns the current interface color/lineWidth settings
00127     QColor fgColor()const;
00128     QColor bgColor()const;
00129     double lineWidth()const;
00130     int lineStyle() const;
00131     void updateButton();
00132     void insertPage( KivioPage* page );
00133     void resetLayerPanel();
00134     void updateProtectPanelCheckBox();
00135 
00136     KoZoomHandler* zoomHandler() const;
00137 
00138     KoRuler* horzRuler() const { return hRuler; }
00139     KoRuler* vertRuler() const { return vRuler; }
00140 
00141     Kivio::PluginManager* pluginManager();
00142 
00143     int hTextAlign();
00144     int vTextAlign();
00145 
00146   signals:
00147     void zoomChanged(int);
00148     void updateStencilSetList();
00149 
00150   protected:
00151     void createGeometryDock();
00152     void createLayerDock();
00153     void createBirdEyeDock();
00154     void createProtectionDock();
00155     void createObjectListPalette();
00156 
00157   public slots:
00158     void paperLayoutDlg();
00159 
00160     void togglePageMargins(bool);
00161     void toggleShowRulers(bool);
00162     void toggleShowGrid(bool);
00163     void toggleSnapGrid(bool);
00164     void toggleShowGuides(bool);
00165 
00166     void toggleStencilGeometry(bool);
00167     void toggleViewManager(bool);
00168 
00169     void addPage( KivioPage* );
00170     void removePage( KivioPage* );
00171     void insertPage();
00172     void removePage();
00173     void renamePage();
00174     void hidePage();
00175     void showPage();
00176     void viewZoom(int);
00177 
00178     void groupStencils();
00179     void ungroupStencils();
00180 
00181     void selectAllStencils();
00182     void unselectAllStencils();
00183 
00184     void bringStencilToFront();
00185     void sendStencilToBack();
00186 
00187     void addStencilFromSpawner( KivioStencilSpawner *pSpawner, double x = 0.0, double y = 0.0 );
00188 
00189     void changePage( const QString& _name );
00190 
00191     void updateToolBars();
00192 
00193     void cutStencil();
00194     void copyStencil();
00195     void pasteStencil();
00197     void deleteObject();
00198 
00199     void alignStencilsDlg();
00200     void optionsDialog();
00201 
00202     void slotPageHidden( KivioPage* page );
00203     void slotPageShown( KivioPage* page );
00204 
00205     void setRulerPageLayout(const KoPageLayout& l);
00206 
00207     void popupTabBarMenu( const QPoint& point );
00208 
00209     void initStatusBarProgress();
00210     void setStatusBarProgress(int progress);
00211     void removeStatusBarProgress();
00212 
00213     void setActivePage( KivioPage* );
00214 
00215     void setStatusBarInfo(const QString& text);
00216 
00217   protected slots:
00218     void slotPageRenamed( KivioPage* page, const QString& old_name );
00219     void slotUpdateView( KivioPage *_page );
00220     void slotUpdateGrid();
00221 
00222     void setFGColor();
00223     void setBGColor();
00224     void setTextColor();
00225 
00226     void setFontFamily( const QString & );
00227     void setFontSize( int );
00228 
00229     void setLineWidth(double);
00230     void setLineStyle(int);
00231 
00232     void toggleFontBold(bool);
00233     void toggleFontItalics(bool);
00234     void toggleFontUnderline(bool);
00235 
00236     void setHParaAlign( int );
00237     void setVParaAlign( int );
00238     void textAlignLeft();
00239     void textAlignCenter();
00240     void textAlignRight();
00241     void textSuperScript();
00242     void textSubScript();
00243     void showAlign( int align );
00244     void showVAlign( int align );
00245 
00246     void slotSetStartArrow( int );
00247     void slotSetEndArrow( int );
00248 
00249     void slotSetStartArrowSize();
00250     void slotSetEndArrowSize();
00251 
00252     void slotChangeStencilPosition(double, double);
00253     void slotChangeStencilSize(double, double);
00254     void slotChangeStencilRotation(int);
00255 
00256     void viewZoom(const QString& s);
00257 
00258     void addSpawnerToStackBar( KivioStencilSpawnerSet * );
00259     void addStencilSet( const QString& );
00260 
00261     void setMousePos( int mx, int my );
00262     void setRulerUnit(KoUnit::Unit);
00263     void setRulerHOffset(int h);
00264     void setRulerVOffset(int v);
00265     void rulerChangedUnit(KoUnit::Unit u);
00266 
00267     void textFormat();
00268     void stencilFormat();
00269     void arrowHeadFormat();
00270 
00271     void clipboardDataChanged();
00272 
00273     void installStencilSet();
00274 
00276     void loadingFinished();
00277 
00278     void moveTab(unsigned tab, unsigned target);
00279 
00280     void addGuideLine();
00281 
00282     void showAddStencilSetDialog();
00283 
00284     void updateRulers();
00285 
00286   protected:
00287     void setupActions();
00288     void initActions();
00289 
00290     virtual void updateReadWrite( bool readwrite );
00291     virtual void partActivateEvent(KParts::PartActivateEvent* event);
00292     
00293     void updatePageStatusLabel();
00294 
00295   private:
00296     KivioCanvas *m_pCanvas;
00297     KoTabBar *m_pTabBar;
00298 
00299     KAction* m_paperLayout;
00300     KAction* m_insertPage;
00301     KAction* m_removePage;
00302     KAction* m_renamePage;
00303     KAction* m_hidePage;
00304     KAction* m_showPage;
00305     KAction* m_arrowHeadsMenuAction;
00306     KAction* m_menuTextFormatAction;
00307     KAction* m_menuStencilConnectorsAction;
00308 
00309     TKSelectColorAction *m_setFGColor;
00310     TKSelectColorAction *m_setBGColor;
00311 
00312     KFontAction *m_setFontFamily;
00313     KFontSizeAction *m_setFontSize;
00314     KToggleAction *m_setBold;
00315     KToggleAction *m_setItalics;
00316     KToggleAction *m_setUnderline;
00317     TKSelectColorAction *m_setTextColor;
00318     KToggleAction* m_textAlignLeft;
00319     KToggleAction* m_textAlignCenter;
00320     KToggleAction* m_textAlignRight;
00321     KToggleAction* m_textVAlignSuper;
00322     KToggleAction* m_textVAlignSub;
00323 
00324     KivioArrowHeadAction* m_setArrowHeads;
00325 
00326     QStringList m_lineWidthList;
00327 
00328     KivioDoc* m_pDoc;
00329     KivioPage* m_pActivePage;
00330     KivioStencilSpawnerSet* m_pActiveSpawnerSet;
00331 
00332     StencilBarDockManager* m_pStencilBarDockManager;
00333     KoPaletteManager* m_pPaletteManager;
00334 
00335     KoRuler* vRuler;
00336     KoRuler* hRuler;
00337 
00338     KivioStencilGeometryPanel* m_pStencilGeometryPanel;
00339     KivioLayerPanel* m_pLayersPanel;
00340     KivioBirdEyePanel* m_pBirdEyePanel;
00341     KivioProtectionPanel* m_pProtectionPanel;
00342     Kivio::ObjectListPalette* m_objectListPalette;
00343     KToggleAction* showPageMargins;
00344     KToggleAction* showRulers;
00345     KToggleAction* showGrid;
00346     KToggleAction* showGuides;
00347     KAction *m_selectAll;
00348     KAction *m_selectNone;
00349     KAction *m_editCopy;
00350     KAction* m_editCut;
00351     KAction* m_editPaste;
00352     KAction* m_editDelete;
00353     bool m_bShowPageMargins;
00354     bool m_bShowRulers;
00355     bool m_bSnapGuides;
00356     bool m_bShowGuides;
00357 
00358     DCOPObject *dcop;
00359 
00360     KoZoomHandler* m_zoomHandler;
00361 
00362     KStatusBarLabel* m_coordSLbl;
00363     KStatusBarLabel* m_pageCountSLbl;
00364     KStatusBarLabel* m_infoSLbl;
00365 
00366     Kivio::PluginManager* m_pluginManager;
00367 
00368     KAction* m_groupAction;
00369     KAction* m_ungroupAction;
00370     KAction* m_stencilToFront;
00371     KAction* m_stencilToBack;
00372     KAction* m_alignAndDistribute;
00373     KoLineWidthAction* m_lineWidthAction;
00374     KoLineStyleAction* m_lineStyleAction;
00375 
00376     QProgressBar* m_statusBarProgress;
00377 
00378     QScrollBar* m_vertScrollBar;
00379     QScrollBar* m_horzScrollBar;
00380     Kivio::AddStencilTool* m_addStencilTool;
00381 
00382     Kivio::AddStencilSetDialog* m_addStencilSetDialog;
00383 };
00384 
00385 #endif
KDE Home | KDE Accessibility Home | Description of Access Keys