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