LibreOffice Module reportdesign (master)  1
ScrollHelper.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_SCROLLHELPER_HXX
20 #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_SCROLLHELPER_HXX
21 
22 #include <vcl/scrbar.hxx>
23 #include <com/sun/star/report/XSection.hpp>
25 #include "ReportDefines.hxx"
26 #include <cppuhelper/basemutex.hxx>
27 #include <rtl/ref.hxx>
28 #include "MarkedSection.hxx"
29 #include "ReportWindow.hxx"
30 
31 namespace rptui
32 {
33  class ODesignView;
34  class OReportWindow;
35  class OSectionView;
36 
42  , public OScrollWindowHelper_BASE/*TabPage*/
44  , public IMarkedSection
45  {
46  private:
49  VclPtr<ScrollBarBox> m_aCornerWin; // window in the bottom right corner
54  m_pReportDefinitionMultiPlexer; // listener for property changes
55 
56  DECL_LINK( ScrollHdl, ScrollBar*, void);
58  void ImplInitSettings();
59  void impl_initScrollBar( ScrollBar& _rScrollBar ) const;
60 
61  OScrollWindowHelper(OScrollWindowHelper const &) = delete;
62  void operator =(OScrollWindowHelper const &) = delete;
63  protected:
64  virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
65  // window
66  virtual void Resize() override;
67  virtual bool EventNotify( NotifyEvent& rNEvt ) override;
68  // OPropertyChangeListener
69  virtual void _propertyChanged(const css::beans::PropertyChangeEvent& _rEvent) override;
70  public:
71  OScrollWindowHelper( ODesignView* _pReportDesignView);
72  virtual ~OScrollWindowHelper() override;
73  virtual void dispose() override;
74 
77  void initialize();
78 
79  Point getThumbPos() const { return Point(m_aHScroll->GetThumbPos(),m_aVScroll->GetThumbPos())/*m_aScrollOffset*/; }
80  void setTotalSize(sal_Int32 _nWidth, sal_Int32 _nHeight);
81  const Size& getTotalSize() const { return m_aTotalPixelSize; }
84 
85  // forwards
86  void SetMode( DlgEdMode _eMode );
87  void SetInsertObj(SdrObjKind eObj, const OUString& _sShapeType);
88  OUString const & GetInsertObjString() const;
89  void setGridSnap(bool bOn);
90  void setDragStripes(bool bOn);
93  void Copy();
94 
99  bool IsPasteAllowed() const;
100 
103  void Paste();
104 
108  void Delete();
109 
112  void SelectAll(const sal_uInt16 _nObjectType);
113 
116  bool HasSelection() const;
117 
122  void removeSection(sal_uInt16 _nPosition);
123 
128  void addSection(const css::uno::Reference< css::report::XSection >& _xSection
129  ,const OUString& _sColorEntry
130  ,sal_uInt16 _nPosition);
131 
132  sal_uInt16 getSectionCount() const;
133 
138  void toggleGrid(bool _bVisible);
139 
142  void unmarkAllObjects();
143 
146  void showRuler(bool _bShow);
147 
153  sal_Int32 getMaxMarkerWidth() const;
154 
159  bool handleKeyEvent(const KeyEvent& _rEvent);
160 
165  void setMarked(OSectionView const * _pSectionView, bool _bMark);
166  void setMarked(const css::uno::Reference< css::report::XSection>& _xSection, bool _bMark);
167  void setMarked(const css::uno::Sequence< css::uno::Reference< css::report::XReportComponent> >& _xShape, bool _bMark);
168 
169  // IMarkedSection
171  OSectionWindow* getSectionWindow(const css::uno::Reference< css::report::XSection>& _xSection) const;
172  virtual void markSection(const sal_uInt16 _nPos) override;
173 
174 
179  void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const;
180 
185  void collapseSections(const css::uno::Sequence< css::beans::PropertyValue>& _aCollapsedSections);
186 
189  void alignMarkedObjects(ControlModification _nControlModification, bool _bAlignAtSection);
190 
191  sal_uInt32 getMarkedObjectCount() const;
192 
195  void zoom(const Fraction& _aZoom);
196 
200  void fillControlModelSelection(::std::vector< css::uno::Reference< css::uno::XInterface > >& _rSelection) const;
201 
205  sal_uInt16 getZoomFactor(SvxZoomType _eType) const;
206  };
207 }
208 #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_SCROLLHELPER_HXX
209 
210 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void _propertyChanged(const css::beans::PropertyChangeEvent &_rEvent) override
OScrollWindowHelper(OScrollWindowHelper const &)=delete
VclPtr< ScrollBarBox > m_aCornerWin
OSectionWindow * getSectionWindow(const css::uno::Reference< css::report::XSection > &_xSection) const
virtual bool EventNotify(NotifyEvent &rNEvt) override
vcl::Window OScrollWindowHelper_BASE
This class defines the scrollable area of the report design.
void collapseSections(const css::uno::Sequence< css::beans::PropertyValue > &_aCollapsedSections)
collapse all sections given by their position
void toggleGrid(bool _bVisible)
turns the grid on or off
VclPtr< ScrollBar > m_aHScroll
OUString const & GetInsertObjString() const
DECL_LINK(ScrollHdl, ScrollBar *, void)
SdrObjKind
sal_Int32 getMaxMarkerWidth() const
calculate the max width of the markers
void Paste()
paste a new control in this section
void setTotalSize(sal_Int32 _nWidth, sal_Int32 _nHeight)
void SetMode(DlgEdMode _eMode)
sal_uInt16 getZoomFactor(SvxZoomType _eType) const
calculates the zoom factor.
VclPtr< ScrollBar > m_aVScroll
sal_uInt32 getMarkedObjectCount() const
void removeSection(sal_uInt16 _nPosition)
removes the section at the given position.
ControlModification
Definition: RptDef.hxx:48
virtual void markSection(const sal_uInt16 _nPos) override
mark the section on the given position .
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...
void setMarked(OSectionView const *_pSectionView, bool _bMark)
the section as marked or not marked
const Size & getTotalSize() const
bool IsPasteAllowed() const
returns if paste is allowed
void unmarkAllObjects()
unmark all objects on the views.
virtual ~OScrollWindowHelper() override
void impl_initScrollBar(ScrollBar &_rScrollBar) const
VclPtr< ODesignView > m_pParent
OSectionWindow * getMarkedSection(NearSectionAccess nsa=CURRENT) const override
returns the section which is currently marked.
void SelectAll(const sal_uInt16 _nObjectType)
All objects will be marked.
void operator=(OScrollWindowHelper const &)=delete
void alignMarkedObjects(ControlModification _nControlModification, bool _bAlignAtSection)
align all marked objects in all sections
tools::Long GetThumbPos() const
void showRuler(bool _bShow)
shows or hides the ruler.
virtual void dispose() override
bool handleKeyEvent(const KeyEvent &_rEvent)
checks if the keycode is known by the child windows
VclPtr< OReportWindow > m_aReportWindow
::rtl::Reference< comphelper::OPropertyChangeMultiplexer > m_pReportDefinitionMultiPlexer
void Copy()
copies the current selection in this section
sal_uInt16 getSectionCount() const
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
SvxZoomType
void SetInsertObj(SdrObjKind eObj, const OUString &_sShapeType)
void zoom(const Fraction &_aZoom)
zoom the ruler and view windows
void fillCollapsedSections(::std::vector< sal_uInt16 > &_rCollapsedPositions) const
fills the positions of all collapsed sections.
void addSection(const css::uno::Reference< css::report::XSection > &_xSection, const OUString &_sColorEntry, sal_uInt16 _nPosition)
adds a new section at position _nPosition.
virtual void Resize() override
void Delete()
Deletes the current selection in this section.
bool HasSelection() const
returns when an object is marked
void initialize()
late ctor