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>
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>
59#include <svx/swframetypes.hxx>
61
62#include <com/sun/star/embed/XEmbeddedObject.hpp>
63
64using namespace com::sun::star;
65
66static 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::toTwips(1, o3tl::Length::cm);
94 nMinLeft = o3tl::toTwips(2, o3tl::Length::cm);
95 }
96 else if (!utl::ConfigManager::IsFuzzing() && MeasurementSystem::Metric == SvtSysLocale().GetLocaleData().getMeasurementSystemEnum() )
97 {
98 nMinTop = nMinBottom = nMinLeft = nMinRight = o3tl::toTwips(2, o3tl::Length::cm);
99 }
100 else
101 {
102 nMinTop = nMinBottom = o3tl::toTwips(1, o3tl::Length::in); // as in MS Word
103 nMinLeft = nMinRight = o3tl::toTwips(1.25, o3tl::Length::in);
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
132static 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
220namespace
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
239void 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 SwFormatContent &aCnt = rFormatHead.GetHeaderFormat()->GetContent();
272
273 if (!aCnt.GetContentIdx())
274 {
275 const SwFrameFormat& rChgedFrameFormat = getConstFrameFormat(rChged, bLeft, bFirst);
276 rDescFrameFormat.SetFormatAttr( rChgedFrameFormat.GetHeader() );
277 }
278 else
279 {
280 const SwFrameFormat *pRight = rHead.GetHeaderFormat();
281 if (!pRight)
282 return;
283 const SwFormatContent &aRCnt = pRight->GetContent();
284
285 if ((*aRCnt.GetContentIdx() == *aCnt.GetContentIdx()) ||
286 // The ContentIdx is _always_ different when called from
287 // SwDocStyleSheet::SetItemSet, because it deep-copies the
288 // PageDesc. So check if it was previously shared.
289 (bFirst ? rDesc.IsFirstShared() : rDesc.IsHeaderShared()))
290 {
291 SwFrameFormat *pFormat = new SwFrameFormat( GetAttrPool(),
292 bFirst ? "First header" : "Left header",
294 ::lcl_DescSetAttr( *pRight, *pFormat, false );
295 // The section which the right header attribute is pointing
296 // is copied, and the Index to the StartNode is set to
297 // the left or first header attribute.
298 SwStartNode* pSttNd = SwNodes::MakeEmptySection( GetNodes().GetEndOfAutotext(), SwHeaderStartNode );
299 SwNodeRange aRange( aRCnt.GetContentIdx()->GetNode(), SwNodeOffset(0),
300 *aRCnt.GetContentIdx()->GetNode().EndOfSectionNode() );
301 GetNodes().Copy_( aRange, *pSttNd->EndOfSectionNode(), false );
302 GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRange, nullptr, *pSttNd);
303 SwPaM const source(aRange.aStart, aRange.aEnd);
304 SwPosition dest(*pSttNd);
305 sw::CopyBookmarks(source, dest);
306 pFormat->SetFormatAttr( SwFormatContent( pSttNd ) );
307 rDescFrameFormat.SetFormatAttr( SwFormatHeader( pFormat ) );
308 }
309 else
310 ::lcl_DescSetAttr( *pRight,
311 *const_cast<SwFrameFormat*>(rFormatHead.GetHeaderFormat()), false );
312 }
313 }
314 }
315}
316
317void SwDoc::CopyMasterFooter(const SwPageDesc &rChged, const SwFormatFooter &rFoot, SwPageDesc &rDesc, bool bLeft, bool bFirst)
318{
319 assert(bLeft || bFirst);
320 SwFrameFormat& rDescFrameFormat = getFrameFormat(rDesc, bLeft, bFirst);
321 if (bFirst && bLeft)
322 {
323 // special case: always shared with something
324 rDescFrameFormat.SetFormatAttr( rChged.IsFirstShared()
325 ? rDesc.GetLeft().GetFooter()
326 : rDesc.GetFirstMaster().GetFooter());
327 }
328 else if ((bFirst ? rChged.IsFirstShared() : rChged.IsFooterShared())
329 || !rFoot.IsActive())
330 {
331 // Left or first shares the Header with the Master.
332 rDescFrameFormat.SetFormatAttr( rDesc.GetMaster().GetFooter() );
333 }
334 else if ( rFoot.IsActive() )
335 { // Left or first gets its own Footer if the Format does not already have one.
336 // If the Format already has a Footer and it points to the same section as the Right one,
337 // it needs to get an own one.
338 // The content is evidently copied.
339 const SwFormatFooter &rFormatFoot = rDescFrameFormat.GetFooter();
340 if ( !rFormatFoot.IsActive() )
341 {
342 SwFormatFooter aFoot( getIDocumentLayoutAccess().MakeLayoutFormat( RndStdIds::FOOTER, nullptr ) );
343 rDescFrameFormat.SetFormatAttr( aFoot );
344 // Take over additional attributes (margins, borders ...).
345 ::lcl_DescSetAttr( *rFoot.GetFooterFormat(), *aFoot.GetFooterFormat(), false);
346 }
347 else
348 {
349 const SwFormatContent &aLCnt = rFormatFoot.GetFooterFormat()->GetContent();
350 if( !aLCnt.GetContentIdx() )
351 {
352 const SwFrameFormat& rChgedFrameFormat = getConstFrameFormat(rChged, bLeft, bFirst);
353 rDescFrameFormat.SetFormatAttr( rChgedFrameFormat.GetFooter() );
354 }
355 else
356 {
357 const SwFrameFormat *pRight = rFoot.GetFooterFormat();
358 if (!pRight)
359 return;
360 const SwFormatContent &aRCnt = pRight->GetContent();
361
362 if ((*aRCnt.GetContentIdx() == *aLCnt.GetContentIdx()) ||
363 // The ContentIdx is _always_ different when called from
364 // SwDocStyleSheet::SetItemSet, because it deep-copies the
365 // PageDesc. So check if it was previously shared.
366 (bFirst ? rDesc.IsFirstShared() : rDesc.IsFooterShared()))
367 {
368 SwFrameFormat *pFormat = new SwFrameFormat( GetAttrPool(),
369 bFirst ? "First footer" : "Left footer",
371 ::lcl_DescSetAttr( *pRight, *pFormat, false );
372 // The section to which the right footer attribute is pointing
373 // is copied, and the Index to the StartNode is set to
374 // the left footer attribute.
375 SwStartNode* pSttNd = SwNodes::MakeEmptySection( GetNodes().GetEndOfAutotext(), SwFooterStartNode );
376 SwNodeRange aRange( aRCnt.GetContentIdx()->GetNode(), SwNodeOffset(0),
377 *aRCnt.GetContentIdx()->GetNode().EndOfSectionNode() );
378 GetNodes().Copy_( aRange, *pSttNd->EndOfSectionNode(), false );
379 GetDocumentContentOperationsManager().CopyFlyInFlyImpl(aRange, nullptr, *pSttNd);
380 SwPaM const source(aRange.aStart, aRange.aEnd);
381 SwPosition dest(*pSttNd);
382 sw::CopyBookmarks(source, dest);
383 pFormat->SetFormatAttr( SwFormatContent( pSttNd ) );
384 rDescFrameFormat.SetFormatAttr( SwFormatFooter( pFormat ) );
385 }
386 else
387 ::lcl_DescSetAttr( *pRight,
388 *const_cast<SwFrameFormat*>(rFormatFoot.GetFooterFormat()), false );
389 }
390 }
391 }
392}
393
394void SwDoc::ChgPageDesc( size_t i, const SwPageDesc &rChged )
395{
396 assert(i < m_PageDescs.size() && "PageDescs is out of range.");
397
398 SwPageDesc& rDesc = *m_PageDescs[i];
400
401 if (GetIDocumentUndoRedo().DoesUndo())
402 {
403 // Stash header formats as needed.
404 const SwFormatHeader& rLeftHead = rChged.GetLeft().GetHeader();
405 const SwFormatHeader& rFirstMasterHead = rChged.GetFirstMaster().GetHeader();
406 const SwFormatHeader& rFirstLeftHead = rChged.GetFirstLeft().GetHeader();
407 const bool bStashLeftHead = !rDesc.IsHeaderShared() && rChged.IsHeaderShared();
408 const bool bStashFirstMasterHead = !rDesc.IsFirstShared() && rChged.IsFirstShared();
409 const bool bStashFirstLeftHead = (!rDesc.IsHeaderShared() && rChged.IsHeaderShared()) || (!rDesc.IsFirstShared() && rChged.IsFirstShared());
410 if (bStashLeftHead && rLeftHead.GetRegisteredIn() && !rDesc.HasStashedFormat(true, true, false))
411 rDesc.StashFrameFormat(rChged.GetLeft(), true, true, false);
412 if (bStashFirstMasterHead && rFirstMasterHead.GetRegisteredIn() && !rDesc.HasStashedFormat(true, false, true))
413 rDesc.StashFrameFormat(rChged.GetFirstMaster(), true, false, true);
414 if (bStashFirstLeftHead && rFirstLeftHead.GetRegisteredIn() && !rDesc.HasStashedFormat(true, true, true))
415 rDesc.StashFrameFormat(rChged.GetFirstLeft(), true, true, true);
416
417 // Stash footer formats as needed.
418 const SwFormatFooter& rLeftFoot = rChged.GetLeft().GetFooter();
419 const SwFormatFooter& rFirstMasterFoot = rChged.GetFirstMaster().GetFooter();
420 const SwFormatFooter& rFirstLeftFoot = rChged.GetFirstLeft().GetFooter();
421 const bool bStashLeftFoot = !rDesc.IsFooterShared() && rChged.IsFooterShared();
422 const bool bStashFirstMasterFoot = !rDesc.IsFirstShared() && rChged.IsFirstShared();
423 const bool bStashFirstLeftFoot = (!rDesc.IsFooterShared() && rChged.IsFooterShared()) || (!rDesc.IsFirstShared() && rChged.IsFirstShared());
424 if (bStashLeftFoot && rLeftFoot.GetRegisteredIn() && !rDesc.HasStashedFormat(false, true, false))
425 rDesc.StashFrameFormat(rChged.GetLeft(), false, true, false);
426 if (bStashFirstMasterFoot && rFirstMasterFoot.GetRegisteredIn() && !rDesc.HasStashedFormat(false, false, true))
427 rDesc.StashFrameFormat(rChged.GetFirstMaster(), false, false, true);
428 if (bStashFirstLeftFoot && rFirstLeftFoot.GetRegisteredIn() && !rDesc.HasStashedFormat(false, true, true))
429 rDesc.StashFrameFormat(rChged.GetFirstLeft(), false, true, true);
430
431 GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoPageDesc>(rDesc, rChged, this));
432 }
433 else
434 {
435 SwUndoId nBeingUndone(SwUndoId::EMPTY);
436 GetIDocumentUndoRedo().GetFirstRedoInfo(nullptr, &nBeingUndone);
437 if (SwUndoId::HEADER_FOOTER == nBeingUndone)
438 {
439 // The last format change is currently being undone. Remove header/footer and corresponding nodes.
440 auto rDescMasterHeaderFormat = rDesc.GetMaster().GetFormatAttr(RES_HEADER);
441 auto rDescLeftHeaderFormat = rDesc.GetLeft().GetFormatAttr(RES_HEADER);
442 auto rDescFirstLeftHeaderFormat = rDesc.GetFirstLeft().GetFormatAttr(RES_HEADER);
443 auto rDescMasterFooterFormat = rDesc.GetMaster().GetFormatAttr(RES_FOOTER);
444 auto rDescLeftFooterFormat = rDesc.GetLeft().GetFormatAttr(RES_FOOTER);
445 auto rDescFirstLeftFooterFormat = rDesc.GetFirstLeft().GetFormatAttr(RES_FOOTER);
446
447 auto rChgedMasterHeaderFormat = rChged.GetMaster().GetFormatAttr(RES_HEADER);
448 auto rChgedLeftHeaderFormat = rChged.GetLeft().GetFormatAttr(RES_HEADER);
449 auto rChgedFirstLeftHeaderFormat = rChged.GetFirstLeft().GetFormatAttr(RES_HEADER);
450 auto rChgedMasterFooterFormat = rChged.GetMaster().GetFormatAttr(RES_FOOTER);
451 auto rChgedLeftFooterFormat = rChged.GetLeft().GetFormatAttr(RES_FOOTER);
452 auto rChgedFirstLeftFooterFormat = rChged.GetFirstLeft().GetFormatAttr(RES_FOOTER);
453
460
461 auto lDelHFFormat = [this](SwClient* pToRemove, SwFrameFormat* pFormat)
462 {
463 // Code taken from lcl_DelHFFormat
464 pFormat->Remove(pToRemove);
465 SwFormatContent& rCnt = const_cast<SwFormatContent&>(pFormat->GetContent());
466 if (rCnt.GetContentIdx())
467 {
468 SwNode* pNode = nullptr;
469 {
470 SwNodeIndex aIdx(*rCnt.GetContentIdx(), 0);
471 pNode = &aIdx.GetNode();
472 SwNodeOffset nEnd = pNode->EndOfSectionIndex();
473 while (aIdx < nEnd)
474 {
475 if (pNode->IsContentNode() &&
476 static_cast<SwContentNode*>(pNode)->HasWriterListeners())
477 {
479 if (pShell)
480 {
481 pShell->ParkCursor(aIdx.GetNode());
482 aIdx = nEnd - 1;
483 }
484 }
485 ++aIdx;
486 pNode = &aIdx.GetNode();
487 }
488 }
489 rCnt.SetNewContentIdx(nullptr);
490
491 ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
492
493 assert(pNode);
495 }
496 delete pFormat;
497 };
498
499 if (rDescMasterHeaderFormat.GetHeaderFormat() && rDescMasterHeaderFormat != rChgedMasterHeaderFormat)
500 lDelHFFormat(&rDescMasterHeaderFormat, rDescMasterHeaderFormat.GetHeaderFormat());
501 else if (rDescLeftHeaderFormat.GetHeaderFormat() && rDescLeftHeaderFormat != rChgedLeftHeaderFormat)
502 lDelHFFormat(&rDescLeftHeaderFormat, rDescLeftHeaderFormat.GetHeaderFormat());
503 else if (rDescFirstLeftHeaderFormat.GetHeaderFormat() && rDescFirstLeftHeaderFormat != rChgedFirstLeftHeaderFormat)
504 lDelHFFormat(&rDescFirstLeftHeaderFormat, rDescFirstLeftHeaderFormat.GetHeaderFormat());
505
506 else if (rDescMasterFooterFormat.GetFooterFormat() && rDescMasterFooterFormat != rChgedMasterFooterFormat)
507 lDelHFFormat(&rDescMasterFooterFormat, rDescMasterFooterFormat.GetFooterFormat());
508 else if (rDescLeftFooterFormat.GetFooterFormat() && rDescLeftFooterFormat != rChgedLeftFooterFormat)
509 lDelHFFormat(&rDescLeftFooterFormat, rDescLeftFooterFormat.GetFooterFormat());
510 else if (rDescFirstLeftFooterFormat.GetFooterFormat() && rDescFirstLeftFooterFormat != rChgedFirstLeftFooterFormat)
511 lDelHFFormat(&rDescFirstLeftFooterFormat, rDescFirstLeftFooterFormat.GetFooterFormat());
512 }
513 }
514 ::sw::UndoGuard const undoGuard(GetIDocumentUndoRedo());
515
516 // Mirror at first if needed.
517 if ( rChged.GetUseOn() == UseOnPage::Mirror )
518 const_cast<SwPageDesc&>(rChged).Mirror();
519 else
520 {
521 // Or else transfer values from Master to Left
523 const_cast<SwPageDesc&>(rChged).GetLeft());
524 }
526 const_cast<SwPageDesc&>(rChged).GetFirstMaster());
527 ::lcl_DescSetAttr(rChged.GetLeft(),
528 const_cast<SwPageDesc&>(rChged).GetFirstLeft());
529
530 // Take over NumType.
531 if( rChged.GetNumType().GetNumberingType() != rDesc.GetNumType().GetNumberingType() )
532 {
533 rDesc.SetNumType( rChged.GetNumType() );
534 // Notify page number fields that NumFormat has changed
537
538 // If the numbering scheme has changed we could have QuoVadis/ErgoSum texts
539 // that refer to a changed page, so we invalidate foot notes.
540 SwFootnoteIdxs& rFootnoteIdxs = GetFootnoteIdxs();
541 for( SwFootnoteIdxs::size_type nPos = 0; nPos < rFootnoteIdxs.size(); ++nPos )
542 {
543 SwTextFootnote *pTextFootnote = rFootnoteIdxs[ nPos ];
544 const SwFormatFootnote &rFootnote = pTextFootnote->GetFootnote();
545 pTextFootnote->SetNumber(rFootnote.GetNumber(), rFootnote.GetNumberRLHidden(), rFootnote.GetNumStr());
546 }
547 }
548
549 // Take over orientation
550 rDesc.SetLandscape( rChged.GetLandscape() );
551
552 // Synch header.
553 const SwFormatHeader& rMasterHead = rChged.GetMaster().GetHeader();
554 rDesc.GetMaster().SetFormatAttr( rMasterHead );
555 const bool bRestoreStashedLeftHead = rDesc.IsHeaderShared() && !rChged.IsHeaderShared();
556 const bool bRestoreStashedFirstMasterHead = rDesc.IsFirstShared() && !rChged.IsFirstShared();
557 const bool bRestoreStashedFirstLeftHead = (rDesc.IsHeaderShared() && !rChged.IsHeaderShared()) || (rDesc.IsFirstShared() && !rChged.IsFirstShared());
558 const SwFrameFormat* pStashedLeftFormat = bRestoreStashedLeftHead ? rChged.GetStashedFrameFormat(true, true, false) : nullptr;
559 const SwFrameFormat* pStashedFirstMasterFormat = bRestoreStashedFirstMasterHead ? rChged.GetStashedFrameFormat(true, false, true) : nullptr;
560 const SwFrameFormat* pStashedFirstLeftFormat = bRestoreStashedFirstLeftHead ? rChged.GetStashedFrameFormat(true, true, true) : nullptr;
561 CopyMasterHeader(rChged, pStashedLeftFormat ? pStashedLeftFormat->GetHeader() : rMasterHead, rDesc, true, false); // Copy left header
562 CopyMasterHeader(rChged, pStashedFirstMasterFormat ? pStashedFirstMasterFormat->GetHeader() : rMasterHead, rDesc, false, true); // Copy first master
563 CopyMasterHeader(rChged, pStashedFirstLeftFormat ? pStashedFirstLeftFormat->GetHeader() : rMasterHead, rDesc, true, true); // Copy first left
564
565 if (pStashedLeftFormat)
566 rDesc.RemoveStashedFormat(true, true, false);
567
568 if (pStashedFirstMasterFormat)
569 rDesc.RemoveStashedFormat(true, false, true);
570
571 if (pStashedFirstLeftFormat)
572 rDesc.RemoveStashedFormat(true, true, true);
573
574 rDesc.ChgHeaderShare( rChged.IsHeaderShared() );
575
576 // Synch Footer.
577 const SwFormatFooter& rMasterFoot = rChged.GetMaster().GetFooter();
578 rDesc.GetMaster().SetFormatAttr( rMasterFoot );
579 const bool bRestoreStashedLeftFoot = rDesc.IsFooterShared() && !rChged.IsFooterShared();
580 const bool bRestoreStashedFirstMasterFoot = rDesc.IsFirstShared() && !rChged.IsFirstShared();
581 const bool bRestoreStashedFirstLeftFoot = (rDesc.IsFooterShared() && !rChged.IsFooterShared()) || (rDesc.IsFirstShared() && !rChged.IsFirstShared());
582 const SwFrameFormat* pStashedLeftFoot = bRestoreStashedLeftFoot ? rChged.GetStashedFrameFormat(false, true, false) : nullptr;
583 const SwFrameFormat* pStashedFirstMasterFoot = bRestoreStashedFirstMasterFoot ? rChged.GetStashedFrameFormat(false, false, true) : nullptr;
584 const SwFrameFormat* pStashedFirstLeftFoot = bRestoreStashedFirstLeftFoot ? rChged.GetStashedFrameFormat(false, true, true) : nullptr;
585 CopyMasterFooter(rChged, pStashedLeftFoot ? pStashedLeftFoot->GetFooter() : rMasterFoot, rDesc, true, false); // Copy left footer
586 CopyMasterFooter(rChged, pStashedFirstMasterFoot ? pStashedFirstMasterFoot->GetFooter() : rMasterFoot, rDesc, false, true); // Copy first master
587 CopyMasterFooter(rChged, pStashedFirstLeftFoot ? pStashedFirstLeftFoot->GetFooter() : rMasterFoot, rDesc, true, true); // Copy first left
588
589 if (pStashedLeftFormat)
590 rDesc.RemoveStashedFormat(false, true, false);
591
592 if (pStashedFirstMasterFoot)
593 rDesc.RemoveStashedFormat(false, false, true);
594
595 if (pStashedFirstLeftFoot)
596 rDesc.RemoveStashedFormat(false, true, true);
597
598 rDesc.ChgFooterShare( rChged.IsFooterShared() );
599 // there is just one first shared flag for both header and footer?
600 rDesc.ChgFirstShare( rChged.IsFirstShared() );
601
602 if ( rDesc.GetName() != rChged.GetName() )
603 rDesc.SetName( rChged.GetName() );
604
605 // A RegisterChange is triggered, if necessary
607
608 // If UseOn or the Follow change, the paragraphs need to know about it.
609 bool bUseOn = false;
610 bool bFollow = false;
611 if (rDesc.GetUseOn() != rChged.GetUseOn())
612 {
613 rDesc.SetUseOn( rChged.GetUseOn() );
614 bUseOn = true;
615 }
616 if (rDesc.GetFollow() != rChged.GetFollow())
617 {
618 if (rChged.GetFollow() == &rChged)
619 {
620 if (rDesc.GetFollow() != &rDesc)
621 {
622 rDesc.SetFollow( &rDesc );
623 bFollow = true;
624 }
625 }
626 else
627 {
628 rDesc.SetFollow( rChged.m_pFollow );
629 bFollow = true;
630 }
631 }
632
633 if ( (bUseOn || bFollow) && pTmpRoot)
634 // Inform layout!
635 {
636 for( auto aLayout : GetAllLayouts() )
637 aLayout->AllCheckPageDescs();
638 }
639
640 // Take over the page attributes.
641 ::lcl_DescSetAttr( rChged.GetMaster(), rDesc.GetMaster() );
642 ::lcl_DescSetAttr( rChged.GetLeft(), rDesc.GetLeft() );
644 ::lcl_DescSetAttr( rChged.GetFirstLeft(), rDesc.GetFirstLeft() );
645
646 // If the FootnoteInfo changes, the pages are triggered.
647 if( !(rDesc.GetFootnoteInfo() == rChged.GetFootnoteInfo()) )
648 {
649 rDesc.SetFootnoteInfo( rChged.GetFootnoteInfo() );
651 rDesc.GetMaster().CallSwClientNotify(aHint);
652 rDesc.GetLeft().CallSwClientNotify(aHint);
653 rDesc.GetFirstMaster().CallSwClientNotify(aHint);
654 rDesc.GetFirstLeft().CallSwClientNotify(aHint);
655 }
657
658 SfxBindings* pBindings =
660 if ( pBindings )
661 {
662 pBindings->Invalidate( SID_ATTR_PAGE_COLUMN );
663 pBindings->Invalidate( SID_ATTR_PAGE );
664 pBindings->Invalidate( SID_ATTR_PAGE_SIZE );
665 pBindings->Invalidate( SID_ATTR_PAGE_ULSPACE );
666 pBindings->Invalidate( SID_ATTR_PAGE_LRSPACE );
667 }
668
669 //h/f of first-left page must not be unique but same as first master or left
670 assert((rDesc.IsFirstShared())
673 assert((rDesc.IsFirstShared())
676}
677
679// #i7983#
681{
682 if (nullptr == pDel)
683 return;
684
685 // mba: test iteration as clients are removed while iteration
686 SwPageDescHint aHint( m_PageDescs[0] );
687 pDel->CallSwClientNotify( aHint );
688
689 bool bHasLayout = getIDocumentLayoutAccess().HasLayout();
690 if ( mpFootnoteInfo->DependsOn( pDel ) )
691 {
692 mpFootnoteInfo->ChgPageDesc( m_PageDescs[0] );
693 if ( bHasLayout )
694 {
695 for( auto aLayout : GetAllLayouts() )
696 aLayout->CheckFootnotePageDescs(false);
697 }
698 }
699 else if ( mpEndNoteInfo->DependsOn( pDel ) )
700 {
701 mpEndNoteInfo->ChgPageDesc( m_PageDescs[0] );
702 if ( bHasLayout )
703 {
704 for( auto aLayout : GetAllLayouts() )
705 aLayout->CheckFootnotePageDescs(true);
706 }
707 }
708
709 for (SwPageDesc* pPageDesc : m_PageDescs)
710 {
711 if (pPageDesc->GetFollow() == pDel)
712 {
713 pPageDesc->SetFollow(nullptr);
714 if( bHasLayout )
715 {
716 for( auto aLayout : GetAllLayouts() )
717 aLayout->AllCheckPageDescs();
718 }
719 }
720 }
721}
722
723void SwDoc::BroadcastStyleOperation(const OUString& rName, SfxStyleFamily eFamily,
724 SfxHintId nOp)
725{
726 if (mpDocShell)
727 {
729
730 if (pPool)
731 {
732 SfxStyleSheetBase* pBase = pPool->Find(rName, eFamily);
733
734 if (pBase != nullptr)
735 pPool->Broadcast(SfxStyleSheetHint( nOp, *pBase ));
736 }
737 }
738}
739
740void SwDoc::DelPageDesc( size_t i, bool bBroadcast )
741{
742 OSL_ENSURE(i < m_PageDescs.size(), "PageDescs is out of range.");
743 OSL_ENSURE( i != 0, "You cannot delete the default Pagedesc.");
744 if ( i == 0 )
745 return;
746
747 SwPageDesc &rDel = *m_PageDescs[i];
748
749 if (bBroadcast)
750 BroadcastStyleOperation(rDel.GetName(), SfxStyleFamily::Page,
751 SfxHintId::StyleSheetErased);
752
753 if (GetIDocumentUndoRedo().DoesUndo())
754 {
755 GetIDocumentUndoRedo().AppendUndo(
756 std::make_unique<SwUndoPageDescDelete>(rDel, this));
757 }
758
759 PreDelPageDesc(&rDel); // #i7983#
760
763}
764
765SwPageDesc* SwDoc::MakePageDesc(const OUString &rName, const SwPageDesc *pCpy,
766 bool bRegardLanguage, bool bBroadcast)
767{
768 SwPageDesc *pNew;
769 if( pCpy )
770 {
771 pNew = new SwPageDesc( *pCpy );
772 pNew->SetName( rName );
773 if( rName != pCpy->GetName() )
774 {
775 pNew->SetPoolFormatId( USHRT_MAX );
776 pNew->SetPoolHelpId( USHRT_MAX );
777 pNew->SetPoolHlpFileId( UCHAR_MAX );
778 }
779 }
780 else
781 {
782 pNew = new SwPageDesc( rName, GetDfltFrameFormat(), this );
783 // Set the default page format.
784 lcl_DefaultPageFormat( USHRT_MAX, pNew->GetMaster(), pNew->GetLeft(), pNew->GetFirstMaster(), pNew->GetFirstLeft() );
785
786 SvxFrameDirection aFrameDirection = bRegardLanguage ?
788 : SvxFrameDirection::Horizontal_LR_TB;
789
790 pNew->GetMaster().SetFormatAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
791 pNew->GetLeft().SetFormatAttr( SvxFrameDirectionItem(aFrameDirection, RES_FRAMEDIR) );
794 }
795
796 std::pair<SwPageDescs::const_iterator, bool> res = m_PageDescs.push_back( pNew );
797 SAL_WARN_IF(!res.second, "sw", "MakePageDesc called with existing name" );
798
799 if (bBroadcast)
800 BroadcastStyleOperation(rName, SfxStyleFamily::Page,
801 SfxHintId::StyleSheetCreated);
802
803 if (GetIDocumentUndoRedo().DoesUndo())
804 {
805 GetIDocumentUndoRedo().AppendUndo(std::make_unique<SwUndoPageDescCreate>(pNew, this));
806 }
807
809 return pNew;
810}
811
812void SwDoc::PrtOLENotify( bool bAll )
813{
814 SwFEShell *pShell = nullptr;
815 {
817 if ( pSh )
818 {
819 for(SwViewShell& rShell : pSh->GetRingContainer())
820 {
821 if(auto pFEShell = dynamic_cast<SwFEShell*>( &rShell))
822 {
823 pShell = pFEShell;
824 break;
825 }
826 }
827 }
828 }
829 if ( !pShell )
830 {
831 // This doesn't make sense without a Shell and thus without a client, because
832 // the communication about size changes is implemented by these components.
833 // Because we don't have a Shell we remember this unfortunate situation
834 // in the document,
835 // which is made up for later on when creating the first Shell.
837 if ( bAll )
838 mbAllOLENotify = true;
839 }
840 else
841 {
842 if ( mbAllOLENotify )
843 bAll = true;
844
846
847 std::unique_ptr<SwOLENodes> pNodes = SwContentNode::CreateOLENodesArray( *GetDfltGrfFormatColl(), !bAll );
848 if ( pNodes )
849 {
850 ::StartProgress( STR_STATSTR_SWGPRTOLENOTIFY,
851 0, pNodes->size(), GetDocShell());
853
854 for( SwOLENodes::size_type i = 0; i < pNodes->size(); ++i )
855 {
857
858 SwOLENode* pOLENd = (*pNodes)[i];
859 pOLENd->SetOLESizeInvalid( false );
860
861 // At first load the Infos and see if it's not already in the exclude list.
863
864 svt::EmbeddedObjectRef& xObj = pOLENd->GetOLEObj().GetObject();
865 if ( xObj.is() )
866 aName = SvGlobalName( xObj->getClassID() );
867 else // Not yet loaded
868 {
869 // TODO/LATER: retrieve ClassID of an unloaded object
870 // aName = ????
871 }
872
873 bool bFound = false;
874 for ( std::vector<SvGlobalName>::size_type j = 0;
875 j < pGlobalOLEExcludeList->size() && !bFound;
876 ++j )
877 {
878 bFound = (*pGlobalOLEExcludeList)[j] == aName;
879 }
880 if ( bFound )
881 continue;
882
883 // We don't know it, so the object has to be loaded.
884 // If it doesn't want to be informed
885 if ( xObj.is() )
886 {
887 pGlobalOLEExcludeList->push_back( aName );
888 }
889 }
890 pNodes.reset();
893 }
894 }
895}
896
897IMPL_LINK_NOARG( SwDoc, DoUpdateModifiedOLE, Timer *, void )
898{
899 SwFEShell* pSh = static_cast<SwFEShell*>(GetEditShell());
900 if (!pSh)
901 return;
902
903 mbOLEPrtNotifyPending = mbAllOLENotify = false;
904
905 std::unique_ptr<SwOLENodes> pNodes = SwContentNode::CreateOLENodesArray( *GetDfltGrfFormatColl(), true );
906 if( !pNodes )
907 return;
908
909 ::StartProgress( STR_STATSTR_SWGPRTOLENOTIFY,
910 0, pNodes->size(), GetDocShell());
911 getIDocumentLayoutAccess().GetCurrentLayout()->StartAllAction();
912 SwUpdateAttr aHint(0,0,0);
913 for( SwOLENodes::size_type i = 0; i < pNodes->size(); ++i )
914 {
915 ::SetProgressState( i, GetDocShell() );
916
917 SwOLENode* pOLENd = (*pNodes)[i];
918 pOLENd->SetOLESizeInvalid( false );
919
920 // We don't know it, so the object has to be loaded.
921 // If it doesn't want to be informed
922 if( pOLENd->GetOLEObj().GetOleRef().is() ) // Broken?
923 {
924 pOLENd->UpdateAttr(aHint);
925 }
926 }
927 getIDocumentLayoutAccess().GetCurrentLayout()->EndAllAction();
928 ::EndProgress( GetDocShell() );
929}
930
931static SwPageDesc* lcl_FindPageDesc( const SwPageDescs *pPageDescs,
932 size_t *pPos, const OUString &rName )
933{
934 SwPageDesc* res = nullptr;
935 SwPageDescs::const_iterator it = pPageDescs->find( rName );
936 if( it != pPageDescs->end() )
937 {
938 res = *it;
939 if( pPos )
940 *pPos = std::distance( pPageDescs->begin(), it );
941 }
942 else if( pPos )
943 *pPos = SIZE_MAX;
944 return res;
945}
946
947SwPageDesc* SwDoc::FindPageDesc( const OUString & rName, size_t* pPos ) const
948{
949 return lcl_FindPageDesc( &m_PageDescs, pPos, rName );
950}
951
952bool SwDoc::ContainsPageDesc( const SwPageDesc *pDesc, size_t* pPos ) const
953{
954 if( pDesc == nullptr )
955 return false;
956 if( !m_PageDescs.contains( const_cast <SwPageDesc*>( pDesc ) ) ) {
957 if( pPos )
958 *pPos = SIZE_MAX;
959 return false;
960 }
961 if( ! pPos )
962 return true;
963
965 &m_PageDescs, pPos, pDesc->GetName() );
966 SAL_WARN_IF( desc != pDesc, "sw", "SwPageDescs container is broken!" );
967 return true;
968}
969
970void SwDoc::DelPageDesc( const OUString & rName, bool bBroadcast )
971{
972 size_t nI;
973
974 if (FindPageDesc(rName, &nI))
975 DelPageDesc(nI, bBroadcast);
976}
977
978void SwDoc::ChgPageDesc( const OUString & rName, const SwPageDesc & rDesc)
979{
980 size_t nI;
981
982 if (FindPageDesc(rName, &nI))
983 ChgPageDesc(nI, rDesc);
984}
985
986/*
987 * The HTML import cannot resist changing the page descriptions, I don't
988 * know why. This function is meant to check the page descriptors for invalid
989 * values.
990 */
992{
993 for ( size_t i = 0; i < GetPageDescCnt(); ++i )
994 {
995 SwPageDesc& rDesc = GetPageDesc( i );
996
997 SwFrameFormat& rMaster = rDesc.GetMaster();
998 SwFrameFormat& rLeft = rDesc.GetLeft();
999
1000 const SwFormatFrameSize& rMasterSize = rMaster.GetFrameSize();
1001 const SwFormatFrameSize& rLeftSize = rLeft.GetFrameSize();
1002
1003 const bool bSetSize = INVALID_TWIPS == rMasterSize.GetWidth() ||
1004 INVALID_TWIPS == rMasterSize.GetHeight() ||
1005 INVALID_TWIPS == rLeftSize.GetWidth() ||
1006 INVALID_TWIPS == rLeftSize.GetHeight();
1007
1008 if ( bSetSize )
1009 lcl_DefaultPageFormat( rDesc.GetPoolFormatId(), rDesc.GetMaster(), rDesc.GetLeft(), rDesc.GetFirstMaster(), rDesc.GetFirstLeft() );
1010 }
1011}
1012
1013void SwDoc::SetDefaultPageMode(bool bSquaredPageMode)
1014{
1015 if( !bSquaredPageMode == !IsSquaredPageMode() )
1016 return;
1017
1018 const SwTextGridItem& rGrid = GetDefault( RES_TEXTGRID );
1019 SwTextGridItem aNewGrid = rGrid;
1020 aNewGrid.SetSquaredMode(bSquaredPageMode);
1021 aNewGrid.Init();
1022 SetDefault(aNewGrid);
1023
1024 for ( size_t i = 0; i < GetPageDescCnt(); ++i )
1025 {
1026 SwPageDesc& rDesc = GetPageDesc( i );
1027
1028 SwFrameFormat& rMaster = rDesc.GetMaster();
1029 SwFrameFormat& rLeft = rDesc.GetLeft();
1030
1032 aGrid.SwitchPaperMode( bSquaredPageMode );
1033 rMaster.SetFormatAttr(aGrid);
1034 rLeft.SetFormatAttr(aGrid);
1035 }
1036}
1037
1039{
1040 const SwTextGridItem& rGrid = GetDefault( RES_TEXTGRID );
1041 return rGrid.IsSquaredMode();
1042}
1043
1044/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void DeleteSection(SwNode *pNode)=0
Delete section containing the node.
virtual SwFieldType * GetSysFieldType(const SwFieldIds eWhich) const =0
virtual const SwRootFrame * GetCurrentLayout() const =0
virtual bool HasLayout() const =0
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
virtual void SetModified()=0
Must be called manually at changes of format.
void Invalidate(sal_uInt16 nId)
void Broadcast(const SfxHint &rHint)
SfxBindings * GetBindings() const
SfxDispatcher * GetDispatcher() const
virtual SfxStyleSheetBase * Find(const OUString &, SfxStyleFamily eFam, SfxStyleSearchBits n=SfxStyleSearchBits::All)
void SetRight(const tools::Long nR, const sal_uInt16 nProp=100)
void SetLeft(const tools::Long nL, const sal_uInt16 nProp=100)
SvxNumType GetNumberingType() const
static Size GetDefaultPaperSize(MapUnit eUnit=MapUnit::MapTwip)
tools::Long GetHeight() const
tools::Long GetWidth() const
void SetSize(const Size &rSize)
void SetLower(const sal_uInt16 nL, const sal_uInt16 nProp=100)
void SetUpper(const sal_uInt16 nU, const sal_uInt16 nProp=100)
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:166
static std::unique_ptr< SwOLENodes > CreateOLENodesArray(const SwFormatColl &rColl, bool bOnlyWithInvalidSize)
Definition: node.cxx:2112
void UpdateAttr(const SwUpdateAttr &)
Definition: node.cxx:1114
void ParkCursor(const SwNode &rIdx)
Remove selections and additional cursors of all shells.
Definition: crsrsh.cxx:3188
virtual SfxStyleSheetBasePool * GetStyleSheetPool() override
For Style PI.
Definition: docsh.cxx:1152
Definition: doc.hxx:197
void CheckDefaultPageFormat()
The html import sometimes overwrites the page sizes set in the page descriptions.
Definition: docdesc.cxx:991
SwPageDesc * FindPageDesc(const OUString &rName, size_t *pPos=nullptr) const
Definition: docdesc.cxx:947
bool ContainsPageDesc(const SwPageDesc *pDesc, size_t *pPos) const
Definition: docdesc.cxx:952
SwDocShell * mpDocShell
Definition: doc.hxx:269
void BroadcastStyleOperation(const OUString &rName, SfxStyleFamily eFamily, SfxHintId nOp)
Definition: docdesc.cxx:723
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:408
void PreDelPageDesc(SwPageDesc const *pDel)
All descriptors whose Follow point to the to-be-deleted have to be adapted.
Definition: docdesc.cxx:680
o3tl::sorted_vector< SwRootFrame * > GetAllLayouts()
Definition: doclay.cxx:1699
const SwGrfFormatColl * GetDfltGrfFormatColl() const
Definition: doc.hxx:819
size_t GetPageDescCnt() const
Definition: doc.hxx:895
void SetDefault(const SfxPoolItem &)
Set attribute as new default attribute in current document.
Definition: docfmt.cxx:548
void PrtOLENotify(bool bAll)
Definition: docdesc.cxx:812
SwPageDescs m_PageDescs
Definition: doc.hxx:206
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:329
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:158
SwNodes & GetNodes()
Definition: doc.hxx:422
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:371
std::unique_ptr< SwFootnoteInfo > mpFootnoteInfo
Definition: doc.hxx:264
SwPageDesc * MakePageDesc(const OUString &rName, const SwPageDesc *pCpy=nullptr, bool bRegardLanguage=true, bool bBroadcast=false)
Definition: docdesc.cxx:765
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:419
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:649
const SfxPoolItem & GetDefault(sal_uInt16 nFormatHint) const
Get the default attribute in this document.
Definition: docfmt.cxx:672
void CopyMasterFooter(const SwPageDesc &rChged, const SwFormatFooter &rFoot, SwPageDesc &pDesc, bool bLeft, bool bFirst)
Definition: docdesc.cxx:317
::sw::DocumentContentOperationsManager const & GetDocumentContentOperationsManager() const
Definition: doc.cxx:339
bool IsSquaredPageMode() const
Definition: docdesc.cxx:1038
void ChgPageDesc(const OUString &rName, const SwPageDesc &)
Definition: docdesc.cxx:978
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1337
void SetDefaultPageMode(bool bSquaredPageMode)
Definition: docdesc.cxx:1013
std::unique_ptr< SwEndNoteInfo > mpEndNoteInfo
Definition: doc.hxx:265
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:762
bool mbAllOLENotify
Definition: doc.hxx:327
void DelPageDesc(const OUString &rName, bool bBroadcast=false)
Definition: docdesc.cxx:970
SwDocShell * GetDocShell()
Definition: doc.hxx:1370
bool mbOLEPrtNotifyPending
TRUE: Printer has changed.
Definition: doc.hxx:325
const SwPageDesc & GetPageDesc(const size_t i) const
Definition: doc.hxx:896
void CopyMasterHeader(const SwPageDesc &rChged, const SwFormatHeader &rHead, SwPageDesc &pDesc, bool bLeft, bool bFirst)
Definition: docdesc.cxx:239
virtual void UpdateFields()
Definition: fldbas.cxx:219
Content, content of frame (header, footer, fly).
Definition: fmtcntnt.hxx:32
void SetNewContentIdx(const SwNodeIndex *pIdx)
Definition: atrfrm.cxx:596
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
Footer, for pageformats Client of FrameFormat describing the footer.
Definition: fmthdft.hxx:65
bool IsActive() const
Definition: fmthdft.hxx:89
const SwFrameFormat * GetFooterFormat() const
Definition: fmthdft.hxx:85
SfxPoolItem subclass for footnotes and endnotes, stored in the anchor text node.
Definition: fmtftn.hxx:47
sal_uInt16 GetNumber() const
Definition: fmtftn.hxx:73
const OUString & GetNumStr() const
Definition: fmtftn.hxx:72
sal_uInt16 GetNumberRLHidden() const
Definition: fmtftn.hxx:74
Header, for PageFormats Client of FrameFormat describing the header.
Definition: fmthdft.hxx:34
bool IsActive() const
Definition: fmthdft.hxx:58
const SwFrameFormat * GetHeaderFormat() const
Definition: fmthdft.hxx:54
sal_uInt16 GetPoolFormatId() const
Get and set Pool style IDs.
Definition: format.hxx:163
const SwFormatFrameSize & GetFrameSize(bool=true) const
Definition: fmtfsize.hxx:104
void SetPoolHelpId(sal_uInt16 nId)
Definition: format.hxx:168
void SetPoolFormatId(sal_uInt16 nId)
Definition: format.hxx:164
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:618
const SwFormatFooter & GetFooter(bool=true) const
Definition: fmthdft.hxx:99
sal_uInt16 GetPoolHelpId() const
Get and set Help-IDs for document templates.
Definition: format.hxx:167
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
Definition: format.cxx:385
const SwFormatHeader & GetHeader(bool=true) const
Definition: fmthdft.hxx:97
sal_uInt8 GetPoolHlpFileId() const
Definition: format.hxx:169
void SetPoolHlpFileId(sal_uInt8 nId)
Definition: format.hxx:170
const SfxPoolItem & GetFormatAttr(sal_uInt16 nWhich, bool bInParents=true) const
If bInParents is FALSE, search only in this format for attribute.
Definition: format.cxx:366
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:447
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
Style of a layout element.
Definition: frmfmt.hxx:72
TElementType * First()
Definition: calbck.hxx:372
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNode & GetNode() const
Definition: ndindex.hxx:123
SwNodeIndex aStart
Definition: ndindex.hxx:136
SwNodeIndex aEnd
Definition: ndindex.hxx:137
Base class of the Writer document model elements.
Definition: node.hxx:98
bool IsContentNode() const
Definition: node.hxx:188
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:691
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:695
static SwStartNode * MakeEmptySection(SwNode &rWhere, SwStartNodeType=SwNormalStartNode)
Create an empty section of Start- and EndNote.
Definition: nodes.cxx:1917
void Copy_(const SwNodeRange &rRg, SwNode &rInsPos, bool bNewFrames=true) const
Definition: ndarr.hxx:179
const SwOLEObj & GetOLEObj() const
Definition: ndole.hxx:116
void SetOLESizeInvalid(bool b)
Definition: ndole.hxx:138
svt::EmbeddedObjectRef & GetObject()
Definition: ndole.cxx:1063
css::uno::Reference< css::embed::XEmbeddedObject > const & GetOleRef()
Definition: ndole.cxx:1012
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:188
sal_uInt16 GetPoolFormatId() const
Query and set PoolFormat-Id.
Definition: pagedesc.hxx:275
void ChgFooterShare(bool bNew)
Definition: pagedesc.hxx:334
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
const OUString & GetName() const
Definition: pagedesc.hxx:196
void SetPoolHlpFileId(sal_uInt8 const nId)
Definition: pagedesc.hxx:280
void SetFollow(const SwPageDesc *pNew)
Definition: pagedesc.hxx:314
SwFrameFormat & GetMaster()
Definition: pagedesc.hxx:238
bool IsHeaderShared() const
Definition: pagedesc.hxx:319
const SvxNumberType & GetNumType() const
Definition: pagedesc.hxx:202
void ChgHeaderShare(bool bNew)
Definition: pagedesc.hxx:327
bool IsFirstShared() const
Definition: pagedesc.cxx:396
bool IsFooterShared() const
Definition: pagedesc.hxx:323
SwFrameFormat & GetFirstLeft()
Definition: pagedesc.hxx:241
SwFrameFormat & GetFirstMaster()
Definition: pagedesc.hxx:240
void SetPoolFormatId(sal_uInt16 const nId)
Definition: pagedesc.hxx:276
void SetPoolHelpId(sal_uInt16 const nId)
Definition: pagedesc.hxx:278
bool GetLandscape() const
Definition: pagedesc.hxx:199
bool HasStashedFormat(bool bHeader, bool bLeft, bool bFirst)
Checks if the pagedescriptor has a stashed format according to the parameters or not.
Definition: pagedesc.cxx:473
UseOnPage GetUseOn() const
Definition: pagedesc.hxx:353
void SetNumType(const SvxNumberType &rNew)
Definition: pagedesc.hxx:203
bool SetName(const OUString &rNewName)
Definition: pagedesc.cxx:147
void SetFootnoteInfo(const SwPageFootnoteInfo &rNew)
Definition: pagedesc.hxx:207
SwPageDesc * m_pFollow
Definition: pagedesc.hxx:164
SwFrameFormat & GetLeft()
Definition: pagedesc.hxx:239
void ChgFirstShare(bool bNew)
Definition: pagedesc.cxx:401
const SwPageDesc * GetFollow() const
Definition: pagedesc.hxx:267
const SwPageFootnoteInfo & GetFootnoteInfo() const
Definition: pagedesc.hxx:205
void RemoveStashedFormat(bool bHeader, bool bLeft, bool bFirst)
Gives the feature of removing the stashed format by hand if it is necessary.
Definition: pagedesc.cxx:517
void SetRegisterFormatColl(const SwTextFormatColl *rFormat)
set the style for the grid alignment
Definition: pagedesc.cxx:211
void SetUseOn(UseOnPage eNew)
Same as WriteUseOn(), but the >= HeaderShare part of the bitfield is not modified.
Definition: pagedesc.hxx:341
void SetLandscape(bool bNew)
Definition: pagedesc.hxx:200
const SwFrameFormat * GetStashedFrameFormat(bool bHeader, bool bLeft, bool bFirst) const
Used to restore hidden header/footer formats.
Definition: pagedesc.cxx:445
const SwTextFormatColl * GetRegisterFormatColl() const
retrieve the style for the grid alignment
Definition: pagedesc.cxx:223
std::pair< const_iterator, bool > push_back(const value_type &x)
Definition: pagedesc.cxx:753
const_iterator begin() const
Definition: pagedesc.hxx:455
void erase(const value_type &x)
Definition: pagedesc.cxx:764
size_t size() const
Definition: pagedesc.hxx:442
const_iterator end() const
Definition: pagedesc.hxx:456
ByPos::const_iterator const_iterator
Definition: pagedesc.hxx:431
const_iterator find(const OUString &name) const
Definition: pagedesc.hxx:449
bool contains(const value_type &x) const
Definition: pagedesc.hxx:458
The root element of a Writer document layout.
Definition: rootfrm.hxx:85
void StartAllAction()
Set up Start-/EndAction for all Shells on an as high as possible (Shell section) level.
Definition: pagechg.cxx:1920
void EndAllAction()
Definition: pagechg.cxx:1932
Starts a section of nodes in the document model.
Definition: node.hxx:348
const SwFormatFootnote & GetFootnote() const
Definition: txatbase.hxx:208
SwTextAttr subclass for footnotes and endnotes.
Definition: txtftn.hxx:34
void SetNumber(sal_uInt16 nNumber, sal_uInt16 nNumberRLHidden, const OUString &sNumStr)
Definition: atrftn.cxx:367
void SwitchPaperMode(bool bNew)
Definition: atrfrm.cxx:2489
void SetSquaredMode(bool bNew)
Definition: tgrditem.hxx:106
bool IsSquaredMode() const
Definition: tgrditem.hxx:104
size_type size() const
void CopyFlyInFlyImpl(const SwNodeRange &rRg, SwPaM const *const pCopiedPaM, SwNode &rStartIdx, const bool bCopyFlyAtFly=false, SwCopyFlags flags=SwCopyFlags::Default) const
ring_container GetRingContainer()
Definition: ring.hxx:240
static bool IsFuzzing()
#define SID_ATTR_PAGE_COLUMN
Definition: cmdid.h:896
static void lcl_DescSetAttr(const SwFrameFormat &rSource, SwFrameFormat &rDest, const bool bPage=true)
Definition: docdesc.cxx:132
static void lcl_DefaultPageFormat(sal_uInt16 nPoolFormatId, SwFrameFormat &rFormat1, SwFrameFormat &rFormat2, SwFrameFormat &rFormat3, SwFrameFormat &rFormat4)
Definition: docdesc.cxx:66
IMPL_LINK_NOARG(SwDoc, DoUpdateModifiedOLE, Timer *, void)
Definition: docdesc.cxx:897
static SwPageDesc * lcl_FindPageDesc(const SwPageDescs *pPageDescs, size_t *pPos, const OUString &rName)
Definition: docdesc.cxx:931
@ Fixed
Frame cannot be moved in Var-direction.
SvxFrameDirection
SfxHintId
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(126)
constexpr TypedWhichId< SwFormatHeader > RES_HEADER(102)
constexpr TypedWhichId< SwFormatFrameSize > RES_FRM_SIZE(89)
constexpr TypedWhichId< SwFormatCol > RES_COL(115)
constexpr TypedWhichId< SvxShadowItem > RES_SHADOW(113)
constexpr TypedWhichId< SfxBoolItem > RES_RTL_GUTTER(139)
constexpr TypedWhichId< SvXMLAttrContainerItem > RES_UNKNOWNATR_CONTAINER(RES_UNKNOWNATR_BEGIN)
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(111)
constexpr TypedWhichId< SwTextGridItem > RES_TEXTGRID(121)
constexpr TypedWhichId< SwHeaderAndFooterEatSpacingItem > RES_HEADER_FOOTER_EAT_SPACING(127)
constexpr TypedWhichId< SwFormatFooter > RES_FOOTER(103)
constexpr TypedWhichId< SvxPaperBinItem > RES_PAPER_BIN(90)
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(97)
constexpr TypedWhichId< SvxULSpaceItem > RES_UL_SPACE(98)
constexpr TypedWhichId< SfxBoolItem > RES_BACKGROUND_FULL_SIZE(138)
std::vector< SvGlobalName > * pGlobalOLEExcludeList
Definition: init.cxx:442
LanguageType GetAppLanguage()
Definition: init.cxx:741
OUString aName
sal_Int64 n
sal_uInt16 nPos
#define SAL_WARN_IF(condition, area, stream)
void StartProgress(TranslateId pMessResId, tools::Long nStartValue, tools::Long nEndValue, SwDocShell *pDocShell)
Definition: mainwn.cxx:52
void EndProgress(SwDocShell const *pDocShell)
Definition: mainwn.cxx:92
void SetProgressState(tools::Long nPosition, SwDocShell const *pDocShell)
Definition: mainwn.cxx:82
int i
constexpr auto toTwips(N number, Length from)
void CopyBookmarks(const SwPaM &rPam, const SwPosition &rCpyPam, SwCopyFlags flags)
const LocaleDataWrapper & GetLocaleData()
@ SwHeaderStartNode
Definition: ndtyp.hxx:56
@ SwFooterStartNode
Definition: ndtyp.hxx:57
sal_Int16 nId
SvxFrameDirection GetDefaultFrameDirection(LanguageType nLanguage)
Return the AutoCollection by its Id.
Definition: poolfmt.cxx:79
@ RES_POOLPAGE_HTML
HTML.
Definition: poolfmt.hxx:176
Marks a position in the document model.
Definition: pam.hxx:38
SfxStyleFamily
#define INVALID_TWIPS
Definition: swtypes.hxx:54
SwUndoId
Definition: swundo.hxx:30
constexpr sal_uInt16 XATTR_FILL_FIRST(XATTRSET_LINE+1)
constexpr sal_uInt16 XATTR_FILL_LAST(XATTR_FILLUSESLIDEBACKGROUND)