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 <cppuhelper/implbase4.hxx>
25 #include <rtl/ustring.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>
32 #include <cppuhelper/implbase3.hxx>
34 #include <basegfx/polygon/b2dpolypolygon.hxx>
38 namespace vcl
{ class Region
; }
53 class ViewObjectContactRedirector
;
55 class ViewObjectContactRedirector
;
56 } // end of namespace contact
57 } // end of namespace sdr
59 // typedefs for a list of SdrPageWindow
61 typedef ::std::vector
< SdrPageWindow
* > SdrPageWindowVector
;
65 class SVX_DLLPUBLIC SdrPageView
70 Point aPgOrg
; // Nullpunkt der Page
72 Rectangle aMarkBound
; // wird
73 Rectangle aMarkSnap
; // von
77 SetOfByte aLayerVisi
; // Menge der sichtbaren Layer
78 SetOfByte aLayerLock
; // Menge der nicht editierbaren Layer
79 SetOfByte aLayerPrn
; // Menge der druckbaren Layer
81 SdrObjList
* pAktList
; // Aktuelle Liste, in der Regel die Page.
82 SdrObject
* pAktGroup
; // Aktuelle Gruppe. NULL=Keine.
84 SdrHelpLineList aHelpLines
; // Hilfslinien und -punkte
86 // #103911# Use one reserved slot (bReserveBool2) for the document color
87 Color maDocumentColor
;
89 // #103834# Use one reserved slot (bReserveBool1) for the background color
90 Color maBackgroundColor
;
92 SdrPageWindowVector maPageWindows
;
94 // #i72752# member to remember with which SdrPageWindow the BeginDrawLayer
96 SdrPageWindow
* mpPreparedPageWindow
;
98 // interface to SdrPageWindow
100 void ClearPageWindows();
101 void AppendPageWindow(SdrPageWindow
& rNew
);
102 SdrPageWindow
* RemovePageWindow(SdrPageWindow
& rOld
);
104 sal_uInt32
PageWindowCount() const { return maPageWindows
.size(); }
105 SdrPageWindow
* FindPageWindow( SdrPaintWindow
& rPaintWindow
) const;
106 SdrPageWindow
* FindPageWindow( const OutputDevice
& rOutDev
) const;
107 SdrPageWindow
* GetPageWindow(sal_uInt32 nIndex
) const;
109 /** finds the page window whose PaintWindow belongs to the given output device
111 In opposite to FindPageWindow, this method also cares possibly patched PaintWindow instances.
112 That is, a SdrPageWindow might have an original, and a patched SdrPaintWindow instance - if
113 this is the case, then the original SdrPaintWindow is examined before the patched one.
115 const SdrPageWindow
* FindPatchedPageWindow( const OutputDevice
& rOutDev
) const;
118 SVX_DLLPRIVATE SdrPageWindow
& CreateNewPageWindowEntry(SdrPaintWindow
& rPaintWindow
);
120 void ImpInvalidateHelpLineArea(sal_uInt16 nNum
) const;
122 void SetLayer(const OUString
& rName
, SetOfByte
& rBS
, bool bJa
);
123 bool IsLayer(const OUString
& rName
, const SetOfByte
& rBS
) const;
125 // Nachsehen, ob AktGroup noch Inserted ist.
126 void CheckAktGroup();
131 SdrPageView(SdrPage
* pPage1
, SdrView
& rNewView
);
134 // Wird von der PaintView gerufen, wenn Modelaenderungen abgeschlossen sind
135 void ModelHasChanged();
140 void AddPaintWindowToPageView(SdrPaintWindow
& rPaintWindow
);
141 void RemovePaintWindowFromPageView(SdrPaintWindow
& rPaintWindow
);
143 SdrView
& GetView() { return mrView
; }
144 const SdrView
& GetView() const { return mrView
; }
146 /** looks up the control container belonging to given output device
149 If the given output device belongs to one of the SdrPageViewWinRecs associated with this
150 SdrPageView instance, the XControlContainer for this output device is returned, <NULL/>
153 ::com::sun::star::uno::Reference
< ::com::sun::star::awt::XControlContainer
>
154 GetControlContainer( const OutputDevice
& _rDevice
) const;
156 /** sets all elements in the view which support a design and a alive mode into the given mode
158 void SetDesignMode( bool _bDesignMode
) const;
160 bool IsVisible() const { return mbVisible
; }
162 // Invalidiert den gesamten Bereich der Page
163 void InvalidateAllWin();
165 // PrePaint call forwarded from app windows
168 // rReg bezieht sich auf's OutDev, nicht auf die Page
169 void CompleteRedraw( SdrPaintWindow
& rPaintWindow
, const vcl::Region
& rReg
, sdr::contact::ViewObjectContactRedirector
* pRedirector
= NULL
);
171 // write access to mpPreparedPageWindow
172 void setPreparedPageWindow(SdrPageWindow
* pKnownTarget
);
174 void DrawLayer(SdrLayerID nID
, OutputDevice
* pGivenTarget
= 0, sdr::contact::ViewObjectContactRedirector
* pRedirector
= 0L,
175 const Rectangle
& rRect
= Rectangle());
176 void DrawPageViewGrid(OutputDevice
& rOut
, const Rectangle
& rRect
, Color aColor
= Color( COL_BLACK
) );
178 Rectangle
GetPageRect() const;
179 SdrPage
* GetPage() const { return mpPage
; }
181 // Betretene Liste rausreichen
182 SdrObjList
* GetObjList() const { return pAktList
; }
184 // Betretene Gruppe rausreichen
185 SdrObject
* GetAktGroup() const { return pAktGroup
; }
187 // Betretene Gruppe und Liste setzen
188 void SetAktGroupAndList(SdrObject
* pNewGroup
, SdrObjList
* pNewList
);
190 bool HasMarkedObjPageView() const { return mbHasMarked
; }
191 void SetHasMarkedObj(bool bOn
) { mbHasMarked
= bOn
; }
193 const Rectangle
& MarkBound() const { return aMarkBound
; }
194 const Rectangle
& MarkSnap() const { return aMarkSnap
; }
195 Rectangle
& MarkBound() { return aMarkBound
; }
196 Rectangle
& MarkSnap() { return aMarkSnap
; }
198 void SetLayerVisible(const OUString
& rName
, bool bShow
= true) { SetLayer(rName
, aLayerVisi
, bShow
); if(!bShow
) AdjHdl(); InvalidateAllWin(); }
199 bool IsLayerVisible(const OUString
& rName
) const { return IsLayer(rName
, aLayerVisi
); }
201 void SetLayerLocked(const OUString
& rName
, bool bLock
= true) { 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
= true) { SetLayer(rName
, aLayerPrn
, bPrn
); }
205 bool IsLayerPrintable(const OUString
& rName
) const { return IsLayer(rName
, aLayerPrn
); }
207 // PV stellt eine RefPage oder eine SubList eines RefObj dar oder Model ist ReadOnly
208 bool IsReadOnly() const;
210 // der Origin bezieht sich immer auf die obere linke Ecke der 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(Rectangle
& rRect
) const { rRect
.Move(-aPgOrg
.X(),-aPgOrg
.Y()); }
216 void PagePosToLogic(Point
& rPnt
) const { rPnt
+=aPgOrg
; }
217 void PagePosToLogic(Rectangle
& rRect
) const { rRect
.Move(aPgOrg
.X(),aPgOrg
.Y()); }
219 void SetVisibleLayers(const SetOfByte
& rSet
) { aLayerVisi
=rSet
; InvalidateAllWin(); }
220 const SetOfByte
& GetVisibleLayers() const { return aLayerVisi
; }
221 void SetPrintableLayers(const SetOfByte
& rSet
) { aLayerPrn
=rSet
; }
222 const SetOfByte
& GetPrintableLayers() const { return aLayerPrn
; }
223 void SetLockedLayers(const SetOfByte
& rSet
) { aLayerLock
=rSet
; }
224 const SetOfByte
& GetLockedLayers() const { return aLayerLock
; }
226 const SdrHelpLineList
& GetHelpLines() const { return aHelpLines
; }
227 void SetHelpLines(const SdrHelpLineList
& rHLL
);
228 //void SetHelpLinePos(sal_uInt16 nNum, const Point& rNewPos);
229 void SetHelpLine(sal_uInt16 nNum
, const SdrHelpLine
& rNewHelpLine
);
230 void DeleteHelpLine(sal_uInt16 nNum
);
231 void InsertHelpLine(const SdrHelpLine
& rHL
, sal_uInt16 nNum
=0xFFFF);
232 void MoveHelpLine(sal_uInt16 nNum
, sal_uInt16 nNewNum
) { aHelpLines
.Move(nNum
,nNewNum
); }
234 // Liefert sal_True, wenn Layer des Obj sichtbar und nicht gesperrt.
235 // Beim Gruppenobjekt muss wenigstens ein Member sichtbar sein,
236 // gesperrt sein darf keiner.
237 bool IsObjMarkable(SdrObject
* pObj
) const;
238 // hmm, selectable is surely the same as markable, now that I
239 // see this as I look for a place to put it. TO-DO,
241 bool IsObjSelectable(SdrObject
*pObj
) const;
244 // Betreten (Editieren) einer Objektgruppe. Anschliessend liegen alle
245 // Memberobjekte der Gruppe im direkten Zugriff. Alle anderen Objekte
246 // koennen waerendessen nicht bearbeitet werden (bis zum naechsten
247 // LeaveGroup()). (wie MsDos chdir bla).
248 bool EnterGroup(SdrObject
* pObj
);
250 // Verlassen einer betretenen Objektgruppe. (wie MsDos chdir ..)
251 void LeaveOneGroup();
253 // Verlassen aller betretenen Objektgruppen. (wie MsDos chdir \)
254 void LeaveAllGroup();
256 // Feststellen, wie weit hinabgestiegen wurde (0=Root(Page))
257 sal_uInt16
GetEnteredLevel() const;
259 // #103834# Set background color for svx at SdrPageViews
260 void SetApplicationBackgroundColor(Color aBackgroundColor
);
263 Color
GetApplicationBackgroundColor() const { return maBackgroundColor
;}
265 // #103911# Set/Get document color for svx at SdrPageViews
266 void SetApplicationDocumentColor(Color aDocumentColor
);
267 Color
GetApplicationDocumentColor() const { return maDocumentColor
;}
272 #endif // INCLUDED_SVX_SVDPAGV_HXX
274 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */