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