Kaydet (Commit) 6898506d authored tarafından Markus Mohrhard's avatar Markus Mohrhard

more code for conditional format API

Change-Id: Iba10222186c84c7a8ecf6928b8145dc941840421
üst 2a9d654c
......@@ -57,6 +57,8 @@ constants ConditionFormatOperator
const long CONTAINS = 20;
const long NOT_CONTAINS = 21;
const long EXPRESSION = 22;
};
......
......@@ -28,7 +28,7 @@ service DataBar
*/
[property] long AxisPosition;
[property] boolean Gradient;
[property] boolean UseGradient;
[property] com::sun::star::util::Color Color;
......
......@@ -295,6 +295,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;
......@@ -342,6 +343,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;
......@@ -364,6 +366,8 @@ public:
iterator end();
const_iterator end() const;
size_t size() const;
private:
double GetMinValue() const;
......
......@@ -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();
......@@ -953,6 +958,11 @@ void ScIconSetFormat::SetIconSetData( ScIconSetFormatData* pFormatData )
mpFormatData.reset( pFormatData );
}
ScIconSetFormatData* ScIconSetFormat::GetIconSetData()
{
return mpFormatData.get();
}
const ScIconSetFormatData* ScIconSetFormat::GetIconSetData() const
{
return mpFormatData.get();
......@@ -1167,6 +1177,12 @@ ScIconSetMap* ScIconSetFormat::getIconSetMap()
return aIconSetMap;
}
size_t ScIconSetFormat::size() const
{
return mpFormatData->maEntries.size();
}
namespace {
const sal_Int32 a3TrafficLights1[] = {
......
......@@ -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;
};
......
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment