Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #ifndef INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTWINDOW_HXX
20 : #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTWINDOW_HXX
21 :
22 : #include <com/sun/star/report/XSection.hpp>
23 : #include "ReportDefines.hxx"
24 : #include "StartMarker.hxx"
25 : #include <svtools/ruler.hxx>
26 : #include <svx/svdedtv.hxx>
27 : #include <sfx2/zoomitem.hxx>
28 :
29 : #include <vector>
30 : #include <boost/shared_ptr.hpp>
31 : #include <comphelper/propmultiplex.hxx>
32 :
33 : #include "MarkedSection.hxx"
34 : #include "ViewsWindow.hxx"
35 :
36 : namespace rptui
37 : {
38 : class ODesignView;
39 : class OScrollWindowHelper;
40 : class OSectionView;
41 : class DlgEdFactory;
42 :
43 : class OReportWindow : public vcl::Window
44 : , public IMarkedSection
45 : , public ::cppu::BaseMutex
46 : , public ::comphelper::OPropertyChangeListener
47 : {
48 : VclPtr<Ruler> m_aHRuler;
49 : VclPtr<ODesignView> m_pView;
50 : VclPtr<OScrollWindowHelper> m_pParent;
51 : VclPtr<OViewsWindow> m_aViewsWindow;
52 : ::rtl::Reference< comphelper::OPropertyChangeMultiplexer> m_pReportListener;
53 : ::std::unique_ptr<DlgEdFactory>
54 : m_pObjFac;
55 :
56 : void ImplInitSettings();
57 :
58 : sal_Int32 GetTotalHeight() const;
59 : sal_Int32 impl_getRealPixelWidth() const;
60 :
61 : OReportWindow(OReportWindow&) SAL_DELETED_FUNCTION;
62 : void operator =(OReportWindow&) SAL_DELETED_FUNCTION;
63 : protected:
64 : virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE;
65 : // OPropertyChangeListener
66 : virtual void _propertyChanged(const ::com::sun::star::beans::PropertyChangeEvent& _rEvent) throw( ::com::sun::star::uno::RuntimeException) SAL_OVERRIDE;
67 : public:
68 : OReportWindow(OScrollWindowHelper* _pParent,ODesignView* _pView);
69 : virtual ~OReportWindow();
70 : virtual void dispose() SAL_OVERRIDE;
71 :
72 : // Window overrides
73 : virtual void Resize() SAL_OVERRIDE;
74 :
75 0 : inline ODesignView* getReportView() const { return m_pView; }
76 0 : inline OScrollWindowHelper* getScrollWindow() const { return m_pParent; }
77 :
78 : void SetMode( DlgEdMode m_eMode );
79 : void SetInsertObj( sal_uInt16 eObj,const OUString& _sShapeType = OUString());
80 : OUString GetInsertObjString() const;
81 : void setGridSnap(bool bOn);
82 : void setDragStripes(bool bOn);
83 :
84 : /** copies the current selection in this section
85 : */
86 : void Copy();
87 :
88 : /** returns if paste is allowed
89 : *
90 : * \return <TRUE/> if paste is allowed
91 : */
92 : bool IsPasteAllowed() const;
93 :
94 : /** paste a new control in this section
95 : */
96 : void Paste();
97 :
98 : /** Deletes the current selection in this section
99 : *
100 : */
101 : void Delete();
102 :
103 : /** All objects will be marked.
104 : */
105 : void SelectAll(const sal_uInt16 _nObjectType);
106 :
107 : /** returns <TRUE/> when a object is marked
108 : */
109 : bool HasSelection() const;
110 :
111 : Point getThumbPos() const;
112 :
113 : /** removes the section at the given position.
114 : *
115 : * \param _nPosition Zero based.
116 : */
117 : void removeSection(sal_uInt16 _nPosition);
118 :
119 : /** adds a new section at position _nPosition.
120 : If the section is <NULL/> nothing happens.
121 : If the position is grater than the current elements, the section will be appended.
122 : */
123 : void addSection(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection >& _xSection
124 : ,const OUString& _sColorEntry
125 : ,sal_uInt16 _nPosition = USHRT_MAX);
126 :
127 : sal_uInt16 getSectionCount() const;
128 :
129 : /** turns the grid on or off
130 : *
131 : * \param _bVisible
132 : */
133 : void toggleGrid(bool _bVisible);
134 :
135 :
136 : /** shows the ruler
137 : */
138 : void showRuler(bool _bShow);
139 :
140 0 : inline sal_Int32 getRulerHeight() const { return m_aHRuler->GetSizePixel().Height(); }
141 :
142 : /** returns the total width of the first section
143 : */
144 : sal_Int32 GetTotalWidth() const;
145 :
146 : /** calculate the max width of the markers
147 : *
148 : * @param _bWithEnd if <TRUE/> the end marker will be used for calculation as well otherwise not.
149 : * \return the max width
150 : */
151 : sal_Int32 getMaxMarkerWidth(bool _bWithEnd) const;
152 :
153 : void ScrollChildren(const Point& _aThumbPos);
154 :
155 : void notifySizeChanged();
156 :
157 : /** unmark all objects on the views without the given one.
158 : *
159 : * @param _pSectionView The view where the objects should not be unmarked.
160 : */
161 : void unmarkAllObjects(OSectionView* _pSectionView);
162 :
163 : /** triggers the property browser with the report component or section
164 : @param _xReportComponent
165 : */
166 : void showProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xReportComponent);
167 :
168 : /** checks if the keycode is known by the child windows
169 : @param _rCode the keycode
170 : @return <TRUE/> if the keycode is handled otherwise <FALSE/>
171 : */
172 : bool handleKeyEvent(const KeyEvent& _rEvent);
173 :
174 : /** the section as marked or not marked
175 : @param _pSectionView the section where to set the marked flag
176 : @param _bMark the marked flag
177 : */
178 : void setMarked(OSectionView* _pSectionView, bool _bMark);
179 : void setMarked(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection, bool _bMark);
180 : void setMarked(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::report::XReportComponent> >& _xShape, bool _bMark);
181 :
182 : // IMarkedSection
183 : OSectionWindow* getMarkedSection(NearSectionAccess nsa = CURRENT) const SAL_OVERRIDE;
184 : OSectionWindow* getSectionWindow(const ::com::sun::star::uno::Reference< ::com::sun::star::report::XSection>& _xSection) const;
185 : virtual void markSection(const sal_uInt16 _nPos) SAL_OVERRIDE;
186 :
187 :
188 : /** fills the positions of all collapsed sections.
189 : *
190 : * \param _rCollapsedPositions Out parameter which holds afterwards all positions of the collapsed sections.
191 : */
192 : void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const;
193 :
194 : /** collpase all sections given by their position
195 : *
196 : * \param _aCollpasedSections The position of the sections which should be collapsed.
197 : */
198 : void collapseSections(const com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue>& _aCollpasedSections);
199 :
200 : /** align all marked objects in all sections
201 : *
202 : * \param eHor
203 : * \param eVert
204 : * \param bBoundRects
205 : */
206 : void alignMarkedObjects(sal_Int32 _nControlModification, bool _bAlignAtSection, bool bBoundRects = false);
207 :
208 : sal_uInt32 getMarkedObjectCount() const;
209 :
210 : /** zoom the ruler and view windows
211 : */
212 : void zoom(const Fraction& _aZoom);
213 :
214 : /** fills the vector with all selected control models
215 : /param _rSelection The vector will be filled and will not be cleared before.
216 : */
217 : void fillControlModelSelection(::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > >& _rSelection) const;
218 :
219 : /** calculates the zoom factor.
220 : @param _eType which kind of zoom is needed
221 : */
222 : sal_uInt16 getZoomFactor(SvxZoomType _eType) const;
223 : };
224 :
225 : } //rptui
226 :
227 : #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTWINDOW_HXX
228 :
229 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|