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/calc_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 CalcUnoApiTest
, public apitest::XLabelRange
34 virtual uno::Reference
<uno::XInterface
> init() override
;
35 virtual void setUp() override
;
36 virtual void tearDown() override
;
38 CPPUNIT_TEST_SUITE(ScLabelRangeObj
);
41 CPPUNIT_TEST(testGetSetDataArea
);
42 CPPUNIT_TEST(testGetSetLabelArea
);
44 CPPUNIT_TEST_SUITE_END();
47 uno::Reference
<lang::XComponent
> mxComponent
;
50 ScLabelRangeObj::ScLabelRangeObj()
51 : CalcUnoApiTest("/sc/qa/extras/testdocuments")
55 uno::Reference
<uno::XInterface
> ScLabelRangeObj::init()
57 uno::Reference
<sheet::XSpreadsheetDocument
> xDoc(mxComponent
, uno::UNO_QUERY_THROW
);
59 uno::Reference
<beans::XPropertySet
> xProp(xDoc
, uno::UNO_QUERY_THROW
);
60 uno::Reference
<sheet::XLabelRanges
> xLabelRanges(xProp
->getPropertyValue("ColumnLabelRanges"),
61 uno::UNO_QUERY_THROW
);
63 table::CellRangeAddress
aCellRanageAddr1(0, 0, 1, 0, 6);
64 table::CellRangeAddress
aCellRanageAddr2(0, 0, 0, 0, 1);
65 xLabelRanges
->addNew(aCellRanageAddr1
, aCellRanageAddr2
);
67 uno::Reference
<sheet::XLabelRange
> xLabelRange(xLabelRanges
->getByIndex(0),
68 uno::UNO_QUERY_THROW
);
72 void ScLabelRangeObj::setUp()
74 CalcUnoApiTest::setUp();
75 // create calc document
76 mxComponent
= loadFromDesktop("private:factory/scalc");
79 void ScLabelRangeObj::tearDown()
81 closeDocument(mxComponent
);
82 CalcUnoApiTest::tearDown();
85 CPPUNIT_TEST_SUITE_REGISTRATION(ScLabelRangeObj
);
89 CPPUNIT_PLUGIN_IMPLEMENT();
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab cinoptions=b1,g0,N-s cinkeys+=0=break: */