sync master with lastest vba changes
[ooovba.git] / reportdesign / source / ui / inc / DesignView.hxx
blob1e8173e8eb0adf54dd137e317ba58875bbd80ebf
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: DesignView.hxx,v $
10 * $Revision: 1.8 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #ifndef RPTUI_DESIGNVIEW_HXX
31 #define RPTUI_DESIGNVIEW_HXX
33 #include <dbaccess/dataview.hxx>
34 #include <com/sun/star/frame/XController.hpp>
35 #include <com/sun/star/report/XSection.hpp>
36 #include <com/sun/star/report/XReportComponent.hpp>
37 #include <vcl/split.hxx>
38 #include <vcl/scrbar.hxx>
39 #include <com/sun/star/container/XNameContainer.hpp>
40 #include <com/sun/star/datatransfer/DataFlavor.hpp>
41 #include <tools/link.hxx>
42 #include <tools/gen.hxx>
43 #include <vcl/timer.hxx>
44 #include <svtools/hint.hxx>
45 #include <svtools/brdcst.hxx>
46 #include <comphelper/stl_types.hxx>
47 #include "ReportDefines.hxx"
48 #include <svtools/colorcfg.hxx>
49 #include <boost/shared_ptr.hpp>
50 #include <svx/svdedtv.hxx>
51 #include <vcl/tabpage.hxx>
52 #include <vcl/splitwin.hxx>
53 #include <MarkedSection.hxx>
54 #include "ScrollHelper.hxx"
56 class KeyEvent;
57 class MouseEvent;
58 class Timer;
59 class Window;
61 namespace rptui
63 class OReportSection;
64 class OUnoObject;
65 class OSectionView;
66 class OReportController;
67 class PropBrw;
68 class OAddFieldWindow;
69 class OReportModel;
70 class ONavigator;
71 //==================================================================
72 //==================================================================
73 class ODesignView : public dbaui::ODataView, public SfxBroadcaster, public IMarkedSection
75 private:
76 SplitWindow m_aSplitWin;
78 ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> m_xReportComponent;
79 OReportController& m_rReportController;
80 OScrollWindowHelper m_aScrollWindow;
81 Window* m_pTaskPane;
82 PropBrw* m_pPropWin;
83 OAddFieldWindow* m_pAddField;
84 OSectionView* m_pCurrentView;
85 ONavigator* m_pReportExplorer;
86 Timer m_aMarkTimer;
87 Point m_aScrollOffset;
88 DlgEdMode m_eMode;
89 USHORT m_nCurrentPosition;
90 USHORT m_eActObj;
91 BOOL m_bFirstDraw;
92 Size m_aGridSizeCoarse;
93 Size m_aGridSizeFine;
94 BOOL m_bGridVisible;
95 BOOL m_bGridSnap;
96 BOOL m_bDeleted;
99 DECL_LINK( MarkTimeout, Timer * );
100 DECL_LINK( SplitHdl, void* );
102 void ImplInitSettings();
104 ODesignView(ODesignView&);
105 void operator =(ODesignView&);
106 protected:
107 // return the Rectangle where I can paint myself
108 virtual void resizeDocumentView(Rectangle& rRect);
109 // return the Rectangle where I can paint myself
110 virtual void DataChanged( const DataChangedEvent& rDCEvt );
112 public:
113 ODesignView(Window* pParent,
114 const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >&,
115 OReportController& _rController);
116 virtual ~ODesignView();
118 // window overloads
119 virtual void MouseButtonDown( const MouseEvent& rMEvt );
120 virtual long PreNotify( NotifyEvent& rNEvt );
121 virtual void GetFocus();
123 // set the view readonly or not
124 virtual void setReadOnly(sal_Bool _bReadOnly);
126 virtual void initialize();
128 inline OReportController& getController() const { return m_rReportController; }
130 void SetMode( DlgEdMode m_eMode );
131 void SetInsertObj( USHORT eObj,const ::rtl::OUString& _sShapeType = ::rtl::OUString());
132 USHORT GetInsertObj() const;
133 rtl::OUString GetInsertObjString() const;
134 DlgEdMode GetMode() const { return m_eMode; }
136 /** cuts the current selection in this section
138 void Cut();
140 /** copies the current selection in this section
142 void Copy();
144 /** returns if paste is allowed
146 * \return <TRUE/> if paste is allowed
148 BOOL IsPasteAllowed();
150 /** paste a new control in this section
152 void Paste();
154 /** Deletes the current selection in this section
157 void Delete();
159 /** align all marked objects in all sections
161 void alignMarkedObjects(sal_Int32 _nControlModification, bool _bAlignAtSection, bool bBoundRects = false);
163 /** checks if alignment is possible in the current section
165 sal_Bool isAlignPossible() const;
167 /** All objects will be marked.
169 void SelectAll(const sal_uInt16 _nObjectType);
171 /// checks if a selection exists
172 BOOL HasSelection();
174 void UpdatePropertyBrowserDelayed(OSectionView& _rView);
176 USHORT getSectionCount() const;
178 /** removes the section at the given position.
180 * \param _nPosition Zero based.
182 void removeSection(USHORT _nPosition);
184 /** adds a new section at position _nPosition.
185 If the section is <NULL/> nothing happens.
186 If the position is grater than the current elements, the section will be appended.
188 void addSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection
189 ,const ::rtl::OUString& _sColorEntry
190 ,USHORT _nPosition = USHRT_MAX);
192 inline Size getGridSizeCoarse() const { return m_aGridSizeCoarse; }
193 inline Size getGridSizeFine() const { return m_aGridSizeFine; }
194 inline BOOL isGridSnap() const { return m_bGridSnap; }
195 void setGridSnap(BOOL bOn);
196 void setDragStripes(BOOL bOn);
197 /** turns the grid on or off
199 * \param _bGridVisible
201 void toggleGrid(sal_Bool _bGridVisible);
203 void togglePropertyBrowser(sal_Bool _bToogleOn);
205 BOOL isAddFieldVisible() const;
206 void toggleAddField();
208 BOOL isReportExplorerVisible() const;
209 void toggleReportExplorer();
211 /** shows or hides the ruler.
213 void showRuler(sal_Bool _bShow);
215 /** unmark all objects on the views without the given one.
217 * @param _pSectionView The view where the objects should not be unmarked.
219 void unmarkAllObjects(OSectionView* _pSectionView);
221 /** triggers the property browser with the section
222 @param _xReportComponent the report component
224 void showProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface>& _xReportComponent);
225 ::com::sun::star::uno::Any getCurrentlyShownProperty() const;
227 /** returns the current section or the detail section if no section was selected previously
229 ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection > getCurrentSection() const;
231 /** returns the current control report model or <NULL/>
233 ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent > getCurrentControlModel() const;
235 // IMarkedSection
236 ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const;
237 virtual void markSection(const sal_uInt16 _nPos);
239 /** fills the positions of all collapsed sections.
241 * \param _rCollapsedPositions Out parameter which holds afterwards all positions of the collapsed sections.
243 void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const;
245 /** collpase all sections given by their position
247 * \param _aCollpasedSections The position of the sections which should be collapsed.
249 void collapseSections(const com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections);
251 ::rtl::OUString getCurrentPage() const;
252 void setCurrentPage(const ::rtl::OUString& _sLastActivePage);
254 /** checks if the keycode is known by the child windows
255 @param _rCode the keycode
256 @return <TRUE/> if the keycode is handled otherwise <FALSE/>
258 sal_Bool handleKeyEvent(const KeyEvent& _rEvent);
260 /** set the section as marked or not marked
261 @param _pSectionView the section where to set the marked flag
262 @param _bMark the marked flag
264 void setMarked(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection,sal_Bool _bMark);
265 void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape,sal_Bool _bMark);
267 /** returns if the view handles the event by itself
269 * \param _nId the command id
270 * \return <FALSE/> is the event is not handled by the view otherwise <TRUE/>
272 sal_Bool isHandleEvent(sal_uInt16 _nId) const;
274 sal_uInt32 getMarkedObjectCount() const;
276 /** zoom the ruler and view windows
278 void zoom(const Fraction& _aZoom);
280 /** fills the vector with all selected control models
281 /param _rSelection The vector will be filled and will not be cleared before.
283 void fillControlModelSelection(::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const;
285 /** returns the selected field from the add field dialog
287 ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > getSelectedFieldDescriptors();
289 /** calculates the zoom factor.
290 @param _eType which kind of zoom is needed
292 sal_uInt16 getZoomFactor(SvxZoomType _eType) const;
294 //==================================================================
295 } //rptui
296 //==================================================================
297 #endif // RPTUI_DESIGNVIEW_HXX