13#include <com/sun/star/beans/XPropertySet.hpp>
14#include <com/sun/star/container/XIndexAccess.hpp>
15#include <com/sun/star/container/XNameContainer.hpp>
16#include <com/sun/star/lang/XMultiServiceFactory.hpp>
17#include <com/sun/star/sheet/XConditionalFormats.hpp>
18#include <com/sun/star/sheet/XSpreadsheetDocument.hpp>
19#include <com/sun/star/sheet/XSpreadsheet.hpp>
20#include <com/sun/star/text/WritingMode2.hpp>
21#include <com/sun/star/util/Color.hpp>
22#include <com/sun/star/uno/Any.hxx>
23#include <com/sun/star/uno/Reference.hxx>
25#include <cppunit/TestAssert.h>
34 uno::Reference<beans::XPropertySet> xSpreadsheet(
init(), UNO_QUERY_THROW);
38 propName =
"IsVisible";
41 propName =
"PageStyle";
44 propName =
"TableLayout";
47 propName =
"AutomaticPrintArea";
50 propName =
"TabColor";
51 util::Color aColorGet;
52 util::Color aColorSet;
53 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue: TabColor",
54 xSpreadsheet->getPropertyValue(propName) >>= aColorGet);
56 aNewValue <<= util::Color(42);
57 xSpreadsheet->setPropertyValue(propName, aNewValue);
58 CPPUNIT_ASSERT(xSpreadsheet->getPropertyValue(propName) >>= aColorSet);
59 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to set PropertyValue: TabColor", util::Color(42),
62 propName =
"ConditionalFormats";
63 uno::Reference<sheet::XConditionalFormats> xConditionalFormatsGet;
64 uno::Reference<sheet::XConditionalFormats> xConditionalFormatsSet;
65 CPPUNIT_ASSERT_MESSAGE(
"Unable to get PropertyValue: ConditionalFormats",
66 xSpreadsheet->getPropertyValue(propName) >>= xConditionalFormatsGet);
69 uno::Reference<container::XIndexAccess> xIA(xDoc->getSheets(), UNO_QUERY_THROW);
70 uno::Reference<sheet::XSpreadsheet> xSheet(xIA->getByIndex(0), UNO_QUERY_THROW);
72 uno::Reference<lang::XMultiServiceFactory> xMSF(xDoc, UNO_QUERY_THROW);
73 uno::Reference<container::XNameContainer> xRanges(
74 xMSF->createInstance(
"com.sun.star.sheet.SheetCellRanges"), UNO_QUERY_THROW);
75 uno::Reference<sheet::XSheetCellRanges> xSheetCellRanges(xRanges, UNO_QUERY_THROW);
78 xCellRange <<= xSheet->getCellRangeByName(
"C1:D4");
79 xRanges->insertByName(
"Range1", xCellRange);
80 xConditionalFormatsGet->createByRange(xSheetCellRanges);
82 aNewValue <<= xConditionalFormatsGet;
83 xSpreadsheet->setPropertyValue(propName, aNewValue);
84 CPPUNIT_ASSERT(xSpreadsheet->getPropertyValue(propName) >>= xConditionalFormatsSet);
85 CPPUNIT_ASSERT_EQUAL_MESSAGE(
"Unable to set PropertyValue: ConditionalFormats", sal_Int32(1),
86 xConditionalFormatsSet->getLength());
void testSpreadsheetProperties()
virtual css::uno::Reference< css::uno::XInterface > init()=0
virtual css::uno::Reference< css::uno::XInterface > getXSpreadsheetDocument()=0
void testStringProperty(uno::Reference< beans::XPropertySet > const &xPropertySet, const OUString &name, const OUString &rValue)
void testShortProperty(uno::Reference< beans::XPropertySet > const &xPropertySet, const OUString &name, const sal_Int16 &nValue)
void testBooleanProperty(uno::Reference< beans::XPropertySet > const &xPropertySet, const OUString &name)