diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2015-03-16 19:46:18 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2015-03-30 04:30:50 +0200 |
commit | 9dc75d5a548facf605a5bde48e637b94bdcabae9 (patch) | |
tree | cb33d92d499e655011a6acc3f2b6942d5757c3c1 /sc | |
parent | 6898506dc26aecd8d0547f8b7f9173282c3cf085 (diff) |
integrate new conditional format list into normal UNO stuff
Change-Id: I04ccc7cee4052e5f8e06423216e7d041cd95e2b6
Diffstat (limited to 'sc')
-rw-r--r-- | sc/inc/unonames.hxx | 1 | ||||
-rw-r--r-- | sc/inc/unowids.hxx | 3 | ||||
-rw-r--r-- | sc/source/ui/inc/condformatuno.hxx | 23 | ||||
-rw-r--r-- | sc/source/ui/unoobj/cellsuno.cxx | 15 | ||||
-rw-r--r-- | sc/source/ui/unoobj/condformatuno.cxx | 52 |
5 files changed, 77 insertions, 17 deletions
diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx index f02297ec84cf..b35c7ba34e63 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 fc06efa0a32d..bd94159f760f 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 df04792d8ae8..0db59b6998ca 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_Int32 SAL_CALL 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 void SAL_CALL 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_Int32 SAL_CALL 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 9b530744688c..6d9c36108c5c 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 2f47c817aa2a..a4da09bf3189 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) |