LibreOffice Module sw (master)  1
pagedesc.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 <libxml/xmlwriter.h>
21 
22 #include <editeng/pbinitem.hxx>
23 #include <editeng/ulspitem.hxx>
24 #include <editeng/boxitem.hxx>
25 #include <editeng/shaditem.hxx>
26 #include <editeng/frmdiritem.hxx>
27 #include <osl/diagnose.h>
28 #include <sal/log.hxx>
29 #include <fmtclds.hxx>
30 #include <fmtfsize.hxx>
31 #include <fmthdft.hxx>
32 #include <pagefrm.hxx>
33 #include <pagedesc.hxx>
34 #include <swtable.hxx>
35 #include <frmatr.hxx>
36 #include <frmtool.hxx>
37 #include <doc.hxx>
38 #include <node.hxx>
39 #include <strings.hrc>
42 #include <poolfmt.hxx>
43 #include <calbck.hxx>
44 
45 SwPageDesc::SwPageDesc(const OUString& rName, SwFrameFormat *pFormat, SwDoc *const pDoc)
46  : sw::BroadcastingModify()
47  , m_StyleName( rName )
48  , m_Master( pDoc->GetAttrPool(), rName, pFormat )
49  , m_Left( pDoc->GetAttrPool(), rName, pFormat )
50  , m_FirstMaster( pDoc->GetAttrPool(), rName, pFormat )
51  , m_FirstLeft( pDoc->GetAttrPool(), rName, pFormat )
52  , m_aStashedHeader()
53  , m_aStashedFooter()
54  , m_aDepends(*this)
55  , m_pTextFormatColl(nullptr)
56  , m_pFollow( this )
57  , m_nRegHeight( 0 )
58  , m_nRegAscent( 0 )
59  , m_nVerticalAdjustment( drawing::TextVerticalAdjust_TOP )
61  , m_IsLandscape( false )
62  , m_IsHidden( false )
63  , m_pdList( nullptr )
64 {
65 }
66 
68  : sw::BroadcastingModify()
69  , m_StyleName( rCpy.GetName() )
70  , m_NumType( rCpy.GetNumType() )
71  , m_Master( rCpy.GetMaster() )
72  , m_Left( rCpy.GetLeft() )
73  , m_FirstMaster( rCpy.GetFirstMaster() )
74  , m_FirstLeft( rCpy.GetFirstLeft() )
75  , m_aDepends(*this)
76  , m_pTextFormatColl(nullptr)
77  , m_pFollow( rCpy.m_pFollow )
78  , m_nRegHeight( rCpy.GetRegHeight() )
79  , m_nRegAscent( rCpy.GetRegAscent() )
80  , m_nVerticalAdjustment( rCpy.GetVerticalAdjustment() )
81  , m_eUse( rCpy.ReadUseOn() )
82  , m_IsLandscape( rCpy.GetLandscape() )
83  , m_IsHidden( rCpy.IsHidden() )
84  , m_FootnoteInfo( rCpy.GetFootnoteInfo() )
85  , m_pdList( nullptr )
86 {
90 
94 
96  {
98  m_aDepends.StartListening(const_cast<SwTextFormatColl*>(m_pTextFormatColl));
99  }
100 }
101 
103 {
104  if(this == &rSrc)
105  return *this;
106 
107  m_StyleName = rSrc.m_StyleName;
108  m_NumType = rSrc.m_NumType;
109  m_Master = rSrc.m_Master;
110  m_Left = rSrc.m_Left;
112  m_FirstLeft = rSrc.m_FirstLeft;
113 
117 
121 
124  {
126  m_aDepends.StartListening(const_cast<SwTextFormatColl*>(m_pTextFormatColl));
127  }
128  else
129  m_pTextFormatColl = nullptr;
130 
131  if (rSrc.m_pFollow == &rSrc)
132  m_pFollow = this;
133  else
134  m_pFollow = rSrc.m_pFollow;
135 
136  m_nRegHeight = rSrc.m_nRegHeight;
137  m_nRegAscent = rSrc.m_nRegAscent;
139  m_eUse = rSrc.m_eUse;
141  return *this;
142 }
143 
145 {
146 }
147 
148 bool SwPageDesc::SetName( const OUString& rNewName )
149 {
150  bool renamed = true;
151  if (m_pdList) {
153  if( m_pdList->end() == it ) {
154  SAL_WARN( "sw", "SwPageDesc not found in expected m_pdList" );
155  return false;
156  }
157  renamed = m_pdList->m_PosIndex.modify( it,
158  change_name( rNewName ), change_name( m_StyleName ) );
159  }
160  else
161  m_StyleName = rNewName;
162  return renamed;
163 }
164 
168 {
169  //Only the margins are mirrored, all other values are just copied.
171  const SvxLRSpaceItem &rLR = m_Master.GetLRSpace();
172  aLR.SetLeft( rLR.GetRight() );
173  aLR.SetRight( rLR.GetLeft() );
175 
178  aSet.Put( aLR );
179  aSet.Put( m_Master.GetFrameSize() );
180  aSet.Put( m_Master.GetPaperBin() );
181  aSet.Put( m_Master.GetULSpace() );
182  aSet.Put( m_Master.GetBox() );
183  aSet.Put( *m_Master.makeBackgroundBrushItem() );
184  aSet.Put( m_Master.GetShadow() );
185  aSet.Put( m_Master.GetCol() );
186  aSet.Put( m_Master.GetFrameDir() );
187  m_Left.SetFormatAttr( aSet );
188 }
189 
191 {
192  SwFrameFormat& rFormat = GetMaster();
193 
194  // #i73790# - method renamed
195  rFormat.ResetAllFormatAttr();
196  rFormat.SetFormatAttr( SvxFrameDirectionItem(SvxFrameDirection::Horizontal_LR_TB, RES_FRAMEDIR) );
197 }
198 
199 // gets information from Modify
200 bool SwPageDesc::GetInfo( SfxPoolItem & rInfo ) const
201 {
202  if (!m_Master.GetInfo(rInfo))
203  return false; // found
204  if (!m_Left.GetInfo(rInfo))
205  return false ;
206  if ( !m_FirstMaster.GetInfo( rInfo ) )
207  return false;
208  return m_FirstLeft.GetInfo( rInfo );
209 }
210 
213 {
214  if(pFormat != m_pTextFormatColl)
215  {
217  m_pTextFormatColl = pFormat;
218  m_aDepends.StartListening(const_cast<SwTextFormatColl*>(m_pTextFormatColl));
219  RegisterChange();
220  }
221 }
222 
225 {
227  m_pTextFormatColl = nullptr;
228  return m_pTextFormatColl;
229 }
230 
233 {
234  // #117072# - During destruction of the document <SwDoc>
235  // the page description is modified. Thus, do nothing, if the document
236  // is in destruction respectively if no viewshell exists.
237  SwDoc* pDoc = GetMaster().GetDoc();
238  if ( !pDoc || pDoc->IsInDtor() )
239  {
240  return;
241  }
243  if ( !pSh )
244  {
245  return;
246  }
247 
248  m_nRegHeight = 0;
249  {
251  for( SwFrame* pLast = aIter.First(); pLast; pLast = aIter.Next() )
252  {
253  if( pLast->IsPageFrame() )
254  static_cast<SwPageFrame*>(pLast)->PrepareRegisterChg();
255  }
256  }
257  {
259  for( SwFrame* pLast = aIter.First(); pLast; pLast = aIter.Next() )
260  {
261  if( pLast->IsPageFrame() )
262  static_cast<SwPageFrame*>(pLast)->PrepareRegisterChg();
263  }
264  }
265  {
267  for( SwFrame* pLast = aIter.First(); pLast; pLast = aIter.Next() )
268  {
269  if( pLast->IsPageFrame() )
270  static_cast<SwPageFrame*>(pLast)->PrepareRegisterChg();
271  }
272  }
273  {
275  for( SwFrame* pLast = aIter.First(); pLast; pLast = aIter.Next() )
276  {
277  if( pLast->IsPageFrame() )
278  static_cast<SwPageFrame*>(pLast)->PrepareRegisterChg();
279  }
280  }
281 }
282 
284 void SwPageDesc::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
285 {
286  if(auto pLegacyHint = dynamic_cast<const sw::LegacyModifyHint*>(&rHint))
287  {
288  const sal_uInt16 nWhich = pLegacyHint->m_pOld
289  ? pLegacyHint->m_pOld->Which()
290  : pLegacyHint->m_pNew
291  ? pLegacyHint->m_pNew->Which()
292  : 0;
293  CallSwClientNotify(rHint);
294  if((RES_ATTRSET_CHG == nWhich)
295  || (RES_FMT_CHG == nWhich)
296  || isCHRATR(nWhich)
297  || (RES_PARATR_LINESPACING == nWhich))
298  RegisterChange();
299  }
300  else if (auto pModifyChangedHint = dynamic_cast<const sw::ModifyChangedHint*>(&rHint))
301  {
302  if(m_pTextFormatColl == &rModify)
303  m_pTextFormatColl = static_cast<const SwTextFormatColl*>(pModifyChangedHint->m_pNew);
304  else
305  assert(false);
306  }
307 }
308 
309 static const SwFrame* lcl_GetFrameOfNode( const SwNode& rNd )
310 {
311  const sw::BroadcastingModify* pMod;
312  SwFrameType nFrameType = FRM_CNTNT;
313 
314  if( rNd.IsContentNode() )
315  {
316  pMod = &static_cast<const SwContentNode&>(rNd);
317  }
318  else if( rNd.IsTableNode() )
319  {
320  pMod = static_cast<const SwTableNode&>(rNd).GetTable().GetFrameFormat();
321  nFrameType = SwFrameType::Tab;
322  }
323  else
324  pMod = nullptr;
325 
326  Point aNullPt;
327  std::pair<Point, bool> const tmp(aNullPt, false);
328  return pMod ? ::GetFrameOfModify(nullptr, *pMod, nFrameType, nullptr, &tmp)
329  : nullptr;
330 }
331 
333 {
334  const SwPageDesc* pRet = nullptr;
335  const SwFrame* pChkFrame = lcl_GetFrameOfNode( rNd );
336  if (pChkFrame && nullptr != (pChkFrame = pChkFrame->FindPageFrame()))
337  pRet = static_cast<const SwPageFrame*>(pChkFrame)->GetPageDesc();
338  return pRet;
339 }
340 
342  bool bCheckForThisPgDc ) const
343 {
344  // which PageDescFormat is valid for this node?
345  const SwFrameFormat* pRet;
346  const SwFrame* pChkFrame = lcl_GetFrameOfNode( rNd );
347 
348  if( pChkFrame && nullptr != ( pChkFrame = pChkFrame->FindPageFrame() ))
349  {
350  const SwPageDesc* pPd = bCheckForThisPgDc ? this :
351  static_cast<const SwPageFrame*>(pChkFrame)->GetPageDesc();
352  pRet = &pPd->GetMaster();
353  OSL_ENSURE( static_cast<const SwPageFrame*>(pChkFrame)->GetPageDesc() == pPd, "Wrong node for detection of page format!" );
354  // this page is assigned to which format?
355  if( !pChkFrame->KnowsFormat(*pRet) )
356  {
357  pRet = &pPd->GetLeft();
358  OSL_ENSURE( pChkFrame->KnowsFormat(*pRet), "Wrong node for detection of page format!" );
359  }
360  }
361  else
362  pRet = &GetMaster();
363  return pRet;
364 }
365 
367 {
368  bool bRet = false;
369  if( GetFollow() && this != GetFollow() )
370  {
371  const SwFrame* pChkFrame = lcl_GetFrameOfNode( rNd );
372  if( pChkFrame && nullptr != ( pChkFrame = pChkFrame->FindPageFrame() ) &&
373  pChkFrame->IsPageFrame() &&
374  ( !pChkFrame->GetNext() || GetFollow() ==
375  static_cast<const SwPageFrame*>(pChkFrame->GetNext())->GetPageDesc() ))
376  // the page on which the follow points was found
377  bRet = true;
378  }
379  return bRet;
380 }
381 
383 {
384  return (UseOnPage::Left & m_eUse)
385  ? (bFirst ? &m_FirstLeft : &m_Left)
386  : nullptr;
387 }
388 
390 {
391  return (UseOnPage::Right & m_eUse)
392  ? (bFirst ? &m_FirstMaster : &m_Master)
393  : nullptr;
394 }
395 
397 {
398  return bool(m_eUse & UseOnPage::FirstShare);
399 }
400 
401 void SwPageDesc::ChgFirstShare( bool bNew )
402 {
403  if ( bNew )
405  else
407 }
408 
409 void SwPageDesc::StashFrameFormat(const SwFrameFormat& rFormat, bool bHeader, bool bLeft, bool bFirst)
410 {
411  assert(rFormat.GetRegisteredIn());
412  std::shared_ptr<SwFrameFormat>* pFormat = nullptr;
413 
414  if (bHeader)
415  {
416  if (bLeft && !bFirst)
417  pFormat = &m_aStashedHeader.m_pStashedLeft;
418  else if (!bLeft && bFirst)
420  else if (bLeft && bFirst)
422  }
423  else
424  {
425  if (bLeft && !bFirst)
426  pFormat = &m_aStashedFooter.m_pStashedLeft;
427  else if (!bLeft && bFirst)
429  else if (bLeft && bFirst)
431  }
432 
433  if (pFormat)
434  {
435  *pFormat = std::make_shared<SwFrameFormat>(rFormat);
436  }
437  else
438  {
439  SAL_WARN(
440  "sw",
441  "SwPageDesc::StashFrameFormat: Stashing the right page header/footer is pointless.");
442  }
443 }
444 
445 const SwFrameFormat* SwPageDesc::GetStashedFrameFormat(bool bHeader, bool bLeft, bool bFirst) const
446 {
447  std::shared_ptr<SwFrameFormat>* pFormat = nullptr;
448 
449  if (bLeft && !bFirst)
450  {
452  }
453  else if (!bLeft && bFirst)
454  {
456  }
457  else if (bLeft && bFirst)
458  {
460  }
461 
462  if (pFormat)
463  {
464  return pFormat->get();
465  }
466  else
467  {
468  SAL_WARN("sw", "SwPageDesc::GetStashedFrameFormat: Right page format is never stashed.");
469  return nullptr;
470  }
471 }
472 
473 bool SwPageDesc::HasStashedFormat(bool bHeader, bool bLeft, bool bFirst)
474 {
475  if (bHeader)
476  {
477  if (bLeft && !bFirst)
478  {
479  return m_aStashedHeader.m_pStashedLeft != nullptr;
480  }
481  else if (!bLeft && bFirst)
482  {
483  return m_aStashedHeader.m_pStashedFirst != nullptr;
484  }
485  else if (bLeft && bFirst)
486  {
487  return m_aStashedHeader.m_pStashedFirstLeft != nullptr;
488  }
489  else
490  {
491  SAL_WARN("sw", "SwPageDesc::HasStashedFormat: Right page format is never stashed.");
492  return false;
493  }
494  }
495  else
496  {
497  if (bLeft && !bFirst)
498  {
499  return m_aStashedFooter.m_pStashedLeft != nullptr;
500  }
501  else if (!bLeft && bFirst)
502  {
503  return m_aStashedFooter.m_pStashedFirst != nullptr;
504  }
505  else if (bLeft && bFirst)
506  {
507  return m_aStashedFooter.m_pStashedFirstLeft != nullptr;
508  }
509  else
510  {
511  SAL_WARN("sw", "SwPageDesc::HasStashedFormat: Right page format is never stashed.");
512  return false;
513  }
514  }
515 }
516 
517 void SwPageDesc::RemoveStashedFormat(bool bHeader, bool bLeft, bool bFirst)
518 {
519  if (bHeader)
520  {
521  if (bLeft && !bFirst)
522  {
524  }
525  else if (!bLeft && bFirst)
526  {
528  }
529  else if (bLeft && bFirst)
530  {
532  }
533  else
534  {
535  SAL_WARN("sw", "SwPageDesc::RemoveStashedFormat: Right page format is never stashed.");
536  }
537  }
538  else
539  {
540  if (bLeft && !bFirst)
541  {
543  }
544  else if (!bLeft && bFirst)
545  {
547  }
548  else if (bLeft && bFirst)
549  {
551  }
552  else
553  {
554  SAL_WARN("sw", "SwPageDesc::RemoveStashedFormat: Right page format is never stashed.");
555  }
556  }
557 }
558 
559 // Page styles
560 static const char* STR_POOLPAGE[] =
561 {
562  STR_POOLPAGE_STANDARD,
563  STR_POOLPAGE_FIRST,
564  STR_POOLPAGE_LEFT,
565  STR_POOLPAGE_RIGHT,
566  STR_POOLPAGE_ENVELOPE,
567  STR_POOLPAGE_REGISTER,
568  STR_POOLPAGE_HTML,
569  STR_POOLPAGE_FOOTNOTE,
570  STR_POOLPAGE_ENDNOTE,
571  STR_POOLPAGE_LANDSCAPE
572 };
573 
574 SwPageDesc* SwPageDesc::GetByName(SwDoc& rDoc, std::u16string_view rName)
575 {
576  const size_t nDCount = rDoc.GetPageDescCnt();
577 
578  for( size_t i = 0; i < nDCount; i++ )
579  {
580  SwPageDesc* pDsc = &rDoc.GetPageDesc( i );
581  if(pDsc->GetName() == rName)
582  {
583  return pDsc;
584  }
585  }
586 
587  for (size_t i = 0; i < SAL_N_ELEMENTS(STR_POOLPAGE); ++i)
588  {
589  if (rName == SwResId(STR_POOLPAGE[i]))
590  {
591  return rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool( static_cast< sal_uInt16 >(
592  i + RES_POOLPAGE_BEGIN) );
593  }
594  }
595 
596  return nullptr;
597 }
598 
600 {
601  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwPageDesc"));
602  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
603  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("m_StyleName"), "%s",
604  BAD_CAST(m_StyleName.toUtf8().getStr()));
605  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("m_pFollow"), "%p", m_pFollow);
606  (void)xmlTextWriterWriteFormatAttribute(
607  pWriter, BAD_CAST("m_eUse"), "0x%s",
608  BAD_CAST(OString::number(static_cast<int>(m_eUse), 16).getStr()));
609 
610  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("m_Master"));
611  m_Master.dumpAsXml(pWriter);
612  (void)xmlTextWriterEndElement(pWriter);
613 
614  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("m_Left"));
615  m_Left.dumpAsXml(pWriter);
616  (void)xmlTextWriterEndElement(pWriter);
617 
618  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("m_FirstMaster"));
619  m_FirstMaster.dumpAsXml(pWriter);
620  (void)xmlTextWriterEndElement(pWriter);
621 
622  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("m_FirstLeft"));
623  m_FirstLeft.dumpAsXml(pWriter);
624  (void)xmlTextWriterEndElement(pWriter);
625 
626  (void)xmlTextWriterEndElement(pWriter);
627 }
628 
630  : m_nMaxHeight( 0 )
631  , m_nLineWidth(10)
632  , m_eLineStyle( SvxBorderLineStyle::SOLID )
633  , m_Width( 25, 100 )
634  , m_nTopDist( 57 ) //1mm
635  , m_nBottomDist( 57 )
636 {
637  m_eAdjust = SvxFrameDirection::Horizontal_RL_TB == GetDefaultFrameDirection(GetAppLanguage()) ?
638  css::text::HorizontalAdjust_RIGHT :
639  css::text::HorizontalAdjust_LEFT;
640 }
641 
643  : m_nMaxHeight(rCpy.GetHeight())
644  , m_nLineWidth(rCpy.m_nLineWidth)
645  , m_eLineStyle(rCpy.m_eLineStyle)
646  , m_LineColor(rCpy.m_LineColor)
647  , m_Width(rCpy.GetWidth())
648  , m_eAdjust(rCpy.GetAdj())
649  , m_nTopDist(rCpy.GetTopDist())
650  , m_nBottomDist(rCpy.GetBottomDist())
651 {
652 }
653 
655 {
656  m_nMaxHeight = rCpy.GetHeight();
657  m_nLineWidth = rCpy.m_nLineWidth;
658  m_eLineStyle = rCpy.m_eLineStyle;
659  m_LineColor = rCpy.m_LineColor;
660  m_Width = rCpy.GetWidth();
661  m_eAdjust = rCpy.GetAdj();
662  m_nTopDist = rCpy.GetTopDist();
663  m_nBottomDist = rCpy.GetBottomDist();
664  return *this;
665 }
666 
668 {
669  return m_nMaxHeight == rCmp.GetHeight()
670  && m_nLineWidth == rCmp.m_nLineWidth
671  && m_eLineStyle == rCmp.m_eLineStyle
672  && m_LineColor == rCmp.m_LineColor
673  && m_Width == rCmp.GetWidth()
674  && m_eAdjust == rCmp.GetAdj()
675  && m_nTopDist == rCmp.GetTopDist()
676  && m_nBottomDist== rCmp.GetBottomDist();
677 }
678 
679 SwPageDescExt::SwPageDescExt(const SwPageDesc & rPageDesc, SwDoc *const pDoc)
680  : m_PageDesc(rPageDesc)
681  , m_pDoc(pDoc)
682 {
683  SetPageDesc(rPageDesc);
684 }
685 
687  : m_PageDesc(rSrc.m_PageDesc)
688  , m_pDoc(rSrc.m_pDoc)
689 {
690  SetPageDesc(rSrc.m_PageDesc);
691 }
692 
694 {
695 }
696 
697 OUString const & SwPageDescExt::GetName() const
698 {
699  return m_PageDesc.GetName();
700 }
701 
702 void SwPageDescExt::SetPageDesc(const SwPageDesc & rPageDesc)
703 {
704  m_PageDesc = rPageDesc;
705 
706  if (m_PageDesc.GetFollow())
708 }
709 
711 {
712  SetPageDesc(rSrc);
713 
714  return *this;
715 }
716 
718 {
719  operator=(rSrc.m_PageDesc);
720  return *this;
721 }
722 
723 SwPageDescExt::operator SwPageDesc() const
724 {
725  SwPageDesc aResult(m_PageDesc);
726 
727  SwPageDesc * pPageDesc = m_pDoc->FindPageDesc(m_sFollow);
728 
729  if ( nullptr != pPageDesc )
730  aResult.SetFollow(pPageDesc);
731 
732  return aResult;
733 }
734 
736  : m_PosIndex( m_Array.get<0>() )
737  , m_NameIndex( m_Array.get<1>() )
738 {
739 }
740 
742 {
743  for(const_iterator it = begin(); it != end(); ++it)
744  delete *it;
745 }
746 
747 SwPageDescs::iterator SwPageDescs::find_(const OUString &name) const
748 {
749  ByName::iterator it = m_NameIndex.find( name );
750  return m_Array.iterator_to( *it );
751 }
752 
753 std::pair<SwPageDescs::const_iterator,bool> SwPageDescs::push_back( const value_type& x )
754 {
755  // SwPageDesc is not already in a SwPageDescs list!
756  assert( x->m_pdList == nullptr );
757 
758  std::pair<iterator,bool> res = m_PosIndex.push_back( x );
759  if( res.second )
760  x->m_pdList = this;
761  return res;
762 }
763 
765 {
766  // SwPageDesc is not in this SwPageDescs list!
767  assert( x->m_pdList == this );
768 
769  iterator const ret = find_( x->GetName() );
770  if (ret != end())
771  m_PosIndex.erase( ret );
772  else
773  SAL_WARN( "sw", "SwPageDesc is not in SwPageDescs m_pdList!" );
774  x->m_pdList = nullptr;
775 }
776 
777 void SwPageDescs::erase( const_iterator const& position )
778 {
779  // SwPageDesc is not in this SwPageDescs list!
780  assert( (*position)->m_pdList == this );
781 
782  (*position)->m_pdList = nullptr;
783  m_PosIndex.erase( position );
784 }
785 
787 {
788  erase( begin() + index_ );
789 }
790 
792 {
793  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwPageDescs"));
794 
795  for (const auto& pPageDesc : m_PosIndex)
796  {
797  pPageDesc->dumpAsXml(pWriter);
798  }
799 
800  (void)xmlTextWriterEndElement(pWriter);
801 }
802 
803 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
Base class of the Writer layout elements.
Definition: frame.hxx:313
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(120)
static const char * STR_POOLPAGE[]
Definition: pagedesc.cxx:560
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
const SwFormatCol & GetCol(bool=true) const
Definition: fmtclds.hxx:168
Represents the style of a paragraph.
Definition: fmtcol.hxx:56
const_iterator end() const
Definition: pagedesc.hxx:457
SwTwips m_nBottomDist
distance between separator and first footnote
Definition: pagedesc.hxx:58
static const SwPageDesc * GetPageDescOfNode(const SwNode &rNd)
Given a SwNode return the pagedesc in use at that location.
Definition: pagedesc.cxx:332
const_iterator begin() const
Definition: pagedesc.hxx:456
SwFrameFormat & GetLeft()
Definition: pagedesc.hxx:240
bool isCHRATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:471
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(162)
SwPageDescsBase::value_type value_type
Definition: pagedesc.hxx:434
iterator find_(const OUString &name) const
Definition: pagedesc.cxx:747
ByName & m_NameIndex
Definition: pagedesc.hxx:429
#define FRM_CNTNT
Definition: frame.hxx:102
tools::Long GetRight() const
SwTwips GetBottomDist() const
Definition: pagedesc.hxx:68
const SvxFrameDirectionItem & GetFrameDir(bool=true) const
Definition: frmatr.hxx:94
SwFrameFormat & GetFirstMaster()
Definition: pagedesc.hxx:241
Definition: doc.hxx:187
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: pagedesc.cxx:599
TElementType * Next()
Definition: calbck.hxx:333
bool KnowsFormat(const SwFormat &rFormat) const
Definition: wsfrm.cxx:332
SwPageDescExt(const SwPageDesc &rPageDesc, SwDoc *pDoc)
Definition: pagedesc.cxx:679
WW8LvlType GetNumType(sal_uInt8 nWwLevelNo)
Definition: ww8par2.cxx:876
sal_uInt16 m_nRegAscent
For grid alignment (Registerhaltigkeit).
Definition: pagedesc.hxx:166
Dialog to specify the properties of date form field.
SwPageDesc & operator=(const SwPageDesc &)
Definition: pagedesc.cxx:102
virtual bool GetInfo(SfxPoolItem &) const override
Definition: calbck.cxx:160
SwPageDescExt & operator=(const SwPageDescExt &rSrc)
Definition: pagedesc.cxx:717
void SetFollow(const SwPageDesc *pNew)
Definition: pagedesc.hxx:315
SwTwips GetTopDist() const
Definition: pagedesc.hxx:67
const OUString & GetName() const
Definition: pagedesc.hxx:197
const SvxBoxItem & GetBox(bool=true) const
Definition: frmatr.hxx:84
UseOnPage
Definition: pagedesc.hxx:120
SvxBorderLineStyle
ByPos::iterator iterator
Definition: pagedesc.hxx:423
SAL_DLLPRIVATE SwPageDesc(const OUString &, SwFrameFormat *, SwDoc *pDc)
Definition: pagedesc.cxx:45
std::unique_ptr< SvxBrushItem > makeBackgroundBrushItem(bool=true) const
Definition: format.cxx:742
tools::Long GetGutterMargin() const
static SwPageDesc * GetByName(SwDoc &rDoc, std::u16string_view rName)
Definition: pagedesc.cxx:574
bool IsFollowNextPageOfNode(const SwNode &rNd) const
Definition: pagedesc.cxx:366
std::pair< const_iterator, bool > push_back(const value_type &x)
Definition: pagedesc.cxx:753
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:426
ByPos::const_iterator const_iterator
Definition: pagedesc.hxx:432
sw::WriterMultiListener m_aDepends
Because of grid alignment (Registerhaltigkeit).
Definition: pagedesc.hxx:162
constexpr OUStringLiteral IsHidden(u"IsHidden")
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
special handling if the style of the grid alignment changes
Definition: pagedesc.cxx:284
SwTwips GetHeight() const
Definition: pagedesc.hxx:61
StashedPageDesc m_aStashedHeader
Definition: pagedesc.hxx:159
drawing::TextVerticalAdjust m_nVerticalAdjustment
Definition: pagedesc.hxx:167
exports com.sun.star. drawing
void RemoveStashedFormat(bool bHeader, bool bLeft, bool bFirst)
Gives the feature of removing the stashed format by hand if it is necessary.
Definition: pagedesc.cxx:517
SwAttrPool * GetPool() const
Definition: swatrset.hxx:190
virtual SwPageDesc * GetPageDescFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return required automatic page style.
virtual ~SwPageDesc() override
Definition: pagedesc.cxx:144
virtual sal_uInt16 ResetAllFormatAttr()
Takes all hints from Delta-Array,.
Definition: format.cxx:652
#define SAL_N_ELEMENTS(arr)
SwFrameFormat m_FirstMaster
Definition: pagedesc.hxx:149
SwPageDesc m_PageDesc
Definition: pagedesc.hxx:380
bool IsContentNode() const
Definition: node.hxx:632
void SetPageDesc(const SwPageDesc &rPageDesc)
Definition: pagedesc.cxx:702
struct _xmlTextWriter * xmlTextWriterPtr
Style of a layout element.
Definition: frmfmt.hxx:58
void erase(const value_type &x)
Definition: pagedesc.cxx:764
int i
Color m_LineColor
color of the separator line
Definition: pagedesc.hxx:54
SwFrameType
Definition: frame.hxx:73
SvxNumberType m_NumType
Definition: pagedesc.hxx:145
sal_uInt16 m_nRegHeight
Sentence spacing and fontascent of style.
Definition: pagedesc.hxx:165
const SwFrameFormat * GetStashedFrameFormat(bool bHeader, bool bLeft, bool bFirst) const
Used to restore hidden header/footer formats.
Definition: pagedesc.cxx:445
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:882
SwFrame * GetFrameOfModify(const SwRootFrame *pLayout, sw::BroadcastingModify const &, SwFrameType const nFrameType, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr)
SAL_DLLPRIVATE void Mirror()
Called for mirroring of Chg (doc).
Definition: pagedesc.cxx:167
SwPageFrame * FindPageFrame()
Definition: frame.hxx:678
bool IsListeningTo(const SwModify *const pDepend) const
Definition: calbck.cxx:275
void ChgFirstShare(bool bNew)
Definition: pagedesc.cxx:401
SwFrameFormat * GetLeftFormat(bool const bFirst=false)
Definition: pagedesc.cxx:382
TElementType * First()
Definition: calbck.hxx:325
tools::Long GetLeft() const
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(163)
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: pagedesc.cxx:791
size_t GetPageDescCnt() const
Definition: doc.hxx:881
const SwTextFormatColl * GetRegisterFormatColl() const
retrieve the style for the grid alignment
Definition: pagedesc.cxx:224
SwPageDescsBase m_Array
Definition: pagedesc.hxx:427
ByPos & m_PosIndex
Definition: pagedesc.hxx:428
UseOnPage m_eUse
Definition: pagedesc.hxx:168
SwPageDescsBase::size_type size_type
Definition: pagedesc.hxx:433
constexpr TypedWhichId< SvxLineSpacingItem > RES_PARATR_LINESPACING(RES_PARATR_BEGIN)
bool m_IsLandscape
Definition: pagedesc.hxx:169
OUString SwResId(const char *pId)
Definition: swmodule.cxx:165
SwPageFootnoteInfo & operator=(const SwPageFootnoteInfo &)
Definition: pagedesc.cxx:654
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:123
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: atrfrm.cxx:2806
A page of the document layout.
Definition: pagefrm.hxx:57
SwFrameFormat m_Left
Definition: pagedesc.hxx:147
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
static const SwFrame * lcl_GetFrameOfNode(const SwNode &rNd)
Definition: pagedesc.cxx:309
const SwPageDesc * GetFollow() const
Definition: pagedesc.hxx:268
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:450
void SetRightGutterMargin(const tools::Long nRightGutterMargin)
void StartListening(SwModify *pDepend)
Definition: calbck.cxx:268
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:239
const SvxULSpaceItem & GetULSpace(bool=true) const
Definition: frmatr.hxx:76
Footnote information.
Definition: pagedesc.hxx:48
const Fraction & GetWidth() const
Definition: pagedesc.hxx:65
const SwFrameFormat * GetPageFormatOfNode(const SwNode &rNd, bool bCheckForThisPgDc=true) const
Definition: pagedesc.cxx:341
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
virtual bool GetInfo(SfxPoolItem &) const override
Query information from Client.
Definition: pagedesc.cxx:200
OUString m_StyleName
Definition: pagedesc.hxx:144
OUString const & GetName() const
Definition: pagedesc.cxx:697
OUString m_sFollow
Definition: pagedesc.hxx:383
SwFrameFormat & GetFirstLeft()
Definition: pagedesc.hxx:242
css::text::HorizontalAdjust GetAdj() const
Definition: pagedesc.hxx:66
SwFrameFormat * GetRightFormat(bool const bFirst=false)
Layout uses the following methods to obtain a format in order to be able to create a page...
Definition: pagedesc.cxx:389
LanguageType GetAppLanguage()
Definition: init.cxx:732
SwPageDesc * m_pFollow
Definition: pagedesc.hxx:164
const SvxPaperBinItem & GetPaperBin(bool=true) const
Definition: frmatr.hxx:72
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:159
SwFrameFormat m_Master
Definition: pagedesc.hxx:146
bool IsPageFrame() const
Definition: frame.hxx:1174
bool SetName(const OUString &rNewName)
Definition: pagedesc.cxx:148
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
Fraction m_Width
percentage width of the separator line.
Definition: pagedesc.hxx:55
const SwTextFormatColl * m_pTextFormatColl
Definition: pagedesc.hxx:163
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:324
SvxFrameDirection GetDefaultFrameDirection(LanguageType nLanguage)
Return the AutoCollection by its Id.
Definition: poolfmt.cxx:79
const sal_uInt16 * GetRanges() const
bool IsInDtor() const
Definition: doc.hxx:403
SwFrameFormat m_FirstLeft
Definition: pagedesc.hxx:150
#define SAL_WARN(area, stream)
std::shared_ptr< SwFrameFormat > m_pStashedFirstLeft
Definition: pagedesc.hxx:156
SvxBorderLineStyle m_eLineStyle
Style of the separator line.
Definition: pagedesc.hxx:53
bool IsTableNode() const
Definition: node.hxx:644
SAL_DLLPRIVATE void ResetAllAttr()
Definition: pagedesc.cxx:190
bool IsFirstShared() const
Definition: pagedesc.cxx:396
void RegisterChange()
notify all affected page frames
Definition: pagedesc.cxx:232
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:120
StashedPageDesc m_aStashedFooter
Definition: pagedesc.hxx:160
std::shared_ptr< SwFrameFormat > m_pStashedLeft
Definition: pagedesc.hxx:155
sal_uLong m_nLineWidth
width of separator line
Definition: pagedesc.hxx:52
SwPageDescs * m_pdList
Backref to the assigned SwPageDescs list to handle renames.
Definition: pagedesc.hxx:176
bool HasStashedFormat(bool bHeader, bool bLeft, bool bFirst)
Checks if the pagedescriptor has a stashed format according to the parameters or not.
Definition: pagedesc.cxx:473
SwTwips m_nTopDist
distance between body and separator.
Definition: pagedesc.hxx:57
css::text::HorizontalAdjust m_eAdjust
line adjustment.
Definition: pagedesc.hxx:56
std::shared_ptr< SwFrameFormat > m_pStashedFirst
Definition: pagedesc.hxx:154
SwTwips m_nMaxHeight
maximum height of the footnote area.
Definition: pagedesc.hxx:51
bool operator==(const SwPageFootnoteInfo &) const
Definition: pagedesc.cxx:667
void SetRegisterFormatColl(const SwTextFormatColl *rFormat)
set the style for the grid alignment
Definition: pagedesc.cxx:212
void StashFrameFormat(const SwFrameFormat &rFormat, bool bHeader, bool bLeft, bool bFirst)
Remember original header/footer formats even when they are hidden by "sharing".
Definition: pagedesc.cxx:409
SwFrame * GetNext()
Definition: frame.hxx:674
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:74
Base class of the Writer document model elements.
Definition: node.hxx:80
const SvxShadowItem & GetShadow(bool=true) const
Definition: frmatr.hxx:88
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo