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