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