LibreOffice Module reportdesign (master)  1
ReportWindow.hxx
Go to the documentation of this file.
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 <o3tl/deleter.hxx>
25 #include <svtools/ruler.hxx>
26 #include <sfx2/zoomitem.hxx>
27 
28 #include <memory>
29 #include <vector>
31 
32 #include "MarkedSection.hxx"
33 #include "ViewsWindow.hxx"
34 
35 namespace rptui
36 {
37  class ODesignView;
38  class OScrollWindowHelper;
39  class OSectionView;
40  class DlgEdFactory;
41 
42  class OReportWindow : public vcl::Window
43  , public IMarkedSection
44  , public ::cppu::BaseMutex
46  {
52  std::unique_ptr<DlgEdFactory, o3tl::default_delete<DlgEdFactory>> m_pObjFac;
53 
54  void ImplInitSettings();
55 
56  sal_Int32 GetTotalHeight() const;
57  sal_Int32 impl_getRealPixelWidth() const;
58 
59  OReportWindow(OReportWindow const &) = delete;
60  void operator =(OReportWindow const &) = delete;
61  protected:
62  virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
63  // OPropertyChangeListener
64  virtual void _propertyChanged(const css::beans::PropertyChangeEvent& _rEvent) override;
65  public:
67  virtual ~OReportWindow() override;
68  virtual void dispose() override;
69 
70  // Window overrides
71  virtual void Resize() override;
72 
73  ODesignView* getReportView() const { return m_pView; }
75 
76  void SetMode( DlgEdMode m_eMode );
77  void SetInsertObj(SdrObjKind eObj, const OUString& _sShapeType);
78  OUString const & GetInsertObjString() const;
79  void setGridSnap(bool bOn);
80  void setDragStripes(bool bOn);
81 
84  void Copy();
85 
90  bool IsPasteAllowed() const;
91 
94  void Paste();
95 
99  void Delete();
100 
103  void SelectAll(const sal_uInt16 _nObjectType);
104 
107  bool HasSelection() const;
108 
109  Point getThumbPos() const;
110 
115  void removeSection(sal_uInt16 _nPosition);
116 
121  void addSection(const css::uno::Reference< css::report::XSection >& _xSection
122  ,const OUString& _sColorEntry
123  ,sal_uInt16 _nPosition);
124 
125  sal_uInt16 getSectionCount() const;
126 
131  void toggleGrid(bool _bVisible);
132 
133 
136  void showRuler(bool _bShow);
137 
138  sal_Int32 getRulerHeight() const { return m_aHRuler->GetSizePixel().Height(); }
139 
142  sal_Int32 GetTotalWidth() const;
143 
149  sal_Int32 getMaxMarkerWidth() const;
150 
151  void ScrollChildren(const Point& _aThumbPos);
152 
153  void notifySizeChanged();
154 
157  void unmarkAllObjects();
158 
162  void showProperties( const css::uno::Reference< css::report::XSection>& _xReportComponent);
163 
168  bool handleKeyEvent(const KeyEvent& _rEvent);
169 
174  void setMarked(OSectionView const * _pSectionView, bool _bMark);
175  void setMarked(const css::uno::Reference< css::report::XSection>& _xSection, bool _bMark);
176  void setMarked(const css::uno::Sequence< css::uno::Reference< css::report::XReportComponent> >& _xShape, bool _bMark);
177 
178  // IMarkedSection
180  OSectionWindow* getSectionWindow(const css::uno::Reference< css::report::XSection>& _xSection) const;
181  virtual void markSection(const sal_uInt16 _nPos) override;
182 
183 
188  void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const;
189 
194  void collapseSections(const css::uno::Sequence< css::beans::PropertyValue>& _aCollapsedSections);
195 
198  void alignMarkedObjects(ControlModification _nControlModification, bool _bAlignAtSection);
199 
200  sal_uInt32 getMarkedObjectCount() const;
201 
204  void zoom(const Fraction& _aZoom);
205 
209  void fillControlModelSelection(::std::vector< css::uno::Reference< css::uno::XInterface > >& _rSelection) const;
210 
214  sal_uInt16 getZoomFactor(SvxZoomType _eType) const;
215  };
216 
217 } //rptui
218 
219 #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_REPORTWINDOW_HXX
220 
221 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OUString const & GetInsertObjString() const
void fillControlModelSelection(::std::vector< css::uno::Reference< css::uno::XInterface > > &_rSelection) const
fills the vector with all selected control models /param _rSelection The vector will be filled and wi...
bool IsPasteAllowed() const
returns if paste is allowed
virtual ~OReportWindow() override
void fillCollapsedSections(::std::vector< sal_uInt16 > &_rCollapsedPositions) const
fills the positions of all collapsed sections.
void collapseSections(const css::uno::Sequence< css::beans::PropertyValue > &_aCollapsedSections)
collapse all sections given by their position
sal_Int32 GetTotalWidth() const
returns the total width of the first section
void zoom(const Fraction &_aZoom)
zoom the ruler and view windows
void Delete()
Deletes the current selection in this section.
void SelectAll(const sal_uInt16 _nObjectType)
All objects will be marked.
void setGridSnap(bool bOn)
SdrObjKind
sal_Int32 getMaxMarkerWidth() const
calculate the max width of the markers The end marker will not be used for calculation.
OSectionWindow * getSectionWindow(const css::uno::Reference< css::report::XSection > &_xSection) const
VclPtr< OScrollWindowHelper > m_pParent
ControlModification
Definition: RptDef.hxx:48
rtl::Reference< comphelper::OPropertyChangeMultiplexer > m_pReportListener
sal_uInt16 getSectionCount() const
VclPtr< Ruler > m_aHRuler
void showRuler(bool _bShow)
shows the ruler
void setMarked(OSectionView const *_pSectionView, bool _bMark)
the section as marked or not marked
void ScrollChildren(const Point &_aThumbPos)
OScrollWindowHelper * getScrollWindow() const
sal_Int32 getRulerHeight() const
bool HasSelection() const
returns when an object is marked
void toggleGrid(bool _bVisible)
turns the grid on or off
virtual void _propertyChanged(const css::beans::PropertyChangeEvent &_rEvent) override
OReportWindow(OReportWindow const &)=delete
VclPtr< OViewsWindow > m_aViewsWindow
VclPtr< ODesignView > m_pView
sal_uInt16 getZoomFactor(SvxZoomType _eType) const
calculates the zoom factor.
std::unique_ptr< DlgEdFactory, o3tl::default_delete< DlgEdFactory > > m_pObjFac
void alignMarkedObjects(ControlModification _nControlModification, bool _bAlignAtSection)
align all marked objects in all sections
sal_Int32 GetTotalHeight() const
void Paste()
paste a new control in this section
void setDragStripes(bool bOn)
void Copy()
copies the current selection in this section
void operator=(OReportWindow const &)=delete
sal_Int32 impl_getRealPixelWidth() const
void unmarkAllObjects()
unmark all objects on the views without the given one.
ODesignView * getReportView() const
void SetInsertObj(SdrObjKind eObj, const OUString &_sShapeType)
Point getThumbPos() const
bool handleKeyEvent(const KeyEvent &_rEvent)
checks if the keycode is known by the child windows
void showProperties(const css::uno::Reference< css::report::XSection > &_xReportComponent)
triggers the property browser with the report component or section
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
sal_uInt32 getMarkedObjectCount() const
void addSection(const css::uno::Reference< css::report::XSection > &_xSection, const OUString &_sColorEntry, sal_uInt16 _nPosition)
adds a new section at position _nPosition.
OSectionWindow * getMarkedSection(NearSectionAccess nsa=CURRENT) const override
returns the section which is currently marked.
virtual void Resize() override
SvxZoomType
virtual void dispose() override
virtual void markSection(const sal_uInt16 _nPos) override
mark the section on the given position .
void SetMode(DlgEdMode m_eMode)
void removeSection(sal_uInt16 _nPosition)
removes the section at the given position.