LibreOffice Module sw (master)  1
section.cxx
Go to the documentation of this file.
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3  * This file is part of the LibreOffice project.
4  *
5  * This Source Code Form is subject to the terms of the Mozilla Public
6  * License, v. 2.0. If a copy of the MPL was not distributed with this
7  * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8  *
9  * This file incorporates work covered by the following license notice:
10  *
11  * Licensed to the Apache Software Foundation (ASF) under one or more
12  * contributor license agreements. See the NOTICE file distributed
13  * with this work for additional information regarding copyright
14  * ownership. The ASF licenses this file to you under the Apache
15  * License, Version 2.0 (the "License"); you may not use this file
16  * except in compliance with the License. You may obtain a copy of
17  * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18  */
19 
20 #include <libxml/xmlstring.h>
21 #include <libxml/xmlwriter.h>
22 #include <stdlib.h>
23 #include <hintids.hxx>
24 #include <osl/diagnose.h>
25 #include <sot/exchange.hxx>
26 #include <svl/stritem.hxx>
27 #include <sfx2/docfile.hxx>
28 #include <editeng/protitem.hxx>
29 #include <sfx2/linkmgr.hxx>
30 #include <sfx2/sfxsids.hrc>
31 #include <docary.hxx>
32 #include <fmtcntnt.hxx>
33 #include <fmtpdsc.hxx>
34 #include <doc.hxx>
35 #include <IDocumentUndoRedo.hxx>
41 #include <IDocumentState.hxx>
43 #include <node.hxx>
44 #include <pam.hxx>
45 #include <frmatr.hxx>
46 #include <frmtool.hxx>
47 #include <editsh.hxx>
48 #include <hints.hxx>
49 #include <docsh.hxx>
50 #include <ndtxt.hxx>
51 #include <section.hxx>
52 #include <swserv.hxx>
53 #include <shellio.hxx>
54 #include <poolfmt.hxx>
55 #include <swbaslnk.hxx>
56 #include <mvsave.hxx>
57 #include <ftnidx.hxx>
58 #include <doctxm.hxx>
59 #include <fmteiro.hxx>
60 #include <unosection.hxx>
61 #include <calbck.hxx>
62 #include <fmtclds.hxx>
63 #include <algorithm>
64 #include "ndsect.hxx"
65 
66 using namespace ::com::sun::star;
67 
68 namespace {
69  class SwIntrnlSectRefLink : public SwBaseLink
70  {
71  SwSectionFormat& m_rSectFormat;
72 
73  public:
74  SwIntrnlSectRefLink(SwSectionFormat& rFormat, SfxLinkUpdateMode nUpdateType)
75  : SwBaseLink(nUpdateType, SotClipboardFormatId::RTF)
76  , m_rSectFormat(rFormat)
77  {}
78 
79  virtual void Closed() override;
80  virtual ::sfx2::SvBaseLink::UpdateResult DataChanged(
81  const OUString& rMimeType, const css::uno::Any & rValue ) override;
82 
83  virtual const SwNode* GetAnchor() const override;
84  virtual bool IsInRange( SwNodeOffset nSttNd, SwNodeOffset nEndNd ) const override;
85 
86  SwSectionNode* GetSectNode()
87  {
88  const SwNode* pSectNd( GetAnchor() );
89  return const_cast<SwSectionNode*>( dynamic_cast<const SwSectionNode*>( pSectNd ) );
90  }
91  };
92 }
93 
94 SwSectionData::SwSectionData(SectionType const eType, OUString const& rName)
95  : m_eType(eType)
96  , m_sSectionName(rName)
97  , m_bHiddenFlag(false)
98  , m_bProtectFlag(false)
99  , m_bEditInReadonlyFlag(false) // edit in readonly sections
100  , m_bHidden(false)
101  , m_bCondHiddenFlag(true)
102  , m_bConnectFlag(true)
103 {
104 }
105 
106 // this must have the same semantics as operator=()
108  : m_eType(rSection.GetType())
109  , m_sSectionName(rSection.GetSectionName())
110  , m_sCondition(rSection.GetCondition())
111  , m_sLinkFileName(rSection.GetLinkFileName())
112  , m_sLinkFilePassword(rSection.GetLinkFilePassword())
113  , m_Password(rSection.GetPassword())
114  , m_bHiddenFlag(rSection.IsHiddenFlag())
115  , m_bProtectFlag(rSection.IsProtect())
116  // edit in readonly sections
117  , m_bEditInReadonlyFlag(rSection.IsEditInReadonly())
118  , m_bHidden(rSection.IsHidden())
119  , m_bCondHiddenFlag(true)
120  , m_bConnectFlag(rSection.IsConnectFlag())
121 {
122 }
123 
124 // this must have the same semantics as operator=()
126  : m_eType(rOther.m_eType)
127  , m_sSectionName(rOther.m_sSectionName)
128  , m_sCondition(rOther.m_sCondition)
129  , m_sLinkFileName(rOther.m_sLinkFileName)
130  , m_sLinkFilePassword(rOther.m_sLinkFilePassword)
131  , m_Password(rOther.m_Password)
132  , m_bHiddenFlag(rOther.m_bHiddenFlag)
133  , m_bProtectFlag(rOther.m_bProtectFlag)
134  // edit in readonly sections
135  , m_bEditInReadonlyFlag(rOther.m_bEditInReadonlyFlag)
136  , m_bHidden(rOther.m_bHidden)
137  , m_bCondHiddenFlag(true)
138  , m_bConnectFlag(rOther.m_bConnectFlag)
139 {
140 }
141 
142 // the semantics here are weird for reasons of backward compatibility
144 {
145  m_eType = rOther.m_eType;
147  m_sCondition = rOther.m_sCondition;
151  m_Password = rOther.m_Password;
152 
155 
156  m_bHidden = rOther.m_bHidden;
157  // FIXME: old code did not assign m_bHiddenFlag ?
158  // FIXME: why should m_bCondHiddenFlag always default to true?
159  m_bCondHiddenFlag = true;
160 
161  return *this;
162 }
163 
164 // the semantics here are weird for reasons of backward compatibility
165 bool SwSectionData::operator==(SwSectionData const& rOther) const
166 {
167  return (m_eType == rOther.m_eType)
168  && (m_sSectionName == rOther.m_sSectionName)
169  && (m_sCondition == rOther.m_sCondition)
170  && (m_bHidden == rOther.m_bHidden)
171  && (m_bProtectFlag == rOther.m_bProtectFlag)
173  && (m_sLinkFileName == rOther.m_sLinkFileName)
175  && (m_Password == rOther.m_Password);
176  // FIXME: old code ignored m_bCondHiddenFlag m_bHiddenFlag m_bConnectFlag
177 }
178 
179 OUString SwSectionData::CollapseWhiteSpaces(const OUString& sName)
180 {
181  const sal_Int32 nLen = sName.getLength();
182  const sal_Unicode cRef = ' ';
183  OUStringBuffer aBuf(nLen+1);
184  for (sal_Int32 i = 0; i<nLen; )
185  {
186  const sal_Unicode cCur = sName[i++];
187  aBuf.append(cCur);
188  if (cCur!=cRef)
189  continue;
190  while (i<nLen && sName[i]==cRef)
191  ++i;
192  }
193  return aBuf.makeStringAndClear();
194 }
195 
197  SectionType const eType, OUString const& rName, SwSectionFormat & rFormat)
198  : SwClient(& rFormat)
199  , m_Data(eType, rName)
200 {
201  SwSection *const pParentSect = GetParent();
202  if( pParentSect )
203  {
204  m_Data.SetProtectFlag( pParentSect->IsProtectFlag() );
205  // edit in readonly sections
207  }
208 
209  if (!m_Data.IsProtectFlag())
210  {
212  }
213 
214  if (!m_Data.IsEditInReadonlyFlag()) // edit in readonly sections
215  {
217  }
218 }
219 
221 {
222  SwSectionFormat* pFormat = GetFormat();
223  if( !pFormat )
224  return;
225 
226  SwDoc* pDoc = pFormat->GetDoc();
227  if( pDoc->IsInDtor() )
228  {
229  // We reattach our Format to the default FrameFormat
230  // to not get any dependencies
231  if( pFormat->DerivedFrom() != pDoc->GetDfltFrameFormat() )
232  pFormat->RegisterToFormat( *pDoc->GetDfltFrameFormat() );
233  }
234  else
235  {
236  pFormat->Remove( this ); // remove
237 
239  {
241  }
242 
243  if (m_RefObj.is())
244  {
246  }
247 
248  // If the Section is the last Client in the Format we can delete it
249  pFormat->RemoveAllUnos();
250  if( !pFormat->HasWriterListeners() )
251  {
252  // Do not add to the Undo. This should've happened earlier.
253  ::sw::UndoGuard const undoGuard(pDoc->GetIDocumentUndoRedo());
254  pDoc->DelSectionFormat( pFormat );
255  }
256  }
257  if (m_RefObj.is())
258  {
259  m_RefObj->Closed();
260  }
261 }
262 
264 {
265  bool const bOldHidden( m_Data.IsHidden() );
266  m_Data = rData;
267  // The next two may actually overwrite the m_Data.m_bProtect or EditInReadonly Flag
268  // in Modify, which should result in same flag value as the old code!
269  SetProtect(m_Data.IsProtectFlag());
270  SetEditInReadonly(m_Data.IsEditInReadonlyFlag());
271  if (bOldHidden != m_Data.IsHidden()) // check if changed...
272  {
273  ImplSetHiddenFlag(m_Data.IsHidden(), m_Data.IsCondHidden());
274  }
275 }
276 
277 bool SwSection::DataEquals(SwSectionData const& rCmp) const
278 {
279  // note that the old code compared the flags of the parameter with the
280  // format attributes of this; the following mess should do the same...
281  (void) GetLinkFileName(); // updates m_sLinkFileName
282  bool const bProtect(m_Data.IsProtectFlag());
283  bool const bEditInReadonly(m_Data.IsEditInReadonlyFlag());
286  bool const bResult( m_Data == rCmp );
287  m_Data.SetProtectFlag(bProtect);
288  m_Data.SetEditInReadonlyFlag(bEditInReadonly);
289  return bResult;
290 }
291 
292 void SwSection::ImplSetHiddenFlag(bool const bTmpHidden, bool const bCondition)
293 {
294  SwSectionFormat* pFormat = GetFormat();
295  OSL_ENSURE(pFormat, "ImplSetHiddenFlag: no format?");
296  if( !pFormat )
297  return;
298 
299  const bool bHide = bTmpHidden && bCondition;
300 
301  if (bHide) // should be hidden
302  {
303  if (!m_Data.IsHiddenFlag()) // is not hidden
304  {
305  // Is the Parent hidden?
306  // This should be shown by the bHiddenFlag.
307 
308  // Tell all Children that they are hidden
309  const SwMsgPoolItem aMsgItem( RES_SECTION_HIDDEN );
310  pFormat->CallSwClientNotify(sw::LegacyModifyHint(&aMsgItem, &aMsgItem));
311 
312  // Delete all Frames
313  pFormat->DelFrames();
314  }
315  }
316  else if (m_Data.IsHiddenFlag()) // show Nodes again
317  {
318  // Show all Frames (Child Sections are accounted for by MakeFrames)
319  // Only if the Parent Section is not restricting us!
320  SwSection* pParentSect = pFormat->GetParentSection();
321  if( !pParentSect || !pParentSect->IsHiddenFlag() )
322  {
323  // Tell all Children that the Parent is not hidden anymore
324  const SwMsgPoolItem aMsgItem( RES_SECTION_NOT_HIDDEN );
325  pFormat->CallSwClientNotify(sw::LegacyModifyHint(&aMsgItem, &aMsgItem));
326 
327  pFormat->MakeFrames();
328  }
329  }
330 }
331 
333 {
334  const SwSection* pSect = this;
335  do {
336  if( pSect->IsHidden() && pSect->IsCondHidden() )
337  return true;
338  } while( nullptr != ( pSect = pSect->GetParent()) );
339 
340  return false;
341 }
342 
344 {
345  SwSectionFormat const *const pFormat( GetFormat() );
346  OSL_ENSURE(pFormat, "SwSection::IsProtect: no format?");
347  return pFormat
348  ? pFormat->GetProtect().IsContentProtected()
349  : IsProtectFlag();
350 }
351 
352 // edit in readonly sections
354 {
355  SwSectionFormat const *const pFormat( GetFormat() );
356  OSL_ENSURE(pFormat, "SwSection::IsEditInReadonly: no format?");
357  return pFormat
358  ? pFormat->GetEditInReadonly().GetValue()
360 }
361 
362 void SwSection::SetHidden(bool const bFlag)
363 {
364  if (!m_Data.IsHidden() == !bFlag)
365  return;
366 
367  m_Data.SetHidden(bFlag);
369 }
370 
371 void SwSection::SetProtect(bool const bFlag)
372 {
373  SwSectionFormat *const pFormat( GetFormat() );
374  OSL_ENSURE(pFormat, "SwSection::SetProtect: no format?");
375  if (pFormat)
376  {
377  SvxProtectItem aItem( RES_PROTECT );
378  aItem.SetContentProtect( bFlag );
379  pFormat->SetFormatAttr( aItem );
380  // note: this will call m_Data.SetProtectFlag via Modify!
381  }
382  else
383  {
384  m_Data.SetProtectFlag(bFlag);
385  }
386 }
387 
388 // edit in readonly sections
389 void SwSection::SetEditInReadonly(bool const bFlag)
390 {
391  SwSectionFormat *const pFormat( GetFormat() );
392  OSL_ENSURE(pFormat, "SwSection::SetEditInReadonly: no format?");
393  if (pFormat)
394  {
396  aItem.SetValue( bFlag );
397  pFormat->SetFormatAttr( aItem );
398  // note: this will call m_Data.SetEditInReadonlyFlag via Modify!
399  }
400  else
401  {
403  }
404 }
405 
406 void SwSection::SwClientNotify(const SwModify&, const SfxHint& rHint)
407 {
408  if (rHint.GetId() != SfxHintId::SwLegacyModify)
409  return;
410  auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
411  auto pOld = pLegacy->m_pOld;
412  auto pNew = pLegacy->m_pNew;
413  bool bUpdateFootnote = false;
414  switch(pLegacy->GetWhich())
415  {
416  case RES_ATTRSET_CHG:
417  if (pNew && pOld)
418  {
419  SfxItemSet* pNewSet = const_cast<SwAttrSetChg*>(static_cast<const SwAttrSetChg*>(pNew))->GetChgSet();
420  SfxItemSet* pOldSet = const_cast<SwAttrSetChg*>(static_cast<const SwAttrSetChg*>(pOld))->GetChgSet();
421  const SfxPoolItem* pItem;
422 
423  if( SfxItemState::SET == pNewSet->GetItemState(
424  RES_PROTECT, false, &pItem ) )
425  {
426  m_Data.SetProtectFlag( static_cast<SvxProtectItem const*>(pItem)
427  ->IsContentProtected() );
428  pNewSet->ClearItem( RES_PROTECT );
429  pOldSet->ClearItem( RES_PROTECT );
430  }
431 
432  // --> edit in readonly sections
433  if( SfxItemState::SET == pNewSet->GetItemState(
434  RES_EDIT_IN_READONLY, false, &pItem ) )
435  {
437  static_cast<SwFormatEditInReadonly const*>(pItem)->GetValue());
438  pNewSet->ClearItem( RES_EDIT_IN_READONLY );
439  pOldSet->ClearItem( RES_EDIT_IN_READONLY );
440  }
441 
442  if( SfxItemState::SET == pNewSet->GetItemState(
443  RES_FTN_AT_TXTEND, false, &pItem ) ||
444  SfxItemState::SET == pNewSet->GetItemState(
445  RES_END_AT_TXTEND, false, &pItem ))
446  {
447  bUpdateFootnote = true;
448  }
449 
450  if( !pNewSet->Count() )
451  return;
452  }
453  break;
454 
455  case RES_PROTECT:
456  if( pNew )
457  {
458  bool bNewFlag =
459  static_cast<const SvxProtectItem*>(pNew)->IsContentProtected();
460  if( !bNewFlag )
461  {
462  // Switching off: See if there is protection transferred
463  // by the Parents
464  const SwSection* pSect = this;
465  do {
466  if( pSect->IsProtect() )
467  {
468  bNewFlag = true;
469  break;
470  }
471  pSect = pSect->GetParent();
472  } while (pSect);
473  }
474 
475  m_Data.SetProtectFlag( bNewFlag );
476  }
477  return;
478  // edit in readonly sections
480  if( pNew )
481  {
482  const bool bNewFlag =
483  static_cast<const SwFormatEditInReadonly*>(pNew)->GetValue();
484  m_Data.SetEditInReadonlyFlag( bNewFlag );
485  }
486  return;
487 
488  case RES_SECTION_HIDDEN:
489  m_Data.SetHiddenFlag(true);
490  return;
491 
494  return;
495 
496  case RES_COL:
497  // Is handled by the Layout, if appropriate
498  break;
499 
500  case RES_FTN_AT_TXTEND:
501  if( pNew && pOld )
502  {
503  bUpdateFootnote = true;
504  }
505  break;
506 
507  case RES_END_AT_TXTEND:
508  if( pNew && pOld )
509  {
510  bUpdateFootnote = true;
511  }
512  break;
513 
514  default:
515  CheckRegistration( pOld );
516  break;
517  }
518 
519  if( bUpdateFootnote )
520  {
521  SwSectionNode* pSectNd = GetFormat()->GetSectionNode();
522  if( pSectNd )
523  pSectNd->GetDoc().GetFootnoteIdxs().UpdateFootnote(SwNodeIndex( *pSectNd ));
524  }
525 }
526 
528 {
529  m_RefObj = pObj;
530 }
531 
532 void SwSection::SetCondHidden(bool const bFlag)
533 {
534  if (!m_Data.IsCondHidden() == !bFlag)
535  return;
536 
537  m_Data.SetCondHidden(bFlag);
539 }
540 
541 // Set/remove the linked FileName
542 OUString const & SwSection::GetLinkFileName() const
543 {
544  if (m_RefLink.is())
545  {
546  OUString sTmp;
547  switch (m_Data.GetType())
548  {
550  sTmp = m_RefLink->GetLinkSourceName();
551  break;
552 
554  {
555  OUString sRange;
556  OUString sFilter;
557  if (m_RefLink->GetLinkManager() &&
559  m_RefLink.get(), nullptr, &sTmp, &sRange, &sFilter ))
560  {
561  sTmp += OUStringChar(sfx2::cTokenSeparator) + sFilter
562  + OUStringChar(sfx2::cTokenSeparator) + sRange;
563  }
564  else if( GetFormat() && !GetFormat()->GetSectionNode() )
565  {
566  // If the Section is in the UndoNodesArray, the LinkManager
567  // does not contain the Link, thus it cannot be queried for it.
568  // Thus return the current Name.
569  return m_Data.GetLinkFileName();
570  }
571  }
572  break;
573  default: break;
574  }
575  m_Data.SetLinkFileName(sTmp);
576  }
577  return m_Data.GetLinkFileName();
578 }
579 
580 void SwSection::SetLinkFileName(const OUString& rNew)
581 {
582  if (m_RefLink.is())
583  {
584  m_RefLink->SetLinkSourceName( rNew );
585  }
586  m_Data.SetLinkFileName(rNew);
587 }
588 
589 // If it was a Linked Section, we need to make all Child Links visible
591 {
592  const SwNode* pNd;
593  const ::sfx2::SvBaseLinks& rLnks = rSectNd.GetDoc().getIDocumentLinksAdministration().GetLinkManager().GetLinks();
594  for( auto n = rLnks.size(); n; )
595  {
596  sfx2::SvBaseLink& rBLnk = *rLnks[--n];
597  if (!rBLnk.IsVisible() && dynamic_cast<const SwBaseLink*>(&rBLnk) != nullptr
598  && nullptr != (pNd = static_cast<SwBaseLink&>(rBLnk).GetAnchor()))
599  {
600  pNd = pNd->StartOfSectionNode(); // If it's a SectionNode
601  const SwSectionNode* pParent;
602  while( nullptr != ( pParent = pNd->FindSectionNode() ) &&
603  ( SectionType::Content == pParent->GetSection().GetType()
604  || pNd == &rSectNd ))
605  pNd = pParent->StartOfSectionNode();
606 
607  // It's within a normal Section, so show again
608  if( !pParent )
609  rBLnk.SetVisible(true);
610  }
611  }
612 }
613 
615 {
616  const SwTOXBase* pRet = nullptr;
618  pRet = dynamic_cast<const SwTOXBaseSection*>(this);
619  return pRet;
620 }
621 
623  : SwFrameFormat( pDoc->GetAttrPool(), OUString(), pDrvdFrame )
624 {
625  LockModify();
627  UnlockModify();
628 }
629 
631 {
632  if( GetDoc()->IsInDtor() )
633  return;
634 
635  SwSectionNode* pSectNd;
636  const SwNodeIndex* pIdx = GetContent( false ).GetContentIdx();
637  if( pIdx && &GetDoc()->GetNodes() == &pIdx->GetNodes() &&
638  nullptr != (pSectNd = pIdx->GetNode().GetSectionNode() ))
639  {
640  SwSection& rSect = pSectNd->GetSection();
641  // If it was a linked Section, we need to make all Child Links
642  // visible again
643  if( rSect.IsConnected() )
645 
646  // Check whether we need to be visible, before deleting the Nodes
647  if( rSect.IsHiddenFlag() )
648  {
649  SwSection* pParentSect = rSect.GetParent();
650  if( !pParentSect || !pParentSect->IsHiddenFlag() )
651  {
652  // Make Nodes visible again
653  rSect.SetHidden(false);
654  }
655  }
656  // mba: test iteration; objects are removed while iterating
657  // use hint which allows to specify, if the content shall be saved or not
659 
660  // Raise the Section up
661  SwNodeRange aRg( *pSectNd, SwNodeOffset(0), *pSectNd->EndOfSectionNode() );
662  GetDoc()->GetNodes().SectionUp( &aRg );
663  }
664  LockModify();
666  UnlockModify();
667 }
668 
670 {
672 }
673 
674 // Do not destroy all Frames in aDepend (Frames are recognized with a dynamic_cast).
676 {
677  SwSectionNode* pSectNd;
678  const SwNodeIndex* pIdx = GetContent(false).GetContentIdx();
679  if( pIdx && &GetDoc()->GetNodes() == &pIdx->GetNodes() &&
680  nullptr != (pSectNd = pIdx->GetNode().GetSectionNode() ))
681  {
682  // First delete the <SwSectionFrame> of the <SwSectionFormat> instance
683  // mba: test iteration as objects are removed in iteration
684  // use hint which allows to specify, if the content shall be saved or not
686 
687  // Then delete frames of the nested <SwSectionFormat> instances
689  SwSectionFormat *pLast = aIter.First();
690  while ( pLast )
691  {
692  pLast->DelFrames();
693  pLast = aIter.Next();
694  }
695 
696  SwNodeOffset nEnd = pSectNd->EndOfSectionIndex();
697  SwNodeOffset nStart = pSectNd->GetIndex()+1;
698  sw_DeleteFootnote( pSectNd, nStart, nEnd );
699  }
700  if( !pIdx )
701  return;
702 
703  // Send Hint for PageDesc. Actually the Layout contained in the
704  // Paste of the Frame itself would need to do this. But that leads
705  // to subsequent errors, which we'd need to solve at run-time.
706  SwNodeIndex aNextNd( *pIdx );
707  SwContentNode* pCNd = GetDoc()->GetNodes().GoNextSection( &aNextNd, true, false );
708  if( pCNd )
709  {
710  const SfxPoolItem& rItem = pCNd->GetSwAttrSet().Get(RES_PAGEDESC);
711  pCNd->CallSwClientNotify(sw::LegacyModifyHint(&rItem, &rItem));
712  }
713 }
714 
715 // Create the Views
717 {
718  SwSectionNode* pSectNd;
719  const SwNodeIndex* pIdx = GetContent(false).GetContentIdx();
720 
721  if( pIdx && &GetDoc()->GetNodes() == &pIdx->GetNodes() &&
722  nullptr != (pSectNd = pIdx->GetNode().GetSectionNode() ))
723  {
724  SwNodeIndex aIdx( *pIdx );
725  pSectNd->MakeOwnFrames( &aIdx );
726  }
727 }
728 
729 void SwSectionFormat::SwClientNotify(const SwModify& rMod, const SfxHint& rHint)
730 {
731  if (rHint.GetId() != SfxHintId::SwLegacyModify)
732  return;
733  auto pLegacy = static_cast<const sw::LegacyModifyHint*>(&rHint);
734  sal_uInt16 nWhich = pLegacy->GetWhich();
735  auto pOld = pLegacy->m_pOld;
736  auto pNew = pLegacy->m_pNew;
737  switch( nWhich )
738  {
739  case RES_ATTRSET_CHG:
740  if (HasWriterListeners() && pOld && pNew)
741  {
742  SfxItemSet* pNewSet = const_cast<SwAttrSetChg*>(static_cast<const SwAttrSetChg*>(pNew))->GetChgSet();
743  SfxItemSet* pOldSet = const_cast<SwAttrSetChg*>(static_cast<const SwAttrSetChg*>(pOld))->GetChgSet();
744  const SfxPoolItem *pItem;
745  if( SfxItemState::SET == pNewSet->GetItemState(
746  RES_PROTECT, false, &pItem ))
747  {
748  GetNotifier().Broadcast(sw::LegacyModifyHint(pItem, pItem));
749  pNewSet->ClearItem( RES_PROTECT );
750  pOldSet->ClearItem( RES_PROTECT );
751  }
752 
753  // --> edit in readonly sections
754  if( SfxItemState::SET == pNewSet->GetItemState(
755  RES_EDIT_IN_READONLY, false, &pItem ) )
756  {
757  GetNotifier().Broadcast(sw::LegacyModifyHint(pItem, pItem));
758  pNewSet->ClearItem( RES_EDIT_IN_READONLY );
759  pOldSet->ClearItem( RES_EDIT_IN_READONLY );
760  }
761 
762  if( SfxItemState::SET == pNewSet->GetItemState(
763  RES_FTN_AT_TXTEND, false, &pItem ))
764  {
765  GetNotifier().Broadcast(sw::LegacyModifyHint(pItem, pItem));
766  pNewSet->ClearItem( RES_FTN_AT_TXTEND );
767  pOldSet->ClearItem( RES_FTN_AT_TXTEND );
768  }
769  if( SfxItemState::SET == pNewSet->GetItemState(
770  RES_END_AT_TXTEND, false, &pItem ))
771  {
772  GetNotifier().Broadcast(sw::LegacyModifyHint(pItem, pItem));
773  pNewSet->ClearItem( RES_END_AT_TXTEND );
774  pOldSet->ClearItem( RES_END_AT_TXTEND );
775  }
776  if( !static_cast<const SwAttrSetChg*>(pOld)->GetChgSet()->Count() )
777  return;
778  }
779  break;
780 
781  case RES_SECTION_HIDDEN:
783  {
784  auto pSect = GetSection();
785  if(!pSect || (RES_SECTION_HIDDEN == nWhich) == pSect->IsHiddenFlag()) // already at target state, skipping.
786  return;
787  }
788  [[fallthrough]];
789  case RES_FTN_AT_TXTEND:
790  case RES_END_AT_TXTEND:
792  return;
793  case RES_PROTECT:
794  case RES_EDIT_IN_READONLY: // edit in readonly sections
795  // Pass through these Messages until the End of the tree!
797  return; // That's it!
798 
799  case RES_OBJECTDYING:
800  if( !GetDoc()->IsInDtor() && pOld &&
801  static_cast<const SwPtrMsgPoolItem *>(pOld)->pObject == static_cast<void*>(GetRegisteredIn()) )
802  {
803  // My Parents will be destroyed, so get the Parent's Parent
804  // and update
805  SwFrameFormat::SwClientNotify(rMod, rHint);
806  UpdateParent();
807  return;
808  }
809  break;
810 
811  case RES_FMT_CHG:
812  if( !GetDoc()->IsInDtor() &&
813  static_cast<const SwFormatChg*>(pNew)->pChangedFormat == static_cast<void*>(GetRegisteredIn()) &&
814  dynamic_cast<const SwSectionFormat*>(static_cast<const SwFormatChg*>(pNew)->pChangedFormat) != nullptr )
815  {
816  // My Parent will be changed, thus I need to update
817  SwFrameFormat::SwClientNotify(rMod, rHint);
818  UpdateParent();
819  return;
820  }
821  break;
822  }
823  SwFrameFormat::SwClientNotify(rMod, rHint);
824 
825  if (pOld && (RES_REMOVE_UNO_OBJECT == pOld->Which()))
826  { // invalidate cached uno object
827  SetXTextSection(uno::Reference<text::XTextSection>(nullptr));
828  }
829 }
830 
831 // Get info from the Format
833 {
834  switch( rInfo.Which() )
835  {
836  case RES_FINDNEARESTNODE:
837  if( GetFormatAttr( RES_PAGEDESC ).GetPageDesc() )
838  {
839  const SwSectionNode* pNd = GetSectionNode();
840  if( pNd )
841  static_cast<SwFindNearestNode&>(rInfo).CheckNode( *pNd );
842  }
843  return true;
844 
845  case RES_CONTENT_VISIBLE:
846  {
847  SwFrame* pFrame = SwIterator<SwFrame,SwFormat>(*this).First();
848  // if the current section has no own frame search for the children
849  if(!pFrame)
850  {
852  SwSectionFormat* pChild = aFormatIter.First();
853  while(pChild && !pFrame)
854  {
855  pFrame = SwIterator<SwFrame,SwFormat>(*pChild).First();
856  pChild = aFormatIter.Next();
857  }
858  }
859  static_cast<SwPtrMsgPoolItem&>(rInfo).pObject = pFrame;
860  }
861  return false;
862  }
863  return sw::BroadcastingModify::GetInfo( rInfo );
864 }
865 
866 static bool lcl_SectionCmpPos( const SwSection *pFirst, const SwSection *pSecond)
867 {
868  const SwSectionFormat* pFSectFormat = pFirst->GetFormat();
869  const SwSectionFormat* pSSectFormat = pSecond->GetFormat();
870  OSL_ENSURE( pFSectFormat && pSSectFormat &&
871  pFSectFormat->GetContent(false).GetContentIdx() &&
872  pSSectFormat->GetContent(false).GetContentIdx(),
873  "Invalid sections" );
874  return pFSectFormat->GetContent(false).GetContentIdx()->GetIndex() <
875  pSSectFormat->GetContent(false).GetContentIdx()->GetIndex();
876 }
877 
878 // get all Sections that have been derived from this one
880  SectionSort eSort,
881  bool bAllSections ) const
882 {
883  rArr.clear();
884 
885  if( !HasWriterListeners() )
886  return;
887 
889  const SwNodeIndex* pIdx;
890  for( SwSectionFormat* pLast = aIter.First(); pLast; pLast = aIter.Next() )
891  if( bAllSections ||
892  ( nullptr != ( pIdx = pLast->GetContent(false).
893  GetContentIdx()) && &pIdx->GetNodes() == &GetDoc()->GetNodes() ))
894  {
895  SwSection* pDummy = pLast->GetSection();
896  rArr.push_back( pDummy );
897  }
898 
899  // Do we need any sorting?
900  if( 1 < rArr.size() )
901  switch( eSort )
902  {
903  case SectionSort::Pos:
904  std::sort( rArr.begin(), rArr.end(), lcl_SectionCmpPos );
905  break;
906  case SectionSort::Not: break;
907  }
908 }
909 
910 // See whether the Section is within the Nodes or the UndoNodes array
912 {
913  const SwNodeIndex* pIdx = GetContent(false).GetContentIdx();
914  return pIdx && &pIdx->GetNodes() == &GetDoc()->GetNodes();
915 }
916 
917 // Parent was changed
919 {
920  if(!HasWriterListeners())
921  return;
922 
923  const SwSection* pSection = GetSection();
924  const SvxProtectItem* pProtect = &GetProtect();
925  // edit in readonly sections
926  const SwFormatEditInReadonly* pEditInReadonly = &GetEditInReadonly();
927  bool bIsHidden = pSection->IsHidden();
928  if(GetRegisteredIn())
929  {
930  const SwSection* pPS = GetParentSection();
931  pProtect = &pPS->GetFormat()->GetProtect();
932  pEditInReadonly = &pPS->GetFormat()->GetEditInReadonly();
933  bIsHidden = pPS->IsHiddenFlag();
934  }
936  if(!pProtect->IsContentProtected() != !pSection->IsProtectFlag())
937  CallSwClientNotify(sw::LegacyModifyHint(pProtect, pProtect));
938 
939  // edit in readonly sections
940  if(!pEditInReadonly->GetValue() != !pSection->IsEditInReadonlyFlag())
941  CallSwClientNotify(sw::LegacyModifyHint(pEditInReadonly, pEditInReadonly));
942 
943  if(bIsHidden == pSection->IsHiddenFlag())
944  {
945  SwMsgPoolItem aMsgItem(o3tl::narrowing<sal_uInt16>(bIsHidden
948  CallSwClientNotify(sw::LegacyModifyHint(&aMsgItem, &aMsgItem));
949  }
950 }
951 
953 {
954  const SwNodeIndex* pIdx = GetContent(false).GetContentIdx();
955  if( pIdx && ( &pIdx->GetNodes() == &GetDoc()->GetNodes() ))
956  return pIdx->GetNode().GetSectionNode();
957  return nullptr;
958 }
959 
960 // Is this Section valid for the GlobalDocument?
962 {
963  const SwSectionNode* pNd = GetSectionNode();
964  if( pNd &&
965  ( SectionType::FileLink == pNd->GetSection().GetType() ||
967  pNd->GetIndex() > pNd->GetNodes().GetEndOfExtras().GetIndex() &&
968  !pNd->StartOfSectionNode()->IsSectionNode() &&
970  return &pNd->GetSection();
971  return nullptr;
972 }
973 
974 // sw::Metadatable
976 {
977  return GetDoc()->GetXmlIdRegistry();
978 }
979 
981 {
982  return GetDoc()->IsClipBoard();
983 }
984 
986 {
987  return !IsInNodesArr();
988 }
989 
991 {
992  SwNodeIndex const*const pIdx = GetContent(false).GetContentIdx();
993  OSL_ENSURE(pIdx, "SwSectionFormat::IsInContent: no index?");
994  return pIdx == nullptr || !GetDoc()->IsInHeaderFooter(*pIdx);
995 }
996 
997 // n.b.: if the section format represents an index, then there is both a
998 // SwXDocumentIndex and a SwXTextSection instance for this single core object.
999 // these two can both implement XMetadatable and forward to the same core
1000 // section format. but here only one UNO object can be returned,
1001 // so always return the text section.
1002 uno::Reference< rdf::XMetadatable >
1004 {
1005  uno::Reference<rdf::XMetadatable> xMeta;
1006  SwSection *const pSection( GetSection() );
1007  if (pSection)
1008  {
1009  xMeta.set( SwXTextSection::CreateXTextSection(this,
1010  SectionType::ToxHeader == pSection->GetType()),
1011  uno::UNO_QUERY );
1012  }
1013  return xMeta;
1014 }
1015 
1017 {
1018  return false;
1019 }
1020 
1022 {
1023  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwSectionFormat"));
1024  (void)xmlTextWriterWriteAttribute(pWriter, BAD_CAST("name"), BAD_CAST(GetName().toUtf8().getStr()));
1025  GetAttrSet().dumpAsXml(pWriter);
1026  (void)xmlTextWriterEndElement(pWriter);
1027 }
1028 
1030 {
1031  (void)xmlTextWriterStartElement(pWriter, BAD_CAST("SwSectionFormats"));
1032  for (size_t i = 0; i < size(); ++i)
1033  GetFormat(i)->dumpAsXml(pWriter);
1034  (void)xmlTextWriterEndElement(pWriter);
1035 }
1036 
1037 // Method to break section links inside a linked section
1038 static void lcl_BreakSectionLinksInSect( const SwSectionNode& rSectNd )
1039 {
1040  if ( !rSectNd.GetSection().IsConnected() )
1041  {
1042  OSL_FAIL( "method <lcl_RemoveSectionLinksInSect(..)> - no Link at Section of SectionNode" );
1043  return;
1044  }
1045  const ::sfx2::SvBaseLink* pOwnLink( &(rSectNd.GetSection().GetBaseLink() ) );
1046  const ::sfx2::SvBaseLinks& rLnks = rSectNd.GetDoc().getIDocumentLinksAdministration().GetLinkManager().GetLinks();
1047  for ( auto n = rLnks.size(); n > 0; )
1048  {
1049  SwIntrnlSectRefLink* pSectLnk = dynamic_cast<SwIntrnlSectRefLink*>(&(*rLnks[ --n ]));
1050  if ( pSectLnk && pSectLnk != pOwnLink &&
1051  pSectLnk->IsInRange( rSectNd.GetIndex(), rSectNd.EndOfSectionIndex() ) )
1052  {
1053  // break the link of the corresponding section.
1054  // the link is also removed from the link manager
1055  SwSectionNode* pSectNode = pSectLnk->GetSectNode();
1056  assert(pSectNode);
1057  pSectNode->GetSection().BreakLink();
1058 
1059  // for robustness, because link is removed from the link manager
1060  if ( n > rLnks.size() )
1061  {
1062  n = rLnks.size();
1063  }
1064  }
1065  }
1066 }
1067 
1068 static void lcl_UpdateLinksInSect( const SwBaseLink& rUpdLnk, SwSectionNode& rSectNd )
1069 {
1070  SwDoc& rDoc = rSectNd.GetDoc();
1071  SwDocShell* pDShell = rDoc.GetDocShell();
1072  if( !pDShell || !pDShell->GetMedium() )
1073  return ;
1074 
1075  const OUString sName( pDShell->GetMedium()->GetName() );
1076  const OUString sMimeType( SotExchange::GetFormatMimeType( SotClipboardFormatId::SIMPLE_FILE ));
1077  uno::Any aValue;
1078  aValue <<= sName; // Arbitrary name
1079 
1080  const ::sfx2::SvBaseLinks& rLnks = rDoc.getIDocumentLinksAdministration().GetLinkManager().GetLinks();
1081  for( auto n = rLnks.size(); n; )
1082  {
1083  ::sfx2::SvBaseLink* pLnk = &(*rLnks[ --n ]);
1084  if( pLnk == &rUpdLnk )
1085  continue;
1087  continue;
1088  SwBaseLink* pBLink = dynamic_cast<SwBaseLink*>( pLnk );
1089  if( pBLink && pBLink->IsInRange( rSectNd.GetIndex(),
1090  rSectNd.EndOfSectionIndex() ) )
1091  {
1092  // It's in the Section, so update. But only if it's not in the same File!
1093  OUString sFName;
1094  sfx2::LinkManager::GetDisplayNames( pBLink, nullptr, &sFName );
1095  if( sFName != sName )
1096  {
1097  pBLink->DataChanged( sMimeType, aValue );
1098 
1099  // If needed find the Link pointer to avoid skipping one or calling one twice
1100  if( n >= rLnks.size() && 0 != ( n = rLnks.size() ))
1101  --n;
1102 
1103  if( n && pLnk != &(*rLnks[ n ]) )
1104  {
1105  // Find - it can only precede it!
1106  while( n )
1107  if( pLnk == &(*rLnks[ --n ] ) )
1108  break;
1109  }
1110  }
1111  }
1112  }
1113 }
1114 
1115 ::sfx2::SvBaseLink::UpdateResult SwIntrnlSectRefLink::DataChanged(
1116  const OUString& rMimeType, const uno::Any & rValue )
1117 {
1118  SwSectionNode* pSectNd = m_rSectFormat.GetSectionNode();
1119  SwDoc* pDoc = m_rSectFormat.GetDoc();
1120 
1122 
1123  if( !pSectNd || !pDoc || pDoc->IsInDtor() || ChkNoDataFlag() ||
1124  sfx2::LinkManager::RegisterStatusInfoId() == nDataFormat )
1125  {
1126  // Should we be in the Undo already?
1127  return SUCCESS;
1128  }
1129 
1130  // #i38810# - Due to possible existing signatures, the
1131  // document has to be modified after updating a link.
1132  pDoc->getIDocumentState().SetModified();
1133  // set additional flag that links have been updated, in order to check this
1134  // during load.
1136 
1137  // Always switch off Undo
1138  bool const bWasUndo = pDoc->GetIDocumentUndoRedo().DoesUndo();
1139  pDoc->GetIDocumentUndoRedo().DoUndo(false);
1140  bool bWasVisibleLinks = pDoc->getIDocumentLinksAdministration().IsVisibleLinks();
1142 
1143  SwPaM* pPam;
1145  SwEditShell* pESh = pDoc->GetEditShell();
1147  {
1148  // Insert an empty TextNode at the Section's start
1149  SwNodeIndex aIdx( *pSectNd, +1 );
1150  SwNodeIndex aEndIdx( *pSectNd->EndOfSectionNode() );
1151  SwTextNode* pNewNd = pDoc->GetNodes().MakeTextNode( aIdx,
1153 
1154  if( pESh )
1155  pESh->StartAllAction();
1156  else if( pVSh )
1157  pVSh->StartAction();
1158 
1159  SwPosition aPos( aIdx, SwIndex( pNewNd, 0 ));
1160  --aPos.nNode;
1161  SwDoc::CorrAbs( aIdx, aEndIdx, aPos, true );
1162 
1163  pPam = new SwPaM( aPos );
1164 
1165  // Delete everything succeeding it
1166  --aIdx;
1167  DelFlyInRange( aIdx, aEndIdx );
1168  DelBookmarks(aIdx, aEndIdx);
1169  ++aIdx;
1170 
1171  pDoc->GetNodes().Delete( aIdx, aEndIdx.GetIndex() - aIdx.GetIndex() );
1172  }
1173 
1174  SwSection& rSection = pSectNd->GetSection();
1175  rSection.SetConnectFlag(false);
1176 
1177  Reader* pRead = nullptr;
1178  switch( nDataFormat )
1179  {
1180  case SotClipboardFormatId::STRING:
1181  pRead = ReadAscii;
1182  break;
1183 
1184  case SotClipboardFormatId::RICHTEXT:
1185  case SotClipboardFormatId::RTF:
1186  pRead = SwReaderWriter::GetRtfReader();
1187  break;
1188 
1189  case SotClipboardFormatId::SIMPLE_FILE:
1190  if ( rValue.hasValue() )
1191  {
1192  OUString sFileName;
1193  if ( !(rValue >>= sFileName) )
1194  break;
1195  OUString sFilter;
1196  OUString sRange;
1197  sfx2::LinkManager::GetDisplayNames( this, nullptr, &sFileName,
1198  &sRange, &sFilter );
1199 
1200  RedlineFlags eOldRedlineFlags = RedlineFlags::NONE;
1201  SfxObjectShellRef xDocSh;
1202  SfxObjectShellLock xLockRef;
1203  int nRet;
1204  if( sFileName.isEmpty() )
1205  {
1206  xDocSh = pDoc->GetDocShell();
1207  nRet = 1;
1208  }
1209  else
1210  {
1211  nRet = SwFindDocShell( xDocSh, xLockRef, sFileName,
1212  rSection.GetLinkFilePassword(),
1213  sFilter, 0, pDoc->GetDocShell() );
1214  if( nRet )
1215  {
1216  SwDoc* pSrcDoc = static_cast<SwDocShell*>( xDocSh.get() )->GetDoc();
1217  eOldRedlineFlags = pSrcDoc->getIDocumentRedlineAccess().GetRedlineFlags();
1219  }
1220  }
1221 
1222  if( nRet )
1223  {
1224  rSection.SetConnectFlag();
1225 
1226  SwNodeIndex aSave( pPam->GetPoint()->nNode, -1 );
1227  std::unique_ptr<SwNodeRange> pCpyRg;
1228 
1229  if( xDocSh->GetMedium() &&
1230  rSection.GetLinkFilePassword().isEmpty() )
1231  {
1232  const SfxPoolItem* pItem;
1233  if( SfxItemState::SET == xDocSh->GetMedium()->GetItemSet()->
1234  GetItemState( SID_PASSWORD, false, &pItem ) )
1235  rSection.SetLinkFilePassword(
1236  static_cast<const SfxStringItem*>(pItem)->GetValue() );
1237  }
1238 
1239  SwDoc* pSrcDoc = static_cast<SwDocShell*>( xDocSh.get() )->GetDoc();
1240 
1241  if( !sRange.isEmpty() )
1242  {
1243  // Catch recursion
1244  bool bRecursion = false;
1245  if( pSrcDoc == pDoc )
1246  {
1247  tools::SvRef<SwServerObject> refObj( static_cast<SwServerObject*>(
1249  if( refObj.is() )
1250  {
1251  bRecursion = refObj->IsLinkInServer( this ) ||
1252  ChkNoDataFlag();
1253  }
1254  }
1255 
1256  SwNodeIndex& rInsPos = pPam->GetPoint()->nNode;
1257 
1258  SwPaM* pCpyPam = nullptr;
1259  if( !bRecursion &&
1260  pSrcDoc->GetDocumentLinksAdministrationManager().SelectServerObj( sRange, pCpyPam, pCpyRg )
1261  && pCpyPam )
1262  {
1263  if( pSrcDoc != pDoc ||
1264  pCpyPam->Start()->nNode > rInsPos ||
1265  rInsPos >= pCpyPam->End()->nNode )
1266  {
1268  }
1269  delete pCpyPam;
1270  }
1271  if( pCpyRg && pSrcDoc == pDoc &&
1272  pCpyRg->aStart < rInsPos && rInsPos < pCpyRg->aEnd )
1273  {
1274  pCpyRg.reset();
1275  }
1276  }
1277  else if( pSrcDoc != pDoc )
1278  pCpyRg.reset(new SwNodeRange( pSrcDoc->GetNodes().GetEndOfExtras(), SwNodeOffset(2),
1279  pSrcDoc->GetNodes().GetEndOfContent() ));
1280 
1281  // #i81653#
1282  // Update links of extern linked document or extern linked
1283  // document section, if section is protected.
1284  if ( pSrcDoc != pDoc &&
1285  rSection.IsProtectFlag() )
1286  {
1287  pSrcDoc->getIDocumentLinksAdministration().GetLinkManager().UpdateAllLinks( false, false, nullptr );
1288  }
1289 
1290  if( pCpyRg )
1291  {
1292  SwNodeIndex& rInsPos = pPam->GetPoint()->nNode;
1293  bool bCreateFrame = rInsPos.GetIndex() <=
1294  pDoc->GetNodes().GetEndOfExtras().GetIndex() ||
1295  rInsPos.GetNode().FindTableNode();
1296 
1297  SwTableNumFormatMerge aTNFM( *pSrcDoc, *pDoc );
1298 
1299  pSrcDoc->GetDocumentContentOperationsManager().CopyWithFlyInFly(*pCpyRg, rInsPos, nullptr, bCreateFrame);
1300  ++aSave;
1301 
1302  if( !bCreateFrame )
1303  ::MakeFrames( pDoc, aSave, rInsPos );
1304 
1305  // Delete last Node, only if it was copied successfully
1306  // (the Section contains more than one Node)
1307  if( SwNodeOffset(2) < pSectNd->EndOfSectionIndex() - pSectNd->GetIndex() )
1308  {
1309  aSave = rInsPos;
1310  pPam->Move( fnMoveBackward, GoInNode );
1311  pPam->SetMark(); // Rewire both SwPositions
1312 
1313  pDoc->CorrAbs( aSave, *pPam->GetPoint(), 0, true );
1314  pDoc->GetNodes().Delete( aSave );
1315  }
1316  pCpyRg.reset();
1317  }
1318 
1319  lcl_BreakSectionLinksInSect( *pSectNd );
1320 
1321  // Update all Links in this Section
1322  lcl_UpdateLinksInSect( *this, *pSectNd );
1323  }
1324  if( xDocSh.is() )
1325  {
1326  if( 2 == nRet )
1327  xDocSh->DoClose();
1328  else if( static_cast<SwDocShell*>( xDocSh.get() )->GetDoc() )
1329  static_cast<SwDocShell*>( xDocSh.get() )->GetDoc()->getIDocumentRedlineAccess().SetRedlineFlags(
1330  eOldRedlineFlags );
1331  }
1332  }
1333  break;
1334  default: break;
1335  }
1336 
1337  // Only create DDE if Shell is available!
1338  uno::Sequence< sal_Int8 > aSeq;
1339  if( pRead && rValue.hasValue() && ( rValue >>= aSeq ) )
1340  {
1341  if( pESh )
1342  {
1343  pESh->Push();
1344  SwPaM* pCursor = pESh->GetCursor();
1345  *pCursor->GetPoint() = *pPam->GetPoint();
1346  delete pPam;
1347  pPam = pCursor;
1348  }
1349 
1350  SvMemoryStream aStrm( const_cast<sal_Int8 *>(aSeq.getConstArray()), aSeq.getLength(),
1351  StreamMode::READ );
1352  aStrm.Seek( 0 );
1353 
1354  // TODO/MBA: it's impossible to set a BaseURL here!
1355  SwReader aTmpReader( aStrm, OUString(), pDoc->GetDocShell()->GetMedium()->GetBaseURL(), *pPam );
1356 
1357  if( ! aTmpReader.Read( *pRead ).IsError() )
1358  {
1359  rSection.SetConnectFlag();
1360  }
1361 
1362  if( pESh )
1363  {
1365  pPam = nullptr; // pam was deleted earlier
1366  }
1367  }
1368 
1369  // remove all undo actions and turn undo on again
1371  pDoc->GetIDocumentUndoRedo().DoUndo(bWasUndo);
1372  pDoc->getIDocumentLinksAdministration().SetVisibleLinks( bWasVisibleLinks );
1373 
1376  pDoc->getIDocumentFieldsAccess().UpdateExpFields(nullptr, true);
1377 
1378  if( pESh )
1379  pESh->EndAllAction();
1380  else if( pVSh )
1381  pVSh->EndAction();
1382  delete pPam; // Was created at the start
1383 
1384  return SUCCESS;
1385 }
1386 
1387 void SwIntrnlSectRefLink::Closed()
1388 {
1389  SwDoc* pDoc = m_rSectFormat.GetDoc();
1390  if( pDoc && !pDoc->IsInDtor() )
1391  {
1392  // Advise says goodbye: mark the Section as not protected
1393  // and change the Flag
1394  const SwSectionFormats& rFormats = pDoc->GetSections();
1395  for( auto n = rFormats.size(); n; )
1396  if (rFormats[--n] == &m_rSectFormat)
1397  {
1399  SwEditShell* pESh = pDoc->GetEditShell();
1400 
1401  if( pESh )
1402  pESh->StartAllAction();
1403  else
1404  pSh->StartAction();
1405 
1406  SwSectionData aSectionData(*m_rSectFormat.GetSection());
1407  aSectionData.SetType( SectionType::Content );
1408  aSectionData.SetLinkFileName( OUString() );
1409  aSectionData.SetProtectFlag( false );
1410  // edit in readonly sections
1411  aSectionData.SetEditInReadonlyFlag( false );
1412 
1413  aSectionData.SetConnectFlag( false );
1414 
1415  pDoc->UpdateSection( n, aSectionData );
1416 
1417  // Make all Links within the Section visible again
1418  SwSectionNode* pSectNd = m_rSectFormat.GetSectionNode();
1419  if( pSectNd )
1421 
1422  if( pESh )
1423  pESh->EndAllAction();
1424  else
1425  pSh->EndAction();
1426  break;
1427  }
1428  }
1429  SvBaseLink::Closed();
1430 }
1431 
1433 {
1434  SwSectionFormat* pFormat = GetFormat();
1435  OSL_ENSURE(pFormat, "SwSection::CreateLink: no format?");
1436  if (!pFormat || (SectionType::Content == m_Data.GetType()))
1437  return ;
1438 
1439  SfxLinkUpdateMode nUpdateType = SfxLinkUpdateMode::ALWAYS;
1440 
1441  if (!m_RefLink.is())
1442  {
1443  // create BaseLink
1444  m_RefLink = new SwIntrnlSectRefLink( *pFormat, nUpdateType );
1445  }
1446  else
1447  {
1449  }
1450 
1451  SwIntrnlSectRefLink *const pLnk =
1452  static_cast<SwIntrnlSectRefLink*>( m_RefLink.get() );
1453 
1455  pLnk->SetUpdateMode( nUpdateType );
1456  pLnk->SetVisible( pFormat->GetDoc()->getIDocumentLinksAdministration().IsVisibleLinks() );
1457 
1458  switch (m_Data.GetType())
1459  {
1460  case SectionType::DdeLink:
1461  pLnk->SetLinkSourceName( sCmd );
1463  break;
1464  case SectionType::FileLink:
1465  {
1466  pLnk->SetContentType( SotClipboardFormatId::SIMPLE_FILE );
1467  sal_Int32 nIndex = 0;
1468  const OUString sFile(sCmd.getToken( 0, sfx2::cTokenSeparator, nIndex ));
1469  const OUString sFltr(sCmd.getToken( 0, sfx2::cTokenSeparator, nIndex ));
1470  const OUString sRange(sCmd.getToken( 0, sfx2::cTokenSeparator, nIndex ));
1472  static_cast<sfx2::SvBaseLinkObjectType>(m_Data.GetType()),
1473  sFile,
1474  ( !sFltr.isEmpty() ? &sFltr : nullptr ),
1475  ( !sRange.isEmpty() ? &sRange : nullptr ) );
1476  }
1477  break;
1478  default:
1479  OSL_ENSURE( false, "What kind of Link is this?" );
1480  }
1481 
1482  switch( eCreateType )
1483  {
1484  case LinkCreateType::Connect: // Connect Link right away
1485  pLnk->Connect();
1486  break;
1487 
1488  case LinkCreateType::Update: // Connect Link and update
1489  pLnk->Update();
1490  break;
1491  case LinkCreateType::NONE: break;
1492  }
1493 }
1494 
1496 {
1497  const SectionType eCurrentType( GetType() );
1498  if ( eCurrentType == SectionType::Content ||
1499  eCurrentType == SectionType::ToxHeader ||
1500  eCurrentType == SectionType::ToxContent )
1501  {
1502  // nothing to do
1503  return;
1504  }
1505 
1506  // Release link, if it exists
1507  if (m_RefLink.is())
1508  {
1509  SwSectionFormat *const pFormat( GetFormat() );
1510  OSL_ENSURE(pFormat, "SwSection::BreakLink: no format?");
1511  if (pFormat)
1512  {
1514  }
1515  m_RefLink.clear();
1516  }
1517  // change type
1519  // reset linked file data
1520  SetLinkFileName( OUString() );
1521  SetLinkFilePassword( OUString() );
1522 }
1523 
1524 const SwNode* SwIntrnlSectRefLink::GetAnchor() const { return m_rSectFormat.GetSectionNode(); }
1525 
1526 bool SwIntrnlSectRefLink::IsInRange( SwNodeOffset nSttNd, SwNodeOffset nEndNd ) const
1527 {
1528  SwStartNode* pSttNd = m_rSectFormat.GetSectionNode();
1529  return pSttNd &&
1530  nSttNd < pSttNd->GetIndex() &&
1531  pSttNd->EndOfSectionIndex() < nEndNd;
1532 }
1533 
1534 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SwAttrSet * GetChgSet() const
What has changed.
Definition: hints.hxx:299
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: section.cxx:1021
void BreakLink()
Definition: section.cxx:1495
SwSectionFormat(SwFrameFormat *pDrvdFrame, SwDoc *pDoc)
Definition: section.cxx:622
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:983
bool GetValue() const
bool is() const
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:684
Starts a section of nodes in the document model.
Definition: node.hxx:313
constexpr TypedWhichId< SvxProtectItem > RES_PROTECT(100)
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: atrfrm.cxx:2598
Base class of the Writer layout elements.
Definition: frame.hxx:315
SAL_DLLPRIVATE void SetHiddenFlag(bool const bFlag)
Definition: section.hxx:102
constexpr TypedWhichId< SwFormatEndAtTextEnd > RES_END_AT_TXTEND(118)
constexpr TypedWhichId< SwFormatPageDesc > RES_PAGEDESC(93)
tools::SvRef< SwServerObject > m_RefObj
Definition: section.hxx:149
std::vector< SwSection * > SwSections
Definition: section.hxx:41
bool hasValue()
sal_Int32 nIndex
SwNodeOffset EndOfSectionIndex() const
Definition: node.hxx:679
Marks a position in the document model.
Definition: pam.hxx:36
void dumpAsXml(xmlTextWriterPtr pWriter) const
void SetType(SectionType const eNew)
Definition: section.hxx:95
void SetType(SectionType const eType)
Definition: section.hxx:171
void DelBookmarks(const SwNodeIndex &rStt, const SwNodeIndex &rEnd, std::vector< SaveBookmark > *pSaveBkmk, const SwIndex *pSttIdx, const SwIndex *pEndIdx)
Definition: docbm.cxx:1898
bool IsSectionNode() const
Definition: node.hxx:646
sal_uInt16 GetWhich() const
Definition: calbck.hxx:75
bool IsInRange(const WhichRangesContainer &pRange, const sal_uInt16 nId)
check if ID is in range of attribute set IDs
Definition: swatrset.cxx:434
tools::SvRef< sfx2::SvBaseLink > m_RefLink
Definition: section.hxx:150
static bool lcl_SectionCmpPos(const SwSection *pFirst, const SwSection *pSecond)
Definition: section.cxx:866
void SetHidden(bool const bFlag)
Definition: section.hxx:98
SAL_DLLPRIVATE void SetProtectFlag(bool const bFlag)
Definition: section.hxx:105
virtual ::sfx2::IXmlIdRegistry & GetRegistry() override
Definition: section.cxx:975
void SetLinkFileName(OUString const &rNew)
Definition: section.hxx:117
SwDocShell * GetDocShell()
Definition: doc.hxx:1352
constexpr TypedWhichId< SwFormatEditInReadonly > RES_EDIT_IN_READONLY(112)
constexpr TypedWhichId< SwFormatChg > RES_FMT_CHG(162)
std::string GetValue
constexpr TypedWhichId< SwFormatCol > RES_COL(109)
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_REMOVE_UNO_OBJECT(181)
void DelSectionFormat(SwSectionFormat *pFormat, bool bDelNodes=false)
Definition: ndsect.cxx:517
SwNodeIndex nNode
Definition: pam.hxx:38
SAL_DLLPRIVATE void UpdateParent()
Definition: section.cxx:918
SwSection(SectionType const eType, OUString const &rName, SwSectionFormat &rFormat)
Definition: section.cxx:196
virtual void SetLinksUpdated(const bool bNewLinksUpdated)=0
void InsertFileLink(sfx2::SvBaseLink &, SvBaseLinkObjectType nFileType, std::u16string_view rFileNm, const OUString *pFilterNm=nullptr, const OUString *pRange=nullptr)
const OUString & GetName() const
virtual void SetModified()=0
Must be called manually at changes of format.
void CreateLink(LinkCreateType eType)
Definition: section.cxx:1432
bool IsEditInReadonlyFlag() const
Definition: section.hxx:106
bool IsEditInReadonlyFlag() const
Definition: section.hxx:189
const sal_Unicode cTokenSeparator
sal_Int64 n
bool m_bEditInReadonlyFlag
Definition: section.hxx:78
Definition: doc.hxx:188
void SetEditInReadonly(bool const bFlag=true)
Definition: section.cxx:389
TElementType * Next()
Definition: calbck.hxx:365
bool m_bCondHiddenFlag
Hide condition evaluated `true'.
Definition: section.hxx:81
IDocumentLinksAdministration const & getIDocumentLinksAdministration() const
Definition: doc.cxx:260
bool IsConnected() const
Definition: section.hxx:224
aBuf
SwSectionData(SectionType const eType, OUString const &rName)
Definition: section.cxx:94
SAL_DLLPRIVATE void SetXTextSection(css::uno::Reference< css::text::XTextSection > const &xTextSection)
Definition: section.hxx:322
sal_uInt64 Seek(sal_uInt64 nPos)
SwNode & GetNode() const
Definition: ndindex.hxx:121
SwSectionFormat * GetFormat()
Definition: section.hxx:336
SwSection * GetParent() const
Definition: section.hxx:346
IDocumentUndoRedo & GetIDocumentUndoRedo()
Definition: doc.cxx:144
SwClient * Remove(SwClient *pDepend)
Definition: calbck.cxx:226
OUString const & GetLinkFileName() const
Definition: section.cxx:542
int SwFindDocShell(SfxObjectShellRef &xDocSh, SfxObjectShellLock &xLockRef, const OUString &rFileName, const OUString &rPasswd, const OUString &rFilter, sal_Int16 nVersion, SwDocShell *pDestSh)
Find the right DocShell and create a new one: The return value specifies what should happen to the Sh...
Definition: docsh2.cxx:1645
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:315
bool HasWriterListeners() const
Definition: calbck.hxx:203
EmbeddedObjectRef * pObject
void EndAllAction()
Definition: edws.cxx:97
virtual bool GetInfo(SfxPoolItem &) const override
Definition: calbck.cxx:162
SwSectionData m_Data
Definition: section.hxx:147
bool IsCondHidden() const
Definition: section.hxx:192
SfxHintId GetId() const
bool IsInHeaderFooter(const SwNodeIndex &rIdx) const
Definition: doclay.cxx:1552
SectionSort
Definition: section.hxx:267
LinkCreateType
Definition: section.hxx:52
virtual ~SwSection() override
Definition: section.cxx:220
static css::uno::Reference< css::text::XTextSection > CreateXTextSection(SwSectionFormat *const pFormat, const bool bIndexHeader=false)
Definition: unosect.cxx:196
virtual bool IsInUndo() const override
Definition: section.cxx:985
show all inserts
Array of Undo-history.
Definition: docary.hxx:192
virtual void LockExpFields()=0
const SwSection & GetSection() const
Definition: node.hxx:543
virtual void UpdateExpFields(SwTextField *pField, bool bUpdateRefFields)=0
const SwFormatEditInReadonly & GetEditInReadonly(bool=true) const
Definition: fmteiro.hxx:48
IDocumentFieldsAccess const & getIDocumentFieldsAccess() const
Definition: doc.cxx:357
sal_uInt16 sal_Unicode
void SetLinkFilePassword(OUString const &rS)
Definition: section.hxx:206
const ::sfx2::SvBaseLink & GetBaseLink() const
Definition: section.hxx:228
OUString m_sLinkFilePassword
Definition: section.hxx:67
SwSectionNode * GetSectionNode()
Definition: section.cxx:952
bool m_bConnectFlag
Definition: section.hxx:82
IDocumentStylePoolAccess const & getIDocumentStylePoolAccess() const
Definition: doc.cxx:426
check if target position is in fly anchored at source range
void MakeOwnFrames(SwNodeIndex *pIdxBehind, SwNodeIndex *pEnd=nullptr)
Creates the frms for the SectionNode (i.e.
Definition: ndsect.cxx:1167
const OUString & GetName() const
Definition: format.hxx:115
constexpr OUStringLiteral IsHidden(u"IsHidden")
void RemoveServer(SvLinkSource *rObj)
virtual void DelAllUndoObj()=0
Delete all Undo actions.
virtual bool IsExpFieldsLocked() const =0
virtual void DoUndo(bool const bDoUndo)=0
Enable/Disable Undo.
constexpr TypedWhichId< SwMsgPoolItem > RES_SECTION_HIDDEN(174)
virtual void MakeFrames() override
Creates the views.
Definition: section.cxx:716
::sfx2::IXmlIdRegistry & GetXmlIdRegistry()
Definition: docnew.cxx:814
bool IsProtectFlag() const
Definition: section.hxx:188
const SfxPoolItem * GetDfltAttr(sal_uInt16 nWhich)
Get the default attribute from corresponding default attribute table.
Definition: hints.cxx:153
SwNodeOffset GetIndex() const
Definition: ndindex.hxx:154
SotClipboardFormatId
virtual bool DoesUndo() const =0
Is Undo enabled?
const char * sName
void MakeFrames(SwDoc *pDoc, const SwNodeIndex &rSttIdx, const SwNodeIndex &rEndIdx)
Definition: frmtool.cxx:1984
constexpr TypedWhichId< SwFindNearestNode > RES_FINDNEARESTNODE(184)
std::optional< sw::ModifyChangedHint > CheckRegistration(const SfxPoolItem *pOldValue)
Definition: calbck.cxx:78
SwNode & GetEndOfContent() const
Regular ContentSection (i.e. the BodyText).
Definition: ndarr.hxx:161
bool m_bHidden
Section is hidden, unless condition evaluates `false'.
Definition: section.hxx:80
OUString m_sCondition
Hide condition.
Definition: section.hxx:65
static void lcl_UpdateLinksInSect(const SwBaseLink &rUpdLnk, SwSectionNode &rSectNd)
Definition: section.cxx:1068
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:137
struct _xmlTextWriter * xmlTextWriterPtr
constexpr TypedWhichId< SwMsgPoolItem > RES_SECTION_NOT_HIDDEN(175)
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:504
T * get() const
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SwSection * GetGlobalDocSection() const
Definition: section.cxx:961
Style of a layout element.
Definition: frmfmt.hxx:59
void SetConnectFlag(bool const bFlag=true)
Definition: section.hxx:239
void Broadcast(const SfxHint &rHint)
SfxItemState GetItemState(sal_uInt16 nWhich, bool bSrchInParent=true, const SfxPoolItem **ppItem=nullptr) const
const SvBaseLinks & GetLinks() const
int i
bool GoInNode(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:961
bool IsHidden() const
Definition: section.hxx:97
const SwStartNode * StartOfSectionNode() const
Definition: node.hxx:133
SwDoc & GetDoc()
Definition: node.hxx:213
const SwPosition * GetPoint() const
Definition: pam.hxx:208
virtual bool CopyRange(SwPaM &rPam, SwPosition &rPos, SwCopyFlags flags) const =0
Copy a selected content range to a position.
void SetCondHidden(bool const bFlag)
Definition: section.cxx:532
void Remove(SvBaseLink const *pLink)
void dumpAsXml(xmlTextWriterPtr pWriter) const
Definition: section.cxx:1029
bool IsProtect() const
Definition: section.cxx:343
SwEditShell const * GetEditShell() const
Definition: doccorr.cxx:328
OUString m_sSectionName
Definition: section.hxx:64
const SwTOXBase * GetTOXBase() const
Definition: section.cxx:614
void SetProtect(bool const bFlag=true)
Definition: section.cxx:371
bool IsHidden() const
Definition: section.hxx:178
void Push()
store a copy of the current cursor on the cursor stack
Definition: crsrsh.cxx:2239
css::uno::Sequence< sal_Int8 > m_Password
Definition: section.hxx:68
::sw::DocumentContentOperationsManager const & GetDocumentContentOperationsManager() const
Definition: doc.cxx:325
Text body.
Definition: poolfmt.hxx:251
Count
TElementType * First()
Definition: calbck.hxx:357
bool IsHiddenFlag() const
Definition: section.hxx:187
SwNodeOffset GetIndex() const
Definition: node.hxx:292
sal_uInt16 Count() const
bool IsProtectFlag() const
Definition: section.hxx:103
static void lcl_BreakSectionLinksInSect(const SwSectionNode &rSectNd)
Definition: section.cxx:1038
virtual css::uno::Reference< css::rdf::XMetadatable > MakeUnoObject() override
Definition: section.cxx:1003
void StartAction()
Definition: viewsh.hxx:591
constexpr TypedWhichId< SwAttrSetChg > RES_ATTRSET_CHG(163)
Marks a character position inside a document model node.
Definition: index.hxx:33
void UnlockModify()
Definition: calbck.hxx:210
OUString GetBaseURL(bool bForSaving=false)
void SetCondHidden(bool const bFlag)
Definition: section.hxx:110
IDocumentState const & getIDocumentState() const
Definition: doc.cxx:394
void LockModify()
Definition: calbck.hxx:209
void SetHidden(bool const bFlag=true)
Definition: section.cxx:362
SfxItemSet * GetItemSet() const
bool IsContentProtected() const
Marks a node in the document model.
Definition: ndindex.hxx:32
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:695
SectionType
Definition: section.hxx:45
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:123
virtual bool IsInClipboard() const override
Definition: section.cxx:980
bool IsEditInReadonly() const
Definition: section.cxx:353
static OUString GetFormatMimeType(SotClipboardFormatId nFormat)
bool SelectServerObj(std::u16string_view rStr, SwPaM *&rpPam, std::unique_ptr< SwNodeRange > &rpRange) const
IDocumentLayoutAccess const & getIDocumentLayoutAccess() const
Definition: doc.cxx:405
void SetLinkFileName(OUString const &rNew)
Definition: section.cxx:580
void SetValue(bool const bTheValue)
const SwPosition * Start() const
Definition: pam.hxx:213
constexpr TypedWhichId< SwFormatContent > RES_CNTNT(95)
Reader * ReadAscii
Definition: fltini.cxx:46
void EndAction(const bool bIdleEnd=false)
Definition: viewsh.hxx:596
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
const SwFrameFormat * GetDfltFrameFormat() const
Definition: doc.hxx:747
bool CalcHiddenFlag() const
Definition: section.cxx:332
virtual SwSectionFormat * GetFormat(size_t idx) const override
Definition: docary.hxx:159
virtual bool SetFormatAttr(const SfxPoolItem &rAttr)
Definition: format.cxx:450
void SetRefObject(SwServerObject *pObj)
Definition: section.cxx:527
SvtBroadcaster & GetNotifier()
Definition: calbck.hxx:102
void UpdateFootnote(const SwNodeIndex &rStt)
Definition: ftnidx.cxx:60
static bool GetDisplayNames(const SvBaseLink *, OUString *pType, OUString *pFile=nullptr, OUString *pLink=nullptr, OUString *pFilter=nullptr)
SwFormat * DerivedFrom() const
Definition: format.hxx:112
void InsertDDELink(SvBaseLink *, const OUString &rServer, std::u16string_view rTopic, std::u16string_view rItem)
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:79
const OUString & GetLinkFileName() const
Definition: section.hxx:116
virtual bool IsInContent() const override
Definition: section.cxx:990
virtual bool ResetFormatAttr(sal_uInt16 nWhich1, sal_uInt16 nWhich2=0)
Definition: format.cxx:624
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
SwCursor * GetCursor(bool bMakeTableCursor=true) const
Return pointer to the current shell cursor.
Definition: crsrsh.cxx:194
void UpdateSection(size_t const nSect, SwSectionData &, SfxItemSet const *const =nullptr, bool const bPreventLinkUpdate=false)
Definition: ndsect.cxx:609
void CorrAbs(const SwNodeIndex &rOldNode, const SwPosition &rNewPos, const sal_Int32 nOffset=0, bool bMoveCursor=false)
Definition: doccorr.cxx:168
const SfxPoolItem & Get(sal_uInt16 nWhich, bool bSrchInParent=true) const
virtual const SwViewShell * GetCurrentViewShell() const =0
Returns the layout set at the document.
void UpdateAllLinks(bool bAskUpdate, bool bUpdateGrfLinks, weld::Window *pParentWin)
void CopyWithFlyInFly(const SwNodeRange &rRg, const SwNodeIndex &rInsPos, const std::pair< const SwPaM &, const SwPosition & > *pCopiedPaM=nullptr, bool bMakeNewFrames=true, bool bDelRedlines=true, bool bCopyFlyAtFly=false, SwCopyFlags flags=SwCopyFlags::Default) const
note: rRg/rInsPos exclude a partially selected start text node; pCopiedPaM includes a partially selec...
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: section.cxx:406
const SwNodes & GetNodes() const
Definition: ndindex.hxx:158
virtual void DelFrames() override
Destroys all Frames in aDepend (Frames are identified via dynamic_cast).
Definition: section.cxx:675
const SfxPoolItem * m_pOld
Definition: calbck.hxx:77
static SotClipboardFormatId GetFormatIdFromMimeType(const OUString &rMimeType)
void SectionUp(SwNodeRange *)
increase level of the given range
Definition: nodes.cxx:959
void SetEditInReadonlyFlag(bool const bFlag)
Definition: section.hxx:107
virtual void SetRedlineFlags(RedlineFlags eMode)=0
Set a new redline mode.
bool DataEquals(SwSectionData const &rCmp) const
Definition: section.cxx:277
bool IsClipBoard() const
Definition: doc.hxx:963
virtual ~SwSectionFormat() override
Definition: section.cxx:630
SwNodes & GetNodes()
Definition: doc.hxx:409
virtual SwTextFormatColl * GetTextCollFromPool(sal_uInt16 nId, bool bRegardLanguage=true)=0
Return "Auto-Collection with ID.
const SwPosition * End() const
Definition: pam.hxx:218
const SwModify * GetRegisteredIn() const
Definition: calbck.hxx:165
void Delete(const SwNodeIndex &rPos, SwNodeOffset nNodes=SwNodeOffset(1))
delete nodes
Definition: nodes.cxx:1078
bool IsHiddenFlag() const
Definition: section.hxx:100
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
Sequence< sal_Int8 > aSeq
void RegisterToFormat(SwFormat &rFormat)
Definition: atrfrm.cxx:2698
o3tl::strong_int< sal_Int32, struct Tag_SwNodeOffset > SwNodeOffset
Definition: nodeoffset.hxx:16
SectionType GetType() const
Definition: section.hxx:94
bool m_bProtectFlag
Flags that correspond to attributes in the format: may have different value than format attribute: fo...
Definition: section.hxx:76
SwSection * GetParentSection() const
Definition: section.hxx:363
Reader * GetRtfReader()
Definition: fltini.cxx:149
const SwAttrSet & GetSwAttrSet() const
Does node has already its own auto-attributes? Access to SwAttrSet.
Definition: node.hxx:716
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
virtual void CallSwClientNotify(const SfxHint &rHint) const override
Definition: calbck.cxx:326
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:357
SectionType m_eType
Definition: section.hxx:62
void RemoveAllUnos()
Definition: format.cxx:763
virtual sfx2::LinkManager & GetLinkManager()=0
::sw::DocumentLinksAdministrationManager const & GetDocumentLinksAdministrationManager() const
Definition: doc.cxx:270
void sw_DeleteFootnote(SwSectionNode *pNd, SwNodeOffset nStt, SwNodeOffset nEnd)
Definition: ndsect.cxx:749
bool IsInDtor() const
Definition: doc.hxx:404
SwFootnoteIdxs & GetFootnoteIdxs()
Definition: doc.hxx:634
virtual RedlineFlags GetRedlineFlags() const =0
Query the currently set redline mode.
SwContentNode * GoNextSection(SwNodeIndex *, bool bSkipHidden=true, bool bSkipProtect=true) const
Go to next content-node that is not protected or hidden (Both set FALSE ==> GoNext/GoPrevious!!!).
Definition: nodes.cxx:1916
void DelFlyInRange(const SwNodeIndex &rMkNdIdx, const SwNodeIndex &rPtNdIdx, SwIndex const *const pMkIdx, SwIndex const *const pPtIdx)
Delete and move all Flys at the paragraph, that are within the selection.
Definition: docedt.cxx:204
const SvxProtectItem & GetProtect(bool=true) const
Definition: frmatr.hxx:82
void SetContentProtect(bool bNew)
virtual bool supportsFullDrawingLayerFillAttributeSet() const override
Definition: section.cxx:1016
virtual ::sfx2::SvLinkSource * CreateLinkSource(const OUString &rItem)=0
void SetSectionData(SwSectionData const &rData)
Definition: section.cxx:263
SwSectionNode * GetSectionNode()
Definition: node.hxx:609
SAL_DLLPRIVATE void ImplSetHiddenFlag(bool const bHidden, bool const bCondition)
Definition: section.cxx:292
const EnumerationType m_eType
virtual bool GetInfo(SfxPoolItem &) const override
Definition: section.cxx:832
virtual void SetMark()
Unless this is called, the getter method of Mark will return Point.
Definition: pam.cxx:478
SectionType GetType() const
Definition: section.hxx:170
bool Pop(PopMode)
delete cursor
Definition: crsrsh.cxx:2261
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:120
static SotClipboardFormatId RegisterStatusInfoId()
virtual void UnlockExpFields()=0
SwSection * GetSection() const
Definition: section.cxx:669
SwNode & GetEndOfExtras() const
This is the last EndNode of a special section.
Definition: ndarr.hxx:159
virtual void SetVisibleLinks(bool bFlag)=0
void StartAllAction()
For all views of this document.
Definition: edws.cxx:86
void GetChildSections(SwSections &rArr, SectionSort eSort=SectionSort::Not, bool bAllSections=true) const
Definition: section.cxx:879
SwSectionFormats & GetSections()
Definition: doc.hxx:1338
static OUString CollapseWhiteSpaces(const OUString &sName)
Definition: section.cxx:179
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_CONTENT_VISIBLE(185)
bool operator==(SwSectionData const &) const
Definition: section.cxx:165
static void MakeChildLinksVisible(const SwSectionNode &rSectNd)
Definition: section.cxx:590
SwSectionData & operator=(SwSectionData const &)
Definition: section.cxx:143
OUString const & GetLinkFilePassword() const
Definition: section.hxx:204
constexpr TypedWhichId< SwFormatFootnoteAtTextEnd > RES_FTN_AT_TXTEND(117)
bool IsCondHidden() const
Definition: section.hxx:111
OUString m_sLinkFileName
Definition: section.hxx:66
sal_uInt16 Which() const
no RedlineFlags
SfxLinkUpdateMode
constexpr TypedWhichId< SwPtrMsgPoolItem > RES_OBJECTDYING(RES_MSG_BEGIN)
SwTextNode * MakeTextNode(const SwNodeIndex &rWhere, SwTextFormatColl *pColl, bool bNewFrames=true)
Implementations of "Make...Node" are in the given .cxx-files.
Definition: ndtxt.cxx:105
virtual void SwClientNotify(const SwModify &, const SfxHint &) override
Definition: section.cxx:729
virtual bool IsVisibleLinks() const =0
Insert links in-/visibly into LinkManager (linked ranges).
bool IsInNodesArr() const
Definition: section.cxx:911
Base class of the Writer document model elements.
Definition: node.hxx:81
typedef void(CALLTYPE *GetFuncDataPtr)(sal_uInt16 &nNo
SfxMedium * GetMedium() const