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 <svl/lstner.hxx>
26 #include <svx/svdhlpln.hxx>
27 #include <svx/svdsob.hxx>
28 #include <svx/svdtypes.hxx>
29 #include <svx/svxdllapi.h>
32 #include <basegfx/polygon/b2dpolypolygon.hxx>
35 namespace vcl
{ class Region
; }
49 class ViewObjectContactRedirector
;
51 class ViewObjectContactRedirector
;
52 } // end of namespace contact
53 } // end of namespace sdr
55 // typedefs for a list of SdrPageWindow
57 typedef ::std::vector
< SdrPageWindow
* > SdrPageWindowVector
;
60 class SVX_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
* pAktList
; // Current List, usually the Page
77 SdrObject
* pAktGroup
; // 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 SdrPageWindowVector maPageWindows
;
89 // #i72752# member to remember with which SdrPageWindow the BeginDrawLayer
91 SdrPageWindow
* mpPreparedPageWindow
;
93 // interface to SdrPageWindow
94 void ClearPageWindows();
95 SdrPageWindow
* RemovePageWindow(SdrPageWindow
& rOld
);
97 sal_uInt32
PageWindowCount() const { return maPageWindows
.size(); }
98 SdrPageWindow
* FindPageWindow( SdrPaintWindow
& rPaintWindow
) const;
99 SdrPageWindow
* FindPageWindow( const OutputDevice
& rOutDev
) const;
100 SdrPageWindow
* GetPageWindow(sal_uInt32 nIndex
) const;
103 * Finds the page window whose PaintWindow belongs to the given output device
104 * In opposite to FindPageWindow, this method also cares possibly patched PaintWindow instances.
105 * That is, a SdrPageWindow might have an original, and a patched SdrPaintWindow instance - if
106 * this is the case, then the original SdrPaintWindow is examined before the patched one.
108 const SdrPageWindow
* FindPatchedPageWindow( const OutputDevice
& rOutDev
) const;
111 void ImpInvalidateHelpLineArea(sal_uInt16 nNum
) const;
113 void SetLayer(const OUString
& rName
, SdrLayerIDSet
& rBS
, bool bJa
);
114 bool IsLayer(const OUString
& rName
, const SdrLayerIDSet
& rBS
) const;
116 /// Let's see if the current Group (pAktGroup) is still inserted
117 void CheckAktGroup();
122 SdrPageView(SdrPage
* pPage1
, SdrView
& rNewView
);
125 /// Is called by PaintView, when modal changes have finished
126 void ModelHasChanged();
131 void AddPaintWindowToPageView(SdrPaintWindow
& rPaintWindow
);
132 void RemovePaintWindowFromPageView(SdrPaintWindow
& rPaintWindow
);
134 SdrView
& GetView() { return mrView
; }
135 const SdrView
& GetView() const { return mrView
; }
138 * Looks up the control container belonging to given output device
140 * If the given output device belongs to one of the SdrPageViewWinRecs associated with this
141 * SdrPageView instance, the XControlContainer for this output device is returned, <NULL/>
144 css::uno::Reference
< css::awt::XControlContainer
>
145 GetControlContainer( const OutputDevice
& _rDevice
) const;
147 /// Sets all elements in the view which support a design and a alive mode into the given mode
148 void SetDesignMode( bool _bDesignMode
) const;
150 bool IsVisible() const { return mbVisible
; }
152 /// Invalidates the Page's whole area
153 void InvalidateAllWin();
155 /// PrePaint call forwarded from app windows
158 /// @param rReg refers to the OutDev and not to the Page
159 void CompleteRedraw( SdrPaintWindow
& rPaintWindow
, const vcl::Region
& rReg
, sdr::contact::ViewObjectContactRedirector
* pRedirector
);
161 /// Write access to mpPreparedPageWindow
162 void setPreparedPageWindow(SdrPageWindow
* pKnownTarget
);
164 void DrawLayer(SdrLayerID nID
, OutputDevice
* pGivenTarget
, sdr::contact::ViewObjectContactRedirector
* pRedirector
= nullptr,
165 const tools::Rectangle
& rRect
= tools::Rectangle(),
166 basegfx::B2IRange
const* pPageFrame
= nullptr);
167 void DrawPageViewGrid(OutputDevice
& rOut
, const tools::Rectangle
& rRect
, Color aColor
= Color( COL_BLACK
) );
169 tools::Rectangle
GetPageRect() const;
170 SdrPage
* GetPage() const { return mpPage
; }
172 /// Return current List
173 SdrObjList
* GetObjList() const { return pAktList
; }
175 /// Return current Group
176 SdrObject
* GetAktGroup() const { return pAktGroup
; }
178 /// Set current Group and List
179 void SetAktGroupAndList(SdrObject
* pNewGroup
, SdrObjList
* pNewList
);
181 bool HasMarkedObjPageView() const { return mbHasMarked
; }
182 void SetHasMarkedObj(bool bOn
) { mbHasMarked
= bOn
; }
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
; }
189 void SetLayerVisible(const OUString
& rName
, bool bShow
) {
190 SetLayer(rName
, aLayerVisi
, bShow
);
194 bool IsLayerVisible(const OUString
& rName
) const { return IsLayer(rName
, aLayerVisi
); }
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
); }
199 void SetLayerPrintable(const OUString
& rName
, bool bPrn
) { SetLayer(rName
, aLayerPrn
, bPrn
); }
200 bool IsLayerPrintable(const OUString
& rName
) const { return IsLayer(rName
, aLayerPrn
); }
202 /// PV represents a RefPage or a SubList of a RefObj, or the Model is ReadOnly
203 bool IsReadOnly() const;
205 /// The Origin always refers to the upper left corner of the Page
206 const Point
& GetPageOrigin() const { return aPgOrg
; }
207 void SetPageOrigin(const Point
& rOrg
);
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
; }
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
; }
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
);
227 /// At least one member must be visible for the Group object and
228 /// it must not be locked
230 /// true, if the object's layer is visible and not locked
231 bool IsObjMarkable(SdrObject
* pObj
) const;
233 /// Entering (editing) an object group
234 /// After that, we have direct access to all member objects of the group.
235 /// All other objects are not editable in the meantime (until the next
237 bool EnterGroup(SdrObject
* pObj
);
239 /// Leave an object group we entered previously
240 void LeaveOneGroup();
242 /// Leave all object groups we entered previously
243 void LeaveAllGroup();
245 /// Determine, how deep we descended (0 = Root(Page))
246 sal_uInt16
GetEnteredLevel() const;
248 // #103834# Set background color for svx at SdrPageViews
249 void SetApplicationBackgroundColor(Color aBackgroundColor
);
251 const Color
& GetApplicationBackgroundColor() const { return maBackgroundColor
;}
253 // #103911# Set/Get document color for svx at SdrPageViews
254 void SetApplicationDocumentColor(Color aDocumentColor
);
255 const Color
& GetApplicationDocumentColor() const { return maDocumentColor
;}
259 #endif // INCLUDED_SVX_SVDPAGV_HXX
261 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */