LibreOffice Module svx (master)  1
svdpagv.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 
20 #ifndef INCLUDED_SVX_SVDPAGV_HXX
21 #define INCLUDED_SVX_SVDPAGV_HXX
22 
23 #include <com/sun/star/awt/XControlContainer.hpp>
24 #include <rtl/ustring.hxx>
25 #include <tools/color.hxx>
26 #include <svx/svdhlpln.hxx>
27 #include <svx/svdsob.hxx>
28 #include <svx/svdtypes.hxx>
29 #include <svx/svxdllapi.h>
30 
31 #include <memory>
32 #include <vector>
34 
35 
36 namespace vcl { class Region; }
37 class SdrObjList;
38 class SdrObject;
39 class SdrPage;
40 class SdrUnoObj;
41 class SdrPaintWindow;
42 class SdrView;
43 class SdrPageObj;
44 class SdrPageView;
45 
46 namespace sdr
47 {
48  namespace contact
49  {
50  class ViewObjectContactRedirector;
51  class DisplayInfo;
52  class ViewObjectContactRedirector;
53  } // end of namespace contact
54 } // end of namespace sdr
55 
56 // typedefs for a list of SdrPageWindow
57 class SdrPageWindow;
58 
59 
61 {
62 private:
65  Point aPgOrg; // The Page's point of origin
66 
70  bool mbVisible;
71 
72  SdrLayerIDSet aLayerVisi; // Set of visible Layers
73  SdrLayerIDSet aLayerLock; // Set of non-editable Layers
74  SdrLayerIDSet aLayerPrn; // Set of printable Layers
75 
76  SdrObjList* pCurrentList; // Current List, usually the Page
77  SdrObject* pCurrentGroup; // Current Group; nullptr means none
78 
79  SdrHelpLineList aHelpLines; // Helper lines and points
80 
81  // #103911# Use one reserved slot (bReserveBool2) for the document color
83 
84  // #103834# Use one reserved slot (bReserveBool1) for the background color
86 
87  std::vector< std::unique_ptr<SdrPageWindow> > maPageWindows;
88 
89  // #i72752# member to remember with which SdrPageWindow the BeginDrawLayer
90  // was done
92 
93  // interface to SdrPageWindow
94  void ClearPageWindows();
95 public:
96  sal_uInt32 PageWindowCount() const { return maPageWindows.size(); }
97  SdrPageWindow* FindPageWindow( SdrPaintWindow& rPaintWindow ) const;
98  SdrPageWindow* FindPageWindow( const OutputDevice& rOutDev ) const;
99  SdrPageWindow* GetPageWindow(sal_uInt32 nIndex) const;
100 
107  const SdrPageWindow* FindPatchedPageWindow( const OutputDevice& rOutDev ) const;
108 
109 private:
110  void ImpInvalidateHelpLineArea(sal_uInt16 nNum) const;
111 
112  void SetLayer(const OUString& rName, SdrLayerIDSet& rBS, bool bJa);
113  bool IsLayer(const OUString& rName, const SdrLayerIDSet& rBS) const;
114 
116  void CheckCurrentGroup();
117 
118  void AdjHdl();
119 
120 public:
121  SdrPageView(SdrPage* pPage1, SdrView& rNewView);
122  ~SdrPageView();
123 
124  SdrPageView& operator=( SdrPageView const & ) = delete; // MSVC2017 workaround
125  SdrPageView( SdrPageView const & ) = delete; // MSVC2017 workaround
126 
127 
129  void ModelHasChanged();
130 
131  void Show();
132  void Hide();
133 
134  void AddPaintWindowToPageView(SdrPaintWindow& rPaintWindow);
135  void RemovePaintWindowFromPageView(SdrPaintWindow& rPaintWindow);
136 
137  SdrView& GetView() { return mrView; }
138  const SdrView& GetView() const { return mrView; }
139 
147  css::uno::Reference< css::awt::XControlContainer >
148  GetControlContainer( const OutputDevice& _rDevice ) const;
149 
151  void SetDesignMode( bool _bDesignMode ) const;
152 
153  bool IsVisible() const { return mbVisible; }
154 
156  void InvalidateAllWin();
157 
159  void PrePaint();
160 
162  void CompleteRedraw( SdrPaintWindow& rPaintWindow, const vcl::Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector );
163 
165  void setPreparedPageWindow(SdrPageWindow* pKnownTarget);
166 
167  void DrawLayer(SdrLayerID nID, OutputDevice* pGivenTarget, sdr::contact::ViewObjectContactRedirector* pRedirector = nullptr,
168  const tools::Rectangle& rRect = tools::Rectangle(),
169  basegfx::B2IRectangle const* pPageFrame = nullptr);
170  void DrawPageViewGrid(OutputDevice& rOut, const tools::Rectangle& rRect, Color aColor = COL_BLACK );
171 
172  tools::Rectangle GetPageRect() const;
173  SdrPage* GetPage() const { return mpPage; }
174 
176  SdrObjList* GetObjList() const { return pCurrentList; }
177 
179  SdrObject* GetCurrentGroup() const { return pCurrentGroup; }
180 
182  void SetCurrentGroupAndList(SdrObject* pNewGroup, SdrObjList* pNewList);
183 
184  bool HasMarkedObjPageView() const { return mbHasMarked; }
185  void SetHasMarkedObj(bool bOn) { mbHasMarked = bOn; }
186 
187  const tools::Rectangle& MarkBound() const { return aMarkBound; }
188  const tools::Rectangle& MarkSnap() const { return aMarkSnap; }
189  tools::Rectangle& MarkBound() { return aMarkBound; }
190  tools::Rectangle& MarkSnap() { return aMarkSnap; }
191 
192  void SetLayerVisible(const OUString& rName, bool bShow) {
193  SetLayer(rName, aLayerVisi, bShow);
194  if(!bShow) AdjHdl();
195  InvalidateAllWin();
196  }
197  bool IsLayerVisible(const OUString& rName) const { return IsLayer(rName, aLayerVisi); }
198 
199  void SetLayerLocked(const OUString& rName, bool bLock) { SetLayer(rName, aLayerLock, bLock); if(bLock) AdjHdl(); }
200  bool IsLayerLocked(const OUString& rName) const { return IsLayer(rName,aLayerLock); }
201 
202  void SetLayerPrintable(const OUString& rName, bool bPrn) { SetLayer(rName, aLayerPrn, bPrn); }
203  bool IsLayerPrintable(const OUString& rName) const { return IsLayer(rName, aLayerPrn); }
204 
206  bool IsReadOnly() const;
207 
209  const Point& GetPageOrigin() const { return aPgOrg; }
210  void SetPageOrigin(const Point& rOrg);
211 
212  void LogicToPagePos(Point& rPnt) const { rPnt-=aPgOrg; }
213  void LogicToPagePos(tools::Rectangle& rRect) const { rRect.Move(-aPgOrg.X(),-aPgOrg.Y()); }
214  void PagePosToLogic(Point& rPnt) const { rPnt+=aPgOrg; }
215 
216  void SetVisibleLayers(const SdrLayerIDSet& rSet) { aLayerVisi=rSet; }
217  const SdrLayerIDSet& GetVisibleLayers() const { return aLayerVisi; }
218  void SetPrintableLayers(const SdrLayerIDSet& rSet) { aLayerPrn=rSet; }
219  const SdrLayerIDSet& GetPrintableLayers() const { return aLayerPrn; }
220  void SetLockedLayers(const SdrLayerIDSet& rSet) { aLayerLock=rSet; }
221  const SdrLayerIDSet& GetLockedLayers() const { return aLayerLock; }
222 
223  const SdrHelpLineList& GetHelpLines() const { return aHelpLines; }
224  void SetHelpLines(const SdrHelpLineList& rHLL);
225  //void SetHelpLinePos(sal_uInt16 nNum, const Point& rNewPos);
226  void SetHelpLine(sal_uInt16 nNum, const SdrHelpLine& rNewHelpLine);
227  void DeleteHelpLine(sal_uInt16 nNum);
228  void InsertHelpLine(const SdrHelpLine& rHL);
229 
234  bool IsObjMarkable(SdrObject const * pObj) const;
235 
240  bool EnterGroup(SdrObject* pObj);
241 
243  void LeaveOneGroup();
244 
246  void LeaveAllGroup();
247 
249  sal_uInt16 GetEnteredLevel() const;
250 
251  // #103834# Set background color for svx at SdrPageViews
252  void SetApplicationBackgroundColor(Color aBackgroundColor);
253 
254  const Color& GetApplicationBackgroundColor() const { return maBackgroundColor;}
255 
256  // #103911# Set/Get document color for svx at SdrPageViews
257  void SetApplicationDocumentColor(Color aDocumentColor);
258  const Color& GetApplicationDocumentColor() const { return maDocumentColor;}
259 };
260 
261 
262 #endif // INCLUDED_SVX_SVDPAGV_HXX
263 
264 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const tools::Rectangle & MarkSnap() const
Definition: svdpagv.hxx:188
tools::Rectangle & MarkSnap()
Definition: svdpagv.hxx:190
SdrView & GetView()
Definition: svdpagv.hxx:137
SdrObjList * pCurrentList
Definition: svdpagv.hxx:76
bool IsReadOnly(const OUString &rURL, bool *pbExist)
const SdrLayerIDSet & GetPrintableLayers() const
Definition: svdpagv.hxx:219
SdrLayerIDSet aLayerVisi
Definition: svdpagv.hxx:72
#define SVX_DLLPUBLIC
Definition: svxdllapi.h:28
void PagePosToLogic(Point &rPnt) const
Definition: svdpagv.hxx:214
bool IsLayerVisible(const OUString &rName) const
Definition: svdpagv.hxx:197
const SdrHelpLineList & GetHelpLines() const
Definition: svdpagv.hxx:223
SdrView & mrView
Definition: svdpagv.hxx:63
void Move(long nHorzMoveDelta, long nVertMoveDelta)
void SetPrintableLayers(const SdrLayerIDSet &rSet)
Definition: svdpagv.hxx:218
void LogicToPagePos(Point &rPnt) const
Definition: svdpagv.hxx:212
bool IsVisible() const
Definition: svdpagv.hxx:153
Color maBackgroundColor
Definition: svdpagv.hxx:85
void SetLayerPrintable(const OUString &rName, bool bPrn)
Definition: svdpagv.hxx:202
const Point & GetPageOrigin() const
The Origin always refers to the upper left corner of the Page.
Definition: svdpagv.hxx:209
void SetLockedLayers(const SdrLayerIDSet &rSet)
Definition: svdpagv.hxx:220
const Color & GetApplicationDocumentColor() const
Definition: svdpagv.hxx:258
SdrObjList * GetObjList() const
Return current List.
Definition: svdpagv.hxx:176
const SdrLayerIDSet & GetVisibleLayers() const
Definition: svdpagv.hxx:217
Point aPgOrg
Definition: svdpagv.hxx:65
bool HasMarkedObjPageView() const
Definition: svdpagv.hxx:184
tools::Rectangle aMarkSnap
Definition: svdpagv.hxx:68
const tools::Rectangle & MarkBound() const
Definition: svdpagv.hxx:187
bool IsLayerLocked(const OUString &rName) const
Definition: svdpagv.hxx:200
tools::Rectangle & MarkBound()
Definition: svdpagv.hxx:189
void SetHasMarkedObj(bool bOn)
Definition: svdpagv.hxx:185
SdrObject * pCurrentGroup
Definition: svdpagv.hxx:77
std::vector< std::unique_ptr< SdrPageWindow > > maPageWindows
Definition: svdpagv.hxx:87
SdrPage * mpPage
Definition: svdpagv.hxx:64
Abstract DrawObject.
Definition: svdobj.hxx:312
long X() const
void SetVisibleLayers(const SdrLayerIDSet &rSet)
Definition: svdpagv.hxx:216
const SdrLayerIDSet & GetLockedLayers() const
Definition: svdpagv.hxx:221
SdrPage * GetPage() const
Definition: svdpagv.hxx:173
SdrPageWindow * mpPreparedPageWindow
Definition: svdpagv.hxx:91
void SetLayerLocked(const OUString &rName, bool bLock)
Definition: svdpagv.hxx:199
SdrLayerIDSet aLayerPrn
Definition: svdpagv.hxx:74
void LogicToPagePos(tools::Rectangle &rRect) const
Definition: svdpagv.hxx:213
SdrHelpLineList aHelpLines
Definition: svdpagv.hxx:79
bool const mbVisible
const SdrView & GetView() const
Definition: svdpagv.hxx:138
SdrLayerIDSet aLayerLock
Definition: svdpagv.hxx:73
bool IsLayerPrintable(const OUString &rName) const
Definition: svdpagv.hxx:203
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:366
tools::Rectangle aMarkBound
Definition: svdpagv.hxx:67
const Color & GetApplicationBackgroundColor() const
Definition: svdpagv.hxx:254
bool mbHasMarked
Definition: svdpagv.hxx:69
Color maDocumentColor
Definition: svdpagv.hxx:82
long Y() const
bool mbVisible
Definition: svdpagv.hxx:70
void SetLayerVisible(const OUString &rName, bool bShow)
Definition: svdpagv.hxx:192
SdrObject * GetCurrentGroup() const
Return current Group.
Definition: svdpagv.hxx:179
sal_uInt32 PageWindowCount() const
Definition: svdpagv.hxx:96