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