diff options
author | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2015-03-27 04:13:52 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@collabora.co.uk> | 2015-03-30 04:34:23 +0200 |
commit | 97054f533f8c7153545a1c08dae12ca92f069122 (patch) | |
tree | ade8c4b7479a76d06b413c6359884db0e9b46aea /sc/source/ui/unoobj/condformatuno.cxx | |
parent | 35ea7ffe7549eb8a5f2539bc37ac5041a8d80c72 (diff) |
implement one more method
Change-Id: Ie18be81fa664df88af605674968e302c59f7dc98
Diffstat (limited to 'sc/source/ui/unoobj/condformatuno.cxx')
-rw-r--r-- | sc/source/ui/unoobj/condformatuno.cxx | 60 |
1 files changed, 55 insertions, 5 deletions
diff --git a/sc/source/ui/unoobj/condformatuno.cxx b/sc/source/ui/unoobj/condformatuno.cxx index fcf32b51d0e1..aee40f72f240 100644 --- a/sc/source/ui/unoobj/condformatuno.cxx +++ b/sc/source/ui/unoobj/condformatuno.cxx @@ -295,6 +295,35 @@ ScConditionalFormatList* ScCondFormatsObj::getCoreObject() return pList; } +namespace { + +uno::Reference<beans::XPropertySet> createConditionEntry(const ScFormatEntry* pEntry, + rtl::Reference<ScCondFormatObj> xParent) +{ + switch (pEntry->GetType()) + { + case condformat::CONDITION: + return new ScConditionEntryObj(xParent); + break; + case condformat::COLORSCALE: + return new ScColorScaleFormatObj(xParent); + break; + case condformat::DATABAR: + return new ScDataBarFormatObj(xParent); + break; + case condformat::ICONSET: + return new ScIconSetFormatObj(xParent); + break; + case condformat::DATE: + break; + default: + break; + } + return uno::Reference<beans::XPropertySet>(); +} + +} + ScCondFormatObj::ScCondFormatObj(ScDocShell* pDocShell, rtl::Reference<ScCondFormatsObj> xCondFormats, sal_Int32 nKey): mxCondFormatList(xCondFormats), @@ -318,6 +347,11 @@ ScConditionalFormat* ScCondFormatObj::getCoreObject() return pFormat; } +ScDocShell* ScCondFormatObj::getDocShell() +{ + return mpDocShell; +} + void ScCondFormatObj::addEntry(const uno::Reference<sheet::XConditionEntry>& /*xEntry*/) throw(uno::RuntimeException, std::exception) { @@ -356,10 +390,18 @@ sal_Int32 ScCondFormatObj::getCount() return pFormat->size(); } -uno::Any ScCondFormatObj::getByIndex(sal_Int32 /*nIndex*/) +uno::Any ScCondFormatObj::getByIndex(sal_Int32 nIndex) throw(uno::RuntimeException, std::exception) { + SolarMutexGuard aGuard; + if (getCoreObject()->size() >= size_t(nIndex)) + throw lang::IllegalArgumentException(); + + const ScFormatEntry* pEntry = getCoreObject()->GetEntry(nIndex); + uno::Reference<beans::XPropertySet> xCondEntry = + createConditionEntry(pEntry, this); uno::Any aAny; + aAny <<= xCondEntry; return aAny; } @@ -477,7 +519,9 @@ void SAL_CALL ScCondFormatObj::removeVetoableChangeListener( const OUString&, SAL_WARN("sc", "not implemented"); } -ScConditionEntryObj::ScConditionEntryObj(): +ScConditionEntryObj::ScConditionEntryObj(rtl::Reference<ScCondFormatObj> xParent): + mpDocShell(xParent->getDocShell()), + mxParent(xParent), maPropSet(getConditionEntryrPropSet()) { } @@ -653,7 +697,9 @@ void SAL_CALL ScConditionEntryObj::removeVetoableChangeListener( const OUString& SAL_WARN("sc", "not implemented"); } -ScColorScaleFormatObj::ScColorScaleFormatObj(): +ScColorScaleFormatObj::ScColorScaleFormatObj(rtl::Reference<ScCondFormatObj> xParent): + mpDocShell(xParent->getDocShell()), + mxParent(xParent), maPropSet(getColorScalePropSet()) { } @@ -753,7 +799,9 @@ void SAL_CALL ScColorScaleFormatObj::removeVetoableChangeListener( const OUStrin SAL_WARN("sc", "not implemented"); } -ScDataBarFormatObj::ScDataBarFormatObj(): +ScDataBarFormatObj::ScDataBarFormatObj(rtl::Reference<ScCondFormatObj> xParent): + mpDocShell(xParent->getDocShell()), + mxParent(xParent), maPropSet(getDataBarPropSet()) { } @@ -980,7 +1028,9 @@ void SAL_CALL ScDataBarFormatObj::removeVetoableChangeListener( const OUString&, SAL_WARN("sc", "not implemented"); } -ScIconSetFormatObj::ScIconSetFormatObj(): +ScIconSetFormatObj::ScIconSetFormatObj(rtl::Reference<ScCondFormatObj> xParent): + mpDocShell(xParent->getDocShell()), + mxParent(xParent), maPropSet(getIconSetPropSet()) { } |