Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
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/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
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 .
18 : */
19 :
20 : #ifndef _SVDPAGV_HXX
21 : #define _SVDPAGV_HXX
22 :
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"
30 :
31 : #include <cppuhelper/implbase3.hxx>
32 : #include <vector>
33 : #include <basegfx/polygon/b2dpolypolygon.hxx>
34 :
35 : ////////////////////////////////////////////////////////////////////////////////////////////////////
36 :
37 : class Region;
38 : class SdrObjList;
39 : class SdrObject;
40 : class SdrPage;
41 : class SdrUnoObj;
42 : class SdrPaintWindow;
43 : class SdrView;
44 : class SdrPageObj;
45 : class SdrPageView;
46 :
47 : // #110094#
48 : namespace sdr
49 : {
50 : namespace contact
51 : {
52 : class ViewObjectContactRedirector;
53 : class DisplayInfo;
54 : class ViewObjectContactRedirector;
55 : } // end of namespace contact
56 : } // end of namespace sdr
57 :
58 : // typedefs for a list of SdrPageWindow
59 : class SdrPageWindow;
60 : typedef ::std::vector< SdrPageWindow* > SdrPageWindowVector;
61 :
62 : ////////////////////////////////////////////////////////////////////////////////////////////////////
63 :
64 : class SVX_DLLPUBLIC SdrPageView
65 : {
66 : private:
67 : SdrView& mrView;
68 : SdrPage* mpPage;
69 : Point aPgOrg; // Nullpunkt der Page
70 :
71 : Rectangle aMarkBound; // wird
72 : Rectangle aMarkSnap; // von
73 : sal_Bool mbHasMarked;
74 : sal_Bool mbVisible;
75 :
76 : SetOfByte aLayerVisi; // Menge der sichtbaren Layer
77 : SetOfByte aLayerLock; // Menge der nicht editierbaren Layer
78 : SetOfByte aLayerPrn; // Menge der druckbaren Layer
79 :
80 : SdrObjList* pAktList; // Aktuelle Liste, in der Regel die Page.
81 : SdrObject* pAktGroup; // Aktuelle Gruppe. NULL=Keine.
82 :
83 : SdrHelpLineList aHelpLines; // Hilfslinien und -punkte
84 :
85 : // #103911# Use one reserved slot (bReserveBool2) for the document color
86 : Color maDocumentColor;
87 :
88 : // #103834# Use one reserved slot (bReserveBool1) for the background color
89 : Color maBackgroundColor;
90 :
91 : SdrPageWindowVector maPageWindows;
92 :
93 : // #i72752# member to remember with which SdrPageWindow the BeginDrawLayer
94 : // was done
95 : SdrPageWindow* mpPreparedPageWindow;
96 :
97 : // interface to SdrPageWindow
98 : private:
99 : void ClearPageWindows();
100 : void AppendPageWindow(SdrPageWindow& rNew);
101 : SdrPageWindow* RemovePageWindow(SdrPageWindow& rOld);
102 : public:
103 0 : 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;
107 :
108 : /** finds the page window whose PaintWindow belongs to the given output device
109 :
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.
113 : */
114 : const SdrPageWindow* FindPatchedPageWindow( const OutputDevice& rOutDev ) const;
115 :
116 : void PaintOutlinerView(OutputDevice* pOut, const Rectangle& rRect) const;
117 :
118 : private:
119 : SVX_DLLPRIVATE SdrPageWindow& CreateNewPageWindowEntry(SdrPaintWindow& rPaintWindow);
120 :
121 : void ImpInvalidateHelpLineArea(sal_uInt16 nNum) const;
122 :
123 : void SetLayer(const String& rName, SetOfByte& rBS, sal_Bool bJa);
124 : sal_Bool IsLayer(const String& rName, const SetOfByte& rBS) const;
125 :
126 : // Nachsehen, ob AktGroup noch Inserted ist.
127 : void CheckAktGroup();
128 :
129 : void AdjHdl();
130 :
131 : public:
132 : SdrPageView(SdrPage* pPage1, SdrView& rNewView);
133 : ~SdrPageView();
134 :
135 : // Wird von der PaintView gerufen, wenn Modelaenderungen abgeschlossen sind
136 : void ModelHasChanged();
137 :
138 : void Show();
139 : void Hide();
140 :
141 : void AddPaintWindowToPageView(SdrPaintWindow& rPaintWindow);
142 : void RemovePaintWindowFromPageView(SdrPaintWindow& rPaintWindow);
143 :
144 0 : SdrView& GetView() { return mrView; }
145 0 : const SdrView& GetView() const { return mrView; }
146 :
147 : /** looks up the control container belonging to given output device
148 :
149 : @return
150 : If the given output device belongs to one of the SdrPageViewWinRecs associated with this
151 : SdrPageView instance, the XControlContainer for this output device is returned, <NULL/>
152 : otherwise.
153 : */
154 : ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer >
155 : GetControlContainer( const OutputDevice& _rDevice ) const;
156 :
157 : /** sets all elements in the view which support a design and a alive mode into the given mode
158 : */
159 : void SetDesignMode( bool _bDesignMode ) const;
160 :
161 : sal_Bool IsVisible() const { return mbVisible; }
162 :
163 : // Invalidiert den gesamten Bereich der Page
164 : void InvalidateAllWin();
165 :
166 : // PrePaint call forwarded from app windows
167 : void PrePaint();
168 :
169 : // rReg bezieht sich auf's OutDev, nicht auf die Page
170 : void CompleteRedraw(SdrPaintWindow& rPaintWindow, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = 0L) const;
171 :
172 : // write access to mpPreparedPageWindow
173 : void setPreparedPageWindow(SdrPageWindow* pKnownTarget);
174 :
175 : void DrawLayer(SdrLayerID nID, OutputDevice* pGivenTarget = 0, sdr::contact::ViewObjectContactRedirector* pRedirector = 0L,
176 : const Rectangle& rRect = Rectangle()) const;
177 : void DrawPageViewGrid(OutputDevice& rOut, const Rectangle& rRect, Color aColor = Color( COL_BLACK ) );
178 :
179 : Rectangle GetPageRect() const;
180 1274 : SdrPage* GetPage() const { return mpPage; }
181 :
182 : // Betretene Liste rausreichen
183 0 : SdrObjList* GetObjList() const { return pAktList; }
184 :
185 : // Betretene Gruppe rausreichen
186 0 : SdrObject* GetAktGroup() const { return pAktGroup; }
187 :
188 : // Betretene Gruppe und Liste setzen
189 : void SetAktGroupAndList(SdrObject* pNewGroup, SdrObjList* pNewList);
190 :
191 : sal_Bool HasMarkedObjPageView() const { return mbHasMarked; }
192 0 : void SetHasMarkedObj(sal_Bool bOn) { mbHasMarked = bOn; }
193 :
194 : const Rectangle& MarkBound() const { return aMarkBound; }
195 : const Rectangle& MarkSnap() const { return aMarkSnap; }
196 : Rectangle& MarkBound() { return aMarkBound; }
197 : Rectangle& MarkSnap() { return aMarkSnap; }
198 :
199 714 : void SetLayerVisible(const String& rName, sal_Bool bShow = sal_True) { SetLayer(rName, aLayerVisi, bShow); if(!bShow) AdjHdl(); InvalidateAllWin(); }
200 0 : sal_Bool IsLayerVisible(const String& rName) const { return IsLayer(rName, aLayerVisi); }
201 :
202 0 : void SetLayerLocked(const String& rName, sal_Bool bLock = sal_True) { SetLayer(rName, aLayerLock, bLock); if(bLock) AdjHdl(); }
203 0 : sal_Bool IsLayerLocked(const String& rName) const { return IsLayer(rName,aLayerLock); }
204 :
205 0 : void SetLayerPrintable(const String& rName, sal_Bool bPrn = sal_True) { SetLayer(rName, aLayerPrn, bPrn); }
206 0 : sal_Bool IsLayerPrintable(const String& rName) const { return IsLayer(rName, aLayerPrn); }
207 :
208 : // PV stellt eine RefPage oder eine SubList eines RefObj dar oder Model ist ReadOnly
209 : sal_Bool IsReadOnly() const;
210 :
211 : // der Origin bezieht sich immer auf die obere linke Ecke der Page
212 0 : const Point& GetPageOrigin() const { return aPgOrg; }
213 : void SetPageOrigin(const Point& rOrg);
214 :
215 0 : void LogicToPagePos(Point& rPnt) const { rPnt-=aPgOrg; }
216 0 : void LogicToPagePos(Rectangle& rRect) const { rRect.Move(-aPgOrg.X(),-aPgOrg.Y()); }
217 0 : void PagePosToLogic(Point& rPnt) const { rPnt+=aPgOrg; }
218 : void PagePosToLogic(Rectangle& rRect) const { rRect.Move(aPgOrg.X(),aPgOrg.Y()); }
219 :
220 0 : void SetVisibleLayers(const SetOfByte& rSet) { aLayerVisi=rSet; InvalidateAllWin(); }
221 0 : const SetOfByte& GetVisibleLayers() const { return aLayerVisi; }
222 0 : void SetPrintableLayers(const SetOfByte& rSet) { aLayerPrn=rSet; }
223 0 : const SetOfByte& GetPrintableLayers() const { return aLayerPrn; }
224 0 : void SetLockedLayers(const SetOfByte& rSet) { aLayerLock=rSet; }
225 0 : const SetOfByte& GetLockedLayers() const { return aLayerLock; }
226 :
227 0 : const SdrHelpLineList& GetHelpLines() const { return aHelpLines; }
228 : void SetHelpLines(const SdrHelpLineList& rHLL);
229 : //void SetHelpLinePos(sal_uInt16 nNum, const Point& rNewPos);
230 : void SetHelpLine(sal_uInt16 nNum, const SdrHelpLine& rNewHelpLine);
231 : void DeleteHelpLine(sal_uInt16 nNum);
232 : void InsertHelpLine(const SdrHelpLine& rHL, sal_uInt16 nNum=0xFFFF);
233 : void MoveHelpLine(sal_uInt16 nNum, sal_uInt16 nNewNum) { aHelpLines.Move(nNum,nNewNum); }
234 :
235 : // Liefert sal_True, wenn Layer des Obj sichtbar und nicht gesperrt.
236 : // Beim Gruppenobjekt muss wenigstens ein Member sichtbar sein,
237 : // gesperrt sein darf keiner.
238 : sal_Bool IsObjMarkable(SdrObject* pObj) const;
239 :
240 : // Betreten (Editieren) einer Objektgruppe. Anschliessend liegen alle
241 : // Memberobjekte der Gruppe im direkten Zugriff. Alle anderen Objekte
242 : // koennen waerendessen nicht bearbeitet werden (bis zum naechsten
243 : // LeaveGroup()). (wie MsDos chdir bla).
244 : sal_Bool EnterGroup(SdrObject* pObj);
245 :
246 : // Verlassen einer betretenen Objektgruppe. (wie MsDos chdir ..)
247 : void LeaveOneGroup();
248 :
249 : // Verlassen aller betretenen Objektgruppen. (wie MsDos chdir \)
250 : void LeaveAllGroup();
251 :
252 : // Feststellen, wie weit hinabgestiegen wurde (0=Root(Page))
253 : sal_uInt16 GetEnteredLevel() const;
254 :
255 : // #103834# Set background color for svx at SdrPageViews
256 : void SetApplicationBackgroundColor(Color aBackgroundColor);
257 :
258 : // #109585#
259 : Color GetApplicationBackgroundColor() const;
260 :
261 : // #103911# Set/Get document color for svx at SdrPageViews
262 : void SetApplicationDocumentColor(Color aDocumentColor);
263 : Color GetApplicationDocumentColor() const;
264 : };
265 :
266 : ////////////////////////////////////////////////////////////////////////////////////////////////////
267 :
268 : #endif //_SVDPAGV_HXX
269 :
270 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|