karbon
karbon_view.h00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020 #ifndef __KARBON_VIEW__
00021 #define __KARBON_VIEW__
00022
00023 #ifdef HAVE_CONFIG_H
00024 #include <config.h>
00025 #endif
00026
00027 #include <KoView.h>
00028 #include <KoPoint.h>
00029 #include <ksharedptr.h>
00030 #include <kxmlguibuilder.h>
00031 #include <KoUnit.h>
00032 #include <koffice_export.h>
00033 class DCOPObject;
00034 class QLabel;
00035
00036 class KAction;
00037 class KarbonPart;
00038 class KSelectAction;
00039 class KToggleAction;
00040 class KoContextHelpAction;
00041 class KoLineStyleAction;
00042
00043 class KoUnitDoubleSpinComboBox;
00044 class KoRect;
00045 class VRuler;
00046
00047 class KoPaletteManager;
00048 class VDocumentTab;
00049 class VLayersTab;
00050 class VHistoryTab;
00051 class VStrokeDocker;
00052 class VColorDocker;
00053 class VStyleDocker;
00054 class VTransformDocker;
00055
00056 class VFill;
00057 class VPainterFactory;
00058 class VSelectToolBar;
00059 class VSmallPreview;
00060 class VStateButton;
00061 class VStroke;
00062 class VStrokeFillPreview;
00063 class VCanvas;
00064 class VStrokeFillPreview;
00065 class VTypeButtonBox;
00066
00067 class VTool;
00068 class VToolBox;
00069 class VToolController;
00070
00071 class KARBONCOMMON_EXPORT KarbonView : public KoView, public KXMLGUIBuilder
00072 {
00073 Q_OBJECT
00074
00075 public:
00076 KarbonView( KarbonPart* part, QWidget* parent = 0L,
00077 const char* name = 0L );
00078 virtual ~KarbonView();
00079
00080 virtual DCOPObject* dcopObject();
00081
00082 KarbonPart *part() const { return m_part; }
00083
00084 virtual void paintEverything( QPainter &p, const QRect &rect, bool transparent = false );
00085
00086 bool mouseEvent( QMouseEvent* event, const KoPoint & );
00087 bool keyEvent( QEvent* event );
00088 void dropEvent( QDropEvent *e );
00089
00090 virtual QWidget* canvas() const;
00091
00092 VCanvas* canvasWidget() const { return m_canvas; }
00093
00094 virtual VPainterFactory* painterFactory() const { return m_painterFactory; }
00095
00096 KoPaletteManager* paletteManager() { return m_pPaletteManager; };
00097
00098
00099 virtual void setupPrinter( KPrinter & ) {}
00100 virtual void print( KPrinter& printer );
00101
00102 KoContextHelpAction* contextHelpAction() const { return m_contextHelpAction; }
00103
00104 void reorganizeGUI();
00105 void setNumberOfRecentFiles( unsigned int number );
00106 void setLineWidth( double val );
00107
00108 QLabel* statusMessage() const { return m_status; }
00109
00110 void setCursor( const QCursor & );
00111
00112 void repaintAll( const KoRect & );
00113 void repaintAll( bool = true );
00114
00115 void setPos( const KoPoint& p );
00116
00117 void setViewportRect( const KoRect &rect );
00118 void setZoomAt( double zoom, const KoPoint & = KoPoint() );
00119
00120 VToolController *toolController();
00121
00122 VStrokeFillPreview* strokeFillPreview()
00123 { return m_strokeFillPreview; }
00124
00125 public slots:
00126
00127 void editCut();
00128 void editCopy();
00129 void editPaste();
00130 void editSelectAll();
00131 void editDeselectAll();
00132 void editDeleteSelection();
00133 void editPurgeHistory();
00134
00135 void selectionDuplicate();
00136 void selectionBringToFront();
00137 void selectionSendToBack();
00138 void selectionMoveUp();
00139 void selectionMoveDown();
00140 void selectionAlignHorizontalLeft();
00141 void selectionAlignHorizontalCenter();
00142 void selectionAlignHorizontalRight();
00143 void selectionAlignVerticalTop();
00144 void selectionAlignVerticalCenter();
00145 void selectionAlignVerticalBottom();
00146
00147 void selectionDistributeHorizontalCenter();
00148 void selectionDistributeHorizontalGap();
00149 void selectionDistributeHorizontalLeft();
00150 void selectionDistributeHorizontalRight();
00151 void selectionDistributeVerticalCenter();
00152 void selectionDistributeVerticalGap();
00153 void selectionDistributeVerticalBottom();
00154 void selectionDistributeVerticalTop();
00155
00156 void fileImportGraphic();
00157
00158 void groupSelection();
00159 void ungroupSelection();
00160
00161 void closePath();
00162
00163
00164 void viewZoomIn();
00165 void viewZoomOut();
00166
00167 void setUnit( KoUnit::Unit _unit );
00168
00169 void configure();
00170
00171 void pageLayout();
00172
00173 void setLineWidth();
00174 void selectionChanged();
00175
00176 void slotActiveToolChanged( VTool * );
00177
00178 void togglePageMargins(bool);
00179 void showRuler();
00180 void showGrid();
00181 bool showPageMargins();
00182 void snapToGrid();
00183
00184 void showSelectionPopupMenu( const QPoint &pos );
00185
00186 protected slots:
00187
00188
00189
00190 void viewModeChanged();
00191 void zoomChanged( const KoPoint & = KoPoint() );
00192 void setLineStyle( int );
00193
00194
00195 void slotStrokeChanged( const VStroke& );
00196 void slotFillChanged( const VFill & );
00197
00198 void canvasContentsMoving( int x, int y );
00199
00200 signals:
00201 void zoomChanged( double );
00202 void selectionChange();
00203 void pageLayoutChanged();
00204
00205 protected:
00206 virtual void updateReadWrite( bool ) {}
00207 virtual void resizeEvent( QResizeEvent* event );
00208
00209 void createDocumentTabDock();
00210 void createLayersTabDock();
00211 void createHistoryTabDock();
00212 void createStrokeDock();
00213 void createColorDock();
00214 void createTransformDock();
00215 void createResourceDock();
00216
00217
00218 virtual QWidget *createContainer( QWidget *parent, int index, const QDomElement &element, int &id );
00219 virtual void removeContainer( QWidget *container, QWidget *parent, QDomElement &element, int id );
00220 void addSelectionToClipboard() const;
00221
00222 private:
00223 void initActions();
00224 void updateRuler();
00225
00226 KarbonPart *m_part;
00227 VCanvas *m_canvas;
00228 VRuler *m_horizRuler;
00229 VRuler *m_vertRuler;
00230
00231 VPainterFactory *m_painterFactory;
00232 VStrokeFillPreview *m_strokeFillPreview;
00233 VTypeButtonBox *m_typeButtonBox;
00234
00235 VToolBox *m_toolbox;
00236
00237 KAction *m_groupObjects;
00238 KAction *m_ungroupObjects;
00239
00240 KAction *m_closePath;
00241
00242
00243 KSelectAction *m_zoomAction;
00244 KSelectAction *m_viewAction;
00245 KAction *m_configureAction;
00246 KToggleAction *m_showRulerAction;
00247 KToggleAction *m_showGridAction;
00248 KToggleAction *m_snapGridAction;
00249 KToggleAction *m_showPageMargins;
00250 KoContextHelpAction *m_contextHelpAction;
00251 KAction *m_deleteSelectionAction;
00252
00253 KoUnitDoubleSpinComboBox *m_setLineWidth;
00254 KoLineStyleAction *m_lineStyleAction;
00255
00256
00257 KoPaletteManager *m_pPaletteManager;
00258 VDocumentTab *m_DocumentTab;
00259 VLayersTab *m_LayersTab;
00260 VHistoryTab *m_HistoryTab;
00261 VColorDocker *m_ColorManager;
00262 VStrokeDocker *m_strokeDocker;
00263 VStyleDocker *m_styleDocker;
00264 VTransformDocker *m_TransformDocker;
00265
00266 VSelectToolBar *m_selectToolBar;
00267
00268
00269 DCOPObject *m_dcop;
00270
00271
00272 QLabel *m_status;
00273 QLabel *m_cursorCoords;
00274 VSmallPreview *m_smallPreview;
00275 VToolController *m_toolController;
00276 };
00277
00278 #endif
00279
|