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 public:
94  sal_uInt32 PageWindowCount() const { return maPageWindows.size(); }
95  SdrPageWindow* FindPageWindow( SdrPaintWindow& rPaintWindow ) const;
96  SdrPageWindow* FindPageWindow( const OutputDevice& rOutDev ) const;
97  SdrPageWindow* GetPageWindow(sal_uInt32 nIndex) const;
98 
105  const SdrPageWindow* FindPatchedPageWindow( const OutputDevice& rOutDev ) const;
106 
107 private:
108  void ImpInvalidateHelpLineArea(sal_uInt16 nNum) const;
109 
110  void SetLayer(const OUString& rName, SdrLayerIDSet& rBS, bool bJa);
111  bool IsLayer(const OUString& rName, const SdrLayerIDSet& rBS) const;
112 
114  void CheckCurrentGroup();
115 
116  void AdjHdl();
117 
118 public:
119  SdrPageView(SdrPage* pPage1, SdrView& rNewView);
120  ~SdrPageView();
121 
122  SdrPageView& operator=( SdrPageView const & ) = delete; // MSVC2017 workaround
123  SdrPageView( SdrPageView const & ) = delete; // MSVC2017 workaround
124 
125 
127  void ModelHasChanged();
128 
129  void Show();
130  void Hide();
131 
132  void AddPaintWindowToPageView(SdrPaintWindow& rPaintWindow);
133  void RemovePaintWindowFromPageView(SdrPaintWindow& rPaintWindow);
134 
135  SdrView& GetView() { return mrView; }
136  const SdrView& GetView() const { return mrView; }
137 
145  css::uno::Reference< css::awt::XControlContainer >
146  GetControlContainer( const OutputDevice& _rDevice ) const;
147 
149  void SetDesignMode( bool _bDesignMode ) const;
150 
151  bool IsVisible() const { return mbVisible; }
152 
154  void InvalidateAllWin();
155 
157  void PrePaint();
158 
160  void CompleteRedraw( SdrPaintWindow& rPaintWindow, const vcl::Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector );
161 
163  void setPreparedPageWindow(SdrPageWindow* pKnownTarget);
164 
165  void DrawLayer(SdrLayerID nID, OutputDevice* pGivenTarget, sdr::contact::ViewObjectContactRedirector* pRedirector = nullptr,
166  const tools::Rectangle& rRect = tools::Rectangle(),
167  basegfx::B2IRectangle const* pPageFrame = nullptr);
168  void DrawPageViewGrid(OutputDevice& rOut, const tools::Rectangle& rRect, Color aColor = COL_BLACK );
169 
170  tools::Rectangle GetPageRect() const;
171  SdrPage* GetPage() const { return mpPage; }
172 
174  SdrObjList* GetObjList() const { return pCurrentList; }
175 
177  SdrObject* GetCurrentGroup() const { return pCurrentGroup; }
178 
180  void SetCurrentGroupAndList(SdrObject* pNewGroup, SdrObjList* pNewList);
181 
182  bool HasMarkedObjPageView() const { return mbHasMarked; }
183  void SetHasMarkedObj(bool bOn) { mbHasMarked = bOn; }
184 
185  const tools::Rectangle& MarkBound() const { return aMarkBound; }
186  const tools::Rectangle& MarkSnap() const { return aMarkSnap; }
187  tools::Rectangle& MarkBound() { return aMarkBound; }
188  tools::Rectangle& MarkSnap() { return aMarkSnap; }
189 
190  void SetLayerVisible(const OUString& rName, bool bShow) {
191  SetLayer(rName, aLayerVisi, bShow);
192  if(!bShow) AdjHdl();
193  InvalidateAllWin();
194  }
195  bool IsLayerVisible(const OUString& rName) const { return IsLayer(rName, aLayerVisi); }
196 
197  void SetLayerLocked(const OUString& rName, bool bLock) { SetLayer(rName, aLayerLock, bLock); if(bLock) AdjHdl(); }
198  bool IsLayerLocked(const OUString& rName) const { return IsLayer(rName,aLayerLock); }
199 
200  void SetLayerPrintable(const OUString& rName, bool bPrn) { SetLayer(rName, aLayerPrn, bPrn); }
201  bool IsLayerPrintable(const OUString& rName) const { return IsLayer(rName, aLayerPrn); }
202 
204  bool IsReadOnly() const;
205 
207  const Point& GetPageOrigin() const { return aPgOrg; }
208  void SetPageOrigin(const Point& rOrg);
209 
210  void LogicToPagePos(Point& rPnt) const { rPnt-=aPgOrg; }
211  void LogicToPagePos(tools::Rectangle& rRect) const { rRect.Move(-aPgOrg.X(),-aPgOrg.Y()); }
212  void PagePosToLogic(Point& rPnt) const { rPnt+=aPgOrg; }
213 
214  void SetVisibleLayers(const SdrLayerIDSet& rSet) { aLayerVisi=rSet; }
215  const SdrLayerIDSet& GetVisibleLayers() const { return aLayerVisi; }
216  void SetPrintableLayers(const SdrLayerIDSet& rSet) { aLayerPrn=rSet; }
217  const SdrLayerIDSet& GetPrintableLayers() const { return aLayerPrn; }
218  void SetLockedLayers(const SdrLayerIDSet& rSet) { aLayerLock=rSet; }
219  const SdrLayerIDSet& GetLockedLayers() const { return aLayerLock; }
220 
221  const SdrHelpLineList& GetHelpLines() const { return aHelpLines; }
222  void SetHelpLines(const SdrHelpLineList& rHLL);
223  //void SetHelpLinePos(sal_uInt16 nNum, const Point& rNewPos);
224  void SetHelpLine(sal_uInt16 nNum, const SdrHelpLine& rNewHelpLine);
225  void DeleteHelpLine(sal_uInt16 nNum);
226  void InsertHelpLine(const SdrHelpLine& rHL);
227 
232  bool IsObjMarkable(SdrObject const * pObj) const;
233 
238  bool EnterGroup(SdrObject* pObj);
239 
241  void LeaveOneGroup();
242 
244  void LeaveAllGroup();
245 
247  sal_uInt16 GetEnteredLevel() const;
248 
249  // #103834# Set background color for svx at SdrPageViews
250  void SetApplicationBackgroundColor(Color aBackgroundColor);
251 
252  const Color& GetApplicationBackgroundColor() const { return maBackgroundColor;}
253 
254  // #103911# Set/Get document color for svx at SdrPageViews
255  void SetApplicationDocumentColor(Color aDocumentColor);
256  const Color& GetApplicationDocumentColor() const { return maDocumentColor;}
257 };
258 
259 
260 #endif // INCLUDED_SVX_SVDPAGV_HXX
261 
262 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const tools::Rectangle & MarkSnap() const
Definition: svdpagv.hxx:186
tools::Rectangle & MarkSnap()
Definition: svdpagv.hxx:188
SdrView & GetView()
Definition: svdpagv.hxx:135
SdrObjList * pCurrentList
Definition: svdpagv.hxx:76
bool IsReadOnly(const OUString &rURL, bool *pbExist)
const SdrLayerIDSet & GetPrintableLayers() const
Definition: svdpagv.hxx:217
SdrLayerIDSet aLayerVisi
Definition: svdpagv.hxx:72
void PagePosToLogic(Point &rPnt) const
Definition: svdpagv.hxx:212
bool IsLayerVisible(const OUString &rName) const
Definition: svdpagv.hxx:195
const SdrHelpLineList & GetHelpLines() const
Definition: svdpagv.hxx:221
SdrView & mrView
Definition: svdpagv.hxx:63
void Move(long nHorzMoveDelta, long nVertMoveDelta)
void SetPrintableLayers(const SdrLayerIDSet &rSet)
Definition: svdpagv.hxx:216
void LogicToPagePos(Point &rPnt) const
Definition: svdpagv.hxx:210
bool IsVisible() const
Definition: svdpagv.hxx:151
Color maBackgroundColor
Definition: svdpagv.hxx:85
void SetLayerPrintable(const OUString &rName, bool bPrn)
Definition: svdpagv.hxx:200
const Point & GetPageOrigin() const
The Origin always refers to the upper left corner of the Page.
Definition: svdpagv.hxx:207
void SetLockedLayers(const SdrLayerIDSet &rSet)
Definition: svdpagv.hxx:218
const Color & GetApplicationDocumentColor() const
Definition: svdpagv.hxx:256
SdrObjList * GetObjList() const
Return current List.
Definition: svdpagv.hxx:174
const SdrLayerIDSet & GetVisibleLayers() const
Definition: svdpagv.hxx:215
Point aPgOrg
Definition: svdpagv.hxx:65
bool HasMarkedObjPageView() const
Definition: svdpagv.hxx:182
tools::Rectangle aMarkSnap
Definition: svdpagv.hxx:68
const tools::Rectangle & MarkBound() const
Definition: svdpagv.hxx:185
bool IsLayerLocked(const OUString &rName) const
Definition: svdpagv.hxx:198
tools::Rectangle & MarkBound()
Definition: svdpagv.hxx:187
void SetHasMarkedObj(bool bOn)
Definition: svdpagv.hxx:183
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:214
const SdrLayerIDSet & GetLockedLayers() const
Definition: svdpagv.hxx:219
SdrPage * GetPage() const
Definition: svdpagv.hxx:171
SdrPageWindow * mpPreparedPageWindow
Definition: svdpagv.hxx:91
void SetLayerLocked(const OUString &rName, bool bLock)
Definition: svdpagv.hxx:197
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
SdrLayerIDSet aLayerPrn
Definition: svdpagv.hxx:74
void LogicToPagePos(tools::Rectangle &rRect) const
Definition: svdpagv.hxx:211
SdrHelpLineList aHelpLines
Definition: svdpagv.hxx:79
bool const mbVisible
const SdrView & GetView() const
Definition: svdpagv.hxx:136
SdrLayerIDSet aLayerLock
Definition: svdpagv.hxx:73
bool IsLayerPrintable(const OUString &rName) const
Definition: svdpagv.hxx:201
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:252
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:190
SdrObject * GetCurrentGroup() const
Return current Group.
Definition: svdpagv.hxx:177
sal_uInt32 PageWindowCount() const
Definition: svdpagv.hxx:94