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::contact
46 {
47  class ViewObjectContactRedirector;
48  class DisplayInfo;
49  class ViewObjectContactRedirector;
50 }
51 
52 // typedefs for a list of SdrPageWindow
53 class SdrPageWindow;
54 
56 {
57 private:
60  Point aPgOrg; // The Page's point of origin
61 
65  bool mbVisible;
66 
67  SdrLayerIDSet aLayerVisi; // Set of visible Layers
68  SdrLayerIDSet aLayerLock; // Set of non-editable Layers
69  SdrLayerIDSet aLayerPrn; // Set of printable Layers
70 
71  SdrObjList* pCurrentList; // Current List, usually the Page
72  SdrObject* pCurrentGroup; // Current Group; nullptr means none
73 
74  SdrHelpLineList aHelpLines; // Helper lines and points
75 
76  // #103911# Use one reserved slot (bReserveBool2) for the document color
78 
79  // #103834# Use one reserved slot (bReserveBool1) for the background color
81 
82  std::vector< std::unique_ptr<SdrPageWindow> > maPageWindows;
83 
84  // #i72752# member to remember with which SdrPageWindow the BeginDrawLayer
85  // was done
87 
88 public:
89  sal_uInt32 PageWindowCount() const { return maPageWindows.size(); }
90  SdrPageWindow* FindPageWindow( const SdrPaintWindow& rPaintWindow ) const;
91  SdrPageWindow* FindPageWindow( const OutputDevice& rOutDev ) const;
92  SdrPageWindow* GetPageWindow(sal_uInt32 nIndex) const;
93 
100  const SdrPageWindow* FindPatchedPageWindow( const OutputDevice& rOutDev ) const;
101 
102 private:
103  void ImpInvalidateHelpLineArea(sal_uInt16 nNum) const;
104 
105  void SetLayer(const OUString& rName, SdrLayerIDSet& rBS, bool bJa);
106  bool IsLayer(const OUString& rName, const SdrLayerIDSet& rBS) const;
107 
109  void CheckCurrentGroup();
110 
111  void AdjHdl();
112 
113 public:
114  SdrPageView(SdrPage* pPage1, SdrView& rNewView);
115  ~SdrPageView();
116 
117  SdrPageView& operator=( SdrPageView const & ) = delete; // MSVC2017 workaround
118  SdrPageView( SdrPageView const & ) = delete; // MSVC2017 workaround
119 
120 
122  void ModelHasChanged();
123 
124  void Show();
125  void Hide();
126 
127  void AddPaintWindowToPageView(SdrPaintWindow& rPaintWindow);
128  void RemovePaintWindowFromPageView(SdrPaintWindow& rPaintWindow);
129 
130  SdrView& GetView() { return mrView; }
131  const SdrView& GetView() const { return mrView; }
132 
140  css::uno::Reference< css::awt::XControlContainer >
141  GetControlContainer( const OutputDevice& _rDevice ) const;
142 
144  void SetDesignMode( bool _bDesignMode ) const;
145 
146  bool IsVisible() const { return mbVisible; }
147 
149  void InvalidateAllWin();
150 
152  void PrePaint();
153 
155  void CompleteRedraw( SdrPaintWindow& rPaintWindow, const vcl::Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector );
156 
158  void setPreparedPageWindow(SdrPageWindow* pKnownTarget);
159 
160  void DrawLayer(SdrLayerID nID, OutputDevice* pGivenTarget, sdr::contact::ViewObjectContactRedirector* pRedirector = nullptr,
161  const tools::Rectangle& rRect = tools::Rectangle(),
162  basegfx::B2IRectangle const* pPageFrame = nullptr);
163  void DrawPageViewGrid(OutputDevice& rOut, const tools::Rectangle& rRect, Color aColor = COL_BLACK );
164 
165  tools::Rectangle GetPageRect() const;
166  SdrPage* GetPage() const { return mpPage; }
167 
169  SdrObjList* GetObjList() const { return pCurrentList; }
170 
172  SdrObject* GetCurrentGroup() const { return pCurrentGroup; }
173 
175  void SetCurrentGroupAndList(SdrObject* pNewGroup, SdrObjList* pNewList);
176 
177  bool HasMarkedObjPageView() const { return mbHasMarked; }
178  void SetHasMarkedObj(bool bOn) { mbHasMarked = bOn; }
179 
180  const tools::Rectangle& MarkBound() const { return aMarkBound; }
181  const tools::Rectangle& MarkSnap() const { return aMarkSnap; }
182  tools::Rectangle& MarkBound() { return aMarkBound; }
183  tools::Rectangle& MarkSnap() { return aMarkSnap; }
184 
185  void SetLayerVisible(const OUString& rName, bool bShow) {
186  SetLayer(rName, aLayerVisi, bShow);
187  if(!bShow) AdjHdl();
188  InvalidateAllWin();
189  }
190  bool IsLayerVisible(const OUString& rName) const { return IsLayer(rName, aLayerVisi); }
191 
192  void SetLayerLocked(const OUString& rName, bool bLock) { SetLayer(rName, aLayerLock, bLock); if(bLock) AdjHdl(); }
193  bool IsLayerLocked(const OUString& rName) const { return IsLayer(rName,aLayerLock); }
194 
195  void SetLayerPrintable(const OUString& rName, bool bPrn) { SetLayer(rName, aLayerPrn, bPrn); }
196  bool IsLayerPrintable(const OUString& rName) const { return IsLayer(rName, aLayerPrn); }
197 
199  bool IsReadOnly() const;
200 
202  const Point& GetPageOrigin() const { return aPgOrg; }
203  void SetPageOrigin(const Point& rOrg);
204 
205  void LogicToPagePos(Point& rPnt) const { rPnt-=aPgOrg; }
206  void LogicToPagePos(tools::Rectangle& rRect) const { rRect.Move(-aPgOrg.X(),-aPgOrg.Y()); }
207  void PagePosToLogic(Point& rPnt) const { rPnt+=aPgOrg; }
208 
209  void SetVisibleLayers(const SdrLayerIDSet& rSet) { aLayerVisi=rSet; }
210  const SdrLayerIDSet& GetVisibleLayers() const { return aLayerVisi; }
211  void SetPrintableLayers(const SdrLayerIDSet& rSet) { aLayerPrn=rSet; }
212  const SdrLayerIDSet& GetPrintableLayers() const { return aLayerPrn; }
213  void SetLockedLayers(const SdrLayerIDSet& rSet) { aLayerLock=rSet; }
214  const SdrLayerIDSet& GetLockedLayers() const { return aLayerLock; }
215 
216  const SdrHelpLineList& GetHelpLines() const { return aHelpLines; }
217  void SetHelpLines(const SdrHelpLineList& rHLL);
218  //void SetHelpLinePos(sal_uInt16 nNum, const Point& rNewPos);
219  void SetHelpLine(sal_uInt16 nNum, const SdrHelpLine& rNewHelpLine);
220  void DeleteHelpLine(sal_uInt16 nNum);
221  void InsertHelpLine(const SdrHelpLine& rHL);
222 
227  bool IsObjMarkable(SdrObject const * pObj) const;
228 
233  bool EnterGroup(SdrObject* pObj);
234 
236  void LeaveOneGroup();
237 
239  void LeaveAllGroup();
240 
242  sal_uInt16 GetEnteredLevel() const;
243 
244  // #103834# Set background color for svx at SdrPageViews
245  void SetApplicationBackgroundColor(Color aBackgroundColor);
246 
247  const Color& GetApplicationBackgroundColor() const { return maBackgroundColor;}
248 
249  // #103911# Set/Get document color for svx at SdrPageViews
250  void SetApplicationDocumentColor(Color aDocumentColor);
251  const Color& GetApplicationDocumentColor() const { return maDocumentColor;}
252 };
253 
254 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const tools::Rectangle & MarkSnap() const
Definition: svdpagv.hxx:181
tools::Rectangle & MarkSnap()
Definition: svdpagv.hxx:183
SdrView & GetView()
Definition: svdpagv.hxx:130
SdrObjList * pCurrentList
Definition: svdpagv.hxx:71
const SdrLayerIDSet & GetPrintableLayers() const
Definition: svdpagv.hxx:212
SdrLayerIDSet aLayerVisi
Definition: svdpagv.hxx:67
void PagePosToLogic(Point &rPnt) const
Definition: svdpagv.hxx:207
bool IsLayerVisible(const OUString &rName) const
Definition: svdpagv.hxx:190
const SdrHelpLineList & GetHelpLines() const
Definition: svdpagv.hxx:216
SdrView & mrView
Definition: svdpagv.hxx:58
void SetPrintableLayers(const SdrLayerIDSet &rSet)
Definition: svdpagv.hxx:211
void LogicToPagePos(Point &rPnt) const
Definition: svdpagv.hxx:205
constexpr OUStringLiteral IsReadOnly(u"IsReadOnly")
bool IsVisible() const
Definition: svdpagv.hxx:146
Color maBackgroundColor
Definition: svdpagv.hxx:80
void SetLayerPrintable(const OUString &rName, bool bPrn)
Definition: svdpagv.hxx:195
const Point & GetPageOrigin() const
The Origin always refers to the upper left corner of the Page.
Definition: svdpagv.hxx:202
void SetLockedLayers(const SdrLayerIDSet &rSet)
Definition: svdpagv.hxx:213
const Color & GetApplicationDocumentColor() const
Definition: svdpagv.hxx:251
SdrObjList * GetObjList() const
Return current List.
Definition: svdpagv.hxx:169
const SdrLayerIDSet & GetVisibleLayers() const
Definition: svdpagv.hxx:210
Point aPgOrg
Definition: svdpagv.hxx:60
bool HasMarkedObjPageView() const
Definition: svdpagv.hxx:177
tools::Rectangle aMarkSnap
Definition: svdpagv.hxx:63
const tools::Rectangle & MarkBound() const
Definition: svdpagv.hxx:180
bool IsLayerLocked(const OUString &rName) const
Definition: svdpagv.hxx:193
tools::Rectangle & MarkBound()
Definition: svdpagv.hxx:182
void SetHasMarkedObj(bool bOn)
Definition: svdpagv.hxx:178
SdrObject * pCurrentGroup
Definition: svdpagv.hxx:72
std::vector< std::unique_ptr< SdrPageWindow > > maPageWindows
Definition: svdpagv.hxx:82
SdrPage * mpPage
Definition: svdpagv.hxx:59
Abstract DrawObject.
Definition: svdobj.hxx:259
void SetVisibleLayers(const SdrLayerIDSet &rSet)
Definition: svdpagv.hxx:209
const SdrLayerIDSet & GetLockedLayers() const
Definition: svdpagv.hxx:214
bool mbVisible
SdrPage * GetPage() const
Definition: svdpagv.hxx:166
SdrPageWindow * mpPreparedPageWindow
Definition: svdpagv.hxx:86
void SetLayerLocked(const OUString &rName, bool bLock)
Definition: svdpagv.hxx:192
#define SVXCORE_DLLPUBLIC
Definition: svxdllapi.h:35
SdrLayerIDSet aLayerPrn
Definition: svdpagv.hxx:69
void LogicToPagePos(tools::Rectangle &rRect) const
Definition: svdpagv.hxx:206
SdrHelpLineList aHelpLines
Definition: svdpagv.hxx:74
void Move(tools::Long nHorzMoveDelta, tools::Long nVertMoveDelta)
const SdrView & GetView() const
Definition: svdpagv.hxx:131
SdrLayerIDSet aLayerLock
Definition: svdpagv.hxx:68
bool IsLayerPrintable(const OUString &rName) const
Definition: svdpagv.hxx:196
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:62
const Color & GetApplicationBackgroundColor() const
Definition: svdpagv.hxx:247
bool mbHasMarked
Definition: svdpagv.hxx:64
Color maDocumentColor
Definition: svdpagv.hxx:77
bool mbVisible
Definition: svdpagv.hxx:65
void SetLayerVisible(const OUString &rName, bool bShow)
Definition: svdpagv.hxx:185
SdrObject * GetCurrentGroup() const
Return current Group.
Definition: svdpagv.hxx:172
sal_uInt32 PageWindowCount() const
Definition: svdpagv.hxx:89