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