25#include <com/sun/star/beans/XPropertySet.hpp>
32#include <osl/diagnose.h>
35using ::com::sun::star::uno::Any;
36using ::com::sun::star::uno::Reference;
43class WrappedAxisAndGridExistenceProperty :
public WrappedProperty
46 WrappedAxisAndGridExistenceProperty(
bool bAxis,
bool bMain, sal_Int32 nDimensionIndex
47 , std::shared_ptr<Chart2ModelContact> spChart2ModelContact );
49 virtual void setPropertyValue(
const css::uno::Any& rOuterValue,
const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet )
const override;
51 virtual css::uno::Any
getPropertyValue(
const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet )
const override;
53 virtual css::uno::Any getPropertyDefault(
const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState )
const override;
65 ,
const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact )
67 rList.emplace_back(
new WrappedAxisAndGridExistenceProperty(
true,
true, 0, spChart2ModelContact ) );
68 rList.emplace_back(
new WrappedAxisAndGridExistenceProperty(
true,
false, 0, spChart2ModelContact ) );
69 rList.emplace_back(
new WrappedAxisAndGridExistenceProperty(
false,
true, 0, spChart2ModelContact ) );
70 rList.emplace_back(
new WrappedAxisAndGridExistenceProperty(
false,
false, 0, spChart2ModelContact ) );
72 rList.emplace_back(
new WrappedAxisAndGridExistenceProperty(
true,
true, 1, spChart2ModelContact ) );
73 rList.emplace_back(
new WrappedAxisAndGridExistenceProperty(
true,
false, 1, spChart2ModelContact ) );
74 rList.emplace_back(
new WrappedAxisAndGridExistenceProperty(
false,
true, 1, spChart2ModelContact ) );
75 rList.emplace_back(
new WrappedAxisAndGridExistenceProperty(
false,
false, 1, spChart2ModelContact ) );
77 rList.emplace_back(
new WrappedAxisAndGridExistenceProperty(
true,
true, 2, spChart2ModelContact ) );
78 rList.emplace_back(
new WrappedAxisAndGridExistenceProperty(
false,
true, 2, spChart2ModelContact ) );
79 rList.emplace_back(
new WrappedAxisAndGridExistenceProperty(
false,
false, 2, spChart2ModelContact ) );
82WrappedAxisAndGridExistenceProperty::WrappedAxisAndGridExistenceProperty(
bool bAxis,
bool bMain, sal_Int32 nDimensionIndex
83 , std::shared_ptr<Chart2ModelContact> spChart2ModelContact )
97 m_aOuterName =
"HasXAxis";
99 m_aOuterName =
"HasSecondaryXAxis";
104 m_aOuterName =
"HasXAxisGrid";
106 m_aOuterName =
"HasXAxisHelpGrid";
114 OSL_ENSURE(
m_bMain,
"there is no secondary z axis at the old api");
116 m_aOuterName =
"HasZAxis";
121 m_aOuterName =
"HasZAxisGrid";
123 m_aOuterName =
"HasZAxisHelpGrid";
132 m_aOuterName =
"HasYAxis";
134 m_aOuterName =
"HasSecondaryYAxis";
139 m_aOuterName =
"HasYAxisGrid";
141 m_aOuterName =
"HasYAxisHelpGrid";
150 bool bNewValue =
false;
151 if( ! (rOuterValue >>= bNewValue) )
152 throw lang::IllegalArgumentException(
"Has axis or grid properties require boolean values",
nullptr, 0 );
154 bool bOldValue =
false;
157 if( bOldValue == bNewValue )
177Any WrappedAxisAndGridExistenceProperty::getPropertyValue(
const Reference< beans::XPropertySet >& )
const
194Any WrappedAxisAndGridExistenceProperty::getPropertyDefault(
const Reference< beans::XPropertyState >& )
const
203class WrappedAxisTitleExistenceProperty :
public WrappedProperty
206 WrappedAxisTitleExistenceProperty( sal_Int32 nTitleIndex
207 , std::shared_ptr<Chart2ModelContact> spChart2ModelContact );
209 virtual void setPropertyValue(
const css::uno::Any& rOuterValue,
const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet )
const override;
211 virtual css::uno::Any
getPropertyValue(
const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet )
const override;
213 virtual css::uno::Any getPropertyDefault(
const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState )
const override;
223 ,
const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact )
225 rList.emplace_back(
new WrappedAxisTitleExistenceProperty( 0, spChart2ModelContact ) );
226 rList.emplace_back(
new WrappedAxisTitleExistenceProperty( 1, spChart2ModelContact ) );
227 rList.emplace_back(
new WrappedAxisTitleExistenceProperty( 2, spChart2ModelContact ) );
228 rList.emplace_back(
new WrappedAxisTitleExistenceProperty( 3, spChart2ModelContact ) );
229 rList.emplace_back(
new WrappedAxisTitleExistenceProperty( 4, spChart2ModelContact ) );
232WrappedAxisTitleExistenceProperty::WrappedAxisTitleExistenceProperty(sal_Int32 nTitleIndex
233 , std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
238 switch( nTitleIndex )
241 m_aOuterName =
"HasXAxisTitle";
245 m_aOuterName =
"HasZAxisTitle";
249 m_aOuterName =
"HasSecondaryXAxisTitle";
253 m_aOuterName =
"HasSecondaryYAxisTitle";
257 m_aOuterName =
"HasYAxisTitle";
265 bool bNewValue =
false;
266 if( ! (rOuterValue >>= bNewValue) )
267 throw lang::IllegalArgumentException(
"Has axis or grid properties require boolean values",
nullptr, 0 );
269 bool bOldValue =
false;
272 if( bOldValue == bNewValue )
286Any WrappedAxisTitleExistenceProperty::getPropertyValue(
const Reference< beans::XPropertySet >& )
const
288 bool bHasTitle =
false;
300Any WrappedAxisTitleExistenceProperty::getPropertyDefault(
const Reference< beans::XPropertyState >& )
const
309class WrappedAxisLabelExistenceProperty :
public WrappedProperty
312 WrappedAxisLabelExistenceProperty(
bool bMain, sal_Int32 nDimensionIndex
313 , std::shared_ptr<Chart2ModelContact> spChart2ModelContact );
315 virtual void setPropertyValue(
const css::uno::Any& rOuterValue,
const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet )
const override;
317 virtual css::uno::Any
getPropertyValue(
const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet )
const override;
319 virtual css::uno::Any getPropertyDefault(
const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState )
const override;
330 ,
const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact )
332 rList.emplace_back(
new WrappedAxisLabelExistenceProperty(
true, 0, spChart2ModelContact ) );
333 rList.emplace_back(
new WrappedAxisLabelExistenceProperty(
true, 1, spChart2ModelContact ) );
334 rList.emplace_back(
new WrappedAxisLabelExistenceProperty(
true, 2, spChart2ModelContact ) );
335 rList.emplace_back(
new WrappedAxisLabelExistenceProperty(
false, 0, spChart2ModelContact ) );
336 rList.emplace_back(
new WrappedAxisLabelExistenceProperty(
false, 1, spChart2ModelContact ) );
339WrappedAxisLabelExistenceProperty::WrappedAxisLabelExistenceProperty(
bool bMain, sal_Int32 nDimensionIndex
340 , std::shared_ptr<Chart2ModelContact> spChart2ModelContact)
349 m_aOuterName =
m_bMain ? std::u16string_view(u
"HasXAxisDescription") :
std::u16string_view(
u"HasSecondaryXAxisDescription");
352 OSL_ENSURE(
m_bMain,
"there is no description available for a secondary z axis");
353 m_aOuterName =
"HasZAxisDescription";
356 m_aOuterName =
m_bMain ? std::u16string_view(u
"HasYAxisDescription") :
std::u16string_view(
u"HasSecondaryYAxisDescription");
363 bool bNewValue =
false;
364 if( ! (rOuterValue >>= bNewValue) )
365 throw lang::IllegalArgumentException(
"Has axis or grid properties require boolean values",
nullptr, 0 );
367 bool bOldValue =
false;
370 if( bOldValue == bNewValue )
375 if( !xProp.is() && bNewValue )
380 xProp->setPropertyValue(
"Show",
uno::Any(
false ) );
383 xProp->setPropertyValue(
"DisplayLabels", rOuterValue );
386Any WrappedAxisLabelExistenceProperty::getPropertyValue(
const Reference< beans::XPropertySet >& )
const
392 aRet = xProp->getPropertyValue(
"DisplayLabels" );
398Any WrappedAxisLabelExistenceProperty::getPropertyDefault(
const Reference< beans::XPropertyState >& )
const
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact
TitleHelper::eTitleType m_eTitleType
sal_Int32 m_nDimensionIndex
static rtl::Reference< ::chart::Axis > getAxis(sal_Int32 nDimensionIndex, bool bMainAxis, const rtl::Reference< ::chart::Diagram > &xDiagram)
static rtl::Reference< ::chart::Axis > createAxis(sal_Int32 nDimensionIndex, bool bMainAxis, const rtl::Reference< ::chart::Diagram > &xDiagram, const css::uno::Reference< css::uno::XComponentContext > &xContext, ReferenceSizeProvider *pRefSizeProvider=nullptr)
static bool isAxisShown(sal_Int32 nDimensionIndex, bool bMainAxis, const rtl::Reference< ::chart::Diagram > &xDiagram)
static void hideAxis(sal_Int32 nDimensionIndex, bool bMainAxis, const rtl::Reference< ::chart::Diagram > &xDiagram)
static void hideGrid(sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid, const rtl::Reference< ::chart::Diagram > &xDiagram)
static void showAxis(sal_Int32 nDimensionIndex, bool bMainAxis, const rtl::Reference< ::chart::Diagram > &xDiagram, const css::uno::Reference< css::uno::XComponentContext > &xContext, ReferenceSizeProvider *pRefSizeProvider=nullptr)
static bool isGridShown(sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid, const rtl::Reference< ::chart::Diagram > &xDiagram)
static void showGrid(sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid, const rtl::Reference< ::chart::Diagram > &xDiagram)
static void removeTitle(eTitleType nTitleIndex, const rtl::Reference< ::chart::ChartModel > &xModel)
static rtl::Reference< ::chart::Title > getTitle(eTitleType nTitleIndex, ChartModel &rModel)
static rtl::Reference< ::chart::Title > createTitle(eTitleType nTitleIndex, const OUString &rTitleText, const rtl::Reference< ::chart::ChartModel > &xModel, const css::uno::Reference< css::uno::XComponentContext > &xContext, ReferenceSizeProvider *pRefSizeProvider=nullptr)
static OUString getCompleteString(const rtl::Reference< ::chart::Title > &xTitle)
static void addWrappedProperties(std::vector< std::unique_ptr< WrappedProperty > > &rList, const std::shared_ptr< Chart2ModelContact > &spChart2ModelContact)
static void addWrappedProperties(std::vector< std::unique_ptr< WrappedProperty > > &rList, const std::shared_ptr< Chart2ModelContact > &spChart2ModelContact)
static void addWrappedProperties(std::vector< std::unique_ptr< WrappedProperty > > &rList, const std::shared_ptr< Chart2ModelContact > &spChart2ModelContact)
void setPropertyValue(tPropertyValueMap &rOutMap, tPropertyValueMapKey key, const Value &value)
Set a property to a certain value in the given map.
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)