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