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 .
23 #include <com/sun/star/awt/XControlContainer.hpp>
24 #include <svl/lstner.hxx>
25 #include <svx/svdhlpln.hxx>
26 #include <cppuhelper/implbase4.hxx>
27 #include <svx/svdsob.hxx>
28 #include <svx/svdtypes.hxx>
29 #include "svx/svxdllapi.h"
31 #include <cppuhelper/implbase3.hxx>
33 #include <basegfx/polygon/b2dpolypolygon.hxx>
35 ////////////////////////////////////////////////////////////////////////////////////////////////////
52 class ViewObjectContactRedirector
;
54 class ViewObjectContactRedirector
;
55 } // end of namespace contact
56 } // end of namespace sdr
58 // typedefs for a list of SdrPageWindow
60 typedef ::std::vector
< SdrPageWindow
* > SdrPageWindowVector
;
62 ////////////////////////////////////////////////////////////////////////////////////////////////////
64 class SVX_DLLPUBLIC SdrPageView
69 Point aPgOrg
; // Nullpunkt der Page
71 Rectangle aMarkBound
; // wird
72 Rectangle aMarkSnap
; // von
76 SetOfByte aLayerVisi
; // Menge der sichtbaren Layer
77 SetOfByte aLayerLock
; // Menge der nicht editierbaren Layer
78 SetOfByte aLayerPrn
; // Menge der druckbaren Layer
80 SdrObjList
* pAktList
; // Aktuelle Liste, in der Regel die Page.
81 SdrObject
* pAktGroup
; // Aktuelle Gruppe. NULL=Keine.
83 SdrHelpLineList aHelpLines
; // Hilfslinien und -punkte
85 // #103911# Use one reserved slot (bReserveBool2) for the document color
86 Color maDocumentColor
;
88 // #103834# Use one reserved slot (bReserveBool1) for the background color
89 Color maBackgroundColor
;
91 SdrPageWindowVector maPageWindows
;
93 // #i72752# member to remember with which SdrPageWindow the BeginDrawLayer
95 SdrPageWindow
* mpPreparedPageWindow
;
97 // interface to SdrPageWindow
99 void ClearPageWindows();
100 void AppendPageWindow(SdrPageWindow
& rNew
);
101 SdrPageWindow
* RemovePageWindow(SdrPageWindow
& rOld
);
103 sal_uInt32
PageWindowCount() const { return maPageWindows
.size(); }
104 SdrPageWindow
* FindPageWindow( SdrPaintWindow
& rPaintWindow
) const;
105 SdrPageWindow
* FindPageWindow( const OutputDevice
& rOutDev
) const;
106 SdrPageWindow
* GetPageWindow(sal_uInt32 nIndex
) const;
108 /** finds the page window whose PaintWindow belongs to the given output device
110 In opposite to FindPageWindow, this method also cares possibly patched PaintWindow instances.
111 That is, a SdrPageWindow might have an original, and a patched SdrPaintWindow instance - if
112 this is the case, then the original SdrPaintWindow is examined before the patched one.
114 const SdrPageWindow
* FindPatchedPageWindow( const OutputDevice
& rOutDev
) const;
117 SVX_DLLPRIVATE SdrPageWindow
& CreateNewPageWindowEntry(SdrPaintWindow
& rPaintWindow
);
119 void ImpInvalidateHelpLineArea(sal_uInt16 nNum
) const;
121 void SetLayer(const String
& rName
, SetOfByte
& rBS
, sal_Bool bJa
);
122 sal_Bool
IsLayer(const String
& rName
, const SetOfByte
& rBS
) const;
124 // Nachsehen, ob AktGroup noch Inserted ist.
125 void CheckAktGroup();
130 SdrPageView(SdrPage
* pPage1
, SdrView
& rNewView
);
133 // Wird von der PaintView gerufen, wenn Modelaenderungen abgeschlossen sind
134 void ModelHasChanged();
139 void AddPaintWindowToPageView(SdrPaintWindow
& rPaintWindow
);
140 void RemovePaintWindowFromPageView(SdrPaintWindow
& rPaintWindow
);
142 SdrView
& GetView() { return mrView
; }
143 const SdrView
& GetView() const { return mrView
; }
145 /** looks up the control container belonging to given output device
148 If the given output device belongs to one of the SdrPageViewWinRecs associated with this
149 SdrPageView instance, the XControlContainer for this output device is returned, <NULL/>
152 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlContainer
>
153 GetControlContainer( const OutputDevice
& _rDevice
) const;
155 /** sets all elements in the view which support a design and a alive mode into the given mode
157 void SetDesignMode( bool _bDesignMode
) const;
159 sal_Bool
IsVisible() const { return mbVisible
; }
161 // Invalidiert den gesamten Bereich der Page
162 void InvalidateAllWin();
164 // PrePaint call forwarded from app windows
167 // rReg bezieht sich auf's OutDev, nicht auf die Page
168 void CompleteRedraw(SdrPaintWindow
& rPaintWindow
, const Region
& rReg
, sdr::contact::ViewObjectContactRedirector
* pRedirector
= 0L) const;
170 // write access to mpPreparedPageWindow
171 void setPreparedPageWindow(SdrPageWindow
* pKnownTarget
);
173 void DrawLayer(SdrLayerID nID
, OutputDevice
* pGivenTarget
= 0, sdr::contact::ViewObjectContactRedirector
* pRedirector
= 0L,
174 const Rectangle
& rRect
= Rectangle()) const;
175 void DrawPageViewGrid(OutputDevice
& rOut
, const Rectangle
& rRect
, Color aColor
= Color( COL_BLACK
) );
177 Rectangle
GetPageRect() const;
178 SdrPage
* GetPage() const { return mpPage
; }
180 // Betretene Liste rausreichen
181 SdrObjList
* GetObjList() const { return pAktList
; }
183 // Betretene Gruppe rausreichen
184 SdrObject
* GetAktGroup() const { return pAktGroup
; }
186 // Betretene Gruppe und Liste setzen
187 void SetAktGroupAndList(SdrObject
* pNewGroup
, SdrObjList
* pNewList
);
189 sal_Bool
HasMarkedObjPageView() const { return mbHasMarked
; }
190 void SetHasMarkedObj(sal_Bool bOn
) { mbHasMarked
= bOn
; }
192 const Rectangle
& MarkBound() const { return aMarkBound
; }
193 const Rectangle
& MarkSnap() const { return aMarkSnap
; }
194 Rectangle
& MarkBound() { return aMarkBound
; }
195 Rectangle
& MarkSnap() { return aMarkSnap
; }
197 void SetLayerVisible(const String
& rName
, sal_Bool bShow
= sal_True
) { SetLayer(rName
, aLayerVisi
, bShow
); if(!bShow
) AdjHdl(); InvalidateAllWin(); }
198 sal_Bool
IsLayerVisible(const String
& rName
) const { return IsLayer(rName
, aLayerVisi
); }
200 void SetLayerLocked(const String
& rName
, sal_Bool bLock
= sal_True
) { SetLayer(rName
, aLayerLock
, bLock
); if(bLock
) AdjHdl(); }
201 sal_Bool
IsLayerLocked(const String
& rName
) const { return IsLayer(rName
,aLayerLock
); }
203 void SetLayerPrintable(const String
& rName
, sal_Bool bPrn
= sal_True
) { SetLayer(rName
, aLayerPrn
, bPrn
); }
204 sal_Bool
IsLayerPrintable(const String
& rName
) const { return IsLayer(rName
, aLayerPrn
); }
206 // PV stellt eine RefPage oder eine SubList eines RefObj dar oder Model ist ReadOnly
207 sal_Bool
IsReadOnly() const;
209 // der Origin bezieht sich immer auf die obere linke Ecke der Page
210 const Point
& GetPageOrigin() const { return aPgOrg
; }
211 void SetPageOrigin(const Point
& rOrg
);
213 void LogicToPagePos(Point
& rPnt
) const { rPnt
-=aPgOrg
; }
214 void LogicToPagePos(Rectangle
& rRect
) const { rRect
.Move(-aPgOrg
.X(),-aPgOrg
.Y()); }
215 void PagePosToLogic(Point
& rPnt
) const { rPnt
+=aPgOrg
; }
216 void PagePosToLogic(Rectangle
& rRect
) const { rRect
.Move(aPgOrg
.X(),aPgOrg
.Y()); }
218 void SetVisibleLayers(const SetOfByte
& rSet
) { aLayerVisi
=rSet
; InvalidateAllWin(); }
219 const SetOfByte
& GetVisibleLayers() const { return aLayerVisi
; }
220 void SetPrintableLayers(const SetOfByte
& rSet
) { aLayerPrn
=rSet
; }
221 const SetOfByte
& GetPrintableLayers() const { return aLayerPrn
; }
222 void SetLockedLayers(const SetOfByte
& rSet
) { aLayerLock
=rSet
; }
223 const SetOfByte
& 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
, sal_uInt16 nNum
=0xFFFF);
231 void MoveHelpLine(sal_uInt16 nNum
, sal_uInt16 nNewNum
) { aHelpLines
.Move(nNum
,nNewNum
); }
233 // Liefert sal_True, wenn Layer des Obj sichtbar und nicht gesperrt.
234 // Beim Gruppenobjekt muss wenigstens ein Member sichtbar sein,
235 // gesperrt sein darf keiner.
236 sal_Bool
IsObjMarkable(SdrObject
* pObj
) const;
238 // Betreten (Editieren) einer Objektgruppe. Anschliessend liegen alle
239 // Memberobjekte der Gruppe im direkten Zugriff. Alle anderen Objekte
240 // koennen waerendessen nicht bearbeitet werden (bis zum naechsten
241 // LeaveGroup()). (wie MsDos chdir bla).
242 sal_Bool
EnterGroup(SdrObject
* pObj
);
244 // Verlassen einer betretenen Objektgruppe. (wie MsDos chdir ..)
245 void LeaveOneGroup();
247 // Verlassen aller betretenen Objektgruppen. (wie MsDos chdir \)
248 void LeaveAllGroup();
250 // Feststellen, wie weit hinabgestiegen wurde (0=Root(Page))
251 sal_uInt16
GetEnteredLevel() const;
253 // #103834# Set background color for svx at SdrPageViews
254 void SetApplicationBackgroundColor(Color aBackgroundColor
);
257 Color
GetApplicationBackgroundColor() const;
259 // #103911# Set/Get document color for svx at SdrPageViews
260 void SetApplicationDocumentColor(Color aDocumentColor
);
261 Color
GetApplicationDocumentColor() const;
264 ////////////////////////////////////////////////////////////////////////////////////////////////////
266 #endif //_SVDPAGV_HXX
268 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */