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 <osl/diagnose.h>
30 #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>
52 #include <rootfrm.hxx>
53 #include <txtfrm.hxx>
54 #include <hints.hxx>
55 #include <ndtxt.hxx>
56 #include <pam.hxx>
57 #include <UndoCore.hxx>
58 #include <UndoAttribute.hxx>
59 #include <UndoInsert.hxx>
60 #include <pagedesc.hxx>
61 #include <rolbck.hxx>
62 #include <mvsave.hxx>
63 #include <txatbase.hxx>
64 #include <swtblfmt.hxx>
65 #include <charfmt.hxx>
66 #include <docary.hxx>
67 #include <paratr.hxx>
68 #include <redline.hxx>
69 #include <reffld.hxx>
70 #include <fmtinfmt.hxx>
71 #include <breakit.hxx>
72 #include <SwUndoFmt.hxx>
73 #include <UndoManager.hxx>
74 #include <swmodule.hxx>
75 #include <modcfg.hxx>
76 #include <frameformats.hxx>
77 #include <memory>
78 
79 using namespace ::com::sun::star::i18n;
80 using namespace ::com::sun::star::lang;
81 using namespace ::com::sun::star::uno;
82 
83 /*
84  * Internal functions
85  */
86 
87 static void SetTextFormatCollNext( SwTextFormatColl* pTextColl, const SwTextFormatColl* pDel )
88 {
89  if ( &pTextColl->GetNextTextFormatColl() == pDel )
90  {
91  pTextColl->SetNextTextFormatColl( *pTextColl );
92  }
93 }
94 
95 static bool lcl_RstAttr( const SwNodePtr& rpNd, void* pArgs )
96 {
98  SwContentNode* pNode = rpNd->GetContentNode();
99  if (pPara && pPara->pLayout && pPara->pLayout->HasMergedParas()
100  && pNode && pNode->GetRedlineMergeFlag() == SwNode::Merge::Hidden)
101  {
102  return true;
103  }
104  if( pNode && pNode->HasSwAttrSet() )
105  {
106  const bool bLocked = pNode->IsModifyLocked();
107  pNode->LockModify();
108 
109  SwDoc& rDoc = pNode->GetDoc();
110 
111  // remove unused attribute RES_LR_SPACE
112  // add list attributes
113  SfxItemSet aSavedAttrsSet(
114  rDoc.GetAttrPool(),
115  svl::Items<
118  RES_PAGEDESC, RES_BREAK>{});
119  const SfxItemSet* pAttrSetOfNode = pNode->GetpSwAttrSet();
120 
121  std::vector<sal_uInt16> aClearWhichIds;
122  // restoring all paragraph list attributes
123  {
124  SfxItemSet aListAttrSet( rDoc.GetAttrPool(), svl::Items<RES_PARATR_LIST_BEGIN, RES_PARATR_LIST_END - 1>{} );
125  aListAttrSet.Set(*pAttrSetOfNode);
126  if ( aListAttrSet.Count() )
127  {
128  aSavedAttrsSet.Put(aListAttrSet);
129  SfxItemIter aIter( aListAttrSet );
130  const SfxPoolItem* pItem = aIter.GetCurItem();
131  while( pItem )
132  {
133  aClearWhichIds.push_back( pItem->Which() );
134  pItem = aIter.NextItem();
135  }
136  }
137  }
138 
139  const SfxPoolItem* pItem;
140 
141  sal_uInt16 const aSavIds[3] = { RES_PAGEDESC, RES_BREAK, RES_PARATR_NUMRULE };
142  for (sal_uInt16 aSavId : aSavIds)
143  {
144  if (SfxItemState::SET == pAttrSetOfNode->GetItemState(aSavId, false, &pItem))
145  {
146  bool bSave = false;
147  switch( aSavId )
148  {
149  case RES_PAGEDESC:
150  bSave = nullptr != pItem->StaticWhichCast(RES_PAGEDESC).GetPageDesc();
151  break;
152  case RES_BREAK:
153  bSave = SvxBreak::NONE != pItem->StaticWhichCast(RES_BREAK).GetBreak();
154  break;
155  case RES_PARATR_NUMRULE:
156  bSave = !pItem->StaticWhichCast(RES_PARATR_NUMRULE).GetValue().isEmpty();
157  break;
158  }
159  if( bSave )
160  {
161  aSavedAttrsSet.Put(*pItem);
162  aClearWhichIds.push_back(aSavId);
163  }
164  }
165  }
166 
167  // do not clear items directly from item set and only clear to be kept
168  // attributes, if no deletion item set is found.
169  const bool bKeepAttributes =
170  !pPara || !pPara->pDelSet || pPara->pDelSet->Count() == 0;
171  if ( bKeepAttributes )
172  {
173  pNode->ResetAttr( aClearWhichIds );
174  }
175 
176  if( !bLocked )
177  pNode->UnlockModify();
178 
179  if( pPara )
180  {
181  SwRegHistory aRegH( pNode, *pNode, pPara->pHistory );
182 
183  if( pPara->pDelSet && pPara->pDelSet->Count() )
184  {
185  OSL_ENSURE( !bKeepAttributes,
186  "<lcl_RstAttr(..)> - certain attributes are kept, but not needed." );
187  SfxItemIter aIter( *pPara->pDelSet );
188  for (pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
189  {
190  if ( ( pItem->Which() != RES_PAGEDESC &&
191  pItem->Which() != RES_BREAK &&
192  pItem->Which() != RES_PARATR_NUMRULE ) ||
193  ( aSavedAttrsSet.GetItemState( pItem->Which(), false ) != SfxItemState::SET ) )
194  {
195  pNode->ResetAttr( pItem->Which() );
196  }
197  }
198  }
199  else if( pPara->bResetAll )
200  pNode->ResetAllAttr();
201  else
202  pNode->ResetAttr( RES_PARATR_BEGIN, POOLATTR_END - 1 );
203  }
204  else
205  pNode->ResetAllAttr();
206 
207  // only restore saved attributes, if needed
208  if (bKeepAttributes && aSavedAttrsSet.Count())
209  {
210  pNode->LockModify();
211 
212  pNode->SetAttr(aSavedAttrsSet);
213 
214  if( !bLocked )
215  pNode->UnlockModify();
216  }
217  }
218  return true;
219 }
220 
221 void SwDoc::RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark,
222  bool bExactRange, SwRootFrame const*const pLayout)
223 {
224  SwHistory* pHst = nullptr;
225  SwDataChanged aTmp( rRg );
226  if (GetIDocumentUndoRedo().DoesUndo())
227  {
228  std::unique_ptr<SwUndoResetAttr> pUndo(new SwUndoResetAttr( rRg, RES_CHRFMT ));
229  pHst = &pUndo->GetHistory();
230  GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
231  }
232  const SwPosition *pStt = rRg.Start(), *pEnd = rRg.End();
234  pStt, pEnd, pHst, nullptr, pLayout );
235  aPara.bInclRefToxMark = bInclRefToxMark;
236  aPara.bExactRange = bExactRange;
237  GetNodes().ForEach( pStt->nNode.GetIndex(), pEnd->nNode.GetIndex()+1,
240 }
241 
242 void SwDoc::ResetAttrs( const SwPaM &rRg,
243  bool bTextAttr,
244  const o3tl::sorted_vector<sal_uInt16> &rAttrs,
245  const bool bSendDataChangedEvents,
246  SwRootFrame const*const pLayout)
247 {
248  SwPaM* pPam = const_cast<SwPaM*>(&rRg);
249  if( !bTextAttr && !rAttrs.empty() && RES_TXTATR_END > *(rAttrs.begin()) )
250  bTextAttr = true;
251 
252  if( !rRg.HasMark() )
253  {
254  SwTextNode* pTextNd = rRg.GetPoint()->nNode.GetNode().GetTextNode();
255  if( !pTextNd )
256  return ;
257 
258  pPam = new SwPaM( *rRg.GetPoint() );
259 
260  SwIndex& rSt = pPam->GetPoint()->nContent;
261  sal_Int32 nMkPos, nPtPos = rSt.GetIndex();
262 
263  // Special case: if the Cursor is located within a URL attribute, we take over it's area
264  SwTextAttr const*const pURLAttr(
265  pTextNd->GetTextAttrAt(rSt.GetIndex(), RES_TXTATR_INETFMT));
266  if (pURLAttr && !pURLAttr->GetINetFormat().GetValue().isEmpty())
267  {
268  nMkPos = pURLAttr->GetStart();
269  nPtPos = *pURLAttr->End();
270  }
271  else
272  {
274  Boundary aBndry = g_pBreakIt->GetBreakIter()->getWordBoundary(
275  pTextNd->GetText(), nPtPos,
276  g_pBreakIt->GetLocale( pTextNd->GetLang( nPtPos ) ),
277  WordType::ANY_WORD /*ANYWORD_IGNOREWHITESPACES*/,
278  true);
279 
280  if( aBndry.startPos < nPtPos && nPtPos < aBndry.endPos )
281  {
282  nMkPos = aBndry.startPos;
283  nPtPos = aBndry.endPos;
284  }
285  else
286  {
287  nPtPos = nMkPos = rSt.GetIndex();
288  if( bTextAttr )
289  pTextNd->DontExpandFormat( rSt );
290  }
291  }
292 
293  rSt = nMkPos;
294  pPam->SetMark();
295  pPam->GetPoint()->nContent = nPtPos;
296  }
297 
298  // #i96644#
299  std::unique_ptr< SwDataChanged > xDataChanged;
300  if ( bSendDataChangedEvents )
301  {
302  xDataChanged.reset( new SwDataChanged( *pPam ) );
303  }
304  SwHistory* pHst = nullptr;
305  if (GetIDocumentUndoRedo().DoesUndo())
306  {
307  std::unique_ptr<SwUndoResetAttr> pUndo(new SwUndoResetAttr( rRg,
308  bTextAttr ? sal_uInt16(RES_CONDTXTFMTCOLL) : sal_uInt16(RES_TXTFMTCOLL) ));
309  if( !rAttrs.empty() )
310  {
311  pUndo->SetAttrs( rAttrs );
312  }
313  pHst = &pUndo->GetHistory();
314  GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
315  }
316 
317  const SwPosition *pStt = pPam->Start(), *pEnd = pPam->End();
319  pStt, pEnd, pHst, nullptr, pLayout);
320 
321  // mst: not including META here; it seems attrs with CH_TXTATR are omitted
326  for( auto it = rAttrs.rbegin(); it != rAttrs.rend(); ++it )
327  {
328  if( POOLATTR_END > *it )
329  aDelSet.Put( *GetDfltAttr( *it ));
330  }
331  if( aDelSet.Count() )
332  aPara.pDelSet = &aDelSet;
333 
334  bool bAdd = true;
335  SwNodeIndex aTmpStt( pStt->nNode );
336  SwNodeIndex aTmpEnd( pEnd->nNode );
337  if( pStt->nContent.GetIndex() ) // just one part
338  {
339  // set up a later, and all CharFormatAttr -> TextFormatAttr
340  SwTextNode* pTNd = aTmpStt.GetNode().GetTextNode();
341  if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() )
342  {
343  if (pHst)
344  {
345  SwRegHistory history(pTNd, *pTNd, pHst);
346  pTNd->FormatToTextAttr(pTNd);
347  }
348  else
349  {
350  pTNd->FormatToTextAttr(pTNd);
351  }
352  }
353 
354  ++aTmpStt;
355  }
356  if( pEnd->nContent.GetIndex() == pEnd->nNode.GetNode().GetContentNode()->Len() )
357  {
358  // set up a later, and all CharFormatAttr -> TextFormatAttr
359  ++aTmpEnd;
360  bAdd = false;
361  }
362  else if( pStt->nNode != pEnd->nNode || !pStt->nContent.GetIndex() )
363  {
364  SwTextNode* pTNd = aTmpEnd.GetNode().GetTextNode();
365  if( pTNd && pTNd->HasSwAttrSet() && pTNd->GetpSwAttrSet()->Count() )
366  {
367  if (pHst)
368  {
369  SwRegHistory history(pTNd, *pTNd, pHst);
370  pTNd->FormatToTextAttr(pTNd);
371  }
372  else
373  {
374  pTNd->FormatToTextAttr(pTNd);
375  }
376  }
377  }
378 
379  if( aTmpStt < aTmpEnd )
380  GetNodes().ForEach( pStt->nNode, aTmpEnd, lcl_RstAttr, &aPara );
381  else if( !rRg.HasMark() )
382  {
383  aPara.bResetAll = false ;
384  ::lcl_RstAttr( &pStt->nNode.GetNode(), &aPara );
385  aPara.bResetAll = true ;
386  }
387 
388  if( bTextAttr )
389  {
390  if( bAdd )
391  ++aTmpEnd;
393  }
394 
396 
397  xDataChanged.reset(); //before delete pPam
398 
399  if( pPam != &rRg )
400  delete pPam;
401 }
402 
404 void SwDoc::UpdateRsid( const SwPaM &rRg, const sal_Int32 nLen )
405 {
406  if (!SW_MOD()->GetModuleConfig()->IsStoreRsid())
407  return;
408 
409  SwTextNode *pTextNode = rRg.GetPoint()->nNode.GetNode().GetTextNode();
410  if (!pTextNode)
411  {
412  return;
413  }
414  const sal_Int32 nStart(rRg.GetPoint()->nContent.GetIndex() - nLen);
416 
418  aSet.Put(aRsid);
419  bool const bRet(pTextNode->SetAttr(aSet, nStart,
420  rRg.GetPoint()->nContent.GetIndex()));
421 
422  if (bRet && GetIDocumentUndoRedo().DoesUndo())
423  {
424  SwUndo *const pLastUndo = GetUndoManager().GetLastUndo();
425  SwUndoInsert *const pUndoInsert(dynamic_cast<SwUndoInsert*>(pLastUndo));
426  // this function is called after Insert so expects to find SwUndoInsert
427  assert(pUndoInsert);
428  if (pUndoInsert)
429  {
430  pUndoInsert->SetWithRsid();
431  }
432  }
433 }
434 
435 bool SwDoc::UpdateParRsid( SwTextNode *pTextNode, sal_uInt32 nVal )
436 {
437  if (!SW_MOD()->GetModuleConfig()->IsStoreRsid())
438  return false;
439 
440  if (!pTextNode)
441  {
442  return false;
443  }
444 
445  SvxRsidItem aRsid( nVal ? nVal : mnRsid, RES_PARATR_RSID );
446  return pTextNode->SetAttr( aRsid );
447 }
448 
451 void SwDoc::SetAttr( const SfxPoolItem& rAttr, SwFormat& rFormat )
452 {
453  SfxItemSet aSet( GetAttrPool(), {{rAttr.Which(), rAttr.Which()}} );
454  aSet.Put( rAttr );
455  SetAttr( aSet, rFormat );
456 }
457 
460 void SwDoc::SetAttr( const SfxItemSet& rSet, SwFormat& rFormat )
461 {
462  if (GetIDocumentUndoRedo().DoesUndo())
463  {
464  SwUndoFormatAttrHelper aTmp( rFormat );
465  rFormat.SetFormatAttr( rSet );
466  if ( aTmp.GetUndo() )
467  {
469  }
470  else
471  {
473  }
474  }
475  else
476  {
477  rFormat.SetFormatAttr( rSet );
478  }
480 }
481 
482 void SwDoc::ResetAttrAtFormat( const sal_uInt16 nWhichId,
483  SwFormat& rChangedFormat )
484 {
485  std::unique_ptr<SwUndo> pUndo;
486  if (GetIDocumentUndoRedo().DoesUndo())
487  pUndo.reset(new SwUndoFormatResetAttr( rChangedFormat, nWhichId ));
488 
489  const bool bAttrReset = rChangedFormat.ResetFormatAttr( nWhichId );
490 
491  if ( bAttrReset )
492  {
493  if ( pUndo )
494  {
495  GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
496  }
497 
499  }
500 }
501 
502 static bool lcl_SetNewDefTabStops( SwTwips nOldWidth, SwTwips nNewWidth,
503  SvxTabStopItem& rChgTabStop )
504 {
505  // Set the default values of all TabStops to the new value.
506  // Attention: we always work with the PoolAttribute here, so that
507  // we don't calculate the same value on the same TabStop (pooled!) for all sets.
508  // We send a FormatChg to modify.
509 
510  sal_uInt16 nOldCnt = rChgTabStop.Count();
511  if( !nOldCnt || nOldWidth == nNewWidth )
512  return false;
513 
514  // Find the default's beginning
515  sal_uInt16 n;
516  for( n = nOldCnt; n ; --n )
517  if( SvxTabAdjust::Default != rChgTabStop[n - 1].GetAdjustment() )
518  break;
519  ++n;
520  if( n < nOldCnt ) // delete the DefTabStops
521  rChgTabStop.Remove( n, nOldCnt - n );
522  return true;
523 }
524 
527 void SwDoc::SetDefault( const SfxPoolItem& rAttr )
528 {
529  SfxItemSet aSet( GetAttrPool(), {{rAttr.Which(), rAttr.Which()}} );
530  aSet.Put( rAttr );
531  SetDefault( aSet );
532 }
533 
534 void SwDoc::SetDefault( const SfxItemSet& rSet )
535 {
536  if( !rSet.Count() )
537  return;
538 
539  sw::BroadcastingModify aCallMod;
540  SwAttrSet aOld( GetAttrPool(), rSet.GetRanges() ),
541  aNew( GetAttrPool(), rSet.GetRanges() );
542  SfxItemIter aIter( rSet );
543  const SfxPoolItem* pItem = aIter.GetCurItem();
544  SfxItemPool* pSdrPool = GetAttrPool().GetSecondaryPool();
545  do
546  {
547  bool bCheckSdrDflt = false;
548  const sal_uInt16 nWhich = pItem->Which();
549  aOld.Put( GetAttrPool().GetDefaultItem( nWhich ) );
550  GetAttrPool().SetPoolDefaultItem( *pItem );
551  aNew.Put( GetAttrPool().GetDefaultItem( nWhich ) );
552 
553  if (isCHRATR(nWhich) || isTXTATR(nWhich))
554  {
555  aCallMod.Add( mpDfltTextFormatColl.get() );
556  aCallMod.Add( mpDfltCharFormat.get() );
557  bCheckSdrDflt = nullptr != pSdrPool;
558  }
559  else if ( isPARATR(nWhich) ||
560  isPARATR_LIST(nWhich) )
561  {
562  aCallMod.Add( mpDfltTextFormatColl.get() );
563  bCheckSdrDflt = nullptr != pSdrPool;
564  }
565  else if (isGRFATR(nWhich))
566  {
567  aCallMod.Add( mpDfltGrfFormatColl.get() );
568  }
569  else if (isFRMATR(nWhich) || isDrawingLayerAttribute(nWhich) )
570  {
571  aCallMod.Add( mpDfltGrfFormatColl.get() );
572  aCallMod.Add( mpDfltTextFormatColl.get() );
573  aCallMod.Add( mpDfltFrameFormat.get() );
574  }
575  else if (isBOXATR(nWhich))
576  {
577  aCallMod.Add( mpDfltFrameFormat.get() );
578  }
579 
580  // also copy the defaults
581  if( bCheckSdrDflt )
582  {
583  sal_uInt16 nSlotId = GetAttrPool().GetSlotId( nWhich );
584  if( 0 != nSlotId && nSlotId != nWhich )
585  {
586  sal_uInt16 nEdtWhich = pSdrPool->GetWhich( nSlotId );
587  if( 0 != nEdtWhich && nSlotId != nEdtWhich )
588  {
589  std::unique_ptr<SfxPoolItem> pCpy(pItem->Clone());
590  pCpy->SetWhich( nEdtWhich );
591  pSdrPool->SetPoolDefaultItem( *pCpy );
592  }
593  }
594  }
595 
596  pItem = aIter.NextItem();
597  } while (pItem);
598 
599  if( aNew.Count() && aCallMod.HasWriterListeners() )
600  {
602  {
603  GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoDefaultAttr>( aOld, *this ) );
604  }
605 
606  const SfxPoolItem* pTmpItem;
607  if( ( SfxItemState::SET ==
608  aNew.GetItemState( RES_PARATR_TABSTOP, false, &pTmpItem ) ) &&
609  pTmpItem->StaticWhichCast(RES_PARATR_TABSTOP).Count() )
610  {
611  // Set the default values of all TabStops to the new value.
612  // Attention: we always work with the PoolAttribute here, so that
613  // we don't calculate the same value on the same TabStop (pooled!) for all sets.
614  // We send a FormatChg to modify.
615  SwTwips nNewWidth = pTmpItem->StaticWhichCast(RES_PARATR_TABSTOP)[ 0 ].GetTabPos(),
616  nOldWidth = aOld.Get(RES_PARATR_TABSTOP)[ 0 ].GetTabPos();
617 
618  bool bChg = false;
619  for (const SfxPoolItem* pItem2 : GetAttrPool().GetItemSurrogates(RES_PARATR_TABSTOP))
620  {
621  if(auto pTabStopItem = pItem2->DynamicWhichCast(RES_PARATR_TABSTOP))
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.CallSwClientNotify(sw::LegacyModifyHint( &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.CallSwClientNotify(sw::LegacyModifyHint( &aChgOld, &aChgNew )); // all changed are sent
642  }
643 
644  // remove the default formats from the object again
645  SwIterator<SwClient, sw::BroadcastingModify> 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( std::u16string_view 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 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 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 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->HasMergedParas())
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 = pItem->StaticWhichCast(RES_PARATR_NUMRULE).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( RES_PAGEDESC, false, &pItem )
1297  && pItem->StaticWhichCast(RES_PAGEDESC).GetPageDesc() )
1298  {
1299  SwFormatPageDesc aPageDesc( pItem->StaticWhichCast(RES_PAGEDESC) );
1300  const OUString& rNm = aPageDesc.GetPageDesc()->GetName();
1301  SwPageDesc* pPageDesc = FindPageDesc( rNm );
1302  if( !pPageDesc )
1303  {
1304  pPageDesc = MakePageDesc(rNm);
1305  }
1306  aPageDesc.RegisterToPageDesc( *pPageDesc );
1307  SwAttrSet aTmpAttrSet( pSrc->GetAttrSet() );
1308  aTmpAttrSet.Put( aPageDesc );
1309  pDest->SetFormatAttr( aTmpAttrSet );
1310  }
1311  else
1312  {
1313  pDest->SetFormatAttr( pSrc->GetAttrSet() );
1314  }
1315 
1316  pDest->SetPoolFormatId( pSrc->GetPoolFormatId() );
1317  pDest->SetPoolHelpId( pSrc->GetPoolHelpId() );
1318 
1319  // Always set the HelpFile Id to default!
1320  pDest->SetPoolHlpFileId( UCHAR_MAX );
1321 
1322  if( pSrc->DerivedFrom() )
1323  pDest->SetDerivedFrom( FindFormatByName( rDestArr,
1324  pSrc->DerivedFrom()->GetName() ) );
1325  if( RES_TXTFMTCOLL == pSrc->Which() ||
1326  RES_CONDTXTFMTCOLL == pSrc->Which() )
1327  {
1328  SwTextFormatColl* pSrcColl = static_cast<SwTextFormatColl*>(pSrc),
1329  * pDstColl = static_cast<SwTextFormatColl*>(pDest);
1330  if( &pSrcColl->GetNextTextFormatColl() != pSrcColl )
1331  pDstColl->SetNextTextFormatColl( *static_cast<SwTextFormatColl*>(FindFormatByName(
1332  rDestArr, pSrcColl->GetNextTextFormatColl().GetName() ) ) );
1333 
1334  if(pSrcColl->IsAssignedToListLevelOfOutlineStyle())
1335  pDstColl->AssignToListLevelOfOutlineStyle(pSrcColl->GetAssignedOutlineStyleLevel());
1336 
1337 //FEATURE::CONDCOLL
1338  if( RES_CONDTXTFMTCOLL == pSrc->Which() )
1339  {
1340  if (pDstColl->Which() != RES_CONDTXTFMTCOLL)
1341  {
1342  // Target already had a style with a matching name, but it's not a conditional
1343  // style, then don't copy the conditions.
1344  continue;
1345  }
1346 
1347  // Copy the conditions, but delete the old ones first!
1348  static_cast<SwConditionTextFormatColl*>(pDstColl)->SetConditions(
1349  static_cast<SwConditionTextFormatColl*>(pSrc)->GetCondColls() );
1350  }
1351 //FEATURE::CONDCOLL
1352  }
1353  }
1354 }
1355 
1357  const SwFrameFormat& rSrcFormat, SwFrameFormat& rDestFormat )
1358 {
1359  // Treat the header and footer attributes in the right way:
1360  // Copy content nodes across documents!
1361  sal_uInt16 nAttr = bCpyHeader ? sal_uInt16(RES_HEADER) : sal_uInt16(RES_FOOTER);
1362  const SfxPoolItem* pItem;
1363  if( SfxItemState::SET != rSrcFormat.GetAttrSet().GetItemState( nAttr, false, &pItem ))
1364  return ;
1365 
1366  // The header only contains the reference to the format from the other document!
1367  std::unique_ptr<SfxPoolItem> pNewItem(pItem->Clone());
1368 
1369  SwFrameFormat* pOldFormat;
1370  if( bCpyHeader )
1371  pOldFormat = pNewItem->StaticWhichCast(RES_HEADER).GetHeaderFormat();
1372  else
1373  pOldFormat = pNewItem->StaticWhichCast(RES_FOOTER).GetFooterFormat();
1374 
1375  if( !pOldFormat )
1376  return;
1377 
1378  SwFrameFormat* pNewFormat = new SwFrameFormat( GetAttrPool(), "CpyDesc",
1379  GetDfltFrameFormat() );
1380  pNewFormat->CopyAttrs( *pOldFormat );
1381 
1382  if( SfxItemState::SET == pNewFormat->GetAttrSet().GetItemState(
1383  RES_CNTNT, false, &pItem ))
1384  {
1386  if( pContent->GetContentIdx() )
1387  {
1388  SwNodeIndex aTmpIdx( GetNodes().GetEndOfAutotext() );
1389  const SwNodes& rSrcNds = rSrcFormat.GetDoc()->GetNodes();
1390  SwStartNode* pSttNd = SwNodes::MakeEmptySection( aTmpIdx,
1391  bCpyHeader
1393  : SwFooterStartNode );
1394  const SwNode& rCSttNd = pContent->GetContentIdx()->GetNode();
1395  SwNodeRange aRg( rCSttNd, 0, *rCSttNd.EndOfSectionNode() );
1396  aTmpIdx = *pSttNd->EndOfSectionNode();
1397  rSrcNds.Copy_( aRg, aTmpIdx );
1398  aTmpIdx = *pSttNd;
1399  rSrcFormat.GetDoc()->GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRg, nullptr, aTmpIdx);
1400  // TODO: investigate calling CopyWithFlyInFly?
1401  SwPaM const source(aRg.aStart, aRg.aEnd);
1402  SwPosition dest(aTmpIdx);
1403  sw::CopyBookmarks(source, dest);
1404  pNewFormat->SetFormatAttr( SwFormatContent( pSttNd ));
1405  }
1406  else
1407  pNewFormat->ResetFormatAttr( RES_CNTNT );
1408  }
1409  if( bCpyHeader )
1410  pNewItem->StaticWhichCast(RES_HEADER).RegisterToFormat(*pNewFormat);
1411  else
1412  pNewItem->StaticWhichCast(RES_FOOTER).RegisterToFormat(*pNewFormat);
1413  rDestFormat.SetFormatAttr( *pNewItem );
1414 }
1415 
1416 void SwDoc::CopyPageDesc( const SwPageDesc& rSrcDesc, SwPageDesc& rDstDesc,
1417  bool bCopyPoolIds )
1418 {
1419  bool bNotifyLayout = false;
1421 
1422  rDstDesc.SetLandscape( rSrcDesc.GetLandscape() );
1423  rDstDesc.SetNumType( rSrcDesc.GetNumType() );
1424  if( rDstDesc.ReadUseOn() != rSrcDesc.ReadUseOn() )
1425  {
1426  rDstDesc.WriteUseOn( rSrcDesc.ReadUseOn() );
1427  bNotifyLayout = true;
1428  }
1429 
1430  if( bCopyPoolIds )
1431  {
1432  rDstDesc.SetPoolFormatId( rSrcDesc.GetPoolFormatId() );
1433  rDstDesc.SetPoolHelpId( rSrcDesc.GetPoolHelpId() );
1434  // Always set the HelpFile Id to default!
1435  rDstDesc.SetPoolHlpFileId( UCHAR_MAX );
1436  }
1437 
1438  if( rSrcDesc.GetFollow() != &rSrcDesc )
1439  {
1440  const SwPageDesc* pSrcFollow = rSrcDesc.GetFollow();
1441  SwPageDesc* pFollow = FindPageDesc( pSrcFollow->GetName() );
1442  if( !pFollow )
1443  {
1444  // copy
1445  pFollow = MakePageDesc( pSrcFollow->GetName() );
1446  CopyPageDesc( *pSrcFollow, *pFollow );
1447  }
1448  rDstDesc.SetFollow( pFollow );
1449  bNotifyLayout = true;
1450  }
1451 
1452  // the header and footer attributes are copied separately
1453  // the content sections have to be copied in their entirety
1454  {
1455  SfxItemSet aAttrSet( rSrcDesc.GetMaster().GetAttrSet() );
1456  aAttrSet.ClearItem( RES_HEADER );
1457  aAttrSet.ClearItem( RES_FOOTER );
1458 
1459  rDstDesc.GetMaster().DelDiffs( aAttrSet );
1460  rDstDesc.GetMaster().SetFormatAttr( aAttrSet );
1461 
1462  aAttrSet.ClearItem();
1463  aAttrSet.Put( rSrcDesc.GetLeft().GetAttrSet() );
1464  aAttrSet.ClearItem( RES_HEADER );
1465  aAttrSet.ClearItem( RES_FOOTER );
1466 
1467  rDstDesc.GetLeft().DelDiffs( aAttrSet );
1468  rDstDesc.GetLeft().SetFormatAttr( aAttrSet );
1469 
1470  aAttrSet.ClearItem();
1471  aAttrSet.Put( rSrcDesc.GetFirstMaster().GetAttrSet() );
1472  aAttrSet.ClearItem( RES_HEADER );
1473  aAttrSet.ClearItem( RES_FOOTER );
1474 
1475  rDstDesc.GetFirstMaster().DelDiffs( aAttrSet );
1476  rDstDesc.GetFirstMaster().SetFormatAttr( aAttrSet );
1477 
1478  aAttrSet.ClearItem();
1479  aAttrSet.Put( rSrcDesc.GetFirstLeft().GetAttrSet() );
1480  aAttrSet.ClearItem( RES_HEADER );
1481  aAttrSet.ClearItem( RES_FOOTER );
1482 
1483  rDstDesc.GetFirstLeft().DelDiffs( aAttrSet );
1484  rDstDesc.GetFirstLeft().SetFormatAttr( aAttrSet );
1485  }
1486 
1487  CopyHeader( rSrcDesc.GetMaster(), rDstDesc.GetMaster() );
1488  CopyFooter( rSrcDesc.GetMaster(), rDstDesc.GetMaster() );
1489  if( !rDstDesc.IsHeaderShared() )
1490  CopyHeader( rSrcDesc.GetLeft(), rDstDesc.GetLeft() );
1491  else
1492  rDstDesc.GetLeft().SetFormatAttr( rDstDesc.GetMaster().GetHeader() );
1493  if( !rDstDesc.IsFirstShared() )
1494  {
1495  CopyHeader( rSrcDesc.GetFirstMaster(), rDstDesc.GetFirstMaster() );
1496  rDstDesc.GetFirstLeft().SetFormatAttr(rDstDesc.GetFirstMaster().GetHeader());
1497  }
1498  else
1499  {
1500  rDstDesc.GetFirstMaster().SetFormatAttr( rDstDesc.GetMaster().GetHeader() );
1501  rDstDesc.GetFirstLeft().SetFormatAttr(rDstDesc.GetLeft().GetHeader());
1502  }
1503 
1504  if( !rDstDesc.IsFooterShared() )
1505  CopyFooter( rSrcDesc.GetLeft(), rDstDesc.GetLeft() );
1506  else
1507  rDstDesc.GetLeft().SetFormatAttr( rDstDesc.GetMaster().GetFooter() );
1508  if( !rDstDesc.IsFirstShared() )
1509  {
1510  CopyFooter( rSrcDesc.GetFirstMaster(), rDstDesc.GetFirstMaster() );
1511  rDstDesc.GetFirstLeft().SetFormatAttr(rDstDesc.GetFirstMaster().GetFooter());
1512  }
1513  else
1514  {
1515  rDstDesc.GetFirstMaster().SetFormatAttr( rDstDesc.GetMaster().GetFooter() );
1516  rDstDesc.GetFirstLeft().SetFormatAttr(rDstDesc.GetLeft().GetFooter());
1517  }
1518 
1519  if( bNotifyLayout && pTmpRoot )
1520  {
1521  for( auto aLayout : GetAllLayouts() )
1522  aLayout->AllCheckPageDescs();
1523  }
1524 
1525  // If foot notes change the pages have to be triggered
1526  if( !(rDstDesc.GetFootnoteInfo() == rSrcDesc.GetFootnoteInfo()) )
1527  {
1528  sw::PageFootnoteHint aHint;
1529  rDstDesc.SetFootnoteInfo( rSrcDesc.GetFootnoteInfo() );
1530  rDstDesc.GetMaster().CallSwClientNotify(aHint);
1531  rDstDesc.GetLeft().CallSwClientNotify(aHint);
1532  rDstDesc.GetFirstMaster().CallSwClientNotify(aHint);
1533  rDstDesc.GetFirstLeft().CallSwClientNotify(aHint);
1534  }
1535 
1536  // Copy the stashed formats as well between the page descriptors...
1537  for (bool bFirst : { true, false })
1538  for (bool bLeft : { true, false })
1539  for (bool bHeader : { true, false })
1540  {
1541  if (!bLeft && !bFirst)
1542  continue;
1543  if (auto pStashedFormat = rSrcDesc.GetStashedFrameFormat(bHeader, bLeft, bFirst))
1544  rDstDesc.StashFrameFormat(*pStashedFormat, bHeader, bLeft, bFirst);
1545  }
1546 }
1547 
1548 void SwDoc::ReplaceStyles( const SwDoc& rSource, bool bIncludePageStyles )
1549 {
1550  ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
1551 
1558 
1559  //To-Do:
1560  // a) in rtf export don't export our hideous pgdsctbl
1561  // extension to rtf anymore
1562  // b) in sd rtf import (View::InsertData) don't use
1563  // a super-fragile test for mere presence of \trowd to
1564  // indicate import of rtf into a table
1565  // c) then drop use of bIncludePageStyles
1566  if (bIncludePageStyles)
1567  {
1568  // and now the page templates
1569  SwPageDescs::size_type nCnt = rSource.m_PageDescs.size();
1570  if( nCnt )
1571  {
1572  // a different Doc -> Number formatter needs to be merged
1573  SwTableNumFormatMerge aTNFM( rSource, *this );
1574 
1575  // 1st step: Create all formats (skip the 0th - it's the default!)
1576  while( nCnt )
1577  {
1578  const SwPageDesc &rSrc = *rSource.m_PageDescs[ --nCnt ];
1579  if( nullptr == FindPageDesc( rSrc.GetName() ) )
1580  MakePageDesc( rSrc.GetName() );
1581  }
1582 
1583  // 2nd step: Copy all attributes, set the right parents
1584  for (SwPageDescs::size_type i = rSource.m_PageDescs.size(); i; )
1585  {
1586  const SwPageDesc &rSrc = *rSource.m_PageDescs[ --i ];
1587  SwPageDesc* pDesc = FindPageDesc( rSrc.GetName() );
1588  CopyPageDesc( rSrc, *pDesc);
1589  }
1590  }
1591  }
1592 
1593  // then there are the numbering templates
1594  const SwNumRuleTable::size_type nCnt = rSource.GetNumRuleTable().size();
1595  if( nCnt )
1596  {
1597  const SwNumRuleTable& rArr = rSource.GetNumRuleTable();
1598  for( SwNumRuleTable::size_type n = 0; n < nCnt; ++n )
1599  {
1600  const SwNumRule& rR = *rArr[ n ];
1601  SwNumRule* pNew = FindNumRulePtr( rR.GetName());
1602  if( pNew )
1603  pNew->CopyNumRule(*this, rR);
1604  else
1605  {
1606  if( !rR.IsAutoRule() )
1607  MakeNumRule( rR.GetName(), &rR );
1608  else
1609  {
1610  // as we reset all styles, there shouldn't be any unknown
1611  // automatic SwNumRules, because all should have been
1612  // created by the style copying!
1613  // So just warn and ignore.
1614  SAL_WARN( "sw.core", "Found unknown auto SwNumRule during reset!" );
1615  }
1616  }
1617  }
1618  }
1619 
1620  if (undoGuard.UndoWasEnabled())
1621  {
1622  // nodes array was modified!
1624  }
1625 
1627 }
1628 
1630  std::u16string_view rName )
1631 {
1632  SwFormat* pFnd = nullptr;
1633  for( size_t n = 0; n < rFormatArr.GetFormatCount(); ++n )
1634  {
1635  // Does the Doc already contain the template?
1636  if( rFormatArr.GetFormat(n)->HasName( rName ) )
1637  {
1638  pFnd = rFormatArr.GetFormat(n);
1639  break;
1640  }
1641  }
1642  return pFnd;
1643 }
1644 
1645 void SwDoc::MoveLeftMargin(const SwPaM& rPam, bool bRight, bool bModulus,
1646  SwRootFrame const*const pLayout)
1647 {
1648  SwHistory* pHistory = nullptr;
1649  if (GetIDocumentUndoRedo().DoesUndo())
1650  {
1651  std::unique_ptr<SwUndoMoveLeftMargin> pUndo(new SwUndoMoveLeftMargin( rPam, bRight,
1652  bModulus ));
1653  pHistory = &pUndo->GetHistory();
1654  GetIDocumentUndoRedo().AppendUndo( std::move(pUndo) );
1655  }
1656 
1657  const SvxTabStopItem& rTabItem = GetDefault( RES_PARATR_TABSTOP );
1658  const sal_Int32 nDefDist = rTabItem.Count() ? rTabItem[0].GetTabPos() : 1134;
1659  const SwPosition &rStt = *rPam.Start(), &rEnd = *rPam.End();
1660  SwNodeIndex aIdx( rStt.nNode );
1661  while( aIdx <= rEnd.nNode )
1662  {
1663  SwTextNode* pTNd = aIdx.GetNode().GetTextNode();
1664  if( pTNd )
1665  {
1666  pTNd = sw::GetParaPropsNode(*pLayout, aIdx);
1667  SvxLRSpaceItem aLS(pTNd->SwContentNode::GetAttr(RES_LR_SPACE).StaticWhichCast(RES_LR_SPACE));
1668 
1669  // #i93873# See also lcl_MergeListLevelIndentAsLRSpaceItem in thints.cxx
1670  if ( pTNd->AreListLevelIndentsApplicable() )
1671  {
1672  const SwNumRule* pRule = pTNd->GetNumRule();
1673  if ( pRule )
1674  {
1675  const int nListLevel = pTNd->GetActualListLevel();
1676  if ( nListLevel >= 0 )
1677  {
1678  const SwNumFormat& rFormat = pRule->Get(static_cast<sal_uInt16>(nListLevel));
1680  {
1681  aLS.SetTextLeft( rFormat.GetIndentAt() );
1682  aLS.SetTextFirstLineOffset( static_cast<short>(rFormat.GetFirstLineIndent()) );
1683  }
1684  }
1685  }
1686  }
1687 
1688  tools::Long nNext = aLS.GetTextLeft();
1689  if( bModulus )
1690  nNext = ( nNext / nDefDist ) * nDefDist;
1691 
1692  if( bRight )
1693  nNext += nDefDist;
1694  else
1695  if(nNext >0) // fdo#75936 set limit for decreasing indent
1696  nNext -= nDefDist;
1697 
1698  aLS.SetTextLeft( nNext );
1699 
1700  SwRegHistory aRegH( pTNd, *pTNd, pHistory );
1701  pTNd->SetAttr( aLS );
1702  aIdx = *sw::GetFirstAndLastNode(*pLayout, aIdx).second;
1703  }
1704  ++aIdx;
1705  }
1707 }
1708 
1709 bool SwDoc::DontExpandFormat( const SwPosition& rPos, bool bFlag )
1710 {
1711  bool bRet = false;
1712  SwTextNode* pTextNd = rPos.nNode.GetNode().GetTextNode();
1713  if( pTextNd )
1714  {
1715  bRet = pTextNd->DontExpandFormat( rPos.nContent, bFlag );
1716  if( bRet && GetIDocumentUndoRedo().DoesUndo() )
1717  {
1718  GetIDocumentUndoRedo().AppendUndo( std::make_unique<SwUndoDontExpandFormat>(rPos) );
1719  }
1720  }
1721  return bRet;
1722 }
1723 
1725 {
1727  pFormat->SetName("TableBox" + OUString::number(reinterpret_cast<sal_IntPtr>(pFormat)));
1729  return pFormat;
1730 }
1731 
1733 {
1735  pFormat->SetName("TableLine" + OUString::number(reinterpret_cast<sal_IntPtr>(pFormat)));
1737  return pFormat;
1738 }
1739 
1741 {
1742  if (mpNumberFormatter == nullptr)
1743  {
1744  LanguageType eLang = LANGUAGE_SYSTEM;
1750  };
1751 }
1752 
1754  : pNFormat( nullptr )
1755 {
1756  // a different Doc -> Number formatter needs to be merged
1757  if( &rSrc != &rDest )
1758  {
1759  SvNumberFormatter* pN = const_cast<SwDoc&>(rSrc).GetNumberFormatter( false );
1760  if( pN )
1761  {
1762  pNFormat = rDest.GetNumberFormatter();
1763  pNFormat->MergeFormatter( *pN );
1764  }
1765  }
1766 
1767  if( &rSrc != &rDest )
1769  MergeWithOtherDoc( rDest );
1770 }
1771 
1773 {
1774  if( pNFormat )
1776 }
1777 
1778 void SwDoc::SetTextFormatCollByAutoFormat( const SwPosition& rPos, sal_uInt16 nPoolId,
1779  const SfxItemSet* pSet )
1780 {
1781  SwPaM aPam( rPos );
1782  SwTextNode* pTNd = rPos.nNode.GetNode().GetTextNode();
1783  assert(pTNd);
1784 
1786  {
1787  // create the redline object
1788  const SwTextFormatColl& rColl = *pTNd->GetTextColl();
1789  SwRangeRedline* pRedl = new SwRangeRedline( RedlineType::FmtColl, aPam );
1790  pRedl->SetMark();
1791 
1792  // Only those items that are not set by the Set again in the Node
1793  // are of interest. Thus, we take the difference.
1794  SwRedlineExtraData_FormatColl aExtraData( rColl.GetName(),
1795  rColl.GetPoolFormatId() );
1796  if( pSet && pTNd->HasSwAttrSet() )
1797  {
1798  SfxItemSet aTmp( *pTNd->GetpSwAttrSet() );
1799  aTmp.Differentiate( *pSet );
1800  // we handle the adjust item separately
1801  const SfxPoolItem* pItem;
1802  if( SfxItemState::SET == pTNd->GetpSwAttrSet()->GetItemState(
1803  RES_PARATR_ADJUST, false, &pItem ))
1804  aTmp.Put( *pItem );
1805  aExtraData.SetItemSet( aTmp );
1806  }
1807  pRedl->SetExtraData( &aExtraData );
1808 
1809  //TODO: Undo is still missing!
1810  getIDocumentRedlineAccess().AppendRedline( pRedl, true );
1811  }
1812 
1813  SetTextFormatColl( aPam, getIDocumentStylePoolAccess().GetTextCollFromPool( nPoolId ) );
1814 
1815  if (pSet && pSet->Count())
1816  {
1817  aPam.SetMark();
1818  aPam.GetMark()->nContent.Assign(pTNd, pTNd->GetText().getLength());
1819  // sw_redlinehide: don't need layout currently because the only caller
1820  // passes in the properties node
1821  assert(static_cast<SwTextFrame const*>(pTNd->getLayoutFrame(nullptr))->GetTextNodeForParaProps() == pTNd);
1823  }
1824 }
1825 
1826 void SwDoc::SetFormatItemByAutoFormat( const SwPaM& rPam, const SfxItemSet& rSet )
1827 {
1828  SwTextNode* pTNd = rPam.GetPoint()->nNode.GetNode().GetTextNode();
1829  assert(pTNd);
1830 
1832 
1834  {
1835  // create the redline object
1836  SwRangeRedline* pRedl = new SwRangeRedline( RedlineType::Format, rPam );
1837  if( !pRedl->HasMark() )
1838  pRedl->SetMark();
1839 
1840  // Only those items that are not set by the Set again in the Node
1841  // are of interest. Thus, we take the difference.
1842  SwRedlineExtraData_Format aExtraData( rSet );
1843 
1844  pRedl->SetExtraData( &aExtraData );
1845 
1846  //TODO: Undo is still missing!
1847  getIDocumentRedlineAccess().AppendRedline( pRedl, true );
1848 
1850  }
1851 
1852  const sal_Int32 nEnd(rPam.End()->nContent.GetIndex());
1853  std::vector<sal_uInt16> whichIds;
1854  SfxItemIter iter(rSet);
1855  for (SfxPoolItem const* pItem = iter.GetCurItem(); pItem; pItem = iter.NextItem())
1856  {
1857  whichIds.push_back(pItem->Which());
1858  whichIds.push_back(pItem->Which());
1859  }
1860  whichIds.push_back(0);
1861  SfxItemSet currentSet(GetAttrPool(), whichIds.data());
1862  pTNd->GetParaAttr(currentSet, nEnd, nEnd);
1863  for (size_t i = 0; whichIds[i]; i += 2)
1864  { // yuk - want to explicitly set the pool defaults too :-/
1865  currentSet.Put(currentSet.Get(whichIds[i]));
1866  }
1867 
1869 
1870  // fdo#62536: DONTEXPAND does not work when there is already an AUTOFMT
1871  // here, so insert the old attributes as an empty hint to stop expand
1872  SwPaM endPam(*pTNd, nEnd);
1873  endPam.SetMark();
1874  getIDocumentContentOperations().InsertItemSet(endPam, currentSet);
1875 
1877 }
1878 
1879 void SwDoc::ChgFormat(SwFormat & rFormat, const SfxItemSet & rSet)
1880 {
1881  if (GetIDocumentUndoRedo().DoesUndo())
1882  {
1883  // copying <rSet> to <aSet>
1884  SfxItemSet aSet(rSet);
1885  // remove from <aSet> all items, which are already set at the format
1886  aSet.Differentiate(rFormat.GetAttrSet());
1887  // <aSet> contains now all *new* items for the format
1888 
1889  // copying current format item set to <aOldSet>
1890  SfxItemSet aOldSet(rFormat.GetAttrSet());
1891  // insert new items into <aOldSet>
1892  aOldSet.Put(aSet);
1893  // invalidate all new items in <aOldSet> in order to clear these items,
1894  // if the undo action is triggered.
1895  {
1896  SfxItemIter aIter(aSet);
1897 
1898  for (const SfxPoolItem* pItem = aIter.GetCurItem(); pItem; pItem = aIter.NextItem())
1899  {
1900  aOldSet.InvalidateItem(pItem->Which());
1901  }
1902  }
1903 
1905  std::make_unique<SwUndoFormatAttr>(aOldSet, rFormat, /*bSaveDrawPt*/true));
1906  }
1907 
1908  rFormat.SetFormatAttr(rSet);
1909 }
1910 
1911 void SwDoc::RenameFormat(SwFormat & rFormat, const OUString & sNewName,
1912  bool bBroadcast)
1913 {
1914  SfxStyleFamily eFamily = SfxStyleFamily::All;
1915 
1916  if (GetIDocumentUndoRedo().DoesUndo())
1917  {
1918  std::unique_ptr<SwUndo> pUndo;
1919 
1920  switch (rFormat.Which())
1921  {
1922  case RES_CHRFMT:
1923  pUndo.reset(new SwUndoRenameCharFormat(rFormat.GetName(), sNewName, *this));
1924  eFamily = SfxStyleFamily::Char;
1925  break;
1926  case RES_TXTFMTCOLL:
1927  pUndo.reset(new SwUndoRenameFormatColl(rFormat.GetName(), sNewName, *this));
1928  eFamily = SfxStyleFamily::Para;
1929  break;
1930  case RES_FRMFMT:
1931  pUndo.reset(new SwUndoRenameFrameFormat(rFormat.GetName(), sNewName, *this));
1932  eFamily = SfxStyleFamily::Frame;
1933  break;
1934 
1935  default:
1936  break;
1937  }
1938 
1939  if (pUndo)
1940  {
1941  GetIDocumentUndoRedo().AppendUndo(std::move(pUndo));
1942  }
1943  }
1944 
1945  rFormat.SetName(sNewName);
1946 
1947  if (bBroadcast)
1948  BroadcastStyleOperation(sNewName, eFamily, SfxHintId::StyleSheetModified);
1949 }
1950 
1952 {
1953  bool bOwns = false;
1954  if (!pWriter)
1955  {
1956  pWriter = xmlNewTextWriterFilename("nodes.xml", 0);
1957  xmlTextWriterSetIndent(pWriter,1);
1958  (void)xmlTextWriterSetIndentString(pWriter, BAD_CAST(" "));
1959  (void)xmlTextWriterStartDocument(pWriter, nullptr, nullptr, nullptr);
1960  bOwns = true;
1961  }
1962  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwDoc"));
1963  (void)xmlTextWriterWriteFormatAttribute(pWriter, BAD_CAST("ptr"), "%p", this);
1964 
1965  m_pNodes->dumpAsXml(pWriter);
1966  m_PageDescs.dumpAsXml(pWriter);
1967  maDBData.dumpAsXml(pWriter);
1968  mpMarkManager->dumpAsXml(pWriter);
1969  m_pUndoManager->dumpAsXml(pWriter);
1970  m_pDocumentSettingManager->dumpAsXml(pWriter);
1972  mpTextFormatCollTable->dumpAsXml(pWriter);
1973  mpCharFormatTable->dumpAsXml(pWriter);
1974  mpFrameFormatTable->dumpAsXml(pWriter, "frmFormatTable");
1975  mpSpzFrameFormatTable->dumpAsXml(pWriter, "spzFrameFormatTable");
1976  mpSectionFormatTable->dumpAsXml(pWriter);
1977  mpTableFrameFormatTable->dumpAsXml(pWriter, "tableFrameFormatTable");
1978  mpNumRuleTable->dumpAsXml(pWriter);
1981  if (const SdrModel* pModel = getIDocumentDrawModelAccess().GetDrawModel())
1982  pModel->dumpAsXml(pWriter);
1983 
1984  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("mbModified"));
1985  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("value"), BAD_CAST(OString::boolean(getIDocumentState().IsModified()).getStr()));
1986  (void)xmlTextWriterEndElement(pWriter);
1987 
1988  (void)xmlTextWriterEndElement(pWriter);
1989  if (bOwns)
1990  {
1991  (void)xmlTextWriterEndDocument(pWriter);
1992  xmlFreeTextWriter(pWriter);
1993  }
1994 }
1995 
1997 {
1998  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwDBData"));
1999 
2000  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("sDataSource"), BAD_CAST(sDataSource.toUtf8().getStr()));
2001  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("sCommand"), BAD_CAST(sCommand.toUtf8().getStr()));
2002  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("nCommandType"), BAD_CAST(OString::number(nCommandType).getStr()));
2003 
2004  (void)xmlTextWriterEndElement(pWriter);
2005 }
2006 
2007 std::set<Color> SwDoc::GetDocColors()
2008 {
2009  std::set<Color> aDocColors;
2010  SwAttrPool& rPool = GetAttrPool();
2011  const sal_uInt16 pAttribs[] = {RES_CHRATR_COLOR, RES_CHRATR_HIGHLIGHT, RES_BACKGROUND};
2012  for (sal_uInt16 nAttrib : pAttribs)
2013  {
2014  for (const SfxPoolItem* pItem : rPool.GetItemSurrogates(nAttrib))
2015  {
2016  auto pColorItem = static_cast<const SvxColorItem*>(pItem);
2017  Color aColor( pColorItem->GetValue() );
2018  if (COL_AUTO != aColor)
2019  aDocColors.insert(aColor);
2020  }
2021  }
2022  return aDocColors;
2023 }
2024 
2025 // #i69627#
2026 namespace docfunc
2027 {
2029  {
2030  // If a parent paragraph style of one of the paragraph styles, which
2031  // are assigned to the list levels of the outline style, has a list style
2032  // set or inherits a list style from its parent style, the outline style
2033  // has to be written as a normal list style to the OpenDocument file
2034  // format or the OpenOffice.org file format.
2035  bool bRet( false );
2036 
2037  const SwTextFormatColls* pTextFormatColls( rDoc.GetTextFormatColls() );
2038  if ( pTextFormatColls )
2039  {
2040  for ( auto pTextFormatColl : *pTextFormatColls )
2041  {
2042  if ( pTextFormatColl->IsDefault() ||
2043  ! pTextFormatColl->IsAssignedToListLevelOfOutlineStyle() )
2044  {
2045  continue;
2046  }
2047 
2048  const SwTextFormatColl* pParentTextFormatColl =
2049  dynamic_cast<const SwTextFormatColl*>( pTextFormatColl->DerivedFrom());
2050  if ( !pParentTextFormatColl )
2051  continue;
2052 
2053  if ( SfxItemState::SET == pParentTextFormatColl->GetItemState( RES_PARATR_NUMRULE ) )
2054  {
2055  // #i106218# consider that the outline style is set
2056  const SwNumRuleItem& rDirectItem = pParentTextFormatColl->GetNumRule();
2057  if ( rDirectItem.GetValue() != rDoc.GetOutlineNumRule()->GetName() )
2058  {
2059  bRet = true;
2060  break;
2061  }
2062  }
2063  }
2064 
2065  }
2066  return bRet;
2067  }
2068 }
2069 
2071  : m_PosIndex( m_Array.get<0>() )
2072  , m_TypeAndNameIndex( m_Array.get<1>() )
2073 {
2074 }
2075 
2077 {
2079 }
2080 
2082 {
2083  ByTypeAndName::iterator it = m_TypeAndNameIndex.find(
2084  boost::make_tuple(x->Which(), x->GetName(), x) );
2085  return m_Array.project<0>( it );
2086 }
2087 
2088 std::pair<SwFrameFormats::const_range_iterator,SwFrameFormats::const_range_iterator>
2089 SwFrameFormats::rangeFind( sal_uInt16 type, const OUString& name ) const
2090 {
2091  return m_TypeAndNameIndex.equal_range( boost::make_tuple(type, name) );
2092 }
2093 
2094 std::pair<SwFrameFormats::const_range_iterator,SwFrameFormats::const_range_iterator>
2096 {
2097  return rangeFind( x->Which(), x->GetName() );
2098 }
2099 
2100 void SwFrameFormats::DeleteAndDestroyAll( bool keepDefault )
2101 {
2102  if ( empty() )
2103  return;
2104  const int _offset = keepDefault ? 1 : 0;
2105  for( const_iterator it = begin() + _offset; it != end(); ++it )
2106  delete *it;
2107  if ( _offset )
2108  m_PosIndex.erase( begin() + _offset, end() );
2109  else
2110  m_Array.clear();
2111 }
2112 
2113 std::pair<SwFrameFormats::const_iterator,bool> SwFrameFormats::push_back( const value_type& x )
2114 {
2115  SAL_WARN_IF(x->m_ffList != nullptr, "sw.core", "Inserting already assigned item");
2116  assert(x->m_ffList == nullptr);
2117  x->m_ffList = this;
2118  return m_PosIndex.push_back( x );
2119 }
2120 
2122 {
2123  const_iterator const ret = find( x );
2124  SAL_WARN_IF(x->m_ffList != this, "sw.core", "Removing invalid / unassigned item");
2125  if (ret != end()) {
2126  assert( x == *ret );
2127  m_PosIndex.erase( ret );
2128  x->m_ffList = nullptr;
2129  return true;
2130  }
2131  return false;
2132 }
2133 
2135 {
2136  erase( begin() + index_ );
2137 }
2138 
2139 void SwFrameFormats::erase( const_iterator const& position )
2140 {
2141  (*position)->m_ffList = nullptr;
2142  m_PosIndex.erase( begin() + (position - begin()) );
2143 }
2144 
2146 {
2147  return (x.m_ffList == this);
2148 }
2149 
2150 bool SwFrameFormats::IsAlive(SwFrameFormat const*const p) const
2151 {
2152  return find(const_cast<SwFrameFormat*>(p)) != end();
2153 }
2154 
2156 {
2157  std::pair<iterator,bool> res = m_PosIndex.push_front( x );
2158  if( ! res.second )
2159  newDefault( res.first );
2160  return res.second;
2161 }
2162 
2164 {
2165  if (position == begin())
2166  return;
2167  m_PosIndex.relocate( begin(), position );
2168 }
2169 
2170 /* 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:686
const std::unique_ptr< ::sw::UndoManager > m_pUndoManager
Definition: doc.hxx:215
Starts a section of nodes in the document model.
Definition: node.hxx:312
bool UndoWasEnabled() const
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
SwFrameFormats * m_ffList
Definition: frmfmt.hxx:74
tools::Long GetFirstLineIndent() const
SwPageDescs m_PageDescs
Definition: doc.hxx:197
bool erase(const value_type &x)
Definition: docfmt.cxx:2121
void EnsureNumberFormatter()
Definition: docfmt.cxx:1740
sal_uLong GetIndex() const
Definition: node.hxx:291
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:1732
sal_Int32 nCommandType
Definition: swdbdata.hxx:32
void Add(SwClient *pDepend)
Definition: calbck.cxx:171
static SwFormat * FindFormatByName(const SwFormatsBase &rFormatArr, std::u16string_view rName)
Definition: docfmt.cxx:1629
int GetAssignedOutlineStyleLevel() const
Definition: fmtcol.cxx:599
Represents the style of a paragraph.
Definition: fmtcol.hxx:56
static bool lcl_SetNewDefTabStops(SwTwips nOldWidth, SwTwips nNewWidth, SvxTabStopItem &rChgTabStop)
Definition: docfmt.cxx:502
sal_uInt16 Count() const
Marks a position in the document model.
Definition: pam.hxx:35
constexpr TypedWhichId< SvxTabStopItem > RES_PARATR_TABSTOP(68)
bool HasName(std::u16string_view rName) const
Definition: format.hxx:116
Pagedescriptor Client of SwPageDesc that is "described" by the attribute.
Definition: fmtpdsc.hxx:35
SwFrameFormat & GetLeft()
Definition: pagedesc.hxx:240
bool IsDefault() const
Definition: format.hxx:113
bool UpdateParRsid(SwTextNode *pTextNode, sal_uInt32 nVal=0)
Definition: docfmt.cxx:435
size_t size() const
Definition: pagedesc.hxx:443
bool isCHRATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:471
void SetPoolHelpId(sal_uInt16 nId)
Definition: format.hxx:152
SwPageDesc * GetPageDesc()
Definition: fmtpdsc.hxx:61
std::pair< const_iterator, bool > push_back(const value_type &x)
Definition: docfmt.cxx:2113
SwCharFormat * MakeCharFormat(const OUString &rFormatName, SwCharFormat *pDerivedFrom, bool bBroadcast=false)
Definition: docfmt.cxx:843
const OUString & GetText() const
Definition: ndtxt.hxx:210
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:4898
bool isFRMATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:495
void SetPoolHelpId(sal_uInt16 const nId)
Definition: pagedesc.hxx:279
SvNumberFormatter * GetNumberFormatter(bool bCreate=true)
Definition: doc.hxx:1412
bool isTXTATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:483
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:2081
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
std::unique_ptr< SwNodes > m_pNodes
Definition: doc.hxx:195
virtual void SetModified()=0
Must be called manually at changes of format.
long Long
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
constexpr::Color COL_AUTO(ColorTransparency, 0xFF, 0xFF, 0xFF, 0xFF)
SwFrameFormat & GetFirstMaster()
Definition: pagedesc.hxx:241
constexpr TypedWhichId< SfxInt16Item > RES_PARATR_LIST_RESTARTVALUE(85)
bool IsAutoRule() const
Definition: numrule.hxx:230
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:1610
SwContentFrame * getLayoutFrame(const SwRootFrame *, const SwPosition *pPos=nullptr, std::pair< Point, bool > const *pViewPosAndCalcFrame=nullptr) const
Definition: node.cxx:1212
sal_Int64 n
ByPos & m_PosIndex
Definition: doc.hxx:187
constexpr sal_uInt16 RES_FRMATR_END(133)
TElementType * Next()
Definition: calbck.hxx:333
void DelDiffs(const SfxItemSet &rSet)
Delete all attributes that are not in rFormat.
Definition: format.cxx:672
SwFrameFormat * CopyFrameFormat(const SwFrameFormat &)
copy the frame format
Definition: docfmt.cxx:1149
constexpr TypedWhichId< SvxFormatBreakItem > RES_BREAK(94)
SwNode & GetNode() const
Definition: ndindex.hxx:119
bool isDrawingLayerAttribute(const sal_uInt16 nWhich)
Definition: hintids.hxx:499
const OUString & GetName() const
Definition: numrule.hxx:225
void RenameFormat(SwFormat &rFormat, const OUString &sNewName, bool bBroadcast=false)
Definition: docfmt.cxx:1911
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:4416
constexpr TypedWhichId< SwConditionTextFormatColl > RES_CONDTXTFMTCOLL(160)
SwGrfFormatColl * MakeGrfFormatColl(const OUString &rFormatName, SwGrfFormatColl *pDerivedFrom)
Definition: docfmt.cxx:937
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
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:1731
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:224
const_iterator end() const
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
bool HasWriterListeners() const
Definition: calbck.hxx:197
SwFrameFormat * FindFrameFormatByName(std::u16string_view rName) const
Definition: docfmt.cxx:734
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
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:4106
const SwFrameFormats * GetSpzFrameFormats() const
Definition: doc.hxx:743
SwFrameFormatsBase::value_type value_type
void ReplaceStyles(const SwDoc &rSource, bool bIncludePageStyles=true)
Definition: docfmt.cxx:1548
ByTypeAndName & m_TypeAndNameIndex
void SetFollow(const SwPageDesc *pNew)
Definition: pagedesc.hxx:315
constexpr TypedWhichId< SfxBoolItem > RES_PARATR_LIST_ISRESTART(84)
const OUString & GetName() const
Definition: pagedesc.hxx:197
SwFlyFrameFormat * MakeFlyFrameFormat(const OUString &rFormatName, SwFrameFormat *pDerivedFrom)
Create the formats.
Definition: docfmt.cxx:740
IDocumentDrawModelAccess const & getIDocumentDrawModelAccess() const
Definition: doc.cxx:155
bool IsAlive(SwFrameFormat const *) const
not so fast check that given format is still alive (i.e. contained here)
Definition: docfmt.cxx:2150
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:357
const SwPageFootnoteInfo & GetFootnoteInfo() const
Definition: pagedesc.hxx:206
const OUString & GetValue() const
Definition: fmtinfmt.hxx:75
const SfxPoolItem * NextItem()
bool IsAssignedToListLevelOfOutlineStyle() const
Definition: fmtcol.hxx:114
const SwCharFormat * GetDfltCharFormat() const
Definition: doc.hxx:752
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:243
bool isGRFATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:503
void SetFootnoteInfo(const SwPageFootnoteInfo &rNew)
Definition: pagedesc.hxx:208
SwIndex nContent
Definition: pam.hxx:38
void SetPoolFormatId(sal_uInt16 nId)
Definition: format.hxx:148
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:276
void ResetAttrs(const SwPaM &rRg, bool bTextAttr=true, const o3tl::sorted_vector< sal_uInt16 > &rAttrs=o3tl::sorted_vector< sal_uInt16 >(), const bool bSendDataChangedEvents=true, SwRootFrame const *pLayout=nullptr)
Reset attributes.
Definition: docfmt.cxx:242
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
A wrapper around SfxPoolItem to store the start position of (usually) a text portion, with an optional end.
Definition: txatbase.hxx:41
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:426
void SetLandscape(bool bNew)
Definition: pagedesc.hxx:201
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:451
void SetNextTextFormatColl(SwTextFormatColl &rNext)
Inline implementations.
Definition: fmtcol.hxx:257
SwFormat * MakeCharFormat_(const OUString &, SwFormat *, bool, bool)
Definition: docfmt.cxx:867
const OUString & GetName() const
Definition: format.hxx:115
SwBreakIt * g_pBreakIt
Definition: breakit.cxx:33
std::unique_ptr< SwNumRuleTable > mpNumRuleTable
Definition: doc.hxx:269
static bool IsFuzzing()
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Get the default attribute in this document.
Definition: docfmt.cxx:653
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:154
virtual void SetName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2471
sal_Int32 GetStart() const
Definition: txatbase.hxx:86
sal_uInt32 mnRsid
Definition: doc.hxx:295
std::unique_ptr< SwFrameFormats > mpSpzFrameFormatTable
Definition: doc.hxx:241
void SetFormatItemByAutoFormat(const SwPaM &rPam, const SfxItemSet &)
Definition: docfmt.cxx:1826
SwTextFormatColl * CopyTextColl(const SwTextFormatColl &rColl)
copy TextNodes
Definition: docfmt.cxx:1164
void SetPoolHlpFileId(sal_uInt8 const nId)
Definition: pagedesc.hxx:281
const SfxPoolItem * GetDfltAttr(sal_uInt16 nWhich)
Get the default attribute from corresponding default attribute table.
Definition: hints.cxx:153
bool empty() const
constexpr TypedWhichId< SwFrameFormat > RES_FRMFMT(155)
o3tl::sorted_vector< SwRootFrame * > GetAllLayouts()
Definition: doclay.cxx:1671
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:213
virtual ~SwFrameFormats() override
Definition: docfmt.cxx:2076
bool SetDerivedFrom(SwFormat *pDerivedFrom=nullptr)
0 is Default.
Definition: format.cxx:321
void CopyFlyInFlyImpl(const SwNodeRange &rRg, SwPaM const *const pCopiedPaM, const SwNodeIndex &rStartIdx, const bool bCopyFlyAtFly=false, SwCopyFlags flags=SwCopyFlags::Default) const
sal_uInt16 GetPoolFormatId() const
Get and set Pool style IDs.
Definition: format.hxx:147
constexpr TypedWhichId< SwFormatINetFormat > RES_TXTATR_INETFMT(51)
SwUndoFormatAttr * GetUndo() const
SwPageDesc * FindPageDesc(const OUString &rName, size_t *pPos=nullptr) const
Definition: docdesc.cxx:860
Base class for various Writer styles.
Definition: format.hxx:46
SwDBData maDBData
Definition: doc.hxx:203
constexpr TypedWhichId< SvxRsidItem > RES_PARATR_RSID(80)
virtual bool ResetAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: node.cxx:1653
void DelTextFormatColl(size_t nFormat, bool bBroadcast=false)
Definition: docfmt.cxx:948
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
bool IsHeaderShared() const
Definition: pagedesc.hxx:320
struct _xmlTextWriter * xmlTextWriterPtr
const SwAttrSet * GetpSwAttrSet() const
Definition: node.hxx:452
std::unique_ptr< SwTextFormatColls > mpTextFormatCollTable
Definition: doc.hxx:244
SwNumRule * FindNumRulePtr(const OUString &rName) const
Definition: docnum.cxx:2415
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:58
::sw::UndoManager & GetUndoManager()
Definition: doc.cxx:133
#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:1951
T & StaticWhichCast(TypedWhichId< T > nId)
static void SetTextFormatCollNext(SwTextFormatColl *pTextColl, const SwTextFormatColl *pDel)
Definition: docfmt.cxx:87
void ForEach(FnForEach_SwNodes fnForEach, void *pArgs=nullptr)
Definition: ndarr.hxx:143
void SetNumType(const SvxNumberType &rNew)
Definition: pagedesc.hxx:204
SwDoc & GetDoc()
Definition: node.hxx:212
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)
const SwFrameFormat * GetStashedFrameFormat(bool bHeader, bool bLeft, bool bFirst) const
Used to restore hidden header/footer formats.
Definition: pagedesc.cxx:445
SwIndex & Assign(SwIndexReg *, sal_Int32)
Definition: index.cxx:206
#define LANGUAGE_SYSTEM
const std::unique_ptr< ::sw::mark::MarkManager > mpMarkManager
Definition: doc.hxx:210
void SetAuto(bool bNew)
Definition: format.hxx:163
bool GetLandscape() const
Definition: pagedesc.hxx:200
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:2116
::sw::DocumentContentOperationsManager const & GetDocumentContentOperationsManager() const
Definition: doc.cxx:325
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:325
SwContentNode * GetContentNode()
Definition: node.hxx:619
SwPageDesc * MakePageDesc(const OUString &rName, const SwPageDesc *pCpy=nullptr, bool bRegardLanguage=true, bool bBroadcast=false)
Definition: docdesc.cxx:678
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:2007
UseOnPage ReadUseOn() const
Definition: pagedesc.hxx:237
std::unique_ptr< SwTextFormatColl > mpDfltTextFormatColl
Definition: doc.hxx:236
virtual void SetName(const OUString &rNewName, bool bBroadcast=false)
Definition: format.cxx:146
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: pagedesc.cxx:791
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:204
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: fldbas.cxx:210
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:2813
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: docredln.cxx:740
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:394
void LockModify()
Definition: calbck.hxx:203
SwPageDescsBase::size_type size_type
Definition: pagedesc.hxx:433
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:388
constexpr TypedWhichId< SwTextFormatColl > RES_TXTFMTCOLL(157)
Marks a node in the document model.
Definition: ndindex.hxx:31
bool IsFooterShared() const
Definition: pagedesc.hxx:324
constexpr sal_uInt16 RES_UNKNOWNATR_END(154)
virtual const SwFieldTypes * GetFieldTypes() const =0
bool mbIsAutoFormatRedline
Definition: doc.hxx:312
virtual sal_uInt16 ResetAllAttr()
Definition: node.cxx:1725
bool HasSwAttrSet() const
Definition: node.hxx:453
sal_uInt16 GetSlotId(sal_uInt16 nWhich) const
std::unique_ptr< SwGrfFormatColls > mpGrfFormatCollTable
Definition: doc.hxx:245
tuple index
bool empty() const
void SetPoolFormatId(sal_uInt16 const nId)
Definition: pagedesc.hxx:277
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:123
const_reverse_iterator rend() const
virtual SwFormatColl * ChgFormatColl(SwFormatColl *)
Definition: node.cxx:1247
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:895
void SetTextFormatCollByAutoFormat(const SwPosition &rPos, sal_uInt16 nPoolId, const SfxItemSet *pSet)
Definition: docfmt.cxx:1778
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
SvxNumPositionAndSpaceMode GetPositionAndSpaceMode() const
void Add(const SfxPoolItem *pOldValue, const SfxPoolItem *pNewValue, sal_uLong nNodeIdx)
Definition: rolbck.cxx:1035
std::unique_ptr< SwUndoFormatAttr > ReleaseUndo()
SvNumberFormatter * mpNumberFormatter
Definition: doc.hxx:267
tools::Long SwTwips
Definition: swtypes.hxx:49
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
const SwPosition * Start() const
Definition: pam.hxx:212
constexpr TypedWhichId< SwFormatContent > RES_CNTNT(95)
const SwNumRuleItem & GetNumRule(bool=true) const
Definition: paratr.hxx:233
void ResetAttrAtFormat(const sal_uInt16 nWhichId, SwFormat &rChangedFormat)
Definition: docfmt.cxx:482
void RstTextAttrs(const SwPaM &rRg, bool bInclRefToxMark=false, bool bExactRange=false, SwRootFrame const *pLayout=nullptr)
Definition: docfmt.cxx:221
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:487
SwGrfFormatColl * CopyGrfColl(const SwGrfFormatColl &rColl)
copy the graphic nodes
Definition: docfmt.cxx:1232
const SwPageDesc * GetFollow() const
Definition: pagedesc.hxx:268
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:746
const_iterator begin() const
void AssignToListLevelOfOutlineStyle(const int nAssignedListLevel)
Definition: fmtcol.cxx:606
constexpr TypedWhichId< SvxRsidItem > RES_CHRATR_RSID(39)
constexpr sal_uInt16 RES_UNKNOWNATR_BEGIN(RES_BOXATR_END)
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:450
css::uno::Reference< css::i18n::XBreakIterator > const & GetBreakIter() const
Definition: breakit.hxx:62
std::unique_ptr< SwSectionFormats > mpSectionFormatTable
Definition: doc.hxx:242
SfxItemPool * GetSecondaryPool() const
static bool lcl_RstAttr(const SwNodePtr &rpNd, void *pArgs)
Definition: docfmt.cxx:95
ignore Redlines
sal_uInt16 Which() const
for Querying of Writer-functions.
Definition: format.hxx:82
constexpr TypedWhichId< SvxColorItem > RES_CHRATR_COLOR(3)
void CopyPageDescHeaderFooterImpl(bool bCpyHeader, const SwFrameFormat &rSrcFormat, SwFrameFormat &rDestFormat)
Definition: docfmt.cxx:1356
const_reverse_iterator rbegin() const
const SwNumFormat & Get(sal_uInt16 i) const
Definition: number.cxx:79
bool IsModifyLocked() const
Definition: calbck.hxx:205
SwFormat * DerivedFrom() const
Definition: format.hxx:112
SwTextFormatColl * FindTextFormatCollByName(std::u16string_view rName) const
Definition: doc.hxx:800
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:527
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:239
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
SwTableNumFormatMerge(const SwDoc &rSrc, SwDoc &rDest)
Definition: docfmt.cxx:1753
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
SwUndo * GetLastUndo()
Definition: docundo.cxx:235
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:1416
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:1645
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:624
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
constexpr sal_uInt16 RES_TXTATR_END(RES_TXTATR_NOEND_END)
void SetInvalidRule(bool bFlag)
Definition: number.cxx:927
virtual bool SetAttr(const SfxPoolItem &)
made virtual
Definition: node.cxx:1558
const SwCharFormats * GetCharFormats() const
Definition: doc.hxx:739
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:404
ByPos::const_iterator const_iterator
void CopyFooter(const SwFrameFormat &rSrcFormat, SwFrameFormat &rDestFormat)
Copy footer (with contents) from SrcFormat to DestFormat.
Definition: doc.hxx:900
sal_uInt16 GetPoolHelpId() const
Get and set Help-IDs for document templates.
Definition: format.hxx:151
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:174
const SwTextFormatColls * GetTextFormatColls() const
Definition: doc.hxx:779
std::unique_ptr< SwCharFormat > mpDfltCharFormat
Definition: doc.hxx:235
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: docredln.cxx:89
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:242
const SwNumRuleTable & GetNumRuleTable() const
Definition: doc.hxx:1067
bool DontExpandFormat(const SwPosition &rPos, bool bFlag=true)
Definition: docfmt.cxx:1709
constexpr TypedWhichId< SwCharFormat > RES_CHRFMT(RES_FMT_BEGIN)
std::unique_ptr< SwCharFormats > mpCharFormatTable
Definition: doc.hxx:240
sal_Int32 GetIndex() const
Definition: index.hxx:91
void WriteUseOn(UseOnPage const eNew)
Definition: pagedesc.hxx:236
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:408
Item2Range GetItemSurrogates(sal_uInt16 nWhich) const
const SwPosition * End() const
Definition: pam.hxx:217
std::unique_ptr< SwFrameFormats > mpFrameFormatTable
Definition: doc.hxx:239
LanguageType GetLang(const sal_Int32 nBegin, const sal_Int32 nLen=0, sal_uInt16 nScript=0) const
Definition: thints.cxx:3424
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:159
const sal_Int32 * End() const
Definition: txatbase.hxx:152
sal_uInt16 GetPoolHelpId() const
Definition: pagedesc.hxx:278
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:2449
size_t GetTableFrameFormatCount(bool bUsed) const
Definition: docfmt.cxx:758
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
Get reference.
Definition: reffld.hxx:65
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:324
bool HasOutlineStyleToBeWrittenAsNormalListStyle(SwDoc &rDoc)
method to check, if the outline style has to written as a normal list style
Definition: docfmt.cxx:2028
void ChgFormat(SwFormat &rFormat, const SfxItemSet &rSet)
Definition: docfmt.cxx:1879
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:2145
std::unique_ptr< SwFrameFormat > mpDfltFrameFormat
Definition: doc.hxx:232
SwFormatColl * GetFormatColl() const
Definition: node.hxx:456
bool newDefault(const value_type &x)
Definition: docfmt.cxx:2155
bool HasMergedParas() const
Definition: rootfrm.hxx:424
virtual SwFieldType * GetSysFieldType(const SwFieldIds eWhich) const =0
SvNumberFormatter * pNFormat
Definition: mvsave.hxx:181
bool IsFirstShared() const
Definition: pagedesc.cxx:396
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:478
const std::unique_ptr< ::sw::DocumentSettingManager > m_pDocumentSettingManager
Definition: doc.hxx:216
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:120
void FormatToTextAttr(SwTextNode *pNd)
Convey attributes of an AttrSet (AutoFormat) to SwpHintsArray.
Definition: thints.cxx:2516
virtual const SwRedlineTable & GetRedlineTable() const =0
const SwFrameFormats * GetFrameFormats() const
Definition: doc.hxx:737
NF_EVALDATEFORMAT_FORMAT_INTL
std::pair< const_range_iterator, const_range_iterator > rangeFind(sal_uInt16 type, const OUString &name) const
Definition: docfmt.cxx:2089
void DeleteAndDestroyAll(bool keepDefault=false)
Definition: docfmt.cxx:2100
bool isBOXATR(const sal_uInt16 nWhich)
Definition: hintids.hxx:507
tools::Long GetIndentAt() const
bool IsTextNode() const
Definition: node.hxx:640
constexpr TypedWhichId< SvxBrushItem > RES_CHRATR_HIGHLIGHT(42)
bool IsAuto() const
Query / set AutoFormat-flag.
Definition: format.hxx:162
OUString sCommand
Definition: swdbdata.hxx:31
Merge GetRedlineMergeFlag() const
Definition: node.hxx:98
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:636
constexpr TypedWhichId< SfxStringItem > RES_PARATR_LIST_ID(RES_PARATR_LIST_BEGIN)
constexpr TypedWhichId< SvXMLAttrContainerItem > RES_TXTATR_UNKNOWN_CONTAINER(54)
SwTableBoxFormat * MakeTableBoxFormat()
Definition: docfmt.cxx:1724
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: docfmt.cxx:1996
const SfxPoolItem * GetCurItem() const
SwTextFormatColl & GetNextTextFormatColl() const
Definition: fmtcol.hxx:102
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1320
std::pair< SwTextNode *, SwTextNode * > GetFirstAndLastNode(SwRootFrame const &rLayout, SwNodeIndex const &rPos)
Definition: txtfrm.cxx:351
const SwFormatINetFormat & GetINetFormat() const
Definition: txatbase.hxx:228
std::unique_ptr< SwGrfFormatColl > mpDfltGrfFormatColl
Definition: doc.hxx:237
SwTextNode * GetTextNode()
Inline methods from Node.hxx.
Definition: ndtxt.hxx:845
SvNumberFormatterIndexTable * MergeFormatter(SvNumberFormatter &rNewTable)
void SetPoolDefaultItem(const SfxPoolItem &)
SwNumRule * GetOutlineNumRule() const
Definition: doc.hxx:1025
bool isPARATR_LIST(const sal_uInt16 nWhich)
Definition: hintids.hxx:491
void StashFrameFormat(const SwFrameFormat &rFormat, bool bHeader, bool bLeft, bool bFirst)
Remember original header/footer formats even when they are hidden by "sharing".
Definition: pagedesc.cxx:409
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:875
static SwStartNode * MakeEmptySection(const SwNodeIndex &rIdx, SwStartNodeType=SwNormalStartNode)
Create an empty section of Start- and EndNote.
Definition: nodes.cxx:1885
Base class of the Writer document model elements.
Definition: node.hxx:80
SwTextFormatColl * GetTextColl() const
Definition: ndtxt.hxx:839
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo
const SvxNumberType & GetNumType() const
Definition: pagedesc.hxx:203