26#include <com/sun/star/beans/PropertyAttribute.hpp>
27#include <com/sun/star/chart2/RelativePosition.hpp>
28#include <com/sun/star/chart2/XTitle.hpp>
40#include <rtl/ustrbuf.hxx>
45using ::com::sun::star::beans::Property;
46using ::com::sun::star::uno::Any;
47using ::com::sun::star::uno::Reference;
48using ::com::sun::star::uno::Sequence;
54class WrappedTitleStringProperty :
public WrappedProperty
57 explicit WrappedTitleStringProperty(
const Reference< uno::XComponentContext >& xContext );
59 virtual void setPropertyValue(
const Any& rOuterValue,
const Reference< beans::XPropertySet >& xInnerPropertySet )
const override;
60 virtual Any getPropertyValue(
const Reference< beans::XPropertySet >& xInnerPropertySet )
const override;
61 virtual Any getPropertyDefault(
const Reference< beans::XPropertyState >& xInnerPropertyState )
const override;
69WrappedTitleStringProperty::WrappedTitleStringProperty(
const Reference< uno::XComponentContext >& xContext )
70 : ::
chart::WrappedProperty(
"String", OUString() )
77 Title* pTitle =
dynamic_cast<Title*
>(xInnerPropertySet.get());
81 rOuterValue >>= aString;
82 TitleHelper::setCompleteString( aString, pTitle,
m_xContext );
85Any WrappedTitleStringProperty::getPropertyValue(
const Reference< beans::XPropertySet >& xInnerPropertySet )
const
87 Any aRet( getPropertyDefault( Reference< beans::XPropertyState >( xInnerPropertySet, uno::UNO_QUERY ) ) );
88 Reference< chart2::XTitle > xTitle(xInnerPropertySet,uno::UNO_QUERY);
91 const Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText());
94 for( Reference< chart2::XFormattedString >
const & formattedStr : aStrings )
96 aBuf.append( formattedStr->getString());
98 aRet <<=
aBuf.makeStringAndClear();
102Any WrappedTitleStringProperty::getPropertyDefault(
const Reference< beans::XPropertyState >& )
const
109class WrappedStackedTextProperty :
public WrappedProperty
112 WrappedStackedTextProperty();
117WrappedStackedTextProperty::WrappedStackedTextProperty()
118 : ::
chart::WrappedProperty(
"StackedText",
"StackCharacters" )
130 PROP_TITLE_TEXT_ROTATION,
131 PROP_TITLE_TEXT_STACKED
134void lcl_AddPropertiesToVector(
135 std::vector< Property > & rOutProperties )
137 rOutProperties.emplace_back(
"String",
140 beans::PropertyAttribute::BOUND
141 | beans::PropertyAttribute::MAYBEVOID );
143 rOutProperties.emplace_back(
"TextRotation",
144 PROP_TITLE_TEXT_ROTATION,
146 beans::PropertyAttribute::BOUND
147 | beans::PropertyAttribute::MAYBEDEFAULT );
148 rOutProperties.emplace_back(
"StackedText",
149 PROP_TITLE_TEXT_STACKED,
151 beans::PropertyAttribute::BOUND
152 | beans::PropertyAttribute::MAYBEDEFAULT );
155const Sequence< Property > & StaticTitleWrapperPropertyArray()
157 static Sequence< Property > aPropSeq = []()
160 lcl_AddPropertiesToVector( aProperties );
183 std::shared_ptr<Chart2ModelContact> spChart2ModelContact ) :
205 if(xPropertySet.is())
209 chart2::RelativePosition aRelativePosition;
210 aRelativePosition.Anchor = drawing::Alignment_TOP_LEFT;
211 aRelativePosition.Primary = double(aPosition.X)/double(aPageSize.Width);
212 aRelativePosition.Secondary = double(aPosition.Y)/double(aPageSize.Height);
213 xPropertySet->setPropertyValue(
"RelativePosition",
uno::Any(aRelativePosition) );
224 OSL_FAIL(
"trying to set size of title" );
230 return "com.sun.star.chart.ChartTitle";
240 clearWrappedPropertySet();
265 if( aStrings.hasElements() )
266 xProp.set( aStrings[0], uno::UNO_QUERY );
282 if( pWrappedProperty )
286 else if( xFastProp.is() )
288 rValue = xFastProp->getFastPropertyValue(
nHandle );
295 sal_Int32 nHandle,
const Any& rValue )
312 if( pWrappedProperty )
314 else if( xFastPropertySet.is() )
315 xFastPropertySet->setFastPropertyValue(
nHandle, rValue );
323 sal_Int32
nHandle = getInfoHelper().getHandleByName( rPropertyName );
335 sal_Int32
nHandle = getInfoHelper().getHandleByName( rPropertyName );
345 beans::PropertyState aState( beans::PropertyState_DIRECT_VALUE );
347 sal_Int32
nHandle = getInfoHelper().getHandleByName( rPropertyName );
351 if( xPropState.is() )
353 const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
354 if( pWrappedProperty )
357 aState = xPropState->getPropertyState( rPropertyName );
367 sal_Int32
nHandle = getInfoHelper().getHandleByName( rPropertyName );
380 sal_Int32
nHandle = getInfoHelper().getHandleByName( rPropertyName );
384 if( xPropState.is() )
386 const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
387 if( pWrappedProperty )
390 aRet = xPropState->getPropertyDefault( rPropertyName );
401 sal_Int32
nHandle = getInfoHelper().getHandleByName( rPropertyName );
406 xPropSet->addPropertyChangeListener( rPropertyName, xListener );
413 sal_Int32
nHandle = getInfoHelper().getHandleByName( rPropertyName );
418 xPropSet->removePropertyChangeListener( rPropertyName, xListener );
430 if( xProp->getPropertyValue(
"ReferencePageSize" ).hasValue() )
431 xProp->setPropertyValue(
"ReferencePageSize",
uno::Any(
440 aRet = xProp->getPropertyValue(
"ReferencePageSize" );
463 return StaticTitleWrapperPropertyArray();
468 std::vector< std::unique_ptr<WrappedProperty> > aWrappedProperties;
472 aWrappedProperties.emplace_back(
new WrappedStackedTextProperty() );
477 return aWrappedProperties;
482 return "com.sun.star.comp.chart.Title";
493 "com.sun.star.chart.ChartTitle",
494 "com.sun.star.drawing.Shape",
495 "com.sun.star.xml.UserDefinedAttributesSupplier",
496 "com.sun.star.style.CharacterProperties"
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact
Reference< uno::XComponentContext > m_xContext
PropertiesInfo aProperties
TitleHelper::eTitleType m_eTitleType
This guard calls lockControllers at the given Model in the CTOR and unlockControllers in the DTOR.
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)
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString &aPropertyName) override
virtual void SAL_CALL setPropertyToDefault(const OUString &PropertyName) override
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString &PropertyName) override
virtual css::beans::PropertyState getPropertyState(const css::uno::Reference< css::beans::XPropertyState > &xInnerPropertyState) const
virtual css::uno::Any getPropertyDefault(const css::uno::Reference< css::beans::XPropertyState > &xInnerPropertyState) const
virtual css::uno::Any getPropertyValue(const css::uno::Reference< css::beans::XPropertySet > &xInnerPropertySet) const
virtual void setPropertyValue(const css::uno::Any &rOuterValue, const css::uno::Reference< css::beans::XPropertySet > &xInnerPropertySet) const
virtual std::vector< std::unique_ptr< WrappedProperty > > createWrappedProperties() override
virtual void SAL_CALL removeEventListener(const css::uno::Reference< css::lang::XEventListener > &aListener) override
virtual void updateReferenceSize() override
virtual void SAL_CALL setPropertyValue(const OUString &aPropertyName, const css::uno::Any &aValue) override
virtual OUString SAL_CALL getImplementationName() override
XServiceInfo declarations.
virtual css::awt::Size SAL_CALL getSize() override
virtual void SAL_CALL addPropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &xListener) override
virtual void SAL_CALL setPosition(const css::awt::Point &aPosition) override
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override
virtual css::uno::Any SAL_CALL getPropertyDefault(const OUString &aPropertyName) override
TitleWrapper(::chart::TitleHelper::eTitleType eTitleType, std::shared_ptr< Chart2ModelContact > spChart2ModelContact)
virtual sal_Bool SAL_CALL supportsService(const OUString &ServiceName) override
void setFastCharacterPropertyValue(sal_Int32 nHandle, const css::uno::Any &rValue)
css::uno::Reference< css::chart2::XTitle > getTitleObject()
::comphelper::OInterfaceContainerHelper4< css::lang::XEventListener > m_aEventListenerContainer
virtual css::awt::Size getCurrentSizeForReference() override
virtual css::awt::Point SAL_CALL getPosition() override
virtual css::beans::PropertyState SAL_CALL getPropertyState(const OUString &PropertyName) override
virtual css::uno::Any getReferenceSize() override
virtual void SAL_CALL dispose() override
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact
::chart::TitleHelper::eTitleType m_eTitleType
virtual void SAL_CALL addEventListener(const css::uno::Reference< css::lang::XEventListener > &xListener) override
virtual void SAL_CALL setSize(const css::awt::Size &aSize) override
virtual OUString SAL_CALL getShapeType() override
virtual const css::uno::Sequence< css::beans::Property > & getPropertySequence() override
virtual void SAL_CALL setPropertyToDefault(const OUString &PropertyName) override
void getFastCharacterPropertyValue(sal_Int32 nHandle, css::uno::Any &rValue)
virtual ~TitleWrapper() override
virtual css::uno::Any SAL_CALL getPropertyValue(const OUString &PropertyName) override
virtual css::uno::Reference< css::beans::XPropertySet > getInnerPropertySet() override
css::uno::Reference< css::beans::XPropertySet > getFirstCharacterPropertySet()
virtual void SAL_CALL removePropertyChangeListener(const OUString &aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener > &aListener) override
static void addWrappedProperties(std::vector< std::unique_ptr< WrappedProperty > > &rList)
static void addProperties(std::vector< css::beans::Property > &rOutProperties)
static void addWrappedProperties(std::vector< std::unique_ptr< WrappedProperty > > &rList, ReferenceSizePropertyProvider *pRefSizePropProvider)
static void addProperties(std::vector< css::beans::Property > &rOutProperties)
static void addWrappedProperties(std::vector< std::unique_ptr< WrappedProperty > > &rList, const std::shared_ptr< Chart2ModelContact > &spChart2ModelContact)
sal_Int32 addInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
void disposeAndClear(::std::unique_lock<::std::mutex > &rGuard, const css::lang::EventObject &rEvt)
sal_Int32 removeInterface(std::unique_lock< std::mutex > &rGuard, const css::uno::Reference< ListenerT > &rxIFace)
OOO_DLLPUBLIC_CHARTTOOLS bool IsCharacterPropertyHandle(sal_Int32 nHandle)
@ FAST_PROPERTY_ID_END_CHAR_PROP
OOO_DLLPUBLIC_CHARTTOOLS void AddPropertiesToVector(std::vector< css::beans::Property > &rOutProperties)
void setPropertyValue(tPropertyValueMap &rOutMap, tPropertyValueMapKey key, const Value &value)
Set a property to a certain value in the given map.
@ FAST_PROPERTY_ID_START_CHAR_PROP
css::uno::Sequence< DstElementType > containerToSequence(const SrcType &i_Container)
bool CPPUHELPER_DLLPUBLIC supportsService(css::lang::XServiceInfo *implementation, rtl::OUString const &name)
bool getPropertyValue(ValueType &rValue, css::uno::Reference< css::beans::XPropertySet > const &xPropSet, OUString const &propName)