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