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