summaryrefslogtreecommitdiffstats
path: root/sw/qa/api
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-15 05:54:39 +0000
commit267c6f2ac71f92999e969232431ba04678e7437e (patch)
tree358c9467650e1d0a1d7227a21dac2e3d08b622b2 /sw/qa/api
parentInitial commit. (diff)
downloadlibreoffice-267c6f2ac71f92999e969232431ba04678e7437e.tar.xz
libreoffice-267c6f2ac71f92999e969232431ba04678e7437e.zip
Adding upstream version 4:24.2.0.upstream/4%24.2.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'sw/qa/api')
-rw-r--r--sw/qa/api/SwXAutoTextContainer.cxx77
-rw-r--r--sw/qa/api/SwXBodyText.cxx104
-rw-r--r--sw/qa/api/SwXBookmark.cxx92
-rw-r--r--sw/qa/api/SwXBookmarks.cxx85
-rw-r--r--sw/qa/api/SwXChapterNumbering.cxx88
-rw-r--r--sw/qa/api/SwXDocumentIndex.cxx111
-rw-r--r--sw/qa/api/SwXDocumentIndexMark.cxx113
-rw-r--r--sw/qa/api/SwXDocumentIndexes.cxx84
-rw-r--r--sw/qa/api/SwXDocumentSettings.cxx90
-rw-r--r--sw/qa/api/SwXFieldEnumeration.cxx109
-rw-r--r--sw/qa/api/SwXFootnote.cxx129
-rw-r--r--sw/qa/api/SwXFootnoteProperties.cxx96
-rw-r--r--sw/qa/api/SwXFootnoteText.cxx122
-rw-r--r--sw/qa/api/SwXFootnotes.cxx82
-rw-r--r--sw/qa/api/SwXFrames.cxx90
-rw-r--r--sw/qa/api/SwXHeadFootText.cxx124
-rw-r--r--sw/qa/api/SwXNumberingRules.cxx137
-rw-r--r--sw/qa/api/SwXParagraphEnumeration.cxx96
-rw-r--r--sw/qa/api/SwXReferenceMark.cxx97
-rw-r--r--sw/qa/api/SwXReferenceMarks.cxx100
-rw-r--r--sw/qa/api/SwXStyleFamilies.cxx81
-rw-r--r--sw/qa/api/SwXTableCellText.cxx103
-rw-r--r--sw/qa/api/SwXTextEmbeddedObjects.cxx100
-rw-r--r--sw/qa/api/SwXTextField.cxx112
-rw-r--r--sw/qa/api/SwXTextFieldMasters.cxx86
-rw-r--r--sw/qa/api/SwXTextFieldTypes.cxx85
-rw-r--r--sw/qa/api/SwXTextFrame.cxx75
-rw-r--r--sw/qa/api/SwXTextSections.cxx100
-rw-r--r--sw/qa/api/SwXTextTable.cxx86
-rw-r--r--sw/qa/api/SwXTextTables.cxx97
-rw-r--r--sw/qa/api/terminate.cxx75
31 files changed, 3026 insertions, 0 deletions
diff --git a/sw/qa/api/SwXAutoTextContainer.cxx b/sw/qa/api/SwXAutoTextContainer.cxx
new file mode 100644
index 0000000000..1f1fc3df1d
--- /dev/null
+++ b/sw/qa/api/SwXAutoTextContainer.cxx
@@ -0,0 +1,77 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/container/xnameaccess.hxx>
+#include <test/container/xindexaccess.hxx>
+#include <test/container/xelementaccess.hxx>
+#include <test/text/xautotextcontainer.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/text/XAutoTextContainer.hpp>
+#include <com/sun/star/text/AutoTextContainer.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXAutoTextContainer.
+ */
+class SwXAutoTextContainer final : public UnoApiTest,
+ public apitest::XElementAccess,
+ public apitest::XIndexAccess,
+ public apitest::XNameAccess
+{
+public:
+ SwXAutoTextContainer()
+ : UnoApiTest("")
+ , XElementAccess(cppu::UnoType<text::XAutoTextGroup>::get())
+ , XIndexAccess(3)
+ , XNameAccess("crdbus50")
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XAutoTextContainer> xAutoTextContainer
+ = text::AutoTextContainer::create(comphelper::getProcessComponentContext());
+
+ Reference<container::XNameAccess> xNA(xAutoTextContainer, UNO_QUERY_THROW);
+ Sequence<rtl::OUString> aNames = xNA->getElementNames();
+ std::cout << aNames[0] << std::endl;
+
+ return Reference<XInterface>(xAutoTextContainer, UNO_QUERY_THROW);
+ }
+
+ CPPUNIT_TEST_SUITE(SwXAutoTextContainer);
+ CPPUNIT_TEST(testGetByName);
+ CPPUNIT_TEST(testGetElementNames);
+ CPPUNIT_TEST(testHasByName);
+ CPPUNIT_TEST(testGetCount);
+ CPPUNIT_TEST(testGetByIndex);
+ CPPUNIT_TEST(testGetElementType);
+ CPPUNIT_TEST(testHasElements);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXAutoTextContainer);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXBodyText.cxx b/sw/qa/api/SwXBodyText.cxx
new file mode 100644
index 0000000000..69fb22a959
--- /dev/null
+++ b/sw/qa/api/SwXBodyText.cxx
@@ -0,0 +1,104 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <test/text/xsimpletext.hxx>
+#include <test/container/xelementaccess.hxx>
+#include <test/text/xtextrange.hxx>
+#include <test/container/xenumerationaccess.hxx>
+#include <test/text/xtextrangecompare.hxx>
+#include <unotest/macros_test.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXBodyText.
+ */
+class SwXBodyText final : public test::BootstrapFixture,
+ public unotest::MacrosTest,
+ public apitest::XElementAccess,
+ public apitest::XTextRange,
+ public apitest::XSimpleText,
+ public apitest::XEnumerationAccess,
+ public apitest::XTextRangeCompare
+{
+public:
+ SwXBodyText();
+ virtual void setUp() override;
+ void tearDown() override;
+
+ Reference<XInterface> init() override;
+
+ CPPUNIT_TEST_SUITE(SwXBodyText);
+ CPPUNIT_TEST(testCreateTextCursor);
+ CPPUNIT_TEST(testCreateTextCursorByRange);
+ CPPUNIT_TEST(testInsertString);
+ CPPUNIT_TEST(testInsertControlCharacter);
+ CPPUNIT_TEST(testGetElementType);
+ CPPUNIT_TEST(testHasElements);
+ CPPUNIT_TEST(testGetText);
+ CPPUNIT_TEST(testGetStart);
+ CPPUNIT_TEST(testGetEnd);
+ CPPUNIT_TEST(testGetSetString);
+ CPPUNIT_TEST(testCreateEnumeration);
+ CPPUNIT_TEST(testCompareRegionStarts);
+ CPPUNIT_TEST(testCompareRegionEnds);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ uno::Reference<lang::XComponent> component_;
+};
+
+SwXBodyText::SwXBodyText()
+ : XElementAccess(cppu::UnoType<text::XTextRange>::get())
+{
+}
+
+void SwXBodyText::setUp()
+{
+ test::BootstrapFixture::setUp();
+ mxDesktop.set(
+ frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory())));
+}
+
+void SwXBodyText::tearDown()
+{
+ if (component_.is())
+ component_->dispose();
+
+ test::BootstrapFixture::tearDown();
+}
+
+Reference<XInterface> SwXBodyText::init()
+{
+ component_ = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument");
+ Reference<text::XTextDocument> xTextDocument(component_, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(component_, UNO_QUERY_THROW);
+
+ Reference<text::XText> xText = xTextDocument->getText();
+
+ return Reference<XInterface>(xText, UNO_QUERY_THROW);
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXBodyText);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXBookmark.cxx b/sw/qa/api/SwXBookmark.cxx
new file mode 100644
index 0000000000..ca6c02d81f
--- /dev/null
+++ b/sw/qa/api/SwXBookmark.cxx
@@ -0,0 +1,92 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/lang/xcomponent.hxx>
+#include <test/container/xnamed.hxx>
+#include <test/text/xtextcontent.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXBookmark.
+ */
+class SwXBookmark final : public UnoApiTest,
+ public apitest::XComponent,
+ public apitest::XNamed,
+ public apitest::XTextContent
+{
+public:
+ SwXBookmark()
+ : UnoApiTest("")
+ , XNamed("Bookmark")
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(mxComponent, UNO_QUERY_THROW);
+
+ Reference<text::XText> xText = xTextDocument->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+
+ Reference<text::XTextContent> xBookmark(xMSF->createInstance("com.sun.star.text.Bookmark"),
+ UNO_QUERY_THROW);
+
+ xText->insertTextContent(xCursor, xBookmark, false);
+ mxTextRange = Reference<text::XTextRange>(xCursor, UNO_QUERY_THROW);
+ mxTextContent = Reference<text::XTextContent>(
+ xMSF->createInstance("com.sun.star.text.Bookmark"), UNO_QUERY_THROW);
+
+ return Reference<XInterface>(xBookmark, UNO_QUERY_THROW);
+ }
+
+ Reference<text::XTextRange> getTextRange() override { return mxTextRange; };
+ Reference<text::XTextContent> getTextContent() override { return mxTextContent; };
+ bool isAttachSupported() override { return true; }
+ void triggerDesktopTerminate() override { mxDesktop->terminate(); }
+
+ CPPUNIT_TEST_SUITE(SwXBookmark);
+ CPPUNIT_TEST(testDispose);
+ CPPUNIT_TEST(testAddEventListener);
+ CPPUNIT_TEST(testRemoveEventListener);
+ CPPUNIT_TEST(testGetName);
+ CPPUNIT_TEST(testSetName);
+ CPPUNIT_TEST(testAttach);
+ CPPUNIT_TEST(testGetAnchor);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ Reference<text::XTextRange> mxTextRange;
+ Reference<text::XTextContent> mxTextContent;
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXBookmark);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXBookmarks.cxx b/sw/qa/api/SwXBookmarks.cxx
new file mode 100644
index 0000000000..34babbbd3c
--- /dev/null
+++ b/sw/qa/api/SwXBookmarks.cxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/container/xnameaccess.hxx>
+#include <test/container/xindexaccess.hxx>
+#include <test/container/xelementaccess.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XBookmarksSupplier.hpp>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXBookmarks.
+ */
+class SwXBookmarks final : public UnoApiTest,
+ public apitest::XElementAccess,
+ public apitest::XIndexAccess,
+ public apitest::XNameAccess
+{
+public:
+ SwXBookmarks()
+ : UnoApiTest("")
+ , XElementAccess(cppu::UnoType<text::XTextContent>::get())
+ , XIndexAccess(1)
+ , XNameAccess("Bookmark")
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(mxComponent, UNO_QUERY_THROW);
+
+ Reference<text::XText> xText = xTextDocument->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+
+ Reference<text::XTextContent> xBookmark(xMSF->createInstance("com.sun.star.text.Bookmark"),
+ UNO_QUERY_THROW);
+ xText->insertTextContent(xCursor, xBookmark, false);
+
+ Reference<text::XBookmarksSupplier> xSupplier(xTextDocument, UNO_QUERY_THROW);
+ Reference<container::XNameAccess> xNameAccess = xSupplier->getBookmarks();
+
+ return Reference<XInterface>(xNameAccess, UNO_QUERY_THROW);
+ }
+
+ CPPUNIT_TEST_SUITE(SwXBookmarks);
+ CPPUNIT_TEST(testGetByName);
+ CPPUNIT_TEST(testGetElementNames);
+ CPPUNIT_TEST(testHasByName);
+ CPPUNIT_TEST(testGetCount);
+ CPPUNIT_TEST(testGetByIndex);
+ CPPUNIT_TEST(testGetElementType);
+ CPPUNIT_TEST(testHasElements);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXBookmarks);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXChapterNumbering.cxx b/sw/qa/api/SwXChapterNumbering.cxx
new file mode 100644
index 0000000000..5a676da9c0
--- /dev/null
+++ b/sw/qa/api/SwXChapterNumbering.cxx
@@ -0,0 +1,88 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/beans/xpropertyset.hxx>
+#include <test/container/xindexaccess.hxx>
+#include <test/container/xelementaccess.hxx>
+#include <test/text/numberingrules.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/text/XChapterNumberingSupplier.hpp>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXChapterNumbering.
+ */
+class SwXChapterNumbering final : public UnoApiTest,
+ public apitest::XPropertySet,
+ public apitest::XElementAccess,
+ public apitest::XIndexAccess,
+ public apitest::NumberingRules
+{
+public:
+ SwXChapterNumbering()
+ : UnoApiTest("")
+ , XElementAccess(cppu::UnoType<Sequence<beans::PropertyValue>>::get())
+ , XIndexAccess(10)
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW);
+
+ Reference<text::XChapterNumberingSupplier> xCNSupplier(xTextDocument, UNO_QUERY_THROW);
+ Reference<container::XIndexAccess> xCNRules(xCNSupplier->getChapterNumberingRules(),
+ UNO_QUERY_THROW);
+
+ try
+ {
+ Reference<container::XIndexReplace> xIndexReplace(xCNRules->getByIndex(1),
+ UNO_QUERY_THROW);
+ }
+ catch (Exception&)
+ {
+ }
+ return Reference<XInterface>(xCNRules, UNO_QUERY_THROW);
+ }
+
+ CPPUNIT_TEST_SUITE(SwXChapterNumbering);
+ CPPUNIT_TEST(testGetCount);
+ CPPUNIT_TEST(testGetByIndex);
+ CPPUNIT_TEST(testGetElementType);
+ CPPUNIT_TEST(testHasElements);
+ CPPUNIT_TEST(testGetPropertySetInfo);
+ CPPUNIT_TEST(testSetPropertyValue);
+ CPPUNIT_TEST(testGetPropertyValue);
+ CPPUNIT_TEST(testPropertyChangeListener);
+ CPPUNIT_TEST(testVetoableChangeListener);
+ CPPUNIT_TEST(testNumberingRulesProperties);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXChapterNumbering);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXDocumentIndex.cxx b/sw/qa/api/SwXDocumentIndex.cxx
new file mode 100644
index 0000000000..929bf6e942
--- /dev/null
+++ b/sw/qa/api/SwXDocumentIndex.cxx
@@ -0,0 +1,111 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/lang/xcomponent.hxx>
+#include <test/lang/xserviceinfo.hxx>
+#include <test/text/baseindex.hxx>
+#include <test/text/textdocumentindex.hxx>
+#include <test/text/xdocumentindex.hxx>
+#include <test/text/xtextcontent.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/text/XTextRange.hpp>
+#include <com/sun/star/text/XDocumentIndex.hpp>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Test for Java API test of file com.sun.star.comp.office.SwXDocumentIndex.csv
+ */
+class SwXDocumentIndex final : public UnoApiTest,
+ public apitest::XServiceInfo,
+ public apitest::XDocumentIndex,
+ public apitest::BaseIndex,
+ public apitest::TextDocumentIndex,
+ public apitest::XTextContent,
+ public apitest::XComponent
+{
+ Reference<text::XTextDocument> mxTextDocument;
+ Reference<text::XTextRange> mxTextRange;
+ Reference<text::XTextContent> mxTextContent;
+
+public:
+ // SwXDocumentIndex()
+ // : apitest::XServiceInfo("SwXDocumentIndex", "com.sun.star.text.BaseIndex"){};
+ SwXDocumentIndex()
+ : UnoApiTest("")
+ , apitest::XServiceInfo("SwXDocumentIndex", "com.sun.star.text.BaseIndex")
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ mxTextDocument = Reference<text::XTextDocument>(mxComponent, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(mxTextDocument, UNO_QUERY_THROW);
+ Reference<text::XDocumentIndex> xDocumentIndex(
+ xMSF->createInstance("com.sun.star.text.DocumentIndex"), UNO_QUERY_THROW);
+
+ auto xText = getTextDocument()->getText();
+ auto xTextCursor = xText->createTextCursor();
+ CPPUNIT_ASSERT(xTextCursor.is());
+ xText->insertTextContent(xTextCursor, xDocumentIndex, false);
+ xTextCursor->gotoEnd(false);
+
+ mxTextRange = Reference<text::XTextRange>(xTextCursor, UNO_QUERY_THROW);
+ mxTextContent = Reference<text::XTextContent>(
+ xMSF->createInstance("com.sun.star.text.DocumentIndex"), UNO_QUERY_THROW);
+
+ return xDocumentIndex;
+ }
+
+ Reference<text::XTextRange> getTextRange() override { return mxTextRange; };
+ Reference<text::XTextContent> getTextContent() override { return mxTextContent; };
+ bool isAttachSupported() override { return true; }
+ Reference<text::XTextDocument> getTextDocument() override { return mxTextDocument; }
+ void triggerDesktopTerminate() override {}
+
+ CPPUNIT_TEST_SUITE(SwXDocumentIndex);
+ CPPUNIT_TEST(testGetImplementationName);
+ CPPUNIT_TEST(testGetSupportedServiceNames);
+ CPPUNIT_TEST(testSupportsService);
+ CPPUNIT_TEST(testUpdate);
+ CPPUNIT_TEST(testBaseIndexProperties);
+ CPPUNIT_TEST(testDocumentIndexProperties);
+ CPPUNIT_TEST(testAttach);
+ CPPUNIT_TEST(testGetAnchor);
+ CPPUNIT_TEST(testAddEventListener);
+ CPPUNIT_TEST(testRemoveEventListener);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXDocumentIndex);
+}
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXDocumentIndexMark.cxx b/sw/qa/api/SwXDocumentIndexMark.cxx
new file mode 100644
index 0000000000..395769c5cc
--- /dev/null
+++ b/sw/qa/api/SwXDocumentIndexMark.cxx
@@ -0,0 +1,113 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <test/lang/xcomponent.hxx>
+#include <test/text/xtextcontent.hxx>
+#include <test/text/baseindexmark.hxx>
+#include <test/text/documentindexmark.hxx>
+#include <unotest/macros_test.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XDocumentIndexMark.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXDocumentIndexMark.
+ */
+class SwXDocumentIndexMark final : public test::BootstrapFixture,
+ public unotest::MacrosTest,
+ public apitest::XComponent,
+ public apitest::XTextContent,
+ public apitest::BaseIndexMark,
+ public apitest::DocumentIndexMark
+{
+public:
+ virtual void setUp() override;
+ void tearDown() override;
+
+ Reference<XInterface> init() override;
+ uno::Reference<text::XTextRange> getTextRange() override;
+ uno::Reference<text::XTextContent> getTextContent() override;
+ bool isAttachSupported() override { return true; }
+ uno::Reference<text::XTextDocument> getTextDocument() { return mxTextDocument; }
+ void triggerDesktopTerminate() override { mxDesktop->terminate(); }
+
+ CPPUNIT_TEST_SUITE(SwXDocumentIndexMark);
+ CPPUNIT_TEST(testDispose);
+ CPPUNIT_TEST(testAddEventListener);
+ CPPUNIT_TEST(testRemoveEventListener);
+ CPPUNIT_TEST(testAttach);
+ CPPUNIT_TEST(testGetAnchor);
+ CPPUNIT_TEST(testBaseIndexMarkProperties);
+ CPPUNIT_TEST(testDocumentIndexMarkProperties);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ uno::Reference<text::XTextDocument> mxTextDocument;
+ uno::Reference<text::XTextRange> mxTextRange;
+ uno::Reference<text::XTextContent> mxTextContent;
+};
+
+void SwXDocumentIndexMark::setUp()
+{
+ test::BootstrapFixture::setUp();
+
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxTextDocument = uno::Reference<text::XTextDocument>(
+ loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"),
+ uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(mxTextDocument.is());
+}
+
+void SwXDocumentIndexMark::tearDown()
+{
+ if (mxTextDocument.is())
+ mxTextDocument->dispose();
+
+ test::BootstrapFixture::tearDown();
+}
+
+Reference<XInterface> SwXDocumentIndexMark::init()
+{
+ Reference<lang::XMultiServiceFactory> xMSF(mxTextDocument, UNO_QUERY_THROW);
+
+ Reference<text::XText> xText = getTextDocument()->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+
+ Reference<text::XDocumentIndexMark> xDIM(
+ xMSF->createInstance("com.sun.star.text.DocumentIndexMark"), UNO_QUERY_THROW);
+
+ mxTextRange = uno::Reference<text::XTextRange>(xCursor, uno::UNO_QUERY_THROW);
+ mxTextContent = uno::Reference<text::XTextContent>(
+ xMSF->createInstance("com.sun.star.text.DocumentIndex"), uno::UNO_QUERY_THROW);
+ xText->insertTextContent(xCursor, xDIM, false);
+
+ return Reference<XInterface>(xDIM, UNO_QUERY_THROW);
+}
+
+uno::Reference<text::XTextRange> SwXDocumentIndexMark::getTextRange() { return mxTextRange; }
+
+uno::Reference<text::XTextContent> SwXDocumentIndexMark::getTextContent() { return mxTextContent; }
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXDocumentIndexMark);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXDocumentIndexes.cxx b/sw/qa/api/SwXDocumentIndexes.cxx
new file mode 100644
index 0000000000..91be0e5c84
--- /dev/null
+++ b/sw/qa/api/SwXDocumentIndexes.cxx
@@ -0,0 +1,84 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/container/xnameaccess.hxx>
+#include <test/container/xindexaccess.hxx>
+#include <test/container/xelementaccess.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XDocumentIndex.hpp>
+#include <com/sun/star/text/XDocumentIndexesSupplier.hpp>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXDocumentIndexes.
+ */
+class SwXDocumentIndexes final : public UnoApiTest,
+ public apitest::XElementAccess,
+ public apitest::XIndexAccess,
+ public apitest::XNameAccess
+{
+public:
+ SwXDocumentIndexes()
+ : UnoApiTest("")
+ , XElementAccess(cppu::UnoType<text::XDocumentIndex>::get())
+ , XIndexAccess(1)
+ , XNameAccess("Table of Contents1")
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(mxComponent, UNO_QUERY_THROW);
+
+ Reference<text::XText> xText = xTextDocument->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+ Reference<text::XTextContent> xTextContent(
+ xMSF->createInstance("com.sun.star.text.ContentIndex"), UNO_QUERY_THROW);
+
+ xText->insertTextContent(xCursor, xTextContent, false);
+ Reference<text::XDocumentIndexesSupplier> xDocIndSupp(xTextDocument, UNO_QUERY_THROW);
+
+ return Reference<XInterface>(xDocIndSupp->getDocumentIndexes(), UNO_QUERY_THROW);
+ }
+
+ CPPUNIT_TEST_SUITE(SwXDocumentIndexes);
+ CPPUNIT_TEST(testGetByName);
+ CPPUNIT_TEST(testGetElementNames);
+ CPPUNIT_TEST(testHasByName);
+ CPPUNIT_TEST(testGetCount);
+ CPPUNIT_TEST(testGetByIndex);
+ CPPUNIT_TEST(testGetElementType);
+ CPPUNIT_TEST(testHasElements);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXDocumentIndexes);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXDocumentSettings.cxx b/sw/qa/api/SwXDocumentSettings.cxx
new file mode 100644
index 0000000000..da2b366dae
--- /dev/null
+++ b/sw/qa/api/SwXDocumentSettings.cxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <test/lang/xserviceinfo.hxx>
+#include <test/text/textdocumentsettings.hxx>
+#include <test/text/textprintersettings.hxx>
+#include <test/text/textsettings.hxx>
+#include <unotest/macros_test.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/uno/XInterface.hpp>
+
+using namespace css;
+
+namespace
+{
+/**
+ * Test for Java API test of file com.sun.star.comp.Writer.DocumentSettings.csv
+ */
+class SwXDocumentSettings final : public test::BootstrapFixture,
+ public unotest::MacrosTest,
+ public apitest::TextDocumentSettings,
+ public apitest::TextSettings,
+ public apitest::TextPrinterSettings,
+ public apitest::XServiceInfo
+{
+private:
+ uno::Reference<lang::XComponent> mxComponent;
+
+public:
+ virtual void setUp() override;
+ virtual void tearDown() override;
+
+ SwXDocumentSettings()
+ : apitest::XServiceInfo("SwXDocumentSettings", "com.sun.star.text.DocumentSettings"){};
+ uno::Reference<uno::XInterface> init() override;
+
+ CPPUNIT_TEST_SUITE(SwXDocumentSettings);
+ CPPUNIT_TEST(testGetImplementationName);
+ CPPUNIT_TEST(testGetSupportedServiceNames);
+ CPPUNIT_TEST(testSupportsService);
+ CPPUNIT_TEST(testDocumentSettingsProperties);
+ CPPUNIT_TEST(testSettingsProperties);
+ CPPUNIT_TEST(testPrinterSettingsProperties);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+void SwXDocumentSettings::setUp()
+{
+ test::BootstrapFixture::setUp();
+
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+}
+
+void SwXDocumentSettings::tearDown()
+{
+ if (mxComponent.is())
+ mxComponent->dispose();
+
+ test::BootstrapFixture::tearDown();
+}
+
+uno::Reference<uno::XInterface> SwXDocumentSettings::init()
+{
+ mxComponent = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument");
+ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<lang::XMultiServiceFactory> xFactory(xTextDocument, uno::UNO_QUERY_THROW);
+
+ uno::Reference<uno::XInterface> xDocumentSettings(
+ xFactory->createInstance("com.sun.star.text.DocumentSettings"), uno::UNO_SET_THROW);
+
+ return xDocumentSettings;
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXDocumentSettings);
+
+} // end anonymous namespace
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXFieldEnumeration.cxx b/sw/qa/api/SwXFieldEnumeration.cxx
new file mode 100644
index 0000000000..53c437ed18
--- /dev/null
+++ b/sw/qa/api/SwXFieldEnumeration.cxx
@@ -0,0 +1,109 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/container/xenumeration.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/text/XDependentTextField.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextFieldsSupplier.hpp>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXFieldEnumeration.
+ */
+class SwXFieldEnumeration final : public UnoApiTest, public apitest::XEnumeration
+{
+public:
+ SwXFieldEnumeration()
+ : UnoApiTest("")
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(mxComponent, UNO_QUERY_THROW);
+
+ Reference<beans::XPropertySet> xFieldMaster;
+ Reference<text::XDependentTextField> xTF;
+
+ try
+ {
+ xFieldMaster = Reference<beans::XPropertySet>(
+ xMSF->createInstance("com.sun.star.text.FieldMaster.Database"), UNO_QUERY_THROW);
+ xTF = Reference<text::XDependentTextField>(
+ xMSF->createInstance("com.sun.star.text.TextField.Database"), UNO_QUERY_THROW);
+ }
+ catch (Exception&)
+ {
+ }
+
+ try
+ {
+ xFieldMaster->setPropertyValue("DataBaseName", Any(OUString("Bibliography")));
+ xFieldMaster->setPropertyValue("DataTableName", Any(OUString("biblio")));
+ xFieldMaster->setPropertyValue("DataColumnName", Any(OUString("Address")));
+ }
+ catch (lang::WrappedTargetException&)
+ {
+ }
+ catch (lang::IllegalArgumentException&)
+ {
+ }
+ catch (beans::UnknownPropertyException&)
+ {
+ }
+ catch (beans::PropertyVetoException&)
+ {
+ }
+
+ Reference<text::XText> xText = xTextDocument->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+ Reference<text::XTextContent> xTextContent(xTF, UNO_QUERY_THROW);
+
+ xTF->attachTextFieldMaster(xFieldMaster);
+ xText->insertTextContent(xCursor, xTextContent, false);
+
+ Reference<text::XTextFieldsSupplier> xTFS(xTextDocument, UNO_QUERY_THROW);
+ Reference<container::XEnumerationAccess> xEnumerationAccess = xTFS->getTextFields();
+
+ return Reference<XInterface>(xEnumerationAccess->createEnumeration(), UNO_QUERY_THROW);
+ }
+
+ CPPUNIT_TEST_SUITE(SwXFieldEnumeration);
+ CPPUNIT_TEST(testHasMoreElements);
+ CPPUNIT_TEST(testNextElement);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXFieldEnumeration);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXFootnote.cxx b/sw/qa/api/SwXFootnote.cxx
new file mode 100644
index 0000000000..5c6f7418d9
--- /dev/null
+++ b/sw/qa/api/SwXFootnote.cxx
@@ -0,0 +1,129 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <test/lang/xcomponent.hxx>
+#include <test/text/footnote.hxx>
+#include <test/text/xsimpletext.hxx>
+#include <test/text/xtextrange.hxx>
+#include <test/text/xtextcontent.hxx>
+#include <test/text/xtext.hxx>
+#include <test/text/xfootnote.hxx>
+#include <unotest/macros_test.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XFootnote.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXFootnote.
+ */
+class SwXFootnote final : public test::BootstrapFixture,
+ public unotest::MacrosTest,
+ public apitest::XComponent,
+ public apitest::XSimpleText,
+ public apitest::XTextRange,
+ public apitest::XTextContent,
+ public apitest::XText,
+ public apitest::XFootnote,
+ public apitest::Footnote
+{
+public:
+ virtual void setUp() override;
+ void tearDown() override;
+
+ Reference<XInterface> init() override;
+ Reference<text::XTextRange> getTextRange() override;
+ Reference<text::XTextContent> getTextContent() override;
+ bool isAttachSupported() override { return true; }
+ Reference<text::XTextDocument> getTextDocument() { return mxTextDocument; }
+ void triggerDesktopTerminate() override {}
+
+ CPPUNIT_TEST_SUITE(SwXFootnote);
+ CPPUNIT_TEST(testDispose);
+ CPPUNIT_TEST(testAddEventListener);
+ CPPUNIT_TEST(testRemoveEventListener);
+ CPPUNIT_TEST(testAttach);
+ CPPUNIT_TEST(testGetAnchor);
+ CPPUNIT_TEST(testCreateTextCursor);
+ CPPUNIT_TEST(testCreateTextCursorByRange);
+ CPPUNIT_TEST(testInsertString);
+ CPPUNIT_TEST(testInsertControlCharacter);
+ CPPUNIT_TEST(testGetEnd);
+ CPPUNIT_TEST(testGetSetString);
+ CPPUNIT_TEST(testGetStart);
+ CPPUNIT_TEST(testGetText);
+ CPPUNIT_TEST(testFootnoteProperties);
+ // CPPUNIT_TEST(testInsertRemoveTextContent);
+ CPPUNIT_TEST(testGetSetLabel);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ Reference<text::XTextDocument> mxTextDocument;
+ Reference<text::XTextRange> mxTextRange;
+ Reference<text::XTextContent> mxTextContent;
+};
+
+void SwXFootnote::setUp()
+{
+ test::BootstrapFixture::setUp();
+
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxTextDocument = Reference<text::XTextDocument>(
+ loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument"),
+ uno::UNO_QUERY_THROW);
+ CPPUNIT_ASSERT(mxTextDocument.is());
+}
+
+void SwXFootnote::tearDown()
+{
+ if (mxTextDocument.is())
+ mxTextDocument->dispose();
+
+ test::BootstrapFixture::tearDown();
+}
+
+Reference<XInterface> SwXFootnote::init()
+{
+ Reference<lang::XMultiServiceFactory> xMSF(mxTextDocument, UNO_QUERY_THROW);
+
+ Reference<text::XFootnote> xFootnote(xMSF->createInstance("com.sun.star.text.Footnote"),
+ UNO_QUERY_THROW);
+
+ Reference<text::XText> xText = getTextDocument()->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+
+ xText->insertTextContent(xCursor, xFootnote, false);
+
+ mxTextRange = Reference<text::XTextRange>(xCursor, UNO_QUERY_THROW);
+ mxTextContent = Reference<text::XTextContent>(
+ xMSF->createInstance("com.sun.star.text.Footnote"), UNO_QUERY_THROW);
+
+ return Reference<XInterface>(xFootnote, UNO_QUERY_THROW);
+}
+
+Reference<text::XTextRange> SwXFootnote::getTextRange() { return mxTextRange; }
+
+Reference<text::XTextContent> SwXFootnote::getTextContent() { return mxTextContent; }
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXFootnote);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXFootnoteProperties.cxx b/sw/qa/api/SwXFootnoteProperties.cxx
new file mode 100644
index 0000000000..e716181a55
--- /dev/null
+++ b/sw/qa/api/SwXFootnoteProperties.cxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <test/container/xelementaccess.hxx>
+#include <test/container/xindexaccess.hxx>
+#include <unotest/macros_test.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XFootnote.hpp>
+#include <com/sun/star/text/XFootnotesSupplier.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXFootnoteProperties.
+ */
+class SwXFootnoteProperties final : public test::BootstrapFixture,
+ public unotest::MacrosTest,
+ public apitest::XElementAccess,
+ public apitest::XIndexAccess
+{
+public:
+ SwXFootnoteProperties();
+ virtual void setUp() override;
+ void tearDown() override;
+
+ Reference<XInterface> init() override;
+
+ CPPUNIT_TEST_SUITE(SwXFootnoteProperties);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ uno::Reference<lang::XComponent> component_;
+};
+
+SwXFootnoteProperties::SwXFootnoteProperties()
+ : XElementAccess(cppu::UnoType<text::XFootnote>::get())
+ , XIndexAccess(3)
+{
+}
+
+void SwXFootnoteProperties::setUp()
+{
+ test::BootstrapFixture::setUp();
+ mxDesktop.set(
+ frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory())));
+}
+
+void SwXFootnoteProperties::tearDown()
+{
+ if (component_.is())
+ component_->dispose();
+
+ test::BootstrapFixture::tearDown();
+}
+
+Reference<XInterface> SwXFootnoteProperties::init()
+{
+ component_ = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument");
+ Reference<text::XTextDocument> xTextDocument(component_, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(component_, UNO_QUERY_THROW);
+
+ Reference<text::XFootnote> xFootnote(xMSF->createInstance("com.sun.star.text.Footnote"),
+ UNO_QUERY_THROW);
+
+ Reference<text::XText> xText = xTextDocument->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+
+ xText->insertTextContent(xCursor, xFootnote, false);
+
+ Reference<text::XFootnotesSupplier> xFootnotesSupplier(xTextDocument, UNO_QUERY_THROW);
+
+ return Reference<XInterface>(xFootnotesSupplier->getFootnoteSettings(), UNO_QUERY_THROW);
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXFootnoteProperties);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXFootnoteText.cxx b/sw/qa/api/SwXFootnoteText.cxx
new file mode 100644
index 0000000000..2369729335
--- /dev/null
+++ b/sw/qa/api/SwXFootnoteText.cxx
@@ -0,0 +1,122 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <test/container/xelementaccess.hxx>
+#include <test/text/xsimpletext.hxx>
+#include <test/text/xtextrange.hxx>
+#include <test/text/xtext.hxx>
+#include <test/container/xenumerationaccess.hxx>
+#include <test/text/xtextrangecompare.hxx>
+#include <unotest/macros_test.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XFootnote.hpp>
+#include <com/sun/star/text/XSimpleText.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXFootnoteText.
+ */
+class SwXFootnoteText final : public test::BootstrapFixture,
+ public unotest::MacrosTest,
+ public apitest::XElementAccess,
+ public apitest::XSimpleText,
+ public apitest::XTextRange,
+ public apitest::XText,
+ public apitest::XEnumerationAccess,
+ public apitest::XTextRangeCompare
+{
+public:
+ SwXFootnoteText();
+ virtual void setUp() override;
+ void tearDown() override;
+
+ Reference<XInterface> init() override;
+ Reference<text::XTextContent> getTextContent() override { return mxTextContent; };
+
+ CPPUNIT_TEST_SUITE(SwXFootnoteText);
+ CPPUNIT_TEST(testGetElementType);
+ CPPUNIT_TEST(testHasElements);
+ CPPUNIT_TEST(testCreateTextCursor);
+ CPPUNIT_TEST(testCreateTextCursorByRange);
+ CPPUNIT_TEST(testInsertString);
+ CPPUNIT_TEST(testInsertControlCharacter);
+ CPPUNIT_TEST(testGetEnd);
+ CPPUNIT_TEST(testGetSetString);
+ CPPUNIT_TEST(testGetStart);
+ CPPUNIT_TEST(testGetText);
+ // CPPUNIT_TEST(testInsertRemoveTextContent);
+ CPPUNIT_TEST(testCreateEnumeration);
+ CPPUNIT_TEST(testCompareRegionStarts);
+ CPPUNIT_TEST(testCompareRegionEnds);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ Reference<lang::XComponent> component_;
+ Reference<text::XTextContent> mxTextContent;
+};
+
+SwXFootnoteText::SwXFootnoteText()
+ : XElementAccess(cppu::UnoType<text::XTextRange>::get())
+{
+}
+
+void SwXFootnoteText::setUp()
+{
+ test::BootstrapFixture::setUp();
+ mxDesktop.set(
+ frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory())));
+}
+
+void SwXFootnoteText::tearDown()
+{
+ if (component_.is())
+ component_->dispose();
+
+ test::BootstrapFixture::tearDown();
+}
+
+Reference<XInterface> SwXFootnoteText::init()
+{
+ component_ = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument");
+ Reference<text::XTextDocument> xTextDocument(component_, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(component_, UNO_QUERY_THROW);
+
+ Reference<text::XFootnote> xFootnote(xMSF->createInstance("com.sun.star.text.Footnote"),
+ UNO_QUERY_THROW);
+
+ Reference<text::XText> xText = xTextDocument->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+
+ xText->insertTextContent(xCursor, xFootnote, false);
+
+ Reference<text::XSimpleText> xFootText(xFootnote, UNO_QUERY_THROW);
+ xFootText->setString("SwXFootnoteText");
+ mxTextContent = Reference<text::XTextContent>(
+ xMSF->createInstance("com.sun.star.text.Footnote"), UNO_QUERY_THROW);
+
+ return Reference<XInterface>(xFootText->getText(), UNO_QUERY_THROW);
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXFootnoteText);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXFootnotes.cxx b/sw/qa/api/SwXFootnotes.cxx
new file mode 100644
index 0000000000..c04e2be384
--- /dev/null
+++ b/sw/qa/api/SwXFootnotes.cxx
@@ -0,0 +1,82 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/container/xelementaccess.hxx>
+#include <test/container/xindexaccess.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XFootnote.hpp>
+#include <com/sun/star/text/XFootnotesSupplier.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXFootnotes.
+ */
+class SwXFootnotes final : public UnoApiTest,
+ public apitest::XElementAccess,
+ public apitest::XIndexAccess
+{
+public:
+ SwXFootnotes()
+ : UnoApiTest("")
+ , XElementAccess(cppu::UnoType<text::XFootnote>::get())
+ , XIndexAccess(1)
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(mxComponent, UNO_QUERY_THROW);
+
+ Reference<text::XFootnote> xFootnote(xMSF->createInstance("com.sun.star.text.Footnote"),
+ UNO_QUERY_THROW);
+
+ Reference<text::XText> xText = xTextDocument->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+
+ xText->insertTextContent(xCursor, xFootnote, false);
+
+ Reference<text::XFootnotesSupplier> xSupplier(xTextDocument, UNO_QUERY_THROW);
+
+ return Reference<XInterface>(xSupplier->getFootnotes(), UNO_QUERY_THROW);
+ }
+
+ CPPUNIT_TEST_SUITE(SwXFootnotes);
+ CPPUNIT_TEST(testGetElementType);
+ CPPUNIT_TEST(testHasElements);
+ CPPUNIT_TEST(testGetCount);
+ CPPUNIT_TEST(testGetByIndex);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXFootnotes);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXFrames.cxx b/sw/qa/api/SwXFrames.cxx
new file mode 100644
index 0000000000..18bc2e2047
--- /dev/null
+++ b/sw/qa/api/SwXFrames.cxx
@@ -0,0 +1,90 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/container/xelementaccess.hxx>
+#include <test/container/xindexaccess.hxx>
+#include <test/container/xnameaccess.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextFrame.hpp>
+#include <com/sun/star/text/XTextFramesSupplier.hpp>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXFramesText.
+ */
+class SwXFramesText final : public UnoApiTest,
+ public apitest::XElementAccess,
+ public apitest::XIndexAccess,
+ public apitest::XNameAccess
+{
+public:
+ SwXFramesText()
+ : UnoApiTest("")
+ , XElementAccess(cppu::UnoType<text::XTextFrame>::get())
+ , XIndexAccess(1)
+ , XNameAccess("Frame1")
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(mxComponent, UNO_QUERY_THROW);
+
+ Reference<text::XTextFrame> xTextFrame(xMSF->createInstance("com.sun.star.text.TextFrame"),
+ UNO_QUERY_THROW);
+
+ Reference<text::XText> xText = xTextDocument->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+
+ xText->insertTextContent(xCursor, xTextFrame, false);
+
+ Reference<text::XTextFramesSupplier> xSupplier(xTextDocument, UNO_QUERY_THROW);
+
+ // Reference<container::XNameAccess> xNA = xSupplier->getTextFrames();
+ // Sequence<OUString> aNames = xNA->getElementNames();
+ // std::cout << aNames[0] << std::endl;
+
+ return Reference<XInterface>(xSupplier->getTextFrames(), UNO_QUERY_THROW);
+ }
+
+ CPPUNIT_TEST_SUITE(SwXFramesText);
+ CPPUNIT_TEST(testGetByName);
+ CPPUNIT_TEST(testGetElementNames);
+ CPPUNIT_TEST(testHasByName);
+ CPPUNIT_TEST(testGetElementType);
+ CPPUNIT_TEST(testHasElements);
+ CPPUNIT_TEST(testGetCount);
+ CPPUNIT_TEST(testGetByIndex);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXFramesText);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXHeadFootText.cxx b/sw/qa/api/SwXHeadFootText.cxx
new file mode 100644
index 0000000000..b3769ccc58
--- /dev/null
+++ b/sw/qa/api/SwXHeadFootText.cxx
@@ -0,0 +1,124 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <test/container/xelementaccess.hxx>
+#include <test/text/xsimpletext.hxx>
+#include <test/text/xtextrange.hxx>
+#include <test/text/xtext.hxx>
+#include <test/container/xenumerationaccess.hxx>
+#include <test/text/xtextrangecompare.hxx>
+#include <unotest/macros_test.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/style/XStyle.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXHeadFootText.
+ */
+class SwXHeadFootText final : public test::BootstrapFixture,
+ public unotest::MacrosTest,
+ public apitest::XElementAccess,
+ public apitest::XSimpleText,
+ public apitest::XTextRange,
+ public apitest::XText,
+ public apitest::XEnumerationAccess,
+ public apitest::XTextRangeCompare
+{
+public:
+ SwXHeadFootText();
+ virtual void setUp() override;
+ void tearDown() override;
+
+ Reference<XInterface> init() override;
+ Reference<text::XTextContent> getTextContent() override { return mxTextContent; };
+
+ CPPUNIT_TEST_SUITE(SwXHeadFootText);
+ CPPUNIT_TEST(testGetElementType);
+ CPPUNIT_TEST(testHasElements);
+ CPPUNIT_TEST(testCreateTextCursor);
+ CPPUNIT_TEST(testCreateTextCursorByRange);
+ CPPUNIT_TEST(testInsertString);
+ CPPUNIT_TEST(testInsertControlCharacter);
+ CPPUNIT_TEST(testGetEnd);
+ CPPUNIT_TEST(testGetSetString);
+ CPPUNIT_TEST(testGetStart);
+ CPPUNIT_TEST(testGetText);
+ // CPPUNIT_TEST(testInsertRemoveTextContent);
+ CPPUNIT_TEST(testCreateEnumeration);
+ CPPUNIT_TEST(testCompareRegionStarts);
+ CPPUNIT_TEST(testCompareRegionEnds);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ Reference<lang::XComponent> component_;
+ Reference<text::XTextContent> mxTextContent;
+};
+
+SwXHeadFootText::SwXHeadFootText()
+ : XElementAccess(cppu::UnoType<text::XTextRange>::get())
+{
+}
+
+void SwXHeadFootText::setUp()
+{
+ test::BootstrapFixture::setUp();
+ mxDesktop.set(
+ frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory())));
+}
+
+void SwXHeadFootText::tearDown()
+{
+ if (component_.is())
+ component_->dispose();
+
+ test::BootstrapFixture::tearDown();
+}
+
+Reference<XInterface> SwXHeadFootText::init()
+{
+ component_ = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument");
+ Reference<text::XTextDocument> xTextDocument(component_, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(component_, UNO_QUERY_THROW);
+
+ Reference<style::XStyleFamiliesSupplier> xStyleFam(xTextDocument, UNO_QUERY_THROW);
+ Reference<container::XNameAccess> xStyleFamNames = xStyleFam->getStyleFamilies();
+
+ Reference<container::XNameAccess> xPageStyles(xStyleFamNames->getByName("PageStyles"),
+ UNO_QUERY_THROW);
+ Reference<style::XStyle> xStyle(xPageStyles->getByName("Standard"), UNO_QUERY_THROW);
+
+ Reference<beans::XPropertySet> xPropSet(xStyle, UNO_QUERY_THROW);
+
+ xPropSet->setPropertyValue("HeaderIsOn", uno::Any(true));
+ xPropSet->setPropertyValue("FooterIsOn", uno::Any(true));
+ Reference<text::XText> xText(xPropSet->getPropertyValue("HeaderText"), UNO_QUERY_THROW);
+
+ return Reference<XInterface>(xText, UNO_QUERY_THROW);
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXHeadFootText);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXNumberingRules.cxx b/sw/qa/api/SwXNumberingRules.cxx
new file mode 100644
index 0000000000..41fb3395aa
--- /dev/null
+++ b/sw/qa/api/SwXNumberingRules.cxx
@@ -0,0 +1,137 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/container/xelementaccess.hxx>
+#include <test/beans/xpropertyset.hxx>
+#include <test/container/xindexaccess.hxx>
+#include <test/text/numberingrules.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/text/ControlCharacter.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/lang/IndexOutOfBoundsException.hpp>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXNumberingRules.
+ */
+class SwXNumberingRules final : public UnoApiTest,
+ public apitest::XElementAccess,
+ public apitest::XIndexAccess,
+ public apitest::XPropertySet,
+ public apitest::NumberingRules
+{
+public:
+ SwXNumberingRules()
+ : UnoApiTest("")
+ , XElementAccess(cppu::UnoType<Sequence<beans::PropertyValue>>::get())
+ , XIndexAccess(10)
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW);
+
+ Reference<container::XIndexAccess> xIndexAccess;
+ Reference<container::XIndexAccess> xNumRules;
+
+ Reference<text::XText> xText = xTextDocument->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+
+ try
+ {
+ xText->insertString(xCursor, "The quick brown fox jumps over the lazy dog", false);
+ xText->insertControlCharacter(xCursor, text::ControlCharacter::PARAGRAPH_BREAK, false);
+ }
+ catch (lang::IllegalArgumentException&)
+ {
+ }
+
+ Reference<style::XStyleFamiliesSupplier> xStyleFam(xTextDocument, UNO_QUERY_THROW);
+
+ try
+ {
+ Reference<container::XNameAccess> xStyleFamNames = xStyleFam->getStyleFamilies();
+ Reference<container::XNameContainer> xNumStyles(
+ xStyleFamNames->getByName("NumberingStyles"), UNO_QUERY_THROW);
+ xIndexAccess = Reference<container::XIndexAccess>(xNumStyles, UNO_QUERY_THROW);
+ }
+ catch (lang::WrappedTargetException&)
+ {
+ }
+ catch (container::NoSuchElementException&)
+ {
+ }
+ catch (lang::IllegalArgumentException&)
+ {
+ }
+
+ try
+ {
+ Reference<beans::XPropertySet> xPropSet(xIndexAccess->getByIndex(0), UNO_QUERY_THROW);
+ xNumRules = Reference<container::XIndexAccess>(
+ xPropSet->getPropertyValue("NumberingRules"), UNO_QUERY_THROW);
+ }
+ catch (lang::WrappedTargetException&)
+ {
+ }
+ catch (lang::IndexOutOfBoundsException&)
+ {
+ }
+ catch (beans::UnknownPropertyException&)
+ {
+ }
+ catch (lang::IllegalArgumentException&)
+ {
+ }
+
+ return Reference<XInterface>(xNumRules, UNO_QUERY_THROW);
+ }
+
+ CPPUNIT_TEST_SUITE(SwXNumberingRules);
+ CPPUNIT_TEST(testGetElementType);
+ CPPUNIT_TEST(testHasElements);
+ CPPUNIT_TEST(testGetCount);
+ CPPUNIT_TEST(testGetByIndex);
+ CPPUNIT_TEST(testGetPropertySetInfo);
+ CPPUNIT_TEST(testSetPropertyValue);
+ CPPUNIT_TEST(testGetPropertyValue);
+ CPPUNIT_TEST(testPropertyChangeListener);
+ CPPUNIT_TEST(testVetoableChangeListener);
+ CPPUNIT_TEST(testNumberingRulesProperties);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXNumberingRules);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXParagraphEnumeration.cxx b/sw/qa/api/SwXParagraphEnumeration.cxx
new file mode 100644
index 0000000000..7e7ddd6d18
--- /dev/null
+++ b/sw/qa/api/SwXParagraphEnumeration.cxx
@@ -0,0 +1,96 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/container/xenumeration.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/container/XEnumeration.hpp>
+#include <com/sun/star/container/XEnumerationAccess.hpp>
+#include <com/sun/star/text/ControlCharacter.hpp>
+#include <com/sun/star/lang/IllegalArgumentException.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXParagraphEnumeration.
+ */
+class SwXParagraphEnumeration final : public UnoApiTest, public apitest::XEnumeration
+{
+public:
+ SwXParagraphEnumeration()
+ : UnoApiTest("")
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(mxComponent, UNO_QUERY_THROW);
+
+ Reference<text::XText> xText = xTextDocument->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+
+ for (int i = 0; i < 5; i++)
+ {
+ try
+ {
+ xText->insertString(xCursor, "The quick brown fox jumps over the lazy dog", false);
+ xText->insertControlCharacter(xCursor, text::ControlCharacter::LINE_BREAK, false);
+ xText->insertString(xCursor, "THE QUICK BROWN FOX JUMPS OVER THE LAZY DOG", false);
+ xText->insertControlCharacter(xCursor, text::ControlCharacter::LINE_BREAK, false);
+ }
+ catch (lang::IllegalArgumentException&)
+ {
+ }
+
+ try
+ {
+ xText->insertControlCharacter(xCursor, text::ControlCharacter::PARAGRAPH_BREAK,
+ false);
+ }
+ catch (lang::IllegalArgumentException&)
+ {
+ }
+ }
+
+ Reference<container::XEnumerationAccess> xEnumAccess(xText, UNO_QUERY_THROW);
+ Reference<container::XEnumeration> xEnum = xEnumAccess->createEnumeration();
+
+ return Reference<XInterface>(xEnum, UNO_QUERY_THROW);
+ }
+
+ CPPUNIT_TEST_SUITE(SwXParagraphEnumeration);
+ CPPUNIT_TEST(testHasMoreElements);
+ CPPUNIT_TEST(testNextElement);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXParagraphEnumeration);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXReferenceMark.cxx b/sw/qa/api/SwXReferenceMark.cxx
new file mode 100644
index 0000000000..bf7b14dc80
--- /dev/null
+++ b/sw/qa/api/SwXReferenceMark.cxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/lang/xcomponent.hxx>
+#include <test/text/xtextcontent.hxx>
+#include <test/container/xnamed.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXReferenceMark.
+ */
+class SwXReferenceMark final : public UnoApiTest,
+ public apitest::XComponent,
+ public apitest::XTextContent,
+ public apitest::XNamed
+
+{
+public:
+ SwXReferenceMark()
+ : UnoApiTest("")
+ , XNamed("SwXReferenceMark")
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(mxComponent, UNO_QUERY_THROW);
+
+ Reference<text::XText> xText = xTextDocument->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+
+ Reference<XInterface> xRefMark = xMSF->createInstance("com.sun.star.text.ReferenceMark");
+ Reference<container::XNamed> xNamed(xRefMark, UNO_QUERY_THROW);
+ xNamed->setName("SwXReferenceMark");
+
+ Reference<text::XTextContent> xTextContent(xRefMark, UNO_QUERY_THROW);
+ xText->insertTextContent(xCursor, xTextContent, false);
+
+ mxTextRange = Reference<text::XTextRange>(xCursor, uno::UNO_QUERY_THROW);
+ mxTextContent = Reference<text::XTextContent>(
+ xMSF->createInstance("com.sun.star.text.ReferenceMark"), UNO_QUERY_THROW);
+
+ return xRefMark;
+ }
+
+ Reference<text::XTextRange> getTextRange() override { return mxTextRange; };
+ Reference<text::XTextContent> getTextContent() override { return mxTextContent; };
+ bool isAttachSupported() override { return true; }
+ void triggerDesktopTerminate() override { mxDesktop->terminate(); };
+
+ CPPUNIT_TEST_SUITE(SwXReferenceMark);
+ CPPUNIT_TEST(testAttach);
+ CPPUNIT_TEST(testGetAnchor);
+ CPPUNIT_TEST(testDispose);
+ CPPUNIT_TEST(testAddEventListener);
+ CPPUNIT_TEST(testRemoveEventListener);
+ CPPUNIT_TEST(testGetName);
+ CPPUNIT_TEST(testSetName);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ Reference<text::XTextRange> mxTextRange;
+ Reference<text::XTextContent> mxTextContent;
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXReferenceMark);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXReferenceMarks.cxx b/sw/qa/api/SwXReferenceMarks.cxx
new file mode 100644
index 0000000000..1420a0468a
--- /dev/null
+++ b/sw/qa/api/SwXReferenceMarks.cxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/container/xelementaccess.hxx>
+#include <test/container/xindexaccess.hxx>
+#include <test/container/xnameaccess.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/container/XNamed.hpp>
+#include <com/sun/star/text/XReferenceMarksSupplier.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXReferenceMarks.
+ */
+class SwXReferenceMarks final : public UnoApiTest,
+ public apitest::XElementAccess,
+ public apitest::XIndexAccess,
+ public apitest::XNameAccess
+{
+public:
+ SwXReferenceMarks()
+ : UnoApiTest("")
+ , XElementAccess(cppu::UnoType<text::XTextContent>::get())
+ , XIndexAccess(2)
+ , XNameAccess("SwXReferenceMarks2")
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(xTextDocument, UNO_QUERY_THROW);
+
+ Reference<text::XText> xText = xTextDocument->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+
+ //RefMark 1
+ Reference<XInterface> xRefMark1 = xMSF->createInstance("com.sun.star.text.ReferenceMark");
+ Reference<container::XNamed> xNamed1(xRefMark1, UNO_QUERY_THROW);
+ xNamed1->setName("SwXReferenceMarks1");
+
+ Reference<text::XTextContent> xTextContent1(xRefMark1, UNO_QUERY_THROW);
+ xText->insertTextContent(xCursor, xTextContent1, false);
+
+ //RefMark 2
+ Reference<XInterface> xRefMark2 = xMSF->createInstance("com.sun.star.text.ReferenceMark");
+ Reference<container::XNamed> xNamed2(xRefMark2, UNO_QUERY_THROW);
+ xNamed2->setName("SwXReferenceMarks2");
+
+ Reference<text::XTextContent> xTextContent2(xRefMark2, UNO_QUERY_THROW);
+ xText->insertTextContent(xCursor, xTextContent2, false);
+
+ // Getting ReferenceMarks from Text Document
+ Reference<text::XReferenceMarksSupplier> xRefMarkSupp(xTextDocument, UNO_QUERY_THROW);
+
+ return Reference<XInterface>(xRefMarkSupp->getReferenceMarks(), UNO_QUERY_THROW);
+ }
+
+ CPPUNIT_TEST_SUITE(SwXReferenceMarks);
+ CPPUNIT_TEST(testGetElementType);
+ CPPUNIT_TEST(testHasElements);
+ CPPUNIT_TEST(testGetCount);
+ CPPUNIT_TEST(testGetByIndex);
+ CPPUNIT_TEST(testGetByName);
+ CPPUNIT_TEST(testGetElementNames);
+ CPPUNIT_TEST(testHasByName);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXReferenceMarks);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXStyleFamilies.cxx b/sw/qa/api/SwXStyleFamilies.cxx
new file mode 100644
index 0000000000..6cc1430ac5
--- /dev/null
+++ b/sw/qa/api/SwXStyleFamilies.cxx
@@ -0,0 +1,81 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/container/xelementaccess.hxx>
+#include <test/container/xindexaccess.hxx>
+#include <test/container/xnameaccess.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
+#include <com/sun/star/container/XIndexAccess.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXStyleFamilies.
+ */
+class SwXStyleFamilies final : public UnoApiTest,
+ public apitest::XElementAccess,
+ public apitest::XIndexAccess,
+ public apitest::XNameAccess
+
+{
+public:
+ SwXStyleFamilies()
+ : UnoApiTest("")
+ , XElementAccess(cppu::UnoType<container::XNameContainer>::get())
+ , XIndexAccess(7)
+ , XNameAccess("CharacterStyles")
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(mxComponent, UNO_QUERY_THROW);
+
+ Reference<style::XStyleFamiliesSupplier> xStyleFamSupp(xTextDocument, UNO_QUERY_THROW);
+ Reference<container::XNameAccess> xSF = xStyleFamSupp->getStyleFamilies();
+
+ return Reference<XInterface>(xSF, UNO_QUERY_THROW);
+ }
+
+ CPPUNIT_TEST_SUITE(SwXStyleFamilies);
+ CPPUNIT_TEST(testGetElementType);
+ CPPUNIT_TEST(testHasElements);
+ CPPUNIT_TEST(testGetCount);
+ CPPUNIT_TEST(testGetByIndex);
+ CPPUNIT_TEST(testGetByName);
+ CPPUNIT_TEST(testGetElementNames);
+ CPPUNIT_TEST(testHasByName);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXStyleFamilies);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXTableCellText.cxx b/sw/qa/api/SwXTableCellText.cxx
new file mode 100644
index 0000000000..733ba36415
--- /dev/null
+++ b/sw/qa/api/SwXTableCellText.cxx
@@ -0,0 +1,103 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/container/xenumerationaccess.hxx>
+#include <test/container/xelementaccess.hxx>
+#include <test/text/xsimpletext.hxx>
+#include <test/text/xtextrange.hxx>
+#include <test/text/xtext.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/table/XCell.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/text/XSimpleText.hpp>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXTableCellText.
+ */
+class SwXTableCellText final : public UnoApiTest,
+ public apitest::XEnumerationAccess,
+ public apitest::XElementAccess,
+ public apitest::XSimpleText,
+ public apitest::XTextRange,
+ public apitest::XText
+{
+public:
+ SwXTableCellText()
+ : UnoApiTest("")
+ , XElementAccess(cppu::UnoType<text::XTextRange>::get())
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(mxComponent, UNO_QUERY_THROW);
+
+ Reference<text::XText> xText = xTextDocument->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+
+ Reference<text::XTextTable> xTable(xMSF->createInstance("com.sun.star.text.TextTable"),
+ UNO_QUERY_THROW);
+ xText->insertTextContent(xCursor, xTable, false);
+
+ Reference<table::XCell> xCell = xTable->getCellByName("A1");
+ Reference<text::XSimpleText> xCellText(xCell, UNO_QUERY_THROW);
+ xCellText->setString("SwXTableCellText");
+
+ mxTextContent = Reference<text::XTextContent>(
+ xMSF->createInstance("com.sun.star.text.TextTable"), UNO_QUERY_THROW);
+
+ return Reference<XInterface>(xCellText->getText(), UNO_QUERY_THROW);
+ }
+
+ Reference<text::XTextContent> getTextContent() override { return mxTextContent; };
+
+ CPPUNIT_TEST_SUITE(SwXTableCellText);
+ CPPUNIT_TEST(testCreateEnumeration);
+ CPPUNIT_TEST(testGetElementType);
+ CPPUNIT_TEST(testHasElements);
+ CPPUNIT_TEST(testCreateTextCursor);
+ CPPUNIT_TEST(testCreateTextCursorByRange);
+ CPPUNIT_TEST(testInsertString);
+ CPPUNIT_TEST(testInsertControlCharacter);
+ CPPUNIT_TEST(testGetEnd);
+ CPPUNIT_TEST(testGetSetString);
+ CPPUNIT_TEST(testGetStart);
+ CPPUNIT_TEST(testGetText);
+ CPPUNIT_TEST(testInsertRemoveTextContent);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ Reference<text::XTextContent> mxTextContent;
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXTableCellText);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXTextEmbeddedObjects.cxx b/sw/qa/api/SwXTextEmbeddedObjects.cxx
new file mode 100644
index 0000000000..4e8a19a702
--- /dev/null
+++ b/sw/qa/api/SwXTextEmbeddedObjects.cxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/container/xnameaccess.hxx>
+#include <test/container/xindexaccess.hxx>
+#include <test/container/xelementaccess.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XTextEmbeddedObjectsSupplier.hpp>
+#include <com/sun/star/document/XEmbeddedObjectSupplier.hpp>
+#include <com/sun/star/text/XTextFrame.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXTextEmbeddedObjects.
+ */
+class SwXTextEmbeddedObjects final : public UnoApiTest,
+ public apitest::XElementAccess,
+ public apitest::XIndexAccess,
+ public apitest::XNameAccess
+{
+public:
+ SwXTextEmbeddedObjects()
+ : UnoApiTest("")
+ , XElementAccess(cppu::UnoType<document::XEmbeddedObjectSupplier>::get())
+ , XIndexAccess(1)
+ , XNameAccess("Object1")
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(mxComponent, UNO_QUERY_THROW);
+
+ Reference<text::XText> xText = xTextDocument->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+
+ try
+ {
+ Reference<text::XTextContent> xTextContent(
+ xMSF->createInstance("com.sun.star.text.TextEmbeddedObject"), UNO_QUERY_THROW);
+ Reference<beans::XPropertySet> xPropertySet(xTextContent, UNO_QUERY_THROW);
+ xPropertySet->setPropertyValue("CLSID",
+ Any(OUString("12dcae26-281f-416f-a234-c3086127382e")));
+
+ xText->insertTextContent(xCursor, xTextContent, false);
+ }
+ catch (Exception&)
+ {
+ }
+
+ Reference<text::XTextEmbeddedObjectsSupplier> xTEOSupp(xTextDocument, UNO_QUERY_THROW);
+
+ return Reference<XInterface>(xTEOSupp->getEmbeddedObjects(), UNO_QUERY_THROW);
+ }
+
+ CPPUNIT_TEST_SUITE(SwXTextEmbeddedObjects);
+ CPPUNIT_TEST(testGetByName);
+ CPPUNIT_TEST(testGetElementNames);
+ CPPUNIT_TEST(testHasByName);
+ CPPUNIT_TEST(testGetCount);
+ CPPUNIT_TEST(testGetByIndex);
+ CPPUNIT_TEST(testGetElementType);
+ CPPUNIT_TEST(testHasElements);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXTextEmbeddedObjects);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXTextField.cxx b/sw/qa/api/SwXTextField.cxx
new file mode 100644
index 0000000000..e22ab89e47
--- /dev/null
+++ b/sw/qa/api/SwXTextField.cxx
@@ -0,0 +1,112 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/beans/xpropertyset.hxx>
+#include <test/lang/xcomponent.hxx>
+#include <test/text/textcontent.hxx>
+#include <test/text/xtextcontent.hxx>
+#include <test/text/xtextfield.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/beans/XPropertySet.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XDependentTextField.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXTextField.
+ */
+struct SwXTextField final : public UnoApiTest,
+ public apitest::XPropertySet,
+ public apitest::XComponent,
+ public apitest::TextContent,
+ public apitest::XTextContent,
+ public apitest::XTextField
+{
+ SwXTextField()
+ : UnoApiTest("")
+ , TextContent(text::TextContentAnchorType_AS_CHARACTER,
+ text::TextContentAnchorType_AS_CHARACTER, text::WrapTextMode_NONE,
+ text::WrapTextMode_NONE)
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(mxComponent, UNO_QUERY_THROW);
+
+ Reference<beans::XPropertySet> xFieldMaster(
+ xMSF->createInstance("com.sun.star.text.FieldMaster.Database"), UNO_QUERY_THROW);
+
+ xFieldMaster->setPropertyValue("DataBaseName", Any(OUString("Address Book File")));
+ xFieldMaster->setPropertyValue("DataTableName", Any(OUString("address")));
+ xFieldMaster->setPropertyValue("DataColumnName", Any(OUString("FIRSTNAME")));
+
+ Reference<text::XDependentTextField> xField(
+ xMSF->createInstance("com.sun.star.text.TextField.Database"), UNO_QUERY_THROW);
+ xField->attachTextFieldMaster(xFieldMaster);
+
+ Reference<text::XText> xText = xTextDocument->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+ Reference<text::XTextContent> xFieldAsContent(xField, UNO_QUERY_THROW);
+ xText->insertTextContent(xCursor, xFieldAsContent, false);
+
+ mxTextRange = Reference<text::XTextRange>(xCursor, UNO_QUERY_THROW);
+ mxTextContent = Reference<text::XTextContent>(
+ xMSF->createInstance("com.sun.star.text.TextField.DateTime"), UNO_QUERY_THROW);
+
+ return Reference<XInterface>(xField, UNO_QUERY_THROW);
+ }
+
+ void triggerDesktopTerminate() override { mxDesktop->terminate(); };
+ bool isAttachSupported() override { return true; };
+ Reference<text::XTextRange> getTextRange() override { return mxTextRange; };
+ Reference<text::XTextContent> getTextContent() override { return mxTextContent; };
+
+ CPPUNIT_TEST_SUITE(SwXTextField);
+ CPPUNIT_TEST(testDispose);
+ CPPUNIT_TEST(testAddEventListener);
+ CPPUNIT_TEST(testRemoveEventListener);
+ CPPUNIT_TEST(testTextContentProperties);
+ CPPUNIT_TEST(testAttach);
+ CPPUNIT_TEST(testGetAnchor);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ Reference<text::XTextRange> mxTextRange;
+ Reference<text::XTextContent> mxTextContent;
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXTextField);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXTextFieldMasters.cxx b/sw/qa/api/SwXTextFieldMasters.cxx
new file mode 100644
index 0000000000..a5d5042dcf
--- /dev/null
+++ b/sw/qa/api/SwXTextFieldMasters.cxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/container/xnameaccess.hxx>
+#include <test/container/xelementaccess.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XTextFieldsSupplier.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+// #include <com/sun/star/container/XNameAccess.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXTextFieldMasters.
+ */
+class SwXTextFieldMasters final : public UnoApiTest,
+ public apitest::XElementAccess,
+ public apitest::XNameAccess
+{
+public:
+ SwXTextFieldMasters()
+ : UnoApiTest("")
+ , XElementAccess(cppu::UnoType<beans::XPropertySet>::get())
+ , XNameAccess("com.sun.star.text.fieldmaster.SetExpression.Illustration")
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW);
+
+ Reference<text::XTextFieldsSupplier> xTFS;
+
+ try
+ {
+ xTFS = Reference<text::XTextFieldsSupplier>(xTextDocument, UNO_QUERY_THROW);
+ }
+ catch (Exception&)
+ {
+ }
+
+ // Reference<container::XNameAccess> xNA = xTFS->getTextFieldMasters();
+ // Sequence<OUString> aNames = xNA->getElementNames();
+ // std::cout << aNames[0] << std::endl;
+
+ return Reference<XInterface>(xTFS->getTextFieldMasters(), UNO_QUERY_THROW);
+ }
+
+ CPPUNIT_TEST_SUITE(SwXTextFieldMasters);
+ CPPUNIT_TEST(testGetByName);
+ CPPUNIT_TEST(testGetElementNames);
+ CPPUNIT_TEST(testHasByName);
+ CPPUNIT_TEST(testGetElementType);
+ CPPUNIT_TEST(testHasElements);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXTextFieldMasters);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXTextFieldTypes.cxx b/sw/qa/api/SwXTextFieldTypes.cxx
new file mode 100644
index 0000000000..1a99606c87
--- /dev/null
+++ b/sw/qa/api/SwXTextFieldTypes.cxx
@@ -0,0 +1,85 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/container/xelementaccess.hxx>
+#include <test/container/xenumerationaccess.hxx>
+#include <test/util/xrefreshable.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XTextFieldsSupplier.hpp>
+#include <com/sun/star/text/XDependentTextField.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXTextFieldTypes.
+ */
+class SwXTextFieldTypes final : public UnoApiTest,
+ public apitest::XElementAccess,
+ public apitest::XEnumerationAccess,
+ public apitest::XRefreshable
+{
+public:
+ SwXTextFieldTypes()
+ : UnoApiTest("")
+ , XElementAccess(cppu::UnoType<text::XDependentTextField>::get())
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ component_ = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument");
+ Reference<text::XTextDocument> xTextDocument(component_, UNO_QUERY_THROW);
+
+ Reference<text::XTextFieldsSupplier> xTFS;
+
+ try
+ {
+ xTFS = Reference<text::XTextFieldsSupplier>(xTextDocument, UNO_QUERY_THROW);
+ }
+ catch (Exception&)
+ {
+ }
+
+ return Reference<XInterface>(xTFS->getTextFields(), UNO_QUERY_THROW);
+ }
+
+ CPPUNIT_TEST_SUITE(SwXTextFieldTypes);
+ CPPUNIT_TEST(testGetElementType);
+ CPPUNIT_TEST(testHasElements);
+ CPPUNIT_TEST(testCreateEnumeration);
+ CPPUNIT_TEST(testRefreshListener);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ Reference<lang::XComponent> component_;
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXTextFieldTypes);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXTextFrame.cxx b/sw/qa/api/SwXTextFrame.cxx
new file mode 100644
index 0000000000..5f356fdbfb
--- /dev/null
+++ b/sw/qa/api/SwXTextFrame.cxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/lang/xserviceinfo.hxx>
+#include <test/lang/xcomponent.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/text/XTextFrame.hpp>
+
+using namespace css;
+
+namespace
+{
+/**
+ * Test for Java API test of file com.sun.star.comp.office.SwXTextFrame.csv
+ */
+class SwXTextFrame final : public UnoApiTest,
+ public apitest::XServiceInfo,
+ public apitest::XComponent
+{
+public:
+ SwXTextFrame()
+ : UnoApiTest("")
+ , apitest::XServiceInfo("SwXTextFrame", "com.sun.star.text.TextFrame")
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ uno::Reference<uno::XInterface> init() override
+ {
+ uno::Reference<lang::XMultiServiceFactory> xMSF(mxComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<text::XTextDocument> xTextDocument(mxComponent, uno::UNO_QUERY_THROW);
+ uno::Reference<text::XTextFrame> xTextFrame(
+ xMSF->createInstance("com.sun.star.text.TextFrame"), uno::UNO_QUERY_THROW);
+ auto xText = xTextDocument->getText();
+ auto xTextCursor = xText->createTextCursor();
+ CPPUNIT_ASSERT(xTextCursor.is());
+ xText->insertTextContent(xTextCursor, xTextFrame, false);
+ xTextCursor->gotoEnd(false);
+ return xTextFrame;
+ }
+
+ void triggerDesktopTerminate() override { mxDesktop->terminate(); }
+
+ CPPUNIT_TEST_SUITE(SwXTextFrame);
+ CPPUNIT_TEST(testGetImplementationName);
+ CPPUNIT_TEST(testGetSupportedServiceNames);
+ CPPUNIT_TEST(testSupportsService);
+ CPPUNIT_TEST(testAddEventListener);
+ CPPUNIT_TEST(testRemoveEventListener);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXTextFrame);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXTextSections.cxx b/sw/qa/api/SwXTextSections.cxx
new file mode 100644
index 0000000000..0e957ad911
--- /dev/null
+++ b/sw/qa/api/SwXTextSections.cxx
@@ -0,0 +1,100 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/container/xnameaccess.hxx>
+#include <test/container/xindexaccess.hxx>
+#include <test/container/xelementaccess.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/container/XNameAccess.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextContent.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XTextSection.hpp>
+#include <com/sun/star/text/XTextSectionsSupplier.hpp>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXTextSections.
+ */
+class SwXTextSections final : public UnoApiTest,
+ public apitest::XElementAccess,
+ public apitest::XIndexAccess,
+ public apitest::XNameAccess
+{
+public:
+ SwXTextSections()
+ : UnoApiTest("")
+ , XElementAccess(cppu::UnoType<text::XTextSection>::get())
+ , XIndexAccess(2)
+ , XNameAccess("TextSection")
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(mxComponent, UNO_QUERY_THROW);
+
+ Reference<text::XText> xText = xTextDocument->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+
+ Reference<text::XTextContent> xContent(
+ xMSF->createInstance("com.sun.star.text.TextSection"), UNO_QUERY_THROW);
+ xText->insertTextContent(xCursor, xContent, false);
+
+ Reference<text::XTextContent> xContent2(
+ xMSF->createInstance("com.sun.star.text.TextSection"), UNO_QUERY_THROW);
+ xText->insertTextContent(xCursor, xContent2, false);
+
+ Reference<container::XNameAccess> xNameAccess;
+ try
+ {
+ Reference<text::XTextSectionsSupplier> xSupplier(xTextDocument, UNO_QUERY_THROW);
+ xNameAccess = xSupplier->getTextSections();
+ }
+ catch (Exception&)
+ {
+ }
+
+ return Reference<XInterface>(xNameAccess, UNO_QUERY_THROW);
+ }
+
+ CPPUNIT_TEST_SUITE(SwXTextSections);
+ CPPUNIT_TEST(testGetByName);
+ CPPUNIT_TEST(testGetElementNames);
+ CPPUNIT_TEST(testHasByName);
+ CPPUNIT_TEST(testGetCount);
+ CPPUNIT_TEST(testGetByIndex);
+ CPPUNIT_TEST(testGetElementType);
+ CPPUNIT_TEST(testHasElements);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXTextSections);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXTextTable.cxx b/sw/qa/api/SwXTextTable.cxx
new file mode 100644
index 0000000000..229583ebcf
--- /dev/null
+++ b/sw/qa/api/SwXTextTable.cxx
@@ -0,0 +1,86 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/bootstrapfixture.hxx>
+#include <test/lang/xcomponent.hxx>
+#include <unotest/macros_test.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXTextTable.
+ */
+struct SwXTextTable final : public test::BootstrapFixture,
+ public unotest::MacrosTest,
+ public apitest::XComponent
+{
+ virtual void setUp() override;
+ void tearDown() override;
+
+ Reference<XInterface> init() override;
+ void triggerDesktopTerminate() override;
+
+ CPPUNIT_TEST_SUITE(SwXTextTable);
+ CPPUNIT_TEST(testAddEventListener);
+ CPPUNIT_TEST(testRemoveEventListener);
+ CPPUNIT_TEST_SUITE_END();
+
+private:
+ css::uno::Reference<css::lang::XComponent> component_;
+};
+
+void SwXTextTable::setUp()
+{
+ test::BootstrapFixture::setUp();
+ mxDesktop.set(
+ frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory())));
+}
+
+void SwXTextTable::tearDown()
+{
+ if (component_.is())
+ {
+ component_->dispose();
+ }
+}
+
+void SwXTextTable::triggerDesktopTerminate() { mxDesktop->terminate(); }
+
+Reference<XInterface> SwXTextTable::init()
+{
+ component_ = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument");
+ Reference<text::XTextDocument> xTextDocument(component_, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(component_, UNO_QUERY_THROW);
+ Reference<text::XText> xText = xTextDocument->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+ Reference<text::XTextTable> xTable(xMSF->createInstance("com.sun.star.text.TextTable"),
+ UNO_QUERY_THROW);
+ xTable->initialize(4, 3);
+ xText->insertTextContent(xCursor, xTable, false);
+ CPPUNIT_ASSERT(xCursor.is());
+ return Reference<XInterface>(xTable, UNO_QUERY_THROW);
+}
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXTextTable);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/SwXTextTables.cxx b/sw/qa/api/SwXTextTables.cxx
new file mode 100644
index 0000000000..a63a6592c8
--- /dev/null
+++ b/sw/qa/api/SwXTextTables.cxx
@@ -0,0 +1,97 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <test/unoapi_test.hxx>
+#include <test/container/xnameaccess.hxx>
+#include <test/container/xindexaccess.hxx>
+#include <test/container/xelementaccess.hxx>
+
+#include <com/sun/star/frame/Desktop.hpp>
+
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/text/XTextTablesSupplier.hpp>
+
+using namespace css;
+using namespace css::uno;
+
+namespace
+{
+/**
+ * Initial tests for SwXTextTables.
+ */
+class SwXTextTables final : public UnoApiTest,
+ public apitest::XElementAccess,
+ public apitest::XIndexAccess,
+ public apitest::XNameAccess
+{
+public:
+ SwXTextTables()
+ : UnoApiTest("")
+ , XElementAccess(cppu::UnoType<text::XTextTable>::get())
+ , XIndexAccess(1)
+ , XNameAccess("Table1")
+ {
+ }
+
+ virtual void setUp() override
+ {
+ UnoApiTest::setUp();
+ mxDesktop.set(frame::Desktop::create(mxComponentContext));
+ mxComponent = loadFromDesktop("private:factory/swriter");
+ CPPUNIT_ASSERT(mxComponent.is());
+ }
+
+ Reference<XInterface> init() override
+ {
+ Reference<text::XTextDocument> xTextDocument(mxComponent, UNO_QUERY_THROW);
+ Reference<lang::XMultiServiceFactory> xMSF(mxComponent, UNO_QUERY_THROW);
+
+ Reference<text::XText> xText = xTextDocument->getText();
+ Reference<text::XTextCursor> xCursor = xText->createTextCursor();
+
+ try
+ {
+ Reference<text::XTextTable> xTable(xMSF->createInstance("com.sun.star.text.TextTable"),
+ UNO_QUERY_THROW);
+ xTable->initialize(4, 3);
+ xText->insertTextContent(xCursor, xTable, false);
+
+ Reference<text::XTextTable> xTable2(xMSF->createInstance("com.sun.star.text.TextTable"),
+ UNO_QUERY_THROW);
+ xTable->initialize(4, 3);
+ xText->insertTextContent(xCursor, xTable2, false);
+ }
+ catch (Exception&)
+ {
+ }
+
+ Reference<text::XTextTablesSupplier> xSupplier(xTextDocument, UNO_QUERY_THROW);
+
+ return Reference<XInterface>(xSupplier->getTextTables(), UNO_QUERY_THROW);
+ }
+
+ CPPUNIT_TEST_SUITE(SwXTextTables);
+ CPPUNIT_TEST(testGetByName);
+ CPPUNIT_TEST(testGetElementNames);
+ CPPUNIT_TEST(testHasByName);
+ CPPUNIT_TEST(testGetCount);
+ CPPUNIT_TEST(testGetByIndex);
+ CPPUNIT_TEST(testGetElementType);
+ CPPUNIT_TEST(testHasElements);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+CPPUNIT_TEST_SUITE_REGISTRATION(SwXTextTables);
+}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/qa/api/terminate.cxx b/sw/qa/api/terminate.cxx
new file mode 100644
index 0000000000..9a0e26d4d7
--- /dev/null
+++ b/sw/qa/api/terminate.cxx
@@ -0,0 +1,75 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
+/*
+ * This file is part of the LibreOffice project.
+ *
+ * This Source Code Form is subject to the terms of the Mozilla Public
+ * License, v. 2.0. If a copy of the MPL was not distributed with this
+ * file, You can obtain one at http://mozilla.org/MPL/2.0/.
+ */
+
+#include <sal/config.h>
+
+#include <cppunit/TestAssert.h>
+#include <cppunit/extensions/HelperMacros.h>
+#include <cppunit/plugin/TestPlugIn.h>
+
+#include <com/sun/star/frame/Desktop.hpp>
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/text/XText.hpp>
+#include <com/sun/star/text/XTextCursor.hpp>
+#include <com/sun/star/text/XTextDocument.hpp>
+#include <com/sun/star/text/XTextTable.hpp>
+#include <com/sun/star/uno/Reference.hxx>
+#include <com/sun/star/uno/XInterface.hpp>
+#include <comphelper/processfactory.hxx>
+#include <test/bootstrapfixture.hxx>
+#include <test/lang/xcomponent.hxx>
+#include <unotest/macros_test.hxx>
+
+class TerminateTest final : public test::BootstrapFixture,
+ public unotest::MacrosTest,
+ public apitest::XComponent
+{
+public:
+ void setUp() override;
+
+ css::uno::Reference<css::uno::XInterface> init() override;
+
+ void triggerDesktopTerminate() override;
+
+ CPPUNIT_TEST_SUITE(TerminateTest);
+ CPPUNIT_TEST(testDisposedByDesktopTerminate);
+ CPPUNIT_TEST_SUITE_END();
+};
+
+void TerminateTest::setUp()
+{
+ test::BootstrapFixture::setUp();
+ mxDesktop.set(
+ css::frame::Desktop::create(comphelper::getComponentContext(getMultiServiceFactory())));
+}
+
+css::uno::Reference<css::uno::XInterface> TerminateTest::init()
+{
+ auto const component
+ = loadFromDesktop("private:factory/swriter", "com.sun.star.text.TextDocument");
+ css::uno::Reference<css::text::XTextDocument> xTextDocument(component,
+ css::uno::UNO_QUERY_THROW);
+ css::uno::Reference<css::lang::XMultiServiceFactory> xMSF(component, css::uno::UNO_QUERY_THROW);
+ css::uno::Reference<css::text::XText> xText = xTextDocument->getText();
+ css::uno::Reference<css::text::XTextCursor> xCursor = xText->createTextCursor();
+ css::uno::Reference<css::text::XTextTable> xTable(
+ xMSF->createInstance("com.sun.star.text.TextTable"), css::uno::UNO_QUERY_THROW);
+ xTable->initialize(4, 3);
+ xText->insertTextContent(xCursor, xTable, false);
+ CPPUNIT_ASSERT(xCursor.is());
+ return css::uno::Reference<css::uno::XInterface>(xTable, css::uno::UNO_QUERY_THROW);
+}
+
+void TerminateTest::triggerDesktopTerminate() { mxDesktop->terminate(); }
+
+CPPUNIT_TEST_SUITE_REGISTRATION(TerminateTest);
+
+CPPUNIT_PLUGIN_IMPLEMENT();
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */