LibreOffice Module sw (master)  1
docfmt.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 #include <hintids.hxx>
22 #include <svl/itemiter.hxx>
23 #include <editeng/tstpitem.hxx>
24 #include <editeng/lrspitem.hxx>
26 #include <editeng/rsiditem.hxx>
27 #include <editeng/colritem.hxx>
28 #include <officecfg/Office/Common.hxx>
29 #include <svl/zforlist.hxx>
32 #include <unotools/configmgr.hxx>
33 #include <sal/log.hxx>
34 #include <com/sun/star/i18n/WordType.hpp>
35 #include <com/sun/star/i18n/XBreakIterator.hpp>
36 #include <fmtpdsc.hxx>
37 #include <fmthdft.hxx>
38 #include <fmtcntnt.hxx>
39 #include <doc.hxx>
40 #include <docfunc.hxx>
41 #include <drawdoc.hxx>
42 #include <MarkManager.hxx>
44 #include <IDocumentUndoRedo.hxx>
48 #include <IDocumentState.hxx>
51 #include <rootfrm.hxx>
52 #include <txtfrm.hxx>
53 #include <hints.hxx>
54 #include <ndtxt.hxx>
55 #include <pam.hxx>
56 #include <UndoCore.hxx>
57 #include <UndoAttribute.hxx>
58 #include <UndoInsert.hxx>
59 #include <pagedesc.hxx>
60 #include <rolbck.hxx>
61 #include <mvsave.hxx>
62 #include <txatbase.hxx>
63 #include <swtblfmt.hxx>
64 #include <charfmt.hxx>
65 #include <docary.hxx>
66 #include <paratr.hxx>
67 #include <redline.hxx>
68 #include <reffld.hxx>
69 #include <fmtinfmt.hxx>
70 #include <breakit.hxx>
71 #include <SwUndoFmt.hxx>
72 #include <UndoManager.hxx>
73 #include <swmodule.hxx>
74 #include <modcfg.hxx>
75 #include <frameformats.hxx>
76 #include <memory>
77 
78 using namespace ::com::sun::star::i18n;
79 using namespace ::com::sun::star::lang;
80 using namespace ::com::sun::star::uno;
81 
82 /*
83  * Internal functions
84  */
85 
86 static void SetTextFormatCollNext( SwTextFormatColl* pTextColl, const SwTextFormatColl* pDel )
87 {
88  if ( &pTextColl->GetNextTextFormatColl() == pDel )
89  {
90  pTextColl->SetNextTextFormatColl( *pTextColl );
91  }
92 }
93 
94 static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
95 {
97  SwContentNode* pNode = rpNd->GetContentNode();
98  if (pPara && pPara->pLayout && pPara->pLayout->IsHideRedlines()
99  && pNode && pNode->GetRedlineMergeFlag() == SwNode::Merge::Hidden)
100  {
101  return true;
102  }
103  if( pNode && pNode->HasSwAttrSet() )
104  {
105  const bool bLocked = pNode->IsModifyLocked();
106  pNode->LockModify();
107 
108  SwDoc* pDoc = pNode->GetDoc();
109 
110  // remove unused attribute RES_LR_SPACE
111  // add list attributes
112  SfxItemSet aSavedAttrsSet(
113  pDoc->GetAttrPool(),
114  svl::Items<
117  RES_PAGEDESC, RES_BREAK>{});
118  const SfxItemSet* pAttrSetOfNode = pNode->GetpSwAttrSet();
119 
120  std::vector<sal_uInt16> aClearWhichIds;
121  // restoring all paragraph list attributes
122  {
123  SfxItemSet aListAttrSet( pDoc->GetAttrPool(), svl::Items<RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1>{} );
124  aListAttrSet.Set(*pAttrSetOfNode);
125  if ( aListAttrSet.Count() )
126  {
127  aSavedAttrsSet.Put(aListAttrSet);
128  SfxItemIter aIter( aListAttrSet );
129  const SfxPoolItem* pItem = aIter.GetCurItem();
130  while( pItem )
131  {
132  aClearWhichIds.push_back( pItem->Which() );
133  pItem = aIter.NextItem();
134  }
135  }
136  }
137 
138  const SfxPoolItem* pItem;
139 
140  sal_uInt16 const aSavIds[3] = { RES_PAGEDESC, RES_BREAK, RES_PARATR_NUMRULE };
141  for (sal_uInt16 aSavId : aSavIds)
142  {
143  if (SfxItemState::SET == pAttrSetOfNode->GetItemState(aSavId, false, &pItem))
144  {
145  bool bSave = false;
146  switch( aSavId )
147  {
148  case RES_PAGEDESC:
149  bSave = nullptr != static_cast<const SwFormatPageDesc*>(pItem)->GetPageDesc();
150  break;
151  case RES_BREAK:
152  bSave = SvxBreak::NONE != static_cast<const SvxFormatBreakItem*>(pItem)->GetBreak();
153  break;
154  case RES_PARATR_NUMRULE:
155  bSave = !static_cast<const SwNumRuleItem*>(pItem)->GetValue().isEmpty();
156  break;
157  }
158  if( bSave )
159  {
160  aSavedAttrsSet.Put(*pItem);
161  aClearWhichIds.push_back(aSavId);
162  }
163  }
164  }
165 
166  // do not clear items directly from item set and only clear to be kept
167  // attributes, if no deletion item set is found.
168  const bool bKeepAttributes =
169  !pPara || !pPara->pDelSet || pPara->pDelSet->Count() == 0;
170  if ( bKeepAttributes )
171  {
172  pNode->ResetAttr( aClearWhichIds );
173  }
174 
175  if( !bLocked )
176  pNode->UnlockModify();
177 
178  if( pPara )
179  {
180  SwRegHistory aRegH( pNode, *pNode, pPara->pHistory );
181 
182  if( pPara->pDelSet && pPara->pDelSet->Count() )
183  {
184  OSL_ENSURE( !bKeepAttributes,
185  "<lcl_RstAttr(..)> - certain attributes are kept, but not needed." );
186  SfxItemIter aIter( *pPara->pDelSet );
187  for (pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
188  {
189  if ( ( pItem->Which() != RES_PAGEDESC &&
190  pItem->Which() != RES_BREAK &&
191  pItem->Which() != RES_PARATR_NUMRULE ) ||
192  ( aSavedAttrsSet.GetItemState( pItem->Which(), false ) != SfxItemState::SET ) )
193  {
194  pNode->ResetAttr( pItem->Which() );
195  }
196  }
197  }
198  else if( pPara->bResetAll )
199  pNode->ResetAllAttr();
200  else
201  pNode->ResetAttr( RES_PARATR_BEGIN, POOLATTR_END - 1 );
202  }
203  else
204  pNode->ResetAllAttr();
205 
206  // only restore saved attributes, if needed
207  if (bKeepAttributes && aSavedAttrsSet.Count())
208  {
209  pNode->LockModify();
210 
211  pNode->SetAttr(aSavedAttrsSet);
212 
213  if( !bLocked )
214  pNode->UnlockModify();
215  }
216  }
217  return true;
218 }
219 
220 void SwDoc::RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark,
221  bool bExactRange, SwRootFrame const*const pLayout)
222 {
223  SwHistory* pHst = nullptr;
224  SwDataChanged aTmp( rRg );
225  if (GetIDocumentUndoRedo().DoesUndo())
226  {
227  std::unique_ptr<SwUndoResetAttr> pUndo(new SwUndoResetAttr( rRg, RES_CHRFMT ));
228  pHst = &pUndo->GetHistory();
229  GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
230  }
231  const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
233  pStt, pEnd, pHst, nullptr, pLayout );
234  aPara.bInclRefToxMark = bInclRefToxMark;
235  aPara.bExactRange = bExactRange;
236  GetNodes().ForEach( pStt->nNode.GetIndex(), pEnd->nNode.GetIndex()+1,
239 }
240 
241 void SwDoc::ResetAttrs( const SwPaM &rRg,
242  bool bTextAttr,
243  const std::set<sal_uInt16> &rAttrs,
244  const bool bSendDataChangedEvents,
245  SwRootFrame const*const pLayout)
246 {
247  SwPaM* pPam = const_cast<SwPaM*>(&rRg);
248  if( !bTextAttr && !rAttrs.empty() && RES_TXTATR_END > *(rAttrs.begin()) )
249  bTextAttr = true;
250 
251  if( !rRg.HasMark() )
252  {
253  SwTextNode* pTextNd = rRg.GetPoint()->nNode.GetNode().GetTextNode();
254  if( !pTextNd )
255  return ;
256 
257  pPam = new SwPaM( *rRg.GetPoint() );
258 
259  SwIndex& rSt = pPam->GetPoint()->nContent;
260  sal_Int32 nMkPos, nPtPos = rSt.GetIndex();
261 
262  // Special case: if the Cursor is located within a URL attribute, we take over it's area
263  SwTextAttr const*const pURLAttr(
264  pTextNd->GetTextAttrAt(rSt.GetIndex(), RES_TXTATR_INETFMT));
265  if (pURLAttr && !pURLAttr->GetINetFormat().GetValue().isEmpty())
266  {
267  nMkPos = pURLAttr->GetStart();
268  nPtPos = *pURLAttr->End();
269  }
270  else
271  {
273  Boundary aBndry = g_pBreakIt->GetBreakIter()->getWordBoundary(
274  pTextNd->GetText(), nPtPos,
275  g_pBreakIt->GetLocale( pTextNd->GetLang( nPtPos ) ),
276  WordType::ANY_WORD /*ANYWORD_IGNOREWHITESPACES*/,
277  true);
278 
279  if( aBndry.startPos < nPtPos && nPtPos < aBndry.endPos )
280  {
281  nMkPos = aBndry.startPos;
282  nPtPos = aBndry.endPos;
283  }
284  else
285  {
286  nPtPos = nMkPos = rSt.GetIndex();
287  if( bTextAttr )
288  pTextNd->DontExpandFormat( rSt );
289  }
290  }
291 
292  rSt = nMkPos;
293  pPam->SetMark();
294  pPam->GetPoint()->nContent = nPtPos;
295  }
296 
297  // #i96644#
298  std::unique_ptr< SwDataChanged > xDataChanged;
299  if ( bSendDataChangedEvents )
300  {
301  xDataChanged.reset( new SwDataChanged( *pPam ) );
302  }
303  SwHistory* pHst = nullptr;
304  if (GetIDocumentUndoRedo().DoesUndo())
305  {
306  std::unique_ptr<SwUndoResetAttr> pUndo(new SwUndoResetAttr( rRg,
307  bTextAttr ? sal_uInt16(RES_CONDTXTFMTCOLL) : sal_uInt16(RES_TXTFMTCOLL) ));
308  if( !rAttrs.empty() )
309  {
310  pUndo->SetAttrs( rAttrs );
311  }
312  pHst = &pUndo->GetHistory();
313  GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
314  }
315 
316  const SwPosition *pStt = pPam->Start(), *pEnd = pPam->End();
318  pStt, pEnd, pHst, nullptr, pLayout);
319 
320  // mst: not including META here; it seems attrs with CH_TXTATR are omitted
325  for( std::set<sal_uInt16>::const_reverse_iterator it = rAttrs.rbegin(); it != rAttrs.rend(); ++it )
326  {
327  if( POOLATTR_END > *it )
328  aDelSet.Put( *GetDfltAttr( *it ));
329  }
330  if( aDelSet.Count() )
331  aPara.pDelSet = &aDelSet;
332 
333  bool bAdd = true;
334  SwNodeIndex aTmpStt( pStt->nNode );
335  SwNodeIndex aTmpEnd( pEnd->nNode );
336  if( pStt->nContent.GetIndex() ) // just one part
337  {
338  // set up a later, and all CharFormatAttr -> TextFormatAttr
339  SwTextNode* pTNd = aTmpStt.GetNode().GetTextNode();
340  if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() )
341  {
342  if (pHst)
343  {
344  SwRegHistory history(pTNd, *pTNd, pHst);
345  pTNd->FormatToTextAttr(pTNd);
346  }
347  else
348  {
349  pTNd->FormatToTextAttr(pTNd);
350  }
351  }
352 
353  ++aTmpStt;
354  }
355  if( pEnd->nContent.GetIndex() == pEnd->nNode.GetNode().GetContentNode()->Len() )
356  {
357  // set up a later, and all CharFormatAttr -> TextFormatAttr
358  ++aTmpEnd;
359  bAdd = false;
360  }
361  else if( pStt->nNode != pEnd->nNode || !pStt->nContent.GetIndex() )
362  {
363  SwTextNode* pTNd = aTmpEnd.GetNode().GetTextNode();
364  if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() )
365  {
366  if (pHst)
367  {
368  SwRegHistory history(pTNd, *pTNd, pHst);
369  pTNd->FormatToTextAttr(pTNd);
370  }
371  else
372  {
373  pTNd->FormatToTextAttr(pTNd);
374  }
375  }
376  }
377 
378  if( aTmpStt < aTmpEnd )
379  GetNodes().ForEach( pStt->nNode, aTmpEnd, lcl_RstAttr, &aPara );
380  else if( !rRg.HasMark() )
381  {
382  aPara.bResetAll = false ;
383  ::lcl_RstAttr( &pStt->nNode.GetNode(), &aPara );
384  aPara.bResetAll = true ;
385  }
386 
387  if( bTextAttr )
388  {
389  if( bAdd )
390  ++aTmpEnd;
392  }
393 
395 
396  xDataChanged.reset(); //before delete pPam
397 
398  if( pPam != &rRg )
399  delete pPam;
400 }
401 
403 void SwDoc::UpdateRsid( const SwPaM &rRg, const sal_Int32 nLen )
404 {
405  if (!SW_MOD()->GetModuleConfig()->IsStoreRsid())
406  return;
407 
408  SwTextNode *pTextNode = rRg.GetPoint()->nNode.GetNode().GetTextNode();
409  if (!pTextNode)
410  {
411  return;
412  }
413  const sal_Int32 nStart(rRg.GetPoint()->nContent.GetIndex() - nLen);
415 
417  aSet.Put(aRsid);
418  bool const bRet(pTextNode->SetAttr(aSet, nStart,
419  rRg.GetPoint()->nContent.GetIndex()));
420 
421  if (bRet && GetIDocumentUndoRedo().DoesUndo())
422  {
423  SwUndo *const pLastUndo = GetUndoManager().GetLastUndo();
424  SwUndoInsert *const pUndoInsert(dynamic_cast<SwUndoInsert*>(pLastUndo));
425  // this function is called after Insert so expects to find SwUndoInsert
426  assert(pUndoInsert);
427  if (pUndoInsert)
428  {
429  pUndoInsert->SetWithRsid();
430  }
431  }
432 }
433 
434 bool SwDoc::UpdateParRsid( SwTextNode *pTextNode, sal_uInt32 nVal )
435 {
436  if (!SW_MOD()->GetModuleConfig()->IsStoreRsid())
437  return false;
438 
439  if (!pTextNode)
440  {
441  return false;
442  }
443 
444  SvxRsidItem aRsid( nVal ? nVal : mnRsid, RES_PARATR_RSID );
445  return pTextNode->SetAttr( aRsid );
446 }
447 
450 void SwDoc::SetAttr( const SfxPoolItem& rAttr, SwFormat& rFormat )
451 {
452  SfxItemSet aSet( GetAttrPool(), {{rAttr.Which(), rAttr.Which()}} );
453  aSet.Put( rAttr );
454  SetAttr( aSet, rFormat );
455 }
456 
459 void SwDoc::SetAttr( const SfxItemSet& rSet, SwFormat& rFormat )
460 {
461  if (GetIDocumentUndoRedo().DoesUndo())
462  {
463  SwUndoFormatAttrHelper aTmp( rFormat );
464  rFormat.SetFormatAttr( rSet );
465  if ( aTmp.GetUndo() )
466  {
468  }
469  else
470  {
472  }
473  }
474  else
475  {
476  rFormat.SetFormatAttr( rSet );
477  }
479 }
480 
481 void SwDoc::ResetAttrAtFormat( const sal_uInt16 nWhichId,
482  SwFormat& rChangedFormat )
483 {
484  std::unique_ptr<SwUndo> pUndo;
485  if (GetIDocumentUndoRedo().DoesUndo())
486  pUndo.reset(new SwUndoFormatResetAttr( rChangedFormat, nWhichId ));
487 
488  const bool bAttrReset = rChangedFormat.ResetFormatAttr( nWhichId );
489 
490  if ( bAttrReset )
491  {
492  if ( pUndo )
493  {
494  GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
495  }
496 
498  }
499 }
500 
501 static bool lcl_SetNewDefTabStops( SwTwips nOldWidth, SwTwips nNewWidth,
502  SvxTabStopItem& rChgTabStop )
503 {
504  // Set the default values of all TabStops to the new value.
505  // Attention: we always work with the PoolAttribute here, so that
506  // we don't calculate the same value on the same TabStop (pooled!) for all sets.
507  // We send a FormatChg to modify.
508 
509  sal_uInt16 nOldCnt = rChgTabStop.Count();
510  if( !nOldCnt || nOldWidth == nNewWidth )
511  return false;
512 
513  // Find the default's beginning
514  sal_uInt16 n;
515  for( n = nOldCnt; n ; --n )
516  if( SvxTabAdjust::Default != rChgTabStop[n - 1].GetAdjustment() )
517  break;
518  ++n;
519  if( n < nOldCnt ) // delete the DefTabStops
520  rChgTabStop.Remove( n, nOldCnt - n );
521  return true;
522 }
523 
526 void SwDoc::SetDefault( const SfxPoolItem& rAttr )
527 {
528  SfxItemSet aSet( GetAttrPool(), {{rAttr.Which(), rAttr.Which()}} );
529  aSet.Put( rAttr );
530  SetDefault( aSet );
531 }
532 
533 void SwDoc::SetDefault( const SfxItemSet& rSet )
534 {
535  if( !rSet.Count() )
536  return;
537 
538  SwModify aCallMod;
539  SwAttrSet aOld( GetAttrPool(), rSet.GetRanges() ),
540  aNew( GetAttrPool(), rSet.GetRanges() );
541  SfxItemIter aIter( rSet );
542  const SfxPoolItem* pItem = aIter.GetCurItem();
543  SfxItemPool* pSdrPool = GetAttrPool().GetSecondaryPool();
544  do
545  {
546  bool bCheckSdrDflt = false;
547  const sal_uInt16 nWhich = pItem->Which();
548  aOld.Put( GetAttrPool().GetDefaultItem( nWhich ) );
549  GetAttrPool().SetPoolDefaultItem( *pItem );
550  aNew.Put( GetAttrPool().GetDefaultItem( nWhich ) );
551 
552  if (isCHRATR(nWhich) || isTXTATR(nWhich))
553  {
554  aCallMod.Add( mpDfltTextFormatColl.get() );
555  aCallMod.Add( mpDfltCharFormat.get() );
556  bCheckSdrDflt = nullptr != pSdrPool;
557  }
558  else if ( isPARATR(nWhich) ||
559  isPARATR_LIST(nWhich) )
560  {
561  aCallMod.Add( mpDfltTextFormatColl.get() );
562  bCheckSdrDflt = nullptr != pSdrPool;
563  }
564  else if (isGRFATR(nWhich))
565  {
566  aCallMod.Add( mpDfltGrfFormatColl.get() );
567  }
568  else if (isFRMATR(nWhich) || isDrawingLayerAttribute(nWhich) )
569  {
570  aCallMod.Add( mpDfltGrfFormatColl.get() );
571  aCallMod.Add( mpDfltTextFormatColl.get() );
572  aCallMod.Add( mpDfltFrameFormat.get() );
573  }
574  else if (isBOXATR(nWhich))
575  {
576  aCallMod.Add( mpDfltFrameFormat.get() );
577  }
578 
579  // also copy the defaults
580  if( bCheckSdrDflt )
581  {
582  sal_uInt16 nSlotId = GetAttrPool().GetSlotId( nWhich );
583  if( 0 != nSlotId && nSlotId != nWhich )
584  {
585  sal_uInt16 nEdtWhich = pSdrPool->GetWhich( nSlotId );
586  if( 0 != nEdtWhich && nSlotId != nEdtWhich )
587  {
588  std::unique_ptr<SfxPoolItem> pCpy(pItem->Clone());
589  pCpy->SetWhich( nEdtWhich );
590  pSdrPool->SetPoolDefaultItem( *pCpy );
591  }
592  }
593  }
594 
595  pItem = aIter.NextItem();
596  } while (pItem);
597 
598  if( aNew.Count() && aCallMod.HasWriterListeners() )
599  {
601  {
602  GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoDefaultAttr>( aOld, this ) );
603  }
604 
605  const SfxPoolItem* pTmpItem;
606  if( ( SfxItemState::SET ==
607  aNew.GetItemState( RES_PARATR_TABSTOP, false, &pTmpItem ) ) &&
608  static_cast<const SvxTabStopItem*>(pTmpItem)->Count() )
609  {
610  // Set the default values of all TabStops to the new value.
611  // Attention: we always work with the PoolAttribute here, so that
612  // we don't calculate the same value on the same TabStop (pooled!) for all sets.
613  // We send a FormatChg to modify.
614  SwTwips nNewWidth = (*static_cast<const SvxTabStopItem*>(pTmpItem))[ 0 ].GetTabPos(),
615  nOldWidth = aOld.Get(RES_PARATR_TABSTOP)[ 0 ].GetTabPos();
616 
617  bool bChg = false;
618  for (const SfxPoolItem* pItem2 : GetAttrPool().GetItemSurrogates(RES_PARATR_TABSTOP))
619  {
620  auto pTabStopItem = dynamic_cast<const SvxTabStopItem*>(pItem2);
621  if(pTabStopItem)
622  bChg |= lcl_SetNewDefTabStops( nOldWidth, nNewWidth,
623  *const_cast<SvxTabStopItem*>(pTabStopItem) );
624  }
625 
626  aNew.ClearItem( RES_PARATR_TABSTOP );
627  aOld.ClearItem( RES_PARATR_TABSTOP );
628  if( bChg )
629  {
630  SwFormatChg aChgFormat( mpDfltCharFormat.get() );
631  // notify the frames
632  aCallMod.ModifyNotification( &aChgFormat, &aChgFormat );
633  }
634  }
635  }
636 
637  if( aNew.Count() && aCallMod.HasWriterListeners() )
638  {
639  SwAttrSetChg aChgOld( aOld, aOld );
640  SwAttrSetChg aChgNew( aNew, aNew );
641  aCallMod.ModifyNotification( &aChgOld, &aChgNew ); // all changed are sent
642  }
643 
644  // remove the default formats from the object again
645  SwIterator<SwClient, SwModify> aClientIter(aCallMod);
646  for(SwClient* pClient = aClientIter.First(); pClient; pClient = aClientIter.Next())
647  aCallMod.Remove( pClient );
648 
650 }
651 
653 const SfxPoolItem& SwDoc::GetDefault( sal_uInt16 nFormatHint ) const
654 {
655  return GetAttrPool().GetDefaultItem( nFormatHint );
656 }
657 
659 void SwDoc::DelCharFormat(size_t nFormat, bool bBroadcast)
660 {
661  SwCharFormat * pDel = (*mpCharFormatTable)[nFormat];
662 
663  if (bBroadcast)
664  BroadcastStyleOperation(pDel->GetName(), SfxStyleFamily::Char,
665  SfxHintId::StyleSheetErased);
666 
668  {
670  std::make_unique<SwUndoCharFormatDelete>(pDel, this));
671  }
672 
673  delete (*mpCharFormatTable)[nFormat];
674  mpCharFormatTable->erase(mpCharFormatTable->begin() + nFormat);
675 
677 }
678 
679 void SwDoc::DelCharFormat( SwCharFormat const *pFormat, bool bBroadcast )
680 {
681  size_t nFormat = mpCharFormatTable->GetPos( pFormat );
682  OSL_ENSURE( SIZE_MAX != nFormat, "Format not found," );
683  DelCharFormat( nFormat, bBroadcast );
684 }
685 
686 void SwDoc::DelFrameFormat( SwFrameFormat *pFormat, bool bBroadcast )
687 {
688  if( dynamic_cast<const SwTableBoxFormat*>( pFormat) != nullptr || dynamic_cast<const SwTableLineFormat*>( pFormat) != nullptr )
689  {
690  OSL_ENSURE( false, "Format is not in the DocArray any more, "
691  "so it can be deleted with delete" );
692  delete pFormat;
693  }
694  else
695  {
696  // The format has to be in the one or the other, we'll see in which one.
697  if (mpFrameFormatTable->ContainsFormat(*pFormat))
698  {
699  if (bBroadcast)
700  BroadcastStyleOperation(pFormat->GetName(),
701  SfxStyleFamily::Frame,
702  SfxHintId::StyleSheetErased);
703 
705  {
707  std::make_unique<SwUndoFrameFormatDelete>(pFormat, this));
708  }
709 
710  mpFrameFormatTable->erase( pFormat );
711  delete pFormat;
712  }
713  else
714  {
715  bool contains = GetSpzFrameFormats()->ContainsFormat(*pFormat);
716  OSL_ENSURE( contains, "FrameFormat not found." );
717  if( contains )
718  {
719  GetSpzFrameFormats()->erase( pFormat );
720  delete pFormat;
721  }
722  }
723  }
724 }
725 
727 {
729  OSL_ENSURE( it != mpTableFrameFormatTable->end(), "Format not found," );
730  mpTableFrameFormatTable->erase( it );
731  delete pFormat;
732 }
733 
734 SwFrameFormat* SwDoc::FindFrameFormatByName( const OUString& rName ) const
735 {
736  return static_cast<SwFrameFormat*>(FindFormatByName( static_cast<SwFormatsBase&>(*mpFrameFormatTable), rName ));
737 }
738 
740 SwFlyFrameFormat *SwDoc::MakeFlyFrameFormat( const OUString &rFormatName,
741  SwFrameFormat *pDerivedFrom )
742 {
743  SwFlyFrameFormat *pFormat = new SwFlyFrameFormat( GetAttrPool(), rFormatName, pDerivedFrom );
744  GetSpzFrameFormats()->push_back(pFormat);
746  return pFormat;
747 }
748 
749 SwDrawFrameFormat *SwDoc::MakeDrawFrameFormat( const OUString &rFormatName,
750  SwFrameFormat *pDerivedFrom )
751 {
752  SwDrawFrameFormat *pFormat = new SwDrawFrameFormat( GetAttrPool(), rFormatName, pDerivedFrom);
753  GetSpzFrameFormats()->push_back(pFormat);
755  return pFormat;
756 }
757 
758 size_t SwDoc::GetTableFrameFormatCount(bool bUsed) const
759 {
760  if (!bUsed)
761  {
762  return mpTableFrameFormatTable->size();
763  }
764 
765  SwAutoFormatGetDocNode aGetHt(&GetNodes());
766  size_t nCount = 0;
767  for (SwFrameFormat* const & pFormat : *mpTableFrameFormatTable)
768  {
769  if (!pFormat->GetInfo(aGetHt))
770  nCount++;
771  }
772  return nCount;
773 }
774 
775 SwFrameFormat& SwDoc::GetTableFrameFormat(size_t nFormat, bool bUsed) const
776 {
777  if (!bUsed)
778  {
779  return *((*mpTableFrameFormatTable)[nFormat]);
780  }
781 
782  SwAutoFormatGetDocNode aGetHt(&GetNodes());
783 
784  size_t index = 0;
785 
786  for (SwFrameFormat* const & pFormat : *mpTableFrameFormatTable)
787  {
788  if (!pFormat->GetInfo(aGetHt))
789  {
790  if (index == nFormat)
791  return *pFormat;
792  else
793  index++;
794  }
795  }
796  throw std::out_of_range("Format index out of range.");
797 }
798 
799 SwTableFormat* SwDoc::MakeTableFrameFormat( const OUString &rFormatName,
800  SwFrameFormat *pDerivedFrom )
801 {
802  SwTableFormat* pFormat = new SwTableFormat( GetAttrPool(), rFormatName, pDerivedFrom );
803  mpTableFrameFormatTable->push_back( pFormat );
805 
806  return pFormat;
807 }
808 
809 SwFrameFormat *SwDoc::MakeFrameFormat(const OUString &rFormatName,
810  SwFrameFormat *pDerivedFrom,
811  bool bBroadcast, bool bAuto)
812 {
813  SwFrameFormat *pFormat = new SwFrameFormat( GetAttrPool(), rFormatName, pDerivedFrom );
814 
815  pFormat->SetAuto(bAuto);
816  mpFrameFormatTable->push_back( pFormat );
818 
819  if (GetIDocumentUndoRedo().DoesUndo())
820  {
822  std::make_unique<SwUndoFrameFormatCreate>(pFormat, pDerivedFrom, this));
823  }
824 
825  if (bBroadcast)
826  {
827  BroadcastStyleOperation(rFormatName, SfxStyleFamily::Frame,
828  SfxHintId::StyleSheetCreated);
829  }
830 
831  return pFormat;
832 }
833 
834 SwFormat *SwDoc::MakeFrameFormat_(const OUString &rFormatName,
835  SwFormat *pDerivedFrom,
836  bool bBroadcast, bool bAuto)
837 {
838  SwFrameFormat *pFrameFormat = dynamic_cast<SwFrameFormat*>(pDerivedFrom);
839  pFrameFormat = MakeFrameFormat( rFormatName, pFrameFormat, bBroadcast, bAuto );
840  return dynamic_cast<SwFormat*>(pFrameFormat);
841 }
842 
843 SwCharFormat *SwDoc::MakeCharFormat( const OUString &rFormatName,
844  SwCharFormat *pDerivedFrom,
845  bool bBroadcast )
846 {
847  SwCharFormat *pFormat = new SwCharFormat( GetAttrPool(), rFormatName, pDerivedFrom );
848  mpCharFormatTable->push_back( pFormat );
849  pFormat->SetAuto(false);
851 
852  if (GetIDocumentUndoRedo().DoesUndo())
853  {
855  std::make_unique<SwUndoCharFormatCreate>(pFormat, pDerivedFrom, this));
856  }
857 
858  if (bBroadcast)
859  {
860  BroadcastStyleOperation(rFormatName, SfxStyleFamily::Char,
861  SfxHintId::StyleSheetCreated);
862  }
863 
864  return pFormat;
865 }
866 
867 SwFormat *SwDoc::MakeCharFormat_(const OUString &rFormatName,
868  SwFormat *pDerivedFrom,
869  bool bBroadcast, bool /*bAuto*/)
870 {
871  SwCharFormat *pCharFormat = dynamic_cast<SwCharFormat*>(pDerivedFrom);
872  pCharFormat = MakeCharFormat( rFormatName, pCharFormat, bBroadcast );
873  return dynamic_cast<SwFormat*>(pCharFormat);
874 }
875 
877 SwTextFormatColl* SwDoc::MakeTextFormatColl( const OUString &rFormatName,
878  SwTextFormatColl *pDerivedFrom,
879  bool bBroadcast)
880 {
881  SwTextFormatColl *pFormatColl = new SwTextFormatColl( GetAttrPool(), rFormatName,
882  pDerivedFrom );
883  mpTextFormatCollTable->push_back(pFormatColl);
884  pFormatColl->SetAuto(false);
886 
887  if (GetIDocumentUndoRedo().DoesUndo())
888  {
890  std::make_unique<SwUndoTextFormatCollCreate>(pFormatColl, pDerivedFrom,
891  this));
892  }
893 
894  if (bBroadcast)
895  BroadcastStyleOperation(rFormatName, SfxStyleFamily::Para,
896  SfxHintId::StyleSheetCreated);
897 
898  return pFormatColl;
899 }
900 
901 SwFormat *SwDoc::MakeTextFormatColl_(const OUString &rFormatName,
902  SwFormat *pDerivedFrom,
903  bool bBroadcast, bool /*bAuto*/)
904 {
905  SwTextFormatColl *pTextFormatColl = dynamic_cast<SwTextFormatColl*>(pDerivedFrom);
906  pTextFormatColl = MakeTextFormatColl( rFormatName, pTextFormatColl, bBroadcast );
907  return dynamic_cast<SwFormat*>(pTextFormatColl);
908 }
909 
910 //FEATURE::CONDCOLL
912  SwTextFormatColl *pDerivedFrom,
913  bool bBroadcast)
914 {
916  rFormatName, pDerivedFrom );
917  mpTextFormatCollTable->push_back(pFormatColl);
918  pFormatColl->SetAuto(false);
920 
921  if (GetIDocumentUndoRedo().DoesUndo())
922  {
924  std::make_unique<SwUndoCondTextFormatCollCreate>(pFormatColl, pDerivedFrom,
925  this));
926  }
927 
928  if (bBroadcast)
929  BroadcastStyleOperation(rFormatName, SfxStyleFamily::Para,
930  SfxHintId::StyleSheetCreated);
931 
932  return pFormatColl;
933 }
934 //FEATURE::CONDCOLL
935 
936 // GRF
937 SwGrfFormatColl* SwDoc::MakeGrfFormatColl( const OUString &rFormatName,
938  SwGrfFormatColl *pDerivedFrom )
939 {
940  SwGrfFormatColl *pFormatColl = new SwGrfFormatColl( GetAttrPool(), rFormatName,
941  pDerivedFrom );
942  mpGrfFormatCollTable->push_back( pFormatColl );
943  pFormatColl->SetAuto(false);
945  return pFormatColl;
946 }
947 
948 void SwDoc::DelTextFormatColl(size_t nFormatColl, bool bBroadcast)
949 {
950  OSL_ENSURE( nFormatColl, "Remove of Coll 0." );
951 
952  // Who has the to-be-deleted as their Next?
953  SwTextFormatColl *pDel = (*mpTextFormatCollTable)[nFormatColl];
954  if( mpDfltTextFormatColl.get() == pDel )
955  return; // never delete default!
956 
957  if (bBroadcast)
958  BroadcastStyleOperation(pDel->GetName(), SfxStyleFamily::Para,
959  SfxHintId::StyleSheetErased);
960 
962  {
963  std::unique_ptr<SwUndoTextFormatCollDelete> pUndo;
964  if (RES_CONDTXTFMTCOLL == pDel->Which())
965  {
966  pUndo.reset(new SwUndoCondTextFormatCollDelete(pDel, this));
967  }
968  else
969  {
970  pUndo.reset(new SwUndoTextFormatCollDelete(pDel, this));
971  }
972 
973  GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
974  }
975 
976  // Remove the FormatColl
977  mpTextFormatCollTable->erase(mpTextFormatCollTable->begin() + nFormatColl);
978  // Correct next
979  for( SwTextFormatColls::const_iterator it = mpTextFormatCollTable->begin() + 1; it != mpTextFormatCollTable->end(); ++it )
980  SetTextFormatCollNext( *it, pDel );
981  delete pDel;
983 }
984 
985 void SwDoc::DelTextFormatColl( SwTextFormatColl const *pColl, bool bBroadcast )
986 {
987  size_t nFormat = mpTextFormatCollTable->GetPos( pColl );
988  OSL_ENSURE( SIZE_MAX != nFormat, "Collection not found," );
989  DelTextFormatColl( nFormat, bBroadcast );
990 }
991 
992 static bool lcl_SetTextFormatColl( const SwNodePtr& rpNode, void* pArgs )
993 {
994  SwContentNode* pCNd = rpNode->GetTextNode();
995 
996  if( pCNd == nullptr)
997  return true;
998 
1000 
1001  if (pPara->pLayout && pPara->pLayout->IsHideRedlines())
1002  {
1004  {
1005  return true;
1006  }
1007  if (pCNd->IsTextNode())
1008  {
1009  pCNd = sw::GetParaPropsNode(*pPara->pLayout, SwNodeIndex(*pCNd));
1010  }
1011  }
1012 
1013  SwTextFormatColl* pFormat = static_cast<SwTextFormatColl*>(pPara->pFormatColl);
1014  if ( pPara->bReset )
1015  {
1016  lcl_RstAttr(pCNd, pPara);
1017 
1018  // #i62675# check, if paragraph style has changed
1019  if ( pPara->bResetListAttrs &&
1020  pFormat != pCNd->GetFormatColl() &&
1021  pFormat->GetItemState( RES_PARATR_NUMRULE ) == SfxItemState::SET )
1022  {
1023  // Check, if the list style of the paragraph will change.
1024  bool bChangeOfListStyleAtParagraph( true );
1025  SwTextNode& rTNd(dynamic_cast<SwTextNode&>(*pCNd));
1026  {
1027  SwNumRule* pNumRuleAtParagraph(rTNd.GetNumRule());
1028  if ( pNumRuleAtParagraph )
1029  {
1030  const SwNumRuleItem& rNumRuleItemAtParagraphStyle =
1031  pFormat->GetNumRule();
1032  if ( rNumRuleItemAtParagraphStyle.GetValue() ==
1033  pNumRuleAtParagraph->GetName() )
1034  {
1035  bChangeOfListStyleAtParagraph = false;
1036  }
1037  }
1038  }
1039 
1040  if ( bChangeOfListStyleAtParagraph )
1041  {
1042  std::unique_ptr< SwRegHistory > pRegH;
1043  if ( pPara->pHistory )
1044  {
1045  pRegH.reset(new SwRegHistory(&rTNd, rTNd, pPara->pHistory));
1046  }
1047 
1048  pCNd->ResetAttr( RES_PARATR_NUMRULE );
1049 
1050  // reset all list attributes
1055  pCNd->ResetAttr( RES_PARATR_LIST_ID );
1056  }
1057  }
1058  }
1059 
1060  // add to History so that old data is saved, if necessary
1061  if( pPara->pHistory )
1062  pPara->pHistory->Add( pCNd->GetFormatColl(), pCNd->GetIndex(),
1063  SwNodeType::Text );
1064 
1065  pCNd->ChgFormatColl( pFormat );
1066 
1067  pPara->nWhich++;
1068 
1069  return true;
1070 }
1071 
1073  SwTextFormatColl *pFormat,
1074  const bool bReset,
1075  const bool bResetListAttrs,
1076  SwRootFrame const*const pLayout)
1077 {
1078  SwDataChanged aTmp( rRg );
1079  const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
1080  SwHistory* pHst = nullptr;
1081  bool bRet = true;
1082 
1083  if (GetIDocumentUndoRedo().DoesUndo())
1084  {
1085  std::unique_ptr<SwUndoFormatColl> pUndo(new SwUndoFormatColl( rRg, pFormat,
1086  bReset,
1087  bResetListAttrs ));
1088  pHst = pUndo->GetHistory();
1089  GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
1090  }
1091 
1093  pStt, pEnd, pHst, nullptr, pLayout);
1094  aPara.pFormatColl = pFormat;
1095  aPara.bReset = bReset;
1096  // #i62675#
1097  aPara.bResetListAttrs = bResetListAttrs;
1098 
1099  GetNodes().ForEach( pStt->nNode.GetIndex(), pEnd->nNode.GetIndex()+1,
1100  lcl_SetTextFormatColl, &aPara );
1101  if( !aPara.nWhich )
1102  bRet = false; // didn't find a valid Node
1103 
1104  if (bRet)
1105  {
1107  }
1108 
1109  return bRet;
1110 }
1111 
1114  const SwFormatsBase& rFormatArr,
1115  FNCopyFormat fnCopyFormat, const SwFormat& rDfltFormat )
1116 {
1117  // It's no autoformat, default format or collection format,
1118  // then search for it.
1119  if( !rFormat.IsAuto() || !rFormat.GetRegisteredIn() )
1120  for( size_t n = 0; n < rFormatArr.GetFormatCount(); ++n )
1121  {
1122  // Does the Doc already contain the template?
1123  if( rFormatArr.GetFormat(n)->GetName()==rFormat.GetName() )
1124  return rFormatArr.GetFormat(n);
1125  }
1126 
1127  // Search for the "parent" first
1128  SwFormat* pParent = const_cast<SwFormat*>(&rDfltFormat);
1129  if( rFormat.DerivedFrom() && pParent != rFormat.DerivedFrom() )
1130  pParent = CopyFormat( *rFormat.DerivedFrom(), rFormatArr,
1131  fnCopyFormat, rDfltFormat );
1132 
1133  // Create the format and copy the attributes
1134  // #i40550#
1135  SwFormat* pNewFormat = (this->*fnCopyFormat)( rFormat.GetName(), pParent, false, true );
1136  pNewFormat->SetAuto( rFormat.IsAuto() );
1137  pNewFormat->CopyAttrs( rFormat ); // copy the attributes
1138 
1139  pNewFormat->SetPoolFormatId( rFormat.GetPoolFormatId() );
1140  pNewFormat->SetPoolHelpId( rFormat.GetPoolHelpId() );
1141 
1142  // Always set the HelpFile Id to default!
1143  pNewFormat->SetPoolHlpFileId( UCHAR_MAX );
1144 
1145  return pNewFormat;
1146 }
1147 
1150 {
1151  return static_cast<SwFrameFormat*>(CopyFormat( rFormat, *GetFrameFormats(), &SwDoc::MakeFrameFormat_,
1152  *GetDfltFrameFormat() ));
1153 }
1154 
1157 {
1158  return static_cast<SwCharFormat*>(CopyFormat( rFormat, *GetCharFormats(),
1160  *GetDfltCharFormat() ));
1161 }
1162 
1165 {
1166  SwTextFormatColl* pNewColl = FindTextFormatCollByName( rColl.GetName() );
1167  if( pNewColl )
1168  return pNewColl;
1169 
1170  // search for the "parent" first
1171  SwTextFormatColl* pParent = mpDfltTextFormatColl.get();
1172  if( pParent != rColl.DerivedFrom() )
1173  pParent = CopyTextColl( *static_cast<SwTextFormatColl*>(rColl.DerivedFrom()) );
1174 
1175 //FEATURE::CONDCOLL
1176  if( RES_CONDTXTFMTCOLL == rColl.Which() )
1177  {
1178  pNewColl = new SwConditionTextFormatColl( GetAttrPool(), rColl.GetName(),
1179  pParent);
1180  mpTextFormatCollTable->push_back( pNewColl );
1181  pNewColl->SetAuto(false);
1183 
1184  // copy the conditions
1185  static_cast<SwConditionTextFormatColl*>(pNewColl)->SetConditions(
1186  static_cast<const SwConditionTextFormatColl&>(rColl).GetCondColls() );
1187  }
1188  else
1189 //FEATURE::CONDCOLL
1190  pNewColl = MakeTextFormatColl( rColl.GetName(), pParent );
1191 
1192  // copy the auto formats or the attributes
1193  pNewColl->CopyAttrs( rColl );
1194 
1197  pNewColl->SetPoolFormatId( rColl.GetPoolFormatId() );
1198  pNewColl->SetPoolHelpId( rColl.GetPoolHelpId() );
1199 
1200  // Always set the HelpFile Id to default!
1201  pNewColl->SetPoolHlpFileId( UCHAR_MAX );
1202 
1203  if( &rColl.GetNextTextFormatColl() != &rColl )
1205 
1206  // create the NumRule if necessary
1207  if( this != rColl.GetDoc() )
1208  {
1209  const SfxPoolItem* pItem;
1210  if( SfxItemState::SET == pNewColl->GetItemState( RES_PARATR_NUMRULE,
1211  false, &pItem ))
1212  {
1213  const OUString& rName = static_cast<const SwNumRuleItem*>(pItem)->GetValue();
1214  if( !rName.isEmpty() )
1215  {
1216  const SwNumRule* pRule = rColl.GetDoc()->FindNumRulePtr( rName );
1217  if( pRule && !pRule->IsAutoRule() )
1218  {
1219  SwNumRule* pDestRule = FindNumRulePtr( rName );
1220  if( pDestRule )
1221  pDestRule->SetInvalidRule( true );
1222  else
1223  MakeNumRule( rName, pRule );
1224  }
1225  }
1226  }
1227  }
1228  return pNewColl;
1229 }
1230 
1233 {
1234  SwGrfFormatColl* pNewColl = static_cast<SwGrfFormatColl*>(FindFormatByName( static_cast<SwFormatsBase const &>(*mpGrfFormatCollTable), rColl.GetName() ));
1235  if( pNewColl )
1236  return pNewColl;
1237 
1238  // Search for the "parent" first
1239  SwGrfFormatColl* pParent = mpDfltGrfFormatColl.get();
1240  if( pParent != rColl.DerivedFrom() )
1241  pParent = CopyGrfColl( *static_cast<SwGrfFormatColl*>(rColl.DerivedFrom()) );
1242 
1243  // if not, copy them
1244  pNewColl = MakeGrfFormatColl( rColl.GetName(), pParent );
1245 
1246  // copy the attributes
1247  pNewColl->CopyAttrs( rColl );
1248 
1249  pNewColl->SetPoolFormatId( rColl.GetPoolFormatId() );
1250  pNewColl->SetPoolHelpId( rColl.GetPoolHelpId() );
1251 
1252  // Always set the HelpFile Id to default!
1253  pNewColl->SetPoolHlpFileId( UCHAR_MAX );
1254 
1255  return pNewColl;
1256 }
1257 
1258 void SwDoc::CopyFormatArr( const SwFormatsBase& rSourceArr,
1259  SwFormatsBase const & rDestArr,
1260  FNCopyFormat fnCopyFormat,
1261  SwFormat& rDfltFormat )
1262 {
1263  SwFormat* pSrc, *pDest;
1264 
1265  // 1st step: Create all formats (skip the 0th - it's the default one)
1266  for( size_t nSrc = rSourceArr.GetFormatCount(); nSrc > 1; )
1267  {
1268  pSrc = rSourceArr.GetFormat( --nSrc );
1269  if( pSrc->IsDefault() || pSrc->IsAuto() )
1270  continue;
1271 
1272  if( nullptr == FindFormatByName( rDestArr, pSrc->GetName() ) )
1273  {
1274  if( RES_CONDTXTFMTCOLL == pSrc->Which() )
1275  MakeCondTextFormatColl( pSrc->GetName(), static_cast<SwTextFormatColl*>(&rDfltFormat) );
1276  else
1277  // #i40550#
1278  (this->*fnCopyFormat)( pSrc->GetName(), &rDfltFormat, false, true );
1279  }
1280  }
1281 
1282  // 2nd step: Copy all attributes, set the right parents
1283  for( size_t nSrc = rSourceArr.GetFormatCount(); nSrc > 1; )
1284  {
1285  pSrc = rSourceArr.GetFormat( --nSrc );
1286  if( pSrc->IsDefault() || pSrc->IsAuto() )
1287  continue;
1288 
1289  pDest = FindFormatByName( rDestArr, pSrc->GetName() );
1290  pDest->SetAuto(false);
1291  pDest->DelDiffs( *pSrc );
1292 
1293  // #i94285#: existing <SwFormatPageDesc> instance, before copying attributes
1294  const SfxPoolItem* pItem;
1295  if( &GetAttrPool() != pSrc->GetAttrSet().GetPool() &&
1296  SfxItemState::SET == pSrc->GetAttrSet().GetItemState(
1297  RES_PAGEDESC, false, &pItem ) &&
1298  static_cast<const SwFormatPageDesc*>(pItem)->GetPageDesc() )
1299  {
1300  SwFormatPageDesc aPageDesc( *static_cast<const SwFormatPageDesc*>(pItem) );
1301  const OUString& rNm = aPageDesc.GetPageDesc()->GetName();
1302  SwPageDesc* pPageDesc = FindPageDesc( rNm );
1303  if( !pPageDesc )
1304  {
1305  pPageDesc = MakePageDesc(rNm);
1306  }
1307  aPageDesc.RegisterToPageDesc( *pPageDesc );
1308  SwAttrSet aTmpAttrSet( pSrc->GetAttrSet() );
1309  aTmpAttrSet.Put( aPageDesc );
1310  pDest->SetFormatAttr( aTmpAttrSet );
1311  }
1312  else
1313  {
1314  pDest->SetFormatAttr( pSrc->GetAttrSet() );
1315  }
1316 
1317  pDest->SetPoolFormatId( pSrc->GetPoolFormatId() );
1318  pDest->SetPoolHelpId( pSrc->GetPoolHelpId() );
1319 
1320  // Always set the HelpFile Id to default!
1321  pDest->SetPoolHlpFileId( UCHAR_MAX );
1322 
1323  if( pSrc->DerivedFrom() )
1324  pDest->SetDerivedFrom( FindFormatByName( rDestArr,
1325  pSrc->DerivedFrom()->GetName() ) );
1326  if( RES_TXTFMTCOLL == pSrc->Which() ||
1327  RES_CONDTXTFMTCOLL == pSrc->Which() )
1328  {
1329  SwTextFormatColl* pSrcColl = static_cast<SwTextFormatColl*>(pSrc),
1330  * pDstColl = static_cast<SwTextFormatColl*>(pDest);
1331  if( &pSrcColl->GetNextTextFormatColl() != pSrcColl )
1332  pDstColl->SetNextTextFormatColl( *static_cast<SwTextFormatColl*>(FindFormatByName(
1333  rDestArr, pSrcColl->GetNextTextFormatColl().GetName() ) ) );
1334 
1335  if(pSrcColl->IsAssignedToListLevelOfOutlineStyle())
1336  pDstColl->AssignToListLevelOfOutlineStyle(pSrcColl->GetAssignedOutlineStyleLevel());
1337 
1338 //FEATURE::CONDCOLL
1339  if( RES_CONDTXTFMTCOLL == pSrc->Which() )
1340  // Copy the conditions, but delete the old ones first!
1341  static_cast<SwConditionTextFormatColl*>(pDstColl)->SetConditions(
1342  static_cast<SwConditionTextFormatColl*>(pSrc)->GetCondColls() );
1343 //FEATURE::CONDCOLL
1344  }
1345  }
1346 }
1347 
1349  const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat )
1350 {
1351  // Treat the header and footer attributes in the right way:
1352  // Copy content nodes across documents!
1353  sal_uInt16 nAttr = bCpyHeader ? sal_uInt16(RES_HEADER) : sal_uInt16(RES_FOOTER);
1354  const SfxPoolItem* pItem;
1355  if( SfxItemState::SET != rSrcFormat.GetAttrSet().GetItemState( nAttr, false, &pItem ))
1356  return ;
1357 
1358  // The header only contains the reference to the format from the other document!
1359  std::unique_ptr<SfxPoolItem> pNewItem(pItem->Clone());
1360 
1361  SwFrameFormat* pOldFormat;
1362  if( bCpyHeader )
1363  pOldFormat = static_cast<SwFormatHeader*>(pNewItem.get())->GetHeaderFormat();
1364  else
1365  pOldFormat = static_cast<SwFormatFooter*>(pNewItem.get())->GetFooterFormat();
1366 
1367  if( !pOldFormat )
1368  return;
1369 
1370  SwFrameFormat* pNewFormat = new SwFrameFormat( GetAttrPool(), "CpyDesc",
1371  GetDfltFrameFormat() );
1372  pNewFormat->CopyAttrs( *pOldFormat );
1373 
1374  if( SfxItemState::SET == pNewFormat->GetAttrSet().GetItemState(
1375  RES_CNTNT, false, &pItem ))
1376  {
1377  const SwFormatContent* pContent = static_cast<const SwFormatContent*>(pItem);
1378  if( pContent->GetContentIdx() )
1379  {
1380  SwNodeIndex aTmpIdx( GetNodes().GetEndOfAutotext() );
1381  const SwNodes& rSrcNds = rSrcFormat.GetDoc()->GetNodes();
1382  SwStartNode* pSttNd = SwNodes::MakeEmptySection( aTmpIdx,
1383  bCpyHeader
1385  : SwFooterStartNode );
1386  const SwNode& rCSttNd = pContent->GetContentIdx()->GetNode();
1387  SwNodeRange aRg( rCSttNd, 0, *rCSttNd.EndOfSectionNode() );
1388  aTmpIdx = *pSttNd->EndOfSectionNode();
1389  rSrcNds.Copy_( aRg, aTmpIdx );
1390  aTmpIdx = *pSttNd;
1391  rSrcFormat.GetDoc()->GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRg, nullptr, aTmpIdx);
1392  // TODO: investigate calling CopyWithFlyInFly?
1393  SwPaM const source(aRg.aStart, aRg.aEnd);
1394  SwPosition dest(aTmpIdx);
1395  sw::CopyBookmarks(source, dest);
1396  pNewFormat->SetFormatAttr( SwFormatContent( pSttNd ));
1397  }
1398  else
1399  pNewFormat->ResetFormatAttr( RES_CNTNT );
1400  }
1401  if( bCpyHeader )
1402  static_cast<SwFormatHeader*>(pNewItem.get())->RegisterToFormat(*pNewFormat);
1403  else
1404  static_cast<SwFormatFooter*>(pNewItem.get())->RegisterToFormat(*pNewFormat);
1405  rDestFormat.SetFormatAttr( *pNewItem );
1406 }
1407 
1408 void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
1409  bool bCopyPoolIds )
1410 {
1411  bool bNotifyLayout = false;
1413 
1414  rDstDesc.SetLandscape( rSrcDesc.GetLandscape() );
1415  rDstDesc.SetNumType( rSrcDesc.GetNumType() );
1416  if( rDstDesc.ReadUseOn() != rSrcDesc.ReadUseOn() )
1417  {
1418  rDstDesc.WriteUseOn( rSrcDesc.ReadUseOn() );
1419  bNotifyLayout = true;
1420  }
1421 
1422  if( bCopyPoolIds )
1423  {
1424  rDstDesc.SetPoolFormatId( rSrcDesc.GetPoolFormatId() );
1425  rDstDesc.SetPoolHelpId( rSrcDesc.GetPoolHelpId() );
1426  // Always set the HelpFile Id to default!
1427  rDstDesc.SetPoolHlpFileId( UCHAR_MAX );
1428  }
1429 
1430  if( rSrcDesc.GetFollow() != &rSrcDesc )
1431  {
1432  const SwPageDesc* pSrcFollow = rSrcDesc.GetFollow();
1433  SwPageDesc* pFollow = FindPageDesc( pSrcFollow->GetName() );
1434  if( !pFollow )
1435  {
1436  // copy
1437  pFollow = MakePageDesc( pSrcFollow->GetName() );
1438  CopyPageDesc( *pSrcFollow, *pFollow );
1439  }
1440  rDstDesc.SetFollow( pFollow );
1441  bNotifyLayout = true;
1442  }
1443 
1444  // the header and footer attributes are copied separately
1445  // the content sections have to be copied in their entirety
1446  {
1447  SfxItemSet aAttrSet( rSrcDesc.GetMaster().GetAttrSet() );
1448  aAttrSet.ClearItem( RES_HEADER );
1449  aAttrSet.ClearItem( RES_FOOTER );
1450 
1451  rDstDesc.GetMaster().DelDiffs( aAttrSet );
1452  rDstDesc.GetMaster().SetFormatAttr( aAttrSet );
1453 
1454  aAttrSet.ClearItem();
1455  aAttrSet.Put( rSrcDesc.GetLeft().GetAttrSet() );
1456  aAttrSet.ClearItem( RES_HEADER );
1457  aAttrSet.ClearItem( RES_FOOTER );
1458 
1459  rDstDesc.GetLeft().DelDiffs( aAttrSet );
1460  rDstDesc.GetLeft().SetFormatAttr( aAttrSet );
1461 
1462  aAttrSet.ClearItem();
1463  aAttrSet.Put( rSrcDesc.GetFirstMaster().GetAttrSet() );
1464  aAttrSet.ClearItem( RES_HEADER );
1465  aAttrSet.ClearItem( RES_FOOTER );
1466 
1467  rDstDesc.GetFirstMaster().DelDiffs( aAttrSet );
1468  rDstDesc.GetFirstMaster().SetFormatAttr( aAttrSet );
1469 
1470  aAttrSet.ClearItem();
1471  aAttrSet.Put( rSrcDesc.GetFirstLeft().GetAttrSet() );
1472  aAttrSet.ClearItem( RES_HEADER );
1473  aAttrSet.ClearItem( RES_FOOTER );
1474 
1475  rDstDesc.GetFirstLeft().DelDiffs( aAttrSet );
1476  rDstDesc.GetFirstLeft().SetFormatAttr( aAttrSet );
1477  }
1478 
1479  CopyHeader( rSrcDesc.GetMaster(), rDstDesc.GetMaster() );
1480  CopyFooter( rSrcDesc.GetMaster(), rDstDesc.GetMaster() );
1481  if( !rDstDesc.IsHeaderShared() )
1482  CopyHeader( rSrcDesc.GetLeft(), rDstDesc.GetLeft() );
1483  else
1484  rDstDesc.GetLeft().SetFormatAttr( rDstDesc.GetMaster().GetHeader() );
1485  if( !rDstDesc.IsFirstShared() )
1486  {
1487  CopyHeader( rSrcDesc.GetFirstMaster(), rDstDesc.GetFirstMaster() );
1488  rDstDesc.GetFirstLeft().SetFormatAttr(rDstDesc.GetFirstMaster().GetHeader());
1489  }
1490  else
1491  {
1492  rDstDesc.GetFirstMaster().SetFormatAttr( rDstDesc.GetMaster().GetHeader() );
1493  rDstDesc.GetFirstLeft().SetFormatAttr(rDstDesc.GetLeft().GetHeader());
1494  }
1495 
1496  if( !rDstDesc.IsFooterShared() )
1497  CopyFooter( rSrcDesc.GetLeft(), rDstDesc.GetLeft() );
1498  else
1499  rDstDesc.GetLeft().SetFormatAttr( rDstDesc.GetMaster().GetFooter() );
1500  if( !rDstDesc.IsFirstShared() )
1501  {
1502  CopyFooter( rSrcDesc.GetFirstMaster(), rDstDesc.GetFirstMaster() );
1503  rDstDesc.GetFirstLeft().SetFormatAttr(rDstDesc.GetFirstMaster().GetFooter());
1504  }
1505  else
1506  {
1507  rDstDesc.GetFirstMaster().SetFormatAttr( rDstDesc.GetMaster().GetFooter() );
1508  rDstDesc.GetFirstLeft().SetFormatAttr(rDstDesc.GetLeft().GetFooter());
1509  }
1510 
1511  if( bNotifyLayout && pTmpRoot )
1512  {
1513  for( auto aLayout : GetAllLayouts() )
1514  aLayout->AllCheckPageDescs();
1515  }
1516 
1517  // If foot notes change the pages have to be triggered
1518  if( !(rDstDesc.GetFootnoteInfo() == rSrcDesc.GetFootnoteInfo()) )
1519  {
1520  sw::PageFootnoteHint aHint;
1521  rDstDesc.SetFootnoteInfo( rSrcDesc.GetFootnoteInfo() );
1522  rDstDesc.GetMaster().CallSwClientNotify(aHint);
1523  rDstDesc.GetLeft().CallSwClientNotify(aHint);
1524  rDstDesc.GetFirstMaster().CallSwClientNotify(aHint);
1525  rDstDesc.GetFirstLeft().CallSwClientNotify(aHint);
1526  }
1527 }
1528 
1529 void SwDoc::ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles )
1530 {
1531  ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
1532 
1539 
1540  //To-Do:
1541  // a) in rtf export don't export our hideous pgdsctbl
1542  // extension to rtf anymore
1543  // b) in sd rtf import (View::InsertData) don't use
1544  // a super-fragile test for mere presence of \trowd to
1545  // indicate import of rtf into a table
1546  // c) then drop use of bIncludePageStyles
1547  if (bIncludePageStyles)
1548  {
1549  // and now the page templates
1550  SwPageDescs::size_type nCnt = rSource.m_PageDescs.size();
1551  if( nCnt )
1552  {
1553  // a different Doc -> Number formatter needs to be merged
1554  SwTableNumFormatMerge aTNFM( rSource, *this );
1555 
1556  // 1st step: Create all formats (skip the 0th - it's the default!)
1557  while( nCnt )
1558  {
1559  const SwPageDesc &rSrc = *rSource.m_PageDescs[ --nCnt ];
1560  if( nullptr == FindPageDesc( rSrc.GetName() ) )
1561  MakePageDesc( rSrc.GetName() );
1562  }
1563 
1564  // 2nd step: Copy all attributes, set the right parents
1565  for (SwPageDescs::size_type i = rSource.m_PageDescs.size(); i; )
1566  {
1567  const SwPageDesc &rSrc = *rSource.m_PageDescs[ --i ];
1568  SwPageDesc* pDesc = FindPageDesc( rSrc.GetName() );
1569  CopyPageDesc( rSrc, *pDesc);
1570  }
1571  }
1572  }
1573 
1574  // then there are the numbering templates
1575  const SwNumRuleTable::size_type nCnt = rSource.GetNumRuleTable().size();
1576  if( nCnt )
1577  {
1578  const SwNumRuleTable& rArr = rSource.GetNumRuleTable();
1579  for( SwNumRuleTable::size_type n = 0; n < nCnt; ++n )
1580  {
1581  const SwNumRule& rR = *rArr[ n ];
1582  SwNumRule* pNew = FindNumRulePtr( rR.GetName());
1583  if( pNew )
1584  pNew->CopyNumRule( this, rR );
1585  else
1586  {
1587  if( !rR.IsAutoRule() )
1588  MakeNumRule( rR.GetName(), &rR );
1589  else
1590  {
1591  // as we reset all styles, there shouldn't be any unknown
1592  // automatic SwNumRules, because all should have been
1593  // created by the style copying!
1594  // So just warn and ignore.
1595  SAL_WARN( "sw.core", "Found unknown auto SwNumRule during reset!" );
1596  }
1597  }
1598  }
1599  }
1600 
1601  if (undoGuard.UndoWasEnabled())
1602  {
1603  // nodes array was modified!
1605  }
1606 
1608 }
1609 
1611  const OUString& rName )
1612 {
1613  SwFormat* pFnd = nullptr;
1614  for( size_t n = 0; n < rFormatArr.GetFormatCount(); ++n )
1615  {
1616  // Does the Doc already contain the template?
1617  if( rFormatArr.GetFormat(n)->HasName( rName ) )
1618  {
1619  pFnd = rFormatArr.GetFormat(n);
1620  break;
1621  }
1622  }
1623  return pFnd;
1624 }
1625 
1626 void SwDoc::MoveLeftMargin(const SwPaM& rPam, bool bRight, bool bModulus,
1627  SwRootFrame const*const pLayout)
1628 {
1629  SwHistory* pHistory = nullptr;
1630  if (GetIDocumentUndoRedo().DoesUndo())
1631  {
1632  std::unique_ptr<SwUndoMoveLeftMargin> pUndo(new SwUndoMoveLeftMargin( rPam, bRight,
1633  bModulus ));
1634  pHistory = &pUndo->GetHistory();
1635  GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
1636  }
1637 
1638  const SvxTabStopItem& rTabItem = GetDefault( RES_PARATR_TABSTOP );
1639  const sal_Int32 nDefDist = rTabItem.Count() ? rTabItem[0].GetTabPos() : 1134;
1640  const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End();
1641  SwNodeIndex aIdx( rStt.nNode );
1642  while( aIdx <= rEnd.nNode )
1643  {
1644  SwTextNode* pTNd = aIdx.GetNode().GetTextNode();
1645  if( pTNd )
1646  {
1647  pTNd = sw::GetParaPropsNode(*pLayout, aIdx);
1648  SvxLRSpaceItem aLS( static_cast<const SvxLRSpaceItem&>(pTNd->SwContentNode::GetAttr( RES_LR_SPACE )) );
1649 
1650  // #i93873# See also lcl_MergeListLevelIndentAsLRSpaceItem in thints.cxx
1651  if ( pTNd->AreListLevelIndentsApplicable() )
1652  {
1653  const SwNumRule* pRule = pTNd->GetNumRule();
1654  if ( pRule )
1655  {
1656  const int nListLevel = pTNd->GetActualListLevel();
1657  if ( nListLevel >= 0 )
1658  {
1659  const SwNumFormat& rFormat = pRule->Get(static_cast<sal_uInt16>(nListLevel));
1661  {
1662  aLS.SetTextLeft( rFormat.GetIndentAt() );
1663  aLS.SetTextFirstLineOffset( static_cast<short>(rFormat.GetFirstLineIndent()) );
1664  }
1665  }
1666  }
1667  }
1668 
1669  long nNext = aLS.GetTextLeft();
1670  if( bModulus )
1671  nNext = ( nNext / nDefDist ) * nDefDist;
1672 
1673  if( bRight )
1674  nNext += nDefDist;
1675  else
1676  if(nNext >0) // fdo#75936 set limit for decreasing indent
1677  nNext -= nDefDist;
1678 
1679  aLS.SetTextLeft( nNext );
1680 
1681  SwRegHistory aRegH( pTNd, *pTNd, pHistory );
1682  pTNd->SetAttr( aLS );
1683  aIdx = *sw::GetFirstAndLastNode(*pLayout, aIdx).second;
1684  }
1685  ++aIdx;
1686  }
1688 }
1689 
1690 bool SwDoc::DontExpandFormat( const SwPosition& rPos, bool bFlag )
1691 {
1692  bool bRet = false;
1693  SwTextNode* pTextNd = rPos.nNode.GetNode().GetTextNode();
1694  if( pTextNd )
1695  {
1696  bRet = pTextNd->DontExpandFormat( rPos.nContent, bFlag );
1697  if( bRet && GetIDocumentUndoRedo().DoesUndo() )
1698  {
1699  GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoDontExpandFormat>(rPos) );
1700  }
1701  }
1702  return bRet;
1703 }
1704 
1706 {
1708  pFormat->SetName("TableBox" + OUString::number(reinterpret_cast<sal_IntPtr>(pFormat)));
1710  return pFormat;
1711 }
1712 
1714 {
1716  pFormat->SetName("TableLine" + OUString::number(reinterpret_cast<sal_IntPtr>(pFormat)));
1718  return pFormat;
1719 }
1720 
1722 {
1724  {
1725  LanguageType eLang = LANGUAGE_SYSTEM;
1730  return pRet;
1731  });
1732 }
1733 
1735  : pNFormat( nullptr )
1736 {
1737  // a different Doc -> Number formatter needs to be merged
1738  if( &rSrc != &rDest )
1739  {
1740  SvNumberFormatter* pN = const_cast<SwDoc&>(rSrc).GetNumberFormatter( false );
1741  if( pN )
1742  {
1743  pNFormat = rDest.GetNumberFormatter();
1744  pNFormat->MergeFormatter( *pN );
1745  }
1746  }
1747 
1748  if( &rSrc != &rDest )
1750  MergeWithOtherDoc( rDest );
1751 }
1752 
1754 {
1755  if( pNFormat )
1757 }
1758 
1759 void SwDoc::SetTextFormatCollByAutoFormat( const SwPosition& rPos, sal_uInt16 nPoolId,
1760  const SfxItemSet* pSet )
1761 {
1762  SwPaM aPam( rPos );
1763  SwTextNode* pTNd = rPos.nNode.GetNode().GetTextNode();
1764  assert(pTNd);
1765 
1767  {
1768  // create the redline object
1769  const SwTextFormatColl& rColl = *pTNd->GetTextColl();
1770  SwRangeRedline* pRedl = new SwRangeRedline( RedlineType::FmtColl, aPam );
1771  pRedl->SetMark();
1772 
1773  // Only those items that are not set by the Set again in the Node
1774  // are of interest. Thus, we take the difference.
1775  SwRedlineExtraData_FormatColl aExtraData( rColl.GetName(),
1776  rColl.GetPoolFormatId() );
1777  if( pSet && pTNd->HasSwAttrSet() )
1778  {
1779  SfxItemSet aTmp( *pTNd->GetpSwAttrSet() );
1780  aTmp.Differentiate( *pSet );
1781  // we handle the adjust item separately
1782  const SfxPoolItem* pItem;
1783  if( SfxItemState::SET == pTNd->GetpSwAttrSet()->GetItemState(
1784  RES_PARATR_ADJUST, false, &pItem ))
1785  aTmp.Put( *pItem );
1786  aExtraData.SetItemSet( aTmp );
1787  }
1788  pRedl->SetExtraData( &aExtraData );
1789 
1790  //TODO: Undo is still missing!
1791  getIDocumentRedlineAccess().AppendRedline( pRedl, true );
1792  }
1793 
1794  SetTextFormatColl( aPam, getIDocumentStylePoolAccess().GetTextCollFromPool( nPoolId ) );
1795 
1796  if (pSet && pSet->Count())
1797  {
1798  aPam.SetMark();
1799  aPam.GetMark()->nContent.Assign(pTNd, pTNd->GetText().getLength());
1800  // sw_redlinehide: don't need layout currently because the only caller
1801  // passes in the properties node
1802  assert(static_cast<SwTextFrame const*>(pTNd->getLayoutFrame(nullptr))->GetTextNodeForParaProps() == pTNd);
1804  }
1805 }
1806 
1807 void SwDoc::SetFormatItemByAutoFormat( const SwPaM& rPam, const SfxItemSet& rSet )
1808 {
1809  SwTextNode* pTNd = rPam.GetPoint()->nNode.GetNode().GetTextNode();
1810  assert(pTNd);
1811 
1813 
1815  {
1816  // create the redline object
1817  SwRangeRedline* pRedl = new SwRangeRedline( RedlineType::Format, rPam );
1818  if( !pRedl->HasMark() )
1819  pRedl->SetMark();
1820 
1821  // Only those items that are not set by the Set again in the Node
1822  // are of interest. Thus, we take the difference.
1823  SwRedlineExtraData_Format aExtraData( rSet );
1824 
1825  pRedl->SetExtraData( &aExtraData );
1826 
1827  //TODO: Undo is still missing!
1828  getIDocumentRedlineAccess().AppendRedline( pRedl, true );
1829 
1831  }
1832 
1833  const sal_Int32 nEnd(rPam.End()->nContent.GetIndex());
1834  std::vector<sal_uInt16> whichIds;
1835  SfxItemIter iter(rSet);
1836  for (SfxPoolItem const* pItem = iter.GetCurItem(); pItem; pItem = iter.NextItem())
1837  {
1838  whichIds.push_back(pItem->Which());
1839  whichIds.push_back(pItem->Which());
1840  }
1841  whichIds.push_back(0);
1842  SfxItemSet currentSet(GetAttrPool(), whichIds.data());
1843  pTNd->GetParaAttr(currentSet, nEnd, nEnd);
1844  for (size_t i = 0; whichIds[i]; i += 2)
1845  { // yuk - want to explicitly set the pool defaults too :-/
1846  currentSet.Put(currentSet.Get(whichIds[i]));
1847  }
1848 
1850 
1851  // fdo#62536: DONTEXPAND does not work when there is already an AUTOFMT
1852  // here, so insert the old attributes as an empty hint to stop expand
1853  SwPaM endPam(*pTNd, nEnd);
1854  endPam.SetMark();
1855  getIDocumentContentOperations().InsertItemSet(endPam, currentSet);
1856 
1858 }
1859 
1860 void SwDoc::ChgFormat(SwFormat & rFormat, const SfxItemSet & rSet)
1861 {
1862  if (GetIDocumentUndoRedo().DoesUndo())
1863  {
1864  // copying <rSet> to <aSet>
1865  SfxItemSet aSet(rSet);
1866  // remove from <aSet> all items, which are already set at the format
1867  aSet.Differentiate(rFormat.GetAttrSet());
1868  // <aSet> contains now all *new* items for the format
1869 
1870  // copying current format item set to <aOldSet>
1871  SfxItemSet aOldSet(rFormat.GetAttrSet());
1872  // insert new items into <aOldSet>
1873  aOldSet.Put(aSet);
1874  // invalidate all new items in <aOldSet> in order to clear these items,
1875  // if the undo action is triggered.
1876  {
1877  SfxItemIter aIter(aSet);
1878 
1879  for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
1880  {
1881  aOldSet.InvalidateItem(pItem->Which());
1882  }
1883  }
1884 
1886  std::make_unique<SwUndoFormatAttr>(aOldSet, rFormat, /*bSaveDrawPt*/true));
1887  }
1888 
1889  rFormat.SetFormatAttr(rSet);
1890 }
1891 
1892 void SwDoc::RenameFormat(SwFormat & rFormat, const OUString & sNewName,
1893  bool bBroadcast)
1894 {
1895  SfxStyleFamily eFamily = SfxStyleFamily::All;
1896 
1897  if (GetIDocumentUndoRedo().DoesUndo())
1898  {
1899  std::unique_ptr<SwUndo> pUndo;
1900 
1901  switch (rFormat.Which())
1902  {
1903  case RES_CHRFMT:
1904  pUndo.reset(new SwUndoRenameCharFormat(rFormat.GetName(), sNewName, this));
1905  eFamily = SfxStyleFamily::Char;
1906  break;
1907  case RES_TXTFMTCOLL:
1908  pUndo.reset(new SwUndoRenameFormatColl(rFormat.GetName(), sNewName, this));
1909  eFamily = SfxStyleFamily::Para;
1910  break;
1911  case RES_FRMFMT:
1912  pUndo.reset(new SwUndoRenameFrameFormat(rFormat.GetName(), sNewName, this));
1913  eFamily = SfxStyleFamily::Frame;
1914  break;
1915 
1916  default:
1917  break;
1918  }
1919 
1920  if (pUndo)
1921  {
1922  GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
1923  }
1924  }
1925 
1926  rFormat.SetName(sNewName);
1927 
1928  if (bBroadcast)
1929  BroadcastStyleOperation(sNewName, eFamily, SfxHintId::StyleSheetModified);
1930 }
1931 
1933 {
1934  bool bOwns = false;
1935  if (!pWriter)
1936  {
1937  pWriter = xmlNewTextWriterFilename("nodes.xml", 0);
1938  xmlTextWriterSetIndent(pWriter,1);
1939  xmlTextWriterSetIndentString(pWriter, BAD_CAST(" "));
1940  xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
1941  bOwns = true;
1942  }
1943  xmlTextWriterStartElement(pWriter, BAD_CAST("SwDoc"));
1944  xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
1945 
1946  m_pNodes->dumpAsXml(pWriter);
1947  m_PageDescs.dumpAsXml(pWriter);
1948  maDBData.dumpAsXml(pWriter);
1949  mpMarkManager->dumpAsXml(pWriter);
1950  m_pUndoManager->dumpAsXml(pWriter);
1951  m_pDocumentSettingManager->dumpAsXml(pWriter);
1953  mpTextFormatCollTable->dumpAsXml(pWriter);
1954  mpCharFormatTable->dumpAsXml(pWriter);
1955  mpFrameFormatTable->dumpAsXml(pWriter, "frmFormatTable");
1956  mpSpzFrameFormatTable->dumpAsXml(pWriter, "spzFrameFormatTable");
1957  mpSectionFormatTable->dumpAsXml(pWriter);
1958  mpNumRuleTable->dumpAsXml(pWriter);
1961  if (const SdrModel* pModel = getIDocumentDrawModelAccess().GetDrawModel())
1962  pModel->dumpAsXml(pWriter);
1963 
1964  xmlTextWriterStartElement(pWriter, BAD_CAST("mbModified"));
1965  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::boolean(getIDocumentState().IsModified()).getStr()));
1966  xmlTextWriterEndElement(pWriter);
1967 
1968  xmlTextWriterEndElement(pWriter);
1969  if (bOwns)
1970  {
1971  xmlTextWriterEndDocument(pWriter);
1972  xmlFreeTextWriter(pWriter);
1973  }
1974 }
1975 
1977 {
1978  xmlTextWriterStartElement(pWriter, BAD_CAST("SwDBData"));
1979 
1980  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("sDataSource"), BAD_CAST(sDataSource.toUtf8().getStr()));
1981  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("sCommand"), BAD_CAST(sCommand.toUtf8().getStr()));
1982  xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nCommandType"), BAD_CAST(OString::number(nCommandType).getStr()));
1983 
1984  xmlTextWriterEndElement(pWriter);
1985 }
1986 
1987 std::set<Color> SwDoc::GetDocColors()
1988 {
1989  std::set<Color> aDocColors;
1990  SwAttrPool& rPool = GetAttrPool();
1991  const sal_uInt16 pAttribs[] = {RES_CHRATR_COLOR, RES_CHRATR_HIGHLIGHT, RES_BACKGROUND};
1992  for (sal_uInt16 nAttrib : pAttribs)
1993  {
1994  for (const SfxPoolItem* pItem : rPool.GetItemSurrogates(nAttrib))
1995  {
1996  auto pColorItem = static_cast<const SvxColorItem*>(pItem);
1997  Color aColor( pColorItem->GetValue() );
1998  if (COL_AUTO != aColor)
1999  aDocColors.insert(aColor);
2000  }
2001  }
2002  return aDocColors;
2003 }
2004 
2005 // #i69627#
2006 namespace docfunc
2007 {
2009  {
2010  // If a parent paragraph style of one of the paragraph styles, which
2011  // are assigned to the list levels of the outline style, has a list style
2012  // set or inherits a list style from its parent style, the outline style
2013  // has to be written as a normal list style to the OpenDocument file
2014  // format or the OpenOffice.org file format.
2015  bool bRet( false );
2016 
2017  const SwTextFormatColls* pTextFormatColls( rDoc.GetTextFormatColls() );
2018  if ( pTextFormatColls )
2019  {
2020  for ( auto pTextFormatColl : *pTextFormatColls )
2021  {
2022  if ( pTextFormatColl->IsDefault() ||
2023  ! pTextFormatColl->IsAssignedToListLevelOfOutlineStyle() )
2024  {
2025  continue;
2026  }
2027 
2028  const SwTextFormatColl* pParentTextFormatColl =
2029  dynamic_cast<const SwTextFormatColl*>( pTextFormatColl->DerivedFrom());
2030  if ( !pParentTextFormatColl )
2031  continue;
2032 
2033  if ( SfxItemState::SET == pParentTextFormatColl->GetItemState( RES_PARATR_NUMRULE ) )
2034  {
2035  // #i106218# consider that the outline style is set
2036  const SwNumRuleItem& rDirectItem = pParentTextFormatColl->GetNumRule();
2037  if ( rDirectItem.GetValue() != rDoc.GetOutlineNumRule()->GetName() )
2038  {
2039  bRet = true;
2040  break;
2041  }
2042  }
2043  }
2044 
2045  }
2046  return bRet;
2047  }
2048 }
2049 
2051  : m_PosIndex( m_Array.get<0>() )
2052  , m_TypeAndNameIndex( m_Array.get<1>() )
2053 {
2054 }
2055 
2057 {
2059 }
2060 
2062 {
2063  ByTypeAndName::iterator it = m_TypeAndNameIndex.find(
2064  boost::make_tuple(x->Which(), x->GetName(), x) );
2065  return m_Array.project<0>( it );
2066 }
2067 
2068 std::pair<SwFrameFormats::const_range_iterator,SwFrameFormats::const_range_iterator>
2069 SwFrameFormats::rangeFind( sal_uInt16 type, const OUString& name ) const
2070 {
2071  return m_TypeAndNameIndex.equal_range( boost::make_tuple(type, name) );
2072 }
2073 
2074 std::pair<SwFrameFormats::const_range_iterator,SwFrameFormats::const_range_iterator>
2076 {
2077  return rangeFind( x->Which(), x->GetName() );
2078 }
2079 
2080 void SwFrameFormats::DeleteAndDestroyAll( bool keepDefault )
2081 {
2082  if ( empty() )
2083  return;
2084  const int _offset = keepDefault ? 1 : 0;
2085  for( const_iterator it = begin() + _offset; it != end(); ++it )
2086  delete *it;
2087  if ( _offset )
2088  m_PosIndex.erase( begin() + _offset, end() );
2089  else
2090  m_Array.clear();
2091 }
2092 
2093 std::pair<SwFrameFormats::const_iterator,bool> SwFrameFormats::push_back( const value_type& x )
2094 {
2095  SAL_WARN_IF(x->m_ffList != nullptr, "sw.core", "Inserting already assigned item");
2096  assert(x->m_ffList == nullptr);
2097  x->m_ffList = this;
2098  return m_PosIndex.push_back( x );
2099 }
2100 
2102 {
2103  const_iterator const ret = find( x );
2104  SAL_WARN_IF(x->m_ffList != this, "sw.core", "Removing invalid / unassigned item");
2105  if (ret != end()) {
2106  assert( x == *ret );
2107  m_PosIndex.erase( ret );
2108  x->m_ffList = nullptr;
2109  return true;
2110  }
2111  return false;
2112 }
2113 
2115 {
2116  erase( begin() + index_ );
2117 }
2118 
2119 void SwFrameFormats::erase( const_iterator const& position )
2120 {
2121  (*position)->m_ffList = nullptr;
2122  m_PosIndex.erase( begin() + (position - begin()) );
2123 }
2124 
2126 {
2127  return (x.m_ffList == this);
2128 }
2129 
2130 bool SwFrameFormats::IsAlive(SwFrameFormat const*const p) const
2131 {
2132  return find(const_cast<SwFrameFormat*>(p)) != end();
2133 }
2134 
2136 {
2137  std::pair<iterator,bool> res = m_PosIndex.push_front( x );
2138  if( ! res.second )
2139  newDefault( res.first );
2140  return res.second;
2141 }
2142 
2144 {
2145  if (position == begin())
2146  return;
2147  m_PosIndex.relocate( begin(), position );
2148 }
2149 
2150 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)
SwTableFormat * MakeTableFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom)
Definition: docfmt.cxx:799
SwTextFormatColl * MakeTextFormatColl(const OUString &rFormatName, SwTextFormatColl *pDerivedFrom, bool bBroadcast=false)
Create the FormatCollections.
Definition: docfmt.cxx:877
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:682
const std::unique_ptr< ::sw::UndoManager > m_pUndoManager
Definition: doc.hxx:212
Starts a section of nodes in the document model.
Definition: node.hxx:303
void ResetAttrs(const SwPaM &rRg, bool bTextAttr=true, const std::set< sal_uInt16 > &rAttrs=std::set< sal_uInt16 >(), const bool bSendDataChangedEvents=true, SwRootFrame const *pLayout=nullptr)
Reset attributes.
Definition: docfmt.cxx:241
bool UndoWasEnabled() const
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
SwFrameFormats * m_ffList
Definition: frmfmt.hxx:73
SwPageDescs m_PageDescs
Definition: doc.hxx:194
bool erase(const value_type &x)
Definition: docfmt.cxx:2101
void EnsureNumberFormatter()
Definition: docfmt.cxx:1721
sal_uLong GetIndex() const
Definition: node.hxx:282
SwFormat * CopyFormat(const SwFormat &rFormat, const SwFormatsBase &rFormatArr, FNCopyFormat fnCopyFormat, const SwFormat &rDfltFormat)
Copy the formats to itself.
Definition: docfmt.cxx:1113
SwTableLineFormat * MakeTableLineFormat()
Definition: docfmt.cxx:1713
sal_Int32 nCommandType
Definition: swdbdata.hxx:32
void Add(SwClient *pDepend)
Definition: calbck.cxx:217
static Type * doubleCheckedInit(std::atomic< Type * > &pointer, Function function, GuardCtor guardCtor=osl::GetGlobalMutex())
int GetAssignedOutlineStyleLevel() const
Definition: fmtcol.cxx:587
Represents the style of a paragraph.
Definition: fmtcol.hxx:55
static bool lcl_SetNewDefTabStops(SwTwips nOldWidth, SwTwips nNewWidth, SvxTabStopItem &rChgTabStop)
Definition: docfmt.cxx:501
sal_uInt16 Count() const
std::atomic< SvNumberFormatter * > mpNumberFormatter
Definition: doc.hxx:262
Marks a position in the document model.
Definition: pam.hxx:35
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
static SwFormat * FindFormatByName(const SwFormatsBase &rFormatArr, const OUString &rName)
Definition: docfmt.cxx:1610
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:35
SwFrameFormat & GetLeft()
Definition: pagedesc.hxx:218
long GetFirstLineIndent() const
bool IsDefault() const
Definition: format.hxx:109
bool UpdateParRsid(SwTextNode *pTextNode, sal_uInt32 nVal=0)
Definition: docfmt.cxx:434
size_t size() const
Definition: pagedesc.hxx:421
bool isCHRATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:471
void SetPoolHelpId(sal_uInt16 nId)
Definition: format.hxx:148
SwPageDesc * GetPageDesc()
Definition: fmtpdsc.hxx:62
std::pair< const_iterator, bool > push_back(const value_type &x)
Definition: docfmt.cxx:2093
SwCharFormat * MakeCharFormat(const OUString &rFormatName, SwCharFormat *pDerivedFrom, bool bBroadcast=false)
Definition: docfmt.cxx:843
const OUString & GetText() const
Definition: ndtxt.hxx:211
virtual const SwRootFrame * GetCurrentLayout() const =0
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
constexpr TypedWhichId< SwFormatHeader > RES_HEADER(96)
static bool lcl_RstTextAttr(const SwNodePtr &rpNd, void *pArgs)
pArgs contains the document's ChrFormatTable Is need for selections at the beginning/end and with no ...
virtual bool SetAttr(const SfxPoolItem &) override
overriding to handle change of certain paragraph attributes
Definition: ndtxt.cxx:4904
bool isFRMATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:497
void SetPoolHelpId(sal_uInt16 const nId)
Definition: pagedesc.hxx:257
std::string GetValue
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1407
bool isTXTATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:485
virtual AppendResult AppendRedline(SwRangeRedline *pNewRedl, bool bCallDelete)=0
Append a new redline.
virtual void SetRedlineFlags_intern(RedlineFlags eMode)=0
Set a new redline mode.
virtual SfxPoolItem * Clone(SfxItemPool *pPool=nullptr) const =0
const_iterator find(const value_type &x) const
Definition: docfmt.cxx:2061
SwNodeIndex nNode
Definition: pam.hxx:37
const_iterator begin() const
virtual void InsertItemSet(const SwPaM &rRg, const SfxItemSet &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr)=0
sal_uInt16 char char * pDesc
SwTextFormatColl * FindTextFormatCollByName(const OUString &rName) const
Definition: doc.hxx:796
std::unique_ptr< SwNodes > m_pNodes
Definition: doc.hxx:192
virtual void SetModified()=0
Must be called manually at changes of format.
OUString sDataSource
Definition: swdbdata.hxx:30
constexpr TypedWhichId< SwNumRuleItem > RES_PARATR_NUMRULE(72)
const SwPosition * GetMark() const
Definition: pam.hxx:209
SwFrameFormat * MakeFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom, bool bBroadcast=false, bool bAuto=true)
Definition: docfmt.cxx:809
SwFrameFormat & GetFirstMaster()
Definition: pagedesc.hxx:219
constexpr TypedWhichId< SfxInt16Item > RES_PARATR_LIST_RESTARTVALUE(85)
bool IsAutoRule() const
Definition: numrule.hxx:227
bool DontExpandFormat(const SwIndex &rIdx, bool bFlag=true, bool bFormatToTextAttributes=true)
When appropriate set DontExpand-flag at INet or character styles respectively.
Definition: ndtxt.cxx:1601
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1190
sal_Int64 n
ByPos & m_PosIndex
Definition: doc.hxx:184
TElementType * Next()
Definition: calbck.hxx:351
void DelDiffs(const SfxItemSet &rSet)
Delete all attributes that are not in rFormat.
Definition: format.cxx:711
SwFrameFormat * CopyFrameFormat(const SwFrameFormat &)
copy the frame format
Definition: docfmt.cxx:1149
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
void SetTextLeft(const long nL, const sal_uInt16 nProp=100)
SwNode & GetNode() const
Definition: ndindex.hxx:119
bool isDrawingLayerAttribute(const sal_uInt16 nWhich)
Definition: hintids.hxx:501
long SwTwips
Definition: swtypes.hxx:49
const OUString & GetName() const
Definition: numrule.hxx:222
void RenameFormat(SwFormat &rFormat, const OUString &sNewName, bool bBroadcast=false)
Definition: docfmt.cxx:1892
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
bool AreListLevelIndentsApplicable() const
Determines, if the list level indent attributes can be applied to the paragraph.
Definition: ndtxt.cxx:4424
SwGrfFormatColl * MakeGrfFormatColl(const OUString &rFormatName, SwGrfFormatColl *pDerivedFrom)
Definition: docfmt.cxx:937
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:143
SwTextAttr * GetTextAttrAt(sal_Int32 const nIndex, sal_uInt16 const nWhich, enum GetTextAttrMode const eMode=DEFAULT) const
get the innermost text attribute covering position nIndex.
Definition: ndtxt.cxx:1722
SwDrawFrameFormat * MakeDrawFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom)
Definition: docfmt.cxx:749
std::vector< SwTextFormatColl * >::const_iterator const_iterator
Definition: docary.hxx:62
SwFormat * MakeFrameFormat_(const OUString &, SwFormat *, bool, bool)
Definition: docfmt.cxx:834
SwClient * Remove(SwClient *pDepend)
Definition: calbck.cxx:259
const_iterator end() const
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:314
bool HasWriterListeners() const
Definition: calbck.hxx:208
The root element of a Writer document layout.
Definition: rootfrm.hxx:80
void Copy_(const SwNodeRange &rRg, const SwNodeIndex &rInsPos, bool bNewFrames=true) const
Definition: ndarr.hxx:176
int GetActualListLevel() const
Returns the actual list level of this text node, when it is a list item.
Definition: ndtxt.cxx:4109
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:739
SwFrameFormatsBase::value_type value_type
void ReplaceStyles(const SwDoc &rSource, bool bIncludePageStyles=true)
Definition: docfmt.cxx:1529
ByTypeAndName & m_TypeAndNameIndex
void SetFollow(const SwPageDesc *pNew)
Definition: pagedesc.hxx:293
SwFrameFormat * FindFrameFormatByName(const OUString &rName) const
Definition: docfmt.cxx:734
constexpr TypedWhichId< SfxBoolItem > RES_PARATR_LIST_ISRESTART(84)
const OUString & GetName() const
Definition: pagedesc.hxx:187
SwFlyFrameFormat * MakeFlyFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom)
Create the formats.
Definition: docfmt.cxx:740
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:154
bool IsAlive(SwFrameFormat const *) const
not so fast check that given format is still alive (i.e. contained here)
Definition: docfmt.cxx:2130
static bool lcl_SetTextFormatColl(const SwNodePtr &rpNode, void *pArgs)
Definition: docfmt.cxx:992
void DelTableFrameFormat(SwTableFormat *pFormat)
Definition: docfmt.cxx:726
void DelCharFormat(size_t nFormat, bool bBroadcast=false)
Delete the formats.
Definition: docfmt.cxx:659
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:356
constexpr::Color COL_AUTO(0xFF, 0xFF, 0xFF, 0xFF)
const SwPageFootnoteInfo & GetFootnoteInfo() const
Definition: pagedesc.hxx:196
const OUString & GetValue() const
Definition: fmtinfmt.hxx:75
const SfxPoolItem * NextItem()
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:109
const SwCharFormat * GetDfltCharFormat() const
Definition: doc.hxx:748
void SetWithRsid()
Definition: UndoInsert.hxx:88
provides some methods for generic operations on lists that contain SwFormat* subclasses.
Definition: docary.hxx:43
constexpr sal_uInt16 RES_PARATR_BEGIN(RES_TXTATR_END)
std::unique_ptr< SwFrameFormats > mpTableFrameFormatTable
Definition: doc.hxx:240
bool isGRFATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:505
void SetFootnoteInfo(const SwPageFootnoteInfo &rNew)
Definition: pagedesc.hxx:198
SwIndex nContent
Definition: pam.hxx:38
void SetPoolFormatId(sal_uInt16 nId)
Definition: format.hxx:144
constexpr TypedWhichId< SfxInt16Item > RES_PARATR_LIST_LEVEL(83)
void Remove(const sal_uInt16 nPos, const sal_uInt16 nLen=1)
const BorderLinePrimitive2D *pCandidateB assert(pCandidateA)
sal_uInt16 GetPoolFormatId() const
Query and set PoolFormat-Id.
Definition: pagedesc.hxx:254
bool SetTextFormatColl(const SwPaM &rRg, SwTextFormatColl *pFormat, const bool bReset=true, const bool bResetListAttrs=false, SwRootFrame const *pLayout=nullptr)
Add 4th optional parameter .
Definition: docfmt.cxx:1072
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:425
void SetLandscape(bool bNew)
Definition: pagedesc.hxx:191
void SetAttr(const SfxPoolItem &, SwFormat &)
Set attribute in given format.1y If Undo is enabled, the old values is added to the Undo history...
Definition: docfmt.cxx:450
void SetNextTextFormatColl(SwTextFormatColl &rNext)
Inline implementations.
Definition: fmtcol.hxx:228
SwFormat * MakeCharFormat_(const OUString &, SwFormat *, bool, bool)
Definition: docfmt.cxx:867
const OUString & GetName() const
Definition: format.hxx:111
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:33
std::unique_ptr< SwNumRuleTable > mpNumRuleTable
Definition: doc.hxx:264
static bool IsFuzzing()
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Get the default attribute in this document.
Definition: docfmt.cxx:653
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:64
int nCount
sal_uLong GetIndex() const
Definition: ndindex.hxx:152
virtual void DelAllUndoObj()=0
Delete all Undo actions.
void SetPoolHlpFileId(sal_uInt8 nId)
Definition: format.hxx:150
virtual void SetName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2493
sal_Int32 GetStart() const
Definition: txatbase.hxx:82
sal_uInt32 mnRsid
Definition: doc.hxx:290
std::unique_ptr< SwFrameFormats > mpSpzFrameFormatTable
Definition: doc.hxx:238
void SetFormatItemByAutoFormat(const SwPaM &rPam, const SfxItemSet &)
Definition: docfmt.cxx:1807
SwTextFormatColl * CopyTextColl(const SwTextFormatColl &rColl)
copy TextNodes
Definition: docfmt.cxx:1164
void SetPoolHlpFileId(sal_uInt8 const nId)
Definition: pagedesc.hxx:259
const SfxPoolItem * GetDfltAttr(sal_uInt16 nWhich)
Get the default attribute from corresponding default attribute table.
Definition: hints.cxx:153
bool empty() const
o3tl::sorted_vector< SwRootFrame * > GetAllLayouts()
Definition: doclay.cxx:1670
SfxStyleFamily
virtual bool DoesUndo() const =0
Is Undo enabled?
SwAttrPool * GetPool() const
Definition: swatrset.hxx:190
void SetExtraData(const SwRedlineExtraData *pData)
ExtraData gets copied, the pointer is therefore not taken over by the RedLineObject.
Definition: redline.hxx:214
virtual ~SwFrameFormats() override
Definition: docfmt.cxx:2056
bool SetDerivedFrom(SwFormat *pDerivedFrom=nullptr)
0 is Default.
Definition: format.cxx:326
void CopyFlyInFlyImpl(const SwNodeRange &rRg, SwPaM const *const pCopiedPaM, const SwNodeIndex &rStartIdx, const bool bCopyFlyAtFly=false, SwCopyFlags flags=SwCopyFlags::Default) const
constexpr TypedWhichId< SwFrameFormat > RES_FRMFMT(153)
sal_uInt16 GetPoolFormatId() const
Get and set Pool style IDs.
Definition: format.hxx:143
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
virtual void ModifyNotification(const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue)
Definition: calbck.hxx:154
SwUndoFormatAttr * GetUndo() const
SwPageDesc * FindPageDesc(const OUString &rName, size_t *pPos=nullptr) const
Definition: docdesc.cxx:825
Base class for various Writer styles.
Definition: format.hxx:43
SwDBData maDBData
Definition: doc.hxx:200
constexpr TypedWhichId< SvxRsidItem > RES_PARATR_RSID(80)
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: node.cxx:1652
void DelTextFormatColl(size_t nFormat, bool bBroadcast=false)
Definition: docfmt.cxx:948
SwNumRule & CopyNumRule(SwDoc *, const SwNumRule &)
A kind of copy-constructor to make sure the num formats are attached to the correctCharFormats of a d...
Definition: number.cxx:855
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
bool IsHeaderShared() const
Definition: pagedesc.hxx:298
struct _xmlTextWriter * xmlTextWriterPtr
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:443
std::unique_ptr< SwTextFormatColls > mpTextFormatCollTable
Definition: doc.hxx:241
SwNumRule * FindNumRulePtr(const OUString &rName) const
Definition: docnum.cxx:2416
virtual void AppendUndo(std::unique_ptr< SwUndo > pUndo)=0
Add new Undo action.
virtual void ClearRedo()=0
Delete all Redo actions.
Style of a layout element.
Definition: frmfmt.hxx:57
::sw::UndoManager & GetUndoManager()
Definition: doc.cxx:132
#define SW_MOD()
Definition: swmodule.hxx:255
virtual const SwExtraRedlineTable & GetExtraRedlineTable() const =0
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
int i
void SetYear2000(sal_uInt16 nVal)
void dumpAsXml(xmlTextWriterPtr=nullptr) const
Dumps the entire nodes structure to the given destination (file nodes.xml in the current directory by...
Definition: docfmt.cxx:1932
static void SetTextFormatCollNext(SwTextFormatColl *pTextColl, const SwTextFormatColl *pDel)
Definition: docfmt.cxx:86
void ForEach(FnForEach_SwNodes fnForEach, void *pArgs=nullptr)
Definition: ndarr.hxx:143
void SetNumType(const SvxNumberType &rNew)
Definition: pagedesc.hxx:194
const SwPosition * GetPoint() const
Definition: pam.hxx:207
std::vector< SwNumRule * >::size_type size_type
Definition: docary.hxx:63
SwFormat * MakeTextFormatColl_(const OUString &, SwFormat *, bool, bool)
Definition: docfmt.cxx:901
constexpr sal_uInt16 RES_PARATR_LIST_END(88)
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:206
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:878
#define LANGUAGE_SYSTEM
const std::unique_ptr< ::sw::mark::MarkManager > mpMarkManager
Definition: doc.hxx:207
void SetAuto(bool bNew)
Definition: format.hxx:159
bool GetLandscape() const
Definition: pagedesc.hxx:190
bool GetParaAttr(SfxItemSet &rSet, sal_Int32 nStt, sal_Int32 nEnd, const bool bOnlyTextAttr=false, const bool bGetFromChrFormat=true, const bool bMergeIndentValuesOfNumRule=false, SwRootFrame const *pLayout=nullptr) const
Query the attributes of textnode over the range.
Definition: thints.cxx:2095
::sw::DocumentContentOperationsManager const & GetDocumentContentOperationsManager() const
Definition: doc.cxx:324
virtual size_t GetFormatCount() const =0
bool bExactRange
From the attributes included in the range, delete only the ones which have exactly same range...
TElementType * First()
Definition: calbck.hxx:343
SwContentNode * GetContentNode()
Definition: node.hxx:615
SwPageDesc * MakePageDesc(const OUString &rName, const SwPageDesc *pCpy=nullptr, bool bRegardLanguage=true, bool bBroadcast=false)
Definition: docdesc.cxx:642
const OUString & GetValue() const
sal_uInt16 Count() const
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:205
std::set< Color > GetDocColors()
Definition: docfmt.cxx:1987
UseOnPage ReadUseOn() const
Definition: pagedesc.hxx:215
SwDoc * GetDoc()
Definition: node.hxx:702
std::unique_ptr< SwTextFormatColl > mpDfltTextFormatColl
Definition: doc.hxx:233
void SetTextFirstLineOffset(const short nF, const sal_uInt16 nProp=100)
virtual void SetName(const OUString &rNewName, bool bBroadcast=false)
Definition: format.cxx:151
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: pagedesc.cxx:621
Marks a character position inside a document model node.
Definition: index.hxx:33
::rtl::Reference< Content > pContent
size_t size() const
Definition: docary.hxx:84
void UnlockModify()
Definition: calbck.hxx:214
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: fldbas.cxx:198
void SetEvalDateFormat(NfEvalDateFormat eEDF)
const SwFormatFooter & GetFooter(bool=true) const
Definition: fmthdft.hxx:99
SwNumRule * GetNumRule(bool bInParent=true) const
Returns numbering rule of this text node.
Definition: ndtxt.cxx:2806
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: docredln.cxx:729
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:393
void LockModify()
Definition: calbck.hxx:213
SwPageDescsBase::size_type size_type
Definition: pagedesc.hxx:411
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:396
Marks a node in the document model.
Definition: ndindex.hxx:31
bool IsFooterShared() const
Definition: pagedesc.hxx:302
virtual const SwFieldTypes * GetFieldTypes() const =0
bool mbIsAutoFormatRedline
Definition: doc.hxx:307
virtual sal_uInt16 ResetAllAttr()
Definition: node.cxx:1739
bool HasSwAttrSet() const
Definition: node.hxx:444
sal_uInt16 GetSlotId(sal_uInt16 nWhich) const
std::unique_ptr< SwGrfFormatColls > mpGrfFormatCollTable
Definition: doc.hxx:242
tuple index
void SetPoolFormatId(sal_uInt16 const nId)
Definition: pagedesc.hxx:255
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:119
virtual SwFormatColl * ChgFormatColl(SwFormatColl *)
Definition: node.cxx:1225
void CopyHeader(const SwFrameFormat &rSrcFormat, SwFrameFormat &rDestFormat)
Copy header (with contents) from SrcFormat to DestFormat (can also be copied into other document)...
Definition: doc.hxx:891
void SetTextFormatCollByAutoFormat(const SwPosition &rPos, sal_uInt16 nPoolId, const SfxItemSet *pSet)
Definition: docfmt.cxx:1759
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const
void Add(const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue, sal_uLong nNodeIdx)
Definition: rolbck.cxx:1028
std::unique_ptr< SwUndoFormatAttr > ReleaseUndo()
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:404
const SwPosition * Start() const
Definition: pam.hxx:212
constexpr TypedWhichId< SwFormatContent > RES_CNTNT(95)
const SwNumRuleItem & GetNumRule(bool=true) const
Definition: paratr.hxx:218
void ResetAttrAtFormat(const sal_uInt16 nWhichId, SwFormat &rChangedFormat)
Definition: docfmt.cxx:481
void RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark=false, bool bExactRange=false, SwRootFrame const *pLayout=nullptr)
Definition: docfmt.cxx:220
constexpr sal_uInt16 POOLATTR_END(RES_UNKNOWNATR_END)
SwTextNode * GetParaPropsNode(SwRootFrame const &rLayout, SwNodeIndex const &rNode)
Definition: txtfrm.cxx:324
bool isPARATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:489
SwGrfFormatColl * CopyGrfColl(const SwGrfFormatColl &rColl)
copy the graphic nodes
Definition: docfmt.cxx:1232
const SwPageDesc * GetFollow() const
Definition: pagedesc.hxx:246
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:742
void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel)
Definition: fmtcol.cxx:594
constexpr TypedWhichId< SvxRsidItem > RES_CHRATR_RSID(39)
constexpr sal_uInt16 RES_UNKNOWNATR_BEGIN(RES_BOXATR_END)
long GetIndentAt() const
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:458
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
Definition: breakit.hxx:62
std::unique_ptr< SwSectionFormats > mpSectionFormatTable
Definition: doc.hxx:239
SfxItemPool * GetSecondaryPool() const
static bool lcl_RstAttr(const SwNodePtr &rpNd, void *pArgs)
Definition: docfmt.cxx:94
ignore Redlines
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:78
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
void CopyPageDescHeaderFooterImpl(bool bCpyHeader, const SwFrameFormat &rSrcFormat, SwFrameFormat &rDestFormat)
Definition: docfmt.cxx:1348
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:78
constexpr sal_uInt16 RES_FRMATR_END(131)
bool IsModifyLocked() const
Definition: calbck.hxx:218
SwFormat * DerivedFrom() const
Definition: format.hxx:108
const css::lang::Locale & GetLocale(const LanguageType aLang)
Definition: breakit.hxx:67
void SetDefault(const SfxPoolItem &)
Set attribute as new default attribute in current document.
Definition: docfmt.cxx:526
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:217
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTableNumFormatMerge(const SwDoc &rSrc, SwDoc &rDest)
Definition: docfmt.cxx:1734
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:80
SwUndo * GetLastUndo()
Definition: docundo.cxx:234
constexpr sal_uInt16 RES_UNKNOWNATR_END(152)
void CopyPageDesc(const SwPageDesc &rSrcDesc, SwPageDesc &rDstDesc, bool bCopyPoolIds=true)
Copy the complete PageDesc - beyond document and "deep"! Optionally copying of PoolFormatId, -HlpId can be prevented.
Definition: docfmt.cxx:1408
void MoveLeftMargin(const SwPaM &rPam, bool bRight, bool bModulus, SwRootFrame const *pLayout=nullptr)
Adjust left margin via object bar (similar to adjustment of numerations).
Definition: docfmt.cxx:1626
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:650
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:334
constexpr sal_uInt16 RES_TXTATR_END(RES_TXTATR_NOEND_END)
void SetInvalidRule(bool bFlag)
Definition: number.cxx:907
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1540
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:735
constexpr sal_uInt16 RES_CHRATR_BEGIN(HINT_BEGIN)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
void UpdateRsid(const SwPaM &rRg, sal_Int32 nLen)
Set the rsid of the next nLen symbols of rRg to the current session number.
Definition: docfmt.cxx:403
ByPos::const_iterator const_iterator
void CopyFooter(const SwFrameFormat &rSrcFormat, SwFrameFormat &rDestFormat)
Copy footer (with contents) from SrcFormat to DestFormat.
Definition: doc.hxx:896
sal_uInt16 GetPoolHelpId() const
Get and set Help-IDs for document templates.
Definition: format.hxx:147
sal_uInt16 GetWhich(sal_uInt16 nSlot, bool bDeep=true) const
#define SAL_WARN_IF(condition, area, stream)
void CopyAttrs(const SwFormat &)
Copy attributes even among documents.
Definition: format.cxx:178
const SwTextFormatColls * GetTextFormatColls() const
Definition: doc.hxx:775
std::unique_ptr< SwCharFormat > mpDfltCharFormat
Definition: doc.hxx:232
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: docredln.cxx:86
SwCharFormat * CopyCharFormat(const SwCharFormat &)
copy the char format
Definition: docfmt.cxx:1156
SwConditionTextFormatColl * MakeCondTextFormatColl(const OUString &rFormatName, SwTextFormatColl *pDerivedFrom, bool bBroadcast=false)
Definition: docfmt.cxx:911
SwFrameFormat & GetFirstLeft()
Definition: pagedesc.hxx:220
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1063
bool DontExpandFormat(const SwPosition &rPos, bool bFlag=true)
Definition: docfmt.cxx:1690
constexpr TypedWhichId< SwTextFormatColl > RES_TXTFMTCOLL(155)
constexpr TypedWhichId< SwCharFormat > RES_CHRFMT(RES_FMT_BEGIN)
std::unique_ptr< SwCharFormats > mpCharFormatTable
Definition: doc.hxx:237
sal_Int32 GetIndex() const
Definition: index.hxx:91
void WriteUseOn(UseOnPage const eNew)
Definition: pagedesc.hxx:214
void Differentiate(const SfxItemSet &rSet)
constexpr TypedWhichId< SfxBoolItem > RES_PARATR_LIST_ISCOUNTED(86)
constexpr sal_uInt16 RES_PARATR_LIST_BEGIN(RES_PARATR_END)
SwNodes & GetNodes()
Definition: doc.hxx:403
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const
const SwPosition * End() const
Definition: pam.hxx:217
std::unique_ptr< SwFrameFormats > mpFrameFormatTable
Definition: doc.hxx:236
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
Definition: thints.cxx:3402
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:157
const sal_Int32 * End() const
Definition: txatbase.hxx:148
sal_uInt16 GetPoolHelpId() const
Definition: pagedesc.hxx:256
Reference< XComponentContext > getProcessComponentContext()
sal_uInt16 MakeNumRule(const OUString &rName, const SwNumRule *pCpy=nullptr, bool bBroadcast=false, const SvxNumberFormat::SvxNumPositionAndSpaceMode eDefaultNumberFormatPositionAndSpaceMode=SvxNumberFormat::LABEL_WIDTH_AND_POSITION)
Definition: docnum.cxx:2450
constexpr TypedWhichId< SwConditionTextFormatColl > RES_CONDTXTFMTCOLL(158)
size_t GetTableFrameFormatCount(bool bUsed) const
Definition: docfmt.cxx:758
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
bool IsHideRedlines() const
Replacement for sw::DocumentRedlineManager::GetRedlineFlags() (this is layout-level redline hiding)...
Definition: rootfrm.hxx:417
Get reference.
Definition: reffld.hxx:65
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:33
constexpr sal_uInt16 RES_CHRATR_END(46)
SwFrameFormat & GetTableFrameFormat(size_t nFormat, bool bUsed) const
Definition: docfmt.cxx:775
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:376
bool HasName(const OUString &rName) const
Definition: format.hxx:112
bool HasOutlineStyleToBeWrittenAsNormalListStyle(SwDoc &rDoc)
method to check, if the outline style has to written as a normal list style
Definition: docfmt.cxx:2008
void ChgFormat(SwFormat &rFormat, const SfxItemSet &rSet)
Definition: docfmt.cxx:1860
void DelFrameFormat(SwFrameFormat *pFormat, bool bBroadcast=false)
Definition: docfmt.cxx:686
const sal_uInt16 * GetRanges() const
void CopyFormatArr(const SwFormatsBase &rSourceArr, SwFormatsBase const &rDestArr, FNCopyFormat fnCopyFormat, SwFormat &rDfltFormat)
Definition: docfmt.cxx:1258
constexpr TypedWhichId< SwFormatFooter > RES_FOOTER(97)
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
#define SAL_WARN(area, stream)
bool ContainsFormat(SwFrameFormat const &rFormat) const
fast check if given format is contained here pFormat must not have been deleted
Definition: docfmt.cxx:2125
std::unique_ptr< SwFrameFormat > mpDfltFrameFormat
Definition: doc.hxx:229
SwFormatColl * GetFormatColl() const
Definition: node.hxx:447
bool newDefault(const value_type &x)
Definition: docfmt.cxx:2135
virtual SwFieldType * GetSysFieldType(const SwFieldIds eWhich) const =0
SvNumberFormatter * pNFormat
Definition: mvsave.hxx:181
bool IsFirstShared() const
Definition: pagedesc.cxx:376
virtual SwFormat * GetFormat(size_t idx) const =0
SwFrameFormatsBase::size_type size_type
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:475
const std::unique_ptr< ::sw::DocumentSettingManager > m_pDocumentSettingManager
Definition: doc.hxx:213
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:116
void FormatToTextAttr(SwTextNode *pNd)
Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
Definition: thints.cxx:2495
virtual const SwRedlineTable & GetRedlineTable() const =0
const SwFrameFormats * GetFrameFormats() const
Definition: doc.hxx:733
NF_EVALDATEFORMAT_FORMAT_INTL
std::pair< const_range_iterator, const_range_iterator > rangeFind(sal_uInt16 type, const OUString &name) const
Definition: docfmt.cxx:2069
long GetTextLeft() const
void DeleteAndDestroyAll(bool keepDefault=false)
Definition: docfmt.cxx:2080
void RegisterToPageDesc(SwPageDesc &)
Definition: atrfrm.cxx:699
bool isBOXATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:509
bool IsTextNode() const
Definition: node.hxx:636
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_HIGHLIGHT(42)
bool IsAuto() const
Query / set AutoFormat-flag.
Definition: format.hxx:158
OUString sCommand
Definition: swdbdata.hxx:31
Merge GetRedlineMergeFlag() const
Definition: node.hxx:97
void CopyBookmarks(const SwPaM &rPam, SwPosition &rCpyPam)
SwFrameFormatsBase m_Array
sal_uInt16 Which() const
constexpr TypedWhichId< SvxAdjustItem > RES_PARATR_ADJUST(64)
void BroadcastStyleOperation(const OUString &rName, SfxStyleFamily eFamily, SfxHintId nOp)
Definition: docdesc.cxx:600
constexpr TypedWhichId< SfxStringItem > RES_PARATR_LIST_ID(RES_PARATR_LIST_BEGIN)
constexpr TypedWhichId< SvXMLAttrContainerItem > RES_TXTATR_UNKNOWN_CONTAINER(54)
SwTableBoxFormat * MakeTableBoxFormat()
Definition: docfmt.cxx:1705
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: docfmt.cxx:1976
const SfxPoolItem * GetCurItem() const
SwTextFormatColl & GetNextTextFormatColl() const
Definition: fmtcol.hxx:97
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1315
std::pair< SwTextNode *, SwTextNode * > GetFirstAndLastNode(SwRootFrame const &rLayout, SwNodeIndex const &rPos)
Definition: txtfrm.cxx:351
const SwFormatINetFormat & GetINetFormat() const
Definition: txatbase.hxx:224
std::unique_ptr< SwGrfFormatColl > mpDfltGrfFormatColl
Definition: doc.hxx:234
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:844
SvNumberFormatterIndexTable * MergeFormatter(SvNumberFormatter &rNewTable)
void SetPoolDefaultItem(const SfxPoolItem &)
SwNumRule * GetOutlineNumRule() const
Definition: doc.hxx:1021
bool isPARATR_LIST(const sal_uInt16 nWhich)
Definition: hintids.hxx:493
static SwStartNode * MakeEmptySection(const SwNodeIndex &rIdx, SwStartNodeType=SwNormalStartNode)
Create an empty section of Start- and EndNote.
Definition: nodes.cxx:1875
Base class of the Writer document model elements.
Definition: node.hxx:79
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:838
const SvxNumberType & GetNumType() const
Definition: pagedesc.hxx:193