summaryrefslogtreecommitdiff
path: root/sw/inc
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-11-08 16:45:00 +0100
committerMiklos Vajna <vmiklos@collabora.com>2022-11-08 18:09:15 +0100
commita8448ded5555947925b0e9ddb4aeea7043f03933 (patch)
treee98ad6f441c03c34b90782d2f076dad58ed4e479 /sw/inc
parent46875d83476942ca215429c837a3457f55c3ccb0 (diff)
sw: introduce an UNO manager for content controls
This builds on top of commit ad950f10dc382ea169f94a0c301ca8c424e7103e (sw: introduce a manager for content controls, 2022-11-08) and exposes it on the UNO API: - add a new css.text.ContentControls service, backed by SwContentControlManager - add a new css.text.XContentControlsSupplier interface, implemented by SwXTextDocument - implement XIndexAccess in ContentControls This allows UNO (and later VBA) clients to have random access to the content controls in a document, which is much easier than the relatively complex traversal of the whole doc model. Change-Id: I26240c9ddbd06f4f57f5f65460ef75a2ace94825 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/142454 Reviewed-by: Miklos Vajna <vmiklos@collabora.com> Tested-by: Jenkins
Diffstat (limited to 'sw/inc')
-rw-r--r--sw/inc/textcontentcontrol.hxx3
-rw-r--r--sw/inc/unotxdoc.hxx6
2 files changed, 9 insertions, 0 deletions
diff --git a/sw/inc/textcontentcontrol.hxx b/sw/inc/textcontentcontrol.hxx
index dc7d210f79a6..78a4d5120b1b 100644
--- a/sw/inc/textcontentcontrol.hxx
+++ b/sw/inc/textcontentcontrol.hxx
@@ -56,6 +56,9 @@ public:
SwContentControlManager();
void Insert(SwTextContentControl* pTextContentControl);
void Erase(SwTextContentControl* pTextContentControl);
+ size_t GetCount() const { return m_aContentControls.size(); }
+ bool IsEmpty() const { return m_aContentControls.empty(); }
+ SwTextContentControl* Get(size_t nIndex);
void dumpAsXml(xmlTextWriterPtr pWriter) const;
};
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index a69a678a6cf1..90f605406d5b 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -29,6 +29,7 @@
#include <com/sun/star/text/XNumberingRulesSupplier.hpp>
#include <com/sun/star/text/XFootnotesSupplier.hpp>
#include <com/sun/star/text/XEndnotesSupplier.hpp>
+#include <com/sun/star/text/XContentControlsSupplier.hpp>
#include <com/sun/star/text/XTextSectionsSupplier.hpp>
#include <com/sun/star/text/XLineNumberingProperties.hpp>
#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
@@ -99,6 +100,7 @@ typedef cppu::ImplInheritanceHelper
css::text::XNumberingRulesSupplier,
css::text::XFootnotesSupplier,
css::text::XEndnotesSupplier,
+ css::text::XContentControlsSupplier,
css::util::XReplaceable,
css::text::XPagePrintable,
css::text::XReferenceMarksSupplier,
@@ -156,6 +158,7 @@ private:
css::uno::Reference< css::beans::XPropertySet > mxXFootnoteSettings;
css::uno::Reference< css::container::XIndexAccess > mxXEndnotes;
css::uno::Reference< css::beans::XPropertySet > mxXEndnoteSettings;
+ css::uno::Reference< css::container::XIndexAccess > mxXContentControls;
css::uno::Reference< css::container::XNameAccess > mxXReferenceMarks;
css::uno::Reference< css::container::XEnumerationAccess > mxXTextFieldTypes;
css::uno::Reference< css::container::XNameAccess > mxXTextFieldMasters;
@@ -266,6 +269,9 @@ public:
virtual css::uno::Reference< css::container::XIndexAccess > SAL_CALL getEndnotes() override;
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getEndnoteSettings() override;
+ // XContentControlsSupplier
+ css::uno::Reference<css::container::XIndexAccess> SAL_CALL getContentControls() override;
+
//XReplaceable
virtual css::uno::Reference< css::util::XReplaceDescriptor > SAL_CALL createReplaceDescriptor() override;
virtual sal_Int32 SAL_CALL replaceAll(const css::uno::Reference< css::util::XSearchDescriptor > & xDesc) override;