summaryrefslogtreecommitdiff
path: root/chart2/source/controller/chartapiwrapper
diff options
context:
space:
mode:
Diffstat (limited to 'chart2/source/controller/chartapiwrapper')
-rw-r--r--chart2/source/controller/chartapiwrapper/AreaWrapper.cxx210
-rw-r--r--chart2/source/controller/chartapiwrapper/AreaWrapper.hxx108
-rw-r--r--chart2/source/controller/chartapiwrapper/AxisWrapper.cxx599
-rw-r--r--chart2/source/controller/chartapiwrapper/AxisWrapper.hxx143
-rw-r--r--chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx303
-rw-r--r--chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx162
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx667
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx138
-rw-r--r--chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx1686
-rw-r--r--chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx890
-rw-r--r--chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx163
-rw-r--r--chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx2116
-rw-r--r--chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx308
-rw-r--r--chart2/source/controller/chartapiwrapper/GridWrapper.cxx214
-rw-r--r--chart2/source/controller/chartapiwrapper/GridWrapper.hxx106
-rw-r--r--chart2/source/controller/chartapiwrapper/LegendWrapper.cxx462
-rw-r--r--chart2/source/controller/chartapiwrapper/LegendWrapper.hxx116
-rw-r--r--chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx438
-rw-r--r--chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx142
-rw-r--r--chart2/source/controller/chartapiwrapper/ReferenceSizePropertyProvider.hxx51
-rw-r--r--chart2/source/controller/chartapiwrapper/TitleWrapper.cxx537
-rw-r--r--chart2/source/controller/chartapiwrapper/TitleWrapper.hxx136
-rw-r--r--chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx405
-rw-r--r--chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx140
-rw-r--r--chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx195
-rw-r--r--chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx92
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAddInProperty.cxx161
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAddInProperty.hxx114
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx159
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.hxx52
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx451
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.hxx79
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.cxx175
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.hxx105
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx196
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.hxx64
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx204
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.hxx90
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx202
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx95
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx514
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx95
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx170
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.hxx57
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx134
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx85
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.cxx73
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.hxx63
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx192
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx290
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSplineProperties.hxx62
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx1158
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.hxx60
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx333
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedStockProperties.hxx62
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx596
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.hxx64
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.cxx90
-rw-r--r--chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.hxx61
-rw-r--r--chart2/source/controller/chartapiwrapper/makefile.mk81
60 files changed, 16914 insertions, 0 deletions
diff --git a/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx b/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx
new file mode 100644
index 000000000000..de6a2ed33838
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx
@@ -0,0 +1,210 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AreaWrapper.cxx,v $
+ * $Revision: 1.5.16.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "AreaWrapper.hxx"
+#include "macros.hxx"
+#include "ContainerHelper.hxx"
+#include "Chart2ModelContact.hxx"
+#include "WrappedDirectStateProperty.hxx"
+#include <comphelper/InlineContainer.hxx>
+#include <com/sun/star/drawing/FillStyle.hpp>
+
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+#include "UserDefinedProperties.hxx"
+
+#include <algorithm>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+namespace
+{
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.Area" ));
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+// ::chart::NamedProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+AreaWrapper::AreaWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
+ m_spChart2ModelContact( spChart2ModelContact ),
+ m_aEventListenerContainer( m_aMutex )
+{
+}
+
+AreaWrapper::~AreaWrapper()
+{}
+
+// ____ XShape ____
+awt::Point SAL_CALL AreaWrapper::getPosition()
+ throw (uno::RuntimeException)
+{
+ return awt::Point(0,0);
+}
+
+void SAL_CALL AreaWrapper::setPosition( const awt::Point& /*aPosition*/ )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( false, "trying to set position of chart area" );
+}
+
+awt::Size SAL_CALL AreaWrapper::getSize()
+ throw (uno::RuntimeException)
+{
+ return m_spChart2ModelContact->GetPageSize();
+}
+
+void SAL_CALL AreaWrapper::setSize( const awt::Size& /*aSize*/ )
+ throw (beans::PropertyVetoException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE( false, "trying to set size of chart area" );
+}
+
+// ____ XShapeDescriptor (base of XShape) ____
+::rtl::OUString SAL_CALL AreaWrapper::getShapeType()
+ throw (uno::RuntimeException)
+{
+ return C2U( "com.sun.star.chart.ChartArea" );
+}
+
+// ____ XComponent ____
+void SAL_CALL AreaWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+
+ // /--
+ MutexGuard aGuard( GetMutex());
+ clearWrappedPropertySet();
+ // \--
+}
+
+void SAL_CALL AreaWrapper::addEventListener(
+ const Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL AreaWrapper::removeEventListener(
+ const Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+// ================================================================================
+
+// WrappedPropertySet
+Reference< beans::XPropertySet > AreaWrapper::getInnerPropertySet()
+{
+ Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ if( xChartDoc.is() )
+ return xChartDoc->getPageBackground();
+ OSL_ENSURE(false,"AreaWrapper::getInnerPropertySet() is NULL");
+ return 0;
+}
+
+const Sequence< beans::Property >& AreaWrapper::getPropertySequence()
+{
+ return lcl_GetPropertySequence();
+}
+
+const std::vector< WrappedProperty* > AreaWrapper::createWrappedProperties()
+{
+ ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
+
+ aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U("LineStyle"), C2U("LineStyle") ) );
+
+ return aWrappedProperties;
+}
+
+// ================================================================================
+
+Sequence< ::rtl::OUString > AreaWrapper::getSupportedServiceNames_Static()
+{
+ Sequence< ::rtl::OUString > aServices( 4 );
+ aServices[ 0 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+ aServices[ 1 ] = C2U( "com.sun.star.beans.PropertySet" );
+ aServices[ 2 ] = C2U( "com.sun.star.drawing.FillProperties" );
+ aServices[ 3 ] = C2U( "com.sun.star.drawing.LineProperties" );
+
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( AreaWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/AreaWrapper.hxx b/chart2/source/controller/chartapiwrapper/AreaWrapper.hxx
new file mode 100644
index 000000000000..58ddba960cfe
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/AreaWrapper.hxx
@@ -0,0 +1,108 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AreaWrapper.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_AREAWRAPPER_HXX
+#define CHART_AREAWRAPPER_HXX
+
+#include "WrappedPropertySet.hxx"
+#include "ServiceMacros.hxx"
+#include <cppuhelper/implbase3.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+namespace wrapper
+{
+
+class Chart2ModelContact;
+
+class AreaWrapper : public ::cppu::ImplInheritanceHelper3<
+ WrappedPropertySet
+ , com::sun::star::drawing::XShape
+ , com::sun::star::lang::XComponent
+ , com::sun::star::lang::XServiceInfo
+ >
+{
+public:
+ AreaWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~AreaWrapper();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ____ XShape ____
+ virtual ::com::sun::star::awt::Point SAL_CALL getPosition()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize )
+ throw (::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XShapeDescriptor (base of XShape) ____
+ virtual ::rtl::OUString SAL_CALL getShapeType()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ // ____ WrappedPropertySet ____
+ virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
+ virtual const std::vector< WrappedProperty* > createWrappedProperties();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
+
+private:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_AREAWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
new file mode 100644
index 000000000000..7fd921e761dc
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx
@@ -0,0 +1,599 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AxisWrapper.cxx,v $
+ * $Revision: 1.11.8.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "AxisWrapper.hxx"
+#include "AxisHelper.hxx"
+#include "Chart2ModelContact.hxx"
+#include "ContainerHelper.hxx"
+#include "macros.hxx"
+#include "WrappedDirectStateProperty.hxx"
+#include <comphelper/InlineContainer.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart/ChartAxisArrangeOrderType.hpp>
+#include <com/sun/star/chart/ChartAxisPosition.hpp>
+#include <com/sun/star/chart/ChartAxisLabelPosition.hpp>
+#include <com/sun/star/chart/ChartAxisMarkPosition.hpp>
+
+#include "CharacterProperties.hxx"
+#include "LineProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "WrappedCharacterHeightProperty.hxx"
+#include "WrappedTextRotationProperty.hxx"
+#include "WrappedGapwidthProperty.hxx"
+#include "WrappedScaleProperty.hxx"
+#include "WrappedDefaultProperty.hxx"
+#include "WrappedNumberFormatProperty.hxx"
+#include "WrappedScaleTextProperties.hxx"
+
+#include <algorithm>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/math.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+using namespace ::chart::ContainerHelper;
+
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+
+namespace
+{
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.Axis" ));
+
+enum
+{
+ PROP_AXIS_MAX,
+ PROP_AXIS_MIN,
+ PROP_AXIS_STEPMAIN,
+ PROP_AXIS_STEPHELP, //deprecated property use 'StepHelpCount' instead
+ PROP_AXIS_STEPHELP_COUNT,
+ PROP_AXIS_AUTO_MAX,
+ PROP_AXIS_AUTO_MIN,
+ PROP_AXIS_AUTO_STEPMAIN,
+ PROP_AXIS_AUTO_STEPHELP,
+ PROP_AXIS_LOGARITHMIC,
+ PROP_AXIS_REVERSEDIRECTION,
+ PROP_AXIS_VISIBLE,
+ PROP_AXIS_CROSSOVER_POSITION,
+ PROP_AXIS_CROSSOVER_VALUE,
+ PROP_AXIS_ORIGIN,
+ PROP_AXIS_AUTO_ORIGIN,
+ PROP_AXIS_MARKS,
+ PROP_AXIS_HELPMARKS,
+ PROP_AXIS_MARK_POSITION,
+ PROP_AXIS_DISPLAY_LABELS,
+ PROP_AXIS_NUMBERFORMAT,
+ PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE,
+ PROP_AXIS_LABEL_POSITION,
+ PROP_AXIS_TEXT_ROTATION,
+ PROP_AXIS_ARRANGE_ORDER,
+ PROP_AXIS_TEXTBREAK,
+ PROP_AXIS_CAN_OVERLAP,
+ PROP_AXIS_STACKEDTEXT,
+ PROP_AXIS_OVERLAP,
+ PROP_AXIS_GAP_WIDTH
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ //Properties for scaling:
+ rOutProperties.push_back(
+ Property( C2U( "Max" ),
+ PROP_AXIS_MAX,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "Min" ),
+ PROP_AXIS_MIN,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "StepMain" ),
+ PROP_AXIS_STEPMAIN,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "StepHelpCount" ),
+ PROP_AXIS_STEPHELP_COUNT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ //deprecated property use 'StepHelpCount' instead
+ rOutProperties.push_back(
+ Property( C2U( "StepHelp" ),
+ PROP_AXIS_STEPHELP,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "AutoMax" ),
+ PROP_AXIS_AUTO_MAX,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "AutoMin" ),
+ PROP_AXIS_AUTO_MIN,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "AutoStepMain" ),
+ PROP_AXIS_AUTO_STEPMAIN,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "AutoStepHelp" ),
+ PROP_AXIS_AUTO_STEPHELP,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "Logarithmic" ),
+ PROP_AXIS_LOGARITHMIC,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ReverseDirection" ),
+ PROP_AXIS_REVERSEDIRECTION,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ //todo: this property is missing in the API
+ rOutProperties.push_back(
+ Property( C2U( "Visible" ),
+ PROP_AXIS_VISIBLE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "CrossoverPosition" ),
+ PROP_AXIS_CROSSOVER_POSITION,
+ ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisPosition * >(0)),
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "CrossoverValue" ),
+ PROP_AXIS_CROSSOVER_VALUE,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::MAYBEVOID ));
+
+
+ rOutProperties.push_back(
+ Property( C2U( "Origin" ),
+ PROP_AXIS_ORIGIN,
+ ::getCppuType( reinterpret_cast< const double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "AutoOrigin" ),
+ PROP_AXIS_AUTO_ORIGIN,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ //Properties for interval marks:
+ rOutProperties.push_back(
+ Property( C2U( "Marks" ),
+ PROP_AXIS_MARKS,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "HelpMarks" ),
+ PROP_AXIS_HELPMARKS,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "MarkPosition" ),
+ PROP_AXIS_MARK_POSITION,
+ ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisMarkPosition * >(0)),
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+
+ //Properties for labels:
+ rOutProperties.push_back(
+ Property( C2U( "DisplayLabels" ),
+ PROP_AXIS_DISPLAY_LABELS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "NumberFormat" ),
+ PROP_AXIS_NUMBERFORMAT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LinkNumberFormatToSource" ),
+ PROP_AXIS_LINK_NUMBERFORMAT_TO_SOURCE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LabelPosition" ),
+ PROP_AXIS_LABEL_POSITION,
+ ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisLabelPosition * >(0)),
+ beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "TextRotation" ),
+ PROP_AXIS_TEXT_ROTATION,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "ArrangeOrder" ),
+ PROP_AXIS_ARRANGE_ORDER,
+ ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartAxisArrangeOrderType * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "TextBreak" ),
+ PROP_AXIS_TEXTBREAK,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "TextCanOverlap" ),
+ PROP_AXIS_CAN_OVERLAP,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "StackedText" ),
+ PROP_AXIS_STACKEDTEXT,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // Properties related to bar charts:
+ rOutProperties.push_back(
+ Property( C2U( "Overlap" ),
+ PROP_AXIS_OVERLAP,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "GapWidth" ),
+ PROP_AXIS_GAP_WIDTH,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+// ::chart::NamedLineProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+ ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+AxisWrapper::AxisWrapper(
+ tAxisType eType, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
+ m_spChart2ModelContact( spChart2ModelContact ),
+ m_aEventListenerContainer( m_aMutex ),
+ m_eType( eType )
+{
+}
+
+AxisWrapper::~AxisWrapper()
+{
+}
+
+// ____ XShape ____
+awt::Point SAL_CALL AxisWrapper::getPosition()
+ throw (uno::RuntimeException)
+{
+ awt::Point aResult( m_spChart2ModelContact->GetAxisPosition( this->getAxis() ) );
+ return aResult;
+}
+
+void SAL_CALL AxisWrapper::setPosition( const awt::Point& /*aPosition*/ )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE( false, "trying to set position of Axis" );
+}
+
+awt::Size SAL_CALL AxisWrapper::getSize()
+ throw (uno::RuntimeException)
+{
+ awt::Size aSize( m_spChart2ModelContact->GetAxisSize( this->getAxis() ) );
+ return aSize;
+}
+
+void SAL_CALL AxisWrapper::setSize( const awt::Size& /*aSize*/ )
+ throw (beans::PropertyVetoException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE( false, "trying to set size of Axis" );
+}
+
+// ____ XShapeDescriptor (base of XShape) ____
+OUString SAL_CALL AxisWrapper::getShapeType()
+ throw (uno::RuntimeException)
+{
+ return C2U( "com.sun.star.chart.ChartAxis" );
+}
+
+// ____ XNumberFormatsSupplier ____
+uno::Reference< beans::XPropertySet > SAL_CALL AxisWrapper::getNumberFormatSettings()
+ throw (uno::RuntimeException)
+{
+ Reference< util::XNumberFormatsSupplier > xNumSuppl( m_spChart2ModelContact->getChartModel(), uno::UNO_QUERY );
+ if( xNumSuppl.is() )
+ return xNumSuppl->getNumberFormatSettings();
+
+ return uno::Reference< beans::XPropertySet >();
+}
+
+uno::Reference< util::XNumberFormats > SAL_CALL AxisWrapper::getNumberFormats()
+ throw (uno::RuntimeException)
+{
+ Reference< util::XNumberFormatsSupplier > xNumSuppl( m_spChart2ModelContact->getChartModel(), uno::UNO_QUERY );
+ if( xNumSuppl.is() )
+ return xNumSuppl->getNumberFormats();
+
+ return uno::Reference< util::XNumberFormats >();
+}
+
+// static
+void AxisWrapper::getDimensionAndMainAxisBool( tAxisType eType, sal_Int32& rnDimensionIndex, sal_Bool& rbMainAxis )
+{
+ switch( eType )
+ {
+ case X_AXIS:
+ rnDimensionIndex = 0; rbMainAxis = sal_True; break;
+ case Y_AXIS:
+ rnDimensionIndex = 1; rbMainAxis = sal_True; break;
+ case Z_AXIS:
+ rnDimensionIndex = 2; rbMainAxis = sal_True; break;
+ case SECOND_X_AXIS:
+ rnDimensionIndex = 0; rbMainAxis = sal_False; break;
+ case SECOND_Y_AXIS:
+ rnDimensionIndex = 1; rbMainAxis = sal_False; break;
+ }
+}
+
+// ____ XComponent ____
+void SAL_CALL AxisWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+
+ clearWrappedPropertySet();
+}
+
+void SAL_CALL AxisWrapper::addEventListener(
+ const Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL AxisWrapper::removeEventListener(
+ const Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+// ================================================================================
+
+//ReferenceSizePropertyProvider
+void AxisWrapper::updateReferenceSize()
+{
+ Reference< beans::XPropertySet > xProp( this->getAxis(), uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ if( xProp->getPropertyValue( C2U("ReferencePageSize") ).hasValue() )
+ xProp->setPropertyValue( C2U("ReferencePageSize"), uno::makeAny(
+ m_spChart2ModelContact->GetPageSize() ));
+ }
+}
+Any AxisWrapper::getReferenceSize()
+{
+ Any aRet;
+ Reference< beans::XPropertySet > xProp( this->getAxis(), uno::UNO_QUERY );
+ if( xProp.is() )
+ aRet = xProp->getPropertyValue( C2U("ReferencePageSize") );
+ return aRet;
+}
+awt::Size AxisWrapper::getCurrentSizeForReference()
+{
+ return m_spChart2ModelContact->GetPageSize();
+}
+
+// ================================================================================
+
+Reference< chart2::XAxis > AxisWrapper::getAxis()
+{
+ Reference< chart2::XAxis > xAxis;
+ try
+ {
+ sal_Int32 nDimensionIndex = 0;
+ sal_Bool bMainAxis = sal_True;
+ AxisWrapper::getDimensionAndMainAxisBool( m_eType, nDimensionIndex, bMainAxis );
+
+ Reference< XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ xAxis = AxisHelper::getAxis( nDimensionIndex, bMainAxis, xDiagram );
+ if( !xAxis.is() )
+ {
+ xAxis = AxisHelper::createAxis( nDimensionIndex, bMainAxis, xDiagram, m_spChart2ModelContact->m_xContext );
+ Reference< beans::XPropertySet > xProp( xAxis, uno::UNO_QUERY );
+ if( xProp.is() )
+ xProp->setPropertyValue( C2U( "Show" ), uno::makeAny( sal_False ) );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return xAxis;
+}
+
+// WrappedPropertySet
+Reference< beans::XPropertySet > AxisWrapper::getInnerPropertySet()
+{
+ return Reference< beans::XPropertySet >( this->getAxis(), uno::UNO_QUERY );
+}
+
+const Sequence< beans::Property >& AxisWrapper::getPropertySequence()
+{
+ return lcl_GetPropertySequence();
+}
+
+const std::vector< WrappedProperty* > AxisWrapper::createWrappedProperties()
+{
+ ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
+
+ aWrappedProperties.push_back( new WrappedTextRotationProperty() );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "Marks" ), C2U( "MajorTickmarks" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "HelpMarks" ), C2U( "MinorTickmarks" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "TextCanOverlap" ), C2U( "TextOverlap" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "ArrangeOrder" ), C2U( "ArrangeOrder" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "Visible" ), C2U( "Show" ) ) );
+ aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U( "DisplayLabels" ), C2U( "DisplayLabels" ) ) );
+ aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U( "TextBreak" ), C2U( "TextBreak" ) ) );
+ WrappedNumberFormatProperty* pWrappedNumberFormatProperty = new WrappedNumberFormatProperty( m_spChart2ModelContact );
+ aWrappedProperties.push_back( pWrappedNumberFormatProperty );
+ aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(pWrappedNumberFormatProperty) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "StackedText" ), C2U( "StackCharacters" ) ) );
+ aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U( "CrossoverPosition" ), C2U( "CrossoverPosition" ) ) );
+ {
+ WrappedGapwidthProperty* pWrappedGapwidthProperty( new WrappedGapwidthProperty( m_spChart2ModelContact ) );
+ WrappedBarOverlapProperty* pWrappedBarOverlapProperty( new WrappedBarOverlapProperty( m_spChart2ModelContact ) );
+ sal_Int32 nDimensionIndex = 0;
+ sal_Bool bMainAxis = sal_True;
+ sal_Int32 nAxisIndex = 0;
+ AxisWrapper::getDimensionAndMainAxisBool( m_eType, nDimensionIndex, bMainAxis );
+ if( !bMainAxis )
+ nAxisIndex = 1;
+ pWrappedGapwidthProperty->setDimensionAndAxisIndex( nDimensionIndex, nAxisIndex );
+ pWrappedBarOverlapProperty->setDimensionAndAxisIndex( nDimensionIndex, nAxisIndex );
+ aWrappedProperties.push_back( pWrappedGapwidthProperty );
+ aWrappedProperties.push_back( pWrappedBarOverlapProperty );
+ }
+
+ WrappedScaleProperty::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+
+ WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
+ WrappedScaleTextProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+
+ return aWrappedProperties;
+}
+
+// ================================================================================
+
+Sequence< OUString > AxisWrapper::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 3 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart.ChartAxis" );
+ aServices[ 1 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+ aServices[ 2 ] = C2U( "com.sun.star.style.CharacterProperties" );
+// aServices[ 3 ] = C2U( "com.sun.star.beans.PropertySet" );
+// aServices[ 4 ] = C2U( "com.sun.star.drawing.LineProperties" );
+
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( AxisWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx
new file mode 100644
index 000000000000..b7708dcf2ac2
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.hxx
@@ -0,0 +1,143 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: AxisWrapper.hxx,v $
+ * $Revision: 1.6.8.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_AXISWRAPPER_HXX
+#define CHART_AXISWRAPPER_HXX
+
+#include "WrappedPropertySet.hxx"
+#include "ReferenceSizePropertyProvider.hxx"
+#include "ServiceMacros.hxx"
+#include <cppuhelper/implbase4.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/chart2/XAxis.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/util/XNumberFormatsSupplier.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+namespace wrapper
+{
+
+class Chart2ModelContact;
+
+class AxisWrapper : public ::cppu::ImplInheritanceHelper4<
+ WrappedPropertySet
+ , com::sun::star::drawing::XShape
+ , com::sun::star::lang::XComponent
+ , com::sun::star::lang::XServiceInfo
+ , com::sun::star::util::XNumberFormatsSupplier
+ >
+ , public ReferenceSizePropertyProvider
+{
+public:
+ enum tAxisType
+ {
+ X_AXIS,
+ Y_AXIS,
+ Z_AXIS,
+ SECOND_X_AXIS,
+ SECOND_Y_AXIS
+ };
+
+ AxisWrapper( tAxisType eType, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~AxisWrapper();
+
+ static void getDimensionAndMainAxisBool( tAxisType eType, sal_Int32& rnDimensionIndex, sal_Bool& rbMainAxis );
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ //ReferenceSizePropertyProvider
+ virtual void updateReferenceSize();
+ virtual ::com::sun::star::uno::Any getReferenceSize();
+ virtual ::com::sun::star::awt::Size getCurrentSizeForReference();
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XShape ____
+ virtual ::com::sun::star::awt::Point SAL_CALL getPosition()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize )
+ throw (::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XShapeDescriptor (base of XShape) ____
+ virtual ::rtl::OUString SAL_CALL getShapeType()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XNumberFormatsSupplier ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getNumberFormatSettings()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::util::XNumberFormats > SAL_CALL getNumberFormats()
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ // ____ WrappedPropertySet ____
+ virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
+ virtual const std::vector< WrappedProperty* > createWrappedProperties();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
+
+private: //methods
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > getAxis();
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+
+ tAxisType m_eType;
+ ::com::sun::star::uno::Any m_aTemporaryHelpStepValue;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_AXISWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
new file mode 100644
index 000000000000..3d930f72f0af
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.cxx
@@ -0,0 +1,303 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: Chart2ModelContact.cxx,v $
+ * $Revision: 1.4.44.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "Chart2ModelContact.hxx"
+#include "ChartModelHelper.hxx"
+#include "LegendHelper.hxx"
+#include "CommonConverters.hxx"
+#include "macros.hxx"
+#include "servicenames.hxx"
+#include "ObjectIdentifier.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "chartview/DrawModelWrapper.hxx"
+#include "AxisHelper.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace chart
+{
+namespace wrapper
+{
+
+namespace
+{
+
+rtl::OUString lcl_getCIDForDiagram( const Reference< frame::XModel >& xChartModel )
+{
+ uno::Reference< XDiagram > xDiagram( ChartModelHelper::findDiagram( xChartModel ) );
+ return ObjectIdentifier::createClassifiedIdentifierForObject( xDiagram, xChartModel );
+}
+
+} //anonymous namespace
+
+Chart2ModelContact::Chart2ModelContact(
+ const Reference< uno::XComponentContext > & xContext ) :
+ m_xContext( xContext ),
+ m_xChartModel( 0 ),
+ m_xChartView(0)
+{
+}
+
+Chart2ModelContact::~Chart2ModelContact()
+{
+ this->clear();
+}
+
+void Chart2ModelContact::setModel( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel )
+{
+ this->clear();
+ m_xChartModel = xChartModel;
+ uno::Reference< lang::XMultiServiceFactory > xTableFactory( xChartModel, uno::UNO_QUERY );
+ if( xTableFactory.is() )
+ {
+ uno::Reference< container::XNameContainer > xDashTable( xTableFactory->createInstance( C2U( "com.sun.star.drawing.DashTable" ) ), uno::UNO_QUERY );
+ uno::Reference< container::XNameContainer > xGradientTable( xTableFactory->createInstance( C2U( "com.sun.star.drawing.GradientTable" ) ), uno::UNO_QUERY );
+ uno::Reference< container::XNameContainer > xHatchTable( xTableFactory->createInstance( C2U( "com.sun.star.drawing.HatchTable" ) ), uno::UNO_QUERY );
+ uno::Reference< container::XNameContainer > xBitmapTable( xTableFactory->createInstance( C2U( "com.sun.star.drawing.BitmapTable" ) ), uno::UNO_QUERY );
+ uno::Reference< container::XNameContainer > xTransparencyGradientTable( xTableFactory->createInstance( C2U( "com.sun.star.drawing.TransparencyGradientTable" ) ), uno::UNO_QUERY );
+ //C2U( "com.sun.star.drawing.MarkerTable" )
+ m_aTableMap[ C2U( "LineDashName" ) ] = xDashTable;
+ m_aTableMap[ C2U( "FillGradientName" ) ] = xGradientTable;
+ m_aTableMap[ C2U( "FillHatchName" ) ] = xHatchTable;
+ m_aTableMap[ C2U( "FillBitmapName" ) ] = xBitmapTable;
+ m_aTableMap[ C2U( "FillTransparenceGradientName" ) ] = xTransparencyGradientTable;
+ }
+}
+
+void Chart2ModelContact::clear()
+{
+ m_xChartModel = uno::WeakReference< frame::XModel >(0);
+ m_xChartView.clear();
+}
+
+Reference< frame::XModel > Chart2ModelContact::getChartModel() const
+{
+ return Reference< frame::XModel >( m_xChartModel.get(), uno::UNO_QUERY );
+}
+
+Reference< chart2::XChartDocument > Chart2ModelContact::getChart2Document() const
+{
+ return Reference< chart2::XChartDocument >( m_xChartModel.get(), uno::UNO_QUERY );
+}
+
+Reference< chart2::XDiagram > Chart2ModelContact::getChart2Diagram() const
+{
+ return ChartModelHelper::findDiagram( this->getChartModel() );
+}
+
+ExplicitValueProvider* Chart2ModelContact::getExplicitValueProvider() const
+{
+ if(!m_xChartView.is())
+ {
+ // get the chart view
+ Reference<frame::XModel> xModel(m_xChartModel);
+ uno::Reference< lang::XMultiServiceFactory > xFact( xModel, uno::UNO_QUERY );
+ if( xFact.is() )
+ m_xChartView = Reference< lang::XUnoTunnel >( xFact->createInstance( CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
+ }
+
+ if(!m_xChartView.is())
+ return 0;
+
+ //obtain the ExplicitValueProvider from the chart view
+ ExplicitValueProvider* pProvider = reinterpret_cast<ExplicitValueProvider*>(m_xChartView->getSomething(
+ ExplicitValueProvider::getUnoTunnelId() ));
+ return pProvider;
+}
+
+uno::Reference< drawing::XDrawPage > Chart2ModelContact::getDrawPage()
+{
+ uno::Reference< drawing::XDrawPage > xResult;
+ ExplicitValueProvider* pProvider( getExplicitValueProvider() );
+ if( pProvider )
+ {
+ xResult.set( pProvider->getDrawModelWrapper()->getMainDrawPage() );
+ }
+ return xResult;
+}
+
+sal_Bool Chart2ModelContact::getExplicitValuesForAxis(
+ const Reference< XAxis > & xAxis,
+ ExplicitScaleData & rOutExplicitScale,
+ ExplicitIncrementData & rOutExplicitIncrement )
+{
+ ExplicitValueProvider* pProvider( getExplicitValueProvider() );
+ if( pProvider )
+ {
+ return pProvider->getExplicitValuesForAxis(
+ xAxis, rOutExplicitScale, rOutExplicitIncrement );
+ }
+ return sal_False;
+}
+
+sal_Int32 Chart2ModelContact::getExplicitNumberFormatKeyForAxis(
+ const Reference< chart2::XAxis >& xAxis )
+{
+ Reference< chart2::XCoordinateSystem > xCooSys(
+ AxisHelper::getCoordinateSystemOfAxis(
+ xAxis, ChartModelHelper::findDiagram( m_xChartModel ) ) );
+
+ return ExplicitValueProvider::getExplicitNumberFormatKeyForAxis( xAxis, xCooSys
+ , Reference< util::XNumberFormatsSupplier >( m_xChartModel.get(), uno::UNO_QUERY ) );
+}
+
+sal_Int32 Chart2ModelContact::getExplicitNumberFormatKeyForSeries(
+ const Reference< chart2::XDataSeries >& xSeries )
+{
+ return ExplicitValueProvider::getExplicitNumberFormatKeyForDataLabel(
+ uno::Reference< beans::XPropertySet >( xSeries, uno::UNO_QUERY ),
+ xSeries,
+ -1 /*-1 for whole series*/,
+ ChartModelHelper::findDiagram( m_xChartModel )
+ );
+}
+
+//-----------------------------------------------------------------------------
+
+awt::Size Chart2ModelContact::GetPageSize() const
+{
+ return ChartModelHelper::getPageSize(m_xChartModel);
+}
+
+awt::Rectangle Chart2ModelContact::GetDiagramRectangleInclusive() const
+{
+ awt::Rectangle aRect;
+
+ ExplicitValueProvider* pProvider( getExplicitValueProvider() );
+ if( pProvider )
+ {
+ aRect = pProvider->getRectangleOfObject( lcl_getCIDForDiagram( m_xChartModel ) );
+ }
+ //add axis title sizes to the diagram size
+ aRect = ExplicitValueProvider::calculateDiagramPositionAndSizeInclusiveTitle(
+ m_xChartModel, m_xChartView, aRect );
+
+ return aRect;
+}
+
+awt::Size Chart2ModelContact::GetDiagramSizeInclusive() const
+{
+ return ToSize( this->GetDiagramRectangleInclusive() );
+}
+
+awt::Point Chart2ModelContact::GetDiagramPositionInclusive() const
+{
+ return ToPoint( this->GetDiagramRectangleInclusive() );
+}
+
+awt::Size Chart2ModelContact::GetLegendSize() const
+{
+ awt::Size aSize;
+ ExplicitValueProvider* pProvider( getExplicitValueProvider() );
+ if( pProvider )
+ {
+ uno::Reference< chart2::XLegend > xLegend( LegendHelper::getLegend( m_xChartModel ) );
+ rtl::OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xLegend, m_xChartModel ) );
+ aSize = ToSize( pProvider->getRectangleOfObject( aCID ) );
+ }
+ return aSize;
+}
+
+awt::Point Chart2ModelContact::GetLegendPosition() const
+{
+ awt::Point aPoint;
+ ExplicitValueProvider* pProvider( getExplicitValueProvider() );
+ if( pProvider )
+ {
+ uno::Reference< chart2::XLegend > xLegend( LegendHelper::getLegend( m_xChartModel ) );
+ rtl::OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xLegend, m_xChartModel ) );
+ aPoint = ToPoint( pProvider->getRectangleOfObject( aCID ) );
+ }
+ return aPoint;
+}
+
+awt::Size Chart2ModelContact::GetTitleSize( const uno::Reference<
+ ::com::sun::star::chart2::XTitle > & xTitle ) const
+{
+ awt::Size aSize;
+ ExplicitValueProvider* pProvider( getExplicitValueProvider() );
+ if( pProvider && xTitle.is() )
+ {
+ rtl::OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle, m_xChartModel ) );
+ aSize = ToSize( pProvider->getRectangleOfObject( aCID ) );
+ }
+ return aSize;
+}
+
+awt::Point Chart2ModelContact::GetTitlePosition( const uno::Reference<
+ ::com::sun::star::chart2::XTitle > & xTitle ) const
+{
+ awt::Point aPoint;
+ ExplicitValueProvider* pProvider( getExplicitValueProvider() );
+ if( pProvider && xTitle.is() )
+ {
+ rtl::OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xTitle, m_xChartModel ) );
+ aPoint = ToPoint( pProvider->getRectangleOfObject( aCID ) );
+ }
+ return aPoint;
+}
+
+awt::Size Chart2ModelContact::GetAxisSize( const uno::Reference<
+ ::com::sun::star::chart2::XAxis > & xAxis ) const
+{
+ awt::Size aSize;
+ ExplicitValueProvider* pProvider( getExplicitValueProvider() );
+ if( pProvider && xAxis.is() )
+ {
+ rtl::OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xAxis, m_xChartModel ) );
+ aSize = ToSize( pProvider->getRectangleOfObject( aCID ) );
+ }
+ return aSize;
+}
+
+awt::Point Chart2ModelContact::GetAxisPosition( const uno::Reference<
+ ::com::sun::star::chart2::XAxis > & xAxis ) const
+{
+ awt::Point aPoint;
+ ExplicitValueProvider* pProvider( getExplicitValueProvider() );
+ if( pProvider && xAxis.is() )
+ {
+ rtl::OUString aCID( ObjectIdentifier::createClassifiedIdentifierForObject( xAxis, m_xChartModel ) );
+ aPoint = ToPoint( pProvider->getRectangleOfObject( aCID ) );
+ }
+ return aPoint;
+}
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
new file mode 100644
index 000000000000..0cc8a16bafff
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/Chart2ModelContact.hxx
@@ -0,0 +1,162 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: Chart2ModelContact.hxx,v $
+ * $Revision: 1.3.44.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_CHART2MODELCONTACT_HXX
+#define CHART_CHART2MODELCONTACT_HXX
+
+#include <com/sun/star/chart2/ExplicitScaleData.hpp>
+#include <com/sun/star/chart2/ExplicitIncrementData.hpp>
+#include <com/sun/star/chart2/XAxis.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/chart2/XTitle.hpp>
+#include <cppuhelper/weakref.hxx>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/container/XNameContainer.hpp>
+#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/lang/XUnoTunnel.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <map>
+
+namespace chart
+{
+class ExplicitValueProvider;
+
+namespace wrapper
+{
+
+class Chart2ModelContact
+{
+public:
+ Chart2ModelContact( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >& xContext );
+ virtual ~Chart2ModelContact();
+
+public:
+ void setModel( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel >& xChartModel );
+ void clear();
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::frame::XModel > getChartModel() const;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XChartDocument > getChart2Document() const;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > getChart2Diagram() const;
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > getDrawPage();
+
+ /** get the current values calculated for an axis in the current view in
+ case properties are 'auto'.
+ */
+ sal_Bool getExplicitValuesForAxis(
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis > & xAxis,
+ ::com::sun::star::chart2::ExplicitScaleData & rOutExplicitScale,
+ ::com::sun::star::chart2::ExplicitIncrementData & rOutExplicitIncrement );
+
+ sal_Int32 getExplicitNumberFormatKeyForAxis(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis );
+
+ sal_Int32 getExplicitNumberFormatKeyForSeries(
+ const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries );
+
+ /** Returns the size of the page in logic coordinates. This value is used
+ for setting an appropriate "ReferencePageSize" for FontHeights.
+ */
+ ::com::sun::star::awt::Size GetPageSize() const;
+
+ /** Returns the size of the diagram object in logic coordinates inclusive
+ the space reserved for axis titles.
+ */
+ ::com::sun::star::awt::Size GetDiagramSizeInclusive() const;
+
+ /** Returns the position of the diagram in logic coordinates inclusive
+ the space reserved for axis titles.
+ */
+ ::com::sun::star::awt::Point GetDiagramPositionInclusive() const;
+
+ /** Returns the size of the object in logic coordinates.
+ */
+ ::com::sun::star::awt::Size GetLegendSize() const;
+
+ /** Returns the position of the object in logic coordinates.
+ */
+ ::com::sun::star::awt::Point GetLegendPosition() const;
+
+ /** Returns the size of the object in logic coordinates.
+ */
+ ::com::sun::star::awt::Size GetTitleSize( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle > & xTitle ) const;
+
+ /** Returns the position of the object in logic coordinates.
+ */
+ ::com::sun::star::awt::Point GetTitlePosition( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XTitle > & xTitle ) const;
+
+
+ /** Returns the size of the object in logic coordinates.
+ */
+ ::com::sun::star::awt::Size GetAxisSize( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis > & xAxis ) const;
+
+ /** Returns the position of the object in logic coordinates.
+ */
+ ::com::sun::star::awt::Point GetAxisPosition( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XAxis > & xAxis ) const;
+
+private: //methods
+ ExplicitValueProvider* getExplicitValueProvider() const;
+ ::com::sun::star::awt::Rectangle GetDiagramRectangleInclusive() const;
+
+public: //member
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::uno::XComponentContext >
+ m_xContext;
+
+private: //member
+ ::com::sun::star::uno::WeakReference<
+ ::com::sun::star::frame::XModel > m_xChartModel;
+
+ mutable ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XUnoTunnel > m_xChartView;
+
+ typedef std::map< ::rtl::OUString, ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > > tTableMap;//GradientTable, HatchTable etc.
+ tTableMap m_aTableMap;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_CHART2MODELCONTACT_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx
new file mode 100644
index 000000000000..8cbb0c5af80c
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx
@@ -0,0 +1,667 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ChartDataWrapper.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ChartDataWrapper.hxx"
+#include "macros.hxx"
+#include "DiagramHelper.hxx"
+#include "DataSourceHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include "CommonFunctors.hxx"
+#include "ChartModelHelper.hxx"
+#include "DataSeriesHelper.hxx"
+#include "ControllerLockGuard.hxx"
+#include "Chart2ModelContact.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/XTitled.hpp>
+#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp>
+#include <com/sun/star/chart2/data/XTextualDataSequence.hpp>
+#include <com/sun/star/chart2/data/XDataSource.hpp>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp>
+#include <com/sun/star/chart2/XChartTypeContainer.hpp>
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/chart/XChartDocument.hpp>
+
+#include "CharacterProperties.hxx"
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+
+#include <map>
+#include <algorithm>
+#include <rtl/math.hxx>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+using ::osl::MutexGuard;
+
+namespace
+{
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.ChartData" ));
+
+struct lcl_DataSequenceToDoubleSeq : public ::std::unary_function<
+ uno::Reference< chart2::data::XDataSequence >,
+ uno::Sequence< double > >
+{
+ uno::Sequence< double > operator() ( const uno::Reference< chart2::data::XDataSequence > & xSeq )
+ {
+ uno::Reference< chart2::data::XNumericalDataSequence > xNumSeq( xSeq, uno::UNO_QUERY );
+ if( xNumSeq.is())
+ {
+ return xNumSeq->getNumericalData();
+ }
+ else if( xSeq.is())
+ {
+ uno::Sequence< uno::Any > aValues = xSeq->getData();
+ uno::Sequence< double > aResult( aValues.getLength());
+ const sal_Int32 nLength = aValues.getLength();
+ for( sal_Int32 i = 0; i < nLength; ++i )
+ {
+ if( ! ( aValues[ i ] >>= aResult[ i ]) )
+ {
+ aResult[ i ] = DBL_MIN;
+ }
+ double& rValue = aResult[ i ];
+ if( ::rtl::math::isNan( rValue ) )
+ rValue = DBL_MIN;
+ }
+ return aResult;
+ }
+ return uno::Sequence< double >();
+ }
+};
+
+void lcl_AddSequences( uno::Reference< chart2::data::XLabeledDataSequence > xLSeq,
+ ::std::vector< uno::Reference< chart2::data::XDataSequence > > & rOutSeqVector,
+ ::std::vector< ::rtl::OUString > & rOutLabelVector )
+{
+ if( xLSeq.is() )
+ {
+ uno::Reference< chart2::data::XDataSequence > xSeq( xLSeq->getValues() );
+ rOutSeqVector.push_back( xSeq );
+
+ ::rtl::OUString aLabel( ::chart::DataSeriesHelper::getLabelForLabeledDataSequence( xLSeq ) );
+ rOutLabelVector.push_back( aLabel );
+ }
+}
+
+uno::Sequence< uno::Sequence< double > > lcl_getNANInsteadDBL_MIN( const uno::Sequence< uno::Sequence< double > >& rData )
+{
+ uno::Sequence< uno::Sequence< double > > aRet;
+ const sal_Int32 nOuterSize = rData.getLength();
+ aRet.realloc( nOuterSize );
+ for( sal_Int32 nOuter=0; nOuter<nOuterSize; ++nOuter )
+ {
+ sal_Int32 nInnerSize = rData[nOuter].getLength();
+ aRet[nOuter].realloc( nInnerSize );
+ for( sal_Int32 nInner=0; nInner<nInnerSize; ++nInner )
+ {
+ aRet[nOuter][nInner] = rData[nOuter][nInner];
+ double& rValue = aRet[nOuter][nInner];
+ if( rValue == DBL_MIN )
+ ::rtl::math::setNan( &rValue );
+ }
+ }
+ return aRet;
+}
+
+uno::Sequence< uno::Sequence< double > > lcl_getDBL_MINInsteadNAN( const uno::Sequence< uno::Sequence< double > >& rData )
+{
+ uno::Sequence< uno::Sequence< double > > aRet;
+ const sal_Int32 nOuterSize = rData.getLength();
+ aRet.realloc( nOuterSize );
+ for( sal_Int32 nOuter=0; nOuter<nOuterSize; ++nOuter )
+ {
+ sal_Int32 nInnerSize = rData[nOuter].getLength();
+ aRet[nOuter].realloc( nInnerSize );
+ for( sal_Int32 nInner=0; nInner<nInnerSize; ++nInner )
+ {
+ aRet[nOuter][nInner] = rData[nOuter][nInner];
+ double& rValue = aRet[nOuter][nInner];
+ if( ::rtl::math::isNan( rValue ) )
+ rValue = DBL_MIN;
+ }
+ }
+ return aRet;
+}
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+ChartDataWrapper::ChartDataWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
+ m_spChart2ModelContact( spChart2ModelContact ),
+ m_aEventListenerContainer( m_aMutex )
+{
+ refreshData();
+}
+
+ChartDataWrapper::~ChartDataWrapper()
+{
+ // @todo: implement XComponent and call this in dispose(). In the DTOR the
+ // ref-count is 0, thus creating a stack reference to this calls the DTOR at
+ // the end of the block recursively
+// uno::Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+// m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+}
+
+// ____ XChartDataArray ____
+uno::Sequence< uno::Sequence< double > > SAL_CALL ChartDataWrapper::getData()
+ throw (uno::RuntimeException)
+{
+ // until we have a data change notification mechanism we always have to
+ // update the data here
+ refreshData();
+ // /--
+ MutexGuard aGuard( GetMutex());
+ return m_aData;
+ // \--
+}
+
+void SAL_CALL ChartDataWrapper::setData(
+ const uno::Sequence< uno::Sequence< double > >& aData )
+ throw (uno::RuntimeException)
+{
+ refreshData();
+ {
+ // /--
+ MutexGuard aGuard( GetMutex());
+ m_aData = aData;
+ // \--
+ }
+ applyData( true, false, false );
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL ChartDataWrapper::getRowDescriptions()
+ throw (uno::RuntimeException)
+{
+ // until we have a data change notification mechanism we always have to
+ // update the data here
+ refreshData();
+
+ // /--
+ MutexGuard aGuard( GetMutex());
+ return m_aRowDescriptions;
+ // \--
+}
+
+void SAL_CALL ChartDataWrapper::setRowDescriptions(
+ const uno::Sequence< ::rtl::OUString >& aRowDescriptions )
+ throw (uno::RuntimeException)
+{
+ refreshData();
+ {
+ // /--
+ MutexGuard aGuard( GetMutex());
+ m_aRowDescriptions = aRowDescriptions;
+ // \--
+ }
+ applyData( false, true, false );
+}
+
+uno::Sequence<
+ ::rtl::OUString > SAL_CALL ChartDataWrapper::getColumnDescriptions()
+ throw (uno::RuntimeException)
+{
+ // until we have a data change notification mechanism we always have to
+ // update the data here
+ refreshData();
+ // /--
+ MutexGuard aGuard( GetMutex());
+ return m_aColumnDescriptions;
+ // \--
+}
+
+void SAL_CALL ChartDataWrapper::setColumnDescriptions(
+ const uno::Sequence< ::rtl::OUString >& aColumnDescriptions )
+ throw (uno::RuntimeException)
+{
+ refreshData();
+ {
+ // /--
+ MutexGuard aGuard( GetMutex());
+ m_aColumnDescriptions = aColumnDescriptions;
+ // \--
+ }
+ applyData( false, false, true );
+}
+
+
+// ____ XChartData (base of XChartDataArray) ____
+void SAL_CALL ChartDataWrapper::addChartDataChangeEventListener(
+ const uno::Reference<
+ ::com::sun::star::chart::XChartDataChangeEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( aListener );
+}
+
+void SAL_CALL ChartDataWrapper::removeChartDataChangeEventListener(
+ const uno::Reference<
+ ::com::sun::star::chart::XChartDataChangeEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+double SAL_CALL ChartDataWrapper::getNotANumber()
+ throw (uno::RuntimeException)
+{
+ return DBL_MIN;
+}
+
+sal_Bool SAL_CALL ChartDataWrapper::isNotANumber( double nNumber )
+ throw (uno::RuntimeException)
+{
+ return DBL_MIN == nNumber
+ || ::rtl::math::isNan( nNumber )
+ || ::rtl::math::isInf( nNumber );
+}
+
+// ____ XComponent ____
+void SAL_CALL ChartDataWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( static_cast< ::cppu::OWeakObject* >( this )));
+
+ // /--
+ MutexGuard aGuard( GetMutex());
+ m_aData.realloc( 0 );
+ m_aColumnDescriptions.realloc( 0 );
+ m_aRowDescriptions.realloc( 0 );
+ // \--
+}
+
+void SAL_CALL ChartDataWrapper::addEventListener(
+ const uno::Reference< lang::XEventListener > & xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL ChartDataWrapper::removeEventListener(
+ const uno::Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+// ____ XEventListener ____
+void SAL_CALL ChartDataWrapper::disposing( const lang::EventObject& /* Source */ )
+ throw (uno::RuntimeException)
+{
+}
+
+// ::com::sun::star::chart::ChartDataChangeEvent aEvent;
+// aEvent.Type = chart::ChartDataChangeType_ALL;
+// aEvent.StartColumn = 0;
+// aEvent.EndColumn = 0;
+// aEvent.StartRow = 0;
+// aEvent.EndRow = 0;
+void ChartDataWrapper::fireChartDataChangeEvent(
+ ::com::sun::star::chart::ChartDataChangeEvent& aEvent )
+{
+ if( ! m_aEventListenerContainer.getLength() )
+ return;
+
+ uno::Reference< uno::XInterface > xSrc( static_cast< cppu::OWeakObject* >( this ));
+ OSL_ASSERT( xSrc.is());
+ if( xSrc.is() )
+ aEvent.Source = xSrc;
+
+ ::cppu::OInterfaceIteratorHelper aIter( m_aEventListenerContainer );
+
+ while( aIter.hasMoreElements() )
+ {
+ uno::Reference<
+ ::com::sun::star::chart::XChartDataChangeEventListener > xListener(
+ aIter.next(), uno::UNO_QUERY );
+ xListener->chartDataChanged( aEvent );
+ }
+}
+
+void ChartDataWrapper::refreshData()
+{
+ //todo mutex...
+ Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ if( !xChartDoc.is() )
+ return;
+ if( xChartDoc->hasInternalDataProvider())
+ {
+ try {
+ uno::Reference< ::com::sun::star::chart::XChartDataArray > xInternalData( xChartDoc->getDataProvider(), uno::UNO_QUERY_THROW );
+ m_aColumnDescriptions = xInternalData->getColumnDescriptions();
+ m_aRowDescriptions = xInternalData->getRowDescriptions();
+ m_aData = lcl_getDBL_MINInsteadNAN( xInternalData->getData() );
+ }
+ catch( const uno::Exception & ex ) {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ else
+ {
+ uno::Reference< chart2::XDiagram > xDia(
+ xChartDoc->getFirstDiagram() );
+ if( ! xDia.is())
+ return;
+
+ // get information about the segmentation of the assumed "rectangular" data
+ // range
+ ::rtl::OUString aRangeString;
+ bool bUseColumns = true;
+ bool bFirstCellAsLabel = true;
+ bool bHasCategories = true;
+ uno::Sequence< sal_Int32 > aSequenceMapping;
+
+ DataSourceHelper::detectRangeSegmentation(
+ uno::Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ),
+ aRangeString, aSequenceMapping, bUseColumns, bFirstCellAsLabel, bHasCategories );
+
+
+ // get data values from data series
+ // --------------------------------
+ uno::Sequence< uno::Reference< chart2::data::XLabeledDataSequence > > aLabeledSequences;
+ uno::Reference< chart2::data::XDataSource > xRectangularDataSource(
+ DataSourceHelper::pressUsedDataIntoRectangularFormat( xChartDoc, false /*bWithCategories*/ ) );
+ if( xRectangularDataSource.is() )
+ {
+ aLabeledSequences = xRectangularDataSource->getDataSequences();
+ }
+
+ ::std::vector< uno::Reference< chart2::data::XDataSequence > > aSequenceVector;
+ ::std::vector< ::rtl::OUString > aLabelVector;
+ for( sal_Int32 nN=0; nN<aLabeledSequences.getLength(); nN++ )
+ lcl_AddSequences( aLabeledSequences[nN], aSequenceVector, aLabelVector );
+
+ if( aSequenceMapping.getLength() )
+ {
+ //aSequenceVector and aLabelVector contain changed positions; resort them to the original position
+ ::std::vector< uno::Reference< chart2::data::XDataSequence > > aBackSortedSequences;
+ ::std::vector< ::rtl::OUString > aBackSortedLabels;
+
+ std::map< sal_Int32, sal_Int32 > aReverseMap;
+ {
+ sal_Int32 nNewIndex, nOldIndex;
+ for( sal_Int32 nS=0; nS <aSequenceMapping.getLength(); nS++ )
+ {
+ nOldIndex = aSequenceMapping[nS];
+ nNewIndex = nS;
+ if( bHasCategories )
+ nNewIndex--;
+ if( nOldIndex >= 0 && nNewIndex >= 0 )
+ aReverseMap[nOldIndex] = nNewIndex;
+ }
+ }
+
+ std::map< sal_Int32, sal_Int32 >::iterator aMapIt = aReverseMap.begin();
+ std::map< sal_Int32, sal_Int32 >::const_iterator aMapEnd = aReverseMap.end();
+
+ for( ; aMapIt != aMapEnd; ++aMapIt )
+ {
+ size_t nNewIndex = static_cast< size_t >( aMapIt->second );
+ if( nNewIndex < aSequenceVector.size() )
+ aBackSortedSequences.push_back( aSequenceVector[nNewIndex] );
+ if( nNewIndex < aLabelVector.size() )
+ aBackSortedLabels.push_back( aLabelVector[nNewIndex] );
+ }
+
+ // note: assign( beg, end ) doesn't work on solaris
+ aSequenceVector.clear();
+ aSequenceVector.insert(
+ aSequenceVector.begin(), aBackSortedSequences.begin(), aBackSortedSequences.end() );
+ aLabelVector.clear();
+ aLabelVector.insert(
+ aLabelVector.begin(), aBackSortedLabels.begin(), aBackSortedLabels.end() );
+ }
+
+ if( bUseColumns )
+ {
+ const sal_Int32 nInnerSize = aSequenceVector.size();
+ if( nInnerSize > 0 && aSequenceVector[0].is() )
+ {
+ // take the length of the first data series also as length for all
+ // other series
+ const sal_Int32 nOuterSize = aSequenceVector[0]->getData().getLength();
+
+ m_aData.realloc( nOuterSize );
+ for( sal_Int32 nOuter=0; nOuter<nOuterSize; ++nOuter )
+ m_aData[nOuter].realloc( nInnerSize );
+
+ for( sal_Int32 nInner=0; nInner<nInnerSize; ++nInner )
+ {
+ uno::Sequence< double > aValues = uno::Sequence< double > (
+ lcl_DataSequenceToDoubleSeq() (aSequenceVector[nInner] ));
+ sal_Int32 nMax = ::std::min( nOuterSize, aValues.getLength());
+ for( sal_Int32 nOuter=0; nOuter<nMax; ++nOuter )
+ m_aData[nOuter][nInner] = aValues[nOuter];
+ }
+ }
+ }
+ else
+ {
+ m_aData.realloc( static_cast< sal_Int32 >( aSequenceVector.size()));
+ ::std::transform( aSequenceVector.begin(), aSequenceVector.end(),
+ m_aData.getArray(),
+ lcl_DataSequenceToDoubleSeq() );
+ }
+
+ // labels (values already filled during parsing of data values)
+ if( bUseColumns )
+ m_aColumnDescriptions = ::chart::ContainerHelper::ContainerToSequence( aLabelVector );
+ else
+ m_aRowDescriptions = ::chart::ContainerHelper::ContainerToSequence( aLabelVector );
+
+ // get row-/column descriptions
+ // ----------------------------
+ // categories
+ uno::Sequence< ::rtl::OUString > & rSequence =
+ bUseColumns ? m_aRowDescriptions : m_aColumnDescriptions;
+ rSequence = DiagramHelper::generateAutomaticCategories( xChartDoc );
+ }
+}
+
+void ChartDataWrapper::applyData( bool bSetValues, bool bSetRowDescriptions, bool bSetColumnDescriptions )
+{
+ Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ if( !xChartDoc.is() )
+ return;
+
+ // /-- locked controllers
+ ControllerLockGuard aCtrlLockGuard( uno::Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ));
+ // should do nothing if we already have an internal data provider
+ xChartDoc->createInternalDataProvider( sal_True /* bCloneExistingData */ );
+
+ uno::Reference< chart2::data::XDataProvider > xDataProvider( xChartDoc->getDataProvider());
+ uno::Reference< XChartDataArray > xDocDataArray( xDataProvider, uno::UNO_QUERY );
+
+ // remember some diagram properties to reset later
+ sal_Bool bStacked = sal_False;
+ sal_Bool bPercent = sal_False;
+ sal_Bool bDeep = sal_False;
+ uno::Reference< ::com::sun::star::chart::XChartDocument > xOldDoc( xChartDoc, uno::UNO_QUERY );
+ OSL_ASSERT( xOldDoc.is());
+ uno::Reference< beans::XPropertySet > xDiaProp( xOldDoc->getDiagram(), uno::UNO_QUERY );
+ if( xDiaProp.is())
+ {
+ xDiaProp->getPropertyValue( C2U("Stacked")) >>= bStacked;
+ xDiaProp->getPropertyValue( C2U("Percent")) >>= bPercent;
+ xDiaProp->getPropertyValue( C2U("Deep")) >>= bDeep;
+ }
+
+ //detect arguments for the new data source
+ ::rtl::OUString aRangeString;
+ bool bUseColumns = true;
+ bool bFirstCellAsLabel = true;
+ bool bHasCategories = true;
+ uno::Sequence< sal_Int32 > aSequenceMapping;
+
+ DataSourceHelper::detectRangeSegmentation(
+ uno::Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ),
+ aRangeString, aSequenceMapping, bUseColumns, bFirstCellAsLabel, bHasCategories );
+
+ if( !bFirstCellAsLabel )
+ {
+ if( bSetRowDescriptions && !bUseColumns )
+ bFirstCellAsLabel = true;
+ else if( bSetColumnDescriptions && bUseColumns )
+ bFirstCellAsLabel = true;
+ }
+ if( !bHasCategories )
+ {
+ if( bSetColumnDescriptions && bUseColumns )
+ bHasCategories = true;
+ else if( bSetRowDescriptions && !bUseColumns )
+ bHasCategories = true;
+ }
+
+ aRangeString = C2U("all");
+ uno::Sequence< beans::PropertyValue > aArguments( DataSourceHelper::createArguments(
+ aRangeString, aSequenceMapping, bUseColumns, bFirstCellAsLabel, bHasCategories ) );
+
+ // create and attach new data source
+ uno::Reference< chart2::data::XDataSource > xSource;
+ if( xDocDataArray.is() )
+ {
+ // we have an internal data provider that supports the XChartDataArray
+ // interface
+ if( bSetValues )
+ xDocDataArray->setData( lcl_getNANInsteadDBL_MIN( m_aData ) );
+ if( bSetRowDescriptions )
+ xDocDataArray->setRowDescriptions( m_aRowDescriptions );
+ if( bSetColumnDescriptions )
+ xDocDataArray->setColumnDescriptions( m_aColumnDescriptions );
+
+ xSource.set( xDataProvider->createDataSource( aArguments ));
+ }
+ else
+ {
+ uno::Reference< chart2::data::XDataReceiver > xReceiver( xChartDoc, uno::UNO_QUERY );
+ OSL_ASSERT( xChartDoc.is());
+ OSL_ASSERT( xReceiver.is());
+ if( ! (xChartDoc.is() && xReceiver.is()))
+ return;
+
+ // create a data provider containing the new data
+ uno::Reference< chart2::data::XDataProvider > xTempDataProvider(
+ ChartModelHelper::createInternalDataProvider() );
+ if( ! xTempDataProvider.is())
+ throw uno::RuntimeException( C2U("Couldn't create temporary data provider"),
+ static_cast< ::cppu::OWeakObject * >( this ));
+
+ uno::Reference< ::com::sun::star::chart::XChartDataArray > xDataArray( xTempDataProvider, uno::UNO_QUERY );
+ OSL_ASSERT( xDataArray.is());
+ if( xDataArray.is())
+ {
+ if( bSetValues )
+ xDataArray->setData( lcl_getNANInsteadDBL_MIN( m_aData ) );
+ if( bSetRowDescriptions )
+ xDataArray->setRowDescriptions( m_aRowDescriptions );
+ if( bSetColumnDescriptions )
+ xDataArray->setColumnDescriptions( m_aColumnDescriptions );
+
+ // removes existing data provider and attaches the new one
+ xReceiver->attachDataProvider( xTempDataProvider );
+ xSource.set( xTempDataProvider->createDataSource( aArguments));
+ }
+ }
+
+ // determine a template
+ uno::Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
+ uno::Reference< chart2::XDiagram > xDia( xChartDoc->getFirstDiagram());
+ DiagramHelper::tTemplateWithServiceName aTemplateAndService =
+ DiagramHelper::getTemplateForDiagram( xDia, xFact );
+ ::rtl::OUString aServiceName( aTemplateAndService.second );
+ uno::Reference< chart2::XChartTypeTemplate > xTemplate = aTemplateAndService.first;
+
+ // (fall-back)
+ if( ! xTemplate.is())
+ {
+ if( aServiceName.getLength() == 0 )
+ aServiceName = C2U("com.sun.star.chart2.template.Column");
+ xTemplate.set( xFact->createInstance( aServiceName ), uno::UNO_QUERY );
+ }
+ OSL_ASSERT( xTemplate.is());
+
+ if( xTemplate.is() && xSource.is())
+ {
+ // argument detection works with internal knowledge of the
+ // ArrayDataProvider
+ OSL_ASSERT( xDia.is());
+ xTemplate->changeDiagramData(
+ xDia, xSource, aArguments );
+ }
+
+ //correct stacking mode
+ if( bStacked || bPercent || bDeep )
+ {
+ StackMode eStackMode = StackMode_Y_STACKED;
+ if( bDeep )
+ eStackMode = StackMode_Z_STACKED;
+ else if( bPercent )
+ eStackMode = StackMode_Y_STACKED_PERCENT;
+ DiagramHelper::setStackMode( xDia, eStackMode );
+ }
+
+ // notify listeners
+ ::com::sun::star::chart::ChartDataChangeEvent aEvent(
+ static_cast< ::cppu::OWeakObject* >( this ),
+ ::com::sun::star::chart::ChartDataChangeType_ALL, 0, 0, 0, 0 );
+ fireChartDataChangeEvent( aEvent );
+ // \-- locked controllers
+}
+
+// --------------------------------------------------------------------------------
+
+uno::Sequence< ::rtl::OUString > ChartDataWrapper::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 2 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart.ChartDataArray" );
+ aServices[ 1 ] = C2U( "com.sun.star.chart.ChartData" );
+
+ return aServices;
+}
+
+// ================================================================================
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( ChartDataWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx
new file mode 100644
index 000000000000..e63b64397f58
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.hxx
@@ -0,0 +1,138 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ChartDataWrapper.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_CHARTDATAWRAPPER_HXX
+#define CHART_CHARTDATAWRAPPER_HXX
+
+#include "ServiceMacros.hxx"
+#include "MutexContainer.hxx"
+#include <cppuhelper/implbase4.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/chart/XChartDataArray.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+namespace wrapper
+{
+
+class Chart2ModelContact;
+
+class ChartDataWrapper : public MutexContainer, public
+ ::cppu::WeakImplHelper4<
+ com::sun::star::chart::XChartDataArray,
+ com::sun::star::lang::XServiceInfo,
+ com::sun::star::lang::XEventListener,
+ com::sun::star::lang::XComponent >
+{
+public:
+ ChartDataWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~ChartDataWrapper();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+protected:
+ // ____ XChartDataArray ____
+ virtual ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ double > > SAL_CALL getData()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence<
+ double > >& aData )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::rtl::OUString > SAL_CALL getRowDescriptions()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setRowDescriptions( const ::com::sun::star::uno::Sequence<
+ ::rtl::OUString >& aRowDescriptions )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence<
+ ::rtl::OUString > SAL_CALL getColumnDescriptions()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setColumnDescriptions( const ::com::sun::star::uno::Sequence<
+ ::rtl::OUString >& aColumnDescriptions )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XChartData (base of XChartDataArray) ____
+ virtual void SAL_CALL addChartDataChangeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart::XChartDataChangeEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeChartDataChangeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart::XChartDataChangeEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual double SAL_CALL getNotANumber()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual sal_Bool SAL_CALL isNotANumber( double nNumber )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener ____
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+
+ void fireChartDataChangeEvent( ::com::sun::star::chart::ChartDataChangeEvent& aEvent );
+
+private:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+
+ ::com::sun::star::uno::Sequence<
+ ::com::sun::star::uno::Sequence< double > > m_aData;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aColumnDescriptions;
+ ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aRowDescriptions;
+
+ /// re-reads the data from the model
+ void refreshData();
+
+ /// applies changed data to model
+ void applyData( bool bSetValues, bool bSetRowDescriptions, bool bSetColumnDescriptions );
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_CHARTDATAWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
new file mode 100644
index 000000000000..397527f3ea9d
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx
@@ -0,0 +1,1686 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ChartDocumentWrapper.cxx,v $
+ * $Revision: 1.10 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "ChartDocumentWrapper.hxx"
+#include "macros.hxx"
+#include "servicenames.hxx"
+#include "PropertyHelper.hxx"
+#include "TitleHelper.hxx"
+#include "LegendHelper.hxx"
+#include "ControllerLockGuard.hxx"
+#include "ModifyListenerHelper.hxx"
+#include "DisposeHelper.hxx"
+#include "DataSeriesPointWrapper.hxx"
+#include "chartview/ExplicitValueProvider.hxx"
+#include "chartview/DrawModelWrapper.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include "DiagramHelper.hxx"
+#include "DataSourceHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "ContainerHelper.hxx"
+
+#include "TitleWrapper.hxx"
+#include "ChartDataWrapper.hxx"
+#include "DiagramWrapper.hxx"
+#include "LegendWrapper.hxx"
+#include "AreaWrapper.hxx"
+#include "WrappedAddInProperty.hxx"
+#include "WrappedIgnoreProperty.hxx"
+#include "ChartRenderer.hxx"
+#include <com/sun/star/chart2/XTitled.hpp>
+#include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/chart/XChartDataArray.hpp>
+#include <comphelper/InlineContainer.hxx>
+// header for function SvxShapeCollection_NewInstance
+#include <svx/unoshcol.hxx>
+// header for define DBG_ASSERT
+#include <tools/debug.hxx>
+#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/lang/DisposedException.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/util/DateTime.hpp>
+
+#include <vector>
+#include <algorithm>
+#include <functional>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart;
+
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+using ::rtl::OUString;
+
+namespace
+{
+enum eServiceType
+{
+ SERVICE_NAME_AREA_DIAGRAM = 0,
+ SERVICE_NAME_BAR_DIAGRAM,
+ SERVICE_NAME_DONUT_DIAGRAM,
+ SERVICE_NAME_LINE_DIAGRAM,
+ SERVICE_NAME_NET_DIAGRAM,
+ SERVICE_NAME_FILLED_NET_DIAGRAM,
+ SERVICE_NAME_PIE_DIAGRAM,
+ SERVICE_NAME_STOCK_DIAGRAM,
+ SERVICE_NAME_XY_DIAGRAM,
+ SERVICE_NAME_BUBBLE_DIAGRAM,
+
+ SERVICE_NAME_DASH_TABLE,
+ SERVICE_NAME_GARDIENT_TABLE,
+ SERVICE_NAME_HATCH_TABLE,
+ SERVICE_NAME_BITMAP_TABLE,
+ SERVICE_NAME_TRANSP_GRADIENT_TABLE,
+ SERVICE_NAME_MARKER_TABLE,
+
+ SERVICE_NAME_NAMESPACE_MAP,
+ SERVICE_NAME_EXPORT_GRAPHIC_RESOLVER,
+ SERVICE_NAME_IMPORT_GRAPHIC_RESOLVER
+};
+
+typedef ::std::map< ::rtl::OUString, enum eServiceType > tServiceNameMap;
+typedef ::comphelper::MakeMap< ::rtl::OUString, enum eServiceType > tMakeServiceNameMap;
+
+tServiceNameMap & lcl_getStaticServiceNameMap()
+{
+ static tServiceNameMap aServiceNameMap(
+ tMakeServiceNameMap
+ ( C2U( "com.sun.star.chart.AreaDiagram" ), SERVICE_NAME_AREA_DIAGRAM )
+ ( C2U( "com.sun.star.chart.BarDiagram" ), SERVICE_NAME_BAR_DIAGRAM )
+ ( C2U( "com.sun.star.chart.DonutDiagram" ), SERVICE_NAME_DONUT_DIAGRAM )
+ ( C2U( "com.sun.star.chart.LineDiagram" ), SERVICE_NAME_LINE_DIAGRAM )
+ ( C2U( "com.sun.star.chart.NetDiagram" ), SERVICE_NAME_NET_DIAGRAM )
+ ( C2U( "com.sun.star.chart.FilledNetDiagram" ), SERVICE_NAME_FILLED_NET_DIAGRAM )
+ ( C2U( "com.sun.star.chart.PieDiagram" ), SERVICE_NAME_PIE_DIAGRAM )
+ ( C2U( "com.sun.star.chart.StockDiagram" ), SERVICE_NAME_STOCK_DIAGRAM )
+ ( C2U( "com.sun.star.chart.XYDiagram" ), SERVICE_NAME_XY_DIAGRAM )
+ ( C2U( "com.sun.star.chart.BubbleDiagram" ), SERVICE_NAME_BUBBLE_DIAGRAM )
+
+ ( C2U( "com.sun.star.drawing.DashTable" ), SERVICE_NAME_DASH_TABLE )
+ ( C2U( "com.sun.star.drawing.GradientTable" ), SERVICE_NAME_GARDIENT_TABLE )
+ ( C2U( "com.sun.star.drawing.HatchTable" ), SERVICE_NAME_HATCH_TABLE )
+ ( C2U( "com.sun.star.drawing.BitmapTable" ), SERVICE_NAME_BITMAP_TABLE )
+ ( C2U( "com.sun.star.drawing.TransparencyGradientTable" ), SERVICE_NAME_TRANSP_GRADIENT_TABLE )
+ ( C2U( "com.sun.star.drawing.MarkerTable" ), SERVICE_NAME_MARKER_TABLE )
+
+ ( C2U( "com.sun.star.xml.NamespaceMap" ), SERVICE_NAME_NAMESPACE_MAP )
+ ( C2U( "com.sun.star.document.ExportGraphicObjectResolver" ), SERVICE_NAME_EXPORT_GRAPHIC_RESOLVER )
+ ( C2U( "com.sun.star.document.ImportGraphicObjectResolver" ), SERVICE_NAME_IMPORT_GRAPHIC_RESOLVER )
+ );
+
+ return aServiceNameMap;
+}
+
+enum
+{
+ PROP_DOCUMENT_HAS_MAIN_TITLE,
+ PROP_DOCUMENT_HAS_SUB_TITLE,
+ PROP_DOCUMENT_HAS_LEGEND,
+ PROP_DOCUMENT_LABELS_IN_FIRST_ROW,
+ PROP_DOCUMENT_LABELS_IN_FIRST_COLUMN,
+ PROP_DOCUMENT_ADDIN,
+ PROP_DOCUMENT_BASEDIAGRAM,
+ PROP_DOCUMENT_ADDITIONAL_SHAPES,
+ PROP_DOCUMENT_UPDATE_ADDIN,
+ PROP_DOCUMENT_NULL_DATE
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "HasMainTitle" ),
+ PROP_DOCUMENT_HAS_MAIN_TITLE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasSubTitle" ),
+ PROP_DOCUMENT_HAS_SUB_TITLE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasLegend" ),
+ PROP_DOCUMENT_HAS_LEGEND,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // really needed?
+ rOutProperties.push_back(
+ Property( C2U( "DataSourceLabelsInFirstRow" ),
+ PROP_DOCUMENT_LABELS_IN_FIRST_ROW,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "DataSourceLabelsInFirstColumn" ),
+ PROP_DOCUMENT_LABELS_IN_FIRST_COLUMN,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ //add-in
+ rOutProperties.push_back(
+ Property( C2U( "AddIn" ),
+ PROP_DOCUMENT_ADDIN,
+ ::getCppuType( reinterpret_cast< Reference< util::XRefreshable > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "BaseDiagram" ),
+ PROP_DOCUMENT_BASEDIAGRAM,
+ ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "AdditionalShapes" ),
+ PROP_DOCUMENT_ADDITIONAL_SHAPES,
+ ::getCppuType( reinterpret_cast< Reference< drawing::XShapes > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::READONLY ));
+ rOutProperties.push_back(
+ Property( C2U( "RefreshAddInAllowed" ),
+ PROP_DOCUMENT_UPDATE_ADDIN,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND ));
+
+ // table:null-date // i99104
+ rOutProperties.push_back(
+ Property( C2U( "NullDate" ),
+ PROP_DOCUMENT_NULL_DATE,
+ ::getCppuType( static_cast< const ::com::sun::star::util::DateTime * >(0)),
+ beans::PropertyAttribute::MAYBEVOID ));
+}
+
+const uno::Sequence< Property > & lcl_GetPropertySequence()
+{
+ static uno::Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+namespace chart
+{
+namespace wrapper
+{
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DOCUMENT_LABELS_IN_FIRST_ROW
+class WrappedDataSourceLabelsInFirstRowProperty : public WrappedProperty
+{
+public:
+ WrappedDataSourceLabelsInFirstRowProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedDataSourceLabelsInFirstRowProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable Any m_aOuterValue;
+};
+
+WrappedDataSourceLabelsInFirstRowProperty::WrappedDataSourceLabelsInFirstRowProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("DataSourceLabelsInFirstRow"),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_aOuterValue()
+{
+ m_aOuterValue = WrappedDataSourceLabelsInFirstRowProperty::getPropertyDefault( 0 );
+}
+
+WrappedDataSourceLabelsInFirstRowProperty::~WrappedDataSourceLabelsInFirstRowProperty()
+{
+}
+
+void WrappedDataSourceLabelsInFirstRowProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bLabelsInFirstRow = sal_True;
+ if( ! (rOuterValue >>= bLabelsInFirstRow) )
+ throw lang::IllegalArgumentException( C2U("Property DataSourceLabelsInFirstRow requires value of type boolean"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+ bool bNewValue = bLabelsInFirstRow;
+
+ ::rtl::OUString aRangeString;
+ bool bUseColumns = true;
+ bool bFirstCellAsLabel = true;
+ bool bHasCategories = true;
+ uno::Sequence< sal_Int32 > aSequenceMapping;
+
+ if( DataSourceHelper::detectRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
+ , bFirstCellAsLabel, bHasCategories ) )
+ {
+ if( bUseColumns && bNewValue != bFirstCellAsLabel )
+ {
+ DataSourceHelper::setRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aSequenceMapping, bUseColumns ,bNewValue, bHasCategories );
+ }
+ else if( !bUseColumns && bNewValue != bHasCategories )
+ {
+ DataSourceHelper::setRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aSequenceMapping, bUseColumns , bFirstCellAsLabel, bNewValue );
+ }
+ }
+}
+
+Any WrappedDataSourceLabelsInFirstRowProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::rtl::OUString aRangeString;
+ bool bUseColumns = true;
+ bool bFirstCellAsLabel = true;
+ bool bHasCategories = true;
+ uno::Sequence< sal_Int32 > aSequenceMapping;
+
+ if( DataSourceHelper::detectRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
+ , bFirstCellAsLabel, bHasCategories ) )
+ {
+ sal_Bool bLabelsInFirstRow = sal_True;
+ if( bUseColumns )
+ bLabelsInFirstRow = bFirstCellAsLabel;
+ else
+ bLabelsInFirstRow = bHasCategories;
+
+ m_aOuterValue <<= bLabelsInFirstRow;
+ }
+ return m_aOuterValue;
+}
+
+Any WrappedDataSourceLabelsInFirstRowProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_True;
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DOCUMENT_LABELS_IN_FIRST_COLUMN
+class WrappedDataSourceLabelsInFirstColumnProperty : public WrappedProperty
+{
+public:
+ WrappedDataSourceLabelsInFirstColumnProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedDataSourceLabelsInFirstColumnProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable Any m_aOuterValue;
+};
+
+WrappedDataSourceLabelsInFirstColumnProperty::WrappedDataSourceLabelsInFirstColumnProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("DataSourceLabelsInFirstColumn"),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_aOuterValue()
+{
+ m_aOuterValue = WrappedDataSourceLabelsInFirstColumnProperty::getPropertyDefault( 0 );
+}
+
+WrappedDataSourceLabelsInFirstColumnProperty::~WrappedDataSourceLabelsInFirstColumnProperty()
+{
+}
+
+void WrappedDataSourceLabelsInFirstColumnProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bLabelsInFirstRow = sal_True;
+ if( ! (rOuterValue >>= bLabelsInFirstRow) )
+ throw lang::IllegalArgumentException( C2U("Property DataSourceLabelsInFirstRow requires value of type boolean"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+ bool bNewValue = bLabelsInFirstRow;
+
+ ::rtl::OUString aRangeString;
+ bool bUseColumns = true;
+ bool bFirstCellAsLabel = true;
+ bool bHasCategories = true;
+ uno::Sequence< sal_Int32 > aSequenceMapping;
+
+ if( DataSourceHelper::detectRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
+ , bFirstCellAsLabel, bHasCategories ) )
+ {
+ if( bUseColumns && bNewValue != bHasCategories )
+ {
+ DataSourceHelper::setRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aSequenceMapping, bUseColumns, bFirstCellAsLabel, bNewValue );
+ }
+ else if( !bUseColumns && bNewValue != bFirstCellAsLabel )
+ {
+ DataSourceHelper::setRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aSequenceMapping, bUseColumns , bNewValue, bHasCategories );
+ }
+ }
+}
+
+Any WrappedDataSourceLabelsInFirstColumnProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::rtl::OUString aRangeString;
+ bool bUseColumns = true;
+ bool bFirstCellAsLabel = true;
+ bool bHasCategories = true;
+ uno::Sequence< sal_Int32 > aSequenceMapping;
+
+ if( DataSourceHelper::detectRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
+ , bFirstCellAsLabel, bHasCategories ) )
+ {
+ sal_Bool bLabelsInFirstColumn = sal_True;
+ if( bUseColumns )
+ bLabelsInFirstColumn = bHasCategories;
+ else
+ bLabelsInFirstColumn = bFirstCellAsLabel;
+
+ m_aOuterValue <<= bLabelsInFirstColumn;
+ }
+ return m_aOuterValue;
+}
+
+Any WrappedDataSourceLabelsInFirstColumnProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_True;
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DOCUMENT_HAS_LEGEND
+class WrappedHasLegendProperty : public WrappedProperty
+{
+public:
+ WrappedHasLegendProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedHasLegendProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+};
+
+WrappedHasLegendProperty::WrappedHasLegendProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("HasLegend"),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+{
+}
+
+WrappedHasLegendProperty::~WrappedHasLegendProperty()
+{
+}
+
+void WrappedHasLegendProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNewValue = sal_True;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Property HasLegend requires value of type boolean"), 0, 0 );
+
+ try
+ {
+ Reference< chart2::XLegend > xLegend( LegendHelper::getLegend( m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext,bNewValue ));
+ if(xLegend.is())
+ {
+ Reference< beans::XPropertySet > xLegendProp( xLegend, uno::UNO_QUERY_THROW );
+ sal_Bool bOldValue = sal_True;
+ Any aAOld = xLegendProp->getPropertyValue( C2U("Show") );
+ aAOld >>= bOldValue;
+ if( bOldValue != bNewValue )
+ xLegendProp->setPropertyValue( C2U("Show"), uno::makeAny( bNewValue ));
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+Any WrappedHasLegendProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ try
+ {
+ Reference< beans::XPropertySet > xLegendProp(
+ LegendHelper::getLegend( m_spChart2ModelContact->getChartModel() ), uno::UNO_QUERY );
+ if( xLegendProp.is())
+ aRet = xLegendProp->getPropertyValue( C2U("Show"));
+ else
+ aRet <<= sal_False;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return aRet;
+}
+
+Any WrappedHasLegendProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_False;
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DOCUMENT_HAS_MAIN_TITLE
+class WrappedHasMainTitleProperty : public WrappedProperty
+{
+public:
+ WrappedHasMainTitleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedHasMainTitleProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+};
+
+WrappedHasMainTitleProperty::WrappedHasMainTitleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("HasMainTitle"),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+{
+}
+
+WrappedHasMainTitleProperty::~WrappedHasMainTitleProperty()
+{
+}
+
+void WrappedHasMainTitleProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNewValue = sal_True;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Property HasMainTitle requires value of type boolean"), 0, 0 );
+
+ try
+ {
+ if( bNewValue )
+ TitleHelper::createTitle( TitleHelper::MAIN_TITLE, C2U("main-title"), m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext );
+ else
+ TitleHelper::removeTitle( TitleHelper::MAIN_TITLE, m_spChart2ModelContact->getChartModel() );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+Any WrappedHasMainTitleProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ try
+ {
+ aRet <<= sal_Bool( TitleHelper::getTitle( TitleHelper::MAIN_TITLE, m_spChart2ModelContact->getChartModel() ).is() );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return aRet;
+}
+
+Any WrappedHasMainTitleProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_False;
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DOCUMENT_HAS_SUB_TITLE
+class WrappedHasSubTitleProperty : public WrappedProperty
+{
+public:
+ WrappedHasSubTitleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedHasSubTitleProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+};
+
+WrappedHasSubTitleProperty::WrappedHasSubTitleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("HasSubTitle"),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+{
+}
+
+WrappedHasSubTitleProperty::~WrappedHasSubTitleProperty()
+{
+}
+
+void WrappedHasSubTitleProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNewValue = sal_True;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Property HasSubTitle requires value of type boolean"), 0, 0 );
+
+
+ try
+ {
+ if( bNewValue )
+ TitleHelper::createTitle( TitleHelper::SUB_TITLE, C2U("sub-title"), m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext );
+ else
+ TitleHelper::removeTitle( TitleHelper::SUB_TITLE, m_spChart2ModelContact->getChartModel() );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+Any WrappedHasSubTitleProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ try
+ {
+ aRet <<= sal_Bool( TitleHelper::getTitle( TitleHelper::SUB_TITLE, m_spChart2ModelContact->getChartModel() ).is() );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return aRet;
+}
+
+Any WrappedHasSubTitleProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_False;
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+ChartDocumentWrapper::ChartDocumentWrapper(
+ const Reference< uno::XComponentContext > & xContext ) :
+ m_spChart2ModelContact( new Chart2ModelContact( xContext ) ),
+ m_bUpdateAddIn( sal_True ),
+ m_bIsDisposed( false )
+{
+}
+
+ChartDocumentWrapper::~ChartDocumentWrapper()
+{
+ stopAllComponentListening();
+}
+
+// ____ XInterface (for new interfaces) ____
+uno::Any SAL_CALL ChartDocumentWrapper::queryInterface( const uno::Type& aType )
+ throw (uno::RuntimeException)
+{
+ if( m_xDelegator.is())
+ // calls queryAggregation if the delegator doesn't know aType
+ return m_xDelegator->queryInterface( aType );
+ else
+ return queryAggregation( aType );
+}
+
+// ____ chart::XChartDocument (old API wrapper) ____
+Reference< drawing::XShape > SAL_CALL ChartDocumentWrapper::getTitle()
+ throw (uno::RuntimeException)
+{
+ if( !m_xTitle.is() )
+ {
+ m_xTitle = new TitleWrapper( TitleHelper::MAIN_TITLE, m_spChart2ModelContact );
+ }
+ return m_xTitle;
+}
+
+Reference< drawing::XShape > SAL_CALL ChartDocumentWrapper::getSubTitle()
+ throw (uno::RuntimeException)
+{
+ if( !m_xSubTitle.is() )
+ {
+ m_xSubTitle = new TitleWrapper( TitleHelper::SUB_TITLE, m_spChart2ModelContact );
+ }
+ return m_xSubTitle;
+}
+
+Reference< drawing::XShape > SAL_CALL ChartDocumentWrapper::getLegend()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xLegend.is())
+ {
+ m_xLegend = new LegendWrapper( m_spChart2ModelContact );
+ Reference< lang::XComponent > xComp( m_xLegend, uno::UNO_QUERY );
+ }
+
+ return m_xLegend;
+}
+
+Reference< beans::XPropertySet > SAL_CALL ChartDocumentWrapper::getArea()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xArea.is())
+ {
+ m_xArea.set( new AreaWrapper( m_spChart2ModelContact ) );
+ Reference< lang::XComponent > xComp( m_xArea, uno::UNO_QUERY );
+ }
+
+ return m_xArea;
+}
+
+Reference< XDiagram > SAL_CALL ChartDocumentWrapper::getDiagram()
+ throw (uno::RuntimeException)
+{
+ if( !m_xDiagram.is() )
+ {
+ try
+ {
+ m_xDiagram = new DiagramWrapper( m_spChart2ModelContact );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ return m_xDiagram;
+}
+
+void SAL_CALL ChartDocumentWrapper::setDiagram( const Reference< XDiagram >& xDiagram )
+ throw (uno::RuntimeException)
+{
+ uno::Reference< util::XRefreshable > xAddIn( xDiagram, uno::UNO_QUERY );
+ if( xAddIn.is() )
+ {
+ setAddIn( xAddIn );
+ }
+ else if( xDiagram.is() && xDiagram != m_xDiagram )
+ {
+ // set new wrapped diagram at new chart. This requires the old
+ // diagram given as parameter to implement the new interface. If
+ // this is not possible throw an exception
+ Reference< chart2::XDiagramProvider > xNewDiaProvider( xDiagram, uno::UNO_QUERY_THROW );
+ Reference< chart2::XDiagram > xNewDia( xNewDiaProvider->getDiagram());
+
+ try
+ {
+ Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ if( xChartDoc.is() )
+ {
+ // set the new diagram
+ xChartDoc->setFirstDiagram( xNewDia );
+ m_xDiagram = xDiagram;
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+Reference< XChartData > SAL_CALL ChartDocumentWrapper::getData()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xChartData.is())
+ {
+ m_xChartData.set( new ChartDataWrapper( m_spChart2ModelContact ) );
+ }
+ //@todo: check hasInternalDataProvider also in else?
+
+ return m_xChartData;
+}
+
+void SAL_CALL ChartDocumentWrapper::attachData( const Reference< XChartData >& xData )
+ throw (uno::RuntimeException)
+{
+ if( !xData.is())
+ return;
+
+ Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ if( !xChartDoc.is() )
+ return;
+
+ uno::Reference< chart2::data::XDataProvider > xDataProvider( xChartDoc->getDataProvider());
+ uno::Reference< XChartDataArray > xDocDataArray( xDataProvider, uno::UNO_QUERY );
+ uno::Reference< XChartDataArray > xDataArray( xData, uno::UNO_QUERY );
+ OSL_ASSERT( xDataArray.is());
+ if( ! xDataArray.is() ||
+ xDocDataArray == xDataArray )
+ return;
+
+ // remember some diagram properties to reset later
+ ChartDataRowSource eSeriesSource = ChartDataRowSource_ROWS;
+ sal_Bool bStacked = sal_False;
+ sal_Bool bPercent = sal_False;
+ sal_Bool bDeep = sal_False;
+ Reference< beans::XPropertySet > xDiaProp( getDiagram(), uno::UNO_QUERY );
+ if( xDiaProp.is())
+ {
+ xDiaProp->getPropertyValue( C2U("DataRowSource")) >>= eSeriesSource;
+ xDiaProp->getPropertyValue( C2U("Stacked")) >>= bStacked;
+ xDiaProp->getPropertyValue( C2U("Percent")) >>= bPercent;
+ xDiaProp->getPropertyValue( C2U("Deep")) >>= bDeep;
+ }
+
+ // create and attach new data source
+ uno::Reference< chart2::data::XDataSource > xSource;
+ Sequence< beans::PropertyValue > aArguments( 4 );
+ aArguments[0] = beans::PropertyValue(
+ C2U("CellRangeRepresentation"), -1, uno::makeAny( C2U("all") ),
+ beans::PropertyState_DIRECT_VALUE );
+ aArguments[1] = beans::PropertyValue(
+ C2U("DataRowSource"), -1, uno::makeAny( eSeriesSource ),
+ beans::PropertyState_DIRECT_VALUE );
+ aArguments[2] = beans::PropertyValue(
+ C2U("FirstCellAsLabel"), -1, uno::makeAny( true ), beans::PropertyState_DIRECT_VALUE );
+ aArguments[3] = beans::PropertyValue(
+ C2U("HasCategories"), -1, uno::makeAny( true ), beans::PropertyState_DIRECT_VALUE );
+
+ // /-- locked controllers
+ ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ));
+ if( xDocDataArray.is())
+ {
+ // we have an internal data provider that supports the XChartDataArray
+ // interface
+ xDocDataArray->setData( xDataArray->getData());
+ xDocDataArray->setRowDescriptions( xDataArray->getRowDescriptions());
+ xDocDataArray->setColumnDescriptions( xDataArray->getColumnDescriptions());
+
+ xSource.set( xDataProvider->createDataSource( aArguments ));
+ }
+ else
+ {
+ uno::Reference< chart2::data::XDataReceiver > xReceiver( xChartDoc, uno::UNO_QUERY );
+ OSL_ASSERT( xChartDoc.is());
+ OSL_ASSERT( xReceiver.is());
+ OSL_ASSERT( xDataArray.is());
+ if( ! (xChartDoc.is() &&
+ xReceiver.is()))
+ return;
+
+ // create a data provider containing the new data
+ Reference< chart2::data::XDataProvider > xTempDataProvider(
+ ChartModelHelper::createInternalDataProvider( xDataArray ));
+
+ if( ! xTempDataProvider.is())
+ throw uno::RuntimeException( C2U("Couldn't create temporary data provider"),
+ static_cast< ::cppu::OWeakObject * >( this ));
+
+ // removes existing data provider and attaches the new one
+ xReceiver->attachDataProvider( xTempDataProvider );
+ xSource.set( xTempDataProvider->createDataSource( aArguments));
+ }
+
+ // determine a template
+ Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
+ Reference< chart2::XDiagram > xDia( xChartDoc->getFirstDiagram());
+ DiagramHelper::tTemplateWithServiceName aTemplateAndService =
+ DiagramHelper::getTemplateForDiagram( xDia, xFact );
+ OUString aServiceName( aTemplateAndService.second );
+ Reference< chart2::XChartTypeTemplate > xTemplate = aTemplateAndService.first;
+
+ // (fall-back)
+ if( ! xTemplate.is())
+ {
+ if( aServiceName.getLength() == 0 )
+ aServiceName = C2U("com.sun.star.chart2.template.Column");
+ xTemplate.set( xFact->createInstance( aServiceName ), uno::UNO_QUERY );
+ }
+ OSL_ASSERT( xTemplate.is());
+
+ if( xTemplate.is() && xSource.is())
+ {
+ // argument detection works with internal knowledge of the
+ // ArrayDataProvider
+ OSL_ASSERT( xDia.is());
+ xTemplate->changeDiagramData(
+ xDia, xSource, aArguments );
+ }
+
+ // should do nothing if we already have an internal data provider
+ xChartDoc->createInternalDataProvider( sal_True /* bCloneExistingData */ );
+
+ //correct stacking mode
+ if( bStacked || bPercent || bDeep )
+ {
+ StackMode eStackMode = StackMode_Y_STACKED;
+ if( bDeep )
+ eStackMode = StackMode_Z_STACKED;
+ else if( bPercent )
+ eStackMode = StackMode_Y_STACKED_PERCENT;
+ DiagramHelper::setStackMode( xDia, eStackMode );
+ }
+
+ m_xChartData = xData;
+ // \-- locked controllers
+}
+
+// ____ XModel ____
+sal_Bool SAL_CALL ChartDocumentWrapper::attachResource(
+ const ::rtl::OUString& URL,
+ const Sequence< beans::PropertyValue >& Arguments )
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ return xModel->attachResource( URL, Arguments );
+ return sal_False;
+}
+
+::rtl::OUString SAL_CALL ChartDocumentWrapper::getURL()
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ return xModel->getURL();
+ return ::rtl::OUString();
+}
+
+Sequence< beans::PropertyValue > SAL_CALL ChartDocumentWrapper::getArgs()
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ return xModel->getArgs();
+ return Sequence< beans::PropertyValue >();
+}
+
+void SAL_CALL ChartDocumentWrapper::connectController( const Reference< frame::XController >& Controller )
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ xModel->connectController( Controller );
+}
+
+void SAL_CALL ChartDocumentWrapper::disconnectController(
+ const Reference< frame::XController >& Controller )
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ xModel->disconnectController( Controller );
+}
+
+void SAL_CALL ChartDocumentWrapper::lockControllers()
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ xModel->lockControllers();
+}
+
+void SAL_CALL ChartDocumentWrapper::unlockControllers()
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ xModel->unlockControllers();
+}
+
+sal_Bool SAL_CALL ChartDocumentWrapper::hasControllersLocked()
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ return xModel->hasControllersLocked();
+ return sal_False;
+}
+
+Reference< frame::XController > SAL_CALL ChartDocumentWrapper::getCurrentController()
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ return xModel->getCurrentController();
+ return 0;
+}
+
+void SAL_CALL ChartDocumentWrapper::setCurrentController(
+ const Reference< frame::XController >& Controller )
+ throw (container::NoSuchElementException,
+ uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ xModel->setCurrentController( Controller );
+}
+
+Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::getCurrentSelection()
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ return xModel->getCurrentSelection();
+ return 0;
+}
+
+
+// ____ XComponent ____
+void SAL_CALL ChartDocumentWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ if( m_bIsDisposed )
+ throw lang::DisposedException(
+ C2U("ChartDocumentWrapper is disposed" ),
+ static_cast< ::cppu::OWeakObject* >( this ));
+
+ m_bIsDisposed = true;
+
+ try
+ {
+ Reference< lang::XComponent > xFormerDelegator( m_xDelegator, uno::UNO_QUERY );
+ DisposeHelper::DisposeAndClear( m_xTitle );
+ DisposeHelper::DisposeAndClear( m_xSubTitle );
+ DisposeHelper::DisposeAndClear( m_xLegend );
+ DisposeHelper::DisposeAndClear( m_xChartData );
+ DisposeHelper::DisposeAndClear( m_xDiagram );
+ DisposeHelper::DisposeAndClear( m_xArea );
+ m_xChartView.set( 0 );
+ m_xShapeFactory.set( 0 );
+ m_xDelegator.set( 0 );
+
+ clearWrappedPropertySet();
+ m_spChart2ModelContact->clear();
+ impl_resetAddIn();
+
+ stopAllComponentListening();
+
+ try
+ {
+ if( xFormerDelegator.is())
+ xFormerDelegator->dispose();
+ }
+ catch( lang::DisposedException )
+ {
+ // this is ok, don't panic
+ }
+ }
+ catch( uno::Exception &ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+}
+
+void ChartDocumentWrapper::impl_resetAddIn()
+{
+ Reference< util::XRefreshable > xAddIn( m_xAddIn );
+ m_xAddIn.set( 0 );
+
+ if( xAddIn.is() )
+ {
+ try
+ {
+ //make sure that the add-in does not hold a refernce to us anymore:
+ Reference< lang::XComponent > xComp( xAddIn, uno::UNO_QUERY );
+ if( xComp.is())
+ xComp->dispose();
+ else
+ {
+ uno::Reference< lang::XInitialization > xInit( xAddIn, uno::UNO_QUERY );
+ if( xInit.is() )
+ {
+ uno::Any aParam;
+ uno::Reference< com::sun::star::chart::XChartDocument > xDoc( 0 );
+ aParam <<= xDoc;
+ uno::Sequence< uno::Any > aSeq( &aParam, 1 );
+ xInit->initialize( aSeq );
+ }
+ }
+ }
+ catch( const uno::RuntimeException& ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ catch( const uno::Exception& ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+void ChartDocumentWrapper::setBaseDiagram( const rtl::OUString& rBaseDiagram )
+{
+ ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ m_aBaseDiagram = rBaseDiagram;
+
+ uno::Reference< XDiagram > xDiagram( ChartDocumentWrapper::createInstance( rBaseDiagram ), uno::UNO_QUERY );
+ if( xDiagram.is() )
+ this->setDiagram( xDiagram );
+}
+
+rtl::OUString ChartDocumentWrapper::getBaseDiagram() const
+{
+ return m_aBaseDiagram;
+}
+
+Reference< util::XRefreshable > ChartDocumentWrapper::getAddIn() const
+{
+ return m_xAddIn;
+}
+
+void ChartDocumentWrapper::setAddIn( const Reference< util::XRefreshable >& xAddIn )
+{
+ if( m_xAddIn == xAddIn )
+ return;
+
+ ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ impl_resetAddIn();
+ m_xAddIn = xAddIn;
+ // initialize AddIn with this as chart document
+ uno::Reference< lang::XInitialization > xInit( m_xAddIn, uno::UNO_QUERY );
+ if( xInit.is() )
+ {
+ uno::Any aParam;
+ uno::Reference< XChartDocument > xDoc( (XChartDocument*)this, uno::UNO_QUERY );
+ aParam <<= xDoc;
+ uno::Sequence< uno::Any > aSeq( &aParam, 1 );
+ xInit->initialize( aSeq );
+ }
+}
+
+void ChartDocumentWrapper::setUpdateAddIn( sal_Bool bUpdateAddIn )
+{
+ m_bUpdateAddIn = bUpdateAddIn;
+}
+sal_Bool ChartDocumentWrapper::getUpdateAddIn() const
+{
+ return m_bUpdateAddIn;
+}
+
+Reference< drawing::XShapes > ChartDocumentWrapper::getAdditionalShapes() const
+{
+ // get additional non-chart shapes for XML export
+ uno::Reference< drawing::XShapes > xFoundShapes;
+ uno::Reference< drawing::XDrawPage > xDrawPage( this->impl_getDrawPage() );
+
+ uno::Reference< drawing::XShapes > xDrawPageShapes( xDrawPage, uno::UNO_QUERY );
+ if( !xDrawPageShapes.is() )
+ return xFoundShapes;
+
+ uno::Reference<drawing::XShapes> xChartRoot( DrawModelWrapper::getChartRootShape( xDrawPage ) );
+
+ // iterate 'flat' over all top-level objects
+ // and determine all that are no chart objects
+ ::std::vector< uno::Reference< drawing::XShape > > aShapeVector;
+ sal_Int32 nSubCount = xDrawPageShapes->getCount();
+ uno::Reference< drawing::XShape > xShape;
+ for( sal_Int32 nS = 0; nS < nSubCount; nS++ )
+ {
+ if( xDrawPageShapes->getByIndex( nS ) >>= xShape )
+ {
+ if( xShape.is() && xChartRoot!=xShape )
+ aShapeVector.push_back( xShape );
+ }
+ }
+
+ if( !aShapeVector.empty() )
+ {
+ // create a shape collection
+ xFoundShapes = uno::Reference< drawing::XShapes >( SvxShapeCollection_NewInstance(), uno::UNO_QUERY );
+
+ DBG_ASSERT( xFoundShapes.is(), "Couldn't create a shape collection!" );
+ if( xFoundShapes.is())
+ {
+ ::std::vector< uno::Reference< drawing::XShape > >::iterator aIter;
+ for( aIter = aShapeVector.begin(); aIter != aShapeVector.end(); ++aIter )
+ xFoundShapes->add( *aIter );
+ }
+ }
+
+ return xFoundShapes;
+}
+
+void SAL_CALL ChartDocumentWrapper::addEventListener( const Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ xModel->addEventListener( xListener );
+}
+
+void SAL_CALL ChartDocumentWrapper::removeEventListener( const Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ Reference< frame::XModel > xModel( m_spChart2ModelContact->getChartModel() );
+ if( xModel.is() )
+ xModel->removeEventListener( aListener );
+}
+
+// ____ XDrawPageSupplier ____
+uno::Reference< drawing::XDrawPage > SAL_CALL ChartDocumentWrapper::getDrawPage()
+ throw (uno::RuntimeException)
+{
+ return this->impl_getDrawPage();
+}
+
+uno::Reference< drawing::XDrawPage > ChartDocumentWrapper::impl_getDrawPage() const
+ throw (uno::RuntimeException)
+{
+ return m_spChart2ModelContact->getDrawPage();
+}
+
+// ____ XMultiServiceFactory ____
+uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstance(
+ const ::rtl::OUString& aServiceSpecifier )
+ throw (uno::Exception,
+ uno::RuntimeException)
+{
+ uno::Reference< uno::XInterface > xResult;
+
+ Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ if( !xChartDoc.is() )
+ return xResult;
+
+ bool bServiceFound = false;
+ tServiceNameMap & rMap = lcl_getStaticServiceNameMap();
+
+ tServiceNameMap::const_iterator aIt( rMap.find( aServiceSpecifier ));
+ if( aIt != rMap.end())
+ {
+ bool bCreateDiagram = false;
+ uno::Reference< lang::XMultiServiceFactory > xManagerFact(
+ xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
+ uno::Reference< chart2::XChartTypeTemplate > xTemplate;
+
+ switch( (*aIt).second )
+ {
+ case SERVICE_NAME_AREA_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.Area" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ break;
+ case SERVICE_NAME_BAR_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ // this is for bar and column (the latter is the default if
+ // no "Vertical=false" property was set)
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.Column" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ break;
+ case SERVICE_NAME_DONUT_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.Donut" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ break;
+ case SERVICE_NAME_LINE_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.Line" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ break;
+ case SERVICE_NAME_NET_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.Net" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ break;
+ case SERVICE_NAME_FILLED_NET_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.FilledNet" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ case SERVICE_NAME_PIE_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.Pie" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ break;
+ case SERVICE_NAME_STOCK_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.StockLowHighClose" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ break;
+ case SERVICE_NAME_XY_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.ScatterLineSymbol" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ break;
+
+ case SERVICE_NAME_BUBBLE_DIAGRAM:
+ if( xManagerFact.is())
+ {
+ xTemplate.set(
+ xManagerFact->createInstance(
+ C2U( "com.sun.star.chart2.template.Bubble" )), uno::UNO_QUERY );
+ bCreateDiagram = true;
+ }
+ break;
+
+ case SERVICE_NAME_DASH_TABLE:
+ case SERVICE_NAME_GARDIENT_TABLE:
+ case SERVICE_NAME_HATCH_TABLE:
+ case SERVICE_NAME_BITMAP_TABLE:
+ case SERVICE_NAME_TRANSP_GRADIENT_TABLE:
+ case SERVICE_NAME_MARKER_TABLE:
+ {
+ uno::Reference< lang::XMultiServiceFactory > xTableFactory( xChartDoc, uno::UNO_QUERY );
+ DBG_ASSERT( xTableFactory.get() != this, "new model is expected to implement service factory for gradient table etc" );
+ if( xTableFactory.is() && xTableFactory.get() != this )
+ xResult.set( xTableFactory->createInstance( aIt->first ), uno::UNO_QUERY );
+ }
+ break;
+
+ case SERVICE_NAME_NAMESPACE_MAP:
+// xResult = svx::NamespaceMap_createInstance( aWhichIds, &m_pModel->GetPool() );
+ break;
+ case SERVICE_NAME_EXPORT_GRAPHIC_RESOLVER:
+// xResult = static_cast< ::cppu::OWeakObject * >( new SvXMLGraphicHelper( GRAPHICHELPER_MODE_WRITE ));
+ break;
+ case SERVICE_NAME_IMPORT_GRAPHIC_RESOLVER:
+// xResult = static_cast< ::cppu::OWeakObject * >( new SvXMLGraphicHelper( GRAPHICHELPER_MODE_READ ));
+ break;
+ }
+
+ if( bCreateDiagram && xTemplate.is() )
+ {
+ try
+ {
+ uno::Reference< chart2::XDiagram > xDia( xChartDoc->getFirstDiagram());
+ if( xDia.is())
+ {
+ // /-- locked controllers
+ ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ));
+ xTemplate->changeDiagram( xDia );
+ // \-- locked controllers
+ }
+ else
+ {
+ // /-- locked controllers
+ ControllerLockGuard aCtrlLockGuard( Reference< frame::XModel >( xChartDoc, uno::UNO_QUERY ));
+ xDia.set( xTemplate->createDiagramByDataSource(
+ uno::Reference< chart2::data::XDataSource >(),
+ uno::Sequence< beans::PropertyValue >()));
+ xChartDoc->setFirstDiagram( xDia );
+ // \-- locked controllers
+ }
+
+ xResult = static_cast< ::cppu::OWeakObject* >( new DiagramWrapper( m_spChart2ModelContact ));
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+
+ bServiceFound = true;
+ }
+ else if( aServiceSpecifier.equals( CHART_RENDERER_SERVICE_IMPLEMENTATION_NAME ) )
+ {
+ Reference< lang::XUnoTunnel > xChartRenderer( new ChartRenderer( m_spChart2ModelContact->getChartModel() ) );
+ xResult.set( xChartRenderer );
+ bServiceFound = true;
+ }
+ else if( aServiceSpecifier.equals( C2U("com.sun.star.comp.chart2.DataSeriesWrapper") ) )
+ {
+ Reference< beans::XPropertySet > xDataSeries( new DataSeriesPointWrapper( m_spChart2ModelContact ) );
+ xResult.set( xDataSeries );
+ bServiceFound = true;
+ }
+ else if( aServiceSpecifier.equals( CHART_VIEW_SERVICE_NAME ) )
+ {
+ if( !m_xChartView.is() )
+ {
+ Reference< lang::XMultiServiceFactory > xFact(
+ m_spChart2ModelContact->m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
+ if( xFact.is() )
+ {
+ Reference< lang::XInitialization > xViewInit( xFact->createInstance(
+ CHART_VIEW_SERVICE_NAME ), uno::UNO_QUERY );
+ if(xViewInit.is())
+ {
+ try
+ {
+ m_xChartView = xViewInit;
+
+ Sequence< Any > aArguments(2);
+ Reference<frame::XModel> xModel(this);
+ aArguments[0]=uno::makeAny(xModel);
+ sal_Bool bRefreshAddIn = sal_True;
+ aArguments[1]=uno::makeAny(bRefreshAddIn);
+ xViewInit->initialize(aArguments);
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+ }
+ xResult.set( m_xChartView );
+ bServiceFound = true;
+ }
+ else
+ {
+ // try to create a shape
+ try
+ {
+ if( !m_xShapeFactory.is() && m_xChartView.is() )
+ {
+ Reference< lang::XUnoTunnel> xUnoTunnel(m_xChartView,uno::UNO_QUERY);
+ if(xUnoTunnel.is())
+ {
+ ExplicitValueProvider* pProvider = reinterpret_cast<ExplicitValueProvider*>(xUnoTunnel->getSomething(
+ ExplicitValueProvider::getUnoTunnelId() ));
+ if( pProvider )
+ m_xShapeFactory.set( pProvider->getDrawModelWrapper()->getShapeFactory() );
+ }
+ }
+ if( m_xShapeFactory.is() )
+ {
+ xResult = m_xShapeFactory->createInstance( aServiceSpecifier );
+ bServiceFound = true;
+ }
+ }
+ catch( const uno::Exception )
+ {
+ // couldn't create shape
+ }
+ }
+
+ // finally, try to create an addin
+ if( !bServiceFound )
+ {
+ try
+ {
+ Reference< lang::XMultiServiceFactory > xFact(
+ m_spChart2ModelContact->m_xContext->getServiceManager(), uno::UNO_QUERY_THROW );
+ if( xFact.is() )
+ {
+ uno::Reference< util::XRefreshable > xAddIn(
+ xFact->createInstance( aServiceSpecifier ), uno::UNO_QUERY );
+ if( xAddIn.is() )
+ {
+ xResult = xAddIn;
+ bServiceFound = true;
+ }
+ }
+ }
+ catch( const uno::Exception& ex )
+ {
+ (void)ex;
+ // couldn't create service
+ }
+ }
+
+ return xResult;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL ChartDocumentWrapper::createInstanceWithArguments(
+ const ::rtl::OUString& ServiceSpecifier,
+ const uno::Sequence< uno::Any >& Arguments )
+ throw (uno::Exception,
+ uno::RuntimeException)
+{
+ OSL_ENSURE( Arguments.getLength(), "createInstanceWithArguments: Warning: Arguments are ignored" );
+ (void)(Arguments);
+
+ return createInstance( ServiceSpecifier );
+}
+
+uno::Sequence< ::rtl::OUString > SAL_CALL ChartDocumentWrapper::getAvailableServiceNames()
+ throw (uno::RuntimeException)
+{
+ tServiceNameMap & rMap = lcl_getStaticServiceNameMap();
+ uno::Sequence< ::rtl::OUString > aResult( rMap.size());
+
+ ::std::transform( rMap.begin(), rMap.end(),
+ aResult.getArray(),
+ ::std::select1st< tServiceNameMap::value_type >() );
+
+ return aResult;
+
+// // shapes
+// // uno::Sequence< OUString > aDrawServices( SvxUnoDrawMSFactory::getAvailableServiceNames() );
+// // const OUString * pArr = aDrawServices.getConstArray();
+// // aServices.insert( aServices.end(), pArr, pArr + aDrawServices.getLength() );
+// }
+
+
+ // add-ins
+ // uno::Sequence< OUString > aAddIns( GetAddInCollection().GetAddInNames() );
+// pArr = aAddIns.getConstArray();
+// aServices.insert( aServices.end(), pArr, pArr + aAddIns.getLength() );
+
+// return ContainerToSequence( aServices );
+}
+
+// ____ XAggregation ____
+void SAL_CALL ChartDocumentWrapper::setDelegator(
+ const uno::Reference< uno::XInterface >& rDelegator )
+ throw (uno::RuntimeException)
+{
+ if( rDelegator.is())
+ {
+ m_xDelegator = rDelegator;
+ m_spChart2ModelContact->setModel( uno::Reference< frame::XModel >(m_xDelegator, uno::UNO_QUERY) );
+ }
+ else
+ {
+ // this is a sort of dispose() from the new model,so release ressources here
+ try
+ {
+ this->dispose();
+ }
+ catch( uno::Exception &ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+uno::Any SAL_CALL ChartDocumentWrapper::queryAggregation( const uno::Type& rType )
+ throw (uno::RuntimeException)
+{
+ return ChartDocumentWrapper_Base::queryInterface( rType );
+}
+
+// ____ ::utl::OEventListenerAdapter ____
+void ChartDocumentWrapper::_disposing( const lang::EventObject& rSource )
+{
+ if( rSource.Source == m_xTitle )
+ m_xTitle.set( 0 );
+ else if( rSource.Source == m_xSubTitle )
+ m_xSubTitle.set( 0 );
+ else if( rSource.Source == m_xLegend )
+ m_xLegend.set( 0 );
+ else if( rSource.Source == m_xChartData )
+ m_xChartData.set( 0 );
+ else if( rSource.Source == m_xDiagram )
+ m_xDiagram.set( 0 );
+ else if( rSource.Source == m_xArea )
+ m_xArea.set( 0 );
+ else if( rSource.Source == m_xAddIn )
+ m_xAddIn.set( 0 );
+ else if( rSource.Source == m_xChartView )
+ m_xChartView.set( 0 );
+}
+
+// ================================================================================
+
+// WrappedPropertySet
+Reference< beans::XPropertySet > ChartDocumentWrapper::getInnerPropertySet()
+{
+ return 0;
+}
+const Sequence< beans::Property >& ChartDocumentWrapper::getPropertySequence()
+{
+ return lcl_GetPropertySequence();
+}
+
+const std::vector< WrappedProperty* > ChartDocumentWrapper::createWrappedProperties()
+{
+ ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
+ aWrappedProperties.push_back( new WrappedDataSourceLabelsInFirstRowProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedDataSourceLabelsInFirstColumnProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedHasLegendProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedHasMainTitleProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedHasSubTitleProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedAddInProperty( *this ) );
+ aWrappedProperties.push_back( new WrappedBaseDiagramProperty( *this ) );
+ aWrappedProperties.push_back( new WrappedAdditionalShapesProperty( *this ) );
+ aWrappedProperties.push_back( new WrappedRefreshAddInAllowedProperty( *this ) );
+ aWrappedProperties.push_back( new WrappedIgnoreProperty( C2U("NullDate"),Any() ) ); // i99104
+
+ return aWrappedProperties;
+}
+
+// ================================================================================
+
+uno::Sequence< ::rtl::OUString > ChartDocumentWrapper::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 4 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart.ChartDocument" );
+ aServices[ 1 ] = CHART_CHARTAPIWRAPPER_SERVICE_NAME;
+ aServices[ 2 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+ aServices[ 3 ] = C2U( "com.sun.star.beans.PropertySet" );
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( ChartDocumentWrapper, CHART_CHARTAPIWRAPPER_IMPLEMENTATION_NAME );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
new file mode 100644
index 000000000000..ce417155dc4f
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx
@@ -0,0 +1,890 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataSeriesPointWrapper.cxx,v $
+ * $Revision: 1.15.44.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "DataSeriesPointWrapper.hxx"
+#include "macros.hxx"
+#include "RegressionCurveHelper.hxx"
+#include "Chart2ModelContact.hxx"
+#include "ChartTypeHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+#include "CharacterProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "WrappedCharacterHeightProperty.hxx"
+#include "WrappedProperty.hxx"
+#include "WrappedIgnoreProperty.hxx"
+#include "WrappedStatisticProperties.hxx"
+#include "WrappedSymbolProperties.hxx"
+#include "WrappedDataCaptionProperties.hxx"
+#include "WrappedSeriesAreaOrLineProperty.hxx"
+#include "WrappedScaleTextProperties.hxx"
+#include "WrappedNumberFormatProperty.hxx"
+#include "WrappedTextRotationProperty.hxx"
+#include <rtl/ustrbuf.hxx>
+#include <rtl/math.hxx>
+// header for define DBG_ASSERT
+#include <tools/debug.hxx>
+
+#include <algorithm>
+#include <comphelper/InlineContainer.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart/ChartAxisAssign.hpp>
+#include <com/sun/star/chart/ChartErrorCategory.hpp>
+#include <com/sun/star/chart/XChartDocument.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/LineJoint.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::chart::wrapper;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::com::sun::star::uno::Any;
+using ::osl::MutexGuard;
+
+namespace
+{
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.DataSeries" ));
+
+enum
+{
+ //data point properties
+ PROP_SERIES_DATAPOINT_SOLIDTYPE,
+ PROP_SERIES_DATAPOINT_SEGMENT_OFFSET,
+ PROP_SERIES_DATAPOINT_PERCENT_DIAGONAL,
+ PROP_SERIES_DATAPOINT_LABEL_SEPARATOR,
+ PROP_SERIES_NUMBERFORMAT,
+ PROP_SERIES_LINK_NUMBERFORMAT_TO_SOURCE,
+ PROP_SERIES_PERCENTAGE_NUMBERFORMAT,
+ PROP_SERIES_DATAPOINT_LABEL_PLACEMENT,
+ //other series properties
+ PROP_SERIES_ATTACHED_AXIS,
+ PROP_SERIES_DATAPOINT_TEXT_ROTATION
+};
+
+void lcl_AddPropertiesToVector_PointProperties(
+ ::std::vector< Property > & rOutProperties )
+{
+ //service chart::Chart3DBarProperties
+ rOutProperties.push_back(
+ Property( C2U( "SolidType" ),
+ PROP_SERIES_DATAPOINT_SOLIDTYPE,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "SegmentOffset" ),
+ PROP_SERIES_DATAPOINT_SEGMENT_OFFSET,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "D3DPercentDiagonal" ),
+ PROP_SERIES_DATAPOINT_PERCENT_DIAGONAL,
+ ::getCppuType( reinterpret_cast< sal_Int16 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LabelSeparator" ),
+ PROP_SERIES_DATAPOINT_LABEL_SEPARATOR,
+ ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "NumberFormat" ),
+ PROP_SERIES_NUMBERFORMAT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "PercentageNumberFormat" ),
+ PROP_SERIES_PERCENTAGE_NUMBERFORMAT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LabelPlacement" ),
+ PROP_SERIES_DATAPOINT_LABEL_PLACEMENT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "TextRotation" ),
+ PROP_SERIES_DATAPOINT_TEXT_ROTATION,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+void lcl_AddPropertiesToVector_SeriesOnly(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "Axis" ),
+ PROP_SERIES_ATTACHED_AXIS,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "LinkNumberFormatToSource" ),
+ PROP_SERIES_LINK_NUMBERFORMAT_TO_SOURCE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+const uno::Sequence< Property > & lcl_GetPropertySequence( DataSeriesPointWrapper::eType _eType )
+{
+ static uno::Sequence< Property > aSeriesPropSeq;
+ static uno::Sequence< Property > aPointPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ uno::Sequence< Property >& rPropSeq =
+ (_eType == DataSeriesPointWrapper::DATA_SERIES) ? aSeriesPropSeq : aPointPropSeq;
+ if( 0 == rPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+
+ lcl_AddPropertiesToVector_PointProperties( aProperties );
+ if( _eType == DataSeriesPointWrapper::DATA_SERIES )
+ {
+ lcl_AddPropertiesToVector_SeriesOnly( aProperties );
+ WrappedStatisticProperties::addProperties( aProperties );
+ }
+ WrappedSymbolProperties::addProperties( aProperties ); //for series and points
+ WrappedDataCaptionProperties::addProperties( aProperties ); //for series and points
+
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+ ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ rPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return rPropSeq;
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------
+
+//PROP_SERIES_ATTACHED_AXIS
+class WrappedAttachedAxisProperty : public ::chart::WrappedProperty
+{
+public:
+ WrappedAttachedAxisProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedAttachedAxisProperty();
+
+ virtual void setPropertyValue( const Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+};
+
+WrappedAttachedAxisProperty::WrappedAttachedAxisProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("Axis"),rtl::OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+{
+}
+
+WrappedAttachedAxisProperty::~WrappedAttachedAxisProperty()
+{
+}
+
+Any WrappedAttachedAxisProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= ::com::sun::star::chart::ChartAxisAssign::PRIMARY_Y;
+ return aRet;
+}
+
+Any WrappedAttachedAxisProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+
+ uno::Reference< chart2::XDataSeries > xDataSeries( xInnerPropertySet, uno::UNO_QUERY );
+ bool bAttachedToMainAxis = ::chart::DiagramHelper::isSeriesAttachedToMainAxis( xDataSeries );
+ if( bAttachedToMainAxis )
+ aRet <<= ::com::sun::star::chart::ChartAxisAssign::PRIMARY_Y;
+ else
+ aRet <<= ::com::sun::star::chart::ChartAxisAssign::SECONDARY_Y;
+ return aRet;
+}
+
+void WrappedAttachedAxisProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ uno::Reference< chart2::XDataSeries > xDataSeries( xInnerPropertySet, uno::UNO_QUERY );
+
+ sal_Int32 nChartAxisAssign = ::com::sun::star::chart::ChartAxisAssign::PRIMARY_Y;
+ if( ! (rOuterValue >>= nChartAxisAssign) )
+ throw lang::IllegalArgumentException( C2U("Property Axis requires value of type sal_Int32"), 0, 0 );
+
+ bool bNewAttachedToMainAxis = nChartAxisAssign == ::com::sun::star::chart::ChartAxisAssign::PRIMARY_Y;
+ bool bOldAttachedToMainAxis = ::chart::DiagramHelper::isSeriesAttachedToMainAxis( xDataSeries );
+
+ if( bNewAttachedToMainAxis != bOldAttachedToMainAxis)
+ {
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() )
+ ::chart::DiagramHelper::attachSeriesToAxis( bNewAttachedToMainAxis, xDataSeries, xDiagram, m_spChart2ModelContact->m_xContext );
+ }
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+
+class WrappedSegmentOffsetProperty : public ::chart::WrappedProperty
+{
+public:
+ WrappedSegmentOffsetProperty();
+ virtual ~WrappedSegmentOffsetProperty();
+
+protected:
+ virtual Any convertInnerToOuterValue( const Any& rInnerValue ) const;
+ virtual Any convertOuterToInnerValue( const Any& rOuterValue ) const;
+};
+
+WrappedSegmentOffsetProperty::WrappedSegmentOffsetProperty() :
+ WrappedProperty( C2U( "SegmentOffset" ), C2U( "Offset" ) )
+{}
+
+WrappedSegmentOffsetProperty::~WrappedSegmentOffsetProperty()
+{}
+
+Any WrappedSegmentOffsetProperty::convertInnerToOuterValue( const Any& rInnerValue ) const
+{
+ // convert new double offset to former integer segment-offset
+ double fOffset = 0;
+ Any aResult( rInnerValue );
+
+ if( rInnerValue >>= fOffset )
+ aResult <<= static_cast< sal_Int32 >( ::rtl::math::round( fOffset * 100.0 ));
+
+ return aResult;
+}
+
+Any WrappedSegmentOffsetProperty::convertOuterToInnerValue( const Any& rOuterValue ) const
+{
+ // convert former integer segment-offset to new double offset
+ sal_Int32 nOffset = 0;
+ Any aResult( rOuterValue );
+
+ if( rOuterValue >>= nOffset )
+ aResult <<= (static_cast< double >( nOffset ) / 100.0);
+
+ return aResult;
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+
+class WrappedLineColorProperty : public WrappedSeriesAreaOrLineProperty
+{
+public:
+ WrappedLineColorProperty( DataSeriesPointWrapper* pDataSeriesPointWrapper );
+ virtual ~WrappedLineColorProperty();
+
+ virtual void setPropertyValue( const Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 void setPropertyToDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ DataSeriesPointWrapper* m_pDataSeriesPointWrapper;
+ mutable Any m_aDefaultValue;
+ mutable Any m_aOuterValue;
+};
+
+WrappedLineColorProperty::WrappedLineColorProperty(
+ DataSeriesPointWrapper* pDataSeriesPointWrapper )
+ : WrappedSeriesAreaOrLineProperty(C2U( "LineColor" ), C2U( "BorderColor" ), C2U( "Color" ), pDataSeriesPointWrapper )
+ , m_pDataSeriesPointWrapper( pDataSeriesPointWrapper )
+ , m_aDefaultValue(uno::makeAny(sal_Int32( 0x0099ccff ))) // blue 8
+ , m_aOuterValue(m_aDefaultValue)
+{
+}
+
+WrappedLineColorProperty::~WrappedLineColorProperty()
+{
+}
+
+void WrappedLineColorProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( m_pDataSeriesPointWrapper && m_pDataSeriesPointWrapper->isLinesForbidden() )
+ m_aOuterValue = rOuterValue;
+ else
+ WrappedSeriesAreaOrLineProperty::setPropertyValue( rOuterValue, xInnerPropertySet );
+}
+
+void WrappedLineColorProperty::setPropertyToDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
+{
+ if( m_pDataSeriesPointWrapper && m_pDataSeriesPointWrapper->isLinesForbidden() )
+ m_aOuterValue = m_aDefaultValue;
+ else
+ WrappedSeriesAreaOrLineProperty::setPropertyToDefault( xInnerPropertyState );
+}
+
+Any WrappedLineColorProperty::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( m_pDataSeriesPointWrapper && !m_pDataSeriesPointWrapper->isSupportingAreaProperties() )
+ return m_aDefaultValue;
+ else
+ return WrappedSeriesAreaOrLineProperty::getPropertyDefault( xInnerPropertyState );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+
+class WrappedLineStyleProperty : public WrappedSeriesAreaOrLineProperty
+{
+public:
+ WrappedLineStyleProperty( DataSeriesPointWrapper* pDataSeriesPointWrapper );
+ virtual ~WrappedLineStyleProperty();
+
+ virtual void setPropertyValue( const Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 void setPropertyToDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ DataSeriesPointWrapper* m_pDataSeriesPointWrapper;
+ mutable Any m_aDefaultValue;
+ mutable Any m_aOuterValue;
+};
+
+WrappedLineStyleProperty::WrappedLineStyleProperty(
+ DataSeriesPointWrapper* pDataSeriesPointWrapper )
+ : WrappedSeriesAreaOrLineProperty(C2U( "LineStyle" ), C2U( "BorderStyle" ), C2U( "LineStyle" ), pDataSeriesPointWrapper )
+ , m_pDataSeriesPointWrapper( pDataSeriesPointWrapper )
+ , m_aDefaultValue(uno::makeAny(drawing::LineStyle_SOLID))
+ , m_aOuterValue(m_aDefaultValue)
+{
+}
+
+WrappedLineStyleProperty::~WrappedLineStyleProperty()
+{
+}
+
+void WrappedLineStyleProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aNewValue(rOuterValue);
+ if( m_pDataSeriesPointWrapper && m_pDataSeriesPointWrapper->isLinesForbidden() )
+ {
+ m_aOuterValue = rOuterValue;
+ aNewValue = uno::makeAny(drawing::LineStyle_NONE);
+ }
+ WrappedSeriesAreaOrLineProperty::setPropertyValue( aNewValue, xInnerPropertySet );
+}
+
+void WrappedLineStyleProperty::setPropertyToDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException)
+{
+ if( m_pDataSeriesPointWrapper && m_pDataSeriesPointWrapper->isLinesForbidden() )
+ m_aOuterValue = m_aDefaultValue;
+ else
+ WrappedSeriesAreaOrLineProperty::setPropertyToDefault( xInnerPropertyState );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+DataSeriesPointWrapper::DataSeriesPointWrapper(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : m_spChart2ModelContact( spChart2ModelContact )
+ , m_aEventListenerContainer( m_aMutex )
+ , m_eType( DATA_SERIES )
+ , m_nSeriesIndexInNewAPI( -1 )
+ , m_nPointIndex( -1 )
+ , m_bLinesAllowed(sal_True)
+ , m_xDataSeries(0)
+{
+ //need initialize call afterwards
+}
+
+void SAL_CALL DataSeriesPointWrapper::initialize( const uno::Sequence< uno::Any >& aArguments )
+ throw ( uno::Exception, uno::RuntimeException)
+{
+ DBG_ASSERT(aArguments.getLength() >= 1,"need at least 1 argument to initialize the DataSeriesPointWrapper: series reference + optional datapoint index");
+
+ m_nSeriesIndexInNewAPI = -1;//ignored in this case
+ m_nPointIndex = -1;
+ if( aArguments.getLength() >= 1 )
+ {
+ aArguments[0] >>= m_xDataSeries;
+ if( aArguments.getLength() >= 2 )
+ aArguments[1] >>= m_nPointIndex;
+ }
+
+ if( !m_xDataSeries.is() )
+ throw uno::Exception(
+ C2U( "DataSeries index invalid" ), static_cast< ::cppu::OWeakObject * >( this ));
+
+ //todo: check upper border of point index
+
+ if( m_nPointIndex >= 0 )
+ m_eType = DATA_POINT;
+ else
+ m_eType = DATA_SERIES;
+}
+
+DataSeriesPointWrapper::DataSeriesPointWrapper( eType _eType
+ , sal_Int32 nSeriesIndexInNewAPI
+ , sal_Int32 nPointIndex //ignored for series
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : m_spChart2ModelContact( spChart2ModelContact )
+ , m_aEventListenerContainer( m_aMutex )
+ , m_eType( _eType )
+ , m_nSeriesIndexInNewAPI( nSeriesIndexInNewAPI )
+ , m_nPointIndex( (_eType == DATA_POINT) ? nPointIndex : -1 )
+ , m_xDataSeries(0)
+{
+}
+
+DataSeriesPointWrapper::~DataSeriesPointWrapper()
+{
+}
+
+// ____ XComponent ____
+void SAL_CALL DataSeriesPointWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ uno::Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+
+ m_xDataSeries.clear();
+ clearWrappedPropertySet();
+}
+
+void SAL_CALL DataSeriesPointWrapper::addEventListener(
+ const uno::Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL DataSeriesPointWrapper::removeEventListener(
+ const uno::Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+// ____ XEventListener ____
+void SAL_CALL DataSeriesPointWrapper::disposing( const lang::EventObject& /*Source*/ )
+ throw (uno::RuntimeException)
+{
+}
+
+// ================================================================================
+
+bool DataSeriesPointWrapper::isSupportingAreaProperties()
+{
+ Reference< chart2::XDataSeries > xSeries( this->getDataSeries() );
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) );
+ sal_Int32 nDimensionCount = DiagramHelper::getDimension( xDiagram );
+
+ return ChartTypeHelper::isSupportingAreaProperties( xChartType, nDimensionCount );
+}
+
+bool DataSeriesPointWrapper::isLinesForbidden()
+{
+ return !m_bLinesAllowed;
+}
+
+Reference< chart2::XDataSeries > DataSeriesPointWrapper::getDataSeries()
+{
+ Reference< chart2::XDataSeries > xSeries( m_xDataSeries );
+ if( !xSeries.is() )
+ {
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList(
+ ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+
+ if( m_nSeriesIndexInNewAPI >= 0 && m_nSeriesIndexInNewAPI < static_cast<sal_Int32>(aSeriesList.size()) )
+ xSeries = aSeriesList[m_nSeriesIndexInNewAPI];
+ }
+
+ return xSeries;
+}
+
+Reference< beans::XPropertySet > DataSeriesPointWrapper::getDataPointProperties()
+{
+ Reference< beans::XPropertySet > xPointProp;
+
+ Reference< chart2::XDataSeries > xSeries( this->getDataSeries() );
+
+ // may throw an IllegalArgumentException
+ if( xSeries.is() )
+ xPointProp = xSeries->getDataPointByIndex( m_nPointIndex );
+
+ return xPointProp;
+}
+
+// ================================================================================
+
+//ReferenceSizePropertyProvider
+void DataSeriesPointWrapper::updateReferenceSize()
+{
+ Reference< beans::XPropertySet > xProp( this->getInnerPropertySet(), uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ if( xProp->getPropertyValue( C2U("ReferencePageSize") ).hasValue() )
+ xProp->setPropertyValue( C2U("ReferencePageSize"), uno::makeAny(
+ m_spChart2ModelContact->GetPageSize() ));
+ }
+}
+Any DataSeriesPointWrapper::getReferenceSize()
+{
+ Any aRet;
+ Reference< beans::XPropertySet > xProp( this->getInnerPropertySet(), uno::UNO_QUERY );
+ if( xProp.is() )
+ aRet = xProp->getPropertyValue( C2U("ReferencePageSize") );
+ return aRet;
+}
+awt::Size DataSeriesPointWrapper::getCurrentSizeForReference()
+{
+ return m_spChart2ModelContact->GetPageSize();
+}
+
+// ================================================================================
+
+// WrappedPropertySet
+
+//XPropertyState
+beans::PropertyState SAL_CALL DataSeriesPointWrapper::getPropertyState( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ beans::PropertyState aState( beans::PropertyState_DIRECT_VALUE );
+
+ if( m_eType == DATA_SERIES )
+ aState = WrappedPropertySet::getPropertyState( rPropertyName );
+ else
+ {
+ if( rPropertyName.equals(C2U("FillColor")) )
+ {
+ Reference< beans::XPropertySet > xSeriesProp( getDataSeries(), uno::UNO_QUERY );
+ sal_Bool bVaryColorsByPoint = sal_False;
+ if( xSeriesProp.is() && (xSeriesProp->getPropertyValue( C2U("VaryColorsByPoint") ) >>= bVaryColorsByPoint)
+ && bVaryColorsByPoint )
+ return beans::PropertyState_DIRECT_VALUE;
+ }
+ else if( rPropertyName.equals(C2U("Lines"))
+ || rPropertyName.equals(C2U("SymbolType"))
+ || rPropertyName.equals(C2U("SymbolSize")) )
+ return WrappedPropertySet::getPropertyState( rPropertyName );
+
+ uno::Any aDefault( getPropertyDefault( rPropertyName ) );
+ uno::Any aValue( getPropertyValue( rPropertyName ) );
+ if( aDefault==aValue )
+ aState = beans::PropertyState_DEFAULT_VALUE;
+ }
+ return aState;
+}
+
+void SAL_CALL DataSeriesPointWrapper::setPropertyToDefault( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ if( m_eType == DATA_SERIES )
+ WrappedPropertySet::setPropertyToDefault( rPropertyName );
+ else
+ {
+ //for data points the default is given by the series
+ setPropertyValue( rPropertyName, getPropertyDefault( rPropertyName ) );
+ }
+}
+Any SAL_CALL DataSeriesPointWrapper::getPropertyDefault( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ try
+ {
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+ if( nHandle > 0 )
+ {
+ //always take the series current value as default for points
+ Reference< beans::XPropertySet > xInnerPropertySet( getDataSeries(), uno::UNO_QUERY );
+ if( xInnerPropertySet.is() )
+ {
+ const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
+ if( pWrappedProperty )
+ aRet = pWrappedProperty->getPropertyValue(xInnerPropertySet);
+ else
+ aRet = xInnerPropertySet->getPropertyValue( rPropertyName );
+ }
+ }
+ }
+ catch( beans::UnknownPropertyException& ex )
+ {
+ (void)(ex);
+ aRet = WrappedPropertySet::getPropertyDefault( rPropertyName );
+ }
+ return aRet;
+}
+
+Reference< beans::XPropertySet > DataSeriesPointWrapper::getInnerPropertySet()
+{
+ if( m_eType == DATA_SERIES )
+ return Reference< beans::XPropertySet >( getDataSeries(), uno::UNO_QUERY );
+ return getDataPointProperties();
+}
+
+const Sequence< beans::Property >& DataSeriesPointWrapper::getPropertySequence()
+{
+ return lcl_GetPropertySequence( m_eType );
+}
+
+const std::vector< WrappedProperty* > DataSeriesPointWrapper::createWrappedProperties()
+{
+ ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
+
+ WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
+
+ if( m_eType == DATA_SERIES )
+ {
+ WrappedStatisticProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact );
+ aWrappedProperties.push_back( new WrappedAttachedAxisProperty( m_spChart2ModelContact ) );
+
+ WrappedNumberFormatProperty* pWrappedNumberFormatProperty = new WrappedNumberFormatProperty( m_spChart2ModelContact );
+ aWrappedProperties.push_back( pWrappedNumberFormatProperty );
+ aWrappedProperties.push_back( new WrappedLinkNumberFormatProperty(pWrappedNumberFormatProperty) );
+ }
+
+ WrappedSymbolProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact );
+ WrappedDataCaptionProperties::addWrappedPropertiesForSeries( aWrappedProperties, m_spChart2ModelContact );
+ WrappedScaleTextProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+
+ //add unnamed fill properties (different inner names here)
+// aWrappedProperties.push_back( new WrappedUnnamedProperty( C2U( "FillGradient" ), C2U( "GradientName" ) ) );
+// aWrappedProperties.push_back( new WrappedUnnamedProperty( C2U( "FillHatch" ), C2U( "HatchName" ) ) );
+// aWrappedProperties.push_back( new WrappedUnnamedProperty( C2U( "FillTransparenceGradient" ), C2U( "TransparencyGradientName" ) ) );
+
+ //add unnamed line properties (different inner names here)
+// aWrappedProperties.push_back( new WrappedUnnamedProperty( C2U( "LineDash" ), C2U( "LineDashName" ) ) );
+
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillColor" ), C2U( "Color" ) ) );
+ aWrappedProperties.push_back( new WrappedLineStyleProperty( this ) );
+ aWrappedProperties.push_back( new WrappedLineColorProperty( this ) );
+ aWrappedProperties.push_back( new WrappedSeriesAreaOrLineProperty( C2U( "LineDashName" ), C2U( "BorderDashName" ), C2U( "LineDashName" ), this ) );
+ aWrappedProperties.push_back( new WrappedSeriesAreaOrLineProperty( C2U( "LineTransparence" ), C2U( "BorderTransparency" ), C2U( "Transparency" ), this ) );
+ aWrappedProperties.push_back( new WrappedSeriesAreaOrLineProperty( C2U( "LineWidth" ), C2U( "BorderWidth" ), C2U( "LineWidth" ), this ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillStyle" ), C2U( "FillStyle" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillTransparence" ), C2U( "Transparency" ) ) );
+
+ aWrappedProperties.push_back( new WrappedIgnoreProperty( C2U( "LineJoint" ), uno::makeAny( drawing::LineJoint_NONE ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillTransparenceGradientName" ), C2U( "TransparencyGradientName" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillGradientName" ), C2U( "GradientName" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillGradientStepCount" ), C2U( "GradientStepCount" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillHatchName" ), C2U( "HatchName" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBitmapName" ), C2U( "FillBitmapName" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBackground" ), C2U( "FillBackground" ) ) );
+
+ //bitmap properties
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBitmapMode" ), C2U( "FillBitmapMode" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBitmapSizeX" ), C2U( "FillBitmapSizeX" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBitmapSizeY" ), C2U( "FillBitmapSizeY" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBitmapLogicalSize" ), C2U( "FillBitmapLogicalSize" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBitmapOffsetX" ), C2U( "FillBitmapOffsetX" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBitmapOffsetY" ), C2U( "FillBitmapOffsetY" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBitmapRectanglePoint" ), C2U( "FillBitmapRectanglePoint" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBitmapPositionOffsetX" ), C2U( "FillBitmapPositionOffsetX" ) ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "FillBitmapPositionOffsetY" ), C2U( "FillBitmapPositionOffsetY" ) ) );
+
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "SolidType" ), C2U( "Geometry3D" ) ) );
+ aWrappedProperties.push_back( new WrappedSegmentOffsetProperty() );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "D3DPercentDiagonal" ), C2U( "PercentDiagonal" ) ) );
+
+ aWrappedProperties.push_back( new WrappedTextRotationProperty() );
+
+ return aWrappedProperties;
+}
+
+void SAL_CALL DataSeriesPointWrapper::setPropertyValue( const ::rtl::OUString& rPropertyName, const Any& rValue )
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if(rPropertyName.equals(C2U("Lines")))
+ {
+ if( ! (rValue >>= m_bLinesAllowed) )
+ throw lang::IllegalArgumentException( C2U("Property Lines requires value of type sal_Bool"), 0, 0 );
+ }
+
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+ static const sal_Int32 nErrorCategoryHandle = getInfoHelper().getHandleByName( C2U("ErrorCategory") );
+ if( nErrorCategoryHandle == nHandle )
+ {
+ ::com::sun::star::chart::ChartErrorCategory aNewValue = ::com::sun::star::chart::ChartErrorCategory_NONE;
+ rValue >>= aNewValue;
+ Any aLow, aHigh;
+ bool bSetHighAndLowValues = false;
+ switch(aNewValue)
+ {
+ case ::com::sun::star::chart::ChartErrorCategory_CONSTANT_VALUE:
+ aHigh = this->getPropertyValue(C2U("ConstantErrorHigh"));
+ aLow = this->getPropertyValue(C2U("ConstantErrorLow"));
+ bSetHighAndLowValues = true;
+ break;
+ case ::com::sun::star::chart::ChartErrorCategory_PERCENT:
+ aHigh = aLow = this->getPropertyValue(C2U("PercentageError"));
+ bSetHighAndLowValues = true;
+ break;
+ case ::com::sun::star::chart::ChartErrorCategory_ERROR_MARGIN:
+ aHigh = aLow = this->getPropertyValue(C2U("ErrorMargin"));
+ bSetHighAndLowValues = true;
+ break;
+ default:
+ break;
+ }
+
+ WrappedPropertySet::setPropertyValue( rPropertyName, rValue );
+
+ if(bSetHighAndLowValues)
+ {
+ switch(aNewValue)
+ {
+ case ::com::sun::star::chart::ChartErrorCategory_CONSTANT_VALUE:
+ this->setPropertyValue(C2U("ConstantErrorHigh"),aHigh);
+ this->setPropertyValue(C2U("ConstantErrorLow"),aLow);
+ break;
+ case ::com::sun::star::chart::ChartErrorCategory_PERCENT:
+ this->setPropertyValue(C2U("PercentageError"),aHigh);
+ break;
+ case ::com::sun::star::chart::ChartErrorCategory_ERROR_MARGIN:
+ this->setPropertyValue(C2U("ErrorMargin"),aHigh);
+ break;
+ default:
+ break;
+ }
+ }
+ }
+ else
+ WrappedPropertySet::setPropertyValue( rPropertyName, rValue );
+}
+
+Any SAL_CALL DataSeriesPointWrapper::getPropertyValue( const rtl::OUString& rPropertyName )
+ throw ( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( m_eType == DATA_POINT )
+ {
+ if( rPropertyName.equals(C2U("FillColor")) )
+ {
+ Reference< beans::XPropertySet > xSeriesProp( getDataSeries(), uno::UNO_QUERY );
+ sal_Bool bVaryColorsByPoint = sal_False;
+ if( xSeriesProp.is() && (xSeriesProp->getPropertyValue( C2U("VaryColorsByPoint") ) >>= bVaryColorsByPoint)
+ && bVaryColorsByPoint )
+ {
+ uno::Reference< beans::XPropertyState > xPointState( DataSeriesPointWrapper::getDataPointProperties(), uno::UNO_QUERY );
+ if( xPointState.is() && xPointState->getPropertyState( C2U("Color")) == beans::PropertyState_DEFAULT_VALUE )
+ {
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() )
+ {
+ Reference< chart2::XColorScheme > xColorScheme( xDiagram->getDefaultColorScheme() );
+ if( xColorScheme.is() )
+ return uno::makeAny( xColorScheme->getColorByIndex( m_nPointIndex ) );
+ }
+ }
+ }
+ }
+ }
+ return WrappedPropertySet::getPropertyValue( rPropertyName );
+}
+
+// ================================================================================
+
+uno::Sequence< ::rtl::OUString > DataSeriesPointWrapper::getSupportedServiceNames_Static()
+{
+ uno::Sequence< ::rtl::OUString > aServices( 7 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart.ChartDataRowProperties" );
+ aServices[ 1 ] = C2U( "com.sun.star.chart.ChartDataPointProperties" );
+ aServices[ 2 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+ aServices[ 3 ] = C2U( "com.sun.star.beans.PropertySet" );
+ aServices[ 4 ] = C2U( "com.sun.star.drawing.FillProperties" );
+ aServices[ 5 ] = C2U( "com.sun.star.drawing.LineProperties" );
+ aServices[ 6 ] = C2U( "com.sun.star.style.CharacterProperties" );
+
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( DataSeriesPointWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx
new file mode 100644
index 000000000000..0e3b87605b77
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.hxx
@@ -0,0 +1,163 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DataSeriesPointWrapper.hxx,v $
+ * $Revision: 1.7.44.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_DATASERIESPOINTWRAPPER_HXX
+#define CHART_DATASERIESPOINTWRAPPER_HXX
+
+#include "ServiceMacros.hxx"
+#include "WrappedPropertySet.hxx"
+#include "ReferenceSizePropertyProvider.hxx"
+#include <cppuhelper/implbase4.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/chart2/XDataSeries.hpp>
+#include <com/sun/star/frame/XModel.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/lang/XInitialization.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+namespace wrapper
+{
+
+class Chart2ModelContact;
+
+class DataSeriesPointWrapper : public ::cppu::ImplInheritanceHelper4<
+ WrappedPropertySet
+ , com::sun::star::lang::XServiceInfo
+ , com::sun::star::lang::XInitialization
+ , com::sun::star::lang::XComponent
+ , com::sun::star::lang::XEventListener
+ >
+ , public ReferenceSizePropertyProvider
+
+{
+public:
+ enum eType
+ {
+ DATA_SERIES,
+ DATA_POINT
+ };
+
+ //this constructor needs an initialize call afterwards
+ DataSeriesPointWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+
+ DataSeriesPointWrapper( eType eType
+ , sal_Int32 nSeriesIndexInNewAPI
+ , sal_Int32 nPointIndex //ignored for series
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+
+ virtual ~DataSeriesPointWrapper();
+
+ bool isSupportingAreaProperties();
+ bool isLinesForbidden();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ___lang::XInitialization___
+ virtual void SAL_CALL initialize( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aArguments )
+ throw (::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
+
+ //ReferenceSizePropertyProvider
+ virtual void updateReferenceSize();
+ virtual ::com::sun::star::uno::Any getReferenceSize();
+ virtual ::com::sun::star::awt::Size getCurrentSizeForReference();
+
+protected:
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XEventListener ____
+ virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ // ____ WrappedPropertySet ____
+ virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
+ virtual const std::vector< WrappedProperty* > createWrappedProperties();
+ virtual void SAL_CALL setPropertyValue( const ::rtl::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 ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
+
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //own methods
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > getDataSeries();
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getDataPointProperties();
+
+private:
+
+ void SAL_CALL getStatisticsPropertyValue
+ ( ::com::sun::star::uno::Any& rValue,
+ sal_Int32 nHandle ) const;
+
+ void SAL_CALL setStatisticsPropertyValue_NoBroadcast(
+ sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
+ throw (::com::sun::star::uno::Exception);
+
+ // ----------------------------------------
+
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+
+ eType m_eType;
+ sal_Int32 m_nSeriesIndexInNewAPI;
+ sal_Int32 m_nPointIndex;
+
+ sal_Bool m_bLinesAllowed;
+
+ //this should only be used, if the DataSeriesPointWrapper is initialized via the XInitialize interface
+ //because a big change in the chartmodel may leed to an dataseriespointer thats not connected to the model anymore
+ //with the indizes instead we are can aleays get the new dataseries
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDataSeries > m_xDataSeries;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_DATASERIESPOINTWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
new file mode 100644
index 000000000000..4a02d9aa99e5
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx
@@ -0,0 +1,2116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DiagramWrapper.cxx,v $
+ * $Revision: 1.17.32.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "DiagramWrapper.hxx"
+#include "macros.hxx"
+#include "servicenames_charttypes.hxx"
+#include "TitleWrapper.hxx"
+#include "DataSeriesPointWrapper.hxx"
+#include "AxisWrapper.hxx"
+#include "AxisHelper.hxx"
+#include "Chart2ModelContact.hxx"
+#include "PositionAndSizeHelper.hxx"
+#include "TitleHelper.hxx"
+#include "GridWrapper.hxx"
+#include "WallFloorWrapper.hxx"
+#include "MinMaxLineWrapper.hxx"
+#include "UpDownBarWrapper.hxx"
+#include "DiagramHelper.hxx"
+#include "DataSourceHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "WrappedIgnoreProperty.hxx"
+#include "WrappedAxisAndGridExistenceProperties.hxx"
+#include "WrappedStatisticProperties.hxx"
+#include "WrappedSymbolProperties.hxx"
+#include "WrappedDataCaptionProperties.hxx"
+#include "WrappedSplineProperties.hxx"
+#include "WrappedStockProperties.hxx"
+#include "WrappedSceneProperty.hxx"
+#include "RelativePositionHelper.hxx"
+#include "ContainerHelper.hxx"
+#include "ControllerLockGuard.hxx"
+#include "ModifyListenerHelper.hxx"
+#include "DisposeHelper.hxx"
+#include <comphelper/InlineContainer.hxx>
+#include "WrappedAutomaticPositionProperties.hxx"
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/XTitled.hpp>
+#include <com/sun/star/chart/ChartDataRowSource.hpp>
+#include <com/sun/star/chart2/RelativeSize.hpp>
+#include <com/sun/star/chart2/RelativePosition.hpp>
+#include <com/sun/star/chart/ChartSolidType.hpp>
+
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "SceneProperties.hxx"
+
+#include <map>
+#include <algorithm>
+#include <rtl/ustrbuf.hxx>
+// header for define DBG_ERROR
+#include <tools/debug.hxx>
+#include <com/sun/star/lang/XServiceName.hpp>
+#include <com/sun/star/util/XRefreshable.hpp>
+
+using namespace ::com::sun::star;
+using namespace ::chart::wrapper;
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+using ::rtl::OUString;
+
+namespace
+{
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.Diagram" ));
+
+enum
+{
+ PROP_DIAGRAM_ATTRIBUTED_DATA_POINTS,
+ PROP_DIAGRAM_PERCENT_STACKED,
+ PROP_DIAGRAM_STACKED,
+ PROP_DIAGRAM_THREE_D,
+ PROP_DIAGRAM_SOLIDTYPE,
+ PROP_DIAGRAM_DEEP,
+ PROP_DIAGRAM_VERTICAL,
+ PROP_DIAGRAM_NUMBER_OF_LINES,
+ PROP_DIAGRAM_STACKED_BARS_CONNECTED,
+ PROP_DIAGRAM_DATAROW_SOURCE,
+
+ PROP_DIAGRAM_GROUP_BARS_PER_AXIS,
+ PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
+
+ PROP_DIAGRAM_SORT_BY_X_VALUES,
+
+ PROP_DIAGRAM_STARTING_ANGLE,
+
+ PROP_DIAGRAM_RIGHT_ANGLED_AXES,
+ PROP_DIAGRAM_PERSPECTIVE,
+ PROP_DIAGRAM_ROTATION_HORIZONTAL,
+ PROP_DIAGRAM_ROTATION_VERTICAL,
+
+ PROP_DIAGRAM_MISSING_VALUE_TREATMENT,
+
+ PROP_DIAGRAM_HAS_X_AXIS,
+ PROP_DIAGRAM_HAS_X_AXIS_DESCR,
+ PROP_DIAGRAM_HAS_X_AXIS_TITLE,
+ PROP_DIAGRAM_HAS_X_AXIS_GRID,
+ PROP_DIAGRAM_HAS_X_AXIS_HELP_GRID,
+
+ PROP_DIAGRAM_HAS_Y_AXIS,
+ PROP_DIAGRAM_HAS_Y_AXIS_DESCR,
+ PROP_DIAGRAM_HAS_Y_AXIS_TITLE,
+ PROP_DIAGRAM_HAS_Y_AXIS_GRID,
+ PROP_DIAGRAM_HAS_Y_AXIS_HELP_GRID,
+
+ PROP_DIAGRAM_HAS_Z_AXIS,
+ PROP_DIAGRAM_HAS_Z_AXIS_DESCR,
+ PROP_DIAGRAM_HAS_Z_AXIS_TITLE,
+ PROP_DIAGRAM_HAS_Z_AXIS_GRID,
+ PROP_DIAGRAM_HAS_Z_AXIS_HELP_GRID,
+
+ PROP_DIAGRAM_HAS_SECOND_X_AXIS,
+ PROP_DIAGRAM_HAS_SECOND_X_AXIS_DESCR,
+
+ PROP_DIAGRAM_HAS_SECOND_Y_AXIS,
+ PROP_DIAGRAM_HAS_SECOND_Y_AXIS_DESCR,
+
+ PROP_DIAGRAM_HAS_SECOND_X_AXIS_TITLE,
+ PROP_DIAGRAM_HAS_SECOND_Y_AXIS_TITLE,
+
+ PROP_DIAGRAM_AUTOMATIC_SIZE
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "AttributedDataPoints" ),
+ PROP_DIAGRAM_ATTRIBUTED_DATA_POINTS,
+ ::getCppuType( reinterpret_cast< const uno::Sequence< uno::Sequence< sal_Int32 > > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ // see com.sun.star.chart.StackableDiagram
+ rOutProperties.push_back(
+ Property( C2U( "Percent" ),
+ PROP_DIAGRAM_PERCENT_STACKED,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "Stacked" ),
+ PROP_DIAGRAM_STACKED,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "Dim3D" ),
+ PROP_DIAGRAM_THREE_D,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // see com.sun.star.chart.Chart3DBarProperties
+ rOutProperties.push_back(
+ Property( C2U( "SolidType" ),
+ PROP_DIAGRAM_SOLIDTYPE,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // see com.sun.star.chart.BarDiagram
+ rOutProperties.push_back(
+ Property( C2U( "Deep" ),
+ PROP_DIAGRAM_DEEP,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "Vertical" ),
+ PROP_DIAGRAM_VERTICAL,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "NumberOfLines" ),
+ PROP_DIAGRAM_NUMBER_OF_LINES,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "StackedBarsConnected" ),
+ PROP_DIAGRAM_STACKED_BARS_CONNECTED,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "DataRowSource" ),
+ PROP_DIAGRAM_DATAROW_SOURCE,
+ ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartDataRowSource * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "GroupBarsPerAxis" ),
+ PROP_DIAGRAM_GROUP_BARS_PER_AXIS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "IncludeHiddenCells" ),
+ PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ //new for XY charts
+ rOutProperties.push_back(
+ Property( C2U( "SortByXValues" ),
+ PROP_DIAGRAM_SORT_BY_X_VALUES,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ //for pie and donut charts
+ rOutProperties.push_back(
+ Property( C2U( "StartingAngle" ),
+ PROP_DIAGRAM_STARTING_ANGLE,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0) ),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ //new for 3D charts
+ rOutProperties.push_back(
+ Property( C2U("RightAngledAxes"),
+ PROP_DIAGRAM_RIGHT_ANGLED_AXES,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U("Perspective"),
+ PROP_DIAGRAM_PERSPECTIVE,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U("RotationHorizontal"),
+ PROP_DIAGRAM_ROTATION_HORIZONTAL,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U("RotationVertical"),
+ PROP_DIAGRAM_ROTATION_VERTICAL,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::MAYBEVOID ));
+
+ // XAxisXSupplier
+ rOutProperties.push_back(
+ Property( C2U( "HasXAxis" ),
+ PROP_DIAGRAM_HAS_X_AXIS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasXAxisDescription" ),
+ PROP_DIAGRAM_HAS_X_AXIS_DESCR,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasXAxisTitle" ),
+ PROP_DIAGRAM_HAS_X_AXIS_TITLE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasXAxisGrid" ),
+ PROP_DIAGRAM_HAS_X_AXIS_GRID,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasXAxisHelpGrid" ),
+ PROP_DIAGRAM_HAS_X_AXIS_HELP_GRID,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // XAxisYSupplier
+ rOutProperties.push_back(
+ Property( C2U( "HasYAxis" ),
+ PROP_DIAGRAM_HAS_Y_AXIS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasYAxisDescription" ),
+ PROP_DIAGRAM_HAS_Y_AXIS_DESCR,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasYAxisTitle" ),
+ PROP_DIAGRAM_HAS_Y_AXIS_TITLE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasYAxisGrid" ),
+ PROP_DIAGRAM_HAS_Y_AXIS_GRID,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasYAxisHelpGrid" ),
+ PROP_DIAGRAM_HAS_Y_AXIS_HELP_GRID,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // XAxisZSupplier
+ rOutProperties.push_back(
+ Property( C2U( "HasZAxis" ),
+ PROP_DIAGRAM_HAS_Z_AXIS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasZAxisDescription" ),
+ PROP_DIAGRAM_HAS_Z_AXIS_DESCR,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasZAxisTitle" ),
+ PROP_DIAGRAM_HAS_Z_AXIS_TITLE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasZAxisGrid" ),
+ PROP_DIAGRAM_HAS_Z_AXIS_GRID,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasZAxisHelpGrid" ),
+ PROP_DIAGRAM_HAS_Z_AXIS_HELP_GRID,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // XTwoAxisXSupplier
+ rOutProperties.push_back(
+ Property( C2U( "HasSecondaryXAxis" ),
+ PROP_DIAGRAM_HAS_SECOND_X_AXIS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasSecondaryXAxisDescription" ),
+ PROP_DIAGRAM_HAS_SECOND_X_AXIS_DESCR,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // XTwoAxisYSupplier
+ rOutProperties.push_back(
+ Property( C2U( "HasSecondaryYAxis" ),
+ PROP_DIAGRAM_HAS_SECOND_Y_AXIS,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasSecondaryYAxisDescription" ),
+ PROP_DIAGRAM_HAS_SECOND_Y_AXIS_DESCR,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ // XSecondAxisTitleSupplier
+ rOutProperties.push_back(
+ Property( C2U( "HasSecondaryXAxisTitle" ),
+ PROP_DIAGRAM_HAS_SECOND_X_AXIS_TITLE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "HasSecondaryYAxisTitle" ),
+ PROP_DIAGRAM_HAS_SECOND_Y_AXIS_TITLE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "MissingValueTreatment" ),
+ PROP_DIAGRAM_MISSING_VALUE_TREATMENT,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "AutomaticSize" ),
+ PROP_DIAGRAM_AUTOMATIC_SIZE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+const uno::Sequence< Property > & lcl_GetPropertySequence()
+{
+ static uno::Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+ ::chart::SceneProperties::AddPropertiesToVector( aProperties );
+ WrappedStatisticProperties::addProperties( aProperties );
+ WrappedSymbolProperties::addProperties( aProperties );
+ WrappedDataCaptionProperties::addProperties( aProperties );
+ WrappedSplineProperties::addProperties( aProperties );
+ WrappedStockProperties::addProperties( aProperties );
+ WrappedAutomaticPositionProperties::addProperties( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+bool lcl_isXYChart( const Reference< chart2::XDiagram > xDiagram )
+{
+ bool bRet = false;
+ Reference< chart2::XChartType > xChartType( ::chart::DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
+ if( xChartType.is() )
+ {
+ rtl::OUString aChartType( xChartType->getChartType() );
+ if( aChartType.equalsIgnoreAsciiCase(CHART2_SERVICE_NAME_CHARTTYPE_SCATTER) )
+ bRet = true;
+ }
+ return bRet;
+}
+
+sal_Int32 lcl_getNewAPIIndexForOldAPIIndex(
+ sal_Int32 nOldAPIIndex
+ , Reference< chart2::XDiagram > xDiagram )
+{
+ sal_Int32 nNewAPIIndex = nOldAPIIndex;
+
+ if( lcl_isXYChart( xDiagram ) )
+ {
+ if( nNewAPIIndex >= 1 )
+ nNewAPIIndex -= 1;
+ }
+
+ ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesList(
+ ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ if( nNewAPIIndex >= static_cast<sal_Int32>(aSeriesList.size()) )
+ nNewAPIIndex = -1;
+
+ return nNewAPIIndex;
+}
+
+typedef ::std::map< OUString, OUString > tChartTypeMap;
+
+OUString lcl_getDiagramType( const OUString & rTemplateServiceName )
+{
+ const OUString aPrefix( RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.template."));
+
+ if( rTemplateServiceName.match( aPrefix ))
+ {
+ const OUString aName( rTemplateServiceName.copy( aPrefix.getLength()));
+
+ // "Area" "StackedArea" "PercentStackedArea" "ThreeDArea"
+ // "StackedThreeDArea" "PercentStackedThreeDArea"
+ if( aName.indexOf( C2U("Area") ) != -1 )
+ return C2U( "com.sun.star.chart.AreaDiagram" );
+
+ // "Pie" "PieAllExploded" "ThreeDPie" "ThreeDPieAllExploded"
+ if( aName.indexOf( C2U("Pie") ) != -1 )
+ return C2U( "com.sun.star.chart.PieDiagram" );
+
+ // "Column" "StackedColumn" "PercentStackedColumn" "ThreeDColumnDeep"
+ // "ThreeDColumnFlat" "StackedThreeDColumnFlat"
+ // "PercentStackedThreeDColumnFlat" "Bar" "StackedBar"
+ // "PercentStackedBar" "ThreeDBarDeep" "ThreeDBarFlat"
+ // "StackedThreeDBarFlat" "PercentStackedThreeDBarFlat" "ColumnWithLine"
+ // "StackedColumnWithLine"
+ if( aName.indexOf( C2U("Column") ) != -1 || aName.indexOf( C2U("Bar") ) != -1 )
+ return C2U( "com.sun.star.chart.BarDiagram" );
+
+ // "Donut" "DonutAllExploded" "ThreeDDonut" "ThreeDDonutAllExploded"
+ if( aName.indexOf( C2U("Donut") ) != -1 )
+ return C2U( "com.sun.star.chart.DonutDiagram" );
+
+ // "ScatterLineSymbol" "ScatterLine" "ScatterSymbol" "ThreeDScatter"
+ if( aName.indexOf( C2U("Scatter") ) != -1 )
+ return C2U( "com.sun.star.chart.XYDiagram" );
+
+ // "FilledNet" "StackedFilledNet" "PercentStackedFilledNet"
+ if( aName.indexOf( C2U("FilledNet") ) != -1 )
+ return C2U( "com.sun.star.chart.FilledNetDiagram" );
+
+ // "Net" "NetSymbol" "NetLine" "StackedNet" "StackedNetSymbol"
+ // "StackedNetLine" "PercentStackedNet" "PercentStackedNetSymbol"
+ // "PercentStackedNetLine"
+ if( aName.indexOf( C2U("Net") ) != -1 )
+ return C2U( "com.sun.star.chart.NetDiagram" );
+
+ // "StockLowHighClose" "StockOpenLowHighClose" "StockVolumeLowHighClose"
+ // "StockVolumeOpenLowHighClose"
+ if( aName.indexOf( C2U("Stock") ) != -1 )
+ return C2U( "com.sun.star.chart.StockDiagram" );
+
+ if( aName.indexOf( C2U("Bubble") ) != -1 )
+ return C2U( "com.sun.star.chart.BubbleDiagram" );
+
+ // Note: this must be checked after Bar, Net and Scatter
+
+ // "Symbol" "StackedSymbol" "PercentStackedSymbol" "Line" "StackedLine"
+ // "PercentStackedLine" "LineSymbol" "StackedLineSymbol"
+ // "PercentStackedLineSymbol" "ThreeDLine" "StackedThreeDLine"
+ // "PercentStackedThreeDLine" "ThreeDLineDeep"
+ if( aName.indexOf( C2U("Line") ) != -1 || aName.indexOf( C2U("Symbol") ) != -1 )
+ return C2U( "com.sun.star.chart.LineDiagram" );
+
+ OSL_ENSURE( false, "unknown template" );
+ }
+
+ return OUString();
+}
+
+typedef ::comphelper::MakeMap< ::rtl::OUString, ::rtl::OUString > tMakeStringStringMap;
+//static
+const tMakeStringStringMap& lcl_getChartTypeNameMap()
+{
+ static tMakeStringStringMap g_aChartTypeNameMap =
+ tMakeStringStringMap
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.LineChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.LineDiagram" ) )
+
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.AreaChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.AreaDiagram" ) )
+
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.ColumnChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.BarDiagram" ) )
+
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.PieChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.PieDiagram" ) )
+
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.DonutChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.DonutDiagram" ) )
+
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.ScatterChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.XYDiagram" ) )
+
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.FilledNetChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.FilledNetDiagram" ) )
+
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.NetChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.NetDiagram" ) )
+
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.CandleStickChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.StockDiagram" ) )
+
+ ( ::rtl::OUString::createFromAscii( "com.sun.star.chart2.BubbleChartType" )
+ , ::rtl::OUString::createFromAscii( "com.sun.star.chart.BubbleDiagram" ) )
+
+ ;
+ return g_aChartTypeNameMap;
+}
+
+
+OUString lcl_getOldChartTypeName( const OUString & rNewChartTypeName )
+{
+ OUString aOld(rNewChartTypeName);
+
+ const tMakeStringStringMap& rMap = lcl_getChartTypeNameMap();
+ tMakeStringStringMap::const_iterator aIt( rMap.find( rNewChartTypeName ));
+ if( aIt != rMap.end())
+ {
+ aOld = aIt->second;
+ }
+ return aOld;
+}
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+DiagramWrapper::DiagramWrapper(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
+ m_spChart2ModelContact( spChart2ModelContact ),
+ m_aEventListenerContainer( m_aMutex )
+{
+}
+
+DiagramWrapper::~DiagramWrapper()
+{}
+
+// ____ XDiagram ____
+OUString SAL_CALL DiagramWrapper::getDiagramType()
+ throw (uno::RuntimeException)
+{
+ OUString aRet;
+
+ Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xChartDoc.is() && xDiagram.is() )
+ {
+ Reference< beans::XPropertySet > xChartDocProp( xChartDoc, uno::UNO_QUERY );
+ if( xChartDocProp.is() )
+ {
+ uno::Reference< util::XRefreshable > xAddIn;
+ if( xChartDocProp->getPropertyValue( C2U( "AddIn" ) ) >>= xAddIn )
+ {
+ uno::Reference< lang::XServiceName > xServiceName( xAddIn, uno::UNO_QUERY );
+ if( xServiceName.is())
+ return xServiceName->getServiceName();
+ }
+ }
+
+ Reference< lang::XMultiServiceFactory > xChartTypeManager( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
+ DiagramHelper::tTemplateWithServiceName aTemplateAndService =
+ DiagramHelper::getTemplateForDiagram( xDiagram, xChartTypeManager );
+
+ aRet = lcl_getDiagramType( aTemplateAndService.second );
+ }
+
+ if( !aRet.getLength())
+ {
+ // none of the standard templates matched
+ // use first chart type
+ Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeByIndex( xDiagram, 0 ) );
+ if( xChartType.is() )
+ {
+ aRet = xChartType->getChartType();
+ if( aRet.getLength() )
+ aRet = lcl_getOldChartTypeName( aRet );
+ }
+ if( !aRet.getLength())
+ aRet = C2U( "com.sun.star.chart.BarDiagram" );
+ }
+
+ return aRet;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getDataRowProperties( sal_Int32 nRow )
+ throw (lang::IndexOutOfBoundsException,
+ uno::RuntimeException)
+{
+ if( nRow < 0 )
+ throw lang::IndexOutOfBoundsException(
+ C2U( "DataSeries index invalid" ), static_cast< ::cppu::OWeakObject * >( this ));
+
+ Reference< chart2::XDataSeries > xSeries;
+
+ sal_Int32 nNewAPIIndex = lcl_getNewAPIIndexForOldAPIIndex( nRow, m_spChart2ModelContact->getChart2Diagram() );
+ if( nNewAPIIndex < 0 )
+ throw lang::IndexOutOfBoundsException(
+ C2U( "DataSeries index invalid" ), static_cast< ::cppu::OWeakObject * >( this ));
+
+ Reference< beans::XPropertySet > xRet( new DataSeriesPointWrapper(
+ DataSeriesPointWrapper::DATA_SERIES, nNewAPIIndex, 0, m_spChart2ModelContact ) );
+ return xRet;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getDataPointProperties( sal_Int32 nCol, sal_Int32 nRow )
+ throw (lang::IndexOutOfBoundsException,
+ uno::RuntimeException)
+{
+ if( nCol < 0 || nRow < 0 )
+ throw lang::IndexOutOfBoundsException(
+ C2U( "DataSeries index invalid" ), static_cast< ::cppu::OWeakObject * >( this ));
+
+ Reference< chart2::XDataSeries > xSeries;
+
+ sal_Int32 nNewAPIIndex = lcl_getNewAPIIndexForOldAPIIndex( nRow, m_spChart2ModelContact->getChart2Diagram() );
+ if( nNewAPIIndex < 0 )
+ throw lang::IndexOutOfBoundsException(
+ C2U( "DataSeries index invalid" ), static_cast< ::cppu::OWeakObject * >( this ));
+
+ //todo: check borders of point index
+
+ Reference< beans::XPropertySet > xRet( new DataSeriesPointWrapper(
+ DataSeriesPointWrapper::DATA_POINT, nNewAPIIndex, nCol, m_spChart2ModelContact ) );
+
+ return xRet;
+}
+
+// ____ XShape (base of XDiagram) ____
+awt::Point SAL_CALL DiagramWrapper::getPosition()
+ throw (uno::RuntimeException)
+{
+ awt::Point aPosition;
+
+ Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() );
+ if( xProp.is() )
+ {
+ bool bSet = false;
+ chart2::RelativePosition aRelativePosition;
+ uno::Any aAPosition( xProp->getPropertyValue( C2U( "RelativePosition" ) ) );
+ if( aAPosition >>= aRelativePosition )
+ {
+ awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
+ aPosition.X = static_cast<sal_Int32>(aRelativePosition.Primary*aPageSize.Width);
+ aPosition.Y = static_cast<sal_Int32>(aRelativePosition.Secondary*aPageSize.Height);
+
+ aPosition = RelativePositionHelper::getUpperLeftCornerOfAnchoredObject(
+ aPosition, DiagramWrapper::getSize(), aRelativePosition.Anchor );
+
+ bSet = true;
+ }
+ if(!bSet)
+ aPosition = m_spChart2ModelContact->GetDiagramPositionInclusive();
+ }
+
+ return aPosition;
+}
+
+void SAL_CALL DiagramWrapper::setPosition( const awt::Point& aPosition )
+ throw (uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() );
+ if( xProp.is() )
+ {
+ if( aPosition.X < 0 || aPosition.Y < 0 )
+ {
+ if( !TitleHelper::getTitle( TitleHelper::X_AXIS_TITLE, m_spChart2ModelContact->getChartModel() ).is() &&
+ !TitleHelper::getTitle( TitleHelper::Y_AXIS_TITLE, m_spChart2ModelContact->getChartModel() ).is() )
+ {
+ DBG_ERROR("DiagramWrapper::setPosition called with negative position -> automatic values are taken instead" );
+ uno::Any aEmpty;
+ xProp->setPropertyValue( C2U( "RelativePosition" ), aEmpty );
+ return;
+ }
+ //else: The saved didagram size does include the axis title sizes thus the position and size could be negative
+ }
+
+ awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
+
+ chart2::RelativePosition aRelativePosition;
+ aRelativePosition.Anchor = drawing::Alignment_TOP_LEFT;
+ aRelativePosition.Primary = double(aPosition.X)/double(aPageSize.Width);
+ aRelativePosition.Secondary = double(aPosition.Y)/double(aPageSize.Height);
+ xProp->setPropertyValue( C2U( "RelativePosition" ), uno::makeAny(aRelativePosition) );
+ }
+}
+
+awt::Size SAL_CALL DiagramWrapper::getSize()
+ throw (uno::RuntimeException)
+{
+ awt::Size aSize;
+
+ Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() );
+ if( xProp.is() )
+ {
+ bool bSet = false;
+ chart2::RelativeSize aRelativeSize;
+ uno::Any aASize( xProp->getPropertyValue( C2U( "RelativeSize" ) ) );
+ if(aASize>>=aRelativeSize)
+ {
+ awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
+ aSize.Width = static_cast<sal_Int32>(aRelativeSize.Primary*aPageSize.Width);
+ aSize.Height = static_cast<sal_Int32>(aRelativeSize.Secondary*aPageSize.Height);
+ bSet = true;
+ }
+ if(!bSet)
+ aSize = m_spChart2ModelContact->GetDiagramSizeInclusive();
+ }
+
+ return aSize;
+}
+
+void SAL_CALL DiagramWrapper::setSize( const awt::Size& aSize )
+ throw (beans::PropertyVetoException,
+ uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() );
+ if( xProp.is() )
+ {
+ awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
+
+ chart2::RelativeSize aRelativeSize;
+ aRelativeSize.Primary = double(aSize.Width)/double(aPageSize.Width);
+ aRelativeSize.Secondary = double(aSize.Height)/double(aPageSize.Height);
+
+ if( aRelativeSize.Primary > 1 || aRelativeSize.Secondary > 1 )
+ {
+ if( !TitleHelper::getTitle( TitleHelper::X_AXIS_TITLE, m_spChart2ModelContact->getChartModel() ).is() &&
+ !TitleHelper::getTitle( TitleHelper::Y_AXIS_TITLE, m_spChart2ModelContact->getChartModel() ).is() )
+ {
+ DBG_ERROR("DiagramWrapper::setSize called with sizes bigger than page -> automatic values are taken instead" );
+ uno::Any aEmpty;
+ xProp->setPropertyValue( C2U( "RelativeSize" ), aEmpty );
+ return;
+ }
+ //else: The saved didagram size does include the axis title sizes thus the position and size could be out of range
+ }
+
+ xProp->setPropertyValue( C2U( "RelativeSize" ), uno::makeAny(aRelativeSize) );
+ }
+}
+
+// ____ XShapeDescriptor (base of XShape) ____
+OUString SAL_CALL DiagramWrapper::getShapeType()
+ throw (uno::RuntimeException)
+{
+ return C2U( "com.sun.star.chart.Diagram" );
+}
+
+// ____ XAxisZSupplier ____
+Reference<
+ drawing::XShape > SAL_CALL DiagramWrapper::getZAxisTitle()
+ throw (uno::RuntimeException)
+{
+ if( !m_xZAxisTitle.is() )
+ {
+ m_xZAxisTitle = new TitleWrapper( TitleHelper::Z_AXIS_TITLE, m_spChart2ModelContact );
+ }
+ return m_xZAxisTitle;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getZMainGrid()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xZMainGrid.is())
+ {
+ m_xZMainGrid = new GridWrapper( GridWrapper::Z_MAIN_GRID, m_spChart2ModelContact );
+ }
+ return m_xZMainGrid;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getZHelpGrid()
+ throw (uno::RuntimeException)
+{
+ if( !m_xZHelpGrid.is() )
+ {
+ m_xZHelpGrid = new GridWrapper( GridWrapper::Z_SUB_GRID, m_spChart2ModelContact );
+ }
+ return m_xZHelpGrid;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getZAxis()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xZAxis.is())
+ {
+ m_xZAxis = new AxisWrapper( AxisWrapper::Z_AXIS, m_spChart2ModelContact );
+ }
+ return m_xZAxis;
+}
+
+
+// ____ XTwoAxisXSupplier ____
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryXAxis()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xSecondXAxis.is())
+ {
+ m_xSecondXAxis = new AxisWrapper( AxisWrapper::SECOND_X_AXIS, m_spChart2ModelContact );
+ }
+ return m_xSecondXAxis;
+}
+
+
+// ____ XAxisXSupplier (base of XTwoAxisXSupplier) ____
+Reference<
+ drawing::XShape > SAL_CALL DiagramWrapper::getXAxisTitle()
+ throw (uno::RuntimeException)
+{
+
+ if( !m_xXAxisTitle.is() )
+ {
+ m_xXAxisTitle = new TitleWrapper( TitleHelper::X_AXIS_TITLE, m_spChart2ModelContact );
+ }
+ return m_xXAxisTitle;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getXAxis()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xXAxis.is())
+ {
+ m_xXAxis = new AxisWrapper( AxisWrapper::X_AXIS, m_spChart2ModelContact );
+ }
+
+ return m_xXAxis;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getXMainGrid()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xXMainGrid.is())
+ {
+ m_xXMainGrid = new GridWrapper( GridWrapper::X_MAIN_GRID, m_spChart2ModelContact );
+ }
+
+ return m_xXMainGrid;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getXHelpGrid()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xXHelpGrid.is())
+ {
+ m_xXHelpGrid = new GridWrapper( GridWrapper::X_SUB_GRID, m_spChart2ModelContact );
+ }
+ return m_xXHelpGrid;
+}
+
+
+// ____ XTwoAxisYSupplier ____
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getSecondaryYAxis()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xSecondYAxis.is())
+ {
+ m_xSecondYAxis = new AxisWrapper( AxisWrapper::SECOND_Y_AXIS, m_spChart2ModelContact );
+ }
+ return m_xSecondYAxis;
+}
+
+
+// ____ XAxisYSupplier (base of XTwoAxisYSupplier) ____
+Reference<
+ drawing::XShape > SAL_CALL DiagramWrapper::getYAxisTitle()
+ throw (uno::RuntimeException)
+{
+ if( !m_xYAxisTitle.is() )
+ {
+ m_xYAxisTitle = new TitleWrapper( TitleHelper::Y_AXIS_TITLE, m_spChart2ModelContact );
+ }
+ return m_xYAxisTitle;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getYAxis()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xYAxis.is())
+ {
+ m_xYAxis = new AxisWrapper( AxisWrapper::Y_AXIS, m_spChart2ModelContact );
+ }
+ return m_xYAxis;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getYHelpGrid()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xYHelpGrid.is())
+ {
+ m_xYHelpGrid = new GridWrapper( GridWrapper::Y_SUB_GRID, m_spChart2ModelContact );
+ }
+ return m_xYHelpGrid;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getYMainGrid()
+ throw (uno::RuntimeException)
+{
+ if( ! m_xYMainGrid.is())
+ {
+ m_xYMainGrid = new GridWrapper( GridWrapper::Y_MAIN_GRID, m_spChart2ModelContact );
+ }
+ return m_xYMainGrid;
+}
+
+// ____ XSecondAxisTitleSupplier ____
+Reference<
+ drawing::XShape > SAL_CALL DiagramWrapper::getSecondXAxisTitle()
+ throw (uno::RuntimeException)
+{
+ if( !m_xSecondXAxisTitle.is() )
+ {
+ m_xSecondXAxisTitle = new TitleWrapper( TitleHelper::SECONDARY_X_AXIS_TITLE, m_spChart2ModelContact );
+ }
+ return m_xSecondXAxisTitle;
+}
+
+Reference<
+ drawing::XShape > SAL_CALL DiagramWrapper::getSecondYAxisTitle()
+ throw (uno::RuntimeException)
+{
+ if( !m_xSecondYAxisTitle.is() )
+ {
+ m_xSecondYAxisTitle = new TitleWrapper( TitleHelper::SECONDARY_Y_AXIS_TITLE, m_spChart2ModelContact );
+ }
+ return m_xSecondYAxisTitle;
+}
+
+// ____ XStatisticDisplay ____
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getUpBar()
+ throw (uno::RuntimeException)
+{
+ if( !m_xUpBarWrapper.is() )
+ {
+ m_xUpBarWrapper = new UpDownBarWrapper( true, m_spChart2ModelContact );
+ }
+ return m_xUpBarWrapper;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getDownBar()
+ throw (uno::RuntimeException)
+{
+ if( !m_xDownBarWrapper.is() )
+ {
+ m_xDownBarWrapper = new UpDownBarWrapper( false, m_spChart2ModelContact );
+ }
+ return m_xDownBarWrapper;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getMinMaxLine()
+ throw (uno::RuntimeException)
+{
+ if( !m_xMinMaxLineWrapper.is() )
+ {
+ m_xMinMaxLineWrapper = new MinMaxLineWrapper( m_spChart2ModelContact );
+ }
+ return m_xMinMaxLineWrapper;
+}
+
+// ____ X3DDisplay ____
+Reference< beans::XPropertySet > SAL_CALL DiagramWrapper::getWall()
+ throw (uno::RuntimeException)
+{
+ if( !m_xWall.is() )
+ {
+ m_xWall = new WallFloorWrapper( true, m_spChart2ModelContact );
+ }
+ return m_xWall;
+}
+
+Reference<
+ beans::XPropertySet > SAL_CALL DiagramWrapper::getFloor()
+ throw (uno::RuntimeException)
+{
+ if( !m_xFloor.is() )
+ {
+ m_xFloor = new WallFloorWrapper( false, m_spChart2ModelContact );
+ }
+ return m_xFloor;
+}
+
+// ____ X3DDefaultSetter ____
+void SAL_CALL DiagramWrapper::set3DSettingsToDefault()
+ throw (uno::RuntimeException)
+{
+ Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY );
+ if( x3DDefaultSetter.is() )
+ x3DDefaultSetter->set3DSettingsToDefault();
+}
+
+void SAL_CALL DiagramWrapper::setDefaultRotation()
+ throw (uno::RuntimeException)
+{
+ Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY );
+ if( x3DDefaultSetter.is() )
+ x3DDefaultSetter->setDefaultRotation();
+}
+
+void SAL_CALL DiagramWrapper::setDefaultIllumination()
+ throw (uno::RuntimeException)
+{
+ Reference< X3DDefaultSetter > x3DDefaultSetter( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY );
+ if( x3DDefaultSetter.is() )
+ x3DDefaultSetter->setDefaultIllumination();
+}
+
+// ____ XComponent ____
+void SAL_CALL DiagramWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( static_cast< ::cppu::OWeakObject* >( this )));
+
+ // /--
+ MutexGuard aGuard( GetMutex());
+
+ DisposeHelper::DisposeAndClear( m_xXAxisTitle );
+ DisposeHelper::DisposeAndClear( m_xYAxisTitle );
+ DisposeHelper::DisposeAndClear( m_xZAxisTitle );
+ DisposeHelper::DisposeAndClear( m_xSecondXAxisTitle );
+ DisposeHelper::DisposeAndClear( m_xSecondYAxisTitle );
+ DisposeHelper::DisposeAndClear( m_xXAxis );
+ DisposeHelper::DisposeAndClear( m_xYAxis );
+ DisposeHelper::DisposeAndClear( m_xZAxis );
+ DisposeHelper::DisposeAndClear( m_xSecondXAxis );
+ DisposeHelper::DisposeAndClear( m_xSecondYAxis );
+ DisposeHelper::DisposeAndClear( m_xXMainGrid );
+ DisposeHelper::DisposeAndClear( m_xYMainGrid );
+ DisposeHelper::DisposeAndClear( m_xZMainGrid );
+ DisposeHelper::DisposeAndClear( m_xXHelpGrid );
+ DisposeHelper::DisposeAndClear( m_xYHelpGrid );
+ DisposeHelper::DisposeAndClear( m_xZHelpGrid );
+ DisposeHelper::DisposeAndClear( m_xWall );
+ DisposeHelper::DisposeAndClear( m_xFloor );
+ DisposeHelper::DisposeAndClear( m_xMinMaxLineWrapper );
+ DisposeHelper::DisposeAndClear( m_xUpBarWrapper );
+ DisposeHelper::DisposeAndClear( m_xDownBarWrapper );
+
+ clearWrappedPropertySet();
+ // \--
+}
+
+void SAL_CALL DiagramWrapper::addEventListener(
+ const Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL DiagramWrapper::removeEventListener(
+ const Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+// ____ XEventListener ____
+// void SAL_CALL DiagramWrapper::disposing( const lang::EventObject& Source )
+// throw (uno::RuntimeException)
+// {
+// }
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DIAGRAM_DATAROW_SOURCE
+class WrappedDataRowSourceProperty : public WrappedProperty
+{
+public:
+ WrappedDataRowSourceProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedDataRowSourceProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable Any m_aOuterValue;
+};
+
+WrappedDataRowSourceProperty::WrappedDataRowSourceProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("DataRowSource"),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_aOuterValue()
+{
+ m_aOuterValue = WrappedDataRowSourceProperty::getPropertyDefault( 0 );
+}
+
+WrappedDataRowSourceProperty::~WrappedDataRowSourceProperty()
+{
+}
+
+void WrappedDataRowSourceProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::com::sun::star::chart::ChartDataRowSource eChartDataRowSource = ::com::sun::star::chart::ChartDataRowSource_ROWS;
+ if( ! (rOuterValue >>= eChartDataRowSource) )
+ throw lang::IllegalArgumentException( C2U("Property DataRowSource requires ::com::sun::star::chart::ChartDataRowSource value"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+
+ bool bNewUseColumns = eChartDataRowSource == ::com::sun::star::chart::ChartDataRowSource_COLUMNS;
+
+ ::rtl::OUString aRangeString;
+ bool bUseColumns = true;
+ bool bFirstCellAsLabel = true;
+ bool bHasCategories = true;
+ uno::Sequence< sal_Int32 > aSequenceMapping;
+
+ if( DataSourceHelper::detectRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
+ , bFirstCellAsLabel, bHasCategories ) )
+ {
+ if( bUseColumns != bNewUseColumns )
+ {
+ aSequenceMapping.realloc(0);
+ DataSourceHelper::setRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aSequenceMapping, bNewUseColumns , bHasCategories, bFirstCellAsLabel );
+ }
+ }
+}
+
+Any WrappedDataRowSourceProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ ::rtl::OUString aRangeString;
+ bool bUseColumns = true;
+ bool bFirstCellAsLabel = true;
+ bool bHasCategories = true;
+ uno::Sequence< sal_Int32 > aSequenceMapping;
+
+ if( DataSourceHelper::detectRangeSegmentation(
+ m_spChart2ModelContact->getChartModel(), aRangeString, aSequenceMapping, bUseColumns
+ , bFirstCellAsLabel, bHasCategories ) )
+ {
+ ::com::sun::star::chart::ChartDataRowSource eChartDataRowSource = ::com::sun::star::chart::ChartDataRowSource_ROWS;
+ if(bUseColumns)
+ eChartDataRowSource = ::com::sun::star::chart::ChartDataRowSource_COLUMNS;
+
+ m_aOuterValue <<= eChartDataRowSource;
+ }
+
+ return m_aOuterValue;
+}
+
+Any WrappedDataRowSourceProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= ::com::sun::star::chart::ChartDataRowSource_COLUMNS;
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+
+//PROP_DIAGRAM_STACKED
+//PROP_DIAGRAM_DEEP
+//PROP_DIAGRAM_PERCENT_STACKED
+class WrappedStackingProperty : public WrappedProperty
+{
+public:
+ WrappedStackingProperty( StackMode eStackMode, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedStackingProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+protected: //methods
+ bool detectInnerValue( StackMode& eInnerStackMode ) const;
+
+private: //member
+::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ const StackMode m_eStackMode;
+ mutable Any m_aOuterValue;
+};
+
+WrappedStackingProperty::WrappedStackingProperty( StackMode eStackMode, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(OUString(),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_eStackMode( eStackMode )
+ , m_aOuterValue()
+{
+ switch( m_eStackMode )
+ {
+ case StackMode_Y_STACKED:
+ m_aOuterName = C2U( "Stacked" );
+ break;
+ case StackMode_Y_STACKED_PERCENT:
+ m_aOuterName = C2U( "Percent" );
+ break;
+ case StackMode_Z_STACKED:
+ m_aOuterName = C2U( "Deep" );
+ break;
+ default:
+ OSL_ENSURE( false, "unexpected stack mode" );
+ break;
+ }
+}
+
+WrappedStackingProperty::~WrappedStackingProperty()
+{
+}
+
+bool WrappedStackingProperty::detectInnerValue( StackMode& eStackMode ) const
+{
+ bool bHasDetectableInnerValue = false;
+ bool bIsAmbiguous = false;
+ eStackMode = DiagramHelper::getStackMode( m_spChart2ModelContact->getChart2Diagram()
+ , bHasDetectableInnerValue, bIsAmbiguous );
+ return bHasDetectableInnerValue;
+}
+
+void WrappedStackingProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNewValue = false;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Stacking Properties require boolean values"), 0, 0 );
+
+ StackMode eInnerStackMode;
+ bool bHasDetectableInnerValue = detectInnerValue( eInnerStackMode );
+
+ if( !bHasDetectableInnerValue )
+ {
+ m_aOuterValue = rOuterValue;
+ return;
+ }
+
+ if( bNewValue && eInnerStackMode == m_eStackMode )
+ return;
+ if( !bNewValue && eInnerStackMode != m_eStackMode )
+ return;
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() )
+ {
+ StackMode eNewStackMode = bNewValue ? m_eStackMode : StackMode_NONE;
+ DiagramHelper::setStackMode( xDiagram, eNewStackMode );
+ }
+}
+
+Any WrappedStackingProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ StackMode eInnerStackMode;
+ if( detectInnerValue( eInnerStackMode ) )
+ {
+ sal_Bool bValue = (eInnerStackMode == m_eStackMode);
+ Any aAny;
+ aAny <<= bValue;
+ return aAny;
+ }
+ return m_aOuterValue;
+}
+
+Any WrappedStackingProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_Bool( sal_False );
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DIAGRAM_THREE_D
+class WrappedDim3DProperty : public WrappedProperty
+{
+public:
+ WrappedDim3DProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedDim3DProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable Any m_aOuterValue;
+};
+
+WrappedDim3DProperty::WrappedDim3DProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("Dim3D"),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_aOuterValue()
+{
+ m_aOuterValue = WrappedDim3DProperty::getPropertyDefault( 0 );
+}
+
+WrappedDim3DProperty::~WrappedDim3DProperty()
+{
+}
+
+void WrappedDim3DProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNew3D = false;
+ if( ! (rOuterValue >>= bNew3D) )
+ throw lang::IllegalArgumentException( C2U("Property Dim3D requires boolean value"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( !xDiagram.is() )
+ return;
+
+ sal_Bool bOld3D = DiagramHelper::getDimension( xDiagram ) == 3;
+ if( bOld3D != bNew3D )
+ DiagramHelper::setDimension( xDiagram, bNew3D ? 3 : 2 );
+}
+
+Any WrappedDim3DProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() )
+ {
+ sal_Bool b3D = DiagramHelper::getDimension( xDiagram ) == 3;
+ m_aOuterValue <<= b3D;
+ }
+ return m_aOuterValue;
+}
+
+Any WrappedDim3DProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_Bool( sal_False );
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DIAGRAM_VERTICAL
+class WrappedVerticalProperty : public WrappedProperty
+{
+public:
+ WrappedVerticalProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedVerticalProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable Any m_aOuterValue;
+};
+
+WrappedVerticalProperty::WrappedVerticalProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("Vertical"),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_aOuterValue()
+{
+ m_aOuterValue = WrappedVerticalProperty::getPropertyDefault( 0 );
+}
+
+WrappedVerticalProperty::~WrappedVerticalProperty()
+{
+}
+
+void WrappedVerticalProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNewVertical = false;
+ if( ! (rOuterValue >>= bNewVertical) )
+ throw lang::IllegalArgumentException( C2U("Property Vertical requires boolean value"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( !xDiagram.is() )
+ return;
+
+ bool bFound = false;
+ bool bAmbiguous = false;
+ sal_Bool bOldVertical = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous );
+ if( bFound && ( bOldVertical != bNewVertical || bAmbiguous ) )
+ DiagramHelper::setVertical( xDiagram, bNewVertical );
+}
+
+Any WrappedVerticalProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ bool bFound = false;
+ bool bAmbiguous = false;
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() )
+ {
+ sal_Bool bVertical = DiagramHelper::getVertical( xDiagram, bFound, bAmbiguous );
+ if( bFound )
+ m_aOuterValue <<= bVertical;
+ }
+ return m_aOuterValue;
+}
+
+Any WrappedVerticalProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_Bool( sal_False );
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DIAGRAM_NUMBER_OF_LINES
+class WrappedNumberOfLinesProperty : public WrappedProperty
+{
+public:
+ WrappedNumberOfLinesProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedNumberOfLinesProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+protected: //methods
+ bool detectInnerValue( uno::Any& rInnerValue ) const;
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable Any m_aOuterValue;
+};
+
+WrappedNumberOfLinesProperty::WrappedNumberOfLinesProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("NumberOfLines"),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_aOuterValue( this->getPropertyDefault(0) )
+{
+}
+
+WrappedNumberOfLinesProperty::~WrappedNumberOfLinesProperty()
+{
+}
+
+bool WrappedNumberOfLinesProperty::detectInnerValue( uno::Any& rInnerValue ) const
+{
+ sal_Int32 nNumberOfLines = 0;
+ bool bHasDetectableInnerValue = false;
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ uno::Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ if( xDiagram.is() && xChartDoc.is() )
+ {
+ ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesVector(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ if( aSeriesVector.size() > 0 )
+ {
+ Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
+ DiagramHelper::tTemplateWithServiceName aTemplateAndService =
+ DiagramHelper::getTemplateForDiagram( xDiagram, xFact );
+ if( aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.ColumnWithLine" ) ) )
+ {
+ try
+ {
+ uno::Reference< beans::XPropertySet > xProp( aTemplateAndService.first, uno::UNO_QUERY );
+ xProp->getPropertyValue( m_aOuterName ) >>= nNumberOfLines;
+ bHasDetectableInnerValue = true;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+ }
+ if(bHasDetectableInnerValue)
+ rInnerValue = uno::makeAny(nNumberOfLines);
+ return bHasDetectableInnerValue;
+}
+
+void WrappedNumberOfLinesProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Int32 nNewValue;
+ if( ! (rOuterValue >>= nNewValue) )
+ throw lang::IllegalArgumentException( C2U("property NumberOfLines requires sal_Int32 value"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+
+ uno::Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ sal_Int32 nDimension = ::chart::DiagramHelper::getDimension( xDiagram );
+ if( xChartDoc.is() && xDiagram.is() && nDimension == 2 )
+ {
+ Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
+ DiagramHelper::tTemplateWithServiceName aTemplateAndService =
+ DiagramHelper::getTemplateForDiagram( xDiagram, xFact );
+
+ uno::Reference< chart2::XChartTypeTemplate > xTemplate(0);
+ if( aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.ColumnWithLine" ) ) )
+ {
+ if( nNewValue != 0 )
+ {
+ xTemplate.set( aTemplateAndService.first );
+ try
+ {
+ sal_Int32 nOldValue = 0;
+ uno::Reference< beans::XPropertySet > xProp( xTemplate, uno::UNO_QUERY );
+ xProp->getPropertyValue( m_aOuterName ) >>= nOldValue;
+ if( nOldValue == nNewValue )
+ return;
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ else
+ {
+ xTemplate.set( xFact->createInstance( C2U( "com.sun.star.chart2.template.Column" ) ), uno::UNO_QUERY );
+ }
+ }
+ else if( aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.Column" ) ) )
+ {
+ if( nNewValue == 0 )
+ return;
+ xTemplate.set( xFact->createInstance( C2U( "com.sun.star.chart2.template.ColumnWithLine" ) ), uno::UNO_QUERY );
+ }
+
+ if(xTemplate.is())
+ {
+ try
+ {
+ // /-- locked controllers
+ ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ uno::Reference< beans::XPropertySet > xProp( xTemplate, uno::UNO_QUERY );
+ xProp->setPropertyValue( C2U( "NumberOfLines" ), uno::makeAny(nNewValue) );
+ xTemplate->changeDiagram( xDiagram );
+ // \-- locked controllers
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+}
+
+Any WrappedNumberOfLinesProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ if( !detectInnerValue( aRet ) )
+ aRet = m_aOuterValue;
+ return aRet;
+}
+
+Any WrappedNumberOfLinesProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_Int32( 0 );
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DIAGRAM_ATTRIBUTED_DATA_POINTS
+class WrappedAttributedDataPointsProperty : public WrappedProperty
+{
+public:
+ WrappedAttributedDataPointsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedAttributedDataPointsProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable Any m_aOuterValue;
+};
+
+WrappedAttributedDataPointsProperty::WrappedAttributedDataPointsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("AttributedDataPoints"),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_aOuterValue()
+{
+ m_aOuterValue = WrappedAttributedDataPointsProperty::getPropertyDefault( 0 );
+}
+
+WrappedAttributedDataPointsProperty::~WrappedAttributedDataPointsProperty()
+{
+}
+
+void WrappedAttributedDataPointsProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ uno::Sequence< uno::Sequence< sal_Int32 > > aNewValue;
+ if( ! (rOuterValue >>= aNewValue) )
+ throw lang::IllegalArgumentException( C2U("Property AttributedDataPoints requires value of type uno::Sequence< uno::Sequence< sal_Int32 > >"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY );
+
+ if( xDiagram.is() && xDiaProp.is())
+ {
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector(
+ ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+
+ uno::Sequence< uno::Sequence< sal_Int32 > > aResult( aSeriesVector.size() );
+
+ ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt =
+ aSeriesVector.begin();
+ sal_Int32 i = 0;
+ for( ; aIt != aSeriesVector.end(); ++aIt, ++i )
+ {
+ Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ uno::Any aVal;
+ if( i < aNewValue.getLength() )
+ aVal <<= aNewValue[i];
+ else
+ {
+ //set empty sequence
+ uno::Sequence< sal_Int32 > aSeq;
+ aVal <<= aSeq;
+ }
+ xProp->setPropertyValue( C2U( "AttributedDataPoints" ), aVal );
+ }
+ }
+ }
+}
+
+Any WrappedAttributedDataPointsProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ Reference< beans::XPropertySet > xDiaProp( xDiagram, uno::UNO_QUERY );
+
+ if( xDiagram.is() && xDiaProp.is())
+ {
+ ::std::vector< Reference< chart2::XDataSeries > > aSeriesVector(
+ ::chart::DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+
+ uno::Sequence< uno::Sequence< sal_Int32 > > aResult( aSeriesVector.size() );
+
+ ::std::vector< Reference< chart2::XDataSeries > >::const_iterator aIt =
+ aSeriesVector.begin();
+ sal_Int32 i = 0;
+ for( ; aIt != aSeriesVector.end(); ++aIt, ++i )
+ {
+ Reference< beans::XPropertySet > xProp( *aIt, uno::UNO_QUERY );
+ if( xProp.is())
+ {
+ uno::Any aVal(
+ xProp->getPropertyValue( C2U( "AttributedDataPoints" )));
+ uno::Sequence< sal_Int32 > aSeq;
+ if( aVal >>= aSeq )
+ aResult[ i ] = aSeq;
+ }
+ }
+ m_aOuterValue <<= aResult;
+ }
+ return m_aOuterValue;
+}
+
+Any WrappedAttributedDataPointsProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ uno::Sequence< uno::Sequence< sal_Int32 > > aSeq;
+ aRet <<= aSeq;
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DIAGRAM_SOLIDTYPE
+class WrappedSolidTypeProperty : public WrappedProperty
+{
+public:
+ WrappedSolidTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedSolidTypeProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable Any m_aOuterValue;
+};
+
+WrappedSolidTypeProperty::WrappedSolidTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty( C2U( "SolidType" ), OUString() )
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_aOuterValue()
+{
+ m_aOuterValue = WrappedSolidTypeProperty::getPropertyDefault( 0 );
+}
+
+WrappedSolidTypeProperty::~WrappedSolidTypeProperty()
+{
+}
+
+void WrappedSolidTypeProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Int32 nNewSolidType = ::com::sun::star::chart::ChartSolidType::RECTANGULAR_SOLID;
+ if( ! (rOuterValue >>= nNewSolidType) )
+ throw lang::IllegalArgumentException( C2U("Property SolidType requires integer value"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( !xDiagram.is() )
+ return;
+
+ bool bFound = false;
+ bool bAmbiguous = false;
+ sal_Int32 nOldSolidType = DiagramHelper::getGeometry3D( xDiagram, bFound, bAmbiguous );
+ if( bFound && ( nOldSolidType != nNewSolidType || bAmbiguous ) )
+ DiagramHelper::setGeometry3D( xDiagram, nNewSolidType );
+}
+
+Any WrappedSolidTypeProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ bool bFound = false;
+ bool bAmbiguous = false;
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() )
+ {
+ sal_Int32 nGeometry = DiagramHelper::getGeometry3D( xDiagram, bFound, bAmbiguous );
+ if( bFound )
+ m_aOuterValue <<= nGeometry;
+ }
+ return m_aOuterValue;
+}
+
+Any WrappedSolidTypeProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return uno::makeAny( ::com::sun::star::chart::ChartSolidType::RECTANGULAR_SOLID );
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+class WrappedAutomaticSizeProperty : public WrappedProperty
+{
+public:
+ WrappedAutomaticSizeProperty();
+ virtual ~WrappedAutomaticSizeProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+};
+
+WrappedAutomaticSizeProperty::WrappedAutomaticSizeProperty()
+ : WrappedProperty( C2U( "AutomaticSize" ), OUString() )
+{
+}
+
+WrappedAutomaticSizeProperty::~WrappedAutomaticSizeProperty()
+{
+}
+
+void WrappedAutomaticSizeProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( xInnerPropertySet.is() )
+ {
+ bool bNewValue = true;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Property AutomaticSize requires value of type boolean"), 0, 0 );
+
+ try
+ {
+ if( bNewValue )
+ {
+ Any aRelativeSize( xInnerPropertySet->getPropertyValue( C2U( "RelativeSize" ) ) );
+ if( aRelativeSize.hasValue() )
+ xInnerPropertySet->setPropertyValue( C2U( "RelativeSize" ), Any() );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+Any WrappedAutomaticSizeProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet( getPropertyDefault( Reference< beans::XPropertyState >( xInnerPropertySet, uno::UNO_QUERY ) ) );
+ if( xInnerPropertySet.is() )
+ {
+ Any aRelativeSize( xInnerPropertySet->getPropertyValue( C2U( "RelativeSize" ) ) );
+ if( !aRelativeSize.hasValue() )
+ aRet <<= true;
+ }
+ return aRet;
+}
+
+Any WrappedAutomaticSizeProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= false;
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+//PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS
+class WrappedIncludeHiddenCellsProperty : public WrappedProperty
+{
+public:
+ WrappedIncludeHiddenCellsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedIncludeHiddenCellsProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+};
+
+WrappedIncludeHiddenCellsProperty::WrappedIncludeHiddenCellsProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("IncludeHiddenCells"),C2U("IncludeHiddenCells"))
+ , m_spChart2ModelContact( spChart2ModelContact )
+{
+}
+
+WrappedIncludeHiddenCellsProperty::~WrappedIncludeHiddenCellsProperty()
+{
+}
+
+void WrappedIncludeHiddenCellsProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNewValue = false;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Property Dim3D requires boolean value"), 0, 0 );
+
+ ChartModelHelper::setIncludeHiddenCells( bNewValue, m_spChart2ModelContact->getChartModel() );
+}
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+// ____ XDiagramProvider ____
+Reference< chart2::XDiagram > SAL_CALL DiagramWrapper::getDiagram()
+ throw (uno::RuntimeException)
+{
+ return m_spChart2ModelContact->getChart2Diagram();
+}
+
+void SAL_CALL DiagramWrapper::setDiagram(
+ const Reference< chart2::XDiagram >& /*xDiagram*/ )
+ throw (uno::RuntimeException)
+{
+ //@todo: remove this method from interface
+ DBG_ERROR("DiagramWrapper::setDiagram is not implemented, should be removed and not be called" );
+}
+
+// ================================================================================
+
+Reference< beans::XPropertySet > DiagramWrapper::getInnerPropertySet()
+{
+ return Reference< beans::XPropertySet >( m_spChart2ModelContact->getChart2Diagram(), uno::UNO_QUERY );
+}
+
+const Sequence< beans::Property >& DiagramWrapper::getPropertySequence()
+{
+ return lcl_GetPropertySequence();
+}
+
+const std::vector< WrappedProperty* > DiagramWrapper::createWrappedProperties()
+{
+ ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
+
+ WrappedAxisAndGridExistenceProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+ WrappedAxisTitleExistenceProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+ WrappedAxisLabelExistenceProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+ WrappedSceneProperty::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+ WrappedIgnoreProperties::addIgnoreFillProperties( aWrappedProperties );
+ WrappedIgnoreProperties::addIgnoreLineProperties( aWrappedProperties );
+ WrappedStatisticProperties::addWrappedPropertiesForDiagram( aWrappedProperties, m_spChart2ModelContact );
+ WrappedSymbolProperties::addWrappedPropertiesForDiagram( aWrappedProperties, m_spChart2ModelContact );
+ WrappedDataCaptionProperties::addWrappedPropertiesForDiagram( aWrappedProperties, m_spChart2ModelContact );
+ WrappedSplineProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+ WrappedStockProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+ WrappedAutomaticPositionProperties::addWrappedProperties( aWrappedProperties );
+
+ aWrappedProperties.push_back( new WrappedDataRowSourceProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedStackingProperty( StackMode_Y_STACKED,m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedStackingProperty( StackMode_Y_STACKED_PERCENT, m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedStackingProperty( StackMode_Z_STACKED, m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedDim3DProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedVerticalProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedNumberOfLinesProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedAttributedDataPointsProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedProperty( C2U( "StackedBarsConnected" ), C2U( "ConnectBars" ) ) );
+ aWrappedProperties.push_back( new WrappedSolidTypeProperty( m_spChart2ModelContact ) );
+ aWrappedProperties.push_back( new WrappedAutomaticSizeProperty() );
+ aWrappedProperties.push_back( new WrappedIncludeHiddenCellsProperty( m_spChart2ModelContact ) );
+
+ return aWrappedProperties;
+}
+
+// ================================================================================
+
+uno::Sequence< OUString > DiagramWrapper::getSupportedServiceNames_Static()
+{
+ uno::Sequence< OUString > aServices( 8 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart.Diagram" );
+ aServices[ 1 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+ aServices[ 2 ] = C2U( "com.sun.star.chart.StackableDiagram" );
+ aServices[ 3 ] = C2U( "com.sun.star.chart.ChartAxisXSupplier" );
+ aServices[ 4 ] = C2U( "com.sun.star.chart.ChartAxisYSupplier" );
+ aServices[ 5 ] = C2U( "com.sun.star.chart.ChartAxisZSupplier" );
+ aServices[ 6 ] = C2U( "com.sun.star.chart.ChartTwoAxisXSupplier" );
+ aServices[ 7 ] = C2U( "com.sun.star.chart.ChartTwoAxisYSupplier" );
+// aServices[ x ] = C2U( "com.sun.star.beans.PropertySet" );
+// aServices[ x ] = C2U( "com.sun.star.drawing.FillProperties" );
+// aServices[ x ] = C2U( "com.sun.star.drawing.LineProperties" );
+
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( DiagramWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx
new file mode 100644
index 000000000000..b69a856a557f
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.hxx
@@ -0,0 +1,308 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: DiagramWrapper.hxx,v $
+ * $Revision: 1.9 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_DIAGRAMWRAPPER_HXX
+#define CHART_DIAGRAMWRAPPER_HXX
+
+#include "WrappedPropertySet.hxx"
+#include "ServiceMacros.hxx"
+#include "DiagramHelper.hxx"
+#include <cppuhelper/implbase11.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/chart2/XDiagramProvider.hpp>
+#include <com/sun/star/chart2/XChartTypeTemplate.hpp>
+#include <com/sun/star/chart2/XChartTypeManager.hpp>
+#include <com/sun/star/chart/XDiagram.hpp>
+#include <com/sun/star/chart/XAxisZSupplier.hpp>
+#include <com/sun/star/chart/XTwoAxisXSupplier.hpp>
+#include <com/sun/star/chart/XTwoAxisYSupplier.hpp>
+#include <com/sun/star/chart/XStatisticDisplay.hpp>
+#include <com/sun/star/chart/X3DDisplay.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XEventListener.hpp>
+#include <com/sun/star/chart/XSecondAxisTitleSupplier.hpp>
+
+#include <com/sun/star/chart/X3DDefaultSetter.hpp>
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+namespace wrapper
+{
+
+class Chart2ModelContact;
+
+class DiagramWrapper : public ::cppu::ImplInheritanceHelper11<
+ WrappedPropertySet
+ , ::com::sun::star::chart::XDiagram
+ , ::com::sun::star::chart::XAxisZSupplier
+ , ::com::sun::star::chart::XTwoAxisXSupplier // : XAxisXSupplier
+ , ::com::sun::star::chart::XTwoAxisYSupplier // : XAxisYSupplier
+ , ::com::sun::star::chart::XStatisticDisplay
+ , ::com::sun::star::chart::X3DDisplay
+ , ::com::sun::star::chart::X3DDefaultSetter
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::lang::XComponent
+// , ::com::sun::star::lang::XEventListener
+ , ::com::sun::star::chart2::XDiagramProvider
+ , ::com::sun::star::chart::XSecondAxisTitleSupplier
+ >
+{
+public:
+ DiagramWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~DiagramWrapper();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XDiagram ____
+ virtual ::rtl::OUString SAL_CALL getDiagramType()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getDataRowProperties( sal_Int32 nRow )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getDataPointProperties( sal_Int32 nCol, sal_Int32 nRow )
+ throw (::com::sun::star::lang::IndexOutOfBoundsException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XShape (base of XDiagram) ____
+ virtual ::com::sun::star::awt::Point SAL_CALL getPosition()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize )
+ throw (::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XShapeDescriptor (base of XShape) ____
+ virtual ::rtl::OUString SAL_CALL getShapeType()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XAxisZSupplier ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > SAL_CALL getZAxisTitle()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getZMainGrid()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getZHelpGrid()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getZAxis()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XTwoAxisXSupplier ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getSecondaryXAxis()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XAxisXSupplier (base of XTwoAxisXSupplier) ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > SAL_CALL getXAxisTitle()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getXAxis()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getXMainGrid()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getXHelpGrid()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XTwoAxisYSupplier ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getSecondaryYAxis()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XAxisYSupplier (base of XTwoAxisYSupplier) ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > SAL_CALL getYAxisTitle()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getYAxis()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getYHelpGrid()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getYMainGrid()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XSecondAxisTitleSupplier ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > SAL_CALL getSecondXAxisTitle()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape > SAL_CALL getSecondYAxisTitle()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XStatisticDisplay ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getUpBar()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getDownBar()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getMinMaxLine()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ X3DDisplay ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getWall()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet > SAL_CALL getFloor()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ X3DDefaultSetter ____
+ virtual void SAL_CALL set3DSettingsToDefault() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDefaultRotation() throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDefaultIllumination() throw (::com::sun::star::uno::RuntimeException);
+
+// // ____ XEventListener ____
+// virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source )
+// throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XDiagramProvider ____
+ virtual ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram > SAL_CALL getDiagram()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setDiagram( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::chart2::XDiagram >& xDiagram )
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ // ____ WrappedPropertySet ____
+ virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
+ virtual const std::vector< WrappedProperty* > createWrappedProperties();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
+
+private:
+ void updateFromModel();
+
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >
+ m_xXAxisTitle;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >
+ m_xYAxisTitle;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >
+ m_xZAxisTitle;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >
+ m_xSecondXAxisTitle;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::drawing::XShape >
+ m_xSecondYAxisTitle;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xXAxis;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xYAxis;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xZAxis;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xSecondXAxis;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xSecondYAxis;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xXMainGrid;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xYMainGrid;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xZMainGrid;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xXHelpGrid;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xYHelpGrid;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xZHelpGrid;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xWall;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xFloor;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xMinMaxLineWrapper;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xUpBarWrapper;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySet >
+ m_xDownBarWrapper;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_DIAGRAMWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/GridWrapper.cxx b/chart2/source/controller/chartapiwrapper/GridWrapper.cxx
new file mode 100644
index 000000000000..7aebd872f870
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/GridWrapper.cxx
@@ -0,0 +1,214 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: GridWrapper.cxx,v $
+ * $Revision: 1.3.44.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "GridWrapper.hxx"
+#include "macros.hxx"
+#include "AxisHelper.hxx"
+#include "Chart2ModelContact.hxx"
+#include "ContainerHelper.hxx"
+#include "AxisIndexDefines.hxx"
+#include <comphelper/InlineContainer.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+#include "LineProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "WrappedDefaultProperty.hxx"
+
+#include <algorithm>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/math.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace
+{
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.Grid" ));
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+// ::chart::NamedLineProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+GridWrapper::GridWrapper(
+ tGridType eType, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
+ m_spChart2ModelContact( spChart2ModelContact ),
+ m_aEventListenerContainer( m_aMutex ),
+ m_eType( eType )
+{
+}
+
+GridWrapper::~GridWrapper()
+{}
+
+// static
+void GridWrapper::getDimensionAndSubGridBool( tGridType eType, sal_Int32& rnDimensionIndex, bool& rbSubGrid )
+{
+ rnDimensionIndex = 1;
+ rbSubGrid = false;
+
+ switch( eType )
+ {
+ case X_MAIN_GRID:
+ rnDimensionIndex = 0; rbSubGrid = false; break;
+ case Y_MAIN_GRID:
+ rnDimensionIndex = 1; rbSubGrid = false; break;
+ case Z_MAIN_GRID:
+ rnDimensionIndex = 2; rbSubGrid = false; break;
+ case X_SUB_GRID:
+ rnDimensionIndex = 0; rbSubGrid = true; break;
+ case Y_SUB_GRID:
+ rnDimensionIndex = 1; rbSubGrid = true; break;
+ case Z_SUB_GRID:
+ rnDimensionIndex = 2; rbSubGrid = true; break;
+ }
+}
+
+// ____ XComponent ____
+void SAL_CALL GridWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+
+ clearWrappedPropertySet();
+}
+
+void SAL_CALL GridWrapper::addEventListener(
+ const Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL GridWrapper::removeEventListener(
+ const Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+// ================================================================================
+
+// WrappedPropertySet
+
+Reference< beans::XPropertySet > GridWrapper::getInnerPropertySet()
+{
+ Reference< beans::XPropertySet > xRet;
+ try
+ {
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ uno::Reference< XCoordinateSystem > xCooSys( AxisHelper::getCoordinateSystemByIndex( xDiagram, 0 /*nCooSysIndex*/ ) );
+
+ sal_Int32 nDimensionIndex = 1;
+ bool bSubGrid = false;
+ getDimensionAndSubGridBool( m_eType, nDimensionIndex, bSubGrid );
+
+ sal_Int32 nSubGridIndex = bSubGrid ? 0 : -1;
+ xRet.set( AxisHelper::getGridProperties( xCooSys , nDimensionIndex, MAIN_AXIS_INDEX, nSubGridIndex ) );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return xRet;
+}
+
+const Sequence< beans::Property >& GridWrapper::getPropertySequence()
+{
+ return lcl_GetPropertySequence();
+}
+
+const std::vector< WrappedProperty* > GridWrapper::createWrappedProperties()
+{
+ ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
+
+ aWrappedProperties.push_back( new WrappedDefaultProperty( C2U("LineColor"), C2U("LineColor"), uno::makeAny( sal_Int32( 0x000000) ) ) ); // black
+
+ return aWrappedProperties;
+}
+
+// ================================================================================
+
+Sequence< OUString > GridWrapper::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 4 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart.ChartGrid" );
+ aServices[ 1 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+ aServices[ 2 ] = C2U( "com.sun.star.drawing.LineProperties" );
+ aServices[ 3 ] = C2U( "com.sun.star.beans.PropertySet" );
+
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( GridWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/GridWrapper.hxx b/chart2/source/controller/chartapiwrapper/GridWrapper.hxx
new file mode 100644
index 000000000000..6bbe84f052ab
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/GridWrapper.hxx
@@ -0,0 +1,106 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: GridWrapper.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_GRIDWRAPPER_HXX
+#define CHART_GRIDWRAPPER_HXX
+
+#include "WrappedPropertySet.hxx"
+#include "ServiceMacros.hxx"
+#include <cppuhelper/implbase2.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/chart2/XDiagram.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+namespace wrapper
+{
+
+class Chart2ModelContact;
+
+class GridWrapper : public ::cppu::ImplInheritanceHelper2<
+ WrappedPropertySet
+ , com::sun::star::lang::XComponent
+ , com::sun::star::lang::XServiceInfo
+ >
+{
+public:
+ enum tGridType
+ {
+ X_MAIN_GRID,
+ Y_MAIN_GRID,
+ Z_MAIN_GRID,
+ X_SUB_GRID,
+ Y_SUB_GRID,
+ Z_SUB_GRID
+ };
+
+ GridWrapper( tGridType eType, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~GridWrapper();
+
+ static void getDimensionAndSubGridBool( tGridType eType, sal_Int32& rnDimensionIndex, bool& rbSubGrid );
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ // ____ WrappedPropertySet ____
+ virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
+ virtual const std::vector< WrappedProperty* > createWrappedProperties();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
+
+private:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+
+ tGridType m_eType;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_GRIDWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx
new file mode 100644
index 000000000000..e6b63308b01d
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx
@@ -0,0 +1,462 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: LegendWrapper.cxx,v $
+ * $Revision: 1.9.16.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "LegendWrapper.hxx"
+#include "macros.hxx"
+#include "Chart2ModelContact.hxx"
+#include "LegendHelper.hxx"
+#include "ContainerHelper.hxx"
+#include <comphelper/InlineContainer.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/XTitled.hpp>
+#include <com/sun/star/chart/ChartLegendPosition.hpp>
+#include <com/sun/star/chart2/LegendPosition.hpp>
+#include <com/sun/star/chart2/LegendExpansion.hpp>
+#include <com/sun/star/chart2/RelativePosition.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+
+#include "CharacterProperties.hxx"
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "WrappedCharacterHeightProperty.hxx"
+#include "PositionAndSizeHelper.hxx"
+#include "WrappedDirectStateProperty.hxx"
+#include "WrappedAutomaticPositionProperties.hxx"
+#include "WrappedScaleTextProperties.hxx"
+
+#include <algorithm>
+#include <rtl/ustrbuf.hxx>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+namespace chart
+{
+class WrappedLegendAlignmentProperty : public WrappedProperty
+{
+public:
+ WrappedLegendAlignmentProperty();
+ virtual ~WrappedLegendAlignmentProperty();
+
+ virtual void setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual Any getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+
+protected:
+ virtual Any convertInnerToOuterValue( const Any& rInnerValue ) const;
+ virtual Any convertOuterToInnerValue( const Any& rOuterValue ) const;
+};
+
+WrappedLegendAlignmentProperty::WrappedLegendAlignmentProperty()
+ : ::chart::WrappedProperty( C2U( "Alignment" ), C2U( "AnchorPosition" ) )
+{
+}
+WrappedLegendAlignmentProperty::~WrappedLegendAlignmentProperty()
+{
+}
+
+Any WrappedLegendAlignmentProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ if( xInnerPropertySet.is() )
+ {
+ sal_Bool bShowLegend = sal_True;
+ xInnerPropertySet->getPropertyValue( C2U( "Show" ) ) >>= bShowLegend;
+ if(!bShowLegend)
+ {
+ aRet = uno::makeAny( ::com::sun::star::chart::ChartLegendPosition_NONE );
+ }
+ else
+ {
+ aRet = xInnerPropertySet->getPropertyValue( m_aInnerName );
+ aRet = this->convertInnerToOuterValue( aRet );
+ }
+ }
+ return aRet;
+}
+
+void WrappedLegendAlignmentProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if(xInnerPropertySet.is())
+ {
+ sal_Bool bNewShowLegend = sal_True;
+ sal_Bool bOldShowLegend = sal_True;
+ {
+ ::com::sun::star::chart::ChartLegendPosition eOuterPos(::com::sun::star::chart::ChartLegendPosition_NONE);
+ if( (rOuterValue >>= eOuterPos) && eOuterPos == ::com::sun::star::chart::ChartLegendPosition_NONE )
+ bNewShowLegend = sal_False;
+ xInnerPropertySet->getPropertyValue( C2U( "Show" ) ) >>= bOldShowLegend;
+ }
+ if(bNewShowLegend!=bOldShowLegend)
+ {
+ xInnerPropertySet->setPropertyValue( C2U( "Show" ), uno::makeAny(bNewShowLegend) );
+ }
+ if(!bNewShowLegend)
+ return;
+
+ //set corresponding LegendPosition
+ Any aInnerValue = this->convertOuterToInnerValue( rOuterValue );
+ xInnerPropertySet->setPropertyValue( m_aInnerName, aInnerValue );
+
+ //correct LegendExpansion
+ chart2::LegendPosition eNewInnerPos(chart2::LegendPosition_LINE_END);
+ if( aInnerValue >>= eNewInnerPos )
+ {
+ chart2::LegendExpansion eNewExpansion =
+ ( eNewInnerPos == chart2::LegendPosition_LINE_END ||
+ eNewInnerPos == chart2::LegendPosition_LINE_START )
+ ? chart2::LegendExpansion_HIGH
+ : chart2::LegendExpansion_WIDE;
+
+ chart2::LegendExpansion eOldExpansion( chart2::LegendExpansion_HIGH );
+ bool bExpansionWasSet(
+ xInnerPropertySet->getPropertyValue( C2U( "Expansion" ) ) >>= eOldExpansion );
+
+ if( !bExpansionWasSet || (eOldExpansion != eNewExpansion))
+ xInnerPropertySet->setPropertyValue( C2U( "Expansion" ), uno::makeAny( eNewExpansion ));
+ }
+
+ //correct RelativePosition
+ Any aRelativePosition( xInnerPropertySet->getPropertyValue( C2U( "RelativePosition" ) ) );
+ if(aRelativePosition.hasValue())
+ {
+ xInnerPropertySet->setPropertyValue( C2U( "RelativePosition" ), Any() );
+ }
+ }
+}
+
+Any WrappedLegendAlignmentProperty::convertInnerToOuterValue( const Any& rInnerValue ) const
+{
+ ::com::sun::star::chart::ChartLegendPosition ePos = ::com::sun::star::chart::ChartLegendPosition_NONE;
+
+ chart2::LegendPosition eNewPos;
+ if( rInnerValue >>= eNewPos )
+ {
+ switch( eNewPos )
+ {
+ case chart2::LegendPosition_LINE_START:
+ ePos = ::com::sun::star::chart::ChartLegendPosition_LEFT;
+ break;
+ case chart2::LegendPosition_LINE_END:
+ ePos = ::com::sun::star::chart::ChartLegendPosition_RIGHT;
+ break;
+ case chart2::LegendPosition_PAGE_START:
+ ePos = ::com::sun::star::chart::ChartLegendPosition_TOP;
+ break;
+ case chart2::LegendPosition_PAGE_END:
+ ePos = ::com::sun::star::chart::ChartLegendPosition_BOTTOM;
+ break;
+
+ default:
+ ePos = ::com::sun::star::chart::ChartLegendPosition_NONE;
+ break;
+ }
+ }
+ return uno::makeAny( ePos );
+}
+Any WrappedLegendAlignmentProperty::convertOuterToInnerValue( const Any& rOuterValue ) const
+{
+ chart2::LegendPosition eNewPos = chart2::LegendPosition_LINE_END;
+
+ ::com::sun::star::chart::ChartLegendPosition ePos;
+ if( rOuterValue >>= ePos )
+ {
+ switch( ePos )
+ {
+ case ::com::sun::star::chart::ChartLegendPosition_LEFT:
+ eNewPos = chart2::LegendPosition_LINE_START;
+ break;
+ case ::com::sun::star::chart::ChartLegendPosition_RIGHT:
+ eNewPos = chart2::LegendPosition_LINE_END;
+ break;
+ case ::com::sun::star::chart::ChartLegendPosition_TOP:
+ eNewPos = chart2::LegendPosition_PAGE_START;
+ break;
+ case ::com::sun::star::chart::ChartLegendPosition_BOTTOM:
+ eNewPos = chart2::LegendPosition_PAGE_END;
+ break;
+ default: // NONE
+ break;
+ }
+ }
+
+ return uno::makeAny( eNewPos );
+}
+}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+namespace
+{
+static const ::rtl::OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.Legend" ));
+
+enum
+{
+ PROP_LEGEND_ALIGNMENT
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "Alignment" ),
+ PROP_LEGEND_ALIGNMENT,
+ ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartLegendPosition * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+// ::chart::NamedProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+ ::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties );
+ ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+LegendWrapper::LegendWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
+ m_spChart2ModelContact( spChart2ModelContact ),
+ m_aEventListenerContainer( m_aMutex )
+{
+}
+
+LegendWrapper::~LegendWrapper()
+{
+}
+
+// ____ XShape ____
+awt::Point SAL_CALL LegendWrapper::getPosition()
+ throw (uno::RuntimeException)
+{
+ return m_spChart2ModelContact->GetLegendPosition();
+}
+
+void SAL_CALL LegendWrapper::setPosition( const awt::Point& aPosition )
+ throw (uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() );
+ if( xProp.is() )
+ {
+ awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
+
+ chart2::RelativePosition aRelativePosition;
+ aRelativePosition.Anchor = drawing::Alignment_TOP_LEFT;
+ aRelativePosition.Primary = double(aPosition.X)/double(aPageSize.Width);
+ aRelativePosition.Secondary = double(aPosition.Y)/double(aPageSize.Height);
+ xProp->setPropertyValue( C2U( "RelativePosition" ), uno::makeAny(aRelativePosition) );
+ }
+}
+
+awt::Size SAL_CALL LegendWrapper::getSize()
+ throw (uno::RuntimeException)
+{
+ return m_spChart2ModelContact->GetLegendSize();
+}
+
+void SAL_CALL LegendWrapper::setSize( const awt::Size& aSize )
+ throw (beans::PropertyVetoException,
+ uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xProp( this->getInnerPropertySet() );
+ if( xProp.is() )
+ {
+ awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
+ awt::Rectangle aPageRectangle( 0,0,aPageSize.Width,aPageSize.Height);
+
+ awt::Point aPos( this->getPosition() );
+ awt::Rectangle aNewPositionAndSize(aPos.X,aPos.Y,aSize.Width,aSize.Height);
+
+ PositionAndSizeHelper::moveObject( OBJECTTYPE_LEGEND
+ , xProp, aNewPositionAndSize, aPageRectangle );
+ }
+}
+
+// ____ XShapeDescriptor (base of XShape) ____
+::rtl::OUString SAL_CALL LegendWrapper::getShapeType()
+ throw (uno::RuntimeException)
+{
+ return C2U( "com.sun.star.chart.ChartLegend" );
+}
+
+// ____ XComponent ____
+void SAL_CALL LegendWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+
+ // /--
+ MutexGuard aGuard( GetMutex());
+ clearWrappedPropertySet();
+ // \--
+}
+
+void SAL_CALL LegendWrapper::addEventListener(
+ const Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL LegendWrapper::removeEventListener(
+ const Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+// ================================================================================
+
+//ReferenceSizePropertyProvider
+void LegendWrapper::updateReferenceSize()
+{
+ Reference< beans::XPropertySet > xProp( this->getInnerPropertySet(), uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ if( xProp->getPropertyValue( C2U("ReferencePageSize") ).hasValue() )
+ xProp->setPropertyValue( C2U("ReferencePageSize"), uno::makeAny(
+ m_spChart2ModelContact->GetPageSize() ));
+ }
+}
+Any LegendWrapper::getReferenceSize()
+{
+ Any aRet;
+ Reference< beans::XPropertySet > xProp( this->getInnerPropertySet(), uno::UNO_QUERY );
+ if( xProp.is() )
+ aRet = xProp->getPropertyValue( C2U("ReferencePageSize") );
+
+ return aRet;
+}
+awt::Size LegendWrapper::getCurrentSizeForReference()
+{
+ return m_spChart2ModelContact->GetPageSize();
+}
+
+// ================================================================================
+
+// WrappedPropertySet
+Reference< beans::XPropertySet > LegendWrapper::getInnerPropertySet()
+{
+ Reference< beans::XPropertySet > xRet;
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() )
+ xRet.set( xDiagram->getLegend(), uno::UNO_QUERY );
+ OSL_ENSURE(xRet.is(),"LegendWrapper::getInnerPropertySet() is NULL");
+ return xRet;
+}
+
+const Sequence< beans::Property >& LegendWrapper::getPropertySequence()
+{
+ return lcl_GetPropertySequence();
+}
+
+const std::vector< WrappedProperty* > LegendWrapper::createWrappedProperties()
+{
+ ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
+
+ aWrappedProperties.push_back( new WrappedLegendAlignmentProperty() );
+ WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
+ //same problem as for wall: thje defaults ion the old chart are different for different charttypes, so we need to export explicitly
+ aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U("FillStyle"), C2U("FillStyle") ) );
+ aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U("FillColor"), C2U("FillColor") ));
+ WrappedAutomaticPositionProperties::addWrappedProperties( aWrappedProperties );
+ WrappedScaleTextProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+
+ return aWrappedProperties;
+}
+
+// ================================================================================
+
+Sequence< ::rtl::OUString > LegendWrapper::getSupportedServiceNames_Static()
+{
+ Sequence< ::rtl::OUString > aServices( 4 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart.ChartLegend" );
+ aServices[ 1 ] = C2U( "com.sun.star.drawing.Shape" );
+ aServices[ 2 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+ aServices[ 3 ] = C2U( "com.sun.star.style.CharacterProperties" );
+// aServices[ 4 ] = C2U( "com.sun.star.beans.PropertySet" );
+// aServices[ 5 ] = C2U( "com.sun.star.drawing.FillProperties" );
+// aServices[ 6 ] = C2U( "com.sun.star.drawing.LineProperties" );
+
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( LegendWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/LegendWrapper.hxx b/chart2/source/controller/chartapiwrapper/LegendWrapper.hxx
new file mode 100644
index 000000000000..85483ec6c59c
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/LegendWrapper.hxx
@@ -0,0 +1,116 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: LegendWrapper.hxx,v $
+ * $Revision: 1.5.44.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_LEGENDWRAPPER_HXX
+#define CHART_LEGENDWRAPPER_HXX
+
+#include "WrappedPropertySet.hxx"
+#include "ReferenceSizePropertyProvider.hxx"
+#include "ServiceMacros.hxx"
+#include <cppuhelper/implbase3.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/chart2/XLegend.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+namespace wrapper
+{
+
+class Chart2ModelContact;
+
+class LegendWrapper : public ::cppu::ImplInheritanceHelper3<
+ WrappedPropertySet
+ , com::sun::star::drawing::XShape
+ , com::sun::star::lang::XComponent
+ , com::sun::star::lang::XServiceInfo
+ >
+ , public ReferenceSizePropertyProvider
+{
+public:
+ LegendWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~LegendWrapper();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ //ReferenceSizePropertyProvider
+ virtual void updateReferenceSize();
+ virtual ::com::sun::star::uno::Any getReferenceSize();
+ virtual ::com::sun::star::awt::Size getCurrentSizeForReference();
+
+ // ____ XShape ____
+ virtual ::com::sun::star::awt::Point SAL_CALL getPosition()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize )
+ throw (::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XShapeDescriptor (base of XShape) ____
+ virtual ::rtl::OUString SAL_CALL getShapeType()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ // ____ WrappedPropertySet ____
+ virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
+ virtual const std::vector< WrappedProperty* > createWrappedProperties();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
+
+private:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_LEGENDWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
new file mode 100644
index 000000000000..f545e54f872b
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx
@@ -0,0 +1,438 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: MinMaxLineWrapper.cxx,v $
+ * $Revision: 1.4.44.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "MinMaxLineWrapper.hxx"
+#include "macros.hxx"
+#include "Chart2ModelContact.hxx"
+#include "DiagramHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include <com/sun/star/chart2/XChartType.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+#include <com/sun/star/drawing/LineJoint.hpp>
+
+#include "LineProperties.hxx"
+#include "UserDefinedProperties.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+
+namespace
+{
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.ChartLine" ));
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+// ::chart::NamedLineProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+MinMaxLineWrapper::MinMaxLineWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : m_spChart2ModelContact( spChart2ModelContact )
+ , m_aEventListenerContainer( m_aMutex )
+ , m_pPropertyArrayHelper()
+ , m_aWrappedLineJointProperty( C2U("LineJoint"), uno::makeAny( drawing::LineJoint_NONE ))
+{
+}
+
+MinMaxLineWrapper::~MinMaxLineWrapper()
+{
+}
+
+// ____ XComponent ____
+void SAL_CALL MinMaxLineWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+
+ // /--
+ MutexGuard aGuard( GetMutex());
+ m_xInfo.clear();
+ // \--
+}
+
+void SAL_CALL MinMaxLineWrapper::addEventListener(
+ const Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL MinMaxLineWrapper::removeEventListener(
+ const Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+::cppu::IPropertyArrayHelper& MinMaxLineWrapper::getInfoHelper()
+{
+ if(!m_pPropertyArrayHelper.get())
+ {
+ // /--
+ ::osl::MutexGuard aGuard( GetMutex() );
+ if(!m_pPropertyArrayHelper.get())
+ {
+ sal_Bool bSorted = sal_True;
+ m_pPropertyArrayHelper = ::boost::shared_ptr< ::cppu::OPropertyArrayHelper >( new ::cppu::OPropertyArrayHelper( lcl_GetPropertySequence(), bSorted ) );
+ }
+ // \--
+ }
+ return *m_pPropertyArrayHelper.get();
+}
+
+//XPropertySet
+uno::Reference< beans::XPropertySetInfo > SAL_CALL MinMaxLineWrapper::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ if( !m_xInfo.is() )
+ {
+ // /--
+ ::osl::MutexGuard aGuard( GetMutex() );
+ if( !m_xInfo.is() )
+ m_xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() );
+ // \--
+ }
+ return m_xInfo;
+}
+void SAL_CALL MinMaxLineWrapper::setPropertyValue( const ::rtl::OUString& rPropertyName, const uno::Any& rValue )
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xPropSet(0);
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ Sequence< Reference< chart2::XChartType > > aTypes(
+ ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
+ for( sal_Int32 nN = 0; nN < aTypes.getLength(); nN++ )
+ {
+ Reference< chart2::XChartType > xType( aTypes[nN] );
+ if( xType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ {
+ Reference< chart2::XDataSeriesContainer > xSeriesContainer(xType,uno::UNO_QUERY);
+ if( xSeriesContainer.is() )
+ {
+ Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xSeriesContainer->getDataSeries() );
+ if(aSeriesSeq.getLength())
+ {
+ xPropSet = Reference< beans::XPropertySet >(aSeriesSeq[0],uno::UNO_QUERY);
+ if(xPropSet.is())
+ {
+ if( rPropertyName.equals( C2U("LineColor")) )
+ xPropSet->setPropertyValue( C2U("Color"), rValue );
+ else if( rPropertyName.equals( C2U("LineTransparence")) )
+ xPropSet->setPropertyValue( C2U("Transparency"), rValue );
+ else if( rPropertyName.equals( m_aWrappedLineJointProperty.getOuterName() ) )
+ m_aWrappedLineJointProperty.setPropertyValue( rValue, xPropSet );
+ else
+ xPropSet->setPropertyValue( rPropertyName, rValue );
+ return;
+ }
+ }
+ }
+ }
+ }
+}
+uno::Any SAL_CALL MinMaxLineWrapper::getPropertyValue( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+
+ Reference< beans::XPropertySet > xPropSet(0);
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ Sequence< Reference< chart2::XChartType > > aTypes(
+ ::chart::DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
+ for( sal_Int32 nN = 0; nN < aTypes.getLength(); nN++ )
+ {
+ Reference< chart2::XChartType > xType( aTypes[nN] );
+ if( xType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ {
+ Reference< chart2::XDataSeriesContainer > xSeriesContainer(xType,uno::UNO_QUERY);
+ if( xSeriesContainer.is() )
+ {
+ Sequence< Reference< chart2::XDataSeries > > aSeriesSeq( xSeriesContainer->getDataSeries() );
+ if(aSeriesSeq.getLength())
+ {
+ xPropSet = Reference< beans::XPropertySet >(aSeriesSeq[0],uno::UNO_QUERY);
+ break;
+ }
+ }
+ }
+ }
+ if(xPropSet.is())
+ {
+ if( rPropertyName.equals( C2U("LineColor")) )
+ aRet = xPropSet->getPropertyValue( C2U("Color") );
+ else if( rPropertyName.equals( C2U("LineTransparence")) )
+ aRet = xPropSet->getPropertyValue( C2U("Transparency") );
+ else if( rPropertyName.equals( m_aWrappedLineJointProperty.getOuterName() ) )
+ aRet = m_aWrappedLineJointProperty.getPropertyValue( xPropSet );
+ else
+ aRet = xPropSet->getPropertyValue( rPropertyName );
+
+ }
+ return aRet;
+}
+
+void SAL_CALL MinMaxLineWrapper::addPropertyChangeListener( const ::rtl::OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL MinMaxLineWrapper::removePropertyChangeListener( const ::rtl::OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL MinMaxLineWrapper::addVetoableChangeListener( const ::rtl::OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL MinMaxLineWrapper::removeVetoableChangeListener( const ::rtl::OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+
+//XMultiPropertySet
+//getPropertySetInfo() already declared in XPropertySet
+void SAL_CALL MinMaxLineWrapper::setPropertyValues( const uno::Sequence< ::rtl::OUString >& rNameSeq, const uno::Sequence< uno::Any >& rValueSeq )
+ throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ bool bUnknownProperty = false;
+ sal_Int32 nMinCount = std::min( rValueSeq.getLength(), rNameSeq.getLength() );
+ for(sal_Int32 nN=0; nN<nMinCount; nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ try
+ {
+ this->setPropertyValue( aPropertyName, rValueSeq[nN] );
+ }
+ catch( beans::UnknownPropertyException& ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ bUnknownProperty = true;
+ }
+ }
+ //todo: store unknown properties elsewhere
+// if( bUnknownProperty )
+// throw beans::UnknownPropertyException();
+}
+uno::Sequence< uno::Any > SAL_CALL MinMaxLineWrapper::getPropertyValues( const uno::Sequence< ::rtl::OUString >& rNameSeq )
+ throw (uno::RuntimeException)
+{
+ Sequence< Any > aRetSeq;
+ if( rNameSeq.getLength() )
+ {
+ aRetSeq.realloc( rNameSeq.getLength() );
+ for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ aRetSeq[nN] = this->getPropertyValue( aPropertyName );
+ }
+ }
+ return aRetSeq;
+}
+void SAL_CALL MinMaxLineWrapper::addPropertiesChangeListener(
+ const uno::Sequence< ::rtl::OUString >& /* aPropertyNames */,
+ const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL MinMaxLineWrapper::removePropertiesChangeListener(
+ const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL MinMaxLineWrapper::firePropertiesChangeEvent(
+ const uno::Sequence< ::rtl::OUString >& /* aPropertyNames */,
+ const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+
+//XPropertyState
+beans::PropertyState SAL_CALL MinMaxLineWrapper::getPropertyState( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ if( rPropertyName.equals( m_aWrappedLineJointProperty.getOuterName() ) )
+ return beans::PropertyState_DEFAULT_VALUE;
+
+ uno::Any aDefault( this->getPropertyDefault( rPropertyName ) );
+ uno::Any aValue( this->getPropertyValue( rPropertyName ) );
+
+ if( aDefault == aValue )
+ return beans::PropertyState_DEFAULT_VALUE;
+
+ return beans::PropertyState_DIRECT_VALUE;
+}
+uno::Sequence< beans::PropertyState > SAL_CALL MinMaxLineWrapper::getPropertyStates( const uno::Sequence< ::rtl::OUString >& rNameSeq )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ Sequence< beans::PropertyState > aRetSeq;
+ if( rNameSeq.getLength() )
+ {
+ aRetSeq.realloc( rNameSeq.getLength() );
+ for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ aRetSeq[nN] = this->getPropertyState( aPropertyName );
+ }
+ }
+ return aRetSeq;
+}
+void SAL_CALL MinMaxLineWrapper::setPropertyToDefault( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ this->setPropertyValue( rPropertyName, this->getPropertyDefault(rPropertyName) );
+}
+uno::Any SAL_CALL MinMaxLineWrapper::getPropertyDefault( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ LineProperties::AddDefaultsToMap( aStaticDefaults );
+ }
+
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+}
+
+//XMultiPropertyStates
+//getPropertyStates() already declared in XPropertyState
+void SAL_CALL MinMaxLineWrapper::setAllPropertiesToDefault( )
+ throw (uno::RuntimeException)
+{
+ const Sequence< beans::Property >& rPropSeq = lcl_GetPropertySequence();
+ for(sal_Int32 nN=0; nN<rPropSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rPropSeq[nN].Name );
+ this->setPropertyToDefault( aPropertyName );
+ }
+}
+void SAL_CALL MinMaxLineWrapper::setPropertiesToDefault( const uno::Sequence< ::rtl::OUString >& rNameSeq )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ this->setPropertyToDefault( aPropertyName );
+ }
+}
+uno::Sequence< uno::Any > SAL_CALL MinMaxLineWrapper::getPropertyDefaults( const uno::Sequence< ::rtl::OUString >& rNameSeq )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Sequence< Any > aRetSeq;
+ if( rNameSeq.getLength() )
+ {
+ aRetSeq.realloc( rNameSeq.getLength() );
+ for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ aRetSeq[nN] = this->getPropertyDefault( aPropertyName );
+ }
+ }
+ return aRetSeq;
+}
+
+
+// ================================================================================
+
+Sequence< OUString > MinMaxLineWrapper::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 3 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart.ChartLine" );
+ aServices[ 1 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+ aServices[ 2 ] = C2U( "com.sun.star.drawing.LineProperties" );
+
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( MinMaxLineWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx
new file mode 100644
index 000000000000..411c97e71a5e
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.hxx
@@ -0,0 +1,142 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: MinMaxLineWrapper.hxx,v $
+ * $Revision: 1.3.44.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_MINMAXLINEWRAPPER_HXX
+#define CHART_MINMAXLINEWRAPPER_HXX
+
+#include "ServiceMacros.hxx"
+#include "MutexContainer.hxx"
+#include "WrappedIgnoreProperty.hxx"
+#include <cppuhelper/interfacecontainer.hxx>
+
+
+#include <com/sun/star/chart2/XDiagram.hpp>
+
+// header for class OPropertyArrayHelper
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/implbase6.hxx>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+namespace wrapper
+{
+
+class Chart2ModelContact;
+
+class MinMaxLineWrapper : public MutexContainer
+ , public ::cppu::WeakImplHelper6
+ < ::com::sun::star::lang::XComponent
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::beans::XPropertySet
+ , ::com::sun::star::beans::XMultiPropertySet
+ , ::com::sun::star::beans::XPropertyState
+ , ::com::sun::star::beans::XMultiPropertyStates
+ // , ::com::sun::star::uno::XWeak // implemented by WeakImplHelper(optional interface)
+ // , ::com::sun::star::uno::XInterface // implemented by WeakImplHelper
+ // , ::com::sun::star::lang::XTypeProvider // implemented by WeakImplHelper
+ >
+{
+public:
+ MinMaxLineWrapper( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~MinMaxLineWrapper();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //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 ::rtl::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 ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::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 ::rtl::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 ::rtl::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 ::rtl::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);
+
+ //XMultiPropertySet
+ //getPropertySetInfo() already declared in XPropertySet
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::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::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ //XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XMultiPropertyStates
+ //getPropertyStates() already declared in XPropertyState
+ virtual void SAL_CALL setAllPropertiesToDefault( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertiesToDefault( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyDefaults( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //methods
+ ::cppu::IPropertyArrayHelper& getInfoHelper();
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo >
+ m_xInfo;//outer PropertySetInfo
+
+ ::boost::shared_ptr< ::cppu::OPropertyArrayHelper > m_pPropertyArrayHelper;
+
+ WrappedIgnoreProperty m_aWrappedLineJointProperty;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_MINMAXLINEWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/ReferenceSizePropertyProvider.hxx b/chart2/source/controller/chartapiwrapper/ReferenceSizePropertyProvider.hxx
new file mode 100644
index 000000000000..c9199bcadaff
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/ReferenceSizePropertyProvider.hxx
@@ -0,0 +1,51 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: ReferenceSizePropertyProvider.hxx,v $
+ * $Revision: 1.3.44.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPER_REFERENCESIZEPROPERTYPROVIDER_HXX
+#define CHART_WRAPPER_REFERENCESIZEPROPERTYPROVIDER_HXX
+
+#include <com/sun/star/awt/Size.hpp>
+
+namespace chart
+{
+namespace wrapper
+{
+class ReferenceSizePropertyProvider
+{
+public:
+ virtual void updateReferenceSize() = 0;
+ virtual ::com::sun::star::uno::Any getReferenceSize() = 0;
+ virtual ::com::sun::star::awt::Size getCurrentSizeForReference() = 0;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_WRAPPER_REFERENCESIZEPROPERTYPROVIDER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx
new file mode 100644
index 000000000000..a84dbc0cfc4d
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx
@@ -0,0 +1,537 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: TitleWrapper.cxx,v $
+ * $Revision: 1.8.44.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+#include "TitleWrapper.hxx"
+#include "macros.hxx"
+#include "ContainerHelper.hxx"
+#include <comphelper/InlineContainer.hxx>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/RelativePosition.hpp>
+
+#include "CharacterProperties.hxx"
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "WrappedCharacterHeightProperty.hxx"
+#include "WrappedTextRotationProperty.hxx"
+#include "WrappedAutomaticPositionProperties.hxx"
+#include "WrappedScaleTextProperties.hxx"
+
+#include <algorithm>
+#include <rtl/ustrbuf.hxx>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+using ::rtl::OUString;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+
+
+namespace chart
+{
+class WrappedTitleStringProperty : public WrappedProperty
+{
+public:
+ WrappedTitleStringProperty( const Reference< uno::XComponentContext >& xContext );
+ virtual ~WrappedTitleStringProperty();
+
+ virtual void setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual Any getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual Any getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+
+protected:
+ Reference< uno::XComponentContext > m_xContext;
+};
+
+WrappedTitleStringProperty::WrappedTitleStringProperty( const Reference< uno::XComponentContext >& xContext )
+ : ::chart::WrappedProperty( C2U( "String" ), OUString() )
+ , m_xContext( xContext )
+{
+}
+WrappedTitleStringProperty::~WrappedTitleStringProperty()
+{
+}
+
+void WrappedTitleStringProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Reference< chart2::XTitle > xTitle(xInnerPropertySet,uno::UNO_QUERY);
+ if(xTitle.is())
+ {
+ OUString aString;
+ rOuterValue >>= aString;
+ TitleHelper::setCompleteString( aString, xTitle, m_xContext );
+ }
+}
+Any WrappedTitleStringProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet( getPropertyDefault( Reference< beans::XPropertyState >( xInnerPropertySet, uno::UNO_QUERY ) ) );
+ Reference< chart2::XTitle > xTitle(xInnerPropertySet,uno::UNO_QUERY);
+ if(xTitle.is())
+ {
+ Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText());
+
+ ::rtl::OUStringBuffer aBuf;
+ for( sal_Int32 i = 0; i < aStrings.getLength(); ++i )
+ {
+ aBuf.append( aStrings[ i ]->getString());
+ }
+ aRet <<= aBuf.makeStringAndClear();
+ }
+ return aRet;
+}
+Any WrappedTitleStringProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return uno::makeAny( rtl::OUString() );//default title is a empty String
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+class WrappedStackedTextProperty : public WrappedProperty
+{
+public:
+ WrappedStackedTextProperty();
+ virtual ~WrappedStackedTextProperty();
+};
+
+WrappedStackedTextProperty::WrappedStackedTextProperty()
+ : ::chart::WrappedProperty( C2U( "StackedText" ), C2U( "StackCharacters" ) )
+{
+}
+WrappedStackedTextProperty::~WrappedStackedTextProperty()
+{
+}
+
+}// end namespace chart
+
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+namespace
+{
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.Title" ));
+
+enum
+{
+ PROP_TITLE_STRING,
+ PROP_TITLE_TEXT_ROTATION,
+ PROP_TITLE_TEXT_STACKED
+};
+
+void lcl_AddPropertiesToVector(
+ ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "String" ),
+ PROP_TITLE_STRING,
+ ::getCppuType( reinterpret_cast< const ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEVOID ));
+
+ rOutProperties.push_back(
+ Property( C2U( "TextRotation" ),
+ PROP_TITLE_TEXT_ROTATION,
+ ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "StackedText" ),
+ PROP_TITLE_TEXT_STACKED,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< beans::Property > aProperties;
+ lcl_AddPropertiesToVector( aProperties );
+ ::chart::CharacterProperties::AddPropertiesToVector( aProperties );
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+// ::chart::NamedProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+ ::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties );
+ ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+TitleWrapper::TitleWrapper( ::chart::TitleHelper::eTitleType eTitleType,
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
+ m_spChart2ModelContact( spChart2ModelContact ),
+ m_aEventListenerContainer( m_aMutex ),
+ m_eTitleType(eTitleType)
+{
+}
+
+TitleWrapper::~TitleWrapper()
+{
+}
+
+// ____ XShape ____
+awt::Point SAL_CALL TitleWrapper::getPosition()
+ throw (uno::RuntimeException)
+{
+ return m_spChart2ModelContact->GetTitlePosition( this->getTitleObject() );
+}
+
+void SAL_CALL TitleWrapper::setPosition( const awt::Point& aPosition )
+ throw (uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xPropertySet( this->getInnerPropertySet() );
+ if(xPropertySet.is())
+ {
+ awt::Size aPageSize( m_spChart2ModelContact->GetPageSize() );
+
+ chart2::RelativePosition aRelativePosition;
+ aRelativePosition.Anchor = drawing::Alignment_TOP_LEFT;
+ aRelativePosition.Primary = double(aPosition.X)/double(aPageSize.Width);
+ aRelativePosition.Secondary = double(aPosition.Y)/double(aPageSize.Height);
+ xPropertySet->setPropertyValue( C2U( "RelativePosition" ), uno::makeAny(aRelativePosition) );
+ }
+}
+
+awt::Size SAL_CALL TitleWrapper::getSize()
+ throw (uno::RuntimeException)
+{
+ return m_spChart2ModelContact->GetTitleSize( this->getTitleObject() );
+}
+
+void SAL_CALL TitleWrapper::setSize( const awt::Size& /*aSize*/ )
+ throw (beans::PropertyVetoException,
+ uno::RuntimeException)
+{
+ OSL_ENSURE( false, "trying to set size of title" );
+}
+
+// ____ XShapeDescriptor (base of XShape) ____
+OUString SAL_CALL TitleWrapper::getShapeType()
+ throw (uno::RuntimeException)
+{
+ return C2U( "com.sun.star.chart.ChartTitle" );
+}
+
+// ____ XComponent ____
+void SAL_CALL TitleWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+
+ // /--
+ MutexGuard aGuard( GetMutex());
+ clearWrappedPropertySet();
+ // \--
+}
+
+void SAL_CALL TitleWrapper::addEventListener(
+ const Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL TitleWrapper::removeEventListener(
+ const Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+// ================================================================================
+
+Reference< beans::XPropertySet > TitleWrapper::getFirstCharacterPropertySet()
+{
+ Reference< beans::XPropertySet > xProp;
+
+ Reference< chart2::XTitle > xTitle( this->getTitleObject() );
+ if( xTitle.is())
+ {
+ Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText());
+ if( aStrings.getLength() > 0 )
+ xProp.set( aStrings[0], uno::UNO_QUERY );
+ }
+
+ return xProp;
+}
+
+void TitleWrapper::getFastCharacterPropertyValue( sal_Int32 nHandle, Any& rValue )
+{
+ OSL_ASSERT( FAST_PROPERTY_ID_START_CHAR_PROP <= nHandle &&
+ nHandle < CharacterProperties::FAST_PROPERTY_ID_END_CHAR_PROP );
+
+ Reference< beans::XPropertySet > xProp( getFirstCharacterPropertySet(), uno::UNO_QUERY );
+ Reference< beans::XFastPropertySet > xFastProp( xProp, uno::UNO_QUERY );
+ if(xProp.is())
+ {
+ const WrappedProperty* pWrappedProperty = getWrappedProperty( nHandle );
+ if( pWrappedProperty )
+ {
+ rValue = pWrappedProperty->getPropertyValue( xProp );
+ }
+ else if( xFastProp.is() )
+ {
+ rValue = xFastProp->getFastPropertyValue( nHandle );
+ }
+ }
+
+}
+
+void TitleWrapper::setFastCharacterPropertyValue(
+ sal_Int32 nHandle, const Any& rValue ) throw (uno::Exception)
+{
+ OSL_ASSERT( FAST_PROPERTY_ID_START_CHAR_PROP <= nHandle &&
+ nHandle < CharacterProperties::FAST_PROPERTY_ID_END_CHAR_PROP );
+
+ Reference< chart2::XTitle > xTitle( this->getTitleObject() );
+ if( xTitle.is())
+ {
+ Sequence< Reference< chart2::XFormattedString > > aStrings( xTitle->getText());
+ const WrappedProperty* pWrappedProperty = getWrappedProperty( nHandle );
+
+ for( sal_Int32 i = 0; i < aStrings.getLength(); ++i )
+ {
+ Reference< beans::XFastPropertySet > xFastPropertySet( aStrings[ i ], uno::UNO_QUERY );
+ Reference< beans::XPropertySet > xPropSet( xFastPropertySet, uno::UNO_QUERY );
+
+ if( pWrappedProperty )
+ pWrappedProperty->setPropertyValue( rValue, xPropSet );
+ else if( xFastPropertySet.is() )
+ xFastPropertySet->setFastPropertyValue( nHandle, rValue );
+ }
+ }
+}
+
+// ================================================================================
+// WrappedPropertySet
+
+void SAL_CALL TitleWrapper::setPropertyValue( const OUString& rPropertyName, const Any& rValue )
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+ if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
+ {
+ setFastCharacterPropertyValue( nHandle, rValue );
+ }
+ else
+ WrappedPropertySet::setPropertyValue( rPropertyName, rValue );
+}
+
+Any SAL_CALL TitleWrapper::getPropertyValue( const OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+ if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
+ getFastCharacterPropertyValue( nHandle, aRet );
+ else
+ aRet = WrappedPropertySet::getPropertyValue( rPropertyName );
+ return aRet;
+}
+
+beans::PropertyState SAL_CALL TitleWrapper::getPropertyState( const OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ beans::PropertyState aState( beans::PropertyState_DIRECT_VALUE );
+
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+ if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
+ {
+ Reference< beans::XPropertyState > xPropState( getFirstCharacterPropertySet(), uno::UNO_QUERY );
+ if( xPropState.is() )
+ {
+ const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
+ if( pWrappedProperty )
+ aState = pWrappedProperty->getPropertyState( xPropState );
+ else
+ aState = xPropState->getPropertyState( rPropertyName );
+ }
+ }
+ else
+ aState = WrappedPropertySet::getPropertyState( rPropertyName );
+
+ return aState;
+}
+void SAL_CALL TitleWrapper::setPropertyToDefault( const OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+ if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
+ {
+ Any aDefault = getPropertyDefault( rPropertyName );
+ setFastCharacterPropertyValue( nHandle, aDefault );
+ }
+ else
+ WrappedPropertySet::setPropertyToDefault( rPropertyName );
+}
+Any SAL_CALL TitleWrapper::getPropertyDefault( const OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+ if( CharacterProperties::IsCharacterPropertyHandle( nHandle ) )
+ {
+ Reference< beans::XPropertyState > xPropState( getFirstCharacterPropertySet(), uno::UNO_QUERY );
+ if( xPropState.is() )
+ {
+ const WrappedProperty* pWrappedProperty = getWrappedProperty( rPropertyName );
+ if( pWrappedProperty )
+ aRet = pWrappedProperty->getPropertyDefault(xPropState);
+ else
+ aRet = xPropState->getPropertyDefault( rPropertyName );
+ }
+ }
+ else
+ aRet = WrappedPropertySet::getPropertyDefault( rPropertyName );
+
+ return aRet;
+}
+
+// ================================================================================
+
+//ReferenceSizePropertyProvider
+void TitleWrapper::updateReferenceSize()
+{
+ Reference< beans::XPropertySet > xProp( this->getTitleObject(), uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ if( xProp->getPropertyValue( C2U("ReferencePageSize") ).hasValue() )
+ xProp->setPropertyValue( C2U("ReferencePageSize"), uno::makeAny(
+ m_spChart2ModelContact->GetPageSize() ));
+ }
+}
+Any TitleWrapper::getReferenceSize()
+{
+ Any aRet;
+ Reference< beans::XPropertySet > xProp( this->getTitleObject(), uno::UNO_QUERY );
+ if( xProp.is() )
+ aRet = xProp->getPropertyValue( C2U("ReferencePageSize") );
+
+ return aRet;
+}
+awt::Size TitleWrapper::getCurrentSizeForReference()
+{
+ return m_spChart2ModelContact->GetPageSize();
+}
+
+// ================================================================================
+
+Reference< chart2::XTitle > TitleWrapper::getTitleObject()
+{
+ return TitleHelper::getTitle( m_eTitleType, m_spChart2ModelContact->getChartModel() );
+}
+
+// WrappedPropertySet
+
+Reference< beans::XPropertySet > TitleWrapper::getInnerPropertySet()
+{
+ return Reference< beans::XPropertySet >( this->getTitleObject(), uno::UNO_QUERY );
+}
+
+const Sequence< beans::Property >& TitleWrapper::getPropertySequence()
+{
+ return lcl_GetPropertySequence();
+}
+
+const std::vector< WrappedProperty* > TitleWrapper::createWrappedProperties()
+{
+ ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
+
+ aWrappedProperties.push_back( new WrappedTitleStringProperty( m_spChart2ModelContact->m_xContext ) );
+ aWrappedProperties.push_back( new WrappedTextRotationProperty( m_eTitleType==TitleHelper::Y_AXIS_TITLE || m_eTitleType==TitleHelper::X_AXIS_TITLE ) );
+ aWrappedProperties.push_back( new WrappedStackedTextProperty() );
+ WrappedCharacterHeightProperty::addWrappedProperties( aWrappedProperties, this );
+ WrappedAutomaticPositionProperties::addWrappedProperties( aWrappedProperties );
+ WrappedScaleTextProperties::addWrappedProperties( aWrappedProperties, m_spChart2ModelContact );
+
+ return aWrappedProperties;
+}
+
+// ================================================================================
+
+Sequence< OUString > TitleWrapper::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 4 );
+ aServices[ 0 ] = C2U( "com.sun.star.chart.ChartTitle" );
+ aServices[ 1 ] = C2U( "com.sun.star.drawing.Shape" );
+ aServices[ 2 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+ aServices[ 3 ] = C2U( "com.sun.star.style.CharacterProperties" );
+// aServices[ 4 ] = C2U( "com.sun.star.beans.PropertySet" );
+// aServices[ 5 ] = C2U( "com.sun.star.drawing.FillProperties" );
+// aServices[ 6 ] = C2U( "com.sun.star.drawing.LineProperties" );
+
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( TitleWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx
new file mode 100644
index 000000000000..3e0db1ed1e42
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.hxx
@@ -0,0 +1,136 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: TitleWrapper.hxx,v $
+ * $Revision: 1.6.44.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_TITLEWRAPPER_HXX
+#define CHART_TITLEWRAPPER_HXX
+
+#include "WrappedPropertySet.hxx"
+#include "ReferenceSizePropertyProvider.hxx"
+#include "Chart2ModelContact.hxx"
+#include "ServiceMacros.hxx"
+#include "TitleHelper.hxx"
+#include <cppuhelper/implbase3.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/chart2/XTitle.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+namespace wrapper
+{
+
+class TitleWrapper : public ::cppu::ImplInheritanceHelper3<
+ WrappedPropertySet
+ , com::sun::star::drawing::XShape
+ , com::sun::star::lang::XComponent
+ , com::sun::star::lang::XServiceInfo
+ >
+ , public ReferenceSizePropertyProvider
+{
+public:
+ TitleWrapper( ::chart::TitleHelper::eTitleType eTitleType,
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~TitleWrapper();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ //ReferenceSizePropertyProvider
+ virtual void updateReferenceSize();
+ virtual ::com::sun::star::uno::Any getReferenceSize();
+ virtual ::com::sun::star::awt::Size getCurrentSizeForReference();
+
+protected:
+ // ____ XShape ____
+ virtual ::com::sun::star::awt::Point SAL_CALL getPosition()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPosition( const ::com::sun::star::awt::Point& aPosition )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::awt::Size SAL_CALL getSize()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setSize( const ::com::sun::star::awt::Size& aSize )
+ throw (::com::sun::star::beans::PropertyVetoException,
+ ::com::sun::star::uno::RuntimeException);
+
+ // ____ XShapeDescriptor (base of XShape) ____
+ virtual ::rtl::OUString SAL_CALL getShapeType()
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ // character properties have to be handled differently (via the XFormattedString elements)
+ void getFastCharacterPropertyValue( sal_Int32 nHandle, ::com::sun::star::uno::Any& rValue );
+ void setFastCharacterPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue )
+ throw (::com::sun::star::uno::Exception);
+
+ // ____ WrappedPropertySet ____
+ virtual void SAL_CALL setPropertyValue( const ::rtl::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 ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
+
+ virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
+ virtual const std::vector< WrappedProperty* > createWrappedProperties();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getFirstCharacterPropertySet();
+
+private:
+ ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XTitle > getTitleObject();
+
+private:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+
+ ::chart::TitleHelper::eTitleType m_eTitleType;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_TITLEWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx
new file mode 100644
index 000000000000..e2a74834d249
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx
@@ -0,0 +1,405 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: UpDownBarWrapper.cxx,v $
+ * $Revision: 1.4.44.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "UpDownBarWrapper.hxx"
+#include "macros.hxx"
+#include "Chart2ModelContact.hxx"
+#include "DiagramHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "ContainerHelper.hxx"
+#include <com/sun/star/chart2/XChartType.hpp>
+#include <com/sun/star/chart2/XDataSeriesContainer.hpp>
+
+#include "LineProperties.hxx"
+#include "FillProperties.hxx"
+// #include "NamedProperties.hxx"
+#include "UserDefinedProperties.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+
+namespace
+{
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.ChartArea" ));
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+// ::chart::NamedProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+UpDownBarWrapper::UpDownBarWrapper(
+ bool bUp, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : m_spChart2ModelContact( spChart2ModelContact )
+ , m_aEventListenerContainer( m_aMutex )
+ , m_aPropertySetName( bUp ? C2U("WhiteDay") : C2U("BlackDay") )
+ , m_xInfo(0)
+ , m_pPropertyArrayHelper()
+{
+}
+
+UpDownBarWrapper::~UpDownBarWrapper()
+{
+}
+
+// ____ XComponent ____
+void SAL_CALL UpDownBarWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+
+ // /--
+ MutexGuard aGuard( GetMutex());
+ m_xInfo.clear();
+ // \--
+}
+
+void SAL_CALL UpDownBarWrapper::addEventListener(
+ const Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL UpDownBarWrapper::removeEventListener(
+ const Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+::cppu::IPropertyArrayHelper& UpDownBarWrapper::getInfoHelper()
+{
+ if(!m_pPropertyArrayHelper.get())
+ {
+ // /--
+ ::osl::MutexGuard aGuard( GetMutex() );
+ if(!m_pPropertyArrayHelper.get())
+ {
+ sal_Bool bSorted = sal_True;
+ m_pPropertyArrayHelper = ::boost::shared_ptr< ::cppu::OPropertyArrayHelper >( new ::cppu::OPropertyArrayHelper( lcl_GetPropertySequence(), bSorted ) );
+ }
+ // \--
+ }
+ return *m_pPropertyArrayHelper.get();
+}
+
+//XPropertySet
+uno::Reference< beans::XPropertySetInfo > SAL_CALL UpDownBarWrapper::getPropertySetInfo()
+ throw (uno::RuntimeException)
+{
+ if( !m_xInfo.is() )
+ {
+ // /--
+ ::osl::MutexGuard aGuard( GetMutex() );
+ if( !m_xInfo.is() )
+ m_xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo( getInfoHelper() );
+ // \--
+ }
+ return m_xInfo;
+}
+void SAL_CALL UpDownBarWrapper::setPropertyValue( const ::rtl::OUString& rPropertyName, const uno::Any& rValue )
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Reference< beans::XPropertySet > xPropSet(0);
+
+ Sequence< Reference< chart2::XChartType > > aTypes(
+ ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) );
+ for( sal_Int32 nN = 0; nN < aTypes.getLength(); nN++ )
+ {
+ Reference< chart2::XChartType > xType( aTypes[nN] );
+ if( xType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ {
+ Reference< beans::XPropertySet > xTypeProps( aTypes[nN], uno::UNO_QUERY );
+ if(xTypeProps.is())
+ {
+ xTypeProps->getPropertyValue( m_aPropertySetName ) >>= xPropSet;
+ }
+ }
+ }
+ if(xPropSet.is())
+ xPropSet->setPropertyValue( rPropertyName, rValue );
+}
+uno::Any SAL_CALL UpDownBarWrapper::getPropertyValue( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+
+ Reference< beans::XPropertySet > xPropSet(0);
+
+ Sequence< Reference< chart2::XChartType > > aTypes(
+ ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) );
+ for( sal_Int32 nN = 0; nN < aTypes.getLength(); nN++ )
+ {
+ Reference< chart2::XChartType > xType( aTypes[nN] );
+ if( xType->getChartType().equals(CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK) )
+ {
+ Reference< beans::XPropertySet > xTypeProps( aTypes[nN], uno::UNO_QUERY );
+ if(xTypeProps.is())
+ {
+ xTypeProps->getPropertyValue( m_aPropertySetName ) >>= xPropSet;
+ }
+ }
+ }
+ if(xPropSet.is())
+ aRet = xPropSet->getPropertyValue( rPropertyName );
+ return aRet;
+}
+
+void SAL_CALL UpDownBarWrapper::addPropertyChangeListener( const ::rtl::OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*xListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL UpDownBarWrapper::removePropertyChangeListener( const ::rtl::OUString& /*aPropertyName*/, const uno::Reference< beans::XPropertyChangeListener >& /*aListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL UpDownBarWrapper::addVetoableChangeListener( const ::rtl::OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL UpDownBarWrapper::removeVetoableChangeListener( const ::rtl::OUString& /*PropertyName*/, const uno::Reference< beans::XVetoableChangeListener >& /*aListener*/ )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+
+//XMultiPropertySet
+//getPropertySetInfo() already declared in XPropertySet
+void SAL_CALL UpDownBarWrapper::setPropertyValues( const uno::Sequence< ::rtl::OUString >& rNameSeq, const uno::Sequence< uno::Any >& rValueSeq )
+ throw (beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ bool bUnknownProperty = false;
+ sal_Int32 nMinCount = std::min( rValueSeq.getLength(), rNameSeq.getLength() );
+ for(sal_Int32 nN=0; nN<nMinCount; nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ try
+ {
+ this->setPropertyValue( aPropertyName, rValueSeq[nN] );
+ }
+ catch( beans::UnknownPropertyException& ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ bUnknownProperty = true;
+ }
+ }
+ //todo: store unknown properties elsewhere
+// if( bUnknownProperty )
+// throw beans::UnknownPropertyException();
+}
+uno::Sequence< uno::Any > SAL_CALL UpDownBarWrapper::getPropertyValues( const uno::Sequence< ::rtl::OUString >& rNameSeq )
+ throw (uno::RuntimeException)
+{
+ Sequence< Any > aRetSeq;
+ if( rNameSeq.getLength() )
+ {
+ aRetSeq.realloc( rNameSeq.getLength() );
+ for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ aRetSeq[nN] = this->getPropertyValue( aPropertyName );
+ }
+ }
+ return aRetSeq;
+}
+void SAL_CALL UpDownBarWrapper::addPropertiesChangeListener( const uno::Sequence< ::rtl::OUString >& /* aPropertyNames */, const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL UpDownBarWrapper::removePropertiesChangeListener( const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+void SAL_CALL UpDownBarWrapper::firePropertiesChangeEvent( const uno::Sequence< ::rtl::OUString >& /* aPropertyNames */, const uno::Reference< beans::XPropertiesChangeListener >& /* xListener */ )
+ throw (uno::RuntimeException)
+{
+ OSL_ENSURE(false,"not implemented");
+}
+
+//XPropertyState
+beans::PropertyState SAL_CALL UpDownBarWrapper::getPropertyState( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ uno::Any aDefault( this->getPropertyDefault( rPropertyName ) );
+ uno::Any aValue( this->getPropertyValue( rPropertyName ) );
+
+ if( aDefault == aValue )
+ return beans::PropertyState_DEFAULT_VALUE;
+
+ return beans::PropertyState_DIRECT_VALUE;
+}
+uno::Sequence< beans::PropertyState > SAL_CALL UpDownBarWrapper::getPropertyStates( const uno::Sequence< ::rtl::OUString >& rNameSeq )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ Sequence< beans::PropertyState > aRetSeq;
+ if( rNameSeq.getLength() )
+ {
+ aRetSeq.realloc( rNameSeq.getLength() );
+ for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ aRetSeq[nN] = this->getPropertyState( aPropertyName );
+ }
+ }
+ return aRetSeq;
+}
+void SAL_CALL UpDownBarWrapper::setPropertyToDefault( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ this->setPropertyValue( rPropertyName, this->getPropertyDefault(rPropertyName) );
+}
+uno::Any SAL_CALL UpDownBarWrapper::getPropertyDefault( const ::rtl::OUString& rPropertyName )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ static tPropertyValueMap aStaticDefaults;
+
+ // /--
+ ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aStaticDefaults.size() )
+ {
+ LineProperties::AddDefaultsToMap( aStaticDefaults );
+ FillProperties::AddDefaultsToMap( aStaticDefaults );
+ }
+
+ sal_Int32 nHandle = getInfoHelper().getHandleByName( rPropertyName );
+
+ tPropertyValueMap::const_iterator aFound(
+ aStaticDefaults.find( nHandle ));
+
+ if( aFound == aStaticDefaults.end())
+ return uno::Any();
+
+ return (*aFound).second;
+}
+
+//XMultiPropertyStates
+//getPropertyStates() already declared in XPropertyState
+void SAL_CALL UpDownBarWrapper::setAllPropertiesToDefault( )
+ throw (uno::RuntimeException)
+{
+ const Sequence< beans::Property >& rPropSeq = lcl_GetPropertySequence();
+ for(sal_Int32 nN=0; nN<rPropSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rPropSeq[nN].Name );
+ this->setPropertyToDefault( aPropertyName );
+ }
+}
+void SAL_CALL UpDownBarWrapper::setPropertiesToDefault( const uno::Sequence< ::rtl::OUString >& rNameSeq )
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ this->setPropertyToDefault( aPropertyName );
+ }
+}
+uno::Sequence< uno::Any > SAL_CALL UpDownBarWrapper::getPropertyDefaults( const uno::Sequence< ::rtl::OUString >& rNameSeq )
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Sequence< Any > aRetSeq;
+ if( rNameSeq.getLength() )
+ {
+ aRetSeq.realloc( rNameSeq.getLength() );
+ for(sal_Int32 nN=0; nN<rNameSeq.getLength(); nN++)
+ {
+ ::rtl::OUString aPropertyName( rNameSeq[nN] );
+ aRetSeq[nN] = this->getPropertyDefault( aPropertyName );
+ }
+ }
+ return aRetSeq;
+}
+
+
+// ================================================================================
+
+Sequence< OUString > UpDownBarWrapper::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 4 );
+ aServices[ 0 ] = ::rtl::OUString::createFromAscii( "com.sun.star.chart.ChartArea" );
+ aServices[ 1 ] = ::rtl::OUString::createFromAscii( "com.sun.star.drawing.LineProperties" );
+ aServices[ 2 ] = ::rtl::OUString::createFromAscii( "com.sun.star.drawing.FillProperties" );
+ aServices[ 3 ] = ::rtl::OUString::createFromAscii( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( UpDownBarWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx
new file mode 100644
index 000000000000..ce83ece0a4bf
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.hxx
@@ -0,0 +1,140 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: UpDownBarWrapper.hxx,v $
+ * $Revision: 1.3.44.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_UPDOWNBARWRAPPER_HXX
+#define CHART_UPDOWNBARWRAPPER_HXX
+
+#include "ServiceMacros.hxx"
+#include "MutexContainer.hxx"
+#include <cppuhelper/interfacecontainer.hxx>
+
+
+#include <com/sun/star/chart2/XDiagram.hpp>
+
+// header for class OPropertyArrayHelper
+#include <cppuhelper/propshlp.hxx>
+#include <cppuhelper/implbase6.hxx>
+#include <com/sun/star/beans/XMultiPropertySet.hpp>
+#include <com/sun/star/beans/XMultiPropertyStates.hpp>
+#include <com/sun/star/beans/XPropertyState.hpp>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+namespace wrapper
+{
+
+class Chart2ModelContact;
+
+class UpDownBarWrapper : public MutexContainer
+ , public ::cppu::WeakImplHelper6
+ < ::com::sun::star::lang::XComponent
+ , ::com::sun::star::lang::XServiceInfo
+ , ::com::sun::star::beans::XPropertySet
+ , ::com::sun::star::beans::XMultiPropertySet
+ , ::com::sun::star::beans::XPropertyState
+ , ::com::sun::star::beans::XMultiPropertyStates
+ // , ::com::sun::star::uno::XWeak // implemented by WeakImplHelper(optional interface)
+ // , ::com::sun::star::uno::XInterface // implemented by WeakImplHelper
+ // , ::com::sun::star::lang::XTypeProvider // implemented by WeakImplHelper
+ >
+{
+public:
+ UpDownBarWrapper( bool bUp, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~UpDownBarWrapper();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+ //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 ::rtl::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 ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual void SAL_CALL addPropertyChangeListener( const ::rtl::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 ::rtl::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 ::rtl::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 ::rtl::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);
+
+ //XMultiPropertySet
+ //getPropertySetInfo() already declared in XPropertySet
+ virtual void SAL_CALL setPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aValues ) throw (::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::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyValues( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addPropertiesChangeListener( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removePropertiesChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL firePropertiesChangeEvent( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertiesChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
+
+ //XPropertyState
+ virtual ::com::sun::star::beans::PropertyState SAL_CALL getPropertyState( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getPropertyStates( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertyToDefault( const ::rtl::OUString& PropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Any SAL_CALL getPropertyDefault( const ::rtl::OUString& aPropertyName ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ //XMultiPropertyStates
+ //getPropertyStates() already declared in XPropertyState
+ virtual void SAL_CALL setAllPropertiesToDefault( ) throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL setPropertiesToDefault( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getPropertyDefaults( const ::com::sun::star::uno::Sequence< ::rtl::OUString >& aPropertyNames ) throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //methods
+ ::cppu::IPropertyArrayHelper& getInfoHelper();
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+
+ rtl::OUString m_aPropertySetName;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::beans::XPropertySetInfo >
+ m_xInfo;//outer PropertySetInfo
+ ::boost::shared_ptr< ::cppu::OPropertyArrayHelper > m_pPropertyArrayHelper;
+
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_UPDOWNBARWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx
new file mode 100644
index 000000000000..efda626e5fd6
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx
@@ -0,0 +1,195 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WallFloorWrapper.cxx,v $
+ * $Revision: 1.3.44.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WallFloorWrapper.hxx"
+#include "macros.hxx"
+#include "Chart2ModelContact.hxx"
+#include "ContainerHelper.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+
+#include "FillProperties.hxx"
+#include "LineProperties.hxx"
+#include "UserDefinedProperties.hxx"
+#include "WrappedDirectStateProperty.hxx"
+
+#include <algorithm>
+#include <rtl/ustrbuf.hxx>
+#include <rtl/math.hxx>
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::chart2;
+
+using ::com::sun::star::beans::Property;
+using ::osl::MutexGuard;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+namespace
+{
+static const OUString lcl_aServiceName(
+ RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.comp.chart.WallOrFloor" ));
+
+const Sequence< Property > & lcl_GetPropertySequence()
+{
+ static Sequence< Property > aPropSeq;
+
+ // /--
+ MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
+ if( 0 == aPropSeq.getLength() )
+ {
+ // get properties
+ ::std::vector< ::com::sun::star::beans::Property > aProperties;
+ ::chart::FillProperties::AddPropertiesToVector( aProperties );
+ ::chart::LineProperties::AddPropertiesToVector( aProperties );
+// ::chart::NamedProperties::AddPropertiesToVector( aProperties );
+ ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties );
+
+ // and sort them for access via bsearch
+ ::std::sort( aProperties.begin(), aProperties.end(),
+ ::chart::PropertyNameLess() );
+
+ // transfer result to static Sequence
+ aPropSeq = ::chart::ContainerHelper::ContainerToSequence( aProperties );
+ }
+
+ return aPropSeq;
+}
+
+} // anonymous namespace
+
+// --------------------------------------------------------------------------------
+
+namespace chart
+{
+namespace wrapper
+{
+
+WallFloorWrapper::WallFloorWrapper( bool bWall,
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact ) :
+ m_spChart2ModelContact( spChart2ModelContact ),
+ m_aEventListenerContainer( m_aMutex ),
+ m_bWall( bWall )
+
+{
+}
+
+WallFloorWrapper::~WallFloorWrapper()
+{
+}
+
+// ____ XComponent ____
+void SAL_CALL WallFloorWrapper::dispose()
+ throw (uno::RuntimeException)
+{
+ Reference< uno::XInterface > xSource( static_cast< ::cppu::OWeakObject* >( this ) );
+ m_aEventListenerContainer.disposeAndClear( lang::EventObject( xSource ) );
+
+ // /--
+ MutexGuard aGuard( GetMutex());
+ clearWrappedPropertySet();
+ // \--
+}
+
+void SAL_CALL WallFloorWrapper::addEventListener(
+ const Reference< lang::XEventListener >& xListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.addInterface( xListener );
+}
+
+void SAL_CALL WallFloorWrapper::removeEventListener(
+ const Reference< lang::XEventListener >& aListener )
+ throw (uno::RuntimeException)
+{
+ m_aEventListenerContainer.removeInterface( aListener );
+}
+
+// ================================================================================
+
+// WrappedPropertySet
+Reference< beans::XPropertySet > WallFloorWrapper::getInnerPropertySet()
+{
+ Reference< beans::XPropertySet > xRet;
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() )
+ {
+ if( m_bWall )
+ xRet.set( xDiagram->getWall() );
+ else
+ xRet.set( xDiagram->getFloor() );
+ }
+
+ return xRet;
+}
+
+const Sequence< beans::Property >& WallFloorWrapper::getPropertySequence()
+{
+ return lcl_GetPropertySequence();
+}
+
+const std::vector< WrappedProperty* > WallFloorWrapper::createWrappedProperties()
+{
+ ::std::vector< ::chart::WrappedProperty* > aWrappedProperties;
+
+ // use direct state always, so that in XML the value is always
+ // exported. Because in the old chart the defaults is as follows:
+ // Floor: SOLID (new and old model default), Wall: NONE, except for some chart types (line, scatter)
+ if( m_bWall )
+ aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U("FillStyle"), C2U("FillStyle") ));
+ aWrappedProperties.push_back( new WrappedDirectStateProperty( C2U("FillColor"), C2U("FillColor") ));
+
+ return aWrappedProperties;
+}
+
+// ================================================================================
+
+Sequence< OUString > WallFloorWrapper::getSupportedServiceNames_Static()
+{
+ Sequence< OUString > aServices( 4 );
+ aServices[ 0 ] = C2U( "com.sun.star.xml.UserDefinedAttributeSupplier" );
+ aServices[ 1 ] = C2U( "com.sun.star.drawing.FillProperties" );
+ aServices[ 2 ] = C2U( "com.sun.star.drawing.LineProperties" );
+ aServices[ 3 ] = C2U( "com.sun.star.beans.PropertySet" );
+
+ return aServices;
+}
+
+// implement XServiceInfo methods basing upon getSupportedServiceNames_Static
+APPHELPER_XSERVICEINFO_IMPL( WallFloorWrapper, lcl_aServiceName );
+
+} // namespace wrapper
+} // namespace chart
diff --git a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx
new file mode 100644
index 000000000000..1e975bbb1ab0
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.hxx
@@ -0,0 +1,92 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WallFloorWrapper.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WALLFLOORWRAPPER_HXX
+#define CHART_WALLFLOORWRAPPER_HXX
+
+#include "WrappedPropertySet.hxx"
+#include "ServiceMacros.hxx"
+#include <cppuhelper/implbase2.hxx>
+#include <comphelper/uno3.hxx>
+#include <cppuhelper/interfacecontainer.hxx>
+#include <com/sun/star/lang/XComponent.hpp>
+#include <com/sun/star/lang/XServiceInfo.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+
+namespace wrapper
+{
+
+class Chart2ModelContact;
+
+class WallFloorWrapper : public ::cppu::ImplInheritanceHelper2<
+ WrappedPropertySet
+ , com::sun::star::lang::XComponent
+ , com::sun::star::lang::XServiceInfo
+ >
+{
+public:
+ WallFloorWrapper( bool bWall, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WallFloorWrapper();
+
+ /// XServiceInfo declarations
+ APPHELPER_XSERVICEINFO_DECL()
+
+ // ____ XComponent ____
+ virtual void SAL_CALL dispose()
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL addEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& xListener )
+ throw (::com::sun::star::uno::RuntimeException);
+ virtual void SAL_CALL removeEventListener( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::lang::XEventListener >& aListener )
+ throw (::com::sun::star::uno::RuntimeException);
+
+protected:
+ // ____ WrappedPropertySet ____
+ virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence();
+ virtual const std::vector< WrappedProperty* > createWrappedProperties();
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > getInnerPropertySet();
+
+private:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ ::cppu::OInterfaceContainerHelper m_aEventListenerContainer;
+
+ bool m_bWall;
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_WALLFLOORWRAPPER_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedAddInProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedAddInProperty.cxx
new file mode 100644
index 000000000000..1f4aa3c96d47
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedAddInProperty.cxx
@@ -0,0 +1,161 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedAddInProperty.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedAddInProperty.hxx"
+#include "macros.hxx"
+
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+namespace wrapper
+{
+
+WrappedAddInProperty::WrappedAddInProperty( ChartDocumentWrapper& rChartDocumentWrapper )
+ : ::chart::WrappedProperty( C2U( "AddIn" ), OUString() )
+ , m_rChartDocumentWrapper( rChartDocumentWrapper )
+{
+}
+WrappedAddInProperty::~WrappedAddInProperty()
+{
+}
+
+void WrappedAddInProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Reference< util::XRefreshable > xAddIn;
+ if( ! (rOuterValue >>= xAddIn) )
+ throw lang::IllegalArgumentException( C2U("AddIn properties require type XRefreshable"), 0, 0 );
+
+ m_rChartDocumentWrapper.setAddIn( xAddIn );
+}
+
+Any WrappedAddInProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return uno::makeAny( m_rChartDocumentWrapper.getAddIn() );
+}
+
+//.............................................................................
+//.............................................................................
+//.............................................................................
+
+WrappedBaseDiagramProperty::WrappedBaseDiagramProperty( ChartDocumentWrapper& rChartDocumentWrapper )
+ : ::chart::WrappedProperty( C2U( "BaseDiagram" ), OUString() )
+ , m_rChartDocumentWrapper( rChartDocumentWrapper )
+{
+}
+WrappedBaseDiagramProperty::~WrappedBaseDiagramProperty()
+{
+}
+
+void WrappedBaseDiagramProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ rtl::OUString aBaseDiagram;
+ if( ! (rOuterValue >>= aBaseDiagram) )
+ throw lang::IllegalArgumentException( C2U("BaseDiagram properties require type OUString"), 0, 0 );
+
+ m_rChartDocumentWrapper.setBaseDiagram( aBaseDiagram );
+}
+
+Any WrappedBaseDiagramProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return uno::makeAny( m_rChartDocumentWrapper.getBaseDiagram() );
+}
+
+//.............................................................................
+//.............................................................................
+//.............................................................................
+
+WrappedAdditionalShapesProperty::WrappedAdditionalShapesProperty( ChartDocumentWrapper& rChartDocumentWrapper )
+ : ::chart::WrappedProperty( C2U( "AdditionalShapes" ), OUString() )
+ , m_rChartDocumentWrapper( rChartDocumentWrapper )
+{
+}
+WrappedAdditionalShapesProperty::~WrappedAdditionalShapesProperty()
+{
+}
+
+void WrappedAdditionalShapesProperty::setPropertyValue( const Any& /*rOuterValue*/, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ throw lang::IllegalArgumentException( C2U("AdditionalShapes is a read only property"), 0, 0 );
+}
+
+Any WrappedAdditionalShapesProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return uno::makeAny( m_rChartDocumentWrapper.getAdditionalShapes() );
+}
+
+//.............................................................................
+//.............................................................................
+//.............................................................................
+
+WrappedRefreshAddInAllowedProperty::WrappedRefreshAddInAllowedProperty( ChartDocumentWrapper& rChartDocumentWrapper )
+ : ::chart::WrappedProperty( C2U( "RefreshAddInAllowed" ), OUString() )
+ , m_rChartDocumentWrapper( rChartDocumentWrapper )
+{
+}
+WrappedRefreshAddInAllowedProperty::~WrappedRefreshAddInAllowedProperty()
+{
+}
+
+void WrappedRefreshAddInAllowedProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bUpdateAddIn = sal_True;
+ if( ! (rOuterValue >>= bUpdateAddIn) )
+ throw lang::IllegalArgumentException( C2U("The property RefreshAddInAllowed requires type boolean"), 0, 0 );
+
+ m_rChartDocumentWrapper.setUpdateAddIn( bUpdateAddIn );
+}
+
+Any WrappedRefreshAddInAllowedProperty::getPropertyValue( const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return uno::makeAny( m_rChartDocumentWrapper.getUpdateAddIn() );
+}
+
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedAddInProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedAddInProperty.hxx
new file mode 100644
index 000000000000..01cdd148c136
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedAddInProperty.hxx
@@ -0,0 +1,114 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedAddInProperty.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_ADDIN_PROPERTY_HXX
+#define CHART_WRAPPED_ADDIN_PROPERTY_HXX
+
+#include "WrappedProperty.hxx"
+#include "ChartDocumentWrapper.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+namespace wrapper
+{
+
+class WrappedAddInProperty : public WrappedProperty
+{
+public:
+ WrappedAddInProperty( ChartDocumentWrapper& rChartDocumentWrapper );
+ virtual ~WrappedAddInProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ChartDocumentWrapper& m_rChartDocumentWrapper;
+};
+
+class WrappedBaseDiagramProperty : public WrappedProperty
+{
+public:
+ WrappedBaseDiagramProperty( ChartDocumentWrapper& rChartDocumentWrapper );
+ virtual ~WrappedBaseDiagramProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ChartDocumentWrapper& m_rChartDocumentWrapper;
+};
+
+class WrappedAdditionalShapesProperty : public WrappedProperty
+{
+public:
+ WrappedAdditionalShapesProperty( ChartDocumentWrapper& rChartDocumentWrapper );
+ virtual ~WrappedAdditionalShapesProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ChartDocumentWrapper& m_rChartDocumentWrapper;
+};
+
+class WrappedRefreshAddInAllowedProperty : public WrappedProperty
+{
+public:
+ WrappedRefreshAddInAllowedProperty( ChartDocumentWrapper& rChartDocumentWrapper );
+ virtual ~WrappedRefreshAddInAllowedProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ChartDocumentWrapper& m_rChartDocumentWrapper;
+};
+
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_ADDIN_PROPERTY_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx
new file mode 100644
index 000000000000..dfba4f0cf5ab
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx
@@ -0,0 +1,159 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedAutomaticPositionProperties.cxx,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_chart2.hxx"
+
+#include "WrappedAutomaticPositionProperties.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include "macros.hxx"
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart2/RelativePosition.hpp>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+class WrappedAutomaticPositionProperty : public WrappedProperty
+{
+public:
+ WrappedAutomaticPositionProperty();
+ virtual ~WrappedAutomaticPositionProperty();
+
+ virtual void setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual Any getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual Any getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+};
+
+WrappedAutomaticPositionProperty::WrappedAutomaticPositionProperty()
+ : ::chart::WrappedProperty( C2U( "AutomaticPosition" ), rtl::OUString() )
+{
+}
+WrappedAutomaticPositionProperty::~WrappedAutomaticPositionProperty()
+{
+}
+
+void WrappedAutomaticPositionProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( xInnerPropertySet.is() )
+ {
+ bool bNewValue = true;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Property AutomaticPosition requires value of type boolean"), 0, 0 );
+
+ try
+ {
+ if( bNewValue )
+ {
+ Any aRelativePosition( xInnerPropertySet->getPropertyValue( C2U( "RelativePosition" ) ) );
+ if( aRelativePosition.hasValue() )
+ xInnerPropertySet->setPropertyValue( C2U( "RelativePosition" ), Any() );
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+Any WrappedAutomaticPositionProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet( getPropertyDefault( Reference< beans::XPropertyState >( xInnerPropertySet, uno::UNO_QUERY ) ) );
+ if( xInnerPropertySet.is() )
+ {
+ Any aRelativePosition( xInnerPropertySet->getPropertyValue( C2U( "RelativePosition" ) ) );
+ if( !aRelativePosition.hasValue() )
+ aRet <<= true;
+ }
+ return aRet;
+}
+
+Any WrappedAutomaticPositionProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= false;
+ return aRet;
+}
+
+namespace
+{
+enum
+{
+ PROP_CHART_AUTOMATIC_POSITION = FAST_PROPERTY_ID_START_CHART_AUTOPOSITION_PROP
+};
+
+void lcl_addWrappedProperties( std::vector< WrappedProperty* >& rList )
+{
+ rList.push_back( new WrappedAutomaticPositionProperty() );
+}
+
+}//anonymous namespace
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//static
+void WrappedAutomaticPositionProperties::addProperties( ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "AutomaticPosition" ),
+ PROP_CHART_AUTOMATIC_POSITION,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void WrappedAutomaticPositionProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList )
+{
+ lcl_addWrappedProperties( rList );
+}
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.hxx
new file mode 100644
index 000000000000..edb9127fcd31
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.hxx
@@ -0,0 +1,52 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedAutomaticPositionProperties.hxx,v $
+ * $Revision: 1.1.2.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CHART_WRAPPED_AUTOMATICPOSITION_PROPERTIES_HXX
+#define CHART_WRAPPED_AUTOMATICPOSITION_PROPERTIES_HXX
+
+#include "WrappedProperty.hxx"
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+class WrappedAutomaticPositionProperties
+{
+public:
+ static void addProperties( ::std::vector< ::com::sun::star::beans::Property >& rOutProperties );
+ static void addWrappedProperties( std::vector< WrappedProperty* >& rList );
+};
+
+} //namespace wrapper
+} //namespace chart
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx
new file mode 100644
index 000000000000..9164e42f5eeb
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx
@@ -0,0 +1,451 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedAxisAndGridExistenceProperties.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedAxisAndGridExistenceProperties.hxx"
+#include "AxisHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "TitleHelper.hxx"
+#include "macros.hxx"
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+class WrappedAxisAndGridExistenceProperty : public WrappedProperty
+{
+public:
+ WrappedAxisAndGridExistenceProperty( bool bAxis, bool bMain, sal_Int32 nDimensionIndex
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedAxisAndGridExistenceProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ bool m_bAxis;
+ bool m_bMain;
+ sal_Int32 m_nDimensionIndex;
+};
+
+//static
+void WrappedAxisAndGridExistenceProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( true, true, 0, spChart2ModelContact ) );//x axis
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( true, false, 0, spChart2ModelContact ) );//x secondary axis
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( false, true, 0, spChart2ModelContact ) );//x grid
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( false, false, 0, spChart2ModelContact ) );//x help grid
+
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( true, true, 1, spChart2ModelContact ) );//y axis
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( true, false, 1, spChart2ModelContact ) );//y secondary axis
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( false, true, 1, spChart2ModelContact ) );//y grid
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( false, false, 1, spChart2ModelContact ) );//y help grid
+
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( true, true, 2, spChart2ModelContact ) );//z axis
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( false, true, 2, spChart2ModelContact ) );//z grid
+ rList.push_back( new WrappedAxisAndGridExistenceProperty( false, false, 2, spChart2ModelContact ) );//z help grid
+}
+
+WrappedAxisAndGridExistenceProperty::WrappedAxisAndGridExistenceProperty( bool bAxis, bool bMain, sal_Int32 nDimensionIndex
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(OUString(),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_bAxis( bAxis )
+ , m_bMain( bMain )
+ , m_nDimensionIndex( nDimensionIndex )
+{
+ switch( m_nDimensionIndex )
+ {
+ case 0:
+ {
+ if( m_bAxis )
+ {
+ if( m_bMain )
+ m_aOuterName = C2U( "HasXAxis" );
+ else
+ m_aOuterName = C2U( "HasSecondaryXAxis" );
+ }
+ else
+ {
+ if( m_bMain )
+ m_aOuterName = C2U( "HasXAxisGrid" );
+ else
+ m_aOuterName = C2U( "HasXAxisHelpGrid" );
+ }
+ }
+ break;
+ case 2:
+ {
+ if( m_bAxis )
+ {
+ OSL_ENSURE(m_bMain == true,"there is no secondary z axis at the old api");
+ m_bMain = true;
+ m_aOuterName = C2U( "HasZAxis" );
+ }
+ else
+ {
+ if( m_bMain )
+ m_aOuterName = C2U( "HasZAxisGrid" );
+ else
+ m_aOuterName = C2U( "HasZAxisHelpGrid" );
+ }
+ }
+ break;
+ default:
+ {
+ if( m_bAxis )
+ {
+ if( m_bMain )
+ m_aOuterName = C2U( "HasYAxis" );
+ else
+ m_aOuterName = C2U( "HasSecondaryYAxis" );
+ }
+ else
+ {
+ if( m_bMain )
+ m_aOuterName = C2U( "HasYAxisGrid" );
+ else
+ m_aOuterName = C2U( "HasYAxisHelpGrid" );
+ }
+ }
+ break;
+ }
+}
+
+WrappedAxisAndGridExistenceProperty::~WrappedAxisAndGridExistenceProperty()
+{
+}
+
+void WrappedAxisAndGridExistenceProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNewValue = false;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Has axis or grid properties require boolean values"), 0, 0 );
+
+ sal_Bool bOldValue = sal_False;
+ getPropertyValue( xInnerPropertySet ) >>= bOldValue;
+
+ if( bOldValue == bNewValue )
+ return;
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( bNewValue )
+ {
+ if( m_bAxis )
+ AxisHelper::showAxis( m_nDimensionIndex, m_bMain, xDiagram, m_spChart2ModelContact->m_xContext );
+ else
+ AxisHelper::showGrid( m_nDimensionIndex, 0, m_bMain, xDiagram, m_spChart2ModelContact->m_xContext );
+ }
+ else
+ {
+ if( m_bAxis )
+ AxisHelper::hideAxis( m_nDimensionIndex, m_bMain, xDiagram );
+ else
+ AxisHelper::hideGrid( m_nDimensionIndex, 0, m_bMain, xDiagram );
+ }
+}
+
+Any WrappedAxisAndGridExistenceProperty::getPropertyValue( const Reference< beans::XPropertySet >& /* xInnerPropertySet */ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if(m_bAxis)
+ {
+ sal_Bool bShown = AxisHelper::isAxisShown( m_nDimensionIndex, m_bMain, xDiagram );
+ aRet <<= bShown;
+ }
+ else
+ {
+ sal_Bool bShown = AxisHelper::isGridShown( m_nDimensionIndex, 0, m_bMain, xDiagram );
+ aRet <<= bShown;
+ }
+ return aRet;
+}
+
+Any WrappedAxisAndGridExistenceProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= false;
+ return aRet;
+}
+
+//---------------------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------------------------
+
+class WrappedAxisTitleExistenceProperty : public WrappedProperty
+{
+public:
+ WrappedAxisTitleExistenceProperty( sal_Int32 nTitleIndex
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedAxisTitleExistenceProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ TitleHelper::eTitleType m_eTitleType;
+};
+
+//static
+void WrappedAxisTitleExistenceProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ rList.push_back( new WrappedAxisTitleExistenceProperty( 0, spChart2ModelContact ) );//x axis title
+ rList.push_back( new WrappedAxisTitleExistenceProperty( 1, spChart2ModelContact ) );//y axis title
+ rList.push_back( new WrappedAxisTitleExistenceProperty( 2, spChart2ModelContact ) );//z axis title
+ rList.push_back( new WrappedAxisTitleExistenceProperty( 3, spChart2ModelContact ) );//secondary x axis title
+ rList.push_back( new WrappedAxisTitleExistenceProperty( 4, spChart2ModelContact ) );//secondary y axis title
+}
+
+WrappedAxisTitleExistenceProperty::WrappedAxisTitleExistenceProperty( sal_Int32 nTitleIndex
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(OUString(),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_eTitleType( TitleHelper::Y_AXIS_TITLE )
+{
+ switch( nTitleIndex )
+ {
+ case 0:
+ m_aOuterName = C2U( "HasXAxisTitle" );
+ m_eTitleType = TitleHelper::X_AXIS_TITLE;
+ break;
+ case 2:
+ m_aOuterName = C2U( "HasZAxisTitle" );
+ m_eTitleType = TitleHelper::Z_AXIS_TITLE;
+ break;
+ case 3:
+ m_aOuterName = C2U( "HasSecondaryXAxisTitle" );
+ m_eTitleType = TitleHelper::SECONDARY_X_AXIS_TITLE;
+ break;
+ case 4:
+ m_aOuterName = C2U( "HasSecondaryYAxisTitle" );
+ m_eTitleType = TitleHelper::SECONDARY_Y_AXIS_TITLE;
+ break;
+ default:
+ m_aOuterName = C2U( "HasYAxisTitle" );
+ m_eTitleType = TitleHelper::Y_AXIS_TITLE;
+ break;
+ }
+}
+
+WrappedAxisTitleExistenceProperty::~WrappedAxisTitleExistenceProperty()
+{
+}
+
+void WrappedAxisTitleExistenceProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNewValue = false;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Has axis or grid properties require boolean values"), 0, 0 );
+
+ sal_Bool bOldValue = sal_False;
+ getPropertyValue( xInnerPropertySet ) >>= bOldValue;
+
+ if( bOldValue == bNewValue )
+ return;
+
+ if( bNewValue )
+ {
+ rtl::OUString aTitleText;
+ TitleHelper::createTitle( m_eTitleType, aTitleText
+ , m_spChart2ModelContact->getChartModel(), m_spChart2ModelContact->m_xContext );
+ }
+ else
+ {
+ TitleHelper::removeTitle( m_eTitleType, m_spChart2ModelContact->getChartModel() );
+ }
+}
+
+Any WrappedAxisTitleExistenceProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bHasTitle = sal_False;
+
+ Reference< chart2::XTitle > xTitle( TitleHelper::getTitle( m_eTitleType, m_spChart2ModelContact->getChartModel() ) );
+ if( xTitle.is() && (TitleHelper::getCompleteString( xTitle ).getLength() != 0) )
+ bHasTitle = sal_True;
+
+ Any aRet;
+ aRet <<= bHasTitle;
+ return aRet;
+
+}
+
+Any WrappedAxisTitleExistenceProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_Bool( sal_False );
+ return aRet;
+}
+
+//---------------------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------------------------
+
+class WrappedAxisLabelExistenceProperty : public WrappedProperty
+{
+public:
+ WrappedAxisLabelExistenceProperty( bool bMain, sal_Int32 nDimensionIndex
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedAxisLabelExistenceProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ bool m_bMain;
+ sal_Int32 m_nDimensionIndex;
+};
+
+//static
+void WrappedAxisLabelExistenceProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ rList.push_back( new WrappedAxisLabelExistenceProperty( true, 0, spChart2ModelContact ) );//x axis
+ rList.push_back( new WrappedAxisLabelExistenceProperty( true, 1, spChart2ModelContact ) );//y axis
+ rList.push_back( new WrappedAxisLabelExistenceProperty( true, 2, spChart2ModelContact ) );//z axis
+ rList.push_back( new WrappedAxisLabelExistenceProperty( false, 0, spChart2ModelContact ) );//secondary x axis
+ rList.push_back( new WrappedAxisLabelExistenceProperty( false, 1, spChart2ModelContact ) );//secondary y axis
+}
+
+WrappedAxisLabelExistenceProperty::WrappedAxisLabelExistenceProperty( bool bMain, sal_Int32 nDimensionIndex
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(OUString(),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_bMain( bMain )
+ , m_nDimensionIndex( nDimensionIndex )
+{
+ switch( m_nDimensionIndex )
+ {
+ case 0:
+ m_aOuterName = m_bMain ? C2U( "HasXAxisDescription" ) : C2U( "HasSecondaryXAxisDescription" );
+ break;
+ case 2:
+ OSL_ENSURE(m_bMain,"there is no description available for a secondary z axis");
+ m_aOuterName = C2U( "HasZAxisDescription" );
+ break;
+ default:
+ m_aOuterName = m_bMain ? C2U( "HasYAxisDescription" ) : C2U( "HasSecondaryYAxisDescription" );
+ break;
+ }
+}
+
+WrappedAxisLabelExistenceProperty::~WrappedAxisLabelExistenceProperty()
+{
+}
+
+void WrappedAxisLabelExistenceProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Bool bNewValue = false;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("Has axis or grid properties require boolean values"), 0, 0 );
+
+ sal_Bool bOldValue = sal_False;
+ getPropertyValue( xInnerPropertySet ) >>= bOldValue;
+
+ if( bOldValue == bNewValue )
+ return;
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ Reference< beans::XPropertySet > xProp( AxisHelper::getAxis( m_nDimensionIndex, m_bMain, xDiagram ), uno::UNO_QUERY );
+ if( !xProp.is() && bNewValue )
+ {
+ //create axis if needed
+ xProp.set( AxisHelper::createAxis( m_nDimensionIndex, m_bMain, xDiagram, m_spChart2ModelContact->m_xContext ), uno::UNO_QUERY );
+ if( xProp.is() )
+ xProp->setPropertyValue( C2U( "Show" ), uno::makeAny( sal_False ) );
+ }
+ if( xProp.is() )
+ xProp->setPropertyValue( C2U( "DisplayLabels" ), rOuterValue );
+}
+
+Any WrappedAxisLabelExistenceProperty::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ Reference< beans::XPropertySet > xProp( AxisHelper::getAxis( m_nDimensionIndex, m_bMain, xDiagram ), uno::UNO_QUERY );
+ if( xProp.is() )
+ aRet = xProp->getPropertyValue( C2U( "DisplayLabels" ));
+ else
+ aRet <<= sal_False;
+ return aRet;
+}
+
+Any WrappedAxisLabelExistenceProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= sal_Bool( sal_True );
+ return aRet;
+}
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.hxx
new file mode 100644
index 000000000000..0c094a3de39c
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.hxx
@@ -0,0 +1,79 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedAxisAndGridExistenceProperties.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_AXISANDGRIDEXISTENCE_PROPERTIES_HXX
+#define CHART_WRAPPED_AXISANDGRIDEXISTENCE_PROPERTIES_HXX
+
+#include "WrappedProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+class WrappedAxisAndGridExistenceProperties
+{
+public:
+ static void addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+};
+
+//---------------------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------------------------
+
+class WrappedAxisTitleExistenceProperties
+{
+public:
+ static void addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+};
+
+//---------------------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------------------------
+//---------------------------------------------------------------------------------------------------------------
+
+class WrappedAxisLabelExistenceProperties
+{
+public:
+ static void addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_SCALE_PROPERTY_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.cxx
new file mode 100644
index 000000000000..94f1c58fe27a
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.cxx
@@ -0,0 +1,175 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedCharacterHeightProperty.cxx,v $
+ * $Revision: 1.5.44.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedCharacterHeightProperty.hxx"
+#include "macros.hxx"
+#include "RelativeSizeHelper.hxx"
+#include "ReferenceSizePropertyProvider.hxx"
+
+// header for define DBG_ASSERT
+#include <tools/debug.hxx>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+
+//.............................................................................
+//.............................................................................
+
+//.............................................................................
+//.............................................................................
+
+namespace chart
+{
+namespace wrapper
+{
+WrappedCharacterHeightProperty_Base::WrappedCharacterHeightProperty_Base(
+ const OUString& rOuterEqualsInnerName
+ , ReferenceSizePropertyProvider* pRefSizePropProvider )
+ : WrappedProperty( rOuterEqualsInnerName, rOuterEqualsInnerName )
+ , m_pRefSizePropProvider( pRefSizePropProvider )
+{
+}
+WrappedCharacterHeightProperty_Base::~WrappedCharacterHeightProperty_Base()
+{
+}
+
+//static
+void WrappedCharacterHeightProperty::addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ReferenceSizePropertyProvider* pRefSizePropProvider )
+{
+ rList.push_back( new WrappedCharacterHeightProperty( pRefSizePropProvider ) );
+ rList.push_back( new WrappedAsianCharacterHeightProperty( pRefSizePropProvider ) );
+ rList.push_back( new WrappedComplexCharacterHeightProperty( pRefSizePropProvider ) );
+}
+
+void WrappedCharacterHeightProperty_Base::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if(xInnerPropertySet.is())
+ {
+ if( m_pRefSizePropProvider )
+ m_pRefSizePropProvider->updateReferenceSize();
+ xInnerPropertySet->setPropertyValue( m_aInnerName, rOuterValue );
+ }
+}
+
+Any WrappedCharacterHeightProperty_Base::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ if( xInnerPropertySet.is() )
+ {
+ aRet = xInnerPropertySet->getPropertyValue( m_aInnerName );
+ float fHeight = 0;
+ if( aRet >>= fHeight )
+ {
+ if( m_pRefSizePropProvider )
+ {
+ awt::Size aReferenceSize;
+ if( m_pRefSizePropProvider->getReferenceSize() >>= aReferenceSize )
+ {
+ awt::Size aCurrentSize = m_pRefSizePropProvider->getCurrentSizeForReference();
+ aRet <<= static_cast< float >(
+ RelativeSizeHelper::calculate( fHeight, aReferenceSize, aCurrentSize ));
+ }
+ }
+ }
+ }
+ return aRet;
+}
+
+Any WrappedCharacterHeightProperty_Base::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ if( xInnerPropertyState.is() )
+ {
+ aRet = xInnerPropertyState->getPropertyDefault( m_aInnerName );
+ }
+ return aRet;
+}
+
+beans::PropertyState WrappedCharacterHeightProperty_Base::getPropertyState( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ return beans::PropertyState_DIRECT_VALUE;
+}
+
+Any WrappedCharacterHeightProperty_Base::convertInnerToOuterValue( const Any& rInnerValue ) const
+{
+ OSL_ASSERT("should not be used: WrappedCharacterHeightProperty_Base::convertInnerToOuterValue - check if you miss data");
+ return rInnerValue;
+}
+Any WrappedCharacterHeightProperty_Base::convertOuterToInnerValue( const Any& rOuterValue ) const
+{
+ OSL_ASSERT("should not be used: WrappedCharacterHeightProperty_Base::convertOuterToInnerValue - check if you miss data");
+ return rOuterValue;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+WrappedCharacterHeightProperty::WrappedCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider )
+ : WrappedCharacterHeightProperty_Base( C2U( "CharHeight" ), pRefSizePropProvider )
+{
+}
+WrappedCharacterHeightProperty::~WrappedCharacterHeightProperty()
+{
+}
+
+//-----------------------------------------------------------------------------
+
+WrappedAsianCharacterHeightProperty::WrappedAsianCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider )
+ : WrappedCharacterHeightProperty_Base( C2U( "CharHeightAsian" ), pRefSizePropProvider )
+{
+}
+WrappedAsianCharacterHeightProperty::~WrappedAsianCharacterHeightProperty()
+{
+}
+
+//-----------------------------------------------------------------------------
+
+WrappedComplexCharacterHeightProperty::WrappedComplexCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider )
+ : WrappedCharacterHeightProperty_Base( C2U( "CharHeightComplex" ), pRefSizePropProvider )
+{
+}
+WrappedComplexCharacterHeightProperty::~WrappedComplexCharacterHeightProperty()
+{
+}
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.hxx
new file mode 100644
index 000000000000..4ee8e0bf89e7
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedCharacterHeightProperty.hxx
@@ -0,0 +1,105 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedCharacterHeightProperty.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_CHARACTERHEIGHT_PROPERTY_HXX
+#define CHART_WRAPPED_CHARACTERHEIGHT_PROPERTY_HXX
+
+#include "WrappedProperty.hxx"
+
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+class ReferenceSizePropertyProvider;
+
+class WrappedCharacterHeightProperty_Base : public WrappedProperty
+{
+public:
+ WrappedCharacterHeightProperty_Base( const ::rtl::OUString& rOuterEqualsInnerName, ReferenceSizePropertyProvider* pRefSizePropProvider );
+ virtual ~WrappedCharacterHeightProperty_Base();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::beans::PropertyState getPropertyState( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual ::com::sun::star::uno::Any convertInnerToOuterValue( const ::com::sun::star::uno::Any& rInnerValue ) const;
+ virtual ::com::sun::star::uno::Any convertOuterToInnerValue( const ::com::sun::star::uno::Any& rOuterValue ) const;
+
+protected:
+ ReferenceSizePropertyProvider* m_pRefSizePropProvider;
+};
+
+//-----------------------------------------------------------------------------
+
+class WrappedCharacterHeightProperty : public WrappedCharacterHeightProperty_Base
+{
+public:
+ WrappedCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider );
+ virtual ~WrappedCharacterHeightProperty();
+
+ static void addWrappedProperties( std::vector< WrappedProperty* >& rList, ReferenceSizePropertyProvider* pRefSizePropProvider );
+};
+
+//-----------------------------------------------------------------------------
+
+class WrappedAsianCharacterHeightProperty : public WrappedCharacterHeightProperty_Base
+{
+public:
+ WrappedAsianCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider );
+ virtual ~WrappedAsianCharacterHeightProperty();
+};
+
+//-----------------------------------------------------------------------------
+
+class WrappedComplexCharacterHeightProperty : public WrappedCharacterHeightProperty_Base
+{
+public:
+ WrappedComplexCharacterHeightProperty( ReferenceSizePropertyProvider* pRefSizePropProvider );
+ virtual ~WrappedComplexCharacterHeightProperty();
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_CHARACTERHEIGHT_PROPERTY_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx
new file mode 100644
index 000000000000..5b48f320db39
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx
@@ -0,0 +1,196 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedDataCaptionProperties.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedDataCaptionProperties.hxx"
+#include "WrappedSeriesOrDiagramProperty.hxx"
+#include "macros.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include <com/sun/star/chart2/DataPointLabel.hpp>
+#include <com/sun/star/chart/ChartDataCaption.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+class WrappedDataCaptionProperty : public WrappedSeriesOrDiagramProperty< sal_Int32 >
+{
+public:
+ virtual sal_Int32 getValueFromSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesPropertySet, sal_Int32 aNewValue ) const;
+
+ explicit WrappedDataCaptionProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedDataCaptionProperty();
+};
+
+namespace
+{
+enum
+{
+ //data caption properties
+ PROP_CHART_DATAPOINT_DATA_CAPTION = FAST_PROPERTY_ID_START_CHART_DATACAPTION_PROP
+};
+
+sal_Int32 lcl_LabelToCaption( const chart2::DataPointLabel& rLabel )
+{
+ sal_Int32 nCaption=0;
+
+ if( rLabel.ShowNumber )
+ nCaption |= ::com::sun::star::chart::ChartDataCaption::VALUE;
+ if( rLabel.ShowNumberInPercent )
+ nCaption |= ::com::sun::star::chart::ChartDataCaption::PERCENT;
+ if( rLabel.ShowCategoryName )
+ nCaption |= ::com::sun::star::chart::ChartDataCaption::TEXT;
+ if( rLabel.ShowLegendSymbol )
+ nCaption |= ::com::sun::star::chart::ChartDataCaption::SYMBOL;
+
+ return nCaption;
+}
+
+chart2::DataPointLabel lcl_CaptionToLabel( sal_Int32 nCaption )
+{
+ chart2::DataPointLabel aLabel(false,false,false,false);
+
+ if( nCaption & ::com::sun::star::chart::ChartDataCaption::VALUE )
+ aLabel.ShowNumber = true;
+ if( nCaption & ::com::sun::star::chart::ChartDataCaption::PERCENT )
+ aLabel.ShowNumberInPercent = true;
+ if( nCaption & ::com::sun::star::chart::ChartDataCaption::TEXT )
+ aLabel.ShowCategoryName = true;
+ if( nCaption & ::com::sun::star::chart::ChartDataCaption::SYMBOL )
+ aLabel.ShowLegendSymbol = true;
+
+ return aLabel;
+}
+
+void lcl_addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
+ , tSeriesOrDiagramPropertyType ePropertyType )
+{
+ //if !spChart2ModelContact.get() is then the created properties do belong to a single series or single datapoint
+ //otherwise they do belong to the whole diagram
+
+ rList.push_back( new WrappedDataCaptionProperty( spChart2ModelContact, ePropertyType ) );
+}
+
+}//anonymous namespace
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//static
+void WrappedDataCaptionProperties::addProperties( ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "DataCaption" ),
+ PROP_CHART_DATAPOINT_DATA_CAPTION,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void WrappedDataCaptionProperties::addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ lcl_addWrappedProperties( rList, spChart2ModelContact, DATA_SERIES );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void WrappedDataCaptionProperties::addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ lcl_addWrappedProperties( rList, spChart2ModelContact, DIAGRAM );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+WrappedDataCaptionProperty::WrappedDataCaptionProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
+ , tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedSeriesOrDiagramProperty< sal_Int32 >( C2U("DataCaption")
+ , uno::makeAny( sal_Int32(0) ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedDataCaptionProperty::~WrappedDataCaptionProperty()
+{
+}
+
+sal_Int32 WrappedDataCaptionProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ sal_Int32 aRet = 0;
+ m_aDefaultValue >>= aRet;
+ chart2::DataPointLabel aLabel;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(C2U("Label")) >>= aLabel ) )
+ aRet = lcl_LabelToCaption( aLabel );
+ return aRet;
+}
+
+void WrappedDataCaptionProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Int32 nCaption ) const
+{
+ if(!xSeriesPropertySet.is())
+ return;
+
+ chart2::DataPointLabel aLabel = lcl_CaptionToLabel( nCaption );
+ xSeriesPropertySet->setPropertyValue( C2U("Label"), uno::makeAny( aLabel ) );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.hxx
new file mode 100644
index 000000000000..1dbd3b8bbaa6
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedDataCaptionProperties.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_DATACAPTION_PROPERTIES_HXX
+#define CHART_WRAPPED_DATACAPTION_PROPERTIES_HXX
+
+#include "WrappedProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+class WrappedDataCaptionProperties
+{
+public:
+ static void addProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties );
+ static void addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ static void addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_DATACAPTION_PROPERTIES_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx
new file mode 100644
index 000000000000..7c4df1455ad4
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.cxx
@@ -0,0 +1,204 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedGapwidthProperty.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedGapwidthProperty.hxx"
+#include "macros.hxx"
+#include "DiagramHelper.hxx"
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+const sal_Int32 DEFAULT_GAPWIDTH = 100;
+const sal_Int32 DEFAULT_OVERLAP = 0;
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+WrappedBarPositionProperty_Base::WrappedBarPositionProperty_Base(
+ const ::rtl::OUString& rOuterName
+ , const ::rtl::OUString& rInnerSequencePropertyName
+ , sal_Int32 nDefaultValue
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedDefaultProperty( rOuterName, rtl::OUString(), uno::makeAny( nDefaultValue ) )
+ , m_nDimensionIndex(0)
+ , m_nAxisIndex(0)
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_nDefaultValue( nDefaultValue )
+ , m_InnerSequencePropertyName( rInnerSequencePropertyName )
+{
+}
+
+void WrappedBarPositionProperty_Base::setDimensionAndAxisIndex( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex )
+{
+ m_nDimensionIndex = nDimensionIndex;
+ m_nAxisIndex = nAxisIndex;
+}
+
+WrappedBarPositionProperty_Base::~WrappedBarPositionProperty_Base()
+{
+}
+
+void WrappedBarPositionProperty_Base::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Int32 nNewValue = 0;
+ if( ! (rOuterValue >>= nNewValue) )
+ throw lang::IllegalArgumentException( C2U("GapWidth and Overlap property require value of type sal_Int32"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( !xDiagram.is() )
+ return;
+
+ if( m_nDimensionIndex==1 )
+ {
+ Sequence< Reference< chart2::XChartType > > aChartTypeList( DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
+ for( sal_Int32 nN = 0; nN < aChartTypeList.getLength(); nN++ )
+ {
+ try
+ {
+ Reference< beans::XPropertySet > xProp( aChartTypeList[nN], uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ Sequence< sal_Int32 > aBarPositionSequence;
+ xProp->getPropertyValue( m_InnerSequencePropertyName ) >>= aBarPositionSequence;
+
+ long nOldLength = aBarPositionSequence.getLength();
+ if( nOldLength <= m_nAxisIndex )
+ {
+ aBarPositionSequence.realloc( m_nAxisIndex+1 );
+ for( sal_Int32 i=nOldLength; i<m_nAxisIndex; i++ )
+ {
+ aBarPositionSequence[i] = m_nDefaultValue;
+ }
+ }
+ aBarPositionSequence[m_nAxisIndex] = nNewValue;
+
+ xProp->setPropertyValue( m_InnerSequencePropertyName, uno::makeAny( aBarPositionSequence ) );
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ //the above properties are not supported by all charttypes (only by column and bar)
+ //in that cases this exception is ok
+ e.Context.is();//to have debug information without compilation warnings
+ }
+ }
+ }
+}
+
+Any WrappedBarPositionProperty_Base::getPropertyValue( const Reference< beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() )
+ {
+ bool bInnerValueDetected = false;
+ sal_Int32 nInnerValue = m_nDefaultValue;
+
+ if( m_nDimensionIndex==1 )
+ {
+ Sequence< Reference< chart2::XChartType > > aChartTypeList( DiagramHelper::getChartTypesFromDiagram( xDiagram ) );
+ for( sal_Int32 nN = 0; nN < aChartTypeList.getLength() && !bInnerValueDetected; nN++ )
+ {
+ try
+ {
+ Reference< beans::XPropertySet > xProp( aChartTypeList[nN], uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ Sequence< sal_Int32 > aBarPositionSequence;
+ xProp->getPropertyValue( m_InnerSequencePropertyName ) >>= aBarPositionSequence;
+ if( m_nAxisIndex < aBarPositionSequence.getLength() )
+ {
+ nInnerValue = aBarPositionSequence[m_nAxisIndex];
+ bInnerValueDetected = true;
+ }
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ //the above properties are not supported by all charttypes (only by column and bar)
+ //in that cases this exception is ok
+ e.Context.is();//to have debug information without compilation warnings
+ }
+ }
+ }
+ if( bInnerValueDetected )
+ {
+ m_aOuterValue <<= nInnerValue;
+ }
+ }
+ return m_aOuterValue;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+WrappedGapwidthProperty::WrappedGapwidthProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedBarPositionProperty_Base( C2U("GapWidth"), C2U("GapwidthSequence"), DEFAULT_GAPWIDTH, spChart2ModelContact )
+{
+}
+WrappedGapwidthProperty::~WrappedGapwidthProperty()
+{
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+WrappedBarOverlapProperty::WrappedBarOverlapProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedBarPositionProperty_Base( C2U("Overlap"), C2U("OverlapSequence"), DEFAULT_OVERLAP, spChart2ModelContact )
+{
+}
+WrappedBarOverlapProperty::~WrappedBarOverlapProperty()
+{
+}
+
+} // namespace wrapper
+} // namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.hxx
new file mode 100644
index 000000000000..85e333577206
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedGapwidthProperty.hxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedGapwidthProperty.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_GAPWIDTH_PROPERTY_HXX
+#define CHART_WRAPPED_GAPWIDTH_PROPERTY_HXX
+
+#include "WrappedDefaultProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+
+namespace chart
+{
+namespace wrapper
+{
+
+class WrappedBarPositionProperty_Base : public WrappedDefaultProperty
+{
+public:
+ WrappedBarPositionProperty_Base(
+ const ::rtl::OUString& rOuterName
+ , const ::rtl::OUString& rInnerSequencePropertyName
+ , sal_Int32 nDefaultValue
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedBarPositionProperty_Base();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ void setDimensionAndAxisIndex( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex );
+
+protected:
+ sal_Int32 m_nDimensionIndex;
+ sal_Int32 m_nAxisIndex;
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+
+ sal_Int32 m_nDefaultValue;
+ ::rtl::OUString m_InnerSequencePropertyName;
+
+ mutable ::com::sun::star::uno::Any m_aOuterValue;
+};
+
+class WrappedGapwidthProperty : public WrappedBarPositionProperty_Base
+{
+public:
+ WrappedGapwidthProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedGapwidthProperty();
+};
+
+class WrappedBarOverlapProperty : public WrappedBarPositionProperty_Base
+{
+public:
+ WrappedBarOverlapProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedBarOverlapProperty();
+};
+
+} // namespace wrapper
+} // namespace chart
+
+// CHART_WRAPPED_GAPWIDTH_PROPERTY_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
new file mode 100644
index 000000000000..00101ef10f34
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.cxx
@@ -0,0 +1,202 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedNumberFormatProperty.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedNumberFormatProperty.hxx"
+#include "macros.hxx"
+
+// header for define DBG_ERROR
+#include <tools/debug.hxx>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+//.............................................................................
+
+WrappedNumberFormatProperty::WrappedNumberFormatProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedDirectStateProperty( C2U("NumberFormat"), C2U("NumberFormat") )
+ , m_spChart2ModelContact(spChart2ModelContact)
+{
+ m_aOuterValue = getPropertyDefault( 0 );
+}
+
+WrappedNumberFormatProperty::~WrappedNumberFormatProperty()
+{
+ if( m_pWrappedLinkNumberFormatProperty )
+ {
+ if( m_pWrappedLinkNumberFormatProperty->m_pWrappedNumberFormatProperty == this )
+ m_pWrappedLinkNumberFormatProperty->m_pWrappedNumberFormatProperty = 0;
+ }
+}
+
+void WrappedNumberFormatProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ sal_Int32 nFormat = 0;
+ if( ! (rOuterValue >>= nFormat) )
+ throw lang::IllegalArgumentException( C2U("Property 'NumberFormat' requires value of type sal_Int32"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+ if(xInnerPropertySet.is())
+ {
+ bool bUseSourceFormat = !xInnerPropertySet->getPropertyValue( C2U("NumberFormat" )).hasValue();
+ if( bUseSourceFormat )
+ {
+ uno::Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ if( xChartDoc.is() && xChartDoc->hasInternalDataProvider() )
+ bUseSourceFormat = false;
+ }
+ if( !bUseSourceFormat )
+ xInnerPropertySet->setPropertyValue( m_aInnerName, this->convertOuterToInnerValue( rOuterValue ) );
+ }
+}
+
+Any WrappedNumberFormatProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( !xInnerPropertySet.is() )
+ {
+ DBG_ERROR("missing xInnerPropertySet in WrappedNumberFormatProperty::getPropertyValue");
+ return Any();
+ }
+ Any aRet( xInnerPropertySet->getPropertyValue( m_aInnerName ));
+ if( !aRet.hasValue() )
+ {
+ sal_Int32 nKey = 0;
+ Reference< chart2::XDataSeries > xSeries( xInnerPropertySet, uno::UNO_QUERY );
+ if( xSeries.is() )
+ nKey = m_spChart2ModelContact->getExplicitNumberFormatKeyForSeries( xSeries );
+ else
+ {
+ Reference< chart2::XAxis > xAxis( xInnerPropertySet, uno::UNO_QUERY );
+ nKey = m_spChart2ModelContact->getExplicitNumberFormatKeyForAxis( xAxis );
+ }
+ aRet <<= nKey;
+ }
+ return aRet;
+}
+
+Any WrappedNumberFormatProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return uno::makeAny( sal_Int32( 0 ) );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+WrappedLinkNumberFormatProperty::WrappedLinkNumberFormatProperty( WrappedNumberFormatProperty* pWrappedNumberFormatProperty )
+ : WrappedProperty( C2U("LinkNumberFormatToSource"), C2U("") )
+ , m_pWrappedNumberFormatProperty( pWrappedNumberFormatProperty )
+{
+ if( m_pWrappedNumberFormatProperty )
+ {
+ m_pWrappedNumberFormatProperty->m_pWrappedLinkNumberFormatProperty = this;
+ }
+}
+
+WrappedLinkNumberFormatProperty::~WrappedLinkNumberFormatProperty()
+{
+ if( m_pWrappedNumberFormatProperty )
+ {
+ if( m_pWrappedNumberFormatProperty->m_pWrappedLinkNumberFormatProperty == this )
+ m_pWrappedNumberFormatProperty->m_pWrappedLinkNumberFormatProperty = 0;
+ }
+}
+
+void WrappedLinkNumberFormatProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( !xInnerPropertySet.is() )
+ {
+ DBG_ERROR("missing xInnerPropertySet in WrappedNumberFormatProperty::setPropertyValue");
+ return;
+ }
+
+ bool bLinkFormat = false;
+ if( rOuterValue >>= bLinkFormat )
+ {
+ Any aValue;
+ if( bLinkFormat )
+ {
+ if( m_pWrappedNumberFormatProperty )
+ {
+ uno::Reference< chart2::XChartDocument > xChartDoc( m_pWrappedNumberFormatProperty->m_spChart2ModelContact->getChart2Document() );
+ if( xChartDoc.is() && xChartDoc->hasInternalDataProvider() )
+ return;
+ }
+ }
+ else
+ {
+ if( m_pWrappedNumberFormatProperty )
+ {
+ aValue = m_pWrappedNumberFormatProperty->getPropertyValue( xInnerPropertySet );
+ }
+ else
+ aValue <<= sal_Int32( 0 );
+ }
+
+ xInnerPropertySet->setPropertyValue( C2U("NumberFormat"), aValue );
+ }
+}
+
+Any WrappedLinkNumberFormatProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( !xInnerPropertySet.is() )
+ {
+ DBG_ERROR("missing xInnerPropertySet in WrappedNumberFormatProperty::getPropertyValue");
+ return getPropertyDefault(0);
+ }
+ bool bLink = ! xInnerPropertySet->getPropertyValue( C2U("NumberFormat" )).hasValue();
+ return uno::makeAny( bLink );
+}
+
+Any WrappedLinkNumberFormatProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ bool bLink = true;
+ return uno::makeAny( bLink );
+}
+
+//.............................................................................
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx
new file mode 100644
index 000000000000..4d1b9b867840
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedNumberFormatProperty.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedNumberFormatProperty.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART2_WRAPPEDNUMBERFORMATPROPERTY_HXX
+#define CHART2_WRAPPEDNUMBERFORMATPROPERTY_HXX
+
+#include "WrappedDirectStateProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+//.............................................................................
+
+class WrappedLinkNumberFormatProperty;
+
+class WrappedNumberFormatProperty : public WrappedDirectStateProperty
+{
+public:
+ WrappedNumberFormatProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedNumberFormatProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ friend class WrappedLinkNumberFormatProperty;
+private:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable ::com::sun::star::uno::Any m_aOuterValue;
+ WrappedLinkNumberFormatProperty* m_pWrappedLinkNumberFormatProperty;
+};
+
+class WrappedLinkNumberFormatProperty : public WrappedProperty
+{
+public:
+ WrappedLinkNumberFormatProperty( WrappedNumberFormatProperty* pWrappedNumberFormatProperty );
+ virtual ~WrappedLinkNumberFormatProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ friend class WrappedNumberFormatProperty;
+private:
+ WrappedNumberFormatProperty* m_pWrappedNumberFormatProperty;
+};
+
+//.............................................................................
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART2_WRAPPEDNUMBERFORMATPROPERTY_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx
new file mode 100644
index 000000000000..ffbaac3a5eb0
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.cxx
@@ -0,0 +1,514 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedScaleProperty.cxx,v $
+ * $Revision: 1.8 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedScaleProperty.hxx"
+#include "macros.hxx"
+#include "CommonConverters.hxx"
+#include "AxisHelper.hxx"
+#include <com/sun/star/chart2/XAxis.hpp>
+#include <com/sun/star/chart2/ExplicitIncrementData.hpp>
+#include <com/sun/star/chart2/ExplicitScaleData.hpp>
+#include <com/sun/star/chart2/AxisOrientation.hpp>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using namespace ::com::sun::star::chart2;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+WrappedScaleProperty::WrappedScaleProperty( tScaleProperty eScaleProperty
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(OUString(),OUString())
+ , m_spChart2ModelContact( spChart2ModelContact )
+ , m_eScaleProperty( eScaleProperty )
+{
+ switch( m_eScaleProperty )
+ {
+ case SCALE_PROP_MAX:
+ m_aOuterName = C2U("Max");
+ break;
+ case SCALE_PROP_MIN:
+ m_aOuterName = C2U("Min");
+ break;
+ case SCALE_PROP_ORIGIN:
+ m_aOuterName = C2U("Origin");
+ break;
+ case SCALE_PROP_STEPMAIN:
+ m_aOuterName = C2U("StepMain");
+ break;
+ case SCALE_PROP_STEPHELP:
+ m_aOuterName = C2U("StepHelp");
+ break;
+ case SCALE_PROP_STEPHELP_COUNT:
+ m_aOuterName = C2U("StepHelpCount");
+ break;
+ case SCALE_PROP_AUTO_MAX:
+ m_aOuterName = C2U("AutoMax");
+ break;
+ case SCALE_PROP_AUTO_MIN:
+ m_aOuterName = C2U("AutoMin");
+ break;
+ case SCALE_PROP_AUTO_ORIGIN:
+ m_aOuterName = C2U("AutoOrigin");
+ break;
+ case SCALE_PROP_AUTO_STEPMAIN:
+ m_aOuterName = C2U("AutoStepMain");
+ break;
+ case SCALE_PROP_AUTO_STEPHELP:
+ m_aOuterName = C2U("AutoStepHelp");
+ break;
+ case SCALE_PROP_LOGARITHMIC:
+ m_aOuterName = C2U("Logarithmic");
+ break;
+ case SCALE_PROP_REVERSEDIRECTION:
+ m_aOuterName = C2U("ReverseDirection");
+ break;
+ default:
+ OSL_ENSURE(false,"unknown scale property");
+ break;
+ }
+}
+
+WrappedScaleProperty::~WrappedScaleProperty()
+{
+}
+
+//static
+void WrappedScaleProperty::addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_MAX, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_MIN, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_ORIGIN, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_STEPMAIN, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_STEPHELP, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_STEPHELP_COUNT, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_MAX, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_MIN, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_ORIGIN, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_STEPMAIN, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_AUTO_STEPHELP, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_LOGARITHMIC, spChart2ModelContact ) );
+ rList.push_back( new WrappedScaleProperty( SCALE_PROP_REVERSEDIRECTION, spChart2ModelContact ) );
+}
+
+void WrappedScaleProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ setPropertyValue( m_eScaleProperty, rOuterValue, xInnerPropertySet );
+}
+
+Any WrappedScaleProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return getPropertyValue( m_eScaleProperty, xInnerPropertySet );
+}
+
+void WrappedScaleProperty::setPropertyValue( tScaleProperty eScaleProperty, const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ m_aOuterValue = rOuterValue;
+
+ Reference< chart2::XAxis > xAxis( xInnerPropertySet, uno::UNO_QUERY );
+ OSL_ENSURE(xAxis.is(),"need an XAxis");
+ if(!xAxis.is())
+ return;
+
+ bool bSetScaleData = false;
+
+ chart2::ScaleData aScaleData( xAxis->getScaleData() );
+
+ sal_Bool bBool = false;
+ switch( eScaleProperty )
+ {
+ case SCALE_PROP_MAX:
+ {
+ aScaleData.Maximum = rOuterValue;
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_MIN:
+ {
+ aScaleData.Minimum = rOuterValue;
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_STEPMAIN:
+ {
+ aScaleData.IncrementData.Distance = rOuterValue;
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_STEPHELP:
+ {
+ Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
+ if( rSubIncrements.getLength() == 0 )
+ rSubIncrements.realloc( 1 );
+
+ double fStepMain = 0, fStepHelp = 0;
+ if( (rOuterValue >>= fStepHelp) )
+ {
+ if( AxisHelper::isLogarithmic(aScaleData.Scaling) )
+ {
+ sal_Int32 nIntervalCount = static_cast< sal_Int32 >(fStepHelp);
+ rSubIncrements[ 0 ].IntervalCount <<= nIntervalCount;
+ }
+ else if( (fStepHelp != 0.0) &&
+ (aScaleData.IncrementData.Distance >>= fStepMain) )
+ {
+ // approximate interval count
+ sal_Int32 nIntervalCount = static_cast< sal_Int32 >(fStepMain / fStepHelp);
+ rSubIncrements[ 0 ].IntervalCount <<= nIntervalCount;
+ }
+ }
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_STEPHELP_COUNT:
+ {
+ Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
+ if( rSubIncrements.getLength() == 0 )
+ rSubIncrements.realloc( 1 );
+ sal_Int32 nIntervalCount=0;
+ if( rOuterValue>>=nIntervalCount )
+ rSubIncrements[ 0 ].IntervalCount <<= nIntervalCount;
+ else
+ rSubIncrements[ 0 ].IntervalCount = Any();
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_AUTO_MAX:
+ {
+ if( (rOuterValue >>= bBool) && bBool )
+ aScaleData.Maximum = Any();
+ else
+ aScaleData.Maximum = getPropertyValue( SCALE_PROP_MAX, xInnerPropertySet );
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_AUTO_MIN:
+ {
+ if( (rOuterValue >>= bBool) && bBool )
+ aScaleData.Minimum = Any();
+ else
+ aScaleData.Minimum = getPropertyValue( SCALE_PROP_MIN, xInnerPropertySet );
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_AUTO_STEPMAIN:
+ {
+ if( (rOuterValue >>= bBool) && bBool )
+ aScaleData.IncrementData.Distance = Any();
+ else
+ aScaleData.IncrementData.Distance = getPropertyValue( SCALE_PROP_STEPMAIN, xInnerPropertySet );
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_AUTO_STEPHELP:
+ {
+ Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
+ if( rSubIncrements.getLength() == 0 )
+ rSubIncrements.realloc( 1 );
+
+ if( (rOuterValue >>= bBool) && bBool )
+ rSubIncrements[ 0 ].IntervalCount = Any();
+ else
+ rSubIncrements[ 0 ].IntervalCount = getPropertyValue( SCALE_PROP_STEPHELP_COUNT, xInnerPropertySet );
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_ORIGIN:
+ {
+ aScaleData.Origin = rOuterValue;
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_AUTO_ORIGIN:
+ {
+ if( (rOuterValue >>= bBool) && bBool )
+ aScaleData.Origin = Any();
+ else
+ aScaleData.Origin = getPropertyValue( SCALE_PROP_ORIGIN, xInnerPropertySet );
+ bSetScaleData = true;
+ break;
+ }
+ case SCALE_PROP_LOGARITHMIC:
+ {
+ if( rOuterValue >>= bBool )
+ {
+ bool bWasLogarithm = AxisHelper::isLogarithmic( aScaleData.Scaling );
+
+ // safe comparison between sal_Bool and bool
+ if( (!bBool) != (!bWasLogarithm) )
+ {
+ if( bBool )
+ aScaleData.Scaling = AxisHelper::createLogarithmicScaling( 10.0 );
+ else
+ aScaleData.Scaling = 0;
+ bSetScaleData = true;
+ }
+ }
+ break;
+ }
+ case SCALE_PROP_REVERSEDIRECTION:
+ {
+ if( rOuterValue >>= bBool )
+ {
+ bool bWasReverse = ( AxisOrientation_REVERSE == aScaleData.Orientation );
+ if( (!bBool) != (!bWasReverse) ) // safe comparison between sal_Bool and bool
+ {
+ aScaleData.Orientation = bBool ? AxisOrientation_REVERSE : AxisOrientation_MATHEMATICAL;
+ bSetScaleData = true;
+ }
+ }
+ break;
+ }
+ default:
+ {
+ OSL_ENSURE(false,"unknown scale property");
+ break;
+ }
+ }
+
+ if( bSetScaleData )
+ xAxis->setScaleData( aScaleData );
+}
+
+Any WrappedScaleProperty::getPropertyValue( tScaleProperty eScaleProperty, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet( m_aOuterValue );
+
+ Reference< chart2::XAxis > xAxis( xInnerPropertySet, uno::UNO_QUERY );
+ OSL_ENSURE(xAxis.is(),"need an XAxis");
+ if(!xAxis.is())
+ return aRet;
+
+ chart2::ScaleData aScaleData( xAxis->getScaleData() );
+
+ chart2::ExplicitScaleData aExplicitScale;
+ chart2::ExplicitIncrementData aExplicitIncrement;
+
+ switch( eScaleProperty )
+ {
+ case SCALE_PROP_MAX:
+ {
+ aRet = aScaleData.Maximum;
+ if( !aRet.hasValue() )
+ {
+ m_spChart2ModelContact->getExplicitValuesForAxis(
+ xAxis, aExplicitScale, aExplicitIncrement );
+ aRet <<= aExplicitScale.Maximum;
+ }
+ break;
+ }
+ case SCALE_PROP_MIN:
+ {
+ aRet = aScaleData.Minimum;
+ if( !aRet.hasValue() )
+ {
+ m_spChart2ModelContact->getExplicitValuesForAxis(
+ xAxis, aExplicitScale, aExplicitIncrement );
+ aRet <<= aExplicitScale.Minimum;
+ }
+ break;
+ }
+
+ case SCALE_PROP_STEPMAIN:
+ {
+ aRet = aScaleData.IncrementData.Distance;
+ if( !aRet.hasValue() )
+ {
+ m_spChart2ModelContact->getExplicitValuesForAxis(
+ xAxis, aExplicitScale, aExplicitIncrement );
+ aRet <<= aExplicitIncrement.Distance;
+ }
+ break;
+ }
+ case SCALE_PROP_STEPHELP:
+ {
+ // todo: evaluate PostEquidistant
+ bool bNeedToCalculateExplicitValues = true;
+
+ bool bLogarithmic( AxisHelper::isLogarithmic(aScaleData.Scaling) );
+ Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
+ if( bLogarithmic )
+ {
+ if( rSubIncrements.getLength() > 0 )
+ {
+ sal_Int32 nIntervalCount = 0;
+ rSubIncrements[ 0 ].IntervalCount >>= nIntervalCount;
+ aRet = uno::makeAny( double(nIntervalCount) );
+ bNeedToCalculateExplicitValues = false;
+ }
+ }
+ else if( aScaleData.IncrementData.Distance.hasValue() )
+ {
+ if( rSubIncrements.getLength() > 0 )
+ {
+ double fStepMain = 0;
+ sal_Int32 nIntervalCount = 0;
+ if( (aScaleData.IncrementData.Distance >>= fStepMain) &&
+ (rSubIncrements[ 0 ].IntervalCount >>= nIntervalCount) &&
+ nIntervalCount > 0 )
+ {
+ aRet <<= ( fStepMain / static_cast< double >( nIntervalCount ) );
+ bNeedToCalculateExplicitValues = false;
+ }
+ }
+ else
+ {
+ aRet = aScaleData.IncrementData.Distance;
+ bNeedToCalculateExplicitValues = false;
+ }
+ }
+
+ if( bNeedToCalculateExplicitValues )
+ {
+ m_spChart2ModelContact->getExplicitValuesForAxis(
+ xAxis, aExplicitScale, aExplicitIncrement );
+ if( aExplicitIncrement.SubIncrements.getLength() > 0 &&
+ aExplicitIncrement.SubIncrements[ 0 ].IntervalCount > 0 )
+ {
+ if( bLogarithmic )
+ {
+ if( rSubIncrements.getLength() > 0 )
+ {
+ sal_Int32 nIntervalCount = aExplicitIncrement.SubIncrements[ 0 ].IntervalCount;
+ aRet = uno::makeAny( double(nIntervalCount) );
+ }
+ }
+ else
+ aRet <<= ( aExplicitIncrement.Distance /
+ static_cast< double >(
+ aExplicitIncrement.SubIncrements[ 0 ].IntervalCount ));
+ }
+ else
+ {
+ if( bLogarithmic )
+ aRet <<= 5.0;
+ else
+ aRet <<= aExplicitIncrement.Distance;
+ }
+ }
+ break;
+ }
+ case SCALE_PROP_STEPHELP_COUNT:
+ {
+ sal_Int32 nIntervalCount = 0;
+ bool bNeedToCalculateExplicitValues = true;
+ Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
+ if( rSubIncrements.getLength() > 0 )
+ {
+ if( (rSubIncrements[ 0 ].IntervalCount >>= nIntervalCount) && (nIntervalCount > 0) )
+ bNeedToCalculateExplicitValues = false;
+ }
+ if( bNeedToCalculateExplicitValues )
+ {
+ m_spChart2ModelContact->getExplicitValuesForAxis( xAxis, aExplicitScale, aExplicitIncrement );
+ if( aExplicitIncrement.SubIncrements.getLength() > 0 )
+ nIntervalCount = aExplicitIncrement.SubIncrements[ 0 ].IntervalCount;
+ }
+ aRet = uno::makeAny( nIntervalCount );
+ break;
+ }
+ case SCALE_PROP_AUTO_MAX:
+ {
+ aRet <<= (sal_Bool)( !aScaleData.Maximum.hasValue() );
+ break;
+ }
+ case SCALE_PROP_AUTO_MIN:
+ {
+ aRet <<= (sal_Bool)( !aScaleData.Minimum.hasValue() );
+ break;
+ }
+ case SCALE_PROP_AUTO_STEPMAIN:
+ {
+ aRet <<= (sal_Bool)( !aScaleData.IncrementData.Distance.hasValue() );
+ break;
+ }
+ case SCALE_PROP_AUTO_STEPHELP:
+ {
+ Sequence< chart2::SubIncrement >& rSubIncrements( aScaleData.IncrementData.SubIncrements );
+ if( rSubIncrements.getLength() > 0 )
+ aRet <<= (sal_Bool)( !rSubIncrements[ 0 ].IntervalCount.hasValue() );
+ else
+ aRet <<= sal_True;
+ break;
+ }
+ case SCALE_PROP_ORIGIN:
+ {
+ aRet = aScaleData.Origin;
+ if( !aRet.hasValue() )
+ {
+ m_spChart2ModelContact->getExplicitValuesForAxis(
+ xAxis, aExplicitScale, aExplicitIncrement );
+ aRet <<= aExplicitScale.Origin;
+ }
+ break;
+ }
+ case SCALE_PROP_AUTO_ORIGIN:
+ {
+ aRet <<= !hasDoubleValue(aScaleData.Origin);
+ break;
+ }
+ case SCALE_PROP_LOGARITHMIC:
+ {
+ aRet <<= static_cast< sal_Bool >( AxisHelper::isLogarithmic(aScaleData.Scaling) );
+ break;
+ }
+ case SCALE_PROP_REVERSEDIRECTION:
+ {
+ aRet <<= static_cast< sal_Bool >( AxisOrientation_REVERSE == aScaleData.Orientation );
+ break;
+ }
+ default:
+ {
+ OSL_ENSURE(false,"unknown scale property");
+ break;
+ }
+ }
+
+ return aRet;
+}
+
+} // namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx
new file mode 100644
index 000000000000..e03bf050f72f
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedScaleProperty.hxx
@@ -0,0 +1,95 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedScaleProperty.hxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_SCALE_PROPERTY_HXX
+#define CHART_WRAPPED_SCALE_PROPERTY_HXX
+
+#include "WrappedProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+class WrappedScaleProperty : public WrappedProperty
+{
+public:
+ enum tScaleProperty
+ {
+ SCALE_PROP_MAX
+ , SCALE_PROP_MIN
+ , SCALE_PROP_ORIGIN
+ , SCALE_PROP_STEPMAIN
+ , SCALE_PROP_STEPHELP //deprecated property
+ , SCALE_PROP_STEPHELP_COUNT
+ , SCALE_PROP_AUTO_MAX
+ , SCALE_PROP_AUTO_MIN
+ , SCALE_PROP_AUTO_ORIGIN
+ , SCALE_PROP_AUTO_STEPMAIN
+ , SCALE_PROP_AUTO_STEPHELP
+ , SCALE_PROP_LOGARITHMIC
+ , SCALE_PROP_REVERSEDIRECTION
+ };
+
+public:
+ WrappedScaleProperty( tScaleProperty eScaleProperty, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedScaleProperty();
+
+ static void addWrappedProperties( std::vector< WrappedProperty* >& rList, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+protected: //methods
+ void setPropertyValue( tScaleProperty eScaleProperty, const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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);
+ ::com::sun::star::uno::Any getPropertyValue( tScaleProperty eScaleProperty, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private: //member
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ tScaleProperty m_eScaleProperty;
+
+ mutable ::com::sun::star::uno::Any m_aOuterValue;
+};
+
+} // namespace wrapper
+} // namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_SCALE_PROPERTY_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx
new file mode 100644
index 000000000000..5a22ae7f184f
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx
@@ -0,0 +1,170 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedScaleTextProperties.cxx,v $
+ * $Revision: 1.1.2.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "precompiled_chart2.hxx"
+
+#include "WrappedScaleTextProperties.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include "macros.hxx"
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+class WrappedScaleTextProperty : public WrappedProperty
+{
+public:
+ WrappedScaleTextProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedScaleTextProperty();
+
+ virtual void setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual Any getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual Any getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+
+private:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+};
+
+WrappedScaleTextProperty::WrappedScaleTextProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : ::chart::WrappedProperty( C2U( "ScaleText" ), rtl::OUString() )
+ , m_spChart2ModelContact( spChart2ModelContact )
+{
+}
+
+WrappedScaleTextProperty::~WrappedScaleTextProperty()
+{
+}
+
+void WrappedScaleTextProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ static const OUString aRefSizeName( RTL_CONSTASCII_USTRINGPARAM("ReferencePageSize") );
+
+ if( xInnerPropertySet.is() )
+ {
+ bool bNewValue = false;
+ if( ! (rOuterValue >>= bNewValue) )
+ {
+ if( rOuterValue.hasValue() )
+ throw lang::IllegalArgumentException( C2U("Property ScaleText requires value of type boolean"), 0, 0 );
+ }
+
+ try
+ {
+ if( bNewValue )
+ {
+ awt::Size aRefSize( m_spChart2ModelContact->GetPageSize() );
+ xInnerPropertySet->setPropertyValue( aRefSizeName, uno::makeAny( aRefSize ) );
+ }
+ else
+ xInnerPropertySet->setPropertyValue( aRefSizeName, Any() );
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+}
+
+Any WrappedScaleTextProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ static const OUString aRefSizeName( RTL_CONSTASCII_USTRINGPARAM("ReferencePageSize") );
+
+ Any aRet( getPropertyDefault( Reference< beans::XPropertyState >( xInnerPropertySet, uno::UNO_QUERY ) ) );
+ if( xInnerPropertySet.is() )
+ {
+ if( xInnerPropertySet->getPropertyValue( aRefSizeName ).hasValue() )
+ aRet <<= true;
+ else
+ aRet <<= false;
+ }
+
+ return aRet;
+}
+
+Any WrappedScaleTextProperty::getPropertyDefault( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ Any aRet;
+ aRet <<= false;
+ return aRet;
+}
+
+namespace
+{
+enum
+{
+ PROP_CHART_SCALE_TEXT = FAST_PROPERTY_ID_START_SCALE_TEXT_PROP
+};
+
+}//anonymous namespace
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//static
+void WrappedScaleTextProperties::addProperties( ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "ScaleText" ),
+ PROP_CHART_SCALE_TEXT,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::MAYBEVOID
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void WrappedScaleTextProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ rList.push_back( new WrappedScaleTextProperty( spChart2ModelContact ) );
+}
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.hxx
new file mode 100644
index 000000000000..433a91254bcc
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedScaleTextProperties.hxx,v $
+ * $Revision: 1.1.2.2 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef CHART_WRAPPED_SCALETEXT_PROPERTIES_HXX
+#define CHART_WRAPPED_SCALETEXT_PROPERTIES_HXX
+
+#include "WrappedProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+class WrappedScaleTextProperties
+{
+public:
+ static void addProperties( ::std::vector< ::com::sun::star::beans::Property >& rOutProperties );
+ static void addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx
new file mode 100644
index 000000000000..e5f45408217e
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.cxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedSceneProperty.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedSceneProperty.hxx"
+#include "macros.hxx"
+#include "DiagramHelper.hxx"
+#include "servicenames_charttypes.hxx"
+#include "BaseGFXHelper.hxx"
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+//static
+void WrappedSceneProperty::addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ rList.push_back( new WrappedD3DTransformMatrixProperty( spChart2ModelContact ) );
+}
+
+//----------------------------------------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------
+
+WrappedD3DTransformMatrixProperty::WrappedD3DTransformMatrixProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(C2U("D3DTransformMatrix"),C2U("D3DTransformMatrix"))
+ , m_spChart2ModelContact( spChart2ModelContact )
+{
+}
+
+WrappedD3DTransformMatrixProperty::~WrappedD3DTransformMatrixProperty()
+{
+}
+
+void WrappedD3DTransformMatrixProperty::setPropertyValue( const Any& rOuterValue, const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, beans::PropertyVetoException, lang::IllegalArgumentException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( DiagramHelper::isPieOrDonutChart( m_spChart2ModelContact->getChart2Diagram() ) )
+ {
+ drawing::HomogenMatrix aHM;
+ if( rOuterValue >>= aHM )
+ {
+ ::basegfx::B3DTuple aRotation( BaseGFXHelper::GetRotationFromMatrix(
+ BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aHM ) ) );
+
+ ::basegfx::B3DHomMatrix aMatrix;
+ aMatrix.rotate( aRotation.getX(), aRotation.getY(), aRotation.getZ() );
+ ::basegfx::B3DHomMatrix aObjectMatrix;
+ ::basegfx::B3DHomMatrix aNewMatrix = aMatrix*aObjectMatrix;
+
+ aHM = BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aNewMatrix);
+
+ WrappedProperty::setPropertyValue( uno::makeAny(aHM), xInnerPropertySet );
+ return;
+ }
+ }
+
+ WrappedProperty::setPropertyValue( rOuterValue, xInnerPropertySet );
+}
+
+Any WrappedD3DTransformMatrixProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ if( DiagramHelper::isPieOrDonutChart( m_spChart2ModelContact->getChart2Diagram() ) )
+ {
+ uno::Any aAMatrix( WrappedProperty::getPropertyValue( xInnerPropertySet ) );
+ drawing::HomogenMatrix aHM;
+ if( aAMatrix >>= aHM )
+ {
+ ::basegfx::B3DTuple aRotation( BaseGFXHelper::GetRotationFromMatrix(
+ BaseGFXHelper::HomogenMatrixToB3DHomMatrix( aHM ) ) );
+
+ ::basegfx::B3DHomMatrix aMatrix;
+ aMatrix.rotate( aRotation.getX(), aRotation.getY(), aRotation.getZ() );
+ ::basegfx::B3DHomMatrix aObjectMatrix;
+ ::basegfx::B3DHomMatrix aNewMatrix = aMatrix*aObjectMatrix;
+
+ aHM = BaseGFXHelper::B3DHomMatrixToHomogenMatrix(aNewMatrix);
+
+ return uno::makeAny(aHM);
+ }
+ }
+
+ return WrappedProperty::getPropertyValue( xInnerPropertySet );
+}
+
+Any WrappedD3DTransformMatrixProperty::getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ return WrappedProperty::getPropertyDefault( xInnerPropertyState );
+}
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx
new file mode 100644
index 000000000000..520524e7c4d3
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSceneProperty.hxx
@@ -0,0 +1,85 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedSceneProperty.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_SCENE_PROPERTY_HXX
+#define CHART_WRAPPED_SCENE_PROPERTY_HXX
+
+#include "WrappedProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+class WrappedSceneProperty
+{
+public:
+ static void addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+};
+
+//----------------------------------------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------
+//----------------------------------------------------------------------------------------------------------------------
+
+class WrappedD3DTransformMatrixProperty : public WrappedProperty
+{
+public:
+ WrappedD3DTransformMatrixProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedD3DTransformMatrixProperty();
+
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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 getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+private:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_SCENE_PROPERTY_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.cxx
new file mode 100644
index 000000000000..2cf5a5406dad
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.cxx
@@ -0,0 +1,73 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedSeriesAreaOrLineProperty.cxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedSeriesAreaOrLineProperty.hxx"
+#include "DataSeriesPointWrapper.hxx"
+#include "macros.hxx"
+
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+WrappedSeriesAreaOrLineProperty::WrappedSeriesAreaOrLineProperty(
+ const rtl::OUString& rOuterName
+ , const rtl::OUString& rInnerAreaTypeName
+ , const rtl::OUString& rInnerLineTypeName
+ , DataSeriesPointWrapper* pDataSeriesPointWrapper )
+ : WrappedProperty( rOuterName, C2U( "" ) )
+ , m_pDataSeriesPointWrapper( pDataSeriesPointWrapper )
+ , m_aInnerAreaTypeName( rInnerAreaTypeName )
+ , m_aInnerLineTypeName( rInnerLineTypeName )
+{
+}
+WrappedSeriesAreaOrLineProperty::~WrappedSeriesAreaOrLineProperty()
+{
+}
+
+//virtual
+::rtl::OUString WrappedSeriesAreaOrLineProperty::getInnerName() const
+{
+ if( m_pDataSeriesPointWrapper && !m_pDataSeriesPointWrapper->isSupportingAreaProperties() )
+ return m_aInnerLineTypeName;
+ return m_aInnerAreaTypeName;
+}
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.hxx
new file mode 100644
index 000000000000..8212e6c75938
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSeriesAreaOrLineProperty.hxx
@@ -0,0 +1,63 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedSeriesAreaOrLineProperty.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_SERIES_AREA_OR_LINE_PROPERTY_HXX
+#define CHART_WRAPPED_SERIES_AREA_OR_LINE_PROPERTY_HXX
+
+#include "WrappedProperty.hxx"
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+class DataSeriesPointWrapper;
+class WrappedSeriesAreaOrLineProperty : public WrappedProperty
+{
+public:
+ WrappedSeriesAreaOrLineProperty( const ::rtl::OUString& rOuterName
+ , const ::rtl::OUString& rInnerAreaTypeName, const ::rtl::OUString& rInnerLineTypeName
+ , DataSeriesPointWrapper* pDataSeriesPointWrapper );
+ virtual ~WrappedSeriesAreaOrLineProperty();
+
+ virtual ::rtl::OUString getInnerName() const;
+
+protected:
+ DataSeriesPointWrapper* m_pDataSeriesPointWrapper;
+ ::rtl::OUString m_aInnerAreaTypeName;
+ ::rtl::OUString m_aInnerLineTypeName;
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_SERIES_AREA_OR_LINE_PROPERTY_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx
new file mode 100644
index 000000000000..370d58eb6302
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSeriesOrDiagramProperty.hxx
@@ -0,0 +1,192 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedSeriesOrDiagramProperty.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_SERIES_OR_DIAGRAM_PROPERTY_HXX
+#define CHART_WRAPPED_SERIES_OR_DIAGRAM_PROPERTY_HXX
+
+#include "WrappedProperty.hxx"
+#include "Chart2ModelContact.hxx"
+#include "macros.hxx"
+#include "DiagramHelper.hxx"
+#include <com/sun/star/chart2/XDataSeries.hpp>
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+enum tSeriesOrDiagramPropertyType
+{
+ DATA_SERIES,
+ DIAGRAM
+};
+
+//PROPERTYTYPE is the type of the outer property
+
+template< typename PROPERTYTYPE >
+class WrappedSeriesOrDiagramProperty : public WrappedProperty
+{
+public:
+ virtual PROPERTYTYPE getValueFromSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesPropertySet ) const =0;
+ virtual void setValueToSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesPropertySet, PROPERTYTYPE aNewValue ) const =0;
+
+ explicit WrappedSeriesOrDiagramProperty( const ::rtl::OUString& rName, const ::com::sun::star::uno::Any& rDefaulValue
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
+ , tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedProperty(rName,::rtl::OUString())
+ , m_spChart2ModelContact(spChart2ModelContact)
+ , m_aOuterValue(rDefaulValue)
+ , m_aDefaultValue(rDefaulValue)
+ , m_ePropertyType( ePropertyType )
+ {
+ }
+ virtual ~WrappedSeriesOrDiagramProperty() {};
+
+ bool detectInnerValue( PROPERTYTYPE& rValue, bool& rHasAmbiguousValue ) const
+ {
+ bool bHasDetectableInnerValue = false;
+ rHasAmbiguousValue = false;
+ if( m_ePropertyType == DIAGRAM &&
+ m_spChart2ModelContact.get() )
+ {
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > > aSeriesVector(
+ ::chart::DiagramHelper::getDataSeriesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) );
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > >::const_iterator aIter =
+ aSeriesVector.begin();
+ for( ; aIter != aSeriesVector.end(); aIter++ )
+ {
+ PROPERTYTYPE aCurValue = getValueFromSeries( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >::query( *aIter ) );
+ if( !bHasDetectableInnerValue )
+ rValue = aCurValue;
+ else
+ {
+ if( rValue != aCurValue )
+ {
+ rHasAmbiguousValue = true;
+ break;
+ }
+ else
+ rValue = aCurValue;
+ }
+ bHasDetectableInnerValue = true;
+ }
+ }
+ return bHasDetectableInnerValue;
+ }
+ void setInnerValue( PROPERTYTYPE aNewValue ) const
+ {
+ if( m_ePropertyType == DIAGRAM &&
+ m_spChart2ModelContact.get() )
+ {
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > > aSeriesVector(
+ ::chart::DiagramHelper::getDataSeriesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) );
+ ::std::vector< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > >::const_iterator aIter =
+ aSeriesVector.begin();
+ for( ; aIter != aSeriesVector.end(); aIter++ )
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xSeriesPropertySet( *aIter, ::com::sun::star::uno::UNO_QUERY );
+ if( xSeriesPropertySet.is() )
+ {
+ setValueToSeries( xSeriesPropertySet, aNewValue );
+ }
+ }
+ }
+ }
+ virtual void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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)
+ {
+ PROPERTYTYPE aNewValue = PROPERTYTYPE();
+ if( ! (rOuterValue >>= aNewValue) )
+ throw ::com::sun::star::lang::IllegalArgumentException( C2U("statistic property requires different type"), 0, 0 );
+
+ if( m_ePropertyType == DIAGRAM )
+ {
+ m_aOuterValue = rOuterValue;
+
+ bool bHasAmbiguousValue = false;
+ PROPERTYTYPE aOldValue = PROPERTYTYPE();
+ if( detectInnerValue( aOldValue, bHasAmbiguousValue ) )
+ {
+ if( bHasAmbiguousValue || aNewValue != aOldValue )
+ setInnerValue( aNewValue );
+ }
+ }
+ else
+ {
+ setValueToSeries( xInnerPropertySet, aNewValue );
+ }
+ }
+
+ virtual ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ {
+ if( m_ePropertyType == DIAGRAM )
+ {
+ bool bHasAmbiguousValue = false;
+ PROPERTYTYPE aValue;
+ if( detectInnerValue( aValue, bHasAmbiguousValue ) )
+ {
+ if(bHasAmbiguousValue)
+ m_aOuterValue <<= m_aDefaultValue;
+ else
+ m_aOuterValue <<= aValue;
+ }
+ return m_aOuterValue;
+ }
+ else
+ {
+ ::com::sun::star::uno::Any aRet( m_aDefaultValue );
+ aRet <<= getValueFromSeries( xInnerPropertySet );
+ return aRet;
+ }
+ }
+
+ virtual ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& /* xInnerPropertyState */ ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ {
+ return m_aDefaultValue;
+ }
+
+protected:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable ::com::sun::star::uno::Any m_aOuterValue;
+ ::com::sun::star::uno::Any m_aDefaultValue;
+ tSeriesOrDiagramPropertyType m_ePropertyType;
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_SERIES_OR_DIAGRAM_PROPERTY_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
new file mode 100644
index 000000000000..abe16ce64a65
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx
@@ -0,0 +1,290 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedSplineProperties.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedSplineProperties.hxx"
+#include "macros.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include "DiagramHelper.hxx"
+#include <com/sun/star/chart2/CurveStyle.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//PROPERTYTYPE is the type of the outer property
+
+template< typename PROPERTYTYPE >
+class WrappedSplineProperty : public WrappedProperty
+{
+public:
+ explicit WrappedSplineProperty( const ::rtl::OUString& rOuterName, const ::rtl::OUString& rInnerName
+ , const ::com::sun::star::uno::Any& rDefaulValue
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(rOuterName,OUString())
+ , m_spChart2ModelContact(spChart2ModelContact)
+ , m_aOuterValue(rDefaulValue)
+ , m_aDefaultValue(rDefaulValue)
+ , m_aOwnInnerName(rInnerName)
+ {
+ }
+ virtual ~WrappedSplineProperty() {};
+
+ bool detectInnerValue( PROPERTYTYPE& rValue, bool& rHasAmbiguousValue ) const
+ {
+ bool bHasDetectableInnerValue = false;
+ rHasAmbiguousValue = false;
+ Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > > aChartTypes(
+ ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) );
+ for( sal_Int32 nN = aChartTypes.getLength(); nN--; )
+ {
+ try
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xChartTypePropertySet( aChartTypes[nN], ::com::sun::star::uno::UNO_QUERY );
+
+ Any aSingleValue = this->convertInnerToOuterValue( xChartTypePropertySet->getPropertyValue(m_aOwnInnerName) );
+ PROPERTYTYPE aCurValue = PROPERTYTYPE();
+ aSingleValue >>= aCurValue;
+ if( !bHasDetectableInnerValue )
+ rValue = aCurValue;
+ else
+ {
+ if( rValue != aCurValue )
+ {
+ rHasAmbiguousValue = true;
+ break;
+ }
+ else
+ rValue = aCurValue;
+ }
+ bHasDetectableInnerValue = true;
+ }
+ catch( uno::Exception & ex )
+ {
+ //spline properties are not supported by all charttypes
+ //in that cases this exception is ok
+ ex.Context.is();//to have debug information without compilation warnings
+ }
+ }
+ return bHasDetectableInnerValue;
+ }
+ void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ 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)
+ {
+ PROPERTYTYPE aNewValue;
+ if( ! (rOuterValue >>= aNewValue) )
+ throw ::com::sun::star::lang::IllegalArgumentException( C2U("spline property requires different type"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+
+ bool bHasAmbiguousValue = false;
+ PROPERTYTYPE aOldValue;
+ if( detectInnerValue( aOldValue, bHasAmbiguousValue ) )
+ {
+ if( bHasAmbiguousValue || aNewValue != aOldValue )
+ {
+ Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > > aChartTypes(
+ ::chart::DiagramHelper::getChartTypesFromDiagram( m_spChart2ModelContact->getChart2Diagram() ) );
+ for( sal_Int32 nN = aChartTypes.getLength(); nN--; )
+ {
+ try
+ {
+ ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xChartTypePropertySet( aChartTypes[nN], ::com::sun::star::uno::UNO_QUERY );
+ if( xChartTypePropertySet.is() )
+ {
+ xChartTypePropertySet->setPropertyValue(m_aOwnInnerName,this->convertOuterToInnerValue(uno::makeAny(aNewValue)));
+ }
+ }
+ catch( uno::Exception & ex )
+ {
+ //spline properties are not supported by all charttypes
+ //in that cases this exception is ok
+ ex.Context.is();//to have debug information without compilation warnings
+ }
+ }
+ }
+ }
+ }
+
+ ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ {
+ bool bHasAmbiguousValue = false;
+ PROPERTYTYPE aValue;
+ if( detectInnerValue( aValue, bHasAmbiguousValue ) )
+ {
+ m_aOuterValue <<= aValue;
+ }
+ return m_aOuterValue;
+ }
+
+ ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+ {
+ return m_aDefaultValue;
+ }
+
+protected:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable ::com::sun::star::uno::Any m_aOuterValue;
+ ::com::sun::star::uno::Any m_aDefaultValue;
+ // this inner name is not set as inner name at the base class
+ const OUString m_aOwnInnerName;
+};
+
+class WrappedSplineTypeProperty : public WrappedSplineProperty< sal_Int32 >
+{
+public:
+ explicit WrappedSplineTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedSplineTypeProperty();
+
+ virtual ::com::sun::star::uno::Any convertInnerToOuterValue( const ::com::sun::star::uno::Any& rInnerValue ) const;
+ virtual ::com::sun::star::uno::Any convertOuterToInnerValue( const ::com::sun::star::uno::Any& rOuterValue ) const;
+};
+
+namespace
+{
+enum
+{
+ //spline properties
+ PROP_CHART_SPLINE_TYPE = FAST_PROPERTY_ID_START_CHART_SPLINE_PROP
+ , PROP_CHART_SPLINE_ORDER
+ , PROP_CHART_SPLINE_RESOLUTION
+};
+
+}//anonymous namespace
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//static
+void WrappedSplineProperties::addProperties( ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "SplineType" ),
+ PROP_CHART_SPLINE_TYPE,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "SplineOrder" ),
+ PROP_CHART_SPLINE_ORDER,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "SplineResolution" ),
+ PROP_CHART_SPLINE_RESOLUTION,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void WrappedSplineProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ rList.push_back( new WrappedSplineTypeProperty( spChart2ModelContact ) );
+ rList.push_back( new WrappedSplineProperty<sal_Int32>( C2U("SplineOrder"), C2U("SplineOrder"), uno::makeAny(sal_Int32(2)), spChart2ModelContact ) );
+ rList.push_back( new WrappedSplineProperty<sal_Int32>( C2U("SplineResolution"), C2U("CurveResolution"), uno::makeAny(sal_Int32(20)), spChart2ModelContact ) );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+
+WrappedSplineTypeProperty::WrappedSplineTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedSplineProperty<sal_Int32>( C2U("SplineType"), C2U("CurveStyle"), uno::makeAny(sal_Int32(0)), spChart2ModelContact )
+{
+}
+WrappedSplineTypeProperty::~WrappedSplineTypeProperty()
+{
+}
+Any WrappedSplineTypeProperty::convertInnerToOuterValue( const Any& rInnerValue ) const
+{
+ chart2::CurveStyle aInnerValue = chart2::CurveStyle_LINES;
+ rInnerValue >>= aInnerValue;
+
+ sal_Int32 nOuterValue;
+ if( chart2::CurveStyle_CUBIC_SPLINES == aInnerValue )
+ nOuterValue = 1;
+ else if( chart2::CurveStyle_B_SPLINES == aInnerValue )
+ nOuterValue = 2;
+ else
+ nOuterValue = 0;
+
+ return uno::makeAny(nOuterValue);
+}
+Any WrappedSplineTypeProperty::convertOuterToInnerValue( const Any& rOuterValue ) const
+{
+ sal_Int32 nOuterValue=0;
+ rOuterValue >>= nOuterValue;
+
+ chart2::CurveStyle aInnerValue;
+
+ if(1==nOuterValue)
+ aInnerValue = chart2::CurveStyle_CUBIC_SPLINES;
+ else if(2==nOuterValue)
+ aInnerValue = chart2::CurveStyle_B_SPLINES;
+ else
+ aInnerValue = chart2::CurveStyle_LINES;
+
+ return uno::makeAny(aInnerValue);
+}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.hxx
new file mode 100644
index 000000000000..364a74747dfe
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedSplineProperties.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_SPLINE_PROPERTIES_HXX
+#define CHART_WRAPPED_SPLINE_PROPERTIES_HXX
+
+#include "WrappedProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+class WrappedSplineProperties
+{
+public:
+ static void addProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties );
+ static void addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_SPLINE_PROPERTIES_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx
new file mode 100644
index 000000000000..226bfd14bf4d
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx
@@ -0,0 +1,1158 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedStatisticProperties.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedStatisticProperties.hxx"
+#include "WrappedSeriesOrDiagramProperty.hxx"
+#include "macros.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include "RegressionCurveHelper.hxx"
+#include "DiagramHelper.hxx"
+#include "ErrorBar.hxx"
+#include "StatisticsHelper.hxx"
+
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart/ChartErrorCategory.hpp>
+#include <com/sun/star/chart/ErrorBarStyle.hpp>
+#include <com/sun/star/chart/ChartErrorIndicatorType.hpp>
+#include <com/sun/star/chart/ChartRegressionCurveType.hpp>
+#include <com/sun/star/chart2/data/XDataProvider.hpp>
+#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+namespace
+{
+
+Any lcl_getRegressionDefault()
+{
+ Any aRet;
+ aRet <<= ::com::sun::star::chart::ChartRegressionCurveType_NONE;
+ return aRet;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+::com::sun::star::chart::ChartRegressionCurveType lcl_getRegressionCurveType( RegressionCurveHelper::tRegressionType eRegressionType )
+{
+ ::com::sun::star::chart::ChartRegressionCurveType eRet = ::com::sun::star::chart::ChartRegressionCurveType_NONE;
+ switch(eRegressionType)
+ {
+ case RegressionCurveHelper::REGRESSION_TYPE_LINEAR:
+ eRet = ::com::sun::star::chart::ChartRegressionCurveType_LINEAR;
+ break;
+ case RegressionCurveHelper::REGRESSION_TYPE_LOG:
+ eRet = ::com::sun::star::chart::ChartRegressionCurveType_LOGARITHM;
+ break;
+ case RegressionCurveHelper::REGRESSION_TYPE_EXP:
+ eRet = ::com::sun::star::chart::ChartRegressionCurveType_EXPONENTIAL;
+ break;
+ case RegressionCurveHelper::REGRESSION_TYPE_POWER:
+ eRet = ::com::sun::star::chart::ChartRegressionCurveType_POWER;
+ break;
+ default:
+ eRet = ::com::sun::star::chart::ChartRegressionCurveType_NONE;
+ break;
+ }
+ return eRet;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+RegressionCurveHelper::tRegressionType lcl_getRegressionType( ::com::sun::star::chart::ChartRegressionCurveType eRegressionCurveType )
+{
+ RegressionCurveHelper::tRegressionType eRet;
+ switch(eRegressionCurveType)
+ {
+ case ::com::sun::star::chart::ChartRegressionCurveType_LINEAR:
+ eRet = RegressionCurveHelper::REGRESSION_TYPE_LINEAR;
+ break;
+ case ::com::sun::star::chart::ChartRegressionCurveType_LOGARITHM:
+ eRet = RegressionCurveHelper::REGRESSION_TYPE_LOG;
+ break;
+ case ::com::sun::star::chart::ChartRegressionCurveType_EXPONENTIAL:
+ eRet = RegressionCurveHelper::REGRESSION_TYPE_EXP;
+ break;
+ case ::com::sun::star::chart::ChartRegressionCurveType_POLYNOMIAL:
+ case ::com::sun::star::chart::ChartRegressionCurveType_POWER:
+ eRet = RegressionCurveHelper::REGRESSION_TYPE_POWER;
+ break;
+ default:
+ eRet = RegressionCurveHelper::REGRESSION_TYPE_NONE;
+ break;
+ }
+ return eRet;
+}
+
+sal_Int32 lcl_getErrorBarStyle( const uno::Reference< beans::XPropertySet >& xErrorBarProperties )
+{
+ sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
+ if(xErrorBarProperties.is())
+ xErrorBarProperties->getPropertyValue( C2U( "ErrorBarStyle" )) >>= nStyle;
+ return nStyle;
+}
+
+uno::Reference< chart2::data::XDataProvider > lcl_getDataProviderFromContact(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ uno::Reference< chart2::data::XDataProvider > xResult;
+ if( spChart2ModelContact.get())
+ {
+ uno::Reference< chart2::XChartDocument > xChartDoc(
+ spChart2ModelContact->getChart2Document());
+ if( xChartDoc.is())
+ xResult.set( xChartDoc->getDataProvider());
+ }
+ return xResult;
+}
+
+void lcl_ConvertRangeFromXML(
+ ::rtl::OUString & rInOutRange,
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ if( rInOutRange.getLength())
+ {
+ uno::Reference< chart2::data::XRangeXMLConversion > xConverter(
+ lcl_getDataProviderFromContact( spChart2ModelContact ), uno::UNO_QUERY );
+ if( xConverter.is())
+ {
+ ::rtl::OUString aResult = xConverter->convertRangeFromXML( rInOutRange );
+ rInOutRange = aResult;
+ }
+ }
+}
+
+void lcl_ConvertRangeToXML(
+ ::rtl::OUString & rInOutRange,
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ if( rInOutRange.getLength())
+ {
+ uno::Reference< chart2::data::XRangeXMLConversion > xConverter(
+ lcl_getDataProviderFromContact( spChart2ModelContact ), uno::UNO_QUERY );
+ if( xConverter.is())
+ {
+ ::rtl::OUString aResult = xConverter->convertRangeToXML( rInOutRange );
+ rInOutRange = aResult;
+ }
+ }
+}
+
+}//anonymous namespace
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+template< typename PROPERTYTYPE >
+class WrappedStatisticProperty : public WrappedSeriesOrDiagramProperty< PROPERTYTYPE >
+{
+public:
+ explicit WrappedStatisticProperty( const OUString& rName, const Any& rDefaulValue
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
+ , tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedSeriesOrDiagramProperty< PROPERTYTYPE >(rName,rDefaulValue,spChart2ModelContact,ePropertyType)
+ {}
+ virtual ~WrappedStatisticProperty() {};
+
+
+protected:
+ uno::Reference< beans::XPropertySet > getOrCreateErrorBarProperties( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+ {
+ if(!xSeriesPropertySet.is())
+ return 0;
+ uno::Reference< beans::XPropertySet > xErrorBarProperties;
+ xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties;
+ if( !xErrorBarProperties.is() )
+ {
+ // todo: use a valid context
+ xErrorBarProperties = ::chart::createErrorBar( uno::Reference< uno::XComponentContext >() );
+ //default in new and old api are different
+ xErrorBarProperties->setPropertyValue( C2U( "ShowPositiveError" ), uno::makeAny(sal_Bool(sal_False)) );
+ xErrorBarProperties->setPropertyValue( C2U( "ShowNegativeError" ), uno::makeAny(sal_Bool(sal_False)) );
+ xErrorBarProperties->setPropertyValue( C2U( "ErrorBarStyle" ), uno::makeAny(::com::sun::star::chart::ErrorBarStyle::NONE) );
+ xSeriesPropertySet->setPropertyValue( C2U( "ErrorBarY" ), uno::makeAny( xErrorBarProperties ) );
+ }
+ return xErrorBarProperties;
+ }
+
+};
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_CONST_ERROR_LOW
+class WrappedConstantErrorLowProperty : public WrappedStatisticProperty< double >
+{
+public:
+ virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const;
+
+ explicit WrappedConstantErrorLowProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedConstantErrorLowProperty();
+
+private:
+ mutable Any m_aOuterValue;
+};
+
+WrappedConstantErrorLowProperty::WrappedConstantErrorLowProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< double >( C2U("ConstantErrorLow")
+ , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedConstantErrorLowProperty::~WrappedConstantErrorLowProperty()
+{
+}
+
+double WrappedConstantErrorLowProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ double aRet = 0.0;
+ m_aDefaultValue >>= aRet;
+ uno::Reference< beans::XPropertySet > xErrorBarProperties;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
+ {
+ if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
+ xErrorBarProperties->getPropertyValue( C2U( "NegativeError" )) >>= aRet;
+ else
+ m_aOuterValue >>= aRet;
+ }
+ return aRet;
+}
+void WrappedConstantErrorLowProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const
+{
+ uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
+ if( xErrorBarProperties.is() )
+ {
+ m_aOuterValue = uno::makeAny( aNewValue );
+ if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
+ {
+ xErrorBarProperties->setPropertyValue( C2U( "NegativeError" ), m_aOuterValue );
+ }
+ }
+}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_CONST_ERROR_HIGH
+class WrappedConstantErrorHighProperty : public WrappedStatisticProperty< double >
+{
+public:
+ virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const;
+
+ explicit WrappedConstantErrorHighProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedConstantErrorHighProperty();
+
+private:
+ mutable Any m_aOuterValue;
+};
+
+WrappedConstantErrorHighProperty::WrappedConstantErrorHighProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< double >( C2U("ConstantErrorHigh")
+ , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedConstantErrorHighProperty::~WrappedConstantErrorHighProperty()
+{
+}
+
+double WrappedConstantErrorHighProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ double aRet = 0.0;
+ m_aDefaultValue >>= aRet;
+ uno::Reference< beans::XPropertySet > xErrorBarProperties;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
+ {
+ if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
+ xErrorBarProperties->getPropertyValue( C2U( "PositiveError" )) >>= aRet;
+ else
+ m_aOuterValue >>= aRet;
+ }
+ return aRet;
+}
+void WrappedConstantErrorHighProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const
+{
+ uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
+ if( xErrorBarProperties.is() )
+ {
+ m_aOuterValue = uno::makeAny( aNewValue );
+ if( ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE == lcl_getErrorBarStyle( xErrorBarProperties ) )
+ {
+ xErrorBarProperties->setPropertyValue( C2U( "PositiveError" ), m_aOuterValue );
+ }
+ }
+}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_MEAN_VALUE
+class WrappedMeanValueProperty : public WrappedStatisticProperty< sal_Bool >
+{
+public:
+ virtual sal_Bool getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Bool aNewValue ) const;
+
+ explicit WrappedMeanValueProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedMeanValueProperty();
+};
+
+WrappedMeanValueProperty::WrappedMeanValueProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< sal_Bool >( C2U("MeanValue"), uno::makeAny( sal_False ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedMeanValueProperty::~WrappedMeanValueProperty()
+{
+}
+
+sal_Bool WrappedMeanValueProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ sal_Bool bRet = sal_False;
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
+ if( xRegCnt.is() )
+ bRet = RegressionCurveHelper::hasMeanValueLine( xRegCnt );
+ return bRet;
+}
+void WrappedMeanValueProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Bool aNewValue ) const
+{
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
+ if( xRegCnt.is() )
+ {
+ if(aNewValue)
+ RegressionCurveHelper::addMeanValueLine( xRegCnt, 0, 0 );
+ else
+ RegressionCurveHelper::removeMeanValueLine( xRegCnt );
+ }
+}
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_ERROR_CATEGORY
+// deprecated, replaced by ErrorBarStyle
+class WrappedErrorCategoryProperty : public WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorCategory >
+{
+public:
+ virtual ::com::sun::star::chart::ChartErrorCategory getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartErrorCategory aNewValue ) const;
+
+ explicit WrappedErrorCategoryProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedErrorCategoryProperty();
+};
+
+WrappedErrorCategoryProperty::WrappedErrorCategoryProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorCategory >( C2U("ErrorCategory")
+ , uno::makeAny( ::com::sun::star::chart::ChartErrorCategory_NONE ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedErrorCategoryProperty::~WrappedErrorCategoryProperty()
+{
+}
+
+::com::sun::star::chart::ChartErrorCategory WrappedErrorCategoryProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ ::com::sun::star::chart::ChartErrorCategory aRet = ::com::sun::star::chart::ChartErrorCategory_NONE;
+ m_aDefaultValue >>= aRet;
+ uno::Reference< beans::XPropertySet > xErrorBarProperties;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
+ {
+ sal_Int32 nStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
+ xErrorBarProperties->getPropertyValue( C2U( "ErrorBarStyle" )) >>= nStyle;
+ switch(nStyle)
+ {
+ case ::com::sun::star::chart::ErrorBarStyle::NONE:
+ aRet = ::com::sun::star::chart::ChartErrorCategory_NONE;
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::VARIANCE:
+ aRet = ::com::sun::star::chart::ChartErrorCategory_VARIANCE;
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION:
+ aRet = ::com::sun::star::chart::ChartErrorCategory_STANDARD_DEVIATION;
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE:
+ aRet = ::com::sun::star::chart::ChartErrorCategory_CONSTANT_VALUE;
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::RELATIVE:
+ aRet = ::com::sun::star::chart::ChartErrorCategory_PERCENT;
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN:
+ aRet = ::com::sun::star::chart::ChartErrorCategory_ERROR_MARGIN;
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::STANDARD_ERROR:
+ break;
+ case ::com::sun::star::chart::ErrorBarStyle::FROM_DATA:
+ break;
+ default:
+ break;
+ }
+ }
+ return aRet;
+}
+void WrappedErrorCategoryProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartErrorCategory aNewValue ) const
+{
+ if( !xSeriesPropertySet.is() )
+ return;
+
+ uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
+ if( xErrorBarProperties.is() )
+ {
+ sal_Int32 nNewStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
+ switch(aNewValue)
+ {
+ case ::com::sun::star::chart::ChartErrorCategory_NONE:
+ nNewStyle = ::com::sun::star::chart::ErrorBarStyle::NONE;
+ break;
+ case ::com::sun::star::chart::ChartErrorCategory_VARIANCE:
+ nNewStyle = ::com::sun::star::chart::ErrorBarStyle::VARIANCE;
+ break;
+ case ::com::sun::star::chart::ChartErrorCategory_STANDARD_DEVIATION:
+ nNewStyle = ::com::sun::star::chart::ErrorBarStyle::STANDARD_DEVIATION;
+ break;
+ case ::com::sun::star::chart::ChartErrorCategory_CONSTANT_VALUE:
+ nNewStyle = ::com::sun::star::chart::ErrorBarStyle::ABSOLUTE;
+ break;
+ case ::com::sun::star::chart::ChartErrorCategory_PERCENT:
+ nNewStyle = ::com::sun::star::chart::ErrorBarStyle::RELATIVE;
+ break;
+ case ::com::sun::star::chart::ChartErrorCategory_ERROR_MARGIN:
+ nNewStyle = ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN;
+ break;
+ default:
+ break;
+ }
+ xErrorBarProperties->setPropertyValue( C2U( "ErrorBarStyle" ), uno::makeAny(nNewStyle) );
+ }
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_PERCENT_ERROR
+class WrappedPercentageErrorProperty : public WrappedStatisticProperty< double >
+{
+public:
+ virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const;
+
+ explicit WrappedPercentageErrorProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedPercentageErrorProperty();
+
+private:
+ mutable Any m_aOuterValue;
+};
+
+WrappedPercentageErrorProperty::WrappedPercentageErrorProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< double >( C2U("PercentageError")
+ , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedPercentageErrorProperty::~WrappedPercentageErrorProperty()
+{
+}
+
+double WrappedPercentageErrorProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ double aRet = 0.0;
+ m_aDefaultValue >>= aRet;
+ uno::Reference< beans::XPropertySet > xErrorBarProperties;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
+ {
+ if( ::com::sun::star::chart::ErrorBarStyle::RELATIVE == lcl_getErrorBarStyle( xErrorBarProperties ) )
+ xErrorBarProperties->getPropertyValue( C2U( "PositiveError" )) >>= aRet;
+ else
+ m_aOuterValue >>= aRet;
+ }
+ return aRet;
+}
+void WrappedPercentageErrorProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const
+{
+ uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
+ if( xErrorBarProperties.is() )
+ {
+ m_aOuterValue = uno::makeAny( aNewValue );
+ if( ::com::sun::star::chart::ErrorBarStyle::RELATIVE == lcl_getErrorBarStyle( xErrorBarProperties ) )
+ {
+ xErrorBarProperties->setPropertyValue( C2U( "PositiveError" ), m_aOuterValue );
+ xErrorBarProperties->setPropertyValue( C2U( "NegativeError" ), m_aOuterValue );
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_ERROR_MARGIN
+class WrappedErrorMarginProperty : public WrappedStatisticProperty< double >
+{
+public:
+ virtual double getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const;
+
+ explicit WrappedErrorMarginProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedErrorMarginProperty();
+
+private:
+ mutable Any m_aOuterValue;
+};
+
+WrappedErrorMarginProperty::WrappedErrorMarginProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< double >( C2U("ErrorMargin")
+ , uno::makeAny( double(0.0) ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedErrorMarginProperty::~WrappedErrorMarginProperty()
+{
+}
+
+double WrappedErrorMarginProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ double aRet = 0.0;
+ m_aDefaultValue >>= aRet;
+ uno::Reference< beans::XPropertySet > xErrorBarProperties;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
+ {
+ if( ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN == lcl_getErrorBarStyle( xErrorBarProperties ) )
+ xErrorBarProperties->getPropertyValue( C2U( "PositiveError" )) >>= aRet;
+ else
+ m_aOuterValue >>= aRet;
+ }
+ return aRet;
+}
+void WrappedErrorMarginProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, double aNewValue ) const
+{
+ uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
+ if( xErrorBarProperties.is() )
+ {
+ m_aOuterValue = uno::makeAny( aNewValue );
+ if( ::com::sun::star::chart::ErrorBarStyle::ERROR_MARGIN == lcl_getErrorBarStyle( xErrorBarProperties ) )
+ {
+ xErrorBarProperties->setPropertyValue( C2U( "PositiveError" ), m_aOuterValue );
+ xErrorBarProperties->setPropertyValue( C2U( "NegativeError" ), m_aOuterValue );
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_ERROR_INDICATOR
+class WrappedErrorIndicatorProperty : public WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorIndicatorType >
+{
+public:
+ virtual ::com::sun::star::chart::ChartErrorIndicatorType getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartErrorIndicatorType aNewValue ) const;
+
+ explicit WrappedErrorIndicatorProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedErrorIndicatorProperty();
+};
+
+WrappedErrorIndicatorProperty::WrappedErrorIndicatorProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< ::com::sun::star::chart::ChartErrorIndicatorType >( C2U("ErrorIndicator")
+ , uno::makeAny( ::com::sun::star::chart::ChartErrorIndicatorType_NONE ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedErrorIndicatorProperty::~WrappedErrorIndicatorProperty()
+{
+}
+
+::com::sun::star::chart::ChartErrorIndicatorType WrappedErrorIndicatorProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ ::com::sun::star::chart::ChartErrorIndicatorType aRet = ::com::sun::star::chart::ChartErrorIndicatorType_NONE;
+ m_aDefaultValue >>= aRet;
+ uno::Reference< beans::XPropertySet > xErrorBarProperties;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
+ {
+ sal_Bool bPositive = sal_False;
+ sal_Bool bNegative = sal_False;
+ xErrorBarProperties->getPropertyValue( C2U( "ShowPositiveError" )) >>= bPositive;
+ xErrorBarProperties->getPropertyValue( C2U( "ShowNegativeError" )) >>= bNegative;
+
+ if( bPositive && bNegative )
+ aRet = ::com::sun::star::chart::ChartErrorIndicatorType_TOP_AND_BOTTOM;
+ else if( bPositive && !bNegative )
+ aRet = ::com::sun::star::chart::ChartErrorIndicatorType_UPPER;
+ else if( !bPositive && bNegative )
+ aRet = ::com::sun::star::chart::ChartErrorIndicatorType_LOWER;
+ }
+ return aRet;
+}
+void WrappedErrorIndicatorProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartErrorIndicatorType aNewValue ) const
+{
+ uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
+ if( xErrorBarProperties.is() )
+ {
+ sal_Bool bPositive = sal_False;
+ sal_Bool bNegative = sal_False;
+ switch( aNewValue )
+ {
+ case ::com::sun::star::chart::ChartErrorIndicatorType_TOP_AND_BOTTOM:
+ bPositive = sal_True;
+ bNegative = sal_True;
+ break;
+ case ::com::sun::star::chart::ChartErrorIndicatorType_UPPER:
+ bPositive = sal_True;
+ break;
+ case ::com::sun::star::chart::ChartErrorIndicatorType_LOWER:
+ bNegative = sal_True;
+ break;
+ default:
+ break;
+ }
+
+ xErrorBarProperties->setPropertyValue( C2U( "ShowPositiveError" ), uno::makeAny(bPositive) );
+ xErrorBarProperties->setPropertyValue( C2U( "ShowNegativeError" ), uno::makeAny(bNegative) );
+ }
+}
+
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_ERROR_BAR_STYLE
+// this is the new constant group that replaces the deprecated enum ChartErrorCategory
+class WrappedErrorBarStyleProperty : public WrappedStatisticProperty< sal_Int32 >
+{
+public:
+ virtual sal_Int32 getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Int32 nNewValue ) const;
+
+ explicit WrappedErrorBarStyleProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact1,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedErrorBarStyleProperty();
+};
+
+WrappedErrorBarStyleProperty::WrappedErrorBarStyleProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< sal_Int32 >( C2U("ErrorBarStyle")
+ , uno::makeAny( ::com::sun::star::chart::ErrorBarStyle::NONE ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedErrorBarStyleProperty::~WrappedErrorBarStyleProperty()
+{
+}
+
+sal_Int32 WrappedErrorBarStyleProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ sal_Int32 nRet = ::com::sun::star::chart::ErrorBarStyle::NONE;
+ m_aDefaultValue >>= nRet;
+ uno::Reference< beans::XPropertySet > xErrorBarProperties;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarProperties ) && xErrorBarProperties.is())
+ {
+ xErrorBarProperties->getPropertyValue( C2U( "ErrorBarStyle" )) >>= nRet;
+ }
+ return nRet;
+}
+void WrappedErrorBarStyleProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Int32 nNewValue ) const
+{
+ if( !xSeriesPropertySet.is() )
+ return;
+
+ uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
+ if( xErrorBarProperties.is() )
+ {
+ xErrorBarProperties->setPropertyValue( C2U( "ErrorBarStyle" ), uno::makeAny( nNewValue ));
+ }
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE
+class WrappedErrorBarRangePositiveProperty : public WrappedStatisticProperty< OUString >
+{
+public:
+ virtual OUString getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, OUString aNewValue ) const;
+
+ explicit WrappedErrorBarRangePositiveProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedErrorBarRangePositiveProperty();
+
+private:
+ mutable Any m_aOuterValue;
+};
+
+WrappedErrorBarRangePositiveProperty::WrappedErrorBarRangePositiveProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< OUString >( C2U("ErrorBarRangePositive")
+ , uno::makeAny( OUString() ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedErrorBarRangePositiveProperty::~WrappedErrorBarRangePositiveProperty()
+{
+}
+
+OUString WrappedErrorBarRangePositiveProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ OUString aRet;
+ m_aDefaultValue >>= aRet;
+ uno::Reference< chart2::data::XDataSource > xErrorBarDataSource;
+ if( xSeriesPropertySet.is() &&
+ ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarDataSource ) &&
+ xErrorBarDataSource.is())
+ {
+ uno::Reference< chart2::data::XDataSequence > xSeq(
+ StatisticsHelper::getErrorDataSequenceFromDataSource(
+ xErrorBarDataSource, true /* positive */, true /* y-error */ ));
+ if( xSeq.is())
+ aRet = xSeq->getSourceRangeRepresentation();
+ else
+ m_aOuterValue >>= aRet;
+ }
+ lcl_ConvertRangeToXML( aRet, m_spChart2ModelContact );
+ return aRet;
+}
+
+void WrappedErrorBarRangePositiveProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, OUString aNewValue ) const
+{
+ uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
+ if( xErrorBarProperties.is() )
+ {
+ uno::Reference< chart2::data::XDataProvider > xDataProvider(
+ lcl_getDataProviderFromContact( m_spChart2ModelContact ));
+ uno::Reference< chart2::data::XDataSource > xDataSource( xErrorBarProperties, uno::UNO_QUERY );
+ if( xDataSource.is() && xDataProvider.is())
+ {
+ OUString aXMLRange( aNewValue );
+ lcl_ConvertRangeFromXML( aNewValue, m_spChart2ModelContact );
+ StatisticsHelper::setErrorDataSequence(
+ xDataSource, xDataProvider, aNewValue, true /* positive */, true /* y-error */, &aXMLRange );
+ m_aOuterValue <<= aNewValue;
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE
+class WrappedErrorBarRangeNegativeProperty : public WrappedStatisticProperty< OUString >
+{
+public:
+ virtual OUString getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, OUString aNewValue ) const;
+
+ explicit WrappedErrorBarRangeNegativeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedErrorBarRangeNegativeProperty();
+
+private:
+ mutable Any m_aOuterValue;
+};
+
+WrappedErrorBarRangeNegativeProperty::WrappedErrorBarRangeNegativeProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< OUString >( C2U("ErrorBarRangeNegative")
+ , uno::makeAny( OUString() ), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedErrorBarRangeNegativeProperty::~WrappedErrorBarRangeNegativeProperty()
+{
+}
+
+OUString WrappedErrorBarRangeNegativeProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ OUString aRet;
+ m_aDefaultValue >>= aRet;
+ uno::Reference< chart2::data::XDataSource > xErrorBarDataSource;
+ if( xSeriesPropertySet.is() &&
+ ( xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xErrorBarDataSource ) &&
+ xErrorBarDataSource.is())
+ {
+ uno::Reference< chart2::data::XDataSequence > xSeq(
+ StatisticsHelper::getErrorDataSequenceFromDataSource(
+ xErrorBarDataSource, false /* positive */, true /* y-error */ ));
+ if( xSeq.is())
+ aRet = xSeq->getSourceRangeRepresentation();
+ else
+ m_aOuterValue >>= aRet;
+ }
+ lcl_ConvertRangeToXML( aRet, m_spChart2ModelContact );
+ return aRet;
+}
+
+void WrappedErrorBarRangeNegativeProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, OUString aNewValue ) const
+{
+ uno::Reference< beans::XPropertySet > xErrorBarProperties( getOrCreateErrorBarProperties(xSeriesPropertySet) );
+ if( xErrorBarProperties.is() )
+ {
+ uno::Reference< chart2::data::XDataProvider > xDataProvider(
+ lcl_getDataProviderFromContact( m_spChart2ModelContact ));
+ uno::Reference< chart2::data::XDataSource > xDataSource( xErrorBarProperties, uno::UNO_QUERY );
+ if( xDataSource.is() && xDataProvider.is())
+ {
+ OUString aXMLRange( aNewValue );
+ lcl_ConvertRangeFromXML( aNewValue, m_spChart2ModelContact );
+ StatisticsHelper::setErrorDataSequence(
+ xDataSource, xDataProvider, aNewValue, false /* positive */, true /* y-error */, &aXMLRange );
+ m_aOuterValue <<= aNewValue;
+ }
+ }
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_REGRESSION_CURVES
+class WrappedRegressionCurvesProperty : public WrappedStatisticProperty< ::com::sun::star::chart::ChartRegressionCurveType >
+{
+public:
+ virtual ::com::sun::star::chart::ChartRegressionCurveType getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartRegressionCurveType aNewValue ) const;
+
+ explicit WrappedRegressionCurvesProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedRegressionCurvesProperty();
+};
+
+WrappedRegressionCurvesProperty::WrappedRegressionCurvesProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< ::com::sun::star::chart::ChartRegressionCurveType >( C2U("RegressionCurves")
+ , lcl_getRegressionDefault(), spChart2ModelContact, ePropertyType )
+{
+}
+WrappedRegressionCurvesProperty::~WrappedRegressionCurvesProperty()
+{
+}
+
+::com::sun::star::chart::ChartRegressionCurveType WrappedRegressionCurvesProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ ::com::sun::star::chart::ChartRegressionCurveType aRet;
+ m_aDefaultValue >>= aRet;
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
+ if( xRegCnt.is() )
+ {
+ aRet = lcl_getRegressionCurveType(
+ RegressionCurveHelper::getFirstRegressTypeNotMeanValueLine( xRegCnt ) );
+ }
+ return aRet;
+}
+void WrappedRegressionCurvesProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, ::com::sun::star::chart::ChartRegressionCurveType aNewValue ) const
+{
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
+ if( xRegCnt.is() )
+ {
+ RegressionCurveHelper::tRegressionType eNewRegressionType = lcl_getRegressionType( aNewValue );
+ RegressionCurveHelper::removeAllExceptMeanValueLine( xRegCnt );
+ if( eNewRegressionType != RegressionCurveHelper::REGRESSION_TYPE_NONE )
+ RegressionCurveHelper::addRegressionCurve( eNewRegressionType, xRegCnt, 0, 0 );
+ }
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//PROP_CHART_STATISTIC_REGRESSION_PROPERTIES
+//PROP_CHART_STATISTIC_ERROR_PROPERTIES
+//PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES
+class WrappedStatisticPropertySetProperty : public WrappedStatisticProperty< Reference< beans::XPropertySet > >
+{
+public:
+ virtual Reference< beans::XPropertySet > getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ // properties are read-only, so this method should never be called
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, Reference< beans::XPropertySet > xNewValue ) const;
+
+ enum PropertySetType
+ {
+ PROPERTY_SET_TYPE_REGRESSION,
+ PROPERTY_SET_TYPE_ERROR_BAR,
+ PROPERTY_SET_TYPE_MEAN_VALUE
+ };
+
+ explicit WrappedStatisticPropertySetProperty(
+ PropertySetType ePropertySetType, ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedStatisticPropertySetProperty();
+
+private:
+ PropertySetType m_eType;
+};
+
+WrappedStatisticPropertySetProperty::WrappedStatisticPropertySetProperty(
+ PropertySetType ePropertySetType
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
+ , tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedStatisticProperty< Reference< beans::XPropertySet > >(
+ (ePropertySetType == PROPERTY_SET_TYPE_REGRESSION)
+ ? C2U("DataRegressionProperties")
+ : (ePropertySetType == PROPERTY_SET_TYPE_ERROR_BAR)
+ ? C2U("DataErrorProperties")
+ : C2U("DataMeanValueProperties")
+ , uno::Any(), spChart2ModelContact, ePropertyType )
+ , m_eType( ePropertySetType )
+{
+}
+WrappedStatisticPropertySetProperty::~WrappedStatisticPropertySetProperty()
+{
+}
+
+Reference< beans::XPropertySet > WrappedStatisticPropertySetProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ Reference< beans::XPropertySet > xResult;
+ uno::Reference< chart2::XRegressionCurveContainer > xRegCnt( xSeriesPropertySet, uno::UNO_QUERY );
+
+ switch( m_eType )
+ {
+ case PROPERTY_SET_TYPE_REGRESSION:
+ if( xRegCnt.is() )
+ xResult.set( RegressionCurveHelper::getFirstCurveNotMeanValueLine( xRegCnt ), uno::UNO_QUERY );
+ break;
+ case PROPERTY_SET_TYPE_ERROR_BAR:
+ if( xSeriesPropertySet.is())
+ xSeriesPropertySet->getPropertyValue( C2U( "ErrorBarY" )) >>= xResult;
+ break;
+ case PROPERTY_SET_TYPE_MEAN_VALUE:
+ if( xRegCnt.is() )
+ xResult.set( RegressionCurveHelper::getMeanValueLine( xRegCnt ), uno::UNO_QUERY );
+ break;
+ }
+
+ return xResult;
+}
+
+void WrappedStatisticPropertySetProperty::setValueToSeries(
+ const Reference< beans::XPropertySet >& /* xSeriesPropertySet */
+ , Reference< beans::XPropertySet > /* xNewValue */ ) const
+{
+ OSL_ENSURE( false, "Trying to set a read-only property" );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+namespace
+{
+enum
+{
+ //statistic properties
+ PROP_CHART_STATISTIC_CONST_ERROR_LOW = FAST_PROPERTY_ID_START_CHART_STATISTIC_PROP,
+ PROP_CHART_STATISTIC_CONST_ERROR_HIGH,
+ PROP_CHART_STATISTIC_MEAN_VALUE,
+ PROP_CHART_STATISTIC_ERROR_CATEGORY,
+ PROP_CHART_STATISTIC_ERROR_BAR_STYLE,
+ PROP_CHART_STATISTIC_PERCENT_ERROR,
+ PROP_CHART_STATISTIC_ERROR_MARGIN,
+ PROP_CHART_STATISTIC_ERROR_INDICATOR,
+ PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE,
+ PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE,
+ PROP_CHART_STATISTIC_REGRESSION_CURVES,
+ PROP_CHART_STATISTIC_REGRESSION_PROPERTIES,
+ PROP_CHART_STATISTIC_ERROR_PROPERTIES,
+ PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES
+};
+
+/** @parameter bDataSeriesProperty if true, this property is for a single data
+ series, if false, it is for the whole diagram, i.e. for all
+ series
+ */
+void lcl_addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
+ , tSeriesOrDiagramPropertyType ePropertyType )
+{
+ rList.push_back( new WrappedConstantErrorLowProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedConstantErrorHighProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedMeanValueProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedErrorCategoryProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedErrorBarStyleProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedPercentageErrorProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedErrorMarginProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedErrorIndicatorProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedErrorBarRangePositiveProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedErrorBarRangeNegativeProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedRegressionCurvesProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedStatisticPropertySetProperty(
+ WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_REGRESSION, spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedStatisticPropertySetProperty(
+ WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_ERROR_BAR, spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedStatisticPropertySetProperty(
+ WrappedStatisticPropertySetProperty::PROPERTY_SET_TYPE_MEAN_VALUE, spChart2ModelContact, ePropertyType ) );
+}
+
+}//anonymous namespace
+
+//static
+void WrappedStatisticProperties::addProperties( ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "ConstantErrorLow" ),
+ PROP_CHART_STATISTIC_CONST_ERROR_LOW,
+ ::getCppuType( reinterpret_cast< double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "ConstantErrorHigh" ),
+ PROP_CHART_STATISTIC_CONST_ERROR_HIGH,
+ ::getCppuType( reinterpret_cast< double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "MeanValue" ),
+ PROP_CHART_STATISTIC_MEAN_VALUE,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "ErrorCategory" ),
+ PROP_CHART_STATISTIC_ERROR_CATEGORY,
+ ::getCppuType( reinterpret_cast< ::com::sun::star::chart::ChartErrorCategory * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "ErrorBarStyle" ),
+ PROP_CHART_STATISTIC_ERROR_BAR_STYLE,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "PercentageError" ),
+ PROP_CHART_STATISTIC_PERCENT_ERROR,
+ ::getCppuType( reinterpret_cast< double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "ErrorMargin" ),
+ PROP_CHART_STATISTIC_ERROR_MARGIN,
+ ::getCppuType( reinterpret_cast< double * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "ErrorIndicator" ),
+ PROP_CHART_STATISTIC_ERROR_INDICATOR,
+ ::getCppuType( reinterpret_cast< ::com::sun::star::chart::ChartErrorIndicatorType * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "ErrorBarRangePositive" ),
+ PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE,
+ ::getCppuType( reinterpret_cast< OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "ErrorBarRangeNegative" ),
+ PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE,
+ ::getCppuType( reinterpret_cast< OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+ rOutProperties.push_back(
+ Property( C2U( "RegressionCurves" ),
+ PROP_CHART_STATISTIC_REGRESSION_CURVES,
+ ::getCppuType( reinterpret_cast< const ::com::sun::star::chart::ChartRegressionCurveType * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "DataRegressionProperties" ),
+ PROP_CHART_STATISTIC_REGRESSION_PROPERTIES,
+ ::getCppuType( reinterpret_cast< const Reference< beans::XPropertySet > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "DataErrorProperties" ),
+ PROP_CHART_STATISTIC_ERROR_PROPERTIES,
+ ::getCppuType( reinterpret_cast< const Reference< beans::XPropertySet > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "DataMeanValueProperties" ),
+ PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES,
+ ::getCppuType( reinterpret_cast< const Reference< beans::XPropertySet > * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::READONLY
+ | beans::PropertyAttribute::MAYBEVOID ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void WrappedStatisticProperties::addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ lcl_addWrappedProperties( rList, spChart2ModelContact, DATA_SERIES );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void WrappedStatisticProperties::addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ lcl_addWrappedProperties( rList, spChart2ModelContact, DIAGRAM );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.hxx
new file mode 100644
index 000000000000..5e20f65a189d
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.hxx
@@ -0,0 +1,60 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedStatisticProperties.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_STATISTIC_PROPERTIES_HXX
+#define CHART_WRAPPED_STATISTIC_PROPERTIES_HXX
+
+#include "WrappedProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+class WrappedStatisticProperties
+{
+public:
+ static void addProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties );
+ static void addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ static void addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_STATISTIC_PROPERTIES_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx
new file mode 100644
index 000000000000..0b68ec120231
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx
@@ -0,0 +1,333 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedStockProperties.cxx,v $
+ * $Revision: 1.5 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedStockProperties.hxx"
+#include "macros.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include "DiagramHelper.hxx"
+#include "ChartModelHelper.hxx"
+#include "ControllerLockGuard.hxx"
+#include <com/sun/star/chart2/XChartDocument.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+class WrappedStockProperty : public WrappedProperty
+{
+public:
+ explicit WrappedStockProperty( const ::rtl::OUString& rOuterName
+ , const ::com::sun::star::uno::Any& rDefaulValue
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedStockProperty();
+
+ void setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ 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);
+
+ ::com::sun::star::uno::Any getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ virtual uno::Reference< chart2::XChartTypeTemplate > getNewTemplate( sal_Bool bNewValue, const rtl::OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const = 0;
+
+protected:
+ ::boost::shared_ptr< Chart2ModelContact > m_spChart2ModelContact;
+ mutable ::com::sun::star::uno::Any m_aOuterValue;
+ ::com::sun::star::uno::Any m_aDefaultValue;
+};
+
+WrappedStockProperty::WrappedStockProperty( const ::rtl::OUString& rOuterName
+ , const ::com::sun::star::uno::Any& rDefaulValue
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedProperty(rOuterName,rtl::OUString())
+ , m_spChart2ModelContact(spChart2ModelContact)
+ , m_aOuterValue()
+ , m_aDefaultValue(rDefaulValue)
+{
+}
+WrappedStockProperty::~WrappedStockProperty()
+{
+}
+
+void WrappedStockProperty::setPropertyValue( const ::com::sun::star::uno::Any& rOuterValue, const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ 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)
+{
+ sal_Bool bNewValue = false;
+ if( ! (rOuterValue >>= bNewValue) )
+ throw lang::IllegalArgumentException( C2U("stock properties require type sal_Bool"), 0, 0 );
+
+ m_aOuterValue = rOuterValue;
+
+ Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ sal_Int32 nDimension = ::chart::DiagramHelper::getDimension( xDiagram );
+ if( xChartDoc.is() && xDiagram.is() && nDimension==2 )
+ {
+ Reference< lang::XMultiServiceFactory > xFactory( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
+ DiagramHelper::tTemplateWithServiceName aTemplateAndService =
+ DiagramHelper::getTemplateForDiagram( xDiagram, xFactory );
+
+ uno::Reference< chart2::XChartTypeTemplate > xTemplate =
+ getNewTemplate( bNewValue, aTemplateAndService.second, xFactory );
+
+ if(xTemplate.is())
+ {
+ try
+ {
+ // /-- locked controllers
+ ControllerLockGuard aCtrlLockGuard( m_spChart2ModelContact->getChartModel() );
+ xTemplate->changeDiagram( xDiagram );
+ // \-- locked controllers
+ }
+ catch( uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+}
+
+::com::sun::star::uno::Any WrappedStockProperty::getPropertyDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ return m_aDefaultValue;
+}
+
+//-------------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------------
+
+class WrappedVolumeProperty : public WrappedStockProperty
+{
+public:
+ explicit WrappedVolumeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedVolumeProperty();
+
+ ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ uno::Reference< chart2::XChartTypeTemplate > getNewTemplate( sal_Bool bNewValue, const rtl::OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const;
+};
+
+WrappedVolumeProperty::WrappedVolumeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedStockProperty( C2U("Volume"), uno::makeAny(sal_False) , spChart2ModelContact )
+{
+}
+WrappedVolumeProperty::~WrappedVolumeProperty()
+{
+}
+
+::com::sun::star::uno::Any WrappedVolumeProperty::getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() && xChartDoc.is() )
+ {
+ ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesVector(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ if( aSeriesVector.size() > 0 )
+ {
+ Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
+ DiagramHelper::tTemplateWithServiceName aTemplateAndService =
+ DiagramHelper::getTemplateForDiagram( xDiagram, xFact );
+
+ if( aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ) )
+ || aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ) ) )
+ m_aOuterValue <<= sal_Bool(sal_True);
+ else if( aTemplateAndService.second.getLength() || !m_aOuterValue.hasValue() )
+ m_aOuterValue <<= sal_Bool(sal_False);
+ }
+ else if(!m_aOuterValue.hasValue())
+ m_aOuterValue <<= sal_Bool(sal_False);
+ }
+ return m_aOuterValue;
+}
+
+uno::Reference< chart2::XChartTypeTemplate > WrappedVolumeProperty::getNewTemplate( sal_Bool bNewValue, const rtl::OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const
+{
+ uno::Reference< chart2::XChartTypeTemplate > xTemplate(0);
+
+ if(!xFactory.is())
+ return xTemplate;
+
+ if( bNewValue ) //add volume
+ {
+ if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockLowHighClose" ) ) )
+ xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ) ), uno::UNO_QUERY );
+ else if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ) ) )
+ xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ) ), uno::UNO_QUERY );
+ }
+ else //remove volume
+ {
+ if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ) ) )
+ xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockLowHighClose" ) ), uno::UNO_QUERY );
+ else if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ) ) )
+ xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ) ), uno::UNO_QUERY );
+ }
+ return xTemplate;
+}
+
+//-------------------------------------------------------------------------------------
+//-------------------------------------------------------------------------------------
+
+
+class WrappedUpDownProperty : public WrappedStockProperty
+{
+public:
+ explicit WrappedUpDownProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ virtual ~WrappedUpDownProperty();
+
+ ::com::sun::star::uno::Any getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xInnerPropertySet ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException);
+
+ uno::Reference< chart2::XChartTypeTemplate > getNewTemplate( sal_Bool bNewValue, const rtl::OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const;
+};
+WrappedUpDownProperty::WrappedUpDownProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+ : WrappedStockProperty( C2U("UpDown"), uno::makeAny(sal_False) , spChart2ModelContact )
+{
+}
+WrappedUpDownProperty::~WrappedUpDownProperty()
+{
+}
+::com::sun::star::uno::Any WrappedUpDownProperty::getPropertyValue( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& /*xInnerPropertySet*/ ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException)
+{
+ Reference< chart2::XChartDocument > xChartDoc( m_spChart2ModelContact->getChart2Document() );
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ if( xDiagram.is() && xChartDoc.is() )
+ {
+ ::std::vector< uno::Reference< chart2::XDataSeries > > aSeriesVector(
+ DiagramHelper::getDataSeriesFromDiagram( xDiagram ) );
+ if( aSeriesVector.size() > 0 )
+ {
+ Reference< lang::XMultiServiceFactory > xFact( xChartDoc->getChartTypeManager(), uno::UNO_QUERY );
+ DiagramHelper::tTemplateWithServiceName aTemplateAndService =
+ DiagramHelper::getTemplateForDiagram( xDiagram, xFact );
+
+ if( aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ) )
+ || aTemplateAndService.second.equals( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ) ) )
+ m_aOuterValue <<= sal_Bool(sal_True);
+ else if( aTemplateAndService.second.getLength() || !m_aOuterValue.hasValue() )
+ m_aOuterValue <<= sal_Bool(sal_False);
+ }
+ else if(!m_aOuterValue.hasValue())
+ m_aOuterValue <<= sal_Bool(sal_False);
+ }
+ return m_aOuterValue;
+}
+uno::Reference< chart2::XChartTypeTemplate > WrappedUpDownProperty::getNewTemplate( sal_Bool bNewValue, const rtl::OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const
+{
+ uno::Reference< chart2::XChartTypeTemplate > xTemplate(0);
+ if( bNewValue ) //add open series
+ {
+ if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockLowHighClose" ) ) )
+ xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ) ), uno::UNO_QUERY );
+ else if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ) ) )
+ xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ) ), uno::UNO_QUERY );
+ }
+ else //remove open series
+ {
+ if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockOpenLowHighClose" ) ) )
+ xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockLowHighClose" ) ), uno::UNO_QUERY );
+ else if( rCurrentTemplate.equals( C2U( "com.sun.star.chart2.template.StockVolumeOpenLowHighClose" ) ) )
+ xTemplate.set( xFactory->createInstance( C2U( "com.sun.star.chart2.template.StockVolumeLowHighClose" ) ), uno::UNO_QUERY );
+ }
+ return xTemplate;
+}
+
+namespace
+{
+enum
+{
+ //spline properties
+ PROP_CHART_STOCK_VOLUME = FAST_PROPERTY_ID_START_CHART_STOCK_PROP
+ , PROP_CHART_STOCK_UPDOWN
+};
+
+}//anonymous namespace
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//static
+void WrappedStockProperties::addProperties( ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "Volume" ),
+ PROP_CHART_STOCK_VOLUME,
+ ::getCppuType( reinterpret_cast< sal_Bool * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+ rOutProperties.push_back(
+ Property( C2U( "UpDown" ),
+ PROP_CHART_STOCK_UPDOWN,
+ ::getCppuType( reinterpret_cast< sal_Bool * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT
+ | beans::PropertyAttribute::MAYBEVOID ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void WrappedStockProperties::addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ rList.push_back( new WrappedVolumeProperty( spChart2ModelContact ) );
+ rList.push_back( new WrappedUpDownProperty( spChart2ModelContact ) );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.hxx
new file mode 100644
index 000000000000..622eeaf901f5
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.hxx
@@ -0,0 +1,62 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedStockProperties.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_STOCK_PROPERTIES_HXX
+#define CHART_WRAPPED_STOCK_PROPERTIES_HXX
+
+#include "WrappedProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+class WrappedStockProperties
+{
+public:
+ static void addProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties );
+ static void addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_STOCK_PROPERTIES_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx
new file mode 100644
index 000000000000..59bba9b5973d
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx
@@ -0,0 +1,596 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedSymbolProperties.cxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedSymbolProperties.hxx"
+#include "WrappedSeriesOrDiagramProperty.hxx"
+#include "macros.hxx"
+#include "FastPropertyIdRanges.hxx"
+#include "ChartTypeHelper.hxx"
+#include <com/sun/star/chart2/Symbol.hpp>
+#include <com/sun/star/chart2/SymbolStyle.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/beans/PropertyAttribute.hpp>
+#include <com/sun/star/chart/ChartSymbolType.hpp>
+#include <com/sun/star/drawing/LineStyle.hpp>
+
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+
+// for UNO_NAME_GRAPHOBJ_URLPREFIX
+#include <svx/unoprnms.hxx>
+
+// for Graphic
+#include <vcl/graph.hxx>
+// for GraphicObject
+#include <goodies/grfmgr.hxx>
+#include <vcl/outdev.hxx>
+
+#include <comphelper/processfactory.hxx>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Sequence;
+using ::com::sun::star::beans::Property;
+using ::rtl::OUString;
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+class WrappedSymbolTypeProperty : public WrappedSeriesOrDiagramProperty< sal_Int32 >
+{
+public:
+ virtual sal_Int32 getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Int32 aNewValue ) const;
+
+ virtual Any getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw ( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException);
+ virtual beans::PropertyState getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, uno::RuntimeException);
+
+ explicit WrappedSymbolTypeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedSymbolTypeProperty();
+};
+
+class WrappedSymbolBitmapURLProperty : public WrappedSeriesOrDiagramProperty< OUString >
+{
+public:
+ virtual OUString getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, OUString aNewGraphicURL ) const;
+
+ explicit WrappedSymbolBitmapURLProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedSymbolBitmapURLProperty();
+};
+
+// this operator is not defined by default
+bool operator!=( const awt::Size & rSize1, const awt::Size & rSize2 )
+{
+ return (rSize1.Width != rSize2.Width) || (rSize1.Height != rSize2.Height);
+}
+
+class WrappedSymbolSizeProperty : public WrappedSeriesOrDiagramProperty< awt::Size >
+{
+public:
+ virtual awt::Size getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, awt::Size aNewSize ) const;
+ virtual beans::PropertyState getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, uno::RuntimeException);
+
+ explicit WrappedSymbolSizeProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedSymbolSizeProperty();
+};
+
+class WrappedSymbolAndLinesProperty : public WrappedSeriesOrDiagramProperty< sal_Bool >
+{
+public:
+ virtual sal_Bool getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const;
+ virtual void setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Bool bDrawLines ) const;
+ virtual beans::PropertyState getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, uno::RuntimeException);
+
+ explicit WrappedSymbolAndLinesProperty( ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType );
+ virtual ~WrappedSymbolAndLinesProperty();
+};
+
+namespace
+{
+enum
+{
+ //symbol properties
+ PROP_CHART_SYMBOL_TYPE = FAST_PROPERTY_ID_START_CHART_SYMBOL_PROP,
+ PROP_CHART_SYMBOL_BITMAP_URL,
+ PROP_CHART_SYMBOL_SIZE,
+ PROP_CHART_SYMBOL_AND_LINES
+};
+
+sal_Int32 lcl_getSymbolType( const ::com::sun::star::chart2::Symbol& rSymbol )
+{
+ sal_Int32 nSymbol = ::com::sun::star::chart::ChartSymbolType::NONE;
+ switch( rSymbol.Style )
+ {
+ case chart2::SymbolStyle_NONE:
+ break;
+ case chart2::SymbolStyle_AUTO:
+ nSymbol = ::com::sun::star::chart::ChartSymbolType::AUTO;
+ break;
+ case chart2::SymbolStyle_STANDARD:
+ nSymbol = rSymbol.StandardSymbol%8;
+ break;
+ case chart2::SymbolStyle_POLYGON://new feature
+ nSymbol = ::com::sun::star::chart::ChartSymbolType::AUTO;
+ break;
+ case chart2::SymbolStyle_GRAPHIC:
+ nSymbol = ::com::sun::star::chart::ChartSymbolType::BITMAPURL;
+ break;
+ default:
+ nSymbol = ::com::sun::star::chart::ChartSymbolType::AUTO;
+ break;
+ }
+ return nSymbol;
+}
+void lcl_setSymbolTypeToSymbol( sal_Int32 nSymbolType, chart2::Symbol& rSymbol )
+{
+ switch( nSymbolType )
+ {
+ case ::com::sun::star::chart::ChartSymbolType::NONE:
+ rSymbol.Style = chart2::SymbolStyle_NONE;
+ break;
+ case ::com::sun::star::chart::ChartSymbolType::AUTO:
+ rSymbol.Style = chart2::SymbolStyle_AUTO;
+ break;
+ case ::com::sun::star::chart::ChartSymbolType::BITMAPURL:
+ rSymbol.Style = chart2::SymbolStyle_GRAPHIC;
+ break;
+ default:
+ rSymbol.Style = chart2::SymbolStyle_STANDARD;
+ rSymbol.StandardSymbol = nSymbolType;
+ break;
+ }
+}
+
+void lcl_addWrappedProperties( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact
+ , tSeriesOrDiagramPropertyType ePropertyType )
+{
+ rList.push_back( new WrappedSymbolTypeProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedSymbolBitmapURLProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedSymbolSizeProperty( spChart2ModelContact, ePropertyType ) );
+ rList.push_back( new WrappedSymbolAndLinesProperty( spChart2ModelContact, ePropertyType ) );
+}
+
+}//anonymous namespace
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//static
+void WrappedSymbolProperties::addProperties( ::std::vector< Property > & rOutProperties )
+{
+ rOutProperties.push_back(
+ Property( C2U( "SymbolType" ),
+ PROP_CHART_SYMBOL_TYPE,
+ ::getCppuType( reinterpret_cast< sal_Int32 * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "SymbolBitmapURL" ),
+ PROP_CHART_SYMBOL_BITMAP_URL,
+ ::getCppuType( reinterpret_cast< ::rtl::OUString * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "SymbolSize" ),
+ PROP_CHART_SYMBOL_SIZE,
+ ::getCppuType( reinterpret_cast< awt::Size * >(0)),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+
+ rOutProperties.push_back(
+ Property( C2U( "Lines" ),
+ PROP_CHART_SYMBOL_AND_LINES,
+ ::getBooleanCppuType(),
+ beans::PropertyAttribute::BOUND
+ | beans::PropertyAttribute::MAYBEDEFAULT ));
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void WrappedSymbolProperties::addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ lcl_addWrappedProperties( rList, spChart2ModelContact, DATA_SERIES );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//static
+void WrappedSymbolProperties::addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact )
+{
+ lcl_addWrappedProperties( rList, spChart2ModelContact, DIAGRAM );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+WrappedSymbolTypeProperty::WrappedSymbolTypeProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedSeriesOrDiagramProperty< sal_Int32 >( C2U("SymbolType")
+ , uno::makeAny( ::com::sun::star::chart::ChartSymbolType::NONE )
+ , spChart2ModelContact
+ , ePropertyType )
+{
+}
+WrappedSymbolTypeProperty::~WrappedSymbolTypeProperty()
+{
+}
+
+sal_Int32 WrappedSymbolTypeProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ sal_Int32 aRet = 0;
+ m_aDefaultValue >>= aRet;
+ chart2::Symbol aSymbol;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol ) )
+ aRet = lcl_getSymbolType( aSymbol );
+ return aRet;
+}
+
+void WrappedSymbolTypeProperty::setValueToSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet, sal_Int32 nSymbolType ) const
+{
+ if(!xSeriesPropertySet.is())
+ return;
+
+ chart2::Symbol aSymbol;
+ xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol;
+
+ lcl_setSymbolTypeToSymbol( nSymbolType, aSymbol );
+ xSeriesPropertySet->setPropertyValue( C2U("Symbol"), uno::makeAny( aSymbol ) );
+}
+
+Any WrappedSymbolTypeProperty::getPropertyValue( const Reference< beans::XPropertySet >& xInnerPropertySet ) const
+ throw ( beans::UnknownPropertyException, lang::WrappedTargetException, uno::RuntimeException)
+{
+ //the old chart (< OOo 2.3) needs symbol-type="automatic" at the plot-area if any of the series should be able to have symbols
+ if( m_ePropertyType == DIAGRAM )
+ {
+ bool bHasAmbiguousValue = false;
+ sal_Int32 aValue = 0;
+ if( detectInnerValue( aValue, bHasAmbiguousValue ) )
+ {
+ if(bHasAmbiguousValue)
+ {
+ m_aOuterValue = uno::makeAny( ::com::sun::star::chart::ChartSymbolType::AUTO );
+ }
+ else
+ {
+ if( ::com::sun::star::chart::ChartSymbolType::NONE == aValue )
+ m_aOuterValue = uno::makeAny( ::com::sun::star::chart::ChartSymbolType::NONE );
+ else
+ m_aOuterValue = uno::makeAny( ::com::sun::star::chart::ChartSymbolType::AUTO );
+ }
+ }
+ return m_aOuterValue;
+ }
+ else
+ {
+ ::com::sun::star::uno::Any aRet( m_aDefaultValue );
+ aRet <<= getValueFromSeries( xInnerPropertySet );
+ return aRet;
+ }
+}
+
+beans::PropertyState WrappedSymbolTypeProperty::getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ //the special situation for this property here is that the diagram default can be
+ //different from the normal default and different from all sinlges series values
+ //so we need to return PropertyState_DIRECT_VALUE for more cases
+
+ if( m_ePropertyType == DATA_SERIES && //single series or point
+ m_spChart2ModelContact.get())
+ {
+ Reference< chart2::XDiagram > xDiagram( m_spChart2ModelContact->getChart2Diagram() );
+ Reference< chart2::XDataSeries > xSeries( xInnerPropertyState, uno::UNO_QUERY );
+ Reference< chart2::XChartType > xChartType( DiagramHelper::getChartTypeOfSeries( xDiagram, xSeries ) );
+ if( ChartTypeHelper::isSupportingSymbolProperties( xChartType, 2 ) )
+ return beans::PropertyState_DIRECT_VALUE;
+ }
+ return WrappedProperty::getPropertyState( xInnerPropertyState );
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+WrappedSymbolBitmapURLProperty::WrappedSymbolBitmapURLProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedSeriesOrDiagramProperty< OUString >( C2U("SymbolBitmapURL")
+ , uno::makeAny( OUString() ), spChart2ModelContact, ePropertyType )
+{
+}
+
+WrappedSymbolBitmapURLProperty::~WrappedSymbolBitmapURLProperty()
+{
+}
+
+OUString WrappedSymbolBitmapURLProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ OUString aRet;
+ m_aDefaultValue >>= aRet;
+ chart2::Symbol aSymbol;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol )
+ && aSymbol.Graphic.is())
+ {
+ GraphicObject aGrObj( Graphic( aSymbol.Graphic ));
+ aRet = OUString( RTL_CONSTASCII_USTRINGPARAM( UNO_NAME_GRAPHOBJ_URLPREFIX ));
+ aRet += OUString::createFromAscii( aGrObj.GetUniqueID().GetBuffer());
+ }
+ return aRet;
+}
+
+void WrappedSymbolBitmapURLProperty::setValueToSeries(
+ const Reference< beans::XPropertySet >& xSeriesPropertySet,
+ OUString aNewGraphicURL ) const
+{
+ if(!xSeriesPropertySet.is())
+ return;
+
+ chart2::Symbol aSymbol;
+ if( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol )
+ {
+ bool bMatchesPrefix =
+ aNewGraphicURL.matchAsciiL( RTL_CONSTASCII_STRINGPARAM( UNO_NAME_GRAPHOBJ_URLPREFIX ));
+ OSL_ENSURE( bMatchesPrefix, "Invalid URL for Symbol Bitmap" );
+ if( bMatchesPrefix )
+ {
+ GraphicObject aGrObj = GraphicObject(
+ ByteString( U2C( aNewGraphicURL.copy( sizeof( UNO_NAME_GRAPHOBJ_URLPREFIX ) - 1 ))));
+ aSymbol.Graphic.set( aGrObj.GetGraphic().GetXGraphic());
+ xSeriesPropertySet->setPropertyValue( C2U("Symbol"), uno::makeAny( aSymbol ) );
+ }
+ else
+ {
+ try
+ {
+ // @todo: get factory from some context?
+ Reference< lang::XMultiServiceFactory > xFact( comphelper::getProcessServiceFactory(), uno::UNO_QUERY_THROW );
+ Reference< graphic::XGraphicProvider > xGraphProv(
+ xFact->createInstance( C2U("com.sun.star.graphic.GraphicProvider")), uno::UNO_QUERY_THROW );
+ Sequence< beans::PropertyValue > aArgs(1);
+ aArgs[0] = beans::PropertyValue(
+ C2U("URL"), -1, uno::makeAny( aNewGraphicURL ),
+ beans::PropertyState_DIRECT_VALUE );
+ aSymbol.Graphic.set( xGraphProv->queryGraphic( aArgs ));
+ xSeriesPropertySet->setPropertyValue( C2U("Symbol"), uno::makeAny( aSymbol ) );
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ }
+ }
+}
+
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+namespace
+{
+
+void lcl_correctSymbolSizeForBitmaps( chart2::Symbol& rSymbol )
+{
+ if( rSymbol.Style != chart2::SymbolStyle_GRAPHIC )
+ return;
+ if( rSymbol.Size.Width != -1 )
+ return;
+ if( rSymbol.Size.Height != -1 )
+ return;
+
+ //find a good automatic size
+ try
+ {
+ const awt::Size aDefaultSize(250,250);
+ awt::Size aSize = aDefaultSize;
+ uno::Reference< beans::XPropertySet > xProp( rSymbol.Graphic, uno::UNO_QUERY );
+ if( xProp.is() )
+ {
+ bool bFoundSize = false;
+ try
+ {
+ if( (xProp->getPropertyValue( C2U( "Size100thMM" ) ) >>= aSize) )
+ {
+ if( aSize.Width == 0 && aSize.Height == 0 )
+ aSize = aDefaultSize;
+ else
+ bFoundSize = true;
+ }
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+
+ if(!bFoundSize)
+ {
+ awt::Size aAWTPixelSize(10,10);
+ if( (xProp->getPropertyValue( C2U( "SizePixel" ) ) >>= aAWTPixelSize) )
+ {
+ Size aPixelSize(aAWTPixelSize.Width,aAWTPixelSize.Height);
+ Size aNewSize = ( OutputDevice::LogicToLogic( aPixelSize, MAP_PIXEL, MAP_100TH_MM ));
+ aSize = awt::Size( aNewSize.Width(), aNewSize.Height() );
+
+ if( aSize.Width == 0 && aSize.Height == 0 )
+ aSize = aDefaultSize;
+ }
+ }
+ }
+ rSymbol.Size = aSize;
+ }
+ catch( uno::Exception& e )
+ {
+ ASSERT_EXCEPTION( e );
+ }
+}
+
+}//end anonymous namespace
+
+WrappedSymbolSizeProperty::WrappedSymbolSizeProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedSeriesOrDiagramProperty< awt::Size >( C2U("SymbolSize")
+ , uno::makeAny( awt::Size(250,250) ), spChart2ModelContact, ePropertyType )
+{
+}
+
+WrappedSymbolSizeProperty::~WrappedSymbolSizeProperty()
+{
+}
+
+awt::Size WrappedSymbolSizeProperty::getValueFromSeries( const Reference< beans::XPropertySet >& xSeriesPropertySet ) const
+{
+ awt::Size aRet;
+ m_aDefaultValue >>= aRet;
+ chart2::Symbol aSymbol;
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol ))
+ aRet = aSymbol.Size;
+ return aRet;
+}
+
+void WrappedSymbolSizeProperty::setValueToSeries(
+ const Reference< beans::XPropertySet >& xSeriesPropertySet,
+ awt::Size aNewSize ) const
+{
+ if(!xSeriesPropertySet.is())
+ return;
+
+ chart2::Symbol aSymbol;
+ if( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol )
+ {
+ aSymbol.Size = aNewSize;
+ lcl_correctSymbolSizeForBitmaps(aSymbol);
+ xSeriesPropertySet->setPropertyValue( C2U("Symbol"), uno::makeAny( aSymbol ) );
+ }
+}
+
+beans::PropertyState WrappedSymbolSizeProperty::getPropertyState( const Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ //only export symbol size if necessary
+ if( m_ePropertyType == DIAGRAM )
+ return beans::PropertyState_DEFAULT_VALUE;
+
+ try
+ {
+ chart2::Symbol aSymbol;
+ Reference< beans::XPropertySet > xSeriesPropertySet( xInnerPropertyState, uno::UNO_QUERY );
+ if( xSeriesPropertySet.is() && ( xSeriesPropertySet->getPropertyValue(C2U("Symbol")) >>= aSymbol ))
+ {
+ if( chart2::SymbolStyle_NONE != aSymbol.Style )
+ return beans::PropertyState_DIRECT_VALUE;
+ }
+ }
+ catch( const uno::Exception & ex )
+ {
+ ASSERT_EXCEPTION( ex );
+ }
+ return beans::PropertyState_DEFAULT_VALUE;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+WrappedSymbolAndLinesProperty::WrappedSymbolAndLinesProperty(
+ ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact,
+ tSeriesOrDiagramPropertyType ePropertyType )
+ : WrappedSeriesOrDiagramProperty< sal_Bool >( C2U("Lines")
+ , uno::makeAny( sal_True ), spChart2ModelContact, ePropertyType )
+{
+}
+
+WrappedSymbolAndLinesProperty::~WrappedSymbolAndLinesProperty()
+{
+}
+
+sal_Bool WrappedSymbolAndLinesProperty::getValueFromSeries( const Reference< beans::XPropertySet >& /*xSeriesPropertySet*/ ) const
+{
+ //do not export this property anymore, instead use a linestyle none for no lines
+ return sal_True;
+}
+
+void WrappedSymbolAndLinesProperty::setValueToSeries(
+ const Reference< beans::XPropertySet >& xSeriesPropertySet,
+ sal_Bool bDrawLines ) const
+{
+ if(!xSeriesPropertySet.is())
+ return;
+
+ drawing::LineStyle eLineStyle( bDrawLines ? drawing::LineStyle_SOLID : drawing::LineStyle_NONE );
+ xSeriesPropertySet->setPropertyValue( C2U("LineStyle"), uno::makeAny( eLineStyle ) );
+}
+
+beans::PropertyState WrappedSymbolAndLinesProperty::getPropertyState( const Reference< beans::XPropertyState >& /*xInnerPropertyState*/ ) const
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ //do not export this property anymore, instead use a linestyle none for no lines
+ return beans::PropertyState_DEFAULT_VALUE;
+}
+
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.hxx b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.hxx
new file mode 100644
index 000000000000..165832ab8664
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.hxx
@@ -0,0 +1,64 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedSymbolProperties.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_SYMBOL_PROPERTIES_HXX
+#define CHART_WRAPPED_SYMBOL_PROPERTIES_HXX
+
+#include "WrappedProperty.hxx"
+#include "Chart2ModelContact.hxx"
+
+#include <boost/shared_ptr.hpp>
+#include <vector>
+
+//.............................................................................
+namespace chart
+{
+namespace wrapper
+{
+
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+//-----------------------------------------------------------------------------------------------------------------
+
+class WrappedSymbolProperties
+{
+public:
+ static void addProperties( ::std::vector< ::com::sun::star::beans::Property > & rOutProperties );
+ static void addWrappedPropertiesForSeries( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+ static void addWrappedPropertiesForDiagram( std::vector< WrappedProperty* >& rList
+ , ::boost::shared_ptr< Chart2ModelContact > spChart2ModelContact );
+};
+
+} //namespace wrapper
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_SYMBOL_PROPERTIES_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.cxx b/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.cxx
new file mode 100644
index 000000000000..07532a4ecf22
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.cxx
@@ -0,0 +1,90 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedTextRotationProperty.cxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+// MARKER(update_precomp.py): autogen include statement, do not remove
+#include "precompiled_chart2.hxx"
+
+#include "WrappedTextRotationProperty.hxx"
+#include "macros.hxx"
+#include <com/sun/star/beans/XPropertyState.hpp>
+
+using namespace ::com::sun::star;
+using ::com::sun::star::uno::Any;
+using ::rtl::OUString;
+
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+WrappedTextRotationProperty::WrappedTextRotationProperty( bool bDirectState )
+ : ::chart::WrappedProperty( C2U( "TextRotation" ), C2U( "TextRotation" ) )
+ , m_bDirectState( bDirectState )
+{
+}
+WrappedTextRotationProperty::~WrappedTextRotationProperty()
+{
+}
+
+beans::PropertyState WrappedTextRotationProperty::getPropertyState( const uno::Reference< beans::XPropertyState >& xInnerPropertyState ) const
+ throw (beans::UnknownPropertyException, uno::RuntimeException)
+{
+ if( m_bDirectState )
+ return beans::PropertyState_DIRECT_VALUE;
+ return WrappedProperty::getPropertyState( xInnerPropertyState );
+}
+
+Any WrappedTextRotationProperty::convertInnerToOuterValue( const Any& rInnerValue ) const
+{
+ Any aRet;
+ double fVal = 0;
+ if( rInnerValue >>= fVal )
+ {
+ sal_Int32 n100thDegrees = static_cast< sal_Int32 >( fVal * 100.0 );
+ aRet <<= n100thDegrees;
+ }
+ return aRet;
+}
+Any WrappedTextRotationProperty::convertOuterToInnerValue( const Any& rOuterValue ) const
+{
+ Any aRet;
+ sal_Int32 nVal = 0;
+ if( rOuterValue >>= nVal )
+ {
+ double fDoubleDegrees = ( static_cast< double >( nVal ) / 100.0 );
+ aRet <<= fDoubleDegrees;
+ }
+ return aRet;
+}
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
diff --git a/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.hxx b/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.hxx
new file mode 100644
index 000000000000..54fbf38e53d7
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/WrappedTextRotationProperty.hxx
@@ -0,0 +1,61 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: WrappedTextRotationProperty.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+#ifndef CHART_WRAPPED_TEXTROTATION_PROPERTY_HXX
+#define CHART_WRAPPED_TEXTROTATION_PROPERTY_HXX
+
+#include "WrappedProperty.hxx"
+
+//.............................................................................
+namespace chart
+{
+//.............................................................................
+
+class WrappedTextRotationProperty : public WrappedProperty
+{
+public:
+ WrappedTextRotationProperty( bool bDirectState=false );
+ virtual ~WrappedTextRotationProperty();
+
+ virtual ::com::sun::star::beans::PropertyState getPropertyState( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertyState >& xInnerPropertyState ) const
+ throw (::com::sun::star::beans::UnknownPropertyException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ virtual ::com::sun::star::uno::Any convertInnerToOuterValue( const ::com::sun::star::uno::Any& rInnerValue ) const;
+ virtual ::com::sun::star::uno::Any convertOuterToInnerValue( const ::com::sun::star::uno::Any& rOuterValue ) const;
+
+ bool m_bDirectState;
+};
+
+//.............................................................................
+} //namespace chart
+//.............................................................................
+
+// CHART_WRAPPED_TEXTROTATION_PROPERTY_HXX
+#endif
diff --git a/chart2/source/controller/chartapiwrapper/makefile.mk b/chart2/source/controller/chartapiwrapper/makefile.mk
new file mode 100644
index 000000000000..402b5870292c
--- /dev/null
+++ b/chart2/source/controller/chartapiwrapper/makefile.mk
@@ -0,0 +1,81 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2008 by Sun Microsystems, Inc.
+#
+# OpenOffice.org - a multi-platform office productivity suite
+#
+# $RCSfile: makefile.mk,v $
+#
+# $Revision: 1.4.44.3 $
+#
+# This file is part of OpenOffice.org.
+#
+# OpenOffice.org is free software: you can redistribute it and/or modify
+# it under the terms of the GNU Lesser General Public License version 3
+# only, as published by the Free Software Foundation.
+#
+# OpenOffice.org is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+# GNU Lesser General Public License version 3 for more details
+# (a copy is included in the LICENSE file that accompanied this code).
+#
+# You should have received a copy of the GNU Lesser General Public License
+# version 3 along with OpenOffice.org. If not, see
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+PRJ= ..$/..$/..
+PRJNAME= chart2
+TARGET= chchartapiwrapper
+
+PRJINC= $(PRJ)$/source
+
+ENABLE_EXCEPTIONS= TRUE
+VISIBILITY_HIDDEN=TRUE
+
+# --- Settings -----------------------------------------------------
+
+.INCLUDE: settings.mk
+
+# --- export library -------------------------------------------------
+
+#Specifies object files to bind into linked libraries.
+SLOFILES= \
+ $(SLO)$/Chart2ModelContact.obj \
+ $(SLO)$/AreaWrapper.obj \
+ $(SLO)$/AxisWrapper.obj \
+ $(SLO)$/ChartDataWrapper.obj \
+ $(SLO)$/ChartDocumentWrapper.obj \
+ $(SLO)$/DataSeriesPointWrapper.obj \
+ $(SLO)$/DiagramWrapper.obj \
+ $(SLO)$/GridWrapper.obj \
+ $(SLO)$/LegendWrapper.obj \
+ $(SLO)$/TitleWrapper.obj \
+ $(SLO)$/MinMaxLineWrapper.obj \
+ $(SLO)$/UpDownBarWrapper.obj \
+ $(SLO)$/WallFloorWrapper.obj \
+ $(SLO)$/WrappedAutomaticPositionProperties.obj \
+ $(SLO)$/WrappedCharacterHeightProperty.obj \
+ $(SLO)$/WrappedDataCaptionProperties.obj \
+ $(SLO)$/WrappedTextRotationProperty.obj \
+ $(SLO)$/WrappedGapwidthProperty.obj \
+ $(SLO)$/WrappedScaleProperty.obj \
+ $(SLO)$/WrappedSplineProperties.obj \
+ $(SLO)$/WrappedStockProperties.obj \
+ $(SLO)$/WrappedSymbolProperties.obj \
+ $(SLO)$/WrappedAxisAndGridExistenceProperties.obj \
+ $(SLO)$/WrappedNumberFormatProperty.obj \
+ $(SLO)$/WrappedStatisticProperties.obj \
+ $(SLO)$/WrappedSceneProperty.obj \
+ $(SLO)$/WrappedSeriesAreaOrLineProperty.obj \
+ $(SLO)$/WrappedAddInProperty.obj \
+ $(SLO)$/WrappedScaleTextProperties.obj
+
+# --- Targets -----------------------------------------------------------------
+
+.INCLUDE: target.mk