1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4; fill-column: 100 -*- */
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/sheet/xlabelrange.hxx>
13 #include <com/sun/star/beans/XPropertySet.hpp>
14 #include <com/sun/star/lang/XComponent.hpp>
15 #include <com/sun/star/sheet/XLabelRange.hpp>
16 #include <com/sun/star/sheet/XLabelRanges.hpp>
17 #include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
18 #include <com/sun/star/table/CellRangeAddress.hpp>
20 #include <com/sun/star/uno/Reference.hxx>
21 #include <com/sun/star/uno/XInterface.hpp>
24 using namespace css::uno
;
25 using namespace com::sun::star
;
29 class ScLabelRangeObj
: public UnoApiTest
, public apitest::XLabelRange
34 virtual uno::Reference
<uno::XInterface
> init() override
;
35 virtual void setUp() override
;
37 CPPUNIT_TEST_SUITE(ScLabelRangeObj
);
40 CPPUNIT_TEST(testGetSetDataArea
);
41 CPPUNIT_TEST(testGetSetLabelArea
);
43 CPPUNIT_TEST_SUITE_END();
46 ScLabelRangeObj::ScLabelRangeObj()
47 : UnoApiTest("/sc/qa/extras/testdocuments")
51 uno::Reference
<uno::XInterface
> ScLabelRangeObj::init()
53 uno::Reference
<sheet::XSpreadsheetDocument
> xDoc(mxComponent
, uno::UNO_QUERY_THROW
);
55 uno::Reference
<beans::XPropertySet
> xProp(xDoc
, uno::UNO_QUERY_THROW
);
56 uno::Reference
<sheet::XLabelRanges
> xLabelRanges(xProp
->getPropertyValue("ColumnLabelRanges"),
57 uno::UNO_QUERY_THROW
);
59 table::CellRangeAddress
aCellRanageAddr1(0, 0, 1, 0, 6);
60 table::CellRangeAddress
aCellRanageAddr2(0, 0, 0, 0, 1);
61 xLabelRanges
->addNew(aCellRanageAddr1
, aCellRanageAddr2
);
63 uno::Reference
<sheet::XLabelRange
> xLabelRange(xLabelRanges
->getByIndex(0),
64 uno::UNO_QUERY_THROW
);
68 void ScLabelRangeObj::setUp()
71 // create calc document
72 mxComponent
= loadFromDesktop("private:factory/scalc");
75 CPPUNIT_TEST_SUITE_REGISTRATION(ScLabelRangeObj
);
79 CPPUNIT_PLUGIN_IMPLEMENT();
81 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */