LibreOffice Module sw (master)  1
docdesc.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 <cmdid.h>
21 #include <init.hxx>
22 #include <editeng/lrspitem.hxx>
23 #include <editeng/ulspitem.hxx>
24 #include <editeng/paperinf.hxx>
25 #include <editeng/frmdiritem.hxx>
26 #include <sfx2/bindings.hxx>
27 #include <sfx2/dispatch.hxx>
28 #include <tools/globname.hxx>
29 #include <sal/log.hxx>
30 #include <osl/diagnose.h>
32 #include <fmtfsize.hxx>
33 #include <fmthdft.hxx>
34 #include <fmtcntnt.hxx>
35 #include <ftninfo.hxx>
36 #include <fesh.hxx>
37 #include <ndole.hxx>
38 #include <mdiexp.hxx>
39 #include <doc.hxx>
40 #include <IDocumentUndoRedo.hxx>
43 #include <IDocumentState.hxx>
45 #include <rootfrm.hxx>
46 #include <poolfmt.hxx>
47 #include <docsh.hxx>
48 #include <ftnidx.hxx>
49 #include <fmtftn.hxx>
50 #include <txtftn.hxx>
51 #include <fldbas.hxx>
52 #include <strings.hrc>
53 #include <hints.hxx>
54 #include <SwUndoPageDesc.hxx>
55 #include <pagedeschint.hxx>
56 #include <tgrditem.hxx>
57 #include <unotools/configmgr.hxx>
58 #include <unotools/syslocale.hxx>
59 #include <svx/swframetypes.hxx>
60 #include <o3tl/unit_conversion.hxx>
61 
62 #include <com/sun/star/embed/XEmbeddedObject.hpp>
63 
64 using namespace com::sun::star;
65 
66 static void lcl_DefaultPageFormat( sal_uInt16 nPoolFormatId,
67  SwFrameFormat &rFormat1,
68  SwFrameFormat &rFormat2,
69  SwFrameFormat &rFormat3,
70  SwFrameFormat &rFormat4)
71 {
72  // --> #i41075# Printer on demand
73  // This function does not require a printer anymore.
74  // The default page size is obtained from the application
75  //locale
76 
78  const Size aPhysSize = SvxPaperInfo::GetDefaultPaperSize();
79  aFrameSize.SetSize( aPhysSize );
80 
81  // Prepare for default margins.
82  // Margins have a default minimum size.
83  // If the printer forces a larger margins, that's ok too.
84  // The HTML page desc had A4 as page size always.
85  // This has been changed to take the page size from the printer.
86  // Unfortunately, the margins of the HTML page desc are smaller than
87  // the margins used here in general, so one extra case is required.
88  // In the long term, this needs to be changed to always keep the
89  // margins from the page desc.
90  sal_Int32 nMinTop, nMinBottom, nMinLeft, nMinRight;
91  if( RES_POOLPAGE_HTML == nPoolFormatId )
92  {
93  nMinRight = nMinTop = nMinBottom = o3tl::convert(1, o3tl::Length::cm, o3tl::Length::twip);
95  }
96  else if (!utl::ConfigManager::IsFuzzing() && MeasurementSystem::Metric == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() )
97  {
98  nMinTop = nMinBottom = nMinLeft = nMinRight = 1134; // 2 centimeters
99  }
100  else
101  {
102  nMinTop = nMinBottom = 1440; // as in MS Word: 1 Inch
103  nMinLeft = nMinRight = 1800; // 1,25 Inch
104  }
105 
106  // set margins
109 
110  aUL.SetUpper( o3tl::narrowing<sal_uInt16>(nMinTop) );
111  aUL.SetLower( o3tl::narrowing<sal_uInt16>(nMinBottom) );
112  aLR.SetRight( nMinRight );
113  aLR.SetLeft( nMinLeft );
114 
115  rFormat1.SetFormatAttr( aFrameSize );
116  rFormat1.SetFormatAttr( aLR );
117  rFormat1.SetFormatAttr( aUL );
118 
119  rFormat2.SetFormatAttr( aFrameSize );
120  rFormat2.SetFormatAttr( aLR );
121  rFormat2.SetFormatAttr( aUL );
122 
123  rFormat3.SetFormatAttr( aFrameSize );
124  rFormat3.SetFormatAttr( aLR );
125  rFormat3.SetFormatAttr( aUL );
126 
127  rFormat4.SetFormatAttr( aFrameSize );
128  rFormat4.SetFormatAttr( aLR );
129  rFormat4.SetFormatAttr( aUL );
130 }
131 
132 static void lcl_DescSetAttr( const SwFrameFormat &rSource, SwFrameFormat &rDest,
133  const bool bPage = true )
134 {
135  // We should actually use ItemSet's Intersect here, but that doesn't work
136  // correctly if we have different WhichRanges.
137 
138  // Take over the attributes which are of interest.
139  sal_uInt16 const aIdArr[] = {
140  RES_FRM_SIZE, RES_UL_SPACE, // [83..86
141  RES_BACKGROUND, RES_SHADOW, // [99..101
142  RES_COL, RES_COL, // [103
143  RES_TEXTGRID, RES_TEXTGRID, // [109
144  RES_FRAMEDIR, RES_FRAMEDIR, // [114
149 
150  // take over DrawingLayer FillStyles
152 
153  0};
154 
155  const SfxPoolItem* pItem;
156  for( sal_uInt16 n = 0; aIdArr[ n ]; n += 2 )
157  {
158  for( sal_uInt16 nId = aIdArr[ n ]; nId <= aIdArr[ n+1]; ++nId )
159  {
160  // #i45539#
161  // bPage == true:
162  // All in aIdArr except from RES_HEADER_FOOTER_EAT_SPACING
163  // bPage == false:
164  // All in aIdArr except from RES_COL and RES_PAPER_BIN:
165  bool bExecuteId(true);
166 
167  if(bPage)
168  {
169  // When Page
170  switch(nId)
171  {
172  // All in aIdArr except from RES_HEADER_FOOTER_EAT_SPACING
174  // take out SvxBrushItem; it's the result of the fallback
175  // at SwFormat::GetItemState and not really in state SfxItemState::SET
176  case RES_BACKGROUND:
177  bExecuteId = false;
178  break;
179  default:
180  break;
181  }
182  }
183  else
184  {
185  // When not Page
186  switch(nId)
187  {
188  // When not Page: All in aIdArr except these:
189  case RES_COL:
190  case RES_PAPER_BIN:
192  case RES_RTL_GUTTER:
193  bExecuteId = false;
194  break;
195  default:
196  break;
197  }
198  }
199 
200  if(bExecuteId)
201  {
202  if (SfxItemState::SET == rSource.GetItemState(nId, false, &pItem))
203  {
204  rDest.SetFormatAttr(*pItem);
205  }
206  else
207  {
208  rDest.ResetFormatAttr(nId);
209  }
210  }
211  }
212  }
213 
214  // Transmit pool and help IDs too
215  rDest.SetPoolFormatId( rSource.GetPoolFormatId() );
216  rDest.SetPoolHelpId( rSource.GetPoolHelpId() );
217  rDest.SetPoolHlpFileId( rSource.GetPoolHlpFileId() );
218 }
219 
220 namespace
221 {
222  SwFrameFormat& getFrameFormat(SwPageDesc &rDesc, bool bLeft, bool bFirst)
223  {
224  if (bFirst)
225  {
226  if (bLeft)
227  return rDesc.GetFirstLeft();
228  return rDesc.GetFirstMaster();
229  }
230  return rDesc.GetLeft();
231  }
232 
233  const SwFrameFormat& getConstFrameFormat(const SwPageDesc &rDesc, bool bLeft, bool bFirst)
234  {
235  return getFrameFormat(const_cast<SwPageDesc&>(rDesc), bLeft, bFirst);
236  }
237 }
238 
239 void SwDoc::CopyMasterHeader(const SwPageDesc &rChged, const SwFormatHeader &rHead, SwPageDesc &rDesc, bool bLeft, bool bFirst)
240 {
241  assert(bLeft || bFirst);
242  SwFrameFormat& rDescFrameFormat = getFrameFormat(rDesc, bLeft, bFirst);
243  if (bFirst && bLeft)
244  {
245  // special case: always shared with something
246  rDescFrameFormat.SetFormatAttr( rChged.IsFirstShared()
247  ? rDesc.GetLeft().GetHeader()
248  : rDesc.GetFirstMaster().GetHeader());
249  }
250  else if ((bFirst ? rChged.IsFirstShared() : rChged.IsHeaderShared())
251  || !rHead.IsActive())
252  {
253  // Left or first shares the header with the Master.
254  rDescFrameFormat.SetFormatAttr( rDesc.GetMaster().GetHeader() );
255  }
256  else if ( rHead.IsActive() )
257  { // Left or first gets its own header if the Format doesn't already have one.
258  // If it already has one and it points to the same Section as the
259  // Right one, it needs to get an own Header.
260  // The content is evidently copied.
261  const SwFormatHeader &rFormatHead = rDescFrameFormat.GetHeader();
262  if ( !rFormatHead.IsActive() )
263  {
264  SwFormatHeader aHead( getIDocumentLayoutAccess().MakeLayoutFormat( RndStdIds::HEADERL, nullptr ) );
265  rDescFrameFormat.SetFormatAttr( aHead );
266  // take over additional attributes (margins, borders ...)
267  ::lcl_DescSetAttr( *rHead.GetHeaderFormat(), *aHead.GetHeaderFormat(), false);
268  }
269  else
270  {
271  const SwFrameFormat *pRight = rHead.GetHeaderFormat();
272  const SwFormatContent &aRCnt = pRight->GetContent();
273  const SwFormatContent &aCnt = rFormatHead.GetHeaderFormat()->GetContent();
274 
275  if (!aCnt.GetContentIdx())
276  {
277  const SwFrameFormat& rChgedFrameFormat = getConstFrameFormat(rChged, bLeft, bFirst);
278  rDescFrameFormat.SetFormatAttr( rChgedFrameFormat.GetHeader() );
279  }
280  else if ((*aRCnt.GetContentIdx() == *aCnt.GetContentIdx()) ||
281  // The ContentIdx is _always_ different when called from
282  // SwDocStyleSheet::SetItemSet, because it deep-copies the
283  // PageDesc. So check if it was previously shared.
284  (bFirst ? rDesc.IsFirstShared() : rDesc.IsHeaderShared()))
285  {
286  SwFrameFormat *pFormat = new SwFrameFormat( GetAttrPool(),
287  bFirst ? "First header" : "Left header",
288  GetDfltFrameFormat() );
289  ::lcl_DescSetAttr( *pRight, *pFormat, false );
290  // The section which the right header attribute is pointing
291  // is copied, and the Index to the StartNode is set to
292  // the left or first header attribute.
293  SwNodeIndex aTmp( GetNodes().GetEndOfAutotext() );
295  SwNodeRange aRange( aRCnt.GetContentIdx()->GetNode(), 0,
296  *aRCnt.GetContentIdx()->GetNode().EndOfSectionNode() );
297  aTmp = *pSttNd->EndOfSectionNode();
298  GetNodes().Copy_( aRange, aTmp, false );
299  aTmp = *pSttNd;
300  GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRange, nullptr, aTmp);
301  SwPaM const source(aRange.aStart, aRange.aEnd);
302  SwPosition dest(aTmp);
303  sw::CopyBookmarks(source, dest);
304  pFormat->SetFormatAttr( SwFormatContent( pSttNd ) );
305  rDescFrameFormat.SetFormatAttr( SwFormatHeader( pFormat ) );
306  }
307  else
308  ::lcl_DescSetAttr( *pRight,
309  *const_cast<SwFrameFormat*>(rFormatHead.GetHeaderFormat()), false );
310  }
311  }
312 }
313 
314 void SwDoc::CopyMasterFooter(const SwPageDesc &rChged, const SwFormatFooter &rFoot, SwPageDesc &rDesc, bool bLeft, bool bFirst)
315 {
316  assert(bLeft || bFirst);
317  SwFrameFormat& rDescFrameFormat = getFrameFormat(rDesc, bLeft, bFirst);
318  if (bFirst && bLeft)
319  {
320  // special case: always shared with something
321  rDescFrameFormat.SetFormatAttr( rChged.IsFirstShared()
322  ? rDesc.GetLeft().GetFooter()
323  : rDesc.GetFirstMaster().GetFooter());
324  }
325  else if ((bFirst ? rChged.IsFirstShared() : rChged.IsFooterShared())
326  || !rFoot.IsActive())
327  {
328  // Left or first shares the Header with the Master.
329  rDescFrameFormat.SetFormatAttr( rDesc.GetMaster().GetFooter() );
330  }
331  else if ( rFoot.IsActive() )
332  { // Left or first gets its own Footer if the Format does not already have one.
333  // If the Format already has a Footer and it points to the same section as the Right one,
334  // it needs to get an own one.
335  // The content is evidently copied.
336  const SwFormatFooter &rFormatFoot = rDescFrameFormat.GetFooter();
337  if ( !rFormatFoot.IsActive() )
338  {
339  SwFormatFooter aFoot( getIDocumentLayoutAccess().MakeLayoutFormat( RndStdIds::FOOTER, nullptr ) );
340  rDescFrameFormat.SetFormatAttr( aFoot );
341  // Take over additional attributes (margins, borders ...).
342  ::lcl_DescSetAttr( *rFoot.GetFooterFormat(), *aFoot.GetFooterFormat(), false);
343  }
344  else
345  {
346  const SwFrameFormat *pRight = rFoot.GetFooterFormat();
347  const SwFormatContent &aRCnt = pRight->GetContent();
348  const SwFormatContent &aLCnt = rFormatFoot.GetFooterFormat()->GetContent();
349  if( !aLCnt.GetContentIdx() )
350  {
351  const SwFrameFormat& rChgedFrameFormat = getConstFrameFormat(rChged, bLeft, bFirst);
352  rDescFrameFormat.SetFormatAttr( rChgedFrameFormat.GetFooter() );
353  }
354  else if ((*aRCnt.GetContentIdx() == *aLCnt.GetContentIdx()) ||
355  // The ContentIdx is _always_ different when called from
356  // SwDocStyleSheet::SetItemSet, because it deep-copies the
357  // PageDesc. So check if it was previously shared.
358  (bFirst ? rDesc.IsFirstShared() : rDesc.IsFooterShared()))
359  {
360  SwFrameFormat *pFormat = new SwFrameFormat( GetAttrPool(),
361  bFirst ? "First footer" : "Left footer",
362  GetDfltFrameFormat() );
363  ::lcl_DescSetAttr( *pRight, *pFormat, false );
364  // The section to which the right footer attribute is pointing
365  // is copied, and the Index to the StartNode is set to
366  // the left footer attribute.
367  SwNodeIndex aTmp( GetNodes().GetEndOfAutotext() );
369  SwNodeRange aRange( aRCnt.GetContentIdx()->GetNode(), 0,
370  *aRCnt.GetContentIdx()->GetNode().EndOfSectionNode() );
371  aTmp = *pSttNd->EndOfSectionNode();
372  GetNodes().Copy_( aRange, aTmp, false );
373  aTmp = *pSttNd;
374  GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRange, nullptr, aTmp);
375  SwPaM const source(aRange.aStart, aRange.aEnd);
376  SwPosition dest(aTmp);
377  sw::CopyBookmarks(source, dest);
378  pFormat->SetFormatAttr( SwFormatContent( pSttNd ) );
379  rDescFrameFormat.SetFormatAttr( SwFormatFooter( pFormat ) );
380  }
381  else
382  ::lcl_DescSetAttr( *pRight,
383  *const_cast<SwFrameFormat*>(rFormatFoot.GetFooterFormat()), false );
384  }
385  }
386 }
387 
388 void SwDoc::ChgPageDesc( size_t i, const SwPageDesc &rChged )
389 {
390  assert(i < m_PageDescs.size() && "PageDescs is out of range.");
391 
392  SwPageDesc& rDesc = *m_PageDescs[i];
393  SwRootFrame* pTmpRoot = getIDocumentLayoutAccess().GetCurrentLayout();
394 
395  if (GetIDocumentUndoRedo().DoesUndo())
396  {
397  // Stash header formats as needed.
398  const SwFormatHeader& rLeftHead = rChged.GetLeft().GetHeader();
399  const SwFormatHeader& rFirstMasterHead = rChged.GetFirstMaster().GetHeader();
400  const SwFormatHeader& rFirstLeftHead = rChged.GetFirstLeft().GetHeader();
401  const bool bStashLeftHead = !rDesc.IsHeaderShared() && rChged.IsHeaderShared();
402  const bool bStashFirstMasterHead = !rDesc.IsFirstShared() && rChged.IsFirstShared();
403  const bool bStashFirstLeftHead = (!rDesc.IsHeaderShared() && rChged.IsHeaderShared()) || (!rDesc.IsFirstShared() && rChged.IsFirstShared());
404  if (bStashLeftHead && rLeftHead.GetRegisteredIn() && !rDesc.HasStashedFormat(true, true, false))
405  rDesc.StashFrameFormat(rChged.GetLeft(), true, true, false);
406  if (bStashFirstMasterHead && rFirstMasterHead.GetRegisteredIn() && !rDesc.HasStashedFormat(true, false, true))
407  rDesc.StashFrameFormat(rChged.GetFirstMaster(), true, false, true);
408  if (bStashFirstLeftHead && rFirstLeftHead.GetRegisteredIn() && !rDesc.HasStashedFormat(true, true, true))
409  rDesc.StashFrameFormat(rChged.GetFirstLeft(), true, true, true);
410 
411  // Stash footer formats as needed.
412  const SwFormatFooter& rLeftFoot = rChged.GetLeft().GetFooter();
413  const SwFormatFooter& rFirstMasterFoot = rChged.GetFirstMaster().GetFooter();
414  const SwFormatFooter& rFirstLeftFoot = rChged.GetFirstLeft().GetFooter();
415  const bool bStashLeftFoot = !rDesc.IsFooterShared() && rChged.IsFooterShared();
416  const bool bStashFirstMasterFoot = !rDesc.IsFirstShared() && rChged.IsFirstShared();
417  const bool bStashFirstLeftFoot = (!rDesc.IsFooterShared() && rChged.IsFooterShared()) || (!rDesc.IsFirstShared() && rChged.IsFirstShared());
418  if (bStashLeftFoot && rLeftFoot.GetRegisteredIn() && !rDesc.HasStashedFormat(false, true, false))
419  rDesc.StashFrameFormat(rChged.GetLeft(), false, true, false);
420  if (bStashFirstMasterFoot && rFirstMasterFoot.GetRegisteredIn() && !rDesc.HasStashedFormat(false, false, true))
421  rDesc.StashFrameFormat(rChged.GetFirstMaster(), false, false, true);
422  if (bStashFirstLeftFoot && rFirstLeftFoot.GetRegisteredIn() && !rDesc.HasStashedFormat(false, true, true))
423  rDesc.StashFrameFormat(rChged.GetFirstLeft(), false, true, true);
424 
425  GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoPageDesc>(rDesc, rChged, this));
426  }
427  else
428  {
429  SwUndoId nBeingUndone(SwUndoId::EMPTY);
430  GetIDocumentUndoRedo().GetFirstRedoInfo(nullptr, &nBeingUndone);
431  if (SwUndoId::HEADER_FOOTER == nBeingUndone)
432  {
433  // The last format change is currently being undone. Remove header/footer and corresponding nodes.
434  auto rDescMasterHeaderFormat = rDesc.GetMaster().GetFormatAttr(RES_HEADER);
435  auto rDescLeftHeaderFormat = rDesc.GetLeft().GetFormatAttr(RES_HEADER);
436  auto rDescFirstLeftHeaderFormat = rDesc.GetFirstLeft().GetFormatAttr(RES_HEADER);
437  auto rDescMasterFooterFormat = rDesc.GetMaster().GetFormatAttr(RES_FOOTER);
438  auto rDescLeftFooterFormat = rDesc.GetLeft().GetFormatAttr(RES_FOOTER);
439  auto rDescFirstLeftFooterFormat = rDesc.GetFirstLeft().GetFormatAttr(RES_FOOTER);
440 
441  auto rChgedMasterHeaderFormat = rChged.GetMaster().GetFormatAttr(RES_HEADER);
442  auto rChgedLeftHeaderFormat = rChged.GetLeft().GetFormatAttr(RES_HEADER);
443  auto rChgedFirstLeftHeaderFormat = rChged.GetFirstLeft().GetFormatAttr(RES_HEADER);
444  auto rChgedMasterFooterFormat = rChged.GetMaster().GetFormatAttr(RES_FOOTER);
445  auto rChgedLeftFooterFormat = rChged.GetLeft().GetFormatAttr(RES_FOOTER);
446  auto rChgedFirstLeftFooterFormat = rChged.GetFirstLeft().GetFormatAttr(RES_FOOTER);
447 
448  rDesc.GetMaster().ResetFormatAttr(RES_HEADER);
449  rDesc.GetLeft().ResetFormatAttr(RES_HEADER);
450  rDesc.GetFirstLeft().ResetFormatAttr(RES_HEADER);
451  rDesc.GetMaster().ResetFormatAttr(RES_FOOTER);
452  rDesc.GetLeft().ResetFormatAttr(RES_FOOTER);
453  rDesc.GetFirstLeft().ResetFormatAttr(RES_FOOTER);
454 
455  auto lDelHFFormat = [this](SwClient* pToRemove, SwFrameFormat* pFormat)
456  {
457  // Code taken from lcl_DelHFFormat
458  pFormat->Remove(pToRemove);
459  SwFormatContent& rCnt = const_cast<SwFormatContent&>(pFormat->GetContent());
460  if (rCnt.GetContentIdx())
461  {
462  SwNode* pNode = nullptr;
463  {
464  SwNodeIndex aIdx(*rCnt.GetContentIdx(), 0);
465  pNode = &aIdx.GetNode();
466  sal_uInt32 nEnd = pNode->EndOfSectionIndex();
467  while (aIdx < nEnd)
468  {
469  if (pNode->IsContentNode() &&
470  static_cast<SwContentNode*>(pNode)->HasWriterListeners())
471  {
473  if (pShell)
474  {
475  pShell->ParkCursor(aIdx);
476  aIdx = nEnd - 1;
477  }
478  }
479  ++aIdx;
480  pNode = &aIdx.GetNode();
481  }
482  }
483  rCnt.SetNewContentIdx(nullptr);
484 
485  ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
486 
487  assert(pNode);
488  getIDocumentContentOperations().DeleteSection(pNode);
489  }
490  delete pFormat;
491  };
492 
493  if (rDescMasterHeaderFormat.GetHeaderFormat() && rDescMasterHeaderFormat != rChgedMasterHeaderFormat)
494  lDelHFFormat(&rDescMasterHeaderFormat, rDescMasterHeaderFormat.GetHeaderFormat());
495  else if (rDescLeftHeaderFormat.GetHeaderFormat() && rDescLeftHeaderFormat != rChgedLeftHeaderFormat)
496  lDelHFFormat(&rDescLeftHeaderFormat, rDescLeftHeaderFormat.GetHeaderFormat());
497  else if (rDescFirstLeftHeaderFormat.GetHeaderFormat() && rDescFirstLeftHeaderFormat != rChgedFirstLeftHeaderFormat)
498  lDelHFFormat(&rDescFirstLeftHeaderFormat, rDescFirstLeftHeaderFormat.GetHeaderFormat());
499 
500  else if (rDescMasterFooterFormat.GetFooterFormat() && rDescMasterFooterFormat != rChgedMasterFooterFormat)
501  lDelHFFormat(&rDescMasterFooterFormat, rDescMasterFooterFormat.GetFooterFormat());
502  else if (rDescLeftFooterFormat.GetFooterFormat() && rDescLeftFooterFormat != rChgedLeftFooterFormat)
503  lDelHFFormat(&rDescLeftFooterFormat, rDescLeftFooterFormat.GetFooterFormat());
504  else if (rDescFirstLeftFooterFormat.GetFooterFormat() && rDescFirstLeftFooterFormat != rChgedFirstLeftFooterFormat)
505  lDelHFFormat(&rDescFirstLeftFooterFormat, rDescFirstLeftFooterFormat.GetFooterFormat());
506  }
507  }
508  ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
509 
510  // Mirror at first if needed.
511  if ( rChged.GetUseOn() == UseOnPage::Mirror )
512  const_cast<SwPageDesc&>(rChged).Mirror();
513  else
514  {
515  // Or else transfer values from Master to Left
516  ::lcl_DescSetAttr(rChged.GetMaster(),
517  const_cast<SwPageDesc&>(rChged).GetLeft());
518  }
519  ::lcl_DescSetAttr(rChged.GetMaster(),
520  const_cast<SwPageDesc&>(rChged).GetFirstMaster());
521  ::lcl_DescSetAttr(rChged.GetLeft(),
522  const_cast<SwPageDesc&>(rChged).GetFirstLeft());
523 
524  // Take over NumType.
525  if( rChged.GetNumType().GetNumberingType() != rDesc.GetNumType().GetNumberingType() )
526  {
527  rDesc.SetNumType( rChged.GetNumType() );
528  // Notify page number fields that NumFormat has changed
529  getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::PageNumber )->UpdateFields();
530  getIDocumentFieldsAccess().GetSysFieldType( SwFieldIds::RefPageGet )->UpdateFields();
531 
532  // If the numbering scheme has changed we could have QuoVadis/ErgoSum texts
533  // that refer to a changed page, so we invalidate foot notes.
534  SwFootnoteIdxs& rFootnoteIdxs = GetFootnoteIdxs();
535  for( SwFootnoteIdxs::size_type nPos = 0; nPos < rFootnoteIdxs.size(); ++nPos )
536  {
537  SwTextFootnote *pTextFootnote = rFootnoteIdxs[ nPos ];
538  const SwFormatFootnote &rFootnote = pTextFootnote->GetFootnote();
539  pTextFootnote->SetNumber(rFootnote.GetNumber(), rFootnote.GetNumberRLHidden(), rFootnote.GetNumStr());
540  }
541  }
542 
543  // Take over orientation
544  rDesc.SetLandscape( rChged.GetLandscape() );
545 
546  // Synch header.
547  const SwFormatHeader& rMasterHead = rChged.GetMaster().GetHeader();
548  rDesc.GetMaster().SetFormatAttr( rMasterHead );
549  const bool bRestoreStashedLeftHead = rDesc.IsHeaderShared() && !rChged.IsHeaderShared();
550  const bool bRestoreStashedFirstMasterHead = rDesc.IsFirstShared() && !rChged.IsFirstShared();
551  const bool bRestoreStashedFirstLeftHead = (rDesc.IsHeaderShared() && !rChged.IsHeaderShared()) || (rDesc.IsFirstShared() && !rChged.IsFirstShared());
552  const SwFrameFormat* pStashedLeftFormat = bRestoreStashedLeftHead ? rChged.GetStashedFrameFormat(true, true, false) : nullptr;
553  const SwFrameFormat* pStashedFirstMasterFormat = bRestoreStashedFirstMasterHead ? rChged.GetStashedFrameFormat(true, false, true) : nullptr;
554  const SwFrameFormat* pStashedFirstLeftFormat = bRestoreStashedFirstLeftHead ? rChged.GetStashedFrameFormat(true, true, true) : nullptr;
555  CopyMasterHeader(rChged, pStashedLeftFormat ? pStashedLeftFormat->GetHeader() : rMasterHead, rDesc, true, false); // Copy left header
556  CopyMasterHeader(rChged, pStashedFirstMasterFormat ? pStashedFirstMasterFormat->GetHeader() : rMasterHead, rDesc, false, true); // Copy first master
557  CopyMasterHeader(rChged, pStashedFirstLeftFormat ? pStashedFirstLeftFormat->GetHeader() : rMasterHead, rDesc, true, true); // Copy first left
558 
559  if (pStashedLeftFormat)
560  rDesc.RemoveStashedFormat(true, true, false);
561 
562  if (pStashedFirstMasterFormat)
563  rDesc.RemoveStashedFormat(true, false, true);
564 
565  if (pStashedFirstLeftFormat)
566  rDesc.RemoveStashedFormat(true, true, true);
567 
568  rDesc.ChgHeaderShare( rChged.IsHeaderShared() );
569 
570  // Synch Footer.
571  const SwFormatFooter& rMasterFoot = rChged.GetMaster().GetFooter();
572  rDesc.GetMaster().SetFormatAttr( rMasterFoot );
573  const bool bRestoreStashedLeftFoot = rDesc.IsFooterShared() && !rChged.IsFooterShared();
574  const bool bRestoreStashedFirstMasterFoot = rDesc.IsFirstShared() && !rChged.IsFirstShared();
575  const bool bRestoreStashedFirstLeftFoot = (rDesc.IsFooterShared() && !rChged.IsFooterShared()) || (rDesc.IsFirstShared() && !rChged.IsFirstShared());
576  const SwFrameFormat* pStashedLeftFoot = bRestoreStashedLeftFoot ? rChged.GetStashedFrameFormat(false, true, false) : nullptr;
577  const SwFrameFormat* pStashedFirstMasterFoot = bRestoreStashedFirstMasterFoot ? rChged.GetStashedFrameFormat(false, false, true) : nullptr;
578  const SwFrameFormat* pStashedFirstLeftFoot = bRestoreStashedFirstLeftFoot ? rChged.GetStashedFrameFormat(false, true, true) : nullptr;
579  CopyMasterFooter(rChged, pStashedLeftFoot ? pStashedLeftFoot->GetFooter() : rMasterFoot, rDesc, true, false); // Copy left footer
580  CopyMasterFooter(rChged, pStashedFirstMasterFoot ? pStashedFirstMasterFoot->GetFooter() : rMasterFoot, rDesc, false, true); // Copy first master
581  CopyMasterFooter(rChged, pStashedFirstLeftFoot ? pStashedFirstLeftFoot->GetFooter() : rMasterFoot, rDesc, true, true); // Copy first left
582 
583  if (pStashedLeftFormat)
584  rDesc.RemoveStashedFormat(false, true, false);
585 
586  if (pStashedFirstMasterFoot)
587  rDesc.RemoveStashedFormat(false, false, true);
588 
589  if (pStashedFirstLeftFoot)
590  rDesc.RemoveStashedFormat(false, true, true);
591 
592  rDesc.ChgFooterShare( rChged.IsFooterShared() );
593  // there is just one first shared flag for both header and footer?
594  rDesc.ChgFirstShare( rChged.IsFirstShared() );
595 
596  if ( rDesc.GetName() != rChged.GetName() )
597  rDesc.SetName( rChged.GetName() );
598 
599  // A RegisterChange is triggered, if necessary
600  rDesc.SetRegisterFormatColl( rChged.GetRegisterFormatColl() );
601 
602  // If UseOn or the Follow change, the paragraphs need to know about it.
603  bool bUseOn = false;
604  bool bFollow = false;
605  if (rDesc.GetUseOn() != rChged.GetUseOn())
606  {
607  rDesc.SetUseOn( rChged.GetUseOn() );
608  bUseOn = true;
609  }
610  if (rDesc.GetFollow() != rChged.GetFollow())
611  {
612  if (rChged.GetFollow() == &rChged)
613  {
614  if (rDesc.GetFollow() != &rDesc)
615  {
616  rDesc.SetFollow( &rDesc );
617  bFollow = true;
618  }
619  }
620  else
621  {
622  rDesc.SetFollow( rChged.m_pFollow );
623  bFollow = true;
624  }
625  }
626 
627  if ( (bUseOn || bFollow) && pTmpRoot)
628  // Inform layout!
629  {
630  for( auto aLayout : GetAllLayouts() )
631  aLayout->AllCheckPageDescs();
632  }
633 
634  // Take over the page attributes.
635  ::lcl_DescSetAttr( rChged.GetMaster(), rDesc.GetMaster() );
636  ::lcl_DescSetAttr( rChged.GetLeft(), rDesc.GetLeft() );
637  ::lcl_DescSetAttr( rChged.GetFirstMaster(), rDesc.GetFirstMaster() );
638  ::lcl_DescSetAttr( rChged.GetFirstLeft(), rDesc.GetFirstLeft() );
639 
640  // If the FootnoteInfo changes, the pages are triggered.
641  if( !(rDesc.GetFootnoteInfo() == rChged.GetFootnoteInfo()) )
642  {
643  rDesc.SetFootnoteInfo( rChged.GetFootnoteInfo() );
644  sw::PageFootnoteHint aHint;
645  rDesc.GetMaster().CallSwClientNotify(aHint);
646  rDesc.GetLeft().CallSwClientNotify(aHint);
647  rDesc.GetFirstMaster().CallSwClientNotify(aHint);
648  rDesc.GetFirstLeft().CallSwClientNotify(aHint);
649  }
650  getIDocumentState().SetModified();
651 
652  SfxBindings* pBindings =
653  ( GetDocShell() && GetDocShell()->GetDispatcher() ) ? GetDocShell()->GetDispatcher()->GetBindings() : nullptr;
654  if ( pBindings )
655  {
656  pBindings->Invalidate( SID_ATTR_PAGE_COLUMN );
657  pBindings->Invalidate( SID_ATTR_PAGE );
658  pBindings->Invalidate( SID_ATTR_PAGE_SIZE );
659  pBindings->Invalidate( SID_ATTR_PAGE_ULSPACE );
660  pBindings->Invalidate( SID_ATTR_PAGE_LRSPACE );
661  }
662 
663  //h/f of first-left page must not be unique but same as first master or left
664  assert((rDesc.IsFirstShared())
665  ? rDesc.GetFirstLeft().GetHeader().GetHeaderFormat() == rDesc.GetLeft().GetHeader().GetHeaderFormat()
666  : rDesc.GetFirstLeft().GetHeader().GetHeaderFormat() == rDesc.GetFirstMaster().GetHeader().GetHeaderFormat());
667  assert((rDesc.IsFirstShared())
668  ? rDesc.GetFirstLeft().GetFooter().GetFooterFormat() == rDesc.GetLeft().GetFooter().GetFooterFormat()
669  : rDesc.GetFirstLeft().GetFooter().GetFooterFormat() == rDesc.GetFirstMaster().GetFooter().GetFooterFormat());
670 }
671 
673 // #i7983#
675 {
676  if (nullptr == pDel)
677  return;
678 
679  // mba: test iteration as clients are removed while iteration
680  SwPageDescHint aHint( m_PageDescs[0] );
681  pDel->CallSwClientNotify( aHint );
682 
683  bool bHasLayout = getIDocumentLayoutAccess().HasLayout();
684  if ( mpFootnoteInfo->DependsOn( pDel ) )
685  {
686  mpFootnoteInfo->ChgPageDesc( m_PageDescs[0] );
687  if ( bHasLayout )
688  {
689  for( auto aLayout : GetAllLayouts() )
690  aLayout->CheckFootnotePageDescs(false);
691  }
692  }
693  else if ( mpEndNoteInfo->DependsOn( pDel ) )
694  {
695  mpEndNoteInfo->ChgPageDesc( m_PageDescs[0] );
696  if ( bHasLayout )
697  {
698  for( auto aLayout : GetAllLayouts() )
699  aLayout->CheckFootnotePageDescs(true);
700  }
701  }
702 
703  for (SwPageDesc* pPageDesc : m_PageDescs)
704  {
705  if (pPageDesc->GetFollow() == pDel)
706  {
707  pPageDesc->SetFollow(nullptr);
708  if( bHasLayout )
709  {
710  for( auto aLayout : GetAllLayouts() )
711  aLayout->AllCheckPageDescs();
712  }
713  }
714  }
715 }
716 
717 void SwDoc::BroadcastStyleOperation(const OUString& rName, SfxStyleFamily eFamily,
718  SfxHintId nOp)
719 {
720  if (mpDocShell)
721  {
722  SfxStyleSheetBasePool * pPool = mpDocShell->GetStyleSheetPool();
723 
724  if (pPool)
725  {
726  SfxStyleSheetBase* pBase = pPool->Find(rName, eFamily);
727 
728  if (pBase != nullptr)
729  pPool->Broadcast(SfxStyleSheetHint( nOp, *pBase ));
730  }
731  }
732 }
733 
734 void SwDoc::DelPageDesc( size_t i, bool bBroadcast )
735 {
736  OSL_ENSURE(i < m_PageDescs.size(), "PageDescs is out of range.");
737  OSL_ENSURE( i != 0, "You cannot delete the default Pagedesc.");
738  if ( i == 0 )
739  return;
740 
741  SwPageDesc &rDel = *m_PageDescs[i];
742 
743  if (bBroadcast)
744  BroadcastStyleOperation(rDel.GetName(), SfxStyleFamily::Page,
745  SfxHintId::StyleSheetErased);
746 
747  if (GetIDocumentUndoRedo().DoesUndo())
748  {
749  GetIDocumentUndoRedo().AppendUndo(
750  std::make_unique<SwUndoPageDescDelete>(rDel, this));
751  }
752 
753  PreDelPageDesc(&rDel); // #i7983#
754 
755  m_PageDescs.erase(m_PageDescs.begin() + i);
756  getIDocumentState().SetModified();
757 }
758 
759 SwPageDesc* SwDoc::MakePageDesc(const OUString &rName, const SwPageDesc *pCpy,
760  bool bRegardLanguage, bool bBroadcast)
761 {
762  SwPageDesc *pNew;
763  if( pCpy )
764  {
765  pNew = new SwPageDesc( *pCpy );
766  pNew->SetName( rName );
767  if( rName != pCpy->GetName() )
768  {
769  pNew->SetPoolFormatId( USHRT_MAX );
770  pNew->SetPoolHelpId( USHRT_MAX );
771  pNew->SetPoolHlpFileId( UCHAR_MAX );
772  }
773  }
774  else
775  {
776  pNew = new SwPageDesc( rName, GetDfltFrameFormat(), this );
777  // Set the default page format.
778  lcl_DefaultPageFormat( USHRT_MAX, pNew->GetMaster(), pNew->GetLeft(), pNew->GetFirstMaster(), pNew->GetFirstLeft() );
779 
780  SvxFrameDirection aFrameDirection = bRegardLanguage ?
782  : SvxFrameDirection::Horizontal_LR_TB;
783 
784  pNew->GetMaster().SetFormatAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
785  pNew->GetLeft().SetFormatAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
786  pNew->GetFirstMaster().SetFormatAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
787  pNew->GetFirstLeft().SetFormatAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
788  }
789 
790  std::pair<SwPageDescs::const_iterator, bool> res = m_PageDescs.push_back( pNew );
791  SAL_WARN_IF(!res.second, "sw", "MakePageDesc called with existing name" );
792 
793  if (bBroadcast)
794  BroadcastStyleOperation(rName, SfxStyleFamily::Page,
795  SfxHintId::StyleSheetCreated);
796 
797  if (GetIDocumentUndoRedo().DoesUndo())
798  {
799  GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoPageDescCreate>(pNew, this));
800  }
801 
802  getIDocumentState().SetModified();
803  return pNew;
804 }
805 
806 void SwDoc::PrtOLENotify( bool bAll )
807 {
808  SwFEShell *pShell = nullptr;
809  {
810  SwViewShell *pSh = getIDocumentLayoutAccess().GetCurrentViewShell();
811  if ( pSh )
812  {
813  for(SwViewShell& rShell : pSh->GetRingContainer())
814  {
815  if(auto pFEShell = dynamic_cast<SwFEShell*>( &rShell))
816  {
817  pShell = pFEShell;
818  break;
819  }
820  }
821  }
822  }
823  if ( !pShell )
824  {
825  // This doesn't make sense without a Shell and thus without a client, because
826  // the communication about size changes is implemented by these components.
827  // Because we don't have a Shell we remember this unfortunate situation
828  // in the document,
829  // which is made up for later on when creating the first Shell.
830  mbOLEPrtNotifyPending = true;
831  if ( bAll )
832  mbAllOLENotify = true;
833  }
834  else
835  {
836  if ( mbAllOLENotify )
837  bAll = true;
838 
839  mbOLEPrtNotifyPending = mbAllOLENotify = false;
840 
841  std::unique_ptr<SwOLENodes> pNodes = SwContentNode::CreateOLENodesArray( *GetDfltGrfFormatColl(), !bAll );
842  if ( pNodes )
843  {
844  ::StartProgress( STR_STATSTR_SWGPRTOLENOTIFY,
845  0, pNodes->size(), GetDocShell());
846  getIDocumentLayoutAccess().GetCurrentLayout()->StartAllAction();
847 
848  for( SwOLENodes::size_type i = 0; i < pNodes->size(); ++i )
849  {
850  ::SetProgressState( i, GetDocShell() );
851 
852  SwOLENode* pOLENd = (*pNodes)[i];
853  pOLENd->SetOLESizeInvalid( false );
854 
855  // At first load the Infos and see if it's not already in the exclude list.
857 
858  svt::EmbeddedObjectRef& xObj = pOLENd->GetOLEObj().GetObject();
859  if ( xObj.is() )
860  aName = SvGlobalName( xObj->getClassID() );
861  else // Not yet loaded
862  {
863  // TODO/LATER: retrieve ClassID of an unloaded object
864  // aName = ????
865  }
866 
867  bool bFound = false;
868  for ( std::vector<SvGlobalName>::size_type j = 0;
869  j < pGlobalOLEExcludeList->size() && !bFound;
870  ++j )
871  {
872  bFound = (*pGlobalOLEExcludeList)[j] == aName;
873  }
874  if ( bFound )
875  continue;
876 
877  // We don't know it, so the object has to be loaded.
878  // If it doesn't want to be informed
879  if ( xObj.is() )
880  {
881  pGlobalOLEExcludeList->push_back( aName );
882  }
883  }
884  pNodes.reset();
885  getIDocumentLayoutAccess().GetCurrentLayout()->EndAllAction();
886  ::EndProgress( GetDocShell() );
887  }
888  }
889 }
890 
891 IMPL_LINK_NOARG( SwDoc, DoUpdateModifiedOLE, Timer *, void )
892 {
893  SwFEShell* pSh = static_cast<SwFEShell*>(GetEditShell());
894  if( !pSh )
895  return;
896 
897  mbOLEPrtNotifyPending = mbAllOLENotify = false;
898 
899  std::unique_ptr<SwOLENodes> pNodes = SwContentNode::CreateOLENodesArray( *GetDfltGrfFormatColl(), true );
900  if( !pNodes )
901  return;
902 
903  ::StartProgress( STR_STATSTR_SWGPRTOLENOTIFY,
904  0, pNodes->size(), GetDocShell());
905  getIDocumentLayoutAccess().GetCurrentLayout()->StartAllAction();
906  SwUpdateAttr aHint(0,0,0);
907  for( SwOLENodes::size_type i = 0; i < pNodes->size(); ++i )
908  {
909  ::SetProgressState( i, GetDocShell() );
910 
911  SwOLENode* pOLENd = (*pNodes)[i];
912  pOLENd->SetOLESizeInvalid( false );
913 
914  // We don't know it, so the object has to be loaded.
915  // If it doesn't want to be informed
916  if( pOLENd->GetOLEObj().GetOleRef().is() ) // Broken?
917  {
918  pOLENd->UpdateAttr(aHint);
919  }
920  }
921  getIDocumentLayoutAccess().GetCurrentLayout()->EndAllAction();
922  ::EndProgress( GetDocShell() );
923 }
924 
925 static SwPageDesc* lcl_FindPageDesc( const SwPageDescs *pPageDescs,
926  size_t *pPos, const OUString &rName )
927 {
928  SwPageDesc* res = nullptr;
929  SwPageDescs::const_iterator it = pPageDescs->find( rName );
930  if( it != pPageDescs->end() )
931  {
932  res = *it;
933  if( pPos )
934  *pPos = std::distance( pPageDescs->begin(), it );
935  }
936  else if( pPos )
937  *pPos = SIZE_MAX;
938  return res;
939 }
940 
941 SwPageDesc* SwDoc::FindPageDesc( const OUString & rName, size_t* pPos ) const
942 {
943  return lcl_FindPageDesc( &m_PageDescs, pPos, rName );
944 }
945 
946 bool SwDoc::ContainsPageDesc( const SwPageDesc *pDesc, size_t* pPos ) const
947 {
948  if( pDesc == nullptr )
949  return false;
950  if( !m_PageDescs.contains( const_cast <SwPageDesc*>( pDesc ) ) ) {
951  if( pPos )
952  *pPos = SIZE_MAX;
953  return false;
954  }
955  if( ! pPos )
956  return true;
957 
959  &m_PageDescs, pPos, pDesc->GetName() );
960  SAL_WARN_IF( desc != pDesc, "sw", "SwPageDescs container is broken!" );
961  return true;
962 }
963 
964 void SwDoc::DelPageDesc( const OUString & rName, bool bBroadcast )
965 {
966  size_t nI;
967 
968  if (FindPageDesc(rName, &nI))
969  DelPageDesc(nI, bBroadcast);
970 }
971 
972 void SwDoc::ChgPageDesc( const OUString & rName, const SwPageDesc & rDesc)
973 {
974  size_t nI;
975 
976  if (FindPageDesc(rName, &nI))
977  ChgPageDesc(nI, rDesc);
978 }
979 
980 /*
981  * The HTML import cannot resist changing the page descriptions, I don't
982  * know why. This function is meant to check the page descriptors for invalid
983  * values.
984  */
986 {
987  for ( size_t i = 0; i < GetPageDescCnt(); ++i )
988  {
989  SwPageDesc& rDesc = GetPageDesc( i );
990 
991  SwFrameFormat& rMaster = rDesc.GetMaster();
992  SwFrameFormat& rLeft = rDesc.GetLeft();
993 
994  const SwFormatFrameSize& rMasterSize = rMaster.GetFrameSize();
995  const SwFormatFrameSize& rLeftSize = rLeft.GetFrameSize();
996 
997  const bool bSetSize = INVALID_TWIPS == rMasterSize.GetWidth() ||
998  INVALID_TWIPS == rMasterSize.GetHeight() ||
999  INVALID_TWIPS == rLeftSize.GetWidth() ||
1000  INVALID_TWIPS == rLeftSize.GetHeight();
1001 
1002  if ( bSetSize )
1003  lcl_DefaultPageFormat( rDesc.GetPoolFormatId(), rDesc.GetMaster(), rDesc.GetLeft(), rDesc.GetFirstMaster(), rDesc.GetFirstLeft() );
1004  }
1005 }
1006 
1007 void SwDoc::SetDefaultPageMode(bool bSquaredPageMode)
1008 {
1009  if( !bSquaredPageMode == !IsSquaredPageMode() )
1010  return;
1011 
1012  const SwTextGridItem& rGrid = GetDefault( RES_TEXTGRID );
1013  SwTextGridItem aNewGrid = rGrid;
1014  aNewGrid.SetSquaredMode(bSquaredPageMode);
1015  aNewGrid.Init();
1016  SetDefault(aNewGrid);
1017 
1018  for ( size_t i = 0; i < GetPageDescCnt(); ++i )
1019  {
1020  SwPageDesc& rDesc = GetPageDesc( i );
1021 
1022  SwFrameFormat& rMaster = rDesc.GetMaster();
1023  SwFrameFormat& rLeft = rDesc.GetLeft();
1024 
1025  SwTextGridItem aGrid(rMaster.GetFormatAttr(RES_TEXTGRID));
1026  aGrid.SwitchPaperMode( bSquaredPageMode );
1027  rMaster.SetFormatAttr(aGrid);
1028  rLeft.SetFormatAttr(aGrid);
1029  }
1030 }
1031 
1033 {
1034  const SwTextGridItem& rGrid = GetDefault( RES_TEXTGRID );
1035  return rGrid.IsSquaredMode();
1036 }
1037 
1038 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SvxNumType GetNumberingType() const
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:683
Starts a section of nodes in the document model.
Definition: node.hxx:312
static void lcl_DescSetAttr(const SwFrameFormat &rSource, SwFrameFormat &rDest, const bool bPage=true)
Definition: docdesc.cxx:132
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(120)
tools::Long GetWidth() const
constexpr TypedWhichId< SvXMLAttrContainerItem > RES_UNKNOWNATR_CONTAINER(RES_UNKNOWNATR_BEGIN)
static std::unique_ptr< SwOLENodes > CreateOLENodesArray(const SwFormatColl &rColl, bool bOnlyWithInvalidSize)
Definition: node.cxx:2071
bool ContainsPageDesc(const SwPageDesc *pDesc, size_t *pPos) const
Definition: docdesc.cxx:946
SfxHintId
constexpr TypedWhichId< SwHeaderAndFooterEatSpacingItem > RES_HEADER_FOOTER_EAT_SPACING(121)
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
static void lcl_DefaultPageFormat(sal_uInt16 nPoolFormatId, SwFrameFormat &rFormat1, SwFrameFormat &rFormat2, SwFrameFormat &rFormat3, SwFrameFormat &rFormat4)
Definition: docdesc.cxx:66
const_iterator end() const
Definition: pagedesc.hxx:456
Marks a position in the document model.
Definition: pam.hxx:35
const_iterator begin() const
Definition: pagedesc.hxx:455
SwFrameFormat & GetLeft()
Definition: pagedesc.hxx:239
#define SID_ATTR_PAGE_COLUMN
Definition: cmdid.h:861
void SetPoolHelpId(sal_uInt16 nId)
Definition: format.hxx:152
const SwOLEObj & GetOLEObj() const
Definition: ndole.hxx:112
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
const_iterator find(const OUString &name) const
Definition: pagedesc.hxx:449
SwUndoId
Definition: swundo.hxx:29
constexpr TypedWhichId< SwFormatHeader > RES_HEADER(96)
void SetPoolHelpId(sal_uInt16 const nId)
Definition: pagedesc.hxx:278
constexpr TypedWhichId< SwFormatCol > RES_COL(109)
void CopyMasterHeader(const SwPageDesc &rChged, const SwFormatHeader &rHead, SwPageDesc &pDesc, bool bLeft, bool bFirst)
Definition: docdesc.cxx:239
void DelPageDesc(const OUString &rName, bool bBroadcast=false)
Definition: docdesc.cxx:964
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
sal_uInt16 char char * pDesc
constexpr TypedWhichId< SvxPaperBinItem > RES_PAPER_BIN(90)
SwFrameFormat & GetFirstMaster()
Definition: pagedesc.hxx:240
css::uno::Reference< css::embed::XEmbeddedObject > const & GetOleRef()
Definition: ndole.cxx:909
constexpr Point convert(const Point &rPoint, o3tl::Length eFrom, o3tl::Length eTo)
sal_Int64 n
Definition: doc.hxx:188
sal_Int16 nId
SwNode & GetNode() const
Definition: ndindex.hxx:119
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:31
void EndProgress(SwDocShell const *pDocShell)
Definition: mainwn.cxx:92
SvxFrameDirection
void Invalidate(sal_uInt16 nId)
void StartProgress(TranslateId pMessResId, tools::Long nStartValue, tools::Long nEndValue, SwDocShell *pDocShell)
Definition: mainwn.cxx:52
#define INVALID_TWIPS
Definition: swtypes.hxx:55
The root element of a Writer document layout.
Definition: rootfrm.hxx:82
UseOnPage GetUseOn() const
Definition: pagedesc.hxx:353
void SetNewContentIdx(const SwNodeIndex *pIdx)
Definition: atrfrm.cxx:595
const OUString & GetName() const
Definition: pagedesc.hxx:196
bool IsActive() const
Definition: fmthdft.hxx:89
std::vector< SvGlobalName > * pGlobalOLEExcludeList
Definition: init.cxx:431
void SetSquaredMode(bool bNew)
Definition: tgrditem.hxx:106
const SwPageFootnoteInfo & GetFootnoteInfo() const
Definition: pagedesc.hxx:205
void SetPoolFormatId(sal_uInt16 nId)
Definition: format.hxx:148
sal_uInt16 GetPoolFormatId() const
Query and set PoolFormat-Id.
Definition: pagedesc.hxx:275
void PrtOLENotify(bool bAll)
Definition: docdesc.cxx:806
ByPos::const_iterator const_iterator
Definition: pagedesc.hxx:431
IMPL_LINK_NOARG(SwDoc, DoUpdateModifiedOLE, Timer *, void)
Definition: docdesc.cxx:891
svt::EmbeddedObjectRef & GetObject()
Definition: ndole.cxx:961
static bool IsFuzzing()
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:64
constexpr TypedWhichId< SfxBoolItem > RES_RTL_GUTTER(132)
void SetPoolHlpFileId(sal_uInt8 nId)
Definition: format.hxx:154
virtual void SetName(const OUString &rNewName, bool bBroadcast=false) override
Definition: atrfrm.cxx:2570
bool IsSquaredMode() const
Definition: tgrditem.hxx:104
void SetPoolHlpFileId(sal_uInt8 const nId)
Definition: pagedesc.hxx:280
const OUString & GetNumStr() const
Definition: fmtftn.hxx:68
SfxStyleFamily
size_type size() const
sal_uInt16 GetPoolFormatId() const
Get and set Pool style IDs.
Definition: format.hxx:147
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
SwPageDesc * FindPageDesc(const OUString &rName, size_t *pPos=nullptr) const
Definition: docdesc.cxx:941
static Size GetDefaultPaperSize(MapUnit eUnit=MapUnit::MapTwip)
void SetNumber(sal_uInt16 nNumber, sal_uInt16 nNumberRLHidden, const OUString &sNumStr)
Definition: atrftn.cxx:361
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
bool IsHeaderShared() const
Definition: pagedesc.hxx:319
void CheckDefaultPageFormat()
The html import sometimes overwrites the page sizes set in the page descriptions. ...
Definition: docdesc.cxx:985
Style of a layout element.
Definition: frmfmt.hxx:59
SfxBindings * GetBindings() const
constexpr TypedWhichId< SfxBoolItem > RES_BACKGROUND_FULL_SIZE(131)
int i
const SwFrameFormat * GetFooterFormat() const
Definition: fmthdft.hxx:85
const SwFrameFormat * GetStashedFrameFormat(bool bHeader, bool bLeft, bool bFirst) const
Used to restore hidden header/footer formats.
Definition: pagedesc.cxx:446
bool GetLandscape() const
Definition: pagedesc.hxx:199
void ParkCursor(const SwNodeIndex &rIdx)
Remove selections and additional cursors of all shells.
Definition: crsrsh.cxx:2872
TElementType * First()
Definition: calbck.hxx:357
SwPageDesc * MakePageDesc(const OUString &rName, const SwPageDesc *pCpy=nullptr, bool bRegardLanguage=true, bool bBroadcast=false)
Definition: docdesc.cxx:759
sal_uInt16 GetNumberRLHidden() const
Definition: fmtftn.hxx:70
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
sal_uInt8 GetPoolHlpFileId() const
Definition: format.hxx:153
const SwFormatFooter & GetFooter(bool=true) const
Definition: fmthdft.hxx:99
const SwTextFormatColl * GetRegisterFormatColl() const
retrieve the style for the grid alignment
Definition: pagedesc.cxx:224
void ChgPageDesc(const OUString &rName, const SwPageDesc &)
Definition: docdesc.cxx:972
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:388
Marks a node in the document model.
Definition: ndindex.hxx:31
bool IsFooterShared() const
Definition: pagedesc.hxx:323
ring_container GetRingContainer()
Definition: ring.hxx:240
void CopyMasterFooter(const SwPageDesc &rChged, const SwFormatFooter &rFoot, SwPageDesc &pDesc, bool bLeft, bool bFirst)
Definition: docdesc.cxx:314
void SetPoolFormatId(sal_uInt16 const nId)
Definition: pagedesc.hxx:276
tools::Long GetHeight() const
void SetDefaultPageMode(bool bSquaredPageMode)
Definition: docdesc.cxx:1007
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:204
Frame cannot be moved in Var-direction.
const SwPageDesc * GetFollow() const
Definition: pagedesc.hxx:267
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:450
void UpdateAttr(const SwUpdateAttr &)
Definition: node.cxx:1099
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
sal_uLong EndOfSectionIndex() const
Definition: node.hxx:678
void Broadcast(const SfxHint &rHint)
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:624
constexpr TypedWhichId< SwTextGridItem > RES_TEXTGRID(115)
bool IsSquaredPageMode() const
Definition: docdesc.cxx:1032
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
sal_uInt16 GetPoolHelpId() const
Get and set Help-IDs for document templates.
Definition: format.hxx:151
#define SAL_WARN_IF(condition, area, stream)
static SwPageDesc * lcl_FindPageDesc(const SwPageDescs *pPageDescs, size_t *pPos, const OUString &rName)
Definition: docdesc.cxx:925
void SwitchPaperMode(bool bNew)
Definition: atrfrm.cxx:2449
SwFrameFormat & GetFirstLeft()
Definition: pagedesc.hxx:241
OUString aName
void SetProgressState(tools::Long nPosition, SwDocShell const *pDocShell)
Definition: mainwn.cxx:82
LanguageType GetAppLanguage()
Definition: init.cxx:723
SwPageDesc * m_pFollow
Definition: pagedesc.hxx:164
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:165
void SetSize(const Size &rSize)
bool SetName(const OUString &rNewName)
Definition: pagedesc.cxx:148
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:369
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:33
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:326
SvxFrameDirection GetDefaultFrameDirection(LanguageType nLanguage)
Return the AutoCollection by its Id.
Definition: poolfmt.cxx:79
void SetOLESizeInvalid(bool b)
Definition: ndole.hxx:134
SfxDispatcher * GetDispatcher() const
constexpr TypedWhichId< SwFormatFooter > RES_FOOTER(97)
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLBACKGROUND)
bool IsFirstShared() const
Definition: pagedesc.cxx:397
bool IsActive() const
Definition: fmthdft.hxx:58
std::vector< SwTextFootnote * >::size_type size_type
void PreDelPageDesc(SwPageDesc const *pDel)
All descriptors whose Follow point to the to-be-deleted have to be adapted.
Definition: docdesc.cxx:674
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
sal_uInt16 GetNumber() const
Definition: fmtftn.hxx:69
void CopyBookmarks(const SwPaM &rPam, SwPosition &rCpyPam)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(92)
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(107)
void BroadcastStyleOperation(const OUString &rName, SfxStyleFamily eFamily, SfxHintId nOp)
Definition: docdesc.cxx:717
static SwPageDesc * FindPageDesc(SwDoc *pDoc, sal_uInt16 nPoolId)
Definition: htmlcss1.cxx:1327
const SwFrameFormat * GetHeaderFormat() const
Definition: fmthdft.hxx:54
sal_uInt16 nPos
const LocaleDataWrapper & GetLocaleData()
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
const SvxNumberType & GetNumType() const
Definition: pagedesc.hxx:202