1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 #include <test/unoapi_test.hxx>
11 #include <test/container/xelementaccess.hxx>
12 #include <test/container/xindexaccess.hxx>
14 #include <com/sun/star/frame/Desktop.hpp>
16 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
18 #include <com/sun/star/text/XTextDocument.hpp>
19 #include <com/sun/star/text/XText.hpp>
20 #include <com/sun/star/text/XFootnote.hpp>
21 #include <com/sun/star/text/XFootnotesSupplier.hpp>
23 #include <comphelper/processfactory.hxx>
26 using namespace css::uno
;
31 * Initial tests for SwXFootnoteProperties.
33 class SwXFootnoteProperties final
: public UnoApiTest
,
34 public apitest::XElementAccess
,
35 public apitest::XIndexAccess
38 SwXFootnoteProperties();
40 Reference
<XInterface
> init() override
;
42 CPPUNIT_TEST_SUITE(SwXFootnoteProperties
);
43 CPPUNIT_TEST_SUITE_END();
46 SwXFootnoteProperties::SwXFootnoteProperties()
47 : UnoApiTest(u
""_ustr
)
48 , XElementAccess(cppu::UnoType
<text::XFootnote
>::get())
53 Reference
<XInterface
> SwXFootnoteProperties::init()
55 loadFromURL(u
"private:factory/swriter"_ustr
);
56 Reference
<text::XTextDocument
> xTextDocument(mxComponent
, UNO_QUERY_THROW
);
57 Reference
<lang::XMultiServiceFactory
> xMSF(mxComponent
, UNO_QUERY_THROW
);
59 Reference
<text::XFootnote
> xFootnote(xMSF
->createInstance(u
"com.sun.star.text.Footnote"_ustr
),
62 Reference
<text::XText
> xText
= xTextDocument
->getText();
63 Reference
<text::XTextCursor
> xCursor
= xText
->createTextCursor();
65 xText
->insertTextContent(xCursor
, xFootnote
, false);
67 Reference
<text::XFootnotesSupplier
> xFootnotesSupplier(xTextDocument
, UNO_QUERY_THROW
);
69 return Reference
<XInterface
>(xFootnotesSupplier
->getFootnoteSettings(), UNO_QUERY_THROW
);
72 CPPUNIT_TEST_SUITE_REGISTRATION(SwXFootnoteProperties
);
75 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */