Rebased ref, commits from common ancestor: commit f932440587483550895194dbc5a993f63a85007a 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/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..f6d51e6 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> @@ -139,6 +142,7 @@ class ScConditionEntryObj : public com::sun::star::beans::XPropertySet, { public: + ScConditionEntryObj(); virtual ~ScConditionEntryObj(); // XConditionEntry @@ -195,6 +199,7 @@ class ScColorScaleFormatObj : public com::sun::star::beans::XPropertySet, { public: + ScColorScaleFormatObj(); virtual ~ScColorScaleFormatObj(); // XPropertySet @@ -247,6 +252,7 @@ class ScDataBarFormatObj : public com::sun::star::beans::XPropertySet, public cppu::OWeakObject { public: + ScDataBarFormatObj(); virtual ~ScDataBarFormatObj(); // XPropertySet @@ -291,7 +297,7 @@ public: ::com::sun::star::uno::RuntimeException, std::exception) SAL_OVERRIDE; private: - ScDataBarFormat* pDataBar; + ScDataBarFormat* mpDataBar; SfxItemPropertySet maPropSet; }; @@ -299,6 +305,7 @@ class ScIconSetFormatObj : public com::sun::star::beans::XPropertySet, public cppu::OWeakObject { public: + ScIconSetFormatObj(); virtual ~ScIconSetFormatObj(); // XPropertySet @@ -344,7 +351,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..499e3bd 100644 --- a/sc/source/ui/unoobj/condformatuno.cxx +++ b/sc/source/ui/unoobj/condformatuno.cxx @@ -12,23 +12,154 @@ #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> namespace { +enum CondFormatProperties +{ + ID, + CondFormat_Range +}; + const SfxItemPropertyMapEntry* getCondFormatPropset() { static const SfxItemPropertyMapEntry aCondFormatPropertyMap_Impl[] = { + {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; +} + +const SfxItemPropertyMapEntry* getConditionEntryrPropSet() +{ + static const SfxItemPropertyMapEntry aConditionEntryPropertyMap_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; + return aConditionEntryPropertyMap_Impl; } +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 +167,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 +203,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 +234,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 +257,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 +314,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,7 +339,7 @@ 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(); @@ -177,7 +351,7 @@ 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(); @@ -219,6 +393,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 +418,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 +438,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 +488,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 +514,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 +598,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 +697,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 +723,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 +777,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; } _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/libreoffice-commits