diff options
Diffstat (limited to 'chart2/source/inc')
93 files changed, 11275 insertions, 0 deletions
diff --git a/chart2/source/inc/AxisHelper.hxx b/chart2/source/inc/AxisHelper.hxx new file mode 100644 index 000000000000..75e69436a784 --- /dev/null +++ b/chart2/source/inc/AxisHelper.hxx @@ -0,0 +1,247 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_TOOLS_AXISHELPER_HXX +#define _CHART2_TOOLS_AXISHELPER_HXX + +#include "charttoolsdllapi.hxx" +#include "ReferenceSizeProvider.hxx" +#include <com/sun/star/chart2/XChartType.hpp> +#include <com/sun/star/chart2/XCoordinateSystem.hpp> +#include <com/sun/star/chart2/XDiagram.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + +#include <vector> + +//............................................................................. +namespace chart +{ +//............................................................................. + +//----------------------------------------------------------------------------- +/** +*/ + +class OOO_DLLPUBLIC_CHARTTOOLS AxisHelper +{ +public: + static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > createLinearScaling(); + static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > createLogarithmicScaling( double fBase = 10.0 ); + + static ::com::sun::star::chart2::ScaleData createDefaultScale(); + + static void removeExplicitScaling( ::com::sun::star::chart2::ScaleData& rScaleData ); + + static bool isLogarithmic( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XScaling >& xScaling ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XAxis > + createAxis( sal_Int32 nDimensionIndex, bool bMainAxis + , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram + , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext + , ReferenceSizeProvider * pRefSizeProvider = 0 ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XAxis > + createAxis( + sal_Int32 nDimensionIndex + , sal_Int32 nAxisIndex // 0==main or 1==secondary axis + , const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem >& xCooSys + , const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext + , ReferenceSizeProvider * pRefSizeProvider = 0 ); + + static void showAxis( sal_Int32 nDimensionIndex, bool bMainAxis + , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram + , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext + , ReferenceSizeProvider * pRefSizeProvider = 0 ); + + static void showGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid + , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram + , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ); + + static void hideAxis( sal_Int32 nDimensionIndex, bool bMainAxis + , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram ); + static void hideGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid + , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram ); + + static sal_Bool isAxisShown( sal_Int32 nDimensionIndex, bool bMainAxis + , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram ); + static sal_Bool isGridShown( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid + , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram ); + + static void makeAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis ); + static void makeGridVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties ); + + static void makeAxisInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis ); + static void makeGridInvisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties ); + + static void hideAxisIfNoDataIsAttached( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis + , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram); + + SAL_DLLPRIVATE static sal_Bool areAxisLabelsVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xAxisProperties ); + static sal_Bool isAxisVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis ); + static sal_Bool isGridVisible( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xGridProperties ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem > + getCoordinateSystemByIndex( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram + , sal_Int32 nIndex ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem > + getCoordinateSystemOfAxis( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XAxis >& xAxis + , const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XAxis > + getAxis( sal_Int32 nDimensionIndex, bool bMainAxis + , const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram ); + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XAxis > + getAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex + , const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem >& xCooSys ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XAxis > + getCrossingMainAxis( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XAxis >& xAxis + , const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem >& xCooSys ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XAxis > + getParallelAxis( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XAxis >& xAxis + , const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > + getGridProperties( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem >& xCooSys + , sal_Int32 nDimensionIndex + , sal_Int32 nAxisIndex //0: Primary axies, 1: secondary axis + , sal_Int32 nSubGridIndex = -1 //-1: Main Grid; 0: First SubGrid etc + ); + + static sal_Int32 getDimensionIndexOfAxis( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XAxis >& xAxis + , const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram ); + + static bool getIndicesForAxis( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XAxis >& xAxis + , const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem >& xCooSys + , sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex ); + + static bool getIndicesForAxis( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XAxis >& xAxis + , const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram + , sal_Int32& rOutCooSysIndex, sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex ); + + /** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to + </TRUE> are returned + */ + static ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XAxis > > + getAllAxesOfDiagram( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram + , bool bOnlyVisible = false ); + + /** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to + </TRUE> are returned + */ + SAL_DLLPRIVATE static std::vector< + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XAxis > > + getAllAxesOfCoordinateSystem( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem >& xCooSys + , bool bOnlyVisible = false ); + + static ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > > + getAllGrids( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram ); + + static void getAxisOrGridPossibilities( ::com::sun::star::uno::Sequence< sal_Bool >& rPossibilityList + , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram>& xDiagram, sal_Bool bAxis=sal_True ); + + static void getAxisOrGridExcistence( ::com::sun::star::uno::Sequence< sal_Bool >& rExcistenceList + , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram>& xDiagram, sal_Bool bAxis=sal_True ); + + static bool changeVisibilityOfGrids( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram>& xDiagram + , const ::com::sun::star::uno::Sequence< sal_Bool >& rOldExistenceList + , const ::com::sun::star::uno::Sequence< sal_Bool >& rNewExistenceList + , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ); + + static bool changeVisibilityOfAxes( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram>& xDiagram + , const ::com::sun::star::uno::Sequence< sal_Bool >& rOldExistenceList + , const ::com::sun::star::uno::Sequence< sal_Bool >& rNewExistenceList + , const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext + , ReferenceSizeProvider * pRefSizeProvider = 0 ); + + static bool shouldAxisBeDisplayed( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis + , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >& xCooSys ); + static bool isSecondaryYAxisNeeded( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem >& xCooSys ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType > + getChartTypeByIndex( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem >& xCooSys, sal_Int32 nIndex ); + + static void setRTLAxisLayout( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem >& xCooSys ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType > + getFirstChartTypeWithSeriesAttachedToAxisIndex( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram, const sal_Int32 nAttachedAxisIndex ); + + static bool isAxisPositioningEnabled(); +}; + +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/AxisIndexDefines.hxx b/chart2/source/inc/AxisIndexDefines.hxx new file mode 100644 index 000000000000..d994f8a85ea4 --- /dev/null +++ b/chart2/source/inc/AxisIndexDefines.hxx @@ -0,0 +1,38 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_AXISINDEX_HXX +#define CHART2_AXISINDEX_HXX + +namespace chart +{ + +const sal_Int32 MAIN_AXIS_INDEX = 0; +const sal_Int32 SECONDARY_AXIS_INDEX = 1; + +} // namespace chart + +#endif diff --git a/chart2/source/inc/BaseGFXHelper.hxx b/chart2/source/inc/BaseGFXHelper.hxx new file mode 100644 index 000000000000..384841261073 --- /dev/null +++ b/chart2/source/inc/BaseGFXHelper.hxx @@ -0,0 +1,102 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_BASEGFXHELPER_HXX +#define CHART2_BASEGFXHELPER_HXX + +#include <basegfx/matrix/b3dhommatrix.hxx> +#include <basegfx/polygon/b3dpolypolygon.hxx> +#include <basegfx/polygon/b3dpolygon.hxx> +#include <basegfx/point/b3dpoint.hxx> +#include <basegfx/range/b2irectangle.hxx> +#include <basegfx/tuple/b3dtuple.hxx> +#include <basegfx/vector/b3dvector.hxx> +#include <basegfx/range/b3drange.hxx> +#include <com/sun/star/awt/Point.hpp> +#include <com/sun/star/awt/Rectangle.hpp> +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/drawing/HomogenMatrix.hpp> +#include <com/sun/star/drawing/Direction3D.hpp> +#include <com/sun/star/drawing/Position3D.hpp> +#include <com/sun/star/drawing/PolyPolygonShape3D.hpp> +#include "charttoolsdllapi.hxx" + +namespace chart +{ +namespace BaseGFXHelper +{ + +OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DRange getBoundVolume( const ::com::sun::star::drawing::PolyPolygonShape3D& rPolyPoly ); + +OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B2IRectangle makeRectangle( + const com::sun::star::awt::Point& rPosition, + const com::sun::star::awt::Size& rSize ); + +OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::awt::Point B2IRectangleToAWTPoint( + const ::basegfx::B2IRectangle& rB2IRectangle ); + +OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::awt::Size B2IRectangleToAWTSize( + const ::basegfx::B2IRectangle& rB2IRectangle ); + +OOO_DLLPUBLIC_CHARTTOOLS +com::sun::star::awt::Rectangle B2IRectangleToAWTRectangle( + const ::basegfx::B2IRectangle& rB2IRectangle ); + +::basegfx::B3DVector Direction3DToB3DVector( + const com::sun::star::drawing::Direction3D& rDirection ); + +com::sun::star::drawing::Direction3D B3DVectorToDirection3D( + const ::basegfx::B3DVector& rB3DVector ); + +::basegfx::B3DVector Position3DToB3DVector( + const com::sun::star::drawing::Position3D& rPosition ); + +com::sun::star::drawing::Position3D B3DVectorToPosition3D( + const ::basegfx::B3DVector& rB3DVector ); + +OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DHomMatrix HomogenMatrixToB3DHomMatrix( + const ::com::sun::star::drawing::HomogenMatrix & rHomogenMatrix ); + +OOO_DLLPUBLIC_CHARTTOOLS +::com::sun::star::drawing::HomogenMatrix B3DHomMatrixToHomogenMatrix( + const ::basegfx::B3DHomMatrix & rB3DMatrix ); + +OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DTuple GetRotationFromMatrix( + const ::basegfx::B3DHomMatrix & rB3DMatrix ); + +OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DTuple GetScaleFromMatrix( + const ::basegfx::B3DHomMatrix & rB3DMatrix ); + +void ReduceToRotationMatrix( ::basegfx::B3DHomMatrix & rB3DMatrix ); + +OOO_DLLPUBLIC_CHARTTOOLS double Deg2Rad( double fDegrees ); +OOO_DLLPUBLIC_CHARTTOOLS double Rad2Deg( double fRadians ); + +} // namespace BaseGFXHelper +} // namespace chart + +// CHART2_BASEGFXHELPER_HXX +#endif diff --git a/chart2/source/inc/CachedDataSequence.hxx b/chart2/source/inc/CachedDataSequence.hxx new file mode 100644 index 000000000000..2ad418939945 --- /dev/null +++ b/chart2/source/inc/CachedDataSequence.hxx @@ -0,0 +1,192 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_CACHEDDATASEQUENCE_HXX +#define _CHART_CACHEDDATASEQUENCE_HXX + +// helper classes +#include <cppuhelper/compbase7.hxx> +#include <comphelper/uno3.hxx> +#include <comphelper/broadcasthelper.hxx> +#include <comphelper/propertycontainer.hxx> +#include <comphelper/proparrhlp.hxx> +#include "ServiceMacros.hxx" + +// interfaces and types +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/chart2/data/XDataSequence.hpp> +#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp> +#include <com/sun/star/chart2/data/XTextualDataSequence.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/util/XModifyBroadcaster.hpp> + +#include <vector> + +// ____________________ +namespace chart +{ + +namespace impl +{ +typedef ::cppu::WeakComponentImplHelper7< + ::com::sun::star::chart2::data::XDataSequence, + ::com::sun::star::chart2::data::XNumericalDataSequence, + ::com::sun::star::chart2::data::XTextualDataSequence, + ::com::sun::star::util::XCloneable, + ::com::sun::star::util::XModifyBroadcaster, + ::com::sun::star::lang::XInitialization, + ::com::sun::star::lang::XServiceInfo > + CachedDataSequence_Base; +} + +class CachedDataSequence : + public ::comphelper::OMutexAndBroadcastHelper, + public ::comphelper::OPropertyContainer, + public ::comphelper::OPropertyArrayUsageHelper< CachedDataSequence >, + public impl::CachedDataSequence_Base +{ +public: + /** constructs an empty sequence + */ + CachedDataSequence(); + + explicit CachedDataSequence( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext ); + + /** creates a sequence and initializes it with the given string. This is + especially useful for labels, which only have one element. + */ + explicit CachedDataSequence( const ::rtl::OUString & rSingleText ); + + /// Copy CTOR + explicit CachedDataSequence( const CachedDataSequence & rSource ); + + virtual ~CachedDataSequence(); + + /// establish methods for factory instatiation + APPHELPER_SERVICE_FACTORY_HELPER( CachedDataSequence ) + /// declare XServiceInfo methods + APPHELPER_XSERVICEINFO_DECL() + + /// merge XInterface implementations + DECLARE_XINTERFACE() + /// merge XTypeProvider implementations + DECLARE_XTYPEPROVIDER() + +protected: + // ____ XPropertySet ____ + /// @see ::com::sun::star::beans::XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() + throw (::com::sun::star::uno::RuntimeException); + /// @see ::comphelper::OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + /// @see ::comphelper::OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const; + + // ____ XDataSequence ____ + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getData() + throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSourceRangeRepresentation() + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL generateLabel( + ::com::sun::star::chart2::data::LabelOrigin nLabelOrigin ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex( ::sal_Int32 nIndex ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException); + + // ____ XNumericalDataSequence ____ + /// @see ::com::sun::star::chart::data::XNumericalDataSequence + virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getNumericalData() throw (::com::sun::star::uno::RuntimeException); + + // ____ XTextualDataSequence ____ + /// @see ::com::sun::star::chart::data::XTextualDataSequence + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getTextualData() throw (::com::sun::star::uno::RuntimeException); + + // ____ XCloneable ____ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() + throw (::com::sun::star::uno::RuntimeException); + + // ____ XModifyBroadcaster ____ + virtual void SAL_CALL addModifyListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeModifyListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + + // ::com::sun::star::lang::XInitialization: + virtual void SAL_CALL initialize(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > & aArguments) + throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::uno::Exception); + + // <properties> + sal_Int32 m_nNumberFormatKey; + ::rtl::OUString m_sRole; + // </properties> + + enum DataType + { + NUMERICAL, + TEXTUAL, + MIXED + }; + + /** This method registers all properties. It should be called by all + constructors. + */ + void registerProperties(); + +private: + /** is used by interface method getNumericalData(). + */ + ::com::sun::star::uno::Sequence< double > Impl_getNumericalData() const; + /** is used by interface method getTextualData(). + */ + ::com::sun::star::uno::Sequence< ::rtl::OUString > Impl_getTextualData() const; + /** is used by interface method getData(). + */ + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > Impl_getMixedData() const; + +private: + enum DataType m_eCurrentDataType; + + ::com::sun::star::uno::Sequence< double > m_aNumericalSequence; + ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aTextualSequence; + ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Any > m_aMixedSequence; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > + m_xModifyEventForwarder; +}; + +} // namespace chart + + +// _CHART_CACHEDDATASEQUENCE_HXX +#endif diff --git a/chart2/source/inc/CharacterProperties.hxx b/chart2/source/inc/CharacterProperties.hxx new file mode 100644 index 000000000000..0742435e9bfe --- /dev/null +++ b/chart2/source/inc/CharacterProperties.hxx @@ -0,0 +1,147 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_CHARACTERPROPERTIES_HXX +#define CHART_CHARACTERPROPERTIES_HXX + +#include "PropertyHelper.hxx" +#include "FastPropertyIdRanges.hxx" +#include "charttoolsdllapi.hxx" +#include <com/sun/star/beans/Property.hpp> +#include <com/sun/star/beans/XMultiPropertySet.hpp> +#include <com/sun/star/awt/FontDescriptor.hpp> + +#include <vector> + +namespace chart +{ + +// implements services +// com.sun.star.style.CharacterProperties +// com.sun.star.style.CharacterPropertiesAsian +// com.sun.star.style.CharacterPropertiesComplex +class OOO_DLLPUBLIC_CHARTTOOLS CharacterProperties +{ +public: + // FastProperty Ids for properties + enum + { + // com.sun.star.style.CharacterProperties + PROP_CHAR_FONT_NAME = FAST_PROPERTY_ID_START_CHAR_PROP, // ? + PROP_CHAR_FONT_STYLE_NAME, + PROP_CHAR_FONT_FAMILY, + PROP_CHAR_FONT_CHAR_SET, + PROP_CHAR_FONT_PITCH, + PROP_CHAR_COLOR, +// PROP_CHAR_BACKGROUND_COLOR, +//-- PROP_CHAR_BACKGROUND_TRANSPARENCY, alpah channnel in COLOR + PROP_CHAR_ESCAPEMENT, + PROP_CHAR_CHAR_HEIGHT, + PROP_CHAR_UNDERLINE, + PROP_CHAR_UNDERLINE_COLOR, + PROP_CHAR_UNDERLINE_HAS_COLOR, + PROP_CHAR_WEIGHT, + PROP_CHAR_POSTURE, + PROP_CHAR_AUTO_KERNING, + PROP_CHAR_KERNING, +// PROP_CHAR_CASE_MAPPING, +// PROP_CHAR_ROTATION, +//-- PROP_CHAR_ROTATION_IS_FIT_TO_LINE, +// PROP_CHAR_SCALE_WIDTH, + PROP_CHAR_ESCAPEMENT_HEIGHT, + +// PROP_CHAR_CROSSED_OUT, + PROP_CHAR_STRIKE_OUT, + PROP_CHAR_WORD_MODE, +// PROP_CHAR_FLASH, + PROP_CHAR_LOCALE, +//-- PROP_CHAR_KEEP_TOGETHER, +//-- PROP_CHAR_NO_LINE_BREAK, + PROP_CHAR_SHADOWED, + PROP_CHAR_CONTOURED, + PROP_CHAR_RELIEF, +//-- PROP_CHAR_COMBINE_IS_ON, +//-- PROP_CHAR_COMBINE_PREFIX, +//-- PROP_CHAR_COMBINE_SUFFIX, + + PROP_CHAR_EMPHASIS, +// PROP_CHAR_RUBY_TEXT, +// PROP_CHAR_RUBY_ADJUST, +// PROP_CHAR_RUBY_STYLE_NAME, +// PROP_CHAR_RUBY_IS_ABOVE, +// PROP_CHAR_INHIBIT_HYPHENATION, + + // Asian (com.sun.star.style.CharacterPropertiesAsian) + PROP_CHAR_ASIAN_FONT_NAME, + PROP_CHAR_ASIAN_FONT_STYLE_NAME, + PROP_CHAR_ASIAN_FONT_FAMILY, + PROP_CHAR_ASIAN_CHAR_SET, + PROP_CHAR_ASIAN_FONT_PITCH, + PROP_CHAR_ASIAN_CHAR_HEIGHT, + PROP_CHAR_ASIAN_WEIGHT, + PROP_CHAR_ASIAN_POSTURE, + PROP_CHAR_ASIAN_LOCALE, +//-- PROP_CHAR_ASIAN_USE_SCRIPT_TYPE_DISTANCE, +//-- PROP_CHAR_ASIAN_USE_FORBIDDEN_RULES, +//-- PROP_CHAR_ASIAN_HANGING_PUNCTUATION_ALLOWED, + + // Complex Text Layout (com.sun.star.style.CharacterPropertiesComplex) + PROP_CHAR_COMPLEX_FONT_NAME, + PROP_CHAR_COMPLEX_FONT_STYLE_NAME, + PROP_CHAR_COMPLEX_FONT_FAMILY, + PROP_CHAR_COMPLEX_CHAR_SET, + PROP_CHAR_COMPLEX_FONT_PITCH, + PROP_CHAR_COMPLEX_CHAR_HEIGHT, + PROP_CHAR_COMPLEX_WEIGHT, + PROP_CHAR_COMPLEX_POSTURE, + PROP_CHAR_COMPLEX_LOCALE, + PROP_PARA_IS_CHARACTER_DISTANCE, + + PROP_WRITING_MODE, + + // don't use + FAST_PROPERTY_ID_END_CHAR_PROP + }; + + static void AddPropertiesToVector( + ::std::vector< ::com::sun::star::beans::Property > & rOutProperties ); + + static void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ); + + static bool IsCharacterPropertyHandle( sal_Int32 nHandle ); + + static ::com::sun::star::awt::FontDescriptor createFontDescriptorFromPropertySet( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XMultiPropertySet > & xMultiPropSet ); + +private: + // not implemented + CharacterProperties(); +}; + +} // namespace chart + +// CHART_CHARACTERPROPERTIES_HXX +#endif diff --git a/chart2/source/inc/ChartDebugTrace.hxx b/chart2/source/inc/ChartDebugTrace.hxx new file mode 100644 index 000000000000..d31267f9cfc4 --- /dev/null +++ b/chart2/source/inc/ChartDebugTrace.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_CHARTDEBUGTRACE_HXX +#define CHART2_CHARTDEBUGTRACE_HXX + +#include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/chart2/XDiagram.hpp> +#include "charttoolsdllapi.hxx" + +#define CHART_TRACE_OSL_DEBUG_LEVEL 2 + +namespace chart +{ +namespace debug +{ + +#if OSL_DEBUG_LEVEL >= CHART_TRACE_OSL_DEBUG_LEVEL +/** Does several OSL_TRACEs that show information about the given chart document + (e.g. the chart-type manager, diagrams etc.) + + If OSL_DEBUG_LEVEL is less than CHART_TRACE_OSL_DEBUG_LEVEL this + function does nothing. + */ +OOO_DLLPUBLIC_CHARTTOOLS void ChartDebugTraceDocument( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument > & xDoc, + int nIndent = 0 ); + +/** Does several OSL_TRACEs that show information about the given diagram + (e.g. coordinate systems, data series etc.) + + If OSL_DEBUG_LEVEL is less than CHART_TRACE_OSL_DEBUG_LEVEL this + function does nothing. + */ +OOO_DLLPUBLIC_CHARTTOOLS void ChartDebugTraceDiagram( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram, + int nIndent = 0 ); +#endif + +} // namespace debug +} // namespace chart + +// CHART2_CHARTDEBUGTRACE_HXX +#endif diff --git a/chart2/source/inc/ChartModelHelper.hxx b/chart2/source/inc/ChartModelHelper.hxx new file mode 100644 index 000000000000..fb087abf15fd --- /dev/null +++ b/chart2/source/inc/ChartModelHelper.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_CONTROLLER_CHARTMODELHELPER_HXX +#define _CHART2_CONTROLLER_CHARTMODELHELPER_HXX + +#include <com/sun/star/chart2/XChartType.hpp> +#include <com/sun/star/chart2/XDataSeries.hpp> +#include <com/sun/star/chart2/XDiagram.hpp> +#include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/chart2/XUndoManager.hpp> +#include <com/sun/star/chart2/data/XDataProvider.hpp> +#include <com/sun/star/chart2/data/XRangeHighlighter.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> + +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include "charttoolsdllapi.hxx" + +#include <vector> + +//............................................................................. +namespace chart +{ +//............................................................................. + +//----------------------------------------------------------------------------- +/** +*/ + +class OOO_DLLPUBLIC_CHARTTOOLS ChartModelHelper +{ +public: + static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XRangeHighlighter > createRangeHighlighter( + const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier >& xSelectionSupplier ); + + static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataProvider > createInternalDataProvider( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc, bool bConnectToModel ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > + findDiagram( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > + findDiagram( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDoc ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem > + getFirstCoordinateSystem( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModel ); + + SAL_DLLPRIVATE static ::std::vector< ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > > getDataSeries( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument > & xChartDoc ); + static ::std::vector< ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > > getDataSeries( + const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > & xModel ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType > + getChartTypeOfSeries( + const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xModel + , const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xGivenDataSeries ); + + static ::com::sun::star::awt::Size getDefaultPageSize(); + + static ::com::sun::star::awt::Size getPageSize( + const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xModel ); + + static void setPageSize( const ::com::sun::star::awt::Size& rSize + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xModel ); + + static void triggerRangeHighlighting( const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xModel ); + + static bool isIncludeHiddenCells( const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel ); + + static bool setIncludeHiddenCells( bool bIncludeHiddenCells, const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel ); +}; + +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx new file mode 100644 index 000000000000..729cfc86bc52 --- /dev/null +++ b/chart2/source/inc/ChartTypeHelper.hxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_CHARTTYPEHELPER_HXX +#define _CHART2_CHARTTYPEHELPER_HXX + +#include <com/sun/star/chart2/XChartType.hpp> +#include <com/sun/star/chart2/AxisType.hpp> +#include <com/sun/star/chart2/XDataSeries.hpp> +#include <com/sun/star/chart2/XDiagram.hpp> +#include <com/sun/star/drawing/Direction3D.hpp> +#include "charttoolsdllapi.hxx" + +//............................................................................. +namespace chart +{ +//............................................................................. + +//----------------------------------------------------------------------------- +/** +*/ + +class OOO_DLLPUBLIC_CHARTTOOLS ChartTypeHelper +{ +public: + static sal_Bool isSupportingGeometryProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); + static sal_Bool isSupportingStatisticProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); + static sal_Bool isSupportingRegressionProperties(const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); + static sal_Bool isSupportingMainAxis( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ); + static sal_Bool isSupportingSecondaryAxis( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ); + static sal_Bool isSupportingAreaProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); + static sal_Bool isSupportingSymbolProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); + static sal_Bool isSupportingOverlapAndGapWidthProperties( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); + static sal_Bool isSupportingBarConnectors( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); + static sal_Bool isSupportingRightAngledAxes( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); + static bool isSupportingAxisSideBySide( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool isSupportingStartingAngle( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); + //starting value for bars or baseline for areas for example + static bool isSupportingBaseValue( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); + static bool shiftTicksAtXAxisPerDefault( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); + static bool isSupportingAxisPositioning( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ); + + //returns sequence of ::com::sun::star::chart::DataLabelPlacement + static ::com::sun::star::uno::Sequence < sal_Int32 > getSupportedLabelPlacements( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Bool bSwapXAndY + , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries ); + + //returns sequence of ::com::sun::star::chart::MissingValueTreatment + static ::com::sun::star::uno::Sequence < sal_Int32 > getSupportedMissingValueTreatments( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); + + SAL_DLLPRIVATE static ::com::sun::star::drawing::Direction3D getDefaultSimpleLightDirection( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); + SAL_DLLPRIVATE static ::com::sun::star::drawing::Direction3D getDefaultRealisticLightDirection( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); + SAL_DLLPRIVATE static sal_Int32 getDefaultDirectLightColor( bool bSimple, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); + SAL_DLLPRIVATE static sal_Int32 getDefaultAmbientLightColor( bool bSimple, const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); + static sal_Int32 getNumberOfDisplayedSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, sal_Int32 nNumberOfSeries ); + SAL_DLLPRIVATE static bool noBordersForSimpleScheme( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); + + static bool isSeriesInFrontOfAxisLine( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); + + static sal_Int32 //one of ::com::sun::star::chart2::AxisType + getAxisType( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType + , sal_Int32 nDimensionIndex ); + + static rtl::OUString getRoleOfSequenceForYAxisNumberFormatDetection( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType >& xChartType ); + + static rtl::OUString getRoleOfSequenceForDataLabelNumberFormatDetection( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType >& xChartType ); + + static bool shouldLabelNumberFormatKeyBeDetectedFromYAxis( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType >& xChartType ); + + static bool isSupportingOnlyDeepStackingFor3D( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType ); +}; + +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/ChartViewHelper.hxx b/chart2/source/inc/ChartViewHelper.hxx new file mode 100644 index 000000000000..772841418e45 --- /dev/null +++ b/chart2/source/inc/ChartViewHelper.hxx @@ -0,0 +1,51 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_CONTROLLER_CHARTVIEWHELPER_HXX +#define _CHART2_CONTROLLER_CHARTVIEWHELPER_HXX + +#include <com/sun/star/frame/XModel.hpp> +#include "charttoolsdllapi.hxx" + +//............................................................................. +namespace chart +{ +//............................................................................. + +//----------------------------------------------------------------------------- +/** +*/ + +class OOO_DLLPUBLIC_CHARTTOOLS ChartViewHelper +{ +public: + static void setViewToDirtyState( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel ); +}; + +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/CloneHelper.hxx b/chart2/source/inc/CloneHelper.hxx new file mode 100644 index 000000000000..6747bd614d84 --- /dev/null +++ b/chart2/source/inc/CloneHelper.hxx @@ -0,0 +1,124 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_CLONEHELPER_HXX +#define CHART2_CLONEHELPER_HXX + +#include <com/sun/star/util/XCloneable.hpp> + +#include <map> +#include <functional> +#include <algorithm> + +namespace chart +{ +namespace CloneHelper +{ + +/// functor that clones a UNO-Reference +template< class Interface > + struct CreateRefClone : public ::std::unary_function< Interface, Interface > +{ + Interface operator() ( const Interface & xOther ) + { + Interface xResult; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > + xCloneable( xOther, ::com::sun::star::uno::UNO_QUERY ); + if( xCloneable.is()) + xResult.set( xCloneable->createClone(), ::com::sun::star::uno::UNO_QUERY ); + + return xResult; + } +}; + +/// functor that clones a map element with a UNO-Reference as value +template< typename Key, class Interface > + struct CreateRefWithKeyClone : public ::std::unary_function< + ::std::pair< Key, Interface >, + ::std::pair< Key, Interface > > +{ + ::std::pair< Key, Interface > operator() ( + const ::std::pair< Key, Interface > & rOther ) + { + Interface xResult; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > + xCloneable( rOther.second, ::com::sun::star::uno::UNO_QUERY ); + if( xCloneable.is()) + xResult.set( xCloneable->createClone(), ::com::sun::star::uno::UNO_QUERY ); + + return ::std::make_pair< Key, Interface >( rOther.first, xResult ); + } +}; + +/// clones a vector of UNO-References +template< class Interface > + void CloneRefVector( + const ::std::vector< Interface > & rSource, + ::std::vector< Interface > & rDestination ) +{ + ::std::transform( rSource.begin(), rSource.end(), + ::std::back_inserter( rDestination ), + CreateRefClone< Interface >()); +} + +template< typename Key, class Interface > + void CloneRefPairVector( + const ::std::vector< ::std::pair< Key, Interface > > & rSource, + ::std::vector< ::std::pair< Key, Interface > > & rDestination ) +{ + ::std::transform( rSource.begin(), rSource.end(), + ::std::back_inserter( rDestination ), + CreateRefWithKeyClone< Key, Interface >()); +} + +/// clones a map of elements with a UNO-Reference as value +template< typename Key, class Interface > + void CloneRefMap( + const ::std::map< Key, Interface > & rSource, + ::std::map< Key, Interface > & rDestination ) +{ + ::std::transform( rSource.begin(), rSource.end(), + ::std::inserter( rDestination, rDestination.begin() ), + CreateRefWithKeyClone< const Key, Interface >()); +} + +/// clones a UNO-sequence of UNO-References +template< class Interface > + void CloneRefSequence( + const ::com::sun::star::uno::Sequence< Interface > & rSource, + ::com::sun::star::uno::Sequence< Interface > & rDestination ) +{ + rDestination.realloc( rSource.getLength()); + ::std::transform( rSource.getConstArray(), rSource.getConstArray() + rSource.getLength(), + rDestination.getArray(), + CreateRefClone< Interface >()); +} + +} // namespace CloneHelper +} // namespace chart + +// CHART2_CLONEHELPER_HXX +#endif diff --git a/chart2/source/inc/ColorPerPointHelper.hxx b/chart2/source/inc/ColorPerPointHelper.hxx new file mode 100644 index 000000000000..af49918a1154 --- /dev/null +++ b/chart2/source/inc/ColorPerPointHelper.hxx @@ -0,0 +1,65 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_COLORPERPOINTHELPER_HXX +#define _CHART2_COLORPERPOINTHELPER_HXX + +#include <com/sun/star/beans/XPropertySet.hpp> +#include "charttoolsdllapi.hxx" + +//............................................................................. +namespace chart +{ +//............................................................................. + +//----------------------------------------------------------------------------- +/** +*/ + +class OOO_DLLPUBLIC_CHARTTOOLS ColorPerPointHelper +{ +public: + static bool hasPointOwnColor( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xDataSeriesProperties + , sal_Int32 nPointIndex + , const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xDataPointProperties //may be NULL this is just for performance + ); + + // returns true if AttributedDataPoints contains nPointIndex and the + // property Color is DEFAULT + SAL_DLLPRIVATE static bool hasPointOwnProperties( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xSeriesProperties + , sal_Int32 nPointIndex ); +}; + +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/CommonConverters.hxx b/chart2/source/inc/CommonConverters.hxx new file mode 100644 index 000000000000..1ce032b3af69 --- /dev/null +++ b/chart2/source/inc/CommonConverters.hxx @@ -0,0 +1,279 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_COMMON_CONVERTERS_HXX +#define __CHART_COMMON_CONVERTERS_HXX + +#include <tools/poly.hxx> +#include <com/sun/star/awt/Point.hpp> +#include <com/sun/star/awt/Rectangle.hpp> +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/drawing/Direction3D.hpp> +#include <com/sun/star/drawing/HomogenMatrix.hpp> +#include <com/sun/star/drawing/HomogenMatrix3.hpp> +#include <com/sun/star/drawing/PolyPolygonBezierCoords.hpp> +#include <com/sun/star/drawing/PointSequenceSequence.hpp> +#include <com/sun/star/drawing/Position3D.hpp> +#include <com/sun/star/drawing/PolyPolygonShape3D.hpp> +#include <com/sun/star/text/WritingMode.hpp> +#include <com/sun/star/chart2/data/XDataSequence.hpp> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/point/b3dpoint.hxx> +#include <basegfx/vector/b3dvector.hxx> +#include "charttoolsdllapi.hxx" + +#include <vector> +#include <algorithm> + +//............................................................................. +namespace chart +{ +//............................................................................. + +//----------------------------------------------------------------------------- +/** +diverse methods for class conversions; e.g. ::basegfx::B3DHomMatrix to HomogenMatrix +and operations e.g drawing::Position3D + drawing::Direction3D +*/ + +//----------------------------------------------------------------------------- +/** ::basegfx::B3DHomMatrix -> HomogenMatrix +*/ +OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::HomogenMatrix + B3DHomMatrixToHomogenMatrix( const ::basegfx::B3DHomMatrix& rM ); + +//----------------------------------------------------------------------------- +/** HomogenMatrix -> ::basegfx::B3DHomMatrix +*/ +OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DHomMatrix HomogenMatrixToB3DHomMatrix( const com::sun::star::drawing::HomogenMatrix& rHM ); + +//----------------------------------------------------------------------------- +/** ::basegfx::B3DHomMatrix -> B2DHomMatrix +*/ +OOO_DLLPUBLIC_CHARTTOOLS +::basegfx::B2DHomMatrix IgnoreZ( const ::basegfx::B3DHomMatrix& rM ); + +//----------------------------------------------------------------------------- +/** B2DHomMatrix <-> HomogenMatrix3 +*/ +OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::HomogenMatrix3 + B2DHomMatrixToHomogenMatrix3( const ::basegfx::B2DHomMatrix& rM ); + +//----------------------------------------------------------------------------- +/** Position3D -> B3DPoint +*/ +OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DPoint Position3DToB3DPoint( const com::sun::star::drawing::Position3D& rPosition ); + +//----------------------------------------------------------------------------- +/** B3DVector -> Direction3D +*/ +OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Direction3D B3DVectorToDirection3D( const ::basegfx::B3DVector& rVector); + +//----------------------------------------------------------------------------- +/** B3DPoint -> Position3D +*/ +OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Position3D B3DPointToPosition3D( const ::basegfx::B3DPoint& rPoint); + +//----------------------------------------------------------------------------- +/** Direction3D -> B3DVector +*/ +OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DVector Direction3DToB3DVector( const com::sun::star::drawing::Direction3D& rDirection); + +//----------------------------------------------------------------------------- +/** PolyPolygonShape3D + drawing::Position3D -> PolyPolygonShape3D +*/ +OOO_DLLPUBLIC_CHARTTOOLS +void AddPointToPoly( ::com::sun::star::drawing::PolyPolygonShape3D& rPoly + , const com::sun::star::drawing::Position3D& rPos + , sal_Int32 nSequenceIndex=0 ); + +//----------------------------------------------------------------------------- +/** get a single Point from a Polygon +*/ +OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::drawing::Position3D getPointFromPoly( + const ::com::sun::star::drawing::PolyPolygonShape3D& rPolygon + , sal_Int32 nPointIndex, sal_Int32 nPolyIndex=0 ); + +//----------------------------------------------------------------------------- +OOO_DLLPUBLIC_CHARTTOOLS +void addPolygon( com::sun::star::drawing::PolyPolygonShape3D& rRet + , const com::sun::star::drawing::PolyPolygonShape3D& rAdd ); +//----------------------------------------------------------------------------- +/** PolyPolygonShape3D + PolyPolygonShape3D -> PolyPolygonShape3D +*/ +OOO_DLLPUBLIC_CHARTTOOLS +void appendPoly( com::sun::star::drawing::PolyPolygonShape3D& rRet + , const com::sun::star::drawing::PolyPolygonShape3D& rAdd ); + +//----------------------------------------------------------------------------- +/** PolyPolygonBezierCoords -> PolyPolygonShape3D +*/ +OOO_DLLPUBLIC_CHARTTOOLS +com::sun::star::drawing::PolyPolygonShape3D BezierToPoly( + const com::sun::star::drawing::PolyPolygonBezierCoords& rBezier ); + +//----------------------------------------------------------------------------- +/** PolyPolygonShape3D -> drawing::PointSequenceSequence (2D) +*/ +OOO_DLLPUBLIC_CHARTTOOLS +com::sun::star::drawing::PointSequenceSequence PolyToPointSequence( + const com::sun::star::drawing::PolyPolygonShape3D& rPolyPolygon ); + +//----------------------------------------------------------------------------- +/** drawing::PointSequenceSequence + drawing::PointSequenceSequence +*/ +OOO_DLLPUBLIC_CHARTTOOLS +void appendPointSequence( com::sun::star::drawing::PointSequenceSequence& rTarget + , com::sun::star::drawing::PointSequenceSequence& rAdd ); + +//----------------------------------------------------------------------------- +/** Position3D + Direction3D == Position3D +*/ +OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Position3D + operator+( const com::sun::star::drawing::Position3D& rPos + , const com::sun::star::drawing::Direction3D& rDirection); + +//----------------------------------------------------------------------------- +/** Position3D - Position3D == Direction3D +*/ +OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Direction3D + operator-( const com::sun::star::drawing::Position3D& rPos1 + , const com::sun::star::drawing::Position3D& rPos2); + +//----------------------------------------------------------------------------- +/** Position3D == Position3D ? +*/ +OOO_DLLPUBLIC_CHARTTOOLS +bool operator==( const com::sun::star::drawing::Position3D& rPos1 + , const com::sun::star::drawing::Position3D& rPos2); + +//----------------------------------------------------------------------------- +/** awt::Rect --> awt::Point (2D) +*/ +OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::awt::Point ToPoint( const com::sun::star::awt::Rectangle& rRectangle ); + +//----------------------------------------------------------------------------- +/** awt::Rect --> awt::Size (2D) +*/ +OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::awt::Size ToSize( const com::sun::star::awt::Rectangle& rRectangle ); + +//----------------------------------------------------------------------------- +/** Position3D --> awt::Point (2D) +*/ +OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::awt::Point Position3DToAWTPoint( const com::sun::star::drawing::Position3D& rPos ); + +//----------------------------------------------------------------------------- +/** Direction3D --> awt::Size (2D) +*/ +OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::awt::Size Direction3DToAWTSize( const com::sun::star::drawing::Direction3D& rDirection ); + +//----------------------------------------------------------------------------- +/** B3DPoint -> Sequence<double> +*/ +OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::uno::Sequence< double > B3DPointToSequence( const ::basegfx::B3DPoint& rPoint ); + +//----------------------------------------------------------------------------- +/** Sequence<double> -> drawing::Position3D +*/ +OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::drawing::Position3D + SequenceToPosition3D( const com::sun::star::uno::Sequence< double >& rSeq ); + +//----------------------------------------------------------------------------- +/** drawing::Position3D -> Sequence<double> +*/ + +OOO_DLLPUBLIC_CHARTTOOLS com::sun::star::uno::Sequence< double > + Position3DToSequence( const com::sun::star::drawing::Position3D& rPosition ); + +//----------------------------------------------------------------------------- +/** chart2::XDataSequence -> uno::Sequence< double > +*/ + +OOO_DLLPUBLIC_CHARTTOOLS +::com::sun::star::uno::Sequence< double > DataSequenceToDoubleSequence( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSequence > & xDataSequence ); + +OOO_DLLPUBLIC_CHARTTOOLS +::com::sun::star::uno::Sequence< rtl::OUString > DataSequenceToStringSequence( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSequence > & xDataSequence ); + +//----------------------------------------------------------------------------- +/** uno::Sequence< uno::Sequence< T > > -> uno::Sequence< T > + */ +template< typename T > +::com::sun::star::uno::Sequence< T > + FlattenSequence( const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Sequence< T > > & aSeqSeq ) +{ + sal_Int32 nOuter, nInner, nCount = 0, + nResultSize = 0; + const sal_Int32 nOuterSize = aSeqSeq.getLength(); + for( nOuter=0; nOuter<nOuterSize; ++nOuter ) + nResultSize += aSeqSeq[nOuter].getLength(); + ::com::sun::star::uno::Sequence< T > aResult( nResultSize ); + + for( nOuter=0; nOuter<nOuterSize; ++nOuter ) + { + const sal_Int32 nInnerSize = aSeqSeq[nOuter].getLength(); + for( nInner=0; nInner<nInnerSize; ++nInner, ++nCount ) + aResult[nCount] = aSeqSeq[nOuter][nInner]; + } + return aResult; +} + +template< typename T > + ::std::vector< T > + FlattenVector( const ::std::vector< ::std::vector< T > > & rVecVec ) +{ + typedef ::std::vector< T > tFlatVec; + typedef ::std::vector< tFlatVec > tVecVec; + + tFlatVec aResult; + typename tVecVec::const_iterator aOuterEnd( rVecVec.end()); + for( typename tVecVec::const_iterator aOuterIt( rVecVec.begin()); aOuterIt != aOuterEnd; ++aOuterIt ) + ::std::copy( aOuterIt->begin(), aOuterIt->end(), back_inserter( aResult )); + return aResult; +} + +OOO_DLLPUBLIC_CHARTTOOLS +sal_Bool hasDoubleValue( const ::com::sun::star::uno::Any& rAny ); + +OOO_DLLPUBLIC_CHARTTOOLS +sal_Bool hasLongOrShortValue( const ::com::sun::star::uno::Any& rAny ); +OOO_DLLPUBLIC_CHARTTOOLS +sal_Int16 getShortForLongAlso( const ::com::sun::star::uno::Any& rAny ); + +OOO_DLLPUBLIC_CHARTTOOLS +bool replaceParamterInString( rtl::OUString & rInOutResourceString, + const rtl::OUString & rParamToReplace, + const rtl::OUString & rReplaceWith ); + +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/CommonFunctors.hxx b/chart2/source/inc/CommonFunctors.hxx new file mode 100644 index 000000000000..13435741e63e --- /dev/null +++ b/chart2/source/inc/CommonFunctors.hxx @@ -0,0 +1,228 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_COMMONFUNCTORS_HXX +#define CHART2_COMMONFUNCTORS_HXX + +#include <algorithm> +#include <functional> +#include <rtl/math.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <rtl/ustring.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include "charttoolsdllapi.hxx" + +namespace chart +{ +namespace CommonFunctors +{ + +/** unary function to convert any type T into a ::com::sun::star::uno::Any. + + <p>uno::makeAny is an inline function. Thus is cannot be taken directly + (via mem_fun_ptr)</p> +*/ +template< typename T > + struct makeAny : public ::std::unary_function< T, ::com::sun::star::uno::Any > +{ + ::com::sun::star::uno::Any operator() ( const T & aVal ) + { + return ::com::sun::star::uno::makeAny( aVal ); + } +}; + +/** unary function to convert ::com::sun::star::uno::Any into a double number. + + <p>In case no number can be generated from the Any, NaN (see + rtl::math::SetNAN()) is returned.</p> +*/ +struct OOO_DLLPUBLIC_CHARTTOOLS AnyToDouble : public ::std::unary_function< ::com::sun::star::uno::Any, double > +{ + double operator() ( const ::com::sun::star::uno::Any & rAny ) + { + double fResult; + ::rtl::math::setNan( & fResult ); + + ::com::sun::star::uno::TypeClass eClass( rAny.getValueType().getTypeClass() ); + if( eClass == ::com::sun::star::uno::TypeClass_STRING ) + { + rtl_math_ConversionStatus eConversionStatus; + fResult = ::rtl::math::stringToDouble( + * reinterpret_cast< const ::rtl::OUString * >( rAny.getValue() ), + sal_Char( '.' ), sal_Char( ',' ), + & eConversionStatus, NULL ); + + if( eConversionStatus != rtl_math_ConversionStatus_Ok ) + ::rtl::math::setNan( & fResult ); + } + else if( eClass == ::com::sun::star::uno::TypeClass_DOUBLE ) + { + fResult = * reinterpret_cast< const double * >( rAny.getValue() ); + } + + return fResult; + } +}; + +/** unary function to convert ::com::sun::star::uno::Any into an + ::rtl::OUString. +*/ +struct OOO_DLLPUBLIC_CHARTTOOLS AnyToString : public ::std::unary_function< ::com::sun::star::uno::Any, ::rtl::OUString > +{ + ::rtl::OUString operator() ( const ::com::sun::star::uno::Any & rAny ) + { + ::com::sun::star::uno::TypeClass eClass( rAny.getValueType().getTypeClass() ); + if( eClass == ::com::sun::star::uno::TypeClass_DOUBLE ) + { + const double* pDouble = reinterpret_cast< const double * >( rAny.getValue() ); + if( ::rtl::math::isNan(*pDouble) ) + return ::rtl::OUString(); + return ::rtl::math::doubleToUString( + * pDouble, + rtl_math_StringFormat_Automatic, + -1, // use maximum decimal places available + sal_Char( '.' ), // decimal separator + false // do not erase trailing zeros + ); + } + else if( eClass == ::com::sun::star::uno::TypeClass_STRING ) + { + return * reinterpret_cast< const ::rtl::OUString * >( rAny.getValue() ); + } + + return ::rtl::OUString(); + } +}; + +/** unary function to convert an ::rtl::OUString into a double number. + + <p>For conversion rtl::math::StringToDouble is used.</p> + */ +struct OOO_DLLPUBLIC_CHARTTOOLS OUStringToDouble : public ::std::unary_function< ::rtl::OUString, double > +{ + double operator() ( const ::rtl::OUString & rStr ) + { + rtl_math_ConversionStatus eConversionStatus; + double fResult = ::rtl::math::stringToDouble( rStr, '.', ',', & eConversionStatus, NULL ); + + if( eConversionStatus != rtl_math_ConversionStatus_Ok ) + ::rtl::math::setNan( & fResult ); + + return fResult; + } +}; + +/** unary function to convert a double number into an ::rtl::OUString. + + <p>For conversion rtl::math::DoubleToOUString is used.</p> + */ +struct OOO_DLLPUBLIC_CHARTTOOLS DoubleToOUString : public ::std::unary_function< double, ::rtl::OUString > +{ + ::rtl::OUString operator() ( double fNumber ) + { + return ::rtl::math::doubleToUString( + fNumber, + rtl_math_StringFormat_Automatic, + -1, // use maximum number of decimal places + static_cast< sal_Char >( '.' ), + false // do not erase trailing zeros + ); + } +}; + +// ================================================================================ + +/** can be used to find an element with a specific first element in e.g. a + vector of pairs (for searching keys in maps you will of course use map::find) + */ +template< typename First, typename Second > + class FirstOfPairEquals : public ::std::unary_function< ::std::pair< First, Second >, bool > +{ +public: + FirstOfPairEquals( const First & aVal ) + : m_aValueToCompareWith( aVal ) + {} + bool operator() ( const ::std::pair< First, Second > & rElem ) + { + return rElem.first == m_aValueToCompareWith; + } + +private: + First m_aValueToCompareWith; +}; + +/** can be used to find a certain value in a map + + ::std::find_if( aMap.begin(), aMap.end(), + SecondOfPairEquals< string, int >( 42 )); + */ +template< typename Key, typename Value > + class SecondOfPairEquals : public ::std::unary_function< ::std::pair< Key, Value >, bool > +{ +public: + SecondOfPairEquals( const Value & aVal ) + : m_aValueToCompareWith( aVal ) + {} + bool operator() ( const ::std::pair< Key, Value > & rMapElem ) + { + return rMapElem.second == m_aValueToCompareWith; + } + +private: + Value m_aValueToCompareWith; +}; + +/** Searches for data in a given map, i.e. not for the key but for the data + pointed to by the keys. + + To find a key (value) you can use rMap.find( rValue ) + */ +template< class MapType > + inline typename MapType::const_iterator + findValueInMap( const MapType & rMap, const typename MapType::mapped_type & rData ) +{ + return ::std::find_if( rMap.begin(), rMap.end(), + ::std::compose1( ::std::bind2nd( + ::std::equal_to< typename MapType::mapped_type >(), + rData ), + ::std::select2nd< typename MapType::value_type >())); +} + +/** Functor that deletes the object behind the given pointer by calling the + delete operator + */ +template< typename T > + struct DeletePtr : public ::std::unary_function< T *, void > +{ + void operator() ( T * pObj ) + { delete pObj; } +}; + +} // namespace CommonFunctors +} // namespace chart + +// CHART2_COMMONFUNCTORS_HXX +#endif diff --git a/chart2/source/inc/ConfigColorScheme.hxx b/chart2/source/inc/ConfigColorScheme.hxx new file mode 100644 index 000000000000..56d13f8971c1 --- /dev/null +++ b/chart2/source/inc/ConfigColorScheme.hxx @@ -0,0 +1,94 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_CONFIG_COLOR_SCHEME_HXX +#define CHART2_CONFIG_COLOR_SCHEME_HXX + +#include "ServiceMacros.hxx" +#include "ConfigItemListener.hxx" +#include "charttoolsdllapi.hxx" +#include <cppuhelper/implbase2.hxx> +#include <comphelper/uno3.hxx> +#include <com/sun/star/chart2/XColorScheme.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + +#include <memory> + + +namespace chart +{ + +OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XColorScheme > createConfigColorScheme( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext ); + +namespace impl +{ +class ChartConfigItem; +} + +class ConfigColorScheme : + public ConfigItemListener, + public ::cppu::WeakImplHelper2< + ::com::sun::star::chart2::XColorScheme, + ::com::sun::star::lang::XServiceInfo > +{ +public: + explicit ConfigColorScheme( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext ); + SAL_DLLPRIVATE virtual ~ConfigColorScheme(); + + /// establish methods for factory instatiation + APPHELPER_SERVICE_FACTORY_HELPER( ConfigColorScheme ) + /// declare XServiceInfo methods + APPHELPER_XSERVICEINFO_DECL() + +protected: + // ____ XColorScheme ____ + SAL_DLLPRIVATE virtual ::sal_Int32 SAL_CALL getColorByIndex( ::sal_Int32 nIndex ) + throw (::com::sun::star::uno::RuntimeException); + + // ____ ConfigItemListener ____ + SAL_DLLPRIVATE virtual void notify( const ::rtl::OUString & rPropertyName ); + +private: + SAL_DLLPRIVATE void retrieveConfigColors(); + + // member variables + ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > m_xContext; + ::std::auto_ptr< impl::ChartConfigItem > m_apChartConfigItem; + mutable ::com::sun::star::uno::Sequence< sal_Int64 > m_aColorSequence; + mutable sal_Int32 m_nNumberOfColors; + bool m_bNeedsUpdate; +}; + +} // namespace chart + +// CHART2_CONFIG_COLOR_SCHEME_HXX +#endif diff --git a/chart2/source/inc/ConfigItemListener.hxx b/chart2/source/inc/ConfigItemListener.hxx new file mode 100644 index 000000000000..9ddde49908c2 --- /dev/null +++ b/chart2/source/inc/ConfigItemListener.hxx @@ -0,0 +1,45 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_CONFIGITEMLISTENER_HXX +#define CHART2_CONFIGITEMLISTENER_HXX + +#include <rtl/ustring.hxx> +#include "charttoolsdllapi.hxx" + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS ConfigItemListener +{ +public: + virtual void notify( const ::rtl::OUString & rPropertyName ) = 0; +}; + +} // namespace chart + +// CHART2_CONFIGITEMLISTENER_HXX +#endif diff --git a/chart2/source/inc/ContainerHelper.hxx b/chart2/source/inc/ContainerHelper.hxx new file mode 100644 index 000000000000..4c6d10d6b1f0 --- /dev/null +++ b/chart2/source/inc/ContainerHelper.hxx @@ -0,0 +1,181 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_CONTAINERHELPER_HXX +#define CHART2_CONTAINERHELPER_HXX + +#include <vector> +#include <set> +#include <map> + +#include <algorithm> +#include <functional> + +namespace chart +{ +namespace ContainerHelper +{ + +/** converts a standard container into a sequence of the same type + + input: standard container + output: css::uno::Sequence< container::value_type > + + example: + + ::std::vector< sal_Int32 > aVector; + Sequence< sal_Int32 > aSequence( ContainerHelper::ContainerToSequence( aVector )); + */ +template< class Container > + ::com::sun::star::uno::Sequence< typename Container::value_type > + ContainerToSequence( const Container & rCont ) +{ + ::com::sun::star::uno::Sequence< typename Container::value_type > aResult( rCont.size()); + ::std::copy( rCont.begin(), rCont.end(), aResult.getArray()); + return aResult; +} + +/** converts a UNO sequence into a standard "Sequence" container. For + convenience see the methods SequenceToVector, etc. below. + + input: uno::Sequence + output: a standard container of the same value type implementing the Concept + of a Sequence (vector, deque, list, slist) + + example: + + Sequence< sal_Int32 > aSequence; + ::std::vector< sal_Int32 > aVector( + ContainerToSequence::SequenceToSTLSequenceContainer< ::std::vector< sal_Int32 > >( aSequence ); +*/ +template< class Container > + Container + SequenceToSTLSequenceContainer( const ::com::sun::star::uno::Sequence< typename Container::value_type > & rSeq ) +{ + Container aResult( rSeq.getLength()); + ::std::copy( rSeq.getConstArray(), rSeq.getConstArray() + rSeq.getLength(), + aResult.begin() ); + return aResult; +} + +/** converts a UNO sequence into a standard container. For convenience see the + methods SequenceToVector, etc. below. (In contrast to + SequenceToSTLSequenceContainer this works for all standard containers) + + input: uno::Sequence + output: a standard container that has an insert( iterator, key ) method (all + standard containers) + note: for containers implementing the Concept of a Sequence (vector, deque, + list, slist) use SequenceToSTLSequenceContainer for better speed + + example: + + Sequence< sal_Int32 > aSequence; + ::std::set< sal_Int32 > aVector( + ContainerToSequence::SequenceToSTLContainer< ::std::set< sal_Int32 > >( aSequence ); +*/ +template< class Container > + Container + SequenceToSTLContainer( const ::com::sun::star::uno::Sequence< typename Container::value_type > & rSeq ) +{ + Container aResult; + ::std::copy( rSeq.getConstArray(), rSeq.getConstArray() + rSeq.getLength(), + ::std::inserter< Container >( aResult, aResult.begin())); + return aResult; +} + +// concrete container methods for convenience + +/** converts a UNO sequence into a standard vector of same value type + + example: + + Sequence< sal_Int32 > aSequence; + ::std::vector< sal_Int32 > aVector( ContainerHelper::SequenceToVector( aSequence )); + */ +template< typename T > + ::std::vector< T > + SequenceToVector( const ::com::sun::star::uno::Sequence< T > & rSeq ) +{ + return SequenceToSTLSequenceContainer< ::std::vector< T > >( rSeq ); +} + +/** converts a UNO sequence into a standard set of same value type + + example: + + Sequence< sal_Int32 > aSequence; + ::std::set< sal_Int32 > aVector( ContainerHelper::SequenceToSet( aSequence )); + */ +template< typename T > + ::std::set< T > + SequenceToSet( const ::com::sun::star::uno::Sequence< T > & rSeq ) +{ + return SequenceToSTLContainer< ::std::set< T > >( rSeq ); +} + +// ---------------------------------------- + +/** converts the keys of a Pair Associative Container into a UNO sequence + + example: + + ::std::multimap< sal_Int32, ::rtl::OUString > aMyMultiMap; + uno::Sequence< sal_Int32 > aMyKeys( ContainerHelper::MapKeysToSequence( aMyMultiMap )); + // note: aMyKeys may contain duplicate keys here + */ +template< class Map > +::com::sun::star::uno::Sequence< typename Map::key_type > MapKeysToSequence( + const Map & rCont ) +{ + ::com::sun::star::uno::Sequence< typename Map::key_type > aResult( rCont.size()); + ::std::transform( rCont.begin(), rCont.end(), aResult.getArray(), + ::std::select1st< typename Map::value_type >()); + return aResult; +} + +/** converts the values of a Pair Associative Container into a UNO sequence + + example: + + ::std::map< sal_Int32, ::rtl::OUString > aMyMultiMap; + uno::Sequence< ::rtl::OUString > aMyValues( ContainerHelper::MapValuesToSequence( aMyMultiMap )); + */ +template< class Map > +::com::sun::star::uno::Sequence< typename Map::mapped_type > MapValuesToSequence( + const Map & rCont ) +{ + ::com::sun::star::uno::Sequence< typename Map::mapped_type > aResult( rCont.size()); + ::std::transform( rCont.begin(), rCont.end(), aResult.getArray(), + ::std::select2nd< typename Map::value_type >()); + return aResult; +} + +} // namespace ContainerHelper +} // namespace chart + +// CHART2_CONTAINERHELPER_HXX +#endif diff --git a/chart2/source/inc/ControllerLockGuard.hxx b/chart2/source/inc/ControllerLockGuard.hxx new file mode 100644 index 000000000000..69044d4a2b3f --- /dev/null +++ b/chart2/source/inc/ControllerLockGuard.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_CONTROLLERLOCKGUARD_HXX +#define CHART2_CONTROLLERLOCKGUARD_HXX + +#include <com/sun/star/frame/XModel.hpp> +#include "charttoolsdllapi.hxx" + +namespace chart +{ + +/** This guard calls lockControllers at the given Model in the CTOR and + unlockControllers in the DTOR. Using this ensures that controllers do not + remain locked when leaving a function even in case an exception is thrown. + */ +class OOO_DLLPUBLIC_CHARTTOOLS ControllerLockGuard +{ +public: + explicit ControllerLockGuard( + const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > & xModel ); + ~ControllerLockGuard(); + +private: + ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > m_xModel; +}; + +/** This helper class can be used to pass a locking mechanism to other objects + without exposing the full XModel to it. + + Use the ControllerLockHelperGuard to lock/unlock the model during a block of + instructions. + */ +class OOO_DLLPUBLIC_CHARTTOOLS ControllerLockHelper +{ +public: + explicit ControllerLockHelper( + const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > & xModel ); + ~ControllerLockHelper(); + + SAL_DLLPRIVATE void lockControllers(); + SAL_DLLPRIVATE void unlockControllers(); + +private: + ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > m_xModel; +}; + +/** This guard calls lockControllers at the given ControllerLockHelper in the + CTOR and unlockControllers in the DTOR. Using this ensures that controllers + do not remain locked when leaving a function even in case an exception is + thrown. + */ +class OOO_DLLPUBLIC_CHARTTOOLS ControllerLockHelperGuard +{ +public: + explicit ControllerLockHelperGuard( ControllerLockHelper & rHelper ); + ~ControllerLockHelperGuard(); + +private: + ControllerLockHelper & m_rHelper; +}; + +} // namespace chart + +// CHART2_CONTROLLERLOCKGUARD_HXX +#endif diff --git a/chart2/source/inc/DataSeriesHelper.hxx b/chart2/source/inc/DataSeriesHelper.hxx new file mode 100644 index 000000000000..640d5cd70dec --- /dev/null +++ b/chart2/source/inc/DataSeriesHelper.hxx @@ -0,0 +1,213 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_DATASERIESHELPER_HXX +#define CHART2_DATASERIESHELPER_HXX + +#include <com/sun/star/chart2/data/XDataSequence.hpp> +#include <com/sun/star/chart2/data/XDataSource.hpp> +#include <com/sun/star/chart2/XDataSeries.hpp> +#include <com/sun/star/chart2/XDiagram.hpp> +#include <com/sun/star/chart2/XCoordinateSystem.hpp> +#include <com/sun/star/chart2/XChartType.hpp> + +#include "StackMode.hxx" +#include "charttoolsdllapi.hxx" + +#include <vector> +#include <functional> +#include <hash_set> + +namespace chart +{ + +namespace DataSeriesHelper +{ + +::rtl::OUString GetRole( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence >& xLabeledDataSequence ); + +/** Retrieves the data sequence in the given data source that matches the + given role. If more than one sequences match the role, the first match + is returned. If no sequence matches, an empty reference is returned. + + @param aSource + The data source containing all data sequences to be searched through. + + @param aRole + The role that is to be filtered out. +*/ +OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > + getDataSequenceByRole( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSource > & xSource, + ::rtl::OUString aRole, + bool bMatchPrefix = false ); + +/** Retrieves all data sequences in the given data source that match the given + role. + + @param aSource + The data source containing all data sequences to be searched through. + + @param aRole + The role that is to be filtered out. +*/ +OOO_DLLPUBLIC_CHARTTOOLS ::std::vector< + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > > + getAllDataSequencesByRole( const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence > > & aDataSequences, + ::rtl::OUString aRole, + bool bMatchPrefix = false ); + +/** Retrieves all data sequences found in the given data series and puts them + into a data source. The order of sequences will match the order of the data + series. + */ +OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSource > + getDataSource( const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > > & aSeries ); + + +/** Get the label of a series (e.g. for the legend) + + @param rLabelSequenceRole + The data sequence contained in xSeries that has this role will be used + to take its label. + */ +OOO_DLLPUBLIC_CHARTTOOLS ::rtl::OUString getDataSeriesLabel( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > & xSeries, + const ::rtl::OUString & rLabelSequenceRole ); + +/** Get the label of a labeled sequence including neccessary automatic generation + */ +OOO_DLLPUBLIC_CHARTTOOLS ::rtl::OUString getLabelForLabeledDataSequence( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence > & xLabeledSeq ); + +OOO_DLLPUBLIC_CHARTTOOLS void setStackModeAtSeries( + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > > & aSeries, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem, + StackMode eStackMode ); + +OOO_DLLPUBLIC_CHARTTOOLS sal_Int32 getAttachedAxisIndex( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > & xSeries ); + +/// @param nAxisIndex, if -1 it is determined by the given data series via getAttachedAxisIndex +OOO_DLLPUBLIC_CHARTTOOLS sal_Int32 getNumberFormatKeyFromAxis( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > & xSeries, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem, + sal_Int32 nDimensionIndex, + sal_Int32 nAxisIndex = -1 ); + +OOO_DLLPUBLIC_CHARTTOOLS +::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > + getCoordinateSystemOfSeries( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > & xSeries, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > & xDiagram ); + +OOO_DLLPUBLIC_CHARTTOOLS +::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType > + getChartTypeOfSeries( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > & xSeries, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > & xDiagram ); + +OOO_DLLPUBLIC_CHARTTOOLS void deleteSeries( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > & xSeries, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType > & xChartType ); + +OOO_DLLPUBLIC_CHARTTOOLS void switchSymbolsOnOrOff( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > & xSeriesProperties, + bool bSymbolsOn, sal_Int32 nSeriesIndex ); + +OOO_DLLPUBLIC_CHARTTOOLS void switchLinesOnOrOff( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > & xSeriesProperties, + bool bLinesOn ); + +OOO_DLLPUBLIC_CHARTTOOLS +void makeLinesThickOrThin( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > & xSeriesProperties, bool bThick ); + +OOO_DLLPUBLIC_CHARTTOOLS void setPropertyAlsoToAllAttributedDataPoints( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries, + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Any& rPropertyValue ); + +OOO_DLLPUBLIC_CHARTTOOLS bool hasAttributedDataPointDifferentValue( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries, + const ::rtl::OUString& rPropertyName, + const ::com::sun::star::uno::Any& rPropertyValue ); + +OOO_DLLPUBLIC_CHARTTOOLS bool areAllSeriesAttachedToSameAxis( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartType >& xChartType, + sal_Int32 & rOutAxisIndex ); + +OOO_DLLPUBLIC_CHARTTOOLS bool hasUnhiddenData( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries ); + +OOO_DLLPUBLIC_CHARTTOOLS +sal_Int32 translateIndexFromHiddenToFullSequence( sal_Int32 nClippedIndex, const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSequence >& xDataSequence, bool bTranslate ); + +OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelsAtSeries( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries ); + +OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelsAtPoints( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries ); + +OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelAtPoint( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries, sal_Int32 nPointIndex ); + +OOO_DLLPUBLIC_CHARTTOOLS void insertDataLabelsToSeriesAndAllPoints( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries ); + +OOO_DLLPUBLIC_CHARTTOOLS void insertDataLabelToPoint( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xPointPropertySet ); + +OOO_DLLPUBLIC_CHARTTOOLS void deleteDataLabelsFromSeriesAndAllPoints( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries ); + +OOO_DLLPUBLIC_CHARTTOOLS void deleteDataLabelsFromPoint( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xPointPropertySet ); + +} // namespace DataSeriesHelper +} // namespace chart + +// CHART2_DATASERIESHELPER_HXX +#endif diff --git a/chart2/source/inc/DataSource.hxx b/chart2/source/inc/DataSource.hxx new file mode 100644 index 000000000000..3dd6ff72d330 --- /dev/null +++ b/chart2/source/inc/DataSource.hxx @@ -0,0 +1,83 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_DATASOURCE_HXX +#define CHART2_DATASOURCE_HXX + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/chart2/data/XDataSource.hpp> +#include <com/sun/star/chart2/data/XDataSink.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <cppuhelper/implbase3.hxx> +#include <comphelper/uno3.hxx> +#include "ServiceMacros.hxx" + +namespace chart +{ + +class DataSource : public + ::cppu::WeakImplHelper3< + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::chart2::data::XDataSource, + ::com::sun::star::chart2::data::XDataSink > +{ +public: + explicit DataSource( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext ); + explicit DataSource( + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence > > & rSequences ); + + virtual ~DataSource(); + + /// establish methods for factory instatiation + APPHELPER_SERVICE_FACTORY_HELPER( DataSource ) + /// declare XServiceInfo methods + APPHELPER_XSERVICEINFO_DECL() + +protected: + // ____ XDataSource ____ + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > > SAL_CALL + getDataSequences() + throw (::com::sun::star::uno::RuntimeException); + + // ____ XDataSink ____ + virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > >& aData ) + throw (::com::sun::star::uno::RuntimeException); + +private: + ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence > > + m_aDataSeq; +}; + +} // namespace chart + +// CHART2_DATASOURCE_HXX +#endif diff --git a/chart2/source/inc/DataSourceHelper.hxx b/chart2/source/inc/DataSourceHelper.hxx new file mode 100644 index 000000000000..06888fe858d6 --- /dev/null +++ b/chart2/source/inc/DataSourceHelper.hxx @@ -0,0 +1,164 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_DATASOURCEHELPER_HXX +#define _CHART2_DATASOURCEHELPER_HXX + +#include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/chart2/XDiagram.hpp> +#include <com/sun/star/chart2/data/XDataSource.hpp> +#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + +#include "charttoolsdllapi.hxx" + +#include <vector> + +//............................................................................. +namespace chart +{ +//............................................................................. + +//----------------------------------------------------------------------------- +/** +*/ + +class OOO_DLLPUBLIC_CHARTTOOLS DataSourceHelper +{ +public: + static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource > + createDataSource( const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence > > & rSequences ); + + static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > + createCachedDataSequence(); + + static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > + createCachedDataSequence( const ::rtl::OUString & rSingleText ); + + static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > + createLabeledDataSequence( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValues , + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xLabels ); + + static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > + createLabeledDataSequence( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xValues ); + + static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > + createLabeledDataSequence( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext >& xContext ); + + static ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue > createArguments( + bool bUseColumns, bool bFirstCellAsLabel, bool bHasCategories ); + + static ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue > createArguments( + const ::rtl::OUString & rRangeRepresentation, + const ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping, + bool bUseColumns, bool bFirstCellAsLabel, bool bHasCategories ); + + SAL_DLLPRIVATE static void readArguments( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rArguments + , ::rtl::OUString & rRangeRepresentation, ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping + , bool& bUseColumns, bool& bFirstCellAsLabel, bool& bHasCategories ); + + static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource > + pressUsedDataIntoRectangularFormat( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument >& xChartDoc, + bool bWithCategories = true ); + + static void addRangeRepresentationsFromLabeledDataSequence( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence >& xLabeledDataSequence + , ::std::vector< ::rtl::OUString >& rOutRangeRepresentations ); + + SAL_DLLPRIVATE static ::com::sun::star::uno::Sequence< ::rtl::OUString > getUsedDataRanges( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram ); + + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getUsedDataRanges( + const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > & xChartModel ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSource > getUsedData( + const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSource > getUsedData( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument >& xChartDoc ); + + static bool detectRangeSegmentation( + const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel + , ::rtl::OUString& rOutRangeString + , ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping + , bool& rOutUseColumns + , bool& rOutFirstCellAsLabel + , bool& rOutHasCategories ); + + static void setRangeSegmentation( + const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel + , const ::com::sun::star::uno::Sequence< sal_Int32 >& rSequenceMapping + , bool bUseColumns + , bool bFirstCellAsLabel + , bool bUseCategories ); + + /** Returns true, if all arguments necessary for getting all data by a + rectangular region are returned by detectArguments at the given + document's data provider. + + Currently, this is: CellRangeRepresentation, DataRowSource, + HasCategories and FirstCellAsLabel. + */ + static bool allArgumentsForRectRangeDetected( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >& xChartDocument ); + + SAL_DLLPRIVATE static ::com::sun::star::uno::Sequence< ::rtl::OUString > getRangesFromLabeledDataSequence( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence > & xLSeq ); + + SAL_DLLPRIVATE static ::rtl::OUString getRangeFromValues( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence > & xLSeq ); + + SAL_DLLPRIVATE static ::com::sun::star::uno::Sequence< ::rtl::OUString > getRangesFromDataSource( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSource > & xSource ); +}; + +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx new file mode 100644 index 000000000000..c7cda6189680 --- /dev/null +++ b/chart2/source/inc/DiagramHelper.hxx @@ -0,0 +1,350 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_DIAGRAMHELPER_HXX +#define CHART2_DIAGRAMHELPER_HXX + +#include "StackMode.hxx" +#include "charttoolsdllapi.hxx" +#include <com/sun/star/chart2/XAxis.hpp> +#include <com/sun/star/chart2/XDiagram.hpp> +#include <com/sun/star/chart2/XChartTypeTemplate.hpp> +#include <com/sun/star/chart2/XCoordinateSystem.hpp> +#include <com/sun/star/chart2/InterpretedData.hpp> +#include <com/sun/star/chart2/StackingDirection.hpp> +#include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> + +#include <utility> +#include <vector> + + +namespace chart +{ + +enum DiagramPositioningMode +{ + DiagramPositioningMode_AUTO, + DiagramPositioningMode_EXCLUDING, + DiagramPositioningMode_INCLUDING +}; + +class OOO_DLLPUBLIC_CHARTTOOLS DiagramHelper +{ +public: + typedef ::std::pair< + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartTypeTemplate >, + ::rtl::OUString > + tTemplateWithServiceName; + + /** tries to find a template in the chart-type manager that matches the + given diagram. + + @param rPreferredTemplateName + Check this template first. This may speed up searching, if the + caller assumes a certain template as most likely to be the one that + matches. + + @return + A pair containing a template with the correct properties set as + first entry and the service name of the templateas second entry. If + no template was found both elements are empty. + */ + static tTemplateWithServiceName + getTemplateForDiagram( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram, + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory > & xChartTypeManager, + const ::rtl::OUString & rPreferredTemplateName = ::rtl::OUString()); + + /** Sets the "SwapXAndYAxis" property at all coordinate systems found in the + given diagram. + + "vertical==true" for bar charts, "vertical==false" for column charts + */ + static void setVertical( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram, + bool bVertical = true ); + + /** Gets the "SwapXAndYAxis" property at all coordinate systems found in the + given diagram. + + "vertical==true" for bar charts, "vertical==false" for column charts + */ + static bool getVertical( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram, + bool& rbOutFoundResult, bool& rbOutAmbiguousResult ); + + static StackMode getStackMode( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram, + bool& rbFound, bool& rbAmbiguous + ); + + /** @param bOnlyAtFirstChartType + If </TRUE>, the stacking mode is only set at the series found inside + the first chart type. This is the standard for all current + templates (the only template that has more than one chart-type and + allows stacking is bar/line combi, and for this the stacking only + applies to the first chart type/the bars) + */ + static void setStackMode( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram, + StackMode eStackMode, + bool bOnlyAtFirstChartType = true + ); + + /** Retrieves the stackmode of the first DataSeries or none. If the series have differing stack + modes, rbAmbiguous is set to true. If no series is there rbFound is set to false. + + @param xCorrespondingCoordinateSystem + The coordinate system in which the given chart type xChartType is + located. (This is needed for determining percent stacking. If + omitted, the result will just indicate "not stacked", "stacked" or + "ambiguous") + */ + static StackMode getStackModeFromChartType( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType > & xChartType, + bool& rbFound, bool& rbAmbiguous, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem = + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem >() + ); + + /** Returns the dimension found for all chart types in the tree. If the + dimension is not unique, 0 is returned. + */ + static sal_Int32 getDimension( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram ); + + /** Sets the dimension of the diagram given. + + 1. Sets the dimension of all used ChartTypes + 2. Adapts the DataSeriesTree to reflect the new dimension + 3. If new coordinate-systems have to be created, adapts the + XCoordinateSystemContainer of the diagram. + */ + static void setDimension( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram, + sal_Int32 nNewDimensionCount ); + + /** Replaces all occurences of xCooSysToReplace in the tree with + xReplacement in the diagram's tree + */ + SAL_DLLPRIVATE static void replaceCoordinateSystem( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem > & xCooSysToReplace, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem > & xReplacement ); + + static bool isSeriesAttachedToMainAxis( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xDataSeries ); + + static bool attachSeriesToAxis( bool bMainAxis, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram, + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext, + bool bAdaptAxes=true ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XAxis > getAttachedAxis( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType > + getChartTypeOfSeries( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xSeries ); + + static ::std::vector< + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > > + getDataSeriesFromDiagram( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram ); + + /** return all data series in this diagram grouped by chart-types + */ + static ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > > > + getDataSeriesGroups( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram ); + + static bool isCategoryDiagram( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram ); + + static void setCategoriesToDiagram( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence >& xCategories, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram, + bool bSetAxisType = false, // when this flag is true ... + bool bCategoryAxis = true);// set the AxisType to CATEGORY or back to REALNUMBER + + static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > + getCategoriesFromDiagram( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram ); + + static ::com::sun::star::uno::Sequence< rtl::OUString > + getExplicitSimpleCategories( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument > & xChartDoc ); + + SAL_DLLPRIVATE static ::com::sun::star::uno::Sequence< rtl::OUString > + generateAutomaticCategoriesFromCooSys( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem > & xCooSys ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType > + getChartTypeByIndex( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram, sal_Int32 nIndex ); + + static ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType > > + getChartTypesFromDiagram( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram ); + + SAL_DLLPRIVATE static bool areChartTypesCompatible( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType >& xFirstType, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType >& xSecondType ); + + + /** + * Test if a series can be moved. + * + * @param xDiagram + * Reference to the diagram that contains the series. + * + * @param xGivenDataSeries + * Reference to the series that should be tested for moving. + * + * @param bForward + * Direction of the move to be checked. + * + * @returns </TRUE> if the series can be moved. + * + */ + static bool isSeriesMoveable( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xGivenDataSeries, + bool bForward ); + + /** + * Move a series forward or backward. + * + * @param xDiagram + * Reference to the diagram that contains the series. + * + * @param xGivenDataSeries + * Reference to the series that should be moved. + * + * @param bForward + * Direction in which the series should be moved. + * + * @returns </TRUE> if the series was moved successfully. + * + */ + static bool moveSeries( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries >& xGivenDataSeries, + bool bForward ); + + static bool isSupportingFloorAndWall( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram ); + + static bool isPieOrDonutChart( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram ); + + static sal_Int32 getGeometry3D( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram, + bool& rbFound, bool& rbAmbiguous ); + + static void setGeometry3D( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram, + sal_Int32 nNewGeometry ); + + //returns integer from constant group ::com::sun::star::chart::MissingValueTreatment + static sal_Int32 getCorrectedMissingValueTreatment( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartType >& xChartType ); + + static DiagramPositioningMode getDiagramPositioningMode( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram ); + + static bool setDiagramPositioning( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel, + const ::com::sun::star::awt::Rectangle& rPosRect /*100th mm*/ ); + + static ::com::sun::star::awt::Rectangle getDiagramRectangleFromModel( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xChartModel ); + + static bool switchDiagramPositioningToExcludingPositioning( const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel + , bool bResetModifiedState //set model back to unchanged if it was unchanged before + , bool bConvertAlsoFromAutoPositioning ); + +private: + // not implemented + DiagramHelper(); + +}; + +} // namespace chart + +// CHART2_DIAGRAMHELPER_HXX +#endif diff --git a/chart2/source/inc/DisposeHelper.hxx b/chart2/source/inc/DisposeHelper.hxx new file mode 100644 index 000000000000..7e8932f17581 --- /dev/null +++ b/chart2/source/inc/DisposeHelper.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_DISPOSEHELPER_HXX +#define CHART2_DISPOSEHELPER_HXX + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/lang/XComponent.hpp> + +#include <functional> +#include <algorithm> +#include <utility> + +namespace chart +{ +namespace DisposeHelper +{ + +template< class T > + void Dispose( const T & xIntf ) +{ + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > xComp( + xIntf, ::com::sun::star::uno::UNO_QUERY ); + if( xComp.is()) + xComp->dispose(); +} + +template< class Intf > + void DisposeAndClear( ::com::sun::star::uno::Reference< Intf > & rIntf ) +{ + Dispose< ::com::sun::star::uno::Reference< Intf > >( rIntf ); + rIntf.set( 0 ); +} + +template< class T > + struct DisposeFunctor : public ::std::unary_function< T, void > +{ + void operator() ( const T & xIntf ) + { + Dispose< T >( xIntf ); + } +}; + +template< typename T > + struct DisposeFirstOfPairFunctor : public ::std::unary_function< T, void > +{ + void operator() ( const T & rElem ) + { + Dispose< typename T::first_type >( rElem.first ); + } +}; + +template< typename T > + struct DisposeSecondOfPairFunctor : public ::std::unary_function< T, void > +{ + void operator() ( const T & rElem ) + { + Dispose< typename T::second_type >( rElem.second ); + } +}; + +template< class Container > + void DisposeAllElements( Container & rContainer ) +{ + ::std::for_each( rContainer.begin(), rContainer.end(), DisposeFunctor< typename Container::value_type >()); +} + +template< class Map > + void DisposeAllMapElements( Map & rContainer ) +{ + ::std::for_each( rContainer.begin(), rContainer.end(), DisposeSecondOfPairFunctor< typename Map::value_type >()); +} + +} // namespace DisposeHelper +} // namespace chart + +// CHART2_DISPOSEHELPER_HXX +#endif diff --git a/chart2/source/inc/ErrorBar.hxx b/chart2/source/inc/ErrorBar.hxx new file mode 100644 index 000000000000..f4d2b457acc4 --- /dev/null +++ b/chart2/source/inc/ErrorBar.hxx @@ -0,0 +1,160 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_ERRORBAR_HXX +#define CHART2_ERRORBAR_HXX + +#include "MutexContainer.hxx" +#include "OPropertySet.hxx" +#include "ServiceMacros.hxx" +#include "ModifyListenerHelper.hxx" +#include "charttoolsdllapi.hxx" + +#include <cppuhelper/implbase6.hxx> +#include <comphelper/uno3.hxx> + +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XServiceName.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/container/XChild.hpp> +#include <com/sun/star/chart2/data/XDataSink.hpp> +#include <com/sun/star/chart2/data/XDataSource.hpp> + +namespace chart +{ + +OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > createErrorBar( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext ); + +namespace impl +{ +typedef ::cppu::WeakImplHelper6< + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::util::XCloneable, + ::com::sun::star::util::XModifyBroadcaster, + ::com::sun::star::util::XModifyListener, + ::com::sun::star::chart2::data::XDataSource, + ::com::sun::star::chart2::data::XDataSink > + ErrorBar_Base; +} + +class ErrorBar : + public MutexContainer, + public impl::ErrorBar_Base, + public ::property::OPropertySet +{ +public: + explicit ErrorBar( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext ); + virtual ~ErrorBar(); + + /// XServiceInfo declarations + APPHELPER_XSERVICEINFO_DECL() + /// establish methods for factory instatiation + APPHELPER_SERVICE_FACTORY_HELPER( ErrorBar ) + + /// merge XInterface implementations + DECLARE_XINTERFACE() + /// merge XTypeProvider implementations + DECLARE_XTYPEPROVIDER() + +protected: + ErrorBar( const ErrorBar & rOther ); + + // ____ OPropertySet ____ + virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const + throw(::com::sun::star::beans::UnknownPropertyException); + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper(); + using OPropertySet::disposing; + + // ____ XPropertySet ____ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL + getPropertySetInfo() + throw (::com::sun::star::uno::RuntimeException); + + // ____ XCloneable ____ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() + throw (::com::sun::star::uno::RuntimeException); + + // ____ XModifyBroadcaster ____ + virtual void SAL_CALL addModifyListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeModifyListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + + // ____ XModifyListener ____ + virtual void SAL_CALL modified( + const ::com::sun::star::lang::EventObject& aEvent ) + throw (::com::sun::star::uno::RuntimeException); + + // ____ XEventListener (base of XModifyListener) ____ + virtual void SAL_CALL disposing( + const ::com::sun::star::lang::EventObject& Source ) + throw (::com::sun::star::uno::RuntimeException); + + // ____ XDataSink ____ + virtual void SAL_CALL setData( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > >& aData ) + throw (::com::sun::star::uno::RuntimeException); + + // ____ XDataSource ____ + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XLabeledDataSequence > > SAL_CALL getDataSequences() + throw (::com::sun::star::uno::RuntimeException); + + // ____ XChild ____ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setParent( + const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) + throw (::com::sun::star::lang::NoSupportException, + ::com::sun::star::uno::RuntimeException); + + // ____ OPropertySet ____ + virtual void firePropertyChangeEvent(); + + void fireModifyEvent(); + +private: + ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > + m_xContext; + + typedef ::std::vector< ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence > > tDataSequenceContainer; + tDataSequenceContainer m_aDataSequences; + + ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent; +}; + +} // namespace chart + +// CHART2_ERRORBAR_HXX +#endif diff --git a/chart2/source/inc/EventListenerHelper.hxx b/chart2/source/inc/EventListenerHelper.hxx new file mode 100644 index 000000000000..79840a2bd2e4 --- /dev/null +++ b/chart2/source/inc/EventListenerHelper.hxx @@ -0,0 +1,222 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_EVENTLISTENERHELPER_HXX +#define CHART2_EVENTLISTENERHELPER_HXX + +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/lang/XComponent.hpp> + +#include <list> +#include <algorithm> +#include <functional> +#include <utility> + +namespace chart +{ +namespace EventListenerHelper +{ + +namespace impl +{ + +template< class InterfaceRef > +struct addListenerFunctor : public ::std::unary_function< InterfaceRef, void > +{ + explicit addListenerFunctor( const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener > & xListener ) : + m_xListener( xListener ) + {} + + void operator() ( const InterfaceRef & xObject ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > + xBroadcaster( xObject, ::com::sun::star::uno::UNO_QUERY ); + if( xBroadcaster.is() && m_xListener.is()) + xBroadcaster->addEventListener( m_xListener ); + } +private: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > m_xListener; +}; + +template< class InterfaceRef > +struct removeListenerFunctor : public ::std::unary_function< InterfaceRef, void > +{ + explicit removeListenerFunctor( const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener > & xListener ) : + m_xListener( xListener ) + {} + + void operator() ( const InterfaceRef & xObject ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > + xBroadcaster( xObject, ::com::sun::star::uno::UNO_QUERY ); + if( xBroadcaster.is() && m_xListener.is()) + xBroadcaster->removeEventListener( m_xListener ); + } +private: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > m_xListener; +}; + +template< class Pair > +struct addListenerToMappedElementFunctor : public ::std::unary_function< Pair, void > +{ + explicit addListenerToMappedElementFunctor( const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener > & xListener ) : + m_xListener( xListener ) + {} + + void operator() ( const Pair & aPair ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > + xBroadcaster( aPair.second, ::com::sun::star::uno::UNO_QUERY ); + if( xBroadcaster.is() && m_xListener.is()) + xBroadcaster->addEventListener( m_xListener ); + } +private: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > m_xListener; +}; + +template< class Pair > +struct removeListenerFromMappedElementFunctor : public ::std::unary_function< Pair, void > +{ + explicit removeListenerFromMappedElementFunctor( const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener > & xListener ) : + m_xListener( xListener ) + {} + + void operator() ( const Pair & aPair ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XComponent > + xBroadcaster( aPair.second, ::com::sun::star::uno::UNO_QUERY ); + if( xBroadcaster.is() && m_xListener.is()) + xBroadcaster->removeEventListener( m_xListener ); + } +private: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XEventListener > m_xListener; +}; + +} // namespace impl + +// -------------------------------------------------------------------------------- + +template< class InterfaceRef > +void addListener( + const InterfaceRef & xObject, + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener > & xListener ) +{ + if( xListener.is()) + { + impl::addListenerFunctor< InterfaceRef > aFunctor( xListener ); + aFunctor( xObject ); + } +} + +template< class Container > +void addListenerToAllElements( + const Container & rContainer, + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener > & xListener ) +{ + if( xListener.is()) + ::std::for_each( rContainer.begin(), rContainer.end(), + impl::addListenerFunctor< typename Container::value_type >( xListener )); +} + +template< class Container > +void addListenerToAllMapElements( + const Container & rContainer, + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener > & xListener ) +{ + if( xListener.is()) + ::std::for_each( rContainer.begin(), rContainer.end(), + impl::addListenerToMappedElementFunctor< typename Container::value_type >( xListener )); +} + +template< typename T > +void addListenerToAllSequenceElements( + const ::com::sun::star::uno::Sequence< T > & rSequence, + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener > & xListener ) +{ + if( xListener.is()) + ::std::for_each( rSequence.getConstArray(), rSequence.getConstArray() + rSequence.getLength(), + impl::addListenerFunctor< T >( xListener )); +} + +template< class InterfaceRef > +void removeListener( + const InterfaceRef & xObject, + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener > & xListener ) +{ + if( xListener.is()) + { + impl::removeListenerFunctor< InterfaceRef > aFunctor( xListener ); + aFunctor( xObject ); + } +} + +template< class Container > +void removeListenerFromAllElements( + const Container & rContainer, + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener > & xListener ) +{ + if( xListener.is()) + ::std::for_each( rContainer.begin(), rContainer.end(), + impl::removeListenerFunctor< typename Container::value_type >( xListener )); +} + +template< class Container > +void removeListenerFromAllMapElements( + const Container & rContainer, + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener > & xListener ) +{ + if( xListener.is()) + ::std::for_each( rContainer.begin(), rContainer.end(), + impl::removeListenerFromMappedElementFunctor< typename Container::value_type >( xListener )); +} + +template< typename T > +void removeListenerFromAllSequenceElements( + const ::com::sun::star::uno::Sequence< T > & rSequence, + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener > & xListener ) +{ + if( xListener.is()) + ::std::for_each( rSequence.getConstArray(), rSequence.getConstArray() + rSequence.getLength(), + impl::removeListenerFunctor< T >( xListener )); +} + +} // namespace EventListenerHelper +} // namespace chart + +// CHART2_EVENTLISTENERHELPER_HXX +#endif diff --git a/chart2/source/inc/ExplicitCategoriesProvider.hxx b/chart2/source/inc/ExplicitCategoriesProvider.hxx new file mode 100644 index 000000000000..18d54eb6e2ad --- /dev/null +++ b/chart2/source/inc/ExplicitCategoriesProvider.hxx @@ -0,0 +1,108 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_VIEW_EXPLICITCATEGORIESPROVIDER_HXX +#define CHART2_VIEW_EXPLICITCATEGORIESPROVIDER_HXX + +#include "ServiceMacros.hxx" +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/weakref.hxx> +#include <com/sun/star/chart2/XCoordinateSystem.hpp> +#include <com/sun/star/chart2/data/XTextualDataSequence.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include "charttoolsdllapi.hxx" + +#include <vector> + +namespace chart +{ + +struct OOO_DLLPUBLIC_CHARTTOOLS ComplexCategory +{ + rtl::OUString Text; + sal_Int32 Count; + + ComplexCategory( const rtl::OUString& rText, sal_Int32 nCount ) : Text( rText ), Count (nCount) + {} +}; + +class OOO_DLLPUBLIC_CHARTTOOLS SplitCategoriesProvider +{ +public: + virtual ~SplitCategoriesProvider(); + + virtual sal_Int32 getLevelCount() const = 0; + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > getStringsForLevel( sal_Int32 nIndex ) const = 0; +}; + +class OOO_DLLPUBLIC_CHARTTOOLS ExplicitCategoriesProvider +{ +public: + ExplicitCategoriesProvider( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel + ); + virtual ~ExplicitCategoriesProvider(); + + void init(); + + ::com::sun::star::uno::Sequence< ::rtl::OUString > getSimpleCategories(); + ::std::vector< ComplexCategory > getCategoriesByLevel( sal_Int32 nLevel ); + + static ::rtl::OUString getCategoryByIndex( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem >& xCooSysModel + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel + , sal_Int32 nIndex ); + + static ::com::sun::star::uno::Sequence< ::rtl::OUString > getExplicitSimpleCategories( + const SplitCategoriesProvider& rSplitCategoriesProvider ); + + bool hasComplexCategories() const; + sal_Int32 getCategoryLevelCount() const; + + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence> >& getSplitCategoriesList(); + +private: //member + ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aExplicitCategories; + ::std::vector< ::std::vector< ComplexCategory > > m_aComplexCats; + bool volatile m_bDirty; + + ::com::sun::star::uno::WeakReference< + ::com::sun::star::chart2::XCoordinateSystem > m_xCooSysModel; + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence> m_xOriginalCategories; + ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence> > m_aSplitCategoriesList; +}; + +} // namespace chart + +// CHART2_VIEW_EXPLICITCATEGORIESPROVIDER_HXX +#endif diff --git a/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx b/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx new file mode 100644 index 000000000000..91c3034ea79c --- /dev/null +++ b/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_EXPONENTIALREGRESSIONCURVECALCULATOR_HXX +#define CHART2_EXPONENTIALREGRESSIONCURVECALCULATOR_HXX + +#include "RegressionCurveCalculator.hxx" + +namespace chart +{ + +class ExponentialRegressionCurveCalculator : + public RegressionCurveCalculator +{ +public: + ExponentialRegressionCurveCalculator(); + virtual ~ExponentialRegressionCurveCalculator(); + +protected: + virtual ::rtl::OUString ImplGetRepresentation( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xNumFormatter, + ::sal_Int32 nNumberFormatKey ) const; + +private: + // ____ XRegressionCurveCalculator ____ + virtual void SAL_CALL recalculateRegression( + const ::com::sun::star::uno::Sequence< double >& aXValues, + const ::com::sun::star::uno::Sequence< double >& aYValues ) + throw (::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getCurveValue( double x ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > SAL_CALL getCurveValues( + double min, + double max, + ::sal_Int32 nPointCount, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingX, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingY, + ::sal_Bool bMaySkipPointsInCalculation ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // formula is: f(x) = m_fSlope ^ x + m_fIntercept + double m_fSlope; + double m_fIntercept; +}; + +} // namespace chart + +// CHART2_EXPONENTIALREGRESSIONCURVECALCULATOR_HXX +#endif diff --git a/chart2/source/inc/FastPropertyIdRanges.hxx b/chart2/source/inc/FastPropertyIdRanges.hxx new file mode 100644 index 000000000000..d0651d60f923 --- /dev/null +++ b/chart2/source/inc/FastPropertyIdRanges.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_FASTPROPERTYIDRANGES_HXX +#define CHART_FASTPROPERTYIDRANGES_HXX + +namespace chart +{ + +enum FastPropertyIdRanges +{ + FAST_PROPERTY_ID_START = 10000, + FAST_PROPERTY_ID_START_DATA_SERIES = FAST_PROPERTY_ID_START + 1000, + FAST_PROPERTY_ID_START_DATA_POINT = FAST_PROPERTY_ID_START + 2000, + FAST_PROPERTY_ID_START_CHAR_PROP = FAST_PROPERTY_ID_START + 3000, + FAST_PROPERTY_ID_START_LINE_PROP = FAST_PROPERTY_ID_START + 4000, + FAST_PROPERTY_ID_START_FILL_PROP = FAST_PROPERTY_ID_START + 5000, + FAST_PROPERTY_ID_START_USERDEF_PROP= FAST_PROPERTY_ID_START + 6000, + FAST_PROPERTY_ID_START_SCENE_PROP = FAST_PROPERTY_ID_START + 7000, +// FAST_PROPERTY_ID_START_NAMED_FILL_PROP = FAST_PROPERTY_ID_START + 8000, +// FAST_PROPERTY_ID_START_NAMED_LINE_PROP = FAST_PROPERTY_ID_START + 9000, + FAST_PROPERTY_ID_START_CHART_STATISTIC_PROP = FAST_PROPERTY_ID_START + 12000, + FAST_PROPERTY_ID_START_CHART_SYMBOL_PROP = FAST_PROPERTY_ID_START + 13000, + FAST_PROPERTY_ID_START_CHART_DATACAPTION_PROP = FAST_PROPERTY_ID_START + 14000, + FAST_PROPERTY_ID_START_CHART_SPLINE_PROP = FAST_PROPERTY_ID_START + 15000, + FAST_PROPERTY_ID_START_CHART_STOCK_PROP = FAST_PROPERTY_ID_START + 16000, + FAST_PROPERTY_ID_START_CHART_AUTOPOSITION_PROP = FAST_PROPERTY_ID_START + 17000, + FAST_PROPERTY_ID_START_SCALE_TEXT_PROP = FAST_PROPERTY_ID_START + 18000 +}; + +} // namespace chart + +// CHART_FASTPROPERTYIDRANGES_HXX +#endif diff --git a/chart2/source/inc/FillProperties.hxx b/chart2/source/inc/FillProperties.hxx new file mode 100644 index 000000000000..f9fa970828a2 --- /dev/null +++ b/chart2/source/inc/FillProperties.hxx @@ -0,0 +1,91 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_FILLPROPERTIES_HXX +#define CHART_FILLPROPERTIES_HXX + +#include "PropertyHelper.hxx" +#include "FastPropertyIdRanges.hxx" +#include "charttoolsdllapi.hxx" +#include <com/sun/star/beans/Property.hpp> + +#include <vector> + +namespace chart +{ + +// implements service FillProperties +class OOO_DLLPUBLIC_CHARTTOOLS FillProperties +{ +public: + // FastProperty Ids for properties + enum + { + // com.sun.star.drawing.FillProperties + // com.sun.star.drawing.FillProperties + PROP_FILL_STYLE = FAST_PROPERTY_ID_START_FILL_PROP + , PROP_FILL_COLOR + , PROP_FILL_TRANSPARENCE + , PROP_FILL_TRANSPARENCE_GRADIENT_NAME +// , PROP_FILL_TRANSPARENCE_GRADIENT //optional + , PROP_FILL_GRADIENT_NAME + , PROP_FILL_GRADIENT_STEPCOUNT +// , PROP_FILL_GRADIENT //optional + , PROP_FILL_HATCH_NAME +// , PROP_FILL_HATCH //optional + //------------------------ + // bitmap properties start + , PROP_FILL_BITMAP_NAME +// , PROP_FILL_BITMAP //optional +// , PROP_FILL_BITMAP_URL //optional + , PROP_FILL_BITMAP_OFFSETX + , PROP_FILL_BITMAP_OFFSETY + , PROP_FILL_BITMAP_POSITION_OFFSETX + , PROP_FILL_BITMAP_POSITION_OFFSETY + , PROP_FILL_BITMAP_RECTANGLEPOINT + , PROP_FILL_BITMAP_LOGICALSIZE + , PROP_FILL_BITMAP_SIZEX + , PROP_FILL_BITMAP_SIZEY + , PROP_FILL_BITMAP_MODE + // bitmap properties end + //------------------------ + , PROP_FILL_BACKGROUND + }; + + static void AddPropertiesToVector( + ::std::vector< ::com::sun::star::beans::Property > & rOutProperties ); + + static void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ); + +private: + // not implemented + FillProperties(); +}; + +} // namespace chart + +// CHART_FILLPROPERTIES_HXX +#endif diff --git a/chart2/source/inc/FormattedStringHelper.hxx b/chart2/source/inc/FormattedStringHelper.hxx new file mode 100644 index 000000000000..a0e69011f77d --- /dev/null +++ b/chart2/source/inc/FormattedStringHelper.hxx @@ -0,0 +1,57 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_TOOLS_FORMATTEDSTRINGHELPER_HXX +#define _CHART2_TOOLS_FORMATTEDSTRINGHELPER_HXX + +#include <com/sun/star/chart2/XFormattedString.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include "charttoolsdllapi.hxx" + +//............................................................................. +namespace chart +{ +//............................................................................. + +class OOO_DLLPUBLIC_CHARTTOOLS FormattedStringHelper +{ +public: + static ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XFormattedString > > + createFormattedStringSequence( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext + , const ::rtl::OUString & rString + , const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > & xTextProperties ) throw(); +}; + +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/InternalData.hxx b/chart2/source/inc/InternalData.hxx new file mode 100755 index 000000000000..6b6590cffdac --- /dev/null +++ b/chart2/source/inc/InternalData.hxx @@ -0,0 +1,109 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_INTERNALDATA_HXX +#define CHART2_INTERNALDATA_HXX + +#include <com/sun/star/uno/Sequence.hxx> + +#include <vector> +#include <valarray> + +namespace chart +{ + +class InternalData +{ +public: + InternalData(); + + void createDefaultData(); + + void setData( const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Sequence< double > > & rDataInRows ); + ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Sequence< double > > getData() const; + + ::com::sun::star::uno::Sequence< double > getColumnValues( sal_Int32 nColumnIndex ) const; + ::com::sun::star::uno::Sequence< double > getRowValues( sal_Int32 nRowIndex ) const; + + void setColumnValues( sal_Int32 nColumnIndex, const ::std::vector< double > & rNewData ); + void setRowValues( sal_Int32 nRowIndex, const ::std::vector< double > & rNewData ); + + void setComplexColumnLabel( sal_Int32 nColumnIndex, const ::std::vector< ::rtl::OUString >& rComplexLabel ); + void setComplexRowLabel( sal_Int32 nRowIndex, const ::std::vector< ::rtl::OUString >& rComplexLabel ); + + ::std::vector< ::rtl::OUString > getComplexColumnLabel( sal_Int32 nColumnIndex ) const; + ::std::vector< ::rtl::OUString > getComplexRowLabel( sal_Int32 nRowIndex ) const; + + void swapRowWithNext( sal_Int32 nRowIndex ); + void swapColumnWithNext( sal_Int32 nColumnIndex ); + + void insertColumn( sal_Int32 nAfterIndex ); + void insertRow( sal_Int32 nAfterIndex ); + void deleteColumn( sal_Int32 nAtIndex ); + void deleteRow( sal_Int32 nAtIndex ); + + /// @return the index of the newly appended column + sal_Int32 appendColumn(); + /// @return the index of the newly appended row + sal_Int32 appendRow(); + + sal_Int32 getRowCount() const; + sal_Int32 getColumnCount() const; + + typedef ::std::valarray< double > tDataType; + typedef ::std::vector< ::std::vector< ::rtl::OUString > > tVecVecString; //inner index is hierarchical level + + void setComplexRowLabels( const tVecVecString& rNewRowLabels ); + tVecVecString getComplexRowLabels() const; + void setComplexColumnLabels( const tVecVecString& rNewColumnLabels ); + tVecVecString getComplexColumnLabels() const; + +#if OSL_DEBUG_LEVEL > 2 + void traceData() const; +#endif + +private: //methods + /** resizes the data if at least one of the given dimensions is larger than + before. The data is never becoming smaller only larger. + + @return </TRUE>, if the data was enlarged + */ + bool enlargeData( sal_Int32 nColumnCount, sal_Int32 nRowCount ); + +private: + sal_Int32 m_nColumnCount; + sal_Int32 m_nRowCount; + + tDataType m_aData; + tVecVecString m_aRowLabels;//outer index is row index, inner index is category level + tVecVecString m_aColumnLabels;//outer index is column index +}; + +#endif + +} // namespace chart diff --git a/chart2/source/inc/InternalDataProvider.hxx b/chart2/source/inc/InternalDataProvider.hxx new file mode 100644 index 000000000000..f5e12f87f505 --- /dev/null +++ b/chart2/source/inc/InternalDataProvider.hxx @@ -0,0 +1,246 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_INTERNALDATAPROVIDER_HXX +#define CHART2_INTERNALDATAPROVIDER_HXX + +#include "InternalData.hxx" + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/chart/XComplexDescriptionAccess.hpp> +#include <com/sun/star/chart2/data/XDataProvider.hpp> +#include <com/sun/star/chart2/XInternalDataProvider.hpp> +#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp> +#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp> +#include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <cppuhelper/implbase6.hxx> +#include "ServiceMacros.hxx" + +#include "CachedDataSequence.hxx" + +#include <map> +#include <memory> + +namespace chart +{ + +namespace impl +{ + +typedef ::cppu::WeakImplHelper6< + ::com::sun::star::chart2::XInternalDataProvider, + ::com::sun::star::chart2::data::XRangeXMLConversion, + ::com::sun::star::chart::XComplexDescriptionAccess, + ::com::sun::star::util::XCloneable, + ::com::sun::star::lang::XInitialization, + ::com::sun::star::lang::XServiceInfo > + InternalDataProvider_Base; +} + +/** Data provider that handles data internally. This is used for charts with + their own data. + + <p>The format for single ranges is "categories|label n|n" where n is a + non-negative number. Meaning return all categories, the label of sequence n, + or the data of sequence n.</p> + + <p>The format for a complete range is "all". (Do we need more than + that?)</p> + */ +class InternalDataProvider : + public impl::InternalDataProvider_Base +{ +public: + explicit InternalDataProvider(const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > & _xContext); + explicit InternalDataProvider( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument > & xChartDoc, bool bConnectToModel ); + explicit InternalDataProvider( const InternalDataProvider & rOther ); + virtual ~InternalDataProvider(); + + void createDefaultData(); + + /// declare XServiceInfo methods + APPHELPER_XSERVICEINFO_DECL() + APPHELPER_SERVICE_FACTORY_HELPER(InternalDataProvider) + + // ____ XInternalDataProvider ____ + virtual ::sal_Bool SAL_CALL hasDataByRangeRepresentation( const ::rtl::OUString& aRange ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL + getDataByRangeRepresentation( const ::rtl::OUString& aRange ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setDataByRangeRepresentation( + const ::rtl::OUString& aRange, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& aNewData ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertSequence( ::sal_Int32 nAfterIndex ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deleteSequence( ::sal_Int32 nAtIndex ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL appendSequence() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertComplexCategoryLevel( ::sal_Int32 nLevel ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deleteComplexCategoryLevel( ::sal_Int32 nLevel ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL insertDataPointForAllSequences( ::sal_Int32 nAfterIndex ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL deleteDataPointForAllSequences( ::sal_Int32 nAtIndex ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL swapDataPointWithNextOneForAllSequences( ::sal_Int32 nAtIndex ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL registerDataSequenceForChanges( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xSeq ) + throw (::com::sun::star::uno::RuntimeException); + + // ____ XDataProvider (base of XInternalDataProvider) ____ + virtual ::sal_Bool SAL_CALL createDataSourcePossible( + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource > SAL_CALL createDataSource( + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > SAL_CALL detectArguments( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSource >& xDataSource ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible( + const ::rtl::OUString& aRangeRepresentation ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation( + const ::rtl::OUString& aRangeRepresentation ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::sheet::XRangeSelection > SAL_CALL getRangeSelection() + throw (::com::sun::star::uno::RuntimeException); + + // ____ XRangeXMLConversion ____ + virtual ::rtl::OUString SAL_CALL convertRangeToXML( + const ::rtl::OUString& aRangeRepresentation ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL convertRangeFromXML( + const ::rtl::OUString& aXMLRange ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // ____ XComplexDescriptionAccess ____ + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL + getComplexRowDescriptions() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setComplexRowDescriptions( + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aRowDescriptions ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< ::rtl::OUString > > SAL_CALL + getComplexColumnDescriptions() throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setComplexColumnDescriptions( + const ::com::sun::star::uno::Sequence< + ::com::sun::star::uno::Sequence< ::rtl::OUString > >& aColumnDescriptions ) + throw (::com::sun::star::uno::RuntimeException); + + // ____ XChartDataArray (base of XComplexDescriptionAccess) ____ + 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); + + // ____ XCloneable ____ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() + throw (::com::sun::star::uno::RuntimeException); + // ::com::sun::star::lang::XInitialization: + virtual void SAL_CALL initialize(const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > & aArguments) + throw (::com::sun::star::uno::RuntimeException, ::com::sun::star::uno::Exception); + +private: + void lcl_addDataSequenceToMap( + const ::rtl::OUString & rRangeRepresentation, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSequence > & xSequence ); + + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSequence > + lcl_createDataSequenceAndAddToMap( const ::rtl::OUString & rRangeRepresentation, + const ::rtl::OUString & rRole ); + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSequence > + lcl_createDataSequenceAndAddToMap( const ::rtl::OUString & rRangeRepresentation ); + + void lcl_deleteMapReferences( const ::rtl::OUString & rRangeRepresentation ); + + void lcl_adaptMapReferences( + const ::rtl::OUString & rOldRangeRepresentation, + const ::rtl::OUString & rNewRangeRepresentation ); + + void lcl_increaseMapReferences( sal_Int32 nBegin, sal_Int32 nEnd ); + void lcl_decreaseMapReferences( sal_Int32 nBegin, sal_Int32 nEnd ); + + typedef ::std::multimap< ::rtl::OUString, + ::com::sun::star::uno::WeakReference< ::com::sun::star::chart2::data::XDataSequence > > + tSequenceMap; + typedef ::std::pair< tSequenceMap::iterator, tSequenceMap::iterator > tSequenceMapRange; + typedef ::std::pair< tSequenceMap::const_iterator, tSequenceMap::const_iterator > tConstSequenceMapRange; + + /** cache for all sequences that have been returned. + + If the range-representation of a sequence changes and it is still + referred to by some component (weak reference is valid), the range will + be adapted. + */ + tSequenceMap m_aSequenceMap; + InternalData m_aInternalData; + bool m_bDataInColumns; +}; + +} // namespace chart + +// CHART2_INTERNALDATAPROVIDER_HXX +#endif diff --git a/chart2/source/inc/LabeledDataSequence.hxx b/chart2/source/inc/LabeledDataSequence.hxx new file mode 100644 index 000000000000..a5ec1d99307d --- /dev/null +++ b/chart2/source/inc/LabeledDataSequence.hxx @@ -0,0 +1,115 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_LABELEDDATASEQUENCE_HXX +#define CHART2_LABELEDDATASEQUENCE_HXX +#include "ServiceMacros.hxx" +#include "MutexContainer.hxx" +#include <comphelper/uno3.hxx> +#include <cppuhelper/implbase4.hxx> + +#ifndef _COM_SUN_STAR_CHART2_XLABELEDDATASEQUENCE_HPP_ +#include <com/sun/star/chart2/data/XLabeledDataSequence.hpp> +#endif +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/util/XModifyBroadcaster.hpp> + +namespace chart +{ + +namespace impl +{ +typedef cppu::WeakImplHelper4< + ::com::sun::star::chart2::data::XLabeledDataSequence, + ::com::sun::star::util::XCloneable, + ::com::sun::star::util::XModifyBroadcaster, + ::com::sun::star::lang::XServiceInfo > + LabeledDataSequence_Base; +} + +class LabeledDataSequence : + public MutexContainer, + public impl::LabeledDataSequence_Base +{ +public: + explicit LabeledDataSequence( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext ); + explicit LabeledDataSequence( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSequence > & rValues ); + explicit LabeledDataSequence( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSequence > & rValues, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSequence > & rLabels ); + + virtual ~LabeledDataSequence(); + + /// establish methods for factory instatiation + APPHELPER_SERVICE_FACTORY_HELPER( LabeledDataSequence ) + /// declare XServiceInfo methods + APPHELPER_XSERVICEINFO_DECL() + +protected: + // ____ XLabeledDataSequence ____ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > SAL_CALL getValues() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setValues( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xSequence ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > SAL_CALL getLabel() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setLabel( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence >& xSequence ) + throw (::com::sun::star::uno::RuntimeException); + + // ____ XCloneable ____ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() + throw (::com::sun::star::uno::RuntimeException); + + // ____ XModifyBroadcaster ____ + virtual void SAL_CALL addModifyListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeModifyListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + +private: + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > m_xData; + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::data::XDataSequence > m_xLabel; + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xModifyEventForwarder; +}; + +} // namespace chart + +// CHART2_LABELEDDATASEQUENCE_HXX +#endif diff --git a/chart2/source/inc/LegendHelper.hxx b/chart2/source/inc/LegendHelper.hxx new file mode 100644 index 000000000000..5f8279286b72 --- /dev/null +++ b/chart2/source/inc/LegendHelper.hxx @@ -0,0 +1,78 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_TOOLS_LEGENDHELPER_HXX +#define _CHART2_TOOLS_LEGENDHELPER_HXX + +// header for class OUString +#include <rtl/ustring.hxx> +#include <com/sun/star/chart2/XLegend.hpp> +#include <com/sun/star/chart2/XDiagram.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include "charttoolsdllapi.hxx" + +//............................................................................. +namespace chart +{ +//............................................................................. + +//----------------------------------------------------------------------------- +/** +*/ + +class OOO_DLLPUBLIC_CHARTTOOLS LegendHelper +{ +public: + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XLegend > + showLegend( const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xModel + , const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext >& xContext ); + + static void hideLegend( const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xModel ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XLegend > + getLegend( const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xModel + , const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext >& xContext = 0 + , bool bCreate = false ); + + /** returns <FALSE/>, if either there is no legend at the diagram, or there + is a legend which has a "Show" property of value <FALSE/>. Otherwise, + <TRUE/> is returned. + */ + static bool hasLegend( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > & xDiagram ); +}; + +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/LifeTime.hxx b/chart2/source/inc/LifeTime.hxx new file mode 100644 index 000000000000..8e278168259f --- /dev/null +++ b/chart2/source/inc/LifeTime.hxx @@ -0,0 +1,255 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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 _LIFETIME_HXX +#define _LIFETIME_HXX + +#include <osl/mutex.hxx> +#include <osl/conditn.hxx> +#ifndef _COM_SUN_STAR_UNO_EXCEPTION_HDL_ +#include <com/sun/star/uno/Exception.hdl> +#endif +#include <cppuhelper/interfacecontainer.hxx> +#include <com/sun/star/util/XCloseListener.hpp> +#include <com/sun/star/util/XCloseable.hpp> +#include <com/sun/star/lang/XComponent.hpp> +#include <cppuhelper/weakref.hxx> +#include "charttoolsdllapi.hxx" + +namespace apphelper +{ + +class LifeTimeGuard; +class LifeTimeManager +{ +friend class LifeTimeGuard; +protected: + mutable ::osl::Mutex m_aAccessMutex; +public: +OOO_DLLPUBLIC_CHARTTOOLS LifeTimeManager( ::com::sun::star::lang::XComponent* pComponent, sal_Bool bLongLastingCallsCancelable = sal_False ); +OOO_DLLPUBLIC_CHARTTOOLS virtual ~LifeTimeManager(); + +OOO_DLLPUBLIC_CHARTTOOLS bool impl_isDisposed( bool bAssert=true ); +OOO_DLLPUBLIC_CHARTTOOLS sal_Bool dispose() throw(::com::sun::star::uno::RuntimeException); + +public: + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; + +protected: + virtual sal_Bool impl_canStartApiCall(); + virtual void impl_apiCallCountReachedNull(){} + + void impl_registerApiCall(sal_Bool bLongLastingCall); + void impl_unregisterApiCall(sal_Bool bLongLastingCall); + + void impl_init(); + +protected: + ::com::sun::star::lang::XComponent* m_pComponent; + + ::osl::Condition m_aNoAccessCountCondition; + sal_Int32 volatile m_nAccessCount; + + sal_Bool volatile m_bDisposed; + sal_Bool volatile m_bInDispose; + + // + sal_Bool m_bLongLastingCallsCancelable; + ::osl::Condition m_aNoLongLastingCallCountCondition; + sal_Int32 volatile m_nLongLastingCallCount; +}; + +class CloseableLifeTimeManager : public LifeTimeManager +{ +protected: + ::com::sun::star::util::XCloseable* m_pCloseable; + + ::osl::Condition m_aEndTryClosingCondition; + sal_Bool volatile m_bClosed; + sal_Bool volatile m_bInTryClose; + //the ownership between model and controller is not clear at first + //each controller might consider him as owner of the model first + //at start the model is not considered as owner of itself + sal_Bool volatile m_bOwnership; + //with a XCloseable::close call and during XCloseListener::queryClosing + //the ownership can be regulated more explicit, + //if so the ownership is considered to be well known + sal_Bool volatile m_bOwnershipIsWellKnown; + +public: +OOO_DLLPUBLIC_CHARTTOOLS CloseableLifeTimeManager( ::com::sun::star::util::XCloseable* pCloseable + , ::com::sun::star::lang::XComponent* pComponent + , sal_Bool bLongLastingCallsCancelable = sal_False ); +OOO_DLLPUBLIC_CHARTTOOLS virtual ~CloseableLifeTimeManager(); + +OOO_DLLPUBLIC_CHARTTOOLS bool impl_isDisposedOrClosed( bool bAssert=true ); +OOO_DLLPUBLIC_CHARTTOOLS sal_Bool g_close_startTryClose(sal_Bool bDeliverOwnership) + throw ( ::com::sun::star::uno::Exception ); +OOO_DLLPUBLIC_CHARTTOOLS sal_Bool g_close_isNeedToCancelLongLastingCalls( sal_Bool bDeliverOwnership, ::com::sun::star::util::CloseVetoException& ex ) + throw ( ::com::sun::star::util::CloseVetoException ); +OOO_DLLPUBLIC_CHARTTOOLS void g_close_endTryClose(sal_Bool bDeliverOwnership, sal_Bool bMyVeto ); +OOO_DLLPUBLIC_CHARTTOOLS void g_close_endTryClose_doClose(); +OOO_DLLPUBLIC_CHARTTOOLS sal_Bool g_addCloseListener( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XCloseListener > & xListener ) + throw(::com::sun::star::uno::RuntimeException); + +protected: + virtual sal_Bool impl_canStartApiCall(); + virtual void impl_apiCallCountReachedNull(); + + void impl_setOwnership( sal_Bool bDeliverOwnership, sal_Bool bMyVeto ); + sal_Bool impl_shouldCloseAtNextChance(); + void impl_doClose(); + + void impl_init() + { + m_bClosed = sal_False; + m_bInTryClose = sal_False; + m_bOwnership = sal_False; + m_bOwnershipIsWellKnown = sal_False; + m_aEndTryClosingCondition.set(); + } +}; + +//----------------------------------------------------------------- +/* +Use this Guard in your apicalls to protect access on resources +which will be released in dispose. +It's guarantied, that the release of resources only starts if your +guarded call has finished. +! It's only partly guaranteed that this resources will not change during the call. +See the example for details. + +This class is to be used as described in the example. + +If this guard is used in all api calls of an XCloseable object +it's guarantied, that the closeable will close itself after finishing the last call +if it should do so. + + ::ApiCall +{ + //hold no mutex!!! + LifeTimeGuard aLifeTimeGuard(m_aLifeTimeManager); + + //mutex is acquired; call is not registered + + if(!aLifeTimeGuard.startApiCall()) + return ; //behave as passive as possible, if disposed or closed + + //mutex is acquired, call is registered + { + //you might access some private members here + //but than you need to protect access to these members always like this + //never call to the outside here + } + + aLifeTimeGuard.clear(); //!!! + + //Mutex is released, the running call is still registered + //this call will finish before the 'release-section' in dispose is allowed to start + + { + //you might access some private members here guarded with your own mutex + //but release your mutex at the end of this block + } + + //you can call to the outside (without holding the mutex) without becoming disposed + + //End of method -> ~LifeTimeGuard + //-> call is unregistered + //-> this object might be disposed now +} + +your XComponent::dispose method has to be implemented in the following way: + + ::dispose() +{ + //hold no mutex!!! + if( !m_aLifeTimeManager.dispose() ) + return; + + //--release all resources and references + //... +} + +*/ +//----------------------------------------------------------------- + +class OOO_DLLPUBLIC_CHARTTOOLS LifeTimeGuard +{ + +public: + LifeTimeGuard( LifeTimeManager& rManager ) + : m_guard( rManager.m_aAccessMutex ) + , m_rManager(rManager) + , m_bCallRegistered(sal_False) + , m_bLongLastingCallRegistered(sal_False) + { + + } + sal_Bool startApiCall(sal_Bool bLongLastingCall=sal_False); + ~LifeTimeGuard(); + void clear() { m_guard.clear(); } + +private: + osl::ClearableMutexGuard m_guard; + LifeTimeManager& m_rManager; + sal_Bool m_bCallRegistered; + sal_Bool m_bLongLastingCallRegistered; + +private: + // these make no sense + LifeTimeGuard( ::osl::Mutex& rMutex ); + LifeTimeGuard( const LifeTimeGuard& ); + LifeTimeGuard& operator= ( const LifeTimeGuard& ); +}; + + +template<class T> +class NegativeGuard +{ +protected: + T * m_pT; +public: + + NegativeGuard(T * pT) : m_pT(pT) + { + m_pT->release(); + } + + NegativeGuard(T & t) : m_pT(&t) + { + m_pT->release(); + } + + ~NegativeGuard() + { + m_pT->acquire(); + } +}; + +}//end namespace apphelper +#endif diff --git a/chart2/source/inc/LineProperties.hxx b/chart2/source/inc/LineProperties.hxx new file mode 100644 index 000000000000..15cd08654a46 --- /dev/null +++ b/chart2/source/inc/LineProperties.hxx @@ -0,0 +1,77 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_LINEPROPERTIES_HXX +#define CHART_LINEPROPERTIES_HXX + +#include "PropertyHelper.hxx" +#include "FastPropertyIdRanges.hxx" +#include "charttoolsdllapi.hxx" +#include <com/sun/star/beans/Property.hpp> + +#include <vector> + +namespace chart +{ + +// implements service LineProperties +class OOO_DLLPUBLIC_CHARTTOOLS LineProperties +{ +public: + // FastProperty Ids for properties + enum + { + // com.sun.star.drawing.LineProperties + PROP_LINE_STYLE = FAST_PROPERTY_ID_START_LINE_PROP, + PROP_LINE_DASH, + PROP_LINE_DASH_NAME, //not in service description + PROP_LINE_COLOR, + PROP_LINE_TRANSPARENCE, + PROP_LINE_WIDTH, + PROP_LINE_JOINT + }; + + static void AddPropertiesToVector( + ::std::vector< ::com::sun::star::beans::Property > & rOutProperties ); + + static void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ); + + SAL_DLLPRIVATE static bool IsLineVisible( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xLineProperties ); + SAL_DLLPRIVATE static void SetLineVisible( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xLineProperties ); + static void SetLineInvisible( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xLineProperties ); + +private: + // not implemented + LineProperties(); +}; + +} // namespace chart + +// CHART_LINEPROPERTIES_HXX +#endif diff --git a/chart2/source/inc/LinearRegressionCurveCalculator.hxx b/chart2/source/inc/LinearRegressionCurveCalculator.hxx new file mode 100644 index 000000000000..faef7bdbe0c8 --- /dev/null +++ b/chart2/source/inc/LinearRegressionCurveCalculator.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_LINEARREGRESSIONCURVECALCULATOR_HXX +#define CHART2_LINEARREGRESSIONCURVECALCULATOR_HXX + +#include "RegressionCurveCalculator.hxx" + +namespace chart +{ + +class LinearRegressionCurveCalculator : + public RegressionCurveCalculator +{ +public: + LinearRegressionCurveCalculator(); + virtual ~LinearRegressionCurveCalculator(); + +protected: + virtual ::rtl::OUString ImplGetRepresentation( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xNumFormatter, + ::sal_Int32 nNumberFormatKey ) const; + +private: + // ____ XRegressionCurveCalculator ____ + virtual void SAL_CALL recalculateRegression( + const ::com::sun::star::uno::Sequence< double >& aXValues, + const ::com::sun::star::uno::Sequence< double >& aYValues ) + throw (::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getCurveValue( double x ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > SAL_CALL getCurveValues( + double min, + double max, + ::sal_Int32 nPointCount, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingX, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingY, + ::sal_Bool bMaySkipPointsInCalculation ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // formula is: f(x) = m_fSlope * x + m_fIntercept + double m_fSlope; + double m_fIntercept; +}; + +} // namespace chart + +// CHART2_LINEARREGRESSIONCURVECALCULATOR_HXX +#endif diff --git a/chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx b/chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx new file mode 100644 index 000000000000..4b3a6fa8d0b0 --- /dev/null +++ b/chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_LOGARITHMICREGRESSIONCURVECALCULATOR_HXX +#define CHART2_LOGARITHMICREGRESSIONCURVECALCULATOR_HXX + +#include "RegressionCurveCalculator.hxx" + +namespace chart +{ + +class LogarithmicRegressionCurveCalculator : + public RegressionCurveCalculator +{ +public: + LogarithmicRegressionCurveCalculator(); + virtual ~LogarithmicRegressionCurveCalculator(); + +protected: + virtual ::rtl::OUString ImplGetRepresentation( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xNumFormatter, + ::sal_Int32 nNumberFormatKey ) const; + +private: + // ____ XRegressionCurveCalculator ____ + virtual void SAL_CALL recalculateRegression( + const ::com::sun::star::uno::Sequence< double >& aXValues, + const ::com::sun::star::uno::Sequence< double >& aYValues ) + throw (::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getCurveValue( double x ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > SAL_CALL getCurveValues( + double min, + double max, + ::sal_Int32 nPointCount, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingX, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingY, + ::sal_Bool bMaySkipPointsInCalculation ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // formula is: f(x) = m_fSlope * log( x ) + m_fIntercept + double m_fSlope; + double m_fIntercept; +}; + +} // namespace chart + +// CHART2_LOGARITHMICREGRESSIONCURVECALCULATOR_HXX +#endif diff --git a/chart2/source/inc/MeanValueRegressionCurveCalculator.hxx b/chart2/source/inc/MeanValueRegressionCurveCalculator.hxx new file mode 100644 index 000000000000..3fc2c6f1c354 --- /dev/null +++ b/chart2/source/inc/MeanValueRegressionCurveCalculator.hxx @@ -0,0 +1,73 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_MEANVALUEREGRESSIONCURVECALCULATOR_HXX +#define CHART2_MEANVALUEREGRESSIONCURVECALCULATOR_HXX + +#include "RegressionCurveCalculator.hxx" + +namespace chart +{ + +class MeanValueRegressionCurveCalculator : + public RegressionCurveCalculator +{ +public: + MeanValueRegressionCurveCalculator(); + virtual ~MeanValueRegressionCurveCalculator(); + +protected: + virtual ::rtl::OUString ImplGetRepresentation( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xNumFormatter, + ::sal_Int32 nNumberFormatKey ) const; + +private: + // ____ XRegressionCurveCalculator ____ + virtual void SAL_CALL recalculateRegression( + const ::com::sun::star::uno::Sequence< double >& aXValues, + const ::com::sun::star::uno::Sequence< double >& aYValues ) + throw (::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getCurveValue( double x ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > SAL_CALL getCurveValues( + double min, + double max, + ::sal_Int32 nPointCount, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingX, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingY, + ::sal_Bool bMaySkipPointsInCalculation ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // formula is: f(x) = m_fMeanValue + double m_fMeanValue; +}; + +} // namespace chart + +// CHART2_MEANVALUEREGRESSIONCURVECALCULATOR_HXX +#endif diff --git a/chart2/source/inc/MediaDescriptorHelper.hxx b/chart2/source/inc/MediaDescriptorHelper.hxx new file mode 100644 index 000000000000..a41ad1f8c751 --- /dev/null +++ b/chart2/source/inc/MediaDescriptorHelper.hxx @@ -0,0 +1,207 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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 _MEDIADESCRIPTORHELPER_HXX +#define _MEDIADESCRIPTORHELPER_HXX + +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/util/URL.hpp> +#include <com/sun/star/awt/Rectangle.hpp> +#include <com/sun/star/io/XStream.hpp> +#include <com/sun/star/io/XInputStream.hpp> +#include <com/sun/star/io/XOutputStream.hpp> +#include <com/sun/star/embed/XStorage.hpp> +#include "charttoolsdllapi.hxx" + +/* +* This class helps to read and write the properties mentioned in the service description +* com.sun.star.document.MediaDescriptor from and to a sequence of PropertyValues. +* Properties that are not mentioned in the service description +* are stored in the member AdditionalProperties. +* +* As an additional feature this helper class can generate a reduced sequence of PropertyValues +* that does not contain properties which are known to be only view relevant. This +* reduced sequence than might be attached to a model directly. +*/ + +namespace apphelper +{ + +class OOO_DLLPUBLIC_CHARTTOOLS MediaDescriptorHelper +{ +private: + //MediaDescriptorHelper(){}; +public: + MediaDescriptorHelper( const ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue > & rMediaDescriptor ); + virtual ~MediaDescriptorHelper(); + + ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue > getReducedForModel(); + +public: + //--------------------- + //all properties given in the constructor are stored in the following three sequences + + ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue > + m_aRegularProperties; //these are the properties which are described in service com.sun.star.document.MediaDescriptor and not marked as deprecated + + ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue > + m_aDeprecatedProperties; //these are properties which are described in service com.sun.star.document.MediaDescriptor but are marked as deprecated + + ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue > + m_aAdditionalProperties; //these are properties which are not described in service com.sun.star.document.MediaDescriptor + + //---------------------- + //properties which should be given to a model are additionally stored in this sequence (not documented properties and deprecated properties are not included!) + ::com::sun::star::uno::Sequence< + ::com::sun::star::beans::PropertyValue > + m_aModelProperties; //these are properties which are not described in service com.sun.star.document.MediaDescriptor + + + //@todo define this for debug only, except URL + sal_Bool AsTemplate; //document is a template. + sal_Bool ISSET_AsTemplate; + ::rtl::OUString Author; // + sal_Bool ISSET_Author; + ::rtl::OUString CharacterSet; //identifier of used character set. + sal_Bool ISSET_CharacterSet; + ::rtl::OUString Comment;// + sal_Bool ISSET_Comment; + + ::com::sun::star::uno::Any + ComponentData;// + sal_Bool ISSET_ComponentData; + ::rtl::OUString FileName; //deprecated, same as url + sal_Bool ISSET_FileName; + ::com::sun::star::uno::Any + FilterData;// + sal_Bool ISSET_FilterData; + ::rtl::OUString FilterName; //internal filter name. + sal_Bool ISSET_FilterName; + ::rtl::OUString FilterFlags;//deprecated, + sal_Bool ISSET_FilterFlags; + ::rtl::OUString FilterOptions;// + sal_Bool ISSET_FilterOptions; + //not documented ... @todo remove? + ::rtl::OUString FrameName; //name of target frame. + sal_Bool ISSET_FrameName; + sal_Bool Hidden; //load document, invisible. + sal_Bool ISSET_Hidden; + + ::rtl::OUString HierarchicalDocumentName; + sal_Bool ISSET_HierarchicalDocumentName; + + + ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > + OutputStream; //a stream to receive the document data for saving + sal_Bool ISSET_OutputStream; + ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream > + InputStream; //content of document. + sal_Bool ISSET_InputStream; + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + InteractionHandler; // //::com::sun::star::task::XInteractionHandler + sal_Bool ISSET_InteractionHandler; + + ::rtl::OUString JumpMark; //specifies the name of a mark within the document where the first view is to position itself. + sal_Bool ISSET_JumpMark; + ::rtl::OUString MediaType; //mime type. + sal_Bool ISSET_MediaType; + ::rtl::OUString OpenFlags; //deprecated + sal_Bool ISSET_OpenFlags; + sal_Bool OpenNewView; //opens a new view for an already loaded document. + sal_Bool ISSET_OpenNewView; + sal_Bool Overwrite; //opens a new view for an already loaded document. + sal_Bool ISSET_Overwrite; + ::rtl::OUString Password; // + sal_Bool ISSET_Password; + + //not documented ... @todo remove? + ::com::sun::star::awt::Rectangle + PosSize; //position and size of document window. + sal_Bool ISSET_PosSize; + + ::com::sun::star::uno::Sequence< sal_Int8 > + PostData; //contains the data for HTTP post method as a sequence of bytes. + sal_Bool ISSET_PostData; + ::rtl::OUString PostString; //deprecated, contains the data for HTTP post method as a sequence of bytes. + sal_Bool ISSET_PostString; + sal_Bool Preview; //show preview. + sal_Bool ISSET_Preview; + sal_Bool ReadOnly; //open document readonly. + sal_Bool ISSET_ReadOnly; + ::rtl::OUString Referer; //name of document referrer. + sal_Bool ISSET_Referer; + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + StatusIndicator; // //::com::sun::star::task::XStatusIndicator + sal_Bool ISSET_StatusIndicator; + //not documented ... @todo remove? + sal_Bool Silent; //prevents dialogs to query for more information. + sal_Bool ISSET_Silent; + ::rtl::OUString TemplateName; //deprecated, name of the template instead of the URL. + sal_Bool ISSET_TemplateName; + ::rtl::OUString TemplateRegionName; //deprecated, name of the region of the template. + sal_Bool ISSET_TemplateRegionName; + sal_Bool Unpacked; + sal_Bool ISSET_Unpacked; + ::rtl::OUString URL;// FileName, URL of the document. + sal_Bool ISSET_URL; + sal_Int16 Version; //storage version. + sal_Bool ISSET_Version; + + ::com::sun::star::uno::Any + ViewData;// + sal_Bool ISSET_ViewData; + sal_Int16 ViewId; //id of the initial view. + sal_Bool ISSET_ViewId; + + // new framework objects + ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > + Storage; + sal_Bool ISSET_Storage; + ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > + Stream; + sal_Bool ISSET_Stream; + + // undocumented SFX Properties + ::com::sun::star::uno::Sequence< sal_Int32 > + WinExtent; + sal_Bool ISSET_WinExtent; + sal_Bool SetEmbedded; + sal_Bool ISSET_SetEmbedded; + +protected: +SAL_DLLPRIVATE void impl_init(); +}; + +} + +#endif diff --git a/chart2/source/inc/ModifyListenerCallBack.hxx b/chart2/source/inc/ModifyListenerCallBack.hxx new file mode 100644 index 000000000000..3833806d185e --- /dev/null +++ b/chart2/source/inc/ModifyListenerCallBack.hxx @@ -0,0 +1,68 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_MODIFYLISTENERCALLBACK_HXX +#define CHART2_MODIFYLISTENERCALLBACK_HXX + +// header for class Link +#include <tools/link.hxx> +#include <com/sun/star/util/XModifyBroadcaster.hpp> +#include <com/sun/star/util/XModifyListener.hpp> +#include "charttoolsdllapi.hxx" + +namespace chart { + +/** Use this class as a member if you want to listen on a XModifyBroadcaster +without becoming a XModifyListener yourself + */ + +class ModifyListenerCallBack_impl; + +class OOO_DLLPUBLIC_CHARTTOOLS ModifyListenerCallBack +{ +public: + explicit ModifyListenerCallBack( const Link& rCallBack ); + + virtual ~ModifyListenerCallBack(); + + void startListening( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyBroadcaster >& xBroadcaster ); + SAL_DLLPRIVATE void stopListening(); + +private: //methods + SAL_DLLPRIVATE ModifyListenerCallBack(); + SAL_DLLPRIVATE ModifyListenerCallBack( const ModifyListenerCallBack& ); + +private: //member + ModifyListenerCallBack_impl* pModifyListener_impl; + ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener > m_xModifyListener; +}; + +} // namespace chart + +#endif + diff --git a/chart2/source/inc/ModifyListenerHelper.hxx b/chart2/source/inc/ModifyListenerHelper.hxx new file mode 100644 index 000000000000..262d2078deea --- /dev/null +++ b/chart2/source/inc/ModifyListenerHelper.hxx @@ -0,0 +1,307 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_MODIFYLISTENERHELPER_HXX +#define CHART2_MODIFYLISTENERHELPER_HXX + +#include <cppuhelper/interfacecontainer.hxx> +#include <com/sun/star/util/XModifyListener.hpp> +#include <com/sun/star/util/XModifyBroadcaster.hpp> +#include <com/sun/star/util/XModifiable.hpp> +#include <com/sun/star/uno/XWeak.hpp> +#include <cppuhelper/implbase1.hxx> +#include <cppuhelper/compbase2.hxx> +#include <cppuhelper/weakref.hxx> + +#include "MutexContainer.hxx" +#include "charttoolsdllapi.hxx" + +#include <list> +#include <algorithm> +#include <functional> +#include <utility> + +namespace com { namespace sun { namespace star { +namespace chart2 +{ + class XChartDocument; +}}}} + +namespace chart +{ +namespace ModifyListenerHelper +{ + +OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > createModifyEventForwarder(); + +// ================================================================================ + +/** This helper class serves as forwarder of modify events. It can be used + whenever an object has to send modify events after it gets a modify event of + one of its children. + + <p>The listeners are held as WeakReferences if they support XWeak. Thus the + life time of the listeners is independent of the broadcaster's lifetime in + this case.</p> + */ +class ModifyEventForwarder : + public MutexContainer, + public ::cppu::WeakComponentImplHelper2< + ::com::sun::star::util::XModifyBroadcaster, + ::com::sun::star::util::XModifyListener > +{ +public: + ModifyEventForwarder(); + + void FireEvent( const ::com::sun::star::lang::EventObject & rEvent ); + + void AddListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ); + void RemoveListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ); + +protected: + // ____ XModifyBroadcaster ____ + virtual void SAL_CALL addModifyListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeModifyListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + + // ____ XModifyListener ____ + virtual void SAL_CALL modified( + const ::com::sun::star::lang::EventObject& aEvent ) + throw (::com::sun::star::uno::RuntimeException); + + // ____ XEventListener (base of XModifyListener) ____ + virtual void SAL_CALL disposing( + const ::com::sun::star::lang::EventObject& Source ) + throw (::com::sun::star::uno::RuntimeException); + + // ____ WeakComponentImplHelperBase ____ + virtual void SAL_CALL disposing(); + +private: + /// call disposing() at all listeners and remove all listeners + void DisposeAndClear( const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XWeak > & xSource ); + +// ::osl::Mutex & m_rMutex; + ::cppu::OBroadcastHelper m_aModifyListeners; + + typedef ::std::list< + ::std::pair< + ::com::sun::star::uno::WeakReference< ::com::sun::star::util::XModifyListener >, + ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > > > + tListenerMap; + + tListenerMap m_aListenerMap; +}; + +// ================================================================================ + +namespace impl +{ + +template< class InterfaceRef > +struct addListenerFunctor : public ::std::unary_function< InterfaceRef, void > +{ + explicit addListenerFunctor( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener > & xListener ) : + m_xListener( xListener ) + {} + + void operator() ( const InterfaceRef & xObject ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyBroadcaster > + xBroadcaster( xObject, ::com::sun::star::uno::UNO_QUERY ); + if( xBroadcaster.is() && m_xListener.is()) + xBroadcaster->addModifyListener( m_xListener ); + } +private: + ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xListener; +}; + +template< class InterfaceRef > +struct removeListenerFunctor : public ::std::unary_function< InterfaceRef, void > +{ + explicit removeListenerFunctor( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener > & xListener ) : + m_xListener( xListener ) + {} + + void operator() ( const InterfaceRef & xObject ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyBroadcaster > + xBroadcaster( xObject, ::com::sun::star::uno::UNO_QUERY ); + if( xBroadcaster.is() && m_xListener.is()) + xBroadcaster->removeModifyListener( m_xListener ); + } +private: + ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xListener; +}; + +template< class Pair > +struct addListenerToMappedElementFunctor : public ::std::unary_function< Pair, void > +{ + explicit addListenerToMappedElementFunctor( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener > & xListener ) : + m_xListener( xListener ) + {} + + void operator() ( const Pair & aPair ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyBroadcaster > + xBroadcaster( aPair.second, ::com::sun::star::uno::UNO_QUERY ); + if( xBroadcaster.is() && m_xListener.is()) + xBroadcaster->addModifyListener( m_xListener ); + } +private: + ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xListener; +}; + +template< class Pair > +struct removeListenerFromMappedElementFunctor : public ::std::unary_function< Pair, void > +{ + explicit removeListenerFromMappedElementFunctor( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener > & xListener ) : + m_xListener( xListener ) + {} + + void operator() ( const Pair & aPair ) + { + ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyBroadcaster > + xBroadcaster( aPair.second, ::com::sun::star::uno::UNO_QUERY ); + if( xBroadcaster.is() && m_xListener.is()) + xBroadcaster->removeModifyListener( m_xListener ); + } +private: + ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > m_xListener; +}; + +} // namespace impl + +// -------------------------------------------------------------------------------- + + +template< class InterfaceRef > +void addListener( + const InterfaceRef & xObject, + const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener > & xListener ) +{ + if( xListener.is()) + { + impl::addListenerFunctor< InterfaceRef > aFunctor( xListener ); + aFunctor( xObject ); + } +} + +template< class Container > +void addListenerToAllElements( + const Container & rContainer, + const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener > & xListener ) +{ + if( xListener.is()) + ::std::for_each( rContainer.begin(), rContainer.end(), + impl::addListenerFunctor< typename Container::value_type >( xListener )); +} + +template< class Container > +void addListenerToAllMapElements( + const Container & rContainer, + const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener > & xListener ) +{ + if( xListener.is()) + ::std::for_each( rContainer.begin(), rContainer.end(), + impl::addListenerToMappedElementFunctor< typename Container::value_type >( xListener )); +} + +template< typename T > +void addListenerToAllSequenceElements( + const ::com::sun::star::uno::Sequence< T > & rSequence, + const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener > & xListener ) +{ + if( xListener.is()) + ::std::for_each( rSequence.getConstArray(), rSequence.getConstArray() + rSequence.getLength(), + impl::addListenerFunctor< T >( xListener )); +} + +template< class InterfaceRef > +void removeListener( + const InterfaceRef & xObject, + const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener > & xListener ) +{ + if( xListener.is()) + { + impl::removeListenerFunctor< InterfaceRef > aFunctor( xListener ); + aFunctor( xObject ); + } +} + +template< class Container > +void removeListenerFromAllElements( + const Container & rContainer, + const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener > & xListener ) +{ + if( xListener.is()) + ::std::for_each( rContainer.begin(), rContainer.end(), + impl::removeListenerFunctor< typename Container::value_type >( xListener )); +} + +template< class Container > +void removeListenerFromAllMapElements( + const Container & rContainer, + const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener > & xListener ) +{ + if( xListener.is()) + ::std::for_each( rContainer.begin(), rContainer.end(), + impl::removeListenerFromMappedElementFunctor< typename Container::value_type >( xListener )); +} + +template< typename T > +void removeListenerFromAllSequenceElements( + const ::com::sun::star::uno::Sequence< T > & rSequence, + const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyListener > & xListener ) +{ + if( xListener.is()) + ::std::for_each( rSequence.getConstArray(), rSequence.getConstArray() + rSequence.getLength(), + impl::removeListenerFunctor< T >( xListener )); +} + +} // namespace ModifyListenerHelper +} // namespace chart + +// CHART2_MODIFYLISTENERHELPER_HXX +#endif diff --git a/chart2/source/inc/MutexContainer.hxx b/chart2/source/inc/MutexContainer.hxx new file mode 100644 index 000000000000..026c53634b12 --- /dev/null +++ b/chart2/source/inc/MutexContainer.hxx @@ -0,0 +1,50 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_MUTEXCONTAINER_HXX +#define CHART_MUTEXCONTAINER_HXX + +#include <osl/mutex.hxx> +#include "charttoolsdllapi.hxx" + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS MutexContainer +{ +public: + virtual ~MutexContainer(); + +protected: + mutable ::osl::Mutex m_aMutex; + + virtual ::osl::Mutex & GetMutex() const; +}; + +} // namespace chart + +// CHART_MUTEXCONTAINER_HXX +#endif diff --git a/chart2/source/inc/NameContainer.hxx b/chart2/source/inc/NameContainer.hxx new file mode 100644 index 000000000000..f44d3cea490a --- /dev/null +++ b/chart2/source/inc/NameContainer.hxx @@ -0,0 +1,104 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_NAMECONTAINER_HXX +#define _CHART2_NAMECONTAINER_HXX + +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <cppuhelper/implbase3.hxx> +#include "charttoolsdllapi.hxx" + +#include <map> + +//............................................................................. +namespace chart +{ +//............................................................................. + +OOO_DLLPUBLIC_CHARTTOOLS ::com::sun::star::uno::Reference< ::com::sun::star::container::XNameContainer > createNameContainer( + const ::com::sun::star::uno::Type& rType, const rtl::OUString& rServicename, const rtl::OUString& rImplementationName ); + +namespace impl +{ +typedef ::cppu::WeakImplHelper3< + ::com::sun::star::container::XNameContainer, + ::com::sun::star::lang::XServiceInfo, + ::com::sun::star::util::XCloneable > + NameContainer_Base; +} + +class NameContainer : public impl::NameContainer_Base +{ +public: + NameContainer( const ::com::sun::star::uno::Type& rType, const rtl::OUString& rServicename, const rtl::OUString& rImplementationName ); + explicit NameContainer( const NameContainer & rOther ); + virtual ~NameContainer(); + + // XServiceInfo + virtual ::rtl::OUString SAL_CALL getImplementationName( ) throw(::com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw(::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames( ) throw(::com::sun::star::uno::RuntimeException); + + // XNameContainer + virtual void SAL_CALL insertByName( const rtl::OUString& aName, const com::sun::star::uno::Any& aElement ) throw( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::ElementExistException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeByName( const rtl::OUString& Name ) throw( com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException); + + // XNameReplace + virtual void SAL_CALL replaceByName( const rtl::OUString& aName, const com::sun::star::uno::Any& aElement ) throw( com::sun::star::lang::IllegalArgumentException, com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException); + + // XNameAccess + virtual com::sun::star::uno::Any SAL_CALL getByName( const rtl::OUString& aName ) throw( com::sun::star::container::NoSuchElementException, com::sun::star::lang::WrappedTargetException, com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Sequence< rtl::OUString > SAL_CALL getElementNames( ) throw( com::sun::star::uno::RuntimeException); + virtual sal_Bool SAL_CALL hasByName( const rtl::OUString& aName ) throw( com::sun::star::uno::RuntimeException); + + // XElementAccess + virtual sal_Bool SAL_CALL hasElements( ) throw( com::sun::star::uno::RuntimeException); + virtual com::sun::star::uno::Type SAL_CALL getElementType( ) throw( com::sun::star::uno::RuntimeException); + + // XCloneable + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() throw (::com::sun::star::uno::RuntimeException); + +private: //methods + NameContainer();//no default contructor + +private: //member + const ::com::sun::star::uno::Type m_aType; + const rtl::OUString m_aServicename; + const rtl::OUString m_aImplementationName; + + typedef ::std::map< ::rtl::OUString, com::sun::star::uno::Any > tContentMap; + + tContentMap m_aMap; +}; + +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/NamedFillProperties.hxx b/chart2/source/inc/NamedFillProperties.hxx new file mode 100644 index 000000000000..325f8960f7fd --- /dev/null +++ b/chart2/source/inc/NamedFillProperties.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_NAMEDFILLPROPERTIES_HXX +#define CHART_NAMEDFILLPROPERTIES_HXX + +#error "Deprecated, do not include this file" + +#include "PropertyHelper.hxx" +#include "FastPropertyIdRanges.hxx" +#include <com/sun/star/beans/Property.hpp> + +#include <vector> + +namespace chart +{ + +// CHANGED! : these are the UNnamed properties! +// @deprecated +class NamedFillProperties +{ +public: + // FastProperty Ids for properties + enum + { + // com.sun.star.drawing.FillProperties (only named properties) + //optional properties: + PROP_FILL_TRANSPARENCE_GRADIENT, + PROP_FILL_GRADIENT, + PROP_FILL_HATCH, + PROP_FILL_BITMAP, + + FAST_PROPERTY_ID_END_NAMED_FILL_PROP + }; + + static void AddPropertiesToVector( + ::std::vector< ::com::sun::star::beans::Property > & rOutProperties ); + + static void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ); + + //will return e.g. "FillGradientName" for nHandle == PROP_FILL_GRADIENT_NAME + static ::rtl::OUString GetPropertyNameForHandle( sal_Int32 nHandle ); + +private: + // not implemented + NamedFillProperties(); +}; + +} // namespace chart + +// CHART_NAMEDFILLPROPERTIES_HXX +#endif diff --git a/chart2/source/inc/NamedLineProperties.hxx b/chart2/source/inc/NamedLineProperties.hxx new file mode 100644 index 000000000000..8f16cd970932 --- /dev/null +++ b/chart2/source/inc/NamedLineProperties.hxx @@ -0,0 +1,75 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_NAMEDLINEPROPERTIES_HXX +#define CHART_NAMEDLINEPROPERTIES_HXX + +#error "Deprecated, do not include this file" + +#include "PropertyHelper.hxx" +#include "FastPropertyIdRanges.hxx" +#include <com/sun/star/beans/Property.hpp> + +#include <vector> + +namespace chart +{ + + +// @depreated !! +class NamedLineProperties +{ +public: + // FastProperty Ids for properties + enum + { + // com.sun.star.drawing.LineProperties (only named properties) + PROP_LINE_DASH_NAME = FAST_PROPERTY_ID_START_NAMED_LINE_PROP, + PROP_LINE_END_NAME, + PROP_LINE_START_NAME, + + FAST_PROPERTY_ID_END_NAMED_LINE_PROP + }; + + static void AddPropertiesToVector( + ::std::vector< ::com::sun::star::beans::Property > & rOutProperties, + bool bIncludeLineEnds = false ); + + static void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap, + bool bIncludeLineEnds = false ); + + //will return e.g. "LineDashName" for PROP_LINE_DASH_NAME + static ::rtl::OUString GetPropertyNameForHandle( sal_Int32 nHandle ); + +private: + // not implemented + NamedLineProperties(); +}; + +} // namespace chart + +// CHART_NAMEDLINEPROPERTIES_HXX +#endif diff --git a/chart2/source/inc/NamedProperties.hxx b/chart2/source/inc/NamedProperties.hxx new file mode 100644 index 000000000000..5f9f5eb94823 --- /dev/null +++ b/chart2/source/inc/NamedProperties.hxx @@ -0,0 +1,62 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_NAMEDPROPERTIES_HXX +#define CHART_NAMEDPROPERTIES_HXX + +#include "NamedLineProperties.hxx" +#include "NamedFillProperties.hxx" + +#include "PropertyHelper.hxx" +#include <com/sun/star/beans/Property.hpp> + +#include <vector> + +namespace chart +{ + +class NamedProperties +{ + /** this class combines the classes NamedFillAttributes and NamedLineAttributes + thus you can handle all named properties with one call if you like + */ +public: + + static void AddPropertiesToVector( + ::std::vector< ::com::sun::star::beans::Property > & rOutProperties ); + + //will return e.g. "FillGradientName" for nHandle == PROP_FILL_GRADIENT_NAME + static ::rtl::OUString GetPropertyNameForHandle( sal_Int32 nHandle ); + +private: + // not implemented + NamedProperties(); +}; + +} // namespace chart + +// CHART_NAMEDPROPERTIES_HXX +#endif diff --git a/chart2/source/inc/NoWarningThisInCTOR.hxx b/chart2/source/inc/NoWarningThisInCTOR.hxx new file mode 100644 index 000000000000..00167d07636b --- /dev/null +++ b/chart2/source/inc/NoWarningThisInCTOR.hxx @@ -0,0 +1,46 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_NOWARNINGTHISINCTOR_HXX +#define CHART2_NOWARNINGTHISINCTOR_HXX + +/** Include this file, if you have to use "this" in the base initializer list of + a constructor. + + Include it only, if the usage of this is unavoidable, like in the + initialization of controls in a dialog. + + Do not include this header in other header files, because this might result + in unintended suppression of the warning via indirect inclusion. + */ + +#ifdef _MSC_VER +// warning C4355: 'this' : used in base member initializer list +# pragma warning (disable : 4355) +#endif + +// CHART2_NOWARNINGTHISINCTOR_HXX +#endif diff --git a/chart2/source/inc/OPropertySet.hxx b/chart2/source/inc/OPropertySet.hxx new file mode 100644 index 000000000000..fa773a6dab00 --- /dev/null +++ b/chart2/source/inc/OPropertySet.hxx @@ -0,0 +1,319 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_OPROPERTYSET_HXX +#define CHART_OPROPERTYSET_HXX + +// helper classes +#include <cppuhelper/propshlp.hxx> +#include <cppuhelper/interfacecontainer.hxx> +#include <cppuhelper/weak.hxx> + +// interfaces and types +// #ifndef _COM_SUN_STAR_LANG_XSERVICEINFO_HPP_ +// #include <com/sun/star/lang/XServiceInfo.hpp> +// #endif +#include <com/sun/star/lang/XTypeProvider.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/beans/XMultiPropertyStates.hpp> +#include <com/sun/star/beans/Property.hpp> +#include <com/sun/star/style/XStyleSupplier.hpp> +// #ifndef _COM_SUN_STAR_BEANS_XFASTPROPERTYSTATE_HPP_ +// #include <com/sun/star/beans/XFastPropertyState.hpp> +// #endif +#include <osl/mutex.hxx> +#include "charttoolsdllapi.hxx" + +#include <memory> + +namespace property +{ + +namespace impl +{ class ImplOPropertySet; } + + +class OOO_DLLPUBLIC_CHARTTOOLS OPropertySet : + public ::cppu::OBroadcastHelper, + // includes beans::XPropertySet, XMultiPropertySet and XFastPropertySet + public ::cppu::OPropertySetHelper, + // includes uno::XWeak (and XInterface, esp. ref-counting) +// public virtual ::cppu::OWeakObject, + +// public virtual ::com::sun::star::lang::XServiceInfo, + public ::com::sun::star::lang::XTypeProvider, + public ::com::sun::star::beans::XPropertyState, + public ::com::sun::star::beans::XMultiPropertyStates, + public ::com::sun::star::style::XStyleSupplier +// public ::com::sun::star::beans::XFastPropertyState +{ +public: + OPropertySet( ::osl::Mutex & rMutex ); + virtual ~OPropertySet(); + +protected: + explicit OPropertySet( const OPropertySet & rOther, ::osl::Mutex & rMutex ); + + void SetNewValuesExplicitlyEvenIfTheyEqualDefault(); + + /** implement this method to provide default values for all properties + supporting defaults. If a property does not have a default value, you + may throw an UnknownPropertyException. + */ + virtual ::com::sun::star::uno::Any GetDefaultValue( sal_Int32 nHandle ) const + throw(::com::sun::star::beans::UnknownPropertyException) = 0; + + /** The InfoHelper table contains all property names and types of + this object. + + @return the object that provides information for the + PropertySetInfo + + @see ::cppu::OPropertySetHelper + */ + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() = 0; + + // ____ XPropertySet ____ + /** sample implementation using the InfoHelper: + + <pre> + uno::Reference< beans::XPropertySetInfo > SAL_CALL + OPropertySet::getPropertySetInfo() + throw (uno::RuntimeException) + { + static uno::Reference< beans::XPropertySetInfo > xInfo; + + // /-- + ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ); + if( !xInfo.is()) + { + xInfo = ::cppu::OPropertySetHelper::createPropertySetInfo( + getInfoHelper()); + } + + return xInfo; + // \-- + } + </pre> + + <p>(The reason why this isn't implemented here is, that the static + object is only valid per concrete PropertySet. Otherwise all + PropertySets derived from this base calss would have the same + properties.)</p> + + @see ::cppu::OPropertySetHelper + */ +// virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL +// getPropertySetInfo() +// throw (::com::sun::star::uno::RuntimeException) = 0; + + /** Try to convert the value <code>rValue</code> to the type required by the + property associated with <code>nHandle</code>. + + Overload this method to take influence in modification of properties. + + If the conversion changed , </TRUE> is returned and the converted value + is in <code>rConvertedValue</code>. The former value is contained in + <code>rOldValue</code>. + + After this call returns successfully, the vetoable listeners are + notified. + + @throws IllegalArgumentException, if the conversion was not successful, + or if there is no corresponding property to the given handle. + + @param rConvertedValue the converted value. Only set if return is true. + @param rOldValue the old value. Only set if return is true. + @param nHandle the handle of the property. + + @return true, if the conversion was successful and converted value + differs from the old value. + + @see ::cppu::OPropertySetHelper + */ + virtual sal_Bool SAL_CALL convertFastPropertyValue + ( ::com::sun::star::uno::Any & rConvertedValue, + ::com::sun::star::uno::Any & rOldValue, + sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::lang::IllegalArgumentException); + + /** The same as setFastProperyValue; nHandle is always valid. + The changes must not be broadcasted in this method. + + @attention + Although you are permitted to throw any UNO exception, only the following + are valid for usage: + -- ::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 + + @param nHandle handle + @param rValue value + + @see ::cppu::OPropertySetHelper + */ + virtual void SAL_CALL setFastPropertyValue_NoBroadcast + ( sal_Int32 nHandle, + const ::com::sun::star::uno::Any& rValue ) + throw (::com::sun::star::uno::Exception); + + /** + The same as getFastProperyValue, but return the value through rValue and + nHandle is always valid. + + @see ::cppu::OPropertySetHelper + */ + virtual void SAL_CALL getFastPropertyValue + ( ::com::sun::star::uno::Any& rValue, + sal_Int32 nHandle ) const; + + /// make original interface function visible again + using ::com::sun::star::beans::XFastPropertySet::getFastPropertyValue; + + /** implement this method in derived classes to get called when properties + change. + */ + virtual void firePropertyChangeEvent(); + + /// call this when a derived component is disposed + virtual void disposePropertySet(); + + // ======================================== + // Interfaces + // ======================================== + + // ____ XInterface ____ + virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& aType ) + throw (::com::sun::star::uno::RuntimeException); +// virtual void SAL_CALL acquire() throw (); +// virtual void SAL_CALL release() throw (); + + + // ____ XServiceInfo ____ +// virtual ::rtl::OUString SAL_CALL +// getImplementationName() +// throw (::com::sun::star::uno::RuntimeException); +// virtual sal_Bool SAL_CALL +// supportsService( const ::rtl::OUString& ServiceName ) +// throw (::com::sun::star::uno::RuntimeException); +// virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL +// getSupportedServiceNames() +// throw (::com::sun::star::uno::RuntimeException); + + // ____ XTypeProvider ____ + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL + getTypes() + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL + getImplementationId() + 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 ____ + // Note: getPropertyStates() is already implemented in XPropertyState with the + // same signature + 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); + + // ____ XStyleSupplier ____ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle > SAL_CALL getStyle() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setStyle( const ::com::sun::star::uno::Reference< ::com::sun::star::style::XStyle >& xStyle ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // ____ XFastPropertyState ____ +// virtual ::com::sun::star::beans::PropertyState SAL_CALL getFastPropertyState( sal_Int32 nHandle ) +// throw (::com::sun::star::beans::UnknownPropertyException, +// ::com::sun::star::uno::RuntimeException); +// virtual ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyState > SAL_CALL getFastPropertyStates( const ::com::sun::star::uno::Sequence< sal_Int32 >& aHandles ) +// throw (::com::sun::star::beans::UnknownPropertyException, +// ::com::sun::star::uno::RuntimeException); +// virtual void SAL_CALL setFastPropertyToDefault( sal_Int32 nHandle ) +// throw (::com::sun::star::beans::UnknownPropertyException, +// ::com::sun::star::uno::RuntimeException); +// virtual ::com::sun::star::uno::Any SAL_CALL getFastPropertyDefault( sal_Int32 nHandle ) +// throw (::com::sun::star::beans::UnknownPropertyException, +// ::com::sun::star::lang::WrappedTargetException, +// ::com::sun::star::uno::RuntimeException); + + // ____ XMultiPropertySet ____ + virtual void SAL_CALL setPropertyValues( + const ::com::sun::star::uno::Sequence< ::rtl::OUString >& PropertyNames, + const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any >& Values ) + throw(::com::sun::star::beans::PropertyVetoException, ::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::lang::WrappedTargetException, ::com::sun::star::uno::RuntimeException); + + // ____ XFastPropertySet ____ + virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const ::com::sun::star::uno::Any& rValue ) + 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); + + // Note: it is assumed that the base class implements setPropertyValue by + // using setFastPropertyValue + +private: + /// reference to mutex of class deriving from here + ::osl::Mutex & m_rMutex; + + /// pImpl idiom implementation + ::std::auto_ptr< impl::ImplOPropertySet > m_pImplProperties; + bool m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault; +}; + +} // namespace property + +// CHART_OPROPERTYSET_HXX +#endif diff --git a/chart2/source/inc/ObjectIdentifier.hxx b/chart2/source/inc/ObjectIdentifier.hxx new file mode 100644 index 000000000000..0765c9acf94a --- /dev/null +++ b/chart2/source/inc/ObjectIdentifier.hxx @@ -0,0 +1,278 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_OBJECTIDENTIFIER_HXX +#define _CHART2_OBJECTIDENTIFIER_HXX + +#include <com/sun/star/chart2/XChartType.hpp> +#include <com/sun/star/chart2/XDiagram.hpp> +#include <com/sun/star/chart2/XCoordinateSystem.hpp> +#include <com/sun/star/chart2/XDataSeries.hpp> +#include <com/sun/star/chart2/XChartDocument.hpp> +#include "TitleHelper.hxx" +#include "charttoolsdllapi.hxx" + +// header for class OUString +#include <rtl/ustring.hxx> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/awt/Point.hpp> +#include <com/sun/star/drawing/XShape.hpp> + +//............................................................................. +namespace chart +{ +//............................................................................. + +//----------------------------------------------------------------------------- +/** +*/ +enum ObjectType +{ + OBJECTTYPE_PAGE, + OBJECTTYPE_TITLE, + OBJECTTYPE_LEGEND, + OBJECTTYPE_LEGEND_ENTRY, + OBJECTTYPE_DIAGRAM, + OBJECTTYPE_DIAGRAM_WALL, + OBJECTTYPE_DIAGRAM_FLOOR, + OBJECTTYPE_AXIS, + OBJECTTYPE_AXIS_UNITLABEL, + OBJECTTYPE_GRID, + OBJECTTYPE_SUBGRID, + OBJECTTYPE_DATA_SERIES, + OBJECTTYPE_DATA_POINT, + OBJECTTYPE_DATA_LABELS, + OBJECTTYPE_DATA_LABEL, + OBJECTTYPE_DATA_ERRORS, + OBJECTTYPE_DATA_ERRORS_X, + OBJECTTYPE_DATA_ERRORS_Y, + OBJECTTYPE_DATA_ERRORS_Z, + OBJECTTYPE_DATA_CURVE,//e.g. a statistical method printed as line + OBJECTTYPE_DATA_AVERAGE_LINE, + OBJECTTYPE_DATA_CURVE_EQUATION, + OBJECTTYPE_DATA_STOCK_RANGE, + OBJECTTYPE_DATA_STOCK_LOSS, + OBJECTTYPE_DATA_STOCK_GAIN, + OBJECTTYPE_SHAPE, + OBJECTTYPE_UNKNOWN +}; + +class OOO_DLLPUBLIC_CHARTTOOLS ObjectIdentifier +{ + //CID == ClassifiedIdentifier <--> name of shape + //semicolon, colon, equal sign and slash have special meanings in a CID + //and are therefore not allowed in its components + + //syntax of a CID: CID:/classification/ObjectID + + //where classification: nothing or "MultiClick" or "DragMethod=DragMethodServiceName" and "DragParameter=DragParameterString" + // or a combination of these seperated with a colon + //where DragMethodServiceName can be a selfdefined servicename for special actions //todo define standard service for this purpose + //where DragParameterString is any string you like to transport information to your special drag service + // only semicolon, colon, equal sign and slash are not allowed characters + // also the keywors used in the ObjectIdentifiers are not allowed + + //where ObjectID: Parent-Particle:Particle //e.g. Series=2:Point=22 + //where Particle: Type=ParticleID //e.g. Point=22 + //where Type: getStringForType( ObjectType eType ) or other string + +public: + ObjectIdentifier(); + ObjectIdentifier( const ::rtl::OUString& rObjectCID ); + ObjectIdentifier( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rxShape ); + ObjectIdentifier( const ::com::sun::star::uno::Any& rAny ); + virtual ~ObjectIdentifier(); + + ObjectIdentifier( const ObjectIdentifier& rOID ); + ObjectIdentifier& operator=( const ObjectIdentifier& rOID ); + bool operator==( const ObjectIdentifier& rOID ) const; + bool operator!=( const ObjectIdentifier& rOID ) const; + bool operator<( const ObjectIdentifier& rOID ) const; + + static rtl::OUString createClassifiedIdentifierForObject( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface >& xObject + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel ); + + static rtl::OUString createClassifiedIdentifierForParticle( + const rtl::OUString& rParticle ); + + static rtl::OUString createClassifiedIdentifierForParticles( + const rtl::OUString& rParentParticle + , const rtl::OUString& rChildParticle + , const rtl::OUString& rDragMethodServiceName = rtl::OUString() + , const rtl::OUString& rDragParameterString = rtl::OUString() ); + + static rtl::OUString createClassifiedIdentifierForGrid( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XAxis >& xAxis + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel + , sal_Int32 nSubIndex = -1 );//-1: main grid, 0: first subgrid etc + + SAL_DLLPRIVATE static rtl::OUString createParticleForDiagram( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel ); + + + static rtl::OUString createParticleForCoordinateSystem( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XCoordinateSystem >& xCooSys + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel ); + + static rtl::OUString createParticleForAxis( + sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ); + + static rtl::OUString createParticleForGrid( + sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ); + + static rtl::OUString createParticleForSeries( sal_Int32 nDiagramIndex, sal_Int32 nCooSysIndex + , sal_Int32 nChartTypeIndex, sal_Int32 nSeriesIndex ); + + static rtl::OUString createParticleForLegend( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XLegend >& xLegend + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel ); + + static rtl::OUString addChildParticle( const rtl::OUString& rParticle, const rtl::OUString& rChildParticle ); + static rtl::OUString createChildParticleWithIndex( ObjectType eObjectType, sal_Int32 nIndex ); + static sal_Int32 getIndexFromParticleOrCID( const rtl::OUString& rParticleOrCID ); + + static rtl::OUString createClassifiedIdentifier( + enum ObjectType eObjectType //e.g. OBJECTTYPE_DATA_SERIES + , const rtl::OUString& rParticleID );//e.g. SeriesID + + static rtl::OUString createClassifiedIdentifierWithParent( + enum ObjectType //e.g. OBJECTTYPE_DATA_POINT or OBJECTTYPE_GRID + , const rtl::OUString& rParticleID //for points or subgrids this is an Index or otherwise an identifier from the model object + , const rtl::OUString& rParentPartical //e.g. "Series=SeriesID" or "Grid=GridId" + , const rtl::OUString& rDragMethodServiceName = rtl::OUString() + , const rtl::OUString& rDragParameterString = rtl::OUString() + ); + + static bool isCID( const rtl::OUString& rName ); + static rtl::OUString getDragMethodServiceName( const rtl::OUString& rClassifiedIdentifier ); + static rtl::OUString getDragParameterString( const rtl::OUString& rCID ); + static bool isDragableObject( const rtl::OUString& rClassifiedIdentifier ); + bool isDragableObject(); + static bool isRotateableObject( const rtl::OUString& rClassifiedIdentifier ); + static bool isMultiClickObject( const rtl::OUString& rClassifiedIdentifier ); + static bool areSiblings( const rtl::OUString& rCID1, const rtl::OUString& rCID2 );//identical object is no sibling + static bool areIdenticalObjects( const ::rtl::OUString& rCID1, const ::rtl::OUString& rCID2 ); + + static rtl::OUString getStringForType( ObjectType eObjectType ); + static ObjectType getObjectType( const rtl::OUString& rCID ); + ObjectType getObjectType(); + + static rtl::OUString createSeriesSubObjectStub( ObjectType eSubObjectType + , const rtl::OUString& rSeriesParticle + , const rtl::OUString& rDragMethodServiceName = rtl::OUString() + , const rtl::OUString& rDragParameterString = rtl::OUString() ); + static rtl::OUString createPointCID( const rtl::OUString& rPointCID_Stub, sal_Int32 nIndex ); + + static rtl::OUString createDataCurveCID( const rtl::OUString& rSeriesParticle, sal_Int32 nCurveIndex, bool bAverageLine ); + static rtl::OUString createDataCurveEquationCID( const rtl::OUString& rSeriesParticle, sal_Int32 nCurveIndex ); + + SAL_DLLPRIVATE static rtl::OUString getObjectID( const rtl::OUString& rCID ); + static rtl::OUString getParticleID( const rtl::OUString& rCID ); + static rtl::OUString getFullParentParticle( const rtl::OUString& rCID ); + + //returns the series particle of a CID when the CID is a child of the series + static rtl::OUString getSeriesParticleFromCID( const rtl::OUString& rCID ); + + //return the model object that is indicated by rObjectCID + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > + getObjectPropertySet( + const rtl::OUString& rObjectCID + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel ); + static ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > + getObjectPropertySet( + const rtl::OUString& rObjectCID + , const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument >& xChartDocument ); + + //return the axis object that belongs to rObjectCID if any + static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > + getAxisForCID( + const rtl::OUString& rObjectCID + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel ); + + //return the series object that belongs to rObjectCID if any + static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > + getDataSeriesForCID( + const rtl::OUString& rObjectCID + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel ); + + static ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > + getDiagramForCID( + const rtl::OUString& rObjectCID + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel ); + + static const ::rtl::OUString& getPieSegmentDragMethodServiceName(); + static ::rtl::OUString createPieSegmentDragParameterString( + sal_Int32 nOffsetPercent + , const ::com::sun::star::awt::Point& rMinimumPosition + , const ::com::sun::star::awt::Point& rMaximumPosition ); + static bool parsePieSegmentDragParameterString( const rtl::OUString& rDragParameterString + , sal_Int32& rOffsetPercent + , ::com::sun::star::awt::Point& rMinimumPosition + , ::com::sun::star::awt::Point& rMaximumPosition ); + + static TitleHelper::eTitleType getTitleTypeForCID( const ::rtl::OUString& rCID ); + + static ::rtl::OUString getMovedSeriesCID( const ::rtl::OUString& rObjectCID, sal_Bool bForward ); + + bool isValid() const; + bool isAutoGeneratedObject() const; + bool isAdditionalShape() const; + ::rtl::OUString getObjectCID() const; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > getAdditionalShape() const; + ::com::sun::star::uno::Any getAny() const; + +private: + // #i12587# support for shapes in chart + // For autogenerated chart objects a CID is specified in m_aObjectCID, + // for all other objects m_xAdditionalShape is set. + // Note, that if m_aObjectCID is set, m_xAdditionalShape must be empty + // and vice versa. + ::rtl::OUString m_aObjectCID; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > m_xAdditionalShape; +}; + +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/PotentialRegressionCurveCalculator.hxx b/chart2/source/inc/PotentialRegressionCurveCalculator.hxx new file mode 100644 index 000000000000..5548cf81be87 --- /dev/null +++ b/chart2/source/inc/PotentialRegressionCurveCalculator.hxx @@ -0,0 +1,76 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_POTENTIALREGRESSIONCURVECALCULATOR_HXX +#define CHART2_POTENTIALREGRESSIONCURVECALCULATOR_HXX + +#include "RegressionCurveCalculator.hxx" +#include "charttoolsdllapi.hxx" + +namespace chart +{ + + +class PotentialRegressionCurveCalculator : + public RegressionCurveCalculator +{ +public: + PotentialRegressionCurveCalculator(); + virtual ~PotentialRegressionCurveCalculator(); + +protected: + virtual ::rtl::OUString ImplGetRepresentation( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xNumFormatter, + ::sal_Int32 nNumberFormatKey ) const; + +private: + // ____ XRegressionCurveCalculator ____ + virtual void SAL_CALL recalculateRegression( + const ::com::sun::star::uno::Sequence< double >& aXValues, + const ::com::sun::star::uno::Sequence< double >& aYValues ) + throw (::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getCurveValue( double x ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > SAL_CALL getCurveValues( + double min, + double max, + ::sal_Int32 nPointCount, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingX, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingY, + ::sal_Bool bMaySkipPointsInCalculation ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + + // formula is: f(x) = x ^ m_fSlope * m_fIntercept + double m_fSlope; + double m_fIntercept; +}; + +} // namespace chart + +// CHART2_POTENTIALREGRESSIONCURVECALCULATOR_HXX +#endif diff --git a/chart2/source/inc/PropertyHelper.hxx b/chart2/source/inc/PropertyHelper.hxx new file mode 100644 index 000000000000..eb4fce0360cc --- /dev/null +++ b/chart2/source/inc/PropertyHelper.hxx @@ -0,0 +1,197 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_PROPERTYHELPER_HXX +#define CHART_PROPERTYHELPER_HXX + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/Property.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <comphelper/property.hxx> +#include <map> +#include "charttoolsdllapi.hxx" + +namespace chart +{ + +typedef int tPropertyValueMapKey; + +typedef ::std::map< tPropertyValueMapKey, ::com::sun::star::uno::Any > + tPropertyValueMap; + +namespace PropertyHelper +{ + +/** adds a line dash with a unique name to the gradient obtained by the given + factory. + + @return The name used for storing this element in the table +*/ +OOO_DLLPUBLIC_CHARTTOOLS ::rtl::OUString addLineDashUniqueNameToTable( + const ::com::sun::star::uno::Any & rValue, + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory > & xFact, + const ::rtl::OUString & rPreferredName ); + +/** adds a gradient with a unique name to the gradient obtained by the given + factory. + + @return The name used for storing this element in the table +*/ +OOO_DLLPUBLIC_CHARTTOOLS ::rtl::OUString addGradientUniqueNameToTable( + const ::com::sun::star::uno::Any & rValue, + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory > & xFact, + const ::rtl::OUString & rPreferredName ); + +/** adds a transparency gradient with a unique name to the gradient obtained + by the given factory. + + @return The name used for storing this element in the table +*/ +OOO_DLLPUBLIC_CHARTTOOLS +::rtl::OUString addTransparencyGradientUniqueNameToTable( + const ::com::sun::star::uno::Any & rValue, + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory > & xFact, + const ::rtl::OUString & rPreferredName ); + +/** adds a hatch with a unique name to the gradient obtained by the given + factory. + + @return The name used for storing this element in the table +*/ +OOO_DLLPUBLIC_CHARTTOOLS ::rtl::OUString addHatchUniqueNameToTable( + const ::com::sun::star::uno::Any & rValue, + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory > & xFact, + const ::rtl::OUString & rPreferredName ); + +/** adds a bitmap with a unique name to the gradient obtained by the given + factory. + + @return The name used for storing this element in the table +*/ +OOO_DLLPUBLIC_CHARTTOOLS ::rtl::OUString addBitmapUniqueNameToTable( + const ::com::sun::star::uno::Any & rValue, + const ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory > & xFact, + const ::rtl::OUString & rPreferredName ); + +// -------------------------------------------------------------------------------- + +/** Set a property to a certain value in the given map. This works for + properties that are already set, and those which are not yet in the map. + + @param any is the value encapsulated in the variant type Any + */ +OOO_DLLPUBLIC_CHARTTOOLS +void setPropertyValueAny( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, + const ::com::sun::star::uno::Any & rAny ); + +/** Set a property to a certain value in the given map. This works for + properties that are already set, and those which are not yet in the map. + + @param value is the value of type Value that will be put into a variant type + Any before set in the property map. + */ +template< typename Value > + void setPropertyValue( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const Value & value ) +{ + setPropertyValueAny( rOutMap, key, ::com::sun::star::uno::makeAny( value )); +} + +template<> + void setPropertyValue< ::com::sun::star::uno::Any >( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const ::com::sun::star::uno::Any & rAny ); + +OOO_DLLPUBLIC_CHARTTOOLS void setPropertyValueDefaultAny( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const ::com::sun::star::uno::Any & rAny ); + +/** Calls setPropertyValue() but asserts that the given property hasn't been set + before. + */ +template< typename Value > + void setPropertyValueDefault( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const Value & value ) +{ + setPropertyValueDefaultAny( rOutMap, key, ::com::sun::star::uno::makeAny( value )); +} + +/** Calls setPropertyValue() but asserts that the given property hasn't been set + before. + */ +template<> + void setPropertyValueDefault< ::com::sun::star::uno::Any >( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const ::com::sun::star::uno::Any & rAny ); + +/** Calls setPropertyValueDefault() with an empty Any as value + */ +OOO_DLLPUBLIC_CHARTTOOLS void setEmptyPropertyValueDefault( tPropertyValueMap & rOutMap, tPropertyValueMapKey key ); + + +} // namespace PropertyHelper + +// ================================================================================ + +struct OOO_DLLPUBLIC_CHARTTOOLS PropertyNameLess +{ + inline bool operator() ( const ::com::sun::star::beans::Property & first, + const ::com::sun::star::beans::Property & second ) + { + return ( first.Name.compareTo( second.Name ) < 0 ); + } +}; + +struct OOO_DLLPUBLIC_CHARTTOOLS PropertyLess : public ::std::binary_function< + ::com::sun::star::beans::Property, + ::com::sun::star::beans::Property, + bool > +{ + bool operator() ( const ::com::sun::star::beans::Property & rFirst, + const ::com::sun::star::beans::Property & rSecond ) + { + return ( rFirst.Name.compareTo( rSecond.Name ) < 0 ); + } +}; + +struct OOO_DLLPUBLIC_CHARTTOOLS PropertyValueNameEquals : public ::std::unary_function< ::com::sun::star::beans::PropertyValue, bool > +{ + explicit PropertyValueNameEquals( const ::rtl::OUString & rName ) : + m_aName( rName ) + {} + + bool operator() ( const ::com::sun::star::beans::PropertyValue & rPropValue ) + { + return rPropValue.Name.equals( m_aName ); + } + +private: + ::rtl::OUString m_aName; +}; + +} // namespace chart + +// CHART_PROPERTYHELPER_HXX +#endif diff --git a/chart2/source/inc/RangeHighlighter.hxx b/chart2/source/inc/RangeHighlighter.hxx new file mode 100644 index 000000000000..48719ec2eeda --- /dev/null +++ b/chart2/source/inc/RangeHighlighter.hxx @@ -0,0 +1,116 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_RANGEHIGHLIGHTER_HXX +#define CHART2_RANGEHIGHLIGHTER_HXX + +#include "MutexContainer.hxx" +#include <cppuhelper/compbase2.hxx> +#include <com/sun/star/chart2/data/XRangeHighlighter.hpp> +#include <com/sun/star/view/XSelectionSupplier.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> + +namespace com { namespace sun { namespace star { +namespace chart2 { + class XDiagram; + class XDataSeries; + class XAxis; +}}}} + +namespace chart +{ + +namespace impl +{ +typedef ::cppu::WeakComponentImplHelper2< + ::com::sun::star::chart2::data::XRangeHighlighter, + ::com::sun::star::view::XSelectionChangeListener + > + RangeHighlighter_Base; +} + +class RangeHighlighter : + public MutexContainer, + public impl::RangeHighlighter_Base +{ +public: + explicit RangeHighlighter( + const ::com::sun::star::uno::Reference< + ::com::sun::star::view::XSelectionSupplier > & xSelectionSupplier ); + virtual ~RangeHighlighter(); + +protected: + // ____ XRangeHighlighter ____ + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::data::HighlightedRange > SAL_CALL getSelectedRanges() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL addSelectionChangeListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeSelectionChangeListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener >& xListener ) + throw (::com::sun::star::uno::RuntimeException); + + // ____ XSelectionChangeListener ____ + virtual void SAL_CALL selectionChanged( + const ::com::sun::star::lang::EventObject& aEvent ) + throw (::com::sun::star::uno::RuntimeException); + + // ____ XEventListener (base of XSelectionChangeListener) ____ + virtual void SAL_CALL disposing( + const ::com::sun::star::lang::EventObject& Source ) + throw (::com::sun::star::uno::RuntimeException); + + // ____ WeakComponentImplHelperBase ____ + // is called when dispose() is called at this component + virtual void SAL_CALL disposing(); + +private: + void fireSelectionEvent(); + void startListening(); + void stopListening(); + void determineRanges(); + + void fillRangesForDiagram( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram > & xDiagram ); + void fillRangesForDataSeries( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > & xSeries ); + void fillRangesForCategories( const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > & xAxis ); + void fillRangesForDataPoint( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > & xDataSeries, sal_Int32 nIndex ); + void fillRangesForErrorBars( const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > & xErrorBar, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries > & xDataSeries ); + + ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionSupplier > + m_xSelectionSupplier; + ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener > + m_xListener; + ::com::sun::star::uno::Sequence< ::com::sun::star::chart2::data::HighlightedRange > + m_aSelectedRanges; + sal_Int32 m_nAddedListenerCount; + bool m_bIncludeHiddenCells; +}; + +} // namespace chart + +// CHART2_RANGEHIGHLIGHTER_HXX +#endif diff --git a/chart2/source/inc/ReferenceSizeProvider.hxx b/chart2/source/inc/ReferenceSizeProvider.hxx new file mode 100644 index 000000000000..35819ba111cb --- /dev/null +++ b/chart2/source/inc/ReferenceSizeProvider.hxx @@ -0,0 +1,145 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_REFERENCESIZEPROVIDER_HXX +#define CHART2_REFERENCESIZEPROVIDER_HXX + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/chart2/XChartDocument.hpp> +#include <com/sun/star/awt/Size.hpp> +#include "charttoolsdllapi.hxx" + +namespace com { namespace sun { namespace star { +namespace chart2 { + class XTitle; + class XTitled; +} +}}} + +// ---------------------------------------- +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS ReferenceSizeProvider +{ +public: + + enum AutoResizeState + { + AUTO_RESIZE_YES, + AUTO_RESIZE_NO, + AUTO_RESIZE_AMBIGUOUS, + AUTO_RESIZE_UNKNOWN + }; + + ReferenceSizeProvider( + ::com::sun::star::awt::Size aPageSize, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument > & xChartDoc ); + + ::com::sun::star::awt::Size getPageSize() const; + + /** Retrieves the state auto-resize from all objects that support this + feature. If all objects return the same state, AUTO_RESIZE_YES or + AUTO_RESIZE_NO is returned. + + If no object supporting the feature is found, AUTO_RESIZE_UNKNOWN is + returned. If there are multiple objects, some with state YES and some + with state NO, AUTO_RESIZE_AMBIGUOUS is returned. + */ + static AutoResizeState getAutoResizeState( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument > & xChartDoc ); + + /** sets or resets the auto-resize at all objects that support this feature + for text to the opposite of the current setting. If the current state + is ambiguous, it is turned on. If the current state is unknown it stays + unknown. + */ + void toggleAutoResizeState(); + + + /** Sets the ReferencePageSize according to the internal settings of this + class at the XPropertySet, and the adapted font sizes if bAdaptFontSizes + is </TRUE>. + */ + SAL_DLLPRIVATE void setValuesAtPropertySet( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > & xProp, + bool bAdaptFontSizes = true ); + + /** Sets the ReferencePageSize according to the internal settings of this + class at the XTitle, and the adapted font sizes at the contained + XFormattedStrings + */ + SAL_DLLPRIVATE void setValuesAtTitle( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XTitle > & xTitle ); + + /** Sets the internal value at all data series in the currently set model. + This is useful, if you have changed a chart-type and thus probably added + some new data series via model functionality. + */ + void setValuesAtAllDataSeries(); + +private: + SAL_DLLPRIVATE bool useAutoScale() const; + + /** sets the auto-resize at all objects that support this feature for text. + eNewState must be either AUTO_RESIZE_YES or AUTO_RESIZE_NO + */ + SAL_DLLPRIVATE void setAutoResizeState( AutoResizeState eNewState ); + + /** Retrieves the auto-resize state from the given propertyset. The result + will be put into eInOutState. If you initialize eInOutState with + AUTO_RESIZE_UNKNOWN, you will get the actual state. If you pass any + other state, the result will be the accumulated state, + esp. AUTO_RESIZE_AMBIGUOUS, if the value was NO before, and is YES for + the current property set, or the other way round. + */ + SAL_DLLPRIVATE static void getAutoResizeFromPropSet( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > & xProp, + AutoResizeState & rInOutState ); + + SAL_DLLPRIVATE void impl_setValuesAtTitled( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XTitled > & xTitled ); + SAL_DLLPRIVATE static void impl_getAutoResizeFromTitled( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XTitled > & xTitled, + AutoResizeState & rInOutState ); + + ::com::sun::star::awt::Size m_aPageSize; + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XChartDocument > m_xChartDoc; + bool m_bUseAutoScale; +}; + +} // namespace chart + +// CHART2_REFERENCESIZEPROVIDER_HXX +#endif diff --git a/chart2/source/inc/RegressionCurveCalculator.hxx b/chart2/source/inc/RegressionCurveCalculator.hxx new file mode 100644 index 000000000000..25fda5080409 --- /dev/null +++ b/chart2/source/inc/RegressionCurveCalculator.hxx @@ -0,0 +1,93 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_REGRESSIONCURVECALCULATOR_HXX +#define CHART2_REGRESSIONCURVECALCULATOR_HXX + +#include <cppuhelper/implbase1.hxx> + +#include <com/sun/star/chart2/XRegressionCurveCalculator.hpp> +#include <com/sun/star/util/XNumberFormatter.hpp> + +namespace chart +{ + +class RegressionCurveCalculator : public + ::cppu::WeakImplHelper1< ::com::sun::star::chart2::XRegressionCurveCalculator > +{ +public: + RegressionCurveCalculator(); + virtual ~RegressionCurveCalculator(); + + static bool isLinearScaling( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > & xScaling ); + static bool isLogarithmicScaling( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling > & xScaling ); + +protected: + virtual ::rtl::OUString ImplGetRepresentation( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xNumFormatter, + ::sal_Int32 nNumberFormatKey ) const = 0; + + ::rtl::OUString getFormattedString( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatter >& xNumFormatter, + ::sal_Int32 nNumberFormatKey, + double fNumber ) const; + + double m_fCorrelationCoeffitient; + + // ____ XRegressionCurveCalculator ____ + virtual void SAL_CALL recalculateRegression( + const ::com::sun::star::uno::Sequence< double >& aXValues, + const ::com::sun::star::uno::Sequence< double >& aYValues ) + throw (::com::sun::star::uno::RuntimeException) = 0; + virtual double SAL_CALL getCurveValue( double x ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException) = 0; + + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::geometry::RealPoint2D > SAL_CALL getCurveValues( + double min, + double max, + ::sal_Int32 nPointCount, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingX, + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XScaling >& xScalingY, + ::sal_Bool bMaySkipPointsInCalculation ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::uno::RuntimeException); + virtual double SAL_CALL getCorrelationCoefficient() + throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getRepresentation() + throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getFormattedRepresentation( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumFmtSupplier, + ::sal_Int32 nNumberFormatKey ) + throw (::com::sun::star::uno::RuntimeException); +}; + +} // namespace chart + +// CHART2_REGRESSIONCURVECALCULATOR_HXX +#endif diff --git a/chart2/source/inc/RegressionCurveHelper.hxx b/chart2/source/inc/RegressionCurveHelper.hxx new file mode 100644 index 000000000000..0a8fd0315bb5 --- /dev/null +++ b/chart2/source/inc/RegressionCurveHelper.hxx @@ -0,0 +1,241 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_REGRESSIONCURVEHELPER_HXX +#define CHART2_REGRESSIONCURVEHELPER_HXX + +#include <com/sun/star/chart2/XRegressionCurve.hpp> +#include <com/sun/star/chart2/XRegressionCurveCalculator.hpp> +#include <com/sun/star/chart2/XRegressionCurveContainer.hpp> +#include <com/sun/star/chart2/data/XDataSource.hpp> +#include <com/sun/star/chart2/XDataSeries.hpp> +#include <com/sun/star/chart2/XDiagram.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include "charttoolsdllapi.hxx" + +#include <vector> + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS RegressionCurveHelper +{ +public: + /// returns a model mean-value line + SAL_DLLPRIVATE static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurve > + createMeanValueLine( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext ); + + /// returns a model regression curve + SAL_DLLPRIVATE static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurve > + createRegressionCurveByServiceName( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext, + ::rtl::OUString aServiceName ); + + // ------------------------------------------------------------ + + static bool hasMeanValueLine( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt ); + + static bool isMeanValueLine( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurve > & xRegCurve ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurve > + getMeanValueLine( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt ); + + /** creates a mean-value line and adds it to the container. + + @param xSeriesProp + If set, this property-set will be used to apply a line color + */ + static void addMeanValueLine( + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt, + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > & xSeriesProp ); + + static void removeMeanValueLine( + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt ); + + enum tRegressionType + { + REGRESSION_TYPE_NONE, + REGRESSION_TYPE_LINEAR, + REGRESSION_TYPE_LOG, + REGRESSION_TYPE_EXP, + REGRESSION_TYPE_POWER, + REGRESSION_TYPE_MEAN_VALUE, + REGRESSION_TYPE_UNKNOWN + }; + + /** Returns the first regression curve found that is not of type + mean-value line + */ + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurve > + getFirstCurveNotMeanValueLine( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt ); + + /** Returns the type of the first regression curve found that is not of type + mean-value line + */ + static tRegressionType getFirstRegressTypeNotMeanValueLine( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt ); + + static tRegressionType getRegressionType( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurve > & xCurve ); + + /** @param xPropertySource is taken as source to copy all properties from if + not null + @param xEquationProperties is set at the new regression curve as + equation properties if not null + */ + static void addRegressionCurve( tRegressionType eType, + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt, + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext, + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xPropertySource = + ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >(), + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xEquationProperties = + ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >() + ); + + static bool removeAllExceptMeanValueLine( + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt ); + + static void removeEquations( + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt ); + + /** adds the given regression curve if there was none before. If there are + regression curves, the first one is replaced by the one given by the + type. All remaining curves are remnoved. + + <p>This fuction ignores mean-value lines.</p> + */ + static void replaceOrAddCurveAndReduceToOne( + tRegressionType eType, + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurveContainer > & xRegCnt, + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext ); + + // ------------------------------------------------------------ + + /// returns a calculator object for regression curves (used by the view) + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurveCalculator > + createRegressionCurveCalculatorByServiceName( + ::rtl::OUString aServiceName ); + + /** recalculates the regression parameters according to the data given in + the data source. + + A sequence having the role "values-x" will be used as x-values for the + calculation if found. Otherwise a sequence (1, 2, 3, ...) of category + indexes will be used for the recalculateRegression() method of the + regression curve. + + The first sequence having the role "values-y" will be used as y-values + for the recalculateRegression() method of the regression curve. + + @param bUseXValuesIfAvailable + If false, the sequence (1, 2, 3, ...) will always be used, even if + there is a data-sequence with role "values-x" + */ + SAL_DLLPRIVATE static void initializeCurveCalculator( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurveCalculator > & xOutCurveCalculator, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSource > & xSource, + bool bUseXValuesIfAvailable = true ); + + /** Same method as above, but uses the given XModel to determine the + parameter bUseXValuesIfAvailable in the above function. It is also + necessary that the data::XDataSource is an XDataSeries, thus this parameter + also changed. + */ + static void initializeCurveCalculator( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurveCalculator > & xOutCurveCalculator, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > & xSeries, + const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > & xModel ); + + static ::rtl::OUString getUINameForRegressionCurve( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurve >& xCurve ); + + static ::std::vector< ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurve > > getAllRegressionCurvesNotMeanValueLine( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram > & xDiagram ); + + static void resetEquationPosition( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurve > & xCurve ); + + /// @return the index of the given curve in the given container. -1 if not contained + static sal_Int32 getRegressionCurveIndex( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurveContainer > & xContainer, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurve > & xCurve ); + + static bool hasEquation( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XRegressionCurve > & xCurve ); + +private: + // not implemented + RegressionCurveHelper(); +}; + +} // namespace chart + +// CHART2_REGRESSIONCURVEHELPER_HXX +#endif diff --git a/chart2/source/inc/RelativePositionHelper.hxx b/chart2/source/inc/RelativePositionHelper.hxx new file mode 100644 index 000000000000..1dd0617236ad --- /dev/null +++ b/chart2/source/inc/RelativePositionHelper.hxx @@ -0,0 +1,120 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_RELATIVEPOSITIONHELPER_HXX +#define _CHART2_RELATIVEPOSITIONHELPER_HXX + +#include <com/sun/star/chart2/RelativePosition.hpp> +#include <com/sun/star/chart2/RelativeSize.hpp> +#include <com/sun/star/drawing/Alignment.hpp> +#include <com/sun/star/awt/Point.hpp> +#include <com/sun/star/awt/Size.hpp> +#include "charttoolsdllapi.hxx" + +//............................................................................. +namespace chart +{ +//............................................................................. + +//----------------------------------------------------------------------------- +/** +*/ + +class OOO_DLLPUBLIC_CHARTTOOLS RelativePositionHelper +{ +public: + /** returns the upper left corner of an object that has size aObjectSize and + where the point indicated by aAnchor has coordinates indicated by aPoint + ( e.g. if aAnchor equals BOTTOM_LEFT, aPoint describes the + coordinates of the bottom left corner of an object with size aObjectSize ) + */ + static ::com::sun::star::awt::Point + getUpperLeftCornerOfAnchoredObject( + ::com::sun::star::awt::Point aPoint, + ::com::sun::star::awt::Size aObjectSize, + ::com::sun::star::drawing::Alignment aAnchor ); + + /** returns the center of an object that has size aObjectSize and + where the point indicated by aAnchor has coordinates indicated by aPoint + ( e.g. if aAnchor equals BOTTOM_LEFT, aPoint describes the + coordinates of the bottom left corner of an object with size aObjectSize ) + */ + static ::com::sun::star::awt::Point + getCenterOfAnchoredObject( + ::com::sun::star::awt::Point aPoint, + ::com::sun::star::awt::Size aUnrotatedObjectSize, + ::com::sun::star::drawing::Alignment aAnchor, + double fAnglePi ); + + /** Returns a relative position that is the same point after the anchor has + been changed to the given one. The passed object size is taken into + account for shifting the position. + */ + SAL_DLLPRIVATE static ::com::sun::star::chart2::RelativePosition + getReanchoredPosition( + const ::com::sun::star::chart2::RelativePosition & rPosition, + const ::com::sun::star::chart2::RelativeSize & rObjectSize, + ::com::sun::star::drawing::Alignment aNewAnchor ); + + /** grows a relative size about the given amount and shifts the given + position such that the resize is relative to the former rectangle's + center. + + @param bCheck If </TRUE>, the resize is only done, if after + transformation, the position and size are within the bounds [0,1]. + + @return </TRUE>, if changes were applied. + + <p>That means, if the position's alignment is center, the position will + not change at all.</p> + */ + static bool centerGrow( + ::com::sun::star::chart2::RelativePosition & rInOutPosition, + ::com::sun::star::chart2::RelativeSize & rInOutSize, + double fAmountX, double fAmountY, + bool bCheck = true ); + + /** shifts a relative position about the given amount + + @param bCheck If </TRUE>, the shift is only done, if after + transformation, the object represented by the position + rInOutPosition and its size rObjectSize the position and size are + within the bounds [0,1]. + + @return </TRUE>, if changes were applied. + */ + static bool moveObject( + ::com::sun::star::chart2::RelativePosition & rInOutPosition, + const ::com::sun::star::chart2::RelativeSize & rObjectSize, + double fAmountX, double fAmountY, + bool bCheck = true ); +}; + +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/RelativeSizeHelper.hxx b/chart2/source/inc/RelativeSizeHelper.hxx new file mode 100644 index 000000000000..a5585d9901bc --- /dev/null +++ b/chart2/source/inc/RelativeSizeHelper.hxx @@ -0,0 +1,59 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_RELATIVESIZEHELPER_HXX +#define CHART2_RELATIVESIZEHELPER_HXX + +#include <com/sun/star/awt/Size.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include "charttoolsdllapi.hxx" + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS RelativeSizeHelper +{ +public: + static double calculate( + double fValue, + const ::com::sun::star::awt::Size & rOldReferenceSize, + const ::com::sun::star::awt::Size & rNewReferenceSize ); + + static void adaptFontSizes( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > & xTargetProperties, + const ::com::sun::star::awt::Size & rOldReferenceSize, + const ::com::sun::star::awt::Size & rNewReferenceSize ); + +private: + // not implemented + RelativeSizeHelper(); +}; + +} // namespace chart + +// CHART2_RELATIVESIZEHELPER_HXX +#endif diff --git a/chart2/source/inc/ResId.hxx b/chart2/source/inc/ResId.hxx new file mode 100644 index 000000000000..551f5f0da40d --- /dev/null +++ b/chart2/source/inc/ResId.hxx @@ -0,0 +1,48 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_RESID_HXX +#define CHART2_RESID_HXX + +#include <tools/resid.hxx> +#include <rtl/ustring.hxx> +#include "charttoolsdllapi.hxx" + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS SchResId : public ResId +{ +public: + SchResId( sal_Int16 nId ); + + static ::rtl::OUString getResString( sal_Int16 nId ); +}; + +} // namespace chart + +// CHART2_RESID_HXX +#endif diff --git a/chart2/source/inc/RessourceManager.hxx b/chart2/source/inc/RessourceManager.hxx new file mode 100644 index 000000000000..9204fa106580 --- /dev/null +++ b/chart2/source/inc/RessourceManager.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_RESSOURCEMANAGER_HXX +#define CHART2_RESSOURCEMANAGER_HXX + +#include "charttoolsdllapi.hxx" + +// defined in <tools/resmgr.hxx> +class ResMgr; + +namespace chart +{ + +class RessourceManager +{ +public: + static ::ResMgr & getRessourceManager(); + +private: + // not implemented -- avoid instantiation + RessourceManager(); + + static ::ResMgr * m_pRessourceManager; +}; + +} // namespace chart + +// CHART2_RESSOURCEMANAGER_HXX +#endif diff --git a/chart2/source/inc/Scaling.hxx b/chart2/source/inc/Scaling.hxx new file mode 100644 index 000000000000..29fd8e2fb2e0 --- /dev/null +++ b/chart2/source/inc/Scaling.hxx @@ -0,0 +1,210 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SCALING_HXX +#define _CHART2_SCALING_HXX +#include "ServiceMacros.hxx" +#include <com/sun/star/chart2/XScaling.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XServiceName.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <cppuhelper/implbase3.hxx> + +//............................................................................. +namespace chart +{ +//............................................................................. + +//----------------------------------------------------------------------------- +/** +*/ + +class LogarithmicScaling : + public ::cppu::WeakImplHelper3 < + ::com::sun::star::chart2::XScaling, + ::com::sun::star::lang::XServiceName, + ::com::sun::star::lang::XServiceInfo + > +{ +public: + /// base is 10.0 + explicit LogarithmicScaling( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext ); + LogarithmicScaling( double fBase = 10.0 ); + virtual ~LogarithmicScaling(); + + /// establish methods for factory instatiation + APPHELPER_SERVICE_FACTORY_HELPER( LogarithmicScaling ) + /// declare XServiceInfo methods + APPHELPER_XSERVICEINFO_DECL() + + // ____ XScaling ____ + virtual double SAL_CALL doScaling( double value ) + throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XScaling > SAL_CALL + getInverseScaling() throw (::com::sun::star::uno::RuntimeException); + + // ____ XServiceName ____ + virtual ::rtl::OUString SAL_CALL getServiceName() + throw (::com::sun::star::uno::RuntimeException); + +private: + const double m_fBase; + const double m_fLogOfBase; + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; +}; + +// ---------------------------------------- + +class ExponentialScaling : + public ::cppu::WeakImplHelper3 < + ::com::sun::star::chart2::XScaling, + ::com::sun::star::lang::XServiceName, + ::com::sun::star::lang::XServiceInfo + > +{ +public: + /// base is 10.0 + explicit ExponentialScaling( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext ); + explicit ExponentialScaling( double fBase = 10.0 ); + virtual ~ExponentialScaling(); + + /// establish methods for factory instatiation + APPHELPER_SERVICE_FACTORY_HELPER( ExponentialScaling ) + /// declare XServiceInfo methods + APPHELPER_XSERVICEINFO_DECL() + + // ____ XScaling ____ + virtual double SAL_CALL + doScaling( double value ) + throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XScaling > SAL_CALL + getInverseScaling() throw (::com::sun::star::uno::RuntimeException); + + // ____ XServiceName ____ + virtual ::rtl::OUString SAL_CALL getServiceName() + throw (::com::sun::star::uno::RuntimeException); + +private: + const double m_fBase; + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; +}; + +// ---------------------------------------- + +class LinearScaling : public ::cppu::WeakImplHelper3 < + ::com::sun::star::chart2::XScaling, + ::com::sun::star::lang::XServiceName, + ::com::sun::star::lang::XServiceInfo + > +{ +public: + /// y(x) = x + explicit LinearScaling( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext ); + /// y(x) = fSlope * x + fOffset + LinearScaling( double fSlope = 1.0, double fOffset = 0.0 ); + virtual ~LinearScaling(); + + /// establish methods for factory instatiation + APPHELPER_SERVICE_FACTORY_HELPER( LinearScaling ) + /// declare XServiceInfo methods + APPHELPER_XSERVICEINFO_DECL() + + // ____ XScaling ____ + virtual double SAL_CALL doScaling( double value ) + throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XScaling > SAL_CALL + getInverseScaling() throw (::com::sun::star::uno::RuntimeException); + + // ____ XServiceName ____ + virtual ::rtl::OUString SAL_CALL getServiceName() + throw (::com::sun::star::uno::RuntimeException); + +private: + const double m_fSlope; + const double m_fOffset; + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; +}; + +// ---------------------------------------- + +class PowerScaling : public ::cppu::WeakImplHelper3 < + ::com::sun::star::chart2::XScaling, + ::com::sun::star::lang::XServiceName, + ::com::sun::star::lang::XServiceInfo + > +{ +public: + /// exponent 10.0 + explicit PowerScaling( + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext ); + explicit PowerScaling( double fExponent = 10.0 ); + virtual ~PowerScaling(); + + /// establish methods for factory instatiation + APPHELPER_SERVICE_FACTORY_HELPER( PowerScaling ) + /// declare XServiceInfo methods + APPHELPER_XSERVICEINFO_DECL() + + // ____ XScaling ____ + virtual double SAL_CALL + doScaling( double value ) + throw (::com::sun::star::uno::RuntimeException); + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XScaling > SAL_CALL + getInverseScaling() throw (::com::sun::star::uno::RuntimeException); + + // ____ XServiceName ____ + virtual ::rtl::OUString SAL_CALL getServiceName() + throw (::com::sun::star::uno::RuntimeException); + +private: + const double m_fExponent; + + ::com::sun::star::uno::Reference< ::com::sun::star::uno::XComponentContext > m_xContext; +}; + +//............................................................................. +} //namespace chart +//............................................................................. +#endif + diff --git a/chart2/source/inc/SceneProperties.hxx b/chart2/source/inc/SceneProperties.hxx new file mode 100644 index 000000000000..bceef6712106 --- /dev/null +++ b/chart2/source/inc/SceneProperties.hxx @@ -0,0 +1,96 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SCENEPROPERTIES_HXX +#define CHART_SCENEPROPERTIES_HXX + +#include "PropertyHelper.hxx" +#include "FastPropertyIdRanges.hxx" +#include "charttoolsdllapi.hxx" +#include <com/sun/star/beans/Property.hpp> + +#include <vector> + +namespace chart +{ + +// implements service SceneProperties +class OOO_DLLPUBLIC_CHARTTOOLS SceneProperties +{ +public: + // FastProperty Ids for properties + enum + { + // "com.sun.star.drawing.SceneProperties" (does not exist) + PROP_SCENE_TRANSF_MATRIX = FAST_PROPERTY_ID_START_SCENE_PROP, + PROP_SCENE_DISTANCE, + PROP_SCENE_FOCAL_LENGTH, + PROP_SCENE_SHADOW_SLANT, + PROP_SCENE_SHADE_MODE, + PROP_SCENE_AMBIENT_COLOR, + PROP_SCENE_TWO_SIDED_LIGHTING, + PROP_SCENE_CAMERA_GEOMETRY, + PROP_SCENE_PERSPECTIVE, + PROP_SCENE_LIGHT_COLOR_1, + PROP_SCENE_LIGHT_DIRECTION_1, + PROP_SCENE_LIGHT_ON_1, + PROP_SCENE_LIGHT_COLOR_2, + PROP_SCENE_LIGHT_DIRECTION_2, + PROP_SCENE_LIGHT_ON_2, + PROP_SCENE_LIGHT_COLOR_3, + PROP_SCENE_LIGHT_DIRECTION_3, + PROP_SCENE_LIGHT_ON_3, + PROP_SCENE_LIGHT_COLOR_4, + PROP_SCENE_LIGHT_DIRECTION_4, + PROP_SCENE_LIGHT_ON_4, + PROP_SCENE_LIGHT_COLOR_5, + PROP_SCENE_LIGHT_DIRECTION_5, + PROP_SCENE_LIGHT_ON_5, + PROP_SCENE_LIGHT_COLOR_6, + PROP_SCENE_LIGHT_DIRECTION_6, + PROP_SCENE_LIGHT_ON_6, + PROP_SCENE_LIGHT_COLOR_7, + PROP_SCENE_LIGHT_DIRECTION_7, + PROP_SCENE_LIGHT_ON_7, + PROP_SCENE_LIGHT_COLOR_8, + PROP_SCENE_LIGHT_DIRECTION_8, + PROP_SCENE_LIGHT_ON_8 + }; + + static void AddPropertiesToVector( + ::std::vector< ::com::sun::star::beans::Property > & rOutProperties ); + + static void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ); + +private: + // not implemented + SceneProperties(); +}; + +} // namespace chart + +// CHART_FILLPROPERTIES_HXX +#endif diff --git a/chart2/source/inc/ServiceMacros.hxx b/chart2/source/inc/ServiceMacros.hxx new file mode 100644 index 000000000000..03913fa22842 --- /dev/null +++ b/chart2/source/inc/ServiceMacros.hxx @@ -0,0 +1,146 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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 _APPHELPER_SERVICEMACROS_HXX +#define _APPHELPER_SERVICEMACROS_HXX + +/* +to use these macros the supported services and the implementation name needs to be static +especially you need to implement (declaration is contained in macro already): + +static com::sun::star::uno::Sequence< rtl::OUString > + Class::getSupportedServiceNames_Static(); +*/ + +//========================================================================= +// +// XServiceInfo decl +// +//========================================================================= +namespace apphelper +{ + +#define APPHELPER_XSERVICEINFO_DECL() \ + virtual ::rtl::OUString SAL_CALL \ + getImplementationName() \ + throw( ::com::sun::star::uno::RuntimeException ); \ + virtual sal_Bool SAL_CALL \ + supportsService( const ::rtl::OUString& ServiceName ) \ + throw( ::com::sun::star::uno::RuntimeException ); \ + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL \ + getSupportedServiceNames() \ + throw( ::com::sun::star::uno::RuntimeException ); \ + \ + static ::rtl::OUString getImplementationName_Static(); \ + static ::com::sun::star::uno::Sequence< ::rtl::OUString > \ + getSupportedServiceNames_Static(); + +//========================================================================= +// +// XServiceInfo impl +// +//========================================================================= + +#define APPHELPER_XSERVICEINFO_IMPL( Class, ImplName ) \ +::rtl::OUString SAL_CALL Class::getImplementationName() \ + throw( ::com::sun::star::uno::RuntimeException ) \ +{ \ + return getImplementationName_Static(); \ +} \ + \ +::rtl::OUString Class::getImplementationName_Static() \ +{ \ + return ImplName; \ +} \ + \ +sal_Bool SAL_CALL \ +Class::supportsService( const ::rtl::OUString& ServiceName ) \ + throw( ::com::sun::star::uno::RuntimeException ) \ +{ \ + ::com::sun::star::uno::Sequence< ::rtl::OUString > aSNL = \ + getSupportedServiceNames(); \ + const ::rtl::OUString* pArray = aSNL.getArray(); \ + for( sal_Int32 i = 0; i < aSNL.getLength(); i++ ) \ + { \ + if( pArray[ i ] == ServiceName ) \ + return sal_True; \ + } \ + \ + return sal_False; \ +} \ + \ +::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL \ +Class::getSupportedServiceNames() \ + throw( ::com::sun::star::uno::RuntimeException ) \ +{ \ + return getSupportedServiceNames_Static(); \ +} + +//========================================================================= +// +// Service factory helper decl+impl +// +//to use this macro you need to provide a constructor: +//class( Reference< XComponentContext > const & xContext ) +//and implement OWeakObject +//========================================================================= + +#define APPHELPER_SERVICE_FACTORY_HELPER(Class) \ +static ::com::sun::star::uno::Reference< \ + ::com::sun::star::uno::XInterface > SAL_CALL \ + create( ::com::sun::star::uno::Reference< \ + ::com::sun::star::uno::XComponentContext > const & xContext) \ + throw(::com::sun::star::uno::Exception) \ +{ \ + return (::cppu::OWeakObject *)new Class( xContext ); \ +} + +/** This macro contains the default implementation for getImplementationId(). + Note, that you have to include the header necessary for rtl_createUuid. + Insert the following into your file: + + <code> +#include <rtl/uuid.h> + </code> + + @param Class the Class-Name for which getImplementationId() should be + implemented + */ +#define APPHELPER_GETIMPLEMENTATIONID_IMPL(Class) \ +::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL Class::getImplementationId() \ + throw (::com::sun::star::uno::RuntimeException) \ +{ \ + static ::com::sun::star::uno::Sequence< sal_Int8 > aId; \ + if( aId.getLength() == 0 ) \ + { \ + aId.realloc( 16 ); \ + rtl_createUuid( (sal_uInt8 *)aId.getArray(), 0, sal_True ); \ + } \ + return aId; \ +} + +}//end namespace apphelper +#endif diff --git a/chart2/source/inc/StackMode.hxx b/chart2/source/inc/StackMode.hxx new file mode 100644 index 000000000000..e341205522d4 --- /dev/null +++ b/chart2/source/inc/StackMode.hxx @@ -0,0 +1,47 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_STACKMODE_HXX +#define CHART2_STACKMODE_HXX + +namespace chart +{ + +// needed for chart type templates + +enum StackMode +{ + StackMode_NONE = 0, + StackMode_Y_STACKED, + StackMode_Y_STACKED_PERCENT, + StackMode_Z_STACKED, + StackMode_AMBIGUOUS +}; + +} // namespace chart + +// CHART2_STACKMODE_HXX +#endif diff --git a/chart2/source/inc/StatisticsHelper.hxx b/chart2/source/inc/StatisticsHelper.hxx new file mode 100644 index 000000000000..af05d5f3f0e8 --- /dev/null +++ b/chart2/source/inc/StatisticsHelper.hxx @@ -0,0 +1,133 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_STATISTICSHELPER_HXX +#define CHART2_STATISTICSHELPER_HXX + +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/chart2/data/XDataSource.hpp> +#include <com/sun/star/chart2/data/XDataProvider.hpp> +#include <com/sun/star/chart2/XDataSeries.hpp> +#include "charttoolsdllapi.hxx" + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS StatisticsHelper +{ +public: + /** Calculates 1/n * sum (x_i - x_mean)^2. + + @see http://mathworld.wolfram.com/Variance.html + + @param bUnbiasedEstimator + If true, 1/(n-1) * sum (x_i - x_mean)^2 is returned. + */ + static double getVariance( const ::com::sun::star::uno::Sequence< double > & rData, + bool bUnbiasedEstimator = false ); + + // square root of the variance + static double getStandardDeviation( const ::com::sun::star::uno::Sequence< double > & rData ); + + // also called "Standard deviation of the mean (SDOM)" + static double getStandardError( const ::com::sun::star::uno::Sequence< double > & rData ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XLabeledDataSequence > + getErrorLabeledDataSequenceFromDataSource( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSource > & xDataSource, + bool bPositiveValue, + bool bYError = true ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSequence > + getErrorDataSequenceFromDataSource( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSource > & xDataSource, + bool bPositiveValue, + bool bYError = true ); + + static double getErrorFromDataSource( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSource > & xDataSource, + sal_Int32 nIndex, + bool bPositiveValue, + bool bYError = true ); + + static void setErrorDataSequence( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataSource > & xDataSource, + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::data::XDataProvider > & xDataProvider, + const ::rtl::OUString & rNewRange, + bool bPositiveValue, + bool bYError = true, + ::rtl::OUString * pXMLRange = 0 ); + + /// @return the newly created or existing error bar object + static ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > + addErrorBars( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > & xDataSeries, + const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext, + sal_Int32 nStyle, + bool bYError = true ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > + getErrorBars( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > & xDataSeries, + bool bYError = true ); + + static bool hasErrorBars( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > & xDataSeries, + bool bYError = true ); + + static void removeErrorBars( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > & xDataSeries, + bool bYError = true ); + + static bool usesErrorBarRanges( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDataSeries > & xDataSeries, + bool bYError = true ); + +private: + // not implemented + StatisticsHelper(); +}; + +} // namespace chart + +// CHART2_STATISTICSHELPER_HXX +#endif diff --git a/chart2/source/inc/Strings.hrc b/chart2/source/inc/Strings.hrc new file mode 100644 index 000000000000..47ed75e80a9a --- /dev/null +++ b/chart2/source/inc/Strings.hrc @@ -0,0 +1,409 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_STRINGS_HRC +#define CHART_STRINGS_HRC + +// this includes no link dependency +#include <svl/solar.hrc> + +//next free is 291 +//single free is: 134 + +//#define RID_APP_START 30000 +////#define STR_NULL (RID_APP_START + 1) +////#define STR_BASIC_IDE (RID_APP_START + 2) +//#define STR_LINES (RID_APP_START + 3) +//#define STR_COLUMNS (RID_APP_START + 4) +//#define STR_BARS (RID_APP_START + 5) +//#define STR_AREAS (RID_APP_START + 6) +//#define STR_CIRCLES (RID_APP_START + 7) +//#define STR_DONUT2 (RID_APP_START + 9) +//#define STR_OFS (RID_APP_START + 14) +//#define STR_XY (RID_APP_START + 16) +//#define STR_XYZ (RID_APP_START + 17) +//#define STR_ONLY_SYMBOLS (RID_APP_START + 115) +//#define STR_LINESYMB (RID_APP_START + 15) +//#define STR_LINE_SYMBOLS (RID_APP_START + 117) +//#define STR_SYMBOL (RID_APP_START + 53) +//#define STR_SYMBOL_STACK (RID_APP_START + 54) +//#define STR_SYMBOL_PERCENT (RID_APP_START + 55) +//#define STR_SPLINE_CUBIC (RID_APP_START + 56) +//#define STR_SPLINE_CUBIC_SYMBOL (RID_APP_START + 57) +//#define STR_SPLINE_B (RID_APP_START + 58) +//#define STR_SPLINE_B_SYMBOL (RID_APP_START + 59) +//#define STR_STOCKCHART (RID_APP_START + 142) +//#define STR_SAEULE_3D_1 (RID_APP_START + 149) +//#define STR_SAEULE_3D_2 (RID_APP_START + 150) +//#define STR_SAEULE_3D_3 (RID_APP_START + 151) +//#define STR_SAEULE_3D_4 (RID_APP_START + 152) +//#define STR_ROEHRE_3D_1 (RID_APP_START + 153) +//#define STR_ROEHRE_3D_2 (RID_APP_START + 154) +//#define STR_ROEHRE_3D_3 (RID_APP_START + 155) +//#define STR_ROEHRE_3D_4 (RID_APP_START + 156) +//#define STR_PYRAMID_3D_1 (RID_APP_START + 157) +//#define STR_PYRAMID_3D_2 (RID_APP_START + 158) +//#define STR_PYRAMID_3D_3 (RID_APP_START + 159) +//#define STR_PYRAMID_3D_4 (RID_APP_START + 160) +//#define STR_PYRAMIDQ_3D_1 (RID_APP_START + 161) +//#define STR_PYRAMIDQ_3D_2 (RID_APP_START + 162) +//#define STR_PYRAMIDQ_3D_3 (RID_APP_START + 163) +//#define STR_PYRAMIDQ_3D_4 (RID_APP_START + 164) +//#define STR_KEGEL_3D_1 (RID_APP_START + 165) +//#define STR_KEGEL_3D_2 (RID_APP_START + 166) +//#define STR_KEGEL_3D_3 (RID_APP_START + 167) +//#define STR_KEGEL_3D_4 (RID_APP_START + 168) +//#define STR_KEGELQ_3D_1 (RID_APP_START + 169) +//#define STR_KEGELQ_3D_2 (RID_APP_START + 170) +//#define STR_KEGELQ_3D_3 (RID_APP_START + 171) +//#define STR_KEGELQ_3D_4 (RID_APP_START + 172) +////#define STR_NORMAL_LINES (RID_APP_START + 18) +////#define STR_SURFACE (RID_APP_START + 19) +// #define STR_STEPMAIN_LT_MAXVALUE (RID_APP_START + 103) +// #define STR_STEPHELP_LT_STEPMAIN (RID_APP_START + 104) +// #define STR_WRONG_ORIGIN (RID_APP_START + 112) +////#define STR_AREA (RID_APP_START + 122) +////#define STR_LINE (RID_APP_START + 123) +////#define STR_OBJECT_SOURCE_DATA (RID_APP_START + 129) + +//----------------------------------------------------------------------------- +//chart types +//see Strings_ChartTypes.src + +#define STR_NORMAL (RID_APP_START + 10) +#define STR_STACKED (RID_APP_START + 11) +#define STR_PERCENT (RID_APP_START + 12) +#define STR_DEEP (RID_APP_START + 13) +#define STR_FILLED (RID_APP_START + 285) + +#define STR_DONUT (RID_APP_START + 8) +#define STR_TYPE_PIE (RID_APP_START + 187) +#define STR_PIE_EXPLODED (RID_APP_START + 188) +#define STR_DONUT_EXPLODED (RID_APP_START + 189) + +#define STR_TYPE_COLUMN (RID_APP_START + 190) +#define STR_TYPE_BAR (RID_APP_START + 191) +#define STR_TYPE_AREA (RID_APP_START + 192) + +#define STR_LINES_3D (RID_APP_START + 193) +#define STR_POINTS_ONLY (RID_APP_START + 194) +#define STR_LINES_ONLY (RID_APP_START + 116) +#define STR_POINTS_AND_LINES (RID_APP_START + 124) +#define STR_TYPE_LINE (RID_APP_START + 125) +#define STR_TYPE_XY (RID_APP_START + 240) + +#define STR_LINE_COLUMN (RID_APP_START + 22) +#define STR_LINE_STACKEDCOLUMN (RID_APP_START + 23) +#define STR_TYPE_COMBI_COLUMN_LINE (RID_APP_START + 24) + +#define STR_TYPE_NET (RID_APP_START + 52) + +#define STR_TYPE_STOCK (RID_APP_START + 126) +#define STR_STOCK_1 (RID_APP_START + 143) +#define STR_STOCK_2 (RID_APP_START + 144) +#define STR_STOCK_3 (RID_APP_START + 145) +#define STR_STOCK_4 (RID_APP_START + 146) + +#define STR_TYPE_BUBBLE (RID_APP_START + 282) +#define STR_BUBBLE_1 (RID_APP_START + 283) + +//----------------------------------------------------------------------------- +//additional controls for wizard: + +#define STR_BAR_GEOMETRY (RID_APP_START + 127) +#define STR_NUMBER_OF_LINES (RID_APP_START + 128) +#define STR_TIP_SELECT_RANGE (RID_APP_START + 196) + +#define STR_3DSCHEME_SIMPLE (RID_APP_START + 231) +#define STR_3DSCHEME_REALISTIC (RID_APP_START + 232) +#define STR_3DSCHEME_CUSTOM (RID_APP_START + 259) + +//additional strings +#define STR_TEXT_SEPARATOR (RID_APP_START + 20) + +//----------------------------------------------------------------------------- +//SchStatisticTabPage and SchDataStatisticsDlg +//see Strings_Statistic.src + +#define STR_INDICATE_BOTH (RID_APP_START + 131) +#define STR_INDICATE_UP (RID_APP_START + 132) +#define STR_INDICATE_DOWN (RID_APP_START + 133) + +#define STR_REGRESSION_LINEAR (RID_APP_START + 135) +#define STR_REGRESSION_LOG (RID_APP_START + 136) +#define STR_REGRESSION_EXP (RID_APP_START + 137) +#define STR_REGRESSION_POWER (RID_APP_START + 138) + +//----------------------------------------------------------------------------- +//for scale tab page +//see Strings_Scale.src + +#define STR_INVALID_NUMBER (RID_APP_START + 100) +#define STR_STEP_GT_ZERO (RID_APP_START + 102) +#define STR_BAD_LOGARITHM (RID_APP_START + 111) +#define STR_MIN_GREATER_MAX (RID_APP_START + 101) + +//----------------------------------------------------------------------------- +//for range didalog +#define STR_DATA_ROLE_LABEL (RID_APP_START + 241) +#define STR_DATA_ROLE_X (RID_APP_START + 242) +#define STR_DATA_ROLE_Y (RID_APP_START + 243) +#define STR_DATA_ROLE_X_ERROR (RID_APP_START + 244) +#define STR_DATA_ROLE_X_ERROR_POSITIVE (RID_APP_START + 272) +#define STR_DATA_ROLE_X_ERROR_NEGATIVE (RID_APP_START + 273) +#define STR_DATA_ROLE_Y_ERROR (RID_APP_START + 245) +#define STR_DATA_ROLE_Y_ERROR_POSITIVE (RID_APP_START + 274) +#define STR_DATA_ROLE_Y_ERROR_NEGATIVE (RID_APP_START + 275) +#define STR_DATA_ROLE_FIRST (RID_APP_START + 246) +#define STR_DATA_ROLE_LAST (RID_APP_START + 247) +#define STR_DATA_ROLE_MIN (RID_APP_START + 248) +#define STR_DATA_ROLE_MAX (RID_APP_START + 249) +#define STR_DATA_ROLE_CATEGORIES (RID_APP_START + 260) +#define STR_DATA_ROLE_SIZE (RID_APP_START + 284) + +#define STR_DATA_UNNAMED_SERIES (RID_APP_START + 250) +#define STR_DATA_UNNAMED_SERIES_WITH_INDEX (RID_APP_START + 251) + +#define STR_DATA_SELECT_RANGE_FOR_SERIES (RID_APP_START + 252) +#define STR_DATA_SELECT_RANGE_FOR_CATEGORIES (RID_APP_START + 253) +#define STR_DATA_SELECT_RANGE_FOR_DATALABELS (RID_APP_START + 195) +#define STR_DATA_SELECT_RANGE_FOR_POSITIVE_ERRORBARS (RID_APP_START + 21) +#define STR_DATA_SELECT_RANGE_FOR_NEGATIVE_ERRORBARS (RID_APP_START + 267) + +//----------------------------------------------------------------------------- +//chart objects +//e.g. used as titles for insert dialogs and object properties dialog +//also used in tip help, in status descriptions e.g. '%object% marked' or in undo action e.g. 'moved %object%' + +#define STR_PAGE_CHARTTYPE (RID_APP_START + 197) +#define STR_PAGE_DATA_RANGE (RID_APP_START + 238) +#define STR_ACTION_EDIT_CHART_DATA (RID_APP_START + 198) + +#define STR_OBJECT_PAGE (RID_APP_START + 30) +#define STR_OBJECT_DIAGRAM (RID_APP_START + 31) +#define STR_OBJECT_DIAGRAM_WALL (RID_APP_START + 32) +#define STR_OBJECT_DIAGRAM_FLOOR (RID_APP_START + 33) +#define STR_OBJECT_LEGEND (RID_APP_START + 48) +#define STR_OBJECT_LEGEND_SYMBOL (RID_APP_START + 49) + +#define STR_OBJECT_DATALABELS (RID_APP_START + 45) +#define STR_OBJECT_LABEL (RID_APP_START + 199) + +#define STR_OBJECT_TITLE (RID_APP_START + 200) +#define STR_OBJECT_TITLES (RID_APP_START + 201) + +#define STR_OBJECT_TITLE_MAIN (RID_APP_START + 254) +#define STR_OBJECT_TITLE_SUB (RID_APP_START + 255) +#define STR_OBJECT_TITLE_X_AXIS (RID_APP_START + 256) +#define STR_OBJECT_TITLE_Y_AXIS (RID_APP_START + 257) +#define STR_OBJECT_TITLE_Z_AXIS (RID_APP_START + 258) +#define STR_OBJECT_TITLE_SECONDARY_X_AXIS (RID_APP_START + 87) +#define STR_OBJECT_TITLE_SECONDARY_Y_AXIS (RID_APP_START + 88) + +#define STR_OBJECT_DATAPOINT (RID_APP_START + 202) +#define STR_OBJECT_DATAPOINTS (RID_APP_START + 203) +#define STR_OBJECT_DATASERIES (RID_APP_START + 204) +#define STR_OBJECT_DATASERIES_PLURAL (RID_APP_START + 205) + +#define STR_OBJECT_FOR_SERIES (RID_APP_START + 288) +#define STR_OBJECT_FOR_ALL_SERIES (RID_APP_START + 289) + +#define STR_OBJECT_AVERAGE_LINE (RID_APP_START + 174) +#define STR_OBJECT_ERROR_BARS (RID_APP_START + 175) +#define STR_OBJECT_CURVE (RID_APP_START + 176) +#define STR_OBJECT_CURVES (RID_APP_START + 130) + +#define STR_OBJECT_STOCK_LOSS (RID_APP_START + 207) +#define STR_OBJECT_STOCK_GAIN (RID_APP_START + 208) + +#define STR_OBJECT_AXES (RID_APP_START + 209) +#define STR_OBJECT_AXIS (RID_APP_START + 210) +#define STR_OBJECT_AXIS_X (RID_APP_START + 211) +#define STR_OBJECT_AXIS_Y (RID_APP_START + 212) +#define STR_OBJECT_AXIS_Z (RID_APP_START + 213) + +#define STR_OBJECT_SECONDARY_X_AXIS (RID_APP_START + 286) +#define STR_OBJECT_SECONDARY_Y_AXIS (RID_APP_START + 287) + +#define STR_OBJECT_GRID (RID_APP_START + 214) +#define STR_OBJECT_GRIDS (RID_APP_START + 215) + +#define STR_OBJECT_GRID_MAJOR_X (RID_APP_START + 37) +#define STR_OBJECT_GRID_MAJOR_Y (RID_APP_START + 38) +#define STR_OBJECT_GRID_MAJOR_Z (RID_APP_START + 39) +#define STR_OBJECT_GRID_MINOR_X (RID_APP_START + 40) +#define STR_OBJECT_GRID_MINOR_Y (RID_APP_START + 41) +#define STR_OBJECT_GRID_MINOR_Z (RID_APP_START + 42) + +#define STR_OBJECT_CURVE_WITH_PARAMETERS (RID_APP_START + 264) +#define STR_OBJECT_AVERAGE_LINE_WITH_PARAMETERS (RID_APP_START + 265) + +#define STR_OBJECT_CURVE_EQUATION (RID_APP_START + 268) +#define STR_STATISTICS_IN_LEGEND (RID_APP_START + 180) + +#define STR_OBJECT_SHAPE (RID_APP_START + 290) + +//----------------------------------------------------------------------------- +//Titles for tabpages and dialogs + +#define STR_PAGE_LINE (RID_APP_START + 216) +#define STR_PAGE_BORDER (RID_APP_START + 217) +#define STR_PAGE_AREA (RID_APP_START + 218) +#define STR_PAGE_TRANSPARENCY (RID_APP_START + 219) +#define STR_PAGE_FONT (RID_APP_START + 220) +#define STR_PAGE_FONT_EFFECTS (RID_APP_START + 221) +#define STR_PAGE_LAYOUT (RID_APP_START + 222) +#define STR_PAGE_OPTIONS (RID_APP_START + 223) +#define STR_PAGE_SCALE (RID_APP_START + 224) +#define STR_PAGE_NUMBERS (RID_APP_START + 225) +#define STR_PAGE_ALIGNMENT (RID_APP_START + 226) +#define STR_PAGE_POSITION (RID_APP_START + 227) + +#define STR_PAGE_PERSPECTIVE (RID_APP_START + 235) +#define STR_PAGE_APPEARANCE (RID_APP_START + 236) +#define STR_PAGE_ILLUMINATION (RID_APP_START + 237) + +#define STR_PAGE_TRENDLINE_TYPE (RID_APP_START + 89) +#define STR_PAGE_YERROR_BARS (RID_APP_START + 206) +#define STR_CONTROLTEXT_ERROR_BARS_FROM_DATA (RID_APP_START + 276) + +#define STR_DLG_CHART_WIZARD (RID_APP_START + 228) +#define STR_PAGE_CHART_ELEMENTS (RID_APP_START + 229) +#define STR_PAGE_CHART_LOCATION (RID_APP_START + 230) + +#define STR_DLG_SMOOTH_LINE_PROPERTIES (RID_APP_START + 239) +#define STR_DLG_NUMBERFORMAT_FOR_PERCENTAGE_VALUE (RID_APP_START + 266) + +#define STR_PAGE_POSITIONING (RID_APP_START + 277) +#define STR_PAGE_ASIAN (RID_APP_START + 281) + +//----------------------------------------------------------------------------- +//strings used as description for actions on toolbar icons, as tip help or for undo + +#define STR_ACTION_EDIT_CHARTTYPE (RID_APP_START + 78) +#define STR_ACTION_EDIT_DATA_RANGES (RID_APP_START + 64) +#define STR_ACTION_EDIT_3D_VIEW (RID_APP_START + 80) +#define STR_ACTION_TOGGLE_LEGEND (RID_APP_START + 83) +#define STR_ACTION_TOGGLE_GRID_HORZ (RID_APP_START + 86) +#define STR_ACTION_SCALE_TEXT (RID_APP_START + 93) +#define STR_ACTION_REARRANGE_CHART (RID_APP_START + 94) + +#define STR_TIP_CHOOSECOLOR (RID_APP_START + 233) +#define STR_TIP_LIGHTSOURCE_X (RID_APP_START + 234) + +//----------------------------------------------------------------------------- +//statusbar strings and balloon help + +#define STR_STATUS_PIE_SEGMENT_EXPLODED (RID_APP_START + 179) +#define STR_STATUS_OBJECT_MARKED (RID_APP_START + 51) +#define STR_STATUS_DATAPOINT_MARKED (RID_APP_START + 44) +#define STR_TIP_DATASERIES (RID_APP_START + 43) +#define STR_TIP_DATAPOINT (RID_APP_START + 140) +#define STR_TIP_DATAPOINT_INDEX (RID_APP_START + 141) +#define STR_TIP_DATAPOINT_VALUES (RID_APP_START + 142) +#define STR_TIP_CATEGORY_VALUE (RID_APP_START + 139) + +//----------------------------------------------------------------------------- +//warning and info boxes +#define STR_ACTION_NOTPOSSIBLE (RID_APP_START + 107) + +#define STR_COLUMN_LABEL (RID_APP_START + 262) +#define STR_ROW_LABEL (RID_APP_START + 263) + +#define STR_DATA_EDITOR_INCORRECT_INPUT (RID_APP_START + 269) + +// frame direction ------------------------------------------------------------ + +#define STR_TEXT_DIRECTION_LTR (RID_APP_START + 278) +#define STR_TEXT_DIRECTION_RTL (RID_APP_START + 279) +#define STR_TEXT_DIRECTION_SUPER (RID_APP_START + 280) + +//----------------------------------------------------------------------------- +/* +////#define STR_DIAGRAM_X_AXIS (RID_APP_START + 34) +////#define STR_DIAGRAM_Y_AXIS (RID_APP_START + 35) +////#define STR_DIAGRAM_Z_AXIS (RID_APP_START + 36) +////#define STR_ACTION_DIAGRAM_DATA (RID_APP_START + 63) +////#define STR_UNDO_AUTOFORMAT (RID_APP_START + 79) +////#define STR_DIAGRAM_DESCR_ROW (RID_APP_START + 46) +////#define STR_DIAGRAM_DESCR_COL (RID_APP_START + 47) +////#define STR_LEGEND_SYMBOL_COL (RID_APP_START + 50) +////#define STR_BAD_PASSWORD_OR_FILE_CORRUPTED (RID_APP_START + 110) +////#define STR_QUERY_SORT (RID_APP_START + 113) +////#define STR_CFG_DEFAULT_COLORS (RID_APP_START + 177) +////#define STR_DIAGRAM_DATA_SAFETY_QUERY (RID_APP_START + 181) +////#define STR_UNDO_CUT (RID_APP_START + 60) +////#define STR_UNDO_DELETE (RID_APP_START + 61) +////#define STR_UNDO_DRAGDROP (RID_APP_START + 62) +////#define STR_UNDO_INSERT_TITLE (RID_APP_START + 65) +////#define STR_UNDO_INSERT_LEGEND (RID_APP_START + 66) +////#define STR_UNDO_INSERT_DESCR (RID_APP_START + 67) +////#define STR_UNDO_INSERT_AXIS (RID_APP_START + 68) +////#define STR_UNDO_DATA_ROW (RID_APP_START + 69) +////#define STR_UNDO_DATA_POINT (RID_APP_START + 70) +////#define STR_UNDO_TITLE (RID_APP_START + 71) +////#define STR_UNDO_LEGEND (RID_APP_START + 72) +////#define STR_UNDO_DIAGRAM_AXIS (RID_APP_START + 73) +////#define STR_UNDO_DIAGRAM_GRID (RID_APP_START + 74) +////#define STR_UNDO_DIAGRAM_WALL (RID_APP_START + 75) +////#define STR_UNDO_DIAGRAM_FLOOR (RID_APP_START + 76) +////#define STR_UNDO_DIAGRAM_AREA (RID_APP_START + 77) +////#define STR_UNDO_LIGHTING (RID_APP_START + 81) +////#define STR_UNDO_TOGGLE_TITLE (RID_APP_START + 82) +////#define STR_UNDO_TOGGLE_AXIS_TITLE (RID_APP_START + 84) +////#define STR_UNDO_TOGGLE_AXIS_DESCR (RID_APP_START + 85) +////#define STR_DEFAULTVIEW (RID_APP_START + 90) +////#define STR_UNDO_STATISTICS (RID_APP_START + 91) +////#define STR_UNDO_DIAGRAM_LINE (RID_APP_START + 92) +////#define STR_UNDO_REMOVEPOINTATTRS (RID_APP_START + 94) +////#define STR_UNDO_MOREFRONT (RID_APP_START + 95) +////#define STR_UNDO_MOREBACK (RID_APP_START + 96) +////#define STR_UNDO_INSERT_SPECCHAR (RID_APP_START + 173) +////#define STR_UNDO_INSERT_GRID (RID_APP_START + 178) +////#define STR_UNDO_TRANSFORM (RID_APP_START + 183) +////#define STR_UNDO_MOVE (RID_APP_START + 184) +////#define STR_UNDO_RESIZE (RID_APP_START + 185) +////#define STR_UNDO_ROTATE (RID_APP_START + 186) +////#define STR_UNDO_DIAGRAM_STOCK_LOSS (RID_APP_START + 147) +////#define STR_UNDO_DIAGRAM_STOCK_PLUS (RID_APP_START + 148) +////#define STR_OPEN_DOCUMENT (RID_APP_START + 105) use SID_DOC_LOADING instead +////#define STR_SAVE_DOCUMENT (RID_APP_START + 106) use SID_SAVEDOC instead +////#define STR_GRAPHIC (RID_APP_START + 108) +////#define STR_CHART_DOCUMENT (RID_APP_START + 109) +////#define STR_CHART_DOCUMENT_FULLTYPE_40 (RID_APP_START + 114) +////#define STR_CHART_DOCUMENT_FULLTYPE_31 (RID_APP_START + 118) +////#define STR_CHART_DOCUMENT_FULLTYPE_50 (RID_APP_START + 119) +////#define STR_CHART_DOCUMENT_FULLTYPE_60 (RID_APP_START + 182) +////#define STR_INVISIBLE (RID_APP_START + 120) +////#define STR_SOLID (RID_APP_START + 121) +////#define STR_APPNAME (RID_APP_START + 139) +*/ + +// ids must not exceed RID_APP_START + 499 +// ids >= RID_APP_START + 500 are defined in glob.hrc + +// CHART_STRINGS_HRC +#endif diff --git a/chart2/source/inc/ThreeDHelper.hxx b/chart2/source/inc/ThreeDHelper.hxx new file mode 100644 index 000000000000..d3d31bd38c5d --- /dev/null +++ b/chart2/source/inc/ThreeDHelper.hxx @@ -0,0 +1,159 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_THREEDHELPER_HXX +#define CHART2_THREEDHELPER_HXX + +#include <com/sun/star/chart2/XDiagram.hpp> +#include <com/sun/star/drawing/CameraGeometry.hpp> +#include <com/sun/star/drawing/ShadeMode.hpp> +#include "charttoolsdllapi.hxx" + +//............................................................................. +namespace chart +{ +//............................................................................. + +//----------------------------------------------------------------------------- +/** +*/ + +enum ThreeDLookScheme +{ + ThreeDLookScheme_Simple, + ThreeDLookScheme_Realistic, + ThreeDLookScheme_Unknown +}; + +enum CuboidPlanePosition +{ + CuboidPlanePosition_Left, + CuboidPlanePosition_Right, + CuboidPlanePosition_Top, + CuboidPlanePosition_Bottom, + CuboidPlanePosition_Front, + CuboidPlanePosition_Back +}; + +class OOO_DLLPUBLIC_CHARTTOOLS ThreeDHelper +{ +public: + + /** Returns the default camera geometry that is set in the Diagram CTOR. + This is not the property default! + + @todo deprecate the hard set camera geometry and use the property + default + */ + static ::com::sun::star::drawing::CameraGeometry getDefaultCameraGeometry( bool bPie=false ); + + static void getRotationAngleFromDiagram( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xSceneProperties + , double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad ); + static void setRotationAngleToDiagram( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xSceneProperties + , double fXAngleRad, double fYAngleRad, double fZAngleRad ); + + static void getRotationFromDiagram( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xSceneProperties + , sal_Int32& rnHorizontalAngleDegree, sal_Int32& rnVerticalAngleDegree ); + static void setRotationToDiagram( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xSceneProperties + , sal_Int32 nHorizontalAngleDegree, sal_Int32 nVerticalYAngleDegree ); + + static void switchRightAngledAxes( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xSceneProperties + , sal_Bool bRightAngledAxes, bool bRotateLights=true ); + + static void adaptRadAnglesForRightAngledAxes( double& rfXAngleRad, double& rfYAngleRad ); + static double getXDegreeAngleLimitForRightAngledAxes(); + static double getYDegreeAngleLimitForRightAngledAxes(); + static double getValueClippedToRange( double fValue, const double& fPositivLimit ); + + static void convertElevationRotationDegToXYZAngleRad( + sal_Int32 nElevationDeg, sal_Int32 nRotationDeg + , double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad ); + + SAL_DLLPRIVATE static void convertXYZAngleRadToElevationRotationDeg( + sal_Int32& rnElevationDeg, sal_Int32& rnRotationDeg + , double fXRad, double fYRad, double fZRad ); + + static double getCameraDistance( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xSceneProperties ); + static void setCameraDistance( + const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xSceneProperties + , double fCameraDistance ); + SAL_DLLPRIVATE static void ensureCameraDistanceRange( double& rfCameraDistance ); + SAL_DLLPRIVATE static void getCameraDistanceRange( double& rfMinimumDistance, double& rfMaximumDistance ); + + static double CameraDistanceToPerspective( double fCameraDistance ); + static double PerspectiveToCameraDistance( double fPerspective ); + + static void set3DSettingsToDefault( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xSceneProperties ); + static void setDefaultRotation( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xSceneProperties ); + static void setDefaultIllumination( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xSceneProperties ); + + static void setDefaultRotation( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xSceneProperties, bool bPieOrDonut ); + + static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardLeftWall( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xSceneProperties ); + static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBackWall(const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xSceneProperties ); + static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBottom(const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xSceneProperties ); + + static ThreeDLookScheme detectScheme( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram ); + static void setScheme( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram + , ThreeDLookScheme aScheme ); + + //sal_Int32 nRoundedEdges: <0 or >100 -> mixed state + //sal_Int32 nObjectLines: 0->no lines; 1->all lines on; other->mixed state + + static void getRoundedEdgesAndObjectLines( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram + , sal_Int32& rnRoundedEdges, sal_Int32& rnObjectLines ); + static void setRoundedEdgesAndObjectLines( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XDiagram >& xDiagram + , sal_Int32 nRoundedEdges, sal_Int32 nObjectLines ); +}; + +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/TitleHelper.hxx b/chart2/source/inc/TitleHelper.hxx new file mode 100644 index 000000000000..2de0c16266db --- /dev/null +++ b/chart2/source/inc/TitleHelper.hxx @@ -0,0 +1,101 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_TOOLS_TITLEHELPER_HXX +#define _CHART2_TOOLS_TITLEHELPER_HXX + +#include "ReferenceSizeProvider.hxx" +#include "charttoolsdllapi.hxx" +#include <com/sun/star/chart2/XTitled.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/chart2/XDiagram.hpp> + +//............................................................................. +namespace chart +{ +//............................................................................. + +class OOO_DLLPUBLIC_CHARTTOOLS TitleHelper +{ +public: + enum eTitleType + { + TITLE_BEGIN = 0, + MAIN_TITLE = 0, + SUB_TITLE, + X_AXIS_TITLE, + Y_AXIS_TITLE, + Z_AXIS_TITLE, + SECONDARY_X_AXIS_TITLE, + SECONDARY_Y_AXIS_TITLE, + NORMAL_TITLE_END, + + //it is intended that this both types are after NORMAL_TITLE_END + TITLE_AT_STANDARD_X_AXIS_POSITION, //equals the Y_AXIS_TITLE for barchart + TITLE_AT_STANDARD_Y_AXIS_POSITION //equals the X_AXIS_TITLE for barchart + }; + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XTitle > + getTitle( eTitleType nTitleIndex + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xModel ); + + static ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XTitle > + createTitle( eTitleType nTitleIndex + , const rtl::OUString& rTitleText + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xModel + , const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext + , ReferenceSizeProvider * pRefSizeProvider = 0 ); + + static void removeTitle( eTitleType nTitleIndex + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xModel ); + + static rtl::OUString getCompleteString( const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XTitle >& xTitle ); + static void setCompleteString( const rtl::OUString& rNewText + , const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XTitle >& xTitle + , const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > & xContext + , float * pDefaultCharHeight = 0 ); + + static bool getTitleType( eTitleType& rType + , const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XTitle >& xTitle + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xModel ); +}; + +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/TrueGuard.hxx b/chart2/source/inc/TrueGuard.hxx new file mode 100644 index 000000000000..6a3c639df26e --- /dev/null +++ b/chart2/source/inc/TrueGuard.hxx @@ -0,0 +1,48 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_TRUEGUARD_HXX +#define CHART2_TRUEGUARD_HXX + +#include "charttoolsdllapi.hxx" + +namespace chart +{ +/** This guard sets the given boolean reference to true in the constructor and to false in the destructor + */ +class OOO_DLLPUBLIC_CHARTTOOLS TrueGuard +{ +public: + explicit TrueGuard( bool& rbTrueDuringGuardedTime ); + virtual ~TrueGuard(); + +private: + bool& m_rbTrueDuringGuardedTime; +}; + +} +// CHART2_TRUEGUARD_HXX +#endif diff --git a/chart2/source/inc/UncachedDataSequence.hxx b/chart2/source/inc/UncachedDataSequence.hxx new file mode 100644 index 000000000000..0b601b06f721 --- /dev/null +++ b/chart2/source/inc/UncachedDataSequence.hxx @@ -0,0 +1,206 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_UNCACHEDDATASEQUENCE_HXX +#define _CHART_UNCACHEDDATASEQUENCE_HXX + +// helper classes +#include <cppuhelper/compbase8.hxx> +#include <comphelper/uno3.hxx> +#include <comphelper/broadcasthelper.hxx> +#include <comphelper/propertycontainer.hxx> +#include <comphelper/proparrhlp.hxx> +#include "ServiceMacros.hxx" +#include "charttoolsdllapi.hxx" + +// interfaces and types +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/chart2/XInternalDataProvider.hpp> +#include <com/sun/star/chart2/data/XDataSequence.hpp> +#include <com/sun/star/chart2/data/XNumericalDataSequence.hpp> +#include <com/sun/star/chart2/data/XTextualDataSequence.hpp> +#include <com/sun/star/container/XIndexReplace.hpp> +#include <com/sun/star/container/XNamed.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/util/XModifyBroadcaster.hpp> +#include <com/sun/star/util/XModifiable.hpp> + +#include <vector> + +// ____________________ +namespace chart +{ + +namespace impl +{ +typedef ::cppu::WeakComponentImplHelper8< + ::com::sun::star::chart2::data::XDataSequence, + ::com::sun::star::chart2::data::XNumericalDataSequence, + ::com::sun::star::chart2::data::XTextualDataSequence, + ::com::sun::star::util::XCloneable, + ::com::sun::star::util::XModifiable, // contains util::XModifyBroadcaster + ::com::sun::star::container::XIndexReplace, + ::com::sun::star::container::XNamed, // for setting a new range representation + ::com::sun::star::lang::XServiceInfo > + UncachedDataSequence_Base; +} + +class UncachedDataSequence : + public ::comphelper::OMutexAndBroadcastHelper, + public ::comphelper::OPropertyContainer, + public ::comphelper::OPropertyArrayUsageHelper< UncachedDataSequence >, + public impl::UncachedDataSequence_Base +{ +public: + /** The referring data provider is held as uno reference to ensure its + lifetime is at least as long as the one of this object. + */ + UncachedDataSequence( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XInternalDataProvider > & xIntDataProv, + const ::rtl::OUString & rRangeRepresentation ); + UncachedDataSequence( + const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XInternalDataProvider > & xIntDataProv, + const ::rtl::OUString & rRangeRepresentation, + const ::rtl::OUString & rRole ); + UncachedDataSequence( const UncachedDataSequence & rSource ); + virtual ~UncachedDataSequence(); + + /// declare XServiceInfo methods + APPHELPER_XSERVICEINFO_DECL() + + /// merge XInterface implementations + DECLARE_XINTERFACE() + /// merge XTypeProvider implementations + DECLARE_XTYPEPROVIDER() + +protected: + // ____ XPropertySet ____ + /// @see ::com::sun::star::beans::XPropertySet + virtual ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() + throw (::com::sun::star::uno::RuntimeException); + /// @see ::comphelper::OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper(); + /// @see ::comphelper::OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const; + + // ____ XDataSequence ____ + virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > SAL_CALL getData() + throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getSourceRangeRepresentation() + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL generateLabel( + ::com::sun::star::chart2::data::LabelOrigin nLabelOrigin ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex( ::sal_Int32 nIndex ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::uno::RuntimeException); + + // ____ XNumericalDataSequence ____ + /// @see ::com::sun::star::chart::data::XNumericalDataSequence + virtual ::com::sun::star::uno::Sequence< double > SAL_CALL getNumericalData() throw (::com::sun::star::uno::RuntimeException); + + // ____ XTextualDataSequence ____ + /// @see ::com::sun::star::chart::data::XTextualDataSequence + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getTextualData() throw (::com::sun::star::uno::RuntimeException); + + // ____ XIndexReplace ____ + virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const ::com::sun::star::uno::Any& Element ) + throw (::com::sun::star::lang::IllegalArgumentException, + ::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // ____ XIndexAccess (base of XIndexReplace) ____ + virtual ::sal_Int32 SAL_CALL getCount() + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) + throw (::com::sun::star::lang::IndexOutOfBoundsException, + ::com::sun::star::lang::WrappedTargetException, + ::com::sun::star::uno::RuntimeException); + + // ____ XElementAccess (base of XIndexAccess) ____ + virtual ::com::sun::star::uno::Type SAL_CALL getElementType() + throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL hasElements() + throw (::com::sun::star::uno::RuntimeException); + + // ____ XNamed (for setting a new range representation) ____ + virtual ::rtl::OUString SAL_CALL getName() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setName( const ::rtl::OUString& aName ) + throw (::com::sun::star::uno::RuntimeException); + + // ____ XCloneable ____ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloneable > SAL_CALL createClone() + throw (::com::sun::star::uno::RuntimeException); + + // ____ XModifiable ____ + virtual ::sal_Bool SAL_CALL isModified() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL setModified( ::sal_Bool bModified ) + throw (::com::sun::star::beans::PropertyVetoException, + ::com::sun::star::uno::RuntimeException); + + // ____ XModifyBroadcaster (base of XModifiable) ____ + virtual void SAL_CALL addModifyListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeModifyListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + + void fireModifyEvent(); + + mutable ::osl::Mutex m_aMutex; + + // <properties> + sal_Int32 m_nNumberFormatKey; + ::rtl::OUString m_sRole; + ::rtl::OUString m_aXMLRange; + // </properties> + + /** This method registers all properties. It should be called by all + constructors. + */ + void registerProperties(); + +private: + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XInternalDataProvider > m_xDataProvider; + ::rtl::OUString m_aSourceRepresentation; + ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener > + m_xModifyEventForwarder; +}; + +} // namespace chart + + +// _CHART_UNCACHEDDATASEQUENCE_HXX +#endif diff --git a/chart2/source/inc/UndoGuard.hxx b/chart2/source/inc/UndoGuard.hxx new file mode 100644 index 000000000000..864d5ccff994 --- /dev/null +++ b/chart2/source/inc/UndoGuard.hxx @@ -0,0 +1,120 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_UNDOGUARD_HXX +#define CHART2_UNDOGUARD_HXX + +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/chart2/XUndoManager.hpp> + +// header for class OUString +#include <rtl/ustring.hxx> + +namespace chart +{ +/** Base Class for UndoGuard and UndoLiveUpdateGuard +*/ +class UndoGuard_Base +{ +public: + explicit UndoGuard_Base( const rtl::OUString & rUndoMessage + , const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XUndoManager > & xUndoManager + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > & xModel ); + virtual ~UndoGuard_Base(); + + void commitAction(); + +protected: + ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > m_xModel; + ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XUndoManager > m_xUndoManager; + + rtl::OUString m_aUndoString; + bool m_bActionPosted; +}; + +/** This guard calls preAction at the given Model in the CTOR and + cancelAction in the DTOR if no other method is called. + If commitAction is called the destructor does nothin anymore. + */ +class UndoGuard : public UndoGuard_Base +{ +public: + explicit UndoGuard( const rtl::OUString& rUndoMessage + , const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XUndoManager > & xUndoManager + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > & xModel ); + virtual ~UndoGuard(); +}; + +/** This guard calls preAction at the given Model in the CTOR and + cancelActionUndo in the DTOR if no other method is called. + If commitAction is called the destructor does nothin anymore. + */ +class UndoLiveUpdateGuard : public UndoGuard_Base +{ +public: + explicit UndoLiveUpdateGuard( const rtl::OUString& rUndoMessage + , const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XUndoManager > & xUndoManager + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > & xModel ); + virtual ~UndoLiveUpdateGuard(); +}; + +/** Same as UndoLiveUpdateGuard but with additional storage of the chart's data. + Only use this if the data has internal data. + */ +class UndoLiveUpdateGuardWithData : + public UndoGuard_Base +{ +public: + explicit UndoLiveUpdateGuardWithData( const rtl::OUString& rUndoMessage + , const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XUndoManager > & xUndoManager + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > & xModel ); + virtual ~UndoLiveUpdateGuardWithData(); +}; + +class UndoGuardWithSelection : public UndoGuard_Base +{ +public: + explicit UndoGuardWithSelection( const rtl::OUString& rUndoMessage + , const ::com::sun::star::uno::Reference< + ::com::sun::star::chart2::XUndoManager > & xUndoManager + , const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > & xModel ); + virtual ~UndoGuardWithSelection(); +}; + +} +// CHART2_UNDOGUARD_HXX +#endif diff --git a/chart2/source/inc/UndoManager.hxx b/chart2/source/inc/UndoManager.hxx new file mode 100644 index 000000000000..a28a0d78c470 --- /dev/null +++ b/chart2/source/inc/UndoManager.hxx @@ -0,0 +1,180 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_UNDOMANAGER_HXX +#define CHART2_UNDOMANAGER_HXX + +#include "ConfigItemListener.hxx" +#include "MutexContainer.hxx" + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/util/XModifyBroadcaster.hpp> +#include <com/sun/star/util/XModifyListener.hpp> +#include <com/sun/star/chart2/XUndoManager.hpp> +#include <com/sun/star/chart2/XUndoHelper.hpp> +#include <com/sun/star/lang/XUnoTunnel.hpp> + +#include <cppuhelper/compbase4.hxx> +#include <rtl/ustring.hxx> + +// for pair +#include <utility> +// for auto_ptr +#include <memory> + +class SdrUndoAction; + +namespace com { namespace sun { namespace star { +namespace frame { + class XModel; +} +}}} + +namespace chart +{ +// ---------------------------------------- +namespace impl +{ + +class UndoStepsConfigItem; +class UndoElement; +class UndoStack; +class ModifyBroadcaster; + +typedef ::cppu::WeakComponentImplHelper4< + ::com::sun::star::util::XModifyBroadcaster, + ::com::sun::star::chart2::XUndoManager, + ::com::sun::star::chart2::XUndoHelper, + ::com::sun::star::lang::XUnoTunnel > + UndoManager_Base; + +} // namespace impl +// ---------------------------------------- + +/** Manages undo by storing the entire XModel in the undo- and redo-buffers. + Note, that therefore this should not be used for "big" XModels. + + A prerequisite for this to work is that the XModels added to the undo- + redo-stacks support the css::util::XCloneable interface, which is + implemented such that the entire model is cloned. + */ +class UndoManager : + public MutexContainer, + public ConfigItemListener, + public impl::UndoManager_Base +{ +public: + explicit UndoManager(); + virtual ~UndoManager(); + + void addShapeUndoAction( SdrUndoAction* pAction ); + + // ____ XUnoTunnel ____ + virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& rId ) + throw (::com::sun::star::uno::RuntimeException); + + static const ::com::sun::star::uno::Sequence< sal_Int8 >& getUnoTunnelId(); + static UndoManager* getImplementation( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface> xObj ); + +protected: + // ____ ConfigItemListener ____ + virtual void notify( const ::rtl::OUString & rPropertyName ); + + // ____ util::XModifyBroadcaster ____ + virtual void SAL_CALL addModifyListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL removeModifyListener( + const ::com::sun::star::uno::Reference< ::com::sun::star::util::XModifyListener >& aListener ) + throw (::com::sun::star::uno::RuntimeException); + + // ____ chart2::XUndoManager ____ + virtual void SAL_CALL preAction( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModelBeforeChange ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL preActionWithArguments( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModelBeforeChange, + const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArguments ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL postAction( const ::rtl::OUString& aUndoText ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL cancelAction() + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL cancelActionWithUndo( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModelToRestore ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL undo( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xCurrentModel ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL redo( ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xCurrentModel ) + throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL undoPossible() + throw (::com::sun::star::uno::RuntimeException); + virtual ::sal_Bool SAL_CALL redoPossible() + throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCurrentUndoString() + throw (::com::sun::star::uno::RuntimeException); + virtual ::rtl::OUString SAL_CALL getCurrentRedoString() + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllUndoStrings() + throw (::com::sun::star::uno::RuntimeException); + virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getAllRedoStrings() + throw (::com::sun::star::uno::RuntimeException); + + // ____ XUndoHelper ____ + virtual ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > SAL_CALL getModelCloneForUndo( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModelBeforeChange ) + throw (::com::sun::star::uno::RuntimeException); + virtual void SAL_CALL applyModelContent( + ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModelToChange, + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >& xModelToCopyFrom ) + throw (::com::sun::star::uno::RuntimeException); + +private: + void retrieveConfigUndoSteps(); + void fireModifyEvent(); + void impl_undoRedo( + ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel > & xCurrentModel, + impl::UndoStack * pStackToRemoveFrom, + impl::UndoStack * pStackToAddTo, + bool bUndo = true ); + + ::std::auto_ptr< impl::UndoStack > m_apUndoStack; + ::std::auto_ptr< impl::UndoStack > m_apRedoStack; + + impl::UndoElement * m_pLastRemeberedUndoElement; + + ::std::auto_ptr< impl::UndoStepsConfigItem > m_apUndoStepsConfigItem; + sal_Int32 m_nMaxNumberOfUndos; + ::com::sun::star::uno::Reference< + ::com::sun::star::util::XModifyBroadcaster > m_xModifyBroadcaster; + // pointer is valid as long as m_xModifyBroadcaster.is() + impl::ModifyBroadcaster * m_pModifyBroadcaster; +}; + +} // namespace chart + +// CHART2_UNDOMANAGER_HXX +#endif diff --git a/chart2/source/inc/UserDefinedProperties.hxx b/chart2/source/inc/UserDefinedProperties.hxx new file mode 100644 index 000000000000..af616a6f6c22 --- /dev/null +++ b/chart2/source/inc/UserDefinedProperties.hxx @@ -0,0 +1,69 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_USERDEFINEDPROPERTIES_HXX +#define CHART_USERDEFINEDPROPERTIES_HXX + +#include "PropertyHelper.hxx" +#include "FastPropertyIdRanges.hxx" +#include "charttoolsdllapi.hxx" +#include <com/sun/star/beans/Property.hpp> + +#include <vector> + +namespace chart +{ + +// implements service com.sun.star.xml.UserDefinedAttributeSupplier +class OOO_DLLPUBLIC_CHARTTOOLS UserDefinedProperties +{ +public: + // FastProperty Ids for properties + enum + { + // UserDefined attributes in the chart-properties + PROP_XML_USERDEF_CHART = FAST_PROPERTY_ID_START_USERDEF_PROP, + PROP_XML_USERDEF_TEXT, + PROP_XML_USERDEF_PARA, + // com.sun.star.xml.UserDefinedAttributeSupplier + // UserDefined attributes in the other properties-sections. (as long as + // there is no reliable mechanism, properties may move between the + // sections) + PROP_XML_USERDEF + }; + + static void AddPropertiesToVector( + ::std::vector< ::com::sun::star::beans::Property > & rOutProperties ); + +private: + // not implemented + UserDefinedProperties(); +}; + +} // namespace chart + +// CHART_USERDEFINEDPROPERTIES_HXX +#endif diff --git a/chart2/source/inc/WeakListenerAdapter.hxx b/chart2/source/inc/WeakListenerAdapter.hxx new file mode 100644 index 000000000000..55f283a94600 --- /dev/null +++ b/chart2/source/inc/WeakListenerAdapter.hxx @@ -0,0 +1,127 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_WEAKLISTENERADAPTER_HXX +#define CHART2_WEAKLISTENERADAPTER_HXX + +#include <com/sun/star/uno/XWeak.hpp> +#include <com/sun/star/lang/XEventListener.hpp> +#include <com/sun/star/util/XModifyListener.hpp> +#include <com/sun/star/view/XSelectionChangeListener.hpp> +#include <cppuhelper/weakref.hxx> +#include <cppuhelper/implbase1.hxx> + +namespace chart +{ +// -------------------------------------------------------------------------------- + +/** Adapter that enables adding listeners as weak UNO references. Thus, adding + an object as listener to a broadcaster does not increase its reference + count. + + <p>The helper class, of course, is held as hard reference at the + broadcaster, but this should never be a problem as the adapter's life time + depends on no other object.</p> + + <p>Note that in order to remove an object as listener, you have to remove + the same wrapper that you added, i.e., you should store the adapter as a + member in the adaptee class for later use.</p> + */ +template< class Listener > + class WeakListenerAdapter : public + ::cppu::WeakImplHelper1< Listener > +{ +public: + explicit WeakListenerAdapter( const ::com::sun::star::uno::Reference< Listener > & xListener ) : + m_xListener( xListener ) + {} + explicit WeakListenerAdapter( const ::com::sun::star::uno::WeakReference< Listener > & xListener ) : + m_xListener( xListener ) + {} + virtual ~WeakListenerAdapter() + {} + +protected: + // ____ XEventListener (base of all listeners) ____ + virtual void SAL_CALL disposing( + const ::com::sun::star::lang::EventObject& Source ) + throw (::com::sun::star::uno::RuntimeException) + { + ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener > xEventListener = + ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XEventListener >( + ::com::sun::star::uno::Reference< Listener >( m_xListener), ::com::sun::star::uno::UNO_QUERY ); + if( xEventListener.is()) + xEventListener->disposing( Source ); + } + + ::com::sun::star::uno::Reference< Listener > getListener() const + { + return m_xListener; + } + +private: + ::com::sun::star::uno::WeakReference< Listener > m_xListener; +}; + +// -------------------------------------------------------------------------------- + +class WeakModifyListenerAdapter : + public WeakListenerAdapter< ::com::sun::star::util::XModifyListener > +{ +public: + explicit WeakModifyListenerAdapter( + const ::com::sun::star::uno::WeakReference< ::com::sun::star::util::XModifyListener > & xListener ); + virtual ~WeakModifyListenerAdapter(); + +protected: + // ____ XModifyListener ____ + virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) + throw (::com::sun::star::uno::RuntimeException); +}; + +// -------------------------------------------------------------------------------- + +class WeakSelectionChangeListenerAdapter : + public WeakListenerAdapter< ::com::sun::star::view::XSelectionChangeListener > +{ +public: + explicit WeakSelectionChangeListenerAdapter( + const ::com::sun::star::uno::Reference< ::com::sun::star::view::XSelectionChangeListener > & xListener ); + virtual ~WeakSelectionChangeListenerAdapter(); + +protected: + // ____ XSelectionChangeListener ____ + virtual void SAL_CALL selectionChanged( + const ::com::sun::star::lang::EventObject& aEvent ) + throw (::com::sun::star::uno::RuntimeException); +}; + +} // namespace chart + +// CHART2_WEAKLISTENERADAPTER_HXX +#endif diff --git a/chart2/source/inc/WrappedDefaultProperty.hxx b/chart2/source/inc/WrappedDefaultProperty.hxx new file mode 100644 index 000000000000..78a263c70cdc --- /dev/null +++ b/chart2/source/inc/WrappedDefaultProperty.hxx @@ -0,0 +1,66 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_WRAPPEDDEFAULTPROPERTY_HXX +#define CHART2_WRAPPEDDEFAULTPROPERTY_HXX + +#include "WrappedProperty.hxx" +#include "charttoolsdllapi.hxx" + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS WrappedDefaultProperty : public WrappedProperty +{ +public: + explicit WrappedDefaultProperty( + const ::rtl::OUString& rOuterName, const ::rtl::OUString& rInnerName, + const ::com::sun::star::uno::Any& rNewOuterDefault ); + virtual ~WrappedDefaultProperty(); + + 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); + + 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); +private: + ::com::sun::star::uno::Any m_aOuterDefaultValue; +}; + +} // namespace chart + +// CHART2_WRAPPEDPROPERTYNEWDEFAULT_HXX +#endif diff --git a/chart2/source/inc/WrappedDirectStateProperty.hxx b/chart2/source/inc/WrappedDirectStateProperty.hxx new file mode 100644 index 000000000000..1dd5889f0d55 --- /dev/null +++ b/chart2/source/inc/WrappedDirectStateProperty.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_WRAPPEDDIRECTSTATEPROPERTY_HXX +#define CHART2_WRAPPEDDIRECTSTATEPROPERTY_HXX + +#include "WrappedProperty.hxx" +#include "charttoolsdllapi.hxx" + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS WrappedDirectStateProperty : + public WrappedProperty +{ +public: + explicit WrappedDirectStateProperty( + const ::rtl::OUString& rOuterName, const ::rtl::OUString& rInnerName ); + virtual ~WrappedDirectStateProperty(); + + 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); +}; + +} // namespace chart + +// CHART2_WRAPPEDPROPERTYNEWDEFAULT_HXX +#endif diff --git a/chart2/source/inc/WrappedIgnoreProperty.hxx b/chart2/source/inc/WrappedIgnoreProperty.hxx new file mode 100644 index 000000000000..1e76bf91ea95 --- /dev/null +++ b/chart2/source/inc/WrappedIgnoreProperty.hxx @@ -0,0 +1,81 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_IGNORE_PROPERTY_HXX +#define CHART_WRAPPED_IGNORE_PROPERTY_HXX + +#include "WrappedProperty.hxx" +#include "charttoolsdllapi.hxx" + +#include <vector> + +//............................................................................. +namespace chart +{ +//............................................................................. + +class OOO_DLLPUBLIC_CHARTTOOLS WrappedIgnoreProperty : public WrappedProperty +{ +public: + WrappedIgnoreProperty( const ::rtl::OUString& rOuterName, const ::com::sun::star::uno::Any& rDefaultValue ); + virtual ~WrappedIgnoreProperty(); + + 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); + +SAL_DLLPRIVATE 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); + +SAL_DLLPRIVATE 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); + +SAL_DLLPRIVATE 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: + ::com::sun::star::uno::Any m_aDefaultValue; + mutable ::com::sun::star::uno::Any m_aCurrentValue; +}; + +class OOO_DLLPUBLIC_CHARTTOOLS WrappedIgnoreProperties +{ +public: + static void addIgnoreLineProperties( std::vector< WrappedProperty* >& rList ); + + static void addIgnoreFillProperties( std::vector< WrappedProperty* >& rList ); + SAL_DLLPRIVATE static void addIgnoreFillProperties_without_BitmapProperties( std::vector< WrappedProperty* >& rList ); + SAL_DLLPRIVATE static void addIgnoreFillProperties_only_BitmapProperties( std::vector< WrappedProperty* >& rList ); +}; + +//............................................................................. +} //namespace chart +//............................................................................. + +// CHART_WRAPPED_IGNORE_PROPERTY_HXX +#endif diff --git a/chart2/source/inc/WrappedProperty.hxx b/chart2/source/inc/WrappedProperty.hxx new file mode 100644 index 000000000000..91a4b40fd2c9 --- /dev/null +++ b/chart2/source/inc/WrappedProperty.hxx @@ -0,0 +1,86 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_WRAPPEDPROPERTY_HXX +#define CHART_WRAPPEDPROPERTY_HXX + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include "charttoolsdllapi.hxx" + +#include <map> + +//............................................................................. +namespace chart +{ +//............................................................................. + +class OOO_DLLPUBLIC_CHARTTOOLS WrappedProperty +{ + /** The property visible to the outer PropertySet in the PropertySetWrapper may have a different name, type and value than + a corresponding property of the inner PropertySet. Use this class to do the conversion between the two. + */ +public: + WrappedProperty( const ::rtl::OUString& rOuterName, const ::rtl::OUString& rInnerName ); + virtual ~WrappedProperty(); + + const ::rtl::OUString& getOuterName() const; + virtual ::rtl::OUString getInnerName() const; + + 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 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); + + 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: + ::rtl::OUString m_aOuterName; + ::rtl::OUString m_aInnerName; +}; + +//............................................................................. + +typedef ::std::map< sal_Int32, const WrappedProperty* > tWrappedPropertyMap; + +//............................................................................. +} //namespace chart +//............................................................................. + +// CHART_WRAPPEDPROPERTY_HXX +#endif diff --git a/chart2/source/inc/WrappedPropertySet.hxx b/chart2/source/inc/WrappedPropertySet.hxx new file mode 100644 index 000000000000..03cfea84f502 --- /dev/null +++ b/chart2/source/inc/WrappedPropertySet.hxx @@ -0,0 +1,145 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_WRAPPEDPROPERTYSET_HXX +#define CHART_WRAPPEDPROPERTYSET_HXX + +#include "WrappedProperty.hxx" +#include "MutexContainer.hxx" +#include "charttoolsdllapi.hxx" +#include <com/sun/star/beans/XMultiPropertySet.hpp> +#include <com/sun/star/beans/XMultiPropertyStates.hpp> +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/beans/Property.hpp> +#include <cppuhelper/implbase4.hxx> + +// header for class OPropertyArrayHelper +#include <cppuhelper/propshlp.hxx> + +// header for class OMultiTypeInterfaceContainerHelperInt32 +#include <cppuhelper/propshlp.hxx> + +#include <vector> + +//............................................................................. +namespace chart +{ +//............................................................................. + +class OOO_DLLPUBLIC_CHARTTOOLS WrappedPropertySet : + public MutexContainer + , public ::cppu::WeakImplHelper4 + < ::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: + WrappedPropertySet(); + virtual ~WrappedPropertySet(); + + void clearWrappedPropertySet(); + +public: + //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); + +protected: //methods + /** give all the properties that should be visible to the outer side + */ + virtual const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::Property >& getPropertySequence()=0; + /** give a list of all properties that need a special treatment; + properties that are not in this list will be wrapped identical. + The base class 'WrappedPropertySet' will take ownership on the contained pointer. + It is not allowed to have duplicate entries in this list. + */ + virtual const std::vector< WrappedProperty* > createWrappedProperties()=0; + + virtual ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet > getInnerPropertySet() = 0; + SAL_DLLPRIVATE ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertyState > getInnerPropertyState(); + + ::cppu::IPropertyArrayHelper& getInfoHelper(); + SAL_DLLPRIVATE tWrappedPropertyMap& getWrappedPropertyMap(); + + const WrappedProperty* getWrappedProperty( const ::rtl::OUString& rOuterName ); + const WrappedProperty* getWrappedProperty( sal_Int32 nHandle ); + +protected: //member + ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySetInfo > m_xInfo;//outer PropertySetInfo + + ::cppu::OPropertyArrayHelper* m_pPropertyArrayHelper;//holds all possible outer properties + + tWrappedPropertyMap* m_pWrappedPropertyMap;//holds all wrapped properties (containing the special mapping from inner to outer properties) + + //Container for the XProperyChangedListener. The listeners are inserted by handle. + //OMultiTypeInterfaceContainerHelperInt32 m_aBoundListenerContainer; + + //Container for the XPropertyVetoableListener. The listeners are inserted by handle. + //OMultiTypeInterfaceContainerHelperInt32 m_aVetoableListenerContainer; +}; + +//............................................................................. +} //namespace chart +//............................................................................. + +// CHART_WRAPPEDPROPERTYSET_HXX +#endif diff --git a/chart2/source/inc/XMLRangeHelper.hxx b/chart2/source/inc/XMLRangeHelper.hxx new file mode 100644 index 000000000000..addc8a351c29 --- /dev/null +++ b/chart2/source/inc/XMLRangeHelper.hxx @@ -0,0 +1,74 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_XMLRANGEHELPER_HXX +#define CHART2_XMLRANGEHELPER_HXX + +#include <sal/types.h> +#include <rtl/ustring.hxx> +#include "charttoolsdllapi.hxx" + +namespace chart +{ +namespace XMLRangeHelper +{ + +struct OOO_DLLPUBLIC_CHARTTOOLS Cell +{ + sal_Int32 nColumn; + sal_Int32 nRow; + bool bRelativeColumn; + bool bRelativeRow; + bool bIsEmpty; + + Cell() : + nColumn(0), + nRow(0), + bRelativeColumn(false), + bRelativeRow(false), + bIsEmpty(true) + {} + + inline bool empty() const { return bIsEmpty; } +}; + +struct OOO_DLLPUBLIC_CHARTTOOLS CellRange +{ + Cell aUpperLeft; + Cell aLowerRight; + ::rtl::OUString aTableName; +}; + +CellRange getCellRangeFromXMLString( const ::rtl::OUString & rXMLString ); + +::rtl::OUString getXMLStringFromCellRange( const CellRange & rRange ); + + +} // namespace XMLRangeHelper +} // namespace chart + +// CHART2_XMLRANGEHELPER_HXX +#endif diff --git a/chart2/source/inc/charttoolsdllapi.hxx b/chart2/source/inc/charttoolsdllapi.hxx new file mode 100644 index 000000000000..5534f2ca737c --- /dev/null +++ b/chart2/source/inc/charttoolsdllapi.hxx @@ -0,0 +1,41 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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 INCLUDED_CHART2_SOURCE_INC_CHARTTOOLSDLLAPI_HXX +#define INCLUDED_CHART2_SOURCE_INC_CHARTTOOLSDLLAPI_HXX + +#include "sal/config.h" + +#include "sal/types.h" + +#if defined OOO_DLLIMPLEMENTATION_CHARTTOOLS +#define OOO_DLLPUBLIC_CHARTTOOLS SAL_DLLPUBLIC_EXPORT +#else +#define OOO_DLLPUBLIC_CHARTTOOLS SAL_DLLPUBLIC_IMPORT +#endif + +#endif diff --git a/chart2/source/inc/chartview/ChartSfxItemIds.hxx b/chart2/source/inc/chartview/ChartSfxItemIds.hxx new file mode 100644 index 000000000000..fbcce70bd1d6 --- /dev/null +++ b/chart2/source/inc/chartview/ChartSfxItemIds.hxx @@ -0,0 +1,262 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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 CHARTSFXITEMIDS_HXX +#define CHARTSFXITEMIDS_HXX + +#include <sfx2/sfxdefs.hxx> + +/* +// header for SID_OBJ1_START +#include <sfx2/sfxsids.hrc> +*/ + +// ============================================================ +// SCHATTR +// ============================================================ + +#define SCHATTR_START 1 + +#define SCHATTR_DATADESCR_START SCHATTR_START +#define SCHATTR_DATADESCR_SHOW_NUMBER SCHATTR_DATADESCR_START +#define SCHATTR_DATADESCR_SHOW_PERCENTAGE (SCHATTR_DATADESCR_START + 1) +#define SCHATTR_DATADESCR_SHOW_CATEGORY (SCHATTR_DATADESCR_START + 2) +#define SCHATTR_DATADESCR_SHOW_SYMBOL (SCHATTR_DATADESCR_START + 3) +#define SCHATTR_DATADESCR_SEPARATOR (SCHATTR_DATADESCR_START + 4) +#define SCHATTR_DATADESCR_PLACEMENT (SCHATTR_DATADESCR_START + 5) +#define SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS (SCHATTR_DATADESCR_START + 6) +#define SCHATTR_DATADESCR_NO_PERCENTVALUE (SCHATTR_DATADESCR_START + 7) //percentage values should not be offered +#define SCHATTR_DATADESCR_END SCHATTR_DATADESCR_NO_PERCENTVALUE + +#define SCHATTR_LEGEND_START (SCHATTR_DATADESCR_END + 1) +#define SCHATTR_LEGEND_POS SCHATTR_LEGEND_START +#define SCHATTR_LEGEND_END SCHATTR_LEGEND_POS + +#define SCHATTR_TEXT_START (SCHATTR_LEGEND_END + 1) +// #define SCHATTR_TEXT_ORIENT SCHATTR_TEXT_START +// name changed: +#define SCHATTR_TEXT_STACKED SCHATTR_TEXT_START +#define SCHATTR_TEXT_ORDER (SCHATTR_TEXT_START + 1) +#define SCHATTR_TEXT_END SCHATTR_TEXT_ORDER + +#define SCHATTR_Y_AXIS_START (SCHATTR_TEXT_END + 1) +#define SCHATTR_Y_AXIS_AUTO_MIN SCHATTR_Y_AXIS_START +#define SCHATTR_Y_AXIS_MIN (SCHATTR_Y_AXIS_START + 1) +#define SCHATTR_Y_AXIS_AUTO_MAX (SCHATTR_Y_AXIS_START + 2) +#define SCHATTR_Y_AXIS_MAX (SCHATTR_Y_AXIS_START + 3) +#define SCHATTR_Y_AXIS_AUTO_STEP_MAIN (SCHATTR_Y_AXIS_START + 4) +#define SCHATTR_Y_AXIS_STEP_MAIN (SCHATTR_Y_AXIS_START + 5) +#define SCHATTR_Y_AXIS_AUTO_STEP_HELP (SCHATTR_Y_AXIS_START + 6) +#define SCHATTR_Y_AXIS_STEP_HELP (SCHATTR_Y_AXIS_START + 7) +#define SCHATTR_Y_AXIS_LOGARITHM (SCHATTR_Y_AXIS_START + 8) +#define SCHATTR_Y_AXIS_AUTO_ORIGIN (SCHATTR_Y_AXIS_START + 9) +#define SCHATTR_Y_AXIS_ORIGIN (SCHATTR_Y_AXIS_START + 10) +#define SCHATTR_Y_AXIS_END SCHATTR_Y_AXIS_ORIGIN + +#define SCHATTR_X_AXIS_START (SCHATTR_Y_AXIS_END + 1) +#define SCHATTR_X_AXIS_AUTO_MIN SCHATTR_X_AXIS_START +#define SCHATTR_X_AXIS_MIN (SCHATTR_X_AXIS_START + 1) +#define SCHATTR_X_AXIS_AUTO_MAX (SCHATTR_X_AXIS_START + 2) +#define SCHATTR_X_AXIS_MAX (SCHATTR_X_AXIS_START + 3) +#define SCHATTR_X_AXIS_AUTO_STEP_MAIN (SCHATTR_X_AXIS_START + 4) +#define SCHATTR_X_AXIS_STEP_MAIN (SCHATTR_X_AXIS_START + 5) +#define SCHATTR_X_AXIS_AUTO_STEP_HELP (SCHATTR_X_AXIS_START + 6) +#define SCHATTR_X_AXIS_STEP_HELP (SCHATTR_X_AXIS_START + 7) +#define SCHATTR_X_AXIS_LOGARITHM (SCHATTR_X_AXIS_START + 8) +#define SCHATTR_X_AXIS_AUTO_ORIGIN (SCHATTR_X_AXIS_START + 9) +#define SCHATTR_X_AXIS_ORIGIN (SCHATTR_X_AXIS_START + 10) +#define SCHATTR_X_AXIS_END SCHATTR_X_AXIS_ORIGIN + +#define SCHATTR_Z_AXIS_START (SCHATTR_X_AXIS_END + 1) +#define SCHATTR_Z_AXIS_AUTO_MIN SCHATTR_Z_AXIS_START +#define SCHATTR_Z_AXIS_MIN (SCHATTR_Z_AXIS_START + 1) +#define SCHATTR_Z_AXIS_AUTO_MAX (SCHATTR_Z_AXIS_START + 2) +#define SCHATTR_Z_AXIS_MAX (SCHATTR_Z_AXIS_START + 3) +#define SCHATTR_Z_AXIS_AUTO_STEP_MAIN (SCHATTR_Z_AXIS_START + 4) +#define SCHATTR_Z_AXIS_STEP_MAIN (SCHATTR_Z_AXIS_START + 5) +#define SCHATTR_Z_AXIS_AUTO_STEP_HELP (SCHATTR_Z_AXIS_START + 6) +#define SCHATTR_Z_AXIS_STEP_HELP (SCHATTR_Z_AXIS_START + 7) +#define SCHATTR_Z_AXIS_LOGARITHM (SCHATTR_Z_AXIS_START + 8) +#define SCHATTR_Z_AXIS_AUTO_ORIGIN (SCHATTR_Z_AXIS_START + 9) +#define SCHATTR_Z_AXIS_ORIGIN (SCHATTR_Z_AXIS_START + 10) +#define SCHATTR_Z_AXIS_END SCHATTR_Z_AXIS_ORIGIN + +// miscellaneous + +#define SCHATTR_AXISTYPE (SCHATTR_Z_AXIS_END + 1) +#define SCHATTR_PERCENT_NUMBERFORMAT_VALUE (SCHATTR_Z_AXIS_END + 2) +#define SCHATTR_PERCENT_NUMBERFORMAT_SOURCE (SCHATTR_Z_AXIS_END + 3) + +#define SCHATTR_STAT_START (SCHATTR_PERCENT_NUMBERFORMAT_SOURCE + 1) +#define SCHATTR_STAT_AVERAGE SCHATTR_STAT_START +#define SCHATTR_STAT_KIND_ERROR (SCHATTR_STAT_START + 1) +#define SCHATTR_STAT_PERCENT (SCHATTR_STAT_START + 2) +#define SCHATTR_STAT_BIGERROR (SCHATTR_STAT_START + 3) +#define SCHATTR_STAT_CONSTPLUS (SCHATTR_STAT_START + 4) +#define SCHATTR_STAT_CONSTMINUS (SCHATTR_STAT_START + 5) +#define SCHATTR_STAT_INDICATE (SCHATTR_STAT_START + 6) +#define SCHATTR_STAT_RANGE_POS (SCHATTR_STAT_START + 7) +#define SCHATTR_STAT_RANGE_NEG (SCHATTR_STAT_START + 8) +#define SCHATTR_STAT_END SCHATTR_STAT_RANGE_NEG + +#define SCHATTR_TEXT2_START ( SCHATTR_STAT_END + 1) +#define SCHATTR_TEXT_DEGREES ( SCHATTR_TEXT2_START ) +#define SCHATTR_TEXT_OVERLAP (SCHATTR_TEXT2_START +1) +#define SCHATTR_TEXT2_END ( SCHATTR_TEXT_OVERLAP ) + +// -------------------------------------------------------- +// these attributes are for replacement of enum eChartStyle +// -------------------------------------------------------- + +#define SCHATTR_STYLE_START ( SCHATTR_TEXT2_END +1 ) + +// for whole chart +#define SCHATTR_STYLE_DEEP ( SCHATTR_STYLE_START ) +#define SCHATTR_STYLE_3D ( SCHATTR_STYLE_START + 1 ) +#define SCHATTR_STYLE_VERTICAL ( SCHATTR_STYLE_START + 2 ) + +// also for series +#define SCHATTR_STYLE_BASETYPE ( SCHATTR_STYLE_START + 3 )// Line,Area,...,Pie +#define SCHATTR_STYLE_LINES ( SCHATTR_STYLE_START + 4 )// draw line +#define SCHATTR_STYLE_PERCENT ( SCHATTR_STYLE_START + 5 ) +#define SCHATTR_STYLE_STACKED ( SCHATTR_STYLE_START + 6 ) +#define SCHATTR_STYLE_SPLINES ( SCHATTR_STYLE_START + 7 ) + +// also for data point +#define SCHATTR_STYLE_SYMBOL ( SCHATTR_STYLE_START + 8 ) +#define SCHATTR_STYLE_SHAPE ( SCHATTR_STYLE_START + 9 ) +#define SCHATTR_STYLE_END ( SCHATTR_STYLE_SHAPE ) + +// -------------------------------------------------------------------------- + +#define SCHATTR_AXIS (SCHATTR_STYLE_END + 1)// see chtmodel.hxx defines CHART_AXIS_PRIMARY_X, etc. +//Ummappen: +#define SCHATTR_AXIS_START (SCHATTR_AXIS + 1) +#define SCHATTR_AXIS_AUTO_MIN SCHATTR_AXIS_START +#define SCHATTR_AXIS_MIN (SCHATTR_AXIS_START + 1) +#define SCHATTR_AXIS_AUTO_MAX (SCHATTR_AXIS_START + 2) +#define SCHATTR_AXIS_MAX (SCHATTR_AXIS_START + 3) +#define SCHATTR_AXIS_AUTO_STEP_MAIN (SCHATTR_AXIS_START + 4) +#define SCHATTR_AXIS_STEP_MAIN (SCHATTR_AXIS_START + 5) +#define SCHATTR_AXIS_AUTO_STEP_HELP (SCHATTR_AXIS_START + 6) +// SCHATTR_AXIS_STEP_HELP: type changed from double to sal_Int32 ! +#define SCHATTR_AXIS_STEP_HELP (SCHATTR_AXIS_START + 7) +#define SCHATTR_AXIS_LOGARITHM (SCHATTR_AXIS_START + 8) +#define SCHATTR_AXIS_AUTO_ORIGIN (SCHATTR_AXIS_START + 9) +#define SCHATTR_AXIS_ORIGIN (SCHATTR_AXIS_START + 10) +//Neu: +#define SCHATTR_AXIS_TICKS (SCHATTR_AXIS_START + 11) +#define SCHATTR_AXIS_NUMFMT (SCHATTR_AXIS_START + 12) +#define SCHATTR_AXIS_NUMFMTPERCENT (SCHATTR_AXIS_START + 13) +#define SCHATTR_AXIS_SHOWAXIS (SCHATTR_AXIS_START + 14) +#define SCHATTR_AXIS_SHOWDESCR (SCHATTR_AXIS_START + 15) +#define SCHATTR_AXIS_SHOWMAINGRID (SCHATTR_AXIS_START + 16) +#define SCHATTR_AXIS_SHOWHELPGRID (SCHATTR_AXIS_START + 17) +#define SCHATTR_AXIS_TOPDOWN (SCHATTR_AXIS_START + 18) +#define SCHATTR_AXIS_HELPTICKS (SCHATTR_AXIS_START + 19) +#define SCHATTR_AXIS_REVERSE (SCHATTR_AXIS_START + 20) +#define SCHATTR_AXIS_POSITION (SCHATTR_AXIS_START + 21) +#define SCHATTR_AXIS_POSITION_VALUE (SCHATTR_AXIS_START + 22) +#define SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT (SCHATTR_AXIS_START + 23) +#define SCHATTR_AXIS_LABEL_POSITION (SCHATTR_AXIS_START + 24) +#define SCHATTR_AXIS_MARK_POSITION (SCHATTR_AXIS_START + 25) +#define SCHATTR_AXIS_END SCHATTR_AXIS_MARK_POSITION + +#define SCHATTR_SYMBOL_BRUSH (SCHATTR_AXIS_END + 1) +#define SCHATTR_STOCK_VOLUME (SCHATTR_AXIS_END + 2) +#define SCHATTR_STOCK_UPDOWN (SCHATTR_AXIS_END + 3) +#define SCHATTR_SYMBOL_SIZE (SCHATTR_AXIS_END + 4) + +// non persistent items (binary format) +#define SCHATTR_CHARTTYPE_START (SCHATTR_SYMBOL_SIZE + 1) + +// new from New Chart +#define SCHATTR_BAR_OVERLAP (SCHATTR_CHARTTYPE_START ) +#define SCHATTR_BAR_GAPWIDTH (SCHATTR_CHARTTYPE_START + 1) +#define SCHATTR_BAR_CONNECT (SCHATTR_CHARTTYPE_START + 2) +#define SCHATTR_NUM_OF_LINES_FOR_BAR (SCHATTR_CHARTTYPE_START + 3) +#define SCHATTR_SPLINE_ORDER (SCHATTR_CHARTTYPE_START + 4) +#define SCHATTR_SPLINE_RESOLUTION (SCHATTR_CHARTTYPE_START + 5) +#define SCHATTR_DIAGRAM_STYLE (SCHATTR_CHARTTYPE_START + 6) +#define SCHATTR_TEXTBREAK (SCHATTR_CHARTTYPE_START + 7) +#define SCHATTR_GROUP_BARS_PER_AXIS (SCHATTR_CHARTTYPE_START + 8) +#define SCHATTR_STARTING_ANGLE (SCHATTR_CHARTTYPE_START + 9) +#define SCHATTR_CLOCKWISE (SCHATTR_CHARTTYPE_START + 10) +#define SCHATTR_MISSING_VALUE_TREATMENT (SCHATTR_CHARTTYPE_START + 11) +#define SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS (SCHATTR_CHARTTYPE_START + 12) +#define SCHATTR_INCLUDE_HIDDEN_CELLS (SCHATTR_CHARTTYPE_START + 13) + +#define SCHATTR_CHARTTYPE_END SCHATTR_INCLUDE_HIDDEN_CELLS + +// items for transporting information to dialogs +#define SCHATTR_MISC_START (SCHATTR_CHARTTYPE_END + 1) +#define SCHATTR_AXIS_FOR_ALL_SERIES (SCHATTR_MISC_START) +#define SCHATTR_MISC_END SCHATTR_AXIS_FOR_ALL_SERIES + +// regression curve equation +#define SCHATTR_REGRESSION_START (SCHATTR_MISC_END + 1) +#define SCHATTR_REGRESSION_TYPE SCHATTR_REGRESSION_START +#define SCHATTR_REGRESSION_SHOW_EQUATION (SCHATTR_REGRESSION_START + 1) +#define SCHATTR_REGRESSION_SHOW_COEFF (SCHATTR_REGRESSION_START + 2) +#define SCHATTR_REGRESSION_END SCHATTR_REGRESSION_SHOW_COEFF + +#define SCHATTR_END SCHATTR_REGRESSION_END + +// ============================================================ +// values for Items +// ============================================================ + +// values for SCHATTR_AXIS_TICKS and SCHATTR_AXIS_HELPTICKS items +#define CHAXIS_MARK_BOTH 3 +#define CHAXIS_MARK_OUTER 2 +#define CHAXIS_MARK_INNER 1 +#define CHAXIS_MARK_NONE 0 + +// values for SCHATTR_AXISTYPE items +#define CHART_AXIS_X 0 +#define CHART_AXIS_Y 1 +#define CHART_AXIS_Z 2 + +// values for SCHATTR_STYLE_SHAPE items +#define CHART_SHAPE3D_IGNORE -2 //intern! (GetChartShapeStyle()!) +#define CHART_SHAPE3D_ANY -1 //undefinierter Typ (GetChartShapeStyle()!) +#define CHART_SHAPE3D_SQUARE 0 +#define CHART_SHAPE3D_CYLINDER 1 +#define CHART_SHAPE3D_CONE 2 +#define CHART_SHAPE3D_PYRAMID 3 //reserved +#define CHART_SHAPE3D_HANOI 4 + +// values for SCHATTR_AXIS items +#define CHART_AXIS_PRIMARY_X 1 +#define CHART_AXIS_PRIMARY_Y 2 +#define CHART_AXIS_PRIMARY_Z 3 +#define CHART_AXIS_SECONDARY_Y 4 +#define CHART_AXIS_SECONDARY_X 5 + +// ============================================================ +// ============================================================ + +#endif diff --git a/chart2/source/inc/chartview/DataPointSymbolSupplier.hxx b/chart2/source/inc/chartview/DataPointSymbolSupplier.hxx new file mode 100644 index 000000000000..4d07791a884f --- /dev/null +++ b/chart2/source/inc/chartview/DataPointSymbolSupplier.hxx @@ -0,0 +1,59 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_DATAPOINTSYMBOLSUPPLIER_HXX +#define _CHART2_DATAPOINTSYMBOLSUPPLIER_HXX + +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include <com/sun/star/drawing/Direction3D.hpp> +#include <com/sun/star/drawing/XShapes.hpp> +#include "chartviewdllapi.hxx" + +//............................................................................. +namespace chart +{ +//............................................................................. + +//----------------------------------------------------------------------------- +/** +*/ + +class OOO_DLLPUBLIC_CHARTVIEW DataPointSymbolSupplier +{ +public: + static ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > + create2DSymbolList( ::com::sun::star::uno::Reference< + ::com::sun::star::lang::XMultiServiceFactory > xShapeFactory + , const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShapes >& xTarget + , const ::com::sun::star::drawing::Direction3D& rSize ); +}; + +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/chartview/DrawModelWrapper.hxx b/chart2/source/inc/chartview/DrawModelWrapper.hxx new file mode 100644 index 000000000000..5bcf67a8592b --- /dev/null +++ b/chart2/source/inc/chartview/DrawModelWrapper.hxx @@ -0,0 +1,114 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_DRAWMODELWRAPPER_HXX +#define _CHART2_DRAWMODELWRAPPER_HXX + +//---- +#include <svx/svdmodel.hxx> +// header for class SdrObject +#include <svx/svdobj.hxx> + +//---- +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/uno/XComponentContext.hpp> +#include <com/sun/star/drawing/XDrawPage.hpp> +#include <com/sun/star/lang/XMultiServiceFactory.hpp> +#include "chartviewdllapi.hxx" + +//............................................................................. +namespace chart +{ +//............................................................................. + +class OOO_DLLPUBLIC_CHARTVIEW DrawModelWrapper : private SdrModel +{ +private: + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiComponentFactory > m_xMCF; + SfxItemPool* m_pChartItemPool; + + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > m_xMainDrawPage; + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > m_xHiddenDrawPage; + + std::auto_ptr< OutputDevice > m_apRefDevice; + + //no default constructor + DrawModelWrapper(); + +public: + SAL_DLLPRIVATE DrawModelWrapper(::com::sun::star::uno::Reference< + ::com::sun::star::uno::XComponentContext > const & xContext ); + SAL_DLLPRIVATE virtual ~DrawModelWrapper(); + + ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > getShapeFactory(); + + // the main page will contain the normal view objects + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > getMainDrawPage(); + SAL_DLLPRIVATE void clearMainDrawPage(); + + // the extra page is not visible, but contains some extras like the symbols for data points + ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XDrawPage > getHiddenDrawPage(); + + static ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes > + getChartRootShape( const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XDrawPage>& xPage ); + + + SAL_DLLPRIVATE void lockControllers(); + SAL_DLLPRIVATE void unlockControllers(); + + /// tries to get an OutputDevice from the XParent of the model to use as reference device + SAL_DLLPRIVATE void attachParentReferenceDevice( + const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > & xChartModel ); + + OutputDevice* getReferenceDevice() const; + + SfxItemPool& GetItemPool(); + SAL_DLLPRIVATE const SfxItemPool& GetItemPool() const; + + SAL_DLLPRIVATE virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > + createUnoModel(); + SAL_DLLPRIVATE ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > + getUnoModel(); + SdrModel& getSdrModel(); + + XColorTable* GetColorTable() const; + XDashList* GetDashList() const; + XLineEndList* GetLineEndList() const; + XGradientList* GetGradientList() const; + XHatchList* GetHatchList() const; + XBitmapList* GetBitmapList() const; + + SdrObject* getNamedSdrObject( const rtl::OUString& rName ); + static SdrObject* getNamedSdrObject( const String& rName, SdrObjList* pObjList ); + + static bool removeShape( const ::com::sun::star::uno::Reference< + ::com::sun::star::drawing::XShape >& xShape ); +}; +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/chartview/ExplicitValueProvider.hxx b/chart2/source/inc/chartview/ExplicitValueProvider.hxx new file mode 100644 index 000000000000..d10ee8d415fc --- /dev/null +++ b/chart2/source/inc/chartview/ExplicitValueProvider.hxx @@ -0,0 +1,119 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_EXPLICITVALUEPROVIDER_HXX +#define _CHART2_EXPLICITVALUEPROVIDER_HXX + +#include <boost/shared_ptr.hpp> +#include <com/sun/star/chart2/ExplicitIncrementData.hpp> +#include <com/sun/star/chart2/ExplicitScaleData.hpp> +#include <com/sun/star/chart2/XAxis.hpp> +#include <com/sun/star/chart2/XCoordinateSystem.hpp> +#include <com/sun/star/chart2/XDataSeries.hpp> +#include <com/sun/star/chart2/XDiagram.hpp> +#include <com/sun/star/awt/Rectangle.hpp> +#include <com/sun/star/frame/XModel.hpp> +#include <com/sun/star/drawing/XShape.hpp> +#include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#include "chartviewdllapi.hxx" + +//............................................................................. +namespace chart +{ +//............................................................................. + +//----------------------------------------------------------------------------- +/** +*/ + +class DrawModelWrapper; +class OOO_DLLPUBLIC_CHARTVIEW ExplicitValueProvider +{ +public: + /** Gives calculated scale and increment values for a given xAxis in the current view. + In contrast to the model data these explicit values are always complete as misssing auto properties are calculated. + If the given Axis could not be found or for another reason no correct output can be given false is returned. + */ + virtual sal_Bool getExplicitValuesForAxis( + ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis > xAxis + , ::com::sun::star::chart2::ExplicitScaleData& rExplicitScale + , ::com::sun::star::chart2::ExplicitIncrementData& rExplicitIncrement )=0; + + /** for rotated objects the shape size and position differs from the visible rectangle + if bSnapRect is set to true you get the resulting visible position (left-top) and size + */ + virtual ::com::sun::star::awt::Rectangle + getRectangleOfObject( const rtl::OUString& rObjectCID, bool bSnapRect=false )=0; + + virtual ::com::sun::star::awt::Rectangle getDiagramRectangleExcludingAxes()=0; + + virtual ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > + getShapeForCID( const rtl::OUString& rObjectCID )=0; + + virtual ::boost::shared_ptr< DrawModelWrapper > getDrawModelWrapper() = 0; + + static const com::sun::star::uno::Sequence<sal_Int8>& getUnoTunnelId(); + static ExplicitValueProvider* getExplicitValueProvider( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xChartView ); + + static ::com::sun::star::awt::Rectangle + addAxisTitleSizes( + const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel + , const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface >& xChartView + , const ::com::sun::star::awt::Rectangle& rExcludingPositionAndSize ); + + static ::com::sun::star::awt::Rectangle + substractAxisTitleSizes( + const ::com::sun::star::uno::Reference< + ::com::sun::star::frame::XModel >& xChartModel + , const ::com::sun::star::uno::Reference< + ::com::sun::star::uno::XInterface >& xChartView + , const ::com::sun::star::awt::Rectangle& rPositionAndSizeIncludingTitles ); + + static sal_Int32 getExplicitNumberFormatKeyForAxis( + const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XAxis >& xAxis + , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem + , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier ); + + SAL_DLLPRIVATE static sal_Int32 getPercentNumberFormat( const ::com::sun::star::uno::Reference< + ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier ); + + static sal_Int32 getExplicitNumberFormatKeyForDataLabel( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesOrPointProp + , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDataSeries >& xSeries + , sal_Int32 nPointIndex /*-1 for whole series*/ + , const ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XDiagram >& xDiagram ); + + static sal_Int32 getExplicitPercentageNumberFormatKeyForDataLabel( + const ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet >& xSeriesOrPointProp + , const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xNumberFormatsSupplier ); +}; + +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/chartview/NumberFormatterWrapper.hxx b/chart2/source/inc/chartview/NumberFormatterWrapper.hxx new file mode 100644 index 000000000000..9f5f44107997 --- /dev/null +++ b/chart2/source/inc/chartview/NumberFormatterWrapper.hxx @@ -0,0 +1,82 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_VIEW_NUMBERFORMATTERWRAPPER_HXX +#define _CHART2_VIEW_NUMBERFORMATTERWRAPPER_HXX + +#include <svl/zforlist.hxx> +#include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#include "chartviewdllapi.hxx" + +//............................................................................. +namespace chart +{ +//............................................................................. + +//----------------------------------------------------------------------------- +/** +*/ +class FixedNumberFormatter; + +class OOO_DLLPUBLIC_CHARTVIEW NumberFormatterWrapper +{ +public: + NumberFormatterWrapper( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xSupplier ); + virtual ~NumberFormatterWrapper(); + + SvNumberFormatter* getSvNumberFormatter() const; + ::com::sun::star::uno::Reference< com::sun::star::util::XNumberFormatsSupplier > + getNumberFormatsSupplier() { return m_xNumberFormatsSupplier; }; + + rtl::OUString getFormattedString( sal_Int32 nNumberFormatKey, double fValue, sal_Int32& rLabelColor, bool& rbColorChanged ) const; + +private: //private member + ::com::sun::star::uno::Reference< com::sun::star::util::XNumberFormatsSupplier > + m_xNumberFormatsSupplier; + + SvNumberFormatter* m_pNumberFormatter; + ::com::sun::star::uno::Any m_aNullDate; +}; + + +class FixedNumberFormatter +{ +public: + FixedNumberFormatter( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XNumberFormatsSupplier >& xSupplier + , sal_Int32 nNumberFormatKey ); + virtual ~FixedNumberFormatter(); + + rtl::OUString getFormattedString( double fValue, sal_Int32& rLabelColor, bool& rbColorChanged ) const; + +private: + NumberFormatterWrapper m_aNumberFormatterWrapper; + ULONG m_nNumberFormatKey; +}; + +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/chartview/chartviewdllapi.hxx b/chart2/source/inc/chartview/chartviewdllapi.hxx new file mode 100644 index 000000000000..39c553a15fe6 --- /dev/null +++ b/chart2/source/inc/chartview/chartviewdllapi.hxx @@ -0,0 +1,41 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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 INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_CHARTVIEWDLLAPI_HXX +#define INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_CHARTVIEWDLLAPI_HXX + +#include "sal/config.h" + +#include "sal/types.h" + +#if defined OOO_DLLIMPLEMENTATION_CHARTVIEW +#define OOO_DLLPUBLIC_CHARTVIEW SAL_DLLPUBLIC_EXPORT +#else +#define OOO_DLLPUBLIC_CHARTVIEW SAL_DLLPUBLIC_IMPORT +#endif + +#endif diff --git a/chart2/source/inc/chartview/servicenames_charttypes.hxx b/chart2/source/inc/chartview/servicenames_charttypes.hxx new file mode 100644 index 000000000000..bd52c33f51ec --- /dev/null +++ b/chart2/source/inc/chartview/servicenames_charttypes.hxx @@ -0,0 +1,47 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SERVICENAMES_CHARTTYPES_HXX +#define _CHART2_SERVICENAMES_CHARTTYPES_HXX + +//............................................................................. +namespace chart +{ +//............................................................................. + +#define CHART2_VIEW_BARCHART_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.view.BarChart_Impl") +#define CHART2_VIEW_BARCHART_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.view.BarChart") + +#define CHART2_VIEW_PIECHART_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.view.PieChart_Impl") +#define CHART2_VIEW_PIECHART_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.view.PieChart") + +#define CHART2_VIEW_AREACHART_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.view.AreaChart_Impl") +#define CHART2_VIEW_AREACHART_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.view.AreaChart") + +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/exports.dxp b/chart2/source/inc/exports.dxp new file mode 100644 index 000000000000..9630d7e06768 --- /dev/null +++ b/chart2/source/inc/exports.dxp @@ -0,0 +1,3 @@ +component_getImplementationEnvironment +component_writeInfo +component_getFactory diff --git a/chart2/source/inc/macros.hxx b/chart2/source/inc/macros.hxx new file mode 100644 index 000000000000..ac64e879e9ec --- /dev/null +++ b/chart2/source/inc/macros.hxx @@ -0,0 +1,53 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_MACROS_HXX +#define CHART_MACROS_HXX + +#include <typeinfo> + +/// creates a unicode-string from an ASCII string +#define C2U(constAsciiStr) (::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( constAsciiStr ) )) + +/** shows an error-box for an exception ex + else-branch necessary to avoid warning +*/ +#if OSL_DEBUG_LEVEL > 0 +#define ASSERT_EXCEPTION(ex) \ + OSL_ENSURE( false, ::rtl::OUStringToOString( \ + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Exception caught. Type: " )) +\ + ::rtl::OUString::createFromAscii( typeid( ex ).name()) +\ + ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( ", Message: " )) +\ + ex.Message, RTL_TEXTENCODING_ASCII_US ).getStr()) +#else +//avoid compilation warnings +#define ASSERT_EXCEPTION(ex) (void)(ex) +#endif + +#define U2C(ouString) (::rtl::OUStringToOString(ouString,RTL_TEXTENCODING_ASCII_US).getStr()) + +// CHART_MACROS_HXX +#endif diff --git a/chart2/source/inc/servicenames.hxx b/chart2/source/inc/servicenames.hxx new file mode 100644 index 000000000000..d1af0edb3335 --- /dev/null +++ b/chart2/source/inc/servicenames.hxx @@ -0,0 +1,71 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SERVICENAMES_HXX +#define _CHART_SERVICENAMES_HXX + +//............................................................................. +namespace chart +{ +//............................................................................. + +#define CHART_MODEL_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.ChartModel") +#define CHART_MODEL_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.ChartDocument") +//@todo create your own service containing the service com.sun.star.document.OfficeDocument + +#define CHART_CONTROLLER_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.ChartController") +#define CHART_CONTROLLER_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.ChartController") +//@todo create your own service containing the service com.sun.star.frame.Controller + +#define CHART_VIEW_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.ChartView") +#define CHART_VIEW_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.ChartView") + +#define CHART_FRAMELOADER_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.ChartFrameLoader") +#define CHART_FRAMELOADER_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.frame.SynchronousFrameLoader") + +#define CHART_WIZARD_DIALOG_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.WizardDialog") +#define CHART_WIZARD_DIALOG_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.WizardDialog") + +#define CHART_TYPE_DIALOG_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.ChartTypeDialog") +#define CHART_TYPE_DIALOG_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.ChartTypeDialog") + +// wrapper for old UNO API (com.sun.star.chart) +#define CHART_CHARTAPIWRAPPER_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.ChartDocumentWrapper") +#define CHART_CHARTAPIWRAPPER_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.ChartDocumentWrapper") + +// accessibility +#define CHART_ACCESSIBLE_TEXT_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.AccessibleTextComponent") +#define CHART_ACCESSIBLE_TEXT_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.accessibility.AccessibleTextComponent") + +#define CHART_RENDERER_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.comp.chart2.ChartRenderer") + +#define CHART_UNDOMANAGER_SERVICE_NAME ::rtl::OUString::createFromAscii( "com.sun.star.chart2.UndoManager" ) + +//............................................................................. +} //namespace chart +//............................................................................. + +#endif diff --git a/chart2/source/inc/servicenames_charttypes.hxx b/chart2/source/inc/servicenames_charttypes.hxx new file mode 100644 index 000000000000..60e39bccf09a --- /dev/null +++ b/chart2/source/inc/servicenames_charttypes.hxx @@ -0,0 +1,49 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SERVICENAMES_CHARTTYPES_HXX +#define _CHART2_SERVICENAMES_CHARTTYPES_HXX + +//............................................................................. +namespace chart +{ +//............................................................................. + +#define CHART2_SERVICE_NAME_CHARTTYPE_AREA ::rtl::OUString::createFromAscii("com.sun.star.chart2.AreaChartType") +#define CHART2_SERVICE_NAME_CHARTTYPE_BAR ::rtl::OUString::createFromAscii("com.sun.star.chart2.BarChartType") +#define CHART2_SERVICE_NAME_CHARTTYPE_COLUMN ::rtl::OUString::createFromAscii("com.sun.star.chart2.ColumnChartType") +#define CHART2_SERVICE_NAME_CHARTTYPE_LINE ::rtl::OUString::createFromAscii("com.sun.star.chart2.LineChartType") +#define CHART2_SERVICE_NAME_CHARTTYPE_SCATTER ::rtl::OUString::createFromAscii("com.sun.star.chart2.ScatterChartType") +#define CHART2_SERVICE_NAME_CHARTTYPE_PIE ::rtl::OUString::createFromAscii("com.sun.star.chart2.PieChartType") +#define CHART2_SERVICE_NAME_CHARTTYPE_NET ::rtl::OUString::createFromAscii("com.sun.star.chart2.NetChartType") +#define CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET ::rtl::OUString::createFromAscii("com.sun.star.chart2.FilledNetChartType") +#define CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK ::rtl::OUString::createFromAscii("com.sun.star.chart2.CandleStickChartType") +#define CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE ::rtl::OUString::createFromAscii("com.sun.star.chart2.BubbleChartType") + +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/servicenames_coosystems.hxx b/chart2/source/inc/servicenames_coosystems.hxx new file mode 100644 index 000000000000..002f75c7ece6 --- /dev/null +++ b/chart2/source/inc/servicenames_coosystems.hxx @@ -0,0 +1,43 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SERVICENAMES_COOSYSTEMS_HXX +#define _CHART2_SERVICENAMES_COOSYSTEMS_HXX + +//............................................................................. +namespace chart +{ +//............................................................................. + +#define CHART2_COOSYSTEM_CARTESIAN_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.CoordinateSystems.Cartesian") +#define CHART2_COOSYSTEM_CARTESIAN_VIEW_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.CoordinateSystems.CartesianView") +#define CHART2_COOSYSTEM_POLAR_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.CoordinateSystems.Polar") +#define CHART2_COOSYSTEM_POLAR_VIEW_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.CoordinateSystems.PolarView") + +//............................................................................. +} //namespace chart +//............................................................................. +#endif diff --git a/chart2/source/inc/servicenames_dlwrapper.hxx b/chart2/source/inc/servicenames_dlwrapper.hxx new file mode 100644 index 000000000000..0b78a8c8227f --- /dev/null +++ b/chart2/source/inc/servicenames_dlwrapper.hxx @@ -0,0 +1,41 @@ +/************************************************************************* + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * Copyright 2000, 2010 Oracle and/or its affiliates. + * + * OpenOffice.org - a multi-platform office productivity suite + * + * 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_SERVICENAMES_DLWRAPPER_HXX +#define _CHART2_SERVICENAMES_DLWRAPPER_HXX + +//............................................................................. +namespace chart +{ +//............................................................................. + +#define CHART2_VIEW_DLWRAPPER_SERVICE_IMPLEMENTATION_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.DrawModelWrapper") +#define CHART2_VIEW_DLWRAPPER_SERVICE_NAME ::rtl::OUString::createFromAscii("com.sun.star.chart2.DrawModelWrapper") + +//............................................................................. +} //namespace chart +//............................................................................. +#endif |