LibreOffice Module reportdesign (master) 1
ViewsWindow.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_VIEWSWINDOW_HXX
20#define INCLUDED_REPORTDESIGN_SOURCE_UI_INC_VIEWSWINDOW_HXX
21
22#include <com/sun/star/report/XSection.hpp>
23#include <vcl/window.hxx>
24#include <svtools/colorcfg.hxx>
25#include "ReportDefines.hxx"
26#include "SectionView.hxx"
27#include <unotools/options.hxx>
28#include <vector>
29
30#include "MarkedSection.hxx"
31#include "SectionWindow.hxx"
32
33class SdrHdl;
34
35namespace rptui
36{
37 class OReportWindow;
38 class OReportSection;
39 class OSectionView;
40 enum class ControlModification;
41
43 {
47 RectangleLess(CompareMode _eCompareMode,const Point& _rRefPoint ) : m_eCompareMode(_eCompareMode),m_aRefPoint(_rRefPoint){}
48 bool operator() (const tools::Rectangle& lhs, const tools::Rectangle& rhs) const
49 {
50 switch(m_eCompareMode)
51 {
52 case POS_LEFT:
53 return lhs.Left() < rhs.Left();
54 case POS_RIGHT:
55 return lhs.Right() >= rhs.Right();
56 case POS_UPPER:
57 return lhs.Top() < rhs.Top();
58 case POS_DOWN:
59 return lhs.Bottom() >= rhs.Bottom();
61 return std::abs(m_aRefPoint.X() - lhs.Center().X()) < std::abs(m_aRefPoint.X() - rhs.Center().X());
63 return std::abs(lhs.Center().Y() - m_aRefPoint.Y()) < std::abs(rhs.Center().Y() - m_aRefPoint.Y());
64 }
65 return false;
66 }
67 };
68
71 , public IMarkedSection
72 {
73 typedef ::std::multimap<tools::Rectangle,::std::pair<SdrObject*,OSectionView*>,RectangleLess> TRectangleMap;
74 public:
75 typedef ::std::vector< VclPtr<OSectionWindow> > TSectionsMap;
76
77 private:
81 OUString m_sShapeType;
83
84 void ImplInitSettings();
87 TSectionsMap::iterator getIteratorAtPos(sal_uInt16 _nPos);
89 static void collectBoundResizeRect(const TRectangleMap& _rSortRectangles, ControlModification _nControlModification,bool _bAlignAtSection,tools::Rectangle& _rBound,tools::Rectangle& _rResize);
90 void impl_resizeSectionWindow(OSectionWindow& _rSectionWindow,Point& _rStartPoint,bool _bSet);
91
92 OViewsWindow(OViewsWindow const &) = delete;
93 void operator =(OViewsWindow const &) = delete;
94 protected:
95 virtual void DataChanged( const DataChangedEvent& rDCEvt ) override;
96 // Window overrides
97 virtual void MouseButtonDown( const MouseEvent& rMEvt ) override;
98 virtual void MouseButtonUp( const MouseEvent& rMEvt ) override;
99
100 virtual void Paint( vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& rRect ) override;
102 public:
104 OReportWindow* _pReportWindow);
105 virtual ~OViewsWindow() override;
106 virtual void dispose() override;
107
108 // Window overrides
109 virtual void Resize() override;
110
111 void resize(const OSectionWindow& _rSectionWindow);
112
113 OReportWindow* getView() const { return m_pParent; }
114
119 void removeSection(sal_uInt16 _nPosition);
120
125 void addSection(const css::uno::Reference< css::report::XSection >& _xSection
126 ,const OUString& _sColorEntry
127 ,sal_uInt16 _nPosition);
128
129 sal_uInt16 getSectionCount() const;
135 OSectionWindow* getSectionWindow(const sal_uInt16 _nPos) const;
136
141 void toggleGrid(bool _bVisible);
142 void setGridSnap(bool bOn);
143 void setDragStripes(bool bOn);
144
147 sal_Int32 getTotalHeight() const;
148
149 bool empty() const { return m_aSections.empty(); }
150 void SetMode( DlgEdMode m_eMode );
151 void SetInsertObj( SdrObjKind eObj,const OUString& _sShapeType);
152 const OUString& GetInsertObjString() const { return m_sShapeType;}
155 void Copy();
156
161 bool IsPasteAllowed() const;
162
165 void Paste();
166
170 void Delete();
171
174 void SelectAll(const SdrObjKind _nObjectType);
175
178 bool HasSelection() const;
179
184 void unmarkAllObjects(OSectionView const * _pSectionView);
185
189 OSectionWindow* getSectionWindow(const css::uno::Reference< css::report::XSection>& _xSection) const;
190
195 bool handleKeyEvent(const KeyEvent& _rEvent);
196
201 void setMarked(OSectionView const * _pSectionView, bool _bMark);
202 void setMarked(const css::uno::Reference< css::report::XSection>& _xSection, bool _bMark);
203 void setMarked(const css::uno::Sequence< css::uno::Reference< css::report::XReportComponent> >& _xShape, bool _bMark);
204
205 // IMarkedSection
207 virtual void markSection(const sal_uInt16 _nPos) override;
208
211 void alignMarkedObjects(ControlModification _nControlModification, bool _bAlignAtSection);
212
216 void createDefault();
217
220 void showRuler(bool _bShow);
221
226 const OUString& getShapeType() const { return m_sShapeType; }
227
230 sal_uInt16 getPosition(const OSectionWindow* _pSectionWindow) const;
231
235 void BrkAction();
236 void BegMarkObj(const Point& _aPnt,const OSectionView* _pSection);
237
238 private:
242 ::std::vector<SdrObject*> m_aBegDragTempList;
243 public:
244 void BegDragObj(const Point& _aPnt, SdrHdl* _pHdl,const OSectionView* _pSection);
245 void EndDragObj(bool _bDragIntoNewSection,const OSectionView* _pSection,const Point& _aPnt);
246
247 void EndAction();
249 bool IsAction() const;
250 bool IsDragObj() const;
251 void handleKey(const vcl::KeyCode& _rCode);
252 void stopScrollTimer();
253
261
262 void MovAction(const Point& rPnt,const OSectionView* _pSection, bool _bControlKeySet);
263
264 sal_uInt32 getMarkedObjectCount() const;
265
270 void fillCollapsedSections(::std::vector<sal_uInt16>& _rCollapsedPositions) const;
271
276 void collapseSections(const css::uno::Sequence< css::beans::PropertyValue>& _aCollapsedSections);
277
280 void zoom(const Fraction& _aZoom);
281
282 void scrollChildren(const Point& _aThumbPos);
283
287 void fillControlModelSelection(::std::vector< css::uno::Reference< css::uno::XInterface > >& _rSelection) const;
288 };
289
290} // rptui
291
292#endif // INCLUDED_REPORTDESIGN_SOURCE_UI_INC_VIEWSWINDOW_HXX
293
294/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
constexpr tools::Long Y() const
constexpr tools::Long X() const
const OUString & GetInsertObjString() const
void Delete()
Deletes the current selection in this section.
bool HasSelection() const
returns <TRUE> when an object is marked
void createDefault()
creates a default object
void showRuler(bool _bShow)
shows or hides the ruler.
void BegDragObj(const Point &_aPnt, SdrHdl *_pHdl, const OSectionView *_pSection)
void resize(const OSectionWindow &_rSectionWindow)
void collectRectangles(TRectangleMap &_rMap)
const OUString & getShapeType() const
returns the currently set shape type.
void setMarked(OSectionView const *_pSectionView, bool _bMark)
the section as marked or not marked
void SetMode(DlgEdMode m_eMode)
void toggleGrid(bool _bVisible)
turns the grid on or off
svtools::ColorConfig m_aColorConfig
Definition: ViewsWindow.hxx:79
void setMarked(const css::uno::Reference< css::report::XSection > &_xSection, bool _bMark)
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.
void Paste()
paste a new control in this section
void zoom(const Fraction &_aZoom)
zoom the ruler and view windows
void setDragStripes(bool bOn)
sal_uInt32 getMarkedObjectCount() const
TSectionsMap::iterator getIteratorAtPos(sal_uInt16 _nPos)
returns the iterator at pos _nPos or the end()
OSectionWindow * getSectionWindow(const sal_uInt16 _nPos) const
return the section at the given position
OViewsWindow(OViewsWindow const &)=delete
sal_Int32 getTotalHeight() const
returns the total accumulated height of all sections until _pSection is reached
virtual void MouseButtonUp(const MouseEvent &rMEvt) override
void BegDragObj_createInvisibleObjectAtPosition(const tools::Rectangle &_aRect, const OSectionView &_rSection)
bool IsPasteAllowed() const
returns if paste is allowed
void impl_resizeSectionWindow(OSectionWindow &_rSectionWindow, Point &_rStartPoint, bool _bSet)
virtual ~OViewsWindow() override
void removeSection(sal_uInt16 _nPosition)
removes the section at the given position.
virtual void Paint(vcl::RenderContext &, const tools::Rectangle &rRect) override
OSectionWindow * getMarkedSection(NearSectionAccess nsa=CURRENT) const override
returns the section which is currently marked.
virtual void ConfigurationChanged(utl::ConfigurationBroadcaster *, ConfigurationHints) override
virtual void markSection(const sal_uInt16 _nPos) override
mark the section on the given position .
void scrollChildren(const Point &_aThumbPos)
VclPtr< OReportWindow > m_pParent
Definition: ViewsWindow.hxx:80
OReportWindow * getView() const
virtual void MouseButtonDown(const MouseEvent &rMEvt) override
bool IsDragObj() const
sal_uInt16 getSectionCount() const
void EndDragObj_removeInvisibleObjects()
void BegMarkObj(const Point &_aPnt, const OSectionView *_pSection)
OSectionWindow * getSectionWindow(const css::uno::Reference< css::report::XSection > &_xSection) const
returns the report section window for the given xsection
sal_uInt16 getPosition(const OSectionWindow *_pSectionWindow) const
returns the current position in the list
void setMarked(const css::uno::Sequence< css::uno::Reference< css::report::XReportComponent > > &_xShape, bool _bMark)
void SetInsertObj(SdrObjKind eObj, const OUString &_sShapeType)
virtual void DataChanged(const DataChangedEvent &rDCEvt) override
void setGridSnap(bool bOn)
void MovAction(const Point &rPnt, const OSectionView *_pSection, bool _bControlKeySet)
bool empty() const
::std::vector< VclPtr< OSectionWindow > > TSectionsMap
Definition: ViewsWindow.hxx:75
void alignMarkedObjects(ControlModification _nControlModification, bool _bAlignAtSection)
align all marked objects in all sections
void collapseSections(const css::uno::Sequence< css::beans::PropertyValue > &_aCollapsedSections)
collapse all sections given by their position
void Copy()
copies the current selection in this section
void handleKey(const vcl::KeyCode &_rCode)
bool IsAction() const
static void collectBoundResizeRect(const TRectangleMap &_rSortRectangles, ControlModification _nControlModification, bool _bAlignAtSection, tools::Rectangle &_rBound, tools::Rectangle &_rResize)
::std::multimap< tools::Rectangle,::std::pair< SdrObject *, OSectionView * >, RectangleLess > TRectangleMap
Definition: ViewsWindow.hxx:73
bool handleKeyEvent(const KeyEvent &_rEvent)
checks if the keycode is known by the child windows
OSectionView * getSectionRelativeToPosition(const OSectionView *_pSection, Point &_rPnt)
return the section at the given point which is relative to the given section
void operator=(OViewsWindow const &)=delete
virtual void Resize() override
void EndDragObj(bool _bDragIntoNewSection, const OSectionView *_pSection, const Point &_aPnt)
void BrkAction()
calls on every section BrkAction
void unmarkAllObjects(OSectionView const *_pSectionView)
unmark all objects on the views without the given one.
TSectionsMap m_aSections
Definition: ViewsWindow.hxx:78
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...
::std::vector< SdrObject * > m_aBegDragTempList
void SelectAll(const SdrObjKind _nObjectType)
All objects will be marked.
virtual void dispose() override
constexpr Point Center() const
constexpr tools::Long Top() const
constexpr tools::Long Right() const
constexpr tools::Long Left() const
constexpr tools::Long Bottom() const
ControlModification
Definition: RptDef.hxx:49
ConfigurationHints
RectangleLess(CompareMode _eCompareMode, const Point &_rRefPoint)
Definition: ViewsWindow.hxx:47
bool operator()(const tools::Rectangle &lhs, const tools::Rectangle &rhs) const
Definition: ViewsWindow.hxx:48
CompareMode m_eCompareMode
Definition: ViewsWindow.hxx:45
SdrObjKind