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