merge the formfield patch from ooo-build
[ooovba.git] / reportdesign / source / ui / inc / ReportWindow.hxx
blobb35cc04bba9b963cf93f7ee39666089c9ae458cf
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: ReportWindow.hxx,v $
10 * $Revision: 1.6 $
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_REPORT_WINDOW_HXX
31 #define RPTUI_REPORT_WINDOW_HXX
33 #include <com/sun/star/report/XSection.hpp>
34 #include "ReportDefines.hxx"
35 #include "StartMarker.hxx"
36 #include <svtools/ruler.hxx>
37 #include <svx/svdedtv.hxx>
38 #include <svx/zoomitem.hxx>
40 #include <vector>
41 #include <boost/shared_ptr.hpp>
43 #include <MarkedSection.hxx>
44 #include "ViewsWindow.hxx"
46 class Splitter;
48 namespace rptui
50 class ODesignView;
51 class OReportSection;
52 class OScrollWindowHelper;
53 class OSectionView;
54 class OReportModel;
55 class OEndMarker;
56 class OReportPage;
57 class DlgEdFunc;
58 class DlgEdFactory;
60 class OReportWindow : public Window, public IMarkedSection
62 Ruler m_aHRuler;
63 ODesignView* m_pView;
64 OScrollWindowHelper* m_pParent;
65 OViewsWindow m_aViewsWindow;
66 ::std::auto_ptr<DlgEdFactory>
67 m_pObjFac;
69 void ImplInitSettings();
71 sal_Int32 GetTotalHeight() const;
72 sal_Int32 impl_getRealPixelWidth() const;
74 OReportWindow(OReportWindow&);
75 void operator =(OReportWindow&);
76 protected:
77 virtual void DataChanged( const DataChangedEvent& rDCEvt );
78 public:
79 OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView);
80 virtual ~OReportWindow();
82 /** late ctor
84 void initialize();
85 // WINDOW overloads
86 virtual void Resize();
88 inline ODesignView* getReportView() const { return m_pView; }
89 inline OScrollWindowHelper* getScrollWindow() const { return m_pParent; }
91 void SetMode( DlgEdMode m_eMode );
92 void SetInsertObj( USHORT eObj,const ::rtl::OUString& _sShapeType = ::rtl::OUString());
93 rtl::OUString GetInsertObjString() const;
94 void setGridSnap(BOOL bOn);
95 void setDragStripes(BOOL bOn);
96 BOOL isDragStripes() const;
98 /** copies the current selection in this section
100 void Copy();
102 /** returns if paste is allowed
104 * \return <TRUE/> if paste is allowed
106 BOOL IsPasteAllowed();
108 /** paste a new control in this section
110 void Paste();
112 /** Deletes the current selection in this section
115 void Delete();
117 /** All objects will be marked.
119 void SelectAll(const sal_uInt16 _nObjectType);
121 /** returns <TRUE/> when a object is marked
123 BOOL HasSelection();
125 Point getThumbPos() const;
127 /** removes the section at the given position.
129 * \param _nPosition Zero based.
131 void removeSection(USHORT _nPosition);
133 /** adds a new section at position _nPosition.
134 If the section is <NULL/> nothing happens.
135 If the position is grater than the current elements, the section will be appended.
137 void addSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection
138 ,const ::rtl::OUString& _sColorEntry
139 ,USHORT _nPosition = USHRT_MAX);
141 USHORT getSectionCount() const;
143 /** turns the grid on or off
145 * \param _bVisible
147 void toggleGrid(sal_Bool _bVisible);
150 /** shows the ruler
152 void showRuler(sal_Bool _bShow);
154 inline sal_Int32 getRulerHeight() const { return m_aHRuler.GetSizePixel().Height(); }
156 /** returns the total width of the first section
158 sal_Int32 GetTotalWidth() const;
160 /** calculate the max width of the markers
162 * @param _bWithEnd if <TRUE/> the end marker will be used for calculation as well otherwise not.
163 * \return the max width
165 sal_Int32 getMaxMarkerWidth(sal_Bool _bWithEnd) const;
167 void ScrollChildren(const Point& _aThumbPos);
169 void notifySizeChanged();
171 /** unmark all objects on the views without the given one.
173 * @param _pSectionView The view where the objects should not be unmarked.
175 void unmarkAllObjects(OSectionView* _pSectionView);
177 /** triggers the property browser with the report component or section
178 @param _xReportComponent
180 void showProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xReportComponent);
182 /** checks if the keycode is known by the child windows
183 @param _rCode the keycode
184 @return <TRUE/> if the keycode is handled otherwise <FALSE/>
186 sal_Bool handleKeyEvent(const KeyEvent& _rEvent);
188 /** the the section as marked or not marked
189 @param _pSectionView the section where to set the marked flag
190 @param _bMark the marked flag
192 void setMarked(OSectionView* _pSectionView,sal_Bool _bMark);
193 void setMarked(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection,sal_Bool _bMark);
194 void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape,sal_Bool _bMark);
196 // IMarkedSection
197 ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const;
198 ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
199 virtual void markSection(const sal_uInt16 _nPos);
202 /** fills the positions of all collapsed sections.
204 * \param _rCollapsedPositions Out parameter which holds afterwards all positions of the collapsed sections.
206 void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const;
208 /** collpase all sections given by their position
210 * \param _aCollpasedSections The position of the sections which should be collapsed.
212 void collapseSections(const com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections);
214 /** align all marked objects in all sections
216 * \param eHor
217 * \param eVert
218 * \param bBoundRects
220 void alignMarkedObjects(sal_Int32 _nControlModification, bool _bAlignAtSection, bool bBoundRects = false);
222 sal_uInt32 getMarkedObjectCount() const;
224 /** zoom the ruler and view windows
226 void zoom(const Fraction& _aZoom);
228 /** fills the vector with all selected control models
229 /param _rSelection The vector will be filled and will not be cleared before.
231 void fillControlModelSelection(::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const;
233 /** calculates the zoom factor.
234 @param _eType which kind of zoom is needed
236 sal_uInt16 getZoomFactor(SvxZoomType _eType) const;
238 //==================================================================
239 } //rptui
240 //==================================================================
241 #endif // RPTUI_REPORT_WINDOW_HXX