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 <svx/svdhlpln.hxx>
27 #include <svx/svdsob.hxx>
28 #include <svx/svdtypes.hxx>
29 #include <svx/svxdllapi.h>
33 #include <basegfx/range/b2irectangle.hxx>
36 namespace vcl
{ class Region
; }
50 class ViewObjectContactRedirector
;
52 class ViewObjectContactRedirector
;
53 } // end of namespace contact
54 } // end of namespace sdr
56 // typedefs for a list of SdrPageWindow
60 class SVXCORE_DLLPUBLIC SdrPageView
65 Point aPgOrg
; // The Page's point of origin
67 tools::Rectangle aMarkBound
;
68 tools::Rectangle aMarkSnap
;
72 SdrLayerIDSet aLayerVisi
; // Set of visible Layers
73 SdrLayerIDSet aLayerLock
; // Set of non-editable Layers
74 SdrLayerIDSet aLayerPrn
; // Set of printable Layers
76 SdrObjList
* pCurrentList
; // Current List, usually the Page
77 SdrObject
* pCurrentGroup
; // Current Group; nullptr means none
79 SdrHelpLineList aHelpLines
; // Helper lines and points
81 // #103911# Use one reserved slot (bReserveBool2) for the document color
82 Color maDocumentColor
;
84 // #103834# Use one reserved slot (bReserveBool1) for the background color
85 Color maBackgroundColor
;
87 std::vector
< std::unique_ptr
<SdrPageWindow
> > maPageWindows
;
89 // #i72752# member to remember with which SdrPageWindow the BeginDrawLayer
91 SdrPageWindow
* mpPreparedPageWindow
;
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;
100 * Finds the page window whose PaintWindow belongs to the given output device
101 * In opposite to FindPageWindow, this method also cares possibly patched PaintWindow instances.
102 * That is, a SdrPageWindow might have an original, and a patched SdrPaintWindow instance - if
103 * this is the case, then the original SdrPaintWindow is examined before the patched one.
105 const SdrPageWindow
* FindPatchedPageWindow( const OutputDevice
& rOutDev
) const;
108 void ImpInvalidateHelpLineArea(sal_uInt16 nNum
) const;
110 void SetLayer(const OUString
& rName
, SdrLayerIDSet
& rBS
, bool bJa
);
111 bool IsLayer(const OUString
& rName
, const SdrLayerIDSet
& rBS
) const;
113 /// Let's see if the current Group (pCurrentGroup) is still inserted
114 void CheckCurrentGroup();
119 SdrPageView(SdrPage
* pPage1
, SdrView
& rNewView
);
122 SdrPageView
& operator=( SdrPageView
const & ) = delete; // MSVC2017 workaround
123 SdrPageView( SdrPageView
const & ) = delete; // MSVC2017 workaround
126 /// Is called by PaintView, when modal changes have finished
127 void ModelHasChanged();
132 void AddPaintWindowToPageView(SdrPaintWindow
& rPaintWindow
);
133 void RemovePaintWindowFromPageView(SdrPaintWindow
& rPaintWindow
);
135 SdrView
& GetView() { return mrView
; }
136 const SdrView
& GetView() const { return mrView
; }
139 * Looks up the control container belonging to given output device
141 * If the given output device belongs to one of the SdrPageViewWinRecs associated with this
142 * SdrPageView instance, the XControlContainer for this output device is returned, <NULL/>
145 css::uno::Reference
< css::awt::XControlContainer
>
146 GetControlContainer( const OutputDevice
& _rDevice
) const;
148 /// Sets all elements in the view which support a design and an alive mode into the given mode
149 void SetDesignMode( bool _bDesignMode
) const;
151 bool IsVisible() const { return mbVisible
; }
153 /// Invalidates the Page's whole area
154 void InvalidateAllWin();
156 /// PrePaint call forwarded from app windows
159 /// @param rReg refers to the OutDev and not to the Page
160 void CompleteRedraw( SdrPaintWindow
& rPaintWindow
, const vcl::Region
& rReg
, sdr::contact::ViewObjectContactRedirector
* pRedirector
);
162 /// Write access to mpPreparedPageWindow
163 void setPreparedPageWindow(SdrPageWindow
* pKnownTarget
);
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
);
170 tools::Rectangle
GetPageRect() const;
171 SdrPage
* GetPage() const { return mpPage
; }
173 /// Return current List
174 SdrObjList
* GetObjList() const { return pCurrentList
; }
176 /// Return current Group
177 SdrObject
* GetCurrentGroup() const { return pCurrentGroup
; }
179 /// Set current Group and List
180 void SetCurrentGroupAndList(SdrObject
* pNewGroup
, SdrObjList
* pNewList
);
182 bool HasMarkedObjPageView() const { return mbHasMarked
; }
183 void SetHasMarkedObj(bool bOn
) { mbHasMarked
= bOn
; }
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
; }
190 void SetLayerVisible(const OUString
& rName
, bool bShow
) {
191 SetLayer(rName
, aLayerVisi
, bShow
);
195 bool IsLayerVisible(const OUString
& rName
) const { return IsLayer(rName
, aLayerVisi
); }
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
); }
200 void SetLayerPrintable(const OUString
& rName
, bool bPrn
) { SetLayer(rName
, aLayerPrn
, bPrn
); }
201 bool IsLayerPrintable(const OUString
& rName
) const { return IsLayer(rName
, aLayerPrn
); }
203 /// PV represents a RefPage or a SubList of a RefObj, or the Model is ReadOnly
204 bool IsReadOnly() const;
206 /// The Origin always refers to the upper left corner of the Page
207 const Point
& GetPageOrigin() const { return aPgOrg
; }
208 void SetPageOrigin(const Point
& rOrg
);
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
; }
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
; }
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
);
228 /// At least one member must be visible for the Group object and
229 /// it must not be locked
231 /// true, if the object's layer is visible and not locked
232 bool IsObjMarkable(SdrObject
const * pObj
) const;
234 /// Entering (editing) an object group
235 /// After that, we have direct access to all member objects of the group.
236 /// All other objects are not editable in the meantime (until the next
238 bool EnterGroup(SdrObject
* pObj
);
240 /// Leave an object group we entered previously
241 void LeaveOneGroup();
243 /// Leave all object groups we entered previously
244 void LeaveAllGroup();
246 /// Determine, how deep we descended (0 = Root(Page))
247 sal_uInt16
GetEnteredLevel() const;
249 // #103834# Set background color for svx at SdrPageViews
250 void SetApplicationBackgroundColor(Color aBackgroundColor
);
252 const Color
& GetApplicationBackgroundColor() const { return maBackgroundColor
;}
254 // #103911# Set/Get document color for svx at SdrPageViews
255 void SetApplicationDocumentColor(Color aDocumentColor
);
256 const Color
& GetApplicationDocumentColor() const { return maDocumentColor
;}
260 #endif // INCLUDED_SVX_SVDPAGV_HXX
262 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */