LibreOffice Module svx (master)  1
svdpage.cxx
Go to the documentation of this file.
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 #include <memory>
21 #include <cassert>
22 #include <set>
23 #include <unordered_set>
24 
25 #include <svx/svdpage.hxx>
26 
27 #include <o3tl/safeint.hxx>
28 #include <string.h>
29 
30 #include <tools/debug.hxx>
31 #include <tools/diagnose_ex.h>
32 
33 #include <svtools/colorcfg.hxx>
34 #include <svx/svdetc.hxx>
35 #include <svx/svdobj.hxx>
36 #include <svx/svdogrp.hxx>
37 #include <svx/svdoedge.hxx>
38 #include <svx/svdoole2.hxx>
39 #include <svx/svditer.hxx>
40 #include <svx/svdmodel.hxx>
41 #include <svx/svdlayer.hxx>
42 #include <svx/svdpagv.hxx>
43 #include <svx/svdundo.hxx>
44 #include <svx/xfillit0.hxx>
45 #include <svx/fmdpage.hxx>
46 
50 #include <algorithm>
51 #include <svl/hint.hxx>
52 #include <rtl/strbuf.hxx>
53 #include <libxml/xmlwriter.h>
54 
55 #include <com/sun/star/lang/IllegalArgumentException.hpp>
56 
57 using namespace ::com::sun::star;
58 
60 
62 : mbObjOrdNumsDirty(false),
63  mbRectsDirty(false),
64  mbIsNavigationOrderDirty(false)
65 {
66 }
67 
68 void SdrObjList::impClearSdrObjList(bool bBroadcast)
69 {
70  SdrModel* pSdrModelFromRemovedSdrObject(nullptr);
71 
72  while(!maList.empty())
73  {
74  // remove last object from list
75  SdrObject* pObj(maList.back());
77 
78  // flushViewObjectContacts() is done since SdrObject::Free is not guaranteed
79  // to delete the object and thus refresh visualisations
80  pObj->GetViewContact().flushViewObjectContacts();
81 
82  if(bBroadcast)
83  {
84  if(nullptr == pSdrModelFromRemovedSdrObject)
85  {
86  pSdrModelFromRemovedSdrObject = &pObj->getSdrModelFromSdrObject();
87  }
88 
89  // sent remove hint (after removal, see RemoveObject())
90  // TTTT SdrPage not needed, can be accessed using SdrObject
92  pObj->getSdrModelFromSdrObject().Broadcast(aHint);
93  }
94 
95  // delete the object itself
96  SdrObject::Free( pObj );
97  }
98 
99  if(bBroadcast && nullptr != pSdrModelFromRemovedSdrObject)
100  {
101  pSdrModelFromRemovedSdrObject->SetChanged();
102  }
103 }
104 
106 {
107  // clear SdrObjects with broadcasting
108  impClearSdrObjList(true);
109 }
110 
112 {
113  // clear SdrObjects without broadcasting
114  impClearSdrObjList(false);
115 }
116 
118 {
119  // default is no page and returns zero
120  return nullptr;
121 }
122 
124 {
125  // default is no SdrObject (SdrObjGroup)
126  return nullptr;
127 }
128 
129 void SdrObjList::CopyObjects(const SdrObjList& rSrcList)
130 {
131  // clear SdrObjects with broadcasting
132  ClearSdrObjList();
133 
134  mbObjOrdNumsDirty = false;
135  mbRectsDirty = false;
136  size_t nCloneErrCnt(0);
137  const size_t nCount(rSrcList.GetObjCount());
138 
139  if(nullptr == getSdrObjectFromSdrObjList() && nullptr == getSdrPageFromSdrObjList())
140  {
141  OSL_ENSURE(false, "SdrObjList which is not part of SdrPage or SdrObject (!)");
142  return;
143  }
144 
145  SdrModel& rTargetSdrModel(nullptr == getSdrObjectFromSdrObjList()
146  ? getSdrPageFromSdrObjList()->getSdrModelFromSdrPage()
147  : getSdrObjectFromSdrObjList()->getSdrModelFromSdrObject());
148 
149  for (size_t no(0); no < nCount; ++no)
150  {
151  SdrObject* pSO(rSrcList.GetObj(no));
152  SdrObject* pDO(pSO->CloneSdrObject(rTargetSdrModel));
153 
154  if(nullptr != pDO)
155  {
156  NbcInsertObject(pDO, SAL_MAX_SIZE);
157  }
158  else
159  {
160  nCloneErrCnt++;
161  }
162  }
163 
164  // and now for the Connectors
165  // The new objects would be shown in the rSrcList
166  // and then the object connections are made.
167  // Similar implementation are setup as the following:
168  // void SdrObjList::CopyObjects(const SdrObjList& rSrcList)
169  // SdrModel* SdrExchangeView::CreateMarkedObjModel() const
170  // BOOL SdrExchangeView::Paste(const SdrModel& rMod,...)
171  // void SdrEditView::CopyMarked()
172  if (nCloneErrCnt==0) {
173  for (size_t no=0; no<nCount; ++no) {
174  const SdrObject* pSrcOb=rSrcList.GetObj(no);
175  const SdrEdgeObj* pSrcEdge=dynamic_cast<const SdrEdgeObj*>( pSrcOb );
176  if (pSrcEdge!=nullptr) {
177  SdrObject* pSrcNode1=pSrcEdge->GetConnectedNode(true);
178  SdrObject* pSrcNode2=pSrcEdge->GetConnectedNode(false);
179  if (pSrcNode1!=nullptr && pSrcNode1->getParentSdrObjListFromSdrObject()!=pSrcEdge->getParentSdrObjListFromSdrObject()) pSrcNode1=nullptr; // can't do this
180  if (pSrcNode2!=nullptr && pSrcNode2->getParentSdrObjListFromSdrObject()!=pSrcEdge->getParentSdrObjListFromSdrObject()) pSrcNode2=nullptr; // across all lists (yet)
181  if (pSrcNode1!=nullptr || pSrcNode2!=nullptr) {
182  SdrObject* pEdgeObjTmp=GetObj(no);
183  SdrEdgeObj* pDstEdge=dynamic_cast<SdrEdgeObj*>( pEdgeObjTmp );
184  if (pDstEdge!=nullptr) {
185  if (pSrcNode1!=nullptr) {
186  sal_uInt32 nDstNode1=pSrcNode1->GetOrdNum();
187  SdrObject* pDstNode1=GetObj(nDstNode1);
188  if (pDstNode1!=nullptr) { // else we get an error!
189  pDstEdge->ConnectToNode(true,pDstNode1);
190  } else {
191  OSL_FAIL("SdrObjList::operator=(): pDstNode1==NULL!");
192  }
193  }
194  if (pSrcNode2!=nullptr) {
195  sal_uInt32 nDstNode2=pSrcNode2->GetOrdNum();
196  SdrObject* pDstNode2=GetObj(nDstNode2);
197  if (pDstNode2!=nullptr) { // else the node was probably not selected
198  pDstEdge->ConnectToNode(false,pDstNode2);
199  } else {
200  OSL_FAIL("SdrObjList::operator=(): pDstNode2==NULL!");
201  }
202  }
203  } else {
204  OSL_FAIL("SdrObjList::operator=(): pDstEdge==NULL!");
205  }
206  }
207  }
208  }
209  } else {
210 #ifdef DBG_UTIL
211  OStringBuffer aStr("SdrObjList::operator=(): Error when cloning ");
212 
213  if(nCloneErrCnt == 1)
214  {
215  aStr.append("a drawing object.");
216  }
217  else
218  {
219  aStr.append(static_cast<sal_Int32>(nCloneErrCnt));
220  aStr.append(" drawing objects.");
221  }
222 
223  aStr.append(" Not copying connectors.");
224 
225  OSL_FAIL(aStr.getStr());
226 #endif
227  }
228 }
229 
231 {
232  const size_t nCount = GetObjCount();
233  for (size_t no=0; no<nCount; ++no) {
234  SdrObject* pObj=GetObj(no);
235  pObj->SetOrdNum(no);
236  }
237  mbObjOrdNumsDirty=false;
238 }
239 
241 {
244  const size_t nCount = GetObjCount();
245  for (size_t i=0; i<nCount; ++i) {
246  SdrObject* pObj=GetObj(i);
247  if (i==0) {
250  } else {
253  }
254  }
255 }
256 
258 {
259  mbRectsDirty=true;
260  SdrObject* pParentSdrObject(getSdrObjectFromSdrObjList());
261 
262  if(nullptr != pParentSdrObject)
263  {
264  pParentSdrObject->SetBoundAndSnapRectsDirty();
265  }
266 }
267 
269 {
271 
272  if(pParent)
273  {
274  pParent->ActionChildInserted(rChild.GetViewContact());
275  }
276 }
277 
278 void SdrObjList::NbcInsertObject(SdrObject* pObj, size_t nPos)
279 {
280  DBG_ASSERT(pObj!=nullptr,"SdrObjList::NbcInsertObject(NULL)");
281  if (pObj==nullptr)
282  return;
283 
284  DBG_ASSERT(!pObj->IsInserted(),"The object already has the status Inserted.");
285  const size_t nCount = GetObjCount();
286  if (nPos>nCount) nPos=nCount;
287  InsertObjectIntoContainer(*pObj,nPos);
288 
289  if (nPos<nCount) mbObjOrdNumsDirty=true;
290  pObj->SetOrdNum(nPos);
291  pObj->setParentOfSdrObject(this);
292 
293  // Inform the parent about change to allow invalidations at
294  // evtl. existing parent visualisations
295  impChildInserted(*pObj);
296 
297  if (!mbRectsDirty) {
298  mbRectsDirty = true;
299  }
300  pObj->InsertedStateChange(); // calls the UserCall (among others)
301 }
302 
304 {
305  std::unordered_set<rtl::OUString> aNameSet;
306  InsertObjectThenMakeNameUnique(pObj, aNameSet);
307 }
308 
309 void SdrObjList::InsertObjectThenMakeNameUnique(SdrObject* pObj, std::unordered_set<OUString>& rNameSet, size_t nPos)
310 {
311  InsertObject(pObj, nPos);
312  if (pObj->GetName().isEmpty())
313  return;
314 
315  pObj->MakeNameUnique(rNameSet);
316  SdrObjList* pSdrObjList = pObj->GetSubList(); // group
317  if (pSdrObjList)
318  {
319  SdrObject* pListObj;
320  SdrObjListIter aIter(pSdrObjList, SdrIterMode::DeepWithGroups);
321  while (aIter.IsMore())
322  {
323  pListObj = aIter.Next();
324  pListObj->MakeNameUnique(rNameSet);
325  }
326  }
327 }
328 
329 void SdrObjList::InsertObject(SdrObject* pObj, size_t nPos)
330 {
331  DBG_ASSERT(pObj!=nullptr,"SdrObjList::InsertObject(NULL)");
332 
333  if(!pObj)
334  return;
335 
336  // if anchor is used, reset it before grouping
338  {
339  const Point& rAnchorPos = pObj->GetAnchorPos();
340  if(rAnchorPos.X() || rAnchorPos.Y())
341  pObj->NbcSetAnchorPos(Point());
342  }
343 
344  // do insert to new group
345  NbcInsertObject(pObj, nPos);
346 
347  // In case the object is inserted into a group and doesn't overlap with
348  // the group's other members, it needs an own repaint.
349  SdrObject* pParentSdrObject(getSdrObjectFromSdrObjList());
350 
351  if(pParentSdrObject)
352  {
353  // only repaint here
354  pParentSdrObject->ActionChanged();
355  }
356 
357  // TODO: We need a different broadcast here!
358  // Repaint from object number ... (heads-up: GroupObj)
360  {
361  SdrHint aHint(SdrHintKind::ObjectInserted, *pObj);
362  pObj->getSdrModelFromSdrObject().Broadcast(aHint);
363  }
364 
366 }
367 
369 {
370  if (nObjNum >= maList.size())
371  {
372  OSL_ASSERT(nObjNum<maList.size());
373  return nullptr;
374  }
375 
376  const size_t nCount = GetObjCount();
377  SdrObject* pObj=maList[nObjNum];
378  RemoveObjectFromContainer(nObjNum);
379 
380  DBG_ASSERT(pObj!=nullptr,"Could not find object to remove.");
381  if (pObj!=nullptr)
382  {
383  // flushViewObjectContacts() clears the VOC's and those invalidate
385 
386  DBG_ASSERT(pObj->IsInserted(),"The object does not have the status Inserted.");
387 
388  // tdf#121022 Do first remove from SdrObjList - InsertedStateChange
389  // relies now on IsInserted which uses getParentSdrObjListFromSdrObject
390  pObj->setParentOfSdrObject(nullptr);
391 
392  // calls UserCall, among other
393  pObj->InsertedStateChange();
394 
395  if (!mbObjOrdNumsDirty)
396  {
397  // optimizing for the case that the last object has to be removed
398  if (nObjNum+1!=nCount) {
399  mbObjOrdNumsDirty=true;
400  }
401  }
403  }
404  return pObj;
405 }
406 
408 {
409  if (nObjNum >= maList.size())
410  {
411  OSL_ASSERT(nObjNum<maList.size());
412  return nullptr;
413  }
414 
415  const size_t nCount = GetObjCount();
416  SdrObject* pObj=maList[nObjNum];
417  RemoveObjectFromContainer(nObjNum);
418 
419  DBG_ASSERT(pObj!=nullptr,"Object to remove not found.");
420  if(pObj)
421  {
422  // flushViewObjectContacts() clears the VOC's and those invalidate
424  DBG_ASSERT(pObj->IsInserted(),"The object does not have the status Inserted.");
425 
426  // TODO: We need a different broadcast here.
427  if (pObj->getSdrPageFromSdrObject()!=nullptr)
428  {
429  SdrHint aHint(SdrHintKind::ObjectRemoved, *pObj);
430  pObj->getSdrModelFromSdrObject().Broadcast(aHint);
431  }
432 
434 
435  // tdf#121022 Do first remove from SdrObjList - InsertedStateChange
436  // relies now on IsInserted which uses getParentSdrObjListFromSdrObject
437  pObj->setParentOfSdrObject(nullptr);
438 
439  // calls, among other things, the UserCall
440  pObj->InsertedStateChange();
441 
442  if (!mbObjOrdNumsDirty)
443  {
444  // optimization for the case that the last object is removed
445  if (nObjNum+1!=nCount) {
446  mbObjOrdNumsDirty=true;
447  }
448  }
449 
451  SdrObject* pParentSdrObject(getSdrObjectFromSdrObjList());
452 
453  if(pParentSdrObject && !GetObjCount())
454  {
455  // empty group created; it needs to be repainted since it's
456  // visualization changes
457  pParentSdrObject->ActionChanged();
458  }
459  }
460  return pObj;
461 }
462 
464 {
465  if (nObjNum >= maList.size())
466  {
467  OSL_ASSERT(nObjNum<maList.size());
468  return nullptr;
469  }
470  if (pNewObj == nullptr)
471  {
472  OSL_ASSERT(pNewObj!=nullptr);
473  return nullptr;
474  }
475 
476  SdrObject* pObj=maList[nObjNum];
477  DBG_ASSERT(pObj!=nullptr,"SdrObjList::ReplaceObject: Could not find object to remove.");
478  if (pObj!=nullptr) {
479  DBG_ASSERT(pObj->IsInserted(),"SdrObjList::ReplaceObject: the object does not have status Inserted.");
480 
481  // TODO: We need a different broadcast here.
482  if (pObj->getSdrPageFromSdrObject()!=nullptr)
483  {
484  SdrHint aHint(SdrHintKind::ObjectRemoved, *pObj);
485  pObj->getSdrModelFromSdrObject().Broadcast(aHint);
486  }
487 
488  // Change parent and replace in SdrObjList
489  pObj->setParentOfSdrObject(nullptr);
490  ReplaceObjectInContainer(*pNewObj,nObjNum);
491 
492  // tdf#121022 InsertedStateChange uses the parent
493  // to detect if pObj is inserted or not, so have to call
494  // it *after* changing these settings, else an obviously wrong
495  // 'SdrUserCallType::Inserted' would be sent
496  pObj->InsertedStateChange();
497 
498  // flushViewObjectContacts() clears the VOC's and those
499  // trigger the evtl. needed invalidate(s)
501 
502  // Setup data at new SdrObject - it already *is* inserted to
503  // the SdrObjList due to 'ReplaceObjectInContainer' above
504  pNewObj->SetOrdNum(nObjNum);
505  pNewObj->setParentOfSdrObject(this);
506 
507  // Inform the parent about change to allow invalidations at
508  // evtl. existing parent visualisations, but also react on
509  // newly inserted SdrObjects (as e.g. GraphCtrlUserCall does)
510  impChildInserted(*pNewObj);
511 
512  pNewObj->InsertedStateChange();
513 
514  // TODO: We need a different broadcast here.
515  if (pNewObj->getSdrPageFromSdrObject()!=nullptr) {
516  SdrHint aHint(SdrHintKind::ObjectInserted, *pNewObj);
517  pNewObj->getSdrModelFromSdrObject().Broadcast(aHint);
518  }
519 
521 
523  }
524  return pObj;
525 }
526 
527 SdrObject* SdrObjList::SetObjectOrdNum(size_t nOldObjNum, size_t nNewObjNum)
528 {
529  if (nOldObjNum >= maList.size() || nNewObjNum >= maList.size())
530  {
531  OSL_ASSERT(nOldObjNum<maList.size());
532  OSL_ASSERT(nNewObjNum<maList.size());
533  return nullptr;
534  }
535 
536  SdrObject* pObj=maList[nOldObjNum];
537  if (nOldObjNum==nNewObjNum) return pObj;
538  DBG_ASSERT(pObj!=nullptr,"SdrObjList::SetObjectOrdNum: Object not found.");
539  if (pObj!=nullptr) {
540  DBG_ASSERT(pObj->IsInserted(),"SdrObjList::SetObjectOrdNum: the object does not have status Inserted.");
541  RemoveObjectFromContainer(nOldObjNum);
542  InsertObjectIntoContainer(*pObj,nNewObjNum);
543 
544  // No need to delete visualisation data since same object
545  // gets inserted again. Also a single ActionChanged is enough
546  pObj->ActionChanged();
547 
548  pObj->SetOrdNum(nNewObjNum);
549  mbObjOrdNumsDirty=true;
550 
551  // TODO: We need a different broadcast here.
552  if (pObj->getSdrPageFromSdrObject()!=nullptr)
555  }
556  return pObj;
557 }
558 
559 void SdrObjList::SetExistingObjectOrdNum(SdrObject* pObj, size_t nNewObjNum)
560 {
561  assert(std::find(maList.begin(), maList.end(), pObj) != maList.end() && "This method requires that the child object already be inserted");
562  assert(pObj->IsInserted() && "SdrObjList::SetObjectOrdNum: the object does not have status Inserted.");
563 
564  // I am deliberately bypassing getOrdNum() because I don't want to unnecessarily
565  // trigger RecalcObjOrdNums()
566  const sal_uInt32 nOldOrdNum = pObj->m_nOrdNum;
567  if (!mbObjOrdNumsDirty && nOldOrdNum == nNewObjNum)
568  return;
569 
570  // Update the navigation positions.
572  {
573  tools::WeakReference<SdrObject> aReference (pObj);
574  auto iObject = ::std::find(
575  mxNavigationOrder->begin(),
576  mxNavigationOrder->end(),
577  aReference);
578  mxNavigationOrder->erase(iObject);
580  // The new object does not have a user defined position so append it
581  // to the list.
583  mxNavigationOrder->push_back(pObj);
584  }
585  if (nOldOrdNum < maList.size() && maList[nOldOrdNum] == pObj)
586  maList.erase(maList.begin()+nOldOrdNum);
587  else
588  {
589  auto it = std::find(maList.begin(), maList.end(), pObj);
590  maList.erase(it);
591  }
592  // Insert object into object list. Because the insert() method requires
593  // a valid iterator as insertion position, we have to use push_back() to
594  // insert at the end of the list.
595  if (nNewObjNum >= maList.size())
596  maList.push_back(pObj);
597  else
598  maList.insert(maList.begin()+nNewObjNum, pObj);
599 
600  mbObjOrdNumsDirty=true;
601 
602  // No need to delete visualisation data since same object
603  // gets inserted again. Also a single ActionChanged is enough
604  pObj->ActionChanged();
605 
606  pObj->SetOrdNum(nNewObjNum);
607  mbObjOrdNumsDirty=true;
608 
609  // TODO: We need a different broadcast here.
610  if (pObj->getSdrPageFromSdrObject()!=nullptr)
613 }
614 
615 void SdrObjList::sort( std::vector<sal_Int32>& sortOrder)
616 {
617  // no negative indexes and indexes larger than maList size are allowed
618  auto it = std::find_if( sortOrder.begin(), sortOrder.end(), [this](const sal_Int32& rIt)
619  { return ( rIt < 0 || o3tl::make_unsigned(rIt) >= maList.size() ); } );
620  if ( it != sortOrder.end())
621  throw css::lang::IllegalArgumentException("negative index of shape", nullptr, 1);
622 
623  // no duplicates
624  std::vector<bool> aNoDuplicates(sortOrder.size(), false);
625  for (size_t i = 0; i < sortOrder.size(); ++i )
626  {
627  size_t idx = static_cast<size_t>( sortOrder[i] );
628 
629  if ( aNoDuplicates[idx] )
630  throw css::lang::IllegalArgumentException("duplicate index of shape", nullptr, 2);
631 
632  aNoDuplicates[idx] = true;
633  }
634 
635  // example sortOrder [2 0 1]
636  // example maList [T T S T T] ( T T = shape with textbox, S = just a shape )
637  // (shapes at positions 0 and 2 have a textbox)
638 
639  std::deque<SdrObject*> aNewList(maList.size());
640  std::set<sal_Int32> aShapesWithTextbox;
641  std::vector<sal_Int32> aIncrements;
642  std::vector<sal_Int32> aDuplicates;
643 
644  if ( maList.size() > 1)
645  {
646  for (size_t i = 1; i< maList.size(); ++i)
647  {
648  // if this shape is a textbox, then look at its left neighbour
649  // (shape this textbox is in)
650  // and insert the number of textboxes to the left of it
651  if (maList[i]->IsTextBox())
652  aShapesWithTextbox.insert( i - 1 - aShapesWithTextbox.size() );
653  }
654  // example aShapesWithTextbox [0 2]
655  }
656 
657  if (aShapesWithTextbox.size() != maList.size() - sortOrder.size())
658  {
659  throw lang::IllegalArgumentException("mismatch of no. of shapes", nullptr, 0);
660  }
661 
662  for (size_t i = 0; i< sortOrder.size(); ++i)
663  {
664 
665  if (aShapesWithTextbox.count(sortOrder[i]) > 0)
666  aDuplicates.push_back(sortOrder[i]);
667 
668  aDuplicates.push_back(sortOrder[i]);
669 
670  // example aDuplicates [2 2 0 0 1]
671  }
672  assert(aDuplicates.size() == maList.size());
673 
674  aIncrements.push_back(0);
675  for (size_t i = 1; i< sortOrder.size(); ++i)
676  {
677  if (aShapesWithTextbox.count(i - 1))
678  aIncrements.push_back(aIncrements[i-1] + 1 );
679  else
680  aIncrements.push_back(aIncrements[i-1]);
681 
682  // example aIncrements [0 1 1]
683  }
684  assert(aIncrements.size() == sortOrder.size());
685 
686  std::vector<sal_Int32> aNewSortOrder(maList.size());
687  sal_Int32 nPrev = -1;
688  for (size_t i = 0; i< aDuplicates.size(); ++i)
689  {
690  if (nPrev != aDuplicates[i])
691  aNewSortOrder[i] = aDuplicates[i] + aIncrements[aDuplicates[i]];
692  else
693  aNewSortOrder[i] = aNewSortOrder[i-1] + 1;
694 
695  nPrev = aDuplicates[i];
696 
697  // example aNewSortOrder [3 4 0 1 2]
698  }
699  assert(aNewSortOrder.size() == maList.size());
700 
701 #ifndef NDEBUG
702  {
703  std::vector<sal_Int32> tmp(aNewSortOrder);
704  std::sort(tmp.begin(), tmp.end());
705  for (size_t i = 0; i < tmp.size(); ++i)
706  {
707  assert(size_t(tmp[i]) == i);
708  }
709  }
710 #endif
711 
712  SdrModel & rModel(getSdrPageFromSdrObjList()->getSdrModelFromSdrPage());
713  bool const isUndo(rModel.IsUndoEnabled());
714  if (isUndo)
715  {
717  }
718 
719  for (size_t i = 0; i < aNewSortOrder.size(); ++i)
720  {
721  aNewList[i] = maList[ aNewSortOrder[i] ];
722  aNewList[i]->SetOrdNum(i);
723  }
724 
725  std::swap(aNewList, maList);
726 }
727 
729 {
730  if (mbRectsDirty) {
731  const_cast<SdrObjList*>(this)->RecalcRects();
732  const_cast<SdrObjList*>(this)->mbRectsDirty=false;
733  }
734  return maSdrObjListSnapRect;
735 }
736 
738 {
739  // #i106183# for deep group hierarchies like in chart2, the invalidates
740  // through the hierarchy are not correct; use a 2nd hint for the needed
741  // recalculation. Future versions will have no bool flag at all, but
742  // just maSdrObjListOutRect in empty state to represent an invalid state, thus
743  // it's a step in the right direction.
745  {
746  const_cast<SdrObjList*>(this)->RecalcRects();
747  const_cast<SdrObjList*>(this)->mbRectsDirty=false;
748  }
749  return maSdrObjListOutRect;
750 }
751 
753 {
754  size_t nCount=GetObjCount();
755  size_t nNum=0;
756 
757  while (nNum<nCount)
758  {
759  SdrObject* pObj = GetObj(nNum);
760 
761  pObj->NbcReformatText();
762  nCount=GetObjCount(); // ReformatText may delete an object
763  nNum++;
764  }
765 
766 }
767 
769 {
771 }
772 
778 {
779  // #i120437# go over whole hierarchy, not only over object level null (seen from grouping)
781 
782  while(aIter.IsMore())
783  {
784  SdrObject* pObj = aIter.Next();
785  if (pObj->GetObjIdentifier() != SdrObjKind::Edge)
786  continue;
787 
788  SdrEdgeObj* pSdrEdgeObj = static_cast< SdrEdgeObj* >(pObj);
789  pSdrEdgeObj->Reformat();
790  }
791 }
792 
794 {
795  for(size_t a = 0; a < GetObjCount(); ++a)
796  {
798  }
799 }
800 
802 {
803  return maList.size();
804 }
805 
806 
807 SdrObject* SdrObjList::GetObj(size_t nNum) const
808 {
809  if (nNum < maList.size())
810  return maList[nNum];
811 
812  return nullptr;
813 }
814 
815 
817 {
818  bool bRet(false);
819  SdrObject* pParentSdrObject(getSdrObjectFromSdrObjList());
820 
821  if(nullptr != pParentSdrObject)
822  {
823  SdrPage* pSdrPage(pParentSdrObject->getSdrPageFromSdrObject());
824 
825  if(nullptr != pSdrPage)
826  {
827  bRet = pSdrPage->IsReadOnly();
828  }
829  }
830 
831  return bRet;
832 }
833 
835 {
836  const size_t nObj = GetObjCount();
837  for( size_t i = nObj; i>0; )
838  UnGroupObj(--i);
839 }
840 
841 void SdrObjList::UnGroupObj( size_t nObjNum )
842 {
843  // if the given object is no group, this method is a noop
844  SdrObject* pUngroupObj = GetObj( nObjNum );
845  if( pUngroupObj )
846  {
847  SdrObjList* pSrcLst = pUngroupObj->GetSubList();
848  if(pSrcLst)
849  if(auto pUngroupGroup = dynamic_cast<SdrObjGroup*>( pUngroupObj))
850  {
851  // ungroup recursively (has to be head recursion,
852  // otherwise our indices will get trashed when doing it in
853  // the loop)
854  pSrcLst->FlattenGroups();
855 
856  // the position at which we insert the members of rUngroupGroup
857  size_t nInsertPos( pUngroupGroup->GetOrdNum() );
858 
859  const size_t nCount = pSrcLst->GetObjCount();
860  for( size_t i=0; i<nCount; ++i )
861  {
862  SdrObject* pObj = pSrcLst->RemoveObject(0);
863  InsertObject(pObj, nInsertPos);
864  ++nInsertPos;
865  }
866 
867  RemoveObject(nInsertPos);
868  }
869  }
870 #ifdef DBG_UTIL
871  else
872  OSL_FAIL("SdrObjList::UnGroupObj: object index invalid");
873 #endif
874 }
875 
877 
879  SdrObject& rObject,
880  const sal_uInt32 nNewPosition)
881 {
882  // When the navigation order container has not yet been created then
883  // create one now. It is initialized with the z-order taken from
884  // maList.
885  if (!mxNavigationOrder)
886  {
887  mxNavigationOrder.emplace(maList.begin(), maList.end());
888  }
889  OSL_ASSERT(bool(mxNavigationOrder));
890  OSL_ASSERT( mxNavigationOrder->size() == maList.size());
891 
892  tools::WeakReference<SdrObject> aReference (&rObject);
893 
894  // Look up the object whose navigation position is to be changed.
895  auto iObject = ::std::find(
896  mxNavigationOrder->begin(),
897  mxNavigationOrder->end(),
898  aReference);
899  if (iObject == mxNavigationOrder->end())
900  {
901  // The given object is not a member of the navigation order.
902  return;
903  }
904 
905  // Move the object to its new position.
906  const sal_uInt32 nOldPosition = ::std::distance(mxNavigationOrder->begin(), iObject);
907  if (nOldPosition == nNewPosition)
908  return;
909 
910  mxNavigationOrder->erase(iObject);
911  sal_uInt32 nInsertPosition (nNewPosition);
912  // Adapt insertion position for the just erased object.
913  if (nNewPosition >= nOldPosition)
914  nInsertPosition -= 1;
915  if (nInsertPosition >= mxNavigationOrder->size())
916  mxNavigationOrder->push_back(aReference);
917  else
918  mxNavigationOrder->insert(mxNavigationOrder->begin()+nInsertPosition, aReference);
919 
921 
922  // The navigation order is written out to file so mark the model as modified.
924 }
925 
926 
927 SdrObject* SdrObjList::GetObjectForNavigationPosition (const sal_uInt32 nNavigationPosition) const
928 {
930  {
931  // There is a user defined navigation order. Make sure the object
932  // index is correct and look up the object in mxNavigationOrder.
933  if (nNavigationPosition >= mxNavigationOrder->size())
934  {
935  OSL_ASSERT(nNavigationPosition < mxNavigationOrder->size());
936  }
937  else
938  return (*mxNavigationOrder)[nNavigationPosition].get();
939  }
940  else
941  {
942  // There is no user defined navigation order. Use the z-order
943  // instead.
944  if (nNavigationPosition >= maList.size())
945  {
946  OSL_ASSERT(nNavigationPosition < maList.size());
947  }
948  else
949  return maList[nNavigationPosition];
950  }
951  return nullptr;
952 }
953 
954 
956 {
957  mxNavigationOrder.reset();
959 }
960 
961 
963 {
965  {
966  if (mxNavigationOrder)
967  {
968  mbIsNavigationOrderDirty = false;
969 
970  sal_uInt32 nIndex (0);
971  for (auto& rpObject : *mxNavigationOrder)
972  {
973  rpObject->SetNavigationPosition(nIndex);
974  ++nIndex;
975  }
976  }
977  }
978 
979  return bool(mxNavigationOrder);
980 }
981 
982 
983 void SdrObjList::SetNavigationOrder (const uno::Reference<container::XIndexAccess>& rxOrder)
984 {
985  if (rxOrder.is())
986  {
987  const sal_Int32 nCount = rxOrder->getCount();
988  if (static_cast<sal_uInt32>(nCount) != maList.size())
989  return;
990 
991  if (!mxNavigationOrder)
992  mxNavigationOrder = std::vector<tools::WeakReference<SdrObject>>(nCount);
993 
994  for (sal_Int32 nIndex=0; nIndex<nCount; ++nIndex)
995  {
996  uno::Reference<uno::XInterface> xShape (rxOrder->getByIndex(nIndex), uno::UNO_QUERY);
998  if (pObject == nullptr)
999  break;
1000  (*mxNavigationOrder)[nIndex] = pObject;
1001  }
1002 
1003  mbIsNavigationOrderDirty = true;
1004  }
1005  else
1006  {
1008  }
1009 }
1010 
1011 
1013  SdrObject& rObject,
1014  const sal_uInt32 nInsertPosition)
1015 {
1016  OSL_ASSERT(nInsertPosition<=maList.size());
1017 
1018  // Update the navigation positions.
1020  {
1021  // The new object does not have a user defined position so append it
1022  // to the list.
1023  rObject.SetNavigationPosition(mxNavigationOrder->size());
1024  mxNavigationOrder->push_back(&rObject);
1025  }
1026 
1027  // Insert object into object list. Because the insert() method requires
1028  // a valid iterator as insertion position, we have to use push_back() to
1029  // insert at the end of the list.
1030  if (nInsertPosition >= maList.size())
1031  maList.push_back(&rObject);
1032  else
1033  maList.insert(maList.begin()+nInsertPosition, &rObject);
1034  mbObjOrdNumsDirty=true;
1035 }
1036 
1037 
1039  SdrObject& rNewObject,
1040  const sal_uInt32 nObjectPosition)
1041 {
1042  if (nObjectPosition >= maList.size())
1043  {
1044  OSL_ASSERT(nObjectPosition<maList.size());
1045  return;
1046  }
1047 
1048  // Update the navigation positions.
1050  {
1051  // A user defined position of the object that is to be replaced is
1052  // not transferred to the new object so erase the former and append
1053  // the later object from/to the navigation order.
1054  OSL_ASSERT(nObjectPosition < maList.size());
1055  tools::WeakReference<SdrObject> aReference (maList[nObjectPosition]);
1056  auto iObject = ::std::find(
1057  mxNavigationOrder->begin(),
1058  mxNavigationOrder->end(),
1059  aReference);
1060  if (iObject != mxNavigationOrder->end())
1061  mxNavigationOrder->erase(iObject);
1062 
1063  mxNavigationOrder->push_back(&rNewObject);
1064 
1065  mbIsNavigationOrderDirty = true;
1066  }
1067 
1068  maList[nObjectPosition] = &rNewObject;
1069  mbObjOrdNumsDirty=true;
1070 }
1071 
1072 
1074  const sal_uInt32 nObjectPosition)
1075 {
1076  if (nObjectPosition >= maList.size())
1077  {
1078  OSL_ASSERT(nObjectPosition<maList.size());
1079  return;
1080  }
1081 
1082  // Update the navigation positions.
1084  {
1085  tools::WeakReference<SdrObject> aReference (maList[nObjectPosition]);
1086  auto iObject = ::std::find(
1087  mxNavigationOrder->begin(),
1088  mxNavigationOrder->end(),
1089  aReference);
1090  if (iObject != mxNavigationOrder->end())
1091  mxNavigationOrder->erase(iObject);
1092  mbIsNavigationOrderDirty = true;
1093  }
1094 
1095  maList.erase(maList.begin()+nObjectPosition);
1096  mbObjOrdNumsDirty=true;
1097 }
1098 
1100 {
1101  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SdrObjList"));
1102  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
1103  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("symbol"), "%s", BAD_CAST(typeid(*this).name()));
1104 
1105  size_t nObjCount = GetObjCount();
1106  for (size_t i = 0; i < nObjCount; ++i)
1107  {
1108  if (const SdrObject* pObject = GetObj(i))
1109  pObject->dumpAsXml(pWriter);
1110  }
1111 
1112  (void)xmlTextWriterEndElement(pWriter);
1113 }
1114 
1115 
1117 {
1118  sal_uInt16 nCount=GetCount();
1119  for (sal_uInt16 i=0; i<nCount; i++) {
1120  delete GetObject(i);
1121  }
1122  aList.clear();
1123 }
1124 
1125 
1126 // PageUser section
1127 
1129 {
1130  maPageUsers.push_back(&rNewUser);
1131 }
1132 
1134 {
1135  const sdr::PageUserVector::iterator aFindResult = ::std::find(maPageUsers.begin(), maPageUsers.end(), &rOldUser);
1136  if(aFindResult != maPageUsers.end())
1137  {
1138  maPageUsers.erase(aFindResult);
1139  }
1140 }
1141 
1142 
1143 // DrawContact section
1144 
1145 std::unique_ptr<sdr::contact::ViewContact> SdrPage::CreateObjectSpecificViewContact()
1146 {
1147  return std::make_unique<sdr::contact::ViewContactOfSdrPage>(*this);
1148 }
1149 
1151 {
1152  if (!mpViewContact)
1153  const_cast<SdrPage*>(this)->mpViewContact =
1154  const_cast<SdrPage*>(this)->CreateObjectSpecificViewContact();
1155 
1156  return *mpViewContact;
1157 }
1158 
1160 {
1161  if (!mpViewContact)
1163 
1164  return *mpViewContact;
1165 }
1166 
1168 {
1169  if(mpStyleSheet)
1170  {
1172  maProperties.SetParent(nullptr);
1173  mpStyleSheet = nullptr;
1174  }
1175 }
1176 
1178 {
1179  if(mpStyleSheet != &rNewStyleSheet)
1180  {
1182  mpStyleSheet = &rNewStyleSheet;
1183  StartListening(rNewStyleSheet);
1184  maProperties.SetParent(&rNewStyleSheet.GetItemSet());
1185  }
1186 }
1187 
1188 static void ImpPageChange(SdrPage& rSdrPage)
1189 {
1190  rSdrPage.ActionChanged();
1191  rSdrPage.getSdrModelFromSdrPage().SetChanged();
1192  SdrHint aHint(SdrHintKind::PageOrderChange, &rSdrPage);
1193  rSdrPage.getSdrModelFromSdrPage().Broadcast(aHint);
1194 }
1195 
1197 : mpSdrPage(&rSdrPage),
1198  mpStyleSheet(nullptr),
1199  maProperties(
1200  mpSdrPage->getSdrModelFromSdrPage().GetItemPool(),
1202 {
1203  if(!rSdrPage.IsMasterPage())
1204  {
1205  maProperties.Put(XFillStyleItem(drawing::FillStyle_NONE));
1206  }
1207 }
1208 
1210 {
1212 }
1213 
1215 {
1216  switch(rHint.GetId())
1217  {
1218  case SfxHintId::DataChanged :
1219  {
1220  // notify change, broadcast
1222  break;
1223  }
1224  case SfxHintId::Dying :
1225  {
1226  // Style needs to be forgotten
1228  break;
1229  }
1230  default: break;
1231  }
1232 }
1233 
1235 {
1236  assert(mpSdrPage);
1237  return mpSdrPage->IsInserted();
1238 }
1239 
1240 
1242 {
1243  OSL_ENSURE(!mpSdrPage->IsMasterPage(), "Item set at MasterPage Attributes (!)");
1244  maProperties.Put(rSet);
1246 }
1247 
1249 {
1250  OSL_ENSURE(!mpSdrPage->IsMasterPage(), "Item set at MasterPage Attributes (!)");
1251  maProperties.Put(rItem);
1253 }
1254 
1255 void SdrPageProperties::ClearItem(const sal_uInt16 nWhich)
1256 {
1257  maProperties.ClearItem(nWhich);
1259 }
1260 
1262 {
1263  if(pStyleSheet)
1264  {
1265  ImpAddStyleSheet(*pStyleSheet);
1266  }
1267  else
1268  {
1270  }
1271 
1273 }
1274 
1275 void SdrPageProperties::SetTheme(std::unique_ptr<svx::Theme> pTheme)
1276 {
1277  mpTheme = std::move(pTheme);
1278 
1279  if (mpTheme && mpSdrPage->IsMasterPage())
1280  {
1282  sal_uInt16 nPageCount = rModel.GetPageCount();
1283  for (sal_uInt16 nPage = 0; nPage < nPageCount; ++nPage)
1284  {
1285  SdrPage* pPage = rModel.GetPage(nPage);
1286  if (!pPage->TRG_HasMasterPage() || &pPage->TRG_GetMasterPage() != mpSdrPage)
1287  {
1288  continue;
1289  }
1290 
1291  mpTheme->UpdateSdrPage(pPage);
1292  }
1293  }
1294 }
1295 
1297 
1299 {
1300  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SdrPageProperties"));
1301  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
1302 
1303  if (mpTheme)
1304  {
1305  mpTheme->dumpAsXml(pWriter);
1306  }
1307 
1308  (void)xmlTextWriterEndElement(pWriter);
1309 }
1310 
1311 SdrPage::SdrPage(SdrModel& rModel, bool bMasterPage)
1312 : mrSdrModelFromSdrPage(rModel),
1313  mnWidth(10),
1314  mnHeight(10),
1315  mnBorderLeft(0),
1316  mnBorderUpper(0),
1317  mnBorderRight(0),
1318  mnBorderLower(0),
1319  mpLayerAdmin(new SdrLayerAdmin(&rModel.GetLayerAdmin())),
1320  nPageNum(0),
1321  mbMaster(bMasterPage),
1322  mbInserted(false),
1323  mbObjectsNotPersistent(false),
1324  mbPageBorderOnlyLeftRight(false)
1325 {
1326  mpSdrPageProperties.reset(new SdrPageProperties(*this));
1327 }
1328 
1330 {
1331  if( mxUnoPage.is() ) try
1332  {
1333  uno::Reference< lang::XComponent > xPageComponent( mxUnoPage, uno::UNO_QUERY_THROW );
1334  mxUnoPage.clear();
1335  xPageComponent->dispose();
1336  }
1337  catch( const uno::Exception& )
1338  {
1339  DBG_UNHANDLED_EXCEPTION("svx");
1340  }
1341 
1342  // tell all the registered PageUsers that the page is in destruction
1343  // This causes some (all?) PageUsers to remove themselves from the list
1344  // of page users. Therefore we have to use a copy of the list for the
1345  // iteration.
1346  sdr::PageUserVector aListCopy (maPageUsers.begin(), maPageUsers.end());
1347  for(sdr::PageUser* pPageUser : aListCopy)
1348  {
1349  DBG_ASSERT(pPageUser, "SdrPage::~SdrPage: corrupt PageUser list (!)");
1350  pPageUser->PageInDestruction(*this);
1351  }
1352 
1353  // Clear the vector. This means that user do not need to call RemovePageUser()
1354  // when they get called from PageInDestruction().
1355  maPageUsers.clear();
1356 
1357  mpLayerAdmin.reset();
1358 
1360 
1361  mpViewContact.reset();
1362  mpSdrPageProperties.reset();
1363 }
1364 
1365 void SdrPage::lateInit(const SdrPage& rSrcPage)
1366 {
1367  assert(!mpViewContact);
1368  assert(!mxUnoPage.is());
1369 
1370  // copy all the local parameters to make this instance
1371  // a valid copy of source page before copying and inserting
1372  // the contained objects
1373  mbMaster = rSrcPage.mbMaster;
1375  mnWidth = rSrcPage.mnWidth;
1376  mnHeight = rSrcPage.mnHeight;
1377  mnBorderLeft = rSrcPage.mnBorderLeft;
1378  mnBorderUpper = rSrcPage.mnBorderUpper;
1379  mnBorderRight = rSrcPage.mnBorderRight;
1380  mnBorderLower = rSrcPage.mnBorderLower;
1382  nPageNum = rSrcPage.nPageNum;
1383 
1384  if(rSrcPage.TRG_HasMasterPage())
1385  {
1388  }
1389  else
1390  {
1392  }
1393 
1395 
1396  {
1397  mpSdrPageProperties.reset(new SdrPageProperties(*this));
1398 
1399  if(!IsMasterPage())
1400  {
1401  mpSdrPageProperties->PutItemSet(rSrcPage.getSdrPageProperties().GetItemSet());
1402  }
1403 
1404  mpSdrPageProperties->SetStyleSheet(rSrcPage.getSdrPageProperties().GetStyleSheet());
1405  }
1406 
1407  // Now copy the contained objects
1408  if(0 != rSrcPage.GetObjCount())
1409  {
1410  CopyObjects(rSrcPage);
1411  }
1412 }
1413 
1415 {
1416  rtl::Reference<SdrPage> pClonedPage(new SdrPage(rTargetModel));
1417  pClonedPage->lateInit(*this);
1418  return pClonedPage;
1419 }
1420 
1421 void SdrPage::SetSize(const Size& aSiz)
1422 {
1423  bool bChanged(false);
1424 
1425  if(aSiz.Width() != mnWidth)
1426  {
1427  mnWidth = aSiz.Width();
1428  bChanged = true;
1429  }
1430 
1431  if(aSiz.Height() != mnHeight)
1432  {
1433  mnHeight = aSiz.Height();
1434  bChanged = true;
1435  }
1436 
1437  if(bChanged)
1438  {
1439  SetChanged();
1440  }
1441 }
1442 
1444 {
1445  return Size(mnWidth,mnHeight);
1446 }
1447 
1449 {
1450  return mnWidth;
1451 }
1452 
1454 {
1455  // square: handle like portrait format
1456  Size aSiz(GetSize());
1457  if (aSiz.Width()!=aSiz.Height()) {
1458  if ((eOri==Orientation::Portrait) == (aSiz.Width()>aSiz.Height())) {
1459  // coverity[swapped_arguments : FALSE] - this is in the correct order
1460  SetSize(Size(aSiz.Height(),aSiz.Width()));
1461  }
1462  }
1463 }
1464 
1466 {
1467  // square: handle like portrait format
1468  Orientation eRet=Orientation::Portrait;
1469  Size aSiz(GetSize());
1470  if (aSiz.Width()>aSiz.Height()) eRet=Orientation::Landscape;
1471  return eRet;
1472 }
1473 
1475 {
1476  return mnHeight;
1477 }
1478 
1479 void SdrPage::SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, sal_Int32 nLwr)
1480 {
1481  bool bChanged(false);
1482 
1483  if(mnBorderLeft != nLft)
1484  {
1485  mnBorderLeft = nLft;
1486  bChanged = true;
1487  }
1488 
1489  if(mnBorderUpper != nUpp)
1490  {
1491  mnBorderUpper = nUpp;
1492  bChanged = true;
1493  }
1494 
1495  if(mnBorderRight != nRgt)
1496  {
1497  mnBorderRight = nRgt;
1498  bChanged = true;
1499  }
1500 
1501  if(mnBorderLower != nLwr)
1502  {
1503  mnBorderLower = nLwr;
1504  bChanged = true;
1505  }
1506 
1507  if(bChanged)
1508  {
1509  SetChanged();
1510  }
1511 }
1512 
1513 void SdrPage::SetLeftBorder(sal_Int32 nBorder)
1514 {
1515  if(mnBorderLeft != nBorder)
1516  {
1517  mnBorderLeft = nBorder;
1518  SetChanged();
1519  }
1520 }
1521 
1522 void SdrPage::SetUpperBorder(sal_Int32 nBorder)
1523 {
1524  if(mnBorderUpper != nBorder)
1525  {
1526  mnBorderUpper = nBorder;
1527  SetChanged();
1528  }
1529 }
1530 
1531 void SdrPage::SetRightBorder(sal_Int32 nBorder)
1532 {
1533  if(mnBorderRight != nBorder)
1534  {
1535  mnBorderRight=nBorder;
1536  SetChanged();
1537  }
1538 }
1539 
1540 void SdrPage::SetLowerBorder(sal_Int32 nBorder)
1541 {
1542  if(mnBorderLower != nBorder)
1543  {
1544  mnBorderLower=nBorder;
1545  SetChanged();
1546  }
1547 }
1548 
1549 sal_Int32 SdrPage::GetLeftBorder() const
1550 {
1551  return mnBorderLeft;
1552 }
1553 
1554 sal_Int32 SdrPage::GetUpperBorder() const
1555 {
1556  return mnBorderUpper;
1557 }
1558 
1559 sal_Int32 SdrPage::GetRightBorder() const
1560 {
1561  return mnBorderRight;
1562 }
1563 
1564 sal_Int32 SdrPage::GetLowerBorder() const
1565 {
1566  return mnBorderLower;
1567 }
1568 
1570 {
1571  if (bIn != mbBackgroundFullSize)
1572  {
1573  mbBackgroundFullSize = bIn;
1574  SetChanged();
1575  }
1576 }
1577 
1579 {
1580  return mbBackgroundFullSize;
1581 }
1582 
1583 // #i68775# React on PageNum changes (from Model in most cases)
1584 void SdrPage::SetPageNum(sal_uInt16 nNew)
1585 {
1586  if(nNew != nPageNum)
1587  {
1588  // change
1589  nPageNum = nNew;
1590 
1591  // notify visualisations, also notifies e.g. buffered MasterPages
1592  ActionChanged();
1593  }
1594 }
1595 
1596 sal_uInt16 SdrPage::GetPageNum() const
1597 {
1598  if (!mbInserted)
1599  return 0;
1600 
1601  if (mbMaster) {
1602  if (getSdrModelFromSdrPage().IsMPgNumsDirty())
1604  } else {
1605  if (getSdrModelFromSdrPage().IsPagNumsDirty())
1607  }
1608  return nPageNum;
1609 }
1610 
1612 {
1613  // For test purposes, use the new ViewContact for change
1614  // notification now.
1615  ActionChanged();
1617 }
1618 
1620 {
1621  return const_cast< SdrPage* >(this);
1622 }
1623 
1624 // MasterPage interface
1625 
1627 {
1628  if(mpMasterPageDescriptor && &(mpMasterPageDescriptor->GetUsedPage()) == &rNew)
1629  return;
1630 
1633 
1634  mpMasterPageDescriptor.reset(new sdr::MasterPageDescriptor(*this, rNew));
1636 }
1637 
1639 {
1641  {
1642  SetChanged();
1643 
1644  // the flushViewObjectContacts() will do needed invalidates by deleting the involved VOCs
1645  mpMasterPageDescriptor->GetUsedPage().GetViewContact().flushViewObjectContacts();
1646 
1647  mpMasterPageDescriptor.reset();
1648  }
1649 }
1650 
1652 {
1653  DBG_ASSERT(mpMasterPageDescriptor != nullptr, "TRG_GetMasterPage(): No MasterPage available. Use TRG_HasMasterPage() before access (!)");
1654  return mpMasterPageDescriptor->GetUsedPage();
1655 }
1656 
1658 {
1659  DBG_ASSERT(mpMasterPageDescriptor != nullptr, "TRG_GetMasterPageVisibleLayers(): No MasterPage available. Use TRG_HasMasterPage() before access (!)");
1660  return mpMasterPageDescriptor->GetVisibleLayers();
1661 }
1662 
1664 {
1665  DBG_ASSERT(mpMasterPageDescriptor != nullptr, "TRG_SetMasterPageVisibleLayers(): No MasterPage available. Use TRG_HasMasterPage() before access (!)");
1666  mpMasterPageDescriptor->SetVisibleLayers(rNew);
1667 }
1668 
1670 {
1671  DBG_ASSERT(mpMasterPageDescriptor != nullptr, "TRG_GetMasterPageDescriptorViewContact(): No MasterPage available. Use TRG_HasMasterPage() before access (!)");
1672  return mpMasterPageDescriptor->GetViewContact();
1673 }
1674 
1675 // used from SdrModel::RemoveMasterPage
1677 {
1678  if(TRG_HasMasterPage())
1679  {
1680  if(&TRG_GetMasterPage() == &rRemovedPage)
1681  {
1683  }
1684  }
1685 }
1686 
1688 {
1689  std::unordered_set<OUString> aNameSet;
1690  for (size_t no(0); no < GetObjCount(); ++no)
1691  {
1692  SdrObject* pObj(GetObj(no));
1693  if(nullptr != pObj)
1694  {
1695  if (!pObj->GetName().isEmpty())
1696  {
1697  pObj->MakeNameUnique(aNameSet);
1698  SdrObjList* pSdrObjList = pObj->GetSubList(); // group
1699  if (pSdrObjList)
1700  {
1701  SdrObject* pListObj;
1702  SdrObjListIter aIter(pSdrObjList, SdrIterMode::DeepWithGroups);
1703  while (aIter.IsMore())
1704  {
1705  pListObj = aIter.Next();
1706  pListObj->MakeNameUnique(aNameSet);
1707  }
1708  }
1709  }
1710  }
1711  }
1712 }
1713 
1714 const SdrPageGridFrameList* SdrPage::GetGridFrameList(const SdrPageView* /*pPV*/, const tools::Rectangle* /*pRect*/) const
1715 {
1716  return nullptr;
1717 }
1718 
1720 {
1721  return *mpLayerAdmin;
1722 }
1723 
1725 {
1726  return *mpLayerAdmin;
1727 }
1728 
1729 OUString SdrPage::GetLayoutName() const
1730 {
1731  return OUString();
1732 }
1733 
1734 void SdrPage::SetInserted( bool bIns )
1735 {
1736  if( mbInserted == bIns )
1737  return;
1738 
1739  mbInserted = bIns;
1740 
1741  // #i120437# go over whole hierarchy, not only over object level null (seen from grouping)
1743 
1744  while ( aIter.IsMore() )
1745  {
1746  SdrObject* pObj = aIter.Next();
1747  if ( auto pOleObj = dynamic_cast<SdrOle2Obj* >(pObj) )
1748  {
1749  if( mbInserted )
1750  pOleObj->Connect();
1751  else
1752  pOleObj->Disconnect();
1753  }
1754  }
1755 }
1756 
1757 void SdrPage::SetUnoPage(uno::Reference<drawing::XDrawPage> const& xNewPage)
1758 {
1759  mxUnoPage = xNewPage;
1760 }
1761 
1762 uno::Reference< uno::XInterface > const & SdrPage::getUnoPage()
1763 {
1764  if( !mxUnoPage.is() )
1765  {
1766  // create one
1768  }
1769 
1770  return mxUnoPage;
1771 }
1772 
1773 uno::Reference< uno::XInterface > SdrPage::createUnoPage()
1774 {
1775  css::uno::Reference< css::uno::XInterface > xInt =
1776  static_cast<cppu::OWeakObject*>( new SvxFmDrawPage( this ) );
1777  return xInt;
1778 }
1779 
1781 {
1782  return pObj->GetStyleSheet();
1783 }
1784 
1786 // #i75566# GetBackgroundColor -> GetPageBackgroundColor and bScreenDisplay hint value
1787 Color SdrPage::GetPageBackgroundColor( SdrPageView const * pView, bool bScreenDisplay ) const
1788 {
1789  Color aColor;
1790 
1791  if(bScreenDisplay && (!pView || pView->GetApplicationDocumentColor() == COL_AUTO))
1792  {
1793  svtools::ColorConfig aColorConfig;
1794  aColor = aColorConfig.GetColorValue( svtools::DOCCOLOR ).nColor;
1795  }
1796  else
1797  {
1798  aColor = pView->GetApplicationDocumentColor();
1799  }
1800 
1801  const SfxItemSet* pBackgroundFill = &getSdrPageProperties().GetItemSet();
1802 
1803  if(!IsMasterPage() && TRG_HasMasterPage())
1804  {
1805  if(drawing::FillStyle_NONE == pBackgroundFill->Get(XATTR_FILLSTYLE).GetValue())
1806  {
1807  pBackgroundFill = &TRG_GetMasterPage().getSdrPageProperties().GetItemSet();
1808  }
1809  }
1810 
1811  GetDraftFillColor(*pBackgroundFill, aColor);
1812 
1813  return aColor;
1814 }
1815 
1818 // #i75566# GetBackgroundColor -> GetPageBackgroundColor
1819 {
1820  return GetPageBackgroundColor( nullptr );
1821 }
1822 
1829  const sdr::contact::ViewObjectContact& /*rOriginal*/,
1830  const sdr::contact::DisplayInfo& /*rDisplayInfo*/,
1831  bool /*bEdit*/)
1832 {
1833  // this will be handled in the application if needed
1834  return true;
1835 }
1836 
1838 {
1839  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SdrPage"));
1840  SdrObjList::dumpAsXml(pWriter);
1841 
1842  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("width"));
1843  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("value"), "%s",
1844  BAD_CAST(OString::number(mnWidth).getStr()));
1845  (void)xmlTextWriterEndElement(pWriter);
1846  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("height"));
1847  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("value"), "%s",
1848  BAD_CAST(OString::number(mnHeight).getStr()));
1849  (void)xmlTextWriterEndElement(pWriter);
1850 
1851  if (mpSdrPageProperties)
1852  {
1853  mpSdrPageProperties->dumpAsXml(pWriter);
1854  }
1855 
1856  (void)xmlTextWriterEndElement(pWriter);
1857 }
1858 
1859 // DrawContact support: Methods for handling Page changes
1861 {
1862  // Do necessary ViewContact actions
1864 
1865  // #i48535# also handle MasterPage change
1866  if(TRG_HasMasterPage())
1867  {
1869  }
1870 }
1871 
1873 {
1874  return *mpSdrPageProperties;
1875 }
1876 
1878 {
1879  return *mpSdrPageProperties;
1880 }
1881 
1883 {
1885  {
1886  return mpMasterPageDescriptor->getCorrectSdrPageProperties();
1887  }
1888  else
1889  {
1890  return &getSdrPageProperties();
1891  }
1892 }
1893 
1894 
1895 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
void SetUnoPage(css::uno::Reference< css::drawing::XDrawPage > const &)
Definition: svdpage.cxx:1757
SdrPage & TRG_GetMasterPage() const
Definition: svdpage.cxx:1651
void AddPageUser(sdr::PageUser &rNewUser)
Definition: svdpage.cxx:1128
double mnHeight
std::unique_ptr< sdr::MasterPageDescriptor > mpMasterPageDescriptor
Definition: svdpage.hxx:433
void SetNavigationPosition(const sal_uInt32 nPosition)
Definition: svdobj.cxx:939
::std::vector< PageUser * > PageUserVector
Definition: sdrpageuser.hxx:46
sal_Int32 nIndex
std::unique_ptr< svx::Theme > mpTheme
Definition: svdpage.hxx:317
tools::Rectangle maSdrObjListOutRect
Definition: svdpage.hxx:227
OLE object.
void UnGroupObj(size_t nObjNum)
Ungroup the object at the given index.
Definition: svdpage.cxx:841
virtual void SetSize(const Size &aSiz)
Definition: svdpage.cxx:1421
SdrPageProperties(SdrPage &rSdrPage)
Definition: svdpage.cxx:1196
void NbcReformatAllTextObjects()
reformat all text objects, e.g. when changing printer
Definition: svdpage.cxx:752
virtual ~SdrObjList()
Definition: svdpage.cxx:111
virtual const tools::Rectangle & GetCurrentBoundRect() const
Definition: svdobj.cxx:949
Color GetPageBackgroundColor() const
deprecated returns an averaged background color of this page
Definition: svdpage.cxx:1817
sdr::PageUserVector maPageUsers
Definition: svdpage.hxx:389
struct _xmlTextWriter * xmlTextWriterPtr
tools::Long GetWidth() const
Definition: svdpage.cxx:1448
void ClearItem(const sal_uInt16 nWhich=0)
Definition: svdpage.cxx:1255
void impClearSdrObjList(bool bBroadcast)
Definition: svdpage.cxx:68
virtual void SetOrientation(Orientation eOri)
Definition: svdpage.cxx:1453
sal_uInt32 m_nOrdNum
Definition: svdobj.hxx:952
void ReplaceObjectInContainer(SdrObject &rObject, const sal_uInt32 nObjectPosition)
Replace an object in the object list.
Definition: svdpage.cxx:1038
const tools::Rectangle & GetAllObjBoundRect() const
Definition: svdpage.cxx:737
virtual ViewContact * GetParentContact() const
virtual Orientation GetOrientation() const
Definition: svdpage.cxx:1465
bool mbObjOrdNumsDirty
Definition: svdpage.hxx:233
SdrPage(const SdrPage &)=delete
void PutItem(const SfxPoolItem &rItem)
Definition: svdpage.cxx:1248
void SetNavigationOrder(const css::uno::Reference< css::container::XIndexAccess > &rxOrder)
Set the navigation order to the one defined by the given list of XShape objects.
Definition: svdpage.cxx:983
sal_Int32 mnBorderRight
Definition: svdpage.hxx:418
long Long
virtual void SetLeftBorder(sal_Int32 nBorder)
Definition: svdpage.cxx:1513
tools::Long mnHeight
Definition: svdpage.hxx:415
static SdrObject * getSdrObjectFromXShape(const css::uno::Reference< css::uno::XInterface > &xInt)
Definition: unoshape.cxx:4017
virtual void NbcInsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
Definition: svdpage.cxx:278
virtual void Notify(SfxBroadcaster &rBC, const SfxHint &rHint) override
Definition: svdpage.cxx:1214
virtual rtl::Reference< SdrPage > CloneSdrPage(SdrModel &rTargetModel) const
Definition: svdpage.cxx:1414
constexpr TypedWhichId< XFillStyleItem > XATTR_FILLSTYLE(XATTR_FILL_FIRST)
constexpr::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
SdrObject * GetObj(size_t nNum) const
Definition: svdpage.cxx:807
sal_Int32 GetRightBorder() const
Definition: svdpage.cxx:1559
void RecalcObjOrdNums()
recalculate order numbers / ZIndex
Definition: svdpage.cxx:230
bool IsInserted() const
Definition: svdobj.hxx:739
void RecalcPageNums(bool bMaster)
Definition: svdmodel.cxx:1159
size_t GetObjCount() const
Definition: svdpage.cxx:801
void MakePageObjectsNamesUnique()
Definition: svdpage.cxx:1687
SdrObject * GetObjectForNavigationPosition(const sal_uInt32 nNavigationPosition) const
Return the object for the given navigation position.
Definition: svdpage.cxx:927
void CopyObjects(const SdrObjList &rSrcList)
Definition: svdpage.cxx:129
virtual bool isUsedByModel() const override
Definition: svdpage.cxx:1234
bool mbRectsDirty
Definition: svdpage.hxx:234
void TRG_ClearMasterPage()
Definition: svdpage.cxx:1638
std::optional< std::vector< tools::WeakReference< SdrObject > > > mxNavigationOrder
This list, if it exists, defines the navigation order.
Definition: svdpage.hxx:232
virtual SfxItemSet & GetItemSet()
static void Free(SdrObject *&_rpObject)
Definition: svdobj.cxx:471
virtual SdrObjKind GetObjIdentifier() const
Definition: svdobj.cxx:649
sal_Int32 GetLowerBorder() const
Definition: svdpage.cxx:1564
virtual void InsertObject(SdrObject *pObj, size_t nPos=SAL_MAX_SIZE)
Definition: svdpage.cxx:329
virtual css::uno::Reference< css::uno::XInterface > createUnoPage()
Definition: svdpage.cxx:1773
EmbeddedObjectRef * pObject
SVX_DLLPRIVATE void setParentOfSdrObject(SdrObjList *pNew)
Definition: svdobj.cxx:284
virtual bool checkVisibility(const sdr::contact::ViewObjectContact &rOriginal, const sdr::contact::DisplayInfo &rDisplayInfo, bool bEdit)
this method returns true if the object from the ViewObjectContact should be visible on this page whil...
Definition: svdpage.cxx:1828
void ImpAddStyleSheet(SfxStyleSheet &rNewStyleSheet)
Definition: svdpage.cxx:1177
virtual SdrObjList * GetSubList() const
Definition: svdobj.cxx:738
sal_Int32 GetLeftBorder() const
Definition: svdpage.cxx:1549
SfxHintId GetId() const
SfxStyleSheet * mpStyleSheet
Definition: svdpage.hxx:316
sdr::contact::ViewContact & GetViewContact() const
Definition: svdobj.cxx:251
void ConnectToNode(bool bTail1, SdrObject *pObj) override
Definition: svdoedge.cxx:470
virtual ~SdrPage() override
Definition: svdpage.cxx:1329
virtual const tools::Rectangle & GetSnapRect() const
Definition: svdobj.cxx:1660
constexpr tools::Long Width() const
void SetExistingObjectOrdNum(SdrObject *pExistingObj, size_t nNewObjNum)
Modify ZOrder of an SdrObject, object must already be in the list.
Definition: svdpage.cxx:559
void SetTheme(std::unique_ptr< svx::Theme > pTheme)
Definition: svdpage.cxx:1275
virtual bool IsReadOnly() const
linked page or linked group object
Definition: svdpage.cxx:816
void RemoveObjectFromContainer(const sal_uInt32 nObjectPosition)
Remove an object from the object list.
Definition: svdpage.cxx:1073
bool IsMore() const
Definition: svditer.hxx:62
std::deque< SdrObject * > maList
Definition: svdpage.hxx:229
SdrPage * getSdrPageFromSdrObject() const
Definition: svdobj.cxx:269
void AddUndo(std::unique_ptr< SdrUndoAction > pUndo)
Definition: svdmodel.cxx:502
int nCount
css::uno::Reference< css::uno::XInterface > mxUnoPage
Definition: svdpage.hxx:424
bool mbInserted
Definition: svdpage.hxx:438
SfxStyleSheet * GetStyleSheet() const
Definition: svdobj.cxx:2242
bool isLocked() const
Definition: svdmodel.hxx:558
virtual SdrPage * getSdrPageFromSdrObjList() const override
Definition: svdpage.cxx:1619
void MakeNameUnique()
Definition: svdobj.cxx:3109
std::unique_ptr< sdr::contact::ViewContact > CreateObjectSpecificViewContact()
Definition: svdpage.cxx:1145
void BurnInStyleSheetAttributes()
Definition: svdobj.cxx:1840
static std::unique_ptr< SdrUndoAction > CreateUndoSort(SdrPage &rPage,::std::vector< sal_Int32 > const &rSortOrder)
Definition: svdundo.cxx:1767
sal_Int32 mnBorderLeft
Definition: svdpage.hxx:416
sal_Int32 mnBorderUpper
Definition: svdpage.hxx:417
SvGenericNameContainerMapImpl maProperties
void ReformatAllTextObjects()
Definition: svdpage.cxx:768
void TRG_SetMasterPage(SdrPage &rNew)
Definition: svdpage.cxx:1626
virtual void SetChanged(bool bFlg=true)
Definition: svdmodel.cxx:1154
void RemovePageUser(sdr::PageUser &rOldUser)
Definition: svdpage.cxx:1133
const Color & GetApplicationDocumentColor() const
Definition: svdpagv.hxx:251
virtual void SetBoundAndSnapRectsDirty(bool bNotMyself=false, bool bRecursive=true)
Definition: svdobj.cxx:510
SdrObject * GetConnectedNode(bool bTail1) const override
Definition: svdoedge.cxx:494
void SetStyleSheet(SfxStyleSheet *pStyleSheet)
Definition: svdpage.cxx:1261
constexpr bool IsEmpty() const
void ReformatAllEdgeObjects()
#103122# reformats all edge objects that are connected to other objects
Definition: svdpage.cxx:777
void SetPageNum(sal_uInt16 nNew)
Definition: svdpage.cxx:1584
#define DBG_UNHANDLED_EXCEPTION(...)
std::vector< SdrPageGridFrame * > aList
Definition: svdpage.hxx:294
Orientation
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
virtual const SdrPageGridFrameList * GetGridFrameList(const SdrPageView *pPV, const tools::Rectangle *pRect) const
for snap-to-grid in Writer, also for AlignObjects if 1 object is marked if pRect != null...
Definition: svdpage.cxx:1714
std::unique_ptr< SdrLayerAdmin > mpLayerAdmin
Definition: svdpage.hxx:422
SdrPage * mpSdrPage
Definition: svdpage.hxx:315
#define DBG_ASSERT(sCon, aError)
int i
uno_Any a
bool mbMaster
Definition: svdpage.hxx:437
bool IsUndoEnabled() const
returns true if undo is currently enabled This returns false if undo was disabled using EnableUndo( f...
Definition: svdmodel.cxx:533
virtual void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: svdpage.cxx:1099
tools::Long GetHeight() const
Definition: svdpage.cxx:1474
virtual SfxStyleSheet * GetTextStyleSheetForObject(SdrObject *pObj) const
Definition: svdpage.cxx:1780
const SdrLayerIDSet & TRG_GetMasterPageVisibleLayers() const
Definition: svdpage.cxx:1657
Size GetSize() const
Definition: svdpage.cxx:1443
sal_Int32 GetUpperBorder() const
Definition: svdpage.cxx:1554
void SetBackgroundFullSize(bool bIn)
Definition: svdpage.cxx:1569
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: svdpage.cxx:1298
svx::Theme * GetTheme()
Definition: svdpage.cxx:1296
const SdrPage * GetPage(sal_uInt16 nPgNum) const
Definition: svdmodel.cxx:1801
void ActionChanged() const
Definition: svdobj.cxx:263
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
virtual void SetUpperBorder(sal_Int32 nBorder)
Definition: svdpage.cxx:1522
static void ImpPageChange(SdrPage &rSdrPage)
Definition: svdpage.cxx:1188
SdrModel & getSdrModelFromSdrObject() const
Definition: svdobj.cxx:279
sal_uInt32 GetOrdNum() const
The order number (aka ZOrder, aka z-index) determines whether a SdrObject is located above or below a...
Definition: svdobj.cxx:892
const SdrLayerAdmin & GetLayerAdmin() const
changing the layers does not set the modified-flag!
Definition: svdpage.cxx:1719
size
bool HasObjectNavigationOrder() const
Return whether there is an explicit, user defined, object navigation order.
Definition: svdpage.cxx:876
bool IsMasterPage() const
Definition: svdpage.hxx:459
const SfxItemSet & GetItemSet() const
Definition: svdpage.hxx:337
void Reformat()
updates edges that are connected to the edges of this object as if the connected objects send a repai...
Definition: svdoedge.cxx:1651
void StartListening(SfxBroadcaster &rBroadcaster, DuplicateHandling eDuplicateHanding=DuplicateHandling::Unexpected)
virtual OUString GetLayoutName() const
Definition: svdpage.cxx:1729
SdrPageProperties & getSdrPageProperties()
Definition: svdpage.cxx:1872
void InsertObjectThenMakeNameUnique(SdrObject *pObj)
Definition: svdpage.cxx:303
bool TRG_HasMasterPage() const
Definition: svdpage.hxx:495
virtual SdrObject * NbcRemoveObject(size_t nObjNum)
remove from list without delete
Definition: svdpage.cxx:368
void flushViewObjectContacts(bool bWithHierarchy=true)
virtual ~SdrPageProperties() override
Definition: svdpage.cxx:1209
Abstract DrawObject.
Definition: svdobj.hxx:259
virtual void ActionChanged()
virtual SdrObject * RemoveObject(size_t nObjNum)
Definition: svdpage.cxx:407
void ActionChildInserted(ViewContact &rChild)
sal_uInt16 GetCount() const
Definition: svdpage.hxx:304
const sal_uInt16 idx[]
void SetObjectNavigationPosition(SdrObject &rObject, const sal_uInt32 nNewNavigationPosition)
Set the navigation position of the given object to the specified value.
Definition: svdpage.cxx:878
void SetParent(const SfxItemSet *pNew)
virtual void SetRightBorder(sal_Int32 nBorder)
Definition: svdpage.cxx:1531
void lateInit(const SdrPage &rSrcPage)
Definition: svdpage.cxx:1365
SdrPageGridFrame * GetObject(sal_uInt16 i) const
Definition: svdpage.hxx:298
sal_Int32 mnBorderLower
Definition: svdpage.hxx:419
SdrModel & getSdrModelFromSdrPage() const
Definition: svdpage.hxx:398
virtual void NbcReformatText()
Definition: svdobj.cxx:1836
virtual void SetLowerBorder(sal_Int32 nBorder)
Definition: svdpage.cxx:1540
SdrObject * Next()
Definition: svditer.hxx:63
void ActionChanged()
Definition: svdpage.cxx:1860
void InsertedStateChange()
Definition: svdobj.cxx:2644
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
void Broadcast(const SfxHint &rHint)
void SetInserted(bool bNew=true)
Definition: svdpage.cxx:1734
void sort(std::vector< sal_Int32 > &sortOrder)
Definition: svdpage.cxx:615
A named theme has a named color set.
Definition: ColorSets.hxx:73
sdr::contact::ViewContact & TRG_GetMasterPageDescriptorViewContact() const
Definition: svdpage.cxx:1669
bool IsInserted() const
Definition: svdpage.hxx:461
void BurnInStyleSheetAttributes()
convert attributes of the style to hard formatting
Definition: svdpage.cxx:793
virtual SdrObject * ReplaceObject(SdrObject *pNewObj, size_t nObjNum)
Replace existing object by different one.
Definition: svdpage.cxx:463
void TRG_ImpMasterPageRemoved(const SdrPage &rRemovedPage)
Definition: svdpage.cxx:1676
ColorConfigValue GetColorValue(ColorConfigEntry eEntry, bool bSmart=true) const
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
tools::Rectangle & Union(const tools::Rectangle &rRect)
const sdr::contact::ViewContact & GetViewContact() const
Definition: svdpage.cxx:1150
constexpr tools::Long Height() const
bool RecalcNavigationPositions()
Set the navigation position of all SdrObjects to their position in the mxNavigationOrder list...
Definition: svdpage.cxx:962
void ClearSdrObjList()
Definition: svdpage.cxx:105
void SetOrdNum(sal_uInt32 nNum)
Definition: svdobj.cxx:904
SfxStyleSheet * GetStyleSheet() const
Definition: svdpage.hxx:344
css::uno::Reference< css::uno::XInterface > const & getUnoPage()
Definition: svdpage.cxx:1762
std::unique_ptr< sdr::contact::ViewContact > mpViewContact
Definition: svdpage.hxx:391
void ClearObjectNavigationOrder()
Restore the navigation order to that defined by the z-order.
Definition: svdpage.cxx:955
const SdrPageProperties * getCorrectSdrPageProperties() const
Definition: svdpage.cxx:1882
double mnWidth
void EndListening(SfxBroadcaster &rBroadcaster, bool bRemoveAllDuplicates=false)
virtual SdrPage * getSdrPageFromSdrObjList() const
Definition: svdpage.cxx:117
static void impChildInserted(SdrObject const &rChild)
simple ActionChildInserted forwarder to have it on a central place
Definition: svdpage.cxx:268
void SetSdrObjListRectsDirty()
Definition: svdpage.cxx:257
void TRG_SetMasterPageVisibleLayers(const SdrLayerIDSet &rNew)
Definition: svdpage.cxx:1663
const Point & GetAnchorPos() const
Definition: svdobj.cxx:1651
void InsertObjectIntoContainer(SdrObject &rObject, const sal_uInt32 nInsertPosition)
Insert an SdrObject into maList.
Definition: svdpage.cxx:1012
SdrObjList()
Definition: svdpage.cxx:61
virtual void SetBorder(sal_Int32 nLft, sal_Int32 nUpp, sal_Int32 nRgt, sal_Int32 Lwr)
Definition: svdpage.cxx:1479
bool mbIsNavigationOrderDirty
This flag is when the mpNavigation list has been changed but the indices of the referenced Sdr...
Definition: svdpage.hxx:237
SfxItemSet maProperties
Definition: svdpage.hxx:318
bool mbObjectsNotPersistent
Definition: svdpage.hxx:439
virtual void NbcSetAnchorPos(const Point &rPnt)
Definition: svdobj.cxx:1633
void ImpRemoveStyleSheet()
Definition: svdpage.cxx:1167
bool mbPageBorderOnlyLeftRight
Definition: svdpage.hxx:442
virtual SdrObject * SetObjectOrdNum(size_t nOldObjNum, size_t nNewObjNum)
Modify ZOrder of an SdrObject.
Definition: svdpage.cxx:527
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLBACKGROUND)
bool IsBackgroundFullSize() const
Definition: svdpage.cxx:1578
A SdrPage contains exactly one SdrObjList and a description of the physical page dimensions (size / m...
Definition: svdpage.hxx:373
SdrObjList * getParentSdrObjListFromSdrObject() const
Definition: svdobj.cxx:305
std::unique_ptr< SdrPageProperties > mpSdrPageProperties
Definition: svdpage.hxx:423
tools::Rectangle maSdrObjListSnapRect
Definition: svdpage.hxx:228
bool GetDraftFillColor(const SfxItemSet &rSet, Color &rCol)
Returns a replacement for an XFillStyle.
Definition: svdetc.cxx:248
tools::Long mnWidth
Definition: svdpage.hxx:414
sal_uInt16 GetPageNum() const
Definition: svdpage.cxx:1596
sal_uInt16 nPageNum
Definition: svdpage.hxx:435
bool mbBackgroundFullSize
Background object to represent the whole page.
Definition: svdpage.hxx:420
const tools::Rectangle & GetAllObjSnapRect() const
Definition: svdpage.cxx:728
virtual SdrObject * getSdrObjectFromSdrObjList() const
Definition: svdpage.cxx:123
void SetChanged()
Definition: svdpage.cxx:1611
const OUString & GetName() const
Definition: svdobj.cxx:792
aStr
void dumpAsXml(xmlTextWriterPtr pWriter) const override
Definition: svdpage.cxx:1837
void RecalcRects()
Definition: svdpage.cxx:240
sal_uInt16 GetPageCount() const
Definition: svdmodel.cxx:1811
void PutItemSet(const SfxItemSet &rSet)
Definition: svdpage.cxx:1241
void FlattenGroups()
Makes the object list flat, i.e.
Definition: svdpage.cxx:834
Utility class SdrEdgeObj.
Definition: svdoedge.hxx:129
bool m_bDetectedRangeSegmentation false
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo