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