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