LibreOffice Module sw (master) 1
unocontentcontrol.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 <unocontentcontrol.hxx>
21
22#include <mutex>
23
24#include <com/sun/star/text/XWordCursor.hpp>
25#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
26
30
32#include <ndtxt.hxx>
34#include <unotext.hxx>
35#include <unotextcursor.hxx>
36#include <unotextrange.hxx>
37#include <doc.hxx>
38#include <unoport.hxx>
39#include <unomap.hxx>
40#include <unoprnms.hxx>
41#include <utility>
42
43using namespace com::sun::star;
44
45namespace
46{
48class SwXContentControlText : public cppu::OWeakObject, public SwXText
49{
50private:
51 SwXContentControl& m_rContentControl;
52
53 void PrepareForAttach(uno::Reference<text::XTextRange>& xRange, const SwPaM& rPam) override;
54
55protected:
56 const SwStartNode* GetStartNode() const override;
57 uno::Reference<text::XTextCursor> CreateCursor() override;
58
59public:
60 SwXContentControlText(SwDoc& rDoc, SwXContentControl& rContentControl);
61
64
65 // XInterface
66 void SAL_CALL acquire() noexcept override { cppu::OWeakObject::acquire(); }
67 void SAL_CALL release() noexcept override { cppu::OWeakObject::release(); }
68
69 // XTypeProvider
70 uno::Sequence<sal_Int8> SAL_CALL getImplementationId() override;
71
72 // XText
73 uno::Reference<text::XTextCursor> SAL_CALL createTextCursor() override;
74 uno::Reference<text::XTextCursor> SAL_CALL
75 createTextCursorByRange(const uno::Reference<text::XTextRange>& xTextPosition) override;
76};
77}
78
79SwXContentControlText::SwXContentControlText(SwDoc& rDoc, SwXContentControl& rContentControl)
81 , m_rContentControl(rContentControl)
82{
83}
84
86{
87 auto pParent = dynamic_cast<SwXText*>(m_rContentControl.GetParentText().get());
88 return pParent ? pParent->GetStartNode() : nullptr;
89}
90
91void SwXContentControlText::PrepareForAttach(uno::Reference<text::XTextRange>& xRange,
92 const SwPaM& rPam)
93{
94 // Create a new cursor to prevent modifying SwXTextRange.
95 xRange = static_cast<text::XWordCursor*>(
96 new SwXTextCursor(*GetDoc(), &m_rContentControl, CursorType::ContentControl,
97 *rPam.GetPoint(), (rPam.HasMark()) ? rPam.GetMark() : nullptr));
98}
99
100uno::Reference<text::XTextCursor> SwXContentControlText::CreateCursor()
101{
102 uno::Reference<text::XTextCursor> xRet;
103 if (IsValid())
104 {
105 SwTextNode* pTextNode;
106 sal_Int32 nContentControlStart;
107 sal_Int32 nContentControlEnd;
108 bool bSuccess = m_rContentControl.SetContentRange(pTextNode, nContentControlStart,
109 nContentControlEnd);
110 if (bSuccess)
111 {
112 SwPosition aPos(*pTextNode, nContentControlStart);
113 xRet = static_cast<text::XWordCursor*>(
114 new SwXTextCursor(*GetDoc(), &m_rContentControl, CursorType::ContentControl, aPos));
115 }
116 }
117 return xRet;
118}
119
120uno::Sequence<sal_Int8> SAL_CALL SwXContentControlText::getImplementationId()
121{
122 return css::uno::Sequence<sal_Int8>();
123}
124
125// XText
126uno::Reference<text::XTextCursor> SAL_CALL SwXContentControlText::createTextCursor()
127{
128 return CreateCursor();
129}
130
131uno::Reference<text::XTextCursor> SAL_CALL SwXContentControlText::createTextCursorByRange(
132 const uno::Reference<text::XTextRange>& xTextPosition)
133{
134 const uno::Reference<text::XTextCursor> xCursor(CreateCursor());
135 xCursor->gotoRange(xTextPosition, false);
136 return xCursor;
137}
138
147{
148public:
150 // Just for OInterfaceContainerHelper4.
151 std::mutex m_Mutex;
153 std::unique_ptr<const TextRangeList_t> m_pTextPortions;
154 // 3 possible states: not attached, attached, disposed
157 uno::Reference<text::XText> m_xParentText;
165 std::vector<SwContentControlListItem> m_aListItems;
178 OUString m_aColor;
180 OUString m_aAlias;
181 OUString m_aTag;
182 sal_Int32 m_nId;
183 sal_uInt32 m_nTabIndex;
184 OUString m_aLock;
185
186 Impl(SwXContentControl& rThis, SwDoc& rDoc, SwContentControl* pContentControl,
187 uno::Reference<text::XText> xParentText, std::unique_ptr<const TextRangeList_t> pPortions)
188 : m_pTextPortions(std::move(pPortions))
189 , m_bIsDisposed(false)
190 , m_bIsDescriptor(pContentControl == nullptr)
191 , m_xParentText(std::move(xParentText))
192 , m_xText(new SwXContentControlText(rDoc, rThis))
193 , m_pContentControl(pContentControl)
194 , m_bShowingPlaceHolder(false)
195 , m_bCheckbox(false)
196 , m_bChecked(false)
197 , m_bPicture(false)
198 , m_bDate(false)
199 , m_bPlainText(false)
200 , m_bComboBox(false)
201 , m_bDropDown(false)
202 , m_nId(0)
203 , m_nTabIndex(0)
204 {
206 {
207 StartListening(m_pContentControl->GetNotifier());
208 }
209 }
210
211 const SwContentControl* GetContentControl() const;
212
213protected:
214 void Notify(const SfxHint& rHint) override;
215};
216
218{
219 return m_pContentControl;
220}
221
222// sw::BroadcastingModify
224{
225 // throw away cache (SwTextNode changed)
226 m_pTextPortions.reset();
227
228 if (rHint.GetId() != SfxHintId::Dying && rHint.GetId() != SfxHintId::Deinitializing)
229 return;
230
231 m_bIsDisposed = true;
232 m_pContentControl = nullptr;
233 m_xText->Invalidate();
234 uno::Reference<uno::XInterface> xThis(m_wThis);
235 if (!xThis.is())
236 {
237 // If UNO object is already dead, don't refer to it in an event.
238 return;
239 }
240 lang::EventObject aEvent(xThis);
241 std::unique_lock aGuard(m_Mutex);
242 m_EventListeners.disposeAndClear(aGuard, aEvent);
243}
244
245const uno::Reference<text::XText>& SwXContentControl::GetParentText() const
246{
247 return m_pImpl->m_xParentText;
248}
249
251 const uno::Reference<text::XText>& xParentText,
252 std::unique_ptr<const TextRangeList_t> pPortions)
253 : m_pImpl(new SwXContentControl::Impl(*this, *pDoc, pContentControl, xParentText,
254 std::move(pPortions)))
255{
256}
257
259 : m_pImpl(new SwXContentControl::Impl(*this, *pDoc, nullptr, nullptr, nullptr))
260{
261}
262
264
266{
267 rtl::Reference<SwXContentControl> xContentControl(new SwXContentControl(&rDoc));
268 xContentControl->m_pImpl->m_wThis = xContentControl.get();
269 return xContentControl;
270}
271
274 const uno::Reference<text::XText>& xParent,
275 std::unique_ptr<const TextRangeList_t>&& pPortions)
276{
277 // re-use existing SwXContentControl
278 rtl::Reference<SwXContentControl> xContentControl(rContentControl.GetXContentControl());
279 if (xContentControl.is())
280 {
281 if (pPortions)
282 {
283 // The content control must always be created with the complete content. If
284 // SwXTextPortionEnumeration is created for a selection, it must be checked that the
285 // content control is contained in the selection.
286 xContentControl->m_pImpl->m_pTextPortions = std::move(pPortions);
287 if (xContentControl->m_pImpl->m_xParentText.get() != xParent.get())
288 {
289 SAL_WARN("sw.uno", "SwXContentControl with different parent");
290 xContentControl->m_pImpl->m_xParentText.set(xParent);
291 }
292 }
293 return xContentControl;
294 }
295
296 // Create new SwXContentControl.
297 SwTextNode* pTextNode = rContentControl.GetTextNode();
298 if (!pTextNode)
299 {
300 SAL_WARN("sw.uno", "CreateXContentControl: no text node");
301 return nullptr;
302 }
303 uno::Reference<text::XText> xParentText(xParent);
304 if (!xParentText.is())
305 {
306 SwTextContentControl* pTextAttr = rContentControl.GetTextAttr();
307 if (!pTextAttr)
308 {
309 SAL_WARN("sw.uno", "CreateXContentControl: no text attr");
310 return nullptr;
311 }
312 SwPosition aPos(*pTextNode, pTextAttr->GetStart());
313 xParentText.set(sw::CreateParentXText(pTextNode->GetDoc(), aPos));
314 }
315 if (!xParentText.is())
316 {
317 return nullptr;
318 }
319 xContentControl = new SwXContentControl(&pTextNode->GetDoc(), &rContentControl, xParentText,
320 std::move(pPortions));
321 rContentControl.SetXContentControl(xContentControl);
322 xContentControl->m_pImpl->m_wThis = xContentControl.get();
323 return xContentControl;
324}
325
326bool SwXContentControl::SetContentRange(SwTextNode*& rpNode, sal_Int32& rStart,
327 sal_Int32& rEnd) const
328{
329 const SwContentControl* pContentControl = m_pImpl->GetContentControl();
330 if (pContentControl)
331 {
332 const SwTextContentControl* pTextAttr = pContentControl->GetTextAttr();
333 if (pTextAttr)
334 {
335 rpNode = pContentControl->GetTextNode();
336 if (rpNode)
337 {
338 // rStart points at the first position within the content control.
339 rStart = pTextAttr->GetStart() + 1;
340 // rEnd points at the last position within the content control.
341 rEnd = *pTextAttr->End() - 1;
342 return true;
343 }
344 }
345 }
346 return false;
347}
348
349// XServiceInfo
350OUString SAL_CALL SwXContentControl::getImplementationName() { return "SwXContentControl"; }
351
352sal_Bool SAL_CALL SwXContentControl::supportsService(const OUString& rServiceName)
353{
354 return cppu::supportsService(this, rServiceName);
355}
356
357uno::Sequence<OUString> SAL_CALL SwXContentControl::getSupportedServiceNames()
358{
359 return { "com.sun.star.text.TextContent", "com.sun.star.text.ContentControl" };
360}
361
362// XComponent
363void SAL_CALL
364SwXContentControl::addEventListener(const uno::Reference<lang::XEventListener>& xListener)
365{
366 std::unique_lock aGuard(m_pImpl->m_Mutex);
367 m_pImpl->m_EventListeners.addInterface(aGuard, xListener);
368}
369
370void SAL_CALL
371SwXContentControl::removeEventListener(const uno::Reference<lang::XEventListener>& xListener)
372{
373 std::unique_lock aGuard(m_pImpl->m_Mutex);
374 m_pImpl->m_EventListeners.removeInterface(aGuard, xListener);
375}
376
378{
380
381 if (m_pImpl->m_bIsDescriptor)
382 {
383 m_pImpl->m_pTextPortions.reset();
384 lang::EventObject aEvent(static_cast<::cppu::OWeakObject&>(*this));
385 std::unique_lock aGuard(m_pImpl->m_Mutex);
386 m_pImpl->m_EventListeners.disposeAndClear(aGuard, aEvent);
387 m_pImpl->m_bIsDisposed = true;
388 m_pImpl->m_xText->Invalidate();
389 }
390 else if (!m_pImpl->m_bIsDisposed)
391 {
392 SwTextNode* pTextNode;
393 sal_Int32 nContentControlStart;
394 sal_Int32 nContentControlEnd;
395 bool bSuccess = SetContentRange(pTextNode, nContentControlStart, nContentControlEnd);
396 if (!bSuccess)
397 {
398 SAL_WARN("sw.core", "SwXContentControl::dispose: no pam");
399 }
400 else
401 {
402 // -1 because of CH_TXTATR
403 SwPaM aPam(*pTextNode, nContentControlStart - 1, *pTextNode, nContentControlEnd);
404 SwDoc& rDoc(pTextNode->GetDoc());
406
407 // removal should call Modify and do the dispose
408 assert(m_pImpl->m_bIsDisposed);
409 }
410 }
411}
412
413void SwXContentControl::AttachImpl(const uno::Reference<text::XTextRange>& xTextRange,
414 sal_uInt16 nWhich)
415{
416 SolarMutexGuard aGuard;
417
418 if (m_pImpl->m_bIsDisposed)
419 {
420 throw lang::DisposedException();
421 }
422 if (!m_pImpl->m_bIsDescriptor)
423 {
424 throw uno::RuntimeException("SwXContentControl::AttachImpl(): already attached",
425 static_cast<::cppu::OWeakObject*>(this));
426 }
427
428 SwXTextRange* pRange = dynamic_cast<SwXTextRange*>(xTextRange.get());
429 OTextCursorHelper* pCursor
430 = pRange ? nullptr : dynamic_cast<OTextCursorHelper*>(xTextRange.get());
431 if (!pRange && !pCursor)
432 {
433 throw lang::IllegalArgumentException(
434 "SwXContentControl::AttachImpl(): argument not supported type",
435 static_cast<::cppu::OWeakObject*>(this), 0);
436 }
437
438 SwDoc* pDoc = pRange ? &pRange->GetDoc() : pCursor->GetDoc();
439 if (!pDoc)
440 {
441 throw lang::IllegalArgumentException(
442 "SwXContentControl::AttachImpl(): argument has no SwDoc",
443 static_cast<::cppu::OWeakObject*>(this), 0);
444 }
445
446 SwUnoInternalPaM aPam(*pDoc);
447 ::sw::XTextRangeToSwPaM(aPam, xTextRange);
448
449 UnoActionContext aContext(pDoc);
450
451 auto pTextCursor = dynamic_cast<SwXTextCursor*>(pCursor);
452 bool bForceExpandHints = pTextCursor && pTextCursor->IsAtEndOfContentControl();
453 SetAttrMode nInsertFlags = bForceExpandHints
456
457 auto pContentControl = std::make_shared<SwContentControl>(nullptr);
458
459 pContentControl->SetShowingPlaceHolder(m_pImpl->m_bShowingPlaceHolder);
460 pContentControl->SetCheckbox(m_pImpl->m_bCheckbox);
461 pContentControl->SetChecked(m_pImpl->m_bChecked);
462 pContentControl->SetCheckedState(m_pImpl->m_aCheckedState);
463 pContentControl->SetUncheckedState(m_pImpl->m_aUncheckedState);
464 pContentControl->SetListItems(m_pImpl->m_aListItems);
465 pContentControl->SetPicture(m_pImpl->m_bPicture);
466 pContentControl->SetDate(m_pImpl->m_bDate);
467 pContentControl->SetDateFormat(m_pImpl->m_aDateFormat);
468 pContentControl->SetDateLanguage(m_pImpl->m_aDateLanguage);
469 pContentControl->SetCurrentDate(m_pImpl->m_aCurrentDate);
470 pContentControl->SetPlainText(m_pImpl->m_bPlainText);
471 pContentControl->SetComboBox(m_pImpl->m_bComboBox);
472 pContentControl->SetDropDown(m_pImpl->m_bDropDown);
473 pContentControl->SetPlaceholderDocPart(m_pImpl->m_aPlaceholderDocPart);
474 pContentControl->SetDataBindingPrefixMappings(m_pImpl->m_aDataBindingPrefixMappings);
475 pContentControl->SetDataBindingXpath(m_pImpl->m_aDataBindingXpath);
476 pContentControl->SetDataBindingStoreItemID(m_pImpl->m_aDataBindingStoreItemID);
477 pContentControl->SetColor(m_pImpl->m_aColor);
478 pContentControl->SetAppearance(m_pImpl->m_aAppearance);
479 pContentControl->SetAlias(m_pImpl->m_aAlias);
480 pContentControl->SetTag(m_pImpl->m_aTag);
481 pContentControl->SetId(m_pImpl->m_nId);
482 pContentControl->SetTabIndex(m_pImpl->m_nTabIndex);
483 pContentControl->SetLock(m_pImpl->m_aLock);
484
485 SwFormatContentControl aContentControl(pContentControl, nWhich);
486 bool bSuccess
487 = pDoc->getIDocumentContentOperations().InsertPoolItem(aPam, aContentControl, nInsertFlags);
488 SwTextAttr* pTextAttr = pContentControl->GetTextAttr();
489 if (!bSuccess)
490 {
491 throw lang::IllegalArgumentException(
492 "SwXContentControl::AttachImpl(): cannot create content control: invalid range",
493 static_cast<::cppu::OWeakObject*>(this), 1);
494 }
495 if (!pTextAttr)
496 {
497 SAL_WARN("sw.core", "content control inserted, but has no text attribute?");
498 throw uno::RuntimeException(
499 "SwXContentControl::AttachImpl(): cannot create content control",
500 static_cast<::cppu::OWeakObject*>(this));
501 }
502
503 m_pImpl->EndListeningAll();
504 m_pImpl->m_pContentControl = pContentControl.get();
505 m_pImpl->StartListening(pContentControl->GetNotifier());
506 pContentControl->SetXContentControl(this);
507
508 m_pImpl->m_xParentText = sw::CreateParentXText(*pDoc, *aPam.GetPoint());
509
510 m_pImpl->m_bIsDescriptor = false;
511}
512
513// XTextContent
514void SAL_CALL SwXContentControl::attach(const uno::Reference<text::XTextRange>& xTextRange)
515{
517}
518
519uno::Reference<text::XTextRange> SAL_CALL SwXContentControl::getAnchor()
520{
522
523 if (m_pImpl->m_bIsDisposed)
524 {
525 throw lang::DisposedException();
526 }
527 if (m_pImpl->m_bIsDescriptor)
528 {
529 throw uno::RuntimeException("SwXContentControl::getAnchor(): not inserted",
530 static_cast<::cppu::OWeakObject*>(this));
531 }
532
533 SwTextNode* pTextNode;
534 sal_Int32 nContentControlStart;
535 sal_Int32 nContentControlEnd;
536 bool bSuccess = SetContentRange(pTextNode, nContentControlStart, nContentControlEnd);
537 if (!bSuccess)
538 {
539 SAL_WARN("sw.core", "no pam");
540 throw lang::DisposedException("SwXContentControl::getAnchor(): not attached",
541 static_cast<::cppu::OWeakObject*>(this));
542 }
543
544 SwPosition aStart(*pTextNode, nContentControlStart - 1); // -1 due to CH_TXTATR
545 SwPosition aEnd(*pTextNode, nContentControlEnd);
546 return SwXTextRange::CreateXTextRange(pTextNode->GetDoc(), aStart, &aEnd);
547}
548
549// XTextRange
550uno::Reference<text::XText> SAL_CALL SwXContentControl::getText() { return this; }
551
552uno::Reference<text::XTextRange> SAL_CALL SwXContentControl::getStart()
553{
555 return m_pImpl->m_xText->getStart();
556}
557
558uno::Reference<text::XTextRange> SAL_CALL SwXContentControl::getEnd()
559{
561 return m_pImpl->m_xText->getEnd();
562}
563
565{
567 return m_pImpl->m_xText->getString();
568}
569
570void SAL_CALL SwXContentControl::setString(const OUString& rString)
571{
573 return m_pImpl->m_xText->setString(rString);
574}
575
576// XSimpleText
577uno::Reference<text::XTextCursor> SAL_CALL SwXContentControl::createTextCursor()
578{
580 return m_pImpl->m_xText->createTextCursor();
581}
582
583uno::Reference<text::XTextCursor> SAL_CALL
584SwXContentControl::createTextCursorByRange(const uno::Reference<text::XTextRange>& xTextPosition)
585{
587 return m_pImpl->m_xText->createTextCursorByRange(xTextPosition);
588}
589
590void SAL_CALL SwXContentControl::insertString(const uno::Reference<text::XTextRange>& xRange,
591 const OUString& rString, sal_Bool bAbsorb)
592{
594 return m_pImpl->m_xText->insertString(xRange, rString, bAbsorb);
595}
596
598 const uno::Reference<text::XTextRange>& xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb)
599{
601 return m_pImpl->m_xText->insertControlCharacter(xRange, nControlCharacter, bAbsorb);
602}
603
604// XText
606 const uno::Reference<text::XTextRange>& xRange,
607 const uno::Reference<text::XTextContent>& xContent, sal_Bool bAbsorb)
608{
610 return m_pImpl->m_xText->insertTextContent(xRange, xContent, bAbsorb);
611}
612
613void SAL_CALL
614SwXContentControl::removeTextContent(const uno::Reference<text::XTextContent>& xContent)
615{
617 return m_pImpl->m_xText->removeTextContent(xContent);
618}
619
620// XPropertySet
621uno::Reference<beans::XPropertySetInfo> SAL_CALL SwXContentControl::getPropertySetInfo()
622{
623 SolarMutexGuard aGuard;
624
625 static uno::Reference<beans::XPropertySetInfo> xRet
627 return xRet;
628}
629
630void SAL_CALL SwXContentControl::setPropertyValue(const OUString& rPropertyName,
631 const css::uno::Any& rValue)
632{
633 SolarMutexGuard aGuard;
634
635 if (rPropertyName == UNO_NAME_SHOWING_PLACE_HOLDER)
636 {
637 bool bValue;
638 if (rValue >>= bValue)
639 {
640 if (m_pImpl->m_bIsDescriptor)
641 {
642 m_pImpl->m_bShowingPlaceHolder = bValue;
643 }
644 else
645 {
646 m_pImpl->m_pContentControl->SetShowingPlaceHolder(bValue);
647 }
648 }
649 }
650 else if (rPropertyName == UNO_NAME_CHECKBOX)
651 {
652 bool bValue;
653 if (rValue >>= bValue)
654 {
655 if (m_pImpl->m_bIsDescriptor)
656 {
657 m_pImpl->m_bCheckbox = bValue;
658 }
659 else
660 {
661 m_pImpl->m_pContentControl->SetCheckbox(bValue);
662 }
663 }
664 }
665 else if (rPropertyName == UNO_NAME_CHECKED)
666 {
667 bool bValue;
668 if (rValue >>= bValue)
669 {
670 if (m_pImpl->m_bIsDescriptor)
671 {
672 m_pImpl->m_bChecked = bValue;
673 }
674 else
675 {
676 m_pImpl->m_pContentControl->SetChecked(bValue);
677 }
678 }
679 }
680 else if (rPropertyName == UNO_NAME_CHECKED_STATE)
681 {
682 OUString aValue;
683 if (rValue >>= aValue)
684 {
685 if (m_pImpl->m_bIsDescriptor)
686 {
687 m_pImpl->m_aCheckedState = aValue;
688 }
689 else
690 {
691 m_pImpl->m_pContentControl->SetCheckedState(aValue);
692 }
693 }
694 }
695 else if (rPropertyName == UNO_NAME_UNCHECKED_STATE)
696 {
697 OUString aValue;
698 if (rValue >>= aValue)
699 {
700 if (m_pImpl->m_bIsDescriptor)
701 {
702 m_pImpl->m_aUncheckedState = aValue;
703 }
704 else
705 {
706 m_pImpl->m_pContentControl->SetUncheckedState(aValue);
707 }
708 }
709 }
710 else if (rPropertyName == UNO_NAME_LIST_ITEMS)
711 {
712 std::vector<SwContentControlListItem> aItems
714 if (m_pImpl->m_bIsDescriptor)
715 {
716 m_pImpl->m_aListItems = aItems;
717
718 if (!m_pImpl->m_bComboBox && !m_pImpl->m_bDropDown)
719 {
720 m_pImpl->m_bDropDown = true;
721 }
722 }
723 else
724 {
725 m_pImpl->m_pContentControl->SetListItems(aItems);
726
727 if (!m_pImpl->m_pContentControl->GetComboBox()
728 && !m_pImpl->m_pContentControl->GetDropDown())
729 {
730 m_pImpl->m_pContentControl->SetDropDown(true);
731 }
732 }
733 }
734 else if (rPropertyName == UNO_NAME_PICTURE)
735 {
736 bool bValue;
737 if (rValue >>= bValue)
738 {
739 if (m_pImpl->m_bIsDescriptor)
740 {
741 m_pImpl->m_bPicture = bValue;
742 }
743 else
744 {
745 m_pImpl->m_pContentControl->SetPicture(bValue);
746 }
747 }
748 }
749 else if (rPropertyName == UNO_NAME_DATE)
750 {
751 bool bValue;
752 if (rValue >>= bValue)
753 {
754 if (m_pImpl->m_bIsDescriptor)
755 {
756 m_pImpl->m_bDate = bValue;
757 }
758 else
759 {
760 m_pImpl->m_pContentControl->SetDate(bValue);
761 }
762 }
763 }
764 else if (rPropertyName == UNO_NAME_DATE_FORMAT)
765 {
766 OUString aValue;
767 if (rValue >>= aValue)
768 {
769 if (m_pImpl->m_bIsDescriptor)
770 {
771 m_pImpl->m_aDateFormat = aValue;
772 }
773 else
774 {
775 m_pImpl->m_pContentControl->SetDateFormat(aValue);
776 }
777 }
778 }
779 else if (rPropertyName == UNO_NAME_DATE_LANGUAGE)
780 {
781 OUString aValue;
782 if (rValue >>= aValue)
783 {
784 if (m_pImpl->m_bIsDescriptor)
785 {
786 m_pImpl->m_aDateLanguage = aValue;
787 }
788 else
789 {
790 m_pImpl->m_pContentControl->SetDateLanguage(aValue);
791 }
792 }
793 }
794 else if (rPropertyName == UNO_NAME_CURRENT_DATE)
795 {
796 OUString aValue;
797 if (rValue >>= aValue)
798 {
799 if (m_pImpl->m_bIsDescriptor)
800 {
801 m_pImpl->m_aCurrentDate = aValue;
802 }
803 else
804 {
805 m_pImpl->m_pContentControl->SetCurrentDate(aValue);
806 }
807 }
808 }
809 else if (rPropertyName == UNO_NAME_PLAIN_TEXT)
810 {
811 bool bValue;
812 if (rValue >>= bValue)
813 {
814 if (m_pImpl->m_bIsDescriptor)
815 {
816 m_pImpl->m_bPlainText = bValue;
817 }
818 else
819 {
820 m_pImpl->m_pContentControl->SetPlainText(bValue);
821 }
822 }
823 }
824 else if (rPropertyName == UNO_NAME_COMBO_BOX)
825 {
826 bool bValue;
827 if (rValue >>= bValue)
828 {
829 if (m_pImpl->m_bIsDescriptor)
830 {
831 m_pImpl->m_bComboBox = bValue;
832 }
833 else
834 {
835 m_pImpl->m_pContentControl->SetComboBox(bValue);
836 }
837 }
838 }
839 else if (rPropertyName == UNO_NAME_DROP_DOWN)
840 {
841 bool bValue;
842 if (rValue >>= bValue)
843 {
844 if (m_pImpl->m_bIsDescriptor)
845 {
846 m_pImpl->m_bDropDown = bValue;
847 }
848 else
849 {
850 m_pImpl->m_pContentControl->SetDropDown(bValue);
851 }
852 }
853 }
854 else if (rPropertyName == UNO_NAME_PLACEHOLDER_DOC_PART)
855 {
856 OUString aValue;
857 if (rValue >>= aValue)
858 {
859 if (m_pImpl->m_bIsDescriptor)
860 {
861 m_pImpl->m_aPlaceholderDocPart = aValue;
862 }
863 else
864 {
865 m_pImpl->m_pContentControl->SetPlaceholderDocPart(aValue);
866 }
867 }
868 }
869 else if (rPropertyName == UNO_NAME_DATA_BINDING_PREFIX_MAPPINGS)
870 {
871 OUString aValue;
872 if (rValue >>= aValue)
873 {
874 if (m_pImpl->m_bIsDescriptor)
875 {
876 m_pImpl->m_aDataBindingPrefixMappings = aValue;
877 }
878 else
879 {
880 m_pImpl->m_pContentControl->SetDataBindingPrefixMappings(aValue);
881 }
882 }
883 }
884 else if (rPropertyName == UNO_NAME_DATA_BINDING_XPATH)
885 {
886 OUString aValue;
887 if (rValue >>= aValue)
888 {
889 if (m_pImpl->m_bIsDescriptor)
890 {
891 m_pImpl->m_aDataBindingXpath = aValue;
892 }
893 else
894 {
895 m_pImpl->m_pContentControl->SetDataBindingXpath(aValue);
896 }
897 }
898 }
899 else if (rPropertyName == UNO_NAME_DATA_BINDING_STORE_ITEM_ID)
900 {
901 OUString aValue;
902 if (rValue >>= aValue)
903 {
904 if (m_pImpl->m_bIsDescriptor)
905 {
906 m_pImpl->m_aDataBindingStoreItemID = aValue;
907 }
908 else
909 {
910 m_pImpl->m_pContentControl->SetDataBindingStoreItemID(aValue);
911 }
912 }
913 }
914 else if (rPropertyName == UNO_NAME_COLOR)
915 {
916 OUString aValue;
917 if (rValue >>= aValue)
918 {
919 if (m_pImpl->m_bIsDescriptor)
920 {
921 m_pImpl->m_aColor = aValue;
922 }
923 else
924 {
925 m_pImpl->m_pContentControl->SetColor(aValue);
926 }
927 }
928 }
929 else if (rPropertyName == UNO_NAME_APPEARANCE)
930 {
931 OUString aValue;
932 if (rValue >>= aValue)
933 {
934 if (m_pImpl->m_bIsDescriptor)
935 {
936 m_pImpl->m_aAppearance = aValue;
937 }
938 else
939 {
940 m_pImpl->m_pContentControl->SetAppearance(aValue);
941 }
942 }
943 }
944 else if (rPropertyName == UNO_NAME_ALIAS)
945 {
946 OUString aValue;
947 if (rValue >>= aValue)
948 {
949 if (m_pImpl->m_bIsDescriptor)
950 {
951 m_pImpl->m_aAlias = aValue;
952 }
953 else
954 {
955 m_pImpl->m_pContentControl->SetAlias(aValue);
956 }
957 }
958 }
959 else if (rPropertyName == UNO_NAME_TAG)
960 {
961 OUString aValue;
962 if (rValue >>= aValue)
963 {
964 if (m_pImpl->m_bIsDescriptor)
965 {
966 m_pImpl->m_aTag = aValue;
967 }
968 else
969 {
970 m_pImpl->m_pContentControl->SetTag(aValue);
971 }
972 }
973 }
974 else if (rPropertyName == UNO_NAME_ID)
975 {
976 sal_Int32 nValue = 0;
977 if (rValue >>= nValue)
978 {
979 if (m_pImpl->m_bIsDescriptor)
980 {
981 m_pImpl->m_nId = nValue;
982 }
983 else
984 {
985 m_pImpl->m_pContentControl->SetId(nValue);
986 }
987 }
988 }
989 else if (rPropertyName == UNO_NAME_TAB_INDEX)
990 {
991 sal_uInt32 nValue = 0;
992 if (rValue >>= nValue)
993 {
994 if (m_pImpl->m_bIsDescriptor)
995 {
996 m_pImpl->m_nTabIndex = nValue;
997 }
998 else
999 {
1000 m_pImpl->m_pContentControl->SetTabIndex(nValue);
1001 }
1002 }
1003 }
1004 else if (rPropertyName == UNO_NAME_LOCK)
1005 {
1006 OUString aValue;
1007 if (rValue >>= aValue)
1008 {
1009 if (m_pImpl->m_bIsDescriptor)
1010 {
1011 m_pImpl->m_aLock = aValue;
1012 }
1013 else
1014 {
1015 m_pImpl->m_pContentControl->SetLock(aValue);
1016 }
1017 }
1018 }
1019 else
1020 {
1021 throw beans::UnknownPropertyException();
1022 }
1023}
1024
1025uno::Any SAL_CALL SwXContentControl::getPropertyValue(const OUString& rPropertyName)
1026{
1027 SolarMutexGuard aGuard;
1028
1029 uno::Any aRet;
1030 if (rPropertyName == UNO_NAME_SHOWING_PLACE_HOLDER)
1031 {
1032 if (m_pImpl->m_bIsDescriptor)
1033 {
1034 aRet <<= m_pImpl->m_bShowingPlaceHolder;
1035 }
1036 else
1037 {
1038 aRet <<= m_pImpl->m_pContentControl->GetShowingPlaceHolder();
1039 }
1040 }
1041 else if (rPropertyName == UNO_NAME_CHECKBOX)
1042 {
1043 if (m_pImpl->m_bIsDescriptor)
1044 {
1045 aRet <<= m_pImpl->m_bCheckbox;
1046 }
1047 else
1048 {
1049 aRet <<= m_pImpl->m_pContentControl->GetCheckbox();
1050 }
1051 }
1052 else if (rPropertyName == UNO_NAME_CHECKED)
1053 {
1054 if (m_pImpl->m_bIsDescriptor)
1055 {
1056 aRet <<= m_pImpl->m_bChecked;
1057 }
1058 else
1059 {
1060 aRet <<= m_pImpl->m_pContentControl->GetChecked();
1061 }
1062 }
1063 else if (rPropertyName == UNO_NAME_CHECKED_STATE)
1064 {
1065 if (m_pImpl->m_bIsDescriptor)
1066 {
1067 aRet <<= m_pImpl->m_aCheckedState;
1068 }
1069 else
1070 {
1071 aRet <<= m_pImpl->m_pContentControl->GetCheckedState();
1072 }
1073 }
1074 else if (rPropertyName == UNO_NAME_UNCHECKED_STATE)
1075 {
1076 if (m_pImpl->m_bIsDescriptor)
1077 {
1078 aRet <<= m_pImpl->m_aUncheckedState;
1079 }
1080 else
1081 {
1082 aRet <<= m_pImpl->m_pContentControl->GetUncheckedState();
1083 }
1084 }
1085 else if (rPropertyName == UNO_NAME_LIST_ITEMS)
1086 {
1087 std::vector<SwContentControlListItem> aItems;
1088 if (m_pImpl->m_bIsDescriptor)
1089 {
1090 aItems = m_pImpl->m_aListItems;
1091 }
1092 else
1093 {
1094 aItems = m_pImpl->m_pContentControl->GetListItems();
1095 }
1097 }
1098 else if (rPropertyName == UNO_NAME_PICTURE)
1099 {
1100 if (m_pImpl->m_bIsDescriptor)
1101 {
1102 aRet <<= m_pImpl->m_bPicture;
1103 }
1104 else
1105 {
1106 aRet <<= m_pImpl->m_pContentControl->GetPicture();
1107 }
1108 }
1109 else if (rPropertyName == UNO_NAME_DATE)
1110 {
1111 if (m_pImpl->m_bIsDescriptor)
1112 {
1113 aRet <<= m_pImpl->m_bDate;
1114 }
1115 else
1116 {
1117 aRet <<= m_pImpl->m_pContentControl->GetDate();
1118 }
1119 }
1120 else if (rPropertyName == UNO_NAME_DATE_FORMAT)
1121 {
1122 if (m_pImpl->m_bIsDescriptor)
1123 {
1124 aRet <<= m_pImpl->m_aDateFormat;
1125 }
1126 else
1127 {
1128 aRet <<= m_pImpl->m_pContentControl->GetDateFormat();
1129 }
1130 }
1131 else if (rPropertyName == UNO_NAME_DATE_LANGUAGE)
1132 {
1133 if (m_pImpl->m_bIsDescriptor)
1134 {
1135 aRet <<= m_pImpl->m_aDateLanguage;
1136 }
1137 else
1138 {
1139 aRet <<= m_pImpl->m_pContentControl->GetDateLanguage();
1140 }
1141 }
1142 else if (rPropertyName == UNO_NAME_CURRENT_DATE)
1143 {
1144 if (m_pImpl->m_bIsDescriptor)
1145 {
1146 aRet <<= m_pImpl->m_aCurrentDate;
1147 }
1148 else
1149 {
1150 aRet <<= m_pImpl->m_pContentControl->GetCurrentDate();
1151 }
1152 }
1153 else if (rPropertyName == UNO_NAME_PLAIN_TEXT)
1154 {
1155 if (m_pImpl->m_bIsDescriptor)
1156 {
1157 aRet <<= m_pImpl->m_bPlainText;
1158 }
1159 else
1160 {
1161 aRet <<= m_pImpl->m_pContentControl->GetPlainText();
1162 }
1163 }
1164 else if (rPropertyName == UNO_NAME_COMBO_BOX)
1165 {
1166 if (m_pImpl->m_bIsDescriptor)
1167 {
1168 aRet <<= m_pImpl->m_bComboBox;
1169 }
1170 else
1171 {
1172 aRet <<= m_pImpl->m_pContentControl->GetComboBox();
1173 }
1174 }
1175 else if (rPropertyName == UNO_NAME_DROP_DOWN)
1176 {
1177 if (m_pImpl->m_bIsDescriptor)
1178 {
1179 aRet <<= m_pImpl->m_bDropDown;
1180 }
1181 else
1182 {
1183 aRet <<= m_pImpl->m_pContentControl->GetDropDown();
1184 }
1185 }
1186 else if (rPropertyName == UNO_NAME_PLACEHOLDER_DOC_PART)
1187 {
1188 if (m_pImpl->m_bIsDescriptor)
1189 {
1190 aRet <<= m_pImpl->m_aPlaceholderDocPart;
1191 }
1192 else
1193 {
1194 aRet <<= m_pImpl->m_pContentControl->GetCurrentDate();
1195 }
1196 }
1197 else if (rPropertyName == UNO_NAME_DATA_BINDING_PREFIX_MAPPINGS)
1198 {
1199 if (m_pImpl->m_bIsDescriptor)
1200 {
1201 aRet <<= m_pImpl->m_aDataBindingPrefixMappings;
1202 }
1203 else
1204 {
1205 aRet <<= m_pImpl->m_pContentControl->GetDataBindingPrefixMappings();
1206 }
1207 }
1208 else if (rPropertyName == UNO_NAME_DATA_BINDING_XPATH)
1209 {
1210 if (m_pImpl->m_bIsDescriptor)
1211 {
1212 aRet <<= m_pImpl->m_aDataBindingXpath;
1213 }
1214 else
1215 {
1216 aRet <<= m_pImpl->m_pContentControl->GetDataBindingXpath();
1217 }
1218 }
1219 else if (rPropertyName == UNO_NAME_DATA_BINDING_STORE_ITEM_ID)
1220 {
1221 if (m_pImpl->m_bIsDescriptor)
1222 {
1223 aRet <<= m_pImpl->m_aDataBindingStoreItemID;
1224 }
1225 else
1226 {
1227 aRet <<= m_pImpl->m_pContentControl->GetDataBindingStoreItemID();
1228 }
1229 }
1230 else if (rPropertyName == UNO_NAME_COLOR)
1231 {
1232 if (m_pImpl->m_bIsDescriptor)
1233 {
1234 aRet <<= m_pImpl->m_aColor;
1235 }
1236 else
1237 {
1238 aRet <<= m_pImpl->m_pContentControl->GetColor();
1239 }
1240 }
1241 else if (rPropertyName == UNO_NAME_APPEARANCE)
1242 {
1243 if (m_pImpl->m_bIsDescriptor)
1244 {
1245 aRet <<= m_pImpl->m_aAppearance;
1246 }
1247 else
1248 {
1249 aRet <<= m_pImpl->m_pContentControl->GetAppearance();
1250 }
1251 }
1252 else if (rPropertyName == UNO_NAME_ALIAS)
1253 {
1254 if (m_pImpl->m_bIsDescriptor)
1255 {
1256 aRet <<= m_pImpl->m_aAlias;
1257 }
1258 else
1259 {
1260 aRet <<= m_pImpl->m_pContentControl->GetAlias();
1261 }
1262 }
1263 else if (rPropertyName == UNO_NAME_TAG)
1264 {
1265 if (m_pImpl->m_bIsDescriptor)
1266 {
1267 aRet <<= m_pImpl->m_aTag;
1268 }
1269 else
1270 {
1271 aRet <<= m_pImpl->m_pContentControl->GetTag();
1272 }
1273 }
1274 else if (rPropertyName == UNO_NAME_DATE_STRING)
1275 {
1276 if (!m_pImpl->m_bIsDescriptor)
1277 {
1278 aRet <<= m_pImpl->m_pContentControl->GetDateString();
1279 }
1280 }
1281 else if (rPropertyName == UNO_NAME_ID)
1282 {
1283 if (m_pImpl->m_bIsDescriptor)
1284 {
1285 aRet <<= m_pImpl->m_nId;
1286 }
1287 else
1288 {
1289 aRet <<= m_pImpl->m_pContentControl->GetId();
1290 }
1291 }
1292 else if (rPropertyName == UNO_NAME_TAB_INDEX)
1293 {
1294 if (m_pImpl->m_bIsDescriptor)
1295 {
1296 aRet <<= m_pImpl->m_nTabIndex;
1297 }
1298 else
1299 {
1300 aRet <<= m_pImpl->m_pContentControl->GetTabIndex();
1301 }
1302 }
1303 else if (rPropertyName == UNO_NAME_LOCK)
1304 {
1305 if (m_pImpl->m_bIsDescriptor)
1306 {
1307 aRet <<= m_pImpl->m_aLock;
1308 }
1309 else
1310 {
1311 aRet <<= m_pImpl->m_pContentControl->GetLock();
1312 }
1313 }
1314 else
1315 {
1316 throw beans::UnknownPropertyException();
1317 }
1318
1319 return aRet;
1320}
1321
1323 const OUString& /*rPropertyName*/,
1324 const uno::Reference<beans::XPropertyChangeListener>& /*xListener*/)
1325{
1326 SAL_WARN("sw.uno", "SwXContentControl::addPropertyChangeListener: not implemented");
1327}
1328
1330 const OUString& /*rPropertyName*/,
1331 const uno::Reference<beans::XPropertyChangeListener>& /*xListener*/)
1332{
1333 SAL_WARN("sw.uno", "SwXContentControl::removePropertyChangeListener: not implemented");
1334}
1335
1337 const OUString& /*rPropertyName*/,
1338 const uno::Reference<beans::XVetoableChangeListener>& /*xListener*/)
1339{
1340 SAL_WARN("sw.uno", "SwXContentControl::addVetoableChangeListener: not implemented");
1341}
1342
1344 const OUString& /*rPropertyName*/,
1345 const uno::Reference<beans::XVetoableChangeListener>& /*xListener*/)
1346{
1347 SAL_WARN("sw.uno", "SwXContentControl::removeVetoableChangeListener: not implemented");
1348}
1349
1350// XElementAccess
1352{
1354}
1355
1357{
1359 return m_pImpl->m_pContentControl != nullptr;
1360}
1361
1362// XEnumerationAccess
1363uno::Reference<container::XEnumeration> SAL_CALL SwXContentControl::createEnumeration()
1364{
1366
1367 if (m_pImpl->m_bIsDisposed)
1368 {
1369 throw lang::DisposedException();
1370 }
1371 if (m_pImpl->m_bIsDescriptor)
1372 {
1373 throw uno::RuntimeException("createEnumeration(): not inserted",
1374 static_cast<::cppu::OWeakObject*>(this));
1375 }
1376
1377 SwTextNode* pTextNode;
1378 sal_Int32 nContentControlStart;
1379 sal_Int32 nContentControlEnd;
1380 bool bSuccess = SetContentRange(pTextNode, nContentControlStart, nContentControlEnd);
1381 if (!bSuccess)
1382 {
1383 SAL_WARN("sw.core", "no pam");
1384 throw lang::DisposedException();
1385 }
1386
1387 SwPaM aPam(*pTextNode, nContentControlStart);
1388
1389 if (!m_pImpl->m_pTextPortions)
1390 {
1391 return new SwXTextPortionEnumeration(aPam, GetParentText(), nContentControlStart,
1392 nContentControlEnd);
1393 }
1394 else
1395 {
1396 return new SwXTextPortionEnumeration(aPam, std::deque(*m_pImpl->m_pTextPortions));
1397 }
1398}
1399
1401 : SwUnoCollection(pDoc)
1402{
1403}
1404
1406
1408{
1409 SolarMutexGuard aGuard;
1410
1411 if (!IsValid())
1412 {
1413 throw uno::RuntimeException();
1414 }
1415
1417}
1418
1420{
1421 SolarMutexGuard aGuard;
1422
1423 if (!IsValid())
1424 {
1425 throw uno::RuntimeException();
1426 }
1427
1429 if (nIndex < 0 || o3tl::make_unsigned(nIndex) >= rManager.GetCount())
1430 {
1431 throw lang::IndexOutOfBoundsException();
1432 }
1433
1434 SwTextContentControl* pTextContentControl = rManager.Get(nIndex);
1435 const SwFormatContentControl& rFormatContentControl = pTextContentControl->GetContentControl();
1436 rtl::Reference<SwXContentControl> xContentControl
1438 uno::Any aRet;
1439 aRet <<= uno::Reference<text::XTextContent>(xContentControl);
1440 return aRet;
1441}
1442
1444
1446{
1447 SolarMutexGuard aGuard;
1448
1449 if (!IsValid())
1450 {
1451 throw uno::RuntimeException();
1452 }
1453
1455}
1456
1457/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
::std::unique_ptr< XmlIdRegistry_Impl > m_pImpl
AnyEventRef aEvent
virtual bool DeleteAndJoin(SwPaM &, SwDeleteFlags flags=SwDeleteFlags::Default)=0
complete delete of a given PaM
virtual bool InsertPoolItem(const SwPaM &rRg, const SfxPoolItem &, const SetAttrMode nFlags=SetAttrMode::DEFAULT, SwRootFrame const *pLayout=nullptr, SwTextAttr **ppNewTextAttr=nullptr)=0
Insert an attribute.
SfxHintId GetId() const
css::uno::Reference< css::beans::XPropertySetInfo > const & getPropertySetInfo() const
bool StartListening(SvtBroadcaster &rBroadcaster)
static std::vector< SwContentControlListItem > ItemsFromAny(const css::uno::Any &rVal)
static void ItemsToAny(const std::vector< SwContentControlListItem > &rItems, css::uno::Any &rVal)
Knows all the text content controls in the document.
SwTextContentControl * Get(size_t nIndex)
Stores the properties of a content control.
void SetXContentControl(const rtl::Reference< SwXContentControl > &xContentControl)
SwTextContentControl * GetTextAttr() const
const unotools::WeakReference< SwXContentControl > & GetXContentControl() const
SwTextNode * GetTextNode() const
Definition: doc.hxx:195
IDocumentContentOperations const & getIDocumentContentOperations() const
Definition: doc.cxx:323
::SwContentControlManager & GetContentControlManager()
Definition: doc.cxx:136
SfxPoolItem subclass that wraps an SwContentControl.
const std::shared_ptr< SwContentControl > & GetContentControl() const
SwDoc & GetDoc()
Definition: node.hxx:233
PaM is Point and Mark: a selection of the document model.
Definition: pam.hxx:187
const SwPosition * GetMark() const
Definition: pam.hxx:263
const SwPosition * GetPoint() const
Definition: pam.hxx:261
bool HasMark() const
A PaM marks a selection if Point and Mark are distinct positions.
Definition: pam.hxx:259
Starts a section of nodes in the document model.
Definition: node.hxx:348
A wrapper around SfxPoolItem to store the start position of (usually) a text portion,...
Definition: txatbase.hxx:44
const sal_Int32 * End() const
Definition: txatbase.hxx:156
sal_Int32 GetStart() const
Definition: txatbase.hxx:88
const SwFormatContentControl & GetContentControl() const
Definition: txatbase.hxx:220
SwTextAttr subclass that tracks the location of the wrapped SwFormatContentControl.
SwTextNode is a paragraph in the document model.
Definition: ndtxt.hxx:111
SwDoc * GetDoc() const
Definition: unocoll.hxx:59
bool IsValid() const
Definition: unocoll.hxx:57
const SfxItemPropertySet * GetPropertySet(sal_uInt16 PropertyId)
Definition: unomap1.cxx:1081
The inner part SwXContentControl, which is deleted with a locked SolarMutex.
unotools::WeakReference< SwXContentControl > m_wThis
uno::Reference< text::XText > m_xParentText
Impl(SwXContentControl &rThis, SwDoc &rDoc, SwContentControl *pContentControl, uno::Reference< text::XText > xParentText, std::unique_ptr< const TextRangeList_t > pPortions)
std::unique_ptr< const TextRangeList_t > m_pTextPortions
::comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > m_EventListeners
const SwContentControl * GetContentControl() const
SwContentControl * m_pContentControl
void Notify(const SfxHint &rHint) override
rtl::Reference< SwXContentControlText > m_xText
std::vector< SwContentControlListItem > m_aListItems
UNO API wrapper around an SwContentControl, exposed as the com.sun.star.text.ContentControl service.
void SAL_CALL setString(const OUString &rString) override
void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
void SAL_CALL insertControlCharacter(const css::uno::Reference< css::text::XTextRange > &xRange, sal_Int16 nControlCharacter, sal_Bool bAbsorb) override
void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursorByRange(const css::uno::Reference< css::text::XTextRange > &xTextPosition) override
void SAL_CALL addVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
void SAL_CALL dispose() override
css::uno::Reference< css::container::XEnumeration > SAL_CALL createEnumeration() override
css::uno::Any SAL_CALL getPropertyValue(const OUString &rPropertyName) override
static rtl::Reference< SwXContentControl > CreateXContentControl(SwContentControl &rContentControl, const css::uno::Reference< css::text::XText > &xParentText=nullptr, std::unique_ptr< const TextRangeList_t > &&pPortions=std::unique_ptr< const TextRangeList_t >())
void SAL_CALL setPropertyValue(const OUString &rPropertyName, const css::uno::Any &rValue) override
sal_Bool SAL_CALL hasElements() override
void SAL_CALL removePropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
void SAL_CALL removeVetoableChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener > &xListener) override
SwXContentControl(const SwXContentControl &)=delete
void SAL_CALL insertTextContent(const css::uno::Reference< css::text::XTextRange > &xRange, const css::uno::Reference< css::text::XTextContent > &xContent, sal_Bool bAbsorb) override
css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
OUString SAL_CALL getImplementationName() override
css::uno::Reference< css::text::XTextRange > SAL_CALL getAnchor() override
css::uno::Reference< css::text::XText > SAL_CALL getText() override
void SAL_CALL insertString(const css::uno::Reference< css::text::XTextRange > &xRange, const OUString &aString, sal_Bool bAbsorb) override
bool SetContentRange(SwTextNode *&rpNode, sal_Int32 &rStart, sal_Int32 &rEnd) const
Initializes params with position of the attribute content (without CH_TXTATR).
css::uno::Reference< css::text::XTextCursor > SAL_CALL createTextCursor() override
const css::uno::Reference< css::text::XText > & GetParentText() const
void SAL_CALL attach(const css::uno::Reference< css::text::XTextRange > &xTextRange) override
css::uno::Type SAL_CALL getElementType() override
void AttachImpl(const css::uno::Reference< css::text::XTextRange > &xTextRange, sal_uInt16 nWhich)
sal_Bool SAL_CALL supportsService(const OUString &rServiceName) override
css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override
sw::UnoImplPtr< Impl > m_pImpl
void SAL_CALL removeTextContent(const css::uno::Reference< css::text::XTextContent > &xContent) override
void SAL_CALL addPropertyChangeListener(const OUString &rPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
OUString SAL_CALL getString() override
css::uno::Reference< css::text::XTextRange > SAL_CALL getEnd() override
css::uno::Reference< css::text::XTextRange > SAL_CALL getStart() override
css::uno::Any SAL_CALL getByIndex(sal_Int32 nIndex) override
sal_Bool SAL_CALL hasElements() override
SwXContentControls(SwDoc *pDoc)
css::uno::Type SAL_CALL getElementType() override
sal_Int32 SAL_CALL getCount() override
bool IsAtEndOfContentControl() const
Definition: unoobj.cxx:946
const SwDoc & GetDoc() const
Definition: unoobj2.cxx:764
static rtl::Reference< SwXTextRange > CreateXTextRange(SwDoc &rDoc, const SwPosition &rPos, const SwPosition *const pMark)
Definition: unoobj2.cxx:1199
virtual css::uno::Reference< css::text::XTextCursor > CreateCursor()
Definition: unotext.cxx:179
void Invalidate()
Definition: unotext.cxx:149
virtual const SwStartNode * GetStartNode() const
Definition: unotext.cxx:173
virtual void PrepareForAttach(css::uno::Reference< css::text::XTextRange > &xRange, SwPaM const &rPam)
Definition: unotext.cxx:163
virtual void SAL_CALL acquire() SAL_NOEXCEPT SAL_OVERRIDE
virtual void SAL_CALL release() SAL_NOEXCEPT SAL_OVERRIDE
css::uno::Type const & get()
static SwNode * GetStartNode(SwOutlineNodes const *pOutlNds, int nOutlineLevel, SwOutlineNodes::size_type *nOutl)
Definition: docglbl.cxx:89
sal_Int16 nValue
constexpr TypedWhichId< SwFormatContentControl > RES_TXTATR_CONTENTCONTROL(56)
sal_Int32 nIndex
#define SAL_WARN(area, stream)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
constexpr std::enable_if_t< std::is_signed_v< T >, std::make_unsigned_t< T > > make_unsigned(T value)
uno::Reference< text::XText > CreateParentXText(SwDoc &rDoc, const SwPosition &rPos)
Definition: unoobj2.cxx:1218
bool XTextRangeToSwPaM(SwUnoInternalPaM &rToFill, const uno::Reference< text::XTextRange > &xTextRange, ::sw::TextRangeMode const eMode)
Definition: unoobj2.cxx:1090
Marks a position in the document model.
Definition: pam.hxx:37
SetAttrMode
Definition: swtypes.hxx:133
@ FORCEHINTEXPAND
Force hint expand (only matters for hints with CH_TXTATR).
unsigned char sal_Bool
CursorType
SwUnoPropertyMapProvider aSwMapProvider
Definition: unomap1.cxx:87
#define PROPERTY_MAP_CONTENTCONTROL
Definition: unomap.hxx:130
constexpr OUStringLiteral UNO_NAME_TAB_INDEX
Definition: unoprnms.hxx:924
constexpr OUStringLiteral UNO_NAME_TAG
Definition: unoprnms.hxx:922
constexpr OUStringLiteral UNO_NAME_SHOWING_PLACE_HOLDER
Definition: unoprnms.hxx:901
constexpr OUStringLiteral UNO_NAME_CHECKBOX
Definition: unoprnms.hxx:902
constexpr OUStringLiteral UNO_NAME_PICTURE
Definition: unoprnms.hxx:907
constexpr OUStringLiteral UNO_NAME_ALIAS
Definition: unoprnms.hxx:921
constexpr OUStringLiteral UNO_NAME_DATE_FORMAT
Definition: unoprnms.hxx:908
constexpr OUStringLiteral UNO_NAME_CHECKED_STATE
Definition: unoprnms.hxx:904
constexpr OUStringLiteral UNO_NAME_PLAIN_TEXT
Definition: unoprnms.hxx:911
constexpr OUStringLiteral UNO_NAME_ID
Definition: unoprnms.hxx:923
constexpr OUStringLiteral UNO_NAME_DROP_DOWN
Definition: unoprnms.hxx:913
constexpr OUStringLiteral UNO_NAME_LIST_ITEMS
Definition: unoprnms.hxx:906
constexpr OUStringLiteral UNO_NAME_CURRENT_DATE
Definition: unoprnms.hxx:910
constexpr OUStringLiteral UNO_NAME_CHECKED
Definition: unoprnms.hxx:903
constexpr OUStringLiteral UNO_NAME_DATA_BINDING_STORE_ITEM_ID
Definition: unoprnms.hxx:918
constexpr OUStringLiteral UNO_NAME_DATE_LANGUAGE
Definition: unoprnms.hxx:909
constexpr OUStringLiteral UNO_NAME_APPEARANCE
Definition: unoprnms.hxx:920
constexpr OUStringLiteral UNO_NAME_LOCK
Definition: unoprnms.hxx:925
constexpr OUStringLiteral UNO_NAME_COMBO_BOX
Definition: unoprnms.hxx:912
constexpr OUStringLiteral UNO_NAME_UNCHECKED_STATE
Definition: unoprnms.hxx:905
constexpr OUStringLiteral UNO_NAME_PLACEHOLDER_DOC_PART
Definition: unoprnms.hxx:914
constexpr OUStringLiteral UNO_NAME_DATA_BINDING_PREFIX_MAPPINGS
Definition: unoprnms.hxx:916
constexpr OUStringLiteral UNO_NAME_DATE_STRING
Definition: unoprnms.hxx:926
constexpr OUStringLiteral UNO_NAME_DATE
Definition: unoprnms.hxx:266
constexpr OUStringLiteral UNO_NAME_DATA_BINDING_XPATH
Definition: unoprnms.hxx:917
constexpr OUStringLiteral UNO_NAME_COLOR
Definition: unoprnms.hxx:919