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