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