1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #ifndef INCLUDED_SVX_SVDPAGV_HXX
21 #define INCLUDED_SVX_SVDPAGV_HXX
23 #include <com/sun/star/awt/XControlContainer.hpp>
24 #include <rtl/ustring.hxx>
25 #include <tools/color.hxx>
26 #include <svl/lstner.hxx>
27 #include <svx/svdhlpln.hxx>
28 #include <svx/svdsob.hxx>
29 #include <svx/svdtypes.hxx>
30 #include <svx/svxdllapi.h>
34 #include <basegfx/polygon/b2dpolypolygon.hxx>
35 #include <basegfx/range/b2irectangle.hxx>
38 namespace vcl
{ class Region
; }
52 class ViewObjectContactRedirector
;
54 class ViewObjectContactRedirector
;
55 } // end of namespace contact
56 } // end of namespace sdr
58 // typedefs for a list of SdrPageWindow
62 class SVX_DLLPUBLIC SdrPageView
67 Point aPgOrg
; // The Page's point of origin
69 tools::Rectangle aMarkBound
;
70 tools::Rectangle aMarkSnap
;
74 SdrLayerIDSet aLayerVisi
; // Set of visible Layers
75 SdrLayerIDSet aLayerLock
; // Set of non-editable Layers
76 SdrLayerIDSet aLayerPrn
; // Set of printable Layers
78 SdrObjList
* pCurrentList
; // Current List, usually the Page
79 SdrObject
* pCurrentGroup
; // Current Group; nullptr means none
81 SdrHelpLineList aHelpLines
; // Helper lines and points
83 // #103911# Use one reserved slot (bReserveBool2) for the document color
84 Color maDocumentColor
;
86 // #103834# Use one reserved slot (bReserveBool1) for the background color
87 Color maBackgroundColor
;
89 std::vector
< std::unique_ptr
<SdrPageWindow
> > maPageWindows
;
91 // #i72752# member to remember with which SdrPageWindow the BeginDrawLayer
93 SdrPageWindow
* mpPreparedPageWindow
;
95 // interface to SdrPageWindow
96 void ClearPageWindows();
98 sal_uInt32
PageWindowCount() const { return maPageWindows
.size(); }
99 SdrPageWindow
* FindPageWindow( SdrPaintWindow
& rPaintWindow
) const;
100 SdrPageWindow
* FindPageWindow( const OutputDevice
& rOutDev
) const;
101 SdrPageWindow
* GetPageWindow(sal_uInt32 nIndex
) const;
104 * Finds the page window whose PaintWindow belongs to the given output device
105 * In opposite to FindPageWindow, this method also cares possibly patched PaintWindow instances.
106 * That is, a SdrPageWindow might have an original, and a patched SdrPaintWindow instance - if
107 * this is the case, then the original SdrPaintWindow is examined before the patched one.
109 const SdrPageWindow
* FindPatchedPageWindow( const OutputDevice
& rOutDev
) const;
112 void ImpInvalidateHelpLineArea(sal_uInt16 nNum
) const;
114 void SetLayer(const OUString
& rName
, SdrLayerIDSet
& rBS
, bool bJa
);
115 bool IsLayer(const OUString
& rName
, const SdrLayerIDSet
& rBS
) const;
117 /// Let's see if the current Group (pCurrentGroup) is still inserted
118 void CheckCurrentGroup();
123 SdrPageView(SdrPage
* pPage1
, SdrView
& rNewView
);
126 SdrPageView
& operator=( SdrPageView
const & ) = delete; // MSVC2017 workaround
127 SdrPageView( SdrPageView
const & ) = delete; // MSVC2017 workaround
130 /// Is called by PaintView, when modal changes have finished
131 void ModelHasChanged();
136 void AddPaintWindowToPageView(SdrPaintWindow
& rPaintWindow
);
137 void RemovePaintWindowFromPageView(SdrPaintWindow
& rPaintWindow
);
139 SdrView
& GetView() { return mrView
; }
140 const SdrView
& GetView() const { return mrView
; }
143 * Looks up the control container belonging to given output device
145 * If the given output device belongs to one of the SdrPageViewWinRecs associated with this
146 * SdrPageView instance, the XControlContainer for this output device is returned, <NULL/>
149 css::uno::Reference
< css::awt::XControlContainer
>
150 GetControlContainer( const OutputDevice
& _rDevice
) const;
152 /// Sets all elements in the view which support a design and a alive mode into the given mode
153 void SetDesignMode( bool _bDesignMode
) const;
155 bool IsVisible() const { return mbVisible
; }
157 /// Invalidates the Page's whole area
158 void InvalidateAllWin();
160 /// PrePaint call forwarded from app windows
163 /// @param rReg refers to the OutDev and not to the Page
164 void CompleteRedraw( SdrPaintWindow
& rPaintWindow
, const vcl::Region
& rReg
, sdr::contact::ViewObjectContactRedirector
* pRedirector
);
166 /// Write access to mpPreparedPageWindow
167 void setPreparedPageWindow(SdrPageWindow
* pKnownTarget
);
169 void DrawLayer(SdrLayerID nID
, OutputDevice
* pGivenTarget
, sdr::contact::ViewObjectContactRedirector
* pRedirector
= nullptr,
170 const tools::Rectangle
& rRect
= tools::Rectangle(),
171 basegfx::B2IRectangle
const* pPageFrame
= nullptr);
172 void DrawPageViewGrid(OutputDevice
& rOut
, const tools::Rectangle
& rRect
, Color aColor
= COL_BLACK
);
174 tools::Rectangle
GetPageRect() const;
175 SdrPage
* GetPage() const { return mpPage
; }
177 /// Return current List
178 SdrObjList
* GetObjList() const { return pCurrentList
; }
180 /// Return current Group
181 SdrObject
* GetCurrentGroup() const { return pCurrentGroup
; }
183 /// Set current Group and List
184 void SetCurrentGroupAndList(SdrObject
* pNewGroup
, SdrObjList
* pNewList
);
186 bool HasMarkedObjPageView() const { return mbHasMarked
; }
187 void SetHasMarkedObj(bool bOn
) { mbHasMarked
= bOn
; }
189 const tools::Rectangle
& MarkBound() const { return aMarkBound
; }
190 const tools::Rectangle
& MarkSnap() const { return aMarkSnap
; }
191 tools::Rectangle
& MarkBound() { return aMarkBound
; }
192 tools::Rectangle
& MarkSnap() { return aMarkSnap
; }
194 void SetLayerVisible(const OUString
& rName
, bool bShow
) {
195 SetLayer(rName
, aLayerVisi
, bShow
);
199 bool IsLayerVisible(const OUString
& rName
) const { return IsLayer(rName
, aLayerVisi
); }
201 void SetLayerLocked(const OUString
& rName
, bool bLock
) { SetLayer(rName
, aLayerLock
, bLock
); if(bLock
) AdjHdl(); }
202 bool IsLayerLocked(const OUString
& rName
) const { return IsLayer(rName
,aLayerLock
); }
204 void SetLayerPrintable(const OUString
& rName
, bool bPrn
) { SetLayer(rName
, aLayerPrn
, bPrn
); }
205 bool IsLayerPrintable(const OUString
& rName
) const { return IsLayer(rName
, aLayerPrn
); }
207 /// PV represents a RefPage or a SubList of a RefObj, or the Model is ReadOnly
208 bool IsReadOnly() const;
210 /// The Origin always refers to the upper left corner of the Page
211 const Point
& GetPageOrigin() const { return aPgOrg
; }
212 void SetPageOrigin(const Point
& rOrg
);
214 void LogicToPagePos(Point
& rPnt
) const { rPnt
-=aPgOrg
; }
215 void LogicToPagePos(tools::Rectangle
& rRect
) const { rRect
.Move(-aPgOrg
.X(),-aPgOrg
.Y()); }
216 void PagePosToLogic(Point
& rPnt
) const { rPnt
+=aPgOrg
; }
218 void SetVisibleLayers(const SdrLayerIDSet
& rSet
) { aLayerVisi
=rSet
; }
219 const SdrLayerIDSet
& GetVisibleLayers() const { return aLayerVisi
; }
220 void SetPrintableLayers(const SdrLayerIDSet
& rSet
) { aLayerPrn
=rSet
; }
221 const SdrLayerIDSet
& GetPrintableLayers() const { return aLayerPrn
; }
222 void SetLockedLayers(const SdrLayerIDSet
& rSet
) { aLayerLock
=rSet
; }
223 const SdrLayerIDSet
& GetLockedLayers() const { return aLayerLock
; }
225 const SdrHelpLineList
& GetHelpLines() const { return aHelpLines
; }
226 void SetHelpLines(const SdrHelpLineList
& rHLL
);
227 //void SetHelpLinePos(sal_uInt16 nNum, const Point& rNewPos);
228 void SetHelpLine(sal_uInt16 nNum
, const SdrHelpLine
& rNewHelpLine
);
229 void DeleteHelpLine(sal_uInt16 nNum
);
230 void InsertHelpLine(const SdrHelpLine
& rHL
);
232 /// At least one member must be visible for the Group object and
233 /// it must not be locked
235 /// true, if the object's layer is visible and not locked
236 bool IsObjMarkable(SdrObject
const * pObj
) const;
238 /// Entering (editing) an object group
239 /// After that, we have direct access to all member objects of the group.
240 /// All other objects are not editable in the meantime (until the next
242 bool EnterGroup(SdrObject
* pObj
);
244 /// Leave an object group we entered previously
245 void LeaveOneGroup();
247 /// Leave all object groups we entered previously
248 void LeaveAllGroup();
250 /// Determine, how deep we descended (0 = Root(Page))
251 sal_uInt16
GetEnteredLevel() const;
253 // #103834# Set background color for svx at SdrPageViews
254 void SetApplicationBackgroundColor(Color aBackgroundColor
);
256 const Color
& GetApplicationBackgroundColor() const { return maBackgroundColor
;}
258 // #103911# Set/Get document color for svx at SdrPageViews
259 void SetApplicationDocumentColor(Color aDocumentColor
);
260 const Color
& GetApplicationDocumentColor() const { return maDocumentColor
;}
264 #endif // INCLUDED_SVX_SVDPAGV_HXX
266 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */