LibreOffice Module sw (master)  1
unosect.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 <memory>
21 #include <unosection.hxx>
22 
23 #include <com/sun/star/beans/PropertyAttribute.hpp>
24 #include <com/sun/star/lang/WrappedTargetRuntimeException.hpp>
25 #include <com/sun/star/text/SectionFileLink.hpp>
26 
28 #include <cppuhelper/exc_hlp.hxx>
30 
31 #include <cmdid.h>
32 #include <hintids.hxx>
33 #include <svl/urihelper.hxx>
34 #include <svl/listener.hxx>
35 #include <editeng/brushitem.hxx>
36 #include <editeng/xmlcnitm.hxx>
37 #include <sfx2/linkmgr.hxx>
38 #include <sfx2/lnkbase.hxx>
39 #include <osl/mutex.hxx>
40 #include <osl/diagnose.h>
41 #include <vcl/svapp.hxx>
42 #include <fmtclds.hxx>
43 #include <unotextrange.hxx>
44 #include <TextCursorHelper.hxx>
45 #include <unoport.hxx>
46 #include <redline.hxx>
47 #include <unomap.hxx>
48 #include <section.hxx>
49 #include <doc.hxx>
51 #include <IDocumentUndoRedo.hxx>
52 #include <docsh.hxx>
53 #include <sfx2/docfile.hxx>
54 #include <docary.hxx>
55 #include <swundo.hxx>
56 #include <tox.hxx>
57 #include <unoidx.hxx>
58 #include <doctxm.hxx>
59 #include <fmtftntx.hxx>
60 #include <fmtclbl.hxx>
61 #include <editeng/frmdiritem.hxx>
62 #include <fmtcntnt.hxx>
63 #include <editeng/lrspitem.hxx>
65 #include <comphelper/string.hxx>
66 
67 using namespace ::com::sun::star;
68 
69 namespace {
70 
71 struct SwTextSectionProperties_Impl
72 {
73  uno::Sequence<sal_Int8> m_Password;
74  OUString m_sCondition;
75  OUString m_sLinkFileName;
76  OUString m_sSectionFilter;
77  OUString m_sSectionRegion;
78 
79  std::unique_ptr<SwFormatCol> m_pColItem;
80  std::unique_ptr<SvxBrushItem> m_pBrushItem;
81  std::unique_ptr<SwFormatFootnoteAtTextEnd> m_pFootnoteItem;
82  std::unique_ptr<SwFormatEndAtTextEnd> m_pEndItem;
83  std::unique_ptr<SvXMLAttrContainerItem> m_pXMLAttr;
84  std::unique_ptr<SwFormatNoBalancedColumns> m_pNoBalanceItem;
85  std::unique_ptr<SvxFrameDirectionItem> m_pFrameDirItem;
86  std::unique_ptr<SvxLRSpaceItem> m_pLRSpaceItem;
87 
88  bool m_bDDE;
89  bool m_bHidden;
90  bool m_bCondHidden;
91  bool m_bProtect;
92  bool m_bEditInReadonly;
93  bool m_bUpdateType;
94 
95  SwTextSectionProperties_Impl()
96  : m_bDDE(false)
97  , m_bHidden(false)
98  , m_bCondHidden(false)
99  , m_bProtect(false)
100  , m_bEditInReadonly(false)
101  , m_bUpdateType(true)
102  {
103  }
104 
105 };
106 
107 }
108 
110  : public SvtListener
111 {
112 private:
113  ::osl::Mutex m_Mutex; // just for OInterfaceContainerHelper2
114 
115 public:
117  uno::WeakReference<uno::XInterface> m_wThis;
120  const bool m_bIndexHeader;
122  OUString m_sName;
123  std::unique_ptr<SwTextSectionProperties_Impl> m_pProps;
125 
127  SwSectionFormat* const pFormat, const bool bIndexHeader)
128  : m_rThis(rThis)
129  , m_rPropSet(*aSwMapProvider.GetPropertySet(PROPERTY_MAP_SECTION))
130  , m_EventListeners(m_Mutex)
131  , m_bIndexHeader(bIndexHeader)
132  , m_bIsDescriptor(nullptr == pFormat)
133  , m_pProps(pFormat ? nullptr : new SwTextSectionProperties_Impl())
134  , m_pFormat(pFormat)
135  {
136  if(m_pFormat)
137  StartListening(m_pFormat->GetNotifier());
138  }
139 
140  void Attach(SwSectionFormat* pFormat)
141  {
142  EndListeningAll();
143  StartListening(pFormat->GetNotifier());
144  m_pFormat = pFormat;
145  }
146 
148  { return m_pFormat; }
149 
151  SwSectionFormat *const pFormat( GetSectionFormat() );
152  if (!pFormat) {
153  throw uno::RuntimeException("SwXTextSection: disposed or invalid", nullptr);
154  }
155  return *pFormat;
156  }
157 
164  const uno::Sequence< OUString >& rPropertyNames,
165  const uno::Sequence< uno::Any >& aValues);
169  uno::Sequence< uno::Any >
171  const uno::Sequence< OUString >& rPropertyNames);
172  virtual void Notify(const SfxHint& rHint) override;
173 };
174 
176 {
177  if(rHint.GetId() == SfxHintId::Dying)
178  {
179  m_pFormat = nullptr;
180  uno::Reference<uno::XInterface> const xThis(m_wThis);
181  if (!xThis.is())
182  { // fdo#72695: if UNO object is already dead, don't revive it with event
183  return;
184  }
185  lang::EventObject const ev(xThis);
187  }
188 }
189 
191 {
192  return m_pImpl->GetSectionFormat();
193 }
194 
195 uno::Reference< text::XTextSection >
197  SwSectionFormat *const pFormat, const bool bIndexHeader)
198 {
199  // re-use existing SwXTextSection
200  // #i105557#: do not iterate over the registered clients: race condition
201  uno::Reference< text::XTextSection > xSection;
202  if (pFormat)
203  {
204  xSection.set(pFormat->GetXTextSection());
205  }
206  if ( !xSection.is() )
207  {
208  rtl::Reference<SwXTextSection> pNew = new SwXTextSection(pFormat, bIndexHeader);
209  xSection.set(pNew);
210  if (pFormat)
211  {
212  pFormat->SetXTextSection(xSection);
213  }
214  // need a permanent Reference to initialize m_wThis
215  pNew->m_pImpl->m_wThis = xSection;
216  }
217  return xSection;
218 }
219 
221  SwSectionFormat *const pFormat, const bool bIndexHeader)
222  : m_pImpl( new SwXTextSection::Impl(*this, pFormat, bIndexHeader) )
223 {
224 }
225 
227 {
228 }
229 
230 const uno::Sequence< sal_Int8 > & SwXTextSection::getUnoTunnelId()
231 {
232  static const comphelper::UnoIdInit theSwXTextSectionUnoTunnelId;
233  return theSwXTextSectionUnoTunnelId.getSeq();
234 }
235 
236 sal_Int64 SAL_CALL
237 SwXTextSection::getSomething(const uno::Sequence< sal_Int8 >& rId)
238 {
239  return comphelper::getSomethingImpl<SwXTextSection>(rId, this);
240 }
241 
242 uno::Reference< text::XTextSection > SAL_CALL
244 {
245  SolarMutexGuard aGuard;
246 
247  SwSectionFormat & rSectionFormat( m_pImpl->GetSectionFormatOrThrow() );
248 
249  SwSectionFormat *const pParentFormat = rSectionFormat.GetParent();
250  const uno::Reference< text::XTextSection > xRet =
251  pParentFormat ? CreateXTextSection(pParentFormat) : nullptr;
252  return xRet;
253 }
254 
255 uno::Sequence< uno::Reference< text::XTextSection > > SAL_CALL
257 {
258  SolarMutexGuard aGuard;
259 
260  SwSectionFormat & rSectionFormat( m_pImpl->GetSectionFormatOrThrow() );
261 
262  SwSections aChildren;
263  rSectionFormat.GetChildSections(aChildren, SectionSort::Not, false);
264  uno::Sequence<uno::Reference<text::XTextSection> > aSeq(aChildren.size());
265  uno::Reference< text::XTextSection > * pArray = aSeq.getArray();
266  for (size_t i = 0; i < aChildren.size(); ++i)
267  {
268  SwSectionFormat *const pChild = aChildren[i]->GetFormat();
269  pArray[i] = CreateXTextSection(pChild);
270  }
271  return aSeq;
272 }
273 
274 void SAL_CALL
275 SwXTextSection::attach(const uno::Reference< text::XTextRange > & xTextRange)
276 {
277  SolarMutexGuard g;
278 
279  if (!m_pImpl->m_bIsDescriptor)
280  {
281  throw uno::RuntimeException();
282  }
283 
284  uno::Reference<lang::XUnoTunnel> xRangeTunnel( xTextRange, uno::UNO_QUERY);
285  SwXTextRange* pRange = comphelper::getFromUnoTunnel<SwXTextRange>(xRangeTunnel);
286  OTextCursorHelper* pCursor = comphelper::getFromUnoTunnel<OTextCursorHelper>(xRangeTunnel);
287 
288  SwDoc *const pDoc =
289  pRange ? &pRange->GetDoc() : (pCursor ? pCursor->GetDoc() : nullptr);
290  if (!pDoc)
291  {
292  throw lang::IllegalArgumentException();
293  }
294 
295  SwUnoInternalPaM aPam(*pDoc);
296  // this has to return true now
297  ::sw::XTextRangeToSwPaM(aPam, xTextRange);
298  UnoActionContext aCont(pDoc);
299  pDoc->GetIDocumentUndoRedo().StartUndo( SwUndoId::INSSECTION, nullptr );
300 
301  if (m_pImpl->m_sName.isEmpty())
302  {
303  m_pImpl->m_sName = "TextSection";
304  }
306  if( m_pImpl->m_pProps->m_bDDE )
307  eType = SectionType::DdeLink;
308  else if( m_pImpl->m_pProps->m_sLinkFileName.isEmpty() && m_pImpl->m_pProps->m_sSectionRegion.isEmpty() )
309  eType = SectionType::Content;
310  // index header section?
311  if (m_pImpl->m_bIndexHeader)
312  {
313  // caller wants an index header section, but will only
314  // give him one if a) we are inside an index, and b) said
315  // index doesn't yet have a header section.
316  const SwTOXBase* pBase = SwDoc::GetCurTOX(*aPam.Start());
317 
318  // are we inside an index?
319  if (pBase)
320  {
321  // get all child sections
322  SwSections aSectionsArr;
323  static_cast<const SwTOXBaseSection*>(pBase)->GetFormat()->
324  GetChildSections(aSectionsArr);
325 
326  // and search for current header section
327  const size_t nCount = aSectionsArr.size();
328  bool bHeaderPresent = false;
329  for(size_t i = 0; i < nCount; ++i)
330  {
331  if (aSectionsArr[i]->GetType() == SectionType::ToxHeader)
332  bHeaderPresent = true;
333  }
334  if (! bHeaderPresent)
335  {
336  eType = SectionType::ToxHeader;
337  }
338  }
339  }
340 
341  SwSectionData aSect(eType, pDoc->GetUniqueSectionName(&m_pImpl->m_sName));
342  aSect.SetCondition(m_pImpl->m_pProps->m_sCondition);
343  aSect.SetLinkFileName(m_pImpl->m_pProps->m_sLinkFileName +
344  OUStringChar(sfx2::cTokenSeparator) +
345  m_pImpl->m_pProps->m_sSectionFilter +
346  OUStringChar(sfx2::cTokenSeparator) +
347  m_pImpl->m_pProps->m_sSectionRegion);
348 
349  aSect.SetHidden(m_pImpl->m_pProps->m_bHidden);
350  aSect.SetProtectFlag(m_pImpl->m_pProps->m_bProtect);
351  aSect.SetEditInReadonlyFlag(m_pImpl->m_pProps->m_bEditInReadonly);
352 
353  SfxItemSet aSet(
354  pDoc->GetAttrPool(),
355  svl::Items<
358  RES_COL, RES_COL,
360  RES_UNKNOWNATR_CONTAINER,RES_UNKNOWNATR_CONTAINER>);
361  if (m_pImpl->m_pProps->m_pBrushItem)
362  {
363  aSet.Put(*m_pImpl->m_pProps->m_pBrushItem);
364  }
365  if (m_pImpl->m_pProps->m_pColItem)
366  {
367  aSet.Put(*m_pImpl->m_pProps->m_pColItem);
368  }
369  if (m_pImpl->m_pProps->m_pFootnoteItem)
370  {
371  aSet.Put(*m_pImpl->m_pProps->m_pFootnoteItem);
372  }
373  if (m_pImpl->m_pProps->m_pEndItem)
374  {
375  aSet.Put(*m_pImpl->m_pProps->m_pEndItem);
376  }
377  if (m_pImpl->m_pProps->m_pXMLAttr)
378  {
379  aSet.Put(*m_pImpl->m_pProps->m_pXMLAttr);
380  }
381  if (m_pImpl->m_pProps->m_pNoBalanceItem)
382  {
383  aSet.Put(*m_pImpl->m_pProps->m_pNoBalanceItem);
384  }
385  if (m_pImpl->m_pProps->m_pFrameDirItem)
386  {
387  aSet.Put(*m_pImpl->m_pProps->m_pFrameDirItem);
388  }
389  if (m_pImpl->m_pProps->m_pLRSpaceItem)
390  {
391  aSet.Put(*m_pImpl->m_pProps->m_pLRSpaceItem);
392  }
393  // section password
394  if (m_pImpl->m_pProps->m_Password.hasElements())
395  {
396  aSect.SetPassword(m_pImpl->m_pProps->m_Password);
397  }
398 
399  SwSection *const pRet =
400  pDoc->InsertSwSection( aPam, aSect, nullptr, aSet.Count() ? &aSet : nullptr );
401  if (!pRet) // fdo#42450 text range could partially overlap existing section
402  {
403  // shouldn't have created an undo object yet
404  pDoc->GetIDocumentUndoRedo().EndUndo( SwUndoId::INSSECTION, nullptr );
405  throw lang::IllegalArgumentException(
406  "SwXTextSection::attach(): invalid TextRange",
407  static_cast< ::cppu::OWeakObject*>(this), 0);
408  }
409  m_pImpl->Attach(pRet->GetFormat());
410  pRet->GetFormat()->SetXObject(static_cast< ::cppu::OWeakObject*>(this));
411 
412  // XML import must hide sections depending on their old
413  // condition status
414  if (!m_pImpl->m_pProps->m_sCondition.isEmpty())
415  {
416  pRet->SetCondHidden(m_pImpl->m_pProps->m_bCondHidden);
417  }
418 
419  // set update type if DDE link (and connect, if necessary)
420  if (m_pImpl->m_pProps->m_bDDE)
421  {
422  if (! pRet->IsConnected())
423  {
425  }
426  pRet->SetUpdateType( m_pImpl->m_pProps->m_bUpdateType ?
427  SfxLinkUpdateMode::ALWAYS : SfxLinkUpdateMode::ONCALL );
428  }
429 
430  // end the Undo bracketing here
431  pDoc->GetIDocumentUndoRedo().EndUndo( SwUndoId::INSSECTION, nullptr );
432  m_pImpl->m_pProps.reset();
433  m_pImpl->m_bIsDescriptor = false;
434 }
435 
436 uno::Reference< text::XTextRange > SAL_CALL
438 {
439  SolarMutexGuard aGuard;
440 
441  uno::Reference< text::XTextRange > xRet;
442  SwSectionFormat *const pSectFormat = m_pImpl->GetSectionFormat();
443  if(pSectFormat)
444  {
445  const SwNodeIndex* pIdx;
446  if( nullptr != ( pSectFormat->GetSection() ) &&
447  nullptr != ( pIdx = pSectFormat->GetContent().GetContentIdx() ) &&
448  pIdx->GetNode().GetNodes().IsDocNodes() )
449  {
450  bool isMoveIntoTable(false);
451  SwPaM aPaM(*pIdx);
452  aPaM.Move( fnMoveForward, GoInContent );
453  assert(pIdx->GetNode().IsSectionNode());
454  if (aPaM.GetPoint()->nNode.GetNode().FindTableNode() != pIdx->GetNode().FindTableNode()
455  || aPaM.GetPoint()->nNode.GetNode().FindSectionNode() != &pIdx->GetNode())
456  {
457  isMoveIntoTable = true;
458  }
459 
460  const SwEndNode* pEndNode = pIdx->GetNode().EndOfSectionNode();
461  SwPaM aEnd(*pEndNode);
463  if (aEnd.GetPoint()->nNode.GetNode().FindTableNode() != pIdx->GetNode().FindTableNode()
464  || aEnd.GetPoint()->nNode.GetNode().FindSectionNode() != &pIdx->GetNode())
465  {
466  isMoveIntoTable = true;
467  }
468  if (isMoveIntoTable)
469  {
470  uno::Reference<text::XText> const xParentText(
471  ::sw::CreateParentXText(*pSectFormat->GetDoc(), SwPosition(*pIdx)));
472  xRet = new SwXTextRange(*pSectFormat);
473  }
474  else // for compatibility, keep the old way in this case
475  {
476  xRet = SwXTextRange::CreateXTextRange(*pSectFormat->GetDoc(),
477  *aPaM.Start(), aEnd.Start());
478  }
479  }
480  }
481  return xRet;
482 }
483 
484 void SAL_CALL SwXTextSection::dispose()
485 {
486  SolarMutexGuard aGuard;
487 
488  SwSectionFormat *const pSectFormat = m_pImpl->GetSectionFormat();
489  if (pSectFormat)
490  {
491  pSectFormat->GetDoc()->DelSectionFormat( pSectFormat );
492  }
493 }
494 
496  const uno::Reference< lang::XEventListener > & xListener)
497 {
498  // no need to lock here as m_pImpl is const and container threadsafe
499  m_pImpl->m_EventListeners.addInterface(xListener);
500 }
501 
503  const uno::Reference< lang::XEventListener > & xListener)
504 {
505  // no need to lock here as m_pImpl is const and container threadsafe
506  m_pImpl->m_EventListeners.removeInterface(xListener);
507 }
508 
509 uno::Reference< beans::XPropertySetInfo > SAL_CALL
511 {
512  SolarMutexGuard g;
513  return m_pImpl->m_rPropSet.getPropertySetInfo();
514 }
515 
516 static void
517 lcl_UpdateLinkType(SwSection & rSection, bool const bLinkUpdateAlways)
518 {
519  if (rSection.GetType() == SectionType::DdeLink)
520  {
521  // set update type; needs an established link
522  if (!rSection.IsConnected())
523  {
525  }
526  rSection.SetUpdateType( bLinkUpdateAlways
527  ? SfxLinkUpdateMode::ALWAYS : SfxLinkUpdateMode::ONCALL );
528  }
529 }
530 
531 static void
533  std::unique_ptr<SwSectionData> const& pSectionData,
534  std::optional<SfxItemSet> const& oItemSet,
535  bool const bLinkModeChanged, bool const bLinkUpdateAlways = true)
536 {
537  if (!pFormat)
538  return;
539 
540  SwSection & rSection = *pFormat->GetSection();
541  SwDoc *const pDoc = pFormat->GetDoc();
542  SwSectionFormats const& rFormats = pDoc->GetSections();
543  UnoActionContext aContext(pDoc);
544  for (size_t i = 0; i < rFormats.size(); ++i)
545  {
546  if (rFormats[i]->GetSection()->GetSectionName()
547  == rSection.GetSectionName())
548  {
549  pDoc->UpdateSection(i, *pSectionData, oItemSet ? &*oItemSet : nullptr,
550  pDoc->IsInReading());
551  {
552  // temporarily remove actions to allow cursor update
553  // TODO: why? no table cursor here!
554  UnoActionRemoveContext aRemoveContext( pDoc );
555  }
556 
557  if (bLinkModeChanged)
558  {
559  lcl_UpdateLinkType(rSection, bLinkUpdateAlways);
560  }
561  // section found and processed: break from loop
562  break;
563  }
564  }
565 }
566 
568  const uno::Sequence< OUString >& rPropertyNames,
569  const uno::Sequence< uno::Any >& rValues)
570 {
571  if(rPropertyNames.getLength() != rValues.getLength())
572  {
573  throw lang::IllegalArgumentException();
574  }
575  SwSectionFormat *const pFormat = GetSectionFormat();
576  if (!pFormat && !m_bIsDescriptor)
577  {
578  throw uno::RuntimeException();
579  }
580 
581  std::unique_ptr<SwSectionData> const pSectionData(
582  pFormat ? new SwSectionData(*pFormat->GetSection()) : nullptr);
583 
584  OUString const*const pPropertyNames = rPropertyNames.getConstArray();
585  uno::Any const*const pValues = rValues.getConstArray();
586  std::optional<SfxItemSet> oItemSet;
587  bool bLinkModeChanged = false;
588  bool bLinkMode = false;
589 
590  for (sal_Int32 nProperty = 0; nProperty < rPropertyNames.getLength();
591  nProperty++)
592  {
593  SfxItemPropertyMapEntry const*const pEntry =
594  m_rPropSet.getPropertyMap().getByName(pPropertyNames[nProperty]);
595  if (!pEntry)
596  {
597  throw beans::UnknownPropertyException(
598  "Unknown property: " + pPropertyNames[nProperty],
599  static_cast<cppu::OWeakObject *>(& m_rThis));
600  }
601  if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
602  {
603  throw beans::PropertyVetoException(
604  "Property is read-only: " + pPropertyNames[nProperty],
605  static_cast<cppu::OWeakObject *>(& m_rThis));
606  }
607  switch (pEntry->nWID)
608  {
609  case WID_SECT_CONDITION:
610  {
611  OUString uTmp;
612  pValues[nProperty] >>= uTmp;
613  if (m_bIsDescriptor)
614  {
615  m_pProps->m_sCondition = uTmp;
616  }
617  else
618  {
619  pSectionData->SetCondition(uTmp);
620  }
621  }
622  break;
623  case WID_SECT_DDE_TYPE:
624  case WID_SECT_DDE_FILE:
626  {
627  OUString sTmp;
628  pValues[nProperty] >>= sTmp;
629  if (m_bIsDescriptor)
630  {
631  if (!m_pProps->m_bDDE)
632  {
633  m_pProps->m_sLinkFileName =
634  OUStringChar(sfx2::cTokenSeparator) + OUStringChar(sfx2::cTokenSeparator);
635  m_pProps->m_bDDE = true;
636  }
637  m_pProps->m_sLinkFileName = comphelper::string::setToken(
638  m_pProps->m_sLinkFileName,
639  pEntry->nWID - WID_SECT_DDE_TYPE, sfx2::cTokenSeparator, sTmp);
640  }
641  else
642  {
643  OUString sLinkFileName(pSectionData->GetLinkFileName());
644  if (pSectionData->GetType() != SectionType::DdeLink)
645  {
646  sLinkFileName = OUStringChar(sfx2::cTokenSeparator) + OUStringChar(sfx2::cTokenSeparator);
647  pSectionData->SetType(SectionType::DdeLink);
648  }
649  sLinkFileName = comphelper::string::setToken(sLinkFileName,
650  pEntry->nWID - WID_SECT_DDE_TYPE,
651  sfx2::cTokenSeparator, sTmp);
652  pSectionData->SetLinkFileName(sLinkFileName);
653  }
654  }
655  break;
657  {
658  bool bVal(false);
659  if (!(pValues[nProperty] >>= bVal))
660  {
661  throw lang::IllegalArgumentException();
662  }
663  if (m_bIsDescriptor)
664  {
665  m_pProps->m_bUpdateType = bVal;
666  }
667  else
668  {
669  bLinkModeChanged = true;
670  bLinkMode = bVal;
671  }
672  }
673  break;
674  case WID_SECT_LINK:
675  {
676  text::SectionFileLink aLink;
677  if (!(pValues[nProperty] >>= aLink))
678  {
679  throw lang::IllegalArgumentException();
680  }
681  if (m_bIsDescriptor)
682  {
683  m_pProps->m_bDDE = false;
684  m_pProps->m_sLinkFileName = aLink.FileURL;
685  m_pProps->m_sSectionFilter = aLink.FilterName;
686  }
687  else
688  {
689  if (pSectionData->GetType() != SectionType::FileLink &&
690  !aLink.FileURL.isEmpty())
691  {
692  pSectionData->SetType(SectionType::FileLink);
693  }
694  const OUString sTmp(!aLink.FileURL.isEmpty()
696  pFormat->GetDoc()->GetDocShell()->GetMedium()->GetURLObject(),
697  aLink.FileURL, URIHelper::GetMaybeFileHdl())
698  : OUString());
699  const OUString sFileName(
700  sTmp + OUStringChar(sfx2::cTokenSeparator) +
701  aLink.FilterName + OUStringChar(sfx2::cTokenSeparator) +
702  pSectionData->GetLinkFileName().getToken(2, sfx2::cTokenSeparator));
703  pSectionData->SetLinkFileName(sFileName);
704  if (sFileName.getLength() < 3)
705  {
706  pSectionData->SetType(SectionType::Content);
707  }
708  }
709  }
710  break;
711  case WID_SECT_REGION:
712  {
713  OUString sLink;
714  pValues[nProperty] >>= sLink;
715  if (m_bIsDescriptor)
716  {
717  m_pProps->m_bDDE = false;
718  m_pProps->m_sSectionRegion = sLink;
719  }
720  else
721  {
722  if (pSectionData->GetType() != SectionType::FileLink &&
723  !sLink.isEmpty())
724  {
725  pSectionData->SetType(SectionType::FileLink);
726  }
727  OUString sSectLink(pSectionData->GetLinkFileName());
728  for (sal_Int32 i = comphelper::string::getTokenCount(sSectLink, sfx2::cTokenSeparator);
729  i < 3; ++i)
730  {
731  sSectLink += OUStringChar(sfx2::cTokenSeparator);
732  }
733  sSectLink = comphelper::string::setToken(sSectLink, 2, sfx2::cTokenSeparator, sLink);
734  pSectionData->SetLinkFileName(sSectLink);
735  if (sSectLink.getLength() < 3)
736  {
737  pSectionData->SetType(SectionType::Content);
738  }
739  }
740  }
741  break;
742  case WID_SECT_VISIBLE:
743  {
744  bool bVal(false);
745  if (!(pValues[nProperty] >>= bVal))
746  {
747  throw lang::IllegalArgumentException();
748  }
749  if (m_bIsDescriptor)
750  {
751  m_pProps->m_bHidden = !bVal;
752  }
753  else
754  {
755  pSectionData->SetHidden(!bVal);
756  }
757  }
758  break;
760  {
761  bool bVal(false);
762  if (!(pValues[nProperty] >>= bVal))
763  {
764  throw lang::IllegalArgumentException();
765  }
766  if (m_bIsDescriptor)
767  {
768  m_pProps->m_bCondHidden = !bVal;
769  }
770  else
771  {
772  if (!pSectionData->GetCondition().isEmpty())
773  {
774  pSectionData->SetCondHidden(!bVal);
775  }
776  }
777  }
778  break;
779  case WID_SECT_PROTECTED:
780  {
781  bool bVal(false);
782  if (!(pValues[nProperty] >>= bVal))
783  {
784  throw lang::IllegalArgumentException();
785  }
786  if (m_bIsDescriptor)
787  {
788  m_pProps->m_bProtect = bVal;
789  }
790  else
791  {
792  pSectionData->SetProtectFlag(bVal);
793  }
794  }
795  break;
797  {
798  bool bVal(false);
799  if (!(pValues[nProperty] >>= bVal))
800  {
801  throw lang::IllegalArgumentException();
802  }
803  if (m_bIsDescriptor)
804  {
805  m_pProps->m_bEditInReadonly = bVal;
806  }
807  else
808  {
809  pSectionData->SetEditInReadonlyFlag(bVal);
810  }
811  }
812  break;
813  case WID_SECT_PASSWORD:
814  {
815  uno::Sequence<sal_Int8> aSeq;
816  pValues[nProperty] >>= aSeq;
817  if (m_bIsDescriptor)
818  {
819  m_pProps->m_Password = aSeq;
820  }
821  else
822  {
823  pSectionData->SetPassword(aSeq);
824  }
825  }
826  break;
827  default:
828  {
829  if (pFormat)
830  {
831  const SfxItemSet& rOldAttrSet = pFormat->GetAttrSet();
832  oItemSet.emplace(*rOldAttrSet.GetPool(), pEntry->nWID, pEntry->nWID);
833  oItemSet->Put(rOldAttrSet);
835  pValues[nProperty], *oItemSet);
836  }
837  else
838  {
839  SfxPoolItem* pPutItem = nullptr;
840  if (RES_COL == pEntry->nWID)
841  {
842  if (!m_pProps->m_pColItem)
843  {
844  m_pProps->m_pColItem.reset(new SwFormatCol);
845  }
846  pPutItem = m_pProps->m_pColItem.get();
847  }
848  else if (RES_BACKGROUND == pEntry->nWID)
849  {
850  if (!m_pProps->m_pBrushItem)
851  {
852  m_pProps->m_pBrushItem.reset(
854  }
855  pPutItem = m_pProps->m_pBrushItem.get();
856  }
857  else if (RES_FTN_AT_TXTEND == pEntry->nWID)
858  {
859  if (!m_pProps->m_pFootnoteItem)
860  {
861  m_pProps->m_pFootnoteItem.reset(new SwFormatFootnoteAtTextEnd);
862  }
863  pPutItem = m_pProps->m_pFootnoteItem.get();
864  }
865  else if (RES_END_AT_TXTEND == pEntry->nWID)
866  {
867  if (!m_pProps->m_pEndItem)
868  {
869  m_pProps->m_pEndItem.reset(new SwFormatEndAtTextEnd);
870  }
871  pPutItem = m_pProps->m_pEndItem.get();
872  }
873  else if (RES_UNKNOWNATR_CONTAINER== pEntry->nWID)
874  {
875  if (!m_pProps->m_pXMLAttr)
876  {
877  m_pProps->m_pXMLAttr.reset(
880  }
881  pPutItem = m_pProps->m_pXMLAttr.get();
882  }
883  else if (RES_COLUMNBALANCE== pEntry->nWID)
884  {
885  if (!m_pProps->m_pNoBalanceItem)
886  {
887  m_pProps->m_pNoBalanceItem.reset(
888  new SwFormatNoBalancedColumns(true));
889  }
890  pPutItem = m_pProps->m_pNoBalanceItem.get();
891  }
892  else if (RES_FRAMEDIR == pEntry->nWID)
893  {
894  if (!m_pProps->m_pFrameDirItem)
895  {
896  m_pProps->m_pFrameDirItem.reset(
898  SvxFrameDirection::Horizontal_LR_TB, RES_FRAMEDIR));
899  }
900  pPutItem = m_pProps->m_pFrameDirItem.get();
901  }
902  else if (RES_LR_SPACE == pEntry->nWID)
903  {
904  if (!m_pProps->m_pLRSpaceItem)
905  {
906  m_pProps->m_pLRSpaceItem.reset(
908  }
909  pPutItem = m_pProps->m_pLRSpaceItem.get();
910  }
911  if (pPutItem)
912  {
913  pPutItem->PutValue(pValues[nProperty],
914  pEntry->nMemberId);
915  }
916  }
917  }
918  }
919  }
920 
921  lcl_UpdateSection(pFormat, pSectionData, oItemSet, bLinkModeChanged,
922  bLinkMode);
923 }
924 
925 void SAL_CALL
927  const uno::Sequence< OUString >& rPropertyNames,
928  const uno::Sequence< uno::Any >& rValues)
929 {
930  SolarMutexGuard aGuard;
931 
932  // workaround for bad designed API
933  try
934  {
935  m_pImpl->SetPropertyValues_Impl( rPropertyNames, rValues );
936  }
937  catch (const beans::UnknownPropertyException &rException)
938  {
939  // wrap the original (here not allowed) exception in
940  // a WrappedTargetException that gets thrown instead.
941  lang::WrappedTargetException aWExc;
942  aWExc.TargetException <<= rException;
943  throw aWExc;
944  }
945 }
946 
948  const OUString& rPropertyName, const uno::Any& rValue)
949 {
950  SolarMutexGuard aGuard;
951 
952  uno::Sequence< OUString > aPropertyNames { rPropertyName };
953  uno::Sequence< uno::Any > aValues(1);
954  aValues.getArray()[0] = rValue;
955  m_pImpl->SetPropertyValues_Impl( aPropertyNames, aValues );
956 }
957 
958 uno::Sequence< uno::Any >
960  const uno::Sequence< OUString > & rPropertyNames )
961 {
962  SwSectionFormat *const pFormat = GetSectionFormat();
963  if (!pFormat && !m_bIsDescriptor)
964  {
965  throw uno::RuntimeException( "non-descriptor section without format");
966  }
967 
968  uno::Sequence< uno::Any > aRet(rPropertyNames.getLength());
969  uno::Any* pRet = aRet.getArray();
970  SwSection *const pSect = pFormat ? pFormat->GetSection() : nullptr;
971  const OUString* pPropertyNames = rPropertyNames.getConstArray();
972 
973  for (sal_Int32 nProperty = 0; nProperty < rPropertyNames.getLength();
974  nProperty++)
975  {
976  SfxItemPropertyMapEntry const*const pEntry =
977  m_rPropSet.getPropertyMap().getByName(pPropertyNames[nProperty]);
978  if (!pEntry)
979  {
980  throw beans::UnknownPropertyException(
981  "Unknown property: " + pPropertyNames[nProperty],
982  static_cast<cppu::OWeakObject *>(& m_rThis));
983  }
984  switch(pEntry->nWID)
985  {
986  case WID_SECT_CONDITION:
987  {
988  const OUString uTmp( m_bIsDescriptor
989  ? m_pProps->m_sCondition
990  : pSect->GetCondition());
991  pRet[nProperty] <<= uTmp;
992  }
993  break;
994  case WID_SECT_DDE_TYPE:
995  case WID_SECT_DDE_FILE:
997  {
998  OUString sRet;
999  if (m_bIsDescriptor)
1000  {
1001  if (m_pProps->m_bDDE)
1002  {
1003  sRet = m_pProps->m_sLinkFileName;
1004  }
1005  }
1006  else if (SectionType::DdeLink == pSect->GetType())
1007  {
1008  sRet = pSect->GetLinkFileName();
1009  }
1010  pRet[nProperty] <<= sRet.getToken(pEntry->nWID - WID_SECT_DDE_TYPE,
1012  }
1013  break;
1015  {
1016  // GetUpdateType() returns .._ALWAYS or .._ONCALL
1017  if (pSect && pSect->IsLinkType() && pSect->IsConnected()) // #i73247#
1018  {
1019  const bool bTemp =
1020  (pSect->GetUpdateType() == SfxLinkUpdateMode::ALWAYS);
1021  pRet[nProperty] <<= bTemp;
1022  }
1023  }
1024  break;
1025  case WID_SECT_LINK :
1026  {
1027  text::SectionFileLink aLink;
1028  if (m_bIsDescriptor)
1029  {
1030  if (!m_pProps->m_bDDE)
1031  {
1032  aLink.FileURL = m_pProps->m_sLinkFileName;
1033  aLink.FilterName = m_pProps->m_sSectionFilter;
1034  }
1035  }
1036  else if (SectionType::FileLink == pSect->GetType())
1037  {
1038  const OUString& sRet( pSect->GetLinkFileName() );
1039  sal_Int32 nIndex(0);
1040  aLink.FileURL =
1041  sRet.getToken(0, sfx2::cTokenSeparator, nIndex);
1042  aLink.FilterName =
1043  sRet.getToken(0, sfx2::cTokenSeparator, nIndex);
1044  }
1045  pRet[nProperty] <<= aLink;
1046  }
1047  break;
1048  case WID_SECT_REGION :
1049  {
1050  OUString sRet;
1051  if (m_bIsDescriptor)
1052  {
1053  sRet = m_pProps->m_sSectionRegion;
1054  }
1055  else if (SectionType::FileLink == pSect->GetType())
1056  {
1057  sRet = pSect->GetLinkFileName().getToken(2,
1059  }
1060  pRet[nProperty] <<= sRet;
1061  }
1062  break;
1063  case WID_SECT_VISIBLE :
1064  {
1065  const bool bTemp = m_bIsDescriptor
1066  ? !m_pProps->m_bHidden : !pSect->IsHidden();
1067  pRet[nProperty] <<= bTemp;
1068  }
1069  break;
1071  {
1072  const bool bTemp = m_bIsDescriptor
1073  ? !m_pProps->m_bCondHidden : !pSect->IsCondHidden();
1074  pRet[nProperty] <<= bTemp;
1075  }
1076  break;
1077  case WID_SECT_PROTECTED:
1078  {
1079  const bool bTemp = m_bIsDescriptor
1080  ? m_pProps->m_bProtect : pSect->IsProtect();
1081  pRet[nProperty] <<= bTemp;
1082  }
1083  break;
1085  {
1086  const bool bTemp = m_bIsDescriptor
1087  ? m_pProps->m_bEditInReadonly : pSect->IsEditInReadonly();
1088  pRet[nProperty] <<= bTemp;
1089  }
1090  break;
1092  {
1093  if (pFormat)
1094  {
1095  pRet[nProperty] <<= pFormat->GetSection()->GetSectionName();
1096  }
1097  }
1098  break;
1100  {
1101  // search enclosing index
1102  SwSection* pEnclosingSection = pSect;
1103  while ((pEnclosingSection != nullptr) &&
1104  (SectionType::ToxContent != pEnclosingSection->GetType()))
1105  {
1106  pEnclosingSection = pEnclosingSection->GetParent();
1107  }
1108  SwTOXBaseSection* const pTOXBaseSect = pEnclosingSection ?
1109  dynamic_cast<SwTOXBaseSection*>( pEnclosingSection ) : nullptr;
1110  if (pTOXBaseSect)
1111  {
1112  // convert section to TOXBase and get SwXDocumentIndex
1113  const uno::Reference<text::XDocumentIndex> xIndex =
1115  *pTOXBaseSect->GetFormat()->GetDoc(), pTOXBaseSect);
1116  pRet[nProperty] <<= xIndex;
1117  }
1118  // else: no enclosing index found -> empty return value
1119  }
1120  break;
1122  {
1123  const bool bRet = pFormat && (nullptr != pFormat->GetGlobalDocSection());
1124  pRet[nProperty] <<= bRet;
1125  }
1126  break;
1127  case FN_UNO_ANCHOR_TYPES:
1128  case FN_UNO_TEXT_WRAP:
1129  case FN_UNO_ANCHOR_TYPE:
1131  pRet[nProperty], u"", pEntry->nWID);
1132  break;
1135  {
1136  if (!pFormat)
1137  break; // #i73247#
1138  SwNode* pSectNode = pFormat->GetSectionNode();
1139  if (FN_UNO_REDLINE_NODE_END == pEntry->nWID)
1140  {
1141  pSectNode = pSectNode->EndOfSectionNode();
1142  }
1143  const SwRedlineTable& rRedTable =
1145  for (SwRangeRedline* pRedline : rRedTable)
1146  {
1147  const SwNode& rRedPointNode = pRedline->GetNode();
1148  const SwNode& rRedMarkNode = pRedline->GetNode(false);
1149  if ((&rRedPointNode == pSectNode) ||
1150  (&rRedMarkNode == pSectNode))
1151  {
1152  const SwNode& rStartOfRedline =
1153  (SwNodeIndex(rRedPointNode) <=
1154  SwNodeIndex(rRedMarkNode))
1155  ? rRedPointNode : rRedMarkNode;
1156  const bool bIsStart = (&rStartOfRedline == pSectNode);
1157  pRet[nProperty] <<=
1159  *pRedline, bIsStart);
1160  break;
1161  }
1162  }
1163  }
1164  break;
1165  case WID_SECT_PASSWORD:
1166  {
1167  pRet[nProperty] <<= m_bIsDescriptor
1168  ? m_pProps->m_Password : pSect->GetPassword();
1169  }
1170  break;
1171  default:
1172  {
1173  if (pFormat)
1174  {
1175  m_rPropSet.getPropertyValue(*pEntry,
1176  pFormat->GetAttrSet(), pRet[nProperty]);
1177  }
1178  else
1179  {
1180  const SfxPoolItem* pQueryItem = nullptr;
1181  if (RES_COL == pEntry->nWID)
1182  {
1183  if (!m_pProps->m_pColItem)
1184  {
1185  m_pProps->m_pColItem.reset(new SwFormatCol);
1186  }
1187  pQueryItem = m_pProps->m_pColItem.get();
1188  }
1189  else if (RES_BACKGROUND == pEntry->nWID)
1190  {
1191  if (!m_pProps->m_pBrushItem)
1192  {
1193  m_pProps->m_pBrushItem.reset(
1195  }
1196  pQueryItem = m_pProps->m_pBrushItem.get();
1197  }
1198  else if (RES_FTN_AT_TXTEND == pEntry->nWID)
1199  {
1200  if (!m_pProps->m_pFootnoteItem)
1201  {
1202  m_pProps->m_pFootnoteItem.reset(new SwFormatFootnoteAtTextEnd);
1203  }
1204  pQueryItem = m_pProps->m_pFootnoteItem.get();
1205  }
1206  else if (RES_END_AT_TXTEND == pEntry->nWID)
1207  {
1208  if (!m_pProps->m_pEndItem)
1209  {
1210  m_pProps->m_pEndItem.reset(new SwFormatEndAtTextEnd);
1211  }
1212  pQueryItem = m_pProps->m_pEndItem.get();
1213  }
1214  else if (RES_UNKNOWNATR_CONTAINER== pEntry->nWID)
1215  {
1216  if (!m_pProps->m_pXMLAttr)
1217  {
1218  m_pProps->m_pXMLAttr.reset(
1220  }
1221  pQueryItem = m_pProps->m_pXMLAttr.get();
1222  }
1223  else if (RES_COLUMNBALANCE== pEntry->nWID)
1224  {
1225  if (!m_pProps->m_pNoBalanceItem)
1226  {
1227  m_pProps->m_pNoBalanceItem.reset(
1229  }
1230  pQueryItem = m_pProps->m_pNoBalanceItem.get();
1231  }
1232  else if (RES_FRAMEDIR == pEntry->nWID)
1233  {
1234  if (!m_pProps->m_pFrameDirItem)
1235  {
1236  m_pProps->m_pFrameDirItem.reset(
1238  SvxFrameDirection::Environment, RES_FRAMEDIR));
1239  }
1240  pQueryItem = m_pProps->m_pFrameDirItem.get();
1241  }
1242  else if (RES_LR_SPACE == pEntry->nWID)
1243  {
1244  if (!m_pProps->m_pLRSpaceItem)
1245  {
1246  m_pProps->m_pLRSpaceItem.reset(
1247  new SvxLRSpaceItem( RES_LR_SPACE ));
1248  }
1249  pQueryItem = m_pProps->m_pLRSpaceItem.get();
1250  }
1251  if (pQueryItem)
1252  {
1253  pQueryItem->QueryValue(pRet[nProperty],
1254  pEntry->nMemberId);
1255  }
1256  }
1257  }
1258  }
1259  }
1260  return aRet;
1261 }
1262 
1263 uno::Sequence< uno::Any > SAL_CALL
1265  const uno::Sequence< OUString >& rPropertyNames)
1266 {
1267  SolarMutexGuard aGuard;
1268  uno::Sequence< uno::Any > aValues;
1269 
1270  // workaround for bad designed API
1271  try
1272  {
1273  aValues = m_pImpl->GetPropertyValues_Impl( rPropertyNames );
1274  }
1275  catch (beans::UnknownPropertyException &)
1276  {
1277  css::uno::Any anyEx = cppu::getCaughtException();
1278  throw lang::WrappedTargetRuntimeException("Unknown property exception caught",
1279  static_cast < cppu::OWeakObject * > ( this ), anyEx );
1280  }
1281  catch (lang::WrappedTargetException &)
1282  {
1283  css::uno::Any anyEx = cppu::getCaughtException();
1284  throw lang::WrappedTargetRuntimeException("WrappedTargetException caught",
1285  static_cast < cppu::OWeakObject * > ( this ), anyEx );
1286  }
1287 
1288  return aValues;
1289 }
1290 
1291 uno::Any SAL_CALL
1292 SwXTextSection::getPropertyValue(const OUString& rPropertyName)
1293 {
1294  SolarMutexGuard aGuard;
1295 
1296  uno::Sequence< OUString > aPropertyNames { rPropertyName };
1297  return m_pImpl->GetPropertyValues_Impl(aPropertyNames).getConstArray()[0];
1298 }
1299 
1301  const uno::Sequence< OUString >& /*aPropertyNames*/,
1302  const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
1303 {
1304  OSL_FAIL("SwXTextSection::addPropertiesChangeListener(): not implemented");
1305 }
1306 
1308  const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
1309 {
1310  OSL_FAIL("SwXTextSection::removePropertiesChangeListener(): not implemented");
1311 }
1312 
1314  const uno::Sequence< OUString >& /*aPropertyNames*/,
1315  const uno::Reference< beans::XPropertiesChangeListener >& /*xListener*/ )
1316 {
1317  OSL_FAIL("SwXTextSection::firePropertiesChangeEvent(): not implemented");
1318 }
1319 
1320 void SAL_CALL
1322  const OUString& /*rPropertyName*/,
1323  const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
1324 {
1325  OSL_FAIL("SwXTextSection::addPropertyChangeListener(): not implemented");
1326 }
1327 
1328 void SAL_CALL
1330  const OUString& /*rPropertyName*/,
1331  const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/)
1332 {
1333  OSL_FAIL("SwXTextSection::removePropertyChangeListener(): not implemented");
1334 }
1335 
1336 void SAL_CALL
1338  const OUString& /*rPropertyName*/,
1339  const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
1340 {
1341  OSL_FAIL("SwXTextSection::addVetoableChangeListener(): not implemented");
1342 }
1343 
1344 void SAL_CALL
1346  const OUString& /*rPropertyName*/,
1347  const uno::Reference< beans::XVetoableChangeListener >& /*xListener*/)
1348 {
1349  OSL_FAIL("SwXTextSection::removeVetoableChangeListener(): not implemented");
1350 }
1351 
1352 beans::PropertyState SAL_CALL
1353 SwXTextSection::getPropertyState(const OUString& rPropertyName)
1354 {
1355  SolarMutexGuard aGuard;
1356 
1357  uno::Sequence< OUString > aNames { rPropertyName };
1358  return getPropertyStates(aNames).getConstArray()[0];
1359 }
1360 
1361 uno::Sequence< beans::PropertyState > SAL_CALL
1363  const uno::Sequence< OUString >& rPropertyNames)
1364 {
1365  SolarMutexGuard aGuard;
1366 
1367  SwSectionFormat *const pFormat = m_pImpl->GetSectionFormat();
1368  if (!pFormat && !m_pImpl->m_bIsDescriptor)
1369  {
1370  throw uno::RuntimeException();
1371  }
1372 
1373  uno::Sequence< beans::PropertyState > aStates(rPropertyNames.getLength());
1374  beans::PropertyState *const pStates = aStates.getArray();
1375  const OUString* pNames = rPropertyNames.getConstArray();
1376  for (sal_Int32 i = 0; i < rPropertyNames.getLength(); i++)
1377  {
1378  pStates[i] = beans::PropertyState_DEFAULT_VALUE;
1379  SfxItemPropertyMapEntry const*const pEntry =
1380  m_pImpl->m_rPropSet.getPropertyMap().getByName( pNames[i]);
1381  if (!pEntry)
1382  {
1383  throw beans::UnknownPropertyException(
1384  "Unknown property: " + pNames[i],
1385  static_cast< cppu::OWeakObject* >(this));
1386  }
1387  switch (pEntry->nWID)
1388  {
1389  case WID_SECT_CONDITION:
1390  case WID_SECT_DDE_TYPE:
1391  case WID_SECT_DDE_FILE:
1392  case WID_SECT_DDE_ELEMENT:
1394  case WID_SECT_LINK:
1395  case WID_SECT_REGION :
1396  case WID_SECT_VISIBLE:
1397  case WID_SECT_PROTECTED:
1400  case FN_UNO_ANCHOR_TYPES:
1401  case FN_UNO_TEXT_WRAP:
1402  case FN_UNO_ANCHOR_TYPE:
1403  pStates[i] = beans::PropertyState_DIRECT_VALUE;
1404  break;
1405  default:
1406  {
1407  if (pFormat)
1408  {
1409  pStates[i] = m_pImpl->m_rPropSet.getPropertyState(
1410  pNames[i], pFormat->GetAttrSet());
1411  }
1412  else
1413  {
1414  if (RES_COL == pEntry->nWID)
1415  {
1416  if (!m_pImpl->m_pProps->m_pColItem)
1417  {
1418  pStates[i] = beans::PropertyState_DEFAULT_VALUE;
1419  }
1420  else
1421  {
1422  pStates[i] = beans::PropertyState_DIRECT_VALUE;
1423  }
1424  }
1425  else
1426  {
1427  if (!m_pImpl->m_pProps->m_pBrushItem)
1428  {
1429  pStates[i] = beans::PropertyState_DEFAULT_VALUE;
1430  }
1431  else
1432  {
1433  pStates[i] = beans::PropertyState_DIRECT_VALUE;
1434  }
1435  }
1436  }
1437  }
1438  }
1439  }
1440  return aStates;
1441 }
1442 
1443 void SAL_CALL
1444 SwXTextSection::setPropertyToDefault(const OUString& rPropertyName)
1445 {
1446  SolarMutexGuard aGuard;
1447 
1448  SwSectionFormat *const pFormat = m_pImpl->GetSectionFormat();
1449  if (!pFormat && !m_pImpl->m_bIsDescriptor)
1450  {
1451  throw uno::RuntimeException();
1452  }
1453 
1454  SfxItemPropertyMapEntry const*const pEntry =
1455  m_pImpl->m_rPropSet.getPropertyMap().getByName(rPropertyName);
1456  if (!pEntry)
1457  {
1458  throw beans::UnknownPropertyException(
1459  "Unknown property: " + rPropertyName,
1460  static_cast< cppu::OWeakObject* >(this));
1461  }
1462  if (pEntry->nFlags & beans::PropertyAttribute::READONLY)
1463  {
1464  throw uno::RuntimeException(
1465  "Property is read-only: " + rPropertyName,
1466  static_cast<cppu::OWeakObject *>(this));
1467  }
1468 
1469  std::unique_ptr<SwSectionData> const pSectionData(
1470  pFormat ? new SwSectionData(*pFormat->GetSection()) : nullptr);
1471 
1472  std::optional<SfxItemSet> oNewAttrSet;
1473  bool bLinkModeChanged = false;
1474 
1475  switch (pEntry->nWID)
1476  {
1477  case WID_SECT_CONDITION:
1478  {
1479  if (m_pImpl->m_bIsDescriptor)
1480  {
1481  m_pImpl->m_pProps->m_sCondition.clear();
1482  }
1483  else
1484  {
1485  pSectionData->SetCondition(OUString());
1486  }
1487  }
1488  break;
1489  case WID_SECT_DDE_TYPE :
1490  case WID_SECT_DDE_FILE :
1491  case WID_SECT_DDE_ELEMENT :
1492  case WID_SECT_LINK :
1493  case WID_SECT_REGION :
1494  if (m_pImpl->m_bIsDescriptor)
1495  {
1496  m_pImpl->m_pProps->m_bDDE = false;
1497  m_pImpl->m_pProps->m_sLinkFileName.clear();
1498  m_pImpl->m_pProps->m_sSectionRegion.clear();
1499  m_pImpl->m_pProps->m_sSectionFilter.clear();
1500  }
1501  else
1502  {
1503  pSectionData->SetType(SectionType::Content);
1504  }
1505  break;
1507  if (m_pImpl->m_bIsDescriptor)
1508  {
1509  m_pImpl->m_pProps->m_bUpdateType = true;
1510  }
1511  else
1512  {
1513  bLinkModeChanged = true;
1514  }
1515  break;
1516  case WID_SECT_VISIBLE :
1517  {
1518  if (m_pImpl->m_bIsDescriptor)
1519  {
1520  m_pImpl->m_pProps->m_bHidden = false;
1521  }
1522  else
1523  {
1524  pSectionData->SetHidden(false);
1525  }
1526  }
1527  break;
1528  case WID_SECT_PROTECTED:
1529  {
1530  if (m_pImpl->m_bIsDescriptor)
1531  {
1532  m_pImpl->m_pProps->m_bProtect = false;
1533  }
1534  else
1535  {
1536  pSectionData->SetProtectFlag(false);
1537  }
1538  }
1539  break;
1541  {
1542  if (m_pImpl->m_bIsDescriptor)
1543  {
1544  m_pImpl->m_pProps->m_bEditInReadonly = false;
1545  }
1546  else
1547  {
1548  pSectionData->SetEditInReadonlyFlag(false);
1549  }
1550  }
1551  break;
1552 
1553  case FN_UNO_ANCHOR_TYPES:
1554  case FN_UNO_TEXT_WRAP:
1555  case FN_UNO_ANCHOR_TYPE:
1556  break;
1557  default:
1558  {
1559  if (SfxItemPool::IsWhich(pEntry->nWID))
1560  {
1561  if (pFormat)
1562  {
1563  const SfxItemSet& rOldAttrSet = pFormat->GetAttrSet();
1564  oNewAttrSet.emplace(*rOldAttrSet.GetPool(), pEntry->nWID, pEntry->nWID);
1565  oNewAttrSet->ClearItem(pEntry->nWID);
1566  }
1567  else
1568  {
1569  if (RES_COL == pEntry->nWID)
1570  {
1571  m_pImpl->m_pProps->m_pColItem.reset();
1572  }
1573  else if (RES_BACKGROUND == pEntry->nWID)
1574  {
1575  m_pImpl->m_pProps->m_pBrushItem.reset();
1576  }
1577  }
1578  }
1579  }
1580  }
1581 
1582  lcl_UpdateSection(pFormat, pSectionData, oNewAttrSet, bLinkModeChanged);
1583 }
1584 
1585 uno::Any SAL_CALL
1586 SwXTextSection::getPropertyDefault(const OUString& rPropertyName)
1587 {
1588  SolarMutexGuard aGuard;
1589 
1590  uno::Any aRet;
1591  SwSectionFormat *const pFormat = m_pImpl->GetSectionFormat();
1592  SfxItemPropertyMapEntry const*const pEntry =
1593  m_pImpl->m_rPropSet.getPropertyMap().getByName(rPropertyName);
1594  if (!pEntry)
1595  {
1596  throw beans::UnknownPropertyException(
1597  "Unknown property: " + rPropertyName,
1598  static_cast<cppu::OWeakObject *>(this));
1599  }
1600 
1601  switch(pEntry->nWID)
1602  {
1603  case WID_SECT_CONDITION:
1604  case WID_SECT_DDE_TYPE :
1605  case WID_SECT_DDE_FILE :
1606  case WID_SECT_DDE_ELEMENT :
1607  case WID_SECT_REGION :
1609  aRet <<= OUString();
1610  break;
1611  case WID_SECT_LINK :
1612  aRet <<= text::SectionFileLink();
1613  break;
1615  case WID_SECT_VISIBLE :
1616  aRet <<= true;
1617  break;
1618  case WID_SECT_PROTECTED:
1620  aRet <<= false;
1621  break;
1622  case FN_UNO_ANCHOR_TYPES:
1623  case FN_UNO_TEXT_WRAP:
1624  case FN_UNO_ANCHOR_TYPE:
1625  ::sw::GetDefaultTextContentValue(aRet, u"", pEntry->nWID);
1626  break;
1627  default:
1628  if(pFormat && SfxItemPool::IsWhich(pEntry->nWID))
1629  {
1630  SwDoc *const pDoc = pFormat->GetDoc();
1631  const SfxPoolItem& rDefItem =
1632  pDoc->GetAttrPool().GetDefaultItem(pEntry->nWID);
1633  rDefItem.QueryValue(aRet, pEntry->nMemberId);
1634  }
1635  }
1636  return aRet;
1637 }
1638 
1639 OUString SAL_CALL SwXTextSection::getName()
1640 {
1641  SolarMutexGuard aGuard;
1642 
1643  OUString sRet;
1644  SwSectionFormat const*const pFormat = m_pImpl->GetSectionFormat();
1645  if(pFormat)
1646  {
1647  sRet = pFormat->GetSection()->GetSectionName();
1648  }
1649  else if (m_pImpl->m_bIsDescriptor)
1650  {
1651  sRet = m_pImpl->m_sName;
1652  }
1653  else
1654  {
1655  throw uno::RuntimeException();
1656  }
1657  return sRet;
1658 }
1659 
1660 void SAL_CALL SwXTextSection::setName(const OUString& rName)
1661 {
1662  SolarMutexGuard aGuard;
1663 
1664  SwSectionFormat *const pFormat = m_pImpl->GetSectionFormat();
1665  if(pFormat)
1666  {
1667  SwSection *const pSect = pFormat->GetSection();
1668  SwSectionData aSection(*pSect);
1669  aSection.SetSectionName(rName);
1670 
1671  const SwSectionFormats& rFormats = pFormat->GetDoc()->GetSections();
1672  size_t nApplyPos = SIZE_MAX;
1673  for( size_t i = 0; i < rFormats.size(); ++i )
1674  {
1675  if(rFormats[i]->GetSection() == pSect)
1676  {
1677  nApplyPos = i;
1678  }
1679  else if (rName == rFormats[i]->GetSection()->GetSectionName())
1680  {
1681  throw uno::RuntimeException();
1682  }
1683  }
1684  if (nApplyPos != SIZE_MAX)
1685  {
1686  {
1687  UnoActionContext aContext(pFormat->GetDoc());
1688  pFormat->GetDoc()->UpdateSection(nApplyPos, aSection);
1689  }
1690  {
1691  // temporarily remove actions to allow cursor update
1692  // TODO: why? no table cursor here!
1693  UnoActionRemoveContext aRemoveContext( pFormat->GetDoc() );
1694  }
1695  }
1696  }
1697  else if (m_pImpl->m_bIsDescriptor)
1698  {
1699  m_pImpl->m_sName = rName;
1700  }
1701  else
1702  {
1703  throw uno::RuntimeException();
1704  }
1705 }
1706 
1707 OUString SAL_CALL
1709 {
1710  return "SwXTextSection";
1711 }
1712 
1713 sal_Bool SAL_CALL SwXTextSection::supportsService(const OUString& rServiceName)
1714 {
1715  return cppu::supportsService(this, rServiceName);
1716 }
1717 
1718 uno::Sequence< OUString > SAL_CALL
1720 {
1721  return {
1722  "com.sun.star.text.TextContent",
1723  "com.sun.star.text.TextSection",
1724  "com.sun.star.document.LinkTarget"
1725  };
1726 }
1727 
1728 // MetadatableMixin
1730 {
1731  SwSectionFormat *const pSectionFormat( m_pImpl->GetSectionFormat() );
1732  return pSectionFormat;
1733 }
1734 
1735 uno::Reference<frame::XModel> SwXTextSection::GetModel()
1736 {
1737  SwSectionFormat *const pSectionFormat( m_pImpl->GetSectionFormat() );
1738  if (pSectionFormat)
1739  {
1740  SwDocShell const*const pShell( pSectionFormat->GetDoc()->GetDocShell() );
1741  return pShell ? pShell->GetModel() : nullptr;
1742  }
1743  return nullptr;
1744 }
1745 
1746 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
SwSectionNode * FindSectionNode()
Search section node, in which it is.
Definition: ndsect.cxx:983
const SwEndNode * EndOfSectionNode() const
Definition: node.hxx:683
constexpr TypedWhichId< SvxFrameDirectionItem > RES_FRAMEDIR(120)
constexpr TypedWhichId< SwFormatEndAtTextEnd > RES_END_AT_TXTEND(118)
constexpr TypedWhichId< SvXMLAttrContainerItem > RES_UNKNOWNATR_CONTAINER(RES_UNKNOWNATR_BEGIN)
std::vector< SwSection * > SwSections
Definition: section.hxx:41
::comphelper::OInterfaceContainerHelper2 m_EventListeners
Definition: unosect.cxx:119
sal_Int32 nIndex
bool GoInContent(SwPaM &rPam, SwMoveFnCollection const &fnMove)
Definition: pam.cxx:970
::osl::Mutex m_Mutex
Definition: unosect.cxx:113
Marks a position in the document model.
Definition: pam.hxx:35
void setPropertyValue(const SfxItemPropertyMapEntry &rEntry, const css::uno::Any &aVal, SfxItemSet &rSet) const
bool IsSectionNode() const
Definition: node.hxx:645
virtual void SAL_CALL dispose() override
Definition: unosect.cxx:484
static constexpr auto Items
SwDocShell * GetDocShell()
Definition: doc.hxx:1352
virtual css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
Definition: unosect.cxx:437
constexpr TypedWhichId< SwFormatCol > RES_COL(109)
css::uno::Sequence< sal_Int8 > const & GetPassword() const
Definition: section.hxx:210
void DelSectionFormat(SwSectionFormat *pFormat, bool bDelNodes=false)
Definition: ndsect.cxx:517
virtual void SAL_CALL addVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unosect.cxx:1337
static SwTOXBase * GetCurTOX(const SwPosition &rPos)
Get current table of contents.
Definition: doctxm.cxx:447
SwNodeIndex nNode
Definition: pam.hxx:37
void CreateLink(LinkCreateType eType)
Definition: section.cxx:1432
const sal_Unicode cTokenSeparator
css::uno::Reference< css::frame::XModel3 > GetModel() const
If text in multi-column sections should be evenly distributed.
Definition: fmtclbl.hxx:28
Definition: doc.hxx:188
SwXTextSection(SwSectionFormat *const pFormat, const bool bIndexHeader)
Definition: unosect.cxx:220
bool IsConnected() const
Definition: section.hxx:224
SAL_DLLPRIVATE void SetXTextSection(css::uno::Reference< css::text::XTextSection > const &xTextSection)
Definition: section.hxx:322
void disposeAndClear(const css::lang::EventObject &rEvt)
#define WID_SECT_DDE_FILE
Definition: unomap.hxx:147
SwNode & GetNode() const
Definition: ndindex.hxx:119
virtual void SAL_CALL addPropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unosect.cxx:1321
SwSectionFormat * GetFormat()
Definition: section.hxx:336
virtual sal_Int64 SAL_CALL getSomething(const css::uno::Sequence< sal_Int8 > &rIdentifier) override
Definition: unosect.cxx:237
SwSection * GetParent() const
Definition: section.hxx:346
uno::Sequence< uno::Any > GetPropertyValues_Impl(const uno::Sequence< OUString > &rPropertyNames)
Definition: unosect.cxx:959
static const css::uno::Sequence< sal_Int8 > & getUnoTunnelId()
Definition: unosect.cxx:230
OUString const & GetLinkFileName() const
Definition: section.cxx:542
virtual ~SwXTextSection() override
Definition: unosect.cxx:226
bool IsCondHidden() const
Definition: section.hxx:192
SfxHintId GetId() const
SfxLinkUpdateMode GetUpdateType() const
Definition: section.hxx:220
OUString const & GetCondition() const
Definition: section.hxx:198
static css::uno::Reference< css::text::XTextSection > CreateXTextSection(SwSectionFormat *const pFormat, const bool bIndexHeader=false)
Definition: unosect.cxx:196
const SfxItemPropertyMapEntry * getByName(std::u16string_view rName) const
SwSectionFormat * GetSectionFormat() const
Definition: unosect.cxx:147
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
Definition: unosect.cxx:1719
Array of Undo-history.
Definition: docary.hxx:192
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unosect.cxx:495
virtual void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
Definition: unosect.cxx:947
SAL_DLLPRIVATE css::uno::WeakReference< css::text::XTextSection > const & GetXTextSection() const
Definition: section.hxx:320
virtual OUString SAL_CALL getName() override
Definition: unosect.cxx:1639
const SwDoc & GetDoc() const
Definition: unoobj2.cxx:767
#define WID_SECT_PASSWORD
Definition: unomap.hxx:156
virtual void SAL_CALL setPropertyToDefault(const OUString &rPropertyName) override
Definition: unosect.cxx:1444
Any SAL_CALL getCaughtException()
virtual bool QueryValue(css::uno::Any &rVal, sal_uInt8 nMemberId=0) const
#define FN_UNO_TEXT_WRAP
Definition: cmdid.h:565
SwSectionNode * GetSectionNode()
Definition: section.cxx:952
int nCount
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
virtual ::sfx2::Metadatable * GetCoreObject() override
Definition: unosect.cxx:1729
virtual void SAL_CALL removePropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
Definition: unosect.cxx:1329
virtual void SAL_CALL removeVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
Definition: unosect.cxx:1345
SAL_DLLPRIVATE void SetXObject(css::uno::Reference< css::uno::XInterface > const &xObject)
Definition: frmfmt.hxx:172
virtual bool PutValue(const css::uno::Any &rVal, sal_uInt8 nMemberId)
SwSectionFormat * m_pFormat
Definition: unosect.cxx:124
sal_Int32 getTokenCount(std::string_view rIn, char cTok)
#define WID_SECT_PROTECTED
Definition: unomap.hxx:151
virtual void SAL_CALL firePropertiesChangeEvent(const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
Definition: unosect.cxx:1313
const css::uno::Sequence< sal_Int8 > & getSeq() const
DocumentType eType
void EndListeningAll()
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:136
bool Move(SwMoveFnCollection const &fnMove=fnMoveForward, SwGoInDoc fnGo=GoInContent)
Movement of cursor.
Definition: pam.cxx:504
bool GetDefaultTextContentValue(css::uno::Any &rAny, std::u16string_view rPropertyName, sal_uInt16 nWID=0)
void Attach(SwSectionFormat *pFormat)
Definition: unosect.cxx:140
sal_uInt16 ClearItem(sal_uInt16 nWhich=0)
const SwSection * GetGlobalDocSection() const
Definition: section.cxx:961
int i
std::unique_ptr< SwTextSectionProperties_Impl > m_pProps
Definition: unosect.cxx:123
const OUString & GetSectionName() const
Definition: section.hxx:168
const SwPosition * GetPoint() const
Definition: pam.hxx:207
void SetCondHidden(bool const bFlag)
Definition: section.cxx:532
const bool m_bIndexHeader
Definition: unosect.cxx:120
bool IsProtect() const
Definition: section.cxx:343
SVL_DLLPUBLIC Link< OUString *, bool > const & GetMaybeFileHdl()
bool IsHidden() const
Definition: section.hxx:178
virtual css::uno::Sequence< css::uno::Reference< css::text::XTextSection > > SAL_CALL getChildSections() override
Definition: unosect.cxx:256
virtual void SAL_CALL setName(const OUString &rName) override
Definition: unosect.cxx:1660
#define WID_SECT_REGION
Definition: unomap.hxx:152
void SetPropertyValues_Impl(const uno::Sequence< OUString > &rPropertyNames, const uno::Sequence< uno::Any > &aValues)
Definition: unosect.cxx:567
const SfxItemPropertySet & m_rPropSet
Definition: unosect.cxx:118
#define WID_SECT_DDE_AUTOUPDATE
Definition: unomap.hxx:153
virtual void Notify(const SfxHint &rHint) override
Definition: unosect.cxx:175
#define WID_SECT_DDE_ELEMENT
Definition: unomap.hxx:148
virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString &rPropertyName) override
Definition: unosect.cxx:1586
float u
size_t size() const
Definition: docary.hxx:88
unsigned char sal_Bool
const SfxItemPropertyMap & getPropertyMap() const
virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
Definition: unosect.cxx:510
static css::uno::Reference< css::text::XDocumentIndex > CreateXDocumentIndex(SwDoc &rDoc, SwTOXBaseSection *pSection, TOXTypes eTypes=TOX_INDEX)
Definition: unoidx.cxx:401
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
Definition: unosect.cxx:1292
Marks a node in the document model.
Definition: ndindex.hxx:31
SwNodes & GetNodes()
Node is in which nodes-array/doc?
Definition: node.hxx:694
SectionType
Definition: section.hxx:45
virtual sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
Definition: unosect.cxx:1713
const SwDoc * GetDoc() const
The document is set in SwAttrPool now, therefore you always can access it.
Definition: format.hxx:123
bool StartListening(SvtBroadcaster &rBroadcaster)
bool IsEditInReadonly() const
Definition: section.cxx:353
#define WID_SECT_CONDITION
Definition: unomap.hxx:145
const SfxPoolItem & GetDefaultItem(sal_uInt16 nWhich) const
Impl(SwXTextSection &rThis, SwSectionFormat *const pFormat, const bool bIndexHeader)
Definition: unosect.cxx:126
SfxItemPool * GetPool() const
bool IsInReading() const
Definition: doc.hxx:954
void SetCondition(OUString const &rNew)
Definition: section.hxx:114
bool IsLinkType() const
Definition: section.hxx:235
virtual void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
Definition: unosect.cxx:275
const SwPosition * Start() const
Definition: pam.hxx:212
#define WID_SECT_CURRENTLY_VISIBLE
Definition: unomap.hxx:157
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange,::sw::TextRangeMode const eMode)
Definition: unoobj2.cxx:1107
SwSectionFormat * GetParent() const
Definition: section.hxx:355
const SwNodeIndex * GetContentIdx() const
Definition: fmtcntnt.hxx:46
::sw::UnoImplPtr< Impl > m_pImpl
Definition: unosection.hxx:56
SvtBroadcaster & GetNotifier()
Definition: calbck.hxx:102
#define PROPERTY_MAP_SECTION
Definition: unomap.hxx:33
const PropertyValue * pValues
const SfxPoolItem * Put(const SfxPoolItem &rItem, sal_uInt16 nWhich)
virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString &rPropertyName) override
Definition: unosect.cxx:1353
static css::uno::Sequence< css::beans::PropertyValue > CreateRedlineProperties(SwRangeRedline const &rRedline, bool const bIsStart)
Definition: unoredline.cxx:290
IDocumentRedlineAccess const & getIDocumentRedlineAccess() const
Definition: doc.cxx:335
constexpr TypedWhichId< SvxBrushItem > RES_BACKGROUND(105)
static void lcl_UpdateLinkType(SwSection &rSection, bool const bLinkUpdateAlways)
Definition: unosect.cxx:517
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
Definition: unosect.cxx:502
void UpdateSection(size_t const nSect, SwSectionData &, SfxItemSet const *const =nullptr, bool const bPreventLinkUpdate=false)
Definition: ndsect.cxx:609
SwXTextSection & m_rThis
Definition: unosect.cxx:116
void SetUpdateType(SfxLinkUpdateMode nType)
Definition: section.hxx:221
virtual css::uno::Reference< css::frame::XModel > GetModel() override
Definition: unosect.cxx:1735
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Sequence< css::uno::Any > &rValues) override
Definition: unosect.cxx:926
constexpr TypedWhichId< SwFormatNoBalancedColumns > RES_COLUMNBALANCE(119)
#define FN_PARAM_LINK_DISPLAY_NAME
Definition: cmdid.h:812
uno::WeakReference< uno::XInterface > m_wThis
Definition: unosect.cxx:117
SwMoveFnCollection const & fnMoveForward
SwPam::Move()/Find() default argument.
Definition: paminit.cxx:59
#define FN_UNO_ANCHOR_TYPE
Definition: cmdid.h:566
SwSectionFormat & GetSectionFormatOrThrow() const
Definition: unosect.cxx:150
#define WID_SECT_EDIT_IN_READONLY
Definition: unomap.hxx:158
SwSectionFormat * GetFormat() const
Definition: unosect.cxx:190
const INetURLObject & GetURLObject() const
SwUnoPropertyMapProvider aSwMapProvider
Definition: unomap1.cxx:87
Sequence< sal_Int8 > aSeq
constexpr TypedWhichId< SvxLRSpaceItem > RES_LR_SPACE(91)
virtual OUString SAL_CALL getImplementationName() override
Definition: unosect.cxx:1708
#define FN_UNO_ANCHOR_TYPES
Definition: cmdid.h:559
#define FN_UNO_REDLINE_NODE_START
Definition: cmdid.h:570
const SwFormatContent & GetContent(bool=true) const
Definition: fmtcntnt.hxx:55
SwMoveFnCollection const & fnMoveBackward
Definition: paminit.cxx:58
SwTableNode * FindTableNode()
Search table node, in which it is.
Definition: node.cxx:357
#define WID_SECT_VISIBLE
Definition: unomap.hxx:150
virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates(const css::uno::Sequence< OUString > &rPropertyNames) override
Definition: unosect.cxx:1362
bool IsDocNodes() const
Is the NodesArray the regular one of Doc? (and not the UndoNds, ...) Implementation in doc...
Definition: nodes.cxx:2329
Ends a section of nodes in the document model.
Definition: node.hxx:342
SectionType GetType() const
Definition: section.hxx:170
const SwAttrSet & GetAttrSet() const
For querying the attribute array.
Definition: format.hxx:120
static css::uno::Reference< css::text::XTextRange > CreateXTextRange(SwDoc &rDoc, const SwPosition &rPos, const SwPosition *const pMark)
Definition: unoobj2.cxx:1214
virtual const SwRedlineTable & GetRedlineTable() const =0
SwSection * GetSection() const
Definition: section.cxx:669
OUString setToken(const OUString &rIn, sal_Int32 nToken, sal_Unicode cTok, const OUString &rNewToken)
#define FN_UNO_REDLINE_NODE_END
Definition: cmdid.h:571
virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues(const css::uno::Sequence< OUString > &rPropertyNames) override
Definition: unosect.cxx:1264
#define WID_SECT_LINK
Definition: unomap.hxx:149
void GetChildSections(SwSections &rArr, SectionSort eSort=SectionSort::Not, bool bAllSections=true) const
Definition: section.cxx:879
SwSectionFormats & GetSections()
Definition: doc.hxx:1338
#define WID_SECT_DDE_TYPE
Definition: unomap.hxx:146
virtual void SAL_CALL addPropertiesChangeListener(const css::uno::Sequence< OUString > &rPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
Definition: unosect.cxx:1300
constexpr TypedWhichId< SwFormatFootnoteAtTextEnd > RES_FTN_AT_TXTEND(117)
#define WID_SECT_DOCUMENT_INDEX
Definition: unomap.hxx:154
uno::Reference< text::XText > CreateParentXText(SwDoc &rDoc, const SwPosition &rPos)
Definition: unoobj2.cxx:1235
static bool IsWhich(sal_uInt16 nId)
static void lcl_UpdateSection(SwSectionFormat *const pFormat, std::unique_ptr< SwSectionData > const &pSectionData, std::optional< SfxItemSet > const &oItemSet, bool const bLinkModeChanged, bool const bLinkUpdateAlways=true)
Definition: unosect.cxx:532
const SwAttrPool & GetAttrPool() const
Definition: doc.hxx:1319
#define WID_SECT_IS_GLOBAL_DOC_SECTION
Definition: unomap.hxx:155
virtual void SAL_CALL removePropertiesChangeListener(const css::uno::Reference< css::beans::XPropertiesChangeListener > &xListener) override
Definition: unosect.cxx:1307
SVL_DLLPUBLIC OUString SmartRel2Abs(INetURLObject const &rTheBaseURIRef, OUString const &rTheRelURIRef, Link< OUString *, bool > const &rMaybeFileHdl=Link< OUString *, bool >(), bool bCheckFileExists=true, bool bIgnoreFragment=false, INetURLObject::EncodeMechanism eEncodeMechanism=INetURLObject::EncodeMechanism::WasEncoded, INetURLObject::DecodeMechanism eDecodeMechanism=INetURLObject::DecodeMechanism::ToIUri, rtl_TextEncoding eCharset=RTL_TEXTENCODING_UTF8, FSysStyle eStyle=FSysStyle::Detect)
void SetSectionName(OUString const &rName)
Definition: section.hxx:93
Base class of the Writer document model elements.
Definition: node.hxx:80
virtual css::uno::Reference< css::text::XTextSection > SAL_CALL getParentSection() override
Definition: unosect.cxx:243
SfxMedium * GetMedium() const