summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--chart2/source/inc/ErrorBar.hxx57
-rw-r--r--chart2/source/tools/ErrorBar.cxx241
2 files changed, 119 insertions, 179 deletions
diff --git a/chart2/source/inc/ErrorBar.hxx b/chart2/source/inc/ErrorBar.hxx
index 027995cca489..1b76c9c3001b 100644
--- a/chart2/source/inc/ErrorBar.hxx
+++ b/chart2/source/inc/ErrorBar.hxx
@@ -20,12 +20,11 @@
#define CHART2_ERRORBAR_HXX
#include "MutexContainer.hxx"
-#include "OPropertySet.hxx"
#include "ServiceMacros.hxx"
#include "ModifyListenerHelper.hxx"
#include "charttoolsdllapi.hxx"
-#include <cppuhelper/implbase6.hxx>
+#include <cppuhelper/implbase7.hxx>
#include <comphelper/uno3.hxx>
#include <com/sun/star/uno/XComponentContext.hpp>
@@ -35,6 +34,8 @@
#include <com/sun/star/container/XChild.hpp>
#include <com/sun/star/chart2/data/XDataSink.hpp>
#include <com/sun/star/chart2/data/XDataSource.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/chart/ErrorBarStyle.hpp>
namespace chart
{
@@ -45,21 +46,29 @@ OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::
namespace impl
{
-typedef ::cppu::WeakImplHelper6<
+typedef ::cppu::WeakImplHelper7<
::com::sun::star::lang::XServiceInfo,
::com::sun::star::util::XCloneable,
::com::sun::star::util::XModifyBroadcaster,
::com::sun::star::util::XModifyListener,
::com::sun::star::chart2::data::XDataSource,
- ::com::sun::star::chart2::data::XDataSink >
+ ::com::sun::star::chart2::data::XDataSink,
+ ::com::sun::star::beans::XPropertySet >
ErrorBar_Base;
}
class ErrorBar :
public MutexContainer,
- public impl::ErrorBar_Base,
- public ::property::OPropertySet
+ public impl::ErrorBar_Base
{
+private:
+ bool mbShowPositiveError;
+ bool mbShowNegativeError;
+ double mfPositiveError;
+ double mfNegativeError;
+ double mfWeight;
+ sal_Int32 meStyle;
+
public:
explicit ErrorBar(
const ::com::sun::star::uno::Reference<
@@ -71,25 +80,26 @@ public:
/// establish methods for factory instatiation
APPHELPER_SERVICE_FACTORY_HELPER( ErrorBar )
- /// merge XInterface implementations
- DECLARE_XINTERFACE()
- /// merge XTypeProvider implementations
- DECLARE_XTYPEPROVIDER()
+ // XPropertySet
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
+ getPropertySetInfo() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const ::com::sun::star::uno::Any& aValue )
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName )
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& xListener )
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& aListener )
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& aListener )
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
protected:
ErrorBar( const ErrorBar & rOther );
- // ____ OPropertySet ____
- virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const
- throw(::com::sun::star::beans::UnknownPropertyException);
- virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper();
- using OPropertySet::disposing;
-
- // ____ XPropertySet ____
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL
- getPropertySetInfo()
- throw (::com::sun::star::uno::RuntimeException);
-
// ____ XCloneable ____
virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone()
throw (::com::sun::star::uno::RuntimeException);
@@ -128,11 +138,6 @@ protected:
throw (::com::sun::star::lang::NoSupportException,
::com::sun::star::uno::RuntimeException);
- // ____ OPropertySet ____
- virtual void firePropertyChangeEvent();
-
- void fireModifyEvent();
-
private:
::com::sun::star::uno::Reference<
::com::sun::star::uno::XComponentContext >
diff --git a/chart2/source/tools/ErrorBar.cxx b/chart2/source/tools/ErrorBar.cxx
index 29f40e8c9925..0c9132388e4a 100644
--- a/chart2/source/tools/ErrorBar.cxx
+++ b/chart2/source/tools/ErrorBar.cxx
@@ -25,6 +25,8 @@
#include "PropertyHelper.hxx"
#include "CloneHelper.hxx"
+#include <svl/itemprop.hxx>
+
#include <com/sun/star/beans/PropertyAttribute.hpp>
#include <com/sun/star/chart/ErrorBarStyle.hpp>
@@ -38,133 +40,31 @@ using ::osl::MutexGuard;
namespace
{
+
static const OUString lcl_aServiceName( "com.sun.star.comp.chart2.ErrorBar" );
-enum
-{
- PROP_ERROR_BAR_STYLE,
- PROP_ERROR_BAR_POS_ERROR,
- PROP_ERROR_BAR_NEG_ERROR,
- PROP_ERROR_BAR_WEIGHT,
- PROP_ERROR_BAR_SHOW_POS_ERROR,
- PROP_ERROR_BAR_SHOW_NEG_ERROR
-};
-
-void lcl_AddPropertiesToVector(
- ::std::vector< Property > & rOutProperties )
+bool lcl_isInternalData( const uno::Reference< chart2::data::XLabeledDataSequence > & xLSeq )
{
- rOutProperties.push_back(
- Property( "ErrorBarStyle",
- PROP_ERROR_BAR_STYLE,
- ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT ));
-
- rOutProperties.push_back(
- Property( "PositiveError",
- PROP_ERROR_BAR_POS_ERROR,
- ::getCppuType( reinterpret_cast< const double * >(0)),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT ));
- rOutProperties.push_back(
- Property( "NegativeError",
- PROP_ERROR_BAR_NEG_ERROR,
- ::getCppuType( reinterpret_cast< const double * >(0)),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT ));
-
- rOutProperties.push_back(
- Property( "Weight",
- PROP_ERROR_BAR_WEIGHT,
- ::getCppuType( reinterpret_cast< const double * >(0)),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT ));
-
- rOutProperties.push_back(
- Property( "ShowPositiveError",
- PROP_ERROR_BAR_SHOW_POS_ERROR,
- ::getBooleanCppuType(),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT ));
- rOutProperties.push_back(
- Property( "ShowNegativeError",
- PROP_ERROR_BAR_SHOW_NEG_ERROR,
- ::getBooleanCppuType(),
- beans::PropertyAttribute::BOUND
- | beans::PropertyAttribute::MAYBEDEFAULT ));
+ uno::Reference< lang::XServiceInfo > xServiceInfo( xLSeq, uno::UNO_QUERY );
+ return ( xServiceInfo.is() && xServiceInfo->getImplementationName() == "com.sun.star.comp.chart2.LabeledDataSequence" );
}
-struct StaticErrorBarDefaults_Initializer
-{
- ::chart::tPropertyValueMap* operator()()
- {
- static ::chart::tPropertyValueMap aStaticDefaults;
- lcl_AddDefaultsToMap( aStaticDefaults );
- return &aStaticDefaults;
- }
-private:
- void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap )
- {
- ::chart::LineProperties::AddDefaultsToMap( rOutMap );
-
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_ERROR_BAR_STYLE, ::com::sun::star::chart::ErrorBarStyle::NONE );
- ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_ERROR_BAR_POS_ERROR, 0.0 );
- ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_ERROR_BAR_NEG_ERROR, 0.0 );
- ::chart::PropertyHelper::setPropertyValueDefault< double >( rOutMap, PROP_ERROR_BAR_WEIGHT, 1.0 );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_ERROR_BAR_SHOW_POS_ERROR, true );
- ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_ERROR_BAR_SHOW_NEG_ERROR, true );
- }
-};
-
-struct StaticErrorBarDefaults : public rtl::StaticAggregate< ::chart::tPropertyValueMap, StaticErrorBarDefaults_Initializer >
-{
-};
-
-struct StaticErrorBarInfoHelper_Initializer
-{
- ::cppu::OPropertyArrayHelper* operator()()
- {
- static ::cppu::OPropertyArrayHelper aPropHelper( lcl_GetPropertySequence() );
- return &aPropHelper;
- }
-
-private:
- uno::Sequence< Property > lcl_GetPropertySequence()
- {
- ::std::vector< ::com::sun::star::beans::Property > aProperties;
- lcl_AddPropertiesToVector( aProperties );
- ::chart::LineProperties::AddPropertiesToVector( aProperties );
-
- ::std::sort( aProperties.begin(), aProperties.end(),
- ::chart::PropertyNameLess() );
-
- return ::chart::ContainerHelper::ContainerToSequence( aProperties );
- }
-
-};
-
-struct StaticErrorBarInfoHelper : public rtl::StaticAggregate< ::cppu::OPropertyArrayHelper, StaticErrorBarInfoHelper_Initializer >
-{
-};
-
-struct StaticErrorBarInfo_Initializer
+const SfxItemPropertySet* GetErrorBarPropertySet()
{
- uno::Reference< beans::XPropertySetInfo >* operator()()
+ static SfxItemPropertyMapEntry aErrorBarPropertyMap_Impl[] =
{
- static uno::Reference< beans::XPropertySetInfo > xPropertySetInfo(
- ::cppu::OPropertySetHelper::createPropertySetInfo(*StaticErrorBarInfoHelper::get() ) );
- return &xPropertySetInfo;
- }
-};
-
-struct StaticErrorBarInfo : public rtl::StaticAggregate< uno::Reference< beans::XPropertySetInfo >, StaticErrorBarInfo_Initializer >
-{
-};
-
-bool lcl_isInternalData( const uno::Reference< chart2::data::XLabeledDataSequence > & xLSeq )
-{
- uno::Reference< lang::XServiceInfo > xServiceInfo( xLSeq, uno::UNO_QUERY );
- return ( xServiceInfo.is() && xServiceInfo->getImplementationName() == "com.sun.star.comp.chart2.LabeledDataSequence" );
+ {MAP_CHAR_LEN("ShowPositiveError"),0,&getBooleanCppuType(), 0, 0},
+ {MAP_CHAR_LEN("ShowNegativeError"),1,&getBooleanCppuType(), 0, 0},
+ {MAP_CHAR_LEN("PositiveError"),2,&getCppuType((const double*)0),0,0},
+ {MAP_CHAR_LEN("NegativeError"),3,&getCppuType((const double*)0), 0, 0},
+ {MAP_CHAR_LEN("ErrorBarStyle"),4,&getCppuType((sal_Int32*)0),0,0},
+ {MAP_CHAR_LEN("Weight"),5,&getCppuType((const double*)0),0,0},
+ {MAP_CHAR_LEN(""),6,&getBooleanCppuType(), 0, 0},
+ {MAP_CHAR_LEN(""),7,&getCppuType((OUString*)0),0,0},
+ {0,0,0,0,0,0}
+ };
+ static SfxItemPropertySet aPropSet( aErrorBarPropertyMap_Impl );
+ return &aPropSet;
}
} // anonymous namespace
@@ -179,15 +79,23 @@ uno::Reference< beans::XPropertySet > createErrorBar( const uno::Reference< uno:
ErrorBar::ErrorBar(
uno::Reference< uno::XComponentContext > const & xContext ) :
- ::property::OPropertySet( m_aMutex ),
+ mbShowPositiveError(true),
+ mbShowNegativeError(true),
+ mfPositiveError(0),
+ mfNegativeError(0),
+ mfWeight(1),
m_xContext( xContext ),
m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{}
ErrorBar::ErrorBar( const ErrorBar & rOther ) :
- MutexContainer(),
- impl::ErrorBar_Base(),
- ::property::OPropertySet( rOther, m_aMutex ),
+ MutexContainer(),
+ impl::ErrorBar_Base(),
+ mbShowPositiveError(rOther.mbShowPositiveError),
+ mbShowNegativeError(rOther.mbShowNegativeError),
+ mfPositiveError(rOther.mfPositiveError),
+ mfNegativeError(rOther.mfNegativeError),
+ mfWeight(rOther.mfWeight),
m_xContext( rOther.m_xContext ),
m_xModifyEventForwarder( ModifyListenerHelper::createModifyEventForwarder())
{
@@ -211,29 +119,70 @@ uno::Reference< util::XCloneable > SAL_CALL ErrorBar::createClone()
return uno::Reference< util::XCloneable >( new ErrorBar( *this ));
}
-// ================================================================================
+// ____ XPropertySet ____
+uno::Reference< beans::XPropertySetInfo > SAL_CALL ErrorBar::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ static uno::Reference< beans::XPropertySetInfo > aRef (
+ new SfxItemPropertySetInfo( GetErrorBarPropertySet()->getPropertyMap() ) );
+ return aRef;
+}
-// ____ OPropertySet ____
-uno::Any ErrorBar::GetDefaultValue( sal_Int32 nHandle ) const
- throw(beans::UnknownPropertyException)
+void ErrorBar::setPropertyValue( const OUString& rPropName, const uno::Any& rAny )
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException,
+ lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
{
- const tPropertyValueMap& rStaticDefaults = *StaticErrorBarDefaults::get();
- tPropertyValueMap::const_iterator aFound( rStaticDefaults.find( nHandle ) );
- if( aFound == rStaticDefaults.end() )
- return uno::Any();
- return (*aFound).second;
+ if(rPropName == "ErrorBarStyle")
+ rAny >>= meStyle;
+ else if(rPropName == "PositiveError")
+ rAny >>= mfPositiveError;
+ else if(rPropName == "NegativeError")
+ rAny >>= mfNegativeError;
+ else if(rPropName == "ShowPositiveError")
+ rAny >>= mbShowPositiveError;
+ else if(rPropName == "ShowNegativeError")
+ rAny >>= mbShowNegativeError;
+ else
+ SAL_WARN("chart2", "asked for property value: " << rPropName);
}
-::cppu::IPropertyArrayHelper & SAL_CALL ErrorBar::getInfoHelper()
+uno::Any ErrorBar::getPropertyValue(const OUString& rPropName)
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
{
- return *StaticErrorBarInfoHelper::get();
+ uno::Any aRet;
+ if(rPropName == "ErrorBarStyle")
+ aRet <<= meStyle;
+ else if(rPropName == "PositiveError")
+ aRet <<= mfPositiveError;
+ else if(rPropName == "NegativeError")
+ aRet <<= mfNegativeError;
+ else if(rPropName == "ShowPositiveError")
+ aRet <<= mbShowPositiveError;
+ else if(rPropName == "ShowNegativeError")
+ aRet <<= mbShowNegativeError;
+ else
+ SAL_WARN("chart2", "asked for property value: " << rPropName);
+ return aRet;
}
-// ____ XPropertySet ____
-uno::Reference< beans::XPropertySetInfo > SAL_CALL ErrorBar::getPropertySetInfo()
- throw (uno::RuntimeException)
+void ErrorBar::addPropertyChangeListener( const OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& )
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+}
+
+void ErrorBar::removePropertyChangeListener( const OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyChangeListener >& )
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+}
+
+void ErrorBar::addVetoableChangeListener( const OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& )
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+}
+
+void ErrorBar::removeVetoableChangeListener( const OUString&, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XVetoableChangeListener >& )
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
{
- return *StaticErrorBarInfo::get();
}
// ____ XModifyBroadcaster ____
@@ -312,17 +261,6 @@ void SAL_CALL ErrorBar::setParent(
m_xParent.set( Parent );
}
-// ____ OPropertySet ____
-void ErrorBar::firePropertyChangeEvent()
-{
- fireModifyEvent();
-}
-
-void ErrorBar::fireModifyEvent()
-{
- m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this )));
-}
-
// ================================================================================
uno::Sequence< OUString > ErrorBar::getSupportedServiceNames_Static()
@@ -339,9 +277,6 @@ APPHELPER_XSERVICEINFO_IMPL( ErrorBar, lcl_aServiceName );
// needed by MSC compiler
using impl::ErrorBar_Base;
-IMPLEMENT_FORWARD_XINTERFACE2( ErrorBar, ErrorBar_Base, OPropertySet )
-IMPLEMENT_FORWARD_XTYPEPROVIDER2( ErrorBar, ErrorBar_Base, OPropertySet )
-
} // namespace chart
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */