diff options
Diffstat (limited to 'chart2/source/inc')
88 files changed, 9108 insertions, 0 deletions
diff --git a/chart2/source/inc/AxisHelper.hxx b/chart2/source/inc/AxisHelper.hxx new file mode 100644 index 000000000..2097d216b --- /dev/null +++ b/chart2/source/inc/AxisHelper.hxx @@ -0,0 +1,208 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_AXISHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_AXISHELPER_HXX + +#include "charttoolsdllapi.hxx" +#include <com/sun/star/chart2/ScaleData.hpp> + +#include <vector> + +namespace chart { class ChartModel; } +namespace chart { class ExplicitCategoriesProvider; } +namespace chart { class ReferenceSizeProvider; } +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::chart2 { class XAxis; } +namespace com::sun::star::chart2 { class XChartDocument; } +namespace com::sun::star::chart2 { class XChartType; } +namespace com::sun::star::chart2 { class XCoordinateSystem; } +namespace com::sun::star::chart2 { class XDiagram; } +namespace com::sun::star::chart2 { class XScaling; } +namespace com::sun::star::uno { class XComponentContext; } + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS AxisHelper +{ +public: + static css::uno::Reference< css::chart2::XScaling > createLinearScaling(); + static css::uno::Reference< css::chart2::XScaling > createLogarithmicScaling( double fBase = 10.0 ); + + static css::chart2::ScaleData createDefaultScale(); + + static void removeExplicitScaling( css::chart2::ScaleData& rScaleData ); + + static bool isLogarithmic( const css::uno::Reference< css::chart2::XScaling >& xScaling ); + + static void checkDateAxis( css::chart2::ScaleData& rScale, ExplicitCategoriesProvider* pExplicitCategoriesProvider, bool bChartTypeAllowsDateAxis ); + static css::chart2::ScaleData getDateCheckedScale( const css::uno::Reference< css::chart2::XAxis >& xAxis, ChartModel& rModel ); + + static sal_Int32 getExplicitNumberFormatKeyForAxis( + const css::uno::Reference< css::chart2::XAxis >& xAxis + , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCorrespondingCoordinateSystem + , const css::uno::Reference< css::chart2::XChartDocument>& xChartDoc + , bool bSearchForParallelAxisIfNothingIsFound ); + + static css::uno::Reference< + css::chart2::XAxis > + createAxis( sal_Int32 nDimensionIndex, bool bMainAxis + , const css::uno::Reference< css::chart2::XDiagram >& xDiagram + , const css::uno::Reference< css::uno::XComponentContext >& xContext + , ReferenceSizeProvider * pRefSizeProvider = nullptr ); + + static css::uno::Reference< css::chart2::XAxis > + createAxis( + sal_Int32 nDimensionIndex + , sal_Int32 nAxisIndex // 0==main or 1==secondary axis + , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys + , const css::uno::Reference< css::uno::XComponentContext > & xContext + , ReferenceSizeProvider * pRefSizeProvider = nullptr ); + + static void showAxis( sal_Int32 nDimensionIndex, bool bMainAxis + , const css::uno::Reference< css::chart2::XDiagram >& xDiagram + , const css::uno::Reference< css::uno::XComponentContext >& xContext + , ReferenceSizeProvider * pRefSizeProvider = nullptr ); + + static void showGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid + , const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + + static void hideAxis( sal_Int32 nDimensionIndex, bool bMainAxis + , const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + static void hideGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid + , const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + + static bool isAxisShown( sal_Int32 nDimensionIndex, bool bMainAxis + , const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + static bool isGridShown( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid + , const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + + static void makeAxisVisible( const css::uno::Reference< css::chart2::XAxis >& xAxis ); + static void makeGridVisible( const css::uno::Reference< css::beans::XPropertySet >& xGridProperties ); + + static void makeAxisInvisible( const css::uno::Reference< css::chart2::XAxis >& xAxis ); + static void makeGridInvisible( const css::uno::Reference< css::beans::XPropertySet >& xGridProperties ); + + static void hideAxisIfNoDataIsAttached( const css::uno::Reference< css::chart2::XAxis >& xAxis + , const css::uno::Reference< css::chart2::XDiagram >& xDiagram); + + SAL_DLLPRIVATE static bool areAxisLabelsVisible( const css::uno::Reference< css::beans::XPropertySet >& xAxisProperties ); + static bool isAxisVisible( const css::uno::Reference< css::chart2::XAxis >& xAxis ); + static bool isGridVisible( const css::uno::Reference< css::beans::XPropertySet >& xGridProperties ); + + static css::uno::Reference< css::chart2::XCoordinateSystem > + getCoordinateSystemByIndex( + const css::uno::Reference< css::chart2::XDiagram >& xDiagram + , sal_Int32 nIndex ); + + static css::uno::Reference< css::chart2::XCoordinateSystem > + getCoordinateSystemOfAxis( + const css::uno::Reference< css::chart2::XAxis >& xAxis + , const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + + static css::uno::Reference< css::chart2::XAxis > + getAxis( sal_Int32 nDimensionIndex, bool bMainAxis + , const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + static css::uno::Reference< css::chart2::XAxis > + getAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex + , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys ); + + static css::uno::Reference< css::chart2::XAxis > + getCrossingMainAxis( const css::uno::Reference< css::chart2::XAxis >& xAxis + , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys ); + + static css::uno::Reference< css::chart2::XAxis > + getParallelAxis( const css::uno::Reference< css::chart2::XAxis >& xAxis + , const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + + static css::uno::Reference< css::beans::XPropertySet > + getGridProperties( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys + , sal_Int32 nDimensionIndex + , sal_Int32 nAxisIndex //0: Primary axis, 1: secondary axis + , sal_Int32 nSubGridIndex //-1: Main Grid; 0: First SubGrid etc + ); + + static sal_Int32 getDimensionIndexOfAxis( + const css::uno::Reference< css::chart2::XAxis >& xAxis + , const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + + static bool getIndicesForAxis( + const css::uno::Reference< css::chart2::XAxis >& xAxis + , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys + , sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex ); + + static bool getIndicesForAxis( + const css::uno::Reference< css::chart2::XAxis >& xAxis + , const css::uno::Reference< css::chart2::XDiagram >& xDiagram + , sal_Int32& rOutCooSysIndex, sal_Int32& rOutDimensionIndex, sal_Int32& rOutAxisIndex ); + + /** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to + </sal_True> are returned + */ + static css::uno::Sequence< css::uno::Reference< css::chart2::XAxis > > + getAllAxesOfDiagram( const css::uno::Reference< css::chart2::XDiagram >& xDiagram + , bool bOnlyVisible = false ); + + /** @param bOnlyVisible if </TRUE>, only axes with property "Show" set to + </sal_True> are returned + */ + SAL_DLLPRIVATE static std::vector< css::uno::Reference< css::chart2::XAxis > > + getAllAxesOfCoordinateSystem( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys + , bool bOnlyVisible = false ); + + static css::uno::Sequence< css::uno::Reference< css::beans::XPropertySet > > + getAllGrids( const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + + static void getAxisOrGridPossibilities( css::uno::Sequence< sal_Bool >& rPossibilityList + , const css::uno::Reference< css::chart2::XDiagram>& xDiagram, bool bAxis=true ); + + static void getAxisOrGridExcistence( css::uno::Sequence< sal_Bool >& rExcistenceList + , const css::uno::Reference< css::chart2::XDiagram>& xDiagram, bool bAxis=true ); + + static bool changeVisibilityOfGrids( const css::uno::Reference< css::chart2::XDiagram>& xDiagram + , const css::uno::Sequence< sal_Bool >& rOldExistenceList + , const css::uno::Sequence< sal_Bool >& rNewExistenceList ); + + static bool changeVisibilityOfAxes( const css::uno::Reference< css::chart2::XDiagram>& xDiagram + , const css::uno::Sequence< sal_Bool >& rOldExistenceList + , const css::uno::Sequence< sal_Bool >& rNewExistenceList + , const css::uno::Reference< css::uno::XComponentContext >& xContext + , ReferenceSizeProvider * pRefSizeProvider ); + + static bool shouldAxisBeDisplayed( const css::uno::Reference< css::chart2::XAxis >& xAxis + , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys ); + static bool isSecondaryYAxisNeeded( const css::uno::Reference< + css::chart2::XCoordinateSystem >& xCooSys ); + + static css::uno::Reference< css::chart2::XChartType > + getChartTypeByIndex( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys, + sal_Int32 nIndex ); + + static void setRTLAxisLayout( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys ); + + static css::uno::Reference< css::chart2::XChartType > + getFirstChartTypeWithSeriesAttachedToAxisIndex( const css::uno::Reference< css::chart2::XDiagram >& xDiagram, const sal_Int32 nAttachedAxisIndex ); + + static bool isAxisPositioningEnabled(); +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/AxisIndexDefines.hxx b/chart2/source/inc/AxisIndexDefines.hxx new file mode 100644 index 000000000..779f8fc7f --- /dev/null +++ b/chart2/source/inc/AxisIndexDefines.hxx @@ -0,0 +1,33 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_AXISINDEXDEFINES_HXX +#define INCLUDED_CHART2_SOURCE_INC_AXISINDEXDEFINES_HXX + +#include <sal/types.h> + +namespace chart +{ +const sal_Int32 MAIN_AXIS_INDEX = 0; +const sal_Int32 SECONDARY_AXIS_INDEX = 1; + +} // namespace chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/BaseGFXHelper.hxx b/chart2/source/inc/BaseGFXHelper.hxx new file mode 100644 index 000000000..014371bfa --- /dev/null +++ b/chart2/source/inc/BaseGFXHelper.hxx @@ -0,0 +1,89 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_BASEGFXHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_BASEGFXHELPER_HXX + +#include <basegfx/matrix/b3dhommatrix.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/Size.hpp> +#include <com/sun/star/drawing/HomogenMatrix.hpp> +#include <com/sun/star/drawing/Direction3D.hpp> +#include <com/sun/star/drawing/Position3D.hpp> +#include "charttoolsdllapi.hxx" + +namespace com::sun::star::awt { struct Rectangle; } +namespace com::sun::star::drawing { struct PolyPolygonShape3D; } + +namespace chart +{ +namespace BaseGFXHelper +{ + +OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DRange getBoundVolume( const css::drawing::PolyPolygonShape3D& rPolyPoly ); + +OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B2IRectangle makeRectangle( + const css::awt::Point& rPosition, + const css::awt::Size& rSize ); + +OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B2IRectangle makeRectangle( const css::awt::Rectangle& rRect ); + +OOO_DLLPUBLIC_CHARTTOOLS css::awt::Point B2IRectangleToAWTPoint( + const ::basegfx::B2IRectangle& rB2IRectangle ); + +OOO_DLLPUBLIC_CHARTTOOLS css::awt::Size B2IRectangleToAWTSize( + const ::basegfx::B2IRectangle& rB2IRectangle ); + +::basegfx::B3DVector Direction3DToB3DVector( + const css::drawing::Direction3D& rDirection ); + +css::drawing::Direction3D B3DVectorToDirection3D( + const ::basegfx::B3DVector& rB3DVector ); + +::basegfx::B3DVector Position3DToB3DVector( + const css::drawing::Position3D& rPosition ); + +css::drawing::Position3D B3DVectorToPosition3D( + const ::basegfx::B3DVector& rB3DVector ); + +OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DHomMatrix HomogenMatrixToB3DHomMatrix( + const css::drawing::HomogenMatrix & rHomogenMatrix ); + +OOO_DLLPUBLIC_CHARTTOOLS +css::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 ); + +} // namespace BaseGFXHelper +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_BASEGFXHELPER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/CachedDataSequence.hxx b/chart2/source/inc/CachedDataSequence.hxx new file mode 100644 index 000000000..90acd6dbf --- /dev/null +++ b/chart2/source/inc/CachedDataSequence.hxx @@ -0,0 +1,168 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_CACHEDDATASEQUENCE_HXX +#define INCLUDED_CHART2_SOURCE_INC_CACHEDDATASEQUENCE_HXX + +// helper classes +#include <cppuhelper/compbase.hxx> +#include <comphelper/uno3.hxx> +#include <comphelper/broadcasthelper.hxx> +#include <comphelper/propertycontainer.hxx> +#include <comphelper/proparrhlp.hxx> + +// interfaces and types +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XInitialization.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> + +namespace com::sun::star::uno { class XComponentContext; } + +namespace chart +{ + +namespace impl +{ +typedef ::cppu::WeakComponentImplHelper< + css::chart2::data::XDataSequence, + css::chart2::data::XNumericalDataSequence, + css::chart2::data::XTextualDataSequence, + css::util::XCloneable, + css::util::XModifyBroadcaster, + css::lang::XInitialization, + css::lang::XServiceInfo > + CachedDataSequence_Base; +} + +/** + * This sequence object does store actual values within, hence "cached". + */ +class CachedDataSequence final : + public ::comphelper::OMutexAndBroadcastHelper, + public ::comphelper::OPropertyContainer, + public ::comphelper::OPropertyArrayUsageHelper< CachedDataSequence >, + public impl::CachedDataSequence_Base +{ +public: + /** constructs an empty sequence + */ + CachedDataSequence(); + + explicit CachedDataSequence( const css::uno::Reference< css::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 OUString & rSingleText ); + + /// Copy CTOR + explicit CachedDataSequence( const CachedDataSequence & rSource ); + + virtual ~CachedDataSequence() override; + + /// declare XServiceInfo methods + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + /// merge XInterface implementations + DECLARE_XINTERFACE() + /// merge XTypeProvider implementations + DECLARE_XTYPEPROVIDER() + +private: + // ____ XPropertySet ____ + /// @see css::beans::XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override; + /// @see ::comphelper::OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + /// @see ::comphelper::OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; + + // ____ XDataSequence ____ + virtual css::uno::Sequence< css::uno::Any > SAL_CALL getData() override; + virtual OUString SAL_CALL getSourceRangeRepresentation() override; + virtual css::uno::Sequence< OUString > SAL_CALL generateLabel( + css::chart2::data::LabelOrigin nLabelOrigin ) override; + virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex( ::sal_Int32 nIndex ) override; + + // ____ XNumericalDataSequence ____ + /// @see css::chart::data::XNumericalDataSequence + virtual css::uno::Sequence< double > SAL_CALL getNumericalData() override; + + // ____ XTextualDataSequence ____ + /// @see css::chart::data::XTextualDataSequence + virtual css::uno::Sequence< OUString > SAL_CALL getTextualData() override; + + // ____ XCloneable ____ + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override; + + // ____ XModifyBroadcaster ____ + virtual void SAL_CALL addModifyListener( + const css::uno::Reference< css::util::XModifyListener >& aListener ) override; + virtual void SAL_CALL removeModifyListener( + const css::uno::Reference< css::util::XModifyListener >& aListener ) override; + + // css::lang::XInitialization: + virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > & aArguments) override; + + // <properties> + sal_Int32 m_nNumberFormatKey; + OUString m_sRole; + // </properties> + + enum DataType + { + NUMERICAL, + TEXTUAL, + MIXED + }; + + /** This method registers all properties. It should be called by all + constructors. + */ + void registerProperties(); + + /** is used by interface method getNumericalData(). + */ + css::uno::Sequence< double > Impl_getNumericalData() const; + /** is used by interface method getTextualData(). + */ + css::uno::Sequence< OUString > Impl_getTextualData() const; + /** is used by interface method getData(). + */ + css::uno::Sequence< css::uno::Any > Impl_getMixedData() const; + + enum DataType m_eCurrentDataType; + + css::uno::Sequence< double > m_aNumericalSequence; + css::uno::Sequence< OUString > m_aTextualSequence; + css::uno::Sequence< css::uno::Any > m_aMixedSequence; + css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_CACHEDDATASEQUENCE_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ChangingResource.hxx b/chart2/source/inc/ChangingResource.hxx new file mode 100644 index 000000000..ca39d92b8 --- /dev/null +++ b/chart2/source/inc/ChangingResource.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_CHANGINGRESOURCE_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_CHANGINGRESOURCE_HXX + +namespace chart +{ +class ChangingResource; +class ResourceChangeListener +{ +public: + virtual void stateChanged() = 0; + virtual ~ResourceChangeListener(); +}; + +class ChangingResource +{ +public: + ChangingResource(); + virtual ~ChangingResource(); + + void setChangeListener(ResourceChangeListener* pListener); + +protected: + ResourceChangeListener* m_pChangeListener; +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/CharacterProperties.hxx b/chart2/source/inc/CharacterProperties.hxx new file mode 100644 index 000000000..7385bfe12 --- /dev/null +++ b/chart2/source/inc/CharacterProperties.hxx @@ -0,0 +1,140 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_CHARACTERPROPERTIES_HXX +#define INCLUDED_CHART2_SOURCE_INC_CHARACTERPROPERTIES_HXX + +#include "PropertyHelper.hxx" +#include "FastPropertyIdRanges.hxx" +#include "charttoolsdllapi.hxx" +#include <com/sun/star/awt/FontDescriptor.hpp> + +#include <vector> + +namespace com::sun::star::beans { class XMultiPropertySet; } +namespace com::sun::star::beans { struct Property; } + +namespace chart +{ + +// implements services +// com.sun.star.style.CharacterProperties +// com.sun.star.style.CharacterPropertiesAsian +// com.sun.star.style.CharacterPropertiesComplex +namespace CharacterProperties +{ + // 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, alpha channel in COLOR + PROP_CHAR_ESCAPEMENT, + PROP_CHAR_CHAR_HEIGHT, + PROP_CHAR_UNDERLINE, + PROP_CHAR_UNDERLINE_COLOR, + PROP_CHAR_UNDERLINE_HAS_COLOR, + PROP_CHAR_OVERLINE, + PROP_CHAR_OVERLINE_COLOR, + PROP_CHAR_OVERLINE_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 + }; + + OOO_DLLPUBLIC_CHARTTOOLS void AddPropertiesToVector( + std::vector< css::beans::Property > & rOutProperties ); + + OOO_DLLPUBLIC_CHARTTOOLS void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ); + + OOO_DLLPUBLIC_CHARTTOOLS bool IsCharacterPropertyHandle( sal_Int32 nHandle ); + + OOO_DLLPUBLIC_CHARTTOOLS css::awt::FontDescriptor createFontDescriptorFromPropertySet( + const css::uno::Reference< css::beans::XMultiPropertySet > & xMultiPropSet ); +} + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_CHARACTERPROPERTIES_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ChartModelHelper.hxx b/chart2/source/inc/ChartModelHelper.hxx new file mode 100644 index 000000000..0a8192706 --- /dev/null +++ b/chart2/source/inc/ChartModelHelper.hxx @@ -0,0 +1,89 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTMODELHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_CHARTMODELHELPER_HXX + +#include <com/sun/star/awt/Size.hpp> +#include "charttoolsdllapi.hxx" + +#include <vector> + +namespace chart { class ChartModel; } +namespace com::sun::star::chart2 { class XChartDocument; } +namespace com::sun::star::chart2 { class XChartType; } +namespace com::sun::star::chart2 { class XCoordinateSystem; } +namespace com::sun::star::chart2 { class XDataSeries; } +namespace com::sun::star::chart2 { class XDiagram; } +namespace com::sun::star::chart2::data { class XDataProvider; } +namespace com::sun::star::chart2::data { class XRangeHighlighter; } +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::view { class XSelectionSupplier; } + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS ChartModelHelper +{ +public: + static css::uno::Reference< css::chart2::data::XRangeHighlighter > createRangeHighlighter( + const css::uno::Reference< css::view::XSelectionSupplier >& xSelectionSupplier ); + + static css::uno::Reference< css::chart2::data::XDataProvider > createInternalDataProvider( + const css::uno::Reference< css::chart2::XChartDocument >& xChartDoc, bool bConnectToModel ); + + static css::uno::Reference< css::chart2::XDiagram > + findDiagram( const css::uno::Reference< css::frame::XModel >& xModel ); + + static css::uno::Reference< css::chart2::XDiagram > + findDiagram( const css::uno::Reference< css::chart2::XChartDocument >& xChartDoc ); + + static css::uno::Reference< css::chart2::XCoordinateSystem > + getFirstCoordinateSystem( ChartModel& rModel ); + + static css::uno::Reference< css::chart2::XCoordinateSystem > + getFirstCoordinateSystem( const css::uno::Reference< css::frame::XModel >& xModel ); + + SAL_DLLPRIVATE static std::vector< css::uno::Reference< css::chart2::XDataSeries > > + getDataSeries( ChartModel& rModel ); + + SAL_DLLPRIVATE static std::vector< css::uno::Reference< css::chart2::XDataSeries > > + getDataSeries( const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc ); + static std::vector< css::uno::Reference< css::chart2::XDataSeries > > + getDataSeries( const css::uno::Reference< css::frame::XModel > & xModel ); + + static css::uno::Reference< css::chart2::XChartType > + getChartTypeOfSeries( + const css::uno::Reference< css::frame::XModel >& xModel + , const css::uno::Reference< css::chart2::XDataSeries >& xGivenDataSeries ); + + static css::awt::Size getDefaultPageSize(); + + static css::awt::Size getPageSize( const css::uno::Reference< css::frame::XModel >& xModel ); + + static void triggerRangeHighlighting( const css::uno::Reference< css::frame::XModel >& xModel ); + + static bool isIncludeHiddenCells( const css::uno::Reference< css::frame::XModel >& xChartModel ); + + static bool setIncludeHiddenCells( bool bIncludeHiddenCells, ChartModel& rModel); +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ChartResourceGroupDlgs.hxx b/chart2/source/inc/ChartResourceGroupDlgs.hxx new file mode 100644 index 000000000..755e7af15 --- /dev/null +++ b/chart2/source/inc/ChartResourceGroupDlgs.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_CHARTRESOURCEGROUPDLGS_HXX +#define INCLUDED_CHART2_SOURCE_CHARTRESOURCEGROUPDLGS_HXX + +#include <vcl/weld.hxx> + +namespace chart +{ +class ChartTypeParameter; + +class SplinePropertiesDialog : public weld::GenericDialogController +{ +public: + explicit SplinePropertiesDialog(weld::Window* pParent); + + void fillControls(const ChartTypeParameter& rParameter); + void fillParameter(ChartTypeParameter& rParameter, bool bSmoothLines); + +private: + DECL_LINK(SplineTypeListBoxHdl, weld::ComboBox&, void); + +private: + std::unique_ptr<weld::ComboBox> m_xLB_Spline_Type; + std::unique_ptr<weld::SpinButton> m_xMF_SplineResolution; + std::unique_ptr<weld::Label> m_xFT_SplineOrder; + std::unique_ptr<weld::SpinButton> m_xMF_SplineOrder; +}; + +class SteppedPropertiesDialog : public weld::GenericDialogController +{ +public: + explicit SteppedPropertiesDialog(weld::Window* pParent); + + void fillControls(const ChartTypeParameter& rParameter); + void fillParameter(ChartTypeParameter& rParameter, bool bSteppedLines); + +private: + std::unique_ptr<weld::RadioButton> m_xRB_Start; + std::unique_ptr<weld::RadioButton> m_xRB_End; + std::unique_ptr<weld::RadioButton> m_xRB_CenterX; + std::unique_ptr<weld::RadioButton> m_xRB_CenterY; +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ChartResourceGroups.hxx b/chart2/source/inc/ChartResourceGroups.hxx new file mode 100644 index 000000000..f3b3e2f4b --- /dev/null +++ b/chart2/source/inc/ChartResourceGroups.hxx @@ -0,0 +1,149 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_CHARTRESOURCEGROUPS_HXX +#define INCLUDED_CHART2_SOURCE_CHARTRESOURCEGROUPS_HXX + +#include "res_BarGeometry.hxx" +#include "ChangingResource.hxx" +#include "ChartTypeDialogController.hxx" +#include "ChartResourceGroupDlgs.hxx" + +namespace chart +{ +using namespace ::com::sun::star; +using namespace ::com::sun::star::chart2; + +class SplinePropertiesDialog; +class SteppedPropertiesDialog; + +enum +{ + POS_3DSCHEME_SIMPLE = 0, + POS_3DSCHEME_REALISTIC = 1 +}; + +class Dim3DLookResourceGroup : public ChangingResource +{ +public: + explicit Dim3DLookResourceGroup(weld::Builder* pBuilder); + + void showControls(bool bShow); + + void fillControls(const ChartTypeParameter& rParameter); + void fillParameter(ChartTypeParameter& rParameter); + +private: + DECL_LINK(Dim3DLookCheckHdl, weld::ToggleButton&, void); + DECL_LINK(SelectSchemeHdl, weld::ComboBox&, void); + +private: + std::unique_ptr<weld::CheckButton> m_xCB_3DLook; + std::unique_ptr<weld::ComboBox> m_xLB_Scheme; +}; + +class SortByXValuesResourceGroup : public ChangingResource +{ +public: + explicit SortByXValuesResourceGroup(weld::Builder* pBuilder); + + void showControls(bool bShow); + + void fillControls(const ChartTypeParameter& rParameter); + void fillParameter(ChartTypeParameter& rParameter); + +private: + DECL_LINK(SortByXValuesCheckHdl, weld::ToggleButton&, void); + +private: + std::unique_ptr<weld::CheckButton> m_xCB_XValueSorting; +}; + +class StackingResourceGroup : public ChangingResource +{ +public: + explicit StackingResourceGroup(weld::Builder* pBuilder); + + void showControls(bool bShow); + + void fillControls(const ChartTypeParameter& rParameter); + void fillParameter(ChartTypeParameter& rParameter); + +private: + DECL_LINK(StackingChangeHdl, weld::ToggleButton&, void); + DECL_LINK(StackingEnableHdl, weld::ToggleButton&, void); + +private: + std::unique_ptr<weld::CheckButton> m_xCB_Stacked; + std::unique_ptr<weld::RadioButton> m_xRB_Stack_Y; + std::unique_ptr<weld::RadioButton> m_xRB_Stack_Y_Percent; + std::unique_ptr<weld::RadioButton> m_xRB_Stack_Z; +}; + +#define POS_LINETYPE_STRAIGHT 0 +#define POS_LINETYPE_SMOOTH 1 +#define POS_LINETYPE_STEPPED 2 + +class SplineResourceGroup : public ChangingResource +{ +public: + explicit SplineResourceGroup(weld::Builder* pBuilder, weld::Window* pParent); + + void showControls(bool bShow); + + void fillControls(const ChartTypeParameter& rParameter); + void fillParameter(ChartTypeParameter& rParameter); + +private: + DECL_LINK(LineTypeChangeHdl, weld::ComboBox&, void); + DECL_LINK(SplineDetailsDialogHdl, weld::Button&, void); + DECL_LINK(SteppedDetailsDialogHdl, weld::Button&, void); + SplinePropertiesDialog& getSplinePropertiesDialog(); + SteppedPropertiesDialog& getSteppedPropertiesDialog(); + +private: + weld::Window* m_pParent; + std::unique_ptr<weld::Label> m_xFT_LineType; + std::unique_ptr<weld::ComboBox> m_xLB_LineType; + std::unique_ptr<weld::Button> m_xPB_DetailsDialog; + std::unique_ptr<SplinePropertiesDialog> m_xSplinePropertiesDialog; + std::unique_ptr<SteppedPropertiesDialog> m_xSteppedPropertiesDialog; +}; + +class GeometryResourceGroup : public ChangingResource +{ +public: + explicit GeometryResourceGroup(weld::Builder* pBuilder); + + void showControls(bool bShow); + + void fillControls(const ChartTypeParameter& rParameter); + void fillParameter(ChartTypeParameter& rParameter); + +private: + DECL_LINK(GeometryChangeHdl, weld::TreeView&, void); + +private: + BarGeometryResources m_aGeometryResources; +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ChartTypeDialogController.hxx b/chart2/source/inc/ChartTypeDialogController.hxx new file mode 100644 index 000000000..f65ce90a5 --- /dev/null +++ b/chart2/source/inc/ChartTypeDialogController.hxx @@ -0,0 +1,363 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_CHARTTYPEDIALOGCONTROLLER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_CHARTTYPEDIALOGCONTROLLER_HXX + +#include <sal/config.h> + +#include <map> + +#include "ChangingResource.hxx" +#include "ThreeDHelper.hxx" + +#include <com/sun/star/chart2/CurveStyle.hpp> +#include <vcl/weld.hxx> + +namespace com +{ +namespace sun +{ +namespace star +{ +namespace beans +{ +class XPropertySet; +} +} +} +} +namespace com +{ +namespace sun +{ +namespace star +{ +namespace chart2 +{ +class XChartDocument; +} +} +} +} +namespace com +{ +namespace sun +{ +namespace star +{ +namespace chart2 +{ +class XChartTypeTemplate; +} +} +} +} +namespace com +{ +namespace sun +{ +namespace star +{ +namespace lang +{ +class XMultiServiceFactory; +} +} +} +} + +class ValueSet; + +namespace chart +{ +enum GlobalStackMode +{ + GlobalStackMode_NONE, + GlobalStackMode_STACK_Y, + GlobalStackMode_STACK_Y_PERCENT, + GlobalStackMode_STACK_Z +}; + +class ChartTypeParameter +{ +public: + ChartTypeParameter(sal_Int32 nSubTypeIndex, bool bXAxisWithValues = false, bool b3DLook = false, + GlobalStackMode eStackMode = GlobalStackMode_NONE, bool _bSymbols = true, + bool _bLines = true, + css::chart2::CurveStyle eCurveStyle = css::chart2::CurveStyle_LINES); + ChartTypeParameter(); + + bool mapsToSameService(const ChartTypeParameter& rParameter) const; + bool mapsToSimilarService(const ChartTypeParameter& rParameter, + sal_Int32 nTheHigherTheLess) const; + + sal_Int32 nSubTypeIndex; //starting with 1 + + bool bXAxisWithValues; + bool b3DLook; + bool bSymbols; + bool bLines; + + GlobalStackMode eStackMode; + css::chart2::CurveStyle eCurveStyle; + + sal_Int32 nCurveResolution; + sal_Int32 nSplineOrder; + + sal_Int32 nGeometry3D; + + ThreeDLookScheme eThreeDLookScheme; + bool bSortByXValues; + + bool mbRoundedEdge; +}; + +typedef std::map<OUString, ChartTypeParameter> tTemplateServiceChartTypeParameterMap; + +class ChartTypeDialogController : public ChangingResource +{ +public: + ChartTypeDialogController(); + virtual ~ChartTypeDialogController() override; + + virtual OUString getName() = 0; + virtual OUString getImage() = 0; + virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const = 0; + virtual void fillSubTypeList(ValueSet& rSubTypeList, const ChartTypeParameter& rParameter); + + virtual bool shouldShow_3DLookControl() const; + virtual bool shouldShow_StackingControl() const; + virtual bool shouldShow_SplineControl() const; + virtual bool shouldShow_GeometryControl() const; + virtual bool shouldShow_SortByXValuesResourceGroup() const; + + virtual void showExtraControls(weld::Builder* pBuilder); + virtual void hideExtraControls() const; + virtual void + fillExtraControls(const css::uno::Reference<css::chart2::XChartDocument>& xChartModel, + const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps) const; + /// @throws css::uno::RuntimeException + virtual void setTemplateProperties( + const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps) const; + + bool isSubType(const OUString& rServiceName); + ChartTypeParameter getChartTypeParameterForService( + const OUString& rServiceName, + const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps); + virtual void adjustSubTypeAndEnableControls( + ChartTypeParameter& + rParameter); //if you have different counts of subtypes you may need to adjust the index + virtual void adjustParameterToSubType(ChartTypeParameter& rParameter); + virtual void adjustParameterToMainType(ChartTypeParameter& rParameter); + OUString getServiceNameForParameter(const ChartTypeParameter& rParameter) const; + void commitToModel(const ChartTypeParameter& rParameter, + const css::uno::Reference<css::chart2::XChartDocument>& xChartModel); + css::uno::Reference<css::chart2::XChartTypeTemplate> getCurrentTemplate( + const ChartTypeParameter& rParameter, + const css::uno::Reference<css::lang::XMultiServiceFactory>& xTemplateManager) const; + +protected: + bool bSupportsXAxisWithValues; + bool bSupports3D; +}; + +class ColumnOrBarChartDialogController_Base : public ChartTypeDialogController +{ +public: + ColumnOrBarChartDialogController_Base(); + virtual ~ColumnOrBarChartDialogController_Base() override; + + virtual bool shouldShow_3DLookControl() const override; + virtual bool shouldShow_GeometryControl() const override; + + virtual void adjustSubTypeAndEnableControls(ChartTypeParameter& rParameter) override; +}; + +class ColumnChartDialogController : public ColumnOrBarChartDialogController_Base +{ +public: + ColumnChartDialogController(); + virtual ~ColumnChartDialogController() override; + + virtual OUString getName() override; + virtual OUString getImage() override; + virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; + virtual void fillSubTypeList(ValueSet& rSubTypeList, + const ChartTypeParameter& rParameter) override; +}; + +class BarChartDialogController : public ColumnOrBarChartDialogController_Base +{ +public: + BarChartDialogController(); + virtual ~BarChartDialogController() override; + + virtual OUString getName() override; + virtual OUString getImage() override; + virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; + virtual void fillSubTypeList(ValueSet& rSubTypeList, + const ChartTypeParameter& rParameter) override; +}; + +class PieChartDialogController : public ChartTypeDialogController +{ +public: + PieChartDialogController(); + virtual ~PieChartDialogController() override; + + virtual OUString getName() override; + virtual OUString getImage() override; + virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; + virtual void fillSubTypeList(ValueSet& rSubTypeList, + const ChartTypeParameter& rParameter) override; + virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override; + + virtual bool shouldShow_3DLookControl() const override; +}; + +class LineChartDialogController : public ChartTypeDialogController +{ +public: + LineChartDialogController(); + virtual ~LineChartDialogController() override; + + virtual OUString getName() override; + virtual OUString getImage() override; + virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; + virtual void fillSubTypeList(ValueSet& rSubTypeList, + const ChartTypeParameter& rParameter) override; + virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override; + virtual void adjustParameterToMainType(ChartTypeParameter& rParameter) override; + + virtual bool shouldShow_StackingControl() const override; + virtual bool shouldShow_SplineControl() const override; +}; + +class XYChartDialogController : public ChartTypeDialogController +{ +public: + XYChartDialogController(); + virtual ~XYChartDialogController() override; + + virtual OUString getName() override; + virtual OUString getImage() override; + virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; + virtual void fillSubTypeList(ValueSet& rSubTypeList, + const ChartTypeParameter& rParameter) override; + virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override; + + virtual bool shouldShow_SplineControl() const override; + virtual bool shouldShow_SortByXValuesResourceGroup() const override; +}; + +class AreaChartDialogController : public ChartTypeDialogController +{ +public: + AreaChartDialogController(); + virtual ~AreaChartDialogController() override; + + virtual OUString getName() override; + virtual OUString getImage() override; + virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; + virtual void fillSubTypeList(ValueSet& rSubTypeList, + const ChartTypeParameter& rParameter) override; + virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override; + virtual void adjustParameterToMainType(ChartTypeParameter& rParameter) override; + + virtual bool shouldShow_3DLookControl() const override; +}; + +class NetChartDialogController : public ChartTypeDialogController +{ +public: + NetChartDialogController(); + virtual ~NetChartDialogController() override; + + virtual OUString getName() override; + virtual OUString getImage() override; + virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; + virtual void fillSubTypeList(ValueSet& rSubTypeList, + const ChartTypeParameter& rParameter) override; + virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override; + + virtual bool shouldShow_StackingControl() const override; +}; + +class StockChartDialogController : public ChartTypeDialogController +{ +public: + StockChartDialogController(); + virtual ~StockChartDialogController() override; + + virtual OUString getName() override; + virtual OUString getImage() override; + virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; + virtual void fillSubTypeList(ValueSet& rSubTypeList, + const ChartTypeParameter& rParameter) override; + virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override; +}; + +class CombiColumnLineChartDialogController : public ChartTypeDialogController +{ +public: + CombiColumnLineChartDialogController(); + + virtual OUString getName() override; + virtual OUString getImage() override; + virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; + virtual void fillSubTypeList(ValueSet& rSubTypeList, + const ChartTypeParameter& rParameter) override; + virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override; + + virtual void showExtraControls(weld::Builder* pBuilder) override; + virtual void hideExtraControls() const override; + virtual void fillExtraControls( + const css::uno::Reference<css::chart2::XChartDocument>& xChartModel, + const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps) const override; + + virtual void setTemplateProperties( + const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps) const override; + +private: + DECL_LINK(ChangeLineCountHdl, weld::SpinButton&, void); + +private: + std::unique_ptr<weld::Label> m_xFT_NumberOfLines; + std::unique_ptr<weld::SpinButton> m_xMF_NumberOfLines; +}; + +class BubbleChartDialogController : public ChartTypeDialogController +{ +public: + BubbleChartDialogController(); + virtual ~BubbleChartDialogController() override; + + virtual OUString getName() override; + virtual OUString getImage() override; + virtual const tTemplateServiceChartTypeParameterMap& getTemplateMap() const override; + virtual void fillSubTypeList(ValueSet& rSubTypeList, + const ChartTypeParameter& rParameter) override; + virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override; +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx new file mode 100644 index 000000000..e749dd5b4 --- /dev/null +++ b/chart2/source/inc/ChartTypeHelper.hxx @@ -0,0 +1,88 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTTYPEHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_CHARTTYPEHELPER_HXX + +#include <com/sun/star/drawing/Direction3D.hpp> +#include "charttoolsdllapi.hxx" + +namespace com::sun::star::chart2 { class XChartType; } +namespace com::sun::star::chart2 { class XDataSeries; } + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS ChartTypeHelper +{ +public: + static bool isSupportingGeometryProperties( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool isSupportingStatisticProperties( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool isSupportingRegressionProperties(const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool isSupportingMainAxis( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ); + static bool isSupportingSecondaryAxis( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool isSupportingAreaProperties( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool isSupportingSymbolProperties( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool isSupportingOverlapAndGapWidthProperties( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool isSupportingBarConnectors( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool isSupportingRightAngledAxes( const css::uno::Reference< css::chart2::XChartType >& xChartType ); + static bool isSupportingAxisSideBySide( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); + static bool isSupportingStartingAngle( const css::uno::Reference< css::chart2::XChartType >& xChartType ); + //starting value for bars or baseline for areas for example + static bool isSupportingBaseValue( const css::uno::Reference< css::chart2::XChartType >& xChartType ); + static bool isSupportingAxisPositioning( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex ); + static bool isSupportingDateAxis( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionIndex ); + static bool isSupportingComplexCategory( const css::uno::Reference< css::chart2::XChartType >& xChartType ); + static bool isSupportingCategoryPositioning( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nDimensionCount ); + + //returns sequence of css::chart::DataLabelPlacement + static css::uno::Sequence < sal_Int32 > getSupportedLabelPlacements( + const css::uno::Reference< css::chart2::XChartType >& xChartType, bool bSwapXAndY + , const css::uno::Reference< css::chart2::XDataSeries >& xSeries ); + + //returns sequence of css::chart::MissingValueTreatment + static css::uno::Sequence < sal_Int32 > getSupportedMissingValueTreatments( + const css::uno::Reference< css::chart2::XChartType >& xChartType ); + + SAL_DLLPRIVATE static css::drawing::Direction3D getDefaultSimpleLightDirection( const css::uno::Reference< css::chart2::XChartType >& xChartType ); + SAL_DLLPRIVATE static css::drawing::Direction3D getDefaultRealisticLightDirection( const css::uno::Reference< css::chart2::XChartType >& xChartType ); + SAL_DLLPRIVATE static sal_Int32 getDefaultDirectLightColor( bool bSimple, const css::uno::Reference< css::chart2::XChartType >& xChartType ); + SAL_DLLPRIVATE static sal_Int32 getDefaultAmbientLightColor( bool bSimple, const css::uno::Reference< css::chart2::XChartType >& xChartType ); + static sal_Int32 getNumberOfDisplayedSeries( const css::uno::Reference< css::chart2::XChartType >& xChartType, sal_Int32 nNumberOfSeries ); + SAL_DLLPRIVATE static bool noBordersForSimpleScheme( const css::uno::Reference< css::chart2::XChartType >& xChartType ); + + static bool isSeriesInFrontOfAxisLine( const css::uno::Reference< css::chart2::XChartType >& xChartType ); + + static sal_Int32 //one of css::chart2::AxisType + getAxisType( const css::uno::Reference< css::chart2::XChartType >& xChartType + , sal_Int32 nDimensionIndex ); + + static OUString getRoleOfSequenceForYAxisNumberFormatDetection( const css::uno::Reference< + css::chart2::XChartType >& xChartType ); + + static OUString getRoleOfSequenceForDataLabelNumberFormatDetection( const css::uno::Reference< + css::chart2::XChartType >& xChartType ); + + static bool isSupportingOnlyDeepStackingFor3D( const css::uno::Reference< css::chart2::XChartType >& xChartType ); +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ChartTypeTemplateProvider.hxx b/chart2/source/inc/ChartTypeTemplateProvider.hxx new file mode 100644 index 000000000..fc4517d1b --- /dev/null +++ b/chart2/source/inc/ChartTypeTemplateProvider.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_CHARTTYPETEMPLATEPROVIDER_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_CHARTTYPETEMPLATEPROVIDER_HXX + +#include <com/sun/star/uno/Reference.hxx> + +namespace com +{ +namespace sun +{ +namespace star +{ +namespace chart2 +{ +class XChartTypeTemplate; +} +} +} +} + +namespace chart +{ +class ChartTypeTemplateProvider +{ +public: + virtual css::uno::Reference<css::chart2::XChartTypeTemplate> getCurrentTemplate() const = 0; + virtual ~ChartTypeTemplateProvider() {} +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ChartViewHelper.hxx b/chart2/source/inc/ChartViewHelper.hxx new file mode 100644 index 000000000..48f7c27b6 --- /dev/null +++ b/chart2/source/inc/ChartViewHelper.hxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTVIEWHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_CHARTVIEWHELPER_HXX + +#include "charttoolsdllapi.hxx" + +namespace com::sun::star::uno { template <class interface_type> class Reference; } +namespace com::sun::star::frame { class XModel; } + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS ChartViewHelper +{ +public: + static void setViewToDirtyState( const css::uno::Reference< css::frame::XModel >& xChartModel ); +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/CloneHelper.hxx b/chart2/source/inc/CloneHelper.hxx new file mode 100644 index 000000000..da697e05e --- /dev/null +++ b/chart2/source/inc/CloneHelper.hxx @@ -0,0 +1,78 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_CLONEHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_CLONEHELPER_HXX + +#include <com/sun/star/util/XCloneable.hpp> + +#include <algorithm> +#include <iterator> +#include <vector> + +namespace chart +{ +namespace CloneHelper +{ + +/// functor that clones a UNO-Reference +template< class Interface > + struct CreateRefClone +{ + css::uno::Reference<Interface> operator() ( const css::uno::Reference<Interface> & xOther ) + { + css::uno::Reference<Interface> xResult; + css::uno::Reference< css::util::XCloneable > + xCloneable( xOther, css::uno::UNO_QUERY ); + if( xCloneable.is()) + xResult.set( xCloneable->createClone(), css::uno::UNO_QUERY ); + + return xResult; + } +}; + +/// clones a vector of UNO-References +template< class Interface > + void CloneRefVector( + const std::vector< css::uno::Reference< Interface > > & rSource, + std::vector< css::uno::Reference< Interface > > & rDestination ) +{ + std::transform( rSource.begin(), rSource.end(), + std::back_inserter( rDestination ), + CreateRefClone< Interface >()); +} + +/// clones a UNO-sequence of UNO-References +template< class Interface > + void CloneRefSequence( + const css::uno::Sequence< css::uno::Reference<Interface> > & rSource, + css::uno::Sequence< css::uno::Reference<Interface> > & rDestination ) +{ + rDestination.realloc( rSource.getLength()); + std::transform( rSource.begin(), rSource.end(), + rDestination.getArray(), + CreateRefClone< Interface >()); +} + +} // namespace CloneHelper +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_CLONEHELPER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ColorPerPointHelper.hxx b/chart2/source/inc/ColorPerPointHelper.hxx new file mode 100644 index 000000000..6c34693da --- /dev/null +++ b/chart2/source/inc/ColorPerPointHelper.hxx @@ -0,0 +1,50 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_INC_COLORPERPOINTHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_COLORPERPOINTHELPER_HXX + +#include "charttoolsdllapi.hxx" + +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::uno { template <class interface_type> class Reference; } + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS ColorPerPointHelper +{ +public: + static bool hasPointOwnColor( + const css::uno::Reference< css::beans::XPropertySet >& xDataSeriesProperties + , sal_Int32 nPointIndex + , const css::uno::Reference< css::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 css::uno::Reference< css::beans::XPropertySet >& xSeriesProperties + , sal_Int32 nPointIndex ); +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/CommonConverters.hxx b/chart2/source/inc/CommonConverters.hxx new file mode 100644 index 000000000..940b95d70 --- /dev/null +++ b/chart2/source/inc/CommonConverters.hxx @@ -0,0 +1,214 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_COMMONCONVERTERS_HXX +#define INCLUDED_CHART2_SOURCE_INC_COMMONCONVERTERS_HXX + +#include <com/sun/star/awt/Point.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/PointSequenceSequence.hpp> +#include <com/sun/star/drawing/Position3D.hpp> +#include <com/sun/star/drawing/PolyPolygonShape3D.hpp> +#include <basegfx/matrix/b2dhommatrix.hxx> +#include <basegfx/point/b3dpoint.hxx> +#include <basegfx/vector/b3dvector.hxx> +#include "charttoolsdllapi.hxx" + +namespace com::sun::star::awt { struct Rectangle; } +namespace com::sun::star::chart2::data { class XDataSequence; } +namespace com::sun::star::drawing { struct PolyPolygonBezierCoords; } + +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 css::drawing::HomogenMatrix + B3DHomMatrixToHomogenMatrix( const ::basegfx::B3DHomMatrix& rM ); + +/** HomogenMatrix -> ::basegfx::B3DHomMatrix +*/ +OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DHomMatrix HomogenMatrixToB3DHomMatrix( const css::drawing::HomogenMatrix& rHM ); + +/** ::basegfx::B3DHomMatrix -> B2DHomMatrix +*/ +OOO_DLLPUBLIC_CHARTTOOLS +::basegfx::B2DHomMatrix IgnoreZ( const ::basegfx::B3DHomMatrix& rM ); + +/** B2DHomMatrix <-> HomogenMatrix3 +*/ +OOO_DLLPUBLIC_CHARTTOOLS css::drawing::HomogenMatrix3 + B2DHomMatrixToHomogenMatrix3( const ::basegfx::B2DHomMatrix& rM ); + +/** Position3D -> B3DPoint +*/ +OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DPoint Position3DToB3DPoint( const css::drawing::Position3D& rPosition ); + +/** B3DVector -> Direction3D +*/ +OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Direction3D B3DVectorToDirection3D( const ::basegfx::B3DVector& rVector); + +/** B3DPoint -> Position3D +*/ +OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D B3DPointToPosition3D( const ::basegfx::B3DPoint& rPoint); + +/** Direction3D -> B3DVector +*/ +OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DVector Direction3DToB3DVector( const css::drawing::Direction3D& rDirection); + +/** PolyPolygonShape3D + drawing::Position3D -> PolyPolygonShape3D +*/ +OOO_DLLPUBLIC_CHARTTOOLS +void AddPointToPoly( css::drawing::PolyPolygonShape3D& rPoly + , const css::drawing::Position3D& rPos + , sal_Int32 nSequenceIndex=0 ); + +/** get a single Point from a Polygon +*/ +OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D getPointFromPoly( + const css::drawing::PolyPolygonShape3D& rPolygon + , sal_Int32 nPointIndex, sal_Int32 nPolyIndex ); + +OOO_DLLPUBLIC_CHARTTOOLS +void addPolygon( css::drawing::PolyPolygonShape3D& rRet + , const css::drawing::PolyPolygonShape3D& rAdd ); +/** PolyPolygonShape3D + PolyPolygonShape3D -> PolyPolygonShape3D +*/ +OOO_DLLPUBLIC_CHARTTOOLS +void appendPoly( css::drawing::PolyPolygonShape3D& rRet + , const css::drawing::PolyPolygonShape3D& rAdd ); + +/** PolyPolygonBezierCoords -> PolyPolygonShape3D +*/ +OOO_DLLPUBLIC_CHARTTOOLS +css::drawing::PolyPolygonShape3D BezierToPoly( + const css::drawing::PolyPolygonBezierCoords& rBezier ); + +/** PolyPolygonShape3D -> drawing::PointSequenceSequence (2D) +*/ +OOO_DLLPUBLIC_CHARTTOOLS +css::drawing::PointSequenceSequence PolyToPointSequence( + const css::drawing::PolyPolygonShape3D& rPolyPolygon ); + +/** drawing::PointSequenceSequence + drawing::PointSequenceSequence +*/ +OOO_DLLPUBLIC_CHARTTOOLS +void appendPointSequence( css::drawing::PointSequenceSequence& rTarget + , css::drawing::PointSequenceSequence& rAdd ); + +/** Position3D + Direction3D == Position3D +*/ +OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D + operator+( const css::drawing::Position3D& rPos + , const css::drawing::Direction3D& rDirection); + +/** Position3D - Position3D == Direction3D +*/ +OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Direction3D + operator-( const css::drawing::Position3D& rPos1 + , const css::drawing::Position3D& rPos2); + +/** awt::Rect --> awt::Point (2D) +*/ +OOO_DLLPUBLIC_CHARTTOOLS css::awt::Point ToPoint( const css::awt::Rectangle& rRectangle ); + +/** awt::Rect --> awt::Size (2D) +*/ +OOO_DLLPUBLIC_CHARTTOOLS css::awt::Size ToSize( const css::awt::Rectangle& rRectangle ); + +/** Position3D --> awt::Point (2D) +*/ +OOO_DLLPUBLIC_CHARTTOOLS css::awt::Point Position3DToAWTPoint( const css::drawing::Position3D& rPos ); + +/** Direction3D --> awt::Size (2D) +*/ +OOO_DLLPUBLIC_CHARTTOOLS css::awt::Size Direction3DToAWTSize( const css::drawing::Direction3D& rDirection ); + +/** B3DPoint -> Sequence<double> +*/ +OOO_DLLPUBLIC_CHARTTOOLS css::uno::Sequence< double > B3DPointToSequence( const ::basegfx::B3DPoint& rPoint ); + +/** Sequence<double> -> drawing::Position3D +*/ +OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D + SequenceToPosition3D( const css::uno::Sequence< double >& rSeq ); + +/** drawing::Position3D -> Sequence<double> +*/ + +OOO_DLLPUBLIC_CHARTTOOLS css::uno::Sequence< double > + Position3DToSequence( const css::drawing::Position3D& rPosition ); + +/** chart2::XDataSequence -> uno::Sequence< double > +*/ + +OOO_DLLPUBLIC_CHARTTOOLS +css::uno::Sequence< double > DataSequenceToDoubleSequence( + const css::uno::Reference< css::chart2::data::XDataSequence > & xDataSequence ); + +OOO_DLLPUBLIC_CHARTTOOLS +css::uno::Sequence< OUString > DataSequenceToStringSequence( + const css::uno::Reference< css::chart2::data::XDataSequence > & xDataSequence ); + +/** uno::Sequence< uno::Sequence< T > > -> uno::Sequence< T > + */ +template< typename T > +css::uno::Sequence< T > + FlattenSequence( const css::uno::Sequence< css::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(); + css::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; +} + +OOO_DLLPUBLIC_CHARTTOOLS +bool hasDoubleValue( const css::uno::Any& rAny ); + +OOO_DLLPUBLIC_CHARTTOOLS +bool hasLongOrShortValue( const css::uno::Any& rAny ); +OOO_DLLPUBLIC_CHARTTOOLS +sal_Int16 getShortForLongAlso( const css::uno::Any& rAny ); + +OOO_DLLPUBLIC_CHARTTOOLS +bool replaceParamterInString( OUString & rInOutResourceString, + const OUString & rParamToReplace, + const OUString & rReplaceWith ); + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/CommonFunctors.hxx b/chart2/source/inc/CommonFunctors.hxx new file mode 100644 index 000000000..10d32f5bf --- /dev/null +++ b/chart2/source/inc/CommonFunctors.hxx @@ -0,0 +1,133 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_COMMONFUNCTORS_HXX +#define INCLUDED_CHART2_SOURCE_INC_COMMONFUNCTORS_HXX + +#include <o3tl/any.hxx> +#include <rtl/math.hxx> +#include <com/sun/star/uno/Any.hxx> +#include <rtl/ustring.hxx> +#include "charttoolsdllapi.hxx" + +namespace chart +{ +namespace CommonFunctors +{ + +/** unary function to convert any type T into a css::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 +{ + css::uno::Any operator() ( const T & aVal ) + { + return css::uno::makeAny( aVal ); + } +}; + +/** unary function to convert css::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 +{ + double operator() ( const css::uno::Any & rAny ) + { + double fResult; + ::rtl::math::setNan( & fResult ); + rAny >>= fResult; + return fResult; + } +}; + +/** unary function to convert css::uno::Any into an + OUString. +*/ +struct OOO_DLLPUBLIC_CHARTTOOLS AnyToString +{ + OUString operator() ( const css::uno::Any & rAny ) + { + if( auto pDouble = o3tl::tryAccess<double>(rAny) ) + { + if( std::isnan(*pDouble) ) + return OUString(); + return ::rtl::math::doubleToUString( + * pDouble, + rtl_math_StringFormat_Automatic, + rtl_math_DecimalPlaces_Max, // use maximum decimal places available + '.', // decimal separator + true // remove trailing zeros + ); + } + else if( auto s = o3tl::tryAccess<OUString>(rAny) ) + { + return *s; + } + + return OUString(); + } +}; + +/** unary function to convert an OUString into a double number. + + <p>For conversion rtl::math::StringToDouble is used.</p> + */ +struct OOO_DLLPUBLIC_CHARTTOOLS OUStringToDouble +{ + double operator() ( const OUString & rStr ) + { + rtl_math_ConversionStatus eConversionStatus; + double fResult = ::rtl::math::stringToDouble( rStr, '.', ',', & eConversionStatus ); + + if( eConversionStatus != rtl_math_ConversionStatus_Ok ) + ::rtl::math::setNan( & fResult ); + + return fResult; + } +}; + +/** unary function to convert a double number into an OUString. + + <p>For conversion rtl::math::DoubleToOUString is used.</p> + */ +struct OOO_DLLPUBLIC_CHARTTOOLS DoubleToOUString +{ + OUString operator() ( double fNumber ) + { + return ::rtl::math::doubleToUString( + fNumber, + rtl_math_StringFormat_Automatic, + rtl_math_DecimalPlaces_Max, // use maximum decimal places available + '.', + true + ); + } +}; + +} // namespace CommonFunctors +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_COMMONFUNCTORS_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ConfigColorScheme.hxx b/chart2/source/inc/ConfigColorScheme.hxx new file mode 100644 index 000000000..7d0bbf662 --- /dev/null +++ b/chart2/source/inc/ConfigColorScheme.hxx @@ -0,0 +1,79 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_CONFIGCOLORSCHEME_HXX +#define INCLUDED_CHART2_SOURCE_INC_CONFIGCOLORSCHEME_HXX + +#include "charttoolsdllapi.hxx" +#include <cppuhelper/implbase.hxx> +#include <com/sun/star/chart2/XColorScheme.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +#include <memory> + +namespace com::sun::star::uno { class XComponentContext; } + +namespace chart +{ + +OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::chart2::XColorScheme > createConfigColorScheme( + const css::uno::Reference< css::uno::XComponentContext > & xContext ); + +namespace impl +{ +class ChartConfigItem; +} + +class ConfigColorScheme : + public ::cppu::WeakImplHelper< + css::chart2::XColorScheme, + css::lang::XServiceInfo > +{ +public: + explicit ConfigColorScheme( const css::uno::Reference< css::uno::XComponentContext > & xContext ); + virtual ~ConfigColorScheme() override; + + /// declare XServiceInfo methods + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // ____ ConfigItemListener ____ + void notify( const OUString & rPropertyName ); + +protected: + // ____ XColorScheme ____ + virtual ::sal_Int32 SAL_CALL getColorByIndex( ::sal_Int32 nIndex ) override; + +private: + void retrieveConfigColors(); + + // member variables + css::uno::Reference< css::uno::XComponentContext > m_xContext; + std::unique_ptr< impl::ChartConfigItem > m_apChartConfigItem; + mutable css::uno::Sequence< sal_Int64 > m_aColorSequence; + mutable sal_Int32 m_nNumberOfColors; + bool m_bNeedsUpdate; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_CONFIGCOLORSCHEME_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ControllerLockGuard.hxx b/chart2/source/inc/ControllerLockGuard.hxx new file mode 100644 index 000000000..090becde9 --- /dev/null +++ b/chart2/source/inc/ControllerLockGuard.hxx @@ -0,0 +1,95 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_CONTROLLERLOCKGUARD_HXX +#define INCLUDED_CHART2_SOURCE_INC_CONTROLLERLOCKGUARD_HXX + +#include "charttoolsdllapi.hxx" +#include <com/sun/star/uno/Reference.h> + +namespace chart { class ChartModel; } +namespace com::sun::star::frame { class XModel; } + +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 ControllerLockGuardUNO +{ +public: + explicit ControllerLockGuardUNO( const css::uno::Reference< css::frame::XModel > & xModel ); + ~ControllerLockGuardUNO(); + +private: + css::uno::Reference< css::frame::XModel > mxModel; +}; + +class ControllerLockGuard +{ +public: + explicit ControllerLockGuard( ChartModel& rModel ); + ~ControllerLockGuard(); + +private: + ChartModel& mrModel; +}; + +/** 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 css::uno::Reference< css::frame::XModel > & xModel ); + ~ControllerLockHelper(); + + SAL_DLLPRIVATE void lockControllers(); + SAL_DLLPRIVATE void unlockControllers(); + +private: + css::uno::Reference< css::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 + +// INCLUDED_CHART2_SOURCE_INC_CONTROLLERLOCKGUARD_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/DataSeriesHelper.hxx b/chart2/source/inc/DataSeriesHelper.hxx new file mode 100644 index 000000000..c6fba94de --- /dev/null +++ b/chart2/source/inc/DataSeriesHelper.hxx @@ -0,0 +1,184 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_DATASERIESHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_DATASERIESHELPER_HXX + +#include "StackMode.hxx" +#include "charttoolsdllapi.hxx" +#include <com/sun/star/uno/Reference.h> +#include <rtl/ustring.hxx> + +#include <vector> + +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::chart2 { class XChartType; } +namespace com::sun::star::chart2 { class XCoordinateSystem; } +namespace com::sun::star::chart2 { class XDataSeries; } +namespace com::sun::star::chart2 { class XDiagram; } +namespace com::sun::star::chart2::data { class XDataSequence; } +namespace com::sun::star::chart2::data { class XDataSource; } +namespace com::sun::star::chart2::data { class XLabeledDataSequence; } +namespace com::sun::star::uno { class Any; } +namespace com::sun::star::uno { template <class E> class Sequence; } + +namespace chart +{ + +namespace DataSeriesHelper +{ + +OOO_DLLPUBLIC_CHARTTOOLS OUString + getRole( const css::uno::Reference<css::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 css::uno::Reference< css::chart2::data::XLabeledDataSequence > + getDataSequenceByRole( const css::uno::Reference< css::chart2::data::XDataSource > & xSource, + const OUString& aRole, + bool bMatchPrefix = false ); + +/** Retrieves all data sequences in the given data source that match the given + role prefix. + + @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< + css::uno::Reference< css::chart2::data::XLabeledDataSequence > > + getAllDataSequencesByRole( const css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > & aDataSequences, + const OUString& aRole ); + +OOO_DLLPUBLIC_CHARTTOOLS +std::vector<css::uno::Reference<css::chart2::data::XLabeledDataSequence> > +getAllDataSequences( + const css::uno::Sequence<css::uno::Reference<css::chart2::XDataSeries> >& aSeries ); + +/** 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 css::uno::Reference< css::chart2::data::XDataSource > + getDataSource( const css::uno::Sequence< css::uno::Reference< css::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 OUString getDataSeriesLabel( + const css::uno::Reference< css::chart2::XDataSeries > & xSeries, + const OUString & rLabelSequenceRole ); + +/** Get the label of a labeled sequence including necessary automatic generation + */ +OOO_DLLPUBLIC_CHARTTOOLS OUString getLabelForLabeledDataSequence( + const css::uno::Reference< css::chart2::data::XLabeledDataSequence > & xLabeledSeq ); + +OOO_DLLPUBLIC_CHARTTOOLS void setStackModeAtSeries( + const css::uno::Sequence< css::uno::Reference< css::chart2::XDataSeries > > & aSeries, + const css::uno::Reference< css::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem, + StackMode eStackMode ); + +OOO_DLLPUBLIC_CHARTTOOLS sal_Int32 getAttachedAxisIndex( + const css::uno::Reference< css::chart2::XDataSeries > & xSeries ); + +/// @param nAxisIndex, if -1 it is determined by the given data series via getAttachedAxisIndex +OOO_DLLPUBLIC_CHARTTOOLS sal_Int32 getNumberFormatKeyFromAxis( + const css::uno::Reference< css::chart2::XDataSeries > & xSeries, + const css::uno::Reference< css::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem, + sal_Int32 nDimensionIndex, + sal_Int32 nAxisIndex = -1 ); + +OOO_DLLPUBLIC_CHARTTOOLS +css::uno::Reference< css::chart2::XCoordinateSystem > + getCoordinateSystemOfSeries( + const css::uno::Reference< css::chart2::XDataSeries > & xSeries, + const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + +OOO_DLLPUBLIC_CHARTTOOLS +css::uno::Reference< css::chart2::XChartType > + getChartTypeOfSeries( + const css::uno::Reference< css::chart2::XDataSeries > & xSeries, + const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + +OOO_DLLPUBLIC_CHARTTOOLS void deleteSeries( + const css::uno::Reference< css::chart2::XDataSeries > & xSeries, + const css::uno::Reference< css::chart2::XChartType > & xChartType ); + +OOO_DLLPUBLIC_CHARTTOOLS void switchSymbolsOnOrOff( + const css::uno::Reference< css::beans::XPropertySet > & xSeriesProperties, + bool bSymbolsOn, sal_Int32 nSeriesIndex ); + +OOO_DLLPUBLIC_CHARTTOOLS void switchLinesOnOrOff( + const css::uno::Reference< css::beans::XPropertySet > & xSeriesProperties, + bool bLinesOn ); + +OOO_DLLPUBLIC_CHARTTOOLS +void makeLinesThickOrThin( const css::uno::Reference< css::beans::XPropertySet > & xSeriesProperties, bool bThick ); + +OOO_DLLPUBLIC_CHARTTOOLS void setPropertyAlsoToAllAttributedDataPoints( + const css::uno::Reference< css::chart2::XDataSeries >& xSeries, + const OUString& rPropertyName, + const css::uno::Any& rPropertyValue ); + +OOO_DLLPUBLIC_CHARTTOOLS bool hasAttributedDataPointDifferentValue( + const css::uno::Reference< css::chart2::XDataSeries >& xSeries, + const OUString& rPropertyName, + const css::uno::Any& rPropertyValue ); + +OOO_DLLPUBLIC_CHARTTOOLS bool hasUnhiddenData( const css::uno::Reference< + css::chart2::XDataSeries >& xSeries ); + +OOO_DLLPUBLIC_CHARTTOOLS +sal_Int32 translateIndexFromHiddenToFullSequence( sal_Int32 nClippedIndex, const css::uno::Reference< + css::chart2::data::XDataSequence >& xDataSequence, bool bTranslate ); + +OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelsAtSeries( const css::uno::Reference< css::chart2::XDataSeries >& xSeries ); + +OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelsAtPoints( const css::uno::Reference< css::chart2::XDataSeries >& xSeries ); + +OOO_DLLPUBLIC_CHARTTOOLS bool hasDataLabelAtPoint( const css::uno::Reference< css::chart2::XDataSeries >& xSeries, sal_Int32 nPointIndex ); + +OOO_DLLPUBLIC_CHARTTOOLS void insertDataLabelsToSeriesAndAllPoints( const css::uno::Reference< css::chart2::XDataSeries >& xSeries ); + +OOO_DLLPUBLIC_CHARTTOOLS void insertDataLabelToPoint( const css::uno::Reference< css::beans::XPropertySet >& xPointPropertySet ); + +OOO_DLLPUBLIC_CHARTTOOLS void deleteDataLabelsFromSeriesAndAllPoints( const css::uno::Reference< css::chart2::XDataSeries >& xSeries ); + +OOO_DLLPUBLIC_CHARTTOOLS void deleteDataLabelsFromPoint( const css::uno::Reference< css::beans::XPropertySet >& xPointPropertySet ); + +} // namespace DataSeriesHelper +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_DATASERIESHELPER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/DataSource.hxx b/chart2/source/inc/DataSource.hxx new file mode 100644 index 000000000..6ad8bbffc --- /dev/null +++ b/chart2/source/inc/DataSource.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_DATASOURCE_HXX +#define INCLUDED_CHART2_SOURCE_INC_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 <cppuhelper/implbase.hxx> + +namespace chart +{ + +class DataSource : public + ::cppu::WeakImplHelper< + css::lang::XServiceInfo, + css::chart2::data::XDataSource, + css::chart2::data::XDataSink > +{ +public: + explicit DataSource(); + explicit DataSource( + const css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > & rSequences ); + + virtual ~DataSource() override; + + /// declare XServiceInfo methods + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + +protected: + // ____ XDataSource ____ + virtual css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > SAL_CALL + getDataSequences() override; + + // ____ XDataSink ____ + virtual void SAL_CALL setData( const css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > >& aData ) override; + +private: + css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > + m_aDataSeq; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_DATASOURCE_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/DataSourceHelper.hxx b/chart2/source/inc/DataSourceHelper.hxx new file mode 100644 index 000000000..5f159f6a5 --- /dev/null +++ b/chart2/source/inc/DataSourceHelper.hxx @@ -0,0 +1,134 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_INC_DATASOURCEHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_DATASOURCEHELPER_HXX + +#include "charttoolsdllapi.hxx" +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Sequence.h> + +namespace chart { class ChartModel; } +namespace com::sun::star::beans { struct PropertyValue; } +namespace com::sun::star::chart2 { class XChartDocument; } +namespace com::sun::star::chart2 { class XDiagram; } +namespace com::sun::star::chart2::data { class XDataSequence; } +namespace com::sun::star::chart2::data { class XDataSource; } +namespace com::sun::star::chart2::data { class XLabeledDataSequence; } +namespace com::sun::star::frame { class XModel; } + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS DataSourceHelper +{ +public: + static css::uno::Reference< css::chart2::data::XDataSource > + createDataSource( const css::uno::Sequence< + css::uno::Reference< css::chart2::data::XLabeledDataSequence > > & rSequences ); + + static css::uno::Reference< css::chart2::data::XDataSequence > + createCachedDataSequence(); + + static css::uno::Reference< css::chart2::data::XDataSequence > + createCachedDataSequence( const OUString & rSingleText ); + + static css::uno::Reference< css::chart2::data::XLabeledDataSequence > + createLabeledDataSequence( + const css::uno::Reference< css::chart2::data::XDataSequence >& xValues , + const css::uno::Reference< css::chart2::data::XDataSequence >& xLabels ); + + static css::uno::Reference< css::chart2::data::XLabeledDataSequence > + createLabeledDataSequence( + const css::uno::Reference< css::chart2::data::XDataSequence >& xValues ); + + static css::uno::Reference< css::chart2::data::XLabeledDataSequence > + createLabeledDataSequence(); + + static css::uno::Sequence< css::beans::PropertyValue > + createArguments( + bool bUseColumns, bool bFirstCellAsLabel, bool bHasCategories ); + + static css::uno::Sequence< + css::beans::PropertyValue > createArguments( + const OUString & rRangeRepresentation, + const css::uno::Sequence< sal_Int32 >& rSequenceMapping, + bool bUseColumns, bool bFirstCellAsLabel, bool bHasCategories ); + + SAL_DLLPRIVATE static void readArguments( const css::uno::Sequence< css::beans::PropertyValue >& rArguments + , OUString & rRangeRepresentation, css::uno::Sequence< sal_Int32 >& rSequenceMapping + , bool& bUseColumns, bool& bFirstCellAsLabel, bool& bHasCategories ); + + static css::uno::Reference< css::chart2::data::XDataSource > + pressUsedDataIntoRectangularFormat( const css::uno::Reference< css::chart2::XChartDocument >& xChartDoc ); + + SAL_DLLPRIVATE static css::uno::Sequence< OUString > getUsedDataRanges( + const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + + static css::uno::Sequence< OUString > getUsedDataRanges( + const css::uno::Reference< css::frame::XModel > & xChartModel ); + + static css::uno::Reference< css::chart2::data::XDataSource > getUsedData( + ChartModel& rModel ); + + static css::uno::Reference< css::chart2::data::XDataSource > getUsedData( + const css::uno::Reference< css::frame::XModel >& xChartModel ); + + static css::uno::Reference< css::chart2::data::XDataSource > getUsedData( + const css::uno::Reference<css::chart2::XChartDocument >& xChartDoc ); + + static bool detectRangeSegmentation( + const css::uno::Reference< css::frame::XModel >& xChartModel + , OUString& rOutRangeString + , css::uno::Sequence< sal_Int32 >& rSequenceMapping + , bool& rOutUseColumns + , bool& rOutFirstCellAsLabel + , bool& rOutHasCategories ); + + static void setRangeSegmentation( + const css::uno::Reference< css::frame::XModel >& xChartModel + , const css::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 css::uno::Reference< css::chart2::XChartDocument >& xChartDocument ); + + SAL_DLLPRIVATE static css::uno::Sequence< OUString > getRangesFromLabeledDataSequence( + const css::uno::Reference< css::chart2::data::XLabeledDataSequence > & xLSeq ); + + SAL_DLLPRIVATE static OUString getRangeFromValues( + const css::uno::Reference< css::chart2::data::XLabeledDataSequence > & xLSeq ); + + SAL_DLLPRIVATE static css::uno::Sequence< OUString > getRangesFromDataSource( + const css::uno::Reference< css::chart2::data::XDataSource > & xSource ); +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx new file mode 100644 index 000000000..3fcd9a0af --- /dev/null +++ b/chart2/source/inc/DiagramHelper.hxx @@ -0,0 +1,298 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_DIAGRAMHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_DIAGRAMHELPER_HXX + +#include "StackMode.hxx" +#include "charttoolsdllapi.hxx" +#include <com/sun/star/awt/Rectangle.hpp> +#include <com/sun/star/chart2/XChartTypeTemplate.hpp> + +#include <utility> +#include <vector> + +namespace chart { class ChartModel; } +namespace com::sun::star::chart2 { class XAxis; } +namespace com::sun::star::chart2 { class XChartDocument; } +namespace com::sun::star::chart2 { class XCoordinateSystem; } +namespace com::sun::star::chart2 { class XDiagram; } +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::lang { class XMultiServiceFactory; } +namespace com::sun::star::uno { class XComponentContext; } +namespace com::sun::star::util { class XNumberFormats; } +namespace com::sun::star::util { class XNumberFormatsSupplier; } + +namespace chart +{ + +enum DiagramPositioningMode +{ + DiagramPositioningMode_AUTO, + DiagramPositioningMode_EXCLUDING, + DiagramPositioningMode_INCLUDING +}; + +class OOO_DLLPUBLIC_CHARTTOOLS DiagramHelper +{ +public: + typedef std::pair< + css::uno::Reference< css::chart2::XChartTypeTemplate >, + OUString > + tTemplateWithServiceName; + + /** tries to find a template in the chart-type manager that matches the + given diagram. + + @return + A pair containing a template with the correct properties set as + first entry and the service name of the templates second entry. If + no template was found both elements are empty. + */ + static tTemplateWithServiceName + getTemplateForDiagram( + const css::uno::Reference< css::chart2::XDiagram > & xDiagram, + const css::uno::Reference< css::lang::XMultiServiceFactory > & xChartTypeManager); + + /** 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 css::uno::Reference< css::chart2::XDiagram > & xDiagram, + bool bVertical ); + + /** 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 css::uno::Reference< css::chart2::XDiagram > & xDiagram, + bool& rbOutFoundResult, bool& rbOutAmbiguousResult ); + + static StackMode getStackMode( + const css::uno::Reference< css::chart2::XDiagram > & xDiagram, + bool& rbFound, bool& rbAmbiguous + ); + + /** 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 css::uno::Reference< css::chart2::XDiagram > & xDiagram, + StackMode eStackMode + ); + + /** 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 css::uno::Reference< css::chart2::XChartType > & xChartType, + bool& rbFound, bool& rbAmbiguous, + const css::uno::Reference< css::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem + ); + + /** 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 css::uno::Reference< css::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 css::uno::Reference< css::chart2::XDiagram > & xDiagram, + sal_Int32 nNewDimensionCount ); + + /** Replaces all occurrences of xCooSysToReplace in the tree with + xReplacement in the diagram's tree + */ + SAL_DLLPRIVATE static void replaceCoordinateSystem( + const css::uno::Reference< css::chart2::XDiagram > & xDiagram, + const css::uno::Reference< css::chart2::XCoordinateSystem > & xCooSysToReplace, + const css::uno::Reference< css::chart2::XCoordinateSystem > & xReplacement ); + + static bool isSeriesAttachedToMainAxis( + const css::uno::Reference< css::chart2::XDataSeries >& xDataSeries ); + + static bool attachSeriesToAxis( bool bMainAxis, + const css::uno::Reference< css::chart2::XDataSeries >& xSeries, + const css::uno::Reference< css::chart2::XDiagram >& xDiagram, + const css::uno::Reference< css::uno::XComponentContext > & xContext, + bool bAdaptAxes=true ); + + static css::uno::Reference< css::chart2::XAxis > getAttachedAxis( + const css::uno::Reference< css::chart2::XDataSeries >& xSeries, + const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + + static css::uno::Reference< css::chart2::XChartType > + getChartTypeOfSeries( + const css::uno::Reference< css::chart2::XDiagram >& xDiagram, + const css::uno::Reference< css::chart2::XDataSeries >& xSeries ); + + static std::vector< css::uno::Reference< css::chart2::XDataSeries > > + getDataSeriesFromDiagram( + const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + + /** return all data series in this diagram grouped by chart-types + */ + static css::uno::Sequence< + css::uno::Sequence< + css::uno::Reference< css::chart2::XDataSeries > > > + getDataSeriesGroups( + const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + + static bool isCategoryDiagram( + const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + + static void setCategoriesToDiagram( + const css::uno::Reference< css::chart2::data::XLabeledDataSequence >& xCategories, + const css::uno::Reference< css::chart2::XDiagram >& xDiagram, + bool bSetAxisType = false, // when this flag is true ... + bool bCategoryAxis = true);// set the AxisType to CATEGORY or back to REALNUMBER + + static css::uno::Reference< css::chart2::data::XLabeledDataSequence > + getCategoriesFromDiagram( + const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + + static css::uno::Sequence< OUString > + getExplicitSimpleCategories( ChartModel& rModel ); + + SAL_DLLPRIVATE static css::uno::Sequence< OUString > + generateAutomaticCategoriesFromCooSys( + const css::uno::Reference< css::chart2::XCoordinateSystem > & xCooSys ); + + static void switchToDateCategories( + const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc ); + + static void switchToTextCategories( + const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc ); + + static bool isSupportingDateAxis( const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + static bool isDateNumberFormat( sal_Int32 nNumberFormat, const css::uno::Reference< css::util::XNumberFormats >& xNumberFormats ); + static sal_Int32 getDateNumberFormat( const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier ); + static sal_Int32 getDateTimeInputNumberFormat( const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier, double fNumber ); + + static sal_Int32 getPercentNumberFormat( const css::uno::Reference< + css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier ); + + static css::uno::Reference< css::chart2::XChartType > + getChartTypeByIndex( const css::uno::Reference< css::chart2::XDiagram >& xDiagram, sal_Int32 nIndex ); + + static css::uno::Sequence< + css::uno::Reference< css::chart2::XChartType > > + getChartTypesFromDiagram( + const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + + SAL_DLLPRIVATE static bool areChartTypesCompatible( const css::uno::Reference< + css::chart2::XChartType >& xFirstType, + const css::uno::Reference< css::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 </sal_True> if the series can be moved. + * + */ + static bool isSeriesMoveable( + const css::uno::Reference< css::chart2::XDiagram >& xDiagram, + const css::uno::Reference< css::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 </sal_True> if the series was moved successfully. + * + */ + static bool moveSeries( + const css::uno::Reference< css::chart2::XDiagram >& xDiagram, + const css::uno::Reference< css::chart2::XDataSeries >& xGivenDataSeries, + bool bForward ); + + static bool isSupportingFloorAndWall( const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + + static bool isPieOrDonutChart( const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + + static sal_Int32 getGeometry3D( + const css::uno::Reference< css::chart2::XDiagram > & xDiagram, + bool& rbFound, bool& rbAmbiguous ); + + static void setGeometry3D( + const css::uno::Reference< css::chart2::XDiagram > & xDiagram, + sal_Int32 nNewGeometry ); + + //returns integer from constant group css::chart::MissingValueTreatment + static sal_Int32 getCorrectedMissingValueTreatment( + const css::uno::Reference< css::chart2::XDiagram > & xDiagram, + const css::uno::Reference< css::chart2::XChartType >& xChartType ); + + static DiagramPositioningMode getDiagramPositioningMode( const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + + static bool setDiagramPositioning( const css::uno::Reference< css::frame::XModel >& xChartModel, + const css::awt::Rectangle& rPosRect /*100th mm*/ ); + + static css::awt::Rectangle getDiagramRectangleFromModel( const css::uno::Reference< css::frame::XModel >& xChartModel ); + + static bool switchDiagramPositioningToExcludingPositioning( ChartModel& rModel + , bool bResetModifiedState //set model back to unchanged if it was unchanged before + , bool bConvertAlsoFromAutoPositioning ); + +private: + DiagramHelper() = delete; + +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_DIAGRAMHELPER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/DisposeHelper.hxx b/chart2/source/inc/DisposeHelper.hxx new file mode 100644 index 000000000..9f02ca3f8 --- /dev/null +++ b/chart2/source/inc/DisposeHelper.hxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_DISPOSEHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_DISPOSEHELPER_HXX + +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/lang/XComponent.hpp> + +namespace chart +{ +namespace DisposeHelper +{ + +template<class T> +void Dispose(const T & xInterface) +{ + css::uno::Reference<css::lang::XComponent> xComponent(xInterface, css::uno::UNO_QUERY); + if (xComponent.is()) + xComponent->dispose(); +} + +template<class T> +void DisposeAndClear(css::uno::Reference<T> & rInterface) +{ + Dispose<css::uno::Reference<T>>(rInterface); + rInterface.set(nullptr); +} + +template<class Container> +void DisposeAllElements(Container & rContainer) +{ + for (const auto & rElement : rContainer) + { + Dispose<typename Container::value_type>(rElement); + } +} + +}} // namespace chart::DisposeHelper + +#endif // INCLUDED_CHART2_SOURCE_INC_DISPOSEHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ErrorBar.hxx b/chart2/source/inc/ErrorBar.hxx new file mode 100644 index 000000000..6cd513ebc --- /dev/null +++ b/chart2/source/inc/ErrorBar.hxx @@ -0,0 +1,144 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_ERRORBAR_HXX +#define INCLUDED_CHART2_SOURCE_INC_ERRORBAR_HXX + +#include "MutexContainer.hxx" +#include "charttoolsdllapi.hxx" + +#include <cppuhelper/implbase.hxx> + +#include <com/sun/star/beans/XPropertySet.hpp> +#include <com/sun/star/beans/XPropertyState.hpp> +#include <com/sun/star/chart2/data/XDataSink.hpp> +#include <com/sun/star/chart2/data/XDataSource.hpp> +#include <com/sun/star/drawing/LineStyle.hpp> +#include <com/sun/star/drawing/LineJoint.hpp> +#include <com/sun/star/drawing/LineDash.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/uno/Any.h> +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/util/Color.hpp> +#include <com/sun/star/util/XModifyListener.hpp> +#include <com/sun/star/util/XModifyBroadcaster.hpp> + + +#include <vector> + +namespace chart +{ + +namespace impl +{ +typedef ::cppu::WeakImplHelper< + css::lang::XServiceInfo, + css::util::XCloneable, + css::util::XModifyBroadcaster, + css::util::XModifyListener, + css::chart2::data::XDataSource, + css::chart2::data::XDataSink, + css::beans::XPropertySet, + css::beans::XPropertyState > + ErrorBar_Base; +} + +class ErrorBar final : + public MutexContainer, + public impl::ErrorBar_Base +{ +private: + OUString maDashName; + css::drawing::LineDash maLineDash; + sal_Int32 mnLineWidth; + css::drawing::LineStyle meLineStyle; + css::util::Color maLineColor; + sal_Int16 mnLineTransparence; + css::drawing::LineJoint meLineJoint; + bool mbShowPositiveError; + bool mbShowNegativeError; + double mfPositiveError; + double mfNegativeError; + double mfWeight; + sal_Int32 meStyle; + +public: + OOO_DLLPUBLIC_CHARTTOOLS explicit ErrorBar(); + virtual ~ErrorBar() override; + + /// XServiceInfo declarations + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL + getPropertySetInfo() override; + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + // XPropertyState + virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& rPropName ) override; + virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( + const css::uno::Sequence< OUString >& rPropNames ) override; + virtual void SAL_CALL setPropertyToDefault( const OUString& rPropName ) override; + virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& rPropName ) override; + +private: + ErrorBar( const ErrorBar & rOther ); + + // ____ XCloneable ____ + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override; + + // ____ XModifyBroadcaster ____ + virtual void SAL_CALL addModifyListener( + const css::uno::Reference< css::util::XModifyListener >& aListener ) override; + virtual void SAL_CALL removeModifyListener( + const css::uno::Reference< css::util::XModifyListener >& aListener ) override; + + // ____ XModifyListener ____ + virtual void SAL_CALL modified( + const css::lang::EventObject& aEvent ) override; + + // ____ XEventListener (base of XModifyListener) ____ + virtual void SAL_CALL disposing( + const css::lang::EventObject& Source ) override; + + // ____ XDataSink ____ + virtual void SAL_CALL setData( const css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > >& aData ) override; + + // ____ XDataSource ____ + virtual css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > SAL_CALL getDataSequences() override; + + typedef std::vector< css::uno::Reference< + css::chart2::data::XLabeledDataSequence > > tDataSequenceContainer; + tDataSequenceContainer m_aDataSequences; + + css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_ERRORBAR_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/EventListenerHelper.hxx b/chart2/source/inc/EventListenerHelper.hxx new file mode 100644 index 000000000..c40fdc49c --- /dev/null +++ b/chart2/source/inc/EventListenerHelper.hxx @@ -0,0 +1,124 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_EVENTLISTENERHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_EVENTLISTENERHELPER_HXX + +#include <com/sun/star/lang/XComponent.hpp> + +#include <algorithm> + +namespace com::sun::star::lang { class XEventListener; } + +namespace chart +{ +namespace EventListenerHelper +{ + +namespace impl +{ + +template< class InterfaceRef > +struct addListenerFunctor +{ + explicit addListenerFunctor( const css::uno::Reference< css::lang::XEventListener > & xListener ) : + m_xListener( xListener ) + {} + + void operator() ( const InterfaceRef & xObject ) + { + css::uno::Reference< css::lang::XComponent > + xBroadcaster( xObject, css::uno::UNO_QUERY ); + if( xBroadcaster.is() && m_xListener.is()) + xBroadcaster->addEventListener( m_xListener ); + } +private: + css::uno::Reference< css::lang::XEventListener > m_xListener; +}; + +template< class InterfaceRef > +struct removeListenerFunctor +{ + explicit removeListenerFunctor( const css::uno::Reference< css::lang::XEventListener > & xListener ) : + m_xListener( xListener ) + {} + + void operator() ( const InterfaceRef & xObject ) + { + css::uno::Reference< css::lang::XComponent > + xBroadcaster( xObject, css::uno::UNO_QUERY ); + if( xBroadcaster.is() && m_xListener.is()) + xBroadcaster->removeEventListener( m_xListener ); + } +private: + css::uno::Reference< css::lang::XEventListener > m_xListener; +}; + +} // namespace impl + +template< class InterfaceRef > +void addListener( + const InterfaceRef & xObject, + const css::uno::Reference< css::lang::XEventListener > & xListener ) +{ + if( xListener.is()) + { + impl::addListenerFunctor< InterfaceRef > aFunctor( xListener ); + aFunctor( xObject ); + } +} + +template< class Container > +void addListenerToAllElements( + const Container & rContainer, + const css::uno::Reference< css::lang::XEventListener > & xListener ) +{ + if( xListener.is()) + std::for_each( rContainer.begin(), rContainer.end(), + impl::addListenerFunctor< typename Container::value_type >( xListener )); +} + +template< class InterfaceRef > +void removeListener( + const InterfaceRef & xObject, + const css::uno::Reference< css::lang::XEventListener > & xListener ) +{ + if( xListener.is()) + { + impl::removeListenerFunctor< InterfaceRef > aFunctor( xListener ); + aFunctor( xObject ); + } +} + +template< class Container > +void removeListenerFromAllElements( + const Container & rContainer, + const css::uno::Reference< css::lang::XEventListener > & xListener ) +{ + if( xListener.is()) + std::for_each( rContainer.begin(), rContainer.end(), + impl::removeListenerFunctor< typename Container::value_type >( xListener )); +} + +} // namespace EventListenerHelper +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_EVENTLISTENERHELPER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ExplicitCategoriesProvider.hxx b/chart2/source/inc/ExplicitCategoriesProvider.hxx new file mode 100644 index 000000000..13c9a3605 --- /dev/null +++ b/chart2/source/inc/ExplicitCategoriesProvider.hxx @@ -0,0 +1,117 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_EXPLICITCATEGORIESPROVIDER_HXX +#define INCLUDED_CHART2_SOURCE_INC_EXPLICITCATEGORIESPROVIDER_HXX + +#include "charttoolsdllapi.hxx" +#include <cppuhelper/weakref.hxx> +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Sequence.h> + +#include <vector> + +namespace chart { class ChartModel; } +namespace com::sun::star::chart2 { class XCoordinateSystem; } +namespace com::sun::star::chart2::data { class XDataSequence; } +namespace com::sun::star::chart2::data { class XLabeledDataSequence; } +namespace com::sun::star::uno { class Any; } + +namespace chart +{ + +struct OOO_DLLPUBLIC_CHARTTOOLS ComplexCategory +{ + OUString Text; + sal_Int32 Count; + + ComplexCategory( const OUString& rText, sal_Int32 nCount ) : Text( rText ), Count (nCount) + {} +}; + +class SplitCategoriesProvider +{ +public: + virtual ~SplitCategoriesProvider(); + + virtual sal_Int32 getLevelCount() const = 0; + virtual css::uno::Sequence< OUString > getStringsForLevel( sal_Int32 nIndex ) const = 0; +}; + +class OOO_DLLPUBLIC_CHARTTOOLS ExplicitCategoriesProvider final +{ +public: + ExplicitCategoriesProvider( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSysModel + , ChartModel& rChartModel + ); + ~ExplicitCategoriesProvider(); + + void init(); + + css::uno::Reference< css::chart2::data::XDataSequence > getOriginalCategories(); + + css::uno::Sequence< OUString > const & getSimpleCategories(); + const std::vector<ComplexCategory>* getCategoriesByLevel( sal_Int32 nLevel ); + + static OUString getCategoryByIndex( + const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSysModel + , ChartModel& rModel + , sal_Int32 nIndex ); + + static css::uno::Sequence< OUString > getExplicitSimpleCategories( + const SplitCategoriesProvider& rSplitCategoriesProvider ); + + static void convertCategoryAnysToText( css::uno::Sequence< OUString >& rOutTexts + , const css::uno::Sequence< css::uno::Any >& rInAnys + , ChartModel& rModel ); + + bool hasComplexCategories() const; + sal_Int32 getCategoryLevelCount() const; + + const css::uno::Sequence< css::uno::Reference< + css::chart2::data::XLabeledDataSequence> >& getSplitCategoriesList() const { return m_aSplitCategoriesList;} + + bool isDateAxis(); + const std::vector< double >& getDateCategories(); + +private: + ExplicitCategoriesProvider(ExplicitCategoriesProvider const &) = delete; + ExplicitCategoriesProvider& operator =(ExplicitCategoriesProvider const &) = delete; + + bool volatile m_bDirty; + css::uno::WeakReference< css::chart2::XCoordinateSystem > m_xCooSysModel; + ChartModel& mrModel; + css::uno::Reference< css::chart2::data::XLabeledDataSequence> m_xOriginalCategories; + + bool m_bIsExplicitCategoriesInited; + css::uno::Sequence< OUString > m_aExplicitCategories; + std::vector< std::vector< ComplexCategory > > m_aComplexCats; + css::uno::Sequence< css::uno::Reference< + css::chart2::data::XLabeledDataSequence> > m_aSplitCategoriesList; + + bool m_bIsDateAxis; + bool m_bIsAutoDate; + std::vector< double > m_aDateCategories; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_EXPLICITCATEGORIESPROVIDER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx b/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx new file mode 100644 index 000000000..ba08bb13d --- /dev/null +++ b/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_EXPONENTIALREGRESSIONCURVECALCULATOR_HXX +#define INCLUDED_CHART2_SOURCE_INC_EXPONENTIALREGRESSIONCURVECALCULATOR_HXX + +#include "RegressionCurveCalculator.hxx" + +namespace chart +{ + +class ExponentialRegressionCurveCalculator : public RegressionCurveCalculator +{ +public: + ExponentialRegressionCurveCalculator(); + virtual ~ExponentialRegressionCurveCalculator() override; + +protected: + virtual OUString ImplGetRepresentation( + const css::uno::Reference<css::util::XNumberFormatter>& xNumFormatter, + sal_Int32 nNumberFormatKey, sal_Int32* pFormulaLength = nullptr ) const override; + +private: + // ____ XRegressionCurveCalculator ____ + virtual void SAL_CALL recalculateRegression( + const css::uno::Sequence<double>& aXValues, + const css::uno::Sequence<double>& aYValues ) override; + + virtual double SAL_CALL getCurveValue( double x ) override; + + virtual css::uno::Sequence<css::geometry::RealPoint2D> SAL_CALL getCurveValues( + double min, + double max, + sal_Int32 nPointCount, + const css::uno::Reference<css::chart2::XScaling>& xScalingX, + const css::uno::Reference<css::chart2::XScaling>& xScalingY, + sal_Bool bMaySkipPointsInCalculation ) override; + + // formula is: f(x) = m_fSign * exp(m_fLogIntercept) * exp( m_fLogSlope * x ) + // mathematical model f(x) = Intercept * Slope^x + double m_fLogSlope; + double m_fLogIntercept; + double m_fSign; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_EXPONENTIALREGRESSIONCURVECALCULATOR_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/FastPropertyIdRanges.hxx b/chart2/source/inc/FastPropertyIdRanges.hxx new file mode 100644 index 000000000..a2572c511 --- /dev/null +++ b/chart2/source/inc/FastPropertyIdRanges.hxx @@ -0,0 +1,51 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_FASTPROPERTYIDRANGES_HXX +#define INCLUDED_CHART2_SOURCE_INC_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 + +// INCLUDED_CHART2_SOURCE_INC_FASTPROPERTYIDRANGES_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/FillProperties.hxx b/chart2/source/inc/FillProperties.hxx new file mode 100644 index 000000000..65a7b221e --- /dev/null +++ b/chart2/source/inc/FillProperties.hxx @@ -0,0 +1,78 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_FILLPROPERTIES_HXX +#define INCLUDED_CHART2_SOURCE_INC_FILLPROPERTIES_HXX + +#include "PropertyHelper.hxx" +#include "FastPropertyIdRanges.hxx" +#include "charttoolsdllapi.hxx" + +#include <vector> + +namespace com::sun::star::beans { struct Property; } + +namespace chart +{ + +// implements service FillProperties +namespace FillProperties +{ + // FastProperty Ids for properties + enum + { + // 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 + }; + + OOO_DLLPUBLIC_CHARTTOOLS void AddPropertiesToVector( + std::vector< css::beans::Property > & rOutProperties ); + + OOO_DLLPUBLIC_CHARTTOOLS void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ); +} + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_FILLPROPERTIES_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/FormattedStringHelper.hxx b/chart2/source/inc/FormattedStringHelper.hxx new file mode 100644 index 000000000..9953de31a --- /dev/null +++ b/chart2/source/inc/FormattedStringHelper.hxx @@ -0,0 +1,46 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_FORMATTEDSTRINGHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_FORMATTEDSTRINGHELPER_HXX + +#include <com/sun/star/uno/Sequence.h> + +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::chart2 { class XFormattedString2; } +namespace com::sun::star::uno { class XComponentContext; } +namespace com::sun::star::uno { template <class interface_type> class Reference; } + +namespace chart +{ + +class FormattedStringHelper +{ +public: + static css::uno::Sequence< + css::uno::Reference< css::chart2::XFormattedString2 > > + createFormattedStringSequence( + const css::uno::Reference< css::uno::XComponentContext > & xContext + , const OUString & rString + , const css::uno::Reference< css::beans::XPropertySet > & xTextProperties ) throw(); +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/InternalData.hxx b/chart2/source/inc/InternalData.hxx new file mode 100644 index 000000000..25ed60606 --- /dev/null +++ b/chart2/source/inc/InternalData.hxx @@ -0,0 +1,99 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_INTERNALDATA_HXX +#define INCLUDED_CHART2_SOURCE_INC_INTERNALDATA_HXX + +#include <com/sun/star/uno/Sequence.hxx> + +#include <vector> +#include <valarray> + +namespace chart +{ + +class InternalData +{ +public: + InternalData(); + + void createDefaultData(); + + void setData( const css::uno::Sequence< css::uno::Sequence< double > > & rDataInRows ); + css::uno::Sequence< css::uno::Sequence< double > > getData() const; + + css::uno::Sequence< double > getColumnValues( sal_Int32 nColumnIndex ) const; + css::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< css::uno::Any >& rComplexLabel ); + void setComplexRowLabel( sal_Int32 nRowIndex, const std::vector< css::uno::Any >& rComplexLabel ); + + std::vector< css::uno::Any > getComplexColumnLabel( sal_Int32 nColumnIndex ) const; + std::vector< css::uno::Any > 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::vector< std::vector< css::uno::Any > > tVecVecAny; //inner index is hierarchical level + + void setComplexRowLabels( const tVecVecAny& rNewRowLabels ); + const tVecVecAny& getComplexRowLabels() const; + void setComplexColumnLabels( const tVecVecAny& rNewColumnLabels ); + const tVecVecAny& getComplexColumnLabels() const; + + void dump() const; + +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; + + typedef std::valarray< double > tDataType; + tDataType m_aData; + tVecVecAny m_aRowLabels;//outer index is row index, inner index is category level + tVecVecAny m_aColumnLabels;//outer index is column index +}; + +#endif + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/InternalDataProvider.hxx b/chart2/source/inc/InternalDataProvider.hxx new file mode 100644 index 000000000..7c3491ae1 --- /dev/null +++ b/chart2/source/inc/InternalDataProvider.hxx @@ -0,0 +1,219 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_INTERNALDATAPROVIDER_HXX +#define INCLUDED_CHART2_SOURCE_INC_INTERNALDATAPROVIDER_HXX + +#include "InternalData.hxx" + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/chart/XDateCategories.hpp> +#include <com/sun/star/chart2/XAnyDescriptionAccess.hpp> +#include <com/sun/star/chart2/XInternalDataProvider.hpp> +#include <com/sun/star/chart2/data/XRangeXMLConversion.hpp> +#include <com/sun/star/lang/XInitialization.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <cppuhelper/implbase.hxx> +#include <cppuhelper/weakref.hxx> + +#include <map> + +namespace com::sun::star::chart2 { class XChartDocument; } + +namespace chart +{ + +namespace impl +{ + +typedef ::cppu::WeakImplHelper< + css::chart2::XInternalDataProvider, + css::chart2::data::XRangeXMLConversion, + css::chart2::XAnyDescriptionAccess, + css::chart::XDateCategories, + css::util::XCloneable, + css::lang::XInitialization, + css::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(); + + // #i120559# allow handing over a default for data orientation + // (DataInColumns) that will be used when no data is available + explicit InternalDataProvider( + const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc, + bool bConnectToModel, + bool bDefaultDataInColumns ); + explicit InternalDataProvider( const InternalDataProvider & rOther ); + virtual ~InternalDataProvider() override; + + /// declare XServiceInfo methods + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // ____ XInternalDataProvider ____ + virtual sal_Bool SAL_CALL hasDataByRangeRepresentation( const OUString& aRange ) override; + virtual css::uno::Sequence< css::uno::Any > SAL_CALL + getDataByRangeRepresentation( const OUString& aRange ) override; + virtual void SAL_CALL setDataByRangeRepresentation( + const OUString& aRange, + const css::uno::Sequence< css::uno::Any >& aNewData ) override; + virtual void SAL_CALL insertSequence( ::sal_Int32 nAfterIndex ) override; + virtual void SAL_CALL deleteSequence( ::sal_Int32 nAtIndex ) override; + virtual void SAL_CALL appendSequence() override; + virtual void SAL_CALL insertComplexCategoryLevel( ::sal_Int32 nLevel ) override; + virtual void SAL_CALL deleteComplexCategoryLevel( ::sal_Int32 nLevel ) override; + virtual void SAL_CALL insertDataPointForAllSequences( ::sal_Int32 nAfterIndex ) override; + virtual void SAL_CALL deleteDataPointForAllSequences( ::sal_Int32 nAtIndex ) override; + virtual void SAL_CALL swapDataPointWithNextOneForAllSequences( ::sal_Int32 nAtIndex ) override; + virtual void SAL_CALL registerDataSequenceForChanges( + const css::uno::Reference< css::chart2::data::XDataSequence >& xSeq ) override; + + // ____ XDataProvider (base of XInternalDataProvider) ____ + virtual sal_Bool SAL_CALL createDataSourcePossible( + const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override; + virtual css::uno::Reference< css::chart2::data::XDataSource > SAL_CALL createDataSource( + const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override; + virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL detectArguments( + const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource ) override; + virtual sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible( + const OUString& aRangeRepresentation ) override; + virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL createDataSequenceByRangeRepresentation( + const OUString& aRangeRepresentation ) override; + + virtual css::uno::Reference<css::chart2::data::XDataSequence> SAL_CALL + createDataSequenceByValueArray( const OUString& aRole, const OUString& aRangeRepresentation ) override; + + virtual css::uno::Reference< css::sheet::XRangeSelection > SAL_CALL getRangeSelection() override; + + // ____ XRangeXMLConversion ____ + virtual OUString SAL_CALL convertRangeToXML( + const OUString& aRangeRepresentation ) override; + virtual OUString SAL_CALL convertRangeFromXML( + const OUString& aXMLRange ) override; + + // ____ XDateCategories ____ + virtual css::uno::Sequence< double > SAL_CALL getDateCategories() override; + virtual void SAL_CALL setDateCategories( const css::uno::Sequence< double >& rDates ) override; + + // ____ XAnyDescriptionAccess ____ + virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL + getAnyRowDescriptions() override; + virtual void SAL_CALL setAnyRowDescriptions( + const css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& aRowDescriptions ) override; + virtual css::uno::Sequence< css::uno::Sequence< css::uno::Any > > SAL_CALL + getAnyColumnDescriptions() override; + virtual void SAL_CALL setAnyColumnDescriptions( + const css::uno::Sequence< css::uno::Sequence< css::uno::Any > >& aColumnDescriptions ) override; + + // ____ XComplexDescriptionAccess (base of XAnyDescriptionAccess) ____ + virtual css::uno::Sequence< css::uno::Sequence< OUString > > SAL_CALL + getComplexRowDescriptions() override; + virtual void SAL_CALL setComplexRowDescriptions( + const css::uno::Sequence< css::uno::Sequence< OUString > >& aRowDescriptions ) override; + virtual css::uno::Sequence< css::uno::Sequence< OUString > > SAL_CALL + getComplexColumnDescriptions() override; + virtual void SAL_CALL setComplexColumnDescriptions( + const css::uno::Sequence< css::uno::Sequence< OUString > >& aColumnDescriptions ) override; + + // ____ XChartDataArray (base of XComplexDescriptionAccess) ____ + virtual css::uno::Sequence< css::uno::Sequence< double > > SAL_CALL getData() override; + virtual void SAL_CALL setData( + const css::uno::Sequence< css::uno::Sequence< double > >& aData ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getRowDescriptions() override; + virtual void SAL_CALL setRowDescriptions( + const css::uno::Sequence< OUString >& aRowDescriptions ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getColumnDescriptions() override; + virtual void SAL_CALL setColumnDescriptions( + const css::uno::Sequence< OUString >& aColumnDescriptions ) override; + + // ____ XChartData (base of XChartDataArray) ____ + virtual void SAL_CALL addChartDataChangeEventListener( + const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override; + virtual void SAL_CALL removeChartDataChangeEventListener( + const css::uno::Reference< css::chart::XChartDataChangeEventListener >& aListener ) override; + virtual double SAL_CALL getNotANumber() override; + virtual sal_Bool SAL_CALL isNotANumber( + double nNumber ) override; + + // ____ XCloneable ____ + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override; + // css::lang::XInitialization: + virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > & aArguments) override; + +private: + void addDataSequenceToMap( + const OUString & rRangeRepresentation, + const css::uno::Reference< css::chart2::data::XDataSequence > & xSequence ); + + css::uno::Reference< css::chart2::data::XDataSequence > + createDataSequenceAndAddToMap( const OUString & rRangeRepresentation, + const OUString & rRole ); + css::uno::Reference< css::chart2::data::XDataSequence > + createDataSequenceAndAddToMap( const OUString & rRangeRepresentation ); + + css::uno::Reference<css::chart2::data::XDataSequence> + createDataSequenceFromArray( const OUString& rArrayStr, const OUString& rRole ); + + void deleteMapReferences( const OUString & rRangeRepresentation ); + + void adaptMapReferences( + const OUString & rOldRangeRepresentation, + const OUString & rNewRangeRepresentation ); + + void increaseMapReferences( sal_Int32 nBegin, sal_Int32 nEnd ); + void decreaseMapReferences( sal_Int32 nBegin, sal_Int32 nEnd ); + + typedef std::multimap< OUString, + css::uno::WeakReference< css::chart2::data::XDataSequence > > + tSequenceMap; + typedef std::pair< tSequenceMap::iterator, tSequenceMap::iterator > tSequenceMapRange; + + /** 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 + +// INCLUDED_CHART2_SOURCE_INC_INTERNALDATAPROVIDER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/LabeledDataSequence.hxx b/chart2/source/inc/LabeledDataSequence.hxx new file mode 100644 index 000000000..dd99ac847 --- /dev/null +++ b/chart2/source/inc/LabeledDataSequence.hxx @@ -0,0 +1,92 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_LABELEDDATASEQUENCE_HXX +#define INCLUDED_CHART2_SOURCE_INC_LABELEDDATASEQUENCE_HXX + +#include "MutexContainer.hxx" +#include <cppuhelper/implbase.hxx> + +#include <com/sun/star/chart2/data/XLabeledDataSequence2.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +namespace com::sun::star::chart2::data { class XDataSequence; } +namespace com::sun::star::util { class XCloneable; } +namespace com::sun::star::util { class XModifyListener; } + +namespace chart +{ + +namespace impl +{ +typedef cppu::WeakImplHelper< + css::chart2::data::XLabeledDataSequence2, + css::lang::XServiceInfo > + LabeledDataSequence_Base; +} + +class LabeledDataSequence : + public MutexContainer, + public impl::LabeledDataSequence_Base +{ +public: + explicit LabeledDataSequence(); + explicit LabeledDataSequence( + const css::uno::Reference< css::chart2::data::XDataSequence > & rValues ); + explicit LabeledDataSequence( + const css::uno::Reference< css::chart2::data::XDataSequence > & rValues, + const css::uno::Reference< css::chart2::data::XDataSequence > & rLabels ); + + virtual ~LabeledDataSequence() override; + + /// declare XServiceInfo methods + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + +protected: + // ____ XLabeledDataSequence ____ + virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL getValues() override; + virtual void SAL_CALL setValues( + const css::uno::Reference< css::chart2::data::XDataSequence >& xSequence ) override; + virtual css::uno::Reference< css::chart2::data::XDataSequence > SAL_CALL getLabel() override; + virtual void SAL_CALL setLabel( + const css::uno::Reference< css::chart2::data::XDataSequence >& xSequence ) override; + + // ____ XCloneable ____ + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override; + + // ____ XModifyBroadcaster ____ + virtual void SAL_CALL addModifyListener( + const css::uno::Reference< css::util::XModifyListener >& aListener ) override; + virtual void SAL_CALL removeModifyListener( + const css::uno::Reference< css::util::XModifyListener >& aListener ) override; + +private: + css::uno::Reference< css::chart2::data::XDataSequence > m_xData; + css::uno::Reference< css::chart2::data::XDataSequence > m_xLabel; + + css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_LABELEDDATASEQUENCE_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/LegendHelper.hxx b/chart2/source/inc/LegendHelper.hxx new file mode 100644 index 000000000..75064f594 --- /dev/null +++ b/chart2/source/inc/LegendHelper.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_LEGENDHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_LEGENDHELPER_HXX + +#include <com/sun/star/uno/Reference.hxx> +#include "charttoolsdllapi.hxx" + +namespace chart { class ChartModel; } +namespace com::sun::star::chart2 { class XDiagram; } +namespace com::sun::star::chart2 { class XLegend; } +namespace com::sun::star::uno { class XComponentContext; } + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS LegendHelper +{ +public: + static css::uno::Reference< css::chart2::XLegend > + showLegend( ChartModel& rModel + , const css::uno::Reference< css::uno::XComponentContext >& xContext ); + + static void hideLegend( ChartModel& rModel ); + + static css::uno::Reference< css::chart2::XLegend > + getLegend( ChartModel& rModel + , const css::uno::Reference< css::uno::XComponentContext >& xContext = nullptr + , 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 css::uno::Reference< css::chart2::XDiagram > & xDiagram ); +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/LifeTime.hxx b/chart2/source/inc/LifeTime.hxx new file mode 100644 index 000000000..ca1e583f9 --- /dev/null +++ b/chart2/source/inc/LifeTime.hxx @@ -0,0 +1,215 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_LIFETIME_HXX +#define INCLUDED_CHART2_SOURCE_INC_LIFETIME_HXX + +#include <osl/mutex.hxx> +#include <osl/conditn.hxx> +#include <cppuhelper/interfacecontainer.h> +#include "charttoolsdllapi.hxx" + +namespace com::sun::star::lang { class XComponent; } +namespace com::sun::star::util { class CloseVetoException; } +namespace com::sun::star::util { class XCloseListener; } +namespace com::sun::star::util { class XCloseable; } + +namespace apphelper +{ + +class OOO_DLLPUBLIC_CHARTTOOLS LifeTimeManager +{ +friend class LifeTimeGuard; +protected: + mutable ::osl::Mutex m_aAccessMutex; +public: + LifeTimeManager( css::lang::XComponent* pComponent ); + virtual ~LifeTimeManager(); + + bool impl_isDisposed( bool bAssert=true ); + /// @throws css::uno::RuntimeException + bool dispose(); + +public: + ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; + +protected: + SAL_DLLPRIVATE virtual bool impl_canStartApiCall(); + SAL_DLLPRIVATE virtual void impl_apiCallCountReachedNull(){} + + SAL_DLLPRIVATE void impl_registerApiCall(bool bLongLastingCall); + SAL_DLLPRIVATE void impl_unregisterApiCall(bool bLongLastingCall); + +protected: + css::lang::XComponent* m_pComponent; + + ::osl::Condition m_aNoAccessCountCondition; + sal_Int32 m_nAccessCount; + + bool volatile m_bDisposed; + bool volatile m_bInDispose; + + ::osl::Condition m_aNoLongLastingCallCountCondition; + sal_Int32 m_nLongLastingCallCount; +}; + +class CloseableLifeTimeManager final : public LifeTimeManager +{ + css::util::XCloseable* m_pCloseable; + + ::osl::Condition m_aEndTryClosingCondition; + bool volatile m_bClosed; + 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 + bool volatile m_bOwnership; + +public: + CloseableLifeTimeManager( css::util::XCloseable* pCloseable + , css::lang::XComponent* pComponent ); + virtual ~CloseableLifeTimeManager() override; + + bool impl_isDisposedOrClosed( bool bAssert=true ); +/// @throws css::uno::Exception + bool g_close_startTryClose(bool bDeliverOwnership); +/// @throws css::util::CloseVetoException + void g_close_isNeedToCancelLongLastingCalls( bool bDeliverOwnership, css::util::CloseVetoException const & ex ); + void g_close_endTryClose(bool bDeliverOwnership ); + void g_close_endTryClose_doClose(); +/// @throws css::uno::RuntimeException + void g_addCloseListener( const css::uno::Reference< css::util::XCloseListener > & xListener ); + +private: + virtual bool impl_canStartApiCall() override; + virtual void impl_apiCallCountReachedNull() override; + + void impl_setOwnership( bool bDeliverOwnership, bool bMyVeto ); + void impl_doClose(); +}; + +/* +Use this Guard in your ApiCalls to protect access on resources +which will be released in dispose. +It's guaranteed 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 guaranteed 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 then 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 LifeTimeGuard +{ + +public: + LifeTimeGuard( LifeTimeManager& rManager ) + : m_guard( rManager.m_aAccessMutex ) + , m_rManager(rManager) + , m_bCallRegistered(false) + , m_bLongLastingCallRegistered(false) + { + + } + bool startApiCall(bool bLongLastingCall=false); + ~LifeTimeGuard(); + void clear() { m_guard.clear(); } + +private: + osl::ClearableMutexGuard m_guard; + LifeTimeManager& m_rManager; + bool m_bCallRegistered; + bool m_bLongLastingCallRegistered; + +private: + LifeTimeGuard( const LifeTimeGuard& ) = delete; + LifeTimeGuard& operator= ( const LifeTimeGuard& ) = delete; +}; + +template<class T> +class NegativeGuard final +{ + T * m_pT; +public: + + NegativeGuard(T & t) : m_pT(&t) + { + m_pT->release(); + } + + ~NegativeGuard() + { + m_pT->acquire(); + } +}; + +}//end namespace apphelper +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/LinePropertiesHelper.hxx b/chart2/source/inc/LinePropertiesHelper.hxx new file mode 100644 index 000000000..e870a5688 --- /dev/null +++ b/chart2/source/inc/LinePropertiesHelper.hxx @@ -0,0 +1,72 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_LINEPROPERTIESHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_LINEPROPERTIESHELPER_HXX + +#include "PropertyHelper.hxx" +#include "FastPropertyIdRanges.hxx" +#include "charttoolsdllapi.hxx" + +#include <vector> + +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::beans { struct Property; } +namespace com::sun::star::uno { template <class interface_type> class Reference; } + +namespace chart +{ + +// implements service LineProperties +namespace LinePropertiesHelper +{ + // 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, + PROP_LINE_CAP + }; + + OOO_DLLPUBLIC_CHARTTOOLS void AddPropertiesToVector( + std::vector< css::beans::Property > & rOutProperties ); + + OOO_DLLPUBLIC_CHARTTOOLS void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ); + + bool IsLineVisible( const css::uno::Reference< + css::beans::XPropertySet >& xLineProperties ); + void SetLineVisible( const css::uno::Reference< + css::beans::XPropertySet >& xLineProperties ); + void SetLineInvisible( const css::uno::Reference< + css::beans::XPropertySet >& xLineProperties ); + void SetLineColor( const css::uno::Reference< + css::beans::XPropertySet >& xGridProperties, sal_Int32 nColor ); +} + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_LINEPROPERTIESHELPER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/LinearRegressionCurveCalculator.hxx b/chart2/source/inc/LinearRegressionCurveCalculator.hxx new file mode 100644 index 000000000..24d82d1ec --- /dev/null +++ b/chart2/source/inc/LinearRegressionCurveCalculator.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_LINEARREGRESSIONCURVECALCULATOR_HXX +#define INCLUDED_CHART2_SOURCE_INC_LINEARREGRESSIONCURVECALCULATOR_HXX + +#include "PolynomialRegressionCurveCalculator.hxx" + +namespace chart +{ + +class LinearRegressionCurveCalculator : public PolynomialRegressionCurveCalculator +{ +public: + LinearRegressionCurveCalculator(); + virtual ~LinearRegressionCurveCalculator() override; + +private: + virtual void SAL_CALL setRegressionProperties( + sal_Int32 aDegree, + sal_Bool aForceIntercept, + double aInterceptValue, + sal_Int32 aPeriod) override; + + virtual css::uno::Sequence<css::geometry::RealPoint2D> SAL_CALL getCurveValues( + double min, + double max, + sal_Int32 nPointCount, + const css::uno::Reference<css::chart2::XScaling>& xScalingX, + const css::uno::Reference<css::chart2::XScaling>& xScalingY, + sal_Bool bMaySkipPointsInCalculation ) override; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_LINEARREGRESSIONCURVECALCULATOR_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx b/chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx new file mode 100644 index 000000000..522756afe --- /dev/null +++ b/chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx @@ -0,0 +1,64 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_LOGARITHMICREGRESSIONCURVECALCULATOR_HXX +#define INCLUDED_CHART2_SOURCE_INC_LOGARITHMICREGRESSIONCURVECALCULATOR_HXX + +#include "RegressionCurveCalculator.hxx" + +namespace chart +{ + +class LogarithmicRegressionCurveCalculator : public RegressionCurveCalculator +{ +public: + LogarithmicRegressionCurveCalculator(); + virtual ~LogarithmicRegressionCurveCalculator() override; + +protected: + virtual OUString ImplGetRepresentation( + const css::uno::Reference<css::util::XNumberFormatter>& xNumFormatter, + sal_Int32 nNumberFormatKey, sal_Int32* pFormulaLength = nullptr ) const override; + +private: + // ____ XRegressionCurveCalculator ____ + virtual void SAL_CALL recalculateRegression( + const css::uno::Sequence<double>& aXValues, + const css::uno::Sequence<double>& aYValues ) override; + + virtual double SAL_CALL getCurveValue( double x ) override; + + virtual css::uno::Sequence<css::geometry::RealPoint2D> SAL_CALL getCurveValues( + double min, + double max, + sal_Int32 nPointCount, + const css::uno::Reference<css::chart2::XScaling>& xScalingX, + const css::uno::Reference<css::chart2::XScaling>& xScalingY, + sal_Bool bMaySkipPointsInCalculation ) override; + + // formula is: f(x) = m_fSlope * log( x ) + m_fIntercept + double m_fSlope; + double m_fIntercept; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_LOGARITHMICREGRESSIONCURVECALCULATOR_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/MeanValueRegressionCurveCalculator.hxx b/chart2/source/inc/MeanValueRegressionCurveCalculator.hxx new file mode 100644 index 000000000..7c947bec4 --- /dev/null +++ b/chart2/source/inc/MeanValueRegressionCurveCalculator.hxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_MEANVALUEREGRESSIONCURVECALCULATOR_HXX +#define INCLUDED_CHART2_SOURCE_INC_MEANVALUEREGRESSIONCURVECALCULATOR_HXX + +#include "RegressionCurveCalculator.hxx" + +namespace chart +{ + +class MeanValueRegressionCurveCalculator : public RegressionCurveCalculator +{ +public: + MeanValueRegressionCurveCalculator(); + virtual ~MeanValueRegressionCurveCalculator() override; + +protected: + virtual OUString ImplGetRepresentation( + const css::uno::Reference<css::util::XNumberFormatter>& xNumFormatter, + sal_Int32 nNumberFormatKey, sal_Int32* pFormulaLength = nullptr ) const override; + +private: + // ____ XRegressionCurveCalculator ____ + virtual void SAL_CALL recalculateRegression( + const css::uno::Sequence<double>& aXValues, + const css::uno::Sequence<double>& aYValues ) override; + + virtual double SAL_CALL getCurveValue( double x ) override; + + virtual css::uno::Sequence<css::geometry::RealPoint2D> SAL_CALL getCurveValues( + double min, + double max, + sal_Int32 nPointCount, + const css::uno::Reference<css::chart2::XScaling>& xScalingX, + const css::uno::Reference<css::chart2::XScaling>& xScalingY, + sal_Bool bMaySkipPointsInCalculation ) override; + + // formula is: f(x) = m_fMeanValue + double m_fMeanValue; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_MEANVALUEREGRESSIONCURVECALCULATOR_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/MediaDescriptorHelper.hxx b/chart2/source/inc/MediaDescriptorHelper.hxx new file mode 100644 index 000000000..f44d5d1d0 --- /dev/null +++ b/chart2/source/inc/MediaDescriptorHelper.hxx @@ -0,0 +1,93 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_MEDIADESCRIPTORHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_MEDIADESCRIPTORHELPER_HXX + +#include <com/sun/star/uno/Sequence.hxx> +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/beans/PropertyValue.hpp> +#include "charttoolsdllapi.hxx" + +namespace com::sun::star::beans { struct PropertyValue; } +namespace com::sun::star::embed { class XStorage; } +namespace com::sun::star::io { class XInputStream; } +namespace com::sun::star::io { class XOutputStream; } +namespace com::sun::star::io { class XStream; } + +/* +* 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 final +{ +public: + MediaDescriptorHelper( const css::uno::Sequence< css::beans::PropertyValue > & rMediaDescriptor ); + + const css::uno::Sequence< css::beans::PropertyValue >& getReducedForModel() const { return m_aModelProperties;} + + //all properties given in the constructor are stored in the following three sequences + + //properties which should be given to a model are additionally stored in this sequence (not documented properties and deprecated properties are not included!) + css::uno::Sequence< css::beans::PropertyValue > + m_aModelProperties; //these are properties which are not described in service com.sun.star.document.MediaDescriptor + + OUString FilterName; //internal filter name. + bool ISSET_FilterName; + + OUString HierarchicalDocumentName; + + css::uno::Reference< css::io::XOutputStream > + OutputStream; //a stream to receive the document data for saving + bool ISSET_OutputStream; + css::uno::Reference< css::io::XInputStream > + InputStream; //content of document. + bool ISSET_InputStream; + + bool ReadOnly; //open document readonly. + + OUString URL;// FileName, URL of the document. + bool ISSET_URL; + + // new framework objects + css::uno::Reference< css::embed::XStorage > + Storage; + bool ISSET_Storage; + css::uno::Reference< css::io::XStream > + Stream; + bool ISSET_Stream; + +private: + SAL_DLLPRIVATE void impl_init(); +}; + +} + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ModifyListenerHelper.hxx b/chart2/source/inc/ModifyListenerHelper.hxx new file mode 100644 index 000000000..29c4106f5 --- /dev/null +++ b/chart2/source/inc/ModifyListenerHelper.hxx @@ -0,0 +1,266 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_MODIFYLISTENERHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_MODIFYLISTENERHELPER_HXX + +#include <com/sun/star/util/XModifyListener.hpp> +#include <com/sun/star/util/XModifyBroadcaster.hpp> +#include <cppuhelper/compbase.hxx> + +#include "MutexContainer.hxx" + +#include <vector> +#include <algorithm> +#include <utility> + +namespace com::sun::star::uno { class XWeak; } +namespace com::sun::star::uno { template <class interface_type> class WeakReference; } + +namespace chart +{ +namespace ModifyListenerHelper +{ + +css::uno::Reference< css::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::WeakComponentImplHelper< + css::util::XModifyBroadcaster, + css::util::XModifyListener > +{ +public: + ModifyEventForwarder(); + + void AddListener( + const css::uno::Reference< css::util::XModifyListener >& aListener ); + void RemoveListener( + const css::uno::Reference< css::util::XModifyListener >& aListener ); + +protected: + // ____ XModifyBroadcaster ____ + virtual void SAL_CALL addModifyListener( + const css::uno::Reference< css::util::XModifyListener >& aListener ) override; + virtual void SAL_CALL removeModifyListener( + const css::uno::Reference< css::util::XModifyListener >& aListener ) override; + + // ____ XModifyListener ____ + virtual void SAL_CALL modified( + const css::lang::EventObject& aEvent ) override; + + // ____ XEventListener (base of XModifyListener) ____ + virtual void SAL_CALL disposing( + const css::lang::EventObject& Source ) override; + + // ____ WeakComponentImplHelperBase ____ + virtual void SAL_CALL disposing() override; + +private: + /// call disposing() at all listeners and remove all listeners + void DisposeAndClear( const css::uno::Reference< + css::uno::XWeak > & xSource ); + +// ::osl::Mutex & m_rMutex; + ::cppu::OBroadcastHelper m_aModifyListeners; + + typedef std::vector< + std::pair< + css::uno::WeakReference< css::util::XModifyListener >, + css::uno::Reference< css::util::XModifyListener > > > + tListenerMap; + + tListenerMap m_aListenerMap; +}; + +namespace impl +{ + +template< class InterfaceRef > +struct addListenerFunctor +{ + explicit addListenerFunctor( const css::uno::Reference< css::util::XModifyListener > & xListener ) : + m_xListener( xListener ) + {} + + void operator() ( const InterfaceRef & xObject ) + { + css::uno::Reference< css::util::XModifyBroadcaster > + xBroadcaster( xObject, css::uno::UNO_QUERY ); + if( xBroadcaster.is() && m_xListener.is()) + xBroadcaster->addModifyListener( m_xListener ); + } +private: + css::uno::Reference< css::util::XModifyListener > m_xListener; +}; + +template< class InterfaceRef > +struct removeListenerFunctor +{ + explicit removeListenerFunctor( const css::uno::Reference< css::util::XModifyListener > & xListener ) : + m_xListener( xListener ) + {} + + void operator() ( const InterfaceRef & xObject ) + { + css::uno::Reference< css::util::XModifyBroadcaster > + xBroadcaster( xObject, css::uno::UNO_QUERY ); + if( xBroadcaster.is() && m_xListener.is()) + xBroadcaster->removeModifyListener( m_xListener ); + } +private: + css::uno::Reference< css::util::XModifyListener > m_xListener; +}; + +template< class Pair > +struct addListenerToMappedElementFunctor +{ + explicit addListenerToMappedElementFunctor( const css::uno::Reference< css::util::XModifyListener > & xListener ) : + m_xListener( xListener ) + {} + + void operator() ( const Pair & aPair ) + { + css::uno::Reference< css::util::XModifyBroadcaster > + xBroadcaster( aPair.second, css::uno::UNO_QUERY ); + if( xBroadcaster.is() && m_xListener.is()) + xBroadcaster->addModifyListener( m_xListener ); + } +private: + css::uno::Reference< css::util::XModifyListener > m_xListener; +}; + +template< class Pair > +struct removeListenerFromMappedElementFunctor +{ + explicit removeListenerFromMappedElementFunctor( const css::uno::Reference< css::util::XModifyListener > & xListener ) : + m_xListener( xListener ) + {} + + void operator() ( const Pair & aPair ) + { + css::uno::Reference< css::util::XModifyBroadcaster > + xBroadcaster( aPair.second, css::uno::UNO_QUERY ); + if( xBroadcaster.is() && m_xListener.is()) + xBroadcaster->removeModifyListener( m_xListener ); + } +private: + css::uno::Reference< css::util::XModifyListener > m_xListener; +}; + +} // namespace impl + +template< class InterfaceRef > +void addListener( + const InterfaceRef & xObject, + const css::uno::Reference< css::util::XModifyListener > & xListener ) +{ + if( xListener.is()) + { + impl::addListenerFunctor< InterfaceRef > aFunctor( xListener ); + aFunctor( xObject ); + } +} + +template< class Container > +void addListenerToAllElements( + const Container & rContainer, + const css::uno::Reference< css::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 css::uno::Reference< css::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 css::uno::Sequence< T > & rSequence, + const css::uno::Reference< css::util::XModifyListener > & xListener ) +{ + if( xListener.is()) + std::for_each( rSequence.begin(), rSequence.end(), + impl::addListenerFunctor< T >( xListener )); +} + +template< class InterfaceRef > +void removeListener( + const InterfaceRef & xObject, + const css::uno::Reference< css::util::XModifyListener > & xListener ) +{ + if( xListener.is()) + { + impl::removeListenerFunctor< InterfaceRef > aFunctor( xListener ); + aFunctor( xObject ); + } +} + +template< class Container > +void removeListenerFromAllElements( + const Container & rContainer, + const css::uno::Reference< css::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 css::uno::Reference< css::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 css::uno::Sequence< T > & rSequence, + const css::uno::Reference< css::util::XModifyListener > & xListener ) +{ + if( xListener.is()) + std::for_each( rSequence.begin(), rSequence.end(), + impl::removeListenerFunctor< T >( xListener )); +} + +} // namespace ModifyListenerHelper +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_MODIFYLISTENERHELPER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/MovingAverageRegressionCurveCalculator.hxx b/chart2/source/inc/MovingAverageRegressionCurveCalculator.hxx new file mode 100644 index 000000000..fb6185098 --- /dev/null +++ b/chart2/source/inc/MovingAverageRegressionCurveCalculator.hxx @@ -0,0 +1,63 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_MOVINGAVERAGEREGRESSIONCURVECALCULATOR_HXX +#define INCLUDED_CHART2_SOURCE_INC_MOVINGAVERAGEREGRESSIONCURVECALCULATOR_HXX + +#include "RegressionCurveCalculator.hxx" +#include <vector> + +namespace chart +{ + +class MovingAverageRegressionCurveCalculator : public RegressionCurveCalculator +{ +public: + MovingAverageRegressionCurveCalculator(); + virtual ~MovingAverageRegressionCurveCalculator() override; + +protected: + virtual OUString ImplGetRepresentation( + const css::uno::Reference<css::util::XNumberFormatter>& xNumFormatter, + sal_Int32 nNumberFormatKey, sal_Int32* pFormulaLength = nullptr ) const override; + +private: + // ____ XRegressionCurveCalculator ____ + virtual void SAL_CALL recalculateRegression( + const css::uno::Sequence<double>& aXValues, + const css::uno::Sequence<double>& aYValues ) override; + + virtual double SAL_CALL getCurveValue( double x ) override; + + virtual css::uno::Sequence<css::geometry::RealPoint2D> SAL_CALL getCurveValues( + double min, + double max, + sal_Int32 nPointCount, + const css::uno::Reference<css::chart2::XScaling>& xScalingX, + const css::uno::Reference<css::chart2::XScaling>& xScalingY, + sal_Bool bMaySkipPointsInCalculation ) override; + + std::vector<double> aYList; + std::vector<double> aXList; +}; + +} // namespace chart + +#endif // INCLUDED_CHART2_SOURCE_INC_MOVINGAVERAGEREGRESSIONCURVECALCULATOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/MutexContainer.hxx b/chart2/source/inc/MutexContainer.hxx new file mode 100644 index 000000000..bab6b6c3f --- /dev/null +++ b/chart2/source/inc/MutexContainer.hxx @@ -0,0 +1,41 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_MUTEXCONTAINER_HXX +#define INCLUDED_CHART2_SOURCE_INC_MUTEXCONTAINER_HXX + +#include <osl/mutex.hxx> + +namespace chart +{ +class MutexContainer +{ +protected: + MutexContainer() = default; + + ~MutexContainer() = default; + + mutable ::osl::Mutex m_aMutex; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_MUTEXCONTAINER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/NameContainer.hxx b/chart2/source/inc/NameContainer.hxx new file mode 100644 index 000000000..8d13d8037 --- /dev/null +++ b/chart2/source/inc/NameContainer.hxx @@ -0,0 +1,91 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_INC_NAMECONTAINER_HXX +#define INCLUDED_CHART2_SOURCE_INC_NAMECONTAINER_HXX + +#include <com/sun/star/container/XNameContainer.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <cppuhelper/implbase.hxx> +#include "charttoolsdllapi.hxx" + +#include <map> + +namespace chart +{ + +OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::container::XNameContainer > createNameContainer( + const css::uno::Type& rType, const OUString& rServicename, const OUString& rImplementationName ); + +namespace impl +{ +typedef ::cppu::WeakImplHelper< + css::container::XNameContainer, + css::lang::XServiceInfo, + css::util::XCloneable > + NameContainer_Base; +} + +class NameContainer : public impl::NameContainer_Base +{ +public: + NameContainer() = delete; + NameContainer( const css::uno::Type& rType, const OUString& rServicename, const OUString& rImplementationName ); + explicit NameContainer( const NameContainer & rOther ); + virtual ~NameContainer() override; + + // XServiceInfo + virtual OUString SAL_CALL getImplementationName( ) override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + + // XNameContainer + virtual void SAL_CALL insertByName( const OUString& aName, const css::uno::Any& aElement ) override; + virtual void SAL_CALL removeByName( const OUString& Name ) override; + + // XNameReplace + virtual void SAL_CALL replaceByName( const OUString& aName, const css::uno::Any& aElement ) override; + + // XNameAccess + virtual css::uno::Any SAL_CALL getByName( const OUString& aName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getElementNames( ) override; + virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override; + + // XElementAccess + virtual sal_Bool SAL_CALL hasElements( ) override; + virtual css::uno::Type SAL_CALL getElementType( ) override; + + // XCloneable + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override; + +private: //member + const css::uno::Type m_aType; + const OUString m_aServicename; + const OUString m_aImplementationName; + + typedef std::map< OUString, css::uno::Any > tContentMap; + + tContentMap m_aMap; +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/NumberFormatterWrapper.hxx b/chart2/source/inc/NumberFormatterWrapper.hxx new file mode 100644 index 000000000..828ef6a3c --- /dev/null +++ b/chart2/source/inc/NumberFormatterWrapper.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_NUMBERFORMATTERWRAPPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_NUMBERFORMATTERWRAPPER_HXX + +#include "charttoolsdllapi.hxx" +#include <com/sun/star/util/XNumberFormatsSupplier.hpp> +#include <tools/solar.h> +#include <tools/date.hxx> + +class SvNumberFormatter; +class Color; + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS NumberFormatterWrapper final +{ +public: + NumberFormatterWrapper( const css::uno::Reference< css::util::XNumberFormatsSupplier >& xSupplier ); + ~NumberFormatterWrapper(); + + SvNumberFormatter* getSvNumberFormatter() const { return m_pNumberFormatter;} + const css::uno::Reference< css::util::XNumberFormatsSupplier >& + getNumberFormatsSupplier() const { return m_xNumberFormatsSupplier; }; + + OUString getFormattedString( sal_Int32 nNumberFormatKey, double fValue, Color& rLabelColor, bool& rbColorChanged ) const; + Date getNullDate() const; + +private: //private member + css::uno::Reference< css::util::XNumberFormatsSupplier > + m_xNumberFormatsSupplier; + + SvNumberFormatter* m_pNumberFormatter; + css::uno::Any m_aNullDate; +}; + +class FixedNumberFormatter final +{ +public: + FixedNumberFormatter( const css::uno::Reference< css::util::XNumberFormatsSupplier >& xSupplier + , sal_Int32 nNumberFormatKey ); + ~FixedNumberFormatter(); + + OUString getFormattedString( double fValue, Color& rLabelColor, bool& rbColorChanged ) const; + +private: + NumberFormatterWrapper m_aNumberFormatterWrapper; + sal_uLong m_nNumberFormatKey; +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/OPropertySet.hxx b/chart2/source/inc/OPropertySet.hxx new file mode 100644 index 000000000..1fafa218a --- /dev/null +++ b/chart2/source/inc/OPropertySet.hxx @@ -0,0 +1,208 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_OPROPERTYSET_HXX +#define INCLUDED_CHART2_SOURCE_INC_OPROPERTYSET_HXX + +// helper classes +#include <cppuhelper/propshlp.hxx> + +// interfaces and types +#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/style/XStyleSupplier.hpp> +#include "charttoolsdllapi.hxx" + +#include <memory> + +namespace property +{ + +namespace impl +{ class ImplOPropertySet; } + +class OPropertySet : + public ::cppu::OBroadcastHelper, + // includes beans::XPropertySet, XMultiPropertySet and XFastPropertySet + public ::cppu::OPropertySetHelper, + // includes uno::XWeak (and XInterface, esp. ref-counting) + + public css::lang::XTypeProvider, + public css::beans::XPropertyState, + public css::beans::XMultiPropertyStates, + public css::style::XStyleSupplier +{ +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. + + @throws css::beans::UnknownPropertyException + @throws css::uno::RuntimeException + */ + virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const = 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() override = 0; + + /** Try to convert the value <code>rValue</code> to the type required by the + property associated with <code>nHandle</code>. + + Override this method to take influence in modification of properties. + + If the conversion changed , </sal_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 + ( css::uno::Any & rConvertedValue, + css::uno::Any & rOldValue, + sal_Int32 nHandle, + const css::uno::Any& rValue ) override; + + /** The same as setFastPropertyValue; 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: + -- css::beans::UnknownPropertyException + -- css::beans::PropertyVetoException + -- css::lang::IllegalArgumentException + -- css::lang::WrappedTargetException + -- css::uno::RuntimeException + + @param nHandle handle + @param rValue value + + @see ::cppu::OPropertySetHelper + */ + virtual void SAL_CALL setFastPropertyValue_NoBroadcast + ( sal_Int32 nHandle, + const css::uno::Any& rValue ) override; + + /** + The same as getFastPropertyValue, but return the value through rValue and + nHandle is always valid. + + @see ::cppu::OPropertySetHelper + */ + virtual void SAL_CALL getFastPropertyValue + ( css::uno::Any& rValue, + sal_Int32 nHandle ) const override; + + /// 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(); + + // Interfaces + + // ____ XInterface ____ + virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; + + // ____ XTypeProvider ____ + virtual css::uno::Sequence< css::uno::Type > SAL_CALL + getTypes() override; + virtual css::uno::Sequence< sal_Int8 > SAL_CALL + getImplementationId() override; + + // ____ XPropertyState ____ + virtual css::beans::PropertyState SAL_CALL + getPropertyState( const OUString& PropertyName ) override; + virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL + getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override; + virtual void SAL_CALL + setPropertyToDefault( const OUString& PropertyName ) override; + virtual css::uno::Any SAL_CALL + getPropertyDefault( const OUString& aPropertyName ) override; + + // ____ XMultiPropertyStates ____ + // Note: getPropertyStates() is already implemented in XPropertyState with the + // same signature + virtual void SAL_CALL + setAllPropertiesToDefault() override; + virtual void SAL_CALL + setPropertiesToDefault( const css::uno::Sequence< OUString >& aPropertyNames ) override; + virtual css::uno::Sequence< css::uno::Any > SAL_CALL + getPropertyDefaults( const css::uno::Sequence< OUString >& aPropertyNames ) override; + + // ____ XStyleSupplier ____ + virtual css::uno::Reference< css::style::XStyle > SAL_CALL getStyle() override; + virtual void SAL_CALL setStyle( const css::uno::Reference< css::style::XStyle >& xStyle ) override; + + // ____ XMultiPropertySet ____ + virtual void SAL_CALL setPropertyValues( + const css::uno::Sequence< OUString >& PropertyNames, + const css::uno::Sequence< css::uno::Any >& Values ) override; + + // ____ XFastPropertySet ____ + virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const css::uno::Any& rValue ) override; + + // 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::unique_ptr< impl::ImplOPropertySet > m_pImplProperties; + bool m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault; +}; + +} // namespace property + +// INCLUDED_CHART2_SOURCE_INC_OPROPERTYSET_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ObjectIdentifier.hxx b/chart2/source/inc/ObjectIdentifier.hxx new file mode 100644 index 000000000..59248857b --- /dev/null +++ b/chart2/source/inc/ObjectIdentifier.hxx @@ -0,0 +1,254 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_OBJECTIDENTIFIER_HXX +#define INCLUDED_CHART2_SOURCE_INC_OBJECTIDENTIFIER_HXX + +#include "TitleHelper.hxx" +#include "charttoolsdllapi.hxx" + +#include <rtl/ustring.hxx> + +namespace chart { class ChartModel; } +namespace com::sun::star::awt { struct Point; } +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::chart2 { class XAxis; } +namespace com::sun::star::chart2 { class XChartDocument; } +namespace com::sun::star::chart2 { class XCoordinateSystem; } +namespace com::sun::star::chart2 { class XDataSeries; } +namespace com::sun::star::chart2 { class XDiagram; } +namespace com::sun::star::drawing { class XShape; } +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::uno { class XInterface; } + +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_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 separated 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 keywords 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 OUString& rObjectCID ); + ObjectIdentifier( const css::uno::Reference< css::drawing::XShape >& rxShape ); + ObjectIdentifier( const css::uno::Any& rAny ); + + bool operator==( const ObjectIdentifier& rOID ) const; + bool operator!=( const ObjectIdentifier& rOID ) const; + bool operator<( const ObjectIdentifier& rOID ) const; + + static OUString createClassifiedIdentifierForObject( + const css::uno::Reference< css::uno::XInterface >& xObject + , ChartModel& rModel); + + static OUString createClassifiedIdentifierForObject( + const css::uno::Reference< css::uno::XInterface >& xObject + , const css::uno::Reference< css::frame::XModel >& xChartModel ); + + static OUString createClassifiedIdentifierForParticle( + const OUString& rParticle ); + + static OUString createClassifiedIdentifierForParticles( + const OUString& rParentParticle + , const OUString& rChildParticle + , const OUString& rDragMethodServiceName = OUString() + , const OUString& rDragParameterString = OUString() ); + + static OUString createClassifiedIdentifierForGrid( + const css::uno::Reference< css::chart2::XAxis >& xAxis + , const css::uno::Reference< css::frame::XModel >& xChartModel + , sal_Int32 nSubIndex = -1 );//-1: main grid, 0: first subgrid etc + + SAL_DLLPRIVATE static OUString createParticleForDiagram(); + + static OUString createParticleForCoordinateSystem( + const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys + , ChartModel& rModel ); + + static OUString createParticleForCoordinateSystem( + const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys + , const css::uno::Reference< css::frame::XModel >& xChartModel ); + + static OUString createParticleForAxis( + sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ); + + static OUString createParticleForGrid( + sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ); + + static OUString createParticleForSeries( sal_Int32 nDiagramIndex, sal_Int32 nCooSysIndex + , sal_Int32 nChartTypeIndex, sal_Int32 nSeriesIndex ); + + static OUString createParticleForLegend( ChartModel& rModel ); + + static OUString createParticleForLegend( + const css::uno::Reference< css::frame::XModel >& xChartModel ); + + static OUString addChildParticle( const OUString& rParticle, const OUString& rChildParticle ); + static OUString createChildParticleWithIndex( ObjectType eObjectType, sal_Int32 nIndex ); + static sal_Int32 getIndexFromParticleOrCID( const OUString& rParticleOrCID ); + + static OUString createClassifiedIdentifier( + enum ObjectType eObjectType //e.g. OBJECTTYPE_DATA_SERIES + , const OUString& rParticleID );//e.g. SeriesID + + static OUString createClassifiedIdentifierWithParent( + enum ObjectType //e.g. OBJECTTYPE_DATA_POINT or OBJECTTYPE_GRID + , const OUString& rParticleID //for points or subgrids this is an Index or otherwise an identifier from the model object + , const OUString& rParentPartical //e.g. "Series=SeriesID" or "Grid=GridId" + , const OUString& rDragMethodServiceName = OUString() + , const OUString& rDragParameterString = OUString() + ); + + static bool isCID( const OUString& rName ); + static OUString getDragMethodServiceName( const OUString& rClassifiedIdentifier ); + static OUString getDragParameterString( const OUString& rCID ); + static bool isDragableObject( const OUString& rClassifiedIdentifier ); + bool isDragableObject() const; + static bool isRotateableObject( const OUString& rClassifiedIdentifier ); + static bool isMultiClickObject( const OUString& rClassifiedIdentifier ); + static bool areSiblings( const OUString& rCID1, const OUString& rCID2 );//identical object is no sibling + static bool areIdenticalObjects( const OUString& rCID1, const OUString& rCID2 ); + + static OUString getStringForType( ObjectType eObjectType ); + static ObjectType getObjectType( const OUString& rCID ); + ObjectType getObjectType() const; + + static OUString createSeriesSubObjectStub( ObjectType eSubObjectType + , const OUString& rSeriesParticle + , const OUString& rDragMethodServiceName = OUString() + , const OUString& rDragParameterString = OUString() ); + static OUString createPointCID( const OUString& rPointCID_Stub, sal_Int32 nIndex ); + + static OUString createDataCurveCID( const OUString& rSeriesParticle, sal_Int32 nCurveIndex, bool bAverageLine ); + static OUString createDataCurveEquationCID( const OUString& rSeriesParticle, sal_Int32 nCurveIndex ); + + SAL_DLLPRIVATE static OUString getObjectID( const OUString& rCID ); + static OUString getParticleID( const OUString& rCID ); + static OUString getFullParentParticle( const OUString& rCID ); + + //returns the series particle of a CID when the CID is a child of the series + static OUString getSeriesParticleFromCID( const OUString& rCID ); + + //return the model object that is indicated by rObjectCID + static css::uno::Reference< css::beans::XPropertySet > + getObjectPropertySet( + const OUString& rObjectCID + , const css::uno::Reference< css::frame::XModel >& xChartModel ); + static css::uno::Reference< css::beans::XPropertySet > + getObjectPropertySet( + const OUString& rObjectCID + , const css::uno::Reference< css::chart2::XChartDocument >& xChartDocument ); + + //return the axis object that belongs to rObjectCID if any + static css::uno::Reference< css::chart2::XAxis > + getAxisForCID( + const OUString& rObjectCID + , const css::uno::Reference< css::frame::XModel >& xChartModel ); + + //return the series object that belongs to rObjectCID if any + static css::uno::Reference< css::chart2::XDataSeries > + getDataSeriesForCID( + const OUString& rObjectCID + , const css::uno::Reference< css::frame::XModel >& xChartModel ); + + static css::uno::Reference< css::chart2::XDiagram > + getDiagramForCID( + const OUString& rObjectCID + , const css::uno::Reference< css::frame::XModel >& xChartModel ); + + static const OUString& getPieSegmentDragMethodServiceName(); + static OUString createPieSegmentDragParameterString( + sal_Int32 nOffsetPercent + , const css::awt::Point& rMinimumPosition + , const css::awt::Point& rMaximumPosition ); + static bool parsePieSegmentDragParameterString( const OUString& rDragParameterString + , sal_Int32& rOffsetPercent + , css::awt::Point& rMinimumPosition + , css::awt::Point& rMaximumPosition ); + + static TitleHelper::eTitleType getTitleTypeForCID( const OUString& rCID ); + + static OUString getMovedSeriesCID( const OUString& rObjectCID, bool bForward ); + + bool isValid() const; + bool isAutoGeneratedObject() const; + bool isAdditionalShape() const; + const OUString& getObjectCID() const { return m_aObjectCID;} + const css::uno::Reference< css::drawing::XShape >& getAdditionalShape() const { return m_xAdditionalShape;} + css::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. + OUString m_aObjectCID; + css::uno::Reference< css::drawing::XShape > m_xAdditionalShape; +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/PolynomialRegressionCurveCalculator.hxx b/chart2/source/inc/PolynomialRegressionCurveCalculator.hxx new file mode 100644 index 000000000..e47d882d4 --- /dev/null +++ b/chart2/source/inc/PolynomialRegressionCurveCalculator.hxx @@ -0,0 +1,64 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_POLYNOMIALREGRESSIONCURVECALCULATOR_HXX +#define INCLUDED_CHART2_SOURCE_INC_POLYNOMIALREGRESSIONCURVECALCULATOR_HXX + +#include "RegressionCurveCalculator.hxx" +#include <vector> + +namespace RegressionCalculationHelper +{ + typedef std::pair< std::vector< double >, std::vector< double > > tDoubleVectorPair; +} + +namespace chart +{ + +class PolynomialRegressionCurveCalculator : public RegressionCurveCalculator +{ +public: + PolynomialRegressionCurveCalculator(); + virtual ~PolynomialRegressionCurveCalculator() override; + +protected: + virtual OUString ImplGetRepresentation( + const css::uno::Reference<css::util::XNumberFormatter>& xNumFormatter, + sal_Int32 nNumberFormatKey, sal_Int32* pFormulaMaxWidth = nullptr ) const override; + + virtual double SAL_CALL getCurveValue( double x ) override; + +private: + // ____ XRegressionCurveCalculator ____ + virtual void SAL_CALL recalculateRegression( + const css::uno::Sequence<double>& aXValues, + const css::uno::Sequence<double>& aYValues ) override; + + void computeCorrelationCoefficient( + RegressionCalculationHelper::tDoubleVectorPair& rValues, + const sal_Int32 aNoValues, + double yAverage ); + + std::vector<double> mCoefficients; +}; + +} // namespace chart + +#endif // INCLUDED_CHART2_SOURCE_INC_POLYNOMIALREGRESSIONCURVECALCULATOR_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/PopupRequest.hxx b/chart2/source/inc/PopupRequest.hxx new file mode 100644 index 000000000..0c9af2f50 --- /dev/null +++ b/chart2/source/inc/PopupRequest.hxx @@ -0,0 +1,57 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + */ + +#ifndef INCLUDED_CHART2_SOURCE_INC_POPUPREQUEST_HXX +#define INCLUDED_CHART2_SOURCE_INC_POPUPREQUEST_HXX + +#include "MutexContainer.hxx" +#include "charttoolsdllapi.hxx" + +#include <cppuhelper/compbase.hxx> +#include <com/sun/star/awt/XRequestCallback.hpp> + +namespace chart +{ + +namespace impl +{ + +typedef cppu::WeakComponentImplHelper<css::awt::XRequestCallback> PopupRequest_Base; + +} + +class OOO_DLLPUBLIC_CHARTTOOLS PopupRequest : public MutexContainer, public impl::PopupRequest_Base +{ +public: + explicit PopupRequest(); + virtual ~PopupRequest() override; + + css::uno::Reference<css::awt::XCallback> const & getCallback() const + { + return m_xCallback; + } + +protected: + // ____ XRequestCallback ____ + virtual void SAL_CALL addCallback(const css::uno::Reference< ::css::awt::XCallback >& xCallback, + const css::uno::Any& aData) override; + + // ____ WeakComponentImplHelperBase ____ + // is called when dispose() is called at this component + virtual void SAL_CALL disposing() override; + +private: + css::uno::Reference<css::awt::XCallback> m_xCallback; +}; + +} // namespace chart + +#endif // INCLUDED_CHART2_SOURCE_INC_POPUPREQUEST_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/PotentialRegressionCurveCalculator.hxx b/chart2/source/inc/PotentialRegressionCurveCalculator.hxx new file mode 100644 index 000000000..c3306d3c6 --- /dev/null +++ b/chart2/source/inc/PotentialRegressionCurveCalculator.hxx @@ -0,0 +1,65 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_POTENTIALREGRESSIONCURVECALCULATOR_HXX +#define INCLUDED_CHART2_SOURCE_INC_POTENTIALREGRESSIONCURVECALCULATOR_HXX + +#include "RegressionCurveCalculator.hxx" + +namespace chart +{ + +class PotentialRegressionCurveCalculator : public RegressionCurveCalculator +{ +public: + PotentialRegressionCurveCalculator(); + virtual ~PotentialRegressionCurveCalculator() override; + +protected: + virtual OUString ImplGetRepresentation( + const css::uno::Reference<css::util::XNumberFormatter>& xNumFormatter, + sal_Int32 nNumberFormatKey, sal_Int32* pFormulaLength = nullptr ) const override; + +private: + // ____ XRegressionCurveCalculator ____ + virtual void SAL_CALL recalculateRegression( + const css::uno::Sequence<double>& aXValues, + const css::uno::Sequence<double>& aYValues ) override; + + virtual double SAL_CALL getCurveValue( double x ) override; + + virtual css::uno::Sequence<css::geometry::RealPoint2D> SAL_CALL getCurveValues( + double min, + double max, + sal_Int32 nPointCount, + const css::uno::Reference<css::chart2::XScaling>& xScalingX, + const css::uno::Reference<css::chart2::XScaling>& xScalingY, + sal_Bool bMaySkipPointsInCalculation ) override; + + // formula is: f(x) = x ^ m_fSlope * m_fSign * m_fIntercept + double m_fSlope; + double m_fIntercept; + double m_fSign; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_POTENTIALREGRESSIONCURVECALCULATOR_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/PropertyHelper.hxx b/chart2/source/inc/PropertyHelper.hxx new file mode 100644 index 000000000..19ce354c9 --- /dev/null +++ b/chart2/source/inc/PropertyHelper.hxx @@ -0,0 +1,152 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_PROPERTYHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_PROPERTYHELPER_HXX + +#include <com/sun/star/beans/Property.hpp> +#include <com/sun/star/uno/Any.hxx> +#include "charttoolsdllapi.hxx" + +#include <unordered_map> + +namespace com::sun::star::lang { class XMultiServiceFactory; } + +namespace chart +{ + +typedef int tPropertyValueMapKey; + +typedef std::unordered_map<tPropertyValueMapKey, css::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 OUString addLineDashUniqueNameToTable( + const css::uno::Any & rValue, + const css::uno::Reference< css::lang::XMultiServiceFactory > & xFact, + const 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 OUString addGradientUniqueNameToTable( + const css::uno::Any & rValue, + const css::uno::Reference< css::lang::XMultiServiceFactory > & xFact, + const 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 +OUString addTransparencyGradientUniqueNameToTable( + const css::uno::Any & rValue, + const css::uno::Reference< css::lang::XMultiServiceFactory > & xFact, + const 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 OUString addHatchUniqueNameToTable( + const css::uno::Any & rValue, + const css::uno::Reference< css::lang::XMultiServiceFactory > & xFact, + const 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 OUString addBitmapUniqueNameToTable( + const css::uno::Any & rValue, + const css::uno::Reference< css::lang::XMultiServiceFactory > & xFact, + const 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 css::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, css::uno::Any( value )); +} + +template<> + void setPropertyValue< css::uno::Any >( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const css::uno::Any & rAny ); + +OOO_DLLPUBLIC_CHARTTOOLS void setPropertyValueDefaultAny( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const css::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, css::uno::Any( value )); +} + +/** Calls setPropertyValue() but asserts that the given property hasn't been set + before. + */ +template<> + void setPropertyValueDefault< css::uno::Any >( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const css::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 +{ + bool operator() ( const css::beans::Property & first, + const css::beans::Property & second ) + { + return ( first.Name.compareTo( second.Name ) < 0 ); + } +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_PROPERTYHELPER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/RangeHighlighter.hxx b/chart2/source/inc/RangeHighlighter.hxx new file mode 100644 index 000000000..c1fe2d721 --- /dev/null +++ b/chart2/source/inc/RangeHighlighter.hxx @@ -0,0 +1,106 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_RANGEHIGHLIGHTER_HXX +#define INCLUDED_CHART2_SOURCE_INC_RANGEHIGHLIGHTER_HXX + +#include "MutexContainer.hxx" +#include <cppuhelper/compbase.hxx> +#include <com/sun/star/chart2/data/XRangeHighlighter.hpp> +#include <com/sun/star/view/XSelectionChangeListener.hpp> + +namespace com::sun::star { + namespace chart2 { + class XDiagram; + class XDataSeries; + class XAxis; + } +} +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::view { class XSelectionSupplier; } + +namespace chart +{ + +namespace impl +{ +typedef ::cppu::WeakComponentImplHelper< + css::chart2::data::XRangeHighlighter, + css::view::XSelectionChangeListener + > + RangeHighlighter_Base; +} + +class RangeHighlighter : + public MutexContainer, + public impl::RangeHighlighter_Base +{ +public: + explicit RangeHighlighter( + const css::uno::Reference< css::view::XSelectionSupplier > & xSelectionSupplier ); + virtual ~RangeHighlighter() override; + +protected: + // ____ XRangeHighlighter ____ + virtual css::uno::Sequence< css::chart2::data::HighlightedRange > SAL_CALL getSelectedRanges() override; + virtual void SAL_CALL addSelectionChangeListener( + const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override; + virtual void SAL_CALL removeSelectionChangeListener( + const css::uno::Reference< css::view::XSelectionChangeListener >& xListener ) override; + + // ____ XSelectionChangeListener ____ + virtual void SAL_CALL selectionChanged( + const css::lang::EventObject& aEvent ) override; + + // ____ XEventListener (base of XSelectionChangeListener) ____ + virtual void SAL_CALL disposing( + const css::lang::EventObject& Source ) override; + + // ____ WeakComponentImplHelperBase ____ + // is called when dispose() is called at this component + virtual void SAL_CALL disposing() override; + +private: + void fireSelectionEvent(); + void startListening(); + void stopListening(); + void determineRanges(); + + void fillRangesForDiagram( const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + void fillRangesForDataSeries( const css::uno::Reference< css::chart2::XDataSeries > & xSeries ); + void fillRangesForCategories( const css::uno::Reference< css::chart2::XAxis > & xAxis ); + void fillRangesForDataPoint( const css::uno::Reference< css::uno::XInterface > & xDataSeries, sal_Int32 nIndex ); + void fillRangesForErrorBars( const css::uno::Reference< css::beans::XPropertySet > & xErrorBar, + const css::uno::Reference< css::chart2::XDataSeries > & xDataSeries ); + + css::uno::Reference< css::view::XSelectionSupplier > + m_xSelectionSupplier; + css::uno::Reference< css::view::XSelectionChangeListener > + m_xListener; + css::uno::Sequence< css::chart2::data::HighlightedRange > + m_aSelectedRanges; + sal_Int32 m_nAddedListenerCount; + bool m_bIncludeHiddenCells; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_RANGEHIGHLIGHTER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ReferenceSizeProvider.hxx b/chart2/source/inc/ReferenceSizeProvider.hxx new file mode 100644 index 000000000..253ab79fb --- /dev/null +++ b/chart2/source/inc/ReferenceSizeProvider.hxx @@ -0,0 +1,132 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_REFERENCESIZEPROVIDER_HXX +#define INCLUDED_CHART2_SOURCE_INC_REFERENCESIZEPROVIDER_HXX + +#include <com/sun/star/uno/Reference.hxx> +#include <com/sun/star/awt/Size.hpp> +#include "charttoolsdllapi.hxx" + +namespace com::sun::star { + namespace chart2 { + class XTitle; + class XTitled; + class XChartDocument; + } + namespace beans { + class XPropertySet; + } +} + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS ReferenceSizeProvider +{ +public: + + enum AutoResizeState + { + AUTO_RESIZE_YES, + AUTO_RESIZE_NO, + AUTO_RESIZE_AMBIGUOUS, + AUTO_RESIZE_UNKNOWN + }; + + ReferenceSizeProvider( + css::awt::Size aPageSize, + const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc ); + + const css::awt::Size& getPageSize() const { return m_aPageSize;} + + /** 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 css::uno::Reference< css::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 </sal_True>. + */ + SAL_DLLPRIVATE void setValuesAtPropertySet( + const css::uno::Reference< css::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 css::uno::Reference< css::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 { return m_bUseAutoScale;} + + /** 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 css::uno::Reference< css::beans::XPropertySet > & xProp, + AutoResizeState & rInOutState ); + + SAL_DLLPRIVATE void impl_setValuesAtTitled( + const css::uno::Reference< css::chart2::XTitled > & xTitled ); + SAL_DLLPRIVATE static void impl_getAutoResizeFromTitled( + const css::uno::Reference< css::chart2::XTitled > & xTitled, + AutoResizeState & rInOutState ); + + css::awt::Size m_aPageSize; + css::uno::Reference< css::chart2::XChartDocument > m_xChartDoc; + bool m_bUseAutoScale; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_REFERENCESIZEPROVIDER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/RegressionCalculationHelper.hxx b/chart2/source/inc/RegressionCalculationHelper.hxx new file mode 100644 index 000000000..a5b2b3b16 --- /dev/null +++ b/chart2/source/inc/RegressionCalculationHelper.hxx @@ -0,0 +1,142 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_REGRESSIONCALCULATIONHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_REGRESSIONCALCULATIONHELPER_HXX + +#include <com/sun/star/uno/Sequence.hxx> + +#include <rtl/math.hxx> + +#include <utility> +#include <vector> + +namespace chart +{ +namespace RegressionCalculationHelper +{ + +typedef std::pair< std::vector< double >, std::vector< double > > tDoubleVectorPair; + +/** takes the given x- and y-values and copies them into the resulting pair, + which contains x-values in the first element and the y-values in the second + one. All tuples for which aPred is false are not copied. + + <p>The function below provide a set of useful predicates that can be + used to pass as parameter aPred.</p> + */ +template< class Pred > +tDoubleVectorPair + cleanup( const css::uno::Sequence< double > & rXValues, + const css::uno::Sequence< double > & rYValues, + Pred aPred ) +{ + tDoubleVectorPair aResult; + sal_Int32 nSize = std::min( rXValues.getLength(), rYValues.getLength()); + for( sal_Int32 i=0; i<nSize; ++i ) + { + if( aPred( rXValues[i], rYValues[i] )) + { + aResult.first.push_back( rXValues[i] ); + aResult.second.push_back( rYValues[i] ); + } + } + + return aResult; +} + +class isValid +{ +public: + bool operator()( double x, double y ) + { return ! ( std::isnan( x ) || + std::isnan( y ) || + std::isinf( x ) || + std::isinf( y ) ); + } +}; + +class isValidAndXPositive +{ +public: + bool operator()( double x, double y ) + { return ! ( std::isnan( x ) || + std::isnan( y ) || + std::isinf( x ) || + std::isinf( y ) || + x <= 0.0 ); + } +}; + +class isValidAndYPositive +{ +public: + bool operator()( double x, double y ) + { return ! ( std::isnan( x ) || + std::isnan( y ) || + std::isinf( x ) || + std::isinf( y ) || + y <= 0.0 ); + } +}; + +class isValidAndYNegative +{ +public: + bool operator()( double x, double y ) + { return ! ( std::isnan( x ) || + std::isnan( y ) || + std::isinf( x ) || + std::isinf( y ) || + y >= 0.0 ); + } +}; + +class isValidAndBothPositive +{ +public: + bool operator()( double x, double y ) + { return ! ( std::isnan( x ) || + std::isnan( y ) || + std::isinf( x ) || + std::isinf( y ) || + x <= 0.0 || + y <= 0.0 ); + } +}; + +class isValidAndXPositiveAndYNegative +{ +public: + bool operator()( double x, double y ) + { return ! ( std::isnan( x ) || + std::isnan( y ) || + std::isinf( x ) || + std::isinf( y ) || + x <= 0.0 || + y >= 0.0 ); + } +}; + +} // namespace RegressionCalculationHelper +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_REGRESSIONCALCULATIONHELPER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/RegressionCurveCalculator.hxx b/chart2/source/inc/RegressionCurveCalculator.hxx new file mode 100644 index 000000000..183db2b65 --- /dev/null +++ b/chart2/source/inc/RegressionCurveCalculator.hxx @@ -0,0 +1,105 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_REGRESSIONCURVECALCULATOR_HXX +#define INCLUDED_CHART2_SOURCE_INC_REGRESSIONCURVECALCULATOR_HXX + +#include <cppuhelper/implbase.hxx> +#include <rtl/ustrbuf.hxx> + +#include <com/sun/star/chart2/XRegressionCurveCalculator.hpp> + +namespace com::sun::star::util { class XNumberFormatsSupplier; } +namespace com::sun::star::util { class XNumberFormatter; } + +namespace chart +{ + +class RegressionCurveCalculator : public + cppu::WeakImplHelper< css::chart2::XRegressionCurveCalculator > +{ +public: + RegressionCurveCalculator(); + virtual ~RegressionCurveCalculator() override; + + static bool isLinearScaling( + const css::uno::Reference< css::chart2::XScaling >& xScaling ); + + static bool isLogarithmicScaling( + const css::uno::Reference< css::chart2::XScaling >& xScaling ); + +protected: + virtual OUString ImplGetRepresentation( + const css::uno::Reference< css::util::XNumberFormatter >& xNumFormatter, + sal_Int32 nNumberFormatKey, sal_Int32* pFormulaLength = nullptr ) const = 0; + + static OUString getFormattedString( + const css::uno::Reference< css::util::XNumberFormatter >& xNumFormatter, + sal_Int32 nNumberFormatKey, + double fNumber, + const sal_Int32* pStringLength ); + + static void addStringToEquation( OUStringBuffer& aStrEquation, sal_Int32& nLineLength, OUStringBuffer const & aAddString, const sal_Int32* pMaxLength ); + + double m_fCorrelationCoefficient; + + sal_Int32 mDegree; + bool mForceIntercept; + double mInterceptValue; + sal_Int32 mPeriod; + OUString mXName, mYName; + + // ____ XRegressionCurveCalculator ____ + virtual void SAL_CALL setRegressionProperties( + sal_Int32 aDegree, + sal_Bool aForceIntercept, + double aInterceptValue, + sal_Int32 aPeriod) override; + + virtual void SAL_CALL recalculateRegression( + const css::uno::Sequence< double >& aXValues, + const css::uno::Sequence< double >& aYValues ) override = 0; + + virtual double SAL_CALL getCurveValue( double x ) override = 0; + + virtual css::uno::Sequence< css::geometry::RealPoint2D > SAL_CALL getCurveValues( + double min, + double max, + sal_Int32 nPointCount, + const css::uno::Reference< css::chart2::XScaling >& xScalingX, + const css::uno::Reference< css::chart2::XScaling >& xScalingY, + sal_Bool bMaySkipPointsInCalculation ) override; + + virtual double SAL_CALL getCorrelationCoefficient() override; + + virtual OUString SAL_CALL getRepresentation() override; + + virtual OUString SAL_CALL getFormattedRepresentation( + const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumFmtSupplier, + sal_Int32 nNumberFormatKey, sal_Int32 nFormulaLength ) override; + + virtual void SAL_CALL setXYNames( + const OUString& aXName, const OUString& aYName ) override; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_REGRESSIONCURVECALCULATOR_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/RegressionCurveHelper.hxx b/chart2/source/inc/RegressionCurveHelper.hxx new file mode 100644 index 000000000..8fa407147 --- /dev/null +++ b/chart2/source/inc/RegressionCurveHelper.hxx @@ -0,0 +1,184 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_REGRESSIONCURVEHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_REGRESSIONCURVEHELPER_HXX + +#include <svx/chrtitem.hxx> +#include "charttoolsdllapi.hxx" + +#include <vector> + +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::chart2 { class XDataSeries; } +namespace com::sun::star::chart2 { class XDiagram; } +namespace com::sun::star::chart2 { class XRegressionCurve; } +namespace com::sun::star::chart2 { class XRegressionCurveCalculator; } +namespace com::sun::star::chart2 { class XRegressionCurveContainer; } +namespace com::sun::star::chart2::data { class XDataSource; } +namespace com::sun::star::frame { class XModel; } + +namespace chart +{ + +namespace RegressionCurveHelper +{ + /// returns a model mean-value line + css::uno::Reference<css::chart2::XRegressionCurve> createMeanValueLine(); + + /// returns a model regression curve + css::uno::Reference<css::chart2::XRegressionCurve> + createRegressionCurveByServiceName( const OUString& aServiceName ); + + OOO_DLLPUBLIC_CHARTTOOLS bool hasMeanValueLine( + const css::uno::Reference<css::chart2::XRegressionCurveContainer> & xRegCnt ); + + OOO_DLLPUBLIC_CHARTTOOLS bool isMeanValueLine( + const css::uno::Reference<css::chart2::XRegressionCurve> & xRegCurve ); + + OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference<css::chart2::XRegressionCurve> + getMeanValueLine( + const css::uno::Reference<css::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 + */ + OOO_DLLPUBLIC_CHARTTOOLS void addMeanValueLine( + css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xRegCnt, + const css::uno::Reference<css::beans::XPropertySet>& xSeriesProp ); + + OOO_DLLPUBLIC_CHARTTOOLS void removeMeanValueLine( + css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xRegCnt ); + + /** Returns the first regression curve found that is not of type + mean-value line + */ + OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference<css::chart2::XRegressionCurve> + getFirstCurveNotMeanValueLine( + const css::uno::Reference<css::chart2::XRegressionCurveContainer>& xCurveContainer ); + + /** Returns the regression curve found at the index provided. + */ + OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference<css::chart2::XRegressionCurve> + getRegressionCurveAtIndex( + const css::uno::Reference<css::chart2::XRegressionCurveContainer>& xCurveContainer, + sal_Int32 aIndex); + + /** Returns the type of the first regression curve found that is not of type + mean-value line + */ + OOO_DLLPUBLIC_CHARTTOOLS SvxChartRegress getFirstRegressTypeNotMeanValueLine( + const css::uno::Reference<css::chart2::XRegressionCurveContainer>& xCurveContainer ); + + OOO_DLLPUBLIC_CHARTTOOLS SvxChartRegress getRegressionType( + const css::uno::Reference<css::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 + */ + OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference<css::chart2::XRegressionCurve> + addRegressionCurve( + SvxChartRegress eType, + css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xCurveContainer, + const css::uno::Reference<css::beans::XPropertySet >& xPropertySource = + css::uno::Reference<css::beans::XPropertySet>(), + const css::uno::Reference<css::beans::XPropertySet>& xEquationProperties = + css::uno::Reference<css::beans::XPropertySet>() ); + + OOO_DLLPUBLIC_CHARTTOOLS bool removeAllExceptMeanValueLine( + css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xCurveContainer ); + + OOO_DLLPUBLIC_CHARTTOOLS void removeEquations( + css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xCurveContainer ); + + OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference<css::chart2::XRegressionCurve> + changeRegressionCurveType( + SvxChartRegress eType, + css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xRegressionCurveContainer, + css::uno::Reference<css::chart2::XRegressionCurve> const & xRegressionCurve ); + + /// returns a calculator object for regression curves (used by the view) + OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference<css::chart2::XRegressionCurveCalculator> + createRegressionCurveCalculatorByServiceName( const 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" + */ + void initializeCurveCalculator( + const css::uno::Reference<css::chart2::XRegressionCurveCalculator>& xOutCurveCalculator, + const css::uno::Reference<css::chart2::data::XDataSource>& xSource, + bool bUseXValuesIfAvailable ); + + /** 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. + */ + OOO_DLLPUBLIC_CHARTTOOLS void initializeCurveCalculator( + const css::uno::Reference<css::chart2::XRegressionCurveCalculator>& xOutCurveCalculator, + const css::uno::Reference<css::chart2::XDataSeries>& xSeries, + const css::uno::Reference<css::frame::XModel>& xModel ); + + OOO_DLLPUBLIC_CHARTTOOLS OUString getUINameForRegressionCurve( + const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve ); + + OOO_DLLPUBLIC_CHARTTOOLS OUString getRegressionCurveName( + const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve ); + + OOO_DLLPUBLIC_CHARTTOOLS OUString getRegressionCurveGenericName( + const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve ); + + OOO_DLLPUBLIC_CHARTTOOLS OUString getRegressionCurveSpecificName( + const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve ); + + OOO_DLLPUBLIC_CHARTTOOLS std::vector<css::uno::Reference<css::chart2::XRegressionCurve> > + getAllRegressionCurvesNotMeanValueLine( + const css::uno::Reference<css::chart2::XDiagram>& xDiagram ); + + OOO_DLLPUBLIC_CHARTTOOLS void resetEquationPosition( + const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve ); + + /// @return the index of the given curve in the given container. -1 if not contained + OOO_DLLPUBLIC_CHARTTOOLS sal_Int32 getRegressionCurveIndex( + const css::uno::Reference<css::chart2::XRegressionCurveContainer>& xContainer, + const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve ); + + OOO_DLLPUBLIC_CHARTTOOLS bool hasEquation(const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve ); +} + +} // namespace chart + +#endif // INCLUDED_CHART2_SOURCE_INC_REGRESSIONCURVEHELPER_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/RelativePositionHelper.hxx b/chart2/source/inc/RelativePositionHelper.hxx new file mode 100644 index 000000000..961a55e99 --- /dev/null +++ b/chart2/source/inc/RelativePositionHelper.hxx @@ -0,0 +1,105 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_INC_RELATIVEPOSITIONHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_RELATIVEPOSITIONHELPER_HXX + +#include <com/sun/star/chart2/RelativePosition.hpp> +#include <com/sun/star/drawing/Alignment.hpp> +#include <com/sun/star/awt/Point.hpp> +#include "charttoolsdllapi.hxx" + +namespace com::sun::star::awt { struct Size; } +namespace com::sun::star::chart2 { struct RelativeSize; } + +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 css::awt::Point + getUpperLeftCornerOfAnchoredObject( + css::awt::Point aPoint, + css::awt::Size aObjectSize, + css::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 css::awt::Point + getCenterOfAnchoredObject( + css::awt::Point aPoint, + css::awt::Size aUnrotatedObjectSize, + css::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 css::chart2::RelativePosition + getReanchoredPosition( + const css::chart2::RelativePosition & rPosition, + const css::chart2::RelativeSize & rObjectSize, + css::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. + + The resize is only done, if after + transformation, the position and size are within the bounds [0,1]. + + @return </sal_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( + css::chart2::RelativePosition & rInOutPosition, + css::chart2::RelativeSize & rInOutSize, + double fAmountX, double fAmountY ); + + /** shifts a relative position about the given amount + + 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 </sal_True>, if changes were applied. + */ + static bool moveObject( + css::chart2::RelativePosition & rInOutPosition, + const css::chart2::RelativeSize & rObjectSize, + double fAmountX, double fAmountY ); +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/RelativeSizeHelper.hxx b/chart2/source/inc/RelativeSizeHelper.hxx new file mode 100644 index 000000000..517804096 --- /dev/null +++ b/chart2/source/inc/RelativeSizeHelper.hxx @@ -0,0 +1,54 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_RELATIVESIZEHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_RELATIVESIZEHELPER_HXX + +#include "charttoolsdllapi.hxx" + +namespace com::sun::star::awt { struct Size; } +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::uno { template <class interface_type> class Reference; } + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS RelativeSizeHelper +{ +public: + static double calculate( + double fValue, + const css::awt::Size & rOldReferenceSize, + const css::awt::Size & rNewReferenceSize ); + + static void adaptFontSizes( + const css::uno::Reference< + css::beans::XPropertySet > & xTargetProperties, + const css::awt::Size & rOldReferenceSize, + const css::awt::Size & rNewReferenceSize ); + +private: + RelativeSizeHelper() = delete; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_RELATIVESIZEHELPER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ResId.hxx b/chart2/source/inc/ResId.hxx new file mode 100644 index 000000000..31d96d155 --- /dev/null +++ b/chart2/source/inc/ResId.hxx @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_RESID_HXX +#define INCLUDED_CHART2_SOURCE_INC_RESID_HXX + +#include <rtl/ustring.hxx> +#include "charttoolsdllapi.hxx" + +namespace chart +{ + +OUString OOO_DLLPUBLIC_CHARTTOOLS SchResId(const char *pId); + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_RESID_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/Scaling.hxx b/chart2/source/inc/Scaling.hxx new file mode 100644 index 000000000..7314ce84e --- /dev/null +++ b/chart2/source/inc/Scaling.hxx @@ -0,0 +1,161 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_SCALING_HXX +#define INCLUDED_CHART2_SOURCE_INC_SCALING_HXX + +#include <com/sun/star/chart2/XScaling.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XServiceName.hpp> +#include <cppuhelper/implbase.hxx> + +namespace chart +{ + +class LogarithmicScaling : + public ::cppu::WeakImplHelper< + css::chart2::XScaling, + css::lang::XServiceName, + css::lang::XServiceInfo + > +{ +public: + /// base is 10.0 + explicit LogarithmicScaling(); + LogarithmicScaling( double fBase ); + virtual ~LogarithmicScaling() override; + + /// declare XServiceInfo methods + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // ____ XScaling ____ + virtual double SAL_CALL doScaling( double value ) override; + + virtual css::uno::Reference< + css::chart2::XScaling > SAL_CALL + getInverseScaling() override; + + // ____ XServiceName ____ + virtual OUString SAL_CALL getServiceName() override; + +private: + const double m_fBase; + const double m_fLogOfBase; +}; + +class ExponentialScaling : + public ::cppu::WeakImplHelper< + css::chart2::XScaling, + css::lang::XServiceName, + css::lang::XServiceInfo + > +{ +public: + /// base is 10.0 + explicit ExponentialScaling(); + explicit ExponentialScaling( double fBase ); + virtual ~ExponentialScaling() override; + + /// declare XServiceInfo methods + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // ____ XScaling ____ + virtual double SAL_CALL + doScaling( double value ) override; + + virtual css::uno::Reference< css::chart2::XScaling > SAL_CALL + getInverseScaling() override; + + // ____ XServiceName ____ + virtual OUString SAL_CALL getServiceName() override; + +private: + const double m_fBase; +}; + +class LinearScaling : public ::cppu::WeakImplHelper< + css::chart2::XScaling, + css::lang::XServiceName, + css::lang::XServiceInfo + > +{ +public: + /// y(x) = x + explicit LinearScaling(); + /// y(x) = fSlope * x + fOffset + LinearScaling( double fSlope, double fOffset ); + virtual ~LinearScaling() override; + + /// declare XServiceInfo methods + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // ____ XScaling ____ + virtual double SAL_CALL doScaling( double value ) override; + + virtual css::uno::Reference< css::chart2::XScaling > SAL_CALL + getInverseScaling() override; + + // ____ XServiceName ____ + virtual OUString SAL_CALL getServiceName() override; + +private: + const double m_fSlope; + const double m_fOffset; +}; + +class PowerScaling : public ::cppu::WeakImplHelper< + css::chart2::XScaling, + css::lang::XServiceName, + css::lang::XServiceInfo + > +{ +public: + /// exponent 10.0 + explicit PowerScaling(); + explicit PowerScaling( double fExponent ); + virtual ~PowerScaling() override; + + /// declare XServiceInfo methods + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + // ____ XScaling ____ + virtual double SAL_CALL + doScaling( double value ) override; + + virtual css::uno::Reference< css::chart2::XScaling > SAL_CALL + getInverseScaling() override; + + // ____ XServiceName ____ + virtual OUString SAL_CALL getServiceName() override; + +private: + const double m_fExponent; +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/SceneProperties.hxx b/chart2/source/inc/SceneProperties.hxx new file mode 100644 index 000000000..9fedd60a6 --- /dev/null +++ b/chart2/source/inc/SceneProperties.hxx @@ -0,0 +1,85 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_SCENEPROPERTIES_HXX +#define INCLUDED_CHART2_SOURCE_INC_SCENEPROPERTIES_HXX + +#include "PropertyHelper.hxx" +#include "FastPropertyIdRanges.hxx" +#include "charttoolsdllapi.hxx" + +#include <vector> + +namespace com::sun::star::beans { struct Property; } + +namespace chart +{ + +// implements service SceneProperties +namespace SceneProperties +{ + // 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 + }; + + OOO_DLLPUBLIC_CHARTTOOLS void AddPropertiesToVector( + std::vector< css::beans::Property > & rOutProperties ); + + OOO_DLLPUBLIC_CHARTTOOLS void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ); +} + +} // namespace chart + +#endif // INCLUDED_CHART2_SOURCE_INC_SCENEPROPERTIES_HXX + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/StackMode.hxx b/chart2/source/inc/StackMode.hxx new file mode 100644 index 000000000..14e5fe6ee --- /dev/null +++ b/chart2/source/inc/StackMode.hxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_STACKMODE_HXX +#define INCLUDED_CHART2_SOURCE_INC_STACKMODE_HXX + +namespace chart +{ +// needed for chart type templates + +enum class StackMode +{ + NONE, + YStacked, + YStackedPercent, + ZStacked +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_STACKMODE_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/StatisticsHelper.hxx b/chart2/source/inc/StatisticsHelper.hxx new file mode 100644 index 000000000..d97934569 --- /dev/null +++ b/chart2/source/inc/StatisticsHelper.hxx @@ -0,0 +1,107 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_STATISTICSHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_STATISTICSHELPER_HXX + +#include <com/sun/star/uno/Reference.h> +#include <rtl/ustring.hxx> +#include "charttoolsdllapi.hxx" + +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::chart2 { class XDataSeries; } +namespace com::sun::star::chart2::data { class XDataProvider; } +namespace com::sun::star::chart2::data { class XDataSequence; } +namespace com::sun::star::chart2::data { class XDataSource; } +namespace com::sun::star::chart2::data { class XLabeledDataSequence; } +namespace com::sun::star::uno { template <typename > class Sequence; } + +namespace chart +{ + +namespace StatisticsHelper +{ + /** Calculates 1/n * sum (x_i - x_mean)^2. + + @see http://mathworld.wolfram.com/Variance.html + */ + OOO_DLLPUBLIC_CHARTTOOLS double getVariance( const css::uno::Sequence< double > & rData ); + + // square root of the variance + OOO_DLLPUBLIC_CHARTTOOLS double getStandardDeviation( const css::uno::Sequence< double > & rData ); + + // also called "Standard deviation of the mean (SDOM)" + OOO_DLLPUBLIC_CHARTTOOLS double getStandardError( const css::uno::Sequence< double > & rData ); + + OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::chart2::data::XLabeledDataSequence > + getErrorLabeledDataSequenceFromDataSource( + const css::uno::Reference< css::chart2::data::XDataSource > & xDataSource, + bool bPositiveValue, + bool bYError = true ); + + OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::chart2::data::XDataSequence > + getErrorDataSequenceFromDataSource( + const css::uno::Reference< css::chart2::data::XDataSource > & xDataSource, + bool bPositiveValue, + bool bYError = true ); + + OOO_DLLPUBLIC_CHARTTOOLS double getErrorFromDataSource( + const css::uno::Reference< css::chart2::data::XDataSource > & xDataSource, + sal_Int32 nIndex, + bool bPositiveValue, + bool bYError = true ); + + OOO_DLLPUBLIC_CHARTTOOLS void setErrorDataSequence( + const css::uno::Reference< css::chart2::data::XDataSource > & xDataSource, + const css::uno::Reference< css::chart2::data::XDataProvider > & xDataProvider, + const OUString & rNewRange, + bool bPositiveValue, + bool bYError = true, + OUString const * pXMLRange = nullptr ); + + /// @return the newly created or existing error bar object + OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::beans::XPropertySet > + addErrorBars( + const css::uno::Reference< css::chart2::XDataSeries > & xDataSeries, + sal_Int32 nStyle, + bool bYError = true ); + + OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::beans::XPropertySet > + getErrorBars( + const css::uno::Reference< css::chart2::XDataSeries > & xDataSeries, + bool bYError = true ); + + OOO_DLLPUBLIC_CHARTTOOLS bool hasErrorBars( + const css::uno::Reference< css::chart2::XDataSeries > & xDataSeries, + bool bYError = true ); + + OOO_DLLPUBLIC_CHARTTOOLS void removeErrorBars( + const css::uno::Reference< css::chart2::XDataSeries > & xDataSeries, + bool bYError = true ); + + OOO_DLLPUBLIC_CHARTTOOLS bool usesErrorBarRanges( + const css::uno::Reference< css::chart2::XDataSeries > & xDataSeries, + bool bYError = true ); +} + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_STATISTICSHELPER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ThreeDHelper.hxx b/chart2/source/inc/ThreeDHelper.hxx new file mode 100644 index 000000000..52c97392b --- /dev/null +++ b/chart2/source/inc/ThreeDHelper.hxx @@ -0,0 +1,132 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_INC_THREEDHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_THREEDHELPER_HXX + +#include <com/sun/star/drawing/CameraGeometry.hpp> +#include "charttoolsdllapi.hxx" + +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::chart2 { class XDiagram; } + +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 css::drawing::CameraGeometry getDefaultCameraGeometry( bool bPie=false ); + + static void getRotationAngleFromDiagram( + const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties + , double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad ); + static void setRotationAngleToDiagram( + const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties + , double fXAngleRad, double fYAngleRad, double fZAngleRad ); + + static void getRotationFromDiagram( + const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties + , sal_Int32& rnHorizontalAngleDegree, sal_Int32& rnVerticalAngleDegree ); + static void setRotationToDiagram( + const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties + , sal_Int32 nHorizontalAngleDegree, sal_Int32 nVerticalYAngleDegree ); + + static void switchRightAngledAxes( const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties + , bool bRightAngledAxes ); + + static void adaptRadAnglesForRightAngledAxes( double& rfXAngleRad, double& rfYAngleRad ); + static double getXDegreeAngleLimitForRightAngledAxes() { return 90.0; } + static double getYDegreeAngleLimitForRightAngledAxes() { return 45.0; } + + 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 css::uno::Reference< css::beans::XPropertySet >& xSceneProperties ); + static void setCameraDistance( + const css::uno::Reference< css::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 css::uno::Reference< css::beans::XPropertySet >& xSceneProperties ); + static void setDefaultRotation( const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties ); + static void setDefaultIllumination( const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties ); + + static void setDefaultRotation( const css::uno::Reference< css::beans::XPropertySet >& xSceneProperties, bool bPieOrDonut ); + + static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardLeftWall( const css::uno::Reference< + css::beans::XPropertySet >& xSceneProperties ); + static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBackWall(const css::uno::Reference< + css::beans::XPropertySet >& xSceneProperties ); + static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBottom(const css::uno::Reference< + css::beans::XPropertySet >& xSceneProperties ); + + static ThreeDLookScheme detectScheme( const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + static void setScheme( const css::uno::Reference< css::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 css::uno::Reference< css::chart2::XDiagram >& xDiagram + , sal_Int32& rnRoundedEdges, sal_Int32& rnObjectLines ); + static void setRoundedEdgesAndObjectLines( const css::uno::Reference< css::chart2::XDiagram >& xDiagram + , sal_Int32 nRoundedEdges, sal_Int32 nObjectLines ); +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/TitleHelper.hxx b/chart2/source/inc/TitleHelper.hxx new file mode 100644 index 000000000..e16beda39 --- /dev/null +++ b/chart2/source/inc/TitleHelper.hxx @@ -0,0 +1,102 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_TITLEHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_TITLEHELPER_HXX + +#include <com/sun/star/uno/Reference.h> +#include <rtl/ustring.hxx> +#include "charttoolsdllapi.hxx" + +namespace chart { class ChartModel; } +namespace chart { class ReferenceSizeProvider; } +namespace com::sun::star::chart2 { class XTitle; } +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::uno { class XComponentContext; } + +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 css::uno::Reference< css::chart2::XTitle > + getTitle( eTitleType nTitleIndex + , ChartModel& rModel ); + + static css::uno::Reference< css::chart2::XTitle > + getTitle( eTitleType nTitleIndex + , const css::uno::Reference< css::frame::XModel >& xModel ); + + static css::uno::Reference< + css::chart2::XTitle > + createTitle( eTitleType nTitleIndex + , const OUString& rTitleText + , const css::uno::Reference< css::frame::XModel >& xModel + , const css::uno::Reference< css::uno::XComponentContext > & xContext + , ReferenceSizeProvider * pRefSizeProvider = nullptr ); + static css::uno::Reference< + css::chart2::XTitle > + createOrShowTitle( eTitleType nTitleIndex + , const OUString& rTitleText + , const css::uno::Reference< css::frame::XModel >& xModel + , const css::uno::Reference< css::uno::XComponentContext > & xContex ); + + static void removeTitle( eTitleType nTitleIndex + , const css::uno::Reference< css::frame::XModel >& xModel ); + + static void hideTitle( eTitleType nTitleIndex + , const css::uno::Reference< css::frame::XModel >& xModel ); + + + static OUString getCompleteString( const css::uno::Reference< css::chart2::XTitle >& xTitle ); + static void setCompleteString( const OUString& rNewText + , const css::uno::Reference< css::chart2::XTitle >& xTitle + , const css::uno::Reference< css::uno::XComponentContext > & xContext + , const float * pDefaultCharHeight = nullptr ); + + static bool getTitleType( eTitleType& rType + , const css::uno::Reference< css::chart2::XTitle >& xTitle + , ChartModel& rModel); + + static bool getTitleType( eTitleType& rType + , const css::uno::Reference< css::chart2::XTitle >& xTitle + , const css::uno::Reference< css::frame::XModel >& xModel ); +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/TrueGuard.hxx b/chart2/source/inc/TrueGuard.hxx new file mode 100644 index 000000000..109c64a06 --- /dev/null +++ b/chart2/source/inc/TrueGuard.hxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_TRUEGUARD_HXX +#define INCLUDED_CHART2_SOURCE_INC_TRUEGUARD_HXX + +namespace chart +{ +/** This guard sets the given boolean reference to true in the constructor and to false in the destructor + */ +class TrueGuard final +{ +public: + explicit TrueGuard(bool& rbTrueDuringGuardedTime); + ~TrueGuard(); + +private: + bool& m_rbTrueDuringGuardedTime; +}; +} +// INCLUDED_CHART2_SOURCE_INC_TRUEGUARD_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/UncachedDataSequence.hxx b/chart2/source/inc/UncachedDataSequence.hxx new file mode 100644 index 000000000..0829ceffa --- /dev/null +++ b/chart2/source/inc/UncachedDataSequence.hxx @@ -0,0 +1,175 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_UNCACHEDDATASEQUENCE_HXX +#define INCLUDED_CHART2_SOURCE_INC_UNCACHEDDATASEQUENCE_HXX + +// helper classes +#include <cppuhelper/compbase.hxx> +#include <comphelper/uno3.hxx> +#include <comphelper/broadcasthelper.hxx> +#include <comphelper/propertycontainer.hxx> +#include <comphelper/proparrhlp.hxx> + +// interfaces and types +#include <com/sun/star/lang/XServiceInfo.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/XModifiable.hpp> + +namespace com::sun::star::beans { class XPropertySetInfo; } +namespace com::sun::star::chart2 { class XInternalDataProvider; } + +namespace chart +{ + +namespace impl +{ +typedef ::cppu::WeakComponentImplHelper< + css::chart2::data::XDataSequence, + css::chart2::data::XNumericalDataSequence, + css::chart2::data::XTextualDataSequence, + css::util::XCloneable, + css::util::XModifiable, // contains util::XModifyBroadcaster + css::container::XIndexReplace, + css::container::XNamed, // for setting a new range representation + css::lang::XServiceInfo > + UncachedDataSequence_Base; +} + +/** + * This sequence object does NOT store actual sequence data. Instead, it + * references a column inside the internal data table (represented by class + * InternalData) via range representation string. The range representation + * string ends with a numeric value that indicates the column index within + * the internal data table. + * + * <p>A range representation can be either '0', '1', '2', ..., or 'label 1', + * 'label 2', ...</p> + */ +class UncachedDataSequence final : + 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 css::uno::Reference< css::chart2::XInternalDataProvider > & xIntDataProv, + const OUString & rRangeRepresentation ); + UncachedDataSequence( + const css::uno::Reference< css::chart2::XInternalDataProvider > & xIntDataProv, + const OUString & rRangeRepresentation, + const OUString & rRole ); + UncachedDataSequence( const UncachedDataSequence & rSource ); + virtual ~UncachedDataSequence() override; + + /// declare XServiceInfo methods + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; + virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; + + /// merge XInterface implementations + DECLARE_XINTERFACE() + /// merge XTypeProvider implementations + DECLARE_XTYPEPROVIDER() + +private: + // ____ XPropertySet ____ + /// @see css::beans::XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo() override; + /// @see ::comphelper::OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + /// @see ::comphelper::OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; + + // ____ XDataSequence ____ + virtual css::uno::Sequence< css::uno::Any > SAL_CALL getData() override; + virtual OUString SAL_CALL getSourceRangeRepresentation() override; + virtual css::uno::Sequence< OUString > SAL_CALL generateLabel( + css::chart2::data::LabelOrigin nLabelOrigin ) override; + virtual ::sal_Int32 SAL_CALL getNumberFormatKeyByIndex( ::sal_Int32 nIndex ) override; + + // ____ XNumericalDataSequence ____ + /// @see css::chart::data::XNumericalDataSequence + virtual css::uno::Sequence< double > SAL_CALL getNumericalData() override; + + // ____ XTextualDataSequence ____ + /// @see css::chart::data::XTextualDataSequence + virtual css::uno::Sequence< OUString > SAL_CALL getTextualData() override; + + // ____ XIndexReplace ____ + virtual void SAL_CALL replaceByIndex( ::sal_Int32 Index, const css::uno::Any& Element ) override; + + // ____ XIndexAccess (base of XIndexReplace) ____ + virtual ::sal_Int32 SAL_CALL getCount() override; + virtual css::uno::Any SAL_CALL getByIndex( ::sal_Int32 Index ) override; + + // ____ XElementAccess (base of XIndexAccess) ____ + virtual css::uno::Type SAL_CALL getElementType() override; + virtual sal_Bool SAL_CALL hasElements() override; + + // ____ XNamed (for setting a new range representation) ____ + virtual OUString SAL_CALL getName() override; + virtual void SAL_CALL setName( const OUString& aName ) override; + + // ____ XCloneable ____ + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() override; + + // ____ XModifiable ____ + virtual sal_Bool SAL_CALL isModified() override; + virtual void SAL_CALL setModified( sal_Bool bModified ) override; + + // ____ XModifyBroadcaster (base of XModifiable) ____ + virtual void SAL_CALL addModifyListener( + const css::uno::Reference< css::util::XModifyListener >& aListener ) override; + virtual void SAL_CALL removeModifyListener( + const css::uno::Reference< css::util::XModifyListener >& aListener ) override; + + void fireModifyEvent(); + + // <properties> + sal_Int32 m_nNumberFormatKey; + OUString m_sRole; + OUString m_aXMLRange; + // </properties> + + /** This method registers all properties. It should be called by all + constructors. + */ + void registerProperties(); + + css::uno::Reference< css::chart2::XInternalDataProvider > m_xDataProvider; + OUString m_aSourceRepresentation; + css::uno::Reference< css::util::XModifyListener > + m_xModifyEventForwarder; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_UNCACHEDDATASEQUENCE_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/UserDefinedProperties.hxx b/chart2/source/inc/UserDefinedProperties.hxx new file mode 100644 index 000000000..93d7af9fd --- /dev/null +++ b/chart2/source/inc/UserDefinedProperties.hxx @@ -0,0 +1,58 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_USERDEFINEDPROPERTIES_HXX +#define INCLUDED_CHART2_SOURCE_INC_USERDEFINEDPROPERTIES_HXX + +#include "FastPropertyIdRanges.hxx" +#include "charttoolsdllapi.hxx" + +#include <vector> + +namespace com::sun::star::beans { struct Property; } + +namespace chart +{ + +// implements service com.sun.star.xml.UserDefinedAttributesSupplier +namespace UserDefinedProperties +{ + // 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.UserDefinedAttributesSupplier + // UserDefined attributes in the other properties-sections. (as long as + // there is no reliable mechanism, properties may move between the + // sections) + PROP_XML_USERDEF + }; + + OOO_DLLPUBLIC_CHARTTOOLS void AddPropertiesToVector( + std::vector< css::beans::Property > & rOutProperties ); +} + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_USERDEFINEDPROPERTIES_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/WeakListenerAdapter.hxx b/chart2/source/inc/WeakListenerAdapter.hxx new file mode 100644 index 000000000..08568f253 --- /dev/null +++ b/chart2/source/inc/WeakListenerAdapter.hxx @@ -0,0 +1,107 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_WEAKLISTENERADAPTER_HXX +#define INCLUDED_CHART2_SOURCE_INC_WEAKLISTENERADAPTER_HXX + +#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/implbase.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 adapted class for later use.</p> + */ +template< class Listener > + class WeakListenerAdapter : public + ::cppu::WeakImplHelper< Listener > +{ +public: + explicit WeakListenerAdapter( const css::uno::Reference< Listener > & xListener ) : + m_xListener( xListener ) + {} + explicit WeakListenerAdapter( const css::uno::WeakReference< Listener > & xListener ) : + m_xListener( xListener ) + {} + +protected: + // ____ XEventListener (base of all listeners) ____ + virtual void SAL_CALL disposing( + const css::lang::EventObject& Source ) override + { + css::uno::Reference< css::lang::XEventListener > xEventListener( + css::uno::Reference< Listener >( m_xListener), css::uno::UNO_QUERY ); + if( xEventListener.is()) + xEventListener->disposing( Source ); + } + + css::uno::Reference< Listener > getListener() const + { + return m_xListener; + } + +private: + css::uno::WeakReference< Listener > m_xListener; +}; + +class WeakModifyListenerAdapter : + public WeakListenerAdapter< css::util::XModifyListener > +{ +public: + explicit WeakModifyListenerAdapter( + const css::uno::WeakReference< css::util::XModifyListener > & xListener ); + virtual ~WeakModifyListenerAdapter() override; + +protected: + // ____ XModifyListener ____ + virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override; +}; + +class WeakSelectionChangeListenerAdapter : + public WeakListenerAdapter< css::view::XSelectionChangeListener > +{ +public: + explicit WeakSelectionChangeListenerAdapter( + const css::uno::Reference< css::view::XSelectionChangeListener > & xListener ); + virtual ~WeakSelectionChangeListenerAdapter() override; + +protected: + // ____ XSelectionChangeListener ____ + virtual void SAL_CALL selectionChanged( + const css::lang::EventObject& aEvent ) override; +}; + +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_WEAKLISTENERADAPTER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/WrappedDefaultProperty.hxx b/chart2/source/inc/WrappedDefaultProperty.hxx new file mode 100644 index 000000000..a36321181 --- /dev/null +++ b/chart2/source/inc/WrappedDefaultProperty.hxx @@ -0,0 +1,53 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_WRAPPEDDEFAULTPROPERTY_HXX +#define INCLUDED_CHART2_SOURCE_INC_WRAPPEDDEFAULTPROPERTY_HXX + +#include "WrappedProperty.hxx" +#include "charttoolsdllapi.hxx" + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS WrappedDefaultProperty : public WrappedProperty +{ +public: + explicit WrappedDefaultProperty( + const OUString& rOuterName, const OUString& rInnerName, + const css::uno::Any& rNewOuterDefault ); + virtual ~WrappedDefaultProperty() override; + + virtual void setPropertyToDefault( + const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const override; + + virtual css::uno::Any getPropertyDefault( + const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const override; + + virtual css::beans::PropertyState getPropertyState( + const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const override; +private: + css::uno::Any m_aOuterDefaultValue; +}; + +} // namespace chart + +// CHART2_WRAPPEDPROPERTYNEWDEFAULT_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/WrappedDirectStateProperty.hxx b/chart2/source/inc/WrappedDirectStateProperty.hxx new file mode 100644 index 000000000..ba2bc0aac --- /dev/null +++ b/chart2/source/inc/WrappedDirectStateProperty.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_WRAPPEDDIRECTSTATEPROPERTY_HXX +#define INCLUDED_CHART2_SOURCE_INC_WRAPPEDDIRECTSTATEPROPERTY_HXX + +#include "WrappedProperty.hxx" +#include "charttoolsdllapi.hxx" + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS WrappedDirectStateProperty : + public WrappedProperty +{ +public: + explicit WrappedDirectStateProperty( + const OUString& rOuterName, const OUString& rInnerName ); + virtual ~WrappedDirectStateProperty() override; + + virtual css::beans::PropertyState getPropertyState( + const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const override; +}; + +} // namespace chart + +// CHART2_WRAPPEDPROPERTYNEWDEFAULT_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/WrappedIgnoreProperty.hxx b/chart2/source/inc/WrappedIgnoreProperty.hxx new file mode 100644 index 000000000..185e06d66 --- /dev/null +++ b/chart2/source/inc/WrappedIgnoreProperty.hxx @@ -0,0 +1,66 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_WRAPPEDIGNOREPROPERTY_HXX +#define INCLUDED_CHART2_SOURCE_INC_WRAPPEDIGNOREPROPERTY_HXX + +#include "WrappedProperty.hxx" +#include "charttoolsdllapi.hxx" + +#include <vector> + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS WrappedIgnoreProperty final : public WrappedProperty +{ +public: + WrappedIgnoreProperty( const OUString& rOuterName, const css::uno::Any& rDefaultValue ); + virtual ~WrappedIgnoreProperty() override; + + virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override; + + virtual css::uno::Any getPropertyValue( const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const override; + +SAL_DLLPRIVATE virtual void setPropertyToDefault( const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const override; + +SAL_DLLPRIVATE virtual css::uno::Any getPropertyDefault( const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const override; + +SAL_DLLPRIVATE virtual css::beans::PropertyState getPropertyState( const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const override; + +private: + css::uno::Any m_aDefaultValue; + mutable css::uno::Any m_aCurrentValue; +}; + +class OOO_DLLPUBLIC_CHARTTOOLS WrappedIgnoreProperties +{ +public: + static void addIgnoreLineProperties( std::vector< std::unique_ptr<WrappedProperty> >& rList ); + + static void addIgnoreFillProperties( std::vector< std::unique_ptr<WrappedProperty> >& rList ); + SAL_DLLPRIVATE static void addIgnoreFillProperties_without_BitmapProperties( std::vector< std::unique_ptr<WrappedProperty> >& rList ); + SAL_DLLPRIVATE static void addIgnoreFillProperties_only_BitmapProperties( std::vector< std::unique_ptr<WrappedProperty> >& rList ); +}; + +} //namespace chart + +// INCLUDED_CHART2_SOURCE_INC_WRAPPEDIGNOREPROPERTY_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/WrappedProperty.hxx b/chart2/source/inc/WrappedProperty.hxx new file mode 100644 index 000000000..82b9f3b0c --- /dev/null +++ b/chart2/source/inc/WrappedProperty.hxx @@ -0,0 +1,90 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_WRAPPEDPROPERTY_HXX +#define INCLUDED_CHART2_SOURCE_INC_WRAPPEDPROPERTY_HXX + +#include <com/sun/star/beans/PropertyState.hpp> +#include <com/sun/star/uno/Any.hxx> +#include <rtl/ustring.hxx> +#include "charttoolsdllapi.hxx" + +#include <map> +#include <memory> + +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::beans { class XPropertyState; } +namespace com::sun::star::uno { template <class interface_type> class Reference; } + +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 OUString& rOuterName, const OUString& rInnerName ); + virtual ~WrappedProperty(); + + const OUString& getOuterName() const { return m_aOuterName;} + virtual OUString getInnerName() const; + + /// @throws css::beans::UnknownPropertyException + /// @throws css::beans::PropertyVetoException + /// @throws css::lang::IllegalArgumentException + /// @throws css::lang::WrappedTargetException + /// @throws css::uno::RuntimeException + virtual void setPropertyValue( const css::uno::Any& rOuterValue, const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const; + + /// @throws css::beans::UnknownPropertyException + /// @throws css::lang::WrappedTargetException + /// @throws css::uno::RuntimeException + virtual css::uno::Any getPropertyValue( const css::uno::Reference< css::beans::XPropertySet >& xInnerPropertySet ) const; + + /// @throws css::beans::UnknownPropertyException + /// @throws css::uno::RuntimeException + virtual void setPropertyToDefault( const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const; + + /// @throws css::beans::UnknownPropertyException + /// @throws css::lang::WrappedTargetException + /// @throws css::uno::RuntimeException + virtual css::uno::Any getPropertyDefault( const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const; + + /// @throws css::beans::UnknownPropertyException + /// @throws css::uno::RuntimeException + virtual css::beans::PropertyState getPropertyState( const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const; + +protected: + virtual css::uno::Any convertInnerToOuterValue( const css::uno::Any& rInnerValue ) const; + virtual css::uno::Any convertOuterToInnerValue( const css::uno::Any& rOuterValue ) const; + +protected: + OUString m_aOuterName; + OUString m_aInnerName; +}; + +typedef std::map< sal_Int32, std::unique_ptr<const WrappedProperty> > tWrappedPropertyMap; + +} //namespace chart + +// INCLUDED_CHART2_SOURCE_INC_WRAPPEDPROPERTY_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/WrappedPropertySet.hxx b/chart2/source/inc/WrappedPropertySet.hxx new file mode 100644 index 000000000..09c768fc7 --- /dev/null +++ b/chart2/source/inc/WrappedPropertySet.hxx @@ -0,0 +1,126 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_WRAPPEDPROPERTYSET_HXX +#define INCLUDED_CHART2_SOURCE_INC_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 <cppuhelper/implbase.hxx> + +#include <memory> +#include <vector> + +namespace cppu { class IPropertyArrayHelper; } +namespace cppu { class OPropertyArrayHelper; } + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTTOOLS WrappedPropertySet : + public MutexContainer + , public ::cppu::WeakImplHelper + < css::beans::XPropertySet + , css::beans::XMultiPropertySet + , css::beans::XPropertyState + , css::beans::XMultiPropertyStates + > +{ +public: + WrappedPropertySet(); + virtual ~WrappedPropertySet() override; + + void clearWrappedPropertySet(); + +public: + //XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override; + + virtual void SAL_CALL setPropertyValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override; + virtual css::uno::Any SAL_CALL getPropertyValue( const OUString& PropertyName ) override; + + virtual void SAL_CALL addPropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; + virtual void SAL_CALL addVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + virtual void SAL_CALL removeVetoableChangeListener( const OUString& PropertyName, const css::uno::Reference< css::beans::XVetoableChangeListener >& aListener ) override; + + //XMultiPropertySet + //getPropertySetInfo() already declared in XPropertySet + virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Sequence< css::uno::Any >& aValues ) override; + virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override; + virtual void SAL_CALL addPropertiesChangeListener( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; + virtual void SAL_CALL removePropertiesChangeListener( const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; + virtual void SAL_CALL firePropertiesChangeEvent( const css::uno::Sequence< OUString >& aPropertyNames, const css::uno::Reference< css::beans::XPropertiesChangeListener >& xListener ) override; + + //XPropertyState + virtual css::beans::PropertyState SAL_CALL getPropertyState( const OUString& PropertyName ) override; + virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override; + virtual void SAL_CALL setPropertyToDefault( const OUString& PropertyName ) override; + virtual css::uno::Any SAL_CALL getPropertyDefault( const OUString& aPropertyName ) override; + + //XMultiPropertyStates + //getPropertyStates() already declared in XPropertyState + virtual void SAL_CALL setAllPropertiesToDefault( ) override; + virtual void SAL_CALL setPropertiesToDefault( const css::uno::Sequence< OUString >& aPropertyNames ) override; + virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyDefaults( const css::uno::Sequence< OUString >& aPropertyNames ) override; + +protected: //methods + /** give all the properties that should be visible to the outer side + */ + virtual const css::uno::Sequence< css::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 std::vector< std::unique_ptr<WrappedProperty> > createWrappedProperties()=0; + + virtual css::uno::Reference< css::beans::XPropertySet > getInnerPropertySet() = 0; + SAL_DLLPRIVATE css::uno::Reference< css::beans::XPropertyState > getInnerPropertyState(); + + ::cppu::IPropertyArrayHelper& getInfoHelper(); + SAL_DLLPRIVATE tWrappedPropertyMap& getWrappedPropertyMap(); + + const WrappedProperty* getWrappedProperty( const OUString& rOuterName ); + const WrappedProperty* getWrappedProperty( sal_Int32 nHandle ); + +protected: //member + css::uno::Reference< css::beans::XPropertySetInfo > m_xInfo;//outer PropertySetInfo + + std::unique_ptr<::cppu::OPropertyArrayHelper> m_pPropertyArrayHelper;//holds all possible outer properties + + std::unique_ptr<tWrappedPropertyMap> m_pWrappedPropertyMap;//holds all wrapped properties (containing the special mapping from inner to outer properties) + + //Container for the XPropertyChangedListener. The listeners are inserted by handle. + //OMultiTypeInterfaceContainerHelperInt32 m_aBoundListenerContainer; + + //Container for the XPropertyVetoableListener. The listeners are inserted by handle. + //OMultiTypeInterfaceContainerHelperInt32 m_aVetoableListenerContainer; +}; + +} //namespace chart + +// INCLUDED_CHART2_SOURCE_INC_WRAPPEDPROPERTYSET_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/XMLRangeHelper.hxx b/chart2/source/inc/XMLRangeHelper.hxx new file mode 100644 index 000000000..207770dbb --- /dev/null +++ b/chart2/source/inc/XMLRangeHelper.hxx @@ -0,0 +1,67 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_XMLRANGEHELPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_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) + {} + + bool empty() const { return bIsEmpty; } +}; + +struct OOO_DLLPUBLIC_CHARTTOOLS CellRange +{ + Cell aUpperLeft; + Cell aLowerRight; + OUString aTableName; +}; + +CellRange getCellRangeFromXMLString( const OUString & rXMLString ); + +OUString getXMLStringFromCellRange( const CellRange & rRange ); + +} // namespace XMLRangeHelper +} // namespace chart + +// INCLUDED_CHART2_SOURCE_INC_XMLRANGEHELPER_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/charttoolsdllapi.hxx b/chart2/source/inc/charttoolsdllapi.hxx new file mode 100644 index 000000000..3a5b8144b --- /dev/null +++ b/chart2/source/inc/charttoolsdllapi.hxx @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/chartview/ChartSfxItemIds.hxx b/chart2/source/inc/chartview/ChartSfxItemIds.hxx new file mode 100644 index 000000000..2d02f2f8b --- /dev/null +++ b/chart2/source/inc/chartview/ChartSfxItemIds.hxx @@ -0,0 +1,228 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_CHARTSFXITEMIDS_HXX +#define INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_CHARTSFXITEMIDS_HXX + +#include <svl/typedwhich.hxx> + +class SvxSizeItem; +class SfxIntegerListItem; +class SfxBoolItem; +class SfxStringItem; +class SfxInt32Item; +class SfxUInt32Item; +class SvxChartIndicateItem; +class SvxDoubleItem; +class SvxBrushItem; +class SvxChartKindErrorItem; +class SvxChartTextOrderItem; +class SvxChartRegressItem; + +// SCHATTR + +// can't this be changed to 0? +constexpr sal_uInt16 SCHATTR_START = 1; + +constexpr sal_uInt16 SCHATTR_DATADESCR_START (SCHATTR_START); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATADESCR_SHOW_NUMBER (SCHATTR_DATADESCR_START); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATADESCR_SHOW_PERCENTAGE (SCHATTR_DATADESCR_START + 1); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATADESCR_SHOW_CATEGORY (SCHATTR_DATADESCR_START + 2); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATADESCR_SHOW_SYMBOL (SCHATTR_DATADESCR_START + 3); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATADESCR_WRAP_TEXT (SCHATTR_DATADESCR_START + 4); +constexpr TypedWhichId<SfxStringItem> SCHATTR_DATADESCR_SEPARATOR (SCHATTR_DATADESCR_START + 5); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_DATADESCR_PLACEMENT (SCHATTR_DATADESCR_START + 6); +constexpr TypedWhichId<SfxIntegerListItem> SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS (SCHATTR_DATADESCR_START + 7); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATADESCR_NO_PERCENTVALUE (SCHATTR_DATADESCR_START + 8); //percentage values should not be offered +constexpr TypedWhichId<SfxUInt32Item> SCHATTR_PERCENT_NUMBERFORMAT_VALUE (SCHATTR_DATADESCR_START + 9); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_PERCENT_NUMBERFORMAT_SOURCE (SCHATTR_DATADESCR_START + 10); +constexpr sal_uInt16 SCHATTR_DATADESCR_END (SCHATTR_PERCENT_NUMBERFORMAT_SOURCE); + +//legend +constexpr sal_uInt16 SCHATTR_LEGEND_START (SCHATTR_DATADESCR_END + 1); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_LEGEND_POS (SCHATTR_LEGEND_START); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_LEGEND_SHOW (SCHATTR_LEGEND_START + 1); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_LEGEND_NO_OVERLAY (SCHATTR_LEGEND_START + 2); +constexpr sal_uInt16 SCHATTR_LEGEND_END (SCHATTR_LEGEND_NO_OVERLAY); + +//text +constexpr sal_uInt16 SCHATTR_TEXT_START (SCHATTR_LEGEND_END + 1); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_TEXT_DEGREES (SCHATTR_TEXT_START); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_TEXT_STACKED (SCHATTR_TEXT_START + 1); +constexpr sal_uInt16 SCHATTR_TEXT_END (SCHATTR_TEXT_STACKED); + +// statistic +constexpr sal_uInt16 SCHATTR_STAT_START (SCHATTR_TEXT_END + 1); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_STAT_AVERAGE (SCHATTR_STAT_START); +constexpr TypedWhichId<SvxChartKindErrorItem> SCHATTR_STAT_KIND_ERROR (SCHATTR_STAT_START + 1); +constexpr TypedWhichId<SvxDoubleItem> SCHATTR_STAT_PERCENT (SCHATTR_STAT_START + 2); +constexpr TypedWhichId<SvxDoubleItem> SCHATTR_STAT_BIGERROR (SCHATTR_STAT_START + 3); +constexpr TypedWhichId<SvxDoubleItem> SCHATTR_STAT_CONSTPLUS (SCHATTR_STAT_START + 4); +constexpr TypedWhichId<SvxDoubleItem> SCHATTR_STAT_CONSTMINUS (SCHATTR_STAT_START + 5); +constexpr TypedWhichId<SvxChartIndicateItem> SCHATTR_STAT_INDICATE (SCHATTR_STAT_START + 6); +constexpr TypedWhichId<SfxStringItem> SCHATTR_STAT_RANGE_POS (SCHATTR_STAT_START + 7); +constexpr TypedWhichId<SfxStringItem> SCHATTR_STAT_RANGE_NEG (SCHATTR_STAT_START + 8); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_STAT_ERRORBAR_TYPE (SCHATTR_STAT_START + 9); +constexpr sal_uInt16 SCHATTR_STAT_END (SCHATTR_STAT_ERRORBAR_TYPE); + +// these attributes are for replacement of enum eChartStyle + +constexpr sal_uInt16 SCHATTR_STYLE_START (SCHATTR_STAT_END + 1); + +// for whole chart +constexpr TypedWhichId<SfxBoolItem> SCHATTR_STYLE_DEEP (SCHATTR_STYLE_START ); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_STYLE_3D (SCHATTR_STYLE_START + 1); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_STYLE_VERTICAL (SCHATTR_STYLE_START + 2); + +// also for series +constexpr TypedWhichId<SfxInt32Item> SCHATTR_STYLE_BASETYPE (SCHATTR_STYLE_START + 3);// Line,Area,...,Pie +constexpr TypedWhichId<SfxBoolItem> SCHATTR_STYLE_LINES (SCHATTR_STYLE_START + 4);// draw line +constexpr TypedWhichId<SfxBoolItem> SCHATTR_STYLE_PERCENT (SCHATTR_STYLE_START + 5); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_STYLE_STACKED (SCHATTR_STYLE_START + 6); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_STYLE_SPLINES (SCHATTR_STYLE_START + 7); + +// also for data point +constexpr TypedWhichId<SfxInt32Item> SCHATTR_STYLE_SYMBOL (SCHATTR_STYLE_START + 8); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_STYLE_SHAPE (SCHATTR_STYLE_START + 9); +constexpr sal_uInt16 SCHATTR_STYLE_END (SCHATTR_STYLE_SHAPE ); + +constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXIS (SCHATTR_STYLE_END + 1); // see chtmodel.hxx defines CHART_AXIS_PRIMARY_X, etc. +//Re-mapped: +constexpr sal_uInt16 SCHATTR_AXIS_START (SCHATTR_AXIS + 1); +//axis scale +constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXISTYPE (SCHATTR_AXIS_START); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_REVERSE (SCHATTR_AXIS_START + 1); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_AUTO_MIN (SCHATTR_AXIS_START + 2); +constexpr TypedWhichId<SvxDoubleItem> SCHATTR_AXIS_MIN (SCHATTR_AXIS_START + 3); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_AUTO_MAX (SCHATTR_AXIS_START + 4); +constexpr TypedWhichId<SvxDoubleItem> SCHATTR_AXIS_MAX (SCHATTR_AXIS_START + 5); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_AUTO_STEP_MAIN (SCHATTR_AXIS_START + 6); +constexpr TypedWhichId<SvxDoubleItem> SCHATTR_AXIS_STEP_MAIN (SCHATTR_AXIS_START + 7); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXIS_MAIN_TIME_UNIT (SCHATTR_AXIS_START + 8); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_AUTO_STEP_HELP (SCHATTR_AXIS_START + 9); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXIS_STEP_HELP (SCHATTR_AXIS_START + 10); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXIS_HELP_TIME_UNIT (SCHATTR_AXIS_START + 11); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_AUTO_TIME_RESOLUTION (SCHATTR_AXIS_START + 12); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXIS_TIME_RESOLUTION (SCHATTR_AXIS_START + 13); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_LOGARITHM (SCHATTR_AXIS_START + 14); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_AUTO_DATEAXIS (SCHATTR_AXIS_START + 15); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_ALLOW_DATEAXIS (SCHATTR_AXIS_START + 16); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_AUTO_ORIGIN (SCHATTR_AXIS_START + 17); +constexpr TypedWhichId<SvxDoubleItem> SCHATTR_AXIS_ORIGIN (SCHATTR_AXIS_START + 18); +//axis position +constexpr sal_uInt16 SCHATTR_AXIS_POSITION_START (SCHATTR_AXIS_ORIGIN + 1); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXIS_TICKS (SCHATTR_AXIS_POSITION_START); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXIS_HELPTICKS (SCHATTR_AXIS_POSITION_START + 1); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXIS_POSITION (SCHATTR_AXIS_POSITION_START + 2); +constexpr TypedWhichId<SvxDoubleItem> SCHATTR_AXIS_POSITION_VALUE (SCHATTR_AXIS_POSITION_START + 3); +constexpr TypedWhichId<SfxUInt32Item> SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT (SCHATTR_AXIS_POSITION_START + 4); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_SHIFTED_CATEGORY_POSITION (SCHATTR_AXIS_POSITION_START + 5); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXIS_LABEL_POSITION (SCHATTR_AXIS_POSITION_START + 6); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXIS_MARK_POSITION (SCHATTR_AXIS_POSITION_START + 7); +//axis label +constexpr sal_uInt16 SCHATTR_AXIS_LABEL_START (SCHATTR_AXIS_MARK_POSITION + 1); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_SHOWDESCR (SCHATTR_AXIS_LABEL_START); +constexpr TypedWhichId<SvxChartTextOrderItem> SCHATTR_AXIS_LABEL_ORDER (SCHATTR_AXIS_LABEL_START + 1); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_LABEL_OVERLAP (SCHATTR_AXIS_LABEL_START + 2); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_LABEL_BREAK (SCHATTR_AXIS_LABEL_START + 3); +constexpr sal_uInt16 SCHATTR_AXIS_LABEL_END (SCHATTR_AXIS_LABEL_BREAK); + +constexpr sal_uInt16 SCHATTR_AXIS_END (SCHATTR_AXIS_LABEL_END); + +constexpr TypedWhichId<SvxBrushItem> SCHATTR_SYMBOL_BRUSH (SCHATTR_AXIS_END + 1); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_STOCK_VOLUME (SCHATTR_AXIS_END + 2); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_STOCK_UPDOWN (SCHATTR_AXIS_END + 3); +constexpr TypedWhichId<SvxSizeItem> SCHATTR_SYMBOL_SIZE (SCHATTR_AXIS_END + 4); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY (SCHATTR_AXIS_END + 5); + +// non persistent items (binary format) +constexpr sal_uInt16 SCHATTR_CHARTTYPE_START (SCHATTR_HIDE_DATA_POINT_LEGEND_ENTRY + 1); + +// new from New Chart +constexpr TypedWhichId<SfxInt32Item> SCHATTR_BAR_OVERLAP (SCHATTR_CHARTTYPE_START ); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_BAR_GAPWIDTH (SCHATTR_CHARTTYPE_START + 1); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_BAR_CONNECT (SCHATTR_CHARTTYPE_START + 2); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_NUM_OF_LINES_FOR_BAR (SCHATTR_CHARTTYPE_START + 3); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_SPLINE_ORDER (SCHATTR_CHARTTYPE_START + 4); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_SPLINE_RESOLUTION (SCHATTR_CHARTTYPE_START + 5); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_GROUP_BARS_PER_AXIS (SCHATTR_CHARTTYPE_START + 6); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_STARTING_ANGLE (SCHATTR_CHARTTYPE_START + 7); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_CLOCKWISE (SCHATTR_CHARTTYPE_START + 8); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_MISSING_VALUE_TREATMENT (SCHATTR_CHARTTYPE_START + 9); +constexpr TypedWhichId<SfxIntegerListItem> SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS (SCHATTR_CHARTTYPE_START + 10); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_INCLUDE_HIDDEN_CELLS (SCHATTR_CHARTTYPE_START + 11); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_HIDE_LEGEND_ENTRY (SCHATTR_CHARTTYPE_START + 12); + +constexpr sal_uInt16 SCHATTR_CHARTTYPE_END (SCHATTR_HIDE_LEGEND_ENTRY); + +// items for transporting information to dialogs +constexpr sal_uInt16 SCHATTR_MISC_START (SCHATTR_CHARTTYPE_END + 1); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXIS_FOR_ALL_SERIES (SCHATTR_MISC_START); +constexpr sal_uInt16 SCHATTR_MISC_END (SCHATTR_AXIS_FOR_ALL_SERIES); + +// regression curve +constexpr sal_uInt16 SCHATTR_REGRESSION_START (SCHATTR_MISC_END + 1); +constexpr TypedWhichId<SvxChartRegressItem> SCHATTR_REGRESSION_TYPE (SCHATTR_REGRESSION_START); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_REGRESSION_SHOW_EQUATION (SCHATTR_REGRESSION_START + 1); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_REGRESSION_SHOW_COEFF (SCHATTR_REGRESSION_START + 2); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_REGRESSION_DEGREE (SCHATTR_REGRESSION_START + 3); +constexpr TypedWhichId<SfxInt32Item> SCHATTR_REGRESSION_PERIOD (SCHATTR_REGRESSION_START + 4); +constexpr TypedWhichId<SvxDoubleItem> SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD (SCHATTR_REGRESSION_START + 5); +constexpr TypedWhichId<SvxDoubleItem> SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD (SCHATTR_REGRESSION_START + 6); +constexpr TypedWhichId<SfxBoolItem> SCHATTR_REGRESSION_SET_INTERCEPT (SCHATTR_REGRESSION_START + 7); +constexpr TypedWhichId<SvxDoubleItem> SCHATTR_REGRESSION_INTERCEPT_VALUE (SCHATTR_REGRESSION_START + 8); +constexpr TypedWhichId<SfxStringItem> SCHATTR_REGRESSION_CURVE_NAME (SCHATTR_REGRESSION_START + 9); +constexpr TypedWhichId<SfxStringItem> SCHATTR_REGRESSION_XNAME (SCHATTR_REGRESSION_START + 10); +constexpr TypedWhichId<SfxStringItem> SCHATTR_REGRESSION_YNAME (SCHATTR_REGRESSION_START + 11); +constexpr sal_uInt16 SCHATTR_REGRESSION_END (SCHATTR_REGRESSION_YNAME); + +constexpr sal_uInt16 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_REALNUMBER 0 +#define CHART_AXIS_PERCENT 1 +#define CHART_AXIS_CATEGORY 2 +#define CHART_AXIS_SERIES 3 +#define CHART_AXIS_DATE 4 + +// values for SCHATTR_STYLE_SHAPE items +#define CHART_SHAPE3D_IGNORE -2 //internal! (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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/chartview/DataPointSymbolSupplier.hxx b/chart2/source/inc/chartview/DataPointSymbolSupplier.hxx new file mode 100644 index 000000000..203c3c390 --- /dev/null +++ b/chart2/source/inc/chartview/DataPointSymbolSupplier.hxx @@ -0,0 +1,45 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_DATAPOINTSYMBOLSUPPLIER_HXX +#define INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_DATAPOINTSYMBOLSUPPLIER_HXX + +#include <chartview/chartviewdllapi.hxx> +#include <com/sun/star/uno/Reference.h> + +namespace com::sun::star::drawing { class XShapes; } +namespace com::sun::star::drawing { struct Direction3D; } +namespace com::sun::star::lang { class XMultiServiceFactory; } + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTVIEW DataPointSymbolSupplier +{ +public: + static css::uno::Reference< css::drawing::XShapes > + create2DSymbolList( const css::uno::Reference< css::lang::XMultiServiceFactory >& xShapeFactory + , const css::uno::Reference< css::drawing::XShapes >& xTarget + , const css::drawing::Direction3D& rSize ); +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/chartview/DrawModelWrapper.hxx b/chart2/source/inc/chartview/DrawModelWrapper.hxx new file mode 100644 index 000000000..3bc0b4fef --- /dev/null +++ b/chart2/source/inc/chartview/DrawModelWrapper.hxx @@ -0,0 +1,93 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_DRAWMODELWRAPPER_HXX +#define INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_DRAWMODELWRAPPER_HXX + +#include <svx/svdmodel.hxx> + +#include <chartview/chartviewdllapi.hxx> + +namespace com::sun::star::lang { class XMultiServiceFactory; } +namespace com::sun::star::frame { class XModel; } +namespace com::sun::star::drawing { class XDrawPage; } +namespace com::sun::star::drawing { class XShape; } +namespace com::sun::star::drawing { class XShapes; } + +class SdrObjList; +class SdrObject; + +namespace chart +{ + +class OOO_DLLPUBLIC_CHARTVIEW DrawModelWrapper : private SdrModel +{ +private: + SfxItemPool* m_pChartItemPool; + + css::uno::Reference< css::drawing::XDrawPage > m_xMainDrawPage; + css::uno::Reference< css::drawing::XDrawPage > m_xHiddenDrawPage; + + VclPtr<OutputDevice> m_pRefDevice; + +public: + SAL_DLLPRIVATE DrawModelWrapper(); + SAL_DLLPRIVATE virtual ~DrawModelWrapper() override; + + css::uno::Reference< css::lang::XMultiServiceFactory > getShapeFactory(); + + // the main page will contain the normal view objects + css::uno::Reference< css::drawing::XDrawPage > const & getMainDrawPage(); + SAL_DLLPRIVATE void clearMainDrawPage(); + + // the extra page is not visible, but contains some extras like the symbols for data points + css::uno::Reference< css::drawing::XDrawPage > const & getHiddenDrawPage(); + + static css::uno::Reference< css::drawing::XShapes > + getChartRootShape( const css::uno::Reference< css::drawing::XDrawPage>& xPage ); + + SAL_DLLPRIVATE void lockControllers(); + SAL_DLLPRIVATE void unlockControllers(); + + OutputDevice* getReferenceDevice() const; + + SfxItemPool& GetItemPool(); + + SAL_DLLPRIVATE virtual css::uno::Reference< css::uno::XInterface > + createUnoModel() override; + SAL_DLLPRIVATE css::uno::Reference< css::frame::XModel > + getUnoModel(); + SdrModel& getSdrModel(); + + XColorListRef GetColorList() const; + XDashListRef GetDashList() const; + XLineEndListRef GetLineEndList() const; + XGradientListRef GetGradientList() const; + XHatchListRef GetHatchList() const; + XBitmapListRef GetBitmapList() const; + XPatternListRef GetPatternList() const; + + SdrObject* getNamedSdrObject( const OUString& rName ); + static SdrObject* getNamedSdrObject( const OUString& rName, SdrObjList const * pObjList ); + + static bool removeShape( const css::uno::Reference< css::drawing::XShape >& xShape ); +}; +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/chartview/ExplicitScaleValues.hxx b/chart2/source/inc/chartview/ExplicitScaleValues.hxx new file mode 100644 index 000000000..731d4c087 --- /dev/null +++ b/chart2/source/inc/chartview/ExplicitScaleValues.hxx @@ -0,0 +1,154 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_EXPLICITSCALEVALUES_HXX +#define INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_EXPLICITSCALEVALUES_HXX + +#include <chartview/chartviewdllapi.hxx> +#include <com/sun/star/chart/TimeInterval.hpp> +#include <com/sun/star/chart2/AxisOrientation.hpp> +#include <com/sun/star/chart2/XScaling.hpp> +#include <tools/date.hxx> +#include <vector> + +namespace com::sun::star::chart2 { class XScaling; } + +namespace chart +{ + +/** This structure contains the explicit values for a scale like Minimum and Maximum. + See also css::chart2::ScaleData. +*/ +struct OOO_DLLPUBLIC_CHARTVIEW ExplicitScaleData +{ + ExplicitScaleData(); + + double Minimum; + double Maximum; + double Origin; + + css::chart2::AxisOrientation Orientation; + + css::uno::Reference< css::chart2::XScaling > Scaling; + + sal_Int32 AxisType;//see css::chart2::AxisType + bool ShiftedCategoryPosition; + sal_Int32 TimeResolution; //constant of type <type>css::chart::TimeUnit</type> + Date NullDate; +}; + +struct ExplicitSubIncrement +{ + ExplicitSubIncrement(); + + /** Numbers of intervals between two superior ticks. For an axis + this usually means, that <code>IntervalCount - 1</code> + sub-tick-marks are displayed between two superior ticks. + + */ + sal_Int32 IntervalCount; + + /** If <TRUE/>, the distance between two sub-tick-marks on the + screen is always the same. If <FALSE/>, the distances may + differ depending on the <type>XScaling</type>. + */ + bool PostEquidistant; +}; + +/** describes how tickmarks are positioned on the scale of an axis. +*/ +struct OOO_DLLPUBLIC_CHARTVIEW ExplicitIncrementData +{ + ExplicitIncrementData(); + + /** the following two members are only for date-time axis + */ + css::chart::TimeInterval MajorTimeInterval; + css::chart::TimeInterval MinorTimeInterval; + + /** the other members are for *not* date-time axis + */ + + /** <member>Distance</member> describes the distance between two + neighboring main tickmarks on a <type>Scale</type> of an axis. + All neighboring main tickmarks have the same constant distance. + + <p>If the Scale has a <type>XScaling</type> the <member>Distance</member> + may be measured in two different ways - that is - before or after the + scaling is applied.</p> + + <p>On a logarithmic scale for example the distance between two main + tickmarks is typically measured after the scaling is applied: + Distance = log(tick2)-log(tick1) + ( log(1000)-log(100)==log(100)-log(10)==log(10)-log(1)==1==Distance ). + The resulting tickmarks will always look equidistant on the screen. + The other possibility is to have a Distance = tick2-tick1 measured constant + before a scaling is applied, which may lead to non equidistant tickmarks + on the screen.</p> + + <p><member>PostEquidistant</member> rules whether the <member>Distance</member> + is meant to be a value before or after scaling.</p> + */ + double Distance; + + /** + <member>PostEquidistant</member> rules whether the member <member>Distance</member> + describes a distance before or after the scaling is applied. + + <p>If <member>PostEquidistant</member> equals <TRUE/> <member>Distance</member> + is given in values after <type>XScaling</type> is applied, thus resulting + main tickmarks will always look equidistant on the screen. + If <member>PostEquidistant</member> equals <FALSE/> <member>Distance</member> + is given in values before <type>XScaling</type> is applied.</p> + */ + bool PostEquidistant; + + /** The <member>BaseValue</member> gives a starting point on the scale + to which all further main tickmarks are relatively positioned. + + <p>The <member>BaseValue</member> is always a value on the scale before + a possible scaling is applied. If the given value is not valid in the + associated scaling the minimum of the scaling is assumed, + if there is no minimum any other obvious value will be assumed.</p> + + <p>E.g.: assume a scale from 0 to 6 with identical scaling. + Further assume this Increment to have Distance==2 and PostEquidistant==false. + Setting BaseValue=0 would lead to main tickmarks 0; 2; 4; 6; + Setting BaseValue=1,3 would lead to main tickmarks 1,3; 3,3; 5,3; + Setting BaseValue=-0,7 would also lead to main tickmarks 1,3; 3,3; 5,3; + And setting BaseValue to 2, -2, 4, -4 etc. in this example + leads to the same result as BaseValue=0.</p> + */ + double BaseValue; + + /** <member>SubIncrements</member> describes the positioning of further + sub tickmarks on the scale of an axis. + + <p>The first SubIncrement in this sequence determines how the + distance between two neighboring main tickmarks is divided for positioning + of further sub tickmarks. Every following SubIncrement determines the + positions of subsequent tickmarks in relation to their parent tickmarks + given by the preceding SubIncrement.</p> + */ + std::vector< ExplicitSubIncrement > SubIncrements; +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/chartview/ExplicitValueProvider.hxx b/chart2/source/inc/chartview/ExplicitValueProvider.hxx new file mode 100644 index 000000000..e2ff1e01a --- /dev/null +++ b/chart2/source/inc/chartview/ExplicitValueProvider.hxx @@ -0,0 +1,98 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_EXPLICITVALUEPROVIDER_HXX +#define INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_EXPLICITVALUEPROVIDER_HXX + +#include <com/sun/star/awt/Rectangle.hpp> +#include <chartview/chartviewdllapi.hxx> + +#include <memory> + +namespace chart { class ChartModel; } +namespace chart { struct ExplicitIncrementData; } +namespace chart { struct ExplicitScaleData; } +namespace com::sun::star::beans { class XPropertySet; } +namespace com::sun::star::chart2 { class XAxis; } +namespace com::sun::star::chart2 { class XChartDocument; } +namespace com::sun::star::chart2 { class XCoordinateSystem; } +namespace com::sun::star::chart2 { class XDataSeries; } +namespace com::sun::star::chart2 { class XDiagram; } +namespace com::sun::star::drawing { class XShape; } +namespace com::sun::star::uno { class XInterface; } +namespace com::sun::star::uno { template <typename > class Reference; } +namespace com::sun::star::uno { template <typename > class Sequence; } +namespace com::sun::star::util { class XNumberFormatsSupplier; } + +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 missing 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 bool getExplicitValuesForAxis( + css::uno::Reference< css::chart2::XAxis > xAxis + , ExplicitScaleData& rExplicitScale + , 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 css::awt::Rectangle + getRectangleOfObject( const OUString& rObjectCID, bool bSnapRect=false )=0; + + virtual css::awt::Rectangle getDiagramRectangleExcludingAxes()=0; + + virtual css::uno::Reference< css::drawing::XShape > + getShapeForCID( const OUString& rObjectCID )=0; + + virtual std::shared_ptr< DrawModelWrapper > getDrawModelWrapper() = 0; + + static const css::uno::Sequence<sal_Int8>& getUnoTunnelId(); + + static css::awt::Rectangle + AddSubtractAxisTitleSizes( + ChartModel& rModel + , const css::uno::Reference< css::uno::XInterface >& xChartView + , const css::awt::Rectangle& rPositionAndSize, bool bSubtract ); + + static sal_Int32 getExplicitNumberFormatKeyForAxis( + const css::uno::Reference< css::chart2::XAxis >& xAxis + , const css::uno::Reference< css::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem + , const css::uno::Reference< css::chart2::XChartDocument>& xChartDoc); + + static sal_Int32 getExplicitNumberFormatKeyForDataLabel( + const css::uno::Reference< css::beans::XPropertySet >& xSeriesOrPointProp ); + + static sal_Int32 getExplicitPercentageNumberFormatKeyForDataLabel( + const css::uno::Reference< css::beans::XPropertySet >& xSeriesOrPointProp + , const css::uno::Reference< css::util::XNumberFormatsSupplier >& xNumberFormatsSupplier ); + +protected: + ~ExplicitValueProvider() {} +}; + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/chartview/chartviewdllapi.hxx b/chart2/source/inc/chartview/chartviewdllapi.hxx new file mode 100644 index 000000000..276210438 --- /dev/null +++ b/chart2/source/inc/chartview/chartviewdllapi.hxx @@ -0,0 +1,35 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#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 + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/defines.hxx b/chart2/source/inc/defines.hxx new file mode 100644 index 000000000..135afe44b --- /dev/null +++ b/chart2/source/inc/defines.hxx @@ -0,0 +1,27 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#ifndef INCLUDED_CHART2_SOURCE_INC_DEFINES_HXX +#define INCLUDED_CHART2_SOURCE_INC_DEFINES_HXX + +#define FIXED_SIZE_FOR_3D_CHART_VOLUME 10000.0 + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/res_BarGeometry.hxx b/chart2/source/inc/res_BarGeometry.hxx new file mode 100644 index 000000000..235c5f4fe --- /dev/null +++ b/chart2/source/inc/res_BarGeometry.hxx @@ -0,0 +1,48 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_RES_BARGEOMETRY_HXX +#define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_RES_BARGEOMETRY_HXX + +#include <vcl/weld.hxx> + +namespace chart +{ +class BarGeometryResources +{ +public: + explicit BarGeometryResources(weld::Builder* pParent); + + void set_visible(bool bShow); + void set_sensitive(bool bEnable); + + sal_Int32 get_selected_index() const; + void select(sal_Int32 nPos); + + void connect_changed(const Link<weld::TreeView&, void>& rLink); + +private: + std::unique_ptr<weld::Label> m_xFT_Geometry; + std::unique_ptr<weld::TreeView> m_xLB_Geometry; +}; + +} //namespace chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/servicenames.hxx b/chart2/source/inc/servicenames.hxx new file mode 100644 index 000000000..a63c09393 --- /dev/null +++ b/chart2/source/inc/servicenames.hxx @@ -0,0 +1,55 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_SERVICENAMES_HXX +#define INCLUDED_CHART2_SOURCE_INC_SERVICENAMES_HXX + +namespace chart +{ +#define CHART_MODEL_SERVICE_IMPLEMENTATION_NAME "com.sun.star.comp.chart2.ChartModel" +#define CHART_MODEL_SERVICE_NAME "com.sun.star.chart2.ChartDocument" +//@todo create your own service containing the service com.sun.star.document.OfficeDocument + +#define CHART_CONTROLLER_SERVICE_IMPLEMENTATION_NAME "com.sun.star.comp.chart2.ChartController" +#define CHART_CONTROLLER_SERVICE_NAME "com.sun.star.chart2.ChartController" +//@todo create your own service containing the service com.sun.star.frame.Controller + +#define CHART_VIEW_SERVICE_IMPLEMENTATION_NAME "com.sun.star.comp.chart2.ChartView" +#define CHART_VIEW_SERVICE_NAME "com.sun.star.chart2.ChartView" + +#define CHART_FRAMELOADER_SERVICE_IMPLEMENTATION_NAME "com.sun.star.comp.chart2.ChartFrameLoader" +#define CHART_FRAMELOADER_SERVICE_NAME "com.sun.star.frame.SynchronousFrameLoader" + +#define CHART_WIZARD_DIALOG_SERVICE_IMPLEMENTATION_NAME "com.sun.star.comp.chart2.WizardDialog" +#define CHART_WIZARD_DIALOG_SERVICE_NAME "com.sun.star.chart2.WizardDialog" + +#define CHART_TYPE_DIALOG_SERVICE_IMPLEMENTATION_NAME "com.sun.star.comp.chart2.ChartTypeDialog" +#define CHART_TYPE_DIALOG_SERVICE_NAME "com.sun.star.chart2.ChartTypeDialog" + +// wrapper for old UNO API (com.sun.star.chart) +#define CHART_CHARTAPIWRAPPER_IMPLEMENTATION_NAME "com.sun.star.comp.chart2.ChartDocumentWrapper" +#define CHART_CHARTAPIWRAPPER_SERVICE_NAME "com.sun.star.chart2.ChartDocumentWrapper" + +// accessibility +#define CHART_ACCESSIBLE_TEXT_SERVICE_NAME "com.sun.star.accessibility.AccessibleTextComponent" + +} //namespace chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/servicenames_charttypes.hxx b/chart2/source/inc/servicenames_charttypes.hxx new file mode 100644 index 000000000..9a1ee83db --- /dev/null +++ b/chart2/source/inc/servicenames_charttypes.hxx @@ -0,0 +1,39 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_SERVICENAMES_CHARTTYPES_HXX +#define INCLUDED_CHART2_SOURCE_INC_SERVICENAMES_CHARTTYPES_HXX + +namespace chart { + +#define CHART2_SERVICE_NAME_CHARTTYPE_AREA "com.sun.star.chart2.AreaChartType" +#define CHART2_SERVICE_NAME_CHARTTYPE_BAR "com.sun.star.chart2.BarChartType" +#define CHART2_SERVICE_NAME_CHARTTYPE_COLUMN "com.sun.star.chart2.ColumnChartType" +#define CHART2_SERVICE_NAME_CHARTTYPE_LINE "com.sun.star.chart2.LineChartType" +#define CHART2_SERVICE_NAME_CHARTTYPE_SCATTER "com.sun.star.chart2.ScatterChartType" +#define CHART2_SERVICE_NAME_CHARTTYPE_PIE "com.sun.star.chart2.PieChartType" +#define CHART2_SERVICE_NAME_CHARTTYPE_NET "com.sun.star.chart2.NetChartType" +#define CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET "com.sun.star.chart2.FilledNetChartType" +#define CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK "com.sun.star.chart2.CandleStickChartType" +#define CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE "com.sun.star.chart2.BubbleChartType" + +} //namespace chart + +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/servicenames_coosystems.hxx b/chart2/source/inc/servicenames_coosystems.hxx new file mode 100644 index 000000000..176486199 --- /dev/null +++ b/chart2/source/inc/servicenames_coosystems.hxx @@ -0,0 +1,31 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_INC_SERVICENAMES_COOSYSTEMS_HXX +#define INCLUDED_CHART2_SOURCE_INC_SERVICENAMES_COOSYSTEMS_HXX + +namespace chart +{ + +#define CHART2_COOSYSTEM_CARTESIAN_VIEW_SERVICE_NAME "com.sun.star.chart2.CoordinateSystems.CartesianView" +#define CHART2_COOSYSTEM_POLAR_VIEW_SERVICE_NAME "com.sun.star.chart2.CoordinateSystems.PolarView" + +} //namespace chart +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |