1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ReportWindow.hxx,v $
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>
41 #include <boost/shared_ptr.hpp>
43 #include <MarkedSection.hxx>
44 #include "ViewsWindow.hxx"
52 class OScrollWindowHelper
;
60 class OReportWindow
: public Window
, public IMarkedSection
64 OScrollWindowHelper
* m_pParent
;
65 OViewsWindow m_aViewsWindow
;
66 ::std::auto_ptr
<DlgEdFactory
>
69 void ImplInitSettings();
71 sal_Int32
GetTotalHeight() const;
72 sal_Int32
impl_getRealPixelWidth() const;
74 OReportWindow(OReportWindow
&);
75 void operator =(OReportWindow
&);
77 virtual void DataChanged( const DataChangedEvent
& rDCEvt
);
79 OReportWindow(OScrollWindowHelper
* _pParent
,ODesignView
* _pView
);
80 virtual ~OReportWindow();
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
102 /** returns if paste is allowed
104 * \return <TRUE/> if paste is allowed
106 BOOL
IsPasteAllowed();
108 /** paste a new control in this section
112 /** Deletes the current selection in this section
117 /** All objects will be marked.
119 void SelectAll(const sal_uInt16 _nObjectType
);
121 /** returns <TRUE/> when a object is marked
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
147 void toggleGrid(sal_Bool _bVisible
);
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
);
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
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 //==================================================================
240 //==================================================================
241 #endif // RPTUI_REPORT_WINDOW_HXX