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 <pagefrm.hxx>
32 #include <pagedesc.hxx>
33 #include <swtable.hxx>
34 #include <frmatr.hxx>
35 #include <frmtool.hxx>
36 #include <doc.hxx>
37 #include <node.hxx>
38 #include <strings.hrc>
41 #include <poolfmt.hxx>
42 #include <calbck.hxx>
43 
44 SwPageDesc::SwPageDesc(const OUString& rName, SwFrameFormat *pFormat, SwDoc *const pDoc)
45  : sw::BroadcastingModify()
46  , m_StyleName( rName )
47  , m_Master( pDoc->GetAttrPool(), rName, pFormat )
48  , m_Left( pDoc->GetAttrPool(), rName, pFormat )
49  , m_FirstMaster( pDoc->GetAttrPool(), rName, pFormat )
50  , m_FirstLeft( pDoc->GetAttrPool(), rName, pFormat )
51  , m_aStashedHeader()
52  , m_aStashedFooter()
53  , m_aDepends(*this)
54  , m_pTextFormatColl(nullptr)
55  , m_pFollow( this )
56  , m_nRegHeight( 0 )
57  , m_nRegAscent( 0 )
58  , m_nVerticalAdjustment( drawing::TextVerticalAdjust_TOP )
60  , m_IsLandscape( false )
61  , m_IsHidden( false )
62  , m_pdList( nullptr )
63 {
64 }
65 
67  : sw::BroadcastingModify()
68  , m_StyleName( rCpy.GetName() )
69  , m_NumType( rCpy.GetNumType() )
70  , m_Master( rCpy.GetMaster() )
71  , m_Left( rCpy.GetLeft() )
72  , m_FirstMaster( rCpy.GetFirstMaster() )
73  , m_FirstLeft( rCpy.GetFirstLeft() )
74  , m_aDepends(*this)
75  , m_pTextFormatColl(nullptr)
76  , m_pFollow( rCpy.m_pFollow )
77  , m_nRegHeight( rCpy.GetRegHeight() )
78  , m_nRegAscent( rCpy.GetRegAscent() )
79  , m_nVerticalAdjustment( rCpy.GetVerticalAdjustment() )
80  , m_eUse( rCpy.ReadUseOn() )
81  , m_IsLandscape( rCpy.GetLandscape() )
82  , m_IsHidden( rCpy.IsHidden() )
83  , m_FootnoteInfo( rCpy.GetFootnoteInfo() )
84  , m_pdList( nullptr )
85 {
89 
93 
95  {
97  m_aDepends.StartListening(const_cast<SwTextFormatColl*>(m_pTextFormatColl));
98  }
99 }
100 
102 {
103  if(this == &rSrc)
104  return *this;
105 
106  m_StyleName = rSrc.m_StyleName;
107  m_NumType = rSrc.m_NumType;
108  m_Master = rSrc.m_Master;
109  m_Left = rSrc.m_Left;
111  m_FirstLeft = rSrc.m_FirstLeft;
112 
116 
120 
123  {
125  m_aDepends.StartListening(const_cast<SwTextFormatColl*>(m_pTextFormatColl));
126  }
127  else
128  m_pTextFormatColl = nullptr;
129 
130  if (rSrc.m_pFollow == &rSrc)
131  m_pFollow = this;
132  else
133  m_pFollow = rSrc.m_pFollow;
134 
135  m_nRegHeight = rSrc.m_nRegHeight;
136  m_nRegAscent = rSrc.m_nRegAscent;
138  m_eUse = rSrc.m_eUse;
140  return *this;
141 }
142 
144 {
145 }
146 
147 bool SwPageDesc::SetName( const OUString& rNewName )
148 {
149  bool renamed = true;
150  if (m_pdList) {
152  if( m_pdList->end() == it ) {
153  SAL_WARN( "sw", "SwPageDesc not found in expected m_pdList" );
154  return false;
155  }
156  renamed = m_pdList->m_PosIndex.modify( it,
157  change_name( rNewName ), change_name( m_StyleName ) );
158  }
159  else
160  m_StyleName = rNewName;
161  return renamed;
162 }
163 
167 {
168  //Only the margins are mirrored, all other values are just copied.
170  const SvxLRSpaceItem &rLR = m_Master.GetLRSpace();
171  aLR.SetLeft( rLR.GetRight() );
172  aLR.SetRight( rLR.GetLeft() );
174 
177  aSet.Put( aLR );
178  aSet.Put( m_Master.GetFrameSize() );
179  aSet.Put( m_Master.GetPaperBin() );
180  aSet.Put( m_Master.GetULSpace() );
181  aSet.Put( m_Master.GetBox() );
182  aSet.Put( *m_Master.makeBackgroundBrushItem() );
183  aSet.Put( m_Master.GetShadow() );
184  aSet.Put( m_Master.GetCol() );
185  aSet.Put( m_Master.GetFrameDir() );
186  m_Left.SetFormatAttr( aSet );
187 }
188 
190 {
191  SwFrameFormat& rFormat = GetMaster();
192 
193  // #i73790# - method renamed
194  rFormat.ResetAllFormatAttr();
195  rFormat.SetFormatAttr( SvxFrameDirectionItem(SvxFrameDirection::Horizontal_LR_TB, RES_FRAMEDIR) );
196 }
197 
198 // gets information from Modify
199 bool SwPageDesc::GetInfo( SfxPoolItem & rInfo ) const
200 {
201  if (!m_Master.GetInfo(rInfo))
202  return false; // found
203  if (!m_Left.GetInfo(rInfo))
204  return false ;
205  if ( !m_FirstMaster.GetInfo( rInfo ) )
206  return false;
207  return m_FirstLeft.GetInfo( rInfo );
208 }
209 
212 {
213  if(pFormat != m_pTextFormatColl)
214  {
216  m_pTextFormatColl = pFormat;
217  m_aDepends.StartListening(const_cast<SwTextFormatColl*>(m_pTextFormatColl));
218  RegisterChange();
219  }
220 }
221 
224 {
226  m_pTextFormatColl = nullptr;
227  return m_pTextFormatColl;
228 }
229 
232 {
233  // #117072# - During destruction of the document <SwDoc>
234  // the page description is modified. Thus, do nothing, if the document
235  // is in destruction respectively if no viewshell exists.
236  SwDoc* pDoc = GetMaster().GetDoc();
237  if ( !pDoc || pDoc->IsInDtor() )
238  {
239  return;
240  }
242  if ( !pSh )
243  {
244  return;
245  }
246 
247  m_nRegHeight = 0;
248  {
250  for( SwFrame* pLast = aIter.First(); pLast; pLast = aIter.Next() )
251  {
252  if( pLast->IsPageFrame() )
253  static_cast<SwPageFrame*>(pLast)->PrepareRegisterChg();
254  }
255  }
256  {
258  for( SwFrame* pLast = aIter.First(); pLast; pLast = aIter.Next() )
259  {
260  if( pLast->IsPageFrame() )
261  static_cast<SwPageFrame*>(pLast)->PrepareRegisterChg();
262  }
263  }
264  {
266  for( SwFrame* pLast = aIter.First(); pLast; pLast = aIter.Next() )
267  {
268  if( pLast->IsPageFrame() )
269  static_cast<SwPageFrame*>(pLast)->PrepareRegisterChg();
270  }
271  }
272  {
274  for( SwFrame* pLast = aIter.First(); pLast; pLast = aIter.Next() )
275  {
276  if( pLast->IsPageFrame() )
277  static_cast<SwPageFrame*>(pLast)->PrepareRegisterChg();
278  }
279  }
280 }
281 
283 void SwPageDesc::SwClientNotify(const SwModify& rModify, const SfxHint& rHint)
284 {
285  if (rHint.GetId() == SfxHintId::SwLegacyModify)
286  {
287  auto pLegacyHint = static_cast<const sw::LegacyModifyHint*>(&rHint);
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
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:314
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:332
const_iterator begin() const
Definition: pagedesc.hxx:455
SwFrameFormat & GetLeft()
Definition: pagedesc.hxx:239
bool isCHRATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:479
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:747
ByName & m_NameIndex
Definition: pagedesc.hxx:428
#define FRM_CNTNT
Definition: frame.hxx:103
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:187
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: pagedesc.cxx:599
TElementType * Next()
Definition: calbck.hxx:364
bool KnowsFormat(const SwFormat &rFormat) const
Definition: wsfrm.cxx:331
SwPageDescExt(const SwPageDesc &rPageDesc, SwDoc *pDoc)
Definition: pagedesc.cxx:679
WW8LvlType GetNumType(sal_uInt8 nWwLevelNo)
Definition: ww8par2.cxx:887
sal_uInt16 m_nRegAscent
For grid alignment (Registerhaltigkeit).
Definition: pagedesc.hxx:166
const TranslateId STR_POOLPAGE[]
Definition: pagedesc.cxx:560
Dialog to specify the properties of date form field.
SwPageDesc & operator=(const SwPageDesc &)
Definition: pagedesc.cxx:101
virtual bool GetInfo(SfxPoolItem &) const override
Definition: calbck.cxx:161
SwPageDescExt & operator=(const SwPageDescExt &rSrc)
Definition: pagedesc.cxx:717
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:164
SvxBorderLineStyle
ByPos::iterator iterator
Definition: pagedesc.hxx:422
SAL_DLLPRIVATE SwPageDesc(const OUString &, SwFrameFormat *, SwDoc *pDc)
Definition: pagedesc.cxx:44
std::unique_ptr< SvxBrushItem > makeBackgroundBrushItem(bool=true) const
Definition: format.cxx:737
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
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:283
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
virtual OUString GetName() const override
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:183
virtual SwPageDesc * GetPageDescFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return required automatic page style.
virtual ~SwPageDesc() override
Definition: pagedesc.cxx:143
virtual sal_uInt16 ResetAllFormatAttr()
Takes all hints from Delta-Array,.
Definition: format.cxx:647
#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:638
void SetPageDesc(const SwPageDesc &rPageDesc)
Definition: pagedesc.cxx:702
Style of a layout element.
Definition: frmfmt.hxx:59
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:74
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:880
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:166
SwPageFrame * FindPageFrame()
Definition: frame.hxx:680
bool IsListeningTo(const SwModify *const pDepend) const
Definition: calbck.cxx:276
void ChgFirstShare(bool bNew)
Definition: pagedesc.cxx:401
SwFrameFormat * GetLeftFormat(bool const bFirst=false)
Definition: pagedesc.cxx:382
TElementType * First()
Definition: calbck.hxx:356
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:879
const SwTextFormatColl * GetRegisterFormatColl() const
retrieve the style for the grid alignment
Definition: pagedesc.cxx:223
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:654
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:139
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: atrfrm.cxx:2856
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:267
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:448
void SetRightGutterMargin(const tools::Long nRightGutterMargin)
void StartListening(SwModify *pDepend)
Definition: calbck.cxx:269
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: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:199
const SfxPoolItem * m_pOld
Definition: calbck.hxx:76
OUString m_StyleName
Definition: pagedesc.hxx:144
OUString const & GetName() const
Definition: pagedesc.cxx:697
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:389
LanguageType GetAppLanguage()
Definition: init.cxx:725
SwPageDesc * m_pFollow
Definition: pagedesc.hxx:164
const SvxPaperBinItem & GetPaperBin(bool=true) const
Definition: frmatr.hxx:72
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:164
SwFrameFormat m_Master
Definition: pagedesc.hxx:146
bool IsPageFrame() const
Definition: frame.hxx:1178
bool SetName(const OUString &rNewName)
Definition: pagedesc.cxx:147
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:325
SvxFrameDirection GetDefaultFrameDirection(LanguageType nLanguage)
Return the AutoCollection by its Id.
Definition: poolfmt.cxx:79
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:650
struct _xmlTextWriter * xmlTextWriterPtr
SAL_DLLPRIVATE void ResetAllAttr()
Definition: pagedesc.cxx:189
bool IsFirstShared() const
Definition: pagedesc.cxx:396
void RegisterChange()
notify all affected page frames
Definition: pagedesc.cxx:231
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:136
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
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:667
bool m_bDetectedRangeSegmentation false
void SetRegisterFormatColl(const SwTextFormatColl *rFormat)
set the style for the grid alignment
Definition: pagedesc.cxx:211
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:676
const SvxLRSpaceItem & GetLRSpace(bool=true) const
Definition: frmatr.hxx:74
Base class of the Writer document model elements.
Definition: node.hxx:81
const SvxShadowItem & GetShadow(bool=true) const
Definition: frmatr.hxx:88
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo