LibreOffice Module reportdesign (master)  1
DesignView.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_DESIGNVIEW_HXX
20 #define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DESIGNVIEW_HXX
21 
22 #include <dbaccess/dataview.hxx>
23 #include <com/sun/star/report/XSection.hpp>
24 #include <com/sun/star/report/XReportComponent.hpp>
25 #include <tools/link.hxx>
26 #include <tools/gen.hxx>
27 #include <vcl/timer.hxx>
28 #include <vcl/idle.hxx>
29 #include <svl/SfxBroadcaster.hxx>
30 #include "ReportDefines.hxx"
31 #include <vcl/splitwin.hxx>
32 #include "MarkedSection.hxx"
33 #include "ScrollHelper.hxx"
34 
35 class KeyEvent;
36 class MouseEvent;
37 class Timer;
38 namespace vcl { class Window; }
39 
40 namespace rptui
41 {
42  class OSectionView;
43  class OReportController;
44  class PropBrw;
45  class OAddFieldWindow;
46  class ONavigator;
47 
48 
50  {
51  private:
53 
54  css::uno::Reference< css::uno::XInterface> m_xReportComponent;
59  std::shared_ptr<OAddFieldWindow> m_xAddField;
61  std::shared_ptr<ONavigator> m_xReportExplorer;
67  bool m_bDeleted;
68 
69 
70  DECL_LINK(MarkTimeout, Timer *, void);
71  DECL_LINK( SplitHdl, SplitWindow*, void );
72 
73  void ImplInitSettings();
74 
75  ODesignView(ODesignView const &) = delete;
76  void operator =(ODesignView const &) = delete;
77  protected:
78  // return the Rectangle where I can paint myself
79  virtual void resizeDocumentView(tools::Rectangle& rRect) override;
80  // return the Rectangle where I can paint myself
81  virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
82 
83  public:
84  ODesignView(vcl::Window* pParent,
85  const css::uno::Reference< css::uno::XComponentContext >&,
86  OReportController& _rController);
87  virtual ~ODesignView() override;
88  virtual void dispose() override;
89 
90  // Window overrides
91  virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
92  virtual bool PreNotify( NotifyEvent& rNEvt ) override;
93  virtual void GetFocus() override;
94 
95  virtual void initialize() override;
96 
98 
99  void SetMode( DlgEdMode m_eMode );
100  void SetInsertObj( SdrObjKind eObj,const OUString& _sShapeType = OUString());
101  SdrObjKind GetInsertObj() const { return m_eActObj;}
102  OUString const & GetInsertObjString() const;
103  DlgEdMode GetMode() const { return m_eMode; }
104 
107  void Cut();
108 
111  void Copy();
112 
117  bool IsPasteAllowed() const;
118 
121  void Paste();
122 
126  void Delete();
127 
130  void alignMarkedObjects(ControlModification _nControlModification, bool _bAlignAtSection);
131 
134  void SelectAll(const sal_uInt16 _nObjectType);
135 
137  bool HasSelection() const;
138 
140 
141  sal_uInt16 getSectionCount() const;
142 
147  void removeSection(sal_uInt16 _nPosition);
148 
153  void addSection(const css::uno::Reference< css::report::XSection >& _xSection
154  ,const OUString& _sColorEntry
155  ,sal_uInt16 _nPosition = USHRT_MAX);
156 
157  const Size& getGridSizeCoarse() const { return m_aGridSizeCoarse; }
158  const Size& getGridSizeFine() const { return m_aGridSizeFine; }
159  void setGridSnap(bool bOn);
160  void setDragStripes(bool bOn);
165  void toggleGrid(bool _bGridVisible);
166 
167  void togglePropertyBrowser(bool _bToggleOn);
168 
169  bool isAddFieldVisible() const;
170  void toggleAddField();
171 
172  bool isReportExplorerVisible() const;
173  void toggleReportExplorer();
174 
177  void showRuler(bool _bShow);
178 
181  void unmarkAllObjects();
182 
186  void showProperties( const css::uno::Reference< css::uno::XInterface>& _xReportComponent);
187  css::uno::Any getCurrentlyShownProperty() const;
188 
191  css::uno::Reference< css::report::XSection > getCurrentSection() const;
192 
195  css::uno::Reference< css::report::XReportComponent > getCurrentControlModel() const;
196 
197  // IMarkedSection
199  OSectionWindow* getSectionWindow(const css::uno::Reference< css::report::XSection>& _xSection) const;
200  virtual void markSection(const sal_uInt16 _nPos) override;
201 
206  void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const;
207 
212  void collapseSections(const css::uno::Sequence< css::beans::PropertyValue>& _aCollapsedSections);
213 
214  OUString getCurrentPage() const;
215  void setCurrentPage(const OUString& _sLastActivePage);
216 
221  bool handleKeyEvent(const KeyEvent& _rEvent);
222 
227  void setMarked(const css::uno::Reference< css::report::XSection>& _xSection,bool _bMark);
228  void setMarked(const css::uno::Sequence< css::uno::Reference< css::report::XReportComponent> >& _xShape,bool _bMark);
229 
234  bool isHandleEvent() const;
235 
236  sal_uInt32 getMarkedObjectCount() const;
237 
240  void zoom(const Fraction& _aZoom);
241 
245  void fillControlModelSelection(::std::vector< css::uno::Reference< css::uno::XInterface > >& _rSelection) const;
246 
250  sal_uInt16 getZoomFactor(SvxZoomType _eType) const;
251  };
252 
253 } //rptui
254 
255 #endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_DESIGNVIEW_HXX
256 
257 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void setGridSnap(bool bOn)
Definition: DesignView.cxx:652
void showProperties(const css::uno::Reference< css::uno::XInterface > &_xReportComponent)
triggers the property browser with the section
Definition: DesignView.cxx:453
virtual void markSection(const sal_uInt16 _nPos) override
mark the section on the given position .
Definition: DesignView.cxx:554
css::uno::Reference< css::report::XReportComponent > getCurrentControlModel() const
returns the current control report model or
Definition: DesignView.cxx:534
void SetMode(DlgEdMode m_eMode)
Definition: DesignView.cxx:284
css::uno::Reference< css::uno::XInterface > m_xReportComponent
Definition: DesignView.hxx:54
void setDragStripes(bool bOn)
Definition: DesignView.cxx:658
void setMarked(const css::uno::Reference< css::report::XSection > &_xSection, bool _bMark)
set the section as marked or not marked
void toggleGrid(bool _bGridVisible)
turns the grid on or off
Definition: DesignView.cxx:356
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...
Definition: DesignView.cxx:647
VclPtr< OScrollWindowHelper > m_aScrollWindow
Definition: DesignView.hxx:56
bool handleKeyEvent(const KeyEvent &_rEvent)
checks if the keycode is known by the child windows
Definition: DesignView.cxx:585
OReportController & m_rReportController
Definition: DesignView.hxx:55
void collapseSections(const css::uno::Sequence< css::beans::PropertyValue > &_aCollapsedSections)
collapse all sections given by their position
Definition: DesignView.cxx:564
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
Definition: DesignView.cxx:168
OUString getCurrentPage() const
Definition: DesignView.cxx:569
SdrObjKind
SdrObjKind m_eActObj
Definition: DesignView.hxx:64
ODesignView(ODesignView const &)=delete
virtual ~ODesignView() override
Definition: DesignView.cxx:118
css::uno::Any getCurrentlyShownProperty() const
Definition: DesignView.cxx:624
void removeSection(sal_uInt16 _nPosition)
removes the section at the given position.
Definition: DesignView.cxx:371
DECL_LINK(MarkTimeout, Timer *, void)
virtual void initialize() override
Definition: DesignView.cxx:161
sal_uInt32 getMarkedObjectCount() const
Definition: DesignView.cxx:668
ControlModification
Definition: RptDef.hxx:48
sal_uInt16 getSectionCount() const
Definition: DesignView.cxx:361
void SetInsertObj(SdrObjKind eObj, const OUString &_sShapeType=OUString())
Definition: DesignView.cxx:293
OSectionView * m_pCurrentView
Definition: DesignView.hxx:60
void Copy()
copies the current selection in this section
Definition: DesignView.cxx:312
const Size & getGridSizeFine() const
Definition: DesignView.hxx:158
css::uno::Reference< css::report::XSection > getCurrentSection() const
returns the current section or the detail section if no section was selected previously ...
Definition: DesignView.cxx:525
bool isAddFieldVisible() const
Definition: DesignView.cxx:487
void SelectAll(const sal_uInt16 _nObjectType)
All objects will be marked.
Definition: DesignView.cxx:414
OSectionWindow * getMarkedSection(NearSectionAccess nsa=CURRENT) const override
returns the section which is currently marked.
Definition: DesignView.cxx:544
virtual bool PreNotify(NotifyEvent &rNEvt) override
Definition: DesignView.cxx:180
void UpdatePropertyBrowserDelayed(OSectionView &_rView)
Definition: DesignView.cxx:340
std::shared_ptr< ONavigator > m_xReportExplorer
Definition: DesignView.hxx:61
virtual void GetFocus() override
Definition: DesignView.cxx:381
OUString const & GetInsertObjString() const
Definition: DesignView.cxx:299
void addSection(const css::uno::Reference< css::report::XSection > &_xSection, const OUString &_sColorEntry, sal_uInt16 _nPosition=USHRT_MAX)
adds a new section at position _nPosition.
Definition: DesignView.cxx:376
void Cut()
cuts the current selection in this section
Definition: DesignView.cxx:305
void fillCollapsedSections(::std::vector< sal_uInt16 > &_rCollapsedPositions) const
fills the positions of all collapsed sections.
Definition: DesignView.cxx:559
bool HasSelection() const
checks if a selection exists
Definition: DesignView.cxx:328
void Paste()
paste a new control in this section
Definition: DesignView.cxx:318
DlgEdMode GetMode() const
Definition: DesignView.hxx:103
virtual void resizeDocumentView(tools::Rectangle &rRect) override
Definition: DesignView.cxx:213
void showRuler(bool _bShow)
shows or hides the ruler.
Definition: DesignView.cxx:366
void operator=(ODesignView const &)=delete
const Size & getGridSizeCoarse() const
Definition: DesignView.hxx:157
VclPtr< vcl::Window > m_pTaskPane
Definition: DesignView.hxx:57
virtual void dispose() override
Definition: DesignView.cxx:123
void setCurrentPage(const OUString &_sLastActivePage)
Definition: DesignView.cxx:574
void unmarkAllObjects()
unmark all objects on the views.
Definition: DesignView.cxx:419
VclPtr< SplitWindow > m_aSplitWin
Definition: DesignView.hxx:52
void zoom(const Fraction &_aZoom)
zoom the ruler and view windows
Definition: DesignView.cxx:673
std::shared_ptr< OAddFieldWindow > m_xAddField
Definition: DesignView.hxx:59
void toggleReportExplorer()
Definition: DesignView.cxx:470
bool IsPasteAllowed() const
returns if paste is allowed
Definition: DesignView.cxx:334
void Delete()
Deletes the current selection in this section.
Definition: DesignView.cxx:323
SdrObjKind GetInsertObj() const
Definition: DesignView.hxx:101
SvxZoomType
bool isHandleEvent() const
returns if the view handles the event by itself
Definition: DesignView.cxx:663
OSectionWindow * getSectionWindow(const css::uno::Reference< css::report::XSection > &_xSection) const
Definition: DesignView.cxx:549
VclPtr< PropBrw > m_pPropWin
Definition: DesignView.hxx:58
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
Definition: DesignView.cxx:614
bool isReportExplorerVisible() const
Definition: DesignView.cxx:465
void alignMarkedObjects(ControlModification _nControlModification, bool _bAlignAtSection)
align all marked objects in all sections
Definition: DesignView.cxx:580
OReportController & getController() const
Definition: DesignView.hxx:97
void togglePropertyBrowser(bool _bToggleOn)
Definition: DesignView.cxx:424
sal_uInt16 getZoomFactor(SvxZoomType _eType) const
calculates the zoom factor.
Definition: DesignView.cxx:678