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_REPORT_WINDOW_HXX
29 : : #define RPTUI_REPORT_WINDOW_HXX
30 : :
31 : : #include <com/sun/star/report/XSection.hpp>
32 : : #include "ReportDefines.hxx"
33 : : #include "StartMarker.hxx"
34 : : #include <svtools/ruler.hxx>
35 : : #include <svx/svdedtv.hxx>
36 : : #include <sfx2/zoomitem.hxx>
37 : :
38 : : #include <vector>
39 : : #include <boost/shared_ptr.hpp>
40 : : #include <comphelper/propmultiplex.hxx>
41 : :
42 : : #include <MarkedSection.hxx>
43 : : #include "ViewsWindow.hxx"
44 : :
45 : : namespace rptui
46 : : {
47 : : class ODesignView;
48 : : class OScrollWindowHelper;
49 : : class OSectionView;
50 : : class DlgEdFactory;
51 : :
52 : : class OReportWindow : public Window
53 : : , public IMarkedSection
54 : : , public ::cppu::BaseMutex
55 : : , public ::comphelper::OPropertyChangeListener
56 : : {
57 : : Ruler m_aHRuler;
58 : : ODesignView* m_pView;
59 : : OScrollWindowHelper* m_pParent;
60 : : OViewsWindow m_aViewsWindow;
61 : : ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener;
62 : : ::std::auto_ptr<DlgEdFactory>
63 : : m_pObjFac;
64 : :
65 : : void ImplInitSettings();
66 : :
67 : : sal_Int32 GetTotalHeight() const;
68 : : sal_Int32 impl_getRealPixelWidth() const;
69 : :
70 : : OReportWindow(OReportWindow&);
71 : : void operator =(OReportWindow&);
72 : : protected:
73 : : virtual void DataChanged( const DataChangedEvent& rDCEvt );
74 : : // OPropertyChangeListener
75 : : virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException);
76 : : public:
77 : : OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView);
78 : : virtual ~OReportWindow();
79 : :
80 : : /** late ctor
81 : : */
82 : : void initialize();
83 : : // WINDOW overloads
84 : : virtual void Resize();
85 : :
86 : 0 : inline ODesignView* getReportView() const { return m_pView; }
87 : 0 : inline OScrollWindowHelper* getScrollWindow() const { return m_pParent; }
88 : :
89 : : void SetMode( DlgEdMode m_eMode );
90 : : void SetInsertObj( sal_uInt16 eObj,const ::rtl::OUString& _sShapeType = ::rtl::OUString());
91 : : rtl::OUString GetInsertObjString() const;
92 : : void setGridSnap(sal_Bool bOn);
93 : : void setDragStripes(sal_Bool bOn);
94 : :
95 : : /** copies the current selection in this section
96 : : */
97 : : void Copy();
98 : :
99 : : /** returns if paste is allowed
100 : : *
101 : : * \return <TRUE/> if paste is allowed
102 : : */
103 : : sal_Bool IsPasteAllowed() const;
104 : :
105 : : /** paste a new control in this section
106 : : */
107 : : void Paste();
108 : :
109 : : /** Deletes the current selection in this section
110 : : *
111 : : */
112 : : void Delete();
113 : :
114 : : /** All objects will be marked.
115 : : */
116 : : void SelectAll(const sal_uInt16 _nObjectType);
117 : :
118 : : /** returns <TRUE/> when a object is marked
119 : : */
120 : : sal_Bool HasSelection() const;
121 : :
122 : : Point getThumbPos() const;
123 : :
124 : : /** removes the section at the given position.
125 : : *
126 : : * \param _nPosition Zero based.
127 : : */
128 : : void removeSection(sal_uInt16 _nPosition);
129 : :
130 : : /** adds a new section at position _nPosition.
131 : : If the section is <NULL/> nothing happens.
132 : : If the position is grater than the current elements, the section will be appended.
133 : : */
134 : : void addSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection
135 : : ,const ::rtl::OUString& _sColorEntry
136 : : ,sal_uInt16 _nPosition = USHRT_MAX);
137 : :
138 : : sal_uInt16 getSectionCount() const;
139 : :
140 : : /** turns the grid on or off
141 : : *
142 : : * \param _bVisible
143 : : */
144 : : void toggleGrid(sal_Bool _bVisible);
145 : :
146 : :
147 : : /** shows the ruler
148 : : */
149 : : void showRuler(sal_Bool _bShow);
150 : :
151 : 0 : inline sal_Int32 getRulerHeight() const { return m_aHRuler.GetSizePixel().Height(); }
152 : :
153 : : /** returns the total width of the first section
154 : : */
155 : : sal_Int32 GetTotalWidth() const;
156 : :
157 : : /** calculate the max width of the markers
158 : : *
159 : : * @param _bWithEnd if <TRUE/> the end marker will be used for calculation as well otherwise not.
160 : : * \return the max width
161 : : */
162 : : sal_Int32 getMaxMarkerWidth(sal_Bool _bWithEnd) const;
163 : :
164 : : void ScrollChildren(const Point& _aThumbPos);
165 : :
166 : : void notifySizeChanged();
167 : :
168 : : /** unmark all objects on the views without the given one.
169 : : *
170 : : * @param _pSectionView The view where the objects should not be unmarked.
171 : : */
172 : : void unmarkAllObjects(OSectionView* _pSectionView);
173 : :
174 : : /** triggers the property browser with the report component or section
175 : : @param _xReportComponent
176 : : */
177 : : void showProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xReportComponent);
178 : :
179 : : /** checks if the keycode is known by the child windows
180 : : @param _rCode the keycode
181 : : @return <TRUE/> if the keycode is handled otherwise <FALSE/>
182 : : */
183 : : sal_Bool handleKeyEvent(const KeyEvent& _rEvent);
184 : :
185 : : /** the the section as marked or not marked
186 : : @param _pSectionView the section where to set the marked flag
187 : : @param _bMark the marked flag
188 : : */
189 : : void setMarked(OSectionView* _pSectionView,sal_Bool _bMark);
190 : : void setMarked(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection,sal_Bool _bMark);
191 : : void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape,sal_Bool _bMark);
192 : :
193 : : // IMarkedSection
194 : : ::boost::shared_ptr<OSectionWindow> getMarkedSection(NearSectionAccess nsa = CURRENT) const;
195 : : ::boost::shared_ptr<OSectionWindow> getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
196 : : virtual void markSection(const sal_uInt16 _nPos);
197 : :
198 : :
199 : : /** fills the positions of all collapsed sections.
200 : : *
201 : : * \param _rCollapsedPositions Out parameter which holds afterwards all positions of the collapsed sections.
202 : : */
203 : : void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const;
204 : :
205 : : /** collpase all sections given by their position
206 : : *
207 : : * \param _aCollpasedSections The position of the sections which should be collapsed.
208 : : */
209 : : void collapseSections(const com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections);
210 : :
211 : : /** align all marked objects in all sections
212 : : *
213 : : * \param eHor
214 : : * \param eVert
215 : : * \param bBoundRects
216 : : */
217 : : void alignMarkedObjects(sal_Int32 _nControlModification, bool _bAlignAtSection, bool bBoundRects = false);
218 : :
219 : : sal_uInt32 getMarkedObjectCount() const;
220 : :
221 : : /** zoom the ruler and view windows
222 : : */
223 : : void zoom(const Fraction& _aZoom);
224 : :
225 : : /** fills the vector with all selected control models
226 : : /param _rSelection The vector will be filled and will not be cleared before.
227 : : */
228 : : void fillControlModelSelection(::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const;
229 : :
230 : : /** calculates the zoom factor.
231 : : @param _eType which kind of zoom is needed
232 : : */
233 : : sal_uInt16 getZoomFactor(SvxZoomType _eType) const;
234 : : };
235 : : //==================================================================
236 : : } //rptui
237 : : //==================================================================
238 : : #endif // RPTUI_REPORT_WINDOW_HXX
239 : :
240 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|