Rebased ref, commits from common ancestor: commit 0e216e0096e7c069affa640c5048f66e10af0494 Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Mon Mar 16 23:14:08 2015 +0100
add test for one of the ScCondFormatsObj methods Change-Id: I05fc54a2153fd90d03d2575bdd9bde30a54d71c1 diff --git a/sc/qa/extras/new_cond_format.cxx b/sc/qa/extras/new_cond_format.cxx index 3200998..cd4826c 100644 --- a/sc/qa/extras/new_cond_format.cxx +++ b/sc/qa/extras/new_cond_format.cxx @@ -33,10 +33,12 @@ public: uno::Reference< uno::XInterface > init(); void testRequestCondFormatListFromSheet(); void testCondFormatListProperties(); + void testCondFormatListFormats(); CPPUNIT_TEST_SUITE(ScConditionalFormatTest); CPPUNIT_TEST(testRequestCondFormatListFromSheet); CPPUNIT_TEST(testCondFormatListProperties); + CPPUNIT_TEST(testCondFormatListFormats); CPPUNIT_TEST_SUITE_END(); private: @@ -104,6 +106,20 @@ void ScConditionalFormatTest::testCondFormatListProperties() CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xCondFormat->getLength()); } +void ScConditionalFormatTest::testCondFormatListFormats() +{ + uno::Reference<sheet::XConditionalFormats> xCondFormatList = + getConditionalFormatList(init()); + + uno::Sequence<uno::Reference<sheet::XConditionalFormat> > xCondFormats = + xCondFormatList->getConditionalFormats(); + CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xCondFormats.getLength()); + for (sal_Int32 i = 0, n = xCondFormats.getLength(); i < n; ++i) + { + CPPUNIT_ASSERT(xCondFormats[i].is()); + } +} + void ScConditionalFormatTest::setUp() { nTest++; commit ad9ce9c2796025cdac6fe97cec93683026a28f70 Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Mon Mar 16 22:50:18 2015 +0100 integrate ScConditionalFormat UNO object correctly Change-Id: I8da8d954dc7bcdf0a8c2f78eeb6b2403eb75d9e3 diff --git a/sc/source/ui/inc/condformatuno.hxx b/sc/source/ui/inc/condformatuno.hxx index 2546403..ec9218c 100644 --- a/sc/source/ui/inc/condformatuno.hxx +++ b/sc/source/ui/inc/condformatuno.hxx @@ -21,8 +21,10 @@ #include <com/sun/star/sheet/XIconSetEntry.hpp> #include <cppuhelper/implbase1.hxx> +#include <cppuhelper/implbase2.hxx> #include <svl/itemprop.hxx> #include <svl/lstner.hxx> +#include <rtl/ref.hxx> class ScDocument; class ScDocShell; @@ -75,18 +77,18 @@ public: throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; -private: ScConditionalFormatList* getCoreObject(); + +private: SCTAB mnTab; ScDocShell* mpDocShell; }; -class ScCondFormatObj : public com::sun::star::sheet::XConditionalFormat, - public com::sun::star::beans::XPropertySet, - public cppu::OWeakObject +class ScCondFormatObj : public cppu::WeakImplHelper2<com::sun::star::sheet::XConditionalFormat, + com::sun::star::beans::XPropertySet> { public: - ScCondFormatObj(ScDocument* pDoc, ScConditionalFormat* pList); + ScCondFormatObj(ScDocShell* pDocShell, rtl::Reference<ScCondFormatsObj> xCondFormats, sal_Int32 nKey); virtual ~ScCondFormatObj(); @@ -101,6 +103,24 @@ public: throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + // XIndexAccess + + virtual SAL_CALL uno::Type getElementType() + throw(::com::sun::star::uno::RuntimeException, + std::exception) SAL_OVERRIDE; + + virtual SAL_CALL sal_Bool hasElements() + throw(::com::sun::star::uno::RuntimeException, + std::exception) SAL_OVERRIDE; + + virtual SAL_CALL sal_Int32 getCount() + throw(::com::sun::star::uno::RuntimeException, + std::exception) SAL_OVERRIDE; + + virtual SAL_CALL uno::Any getByIndex(sal_Int32 nIndex) + throw(::com::sun::star::uno::RuntimeException, + std::exception) SAL_OVERRIDE; + // XPropertySet virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() @@ -142,9 +162,13 @@ public: ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + ScConditionalFormat* getCoreObject(); + private: - ScConditionalFormat* mpFormat; + rtl::Reference<ScCondFormatsObj> mxCondFormatList; + ScDocShell* mpDocShell; SfxItemPropertySet maPropSet; + sal_Int32 mnKey; }; class ScConditionEntryObj : public com::sun::star::beans::XPropertySet, diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx index faa108c..8ceee90 100644 --- a/sc/source/ui/unoobj/condformatuno.cxx +++ b/sc/source/ui/unoobj/condformatuno.cxx @@ -235,7 +235,17 @@ void ScCondFormatsObj::removeByID(const sal_Int32 nID) uno::Sequence<uno::Reference<sheet::XConditionalFormat> > ScCondFormatsObj::getConditionalFormats() throw(uno::RuntimeException, std::exception) { - return uno::Sequence<uno::Reference<sheet::XConditionalFormat> >(); + SolarMutexGuard aGuard; + ScConditionalFormatList* pFormatList = getCoreObject();; + size_t n = pFormatList->size(); + uno::Sequence<uno::Reference<sheet::XConditionalFormat> > aCondFormats(n); + sal_Int32 i = 0; + for (ScConditionalFormatList::const_iterator itr = pFormatList->begin(); itr != pFormatList->end(); ++itr, ++i) { + uno::Reference<sheet::XConditionalFormat> xCondFormat(new ScCondFormatObj(mpDocShell, this, itr->GetKey())); + aCondFormats[i] = xCondFormat; + } + + return aCondFormats; } sal_Int32 ScCondFormatsObj::getLength() @@ -258,9 +268,12 @@ ScConditionalFormatList* ScCondFormatsObj::getCoreObject() return pList; } -ScCondFormatObj::ScCondFormatObj(ScDocument* /*pDoc*/, ScConditionalFormat* pFormat): - mpFormat(pFormat), - maPropSet(getCondFormatPropset()) +ScCondFormatObj::ScCondFormatObj(ScDocShell* pDocShell, rtl::Reference<ScCondFormatsObj> xCondFormats, + sal_Int32 nKey): + mxCondFormatList(xCondFormats), + mpDocShell(pDocShell), + maPropSet(getCondFormatPropset()), + mnKey(nKey) { } @@ -268,6 +281,16 @@ ScCondFormatObj::~ScCondFormatObj() { } +ScConditionalFormat* ScCondFormatObj::getCoreObject() +{ + ScConditionalFormatList* pList = mxCondFormatList->getCoreObject(); + ScConditionalFormat* pFormat = pList->GetFormat(mnKey); + if (!pFormat) + throw uno::RuntimeException(); + + return pFormat; +} + void ScCondFormatObj::addEntry(const uno::Reference<sheet::XConditionEntry>& /*xEntry*/) throw(uno::RuntimeException, std::exception) { @@ -278,6 +301,36 @@ void ScCondFormatObj::removeByIndex(const sal_Int32 /*nIndex*/) { } +uno::Type ScCondFormatObj::getElementType() + throw(uno::RuntimeException, std::exception) +{ + return cppu::UnoType<sheet::XConditionEntry>::get(); +} + +sal_Bool ScCondFormatObj::hasElements() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + ScConditionalFormat* pFormat = getCoreObject(); + return !pFormat->IsEmpty(); +} + +sal_Int32 ScCondFormatObj::getCount() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + ScConditionalFormat* pFormat = getCoreObject(); + + return pFormat->size(); +} + +uno::Any ScCondFormatObj::getByIndex(sal_Int32 /*nIndex*/) + throw(uno::RuntimeException, std::exception) +{ + uno::Any aAny; + return aAny; +} + uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCondFormatObj::getPropertySetInfo() throw(uno::RuntimeException, std::exception) { @@ -327,14 +380,13 @@ uno::Any SAL_CALL ScCondFormatObj::getPropertyValue( const OUString& aPropertyNa switch(pEntry->nWID) { case ID: - aAny <<= sal_Int32(mpFormat->GetKey()); + aAny <<= sal_Int32(getCoreObject()->GetKey()); break; case CondFormat_Range: { - const ScRangeList& rRange = mpFormat->GetRange(); - ScDocShell* pShell = static_cast<ScDocShell*>(mpFormat->GetDocument()->GetDocumentShell()); + const ScRangeList& rRange = getCoreObject()->GetRange(); uno::Reference<sheet::XSheetCellRanges> xRange; - xRange.set(new ScCellRangesObj(pShell, rRange)); + xRange.set(new ScCellRangesObj(mpDocShell, rRange)); } break; default: commit 6611a83143b5ac7e1e2eb18605f17d17581fed8c Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Mon Mar 16 20:53:24 2015 +0100 add test for conditional format list size Change-Id: Ib7df18a5ff8f9afa00c925245eae0ae8be9e06e9 diff --git a/sc/qa/extras/new_cond_format.cxx b/sc/qa/extras/new_cond_format.cxx index 84c29a6..3200998 100644 --- a/sc/qa/extras/new_cond_format.cxx +++ b/sc/qa/extras/new_cond_format.cxx @@ -20,7 +20,7 @@ using namespace css; namespace sc_apitest { -#define NUMBER_OF_TESTS 1 +#define NUMBER_OF_TESTS 2 class ScConditionalFormatTest : public CalcUnoApiTest { @@ -32,9 +32,11 @@ public: uno::Reference< uno::XInterface > init(); void testRequestCondFormatListFromSheet(); + void testCondFormatListProperties(); CPPUNIT_TEST_SUITE(ScConditionalFormatTest); CPPUNIT_TEST(testRequestCondFormatListFromSheet); + CPPUNIT_TEST(testCondFormatListProperties); CPPUNIT_TEST_SUITE_END(); private: @@ -79,6 +81,29 @@ void ScConditionalFormatTest::testRequestCondFormatListFromSheet() CPPUNIT_ASSERT(xCondFormats.is()); } +namespace { + +uno::Reference<sheet::XConditionalFormats> getConditionalFormatList(uno::Reference<uno::XInterface> xInterface) +{ + uno::Reference<sheet::XSpreadsheet> xSheet(xInterface, uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xProps(xSheet, uno::UNO_QUERY_THROW); + uno::Any aAny = xProps->getPropertyValue("ConditionalFormats"); + uno::Reference<sheet::XConditionalFormats> xCondFormats; + CPPUNIT_ASSERT(aAny >>= xCondFormats); + CPPUNIT_ASSERT(xCondFormats.is()); + + return xCondFormats; +} + +} + +void ScConditionalFormatTest::testCondFormatListProperties() +{ + uno::Reference<sheet::XConditionalFormats> xCondFormat = + getConditionalFormatList(init()); + CPPUNIT_ASSERT_EQUAL(sal_Int32(4), xCondFormat->getLength()); +} + void ScConditionalFormatTest::setUp() { nTest++; commit d193dbf4aa61874c7a2ad578196c422140959759 Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Mon Mar 16 20:40:42 2015 +0100 try to prevent use-after-free Change-Id: I7edc3d09d495749a44da29c0cbb30eb0d20fd779 diff --git a/sc/source/ui/inc/condformatuno.hxx b/sc/source/ui/inc/condformatuno.hxx index 80230e3..2546403 100644 --- a/sc/source/ui/inc/condformatuno.hxx +++ b/sc/source/ui/inc/condformatuno.hxx @@ -22,8 +22,10 @@ #include <cppuhelper/implbase1.hxx> #include <svl/itemprop.hxx> +#include <svl/lstner.hxx> class ScDocument; +class ScDocShell; class ScConditionalFormatList; class ScConditionalFormat; class ScIconSetFormat; @@ -43,13 +45,16 @@ class XSheetCellRanges; } } } -class ScCondFormatsObj : public cppu::WeakImplHelper1<com::sun::star::sheet::XConditionalFormats> +class ScCondFormatsObj : public cppu::WeakImplHelper1<com::sun::star::sheet::XConditionalFormats>, + public SfxListener { public: - ScCondFormatsObj(ScDocument& rDoc, SCTAB nTab); + ScCondFormatsObj(ScDocShell* pDocShell, SCTAB nTab); virtual ~ScCondFormatsObj(); + virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) SAL_OVERRIDE; + static ScCondFormatsObj* getImplementation( uno::Reference< com::sun::star::sheet::XConditionalFormats > xCondFormat ); // XConditionalFormats @@ -73,7 +78,7 @@ public: private: ScConditionalFormatList* getCoreObject(); SCTAB mnTab; - ScDocument& mrDoc; + ScDocShell* mpDocShell; }; class ScCondFormatObj : public com::sun::star::sheet::XConditionalFormat, diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 9b45c2e..8ca9734 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -8608,7 +8608,7 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn } else if (pEntry->nWID == SC_WID_UNO_CONDFORMAT) { - rAny <<= uno::Reference<sheet::XConditionalFormats>(new ScCondFormatsObj(pDocSh->GetDocument(), nTab)); + rAny <<= uno::Reference<sheet::XConditionalFormats>(new ScCondFormatsObj(pDocSh, nTab)); } else ScCellRangeObj::GetOnePropertyValue(pEntry, rAny); diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx index a4da09b..faa108c 100644 --- a/sc/source/ui/unoobj/condformatuno.cxx +++ b/sc/source/ui/unoobj/condformatuno.cxx @@ -186,14 +186,26 @@ const IconSetTypeApiMap aIconSetApiMap[] = } -ScCondFormatsObj::ScCondFormatsObj(ScDocument& rDoc, SCTAB nTab): +ScCondFormatsObj::ScCondFormatsObj(ScDocShell* pDocShell, SCTAB nTab): mnTab(nTab), - mrDoc(rDoc) + mpDocShell(pDocShell) { + pDocShell->GetDocument().AddUnoObject(*this); } ScCondFormatsObj::~ScCondFormatsObj() { + if (mpDocShell) + mpDocShell->GetDocument().RemoveUnoObject(*this); +} + +void ScCondFormatsObj::Notify(SfxBroadcaster& /*rBC*/, const SfxHint& rHint) +{ + if ( dynamic_cast<const SfxSimpleHint*>(&rHint) && + static_cast<const SfxSimpleHint&>(rHint).GetId() == SFX_HINT_DYING ) + { + mpDocShell = NULL; // ungueltig geworden + } } sal_Int32 ScCondFormatsObj::addByRange(const uno::Reference< sheet::XConditionalFormat >& xCondFormat, @@ -236,7 +248,10 @@ sal_Int32 ScCondFormatsObj::getLength() ScConditionalFormatList* ScCondFormatsObj::getCoreObject() { - ScConditionalFormatList* pList = mrDoc.GetCondFormList(mnTab); + if (!mpDocShell) + throw uno::RuntimeException(); + + ScConditionalFormatList* pList = mpDocShell->GetDocument().GetCondFormList(mnTab); if (!pList) throw uno::RuntimeException(); commit 75590deee3d22413729d2ddac43677db09a7fd83 Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Mon Mar 16 20:23:59 2015 +0100 add first test for new conditional format API Change-Id: I85cee7b6b55ce35bb900eaf708744117208e57d7 diff --git a/sc/CppunitTest_sc_new_cond_format_api.mk b/sc/CppunitTest_sc_new_cond_format_api.mk new file mode 100644 index 0000000..c0558d1 --- /dev/null +++ b/sc/CppunitTest_sc_new_cond_format_api.mk @@ -0,0 +1,109 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +#************************************************************************* +# +# 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/. +# +#************************************************************************* + +$(eval $(call gb_CppunitTest_CppunitTest,sc_new_cond_format_api)) + +$(eval $(call gb_CppunitTest_add_exception_objects,sc_new_cond_format_api, \ + sc/qa/extras/new_cond_format \ +)) + +$(eval $(call gb_CppunitTest_use_external,sc_new_cond_format_api,boost_headers)) + +$(eval $(call gb_CppunitTest_use_libraries,sc_new_cond_format_api, \ + basegfx \ + comphelper \ + cppu \ + cppuhelper \ + drawinglayer \ + editeng \ + for \ + forui \ + i18nlangtag \ + msfilter \ + oox \ + sal \ + salhelper \ + sax \ + sb \ + sfx \ + sot \ + subsequenttest \ + svl \ + svt \ + svx \ + svxcore \ + test \ + tk \ + tl \ + ucbhelper \ + unotest \ + utl \ + vbahelper \ + vcl \ + xo \ + $(gb_UWINAPI) \ +)) + +$(eval $(call gb_CppunitTest_set_include,sc_new_cond_format_api,\ + -I$(SRCDIR)/sc/source/ui/inc \ + -I$(SRCDIR)/sc/inc \ + $$(INCLUDE) \ +)) + +$(eval $(call gb_CppunitTest_use_api,sc_new_cond_format_api,\ + offapi \ + udkapi \ +)) + +$(eval $(call gb_CppunitTest_use_ure,sc_new_cond_format_api)) +$(eval $(call gb_CppunitTest_use_vcl,sc_new_cond_format_api)) + +$(eval $(call gb_CppunitTest_use_components,sc_new_cond_format_api,\ + basic/util/sb \ + comphelper/util/comphelp \ + configmgr/source/configmgr \ + dbaccess/util/dba \ + filter/source/config/cache/filterconfig1 \ + filter/source/storagefilterdetect/storagefd \ + forms/util/frm \ + framework/util/fwk \ + i18npool/util/i18npool \ + linguistic/source/lng \ + oox/util/oox \ + package/source/xstor/xstor \ + package/util/package2 \ + sax/source/expatwrap/expwrap \ + scripting/source/basprov/basprov \ + scripting/util/scriptframe \ + sc/util/sc \ + sc/util/scd \ + sc/util/scfilt \ + $(call gb_Helper_optional,SCRIPTING, \ + sc/util/vbaobj) \ + sfx2/util/sfx \ + sot/util/sot \ + svl/source/fsstor/fsstorage \ + toolkit/util/tk \ + ucb/source/core/ucb1 \ + ucb/source/ucp/file/ucpfile1 \ + ucb/source/ucp/tdoc/ucptdoc1 \ + unotools/util/utl \ + unoxml/source/rdf/unordf \ + unoxml/source/service/unoxml \ + xmloff/util/xo \ + svtools/util/svt \ +)) + +$(eval $(call gb_CppunitTest_use_configuration,sc_new_cond_format_api)) + +$(eval $(call gb_CppunitTest_use_unittest_configuration,sc_new_cond_format_api)) + +# vim: set noet sw=4 ts=4: diff --git a/sc/Module_sc.mk b/sc/Module_sc.mk index 83a9742..2e82f0f 100644 --- a/sc/Module_sc.mk +++ b/sc/Module_sc.mk @@ -53,6 +53,7 @@ $(eval $(call gb_Module_add_check_targets,sc,\ $(eval $(call gb_Module_add_slowcheck_targets,sc, \ CppunitTest_sc_condformats \ + CppunitTest_sc_new_cond_format_api \ CppunitTest_sc_subsequent_filters_test \ CppunitTest_sc_subsequent_export_test \ CppunitTest_sc_bugfix_test \ diff --git a/sc/qa/extras/new_cond_format.cxx b/sc/qa/extras/new_cond_format.cxx new file mode 100644 index 0000000..84c29a6 --- /dev/null +++ b/sc/qa/extras/new_cond_format.cxx @@ -0,0 +1,106 @@ +/* -*- 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/calc_unoapi_test.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/sheet/XConditionalFormats.hpp> +#include <com/sun/star/sheet/XSpreadsheetDocument.hpp> +#include <com/sun/star/sheet/XSpreadsheet.hpp> +#include <com/sun/star/table/CellAddress.hpp> +#include <unonames.hxx> + +using namespace css; + +namespace sc_apitest { + +#define NUMBER_OF_TESTS 1 + +class ScConditionalFormatTest : public CalcUnoApiTest +{ +public: + ScConditionalFormatTest(); + + virtual void setUp() SAL_OVERRIDE; + virtual void tearDown() SAL_OVERRIDE; + + uno::Reference< uno::XInterface > init(); + void testRequestCondFormatListFromSheet(); + + CPPUNIT_TEST_SUITE(ScConditionalFormatTest); + CPPUNIT_TEST(testRequestCondFormatListFromSheet); + CPPUNIT_TEST_SUITE_END(); +private: + + static sal_Int32 nTest; + static uno::Reference< lang::XComponent > mxComponent; +}; + +sal_Int32 ScConditionalFormatTest::nTest = 0; +uno::Reference< lang::XComponent > ScConditionalFormatTest::mxComponent; + +ScConditionalFormatTest::ScConditionalFormatTest() + : CalcUnoApiTest("sc/qa/extras/testdocuments/") +{ +} + +uno::Reference< uno::XInterface > ScConditionalFormatTest::init() +{ + if(!mxComponent.is()) + { + // get the test file + OUString aFileURL; + createFileURL(OUString("new_cond_format_api.ods"), aFileURL); + mxComponent = loadFromDesktop(aFileURL); + } + CPPUNIT_ASSERT_MESSAGE("Component not loaded", mxComponent.is()); + + // get the first sheet + uno::Reference< sheet::XSpreadsheetDocument > xDoc(mxComponent, uno::UNO_QUERY_THROW); + uno::Reference< container::XIndexAccess > xIndex (xDoc->getSheets(), uno::UNO_QUERY_THROW); + uno::Reference< sheet::XSpreadsheet > xSheet( xIndex->getByIndex(0), uno::UNO_QUERY_THROW); + + return xSheet; +} + +void ScConditionalFormatTest::testRequestCondFormatListFromSheet() +{ + uno::Reference<sheet::XSpreadsheet> xSheet(init(), uno::UNO_QUERY_THROW); + uno::Reference<beans::XPropertySet> xProps(xSheet, uno::UNO_QUERY_THROW); + uno::Any aAny = xProps->getPropertyValue("ConditionalFormats"); + uno::Reference<sheet::XConditionalFormats> xCondFormats; + CPPUNIT_ASSERT(aAny >>= xCondFormats); + CPPUNIT_ASSERT(xCondFormats.is()); +} + +void ScConditionalFormatTest::setUp() +{ + nTest++; + CalcUnoApiTest::setUp(); +} + +void ScConditionalFormatTest::tearDown() +{ + if (nTest == NUMBER_OF_TESTS) + { + closeDocument(mxComponent); + mxComponent.clear(); + } + + CalcUnoApiTest::tearDown(); +} + +CPPUNIT_TEST_SUITE_REGISTRATION(ScConditionalFormatTest); + +} + +CPPUNIT_PLUGIN_IMPLEMENT(); + + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/qa/extras/testdocuments/new_cond_format_api.ods b/sc/qa/extras/testdocuments/new_cond_format_api.ods new file mode 100644 index 0000000..8208fea Binary files /dev/null and b/sc/qa/extras/testdocuments/new_cond_format_api.ods differ commit 48cfe2e4bef5c3eedea22ec8cdc0d3121a32d5f1 Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Mon Mar 16 19:46:18 2015 +0100 integrate new conditional format list into normal UNO stuff Change-Id: I04ccc7cee4052e5f8e06423216e7d041cd95e2b6 diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx index 73ab293..61da350 100644 --- a/sc/inc/unonames.hxx +++ b/sc/inc/unonames.hxx @@ -179,6 +179,7 @@ #define SC_UNONAME_TABLAYOUT "TableLayout" #define SC_UNONAME_AUTOPRINT "AutomaticPrintArea" #define SC_UNONAME_TABCOLOR "TabColor" +#define SC_UNONAME_CONDFORMAT "ConditionalFormats" #define SC_UNONAME_VISFLAG "VisibleFlag" diff --git a/sc/inc/unowids.hxx b/sc/inc/unowids.hxx index fc06efa..bd94159 100644 --- a/sc/inc/unowids.hxx +++ b/sc/inc/unowids.hxx @@ -71,7 +71,8 @@ #define SC_WID_UNO_TABCOLOR ( SC_WID_UNO_START + 41 ) #define SC_WID_UNO_NAMES ( SC_WID_UNO_START + 42 ) #define SC_WID_UNO_TBLBORD2 ( SC_WID_UNO_START + 43 ) -#define SC_WID_UNO_END ( SC_WID_UNO_START + 43 ) +#define SC_WID_UNO_CONDFORMAT ( SC_WID_UNO_START + 44 ) +#define SC_WID_UNO_END ( SC_WID_UNO_START + 44 ) inline bool IsScUnoWid( sal_uInt16 nWid ) { diff --git a/sc/source/ui/inc/condformatuno.hxx b/sc/source/ui/inc/condformatuno.hxx index c9f041d..80230e3 100644 --- a/sc/source/ui/inc/condformatuno.hxx +++ b/sc/source/ui/inc/condformatuno.hxx @@ -20,7 +20,7 @@ #include <com/sun/star/sheet/XDataBarEntry.hpp> #include <com/sun/star/sheet/XIconSetEntry.hpp> -#include <cppuhelper/weak.hxx> +#include <cppuhelper/implbase1.hxx> #include <svl/itemprop.hxx> class ScDocument; @@ -43,14 +43,15 @@ class XSheetCellRanges; } } } -class ScCondFormatsObj : public com::sun::star::sheet::XConditionalFormats, - public cppu::OWeakObject +class ScCondFormatsObj : public cppu::WeakImplHelper1<com::sun::star::sheet::XConditionalFormats> { public: - ScCondFormatsObj(ScDocument* pDoc, SCTAB nTab); + ScCondFormatsObj(ScDocument& rDoc, SCTAB nTab); virtual ~ScCondFormatsObj(); + static ScCondFormatsObj* getImplementation( uno::Reference< com::sun::star::sheet::XConditionalFormats > xCondFormat ); + // XConditionalFormats virtual SAL_CALL sal_Int32 addByRange( const uno::Reference< sheet::XConditionalFormat >& xCondFormat, const uno::Reference<sheet::XSheetCellRanges>& xRanges) @@ -70,7 +71,9 @@ public: std::exception) SAL_OVERRIDE; private: - ScConditionalFormatList* mpFormatList; + ScConditionalFormatList* getCoreObject(); + SCTAB mnTab; + ScDocument& mrDoc; }; class ScCondFormatObj : public com::sun::star::sheet::XConditionalFormat, @@ -82,6 +85,8 @@ public: virtual ~ScCondFormatObj(); + static ScCondFormatObj* getImplementation( uno::Reference<sheet::XConditionalFormat> XCondFormat); + // XConditionalFormat virtual SAL_CALL void addEntry(const uno::Reference<sheet::XConditionEntry>& xEntry) throw(::com::sun::star::uno::RuntimeException, @@ -146,6 +151,8 @@ public: ScConditionEntryObj(); virtual ~ScConditionEntryObj(); + static ScConditionEntryObj* getImplementation(uno::Reference<sheet::XConditionEntry> xCondition); + // XConditionEntry virtual SAL_CALL sal_Int32 getType() throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; @@ -204,6 +211,8 @@ public: ScColorScaleFormatObj(); virtual ~ScColorScaleFormatObj(); + static ScColorScaleFormatObj* getImplementation(uno::Reference<beans::XPropertySet> xPropSet); + // XPropertySet virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() @@ -257,6 +266,8 @@ public: ScDataBarFormatObj(); virtual ~ScDataBarFormatObj(); + static ScDataBarFormatObj* getImplementation(uno::Reference<beans::XPropertySet> xPropSet); + // XPropertySet virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() @@ -310,6 +321,8 @@ public: ScIconSetFormatObj(); virtual ~ScIconSetFormatObj(); + static ScIconSetFormatObj* getImplementation(uno::Reference<beans::XPropertySet> xPropSet); + // XPropertySet virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 546083a..9b45c2e 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -60,6 +60,7 @@ #include <com/sun/star/beans/SetPropertyTolerantFailed.hpp> #include <com/sun/star/text/WritingMode2.hpp> #include <com/sun/star/text/textfield/Type.hpp> +#include <com/sun/star/sheet/XConditionalFormats.hpp> #include "autoform.hxx" #include "cellmergeoption.hxx" @@ -126,6 +127,7 @@ #include "stylehelper.hxx" #include "dputil.hxx" #include <sortparam.hxx> +#include "condformatuno.hxx" #include <list> #include <boost/scoped_array.hpp> @@ -816,6 +818,7 @@ static const SfxItemPropertySet* lcl_GetSheetPropertySet() {OUString(SC_UNONAME_TBLBORD), SC_WID_UNO_TBLBORD, cppu::UnoType<table::TableBorder>::get(), 0, 0 | CONVERT_TWIPS }, {OUString(SC_UNONAME_TBLBORD2), SC_WID_UNO_TBLBORD2, cppu::UnoType<table::TableBorder2>::get(), 0, 0 | CONVERT_TWIPS }, {OUString(SC_UNONAME_TABLAYOUT),SC_WID_UNO_TABLAYOUT,cppu::UnoType<sal_Int16>::get(), 0, 0 }, + {OUString(SC_UNONAME_CONDFORMAT), SC_WID_UNO_CONDFORMAT, cppu::UnoType<sheet::XConditionalFormats>::get(), 0, 0}, {OUString(SC_UNONAME_TOPBORDER),ATTR_BORDER, ::cppu::UnoType<table::BorderLine>::get(), 0, TOP_BORDER | CONVERT_TWIPS }, {OUString(SC_UNONAME_TOPBORDER2),ATTR_BORDER, ::cppu::UnoType<table::BorderLine2>::get(), 0, TOP_BORDER | CONVERT_TWIPS }, {OUString(SC_UNONAME_USERDEF), ATTR_USERDEF, cppu::UnoType<container::XNameContainer>::get(), 0, 0 }, @@ -8441,6 +8444,14 @@ void ScTableSheetObj::SetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn pDocSh->GetDocument().SetCodeName( GetTab_Impl(), aCodeName ); } } + else if (pEntry->nWID == SC_WID_UNO_CONDFORMAT) + { + uno::Reference<sheet::XConditionalFormats> xCondFormat; + if (aValue >>= xCondFormat) + { + // how to set the format correctly + } + } else ScCellRangeObj::SetOnePropertyValue(pEntry, aValue); // base class, no Item WID } @@ -8595,6 +8606,10 @@ void ScTableSheetObj::GetOnePropertyValue( const SfxItemPropertySimpleEntry* pEn pDocSh->GetDocument().GetCodeName( GetTab_Impl(), aCodeName ); rAny <<= OUString( aCodeName ); } + else if (pEntry->nWID == SC_WID_UNO_CONDFORMAT) + { + rAny <<= uno::Reference<sheet::XConditionalFormats>(new ScCondFormatsObj(pDocSh->GetDocument(), nTab)); + } else ScCellRangeObj::GetOnePropertyValue(pEntry, rAny); } diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx index 2f47c81..a4da09b 100644 --- a/sc/source/ui/unoobj/condformatuno.cxx +++ b/sc/source/ui/unoobj/condformatuno.cxx @@ -13,6 +13,7 @@ #include "conditio.hxx" #include "colorscale.hxx" #include "docsh.hxx" +#include "miscuno.hxx" #include "cellsuno.hxx" @@ -70,10 +71,11 @@ struct ConditionEntryApiMap sal_Int32 nApiMode; }; +/* ConditionEntryApiMap aConditionEntryMap[] = { - }; +*/ enum ColorScaleProperties { @@ -184,8 +186,9 @@ const IconSetTypeApiMap aIconSetApiMap[] = } -ScCondFormatsObj::ScCondFormatsObj(ScDocument* pDoc, SCTAB nTab): - mpFormatList(pDoc->GetCondFormList(nTab)) +ScCondFormatsObj::ScCondFormatsObj(ScDocument& rDoc, SCTAB nTab): + mnTab(nTab), + mrDoc(rDoc) { } @@ -194,16 +197,27 @@ ScCondFormatsObj::~ScCondFormatsObj() } sal_Int32 ScCondFormatsObj::addByRange(const uno::Reference< sheet::XConditionalFormat >& xCondFormat, - const uno::Reference< sheet::XSheetCellRanges >& xRanges) + const uno::Reference< sheet::XSheetCellRanges >& /*xRanges*/) throw(uno::RuntimeException, std::exception) { + if (!xCondFormat.is()) + return 0; + SolarMutexGuard aGuard; + /* + ScCondFormatObj* pFormatObj = ScCondFormatObj::getImplementation(xCondFormat); + ScConditionalFormat* pFormat = pFormatObj->getCoreObject(); + mpFormatList->InsertNew(pFormat); + */ return 0; } void ScCondFormatsObj::removeByID(const sal_Int32 nID) throw(uno::RuntimeException, std::exception) { + SolarMutexGuard aGuard; + ScConditionalFormatList* pFormatList = getCoreObject();; + pFormatList->erase(nID); } uno::Sequence<uno::Reference<sheet::XConditionalFormat> > ScCondFormatsObj::getConditionalFormats() @@ -216,10 +230,20 @@ sal_Int32 ScCondFormatsObj::getLength() throw(uno::RuntimeException, std::exception) { SolarMutexGuard aGuard; - return mpFormatList->size();; + ScConditionalFormatList* pFormatList = getCoreObject();; + return pFormatList->size();; +} + +ScConditionalFormatList* ScCondFormatsObj::getCoreObject() +{ + ScConditionalFormatList* pList = mrDoc.GetCondFormList(mnTab); + if (!pList) + throw uno::RuntimeException(); + + return pList; } -ScCondFormatObj::ScCondFormatObj(ScDocument* pDoc, ScConditionalFormat* pFormat): +ScCondFormatObj::ScCondFormatObj(ScDocument* /*pDoc*/, ScConditionalFormat* pFormat): mpFormat(pFormat), maPropSet(getCondFormatPropset()) { @@ -229,12 +253,12 @@ ScCondFormatObj::~ScCondFormatObj() { } -void ScCondFormatObj::addEntry(const uno::Reference<sheet::XConditionEntry>& xEntry) +void ScCondFormatObj::addEntry(const uno::Reference<sheet::XConditionEntry>& /*xEntry*/) throw(uno::RuntimeException, std::exception) { } -void ScCondFormatObj::removeByIndex(const sal_Int32 nIndex) +void ScCondFormatObj::removeByIndex(const sal_Int32 /*nIndex*/) throw(uno::RuntimeException, std::exception) { } @@ -249,7 +273,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCondFormatObj::getPropertySet } void SAL_CALL ScCondFormatObj::setPropertyValue( - const OUString& aPropertyName, const uno::Any& aValue ) + const OUString& aPropertyName, const uno::Any& /*aValue*/ ) throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception) @@ -345,6 +369,12 @@ ScConditionEntryObj::~ScConditionEntryObj() { } +sal_Int32 ScConditionEntryObj::getType() + throw(uno::RuntimeException, std::exception) +{ + return 0; +} + uno::Reference<beans::XPropertySetInfo> SAL_CALL ScConditionEntryObj::getPropertySetInfo() throw(uno::RuntimeException, std::exception) { @@ -354,7 +384,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScConditionEntryObj::getPropert } void SAL_CALL ScConditionEntryObj::setPropertyValue( - const OUString& aPropertyName, const uno::Any& aValue ) + const OUString& aPropertyName, const uno::Any& /*aValue*/ ) throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception) @@ -473,7 +503,7 @@ uno::Reference<beans::XPropertySetInfo> SAL_CALL ScColorScaleFormatObj::getPrope } void SAL_CALL ScColorScaleFormatObj::setPropertyValue( - const OUString& aPropertyName, const uno::Any& aValue ) + const OUString& aPropertyName, const uno::Any& /*aValue*/ ) throw(beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException, std::exception) commit b3365f5af7f84936298f694c1751c9109ca5e46f Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Fri Feb 27 10:31:19 2015 +0100 more code for conditional format API Change-Id: Iba10222186c84c7a8ecf6928b8145dc941840421 diff --git a/offapi/com/sun/star/sheet/ConditionFormatOperator.idl b/offapi/com/sun/star/sheet/ConditionFormatOperator.idl index cf4b31a..187fde36 100644 --- a/offapi/com/sun/star/sheet/ConditionFormatOperator.idl +++ b/offapi/com/sun/star/sheet/ConditionFormatOperator.idl @@ -57,6 +57,8 @@ constants ConditionFormatOperator const long CONTAINS = 20; const long NOT_CONTAINS = 21; + + const long EXPRESSION = 22; }; diff --git a/offapi/com/sun/star/sheet/DataBar.idl b/offapi/com/sun/star/sheet/DataBar.idl index 8276e17..9045a67 100644 --- a/offapi/com/sun/star/sheet/DataBar.idl +++ b/offapi/com/sun/star/sheet/DataBar.idl @@ -28,7 +28,7 @@ service DataBar */ [property] long AxisPosition; - [property] boolean Gradient; + [property] boolean UseGradient; [property] com::sun::star::util::Color Color; diff --git a/sc/inc/colorscale.hxx b/sc/inc/colorscale.hxx index 06c3c80..3e29911 100644 --- a/sc/inc/colorscale.hxx +++ b/sc/inc/colorscale.hxx @@ -281,6 +281,7 @@ public: void SetDataBarData( ScDataBarFormatData* pData ); const ScDataBarFormatData* GetDataBarData() const; + ScDataBarFormatData* GetDataBarData(); virtual void DataChanged(const ScRange& rRange) SAL_OVERRIDE; virtual void UpdateReference( sc::RefUpdateContext& rCxt ) SAL_OVERRIDE; @@ -328,6 +329,7 @@ public: void SetIconSetData( ScIconSetFormatData* pData ); const ScIconSetFormatData* GetIconSetData() const; + ScIconSetFormatData* GetIconSetData(); virtual void DataChanged(const ScRange& rRange) SAL_OVERRIDE; virtual void UpdateReference( sc::RefUpdateContext& rCxt ) SAL_OVERRIDE; @@ -350,6 +352,8 @@ public: iterator end(); const_iterator end() const; + size_t size() const; + private: double GetMinValue() const; diff --git a/sc/source/core/data/colorscale.cxx b/sc/source/core/data/colorscale.cxx index 9de8919..9c4d7ce 100644 --- a/sc/source/core/data/colorscale.cxx +++ b/sc/source/core/data/colorscale.cxx @@ -692,6 +692,11 @@ void ScDataBarFormat::SetDataBarData( ScDataBarFormatData* pData ) mpFormatData.reset(pData); } +ScDataBarFormatData* ScDataBarFormat::GetDataBarData() +{ + return mpFormatData.get(); +} + const ScDataBarFormatData* ScDataBarFormat::GetDataBarData() const { return mpFormatData.get(); @@ -951,6 +956,11 @@ void ScIconSetFormat::SetIconSetData( ScIconSetFormatData* pFormatData ) mpFormatData.reset( pFormatData ); } +ScIconSetFormatData* ScIconSetFormat::GetIconSetData() +{ + return mpFormatData.get(); +} + const ScIconSetFormatData* ScIconSetFormat::GetIconSetData() const { return mpFormatData.get(); @@ -1165,6 +1175,12 @@ ScIconSetMap* ScIconSetFormat::getIconSetMap() return aIconSetMap; } +size_t ScIconSetFormat::size() const +{ + return mpFormatData->maEntries.size(); +} + + namespace { const sal_Int32 a3TrafficLights1[] = { diff --git a/sc/source/ui/inc/condformatuno.hxx b/sc/source/ui/inc/condformatuno.hxx index 4d83fc9..c9f041d 100644 --- a/sc/source/ui/inc/condformatuno.hxx +++ b/sc/source/ui/inc/condformatuno.hxx @@ -16,6 +16,9 @@ #include <com/sun/star/sheet/XConditionalFormats.hpp> #include <com/sun/star/sheet/XConditionalFormat.hpp> #include <com/sun/star/sheet/XConditionEntry.hpp> +#include <com/sun/star/sheet/XColorScaleEntry.hpp> +#include <com/sun/star/sheet/XDataBarEntry.hpp> +#include <com/sun/star/sheet/XIconSetEntry.hpp> #include <cppuhelper/weak.hxx> #include <svl/itemprop.hxx> @@ -26,6 +29,7 @@ class ScConditionalFormat; class ScIconSetFormat; class ScDataBarFormat; class ScColorScale; +class ScCondFormatEntry; using namespace com::sun::star; @@ -139,6 +143,7 @@ class ScConditionEntryObj : public com::sun::star::beans::XPropertySet, { public: + ScConditionEntryObj(); virtual ~ScConditionEntryObj(); // XConditionEntry @@ -188,6 +193,7 @@ public: private: SfxItemPropertySet maPropSet; + ScCondFormatEntry* pFormat; }; class ScColorScaleFormatObj : public com::sun::star::beans::XPropertySet, @@ -195,6 +201,7 @@ class ScColorScaleFormatObj : public com::sun::star::beans::XPropertySet, { public: + ScColorScaleFormatObj(); virtual ~ScColorScaleFormatObj(); // XPropertySet @@ -247,6 +254,7 @@ class ScDataBarFormatObj : public com::sun::star::beans::XPropertySet, public cppu::OWeakObject { public: + ScDataBarFormatObj(); virtual ~ScDataBarFormatObj(); // XPropertySet @@ -291,7 +299,7 @@ public: ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; private: - ScDataBarFormat* pDataBar; + ScDataBarFormat* mpDataBar; SfxItemPropertySet maPropSet; }; @@ -299,6 +307,7 @@ class ScIconSetFormatObj : public com::sun::star::beans::XPropertySet, public cppu::OWeakObject { public: + ScIconSetFormatObj(); virtual ~ScIconSetFormatObj(); // XPropertySet @@ -344,7 +353,7 @@ public: private: - ScIconSetFormat* pIconSet; + ScIconSetFormat* mpIconSet; SfxItemPropertySet maPropSet; }; diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx index af7496f..2f47c81 100644 --- a/sc/source/ui/unoobj/condformatuno.cxx +++ b/sc/source/ui/unoobj/condformatuno.cxx @@ -12,23 +12,176 @@ #include "document.hxx" #include "conditio.hxx" #include "colorscale.hxx" +#include "docsh.hxx" + +#include "cellsuno.hxx" #include <vcl/svapp.hxx> -#include <rt/ustring.hxx> +#include <rtl/ustring.hxx> + +#include <com/sun/star/sheet/DataBarAxis.hpp> +#include <com/sun/star/sheet/IconSetType.hpp> +#include <com/sun/star/sheet/DataBarAxis.hpp> +#include <com/sun/star/sheet/ConditionFormatOperator.hpp> namespace { +enum CondFormatProperties +{ + ID, + CondFormat_Range +}; + const SfxItemPropertyMapEntry* getCondFormatPropset() { static const SfxItemPropertyMapEntry aCondFormatPropertyMap_Impl[] = { - {OUString("ID"), 0, cppu::UnoType<sal_Int32>::get(), 0, 0}, - {OUString("Range"), 0, cppu::UnoType<sheet::XSheetCellRanges>::get(), 0, 0}, + {OUString("ID"), ID, cppu::UnoType<sal_Int32>::get(), 0, 0}, + {OUString("Range"), CondFormat_Range, cppu::UnoType<sheet::XSheetCellRanges>::get(), 0, 0}, {OUString(), 0, css::uno::Type(), 0, 0} }; return aCondFormatPropertyMap_Impl; } +enum ConditionEntryProperties +{ + StyleName, + Formula1, + Formula2, + Operator +}; + +const SfxItemPropertyMapEntry* getConditionEntryrPropSet() +{ + static const SfxItemPropertyMapEntry aConditionEntryPropertyMap_Impl[] = + { + {OUString("StyleName"), StyleName, cppu::UnoType<OUString>::get(), 0, 0}, + {OUString("Formula1"), Formula1, cppu::UnoType<OUString>::get(), 0, 0}, + {OUString("Formula2"), Formula2, cppu::UnoType<OUString>::get(), 0, 0}, + {OUString("Operator"), Operator, getCppuType(&sheet::ConditionFormatOperator::EQUAL), 0, 0 }, + {OUString(), 0, css::uno::Type(), 0, 0} + }; + return aConditionEntryPropertyMap_Impl; +} + +struct ConditionEntryApiMap +{ + ScConditionMode eMode; + sal_Int32 nApiMode; +}; + +ConditionEntryApiMap aConditionEntryMap[] = +{ + +}; + +enum ColorScaleProperties +{ + ColorScaleEntries +}; + +const SfxItemPropertyMapEntry* getColorScalePropSet() +{ + static const SfxItemPropertyMapEntry aColorScalePropertyMap_Impl[] = + { + {OUString("ColorScaleEntries"), ColorScaleEntries, getCppuType((uno::Sequence< sheet::XColorScaleEntry >*)0), 0, 0 }, + {OUString(), 0, css::uno::Type(), 0, 0} + }; + return aColorScalePropertyMap_Impl; +} + +enum DataBarProperties +{ + AxisPosition, + UseGradient, + UseNegativeColor, + DataBar_ShowValue, + DataBar_Color, + AxisColor, + NegativeColor, + DataBarEntries +}; + +const SfxItemPropertyMapEntry* getDataBarPropSet() +{ + static const SfxItemPropertyMapEntry aDataBarPropertyMap_Impl[] = + { + {OUString("AxisPosition"), AxisPosition, getCppuType(&sheet::DataBarAxis::AXIS_AUTOMATIC), 0, 0 }, + {OUString("UseGradient"), UseGradient, getBooleanCppuType(), 0, 0 }, + {OUString("UseNegativeColor"), UseNegativeColor, getBooleanCppuType(), 0, 0 }, + {OUString("ShowValue"), DataBar_ShowValue, getBooleanCppuType(), 0, 0 }, + {OUString("Color"), DataBar_Color, cppu::UnoType<sal_Int32>::get(), 0, 0}, + {OUString("AxisColor"), AxisColor, cppu::UnoType<sal_Int32>::get(), 0, 0}, + {OUString("NegativeColor"), NegativeColor, cppu::UnoType<sal_Int32>::get(), 0, 0}, + {OUString("DataBarEntries"), DataBarEntries, getCppuType((uno::Sequence< sheet::XDataBarEntry >*)0), 0, 0 }, + {OUString(), 0, css::uno::Type(), 0, 0} + }; + return aDataBarPropertyMap_Impl; +} + +struct DataBarAxisApiMap +{ + databar::ScAxisPosition ePos; + sal_Int32 nApiPos; +}; + +DataBarAxisApiMap aDataBarAxisMap[] = +{ + { databar::NONE, sheet::DataBarAxis::AXIS_NONE }, + { databar::AUTOMATIC, sheet::DataBarAxis::AXIS_AUTOMATIC }, + { databar::MIDDLE, sheet::DataBarAxis::AXIS_MIDDLE } +}; + +enum IconSetProperties +{ + Icons, + Reverse, + ShowValue, + IconSetEntries +}; + +const SfxItemPropertyMapEntry* getIconSetPropSet() +{ + static const SfxItemPropertyMapEntry aIconSetPropertyMap_Impl[] = + { + {OUString("Icons"), Icons, getCppuType(&sheet::IconSetType::ICONSET_3SYMBOLS), 0, 0 }, + {OUString("Reverse"), Reverse, getBooleanCppuType(), 0, 0 }, + {OUString("ShowValue"), ShowValue, getBooleanCppuType(), 0, 0 }, + {OUString("IconSetEntries"), IconSetEntries, getCppuType((uno::Sequence< sheet::XIconSetEntry >*)0), 0, 0 }, + {OUString(), 0, css::uno::Type(), 0, 0} + }; + return aIconSetPropertyMap_Impl; +} + +struct IconSetTypeApiMap +{ + ScIconSetType eType; + sal_Int32 nApiType; +}; + +const IconSetTypeApiMap aIconSetApiMap[] = +{ + { IconSet_3Arrows, sheet::IconSetType::ICONSET_3ARROWS }, + { IconSet_3ArrowsGray, sheet::IconSetType::ICONSET_3ARROWS_GRAY }, + { IconSet_3Flags, sheet::IconSetType::ICONSET_3FLAGS }, + { IconSet_3TrafficLights1, sheet::IconSetType::ICONSET_3TRAFFICLIGHTS1 }, + { IconSet_3TrafficLights2, sheet::IconSetType::ICONSET_3TRAFFICLIGHTS2 }, + { IconSet_3Signs, sheet::IconSetType::ICONSET_3SIGNS }, + { IconSet_3Symbols, sheet::IconSetType::ICONSET_3SYMBOLS }, + { IconSet_3Symbols2, sheet::IconSetType::ICONSET_3SYMBOLS2 }, + { IconSet_3Smilies, sheet::IconSetType::ICONSET_3SMILIES }, + { IconSet_3ColorSmilies, sheet::IconSetType::ICONSET_3COLOR_SIMILIES }, + { IconSet_4Arrows, sheet::IconSetType::ICONSET_4ARROWS }, + { IconSet_4ArrowsGray, sheet::IconSetType::ICONSET_4ARROWS_GRAY }, + { IconSet_4Rating, sheet::IconSetType::ICONSET_4RATING }, + { IconSet_4RedToBlack, sheet::IconSetType::ICONSET_4RED_TO_BLACK }, + { IconSet_4TrafficLights, sheet::IconSetType::ICONSET_4TRAFFICLIGHTS }, + { IconSet_5Arrows, sheet::IconSetType::ICONSET_5ARROWS }, + { IconSet_5ArrowsGray, sheet::IconSetType::ICONSET_4ARROWS_GRAY }, + { IconSet_5Ratings, sheet::IconSetType::ICONSET_5RATINGS }, + { IconSet_5Quarters, sheet::IconSetType::ICONSET_5QUARTERS }, +}; + } ScCondFormatsObj::ScCondFormatsObj(ScDocument* pDoc, SCTAB nTab): @@ -36,6 +189,10 @@ ScCondFormatsObj::ScCondFormatsObj(ScDocument* pDoc, SCTAB nTab): { } +ScCondFormatsObj::~ScCondFormatsObj() +{ +} + sal_Int32 ScCondFormatsObj::addByRange(const uno::Reference< sheet::XConditionalFormat >& xCondFormat, const uno::Reference< sheet::XSheetCellRanges >& xRanges) throw(uno::RuntimeException, std::exception) @@ -68,6 +225,10 @@ ScCondFormatObj::ScCondFormatObj(ScDocument* pDoc, ScConditionalFormat* pFormat) { } +ScCondFormatObj::~ScCondFormatObj() +{ +} + void ScCondFormatObj::addEntry(const uno::Reference<sheet::XConditionEntry>& xEntry) throw(uno::RuntimeException, std::exception) { @@ -95,10 +256,21 @@ void SAL_CALL ScCondFormatObj::setPropertyValue( { SolarMutexGuard aGuard; - const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class + const SfxItemPropertyMap& rPropertyMap = maPropSet.getPropertyMap(); // from derived class const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName ); if ( !pEntry ) throw beans::UnknownPropertyException(); + + switch(pEntry->nWID) + { + case ID: + throw lang::IllegalArgumentException(); + break; + case CondFormat_Range: + break; + default: + SAL_WARN("sc", "unknown property"); + } } uno::Any SAL_CALL ScCondFormatObj::getPropertyValue( const OUString& aPropertyName ) @@ -107,13 +279,28 @@ uno::Any SAL_CALL ScCondFormatObj::getPropertyValue( const OUString& aPropertyNa { SolarMutexGuard aGuard; - const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class + const SfxItemPropertyMap& rPropertyMap = maPropSet.getPropertyMap(); // from derived class const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName ); if ( !pEntry ) throw beans::UnknownPropertyException(); uno::Any aAny; - // GetOnePropertyValue( pEntry, aAny ); + switch(pEntry->nWID) + { + case ID: + aAny <<= sal_Int32(mpFormat->GetKey()); + break; + case CondFormat_Range: + { + const ScRangeList& rRange = mpFormat->GetRange(); + ScDocShell* pShell = static_cast<ScDocShell*>(mpFormat->GetDocument()->GetDocumentShell()); + uno::Reference<sheet::XSheetCellRanges> xRange; + xRange.set(new ScCellRangesObj(pShell, rRange)); + } + break; + default: + SAL_WARN("sc", "unknown property"); + } return aAny; } @@ -149,6 +336,15 @@ void SAL_CALL ScCondFormatObj::removeVetoableChangeListener( const OUString&, SAL_WARN("sc", "not implemented"); } +ScConditionEntryObj::ScConditionEntryObj(): + maPropSet(getConditionEntryrPropSet()) +{ +} + +ScConditionEntryObj::~ScConditionEntryObj() +{ +} + uno::Reference<beans::XPropertySetInfo> SAL_CALL ScConditionEntryObj::getPropertySetInfo() throw(uno::RuntimeException, std::exception) { @@ -165,10 +361,24 @@ void SAL_CALL ScConditionEntryObj::setPropertyValue( { SolarMutexGuard aGuard; - const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class + const SfxItemPropertyMap& rPropertyMap = maPropSet.getPropertyMap(); // from derived class const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName ); if ( !pEntry ) throw beans::UnknownPropertyException(); + + switch(pEntry->nWID) + { + case StyleName: + break; + case Formula1: + break; + case Formula2: + break; + case Operator: + break; + default: + SAL_WARN("sc", "unsupported property"); + } } uno::Any SAL_CALL ScConditionEntryObj::getPropertyValue( const OUString& aPropertyName ) @@ -177,13 +387,39 @@ uno::Any SAL_CALL ScConditionEntryObj::getPropertyValue( const OUString& aProper { SolarMutexGuard aGuard; - const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class + const SfxItemPropertyMap& rPropertyMap = maPropSet.getPropertyMap(); // from derived class const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName ); if ( !pEntry ) throw beans::UnknownPropertyException(); uno::Any aAny; - // GetOnePropertyValue( pEntry, aAny ); + switch(pEntry->nWID) + { + case StyleName: + aAny <<= pFormat->GetStyle(); + break; + case Formula1: + { + ScAddress aCursor = pFormat->GetSrcPos(); + OUString aFormula = pFormat->GetExpression(aCursor, 0); + aAny <<= aFormula; + } + break; + case Formula2: + { + ScAddress aCursor = pFormat->GetSrcPos(); + OUString aFormula = pFormat->GetExpression(aCursor, 1); + aAny <<= aFormula; + } + break; + case Operator: + { + + } + break; + default: + SAL_WARN("sc", "unsupported property"); + } return aAny; } @@ -219,6 +455,15 @@ void SAL_CALL ScConditionEntryObj::removeVetoableChangeListener( const OUString& SAL_WARN("sc", "not implemented"); } +ScColorScaleFormatObj::ScColorScaleFormatObj(): + maPropSet(getColorScalePropSet()) +{ +} + +ScColorScaleFormatObj::~ScColorScaleFormatObj() +{ +} + uno::Reference<beans::XPropertySetInfo> SAL_CALL ScColorScaleFormatObj::getPropertySetInfo() throw(uno::RuntimeException, std::exception) { @@ -235,10 +480,18 @@ void SAL_CALL ScColorScaleFormatObj::setPropertyValue( { SolarMutexGuard aGuard; - const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class + const SfxItemPropertyMap& rPropertyMap = maPropSet.getPropertyMap(); // from derived class const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName ); if ( !pEntry ) throw beans::UnknownPropertyException(); + + switch(pEntry->nWID) + { + case ColorScaleEntries: + break; + default: + SAL_WARN("sc", "unknown property"); + } } uno::Any SAL_CALL ScColorScaleFormatObj::getPropertyValue( const OUString& aPropertyName ) @@ -247,13 +500,21 @@ uno::Any SAL_CALL ScColorScaleFormatObj::getPropertyValue( const OUString& aProp { SolarMutexGuard aGuard; - const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class + const SfxItemPropertyMap& rPropertyMap = maPropSet.getPropertyMap(); // from derived class const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName ); if ( !pEntry ) throw beans::UnknownPropertyException(); uno::Any aAny; - // GetOnePropertyValue( pEntry, aAny ); + + switch(pEntry->nWID) + { + case ColorScaleEntries: + break; + default: + SAL_WARN("sc", "unknown property"); + } + return aAny; } @@ -289,6 +550,15 @@ void SAL_CALL ScColorScaleFormatObj::removeVetoableChangeListener( const OUStrin SAL_WARN("sc", "not implemented"); } +ScDataBarFormatObj::ScDataBarFormatObj(): + maPropSet(getDataBarPropSet()) +{ +} + +ScDataBarFormatObj::~ScDataBarFormatObj() +{ +} + uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDataBarFormatObj::getPropertySetInfo() throw(uno::RuntimeException, std::exception) { @@ -306,10 +576,82 @@ void SAL_CALL ScDataBarFormatObj::setPropertyValue( { SolarMutexGuard aGuard; - const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class + const SfxItemPropertyMap& rPropertyMap = maPropSet.getPropertyMap(); // from derived class const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName ); if ( !pEntry ) throw beans::UnknownPropertyException(); + + switch(pEntry->nWID) + { + case AxisPosition: + { + } + break; + case UseGradient: + { + bool bUseGradient = true; + if (aValue >>= bUseGradient) + { + mpDataBar->GetDataBarData()->mbGradient = bUseGradient; + } + } + break; + case UseNegativeColor: + { + bool bUseNegativeColor = false; + if (aValue >>= bUseNegativeColor) + { + mpDataBar->GetDataBarData()->mbNeg = bUseNegativeColor; + if (bUseNegativeColor && !mpDataBar->GetDataBarData()->mpNegativeColor) + { + mpDataBar->GetDataBarData()->mpNegativeColor.reset(new Color(COL_AUTO)); + } + } + } + break; + case DataBar_ShowValue: + { + bool bShowValue = true; + if (aValue >>= bShowValue) + { + mpDataBar->GetDataBarData()->mbOnlyBar = !bShowValue; + } + } + break; + case DataBar_Color: + { + sal_Int32 nColor = COL_AUTO; + if (aValue >>= nColor) + { + mpDataBar->GetDataBarData()->maPositiveColor.SetColor(nColor); + } + } + break; + case AxisColor: + { + sal_Int32 nAxisColor = COL_AUTO; + if (aValue >>= nAxisColor) + { + mpDataBar->GetDataBarData()->maAxisColor.SetColor(nAxisColor); + } + } + break; + case NegativeColor: + { + sal_Int32 nNegativeColor = COL_AUTO; + if ((aValue >>= nNegativeColor) && mpDataBar->GetDataBarData()->mbNeg) + { + mpDataBar->GetDataBarData()->mpNegativeColor->SetColor(nNegativeColor); + } + else + throw lang::IllegalArgumentException(); + } + break; + case DataBarEntries: + { + } + break; + } } uno::Any SAL_CALL ScDataBarFormatObj::getPropertyValue( const OUString& aPropertyName ) @@ -318,13 +660,70 @@ uno::Any SAL_CALL ScDataBarFormatObj::getPropertyValue( const OUString& aPropert { SolarMutexGuard aGuard; - const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class + const SfxItemPropertyMap& rPropertyMap = maPropSet.getPropertyMap(); // from derived class const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName ); if ( !pEntry ) throw beans::UnknownPropertyException(); uno::Any aAny; - // GetOnePropertyValue( pEntry, aAny ); + switch(pEntry->nWID) + { + case AxisPosition: + { + databar::ScAxisPosition ePos = mpDataBar->GetDataBarData()->meAxisPosition; + sal_Int32 nApiPos = sheet::DataBarAxis::AXIS_NONE; + for (size_t i = 0; i < SAL_N_ELEMENTS(aDataBarAxisMap); ++i) + { + if (aDataBarAxisMap[i].ePos == ePos) + { + nApiPos = aDataBarAxisMap[i].nApiPos; + } + } + + aAny <<= nApiPos; + } + break; + case UseGradient: + { + aAny <<= mpDataBar->GetDataBarData()->mbGradient; + } + break; + case UseNegativeColor: + { + aAny <<= mpDataBar->GetDataBarData()->mbNeg; + } + break; + case DataBar_ShowValue: + { + aAny <<= !mpDataBar->GetDataBarData()->mbOnlyBar; + } + break; + case DataBar_Color: + { + sal_Int32 nColor = mpDataBar->GetDataBarData()->maPositiveColor.GetColor(); + aAny <<= nColor; + } + break; + case AxisColor: + { + sal_Int32 nAxisColor = mpDataBar->GetDataBarData()->maAxisColor.GetColor(); + aAny <<= nAxisColor; + } + break; + case NegativeColor: + { + if (mpDataBar->GetDataBarData()->mbNeg && mpDataBar->GetDataBarData()->mpNegativeColor) + { + sal_Int32 nNegativeColor = mpDataBar->GetDataBarData() ->mpNegativeColor->GetColor(); + aAny <<= nNegativeColor; + } + } + break; + case DataBarEntries: + { + } + break; + } return aAny; } @@ -360,6 +759,15 @@ void SAL_CALL ScDataBarFormatObj::removeVetoableChangeListener( const OUString&, SAL_WARN("sc", "not implemented"); } +ScIconSetFormatObj::ScIconSetFormatObj(): + maPropSet(getIconSetPropSet()) +{ +} + +ScIconSetFormatObj::~ScIconSetFormatObj() +{ +} + uno::Reference<beans::XPropertySetInfo> SAL_CALL ScIconSetFormatObj::getPropertySetInfo() throw(uno::RuntimeException, std::exception) { @@ -377,10 +785,52 @@ void SAL_CALL ScIconSetFormatObj::setPropertyValue( { SolarMutexGuard aGuard; - const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class + const SfxItemPropertyMap& rPropertyMap = maPropSet.getPropertyMap(); // from derived class const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName ); if ( !pEntry ) throw beans::UnknownPropertyException(); + + switch(pEntry->nWID) + { + case ShowValue: + { + bool bShowValue = true; + aValue >>= bShowValue; + mpIconSet->GetIconSetData()->mbShowValue = bShowValue; + } + break; + case Reverse: + { + bool bReverse = false; + aValue >>= bReverse; + mpIconSet->GetIconSetData()->mbReverse = bReverse; + } + break; + case Icons: + { + sal_Int32 nApiType = -1; + aValue >>= nApiType; + ScIconSetType eType = IconSet_3Arrows; + bool bFound = false; + for (size_t i = 0; i < SAL_N_ELEMENTS(aIconSetApiMap); ++i) + { + if (aIconSetApiMap[i].nApiType == nApiType) + { + eType = aIconSetApiMap[i].eType; + bFound = true; + break; + } + } + + if (!bFound) + { + throw lang::IllegalArgumentException(); + } + + mpIconSet->GetIconSetData()->eIconSetType = eType; + } + break; + } } uno::Any SAL_CALL ScIconSetFormatObj::getPropertyValue( const OUString& aPropertyName ) @@ -389,13 +839,46 @@ uno::Any SAL_CALL ScIconSetFormatObj::getPropertyValue( const OUString& aPropert { SolarMutexGuard aGuard; - const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class + const SfxItemPropertyMap& rPropertyMap = maPropSet.getPropertyMap(); // from derived class const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName ); if ( !pEntry ) throw beans::UnknownPropertyException(); uno::Any aAny; - // GetOnePropertyValue( pEntry, aAny ); + + switch(pEntry->nWID) + { + case ShowValue: + aAny <<= mpIconSet->GetIconSetData()->mbShowValue; + break; + case Reverse: + aAny <<= mpIconSet->GetIconSetData()->mbReverse; + break; + case Icons: + { + ScIconSetType eType = mpIconSet->GetIconSetData()->eIconSetType; + for (size_t i = 0; i < SAL_N_ELEMENTS(aIconSetApiMap); ++i) + { + if (aIconSetApiMap[i].eType == eType) + { + aAny <<= aIconSetApiMap[i].nApiType; + break; + } + } + } + break; + case IconSetEntries: + { + uno::Sequence< sheet::XIconSetEntry > aEntries(mpIconSet->size()); + for (auto it = mpIconSet->begin(), itEnd = mpIconSet->end(); it != itEnd; ++it) + { + //aEntries.operator[] = ; + } + } + break; + default: + SAL_WARN("sc", "unknown property"); + } return aAny; } commit e7154614b3798f6878f2700505a007417d90c45d Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Fri Feb 27 06:34:42 2015 +0100 fix gbuild-to-ide script Change-Id: Iff624d9e31ef5ba7d87b92124c60b02cd577c50b diff --git a/bin/gbuild-to-ide b/bin/gbuild-to-ide index 3a78d9f..ee2fa99 100755 --- a/bin/gbuild-to-ide +++ b/bin/gbuild-to-ide @@ -146,6 +146,7 @@ class GbuildParser: if len(defparts) == 1: defparts.append(None) state.defs[defparts[0]] = defparts[1] + state.defs["LIBO_INTERNAL_ONLY"] = None return state cxxmatch = GbuildParser.cxxpattern.match(line) if cxxmatch: commit 396ae481ff0a732e7ca179a8ad0300121c6a3858 Author: Markus Mohrhard <markus.mohrh...@collabora.co.uk> Date: Fri Feb 27 03:16:35 2015 +0100 add implementation for new conditional formatting Change-Id: I4c283ec8a1f5b51c0274d9c520cd653be7f75aa2 diff --git a/offapi/com/sun/star/sheet/ConditionalFormat.idl b/offapi/com/sun/star/sheet/ConditionalFormat.idl index d168da3..953d3cf 100644 --- a/offapi/com/sun/star/sheet/ConditionalFormat.idl +++ b/offapi/com/sun/star/sheet/ConditionalFormat.idl @@ -35,7 +35,7 @@ service ConditionalFormat /** represents the range for the conditional format All ranges have to be in the same sheet. */ - [property] XSheetCellRanges range; + [property] XSheetCellRanges Range; [property] long ID; }; diff --git a/sc/Library_sc.mk b/sc/Library_sc.mk index d8cf1bc..d2fd5cd 100644 --- a/sc/Library_sc.mk +++ b/sc/Library_sc.mk @@ -542,6 +542,7 @@ $(eval $(call gb_Library_add_exception_objects,sc,\ sc/source/ui/unoobj/cellvaluebinding \ sc/source/ui/unoobj/chart2uno \ sc/source/ui/unoobj/chartuno \ + sc/source/ui/unoobj/condformatuno \ sc/source/ui/unoobj/confuno \ sc/source/ui/unoobj/convuno \ sc/source/ui/unoobj/cursuno \ diff --git a/sc/source/ui/inc/condformatuno.hxx b/sc/source/ui/inc/condformatuno.hxx new file mode 100644 index 0000000..4d83fc9 --- /dev/null +++ b/sc/source/ui/inc/condformatuno.hxx @@ -0,0 +1,353 @@ +/* -*- 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/. + */ + +#ifndef _SC_CONDFORMATUNO_HXX_ +#define _SC_CONDFORMATUNO_HXX_ + +#include "address.hxx" + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/sheet/XConditionalFormats.hpp> +#include <com/sun/star/sheet/XConditionalFormat.hpp> +#include <com/sun/star/sheet/XConditionEntry.hpp> + +#include <cppuhelper/weak.hxx> +#include <svl/itemprop.hxx> + +class ScDocument; +class ScConditionalFormatList; +class ScConditionalFormat; +class ScIconSetFormat; +class ScDataBarFormat; +class ScColorScale; + +using namespace com::sun::star; + +namespace com { namespace sun { namespace star { + +namespace sheet { + +class XSheetCellRanges; + +} + +} } } + +class ScCondFormatsObj : public com::sun::star::sheet::XConditionalFormats, + public cppu::OWeakObject +{ +public: + ScCondFormatsObj(ScDocument* pDoc, SCTAB nTab); + + virtual ~ScCondFormatsObj(); + + // XConditionalFormats + virtual SAL_CALL sal_Int32 addByRange( const uno::Reference< sheet::XConditionalFormat >& xCondFormat, + const uno::Reference<sheet::XSheetCellRanges>& xRanges) + throw(::com::sun::star::uno::RuntimeException, + std::exception) SAL_OVERRIDE; + + virtual SAL_CALL void removeByID( const sal_Int32 nID ) + throw(::com::sun::star::uno::RuntimeException, + std::exception) SAL_OVERRIDE; + + virtual SAL_CALL uno::Sequence< uno::Reference< sheet::XConditionalFormat > > getConditionalFormats() + throw(::com::sun::star::uno::RuntimeException, + std::exception) SAL_OVERRIDE; + + virtual SAL_CALL sal_Int32 getLength() + throw(::com::sun::star::uno::RuntimeException, + std::exception) SAL_OVERRIDE; + +private: + ScConditionalFormatList* mpFormatList; +}; + +class ScCondFormatObj : public com::sun::star::sheet::XConditionalFormat, + public com::sun::star::beans::XPropertySet, + public cppu::OWeakObject +{ +public: + ScCondFormatObj(ScDocument* pDoc, ScConditionalFormat* pList); + + virtual ~ScCondFormatObj(); + + // XConditionalFormat + virtual SAL_CALL void addEntry(const uno::Reference<sheet::XConditionEntry>& xEntry) + throw(::com::sun::star::uno::RuntimeException, + std::exception) SAL_OVERRIDE; + + virtual SAL_CALL void removeByIndex(const sal_Int32 nIndex) + throw(::com::sun::star::uno::RuntimeException, + std::exception) SAL_OVERRIDE; + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + +private: + ScConditionalFormat* mpFormat; + SfxItemPropertySet maPropSet; +}; + +class ScConditionEntryObj : public com::sun::star::beans::XPropertySet, + public com::sun::star::sheet::XConditionEntry, + public cppu::OWeakObject +{ +public: + + virtual ~ScConditionEntryObj(); + + // XConditionEntry + virtual SAL_CALL sal_Int32 getType() + throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + +private: + SfxItemPropertySet maPropSet; +}; + +class ScColorScaleFormatObj : public com::sun::star::beans::XPropertySet, + public cppu::OWeakObject +{ +public: + + virtual ~ScColorScaleFormatObj(); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + +private: + ScColorScale* pColorScale; + SfxItemPropertySet maPropSet; +}; + +class ScDataBarFormatObj : public com::sun::star::beans::XPropertySet, + public cppu::OWeakObject +{ +public: + virtual ~ScDataBarFormatObj(); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + +private: + ScDataBarFormat* pDataBar; + SfxItemPropertySet maPropSet; +}; + +class ScIconSetFormatObj : public com::sun::star::beans::XPropertySet, + public cppu::OWeakObject +{ +public: + virtual ~ScIconSetFormatObj(); + + // XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > + SAL_CALL getPropertySetInfo() + throw(::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, + const ::com::sun::star::uno::Any& aValue ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( + const OUString& PropertyName ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& xListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XVetoableChangeListener >& aListener ) + throw(::com::sun::star::beans::UnknownPropertyException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; + +private: + + ScIconSetFormat* pIconSet; + SfxItemPropertySet maPropSet; +}; + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx new file mode 100644 index 0000000..af7496f --- /dev/null +++ b/sc/source/ui/unoobj/condformatuno.cxx @@ -0,0 +1,434 @@ +/* -*- 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 "condformatuno.hxx" + +#include "document.hxx" +#include "conditio.hxx" +#include "colorscale.hxx" + +#include <vcl/svapp.hxx> +#include <rt/ustring.hxx> + +namespace { + +const SfxItemPropertyMapEntry* getCondFormatPropset() +{ + static const SfxItemPropertyMapEntry aCondFormatPropertyMap_Impl[] = + { + {OUString("ID"), 0, cppu::UnoType<sal_Int32>::get(), 0, 0}, + {OUString("Range"), 0, cppu::UnoType<sheet::XSheetCellRanges>::get(), 0, 0}, + {OUString(), 0, css::uno::Type(), 0, 0} + }; + return aCondFormatPropertyMap_Impl; +} + +} + +ScCondFormatsObj::ScCondFormatsObj(ScDocument* pDoc, SCTAB nTab): + mpFormatList(pDoc->GetCondFormList(nTab)) +{ +} + +sal_Int32 ScCondFormatsObj::addByRange(const uno::Reference< sheet::XConditionalFormat >& xCondFormat, + const uno::Reference< sheet::XSheetCellRanges >& xRanges) + throw(uno::RuntimeException, std::exception) +{ + + return 0; +} + +void ScCondFormatsObj::removeByID(const sal_Int32 nID) + throw(uno::RuntimeException, std::exception) +{ +} + +uno::Sequence<uno::Reference<sheet::XConditionalFormat> > ScCondFormatsObj::getConditionalFormats() + throw(uno::RuntimeException, std::exception) +{ + return uno::Sequence<uno::Reference<sheet::XConditionalFormat> >(); +} + +sal_Int32 ScCondFormatsObj::getLength() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + return mpFormatList->size();; +} + +ScCondFormatObj::ScCondFormatObj(ScDocument* pDoc, ScConditionalFormat* pFormat): + mpFormat(pFormat), + maPropSet(getCondFormatPropset()) +{ +} + +void ScCondFormatObj::addEntry(const uno::Reference<sheet::XConditionEntry>& xEntry) + throw(uno::RuntimeException, std::exception) +{ +} + +void ScCondFormatObj::removeByIndex(const sal_Int32 nIndex) + throw(uno::RuntimeException, std::exception) +{ +} + +uno::Reference<beans::XPropertySetInfo> SAL_CALL ScCondFormatObj::getPropertySetInfo() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + static uno::Reference<beans::XPropertySetInfo> aRef( + new SfxItemPropertySetInfo( maPropSet.getPropertyMap())); + return aRef; +} + +void SAL_CALL ScCondFormatObj::setPropertyValue( + const OUString& aPropertyName, const uno::Any& aValue ) + throw(beans::UnknownPropertyException, beans::PropertyVetoException, + lang::IllegalArgumentException, lang::WrappedTargetException, + uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class + const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName ); + if ( !pEntry ) + throw beans::UnknownPropertyException(); +} + +uno::Any SAL_CALL ScCondFormatObj::getPropertyValue( const OUString& aPropertyName ) + throw(beans::UnknownPropertyException, lang::WrappedTargetException, + uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class + const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName ); + if ( !pEntry ) + throw beans::UnknownPropertyException(); + + uno::Any aAny; + // GetOnePropertyValue( pEntry, aAny ); + return aAny; +} + +void SAL_CALL ScCondFormatObj::addPropertyChangeListener( const OUString& /* aPropertyName */, + const uno::Reference<beans::XPropertyChangeListener>& /* aListener */) + throw(beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException, std::exception) +{ + SAL_WARN("sc", "not implemented"); +} + +void SAL_CALL ScCondFormatObj::removePropertyChangeListener( const OUString& /* aPropertyName */, + const uno::Reference<beans::XPropertyChangeListener>& /* aListener */) + throw(beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException, std::exception) +{ + SAL_WARN("sc", "not implemented"); +} + +void SAL_CALL ScCondFormatObj::addVetoableChangeListener( const OUString&, + const uno::Reference<beans::XVetoableChangeListener>&) + throw(beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException, std::exception) +{ + SAL_WARN("sc", "not implemented"); +} + +void SAL_CALL ScCondFormatObj::removeVetoableChangeListener( const OUString&, + const uno::Reference<beans::XVetoableChangeListener>&) + throw(beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException, std::exception) +{ + SAL_WARN("sc", "not implemented"); +} + +uno::Reference<beans::XPropertySetInfo> SAL_CALL ScConditionEntryObj::getPropertySetInfo() + throw(uno::RuntimeException, std::exception) +{ + static uno::Reference<beans::XPropertySetInfo> aRef( + new SfxItemPropertySetInfo( maPropSet.getPropertyMap() )); + return aRef; +} + +void SAL_CALL ScConditionEntryObj::setPropertyValue( + const OUString& aPropertyName, const uno::Any& aValue ) + throw(beans::UnknownPropertyException, beans::PropertyVetoException, + lang::IllegalArgumentException, lang::WrappedTargetException, + uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class + const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName ); + if ( !pEntry ) + throw beans::UnknownPropertyException(); +} + +uno::Any SAL_CALL ScConditionEntryObj::getPropertyValue( const OUString& aPropertyName ) + throw(beans::UnknownPropertyException, lang::WrappedTargetException, + uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class + const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName ); + if ( !pEntry ) + throw beans::UnknownPropertyException(); + + uno::Any aAny; + // GetOnePropertyValue( pEntry, aAny ); + return aAny; +} + +void SAL_CALL ScConditionEntryObj::addPropertyChangeListener( const OUString& /* aPropertyName */, + const uno::Reference<beans::XPropertyChangeListener>& /* aListener */) + throw(beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException, std::exception) +{ + SAL_WARN("sc", "not implemented"); +} + +void SAL_CALL ScConditionEntryObj::removePropertyChangeListener( const OUString& /* aPropertyName */, + const uno::Reference<beans::XPropertyChangeListener>& /* aListener */) + throw(beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException, std::exception) +{ + SAL_WARN("sc", "not implemented"); +} + +void SAL_CALL ScConditionEntryObj::addVetoableChangeListener( const OUString&, + const uno::Reference<beans::XVetoableChangeListener>&) + throw(beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException, std::exception) +{ + SAL_WARN("sc", "not implemented"); +} + +void SAL_CALL ScConditionEntryObj::removeVetoableChangeListener( const OUString&, + const uno::Reference<beans::XVetoableChangeListener>&) + throw(beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException, std::exception) +{ + SAL_WARN("sc", "not implemented"); +} + +uno::Reference<beans::XPropertySetInfo> SAL_CALL ScColorScaleFormatObj::getPropertySetInfo() + throw(uno::RuntimeException, std::exception) +{ + static uno::Reference<beans::XPropertySetInfo> aRef( + new SfxItemPropertySetInfo( maPropSet.getPropertyMap() )); + return aRef; +} + +void SAL_CALL ScColorScaleFormatObj::setPropertyValue( + const OUString& aPropertyName, const uno::Any& aValue ) + throw(beans::UnknownPropertyException, beans::PropertyVetoException, + lang::IllegalArgumentException, lang::WrappedTargetException, + uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class + const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName ); + if ( !pEntry ) + throw beans::UnknownPropertyException(); +} + +uno::Any SAL_CALL ScColorScaleFormatObj::getPropertyValue( const OUString& aPropertyName ) + throw(beans::UnknownPropertyException, lang::WrappedTargetException, + uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class + const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName ); + if ( !pEntry ) + throw beans::UnknownPropertyException(); + + uno::Any aAny; + // GetOnePropertyValue( pEntry, aAny ); + return aAny; +} + +void SAL_CALL ScColorScaleFormatObj::addPropertyChangeListener( const OUString& /* aPropertyName */, + const uno::Reference<beans::XPropertyChangeListener>& /* aListener */) + throw(beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException, std::exception) +{ + SAL_WARN("sc", "not implemented"); +} + +void SAL_CALL ScColorScaleFormatObj::removePropertyChangeListener( const OUString& /* aPropertyName */, + const uno::Reference<beans::XPropertyChangeListener>& /* aListener */) + throw(beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException, std::exception) +{ + SAL_WARN("sc", "not implemented"); +} + +void SAL_CALL ScColorScaleFormatObj::addVetoableChangeListener( const OUString&, + const uno::Reference<beans::XVetoableChangeListener>&) + throw(beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException, std::exception) +{ + SAL_WARN("sc", "not implemented"); +} + +void SAL_CALL ScColorScaleFormatObj::removeVetoableChangeListener( const OUString&, + const uno::Reference<beans::XVetoableChangeListener>&) + throw(beans::UnknownPropertyException, + lang::WrappedTargetException, uno::RuntimeException, std::exception) +{ + SAL_WARN("sc", "not implemented"); +} + +uno::Reference<beans::XPropertySetInfo> SAL_CALL ScDataBarFormatObj::getPropertySetInfo() + throw(uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + static uno::Reference<beans::XPropertySetInfo> aRef( + new SfxItemPropertySetInfo( maPropSet.getPropertyMap() )); + return aRef; +} + +void SAL_CALL ScDataBarFormatObj::setPropertyValue( + const OUString& aPropertyName, const uno::Any& aValue ) + throw(beans::UnknownPropertyException, beans::PropertyVetoException, + lang::IllegalArgumentException, lang::WrappedTargetException, + uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class + const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName ); + if ( !pEntry ) + throw beans::UnknownPropertyException(); +} + +uno::Any SAL_CALL ScDataBarFormatObj::getPropertyValue( const OUString& aPropertyName ) + throw(beans::UnknownPropertyException, lang::WrappedTargetException, + uno::RuntimeException, std::exception) +{ + SolarMutexGuard aGuard; + + const SfxItemPropertyMap& rPropertyMap = GetItemPropertyMap(); // from derived class + const SfxItemPropertySimpleEntry* pEntry = rPropertyMap.getByName( aPropertyName ); + if ( !pEntry ) + throw beans::UnknownPropertyException(); + + uno::Any aAny; ... etc. - the rest is truncated _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits