1 /************************************************************** 2 * 3 * Licensed to the Apache Software Foundation (ASF) under one 4 * or more contributor license agreements. See the NOTICE file 5 * distributed with this work for additional information 6 * regarding copyright ownership. The ASF licenses this file 7 * to you under the Apache License, Version 2.0 (the 8 * "License"); you may not use this file except in compliance 9 * with the License. You may obtain a copy of the License at 10 * 11 * http://www.apache.org/licenses/LICENSE-2.0 12 * 13 * Unless required by applicable law or agreed to in writing, 14 * software distributed under the License is distributed on an 15 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 16 * KIND, either express or implied. See the License for the 17 * specific language governing permissions and limitations 18 * under the License. 19 * 20 *************************************************************/ 21 22 23 24 #ifndef _SVDPAGV_HXX 25 #define _SVDPAGV_HXX 26 27 #include <com/sun/star/awt/XControlContainer.hpp> 28 #include <svl/lstner.hxx> 29 #include <svx/svdhlpln.hxx> 30 #include <cppuhelper/implbase4.hxx> 31 #include <svx/svdsob.hxx> 32 #include <svx/svdtypes.hxx> 33 #include "svx/svxdllapi.h" 34 35 #include <cppuhelper/implbase3.hxx> 36 #include <vector> 37 #include <basegfx/polygon/b2dpolypolygon.hxx> 38 39 //////////////////////////////////////////////////////////////////////////////////////////////////// 40 41 class Region; 42 class SdrObjList; 43 class SdrObject; 44 class SdrPage; 45 class SdrUnoObj; 46 class SdrPaintWindow; 47 class SdrView; 48 class SdrPageObj; 49 class B2dIAOManager; 50 class SdrPageView; 51 52 // #110094# 53 namespace sdr 54 { 55 namespace contact 56 { 57 class ViewObjectContactRedirector; 58 class DisplayInfo; 59 class ViewObjectContactRedirector; 60 } // end of namespace contact 61 } // end of namespace sdr 62 63 // typedefs for a list of SdrPageWindow 64 class SdrPageWindow; 65 typedef ::std::vector< SdrPageWindow* > SdrPageWindowVector; 66 67 //////////////////////////////////////////////////////////////////////////////////////////////////// 68 69 class SVX_DLLPUBLIC SdrPageView : public SfxListener 70 { 71 protected: 72 SdrView& mrView; 73 SdrPage* mpPage; 74 Point aPgOrg; // Nullpunkt der Page 75 76 Rectangle aMarkBound; // wird 77 Rectangle aMarkSnap; // von 78 sal_Bool mbHasMarked; 79 sal_Bool mbVisible; 80 81 SetOfByte aLayerVisi; // Menge der sichtbaren Layer 82 SetOfByte aLayerLock; // Menge der nicht editierbaren Layer 83 SetOfByte aLayerPrn; // Menge der druckbaren Layer 84 85 SdrObjList* pAktList; // Aktuelle Liste, in der Regel die Page. 86 SdrObject* pAktGroup; // Aktuelle Gruppe. NULL=Keine. 87 88 SdrHelpLineList aHelpLines; // Hilfslinien und -punkte 89 90 // #103911# Use one reserved slot (bReserveBool2) for the document color 91 Color maDocumentColor; 92 93 // #103834# Use one reserved slot (bReserveBool1) for the background color 94 Color maBackgroundColor; 95 96 SdrPageWindowVector maPageWindows; 97 98 // #i72752# member to remember with which SdrPageWindow the BeginDrawLayer 99 // was done 100 SdrPageWindow* mpPreparedPageWindow; 101 102 // interface to SdrPageWindow 103 protected: 104 void ClearPageWindows(); 105 void AppendPageWindow(SdrPageWindow& rNew); 106 SdrPageWindow* RemovePageWindow(sal_uInt32 nPos); 107 SdrPageWindow* RemovePageWindow(SdrPageWindow& rOld); 108 public: PageWindowCount() const109 sal_uInt32 PageWindowCount() const { return maPageWindows.size(); } 110 SdrPageWindow* FindPageWindow( SdrPaintWindow& rPaintWindow ) const; 111 SdrPageWindow* FindPageWindow( const OutputDevice& rOutDev ) const; 112 SdrPageWindow* GetPageWindow(sal_uInt32 nIndex) const; 113 114 /** finds the page window whose PaintWindow belongs to the given output device 115 116 In opposite to FindPageWindow, this method also cares possibly patched PaintWindow instances. 117 That is, a SdrPageWindow might have an original, and a patched SdrPaintWindow instance - if 118 this is the case, then the original SdrPaintWindow is examined before the patched one. 119 */ 120 const SdrPageWindow* FindPatchedPageWindow( const OutputDevice& rOutDev ) const; 121 122 private: 123 SVX_DLLPRIVATE SdrPageWindow& CreateNewPageWindowEntry(SdrPaintWindow& rPaintWindow); 124 125 protected: 126 void ImpInvalidateHelpLineArea(sal_uInt16 nNum) const; 127 128 protected: 129 void SetLayer(const String& rName, SetOfByte& rBS, sal_Bool bJa); 130 sal_Bool IsLayer(const String& rName, const SetOfByte& rBS) const; 131 void SetAllLayers(SetOfByte& rB, sal_Bool bJa); 132 133 virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint); 134 135 // Nachsehen, ob AktGroup noch Inserted ist. 136 void CheckAktGroup(); 137 138 void AdjHdl(); 139 140 public: 141 TYPEINFO(); 142 SdrPageView(SdrPage* pPage1, SdrView& rNewView); 143 ~SdrPageView(); 144 145 // Wird von der PaintView gerufen, wenn Modelaenderungen abgeschlossen sind 146 void ModelHasChanged(); 147 148 void Show(); 149 void Hide(); 150 151 void AddPaintWindowToPageView(SdrPaintWindow& rPaintWindow); 152 void RemovePaintWindowFromPageView(SdrPaintWindow& rPaintWindow); 153 GetView()154 SdrView& GetView() { return mrView; } GetView() const155 const SdrView& GetView() const { return mrView; } 156 157 /** looks up the control container belonging to given output device 158 159 @return 160 If the given output device belongs to one of the SdrPageViewWinRecs associated with this 161 SdrPageView instance, the XControlContainer for this output device is returned, <NULL/> 162 otherwise. 163 */ 164 ::com::sun::star::uno::Reference< ::com::sun::star::awt::XControlContainer > 165 GetControlContainer( const OutputDevice& _rDevice ) const; 166 167 /** sets all elements in the view which support a design and a alive mode into the given mode 168 */ 169 void SetDesignMode( bool _bDesignMode ) const; 170 IsVisible() const171 sal_Bool IsVisible() const { return mbVisible; } 172 173 // Invalidiert den gesamten Bereich der Page 174 void InvalidateAllWin(); 175 176 // rRect bezieht sich auf die Page 177 void InvalidateAllWin(const Rectangle& rRect, sal_Bool bPlus1Pix=sal_False); 178 179 // PrePaint call forwarded from app windows 180 void PrePaint(); 181 182 // PostPaint call forwarded from app windows 183 void PostPaint(); 184 185 // rReg bezieht sich auf's OutDev, nicht auf die Page 186 void CompleteRedraw(SdrPaintWindow& rPaintWindow, const Region& rReg, sdr::contact::ViewObjectContactRedirector* pRedirector = 0L) const; 187 188 // write access to mpPreparedPageWindow 189 void setPreparedPageWindow(SdrPageWindow* pKnownTarget); 190 191 void DrawLayer(SdrLayerID nID, OutputDevice* pGivenTarget = 0, sdr::contact::ViewObjectContactRedirector* pRedirector = 0L) const; 192 void DrawPageViewGrid(OutputDevice& rOut, const Rectangle& rRect, Color aColor = Color( COL_BLACK ) ); 193 194 Rectangle GetPageRect() const; GetPage() const195 SdrPage* GetPage() const { return mpPage; } 196 197 // Betretene Liste rausreichen GetObjList() const198 SdrObjList* GetObjList() const { return pAktList; } 199 200 // Betretene Gruppe rausreichen GetAktGroup() const201 SdrObject* GetAktGroup() const { return pAktGroup; } 202 203 // Betretene Gruppe und Liste setzen 204 void SetAktGroupAndList(SdrObject* pNewGroup, SdrObjList* pNewList); 205 HasMarkedObjPageView() const206 sal_Bool HasMarkedObjPageView() const { return mbHasMarked; } SetHasMarkedObj(sal_Bool bOn)207 void SetHasMarkedObj(sal_Bool bOn) { mbHasMarked = bOn; } 208 MarkBound() const209 const Rectangle& MarkBound() const { return aMarkBound; } MarkSnap() const210 const Rectangle& MarkSnap() const { return aMarkSnap; } MarkBound()211 Rectangle& MarkBound() { return aMarkBound; } MarkSnap()212 Rectangle& MarkSnap() { return aMarkSnap; } 213 SetLayerVisible(const String & rName,sal_Bool bShow=sal_True)214 void SetLayerVisible(const String& rName, sal_Bool bShow = sal_True) { SetLayer(rName, aLayerVisi, bShow); if(!bShow) AdjHdl(); InvalidateAllWin(); } IsLayerVisible(const String & rName) const215 sal_Bool IsLayerVisible(const String& rName) const { return IsLayer(rName, aLayerVisi); } SetAllLayersVisible(sal_Bool bShow=sal_True)216 void SetAllLayersVisible(sal_Bool bShow = sal_True) { SetAllLayers(aLayerVisi, bShow); if(!bShow) AdjHdl(); InvalidateAllWin(); } 217 SetLayerLocked(const String & rName,sal_Bool bLock=sal_True)218 void SetLayerLocked(const String& rName, sal_Bool bLock = sal_True) { SetLayer(rName, aLayerLock, bLock); if(bLock) AdjHdl(); } IsLayerLocked(const String & rName) const219 sal_Bool IsLayerLocked(const String& rName) const { return IsLayer(rName,aLayerLock); } SetAllLayersLocked(sal_Bool bLock=sal_True)220 void SetAllLayersLocked(sal_Bool bLock = sal_True) { SetAllLayers(aLayerLock, bLock); if(bLock) AdjHdl(); } 221 SetLayerPrintable(const String & rName,sal_Bool bPrn=sal_True)222 void SetLayerPrintable(const String& rName, sal_Bool bPrn = sal_True) { SetLayer(rName, aLayerPrn, bPrn); } IsLayerPrintable(const String & rName) const223 sal_Bool IsLayerPrintable(const String& rName) const { return IsLayer(rName, aLayerPrn); } SetAllLayersPrintable(sal_Bool bPrn=sal_True)224 void SetAllLayersPrintable(sal_Bool bPrn = sal_True) { SetAllLayers(aLayerPrn, bPrn); } 225 226 // PV stellt eine RefPage oder eine SubList eines RefObj dar oder Model ist ReadOnly 227 sal_Bool IsReadOnly() const; 228 229 // der Origin bezieht sich immer auf die obere linke Ecke der Page GetPageOrigin() const230 const Point& GetPageOrigin() const { return aPgOrg; } 231 void SetPageOrigin(const Point& rOrg); 232 LogicToPagePos(Point & rPnt) const233 void LogicToPagePos(Point& rPnt) const { rPnt-=aPgOrg; } LogicToPagePos(Rectangle & rRect) const234 void LogicToPagePos(Rectangle& rRect) const { rRect.Move(-aPgOrg.X(),-aPgOrg.Y()); } PagePosToLogic(Point & rPnt) const235 void PagePosToLogic(Point& rPnt) const { rPnt+=aPgOrg; } PagePosToLogic(Rectangle & rRect) const236 void PagePosToLogic(Rectangle& rRect) const { rRect.Move(aPgOrg.X(),aPgOrg.Y()); } 237 SetVisibleLayers(const SetOfByte & rSet)238 void SetVisibleLayers(const SetOfByte& rSet) { aLayerVisi=rSet; InvalidateAllWin(); } GetVisibleLayers() const239 const SetOfByte& GetVisibleLayers() const { return aLayerVisi; } SetPrintableLayers(const SetOfByte & rSet)240 void SetPrintableLayers(const SetOfByte& rSet) { aLayerPrn=rSet; } GetPrintableLayers() const241 const SetOfByte& GetPrintableLayers() const { return aLayerPrn; } SetLockedLayers(const SetOfByte & rSet)242 void SetLockedLayers(const SetOfByte& rSet) { aLayerLock=rSet; } GetLockedLayers() const243 const SetOfByte& GetLockedLayers() const { return aLayerLock; } 244 GetHelpLines() const245 const SdrHelpLineList& GetHelpLines() const { return aHelpLines; } 246 void SetHelpLines(const SdrHelpLineList& rHLL); 247 //void SetHelpLinePos(sal_uInt16 nNum, const Point& rNewPos); 248 void SetHelpLine(sal_uInt16 nNum, const SdrHelpLine& rNewHelpLine); 249 void DeleteHelpLine(sal_uInt16 nNum); 250 void InsertHelpLine(const SdrHelpLine& rHL, sal_uInt16 nNum=0xFFFF); MoveHelpLine(sal_uInt16 nNum,sal_uInt16 nNewNum)251 void MoveHelpLine(sal_uInt16 nNum, sal_uInt16 nNewNum) { aHelpLines.Move(nNum,nNewNum); } 252 253 // Liefert sal_True, wenn Layer des Obj sichtbar und nicht gesperrt. 254 // Beim Gruppenobjekt muss wenigstens ein Member sichtbar sein, 255 // gesperrt sein darf keiner. 256 sal_Bool IsObjMarkable(SdrObject* pObj) const; 257 258 // Betreten (Editieren) einer Objektgruppe. Anschliessend liegen alle 259 // Memberobjekte der Gruppe im direkten Zugriff. Alle anderen Objekte 260 // koennen waerendessen nicht bearbeitet werden (bis zum naechsten 261 // LeaveGroup()). (wie MsDos chdir bla). 262 sal_Bool EnterGroup(SdrObject* pObj); 263 264 // Verlassen einer betretenen Objektgruppe. (wie MsDos chdir ..) 265 void LeaveOneGroup(); 266 267 // Verlassen aller betretenen Objektgruppen. (wie MsDos chdir \) 268 void LeaveAllGroup(); 269 270 // Feststellen, wie weit hinabgestiegen wurde (0=Root(Page)) 271 sal_uInt16 GetEnteredLevel() const; 272 273 // Name der aktuellen Objektgruppe 274 String GetActualGroupName() const; 275 276 // Die Namen aller z.Zt. betretenen Gruppen 277 String GetActualPathName(sal_Unicode cSep = sal_Unicode('|')) const; 278 279 // #103834# Set background color for svx at SdrPageViews 280 void SetApplicationBackgroundColor(Color aBackgroundColor); 281 282 // #109585# 283 Color GetApplicationBackgroundColor() const; 284 285 // #103911# Set/Get document color for svx at SdrPageViews 286 void SetApplicationDocumentColor(Color aDocumentColor); 287 Color GetApplicationDocumentColor() const; 288 }; 289 290 //////////////////////////////////////////////////////////////////////////////////////////////////// 291 292 #endif //_SVDPAGV_HXX 293