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 (rHint.GetId() == SfxHintId::SwLegacyModify)
287  {
288  auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
289  const sal_uInt16 nWhich = pLegacyHint->m_pOld
290  ? pLegacyHint->m_pOld->Which()
291  : pLegacyHint->m_pNew
292  ? pLegacyHint->m_pNew->Which()
293  : 0;
294  CallSwClientNotify(rHint);
295  if((RES_ATTRSET_CHG == nWhich)
296  || (RES_FMT_CHG == nWhich)
297  || isCHRATR(nWhich)
298  || (RES_PARATR_LINESPACING == nWhich))
299  RegisterChange();
300  }
301  else if (auto pModifyChangedHint = dynamic_cast<const sw::ModifyChangedHint*>(&rHint))
302  {
303  if(m_pTextFormatColl == &rModify)
304  m_pTextFormatColl = static_cast<const SwTextFormatColl*>(pModifyChangedHint->m_pNew);
305  else
306  assert(false);
307  }
308 }
309 
310 static const SwFrame* lcl_GetFrameOfNode( const SwNode& rNd )
311 {
312  const sw::BroadcastingModify* pMod;
313  SwFrameType nFrameType = FRM_CNTNT;
314 
315  if( rNd.IsContentNode() )
316  {
317  pMod = &static_cast<const SwContentNode&>(rNd);
318  }
319  else if( rNd.IsTableNode() )
320  {
321  pMod = static_cast<const SwTableNode&>(rNd).GetTable().GetFrameFormat();
322  nFrameType = SwFrameType::Tab;
323  }
324  else
325  pMod = nullptr;
326 
327  Point aNullPt;
328  std::pair<Point, bool> const tmp(aNullPt, false);
329  return pMod ? ::GetFrameOfModify(nullptr, *pMod, nFrameType, nullptr, &tmp)
330  : nullptr;
331 }
332 
334 {
335  const SwPageDesc* pRet = nullptr;
336  const SwFrame* pChkFrame = lcl_GetFrameOfNode( rNd );
337  if (pChkFrame && nullptr != (pChkFrame = pChkFrame->FindPageFrame()))
338  pRet = static_cast<const SwPageFrame*>(pChkFrame)->GetPageDesc();
339  return pRet;
340 }
341 
343  bool bCheckForThisPgDc ) const
344 {
345  // which PageDescFormat is valid for this node?
346  const SwFrameFormat* pRet;
347  const SwFrame* pChkFrame = lcl_GetFrameOfNode( rNd );
348 
349  if( pChkFrame && nullptr != ( pChkFrame = pChkFrame->FindPageFrame() ))
350  {
351  const SwPageDesc* pPd = bCheckForThisPgDc ? this :
352  static_cast<const SwPageFrame*>(pChkFrame)->GetPageDesc();
353  pRet = &pPd->GetMaster();
354  OSL_ENSURE( static_cast<const SwPageFrame*>(pChkFrame)->GetPageDesc() == pPd, "Wrong node for detection of page format!" );
355  // this page is assigned to which format?
356  if( !pChkFrame->KnowsFormat(*pRet) )
357  {
358  pRet = &pPd->GetLeft();
359  OSL_ENSURE( pChkFrame->KnowsFormat(*pRet), "Wrong node for detection of page format!" );
360  }
361  }
362  else
363  pRet = &GetMaster();
364  return pRet;
365 }
366 
368 {
369  bool bRet = false;
370  if( GetFollow() && this != GetFollow() )
371  {
372  const SwFrame* pChkFrame = lcl_GetFrameOfNode( rNd );
373  if( pChkFrame && nullptr != ( pChkFrame = pChkFrame->FindPageFrame() ) &&
374  pChkFrame->IsPageFrame() &&
375  ( !pChkFrame->GetNext() || GetFollow() ==
376  static_cast<const SwPageFrame*>(pChkFrame->GetNext())->GetPageDesc() ))
377  // the page on which the follow points was found
378  bRet = true;
379  }
380  return bRet;
381 }
382 
384 {
385  return (UseOnPage::Left & m_eUse)
386  ? (bFirst ? &m_FirstLeft : &m_Left)
387  : nullptr;
388 }
389 
391 {
392  return (UseOnPage::Right & m_eUse)
393  ? (bFirst ? &m_FirstMaster : &m_Master)
394  : nullptr;
395 }
396 
398 {
399  return bool(m_eUse & UseOnPage::FirstShare);
400 }
401 
402 void SwPageDesc::ChgFirstShare( bool bNew )
403 {
404  if ( bNew )
406  else
408 }
409 
410 void SwPageDesc::StashFrameFormat(const SwFrameFormat& rFormat, bool bHeader, bool bLeft, bool bFirst)
411 {
412  assert(rFormat.GetRegisteredIn());
413  std::shared_ptr<SwFrameFormat>* pFormat = nullptr;
414 
415  if (bHeader)
416  {
417  if (bLeft && !bFirst)
418  pFormat = &m_aStashedHeader.m_pStashedLeft;
419  else if (!bLeft && bFirst)
421  else if (bLeft && bFirst)
423  }
424  else
425  {
426  if (bLeft && !bFirst)
427  pFormat = &m_aStashedFooter.m_pStashedLeft;
428  else if (!bLeft && bFirst)
430  else if (bLeft && bFirst)
432  }
433 
434  if (pFormat)
435  {
436  *pFormat = std::make_shared<SwFrameFormat>(rFormat);
437  }
438  else
439  {
440  SAL_WARN(
441  "sw",
442  "SwPageDesc::StashFrameFormat: Stashing the right page header/footer is pointless.");
443  }
444 }
445 
446 const SwFrameFormat* SwPageDesc::GetStashedFrameFormat(bool bHeader, bool bLeft, bool bFirst) const
447 {
448  std::shared_ptr<SwFrameFormat>* pFormat = nullptr;
449 
450  if (bLeft && !bFirst)
451  {
453  }
454  else if (!bLeft && bFirst)
455  {
457  }
458  else if (bLeft && bFirst)
459  {
461  }
462 
463  if (pFormat)
464  {
465  return pFormat->get();
466  }
467  else
468  {
469  SAL_WARN("sw", "SwPageDesc::GetStashedFrameFormat: Right page format is never stashed.");
470  return nullptr;
471  }
472 }
473 
474 bool SwPageDesc::HasStashedFormat(bool bHeader, bool bLeft, bool bFirst)
475 {
476  if (bHeader)
477  {
478  if (bLeft && !bFirst)
479  {
480  return m_aStashedHeader.m_pStashedLeft != nullptr;
481  }
482  else if (!bLeft && bFirst)
483  {
484  return m_aStashedHeader.m_pStashedFirst != nullptr;
485  }
486  else if (bLeft && bFirst)
487  {
488  return m_aStashedHeader.m_pStashedFirstLeft != nullptr;
489  }
490  else
491  {
492  SAL_WARN("sw", "SwPageDesc::HasStashedFormat: Right page format is never stashed.");
493  return false;
494  }
495  }
496  else
497  {
498  if (bLeft && !bFirst)
499  {
500  return m_aStashedFooter.m_pStashedLeft != nullptr;
501  }
502  else if (!bLeft && bFirst)
503  {
504  return m_aStashedFooter.m_pStashedFirst != nullptr;
505  }
506  else if (bLeft && bFirst)
507  {
508  return m_aStashedFooter.m_pStashedFirstLeft != nullptr;
509  }
510  else
511  {
512  SAL_WARN("sw", "SwPageDesc::HasStashedFormat: Right page format is never stashed.");
513  return false;
514  }
515  }
516 }
517 
518 void SwPageDesc::RemoveStashedFormat(bool bHeader, bool bLeft, bool bFirst)
519 {
520  if (bHeader)
521  {
522  if (bLeft && !bFirst)
523  {
525  }
526  else if (!bLeft && bFirst)
527  {
529  }
530  else if (bLeft && bFirst)
531  {
533  }
534  else
535  {
536  SAL_WARN("sw", "SwPageDesc::RemoveStashedFormat: Right page format is never stashed.");
537  }
538  }
539  else
540  {
541  if (bLeft && !bFirst)
542  {
544  }
545  else if (!bLeft && bFirst)
546  {
548  }
549  else if (bLeft && bFirst)
550  {
552  }
553  else
554  {
555  SAL_WARN("sw", "SwPageDesc::RemoveStashedFormat: Right page format is never stashed.");
556  }
557  }
558 }
559 
560 // Page styles
562 {
563  STR_POOLPAGE_STANDARD,
564  STR_POOLPAGE_FIRST,
565  STR_POOLPAGE_LEFT,
566  STR_POOLPAGE_RIGHT,
567  STR_POOLPAGE_ENVELOPE,
568  STR_POOLPAGE_REGISTER,
569  STR_POOLPAGE_HTML,
570  STR_POOLPAGE_FOOTNOTE,
571  STR_POOLPAGE_ENDNOTE,
572  STR_POOLPAGE_LANDSCAPE
573 };
574 
575 SwPageDesc* SwPageDesc::GetByName(SwDoc& rDoc, std::u16string_view rName)
576 {
577  const size_t nDCount = rDoc.GetPageDescCnt();
578 
579  for( size_t i = 0; i < nDCount; i++ )
580  {
581  SwPageDesc* pDsc = &rDoc.GetPageDesc( i );
582  if(pDsc->GetName() == rName)
583  {
584  return pDsc;
585  }
586  }
587 
588  for (size_t i = 0; i < SAL_N_ELEMENTS(STR_POOLPAGE); ++i)
589  {
590  if (rName == SwResId(STR_POOLPAGE[i]))
591  {
592  return rDoc.getIDocumentStylePoolAccess().GetPageDescFromPool( static_cast< sal_uInt16 >(
593  i + RES_POOLPAGE_BEGIN) );
594  }
595  }
596 
597  return nullptr;
598 }
599 
601 {
602  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwPageDesc"));
603  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
604  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("m_StyleName"), "%s",
605  BAD_CAST(m_StyleName.toUtf8().getStr()));
606  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("m_pFollow"), "%p", m_pFollow);
607  (void)xmlTextWriterWriteFormatAttribute(
608  pWriter, BAD_CAST("m_eUse"), "0x%s",
609  BAD_CAST(OString::number(static_cast<int>(m_eUse), 16).getStr()));
610 
611  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("m_Master"));
612  m_Master.dumpAsXml(pWriter);
613  (void)xmlTextWriterEndElement(pWriter);
614 
615  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("m_Left"));
616  m_Left.dumpAsXml(pWriter);
617  (void)xmlTextWriterEndElement(pWriter);
618 
619  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("m_FirstMaster"));
620  m_FirstMaster.dumpAsXml(pWriter);
621  (void)xmlTextWriterEndElement(pWriter);
622 
623  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("m_FirstLeft"));
624  m_FirstLeft.dumpAsXml(pWriter);
625  (void)xmlTextWriterEndElement(pWriter);
626 
627  (void)xmlTextWriterEndElement(pWriter);
628 }
629 
631  : m_nMaxHeight( 0 )
632  , m_nLineWidth(10)
633  , m_eLineStyle( SvxBorderLineStyle::SOLID )
634  , m_Width( 25, 100 )
635  , m_nTopDist( 57 ) //1mm
636  , m_nBottomDist( 57 )
637 {
638  m_eAdjust = SvxFrameDirection::Horizontal_RL_TB == GetDefaultFrameDirection(GetAppLanguage()) ?
639  css::text::HorizontalAdjust_RIGHT :
640  css::text::HorizontalAdjust_LEFT;
641 }
642 
644  : m_nMaxHeight(rCpy.GetHeight())
645  , m_nLineWidth(rCpy.m_nLineWidth)
646  , m_eLineStyle(rCpy.m_eLineStyle)
647  , m_LineColor(rCpy.m_LineColor)
648  , m_Width(rCpy.GetWidth())
649  , m_eAdjust(rCpy.GetAdj())
650  , m_nTopDist(rCpy.GetTopDist())
651  , m_nBottomDist(rCpy.GetBottomDist())
652 {
653 }
654 
656 {
657  m_nMaxHeight = rCpy.GetHeight();
658  m_nLineWidth = rCpy.m_nLineWidth;
659  m_eLineStyle = rCpy.m_eLineStyle;
660  m_LineColor = rCpy.m_LineColor;
661  m_Width = rCpy.GetWidth();
662  m_eAdjust = rCpy.GetAdj();
663  m_nTopDist = rCpy.GetTopDist();
664  m_nBottomDist = rCpy.GetBottomDist();
665  return *this;
666 }
667 
669 {
670  return m_nMaxHeight == rCmp.GetHeight()
671  && m_nLineWidth == rCmp.m_nLineWidth
672  && m_eLineStyle == rCmp.m_eLineStyle
673  && m_LineColor == rCmp.m_LineColor
674  && m_Width == rCmp.GetWidth()
675  && m_eAdjust == rCmp.GetAdj()
676  && m_nTopDist == rCmp.GetTopDist()
677  && m_nBottomDist== rCmp.GetBottomDist();
678 }
679 
680 SwPageDescExt::SwPageDescExt(const SwPageDesc & rPageDesc, SwDoc *const pDoc)
681  : m_PageDesc(rPageDesc)
682  , m_pDoc(pDoc)
683 {
684  SetPageDesc(rPageDesc);
685 }
686 
688  : m_PageDesc(rSrc.m_PageDesc)
689  , m_pDoc(rSrc.m_pDoc)
690 {
691  SetPageDesc(rSrc.m_PageDesc);
692 }
693 
695 {
696 }
697 
698 OUString const & SwPageDescExt::GetName() const
699 {
700  return m_PageDesc.GetName();
701 }
702 
703 void SwPageDescExt::SetPageDesc(const SwPageDesc & rPageDesc)
704 {
705  m_PageDesc = rPageDesc;
706 
707  if (m_PageDesc.GetFollow())
709 }
710 
712 {
713  SetPageDesc(rSrc);
714 
715  return *this;
716 }
717 
719 {
720  operator=(rSrc.m_PageDesc);
721  return *this;
722 }
723 
724 SwPageDescExt::operator SwPageDesc() const
725 {
726  SwPageDesc aResult(m_PageDesc);
727 
728  SwPageDesc * pPageDesc = m_pDoc->FindPageDesc(m_sFollow);
729 
730  if ( nullptr != pPageDesc )
731  aResult.SetFollow(pPageDesc);
732 
733  return aResult;
734 }
735 
737  : m_PosIndex( m_Array.get<0>() )
738  , m_NameIndex( m_Array.get<1>() )
739 {
740 }
741 
743 {
744  for(const_iterator it = begin(); it != end(); ++it)
745  delete *it;
746 }
747 
748 SwPageDescs::iterator SwPageDescs::find_(const OUString &name) const
749 {
750  ByName::iterator it = m_NameIndex.find( name );
751  return m_Array.iterator_to( *it );
752 }
753 
754 std::pair<SwPageDescs::const_iterator,bool> SwPageDescs::push_back( const value_type& x )
755 {
756  // SwPageDesc is not already in a SwPageDescs list!
757  assert( x->m_pdList == nullptr );
758 
759  std::pair<iterator,bool> res = m_PosIndex.push_back( x );
760  if( res.second )
761  x->m_pdList = this;
762  return res;
763 }
764 
766 {
767  // SwPageDesc is not in this SwPageDescs list!
768  assert( x->m_pdList == this );
769 
770  iterator const ret = find_( x->GetName() );
771  if (ret != end())
772  m_PosIndex.erase( ret );
773  else
774  SAL_WARN( "sw", "SwPageDesc is not in SwPageDescs m_pdList!" );
775  x->m_pdList = nullptr;
776 }
777 
778 void SwPageDescs::erase( const_iterator const& position )
779 {
780  // SwPageDesc is not in this SwPageDescs list!
781  assert( (*position)->m_pdList == this );
782 
783  (*position)->m_pdList = nullptr;
784  m_PosIndex.erase( position );
785 }
786 
788 {
789  erase( begin() + index_ );
790 }
791 
793 {
794  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwPageDescs"));
795 
796  for (const auto& pPageDesc : m_PosIndex)
797  {
798  pPageDesc->dumpAsXml(pWriter);
799  }
800 
801  (void)xmlTextWriterEndElement(pWriter);
802 }
803 
804 /* 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:315
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(120)
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:456
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:333
const_iterator begin() const
Definition: pagedesc.hxx:455
SwFrameFormat & GetLeft()
Definition: pagedesc.hxx:239
bool isCHRATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:476
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(162)
SwPageDescsBase::value_type value_type
Definition: pagedesc.hxx:433
iterator find_(const OUString &name) const
Definition: pagedesc.cxx:748
ByName & m_NameIndex
Definition: pagedesc.hxx:428
#define FRM_CNTNT
Definition: frame.hxx:104
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:240
const WhichRangesContainer & GetRanges() const
Definition: doc.hxx:188
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: pagedesc.cxx:600
TElementType * Next()
Definition: calbck.hxx:365
bool KnowsFormat(const SwFormat &rFormat) const
Definition: wsfrm.cxx:330
SwPageDescExt(const SwPageDesc &rPageDesc, SwDoc *pDoc)
Definition: pagedesc.cxx:680
WW8LvlType GetNumType(sal_uInt8 nWwLevelNo)
Definition: ww8par2.cxx:911
sal_uInt16 m_nRegAscent
For grid alignment (Registerhaltigkeit).
Definition: pagedesc.hxx:166
const TranslateId STR_POOLPAGE[]
Definition: pagedesc.cxx:561
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:162
SwPageDescExt & operator=(const SwPageDescExt &rSrc)
Definition: pagedesc.cxx:718
SfxHintId GetId() const
void SetFollow(const SwPageDesc *pNew)
Definition: pagedesc.hxx:314
SwTwips GetTopDist() const
Definition: pagedesc.hxx:67
const OUString & GetName() const
Definition: pagedesc.hxx:196
const SvxBoxItem & GetBox(bool=true) const
Definition: frmatr.hxx:84
UseOnPage
Definition: pagedesc.hxx:120
OUString SwResId(TranslateId aId)
Definition: swmodule.cxx:165
SvxBorderLineStyle
ByPos::iterator iterator
Definition: pagedesc.hxx:422
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:575
bool IsFollowNextPageOfNode(const SwNode &rNd) const
Definition: pagedesc.cxx:367
std::pair< const_iterator, bool > push_back(const value_type &x)
Definition: pagedesc.cxx:754
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:426
ByPos::const_iterator const_iterator
Definition: pagedesc.hxx:431
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:518
SwAttrPool * GetPool() const
Definition: swatrset.hxx:183
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:379
bool IsContentNode() const
Definition: node.hxx:629
void SetPageDesc(const SwPageDesc &rPageDesc)
Definition: pagedesc.cxx:703
struct _xmlTextWriter * xmlTextWriterPtr
Style of a layout element.
Definition: frmfmt.hxx:59
void erase(const value_type &x)
Definition: pagedesc.cxx:765
int i
Color m_LineColor
color of the separator line
Definition: pagedesc.hxx:54
SwFrameType
Definition: frame.hxx:75
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:446
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:881
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:681
bool IsListeningTo(const SwModify *const pDepend) const
Definition: calbck.cxx:277
void ChgFirstShare(bool bNew)
Definition: pagedesc.cxx:402
SwFrameFormat * GetLeftFormat(bool const bFirst=false)
Definition: pagedesc.cxx:383
TElementType * First()
Definition: calbck.hxx:357
tools::Long GetLeft() const
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(163)
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: pagedesc.cxx:792
size_t GetPageDescCnt() const
Definition: doc.hxx:880
const SwTextFormatColl * GetRegisterFormatColl() const
retrieve the style for the grid alignment
Definition: pagedesc.cxx:224
SwPageDescsBase m_Array
Definition: pagedesc.hxx:426
ByPos & m_PosIndex
Definition: pagedesc.hxx:427
UseOnPage m_eUse
Definition: pagedesc.hxx:168
SwPageDescsBase::size_type size_type
Definition: pagedesc.hxx:432
constexpr TypedWhichId< SvxLineSpacingItem > RES_PARATR_LINESPACING(RES_PARATR_BEGIN)
bool m_IsLandscape
Definition: pagedesc.hxx:169
SwPageFootnoteInfo & operator=(const SwPageFootnoteInfo &)
Definition: pagedesc.cxx:655
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:2866
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:310
const SwPageDesc * GetFollow() const
Definition: pagedesc.hxx:267
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:450
void SetRightGutterMargin(const tools::Long nRightGutterMargin)
void StartListening(SwModify *pDepend)
Definition: calbck.cxx:270
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
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:342
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
const SfxPoolItem * m_pOld
Definition: calbck.hxx:77
OUString m_StyleName
Definition: pagedesc.hxx:144
OUString const & GetName() const
Definition: pagedesc.cxx:698
OUString m_sFollow
Definition: pagedesc.hxx:382
SwFrameFormat & GetFirstLeft()
Definition: pagedesc.hxx:241
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:390
LanguageType GetAppLanguage()
Definition: init.cxx:723
SwPageDesc * m_pFollow
Definition: pagedesc.hxx:164
const SvxPaperBinItem & GetPaperBin(bool=true) const
Definition: frmatr.hxx:72
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:165
SwFrameFormat m_Master
Definition: pagedesc.hxx:146
bool IsPageFrame() const
Definition: frame.hxx:1179
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:326
SvxFrameDirection GetDefaultFrameDirection(LanguageType nLanguage)
Return the AutoCollection by its Id.
Definition: poolfmt.cxx:79
bool IsInDtor() const
Definition: doc.hxx:404
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:641
SAL_DLLPRIVATE void ResetAllAttr()
Definition: pagedesc.cxx:190
bool IsFirstShared() const
Definition: pagedesc.cxx:397
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:474
SwTwips m_nTopDist
distance between body and separator.
Definition: pagedesc.hxx:57
css::text::HorizontalAdjust m_eAdjust
line adjustment.
Definition: pagedesc.hxx:56
sal_uInt16 Which() const
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:668
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:410
SwFrame * GetNext()
Definition: frame.hxx:677
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