diff options
Diffstat (limited to 'chart2/source/inc')
108 files changed, 4280 insertions, 2259 deletions
diff --git a/chart2/source/inc/Axis.hxx b/chart2/source/inc/Axis.hxx new file mode 100644 index 000000000000..d42832c0fb7e --- /dev/null +++ b/chart2/source/inc/Axis.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 . + */ +#pragma once + +#include "OPropertySet.hxx" +#include <cppuhelper/implbase.hxx> +#include <comphelper/uno3.hxx> + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/chart2/XAxis.hpp> +#include <com/sun/star/chart2/XTitled.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include "ModifyListenerHelper.hxx" +#include "PropertyHelper.hxx" + +namespace chart +{ +class GridProperties; +class Title; + +namespace impl +{ +typedef ::cppu::WeakImplHelper< + css::chart2::XAxis, + css::chart2::XTitled, + css::lang::XServiceInfo, + css::util::XCloneable, + css::util::XModifyBroadcaster, + css::util::XModifyListener > + Axis_Base; +} + +class Axis final : + public impl::Axis_Base, + public ::property::OPropertySet +{ +public: + explicit Axis(); + virtual ~Axis() 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; + + /// merge XInterface implementations + DECLARE_XINTERFACE() + /// merge XTypeProvider implementations + DECLARE_XTYPEPROVIDER() + +private: + explicit Axis( const Axis & rOther ); + + // late initialization to call after copy-constructing + void Init(); + + // ____ OPropertySet ____ + virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override; + + // ____ OPropertySet ____ + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + +public: + // ____ XPropertySet ____ + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL + getPropertySetInfo() override; + + // ____ XAxis ____ + virtual void SAL_CALL setScaleData( const css::chart2::ScaleData& rScaleData ) override; + virtual css::chart2::ScaleData SAL_CALL getScaleData() override; + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getGridProperties() override; + virtual css::uno::Sequence< css::uno::Reference< css::beans::XPropertySet > > SAL_CALL getSubGridProperties() override; + virtual css::uno::Sequence< css::uno::Reference< css::beans::XPropertySet > > SAL_CALL getSubTickProperties() override; + + // ____ XTitled ____ + virtual css::uno::Reference< css::chart2::XTitle > SAL_CALL getTitleObject() override; + virtual void SAL_CALL setTitleObject( + const css::uno::Reference< css::chart2::XTitle >& Title ) override; + + // ____ XCloneable ____ + // Note: the coordinate systems are not cloned! + 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; + + rtl::Reference< ::chart::Title > getTitleObject2() const; + void setTitleObject( const rtl::Reference< ::chart::Title >& xNewTitle ); + + rtl::Reference< ::chart::GridProperties > getGridProperties2(); + std::vector< rtl::Reference< ::chart::GridProperties > > getSubGridProperties2(); + +private: + // ____ 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; + + // ____ OPropertySet ____ + virtual void firePropertyChangeEvent() override; + using OPropertySet::disposing; + + void fireModifyEvent(); + + void AllocateSubGrids(); + + rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder; + + css::chart2::ScaleData m_aScaleData; + + rtl::Reference< ::chart::GridProperties > m_xGrid; + + std::vector< rtl::Reference< ::chart::GridProperties > > m_aSubGridProperties; + + rtl::Reference< ::chart::Title > m_xTitle; +}; + +const ::chart::tPropertyValueMap & StaticAxisDefaults(); + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/AxisHelper.hxx b/chart2/source/inc/AxisHelper.hxx index 2097d216bc60..eff1bb4e28c4 100644 --- a/chart2/source/inc/AxisHelper.hxx +++ b/chart2/source/inc/AxisHelper.hxx @@ -16,30 +16,29 @@ * 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 +#pragma once -#include "charttoolsdllapi.hxx" +#include <config_options.h> #include <com/sun/star/chart2/ScaleData.hpp> +#include <rtl/ref.hxx> +#include "GridProperties.hxx" #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 Axis; +class BaseCoordinateSystem; +class ChartType; +class Diagram; -class OOO_DLLPUBLIC_CHARTTOOLS AxisHelper +class AxisHelper { public: static css::uno::Reference< css::chart2::XScaling > createLinearScaling(); @@ -52,157 +51,155 @@ public: 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 css::chart2::ScaleData getDateCheckedScale( const rtl::Reference< ::chart::Axis >& 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 + const rtl::Reference< ::chart::Axis >& xAxis + , const rtl::Reference< ::chart::BaseCoordinateSystem >& xCorrespondingCoordinateSystem + , const rtl::Reference< ::chart::ChartModel>& xChartDoc , bool bSearchForParallelAxisIfNothingIsFound ); - static css::uno::Reference< - css::chart2::XAxis > + static rtl::Reference< ::chart::Axis > createAxis( sal_Int32 nDimensionIndex, bool bMainAxis - , const css::uno::Reference< css::chart2::XDiagram >& xDiagram + , const rtl::Reference< ::chart::Diagram >& xDiagram , const css::uno::Reference< css::uno::XComponentContext >& xContext , ReferenceSizeProvider * pRefSizeProvider = nullptr ); - static css::uno::Reference< css::chart2::XAxis > + static rtl::Reference< ::chart::Axis > createAxis( sal_Int32 nDimensionIndex , sal_Int32 nAxisIndex // 0==main or 1==secondary axis - , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys + , const rtl::Reference< ::chart::BaseCoordinateSystem >& 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 rtl::Reference< ::chart::Diagram >& 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 ); + , const rtl::Reference< ::chart::Diagram >& xDiagram ); static void hideAxis( sal_Int32 nDimensionIndex, bool bMainAxis - , const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + , const rtl::Reference< ::chart::Diagram >& xDiagram ); static void hideGrid( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid - , const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + , const rtl::Reference< ::chart::Diagram >& xDiagram ); static bool isAxisShown( sal_Int32 nDimensionIndex, bool bMainAxis - , const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + , const rtl::Reference< ::chart::Diagram >& xDiagram ); static bool isGridShown( sal_Int32 nDimensionIndex, sal_Int32 nCooSysIndex, bool bMainGrid - , const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + , const rtl::Reference< ::chart::Diagram >& 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 makeAxisVisible( const rtl::Reference< ::chart::Axis >& xAxis ); + static void makeGridVisible( const rtl::Reference< ::chart::GridProperties >& 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 makeAxisInvisible( const rtl::Reference< ::chart::Axis >& xAxis ); + static void makeGridInvisible( const rtl::Reference< ::chart::GridProperties >& xGridProperties ); - static void hideAxisIfNoDataIsAttached( const css::uno::Reference< css::chart2::XAxis >& xAxis - , const css::uno::Reference< css::chart2::XDiagram >& xDiagram); + static void hideAxisIfNoDataIsAttached( const rtl::Reference< ::chart::Axis >& xAxis + , const rtl::Reference< ::chart::Diagram >& 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 bool areAxisLabelsVisible( const rtl::Reference< ::chart::Axis >& xAxisProperties ); + static bool isAxisVisible( const rtl::Reference< ::chart::Axis >& xAxis ); + static bool isGridVisible( const rtl::Reference< ::chart::GridProperties >& xGridProperties ); - static css::uno::Reference< css::chart2::XCoordinateSystem > + static rtl::Reference< ::chart::BaseCoordinateSystem > getCoordinateSystemByIndex( - const css::uno::Reference< css::chart2::XDiagram >& xDiagram + const rtl::Reference< ::chart::Diagram >& xDiagram , sal_Int32 nIndex ); - static css::uno::Reference< css::chart2::XCoordinateSystem > + static rtl::Reference< ::chart::BaseCoordinateSystem > getCoordinateSystemOfAxis( - const css::uno::Reference< css::chart2::XAxis >& xAxis - , const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + const rtl::Reference< ::chart::Axis >& xAxis + , const rtl::Reference< ::chart::Diagram >& xDiagram ); - static css::uno::Reference< css::chart2::XAxis > + static rtl::Reference< ::chart::Axis > getAxis( sal_Int32 nDimensionIndex, bool bMainAxis - , const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); - static css::uno::Reference< css::chart2::XAxis > + , const rtl::Reference< ::chart::Diagram >& xDiagram ); + static rtl::Reference< ::chart::Axis > getAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex - , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys ); + , const rtl::Reference< ::chart::BaseCoordinateSystem >& 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 rtl::Reference< ::chart::Axis > + getCrossingMainAxis( const rtl::Reference< ::chart::Axis >& xAxis + , const rtl::Reference< ::chart::BaseCoordinateSystem >& 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 rtl::Reference< ::chart::Axis > + getParallelAxis( const rtl::Reference< ::chart::Axis >& xAxis + , const rtl::Reference< ::chart::Diagram >& xDiagram ); - static css::uno::Reference< css::beans::XPropertySet > - getGridProperties( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys + static rtl::Reference< ::chart::GridProperties > + getGridProperties( const rtl::Reference< ::chart::BaseCoordinateSystem >& 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 ); + const rtl::Reference< ::chart::Axis >& xAxis + , const rtl::Reference< ::chart::Diagram >& xDiagram ); static bool getIndicesForAxis( - const css::uno::Reference< css::chart2::XAxis >& xAxis - , const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys + const rtl::Reference< ::chart::Axis >& xAxis + , const rtl::Reference< ::chart::BaseCoordinateSystem >& 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 + const rtl::Reference< ::chart::Axis >& xAxis + , const rtl::Reference< ::chart::Diagram >& 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 + static std::vector< rtl::Reference< ::chart::Axis > > + getAllAxesOfDiagram( const rtl::Reference< ::chart::Diagram >& 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 + static std::vector< rtl::Reference< ::chart::Axis > > + getAllAxesOfCoordinateSystem( const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys , bool bOnlyVisible = false ); - static css::uno::Sequence< css::uno::Reference< css::beans::XPropertySet > > - getAllGrids( const css::uno::Reference< css::chart2::XDiagram >& xDiagram ); + static std::vector< rtl::Reference< ::chart::GridProperties > > + getAllGrids( const rtl::Reference< ::chart::Diagram >& xDiagram ); static void getAxisOrGridPossibilities( css::uno::Sequence< sal_Bool >& rPossibilityList - , const css::uno::Reference< css::chart2::XDiagram>& xDiagram, bool bAxis=true ); + , const rtl::Reference< ::chart::Diagram>& 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 void getAxisOrGridExistence( css::uno::Sequence< sal_Bool >& rExistenceList + , const rtl::Reference< ::chart::Diagram>& xDiagram, bool bAxis=true ); - static bool changeVisibilityOfGrids( const css::uno::Reference< css::chart2::XDiagram>& xDiagram + static bool changeVisibilityOfGrids( const rtl::Reference< ::chart::Diagram>& 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 + static bool changeVisibilityOfAxes( const rtl::Reference< ::chart::Diagram>& 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 bool shouldAxisBeDisplayed( const rtl::Reference< ::chart::Axis >& xAxis + , const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys ); + static bool isSecondaryYAxisNeeded( const rtl::Reference< + ::chart::BaseCoordinateSystem >& xCooSys ); - static css::uno::Reference< css::chart2::XChartType > - getChartTypeByIndex( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys, + static rtl::Reference< ::chart::ChartType > + getChartTypeByIndex( const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys, sal_Int32 nIndex ); - static void setRTLAxisLayout( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSys ); + static void setRTLAxisLayout( const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys ); - static css::uno::Reference< css::chart2::XChartType > - getFirstChartTypeWithSeriesAttachedToAxisIndex( const css::uno::Reference< css::chart2::XDiagram >& xDiagram, const sal_Int32 nAttachedAxisIndex ); + static rtl::Reference< ::chart::ChartType > + getFirstChartTypeWithSeriesAttachedToAxisIndex( const rtl::Reference< ::chart::Diagram >& 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 index 779f8fc7ff96..5e6d32d691b5 100644 --- a/chart2/source/inc/AxisIndexDefines.hxx +++ b/chart2/source/inc/AxisIndexDefines.hxx @@ -16,8 +16,7 @@ * 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 +#pragma once #include <sal/types.h> @@ -28,6 +27,4 @@ const sal_Int32 SECONDARY_AXIS_INDEX = 1; } // namespace chart -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/charttoolsdllapi.hxx b/chart2/source/inc/BaseColorScheme.hxx index 3a5b8144b770..e916711be357 100644 --- a/chart2/source/inc/charttoolsdllapi.hxx +++ b/chart2/source/inc/BaseColorScheme.hxx @@ -16,20 +16,29 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#pragma once -#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTTOOLSDLLAPI_HXX -#define INCLUDED_CHART2_SOURCE_INC_CHARTTOOLSDLLAPI_HXX +#include <cppuhelper/implbase.hxx> +#include <com/sun/star/chart2/XColorScheme.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> -#include <sal/config.h> +namespace chart +{ +class BaseColorScheme + : public ::cppu::WeakImplHelper<css::chart2::XColorScheme, css::lang::XServiceInfo> +{ +public: + explicit BaseColorScheme(); -#include <sal/types.h> + /// declare XServiceInfo methods + sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; -#if defined OOO_DLLIMPLEMENTATION_CHARTTOOLS -#define OOO_DLLPUBLIC_CHARTTOOLS SAL_DLLPUBLIC_EXPORT -#else -#define OOO_DLLPUBLIC_CHARTTOOLS SAL_DLLPUBLIC_IMPORT -#endif - -#endif +protected: + // member variables + mutable css::uno::Sequence<sal_Int64> m_aColorSequence; + mutable sal_Int32 m_nNumberOfColors; +}; +} // namespace chart /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/BaseCoordinateSystem.hxx b/chart2/source/inc/BaseCoordinateSystem.hxx new file mode 100644 index 000000000000..e9e6f095c541 --- /dev/null +++ b/chart2/source/inc/BaseCoordinateSystem.hxx @@ -0,0 +1,135 @@ +/* -*- 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 . + */ +#pragma once + +#include "OPropertySet.hxx" +#include <cppuhelper/implbase.hxx> +#include <comphelper/uno3.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/chart2/XCoordinateSystem.hpp> +#include <com/sun/star/chart2/XChartTypeContainer.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include "ModifyListenerHelper.hxx" + +#include <vector> + +namespace chart +{ +class Axis; +class ChartType; +class ExplicitCategoriesProvider; +class ChartModel; + +namespace impl +{ +typedef ::cppu::WeakImplHelper + < css::lang::XServiceInfo, + css::chart2::XCoordinateSystem, + css::chart2::XChartTypeContainer, + css::util::XCloneable, + css::util::XModifyBroadcaster, + css::util::XModifyListener > + BaseCoordinateSystem_Base; +} + +class SAL_DLLPUBLIC_RTTI BaseCoordinateSystem : + public impl::BaseCoordinateSystem_Base, + public ::property::OPropertySet +{ +public: + BaseCoordinateSystem( sal_Int32 nDimensionCount ); + explicit BaseCoordinateSystem( const BaseCoordinateSystem & rSource ); + virtual ~BaseCoordinateSystem() override; + + // ____ OPropertySet ____ + virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override; + + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + // ____ XPropertySet ____ + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL + getPropertySetInfo() override; + + /// merge XInterface implementations + DECLARE_XINTERFACE() + /// merge XTypeProvider implementations + DECLARE_XTYPEPROVIDER() + + // ____ XCoordinateSystem ____ + virtual ::sal_Int32 SAL_CALL getDimension() override; + virtual void SAL_CALL setAxisByDimension( + ::sal_Int32 nDimension, + const css::uno::Reference< css::chart2::XAxis >& xAxis, + ::sal_Int32 nIndex ) override; + virtual css::uno::Reference< css::chart2::XAxis > SAL_CALL getAxisByDimension( + ::sal_Int32 nDimension, ::sal_Int32 nIndex ) override; + virtual ::sal_Int32 SAL_CALL getMaximumAxisIndexByDimension( ::sal_Int32 nDimension ) override; + + // ____ XChartTypeContainer ____ + virtual void SAL_CALL addChartType( + const css::uno::Reference< css::chart2::XChartType >& aChartType ) override; + virtual void SAL_CALL removeChartType( + const css::uno::Reference< css::chart2::XChartType >& aChartType ) override; + virtual css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > > SAL_CALL getChartTypes() override; + virtual void SAL_CALL setChartTypes( + const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > >& aChartTypes ) final 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; + + void setAxisByDimension( sal_Int32 nDimension, const rtl::Reference< ::chart::Axis >& xAxis, sal_Int32 nIndex ); + const rtl::Reference< ::chart::Axis > & getAxisByDimension2(sal_Int32 nDimension, sal_Int32 nIndex ) const; + + void setChartTypes( const std::vector< rtl::Reference< ::chart::ChartType > >& aChartTypes ); + const std::vector< rtl::Reference<::chart::ChartType > > & getChartTypes2() const { return m_aChartTypes; } + + ExplicitCategoriesProvider& getExplicitCategoriesProvider(ChartModel& rModel); + +protected: + + // ____ 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; + + // ____ OPropertySet ____ + virtual void firePropertyChangeEvent() override; + using OPropertySet::disposing; + + void fireModifyEvent(); + +private: + rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder; + sal_Int32 m_nDimensionCount; + typedef std::vector< std::vector< rtl::Reference< ::chart::Axis > > > tAxisVecVecType; + tAxisVecVecType m_aAllAxis; //outer sequence is the dimension; inner sequence is the axis index that indicates main or secondary axis + std::vector< rtl::Reference<::chart::ChartType > > m_aChartTypes; + // cache this here so we can share it across different parts of the code, it is expensive to create + std::unique_ptr<ExplicitCategoriesProvider> mxExplicitCategoriesProvider; +}; + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/BaseGFXHelper.hxx b/chart2/source/inc/BaseGFXHelper.hxx index 014371bfa20e..54f26896339a 100644 --- a/chart2/source/inc/BaseGFXHelper.hxx +++ b/chart2/source/inc/BaseGFXHelper.hxx @@ -16,9 +16,9 @@ * 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 +#pragma once +#include <config_options.h> #include <basegfx/matrix/b3dhommatrix.hxx> #include <basegfx/range/b2irectangle.hxx> #include <basegfx/tuple/b3dtuple.hxx> @@ -29,30 +29,31 @@ #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 +namespace chart::BaseGFXHelper { -OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DRange getBoundVolume( const css::drawing::PolyPolygonShape3D& rPolyPoly ); +::basegfx::B3DRange getBoundVolume( const css::drawing::PolyPolygonShape3D& rPolyPoly ); + +::basegfx::B3DRange getBoundVolume( const std::vector<std::vector<css::drawing::Position3D>>& rPolyPoly ); -OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B2IRectangle makeRectangle( +::basegfx::B2IRectangle makeRectangle( const css::awt::Point& rPosition, const css::awt::Size& rSize ); -OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B2IRectangle makeRectangle( const css::awt::Rectangle& rRect ); +::basegfx::B2IRectangle makeRectangle( const css::awt::Rectangle& rRect ); -OOO_DLLPUBLIC_CHARTTOOLS css::awt::Point B2IRectangleToAWTPoint( +css::awt::Point B2IRectangleToAWTPoint( const ::basegfx::B2IRectangle& rB2IRectangle ); -OOO_DLLPUBLIC_CHARTTOOLS css::awt::Size B2IRectangleToAWTSize( +css::awt::Size B2IRectangleToAWTSize( const ::basegfx::B2IRectangle& rB2IRectangle ); +css::awt::Rectangle toAwtRectangle(const basegfx::B2IRectangle& rB2IRectangle); + ::basegfx::B3DVector Direction3DToB3DVector( const css::drawing::Direction3D& rDirection ); @@ -65,25 +66,20 @@ css::drawing::Direction3D B3DVectorToDirection3D( css::drawing::Position3D B3DVectorToPosition3D( const ::basegfx::B3DVector& rB3DVector ); -OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DHomMatrix HomogenMatrixToB3DHomMatrix( +::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( +::basegfx::B3DTuple GetRotationFromMatrix( const ::basegfx::B3DHomMatrix & rB3DMatrix ); -OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DTuple GetScaleFromMatrix( +::basegfx::B3DTuple GetScaleFromMatrix( const ::basegfx::B3DHomMatrix & rB3DMatrix ); void ReduceToRotationMatrix( ::basegfx::B3DHomMatrix & rB3DMatrix ); -} // namespace BaseGFXHelper -} // namespace chart - -// INCLUDED_CHART2_SOURCE_INC_BASEGFXHELPER_HXX -#endif +} // namespace chart::BaseGFXHelper /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/CachedDataSequence.hxx b/chart2/source/inc/CachedDataSequence.hxx index 90acd6dbfa63..513907c2429d 100644 --- a/chart2/source/inc/CachedDataSequence.hxx +++ b/chart2/source/inc/CachedDataSequence.hxx @@ -16,14 +16,12 @@ * 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 +#pragma once // helper classes -#include <cppuhelper/compbase.hxx> +#include <comphelper/compbase.hxx> #include <comphelper/uno3.hxx> -#include <comphelper/broadcasthelper.hxx> -#include <comphelper/propertycontainer.hxx> +#include <comphelper/propertycontainer2.hxx> #include <comphelper/proparrhlp.hxx> // interfaces and types @@ -33,7 +31,7 @@ #include <com/sun/star/chart2/data/XNumericalDataSequence.hpp> #include <com/sun/star/chart2/data/XTextualDataSequence.hpp> #include <com/sun/star/util/XCloneable.hpp> -#include <com/sun/star/util/XModifyBroadcaster.hpp> +#include "ModifyListenerHelper.hxx" namespace com::sun::star::uno { class XComponentContext; } @@ -42,7 +40,7 @@ namespace chart namespace impl { -typedef ::cppu::WeakComponentImplHelper< +typedef ::comphelper::WeakComponentImplHelper< css::chart2::data::XDataSequence, css::chart2::data::XNumericalDataSequence, css::chart2::data::XTextualDataSequence, @@ -57,8 +55,7 @@ typedef ::cppu::WeakComponentImplHelper< * This sequence object does store actual values within, hence "cached". */ class CachedDataSequence final : - public ::comphelper::OMutexAndBroadcastHelper, - public ::comphelper::OPropertyContainer, + public ::comphelper::OPropertyContainer2, public ::comphelper::OPropertyArrayUsageHelper< CachedDataSequence >, public impl::CachedDataSequence_Base { @@ -94,7 +91,7 @@ private: /// @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; + virtual ::cppu::IPropertyArrayHelper& getInfoHelper() override; /// @see ::comphelper::OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; @@ -157,12 +154,9 @@ private: 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; + rtl::Reference<ModifyEventForwarder> 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 index ca39d92b873d..dcb2aadbb974 100644 --- a/chart2/source/inc/ChangingResource.hxx +++ b/chart2/source/inc/ChangingResource.hxx @@ -17,12 +17,10 @@ * 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 +#pragma once namespace chart { -class ChangingResource; class ResourceChangeListener { public: @@ -43,6 +41,5 @@ protected: }; } //namespace chart -#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/CharacterProperties.hxx b/chart2/source/inc/CharacterProperties.hxx index 7385bfe12020..be3f1f989165 100644 --- a/chart2/source/inc/CharacterProperties.hxx +++ b/chart2/source/inc/CharacterProperties.hxx @@ -16,12 +16,10 @@ * 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 +#pragma once #include "PropertyHelper.hxx" #include "FastPropertyIdRanges.hxx" -#include "charttoolsdllapi.hxx" #include <com/sun/star/awt/FontDescriptor.hpp> #include <vector> @@ -121,20 +119,17 @@ namespace CharacterProperties FAST_PROPERTY_ID_END_CHAR_PROP }; - OOO_DLLPUBLIC_CHARTTOOLS void AddPropertiesToVector( + void AddPropertiesToVector( std::vector< css::beans::Property > & rOutProperties ); - OOO_DLLPUBLIC_CHARTTOOLS void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ); + void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ); - OOO_DLLPUBLIC_CHARTTOOLS bool IsCharacterPropertyHandle( sal_Int32 nHandle ); + bool IsCharacterPropertyHandle( sal_Int32 nHandle ); - OOO_DLLPUBLIC_CHARTTOOLS css::awt::FontDescriptor createFontDescriptorFromPropertySet( + 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/ChartColorPaletteHelper.hxx b/chart2/source/inc/ChartColorPaletteHelper.hxx new file mode 100644 index 000000000000..a580f6744a07 --- /dev/null +++ b/chart2/source/inc/ChartColorPaletteHelper.hxx @@ -0,0 +1,47 @@ +/* -*- 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/. + */ + +#pragma once + +#include <svx/svxdllapi.h> +#include <svx/ChartColorPaletteType.hxx> +#include <docmodel/theme/Theme.hxx> +#include <tools/gen.hxx> + +#include <array> + +class OutputDevice; + +namespace chart +{ +class ChartColorPaletteHelper +{ +public: + static constexpr size_t ColorfulPaletteSize = 4; + static constexpr size_t MonotonicPaletteSize = 6; + + explicit ChartColorPaletteHelper(const std::shared_ptr<model::Theme>& pTheme); + + ChartColorPalette getColorPalette(ChartColorPaletteType eType, sal_uInt32 nIndex) const; + static void renderColorPalette(OutputDevice* pDev, const tools::Rectangle& rDrawArea, + const ChartColorPalette& rColorSet, + bool bDrawItemBorder = false); + static void renderNoPalette(OutputDevice* pDev, const tools::Rectangle& rDrawArea); + +private: + void createBasePaletteFromTheme(const std::shared_ptr<model::Theme>& pTheme); + ChartColorPalette createColorfulPalette(sal_uInt32 nIndex) const; + ChartColorPalette createColorfulPaletteImpl(size_t nIdx1, size_t nIdx2, size_t nIdx3) const; + ChartColorPalette createMonotonicPalette(sal_uInt32 nIndex) const; + + ChartColorPalette mBasePalette; +}; +} // end namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ChartColorPalettes.hxx b/chart2/source/inc/ChartColorPalettes.hxx new file mode 100644 index 000000000000..78e12c396c6f --- /dev/null +++ b/chart2/source/inc/ChartColorPalettes.hxx @@ -0,0 +1,36 @@ +/* -*- 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/. + */ + +#pragma once + +#include <svx/ChartColorPaletteType.hxx> +#include <svtools/valueset.hxx> + +namespace chart +{ +class ChartColorPalettes final : public ValueSet +{ + std::vector<ChartColorPalette> maColorSets; + +public: + ChartColorPalettes() + : ValueSet(nullptr) + { + } + + void SetDrawingArea(weld::DrawingArea* pDrawingArea) override; + void UserDraw(const UserDrawEvent& rUserDrawEvent) override; + void StyleUpdated() override; + + void insert(ChartColorPalette const& rColorSet); + const ChartColorPalette* getPalette(sal_uInt32 nItem) const; +}; +} // end namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/MutexContainer.hxx b/chart2/source/inc/ChartColorScheme.hxx index bab6b6c3fb1a..f330d31ababc 100644 --- a/chart2/source/inc/MutexContainer.hxx +++ b/chart2/source/inc/ChartColorScheme.hxx @@ -16,26 +16,25 @@ * 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 +#pragma once -#include <osl/mutex.hxx> +#include "BaseColorScheme.hxx" +#include <svx/ChartColorPaletteType.hxx> namespace chart { -class MutexContainer +class ChartColorScheme final : public BaseColorScheme { -protected: - MutexContainer() = default; +public: + explicit ChartColorScheme(const ChartColorPalette& rPalette); - ~MutexContainer() = default; + /// declare XServiceInfo methods + OUString SAL_CALL getImplementationName() override; - mutable ::osl::Mutex m_aMutex; +protected: + // ____ XColorScheme ____ + ::sal_Int32 SAL_CALL getColorByIndex(::sal_Int32 nIndex) override; }; - -} // namespace chart - -// INCLUDED_CHART2_SOURCE_INC_MUTEXCONTAINER_HXX -#endif +} // namespace chart /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ChartModelHelper.hxx b/chart2/source/inc/ChartModelHelper.hxx deleted file mode 100644 index 0a8192706ef0..000000000000 --- a/chart2/source/inc/ChartModelHelper.hxx +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- 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 index 755e7af15345..e54585488971 100644 --- a/chart2/source/inc/ChartResourceGroupDlgs.hxx +++ b/chart2/source/inc/ChartResourceGroupDlgs.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CHART2_SOURCE_CHARTRESOURCEGROUPDLGS_HXX -#define INCLUDED_CHART2_SOURCE_CHARTRESOURCEGROUPDLGS_HXX +#pragma once #include <vcl/weld.hxx> @@ -26,7 +25,7 @@ namespace chart { class ChartTypeParameter; -class SplinePropertiesDialog : public weld::GenericDialogController +class SplinePropertiesDialog final : public weld::GenericDialogController { public: explicit SplinePropertiesDialog(weld::Window* pParent); @@ -44,7 +43,7 @@ private: std::unique_ptr<weld::SpinButton> m_xMF_SplineOrder; }; -class SteppedPropertiesDialog : public weld::GenericDialogController +class SteppedPropertiesDialog final : public weld::GenericDialogController { public: explicit SteppedPropertiesDialog(weld::Window* pParent); @@ -60,6 +59,5 @@ private: }; } //namespace chart -#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ChartResourceGroups.hxx b/chart2/source/inc/ChartResourceGroups.hxx index f3b3e2f4b2c5..9b6d5ee267f7 100644 --- a/chart2/source/inc/ChartResourceGroups.hxx +++ b/chart2/source/inc/ChartResourceGroups.hxx @@ -17,8 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#ifndef INCLUDED_CHART2_SOURCE_CHARTRESOURCEGROUPS_HXX -#define INCLUDED_CHART2_SOURCE_CHARTRESOURCEGROUPS_HXX +#pragma once #include "res_BarGeometry.hxx" #include "ChangingResource.hxx" @@ -28,7 +27,6 @@ namespace chart { using namespace ::com::sun::star; -using namespace ::com::sun::star::chart2; class SplinePropertiesDialog; class SteppedPropertiesDialog; @@ -39,7 +37,7 @@ enum POS_3DSCHEME_REALISTIC = 1 }; -class Dim3DLookResourceGroup : public ChangingResource +class Dim3DLookResourceGroup final : public ChangingResource { public: explicit Dim3DLookResourceGroup(weld::Builder* pBuilder); @@ -50,7 +48,7 @@ public: void fillParameter(ChartTypeParameter& rParameter); private: - DECL_LINK(Dim3DLookCheckHdl, weld::ToggleButton&, void); + DECL_LINK(Dim3DLookCheckHdl, weld::Toggleable&, void); DECL_LINK(SelectSchemeHdl, weld::ComboBox&, void); private: @@ -58,7 +56,7 @@ private: std::unique_ptr<weld::ComboBox> m_xLB_Scheme; }; -class SortByXValuesResourceGroup : public ChangingResource +class SortByXValuesResourceGroup final : public ChangingResource { public: explicit SortByXValuesResourceGroup(weld::Builder* pBuilder); @@ -69,13 +67,13 @@ public: void fillParameter(ChartTypeParameter& rParameter); private: - DECL_LINK(SortByXValuesCheckHdl, weld::ToggleButton&, void); + DECL_LINK(SortByXValuesCheckHdl, weld::Toggleable&, void); private: std::unique_ptr<weld::CheckButton> m_xCB_XValueSorting; }; -class StackingResourceGroup : public ChangingResource +class StackingResourceGroup final : public ChangingResource { public: explicit StackingResourceGroup(weld::Builder* pBuilder); @@ -86,8 +84,8 @@ public: void fillParameter(ChartTypeParameter& rParameter); private: - DECL_LINK(StackingChangeHdl, weld::ToggleButton&, void); - DECL_LINK(StackingEnableHdl, weld::ToggleButton&, void); + DECL_LINK(StackingChangeHdl, weld::Toggleable&, void); + DECL_LINK(StackingEnableHdl, weld::Toggleable&, void); private: std::unique_ptr<weld::CheckButton> m_xCB_Stacked; @@ -100,7 +98,7 @@ private: #define POS_LINETYPE_SMOOTH 1 #define POS_LINETYPE_STEPPED 2 -class SplineResourceGroup : public ChangingResource +class SplineResourceGroup final : public ChangingResource { public: explicit SplineResourceGroup(weld::Builder* pBuilder, weld::Window* pParent); @@ -114,19 +112,19 @@ private: DECL_LINK(LineTypeChangeHdl, weld::ComboBox&, void); DECL_LINK(SplineDetailsDialogHdl, weld::Button&, void); DECL_LINK(SteppedDetailsDialogHdl, weld::Button&, void); - SplinePropertiesDialog& getSplinePropertiesDialog(); - SteppedPropertiesDialog& getSteppedPropertiesDialog(); + const std::shared_ptr<SplinePropertiesDialog>& getSplinePropertiesDialog(); + const std::shared_ptr<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; + std::shared_ptr<SplinePropertiesDialog> m_xSplinePropertiesDialog; + std::shared_ptr<SteppedPropertiesDialog> m_xSteppedPropertiesDialog; }; -class GeometryResourceGroup : public ChangingResource +class GeometryResourceGroup final : public ChangingResource { public: explicit GeometryResourceGroup(weld::Builder* pBuilder); @@ -144,6 +142,5 @@ private: }; } //namespace chart -#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ChartType.hxx b/chart2/source/inc/ChartType.hxx new file mode 100644 index 000000000000..2ae78395e30e --- /dev/null +++ b/chart2/source/inc/ChartType.hxx @@ -0,0 +1,189 @@ +/* -*- 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 . + */ +#pragma once + +#include "OPropertySet.hxx" +#include <cppuhelper/implbase.hxx> +#include <comphelper/uno3.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/chart2/XChartType.hpp> +#include <com/sun/star/chart2/XDataSeriesContainer.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/util/XModifyBroadcaster.hpp> +#include <com/sun/star/util/XModifyListener.hpp> +#include <rtl/ref.hxx> + +#include <vector> + +namespace chart +{ +class BaseCoordinateSystem; +class DataSeries; +class ModifyEventForwarder; + +enum +{ + PROP_PIECHARTTYPE_USE_RINGS, + PROP_PIECHARTTYPE_3DRELATIVEHEIGHT, + PROP_PIECHARTTYPE_SUBTYPE, // none, of-bar, of-pie + PROP_PIECHARTTYPE_SPLIT_POS +}; + + + +namespace impl +{ +typedef ::cppu::WeakImplHelper< + css::lang::XServiceInfo, + css::chart2::XChartType, + css::chart2::XDataSeriesContainer, + css::util::XCloneable, + css::util::XModifyBroadcaster, + css::util::XModifyListener > + ChartType_Base; +} + +class ChartType : + public impl::ChartType_Base, + public ::property::OPropertySet +{ +public: + explicit ChartType(); + virtual ~ChartType() override; + + /// merge XInterface implementations + DECLARE_XINTERFACE() + + explicit ChartType( const ChartType & rOther ); + + // ____ XChartType ____ + // still abstract ! implement ! + virtual OUString SAL_CALL getChartType() override = 0; + virtual css::uno::Reference< css::chart2::XCoordinateSystem > SAL_CALL + createCoordinateSystem( ::sal_Int32 DimensionCount ) final override; + virtual css::uno::Sequence< OUString > SAL_CALL + getSupportedMandatoryRoles() override; + virtual css::uno::Sequence< OUString > SAL_CALL + getSupportedOptionalRoles() override; + virtual OUString SAL_CALL getRoleOfSequenceForSeriesLabel() override; + virtual css::uno::Sequence< OUString > SAL_CALL + getSupportedPropertyRoles() override; + + // ____ XDataSeriesContainer ____ + virtual void SAL_CALL addDataSeries( + const css::uno::Reference< css::chart2::XDataSeries >& aDataSeries ) override; + virtual void SAL_CALL removeDataSeries( + const css::uno::Reference< css::chart2::XDataSeries >& aDataSeries ) override; + virtual css::uno::Sequence< css::uno::Reference< css::chart2::XDataSeries > > SAL_CALL getDataSeries() override; + virtual void SAL_CALL setDataSeries( + const css::uno::Sequence< css::uno::Reference< css::chart2::XDataSeries > >& aDataSeries ) 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; + + virtual rtl::Reference<ChartType> cloneChartType() const = 0; + + void addDataSeries( + const rtl::Reference< ::chart::DataSeries >& aDataSeries ); + void removeDataSeries( + const rtl::Reference< ::chart::DataSeries >& aDataSeries ); + void setDataSeries( + const std::vector< rtl::Reference< ::chart::DataSeries > >& aDataSeries ); + + const std::vector<rtl::Reference<::chart::DataSeries>>& getDataSeries2() const; + + virtual rtl::Reference< ::chart::BaseCoordinateSystem > + createCoordinateSystem2( sal_Int32 DimensionCount ); + + virtual void createCalculatedDataSeries(); + + void deleteSeries( const rtl::Reference< ::chart::DataSeries > & xSeries ); + + // Tools + bool isSupportingMainAxis(sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex); + bool isSupportingStatisticProperties(sal_Int32 nDimensionCount); + bool isSupportingRegressionProperties(sal_Int32 nDimensionCount); + bool isSupportingGeometryProperties(sal_Int32 nDimensionCount); + bool isSupportingAreaProperties(sal_Int32 nDimensionCount); + bool isSupportingSymbolProperties(sal_Int32 nDimensionCount); + bool isSupportingSecondaryAxis(sal_Int32 nDimensionCount); + bool isSupportingRightAngledAxes(); + bool isSupportingOverlapAndGapWidthProperties(sal_Int32 nDimensionCount); + bool isSupportingBarConnectors(sal_Int32 nDimensionCount); + bool isSupportingAxisSideBySide(sal_Int32 nDimensionCount); + bool isSupportingBaseValue(); + bool isSupportingAxisPositioning(sal_Int32 nDimensionCount, sal_Int32 nDimensionIndex); + bool isSupportingStartingAngle(); + bool isSupportingDateAxis(sal_Int32 nDimensionIndex); + bool isSupportingComplexCategory(); + bool isSupportingCategoryPositioning(sal_Int32 nDimensionIndex); + bool isSupportingOnlyDeepStackingFor3D(); + bool isSeriesInFrontOfAxisLine(); + + sal_Int32 getAxisType(sal_Int32 nDimensionIndex); + +protected: + + // ____ 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; + + void fireModifyEvent(); + + // ____ OPropertySet ____ + virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override; + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + virtual void firePropertyChangeEvent() override; + using OPropertySet::disposing; + + // ____ XPropertySet ____ + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL + getPropertySetInfo() override; + + /// merge XTypeProvider implementations + DECLARE_XTYPEPROVIDER() + +protected: + rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder; + +private: + void impl_addDataSeriesWithoutNotification( + const rtl::Reference< ::chart::DataSeries >& aDataSeries ); + +protected: + typedef std::vector<rtl::Reference<::chart::DataSeries>> tDataSeriesContainerType; + + // --- mutable members: the following members need mutex guard --- + + tDataSeriesContainerType m_aDataSeries; + + bool m_bNotifyChanges; +}; + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ChartTypeDialogController.hxx b/chart2/source/inc/ChartTypeDialogController.hxx index f65ce90a5008..d052f0d76e1c 100644 --- a/chart2/source/inc/ChartTypeDialogController.hxx +++ b/chart2/source/inc/ChartTypeDialogController.hxx @@ -17,8 +17,7 @@ * 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 +#pragma once #include <sal/config.h> @@ -30,63 +29,19 @@ #include <com/sun/star/chart2/CurveStyle.hpp> #include <vcl/weld.hxx> -namespace com -{ -namespace sun -{ -namespace star -{ -namespace beans +namespace com::sun::star::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 { +class ChartModel; +class ChartTypeTemplate; +class ChartTypeManager; + enum GlobalStackMode { GlobalStackMode_NONE, @@ -151,7 +106,7 @@ public: virtual void showExtraControls(weld::Builder* pBuilder); virtual void hideExtraControls() const; virtual void - fillExtraControls(const css::uno::Reference<css::chart2::XChartDocument>& xChartModel, + fillExtraControls(const rtl::Reference<::chart::ChartModel>& xChartModel, const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps) const; /// @throws css::uno::RuntimeException virtual void setTemplateProperties( @@ -167,11 +122,13 @@ public: 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; + void + commitToModel(const ChartTypeParameter& rParameter, + const rtl::Reference<::chart::ChartModel>& xChartModel, + const css::uno::Reference<com::sun::star::beans::XPropertySet>& xTemplateProps); + rtl::Reference<::chart::ChartTypeTemplate> + getCurrentTemplate(const ChartTypeParameter& rParameter, + const rtl::Reference<::chart::ChartTypeManager>& xTemplateManager) const; protected: bool bSupportsXAxisWithValues; @@ -190,7 +147,7 @@ public: virtual void adjustSubTypeAndEnableControls(ChartTypeParameter& rParameter) override; }; -class ColumnChartDialogController : public ColumnOrBarChartDialogController_Base +class ColumnChartDialogController final : public ColumnOrBarChartDialogController_Base { public: ColumnChartDialogController(); @@ -203,7 +160,7 @@ public: const ChartTypeParameter& rParameter) override; }; -class BarChartDialogController : public ColumnOrBarChartDialogController_Base +class BarChartDialogController final : public ColumnOrBarChartDialogController_Base { public: BarChartDialogController(); @@ -216,7 +173,21 @@ public: const ChartTypeParameter& rParameter) override; }; -class PieChartDialogController : public ChartTypeDialogController +class HistogramChartDialogController final : public ChartTypeDialogController +{ +public: + HistogramChartDialogController(); + virtual ~HistogramChartDialogController() 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 PieChartDialogController final : public ChartTypeDialogController { public: PieChartDialogController(); @@ -232,7 +203,39 @@ public: virtual bool shouldShow_3DLookControl() const override; }; -class LineChartDialogController : public ChartTypeDialogController +class OfPieChartDialogController final : public ChartTypeDialogController +{ +public: + OfPieChartDialogController(); + virtual ~OfPieChartDialogController() 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; + + virtual void showExtraControls(weld::Builder* pBuilder) override; + virtual void hideExtraControls() const override; + virtual void fillExtraControls( + const rtl::Reference<::chart::ChartModel>& 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(ChangeCompositeSizeHdl, weld::SpinButton&, void); + +private: + std::unique_ptr<weld::Label> m_xFT_CompositeSize; + std::unique_ptr<weld::SpinButton> m_xMF_CompositeSize; +}; + +class LineChartDialogController final : public ChartTypeDialogController { public: LineChartDialogController(); @@ -250,7 +253,7 @@ public: virtual bool shouldShow_SplineControl() const override; }; -class XYChartDialogController : public ChartTypeDialogController +class XYChartDialogController final : public ChartTypeDialogController { public: XYChartDialogController(); @@ -267,7 +270,7 @@ public: virtual bool shouldShow_SortByXValuesResourceGroup() const override; }; -class AreaChartDialogController : public ChartTypeDialogController +class AreaChartDialogController final : public ChartTypeDialogController { public: AreaChartDialogController(); @@ -284,7 +287,7 @@ public: virtual bool shouldShow_3DLookControl() const override; }; -class NetChartDialogController : public ChartTypeDialogController +class NetChartDialogController final : public ChartTypeDialogController { public: NetChartDialogController(); @@ -300,7 +303,7 @@ public: virtual bool shouldShow_StackingControl() const override; }; -class StockChartDialogController : public ChartTypeDialogController +class StockChartDialogController final : public ChartTypeDialogController { public: StockChartDialogController(); @@ -314,7 +317,7 @@ public: virtual void adjustParameterToSubType(ChartTypeParameter& rParameter) override; }; -class CombiColumnLineChartDialogController : public ChartTypeDialogController +class CombiColumnLineChartDialogController final : public ChartTypeDialogController { public: CombiColumnLineChartDialogController(); @@ -329,7 +332,7 @@ public: virtual void showExtraControls(weld::Builder* pBuilder) override; virtual void hideExtraControls() const override; virtual void fillExtraControls( - const css::uno::Reference<css::chart2::XChartDocument>& xChartModel, + const rtl::Reference<::chart::ChartModel>& xChartModel, const css::uno::Reference<css::beans::XPropertySet>& xTemplateProps) const override; virtual void setTemplateProperties( @@ -343,7 +346,7 @@ private: std::unique_ptr<weld::SpinButton> m_xMF_NumberOfLines; }; -class BubbleChartDialogController : public ChartTypeDialogController +class BubbleChartDialogController final : public ChartTypeDialogController { public: BubbleChartDialogController(); @@ -358,6 +361,5 @@ public: }; } //namespace chart -#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ChartTypeHelper.hxx b/chart2/source/inc/ChartTypeHelper.hxx index e749dd5b4f75..0addc73790db 100644 --- a/chart2/source/inc/ChartTypeHelper.hxx +++ b/chart2/source/inc/ChartTypeHelper.hxx @@ -17,72 +17,47 @@ * 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 +#pragma once +#include <config_options.h> #include <com/sun/star/drawing/Direction3D.hpp> -#include "charttoolsdllapi.hxx" - -namespace com::sun::star::chart2 { class XChartType; } -namespace com::sun::star::chart2 { class XDataSeries; } +#include "ChartType.hxx" +#include <rtl/ref.hxx> namespace chart { +class ChartType; +class DataSeries; -class OOO_DLLPUBLIC_CHARTTOOLS ChartTypeHelper +class 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 ); + static bool shiftCategoryPosAtXAxisPerDefault( const rtl::Reference< ::chart::ChartType >& xChartType ); //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 ); + const rtl::Reference< ::chart::ChartType >& xChartType, bool bSwapXAndY + , const rtl::Reference< ::chart::DataSeries >& 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 ); + const rtl::Reference< ::chart::ChartType >& xChartType ); - static OUString getRoleOfSequenceForYAxisNumberFormatDetection( const css::uno::Reference< - css::chart2::XChartType >& xChartType ); + static css::drawing::Direction3D getDefaultSimpleLightDirection( const rtl::Reference< ::chart::ChartType >& xChartType ); + static css::drawing::Direction3D getDefaultRealisticLightDirection( const rtl::Reference< ::chart::ChartType >& xChartType ); + static sal_Int32 getDefaultDirectLightColor( bool bSimple, const rtl::Reference< ::chart::ChartType >& xChartType ); + static sal_Int32 getDefaultAmbientLightColor( bool bSimple, const rtl::Reference< ::chart::ChartType >& xChartType ); + static sal_Int32 getNumberOfDisplayedSeries( const rtl::Reference< ::chart::ChartType >& xChartType, sal_Int32 nNumberOfSeries ); + static bool noBordersForSimpleScheme( const rtl::Reference< ::chart::ChartType >& xChartType ); - static OUString getRoleOfSequenceForDataLabelNumberFormatDetection( const css::uno::Reference< - css::chart2::XChartType >& xChartType ); + static OUString getRoleOfSequenceForYAxisNumberFormatDetection( const rtl::Reference< + ::chart::ChartType >& xChartType ); - static bool isSupportingOnlyDeepStackingFor3D( const css::uno::Reference< css::chart2::XChartType >& xChartType ); + static OUString getRoleOfSequenceForDataLabelNumberFormatDetection( const rtl::Reference< + ::chart::ChartType >& xChartType ); }; } //namespace chart -#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ChartTypeTemplate.hxx b/chart2/source/inc/ChartTypeTemplate.hxx new file mode 100644 index 000000000000..9e641eeaea1e --- /dev/null +++ b/chart2/source/inc/ChartTypeTemplate.hxx @@ -0,0 +1,279 @@ +/* -*- 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 . + */ +#pragma once + +#include <cppuhelper/implbase.hxx> +#include "DataInterpreter.hxx" +#include "StackMode.hxx" +#include <com/sun/star/chart2/XChartTypeTemplate.hpp> +#include <com/sun/star/lang/XServiceName.hpp> +#include <rtl/ref.hxx> +#include <vector> + +namespace com::sun::star::beans { struct PropertyValue; } +namespace com::sun::star::chart2 { class XChartType; } +namespace com::sun::star::chart2 { class XDataSeries; } +namespace com::sun::star::chart2 { class XDiagram; } +namespace com::sun::star::chart2::data { class XDataSource; } +namespace com::sun::star::chart2::data { class XLabeledDataSequence; } +namespace com::sun::star::uno { class XComponentContext; } + +namespace chart +{ +class BaseCoordinateSystem; +class ChartType; +class DataSeries; +class Diagram; + +/** For creating diagrams and modifying existing diagrams. A base class that + implements XChartTypeTemplate and offers some tooling for classes that + derive from this class. + + createDiagramByDataSource + + This does the following steps using some virtual helper-methods, that may be + overridden by derived classes: + + * creates an XDiagram via service-factory. + + * convert the given XDataSource to a sequence of XDataSeries using the + method createDataSeries(). In this class the DataInterpreter helper class + is used to create a standard interpretation (just y-values). + + * call applyDefaultStyle() for all XDataSeries in order to apply default + styles. In this class the series get the system-wide default colors as + "Color" property. + + * call applyStyle() for applying chart-type specific styles to all series. + The default implementation is empty. + + * call createCoordinateSystems() and apply them to the diagram. As + default one cartesian system with Scales using a linear Scaling is + created. + + * createChartTypes() is called in order to define the structure of the + diagram. For details see comment of this function. As default this + method creates a tree where all series appear in one branch with the chart + type determined by getChartTypeForNewSeries(). The stacking is determined + via the method getStackMode(). + + * create an XLegend via the global service factory, set it at the diagram. + */ +class ChartTypeTemplate : public ::cppu::WeakImplHelper< + css::chart2::XChartTypeTemplate, + css::lang::XServiceName > +{ +public: + explicit ChartTypeTemplate( css::uno::Reference< css::uno::XComponentContext > const & xContext, + OUString aServiceName ); + virtual ~ChartTypeTemplate() override; + + rtl::Reference< ::chart::Diagram > createDiagramByDataSource2( + const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource, + const css::uno::Sequence< css::beans::PropertyValue >& aArguments ); + + // ____ XChartTypeTemplate ____ + virtual css::uno::Reference< css::chart2::XDiagram > SAL_CALL createDiagramByDataSource( + const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource, + const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override final; + /// denotes if the chart needs categories at the first scale + virtual sal_Bool SAL_CALL supportsCategories() override; + virtual void SAL_CALL changeDiagram( + const css::uno::Reference< css::chart2::XDiagram >& xDiagram ) override final; + virtual void SAL_CALL changeDiagramData( + const css::uno::Reference< css::chart2::XDiagram >& xDiagram, + const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource, + const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override final; + virtual sal_Bool SAL_CALL matchesTemplate( + const css::uno::Reference< css::chart2::XDiagram >& xDiagram, + sal_Bool bAdaptProperties ) override final; + virtual css::uno::Reference< css::uno::XInterface > SAL_CALL getDataInterpreter() override final; + virtual css::uno::Reference< ::css::chart2::XChartType > SAL_CALL getChartTypeForNewSeries( + const css::uno::Sequence< css::uno::Reference< css::chart2::XChartType > >& aFormerlyUsedChartTypes ) override final; + virtual void SAL_CALL applyStyle( + const css::uno::Reference< css::chart2::XDataSeries >& xSeries, + ::sal_Int32 nChartTypeIndex, + ::sal_Int32 nSeriesIndex, + ::sal_Int32 nSeriesCount ) override final; + virtual void SAL_CALL resetStyles( + const css::uno::Reference< css::chart2::XDiagram >& xDiagram ) override final; + + void changeDiagram( + const rtl::Reference< ::chart::Diagram >& xDiagram ); + void changeDiagramData( + const rtl::Reference< ::chart::Diagram >& xDiagram, + const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource, + const css::uno::Sequence< css::beans::PropertyValue >& aArguments ); + virtual bool matchesTemplate2( + const rtl::Reference< ::chart::Diagram >& xDiagram, + bool bAdaptProperties ); + virtual rtl::Reference< ::chart::ChartType > + getChartTypeForNewSeries2( const std::vector< + rtl::Reference< ::chart::ChartType > >& aFormerlyUsedChartTypes ) = 0; + virtual rtl::Reference< ::chart::DataInterpreter > getDataInterpreter2(); + virtual void applyStyle2( + const rtl::Reference< ::chart::DataSeries >& xSeries, + ::sal_Int32 nChartTypeIndex, + ::sal_Int32 nSeriesIndex, + ::sal_Int32 nSeriesCount ); + virtual void resetStyles2( + const rtl::Reference< ::chart::Diagram >& xDiagram ); + + /// @throws css::uno::RuntimeException + void applyStyles( + const rtl::Reference< ::chart::Diagram >& xDiagram ); + + // ____ XServiceName ____ + virtual OUString SAL_CALL getServiceName() override; + + // Methods to override for automatic creation + + /// returns 2 by default. Supported are 2 and 3 + virtual sal_Int32 getDimension() const; + + /** returns StackMode::NONE by default. This is a global flag used for all + series of a specific chart type. If percent stacking is supported, the + percent stacking mode is retrieved from the first chart type (index 0) + + @param nChartTypeIndex denotes the index of the charttype in means + defined by the template creation order, i.e., 0 means the first + chart type that a template creates. + */ + virtual StackMode getStackMode( sal_Int32 nChartTypeIndex ) const; + + virtual rtl::Reference< ::chart::ChartType > + getChartTypeForIndex( sal_Int32 nChartTypeIndex ) = 0; + + virtual bool isSwapXAndY() const; + + // Methods for creating the diagram piecewise + + /** Allows derived classes to manipulate the diagrams whole, like changing + the wall color. The default implementation is empty. It is called by + FillDiagram which is called by createDiagramByDataSource and + changeDiagram + */ + virtual void adaptDiagram( + const rtl::Reference< ::chart::Diagram > & xDiagram ); + + /** Creates a 2d or 3d cartesian coordinate system with mathematically + oriented, linear scales with auto-min/max. If the given + CoordinateSystemContainer is not empty, those coordinate system should + be reused. + + <p>The dimension depends on the value returned by getDimension().</p> + */ + virtual void createCoordinateSystems( + const rtl::Reference< ::chart::Diagram > & xDiagram ); + + /** Sets categories at the scales of dimension 0 and the percent stacking at + the scales of dimension 1 of all given coordinate systems. + + <p>Called by FillDiagram.</p> + */ + virtual void adaptScales( + const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > & aCooSysSeq, + const css::uno::Reference< css::chart2::data::XLabeledDataSequence > & xCategories ); + + /** create a data series tree, that fits the requirements of the chart type. + + <p>As default, this creates a tree with the following structure:</p> + + <pre> + root + | + +-- chart type (determined by getChartTypeForNewSeries()) + | + +-- category (DiscreteStackableScaleGroup using scale 0) + | + +-- values (ContinuousStackableScaleGroup using scale 1) + | + +-- series 0 + | + +-- series 1 + | + ... + | + +.. series n-1 + </pre> + + <p>If there are less than two scales available the returned tree is + empty.</p> + */ + virtual void createChartTypes( + const std::vector< + std::vector< + rtl::Reference< + ::chart::DataSeries > > > & aSeriesSeq, + const std::vector< + rtl::Reference< + ::chart::BaseCoordinateSystem > > & rCoordSys, + const std::vector< rtl::Reference< ChartType > > & aOldChartTypesSeq + ); + + /** create axes and add them to the given container. If there are already + compatible axes in the container these should be maintained. + + <p>As default, this method creates as many axes as there are dimensions + in the given first coordinate system. Each of the axis + represents one of the dimensions of the coordinate systems. If there are series + requesting a secondary axes a secondary y axes is added</p> + */ + void createAxes( + const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > & rCoordSys ); + + /** Give the number of requested axis per dimension here. Default is one + axis for each dimension + */ + virtual sal_Int32 getAxisCountByDimension( sal_Int32 nDimension ); + + /** adapt properties of existing axes and remove superfluous axes + */ + virtual void adaptAxes( + const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > & rCoordSys ); + + const css::uno::Reference< css::uno::XComponentContext >& + GetComponentContext() const { return m_xContext;} + + static void copyPropertiesFromOldToNewCoordinateSystem( + const std::vector< rtl::Reference< ChartType > > & rOldChartTypesSeq, + const rtl::Reference< ChartType > & xNewChartType ); + +protected: + css::uno::Reference< css::uno::XComponentContext > m_xContext; + mutable rtl::Reference< ::chart::DataInterpreter > m_xDataInterpreter; + +private: + const OUString m_aServiceName; + +private: + /** modifies the given diagram + */ + void FillDiagram( const rtl::Reference< ::chart::Diagram >& xDiagram, + const std::vector< + std::vector< + rtl::Reference< + ::chart::DataSeries > > > & aSeriesSeq, + const css::uno::Reference< css::chart2::data::XLabeledDataSequence >& xCategories, + const std::vector< rtl::Reference< ChartType > > & aOldChartTypesSeq); +}; + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ChartTypeTemplateProvider.hxx b/chart2/source/inc/ChartTypeTemplateProvider.hxx index fc4517d1bc4e..400b1c8e2819 100644 --- a/chart2/source/inc/ChartTypeTemplateProvider.hxx +++ b/chart2/source/inc/ChartTypeTemplateProvider.hxx @@ -17,35 +17,21 @@ * 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 +#pragma once -#include <com/sun/star/uno/Reference.hxx> - -namespace com -{ -namespace sun -{ -namespace star -{ -namespace chart2 -{ -class XChartTypeTemplate; -} -} -} -} +#include <rtl/ref.hxx> namespace chart { +class ChartTypeTemplate; + class ChartTypeTemplateProvider { public: - virtual css::uno::Reference<css::chart2::XChartTypeTemplate> getCurrentTemplate() const = 0; + virtual rtl::Reference<::chart::ChartTypeTemplate> 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 index 48f7c27b6fac..1a6425ffae55 100644 --- a/chart2/source/inc/ChartViewHelper.hxx +++ b/chart2/source/inc/ChartViewHelper.hxx @@ -16,24 +16,29 @@ * 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 +#pragma once -#include "charttoolsdllapi.hxx" +#include <config_options.h> +#include <rtl/ref.hxx> -namespace com::sun::star::uno { template <class interface_type> class Reference; } -namespace com::sun::star::frame { class XModel; } +#include <com/sun/star/uno/Reference.hxx> + +namespace com::sun::star::chart2 +{ +class XChartDocument; +} namespace chart { +class ChartModel; -class OOO_DLLPUBLIC_CHARTTOOLS ChartViewHelper +namespace ChartViewHelper { -public: - static void setViewToDirtyState( const css::uno::Reference< css::frame::XModel >& xChartModel ); +void setViewToDirtyState(const rtl::Reference<ChartModel>& xChartModel); + +void setViewToDirtyState_UNO(const css::uno::Reference<css::chart2::XChartDocument>& 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 index da697e05ece4..cabcdb58366f 100644 --- a/chart2/source/inc/CloneHelper.hxx +++ b/chart2/source/inc/CloneHelper.hxx @@ -16,18 +16,14 @@ * 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 +#pragma once #include <com/sun/star/util/XCloneable.hpp> - -#include <algorithm> +#include <rtl/ref.hxx> #include <iterator> #include <vector> -namespace chart -{ -namespace CloneHelper +namespace chart::CloneHelper { /// functor that clones a UNO-Reference @@ -57,6 +53,15 @@ template< class Interface > CreateRefClone< Interface >()); } +template< class T > + void CloneRefVector( + const std::vector< rtl::Reference< T > > & rSource, + std::vector< rtl::Reference< T > > & rDestination ) +{ + for (const auto & rSourceItem : rSource) + rDestination.push_back(static_cast<T*>(rSourceItem->createClone().get())); +} + /// clones a UNO-sequence of UNO-References template< class Interface > void CloneRefSequence( @@ -69,10 +74,6 @@ template< class Interface > CreateRefClone< Interface >()); } -} // namespace CloneHelper -} // namespace chart - -// INCLUDED_CHART2_SOURCE_INC_CLONEHELPER_HXX -#endif +} // namespace chart::CloneHelper /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ColorPerPointHelper.hxx b/chart2/source/inc/ColorPerPointHelper.hxx deleted file mode 100644 index 6c34693da111..000000000000 --- a/chart2/source/inc/ColorPerPointHelper.hxx +++ /dev/null @@ -1,50 +0,0 @@ -/* -*- 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 index 940b95d70502..2716849ba804 100644 --- a/chart2/source/inc/CommonConverters.hxx +++ b/chart2/source/inc/CommonConverters.hxx @@ -16,8 +16,7 @@ * 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 +#pragma once #include <com/sun/star/awt/Point.hpp> #include <com/sun/star/awt/Size.hpp> @@ -30,7 +29,7 @@ #include <basegfx/matrix/b2dhommatrix.hxx> #include <basegfx/point/b3dpoint.hxx> #include <basegfx/vector/b3dvector.hxx> -#include "charttoolsdllapi.hxx" +#include <basegfx/polygon/b2dpolypolygon.hxx> namespace com::sun::star::awt { struct Rectangle; } namespace com::sun::star::chart2::data { class XDataSequence; } @@ -46,169 +45,174 @@ and operations e.g drawing::Position3D + drawing::Direction3D /** ::basegfx::B3DHomMatrix -> HomogenMatrix */ -OOO_DLLPUBLIC_CHARTTOOLS css::drawing::HomogenMatrix +css::drawing::HomogenMatrix B3DHomMatrixToHomogenMatrix( const ::basegfx::B3DHomMatrix& rM ); /** HomogenMatrix -> ::basegfx::B3DHomMatrix */ -OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DHomMatrix HomogenMatrixToB3DHomMatrix( const css::drawing::HomogenMatrix& rHM ); +::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 +css::drawing::HomogenMatrix3 B2DHomMatrixToHomogenMatrix3( const ::basegfx::B2DHomMatrix& rM ); /** Position3D -> B3DPoint */ -OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DPoint Position3DToB3DPoint( const css::drawing::Position3D& rPosition ); +::basegfx::B3DPoint Position3DToB3DPoint( const css::drawing::Position3D& rPosition ); /** B3DVector -> Direction3D */ -OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Direction3D B3DVectorToDirection3D( const ::basegfx::B3DVector& rVector); +css::drawing::Direction3D B3DVectorToDirection3D( const ::basegfx::B3DVector& rVector); /** B3DPoint -> Position3D */ -OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D B3DPointToPosition3D( const ::basegfx::B3DPoint& rPoint); +css::drawing::Position3D B3DPointToPosition3D( const ::basegfx::B3DPoint& rPoint); /** Direction3D -> B3DVector */ -OOO_DLLPUBLIC_CHARTTOOLS ::basegfx::B3DVector Direction3DToB3DVector( const css::drawing::Direction3D& rDirection); +::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 ); +void AddPointToPoly( std::vector<std::vector<css::drawing::Position3D>>& rPoly + , const css::drawing::Position3D& rPos + , sal_Int32 nSequenceIndex=0 ); + /** get a single Point from a Polygon */ -OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D getPointFromPoly( +css::drawing::Position3D getPointFromPoly( + const std::vector<std::vector<css::drawing::Position3D>>& rPolygon + , sal_Int32 nPointIndex, sal_Int32 nPolyIndex ); +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 ); + +void addPolygon( std::vector<std::vector<css::drawing::Position3D>>& rRet + , const std::vector<std::vector<css::drawing::Position3D>>& rAdd ); /** PolyPolygonShape3D + PolyPolygonShape3D -> PolyPolygonShape3D */ -OOO_DLLPUBLIC_CHARTTOOLS -void appendPoly( css::drawing::PolyPolygonShape3D& rRet - , const css::drawing::PolyPolygonShape3D& rAdd ); + +void appendPoly( std::vector<std::vector<css::drawing::Position3D>>& rRet + , const std::vector<std::vector<css::drawing::Position3D>>& 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 ); +css::drawing::PointSequenceSequence PolyToPointSequence( + const std::vector<std::vector<css::drawing::Position3D>>& rPolyPolygon ); + +/** PolyPolygonShape3D -> basegfx::B2DPolyPolygon (2D) +*/ + +basegfx::B2DPolyPolygon PolyToB2DPolyPolygon( + const std::vector<std::vector<css::drawing::Position3D>>& rPolyPolygon ); + /** drawing::PointSequenceSequence + drawing::PointSequenceSequence */ -OOO_DLLPUBLIC_CHARTTOOLS + void appendPointSequence( css::drawing::PointSequenceSequence& rTarget - , css::drawing::PointSequenceSequence& rAdd ); + , const css::drawing::PointSequenceSequence& rAdd ); /** Position3D + Direction3D == Position3D */ -OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D +css::drawing::Position3D operator+( const css::drawing::Position3D& rPos , const css::drawing::Direction3D& rDirection); /** Position3D - Position3D == Direction3D */ -OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Direction3D +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 ); +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 ); +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 ); +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 ); +css::awt::Size Direction3DToAWTSize( const css::drawing::Direction3D& rDirection ); /** Sequence<double> -> drawing::Position3D */ -OOO_DLLPUBLIC_CHARTTOOLS css::drawing::Position3D +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 > +/** std::vector< std::vector< T > > -> std::vector< T > */ template< typename T > -css::uno::Sequence< T > - FlattenSequence( const css::uno::Sequence< css::uno::Sequence< T > > & aSeqSeq ) +std::vector< T > + FlattenSequence( const std::vector< std::vector< T > > & aSeqSeq ) { sal_Int32 nOuter, nInner, nCount = 0, nResultSize = 0; - const sal_Int32 nOuterSize = aSeqSeq.getLength(); + const sal_Int32 nOuterSize = aSeqSeq.size(); for( nOuter=0; nOuter<nOuterSize; ++nOuter ) - nResultSize += aSeqSeq[nOuter].getLength(); - css::uno::Sequence< T > aResult( nResultSize ); + nResultSize += aSeqSeq[nOuter].size(); + std::vector< T > aResult( nResultSize ); for( nOuter=0; nOuter<nOuterSize; ++nOuter ) { - const sal_Int32 nInnerSize = aSeqSeq[nOuter].getLength(); + const sal_Int32 nInnerSize = aSeqSeq[nOuter].size(); 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 ); + std::u16string_view rParamToReplace, + std::u16string_view 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 index 10d32f5bf0e1..bbbdce3ed960 100644 --- a/chart2/source/inc/CommonFunctors.hxx +++ b/chart2/source/inc/CommonFunctors.hxx @@ -16,18 +16,18 @@ * 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 +#pragma once #include <o3tl/any.hxx> #include <rtl/math.hxx> #include <com/sun/star/uno/Any.hxx> +#include <com/sun/star/uno/Sequence.hxx> #include <rtl/ustring.hxx> -#include "charttoolsdllapi.hxx" -namespace chart -{ -namespace CommonFunctors +#include <algorithm> +#include <limits> + +namespace chart::CommonFunctors { /** unary function to convert any type T into a css::uno::Any. @@ -35,35 +35,46 @@ namespace CommonFunctors <p>uno::makeAny is an inline function. Thus is cannot be taken directly (via mem_fun_ptr)</p> */ -template< typename T > - struct makeAny +struct makeAny { + template< typename T > css::uno::Any operator() ( const T & aVal ) { - return css::uno::makeAny( aVal ); + return css::uno::Any( aVal ); } }; -/** unary function to convert css::uno::Any into a double number. +/** unary function to convert an OUString or 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 + <p>For conversion of OUString, rtl::math::StringToDouble is used.</p> + <p>In case no number can be generated from the Any, NaN is returned.</p> + */ +struct ToDouble { double operator() ( const css::uno::Any & rAny ) { - double fResult; - ::rtl::math::setNan( & fResult ); + double fResult = std::numeric_limits<double>::quiet_NaN(); rAny >>= fResult; return fResult; } + + double operator() ( std::u16string_view rStr ) + { + rtl_math_ConversionStatus eConversionStatus; + double fResult = ::rtl::math::stringToDouble( rStr, '.', ',', & eConversionStatus ); + + if( eConversionStatus != rtl_math_ConversionStatus_Ok ) + return std::numeric_limits<double>::quiet_NaN(); + + return fResult; + } }; -/** unary function to convert css::uno::Any into an - OUString. -*/ -struct OOO_DLLPUBLIC_CHARTTOOLS AnyToString +/** unary function to convert a double number or css::uno::Any into an OUString. + + <p>For conversion of doubles, rtl::math::DoubleToOUString is used.</p> + */ +struct ToString { OUString operator() ( const css::uno::Any & rAny ) { @@ -86,32 +97,7 @@ struct OOO_DLLPUBLIC_CHARTTOOLS AnyToString 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( @@ -124,10 +110,13 @@ struct OOO_DLLPUBLIC_CHARTTOOLS DoubleToOUString } }; -} // namespace CommonFunctors -} // namespace chart +template <class Container, class Func> auto convertToSequence(const Container& container, Func f) +{ + css::uno::Sequence<decltype(f(container[0]))> result(container.size()); + std::transform(container.begin(), container.end(), result.getArray(), f); + return result; +} -// INCLUDED_CHART2_SOURCE_INC_COMMONFUNCTORS_HXX -#endif +} // namespace chart::CommonFunctors /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ConfigColorScheme.hxx b/chart2/source/inc/ConfigColorScheme.hxx index 7d0bbf662ed4..f1302a4e271f 100644 --- a/chart2/source/inc/ConfigColorScheme.hxx +++ b/chart2/source/inc/ConfigColorScheme.hxx @@ -16,13 +16,9 @@ * 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 +#pragma once -#include "charttoolsdllapi.hxx" -#include <cppuhelper/implbase.hxx> -#include <com/sun/star/chart2/XColorScheme.hpp> -#include <com/sun/star/lang/XServiceInfo.hpp> +#include "BaseColorScheme.hxx" #include <memory> @@ -31,7 +27,7 @@ namespace com::sun::star::uno { class XComponentContext; } namespace chart { -OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::chart2::XColorScheme > createConfigColorScheme( +css::uno::Reference< css::chart2::XColorScheme > createConfigColorScheme( const css::uno::Reference< css::uno::XComponentContext > & xContext ); namespace impl @@ -39,22 +35,17 @@ namespace impl class ChartConfigItem; } -class ConfigColorScheme : - public ::cppu::WeakImplHelper< - css::chart2::XColorScheme, - css::lang::XServiceInfo > +class ConfigColorScheme final : public BaseColorScheme { public: explicit ConfigColorScheme( const css::uno::Reference< css::uno::XComponentContext > & xContext ); virtual ~ConfigColorScheme() override; + // ____ ConfigItemListener ____ + void notify(); + /// 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 ____ @@ -66,14 +57,9 @@ private: // 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 index 090becde9343..41fc545c4681 100644 --- a/chart2/source/inc/ControllerLockGuard.hxx +++ b/chart2/source/inc/ControllerLockGuard.hxx @@ -16,36 +16,37 @@ * 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 +#pragma once -#include "charttoolsdllapi.hxx" -#include <com/sun/star/uno/Reference.h> +#include <config_options.h> -namespace chart { class ChartModel; } -namespace com::sun::star::frame { class XModel; } +#include <rtl/ref.hxx> namespace chart { +class ChartModel; +} +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 +class ControllerLockGuardUNO { public: - explicit ControllerLockGuardUNO( const css::uno::Reference< css::frame::XModel > & xModel ); + explicit ControllerLockGuardUNO(rtl::Reference<::chart::ChartModel> xModel); ~ControllerLockGuardUNO(); private: - css::uno::Reference< css::frame::XModel > mxModel; + rtl::Reference<::chart::ChartModel> mxModel; }; class ControllerLockGuard { public: - explicit ControllerLockGuard( ChartModel& rModel ); + explicit ControllerLockGuard(ChartModel& rModel); ~ControllerLockGuard(); private: @@ -58,18 +59,17 @@ private: Use the ControllerLockHelperGuard to lock/unlock the model during a block of instructions. */ -class OOO_DLLPUBLIC_CHARTTOOLS ControllerLockHelper +class ControllerLockHelper { public: - explicit ControllerLockHelper( - const css::uno::Reference< css::frame::XModel > & xModel ); + explicit ControllerLockHelper(rtl::Reference<::chart::ChartModel> xModel); ~ControllerLockHelper(); - SAL_DLLPRIVATE void lockControllers(); - SAL_DLLPRIVATE void unlockControllers(); + void lockControllers(); + void unlockControllers(); private: - css::uno::Reference< css::frame::XModel > m_xModel; + rtl::Reference<::chart::ChartModel> m_xModel; }; /** This guard calls lockControllers at the given ControllerLockHelper in the @@ -77,19 +77,16 @@ private: do not remain locked when leaving a function even in case an exception is thrown. */ -class OOO_DLLPUBLIC_CHARTTOOLS ControllerLockHelperGuard +class ControllerLockHelperGuard { public: - explicit ControllerLockHelperGuard( ControllerLockHelper & rHelper ); + explicit ControllerLockHelperGuard(ControllerLockHelper& rHelper); ~ControllerLockHelperGuard(); private: - ControllerLockHelper & m_rHelper; + 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/DataBrowserModel.hxx b/chart2/source/inc/DataBrowserModel.hxx new file mode 100644 index 000000000000..53aff9ade60e --- /dev/null +++ b/chart2/source/inc/DataBrowserModel.hxx @@ -0,0 +1,164 @@ +/* -*- 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 . + */ +#pragma once + +#include "DataSeries.hxx" +#include "ChartType.hxx" + +#include <com/sun/star/uno/Reference.hxx> +#include <rtl/ref.hxx> + +#include <memory> +#include <utility> +#include <vector> + +namespace com::sun::star::chart2 { + class XDataSeries; +} + +namespace chart +{ + +class DialogModel; +class ChartModel; + +class DataBrowserModel final +{ +public: + explicit DataBrowserModel( + const rtl::Reference<::chart::ChartModel> & xChartDoc ); + ~DataBrowserModel(); + + /** Inserts a new data series after the data series to which the data column + with index nAfterColumnIndex belongs. + */ + void insertDataSeries( sal_Int32 nAfterColumnIndex ); + + /** Inserts a new text column for complex categories. + */ + void insertComplexCategoryLevel( sal_Int32 nAfterColumnIndex ); + + /** Removes a data series to which the data column with index nAtColumnIndex + belongs. + */ + void removeDataSeriesOrComplexCategoryLevel( sal_Int32 nAtColumnIndex ); + + /** Swaps the series to which the data column with index nFirstIndex belongs + with the next series (which starts at an index >= nFirstIndex + 1) + */ + void swapDataSeries( sal_Int32 nFirstIndex ); + void swapDataPointForAllSeries( sal_Int32 nFirstIndex ); + + void insertDataPointForAllSeries( sal_Int32 nAfterIndex ); + void removeDataPointForAllSeries( sal_Int32 nAtIndex ); + + enum eCellType + { + NUMBER, + TEXT, + TEXTORDATE + }; + + eCellType getCellType( sal_Int32 nAtColumn ) const; + /// If getCellType( nAtColumn, nAtRow ) returns TEXT, the result will be Nan + double getCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow ); + OUString getCellText( sal_Int32 nAtColumn, sal_Int32 nAtRow ); + css::uno::Any getCellAny( sal_Int32 nAtColumn, sal_Int32 nAtRow ); + sal_uInt32 getNumberFormatKey( sal_Int32 nAtColumn ); + + /// returns </sal_True> if the number could successfully be set at the given position + bool setCellNumber( sal_Int32 nAtColumn, sal_Int32 nAtRow, double fValue ); + /// returns </sal_True> if the text could successfully be set at the given position + bool setCellText( sal_Int32 nAtColumn, sal_Int32 nAtRow, const OUString & rText ); + bool setCellAny( sal_Int32 nAtColumn, sal_Int32 nAtRow, const css::uno::Any & aValue ); + + sal_Int32 getColumnCount() const; + sal_Int32 getMaxRowCount() const; + + // returns the UI string of the corresponding role + const OUString & getRoleOfColumn( sal_Int32 nColumnIndex ) const; + bool isCategoriesColumn( sal_Int32 nColumnIndex ) const; + + struct tDataHeader + { + rtl::Reference< ::chart::DataSeries > m_xDataSeries; + rtl::Reference< ::chart::ChartType > m_xChartType; + bool m_bSwapXAndYAxis; + sal_Int32 m_nStartColumn; + sal_Int32 m_nEndColumn; + + // default CTOR + tDataHeader() : + m_bSwapXAndYAxis( false ), + m_nStartColumn( -1 ), + m_nEndColumn( -1 ) + {} + // "full" CTOR + tDataHeader( + rtl::Reference< ::chart::DataSeries > xDataSeries, + rtl::Reference< ::chart::ChartType > xChartType, + bool bSwapXAndYAxis, + sal_Int32 nStartColumn, + sal_Int32 nEndColumn ) : + m_xDataSeries(std::move( xDataSeries )), + m_xChartType(std::move( xChartType )), + m_bSwapXAndYAxis( bSwapXAndYAxis ), + m_nStartColumn( nStartColumn ), + m_nEndColumn( nEndColumn ) + {} + }; + + typedef std::vector< tDataHeader > tDataHeaderVector; + + const tDataHeaderVector& getDataHeaders() const { return m_aHeaders;} + + tDataHeader getHeaderForSeries( + const css::uno::Reference< css::chart2::XDataSeries > &xSeries ) const; + + rtl::Reference< ::chart::DataSeries > + getDataSeriesByColumn( sal_Int32 nColumn ) const; + +private: + void updateFromModel(); + + void removeComplexCategoryLevel( sal_Int32 nAtColumnIndex ); + + void addErrorBarRanges( + const rtl::Reference<::chart::DataSeries > & xDataSeries, + sal_Int32 nNumberFormatKey, + sal_Int32 & rInOutSequenceIndex, + sal_Int32 & rInOutHeaderEnd, bool bYError ); + + sal_Int32 getCategoryColumnCount(); + + rtl::Reference<::chart::ChartModel> m_xChartDocument; + std::unique_ptr< DialogModel > m_apDialogModel; + + struct tDataColumn; + struct implColumnLess; + + typedef std::vector< tDataColumn > tDataColumnVector; + + tDataColumnVector m_aColumns; + tDataHeaderVector m_aHeaders; +}; + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/DataInterpreter.hxx b/chart2/source/inc/DataInterpreter.hxx new file mode 100644 index 000000000000..91513e25f31e --- /dev/null +++ b/chart2/source/inc/DataInterpreter.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 . + */ +#pragma once + +#include "DataSeries.hxx" +#include <cppuhelper/implbase.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/beans/PropertyValue.hpp> +#include <com/sun/star/chart2/data/XDataSource.hpp> +#include <rtl/ref.hxx> +#include <vector> + +namespace chart +{ +class DataSource; + +/** offers tooling to interpret different data sources in a structural + and chart-type-dependent way. + */ +struct InterpretedData +{ + std::vector< std::vector< rtl::Reference<::chart::DataSeries> > > Series; + css::uno::Reference< css::chart2::data::XLabeledDataSequence > Categories; +}; + +/** offers tooling to interpret different data sources in a structural + and chart-type-dependent way. + */ +class SAL_DLLPUBLIC_RTTI DataInterpreter : public ::cppu::WeakImplHelper< + css::lang::XServiceInfo > +{ +public: + explicit DataInterpreter(); + virtual ~DataInterpreter() 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; + + // convenience methods + static OUString GetRole( const css::uno::Reference< css::chart2::data::XDataSequence > & xSeq ); + + static void SetRole( + const css::uno::Reference< css::chart2::data::XDataSequence > & xSeq, + const OUString & rRole ); + + static css::uno::Any GetProperty( + const css::uno::Sequence<css::beans::PropertyValue > & aArguments, + std::u16string_view rName ); + + static bool HasCategories( + const css::uno::Sequence< css::beans::PropertyValue > & rArguments, + const std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > & rData ); + + static bool UseCategoriesAsX( + const css::uno::Sequence< css::beans::PropertyValue > & rArguments ); + + static std::vector<css::uno::Reference< css::chart2::data::XLabeledDataSequence >> getDataSequences( + const css::uno::Reference< css::chart2::data::XDataSource >& xSource); + + // ____ DataInterpreter ____ + /** Interprets the given data. + + @param xSource + the data source. + + @param aArguments + Arguments that tell the template how to slice the given + range. The properties should be defined in a separate + service. + + <p>For standard parameters that may be used, see the + service StandardDiagramCreationParameters. + </p> + + @param aSeriesToReUse + use all the data series given here for the result before + creating new ones. + */ + virtual InterpretedData interpretDataSource( + const css::uno::Reference< css::chart2::data::XDataSource >& xSource, + const css::uno::Sequence< css::beans::PropertyValue >& aArguments, + const std::vector< rtl::Reference< ::chart::DataSeries > >& aSeriesToReUse ); + + /** Re-interprets the data given in <code>aInterpretedData</code> + while keeping the number of data series and the categories. + */ + virtual InterpretedData reinterpretDataSeries( + const InterpretedData& aInterpretedData ); + + /** parses the given data and states, if a + reinterpretDataSeries() call can be done + without data loss. + + @return + `TRUE`, if the data given in + <code>aInterpretedData</code> has a similar structure than + the one required is used as output of the data interpreter. + */ + virtual bool isDataCompatible( + const InterpretedData& aInterpretedData ); + + /** Try to reverse the operation done in + interpretDataSource(). + + <p>In case <code>aInterpretedData</code> is the result of + interpretDataSource()( <code>xSource</code> ), + the result of this method should be <code>xSource</code>.</p> + */ + static rtl::Reference< ::chart::DataSource > mergeInterpretedData( + const InterpretedData& aInterpretedData ); + + /** Get chart information that is specific to a particular chart + type, by key. + + @param sKey + name of the piece of data to retrieve. + + <p>Supported key strings:</p> + <ul> + <li><tt>"stock variant"</tt>: stock chart variant, + with 0 = neither Open Values nor volume, 1 = Open Values, + 2 = volume, 3 = both. Valid for candlestick charts.</li> + </ul> + + @return + The value requested, or nothing if not present. + */ + virtual css::uno::Any getChartTypeSpecificData( + const OUString& sKey ); +}; + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/DataSeries.hxx b/chart2/source/inc/DataSeries.hxx new file mode 100644 index 000000000000..10dfb0e45840 --- /dev/null +++ b/chart2/source/inc/DataSeries.hxx @@ -0,0 +1,231 @@ +/* -*- 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 . + */ +#pragma once + +// UNO types +#include <com/sun/star/chart2/XDataSeries.hpp> +#include <com/sun/star/chart2/data/XDataSink.hpp> +#include <com/sun/star/chart2/data/XDataSource.hpp> +#include <com/sun/star/chart2/XRegressionCurveContainer.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> + +// helper classes +#include <cppuhelper/implbase.hxx> +#include <comphelper/uno3.hxx> +#include "ModifyListenerHelper.hxx" +#include "PropertyHelper.hxx" + +// STL +#include <vector> +#include <map> + +#include "OPropertySet.hxx" + +namespace com::sun::star::beans { class XPropertySet; } + +namespace chart +{ +class LabeledDataSequence; +class RegressionCurveModel; + +namespace impl +{ +typedef ::cppu::WeakImplHelper< + css::chart2::XDataSeries, + css::chart2::data::XDataSink, + css::chart2::data::XDataSource, + css::lang::XServiceInfo, + css::chart2::XRegressionCurveContainer, + css::util::XCloneable, + css::util::XModifyBroadcaster, + css::util::XModifyListener > + DataSeries_Base; +} + +class DataSeries + final + : public impl::DataSeries_Base + , public ::property::OPropertySet +{ +public: + explicit DataSeries(); + virtual ~DataSeries() 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; + + /// merge XInterface implementations + DECLARE_XINTERFACE() + /// merge XTypeProvider implementations + DECLARE_XTYPEPROVIDER() + + explicit DataSeries( const DataSeries & rOther ); + + // ____ XDataSeries ____ + /// @see css::chart2::XDataSeries + virtual css::uno::Reference< css::beans::XPropertySet > + SAL_CALL getDataPointByIndex( sal_Int32 nIndex ) override; + virtual void SAL_CALL resetDataPoint( sal_Int32 nIndex ) override; + virtual void SAL_CALL resetAllDataPoints() override; + + // ____ XDataSink ____ + /// @see css::chart2::data::XDataSink + virtual void SAL_CALL setData( const css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > >& aData ) override; + + // ____ XDataSource ____ + /// @see css::chart2::data::XDataSource + virtual css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > SAL_CALL getDataSequences() override; + + // ____ OPropertySet ____ + virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override; + virtual void SAL_CALL getFastPropertyValue( css::uno::Any& rValue, sal_Int32 nHandle ) const override; + virtual void SAL_CALL setFastPropertyValue_NoBroadcast + ( sal_Int32 nHandle, + const css::uno::Any& rValue ) override; + + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + // ____ XPropertySet ____ + /// @see css::beans::XPropertySet + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL + getPropertySetInfo() override; + + /// make original interface function visible again + using ::com::sun::star::beans::XFastPropertySet::getFastPropertyValue; + + // ____ XRegressionCurveContainer ____ + /// @see css::chart2::XRegressionCurveContainer + virtual void SAL_CALL addRegressionCurve( + const css::uno::Reference< css::chart2::XRegressionCurve >& aRegressionCurve ) override; + virtual void SAL_CALL removeRegressionCurve( + const css::uno::Reference< css::chart2::XRegressionCurve >& aRegressionCurve ) override; + virtual css::uno::Sequence< css::uno::Reference< css::chart2::XRegressionCurve > > SAL_CALL getRegressionCurves() override; + virtual void SAL_CALL setRegressionCurves( + const css::uno::Sequence< css::uno::Reference< css::chart2::XRegressionCurve > >& aRegressionCurves ) 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; + + typedef std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > tDataSequenceContainer; + + void setData( const tDataSequenceContainer& aData ); + const tDataSequenceContainer & getDataSequences2() const { return m_aDataSequences; } + void addDataSequence(css::uno::Reference<css::chart2::data::XLabeledDataSequence> const& rSequence); + + typedef + std::vector< rtl::Reference< ::chart::RegressionCurveModel > > + tRegressionCurveContainerType; + + const tRegressionCurveContainerType & getRegressionCurves2() const { return m_aRegressionCurves; } + + /** 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. + */ + OUString getLabelForRole( const OUString & rLabelSequenceRole ); + + bool hasUnhiddenData(); + + bool hasPointOwnColor( + 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 + bool hasPointOwnProperties( sal_Int32 nPointIndex ); + + sal_Int32 getAttachedAxisIndex(); + + bool isAttachedToMainAxis() { return getAttachedAxisIndex() == 0; } + + void switchSymbolsOnOrOff( bool bSymbolsOn, sal_Int32 nSeriesIndex ); + + void switchLinesOnOrOff( bool bLinesOn ); + + void makeLinesThickOrThin( bool bThick ); + + bool hasAttributedDataPointDifferentValue( + const OUString& rPropertyName, + const css::uno::Any& rPropertyValue ); + + void setPropertyAlsoToAllAttributedDataPoints( + const OUString& rPropertyName, + const css::uno::Any& rPropertyValue ); + + bool hasDataLabelsAtSeries(); + + bool hasDataLabelsAtPoints(); + + bool hasDataLabelAtPoint( sal_Int32 nPointIndex ); + + void insertDataLabelsToSeriesAndAllPoints(); + + void deleteDataLabelsFromSeriesAndAllPoints(); + + sal_Int32 getExplicitNumberFormatKeyForDataLabel(); + +private: + + // late initialization to call after copy-constructing + void Init( const DataSeries & rOther ); + + // ____ 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; + + // ____ OPropertySet ____ + virtual void firePropertyChangeEvent() override; + using OPropertySet::disposing; + + void fireModifyEvent(); + + void impl_insertOrDeleteDataLabelsToSeriesAndAllPoints( bool bInsert ); + + tDataSequenceContainer m_aDataSequences; + + typedef std::map< sal_Int32, + css::uno::Reference< css::beans::XPropertySet > > tDataPointAttributeContainer; + tDataPointAttributeContainer m_aAttributedDataPoints; + + tRegressionCurveContainerType m_aRegressionCurves; + + rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder; +}; + +const tPropertyValueMap & StaticDataSeriesDefaults(); + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/DataSeriesHelper.hxx b/chart2/source/inc/DataSeriesHelper.hxx index c6fba94de6c7..1bde79c29fdb 100644 --- a/chart2/source/inc/DataSeriesHelper.hxx +++ b/chart2/source/inc/DataSeriesHelper.hxx @@ -16,35 +16,33 @@ * 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 +#pragma once +#include <config_options.h> #include "StackMode.hxx" -#include "charttoolsdllapi.hxx" #include <com/sun/star/uno/Reference.h> #include <rtl/ustring.hxx> +#include <rtl/ref.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 +namespace chart { class BaseCoordinateSystem; } +namespace chart { class ChartType; } +namespace chart { class DataSource; } +namespace chart { class Diagram; } +namespace chart { class DataSeries; } +namespace chart { class ChartModel; } + +namespace chart::DataSeriesHelper { -OOO_DLLPUBLIC_CHARTTOOLS OUString - getRole( const css::uno::Reference<css::chart2::data::XLabeledDataSequence>& xLabeledDataSequence ); +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 @@ -56,7 +54,7 @@ OOO_DLLPUBLIC_CHARTTOOLS OUString @param aRole The role that is to be filtered out. */ -OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::chart2::data::XLabeledDataSequence > +css::uno::Reference< css::chart2::data::XLabeledDataSequence > getDataSequenceByRole( const css::uno::Reference< css::chart2::data::XDataSource > & xSource, const OUString& aRole, bool bMatchPrefix = false ); @@ -70,115 +68,55 @@ OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::chart2::data::XLabeledDataSeq @param aRole The role that is to be filtered out. */ -OOO_DLLPUBLIC_CHARTTOOLS std::vector< +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 ); +std::vector< + css::uno::Reference< css::chart2::data::XLabeledDataSequence > > + getAllDataSequencesByRole( const std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > & aDataSequences, + const OUString& aRole ); -OOO_DLLPUBLIC_CHARTTOOLS -std::vector<css::uno::Reference<css::chart2::data::XLabeledDataSequence> > +std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > getAllDataSequences( - const css::uno::Sequence<css::uno::Reference<css::chart2::XDataSeries> >& aSeries ); + const std::vector<rtl::Reference<::chart::DataSeries> >& 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 ); +rtl::Reference< ::chart::DataSource > + getDataSource( const std::vector< rtl::Reference< ::chart::DataSeries > > & aSeries ); -OOO_DLLPUBLIC_CHARTTOOLS void setStackModeAtSeries( - const css::uno::Sequence< css::uno::Reference< css::chart2::XDataSeries > > & aSeries, - const css::uno::Reference< css::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem, +void setStackModeAtSeries( + const std::vector< rtl::Reference< ::chart::DataSeries > > & aSeries, + const rtl::Reference< ::chart::BaseCoordinateSystem > & 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 getNumberFormatKeyFromAxis( + const rtl::Reference< ::chart::DataSeries > & xSeries, + const rtl::Reference< ::chart::BaseCoordinateSystem > & xCorrespondingCoordinateSystem, sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex = -1 ); -OOO_DLLPUBLIC_CHARTTOOLS -css::uno::Reference< css::chart2::XCoordinateSystem > +rtl::Reference< ::chart::BaseCoordinateSystem > getCoordinateSystemOfSeries( - const css::uno::Reference< css::chart2::XDataSeries > & xSeries, - const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + const rtl::Reference< ::chart::DataSeries > & xSeries, + const rtl::Reference< ::chart::Diagram > & xDiagram ); -OOO_DLLPUBLIC_CHARTTOOLS -css::uno::Reference< css::chart2::XChartType > +rtl::Reference< ::chart::ChartType > 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 ); + const rtl::Reference< ::chart::DataSeries > & xSeries, + const rtl::Reference< ::chart::Diagram > & xDiagram ); -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 ); +void insertDataLabelToPoint( const css::uno::Reference< css::beans::XPropertySet >& xPointPropertySet ); -} // namespace DataSeriesHelper -} // namespace chart +void deleteDataLabelsFromPoint( const css::uno::Reference< css::beans::XPropertySet >& xPointPropertySet ); -// INCLUDED_CHART2_SOURCE_INC_DATASERIESHELPER_HXX -#endif +} // namespace chart::DataSeriesHelper /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/chartview/chartviewdllapi.hxx b/chart2/source/inc/DataSeriesProperties.hxx index 2762104384f2..d0c19d07bf23 100644 --- a/chart2/source/inc/chartview/chartviewdllapi.hxx +++ b/chart2/source/inc/DataSeriesProperties.hxx @@ -16,20 +16,34 @@ * except in compliance with the License. You may obtain a copy of * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#pragma once -#ifndef INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_CHARTVIEWDLLAPI_HXX -#define INCLUDED_CHART2_SOURCE_INC_CHARTVIEW_CHARTVIEWDLLAPI_HXX +#include "PropertyHelper.hxx" +#include "FastPropertyIdRanges.hxx" -#include <sal/config.h> +#include <vector> -#include <sal/types.h> +namespace com::sun::star::beans { struct Property; } -#if defined OOO_DLLIMPLEMENTATION_CHARTVIEW -#define OOO_DLLPUBLIC_CHARTVIEW SAL_DLLPUBLIC_EXPORT -#else -#define OOO_DLLPUBLIC_CHARTVIEW SAL_DLLPUBLIC_IMPORT -#endif +namespace chart::DataSeriesProperties +{ + enum + { + PROP_DATASERIES_ATTRIBUTED_DATA_POINTS = FAST_PROPERTY_ID_START_DATA_SERIES, + PROP_DATASERIES_STACKING_DIRECTION, + PROP_DATASERIES_VARY_COLORS_BY_POINT, + PROP_DATASERIES_ATTACHED_AXIS_INDEX, + PROP_DATASERIES_SHOW_LEGEND_ENTRY, + PROP_DATASERIES_DELETED_LEGEND_ENTRIES, + PROP_DATASERIES_SHOW_CUSTOM_LEADERLINES, + PROP_DATASERIES_INVERT_NEGATIVE + }; -#endif + void AddPropertiesToVector( + std::vector< css::beans::Property > & rOutProperties ); + + void AddDefaultsToMap( tPropertyValueMap & rOutMap ); + +} // namespace chart /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/DataSource.hxx b/chart2/source/inc/DataSource.hxx index 6ad8bbffc409..f7f837d90b17 100644 --- a/chart2/source/inc/DataSource.hxx +++ b/chart2/source/inc/DataSource.hxx @@ -16,18 +16,19 @@ * 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 +#pragma once +#include <config_options.h> #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> +#include <vector> namespace chart { -class DataSource : public +class DataSource final : public ::cppu::WeakImplHelper< css::lang::XServiceInfo, css::chart2::data::XDataSource, @@ -37,6 +38,8 @@ public: explicit DataSource(); explicit DataSource( const css::uno::Sequence< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > & rSequences ); + explicit DataSource( + const std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence > > & rSequences ); virtual ~DataSource() override; @@ -45,7 +48,6 @@ public: 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; @@ -60,7 +62,4 @@ private: } // 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 index 5f159f6a5dac..a683c6a1c4b6 100644 --- a/chart2/source/inc/DataSourceHelper.hxx +++ b/chart2/source/inc/DataSourceHelper.hxx @@ -17,48 +17,44 @@ * 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 +#pragma once -#include "charttoolsdllapi.hxx" +#include <config_options.h> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Sequence.h> +#include <rtl/ref.hxx> 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 DataSource; +class Diagram; +class LabeledDataSequence; -class OOO_DLLPUBLIC_CHARTTOOLS DataSourceHelper +class 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 > + static rtl::Reference< LabeledDataSequence > 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 > + static rtl::Reference< LabeledDataSequence > createLabeledDataSequence( const css::uno::Reference< css::chart2::data::XDataSequence >& xValues ); - static css::uno::Reference< css::chart2::data::XLabeledDataSequence > + static rtl::Reference< LabeledDataSequence > createLabeledDataSequence(); static css::uno::Sequence< css::beans::PropertyValue > @@ -71,30 +67,24 @@ public: 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 + 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 ); + static rtl::Reference< ::chart::DataSource > + pressUsedDataIntoRectangularFormat( const rtl::Reference< ::chart::ChartModel >& xChartDoc ); - SAL_DLLPRIVATE static css::uno::Sequence< OUString > getUsedDataRanges( - const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + static std::vector< OUString > getUsedDataRanges( + const rtl::Reference< ::chart::Diagram > & xDiagram ); - static css::uno::Sequence< OUString > getUsedDataRanges( - const css::uno::Reference< css::frame::XModel > & xChartModel ); + static std::vector< OUString > getUsedDataRanges( + const rtl::Reference<::chart::ChartModel> & xChartModel ); - static css::uno::Reference< css::chart2::data::XDataSource > getUsedData( + static rtl::Reference< ::chart::DataSource > 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 + const rtl::Reference<::chart::ChartModel>& xChartModel , OUString& rOutRangeString , css::uno::Sequence< sal_Int32 >& rSequenceMapping , bool& rOutUseColumns @@ -102,7 +92,7 @@ public: , bool& rOutHasCategories ); static void setRangeSegmentation( - const css::uno::Reference< css::frame::XModel >& xChartModel + const rtl::Reference<::chart::ChartModel>& xChartModel , const css::uno::Sequence< sal_Int32 >& rSequenceMapping , bool bUseColumns , bool bFirstCellAsLabel @@ -116,19 +106,18 @@ public: HasCategories and FirstCellAsLabel. */ static bool allArgumentsForRectRangeDetected( - const css::uno::Reference< css::chart2::XChartDocument >& xChartDocument ); + const rtl::Reference<::chart::ChartModel>& xChartDocument ); - SAL_DLLPRIVATE static css::uno::Sequence< OUString > getRangesFromLabeledDataSequence( + static std::vector< OUString > getRangesFromLabeledDataSequence( const css::uno::Reference< css::chart2::data::XLabeledDataSequence > & xLSeq ); - SAL_DLLPRIVATE static OUString getRangeFromValues( + static OUString getRangeFromValues( const css::uno::Reference< css::chart2::data::XLabeledDataSequence > & xLSeq ); - SAL_DLLPRIVATE static css::uno::Sequence< OUString > getRangesFromDataSource( + static std::vector< 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/DataTable.hxx b/chart2/source/inc/DataTable.hxx new file mode 100644 index 000000000000..849c2303de60 --- /dev/null +++ b/chart2/source/inc/DataTable.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/. + */ + +#pragma once + +#include "OPropertySet.hxx" +#include <cppuhelper/implbase.hxx> +#include <comphelper/uno3.hxx> + +#include <com/sun/star/chart2/XDataTable.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include "ModifyListenerHelper.hxx" + +namespace chart +{ +typedef cppu::WeakImplHelper<css::chart2::XDataTable, css::lang::XServiceInfo, + css::util::XCloneable, css::util::XModifyBroadcaster, + css::util::XModifyListener> + DataTable_Base; + +/** Data table implementation */ +class DataTable final : public DataTable_Base, public ::property::OPropertySet +{ +public: + explicit DataTable(); + virtual ~DataTable() 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; + + /// merge XInterface implementations + DECLARE_XINTERFACE() + + /// merge XTypeProvider implementations + DECLARE_XTYPEPROVIDER() + + explicit DataTable(DataTable const& rOther); + +private: + // ____ OPropertySet ____ + virtual void GetDefaultValue(sal_Int32 nHandle, css::uno::Any& rAny) const override; + + // ____ OPropertySet ____ + virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; + +public: + // ____ XPropertySet ____ + virtual css::uno::Reference<css::beans::XPropertySetInfo> + SAL_CALL getPropertySetInfo() 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: + // ____ 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; + + // ____ OPropertySet ____ + virtual void firePropertyChangeEvent() override; + using OPropertySet::disposing; + + rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder; +}; + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/Diagram.hxx b/chart2/source/inc/Diagram.hxx new file mode 100644 index 000000000000..4945c7bde95b --- /dev/null +++ b/chart2/source/inc/Diagram.hxx @@ -0,0 +1,380 @@ +/* -*- 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 . + */ +#pragma once + +#include "OPropertySet.hxx" +#include <cppuhelper/implbase.hxx> +#include <comphelper/uno3.hxx> +#include <com/sun/star/chart2/XDiagram.hpp> +#include <com/sun/star/chart2/XCoordinateSystemContainer.hpp> +#include <com/sun/star/chart2/XTitled.hpp> +#include <com/sun/star/chart/X3DDefaultSetter.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include "ModifyListenerHelper.hxx" + +#include <vector> + +namespace com::sun::star::beans { struct PropertyValue; } +namespace com::sun::star::chart2 { class XDataSeries; } +namespace com::sun::star::chart2::data { class XDataSource; } +namespace com::sun::star::uno { class XComponentContext; } + +namespace chart +{ +class Axis; +class BaseCoordinateSystem; +class ChartType; +class ChartTypeManager; +class ChartTypeTemplate; +class DataSeries; +class Legend; +class DataTable; +class RegressionCurveModel; +enum class StackMode; +class Wall; +enum class ThreeDLookScheme; + +enum class DiagramPositioningMode +{ + Auto, Excluding, Including +}; + + +namespace impl +{ +typedef ::cppu::WeakImplHelper< + css::chart2::XDiagram, + css::lang::XServiceInfo, + css::chart2::XCoordinateSystemContainer, + css::chart2::XTitled, + css::chart::X3DDefaultSetter, + css::util::XModifyBroadcaster, + css::util::XModifyListener, + css::util::XCloneable > + Diagram_Base; +} + +class Diagram + final + : public impl::Diagram_Base + , public ::property::OPropertySet +{ +public: + Diagram( css::uno::Reference< css::uno::XComponentContext > xContext ); + virtual ~Diagram() 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; + + /// merge XInterface implementations + DECLARE_XINTERFACE() + /// merge XTypeProvider implementations + DECLARE_XTYPEPROVIDER() + + explicit Diagram( const Diagram & rOther ); + + // ____ OPropertySet ____ + virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override; + + // ____ OPropertySet ____ + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + // ____ XPropertySet ____ + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL + getPropertySetInfo() override; + + // ____ XFastPropertySet ____ + virtual void SAL_CALL setFastPropertyValue_NoBroadcast( sal_Int32 nHandle, const css::uno::Any& rValue ) override; + + /// make original interface function visible again + using ::com::sun::star::beans::XFastPropertySet::getFastPropertyValue; + + virtual void SAL_CALL getFastPropertyValue( + css::uno::Any& rValue, sal_Int32 nHandle ) const override; + + // ____ XDiagram ____ + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getWall() override; + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getFloor() override; + virtual css::uno::Reference< css::chart2::XLegend > SAL_CALL getLegend() override; + virtual void SAL_CALL setLegend( const css::uno::Reference< + css::chart2::XLegend >& xLegend ) override; + virtual css::uno::Reference< css::chart2::XColorScheme > SAL_CALL getDefaultColorScheme() override; + virtual void SAL_CALL setDefaultColorScheme( + const css::uno::Reference< css::chart2::XColorScheme >& xColorScheme ) override; + virtual void SAL_CALL setDiagramData( + const css::uno::Reference< css::chart2::data::XDataSource >& xDataSource, + const css::uno::Sequence< css::beans::PropertyValue >& aArguments ) override; + + virtual css::uno::Reference<css::chart2::XDataTable> SAL_CALL getDataTable() override; + virtual void SAL_CALL setDataTable(const css::uno::Reference<css::chart2::XDataTable>& xDataTable) override; + + // ____ XCoordinateSystemContainer ____ + virtual void SAL_CALL addCoordinateSystem( + const css::uno::Reference< css::chart2::XCoordinateSystem >& aCoordSys ) override; + virtual void SAL_CALL removeCoordinateSystem( + const css::uno::Reference< css::chart2::XCoordinateSystem >& aCoordSys ) override; + virtual css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > > SAL_CALL getCoordinateSystems() override; + virtual void SAL_CALL setCoordinateSystems( + const css::uno::Sequence< css::uno::Reference< css::chart2::XCoordinateSystem > >& aCoordinateSystems ) override; + + // ____ XTitled ____ + virtual css::uno::Reference< + css::chart2::XTitle > SAL_CALL getTitleObject() override; + virtual void SAL_CALL setTitleObject( const css::uno::Reference< + css::chart2::XTitle >& Title ) override; + + // ____ X3DDefaultSetter ____ + virtual void SAL_CALL set3DSettingsToDefault() override; + virtual void SAL_CALL setDefaultRotation() override; + virtual void SAL_CALL setDefaultIllumination() 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; + + typedef + std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > > + tCoordinateSystemContainerType; + + tCoordinateSystemContainerType getBaseCoordinateSystems() const; + void setCoordinateSystems( + const std::vector< rtl::Reference< ::chart::BaseCoordinateSystem > >& aCoordinateSystems ); + + rtl::Reference< ::chart::Legend > getLegend2() const; + void setLegend(const rtl::Reference< ::chart::Legend > &); + + void setDataTable(const rtl::Reference<::chart::DataTable>& xNewDataTable); + rtl::Reference<::chart::DataTable> getDataTableRef() const; + + DiagramPositioningMode getDiagramPositioningMode(); + + //returns integer from constant group css::chart::MissingValueTreatment + sal_Int32 getCorrectedMissingValueTreatment( + const rtl::Reference< ::chart::ChartType >& xChartType ); + + void setGeometry3D( sal_Int32 nNewGeometry ); + + sal_Int32 getGeometry3D( bool& rbFound, bool& rbAmbiguous ); + + bool isPieOrDonutChart(); + + bool isSupportingFloorAndWall(); + + /** + * 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. + * + */ + bool moveSeries( + const rtl::Reference< DataSeries >& xGivenDataSeries, + bool bForward ); + + /** + * 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. + * + */ + bool isSeriesMoveable( + const rtl::Reference< DataSeries >& xGivenDataSeries, + bool bForward ); + + std::vector< rtl::Reference< ChartType > > getChartTypes(); + + rtl::Reference< ChartType > getChartTypeByIndex( sal_Int32 nIndex ); + + bool isSupportingDateAxis(); + + css::uno::Reference< css::chart2::data::XLabeledDataSequence > + getCategories(); + + void setCategories( + const css::uno::Reference< css::chart2::data::XLabeledDataSequence >& xCategories, + bool bSetAxisType = false, // when this flag is true ... + bool bCategoryAxis = true);// set the AxisType to CATEGORY or back to REALNUMBER + + bool isCategory(); + + /** return all data series in this diagram grouped by chart-types + */ + std::vector< + std::vector< + rtl::Reference< ::chart::DataSeries > > > + getDataSeriesGroups(); + + std::vector< rtl::Reference< ::chart::DataSeries > > + getDataSeries(); + + rtl::Reference< ChartType > + getChartTypeOfSeries( const rtl::Reference< DataSeries >& xSeries ); + + rtl::Reference< ::chart::Axis > getAttachedAxis( + const rtl::Reference< ::chart::DataSeries >& xSeries ); + + bool attachSeriesToAxis( bool bMainAxis, + const rtl::Reference< DataSeries >& xSeries, + const css::uno::Reference< css::uno::XComponentContext > & xContext, + bool bAdaptAxes=true ); + + /** Replaces all occurrences of xCooSysToReplace in the tree with + xReplacement in the diagram's tree + */ + void replaceCoordinateSystem( + const rtl::Reference< ::chart::BaseCoordinateSystem > & xCooSysToReplace, + const rtl::Reference< ::chart::BaseCoordinateSystem > & xReplacement ); + + + /** Returns the dimension found for all chart types in the tree. If the + dimension is not unique, 0 is returned. + */ + sal_Int32 getDimension(); + + /** 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. + */ + void setDimension( sal_Int32 nNewDimensionCount ); + + + StackMode getStackMode(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) + */ + void setStackMode(StackMode eStackMode); + + + /** Sets the "SwapXAndYAxis" property at all coordinate systems found in the + given diagram. + + "vertical==true" for bar charts, "vertical==false" for column charts + */ + void setVertical( 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 + */ + bool getVertical( bool& rbOutFoundResult, bool& rbOutAmbiguousResult ); + + struct tTemplateWithServiceName { + rtl::Reference< ::chart::ChartTypeTemplate > xChartTypeTemplate; + OUString sServiceName; + }; + + /** tries to find a template in the chart-type manager that matches this + 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. + */ + tTemplateWithServiceName + getTemplate(const rtl::Reference< ::chart::ChartTypeManager > & xChartTypeManager); + + std::vector<rtl::Reference<::chart::RegressionCurveModel> > + getAllRegressionCurvesNotMeanValueLine(); + + double getCameraDistance(); + void setCameraDistance( double fCameraDistance ); + + void getRotation( + sal_Int32& rnHorizontalAngleDegree, sal_Int32& rnVerticalAngleDegree ); + void setRotation( + sal_Int32 nHorizontalAngleDegree, sal_Int32 nVerticalYAngleDegree ); + void getRotationAngle( + double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad ); + void setRotationAngle( + double fXAngleRad, double fYAngleRad, double fZAngleRad ); + + ThreeDLookScheme detectScheme(); + void setScheme( ThreeDLookScheme aScheme ); + + void setDefaultRotation( bool bPieOrDonut ); + + void switchRightAngledAxes( bool bRightAngledAxes ); + +private: + // ____ 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; + + // ____ OPropertySet ____ + virtual void firePropertyChangeEvent() override; + using OPropertySet::disposing; + + void fireModifyEvent(); + + css::uno::Reference<css::uno::XComponentContext> m_xContext; + tCoordinateSystemContainerType m_aCoordSystems; + + rtl::Reference<Wall> m_xWall; + rtl::Reference<Wall> m_xFloor; + + css::uno::Reference<css::chart2::XTitle> m_xTitle; + + rtl::Reference<::chart::Legend> m_xLegend; + rtl::Reference<::chart::DataTable> m_xDataTable; + css::uno::Reference<css::chart2::XColorScheme> m_xColorScheme; + rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder; + +}; + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/DiagramHelper.hxx b/chart2/source/inc/DiagramHelper.hxx index 3fcd9a0af2d3..10c9e6de5b2e 100644 --- a/chart2/source/inc/DiagramHelper.hxx +++ b/chart2/source/inc/DiagramHelper.hxx @@ -16,90 +16,26 @@ * 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 +#pragma once #include "StackMode.hxx" -#include "charttoolsdllapi.hxx" +#include "ChartTypeTemplate.hxx" #include <com/sun/star/awt/Rectangle.hpp> -#include <com/sun/star/chart2/XChartTypeTemplate.hpp> - -#include <utility> -#include <vector> +#include <rtl/ref.hxx> 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 { +class BaseCoordinateSystem; +class ChartType; +class DataSeries; -enum DiagramPositioningMode -{ - DiagramPositioningMode_AUTO, - DiagramPositioningMode_EXCLUDING, - DiagramPositioningMode_INCLUDING -}; - -class OOO_DLLPUBLIC_CHARTTOOLS DiagramHelper +class 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. @@ -111,93 +47,24 @@ public: "ambiguous") */ static StackMode getStackModeFromChartType( - const css::uno::Reference< css::chart2::XChartType > & xChartType, + const rtl::Reference< ::chart::ChartType > & xChartType, bool& rbFound, bool& rbAmbiguous, - const css::uno::Reference< css::chart2::XCoordinateSystem > & xCorrespondingCoordinateSystem + const rtl::Reference< ::chart::BaseCoordinateSystem > & 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 > + static css::uno::Sequence< OUString > generateAutomaticCategoriesFromCooSys( - const css::uno::Reference< css::chart2::XCoordinateSystem > & xCooSys ); + const rtl::Reference< ::chart::BaseCoordinateSystem > & xCooSys ); static void switchToDateCategories( - const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc ); + const rtl::Reference<::chart::ChartModel> & xChartDoc ); static void switchToTextCategories( - const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc ); + const rtl::Reference<::chart::ChartModel> & 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 ); @@ -205,81 +72,14 @@ public: 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 bool areChartTypesCompatible( + const rtl::Reference< ::chart::ChartType >& xFirstType, + const rtl::Reference< ::chart::ChartType >& xSecondType ); - 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, + static bool setDiagramPositioning( const rtl::Reference<::chart::ChartModel>& xChartModel, const css::awt::Rectangle& rPosRect /*100th mm*/ ); - static css::awt::Rectangle getDiagramRectangleFromModel( const css::uno::Reference< css::frame::XModel >& xChartModel ); + static css::awt::Rectangle getDiagramRectangleFromModel( const rtl::Reference<::chart::ChartModel>& xChartModel ); static bool switchDiagramPositioningToExcludingPositioning( ChartModel& rModel , bool bResetModifiedState //set model back to unchanged if it was unchanged before @@ -292,7 +92,4 @@ private: } // 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 index 9f02ca3f8ab4..e39c88760dcc 100644 --- a/chart2/source/inc/DisposeHelper.hxx +++ b/chart2/source/inc/DisposeHelper.hxx @@ -16,43 +16,43 @@ * 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 +#pragma once #include <com/sun/star/uno/Reference.h> #include <com/sun/star/lang/XComponent.hpp> -namespace chart +namespace chart::DisposeHelper { -namespace DisposeHelper -{ - -template<class T> -void Dispose(const T & xInterface) +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) +template <class T> void DisposeAndClear(css::uno::Reference<T>& rInterface) { Dispose<css::uno::Reference<T>>(rInterface); - rInterface.set(nullptr); + rInterface.clear(); } -template<class Container> -void DisposeAllElements(Container & rContainer) +template <class T> void DisposeAndClear(rtl::Reference<T>& rInterface) { - for (const auto & rElement : rContainer) + if (rInterface) { - Dispose<typename Container::value_type>(rElement); + rInterface->dispose(); + rInterface.clear(); } } -}} // namespace chart::DisposeHelper +template <class Container> void DisposeAllElements(Container& rContainer) +{ + for (const auto& rElement : rContainer) + { + Dispose<typename Container::value_type>(rElement); + } +} -#endif // INCLUDED_CHART2_SOURCE_INC_DISPOSEHELPER_HXX +} // namespace chart::DisposeHelper /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ErrorBar.hxx b/chart2/source/inc/ErrorBar.hxx index 6cd513ebc940..869b3e306fdc 100644 --- a/chart2/source/inc/ErrorBar.hxx +++ b/chart2/source/inc/ErrorBar.hxx @@ -16,11 +16,9 @@ * 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 +#pragma once -#include "MutexContainer.hxx" -#include "charttoolsdllapi.hxx" +#include <config_options.h> #include <cppuhelper/implbase.hxx> @@ -36,7 +34,7 @@ #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 "ModifyListenerHelper.hxx" #include <vector> @@ -58,9 +56,7 @@ typedef ::cppu::WeakImplHelper< ErrorBar_Base; } -class ErrorBar final : - public MutexContainer, - public impl::ErrorBar_Base +class ErrorBar final : public impl::ErrorBar_Base { private: OUString maDashName; @@ -78,7 +74,7 @@ private: sal_Int32 meStyle; public: - OOO_DLLPUBLIC_CHARTTOOLS explicit ErrorBar(); + explicit ErrorBar(); virtual ~ErrorBar() override; /// XServiceInfo declarations @@ -133,12 +129,9 @@ private: css::chart2::data::XLabeledDataSequence > > tDataSequenceContainer; tDataSequenceContainer m_aDataSequences; - css::uno::Reference< css::util::XModifyListener > m_xModifyEventForwarder; + rtl::Reference<ModifyEventForwarder> 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 index c40fdc49c1e2..dcf3256d46b5 100644 --- a/chart2/source/inc/EventListenerHelper.hxx +++ b/chart2/source/inc/EventListenerHelper.hxx @@ -16,12 +16,11 @@ * 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 +#pragma once #include <com/sun/star/lang/XComponent.hpp> -#include <algorithm> +#include <utility> namespace com::sun::star::lang { class XEventListener; } @@ -36,8 +35,8 @@ namespace impl template< class InterfaceRef > struct addListenerFunctor { - explicit addListenerFunctor( const css::uno::Reference< css::lang::XEventListener > & xListener ) : - m_xListener( xListener ) + explicit addListenerFunctor( css::uno::Reference< css::lang::XEventListener > xListener ) : + m_xListener(std::move( xListener )) {} void operator() ( const InterfaceRef & xObject ) @@ -54,8 +53,8 @@ private: template< class InterfaceRef > struct removeListenerFunctor { - explicit removeListenerFunctor( const css::uno::Reference< css::lang::XEventListener > & xListener ) : - m_xListener( xListener ) + explicit removeListenerFunctor( css::uno::Reference< css::lang::XEventListener > xListener ) : + m_xListener(std::move( xListener )) {} void operator() ( const InterfaceRef & xObject ) @@ -118,7 +117,4 @@ void removeListenerFromAllElements( } // 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 index 13c9a3605cc6..9e43abfc268e 100644 --- a/chart2/source/inc/ExplicitCategoriesProvider.hxx +++ b/chart2/source/inc/ExplicitCategoriesProvider.hxx @@ -16,31 +16,32 @@ * 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 +#pragma once -#include "charttoolsdllapi.hxx" -#include <cppuhelper/weakref.hxx> +#include <config_options.h> +#include <unotools/weakref.hxx> #include <com/sun/star/uno/Reference.h> #include <com/sun/star/uno/Sequence.h> +#include <utility> #include <vector> namespace chart { class ChartModel; } -namespace com::sun::star::chart2 { class XCoordinateSystem; } +namespace com::sun::star::chart2::data { class XDataProvider; } 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 { +class BaseCoordinateSystem; -struct OOO_DLLPUBLIC_CHARTTOOLS ComplexCategory +struct ComplexCategory { OUString Text; sal_Int32 Count; - ComplexCategory( const OUString& rText, sal_Int32 nCount ) : Text( rText ), Count (nCount) + ComplexCategory( OUString aText, sal_Int32 nCount ) : Text(std::move( aText )), Count (nCount) {} }; @@ -53,10 +54,10 @@ public: virtual css::uno::Sequence< OUString > getStringsForLevel( sal_Int32 nIndex ) const = 0; }; -class OOO_DLLPUBLIC_CHARTTOOLS ExplicitCategoriesProvider final +class ExplicitCategoriesProvider final { public: - ExplicitCategoriesProvider( const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSysModel + ExplicitCategoriesProvider( const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSysModel , ChartModel& rChartModel ); ~ExplicitCategoriesProvider(); @@ -69,7 +70,7 @@ public: const std::vector<ComplexCategory>* getCategoriesByLevel( sal_Int32 nLevel ); static OUString getCategoryByIndex( - const css::uno::Reference< css::chart2::XCoordinateSystem >& xCooSysModel + const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSysModel , ChartModel& rModel , sal_Int32 nIndex ); @@ -83,8 +84,8 @@ public: bool hasComplexCategories() const; sal_Int32 getCategoryLevelCount() const; - const css::uno::Sequence< css::uno::Reference< - css::chart2::data::XLabeledDataSequence> >& getSplitCategoriesList() const { return m_aSplitCategoriesList;} + const std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence> >& + getSplitCategoriesList() const { return m_aSplitCategoriesList;} bool isDateAxis(); const std::vector< double >& getDateCategories(); @@ -93,16 +94,17 @@ private: ExplicitCategoriesProvider(ExplicitCategoriesProvider const &) = delete; ExplicitCategoriesProvider& operator =(ExplicitCategoriesProvider const &) = delete; + void implInitSplit(); + bool volatile m_bDirty; - css::uno::WeakReference< css::chart2::XCoordinateSystem > m_xCooSysModel; + unotools::WeakReference< ::chart::BaseCoordinateSystem > 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; + std::vector< css::uno::Reference< css::chart2::data::XLabeledDataSequence> > m_aSplitCategoriesList; bool m_bIsDateAxis; bool m_bIsAutoDate; @@ -111,7 +113,4 @@ private: } // 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 index ba08bb13dfd1..c929ac80cd73 100644 --- a/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx +++ b/chart2/source/inc/ExponentialRegressionCurveCalculator.hxx @@ -16,15 +16,14 @@ * 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 +#pragma once #include "RegressionCurveCalculator.hxx" namespace chart { -class ExponentialRegressionCurveCalculator : public RegressionCurveCalculator +class ExponentialRegressionCurveCalculator final : public RegressionCurveCalculator { public: ExponentialRegressionCurveCalculator(); @@ -60,7 +59,4 @@ private: } // 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 index a2572c5117fc..d06809e44c1f 100644 --- a/chart2/source/inc/FastPropertyIdRanges.hxx +++ b/chart2/source/inc/FastPropertyIdRanges.hxx @@ -16,24 +16,22 @@ * 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 +#pragma once 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_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, @@ -45,7 +43,4 @@ enum FastPropertyIdRanges } // 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 index 65a7b221e517..c76ee51d1a2f 100644 --- a/chart2/source/inc/FillProperties.hxx +++ b/chart2/source/inc/FillProperties.hxx @@ -16,12 +16,10 @@ * 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 +#pragma once #include "PropertyHelper.hxx" #include "FastPropertyIdRanges.hxx" -#include "charttoolsdllapi.hxx" #include <vector> @@ -64,15 +62,12 @@ namespace FillProperties , PROP_FILL_BACKGROUND }; - OOO_DLLPUBLIC_CHARTTOOLS void AddPropertiesToVector( + void AddPropertiesToVector( std::vector< css::beans::Property > & rOutProperties ); - OOO_DLLPUBLIC_CHARTTOOLS void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ); + 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/FormattedString.hxx b/chart2/source/inc/FormattedString.hxx new file mode 100644 index 000000000000..cf3c68dd0a56 --- /dev/null +++ b/chart2/source/inc/FormattedString.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 . + */ +#pragma once + +#include "OPropertySet.hxx" +#include <cppuhelper/implbase.hxx> +#include <comphelper/uno3.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/chart2/XDataPointCustomLabelField.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include "ModifyListenerHelper.hxx" +#include "PropertyHelper.hxx" + +namespace chart +{ + +namespace impl +{ +typedef ::cppu::WeakImplHelper< + css::chart2::XDataPointCustomLabelField, // inherits from XFormattedString2 + css::lang::XServiceInfo, + css::util::XCloneable, + css::util::XModifyBroadcaster, + css::util::XModifyListener > + FormattedString_Base; +} + +class FormattedString final : + public impl::FormattedString_Base, + public ::property::OPropertySet +{ +public: + explicit FormattedString(); + virtual ~FormattedString() 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() + + virtual void SAL_CALL setPropertyValue(const OUString& p1, const css::uno::Any& p2) override + { ::property::OPropertySet::setPropertyValue(p1, p2); } + virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& p1) override + { return ::property::OPropertySet::getPropertyValue(p1); } + virtual void SAL_CALL addPropertyChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XPropertyChangeListener>& p2) override + { ::property::OPropertySet::addPropertyChangeListener(p1, p2); } + virtual void SAL_CALL removePropertyChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XPropertyChangeListener>& p2) override + { ::property::OPropertySet::removePropertyChangeListener(p1, p2); } + virtual void SAL_CALL addVetoableChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2) override + { ::property::OPropertySet::addVetoableChangeListener(p1, p2); } + virtual void SAL_CALL removeVetoableChangeListener(const OUString& p1, const css::uno::Reference<css::beans::XVetoableChangeListener>& p2) override + { ::property::OPropertySet::removeVetoableChangeListener(p1, p2); } + + explicit FormattedString( const FormattedString & rOther ); + + // ____ XFormattedString ____ + virtual OUString SAL_CALL getString() override; + virtual void SAL_CALL setString( const OUString& String ) override; + + // ____ XDataPointCustomLabelField ____ + virtual css::chart2::DataPointCustomLabelFieldType SAL_CALL getFieldType() override; + virtual void SAL_CALL + setFieldType( const css::chart2::DataPointCustomLabelFieldType FieldType ) override; + virtual OUString SAL_CALL getGuid() override; + void SAL_CALL setGuid( const OUString& guid ) override; + virtual sal_Bool SAL_CALL getDataLabelsRange() override; + virtual void SAL_CALL setDataLabelsRange( sal_Bool dataLabelsRange ) override; + virtual OUString SAL_CALL getCellRange() override; + virtual void SAL_CALL setCellRange( const OUString& cellRange ) override; + + // ____ OPropertySet ____ + virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override; + + // ____ OPropertySet ____ + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + // ____ XPropertySet ____ + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL + getPropertySetInfo() 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; + + // ____ 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; + +private: + // ____ OPropertySet ____ + virtual void firePropertyChangeEvent() override; + using OPropertySet::disposing; + + void fireModifyEvent(); + + // ____ XFormattedString ____ + OUString m_aString; + + // ____ XDataPointCustomLabelField ____ + css::chart2::DataPointCustomLabelFieldType m_aType; + OUString m_aGuid; + OUString m_aCellRange; + bool m_bDataLabelsRange; + + rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder; +}; + +const ::chart::tPropertyValueMap & StaticFormattedStringDefaults(); + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/FormattedStringHelper.hxx b/chart2/source/inc/FormattedStringHelper.hxx index 9953de31aff5..31706b55ffc1 100644 --- a/chart2/source/inc/FormattedStringHelper.hxx +++ b/chart2/source/inc/FormattedStringHelper.hxx @@ -16,31 +16,27 @@ * 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 +#pragma once -#include <com/sun/star/uno/Sequence.h> +#include <rtl/ref.hxx> +#include <rtl/ustring.hxx> 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 FormattedString; 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(); + static rtl::Reference< ::chart::FormattedString > + createFormattedString( + const OUString & rString + , const css::uno::Reference< css::beans::XPropertySet > & xTextProperties ) noexcept; }; } //namespace chart -#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/GridProperties.hxx b/chart2/source/inc/GridProperties.hxx new file mode 100644 index 000000000000..05108f739473 --- /dev/null +++ b/chart2/source/inc/GridProperties.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 . + */ +#pragma once + +#include <cppuhelper/implbase.hxx> +#include <comphelper/uno3.hxx> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include "ModifyListenerHelper.hxx" + +#include "OPropertySet.hxx" + +namespace chart +{ + +namespace impl +{ +typedef ::cppu::WeakImplHelper< + css::lang::XServiceInfo, + css::util::XCloneable, + css::util::XModifyBroadcaster, + css::util::XModifyListener > + GridProperties_Base; +} + +class GridProperties final : + public impl::GridProperties_Base, + public ::property::OPropertySet +{ +public: + explicit GridProperties(); + explicit GridProperties( const GridProperties & rOther ); + virtual ~GridProperties() 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; + + /// merge XInterface implementations + DECLARE_XINTERFACE() + /// merge XTypeProvider implementations + DECLARE_XTYPEPROVIDER() + + // ____ OPropertySet ____ + virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override; + + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + // ____ XPropertySet ____ + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL + getPropertySetInfo() 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: + + // ____ 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; + + // ____ OPropertySet ____ + virtual void firePropertyChangeEvent() override; + using OPropertySet::disposing; + + rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder; +}; + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/HistogramDataSequence.hxx b/chart2/source/inc/HistogramDataSequence.hxx new file mode 100644 index 000000000000..3a8ac0233476 --- /dev/null +++ b/chart2/source/inc/HistogramDataSequence.hxx @@ -0,0 +1,104 @@ +/* -*- 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/. + */ + +#pragma once + +// helper classes +#include <comphelper/compbase.hxx> +#include <comphelper/uno3.hxx> +#include <comphelper/broadcasthelper.hxx> +#include <comphelper/propertycontainer2.hxx> +#include <comphelper/proparrhlp.hxx> +#include <rtl/ref.hxx> + +#include "ModifyListenerHelper.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/util/XCloneable.hpp> +#include <com/sun/star/util/XModifiable.hpp> + +namespace chart +{ +typedef ::comphelper::WeakComponentImplHelper< + css::chart2::data::XDataSequence, css::chart2::data::XNumericalDataSequence, + css::chart2::data::XTextualDataSequence, css::util::XCloneable, css::util::XModifyBroadcaster, + css::lang::XServiceInfo> + HistogramDataSequence_Base; + +class HistogramDataSequence final + : public HistogramDataSequence_Base, + public ::comphelper::OPropertyContainer2, + public ::comphelper::OPropertyArrayUsageHelper<HistogramDataSequence> +{ +public: + HistogramDataSequence(); + virtual ~HistogramDataSequence() override; + + /// declare XServiceInfo methods + OUString SAL_CALL getImplementationName() override; + sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; + + /// merge XInterface implementations + DECLARE_XINTERFACE() + + /// merge XTypeProvider implementations + DECLARE_XTYPEPROVIDER() + + // XPropertySet + /// @see css::beans::XPropertySet + virtual css::uno::Reference<css::beans::XPropertySetInfo> + SAL_CALL getPropertySetInfo() override; + /// @see ::comphelper::OPropertySetHelper + virtual ::cppu::IPropertyArrayHelper& getInfoHelper() override; + /// @see ::comphelper::OPropertyArrayUsageHelper + virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; + + // XDataSequence + css::uno::Sequence<css::uno::Any> SAL_CALL getData() override; + OUString SAL_CALL getSourceRangeRepresentation() override; + css::uno::Sequence<OUString> + SAL_CALL generateLabel(css::chart2::data::LabelOrigin nLabelOrigin) override; + 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; + + void setLabels(css::uno::Sequence<OUString> const& xLabels) { mxLabels = xLabels; } + + void setValues(css::uno::Sequence<double> const& xValues) { mxValues = xValues; } + +private: + rtl::Reference<chart::ModifyEventForwarder> m_xModifyEventForwarder; + OUString m_sRole; + css::uno::Sequence<OUString> mxLabels; + css::uno::Sequence<double> mxValues; +}; + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/InternalData.hxx b/chart2/source/inc/InternalData.hxx index 25ed60606d74..1d52df4566c7 100644 --- a/chart2/source/inc/InternalData.hxx +++ b/chart2/source/inc/InternalData.hxx @@ -16,8 +16,7 @@ * 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 +#pragma once #include <com/sun/star/uno/Sequence.hxx> @@ -43,8 +42,9 @@ public: 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 ); + void setComplexColumnLabel( sal_Int32 nColumnIndex, std::vector< css::uno::Any >&& rComplexLabel ); + void setComplexRowLabel( sal_Int32 nRowIndex, std::vector< css::uno::Any >&& rComplexLabel ); + void setComplexCategoryLabel( sal_Int32 nRowIndex, 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; @@ -67,9 +67,9 @@ public: typedef std::vector< std::vector< css::uno::Any > > tVecVecAny; //inner index is hierarchical level - void setComplexRowLabels( const tVecVecAny& rNewRowLabels ); + void setComplexRowLabels( tVecVecAny&& rNewRowLabels ); const tVecVecAny& getComplexRowLabels() const; - void setComplexColumnLabels( const tVecVecAny& rNewColumnLabels ); + void setComplexColumnLabels( tVecVecAny&& rNewColumnLabels ); const tVecVecAny& getComplexColumnLabels() const; void dump() const; @@ -92,8 +92,6 @@ private: 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 index 7c3491ae17e6..26a759c56865 100644 --- a/chart2/source/inc/InternalDataProvider.hxx +++ b/chart2/source/inc/InternalDataProvider.hxx @@ -16,10 +16,10 @@ * 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 +#pragma once #include "InternalData.hxx" +#include <ChartModel.hxx> #include <com/sun/star/lang/XServiceInfo.hpp> #include <com/sun/star/chart/XDateCategories.hpp> @@ -30,6 +30,8 @@ #include <com/sun/star/util/XCloneable.hpp> #include <cppuhelper/implbase.hxx> #include <cppuhelper/weakref.hxx> +#include <rtl/ref.hxx> +#include <unotools/weakref.hxx> #include <map> @@ -37,6 +39,8 @@ namespace com::sun::star::chart2 { class XChartDocument; } namespace chart { +class ChartModel; +class UncachedDataSequence; namespace impl { @@ -62,7 +66,7 @@ typedef ::cppu::WeakImplHelper< <p>The format for a complete range is "all". (Do we need more than that?)</p> */ -class InternalDataProvider : +class InternalDataProvider final : public impl::InternalDataProvider_Base { public: @@ -71,7 +75,7 @@ public: // #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, + const rtl::Reference< ::chart::ChartModel > & xChartDoc, bool bConnectToModel, bool bDefaultDataInColumns ); explicit InternalDataProvider( const InternalDataProvider & rOther ); @@ -99,6 +103,7 @@ public: virtual void SAL_CALL swapDataPointWithNextOneForAllSequences( ::sal_Int32 nAtIndex ) override; virtual void SAL_CALL registerDataSequenceForChanges( const css::uno::Reference< css::chart2::data::XDataSequence >& xSeq ) override; + virtual void SAL_CALL insertDataSeries( ::sal_Int32 nAfterIndex ) override; // ____ XDataProvider (base of XInternalDataProvider) ____ virtual sal_Bool SAL_CALL createDataSourcePossible( @@ -113,7 +118,8 @@ public: const OUString& aRangeRepresentation ) override; virtual css::uno::Reference<css::chart2::data::XDataSequence> SAL_CALL - createDataSequenceByValueArray( const OUString& aRole, const OUString& aRangeRepresentation ) override; + createDataSequenceByValueArray( const OUString& aRole, const OUString& aRangeRepresentation, + const OUString& aRoleQualifier ) override; virtual css::uno::Reference< css::sheet::XRangeSelection > SAL_CALL getRangeSelection() override; @@ -172,6 +178,8 @@ public: // css::lang::XInitialization: virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > & aArguments) override; + void setChartModel(ChartModel* pChartModel); + private: void addDataSequenceToMap( const OUString & rRangeRepresentation, @@ -180,11 +188,12 @@ private: css::uno::Reference< css::chart2::data::XDataSequence > createDataSequenceAndAddToMap( const OUString & rRangeRepresentation, const OUString & rRole ); - css::uno::Reference< css::chart2::data::XDataSequence > + rtl::Reference< UncachedDataSequence > createDataSequenceAndAddToMap( const OUString & rRangeRepresentation ); - css::uno::Reference<css::chart2::data::XDataSequence> - createDataSequenceFromArray( const OUString& rArrayStr, const OUString& rRole ); + rtl::Reference<UncachedDataSequence> + createDataSequenceFromArray( const OUString& rArrayStr, std::u16string_view rRole, + std::u16string_view rRoleQualifier); void deleteMapReferences( const OUString & rRangeRepresentation ); @@ -209,11 +218,11 @@ private: tSequenceMap m_aSequenceMap; InternalData m_aInternalData; bool m_bDataInColumns; + + // keep a weak reference to the owning m_xChartModel for insertDataSeries + unotools::WeakReference<ChartModel> m_xChartModel; }; } // 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 index dd99ac8479b5..c36f1918cfa5 100644 --- a/chart2/source/inc/LabeledDataSequence.hxx +++ b/chart2/source/inc/LabeledDataSequence.hxx @@ -16,14 +16,14 @@ * 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 +#pragma once -#include "MutexContainer.hxx" +#include <config_options.h> #include <cppuhelper/implbase.hxx> #include <com/sun/star/chart2/data/XLabeledDataSequence2.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> +#include "ModifyListenerHelper.hxx" namespace com::sun::star::chart2::data { class XDataSequence; } namespace com::sun::star::util { class XCloneable; } @@ -40,17 +40,17 @@ typedef cppu::WeakImplHelper< LabeledDataSequence_Base; } -class LabeledDataSequence : - public MutexContainer, +class LabeledDataSequence final : public impl::LabeledDataSequence_Base { public: explicit LabeledDataSequence(); + explicit LabeledDataSequence(const LabeledDataSequence &); explicit LabeledDataSequence( - const css::uno::Reference< css::chart2::data::XDataSequence > & rValues ); + css::uno::Reference< css::chart2::data::XDataSequence > xValues ); explicit LabeledDataSequence( - const css::uno::Reference< css::chart2::data::XDataSequence > & rValues, - const css::uno::Reference< css::chart2::data::XDataSequence > & rLabels ); + css::uno::Reference< css::chart2::data::XDataSequence > xValues, + css::uno::Reference< css::chart2::data::XDataSequence > xLabels ); virtual ~LabeledDataSequence() override; @@ -59,7 +59,6 @@ public: 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( @@ -81,12 +80,9 @@ 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; + rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder; }; } // namespace chart -// INCLUDED_CHART2_SOURCE_INC_LABELEDDATASEQUENCE_HXX -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/Legend.hxx b/chart2/source/inc/Legend.hxx new file mode 100644 index 000000000000..7927f20fcc3b --- /dev/null +++ b/chart2/source/inc/Legend.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 . + */ +#pragma once + +#include "OPropertySet.hxx" +#include <cppuhelper/implbase.hxx> +#include <comphelper/uno3.hxx> +#include <com/sun/star/chart2/XLegend.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include "ModifyListenerHelper.hxx" +#include "PropertyHelper.hxx" + +namespace chart +{ + +namespace impl +{ +typedef ::cppu::WeakImplHelper< + css::chart2::XLegend, + css::lang::XServiceInfo, + css::util::XCloneable, + css::util::XModifyBroadcaster, + css::util::XModifyListener > + Legend_Base; +} + +class Legend final : + public impl::Legend_Base, + public ::property::OPropertySet +{ +public: + explicit Legend(); + virtual ~Legend() 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; + + /// merge XInterface implementations + DECLARE_XINTERFACE() + /// merge XTypeProvider implementations + DECLARE_XTYPEPROVIDER() + + explicit Legend( const Legend & rOther ); + +private: + // ____ OPropertySet ____ + virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override; + + // ____ OPropertySet ____ + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + +public: + // ____ XPropertySet ____ + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL + getPropertySetInfo() 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: + // ____ 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; + + // ____ OPropertySet ____ + virtual void firePropertyChangeEvent() override; + using OPropertySet::disposing; + + rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder; +}; + +const ::chart::tPropertyValueMap& StaticLegendDefaults(); + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/LegendHelper.hxx b/chart2/source/inc/LegendHelper.hxx index 75064f594eb6..577047888ee8 100644 --- a/chart2/source/inc/LegendHelper.hxx +++ b/chart2/source/inc/LegendHelper.hxx @@ -16,30 +16,30 @@ * 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 +#pragma once +#include <config_options.h> #include <com/sun/star/uno/Reference.hxx> -#include "charttoolsdllapi.hxx" +#include <rtl/ref.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 Diagram; +class Legend; -class OOO_DLLPUBLIC_CHARTTOOLS LegendHelper +class LegendHelper { public: - static css::uno::Reference< css::chart2::XLegend > + static rtl::Reference< ::chart::Legend > showLegend( ChartModel& rModel , const css::uno::Reference< css::uno::XComponentContext >& xContext ); static void hideLegend( ChartModel& rModel ); - static css::uno::Reference< css::chart2::XLegend > + static rtl::Reference< ::chart::Legend > getLegend( ChartModel& rModel , const css::uno::Reference< css::uno::XComponentContext >& xContext = nullptr , bool bCreate = false ); @@ -48,10 +48,9 @@ public: 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 ); + static bool hasLegend( const rtl::Reference< ::chart::Diagram > & 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 index ca1e583f9835..1e3e2cee26ab 100644 --- a/chart2/source/inc/LifeTime.hxx +++ b/chart2/source/inc/LifeTime.hxx @@ -16,27 +16,28 @@ * 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 +#pragma once -#include <osl/mutex.hxx> +#include <config_options.h> +#include <mutex> #include <osl/conditn.hxx> -#include <cppuhelper/interfacecontainer.h> -#include "charttoolsdllapi.hxx" +#include <comphelper/interfacecontainer4.hxx> +namespace com::sun::star::document { class XStorageChangeListener; } namespace com::sun::star::lang { class XComponent; } +namespace com::sun::star::lang { class XEventListener; } namespace com::sun::star::util { class CloseVetoException; } namespace com::sun::star::util { class XCloseListener; } namespace com::sun::star::util { class XCloseable; } +namespace com::sun::star::util { class XModifyListener; } +namespace com::sun::star::view { class XSelectionChangeListener; } namespace apphelper { -class OOO_DLLPUBLIC_CHARTTOOLS LifeTimeManager +class LifeTimeManager { friend class LifeTimeGuard; -protected: - mutable ::osl::Mutex m_aAccessMutex; public: LifeTimeManager( css::lang::XComponent* pComponent ); virtual ~LifeTimeManager(); @@ -45,25 +46,25 @@ public: /// @throws css::uno::RuntimeException bool dispose(); -public: - ::cppu::OMultiTypeInterfaceContainerHelper m_aListenerContainer; + mutable std::mutex m_aAccessMutex; + ::comphelper::OInterfaceContainerHelper4<css::util::XCloseListener> m_aCloseListeners; + ::comphelper::OInterfaceContainerHelper4<css::util::XModifyListener> m_aModifyListeners; + ::comphelper::OInterfaceContainerHelper4<css::document::XStorageChangeListener> m_aStorageChangeListeners; + ::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListeners; + ::comphelper::OInterfaceContainerHelper4<css::view::XSelectionChangeListener> m_aSelectionChangeListeners; protected: - SAL_DLLPRIVATE virtual bool impl_canStartApiCall(); - SAL_DLLPRIVATE virtual void impl_apiCallCountReachedNull(){} + virtual bool impl_canStartApiCall(); + virtual void impl_apiCallCountReachedNull(std::unique_lock<std::mutex>& /*rGuard*/){} - SAL_DLLPRIVATE void impl_registerApiCall(bool bLongLastingCall); - SAL_DLLPRIVATE void impl_unregisterApiCall(bool bLongLastingCall); + void impl_registerApiCall(bool bLongLastingCall); + void impl_unregisterApiCall(std::unique_lock<std::mutex>& rGuard, 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; }; @@ -73,12 +74,12 @@ class CloseableLifeTimeManager final : public LifeTimeManager css::util::XCloseable* m_pCloseable; ::osl::Condition m_aEndTryClosingCondition; - bool volatile m_bClosed; - bool volatile m_bInTryClose; + bool m_bClosed; + bool 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; + bool m_bOwnership; public: CloseableLifeTimeManager( css::util::XCloseable* pCloseable @@ -90,17 +91,16 @@ public: 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(); 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; + virtual void impl_apiCallCountReachedNull(std::unique_lock<std::mutex>& rGuard) override; - void impl_setOwnership( bool bDeliverOwnership, bool bMyVeto ); - void impl_doClose(); + void impl_doClose(std::unique_lock<std::mutex>& rGuard); }; /* @@ -179,10 +179,10 @@ public: } bool startApiCall(bool bLongLastingCall=false); ~LifeTimeGuard(); - void clear() { m_guard.clear(); } + void clear() { m_guard.unlock(); } private: - osl::ClearableMutexGuard m_guard; + std::unique_lock<std::mutex> m_guard; LifeTimeManager& m_rManager; bool m_bCallRegistered; bool m_bLongLastingCallRegistered; @@ -192,24 +192,6 @@ private: 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 index 11c56b186eaf..d664273916b3 100644 --- a/chart2/source/inc/LinePropertiesHelper.hxx +++ b/chart2/source/inc/LinePropertiesHelper.hxx @@ -16,12 +16,10 @@ * 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 +#pragma once #include "PropertyHelper.hxx" #include "FastPropertyIdRanges.hxx" -#include "charttoolsdllapi.hxx" #include <vector> @@ -45,13 +43,14 @@ namespace LinePropertiesHelper PROP_LINE_COLOR, PROP_LINE_TRANSPARENCE, PROP_LINE_WIDTH, - PROP_LINE_JOINT + PROP_LINE_JOINT, + PROP_LINE_CAP }; - OOO_DLLPUBLIC_CHARTTOOLS void AddPropertiesToVector( + void AddPropertiesToVector( std::vector< css::beans::Property > & rOutProperties ); - OOO_DLLPUBLIC_CHARTTOOLS void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ); + void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ); bool IsLineVisible( const css::uno::Reference< css::beans::XPropertySet >& xLineProperties ); @@ -65,7 +64,4 @@ namespace LinePropertiesHelper } // 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 index 24d82d1ecf5d..05853b26a8f5 100644 --- a/chart2/source/inc/LinearRegressionCurveCalculator.hxx +++ b/chart2/source/inc/LinearRegressionCurveCalculator.hxx @@ -16,15 +16,14 @@ * 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 +#pragma once #include "PolynomialRegressionCurveCalculator.hxx" namespace chart { -class LinearRegressionCurveCalculator : public PolynomialRegressionCurveCalculator +class LinearRegressionCurveCalculator final : public PolynomialRegressionCurveCalculator { public: LinearRegressionCurveCalculator(); @@ -35,7 +34,8 @@ private: sal_Int32 aDegree, sal_Bool aForceIntercept, double aInterceptValue, - sal_Int32 aPeriod) override; + sal_Int32 aPeriod, + sal_Int32 nMovingType) override; virtual css::uno::Sequence<css::geometry::RealPoint2D> SAL_CALL getCurveValues( double min, @@ -48,7 +48,4 @@ private: } // 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 index 522756afe139..02fa1fc22bc0 100644 --- a/chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx +++ b/chart2/source/inc/LogarithmicRegressionCurveCalculator.hxx @@ -16,15 +16,14 @@ * 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 +#pragma once #include "RegressionCurveCalculator.hxx" namespace chart { -class LogarithmicRegressionCurveCalculator : public RegressionCurveCalculator +class LogarithmicRegressionCurveCalculator final : public RegressionCurveCalculator { public: LogarithmicRegressionCurveCalculator(); @@ -58,7 +57,4 @@ private: } // 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 index 7c947bec4d8c..be46e973887d 100644 --- a/chart2/source/inc/MeanValueRegressionCurveCalculator.hxx +++ b/chart2/source/inc/MeanValueRegressionCurveCalculator.hxx @@ -16,15 +16,14 @@ * 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 +#pragma once #include "RegressionCurveCalculator.hxx" namespace chart { -class MeanValueRegressionCurveCalculator : public RegressionCurveCalculator +class MeanValueRegressionCurveCalculator final : public RegressionCurveCalculator { public: MeanValueRegressionCurveCalculator(); @@ -57,7 +56,4 @@ private: } // 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 index f44d5d1d038f..49893e543241 100644 --- a/chart2/source/inc/MediaDescriptorHelper.hxx +++ b/chart2/source/inc/MediaDescriptorHelper.hxx @@ -16,13 +16,12 @@ * 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 +#pragma once +#include <config_options.h> #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; } @@ -44,7 +43,7 @@ namespace com::sun::star::io { class XStream; } namespace apphelper { -class OOO_DLLPUBLIC_CHARTTOOLS MediaDescriptorHelper final +class MediaDescriptorHelper final { public: MediaDescriptorHelper( const css::uno::Sequence< css::beans::PropertyValue > & rMediaDescriptor ); @@ -83,11 +82,9 @@ public: bool ISSET_Stream; private: - SAL_DLLPRIVATE void impl_init(); + void impl_init(); }; } -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ModifyListenerCallBack.hxx b/chart2/source/inc/ModifyListenerCallBack.hxx new file mode 100644 index 000000000000..433512bb8244 --- /dev/null +++ b/chart2/source/inc/ModifyListenerCallBack.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 . + */ + +#pragma once + +#include <config_options.h> +#include <tools/link.hxx> +#include <com/sun/star/util/XModifyBroadcaster.hpp> +#include <com/sun/star/util/XModifyListener.hpp> + +namespace chart +{ +/** Use this class as a member if you want to listen on a XModifyBroadcaster +without becoming a XModifyListener yourself + */ + +class ModifyListenerCallBack_impl; + +class ModifyListenerCallBack final +{ +public: + explicit ModifyListenerCallBack(const Link<void*, void>& rCallBack); + + ~ModifyListenerCallBack(); + + void startListening(const css::uno::Reference<css::util::XModifyBroadcaster>& xBroadcaster); + void stopListening(); + +private: //methods + ModifyListenerCallBack(const ModifyListenerCallBack&) = delete; + +private: //member + ModifyListenerCallBack_impl* pModifyListener_impl; + css::uno::Reference<css::util::XModifyListener> m_xModifyListener; +}; + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ModifyListenerHelper.hxx b/chart2/source/inc/ModifyListenerHelper.hxx index 29c4106f538f..ee90d407a66f 100644 --- a/chart2/source/inc/ModifyListenerHelper.hxx +++ b/chart2/source/inc/ModifyListenerHelper.hxx @@ -16,52 +16,33 @@ * 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 +#pragma once #include <com/sun/star/util/XModifyListener.hpp> #include <com/sun/star/util/XModifyBroadcaster.hpp> -#include <cppuhelper/compbase.hxx> +#include <comphelper/interfacecontainer4.hxx> +#include <comphelper/compbase.hxx> +#include <rtl/ref.hxx> -#include "MutexContainer.hxx" - -#include <vector> +#include <mutex> #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< +class ModifyEventForwarder final : + public ::comphelper::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; @@ -72,29 +53,21 @@ protected: virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override; +private: // ____ 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 ); + virtual void disposing(std::unique_lock<std::mutex>& ) override; -// ::osl::Mutex & m_rMutex; - ::cppu::OBroadcastHelper m_aModifyListeners; + comphelper::OInterfaceContainerHelper4<css::util::XModifyListener> m_aModifyListeners; +}; - typedef std::vector< - std::pair< - css::uno::WeakReference< css::util::XModifyListener >, - css::uno::Reference< css::util::XModifyListener > > > - tListenerMap; +} - tListenerMap m_aListenerMap; -}; +namespace chart::ModifyListenerHelper +{ namespace impl { @@ -102,8 +75,8 @@ namespace impl template< class InterfaceRef > struct addListenerFunctor { - explicit addListenerFunctor( const css::uno::Reference< css::util::XModifyListener > & xListener ) : - m_xListener( xListener ) + explicit addListenerFunctor( css::uno::Reference< css::util::XModifyListener > xListener ) : + m_xListener(std::move( xListener )) {} void operator() ( const InterfaceRef & xObject ) @@ -120,8 +93,8 @@ private: template< class InterfaceRef > struct removeListenerFunctor { - explicit removeListenerFunctor( const css::uno::Reference< css::util::XModifyListener > & xListener ) : - m_xListener( xListener ) + explicit removeListenerFunctor( css::uno::Reference< css::util::XModifyListener > xListener ) : + m_xListener(std::move( xListener )) {} void operator() ( const InterfaceRef & xObject ) @@ -138,8 +111,8 @@ private: template< class Pair > struct addListenerToMappedElementFunctor { - explicit addListenerToMappedElementFunctor( const css::uno::Reference< css::util::XModifyListener > & xListener ) : - m_xListener( xListener ) + explicit addListenerToMappedElementFunctor( css::uno::Reference< css::util::XModifyListener > xListener ) : + m_xListener(std::move( xListener )) {} void operator() ( const Pair & aPair ) @@ -156,8 +129,8 @@ private: template< class Pair > struct removeListenerFromMappedElementFunctor { - explicit removeListenerFromMappedElementFunctor( const css::uno::Reference< css::util::XModifyListener > & xListener ) : - m_xListener( xListener ) + explicit removeListenerFromMappedElementFunctor( css::uno::Reference< css::util::XModifyListener > xListener ) : + m_xListener(std::move( xListener )) {} void operator() ( const Pair & aPair ) @@ -184,6 +157,14 @@ void addListener( aFunctor( xObject ); } } +template< class T > +void addListener( + const rtl::Reference<T> & xBroadcaster, + const css::uno::Reference< css::util::XModifyListener > & xListener ) +{ + if( xBroadcaster && xListener ) + xBroadcaster->addModifyListener( xListener ); +} template< class Container > void addListenerToAllElements( @@ -195,6 +176,17 @@ void addListenerToAllElements( impl::addListenerFunctor< typename Container::value_type >( xListener )); } +template< class T > +void addListenerToAllElements( + const std::vector<rtl::Reference<T>> & rContainer, + const css::uno::Reference< css::util::XModifyListener > & xListener ) +{ + if( !xListener ) + return; + for (auto const & i : rContainer) + i->addModifyListener(xListener); +} + template< class Container > void addListenerToAllMapElements( const Container & rContainer, @@ -205,16 +197,6 @@ void addListenerToAllMapElements( 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, @@ -227,6 +209,15 @@ void removeListener( } } +template< class T > +void removeListener( + const rtl::Reference<T> & xBroadcaster, + const css::uno::Reference< css::util::XModifyListener > & xListener ) +{ + if( xBroadcaster && xListener ) + xBroadcaster->removeModifyListener( xListener ); +} + template< class Container > void removeListenerFromAllElements( const Container & rContainer, @@ -237,6 +228,17 @@ void removeListenerFromAllElements( impl::removeListenerFunctor< typename Container::value_type >( xListener )); } +template< class T > +void removeListenerFromAllElements( + const std::vector<rtl::Reference<T>> & rContainer, + const css::uno::Reference< css::util::XModifyListener > & xListener ) +{ + if( !xListener ) + return; + for (auto const & i : rContainer) + i->removeModifyListener(xListener); +} + template< class Container > void removeListenerFromAllMapElements( const Container & rContainer, @@ -247,20 +249,6 @@ void removeListenerFromAllMapElements( 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 +} // namespace chart::ModifyListenerHelper /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/MovingAverageRegressionCurveCalculator.hxx b/chart2/source/inc/MovingAverageRegressionCurveCalculator.hxx index fb6185098193..abb74ded2294 100644 --- a/chart2/source/inc/MovingAverageRegressionCurveCalculator.hxx +++ b/chart2/source/inc/MovingAverageRegressionCurveCalculator.hxx @@ -16,16 +16,16 @@ * 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 +#pragma once #include "RegressionCurveCalculator.hxx" +#include "RegressionCalculationHelper.hxx" #include <vector> namespace chart { -class MovingAverageRegressionCurveCalculator : public RegressionCurveCalculator +class MovingAverageRegressionCurveCalculator final : public RegressionCurveCalculator { public: MovingAverageRegressionCurveCalculator(); @@ -52,12 +52,12 @@ private: const css::uno::Reference<css::chart2::XScaling>& xScalingY, sal_Bool bMaySkipPointsInCalculation ) override; + void calculateValues(const RegressionCalculationHelper::tDoubleVectorPair& aValues, bool bUseXAvg); + void calculateValuesCentral(const RegressionCalculationHelper::tDoubleVectorPair& aValues); 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/NameContainer.hxx b/chart2/source/inc/NameContainer.hxx index 8d13d8037eff..12fc76978b0d 100644 --- a/chart2/source/inc/NameContainer.hxx +++ b/chart2/source/inc/NameContainer.hxx @@ -17,23 +17,18 @@ * 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 +#pragma once #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< @@ -43,11 +38,12 @@ typedef ::cppu::WeakImplHelper< NameContainer_Base; } -class NameContainer : public impl::NameContainer_Base +/// Contains the XML namespaces map +/// +class NameContainer final : public impl::NameContainer_Base { public: - NameContainer() = delete; - NameContainer( const css::uno::Type& rType, const OUString& rServicename, const OUString& rImplementationName ); + NameContainer(); explicit NameContainer( const NameContainer & rOther ); virtual ~NameContainer() override; @@ -76,16 +72,11 @@ public: 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 index 828ef6a3cc4d..a229beafcda2 100644 --- a/chart2/source/inc/NumberFormatterWrapper.hxx +++ b/chart2/source/inc/NumberFormatterWrapper.hxx @@ -16,12 +16,10 @@ * 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 +#pragma once -#include "charttoolsdllapi.hxx" +#include <config_options.h> #include <com/sun/star/util/XNumberFormatsSupplier.hpp> -#include <tools/solar.h> #include <tools/date.hxx> class SvNumberFormatter; @@ -30,7 +28,7 @@ class Color; namespace chart { -class OOO_DLLPUBLIC_CHARTTOOLS NumberFormatterWrapper final +class NumberFormatterWrapper final { public: NumberFormatterWrapper( const css::uno::Reference< css::util::XNumberFormatsSupplier >& xSupplier ); @@ -62,10 +60,9 @@ public: private: NumberFormatterWrapper m_aNumberFormatterWrapper; - sal_uLong m_nNumberFormatKey; + sal_uInt32 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 index 1fafa218a9bd..037d626fcf83 100644 --- a/chart2/source/inc/OPropertySet.hxx +++ b/chart2/source/inc/OPropertySet.hxx @@ -16,10 +16,12 @@ * 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 +#pragma once + +#include <config_options.h> // helper classes +#include <cppuhelper/basemutex.hxx> #include <cppuhelper/propshlp.hxx> // interfaces and types @@ -27,17 +29,14 @@ #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> +#include <unordered_map> namespace property { -namespace impl -{ class ImplOPropertySet; } - -class OPropertySet : +class SAL_DLLPUBLIC_RTTI OPropertySet : + protected cppu::BaseMutex, public ::cppu::OBroadcastHelper, // includes beans::XPropertySet, XMultiPropertySet and XFastPropertySet public ::cppu::OPropertySetHelper, @@ -49,22 +48,25 @@ class OPropertySet : public css::style::XStyleSupplier { public: - OPropertySet( ::osl::Mutex & rMutex ); + OPropertySet(); virtual ~OPropertySet(); protected: - explicit OPropertySet( const OPropertySet & rOther, ::osl::Mutex & rMutex ); + explicit OPropertySet( const OPropertySet & rOther ); 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. + We pass the any by reference because this code is very hot and doing + it this way is cheaper than the two step process of constructing a new + any and then assigning to via a return value. @throws css::beans::UnknownPropertyException @throws css::uno::RuntimeException */ - virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const = 0; + virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const = 0; /** The InfoHelper table contains all property names and types of this object. @@ -104,7 +106,7 @@ protected: ( css::uno::Any & rConvertedValue, css::uno::Any & rOldValue, sal_Int32 nHandle, - const css::uno::Any& rValue ) override; + const css::uno::Any& rValue ) override final; /** The same as setFastPropertyValue; nHandle is always valid. The changes must not be broadcasted in this method. @@ -137,14 +139,15 @@ protected: ( 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(); +public: + /// make original interface function visible again + using ::cppu::OPropertySetHelper::getFastPropertyValue; + // Interfaces // ____ XInterface ____ @@ -158,51 +161,74 @@ protected: // ____ XPropertyState ____ virtual css::beans::PropertyState SAL_CALL - getPropertyState( const OUString& PropertyName ) override; + getPropertyState( const OUString& PropertyName ) override final; virtual css::uno::Sequence< css::beans::PropertyState > SAL_CALL - getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override; + getPropertyStates( const css::uno::Sequence< OUString >& aPropertyName ) override final; virtual void SAL_CALL - setPropertyToDefault( const OUString& PropertyName ) override; + setPropertyToDefault( const OUString& PropertyName ) override final; virtual css::uno::Any SAL_CALL - getPropertyDefault( const OUString& aPropertyName ) override; + getPropertyDefault( const OUString& aPropertyName ) override final; // ____ XMultiPropertyStates ____ // Note: getPropertyStates() is already implemented in XPropertyState with the // same signature virtual void SAL_CALL - setAllPropertiesToDefault() override; + setAllPropertiesToDefault() override final; virtual void SAL_CALL - setPropertiesToDefault( const css::uno::Sequence< OUString >& aPropertyNames ) override; + setPropertiesToDefault( const css::uno::Sequence< OUString >& aPropertyNames ) override final; virtual css::uno::Sequence< css::uno::Any > SAL_CALL - getPropertyDefaults( const css::uno::Sequence< OUString >& aPropertyNames ) override; + getPropertyDefaults( const css::uno::Sequence< OUString >& aPropertyNames ) override final; // ____ 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; + virtual css::uno::Reference< css::style::XStyle > SAL_CALL getStyle() override final; + virtual void SAL_CALL setStyle( const css::uno::Reference< css::style::XStyle >& xStyle ) override final; // ____ XMultiPropertySet ____ virtual void SAL_CALL setPropertyValues( const css::uno::Sequence< OUString >& PropertyNames, - const css::uno::Sequence< css::uno::Any >& Values ) override; + const css::uno::Sequence< css::uno::Any >& Values ) override final; // ____ XFastPropertySet ____ - virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const css::uno::Any& rValue ) override; + virtual void SAL_CALL setFastPropertyValue( sal_Int32 nHandle, const css::uno::Any& rValue ) override final; // 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; + /** supports states DIRECT_VALUE and DEFAULT_VALUE + */ + css::beans::PropertyState + GetPropertyStateByHandle( sal_Int32 nHandle ) const; + + css::uno::Sequence< css::beans::PropertyState > + GetPropertyStatesByHandle( const std::vector< sal_Int32 > & aHandles ) const; + + void SetPropertyToDefault( sal_Int32 nHandle ); + void SetPropertiesToDefault( const std::vector< sal_Int32 > & aHandles ); + void SetAllPropertiesToDefault(); + + /** @param rValue is set to the value for the property given in nHandle. If + the property is not set, the style chain is searched for any + instance set there. If there was no value found either in the + property set itself or any of its styles, rValue remains + unchanged and false is returned. + + @return false if the property is default, true otherwise. + */ + bool GetPropertyValueByHandle( + css::uno::Any & rValue, + sal_Int32 nHandle ) const; + + void SetPropertyValueByHandle( sal_Int32 nHandle, + const css::uno::Any & rValue ); + + bool SetStyle( const css::uno::Reference< css::style::XStyle > & xStyle ); - /// pImpl idiom implementation - std::unique_ptr< impl::ImplOPropertySet > m_pImplProperties; bool m_bSetNewValuesExplicitlyEvenIfTheyEqualDefault; + std::unordered_map< sal_Int32, css::uno::Any > m_aProperties; + css::uno::Reference< css::style::XStyle > m_xStyle; }; } // 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 index 59248857b91c..2376d7073b79 100644 --- a/chart2/source/inc/ObjectIdentifier.hxx +++ b/chart2/source/inc/ObjectIdentifier.hxx @@ -16,28 +16,31 @@ * 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 +#pragma once + +#include <sal/config.h> + +#include <string_view> #include "TitleHelper.hxx" -#include "charttoolsdllapi.hxx" #include <rtl/ustring.hxx> +#include <rtl/ref.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 { +class Axis; +class BaseCoordinateSystem; +class DataSeries; +class Diagram; +class Legend; enum ObjectType { @@ -65,11 +68,12 @@ enum ObjectType OBJECTTYPE_DATA_STOCK_RANGE, OBJECTTYPE_DATA_STOCK_LOSS, OBJECTTYPE_DATA_STOCK_GAIN, + OBJECTTYPE_DATA_TABLE, OBJECTTYPE_SHAPE, OBJECTTYPE_UNKNOWN }; -class OOO_DLLPUBLIC_CHARTTOOLS ObjectIdentifier +class ObjectIdentifier { //CID == ClassifiedIdentifier <--> name of shape //semicolon, colon, equal sign and slash have special meanings in a CID @@ -90,45 +94,45 @@ class OOO_DLLPUBLIC_CHARTTOOLS ObjectIdentifier public: ObjectIdentifier(); - ObjectIdentifier( const OUString& rObjectCID ); + ObjectIdentifier( OUString aObjectCID ); 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); - + , const rtl::Reference<::chart::ChartModel>& xChartModel ); static OUString createClassifiedIdentifierForObject( - const css::uno::Reference< css::uno::XInterface >& xObject - , const css::uno::Reference< css::frame::XModel >& xChartModel ); + const rtl::Reference< ::chart::Title >& xObject + , const rtl::Reference<::chart::ChartModel>& xChartModel ); + static OUString createClassifiedIdentifierForObject( + const rtl::Reference< ::chart::Legend >& xObject + , const rtl::Reference<::chart::ChartModel>& xChartModel ); + static OUString createClassifiedIdentifierForObject( + const rtl::Reference< ::chart::Axis >& xObject + , const rtl::Reference<::chart::ChartModel>& xChartModel ); static OUString createClassifiedIdentifierForParticle( - const OUString& rParticle ); + std::u16string_view rParticle ); static OUString createClassifiedIdentifierForParticles( - const OUString& rParentParticle - , const OUString& rChildParticle - , const OUString& rDragMethodServiceName = OUString() - , const OUString& rDragParameterString = OUString() ); + std::u16string_view rParentParticle + , std::u16string_view rChildParticle + , std::u16string_view rDragMethodServiceName = std::u16string_view() + , std::u16string_view rDragParameterString = std::u16string_view() ); static OUString createClassifiedIdentifierForGrid( const css::uno::Reference< css::chart2::XAxis >& xAxis - , const css::uno::Reference< css::frame::XModel >& xChartModel + , const rtl::Reference<::chart::ChartModel>& xChartModel , sal_Int32 nSubIndex = -1 );//-1: main grid, 0: first subgrid etc - SAL_DLLPRIVATE static OUString createParticleForDiagram(); + 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 ); + const rtl::Reference< ::chart::BaseCoordinateSystem >& xCooSys + , const rtl::Reference<::chart::ChartModel>& xChartModel ); static OUString createParticleForAxis( sal_Int32 nDimensionIndex, sal_Int32 nAxisIndex ); @@ -139,97 +143,95 @@ public: 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 ); + const rtl::Reference<::chart::ChartModel>& xChartModel ); - static OUString addChildParticle( const OUString& rParticle, const OUString& rChildParticle ); + /** Creates an identifier for the data table */ + static OUString createParticleForDataTable( + const rtl::Reference<::chart::ChartModel>& xChartModel ); + + static OUString addChildParticle( std::u16string_view rParticle, std::u16string_view rChildParticle ); static OUString createChildParticleWithIndex( ObjectType eObjectType, sal_Int32 nIndex ); - static sal_Int32 getIndexFromParticleOrCID( const OUString& rParticleOrCID ); + static sal_Int32 getIndexFromParticleOrCID( std::u16string_view rParticleOrCID ); static OUString createClassifiedIdentifier( enum ObjectType eObjectType //e.g. OBJECTTYPE_DATA_SERIES - , const OUString& rParticleID );//e.g. SeriesID + , std::u16string_view 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() + , std::u16string_view rParticleID //for points or subgrids this is an Index or otherwise an identifier from the model object + , std::u16string_view rParentPartical //e.g. "Series=SeriesID" or "Grid=GridId" + , std::u16string_view rDragMethodServiceName = std::u16string_view() + , std::u16string_view rDragParameterString = std::u16string_view() ); - static bool isCID( const OUString& rName ); - static OUString getDragMethodServiceName( const OUString& rClassifiedIdentifier ); - static OUString getDragParameterString( const OUString& rCID ); - static bool isDragableObject( const OUString& rClassifiedIdentifier ); + static bool isCID( std::u16string_view rName ); + static std::u16string_view getDragMethodServiceName( std::u16string_view rClassifiedIdentifier ); + static std::u16string_view getDragParameterString( std::u16string_view rCID ); + static bool isDragableObject( std::u16string_view 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 bool isRotateableObject( std::u16string_view rClassifiedIdentifier ); + static bool isMultiClickObject( std::u16string_view rClassifiedIdentifier ); + static bool areSiblings( std::u16string_view rCID1, std::u16string_view rCID2 );//identical object is no sibling + static bool areIdenticalObjects( std::u16string_view rCID1, std::u16string_view rCID2 ); static OUString getStringForType( ObjectType eObjectType ); - static ObjectType getObjectType( const OUString& rCID ); + static ObjectType getObjectType( std::u16string_view 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 ); + , std::u16string_view rSeriesParticle + , std::u16string_view rDragMethodServiceName = std::u16string_view() + , std::u16string_view rDragParameterString = std::u16string_view() ); + static OUString createPointCID( std::u16string_view 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 ); + static OUString createDataCurveCID( std::u16string_view rSeriesParticle, sal_Int32 nCurveIndex, bool bAverageLine ); + static OUString createDataCurveEquationCID( std::u16string_view rSeriesParticle, sal_Int32 nCurveIndex ); - SAL_DLLPRIVATE static OUString getObjectID( const OUString& rCID ); - static OUString getParticleID( const OUString& rCID ); - static OUString getFullParentParticle( const OUString& rCID ); + static OUString getObjectID( std::u16string_view rCID ); + static std::u16string_view getParticleID( std::u16string_view rCID ); + static std::u16string_view getFullParentParticle( std::u16string_view rCID ); //returns the series particle of a CID when the CID is a child of the series - static OUString getSeriesParticleFromCID( const OUString& rCID ); + static OUString getSeriesParticleFromCID( std::u16string_view 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 ); + std::u16string_view rObjectCID + , const rtl::Reference< ::chart::ChartModel >& xChartDocument ); //return the axis object that belongs to rObjectCID if any - static css::uno::Reference< css::chart2::XAxis > + static rtl::Reference< ::chart::Axis > getAxisForCID( - const OUString& rObjectCID - , const css::uno::Reference< css::frame::XModel >& xChartModel ); + std::u16string_view rObjectCID + , const rtl::Reference<::chart::ChartModel>& xChartModel ); //return the series object that belongs to rObjectCID if any - static css::uno::Reference< css::chart2::XDataSeries > + static rtl::Reference< ::chart::DataSeries > getDataSeriesForCID( - const OUString& rObjectCID - , const css::uno::Reference< css::frame::XModel >& xChartModel ); + std::u16string_view rObjectCID + , const rtl::Reference<::chart::ChartModel>& xChartModel ); - static css::uno::Reference< css::chart2::XDiagram > + static rtl::Reference< ::chart::Diagram > getDiagramForCID( - const OUString& rObjectCID - , const css::uno::Reference< css::frame::XModel >& xChartModel ); + std::u16string_view rObjectCID + , const rtl::Reference<::chart::ChartModel>& 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 + static bool parsePieSegmentDragParameterString( std::u16string_view rDragParameterString , sal_Int32& rOffsetPercent , css::awt::Point& rMinimumPosition , css::awt::Point& rMaximumPosition ); - static TitleHelper::eTitleType getTitleTypeForCID( const OUString& rCID ); + static TitleHelper::eTitleType getTitleTypeForCID( std::u16string_view rCID ); - static OUString getMovedSeriesCID( const OUString& rObjectCID, bool bForward ); + static OUString getMovedSeriesCID( std::u16string_view rObjectCID, bool bForward ); bool isValid() const; bool isAutoGeneratedObject() const; @@ -249,6 +251,5 @@ private: }; } //namespace chart -#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/PolynomialRegressionCurveCalculator.hxx b/chart2/source/inc/PolynomialRegressionCurveCalculator.hxx index e47d882d4903..73512497b190 100644 --- a/chart2/source/inc/PolynomialRegressionCurveCalculator.hxx +++ b/chart2/source/inc/PolynomialRegressionCurveCalculator.hxx @@ -16,8 +16,7 @@ * 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 +#pragma once #include "RegressionCurveCalculator.hxx" #include <vector> @@ -59,6 +58,4 @@ private: } // 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 index 0c9af2f50bad..3caeffc0d98a 100644 --- a/chart2/source/inc/PopupRequest.hxx +++ b/chart2/source/inc/PopupRequest.hxx @@ -7,51 +7,36 @@ * 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 +#pragma once -#include "MutexContainer.hxx" -#include "charttoolsdllapi.hxx" +#include <config_options.h> -#include <cppuhelper/compbase.hxx> +#include <comphelper/compbase.hxx> #include <com/sun/star/awt/XRequestCallback.hpp> namespace chart { - namespace impl { - -typedef cppu::WeakComponentImplHelper<css::awt::XRequestCallback> PopupRequest_Base; - +typedef comphelper::WeakComponentImplHelper<css::awt::XRequestCallback> PopupRequest_Base; } -class OOO_DLLPUBLIC_CHARTTOOLS PopupRequest : public MutexContainer, public impl::PopupRequest_Base +class PopupRequest final : public impl::PopupRequest_Base { public: explicit PopupRequest(); virtual ~PopupRequest() override; - css::uno::Reference<css::awt::XCallback> const & getCallback() const - { - return m_xCallback; - } + 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, + 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 index c3306d3c6ee4..a0d05b4a2f53 100644 --- a/chart2/source/inc/PotentialRegressionCurveCalculator.hxx +++ b/chart2/source/inc/PotentialRegressionCurveCalculator.hxx @@ -16,15 +16,14 @@ * 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 +#pragma once #include "RegressionCurveCalculator.hxx" namespace chart { -class PotentialRegressionCurveCalculator : public RegressionCurveCalculator +class PotentialRegressionCurveCalculator final : public RegressionCurveCalculator { public: PotentialRegressionCurveCalculator(); @@ -59,7 +58,4 @@ private: } // 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 index 19ce354c9735..26f395fa1b06 100644 --- a/chart2/source/inc/PropertyHelper.hxx +++ b/chart2/source/inc/PropertyHelper.hxx @@ -16,12 +16,11 @@ * 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 +#pragma once +#include <config_options.h> #include <com/sun/star/beans/Property.hpp> #include <com/sun/star/uno/Any.hxx> -#include "charttoolsdllapi.hxx" #include <unordered_map> @@ -42,7 +41,7 @@ namespace PropertyHelper @return The name used for storing this element in the table */ -OOO_DLLPUBLIC_CHARTTOOLS OUString addLineDashUniqueNameToTable( +OUString addLineDashUniqueNameToTable( const css::uno::Any & rValue, const css::uno::Reference< css::lang::XMultiServiceFactory > & xFact, const OUString & rPreferredName ); @@ -52,7 +51,7 @@ OOO_DLLPUBLIC_CHARTTOOLS OUString addLineDashUniqueNameToTable( @return The name used for storing this element in the table */ -OOO_DLLPUBLIC_CHARTTOOLS OUString addGradientUniqueNameToTable( +OUString addGradientUniqueNameToTable( const css::uno::Any & rValue, const css::uno::Reference< css::lang::XMultiServiceFactory > & xFact, const OUString & rPreferredName ); @@ -62,7 +61,6 @@ OOO_DLLPUBLIC_CHARTTOOLS OUString addGradientUniqueNameToTable( @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, @@ -73,7 +71,7 @@ OUString addTransparencyGradientUniqueNameToTable( @return The name used for storing this element in the table */ -OOO_DLLPUBLIC_CHARTTOOLS OUString addHatchUniqueNameToTable( +OUString addHatchUniqueNameToTable( const css::uno::Any & rValue, const css::uno::Reference< css::lang::XMultiServiceFactory > & xFact, const OUString & rPreferredName ); @@ -83,7 +81,7 @@ OOO_DLLPUBLIC_CHARTTOOLS OUString addHatchUniqueNameToTable( @return The name used for storing this element in the table */ -OOO_DLLPUBLIC_CHARTTOOLS OUString addBitmapUniqueNameToTable( +OUString addBitmapUniqueNameToTable( const css::uno::Any & rValue, const css::uno::Reference< css::lang::XMultiServiceFactory > & xFact, const OUString & rPreferredName ); @@ -93,7 +91,6 @@ OOO_DLLPUBLIC_CHARTTOOLS OUString addBitmapUniqueNameToTable( @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 ); @@ -112,7 +109,7 @@ template< typename 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 ); +void setPropertyValueDefaultAny( tPropertyValueMap & rOutMap, tPropertyValueMapKey key, const css::uno::Any & rAny ); /** Calls setPropertyValue() but asserts that the given property hasn't been set before. @@ -131,11 +128,11 @@ template<> /** Calls setPropertyValueDefault() with an empty Any as value */ -OOO_DLLPUBLIC_CHARTTOOLS void setEmptyPropertyValueDefault( tPropertyValueMap & rOutMap, tPropertyValueMapKey key ); +void setEmptyPropertyValueDefault( tPropertyValueMap & rOutMap, tPropertyValueMapKey key ); } // namespace PropertyHelper -struct OOO_DLLPUBLIC_CHARTTOOLS PropertyNameLess +struct PropertyNameLess { bool operator() ( const css::beans::Property & first, const css::beans::Property & second ) @@ -146,7 +143,4 @@ struct OOO_DLLPUBLIC_CHARTTOOLS PropertyNameLess } // 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 index c1fe2d721b5b..9ec39e9977ec 100644 --- a/chart2/source/inc/RangeHighlighter.hxx +++ b/chart2/source/inc/RangeHighlighter.hxx @@ -16,17 +16,16 @@ * 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 +#pragma once -#include "MutexContainer.hxx" -#include <cppuhelper/compbase.hxx> +#include <comphelper/compbase.hxx> +#include <comphelper/interfacecontainer4.hxx> #include <com/sun/star/chart2/data/XRangeHighlighter.hpp> #include <com/sun/star/view/XSelectionChangeListener.hpp> +#include <rtl/ref.hxx> namespace com::sun::star { namespace chart2 { - class XDiagram; class XDataSeries; class XAxis; } @@ -36,23 +35,25 @@ namespace com::sun::star::view { class XSelectionSupplier; } namespace chart { +class ChartModel; +class DataSeries; +class Diagram; namespace impl { -typedef ::cppu::WeakComponentImplHelper< +typedef comphelper::WeakComponentImplHelper< css::chart2::data::XRangeHighlighter, css::view::XSelectionChangeListener > RangeHighlighter_Base; } -class RangeHighlighter : - public MutexContainer, +class RangeHighlighter final : public impl::RangeHighlighter_Base { public: explicit RangeHighlighter( - const css::uno::Reference< css::view::XSelectionSupplier > & xSelectionSupplier ); + const rtl::Reference< ::chart::ChartModel > & xSelectionSupplier ); virtual ~RangeHighlighter() override; protected: @@ -73,7 +74,7 @@ protected: // ____ WeakComponentImplHelperBase ____ // is called when dispose() is called at this component - virtual void SAL_CALL disposing() override; + virtual void disposing(std::unique_lock<std::mutex>&) override; private: void fireSelectionEvent(); @@ -81,26 +82,25 @@ private: void stopListening(); void determineRanges(); - void fillRangesForDiagram( const css::uno::Reference< css::chart2::XDiagram > & xDiagram ); + void fillRangesForDiagram( const rtl::Reference< ::chart::Diagram > & 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 fillRangesForDataPoint( const rtl::Reference< ::chart::DataSeries > & 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; + rtl::Reference< ::chart::ChartModel > m_xChartModel; css::uno::Reference< css::view::XSelectionChangeListener > m_xListener; css::uno::Sequence< css::chart2::data::HighlightedRange > m_aSelectedRanges; sal_Int32 m_nAddedListenerCount; bool m_bIncludeHiddenCells; + comphelper::OInterfaceContainerHelper4<css::view::XSelectionChangeListener> maSelectionChangeListeners; }; } // namespace chart -// INCLUDED_CHART2_SOURCE_INC_RANGEHIGHLIGHTER_HXX -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/RangeSelectionHelper.hxx b/chart2/source/inc/RangeSelectionHelper.hxx new file mode 100644 index 000000000000..d71c861d0314 --- /dev/null +++ b/chart2/source/inc/RangeSelectionHelper.hxx @@ -0,0 +1,70 @@ +/* -*- 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 . + */ +#pragma once + +#include <com/sun/star/uno/Reference.h> +#include <com/sun/star/uno/Sequence.h> +#include <rtl/ustring.hxx> +#include <rtl/ref.hxx> + +namespace com::sun::star::beans { struct PropertyValue; } + +namespace com::sun::star { + namespace sheet{ + class XRangeSelection; + class XRangeSelectionListener; + } +} + +namespace chart +{ +class ChartModel; +class RangeSelectionListenerParent; + +class RangeSelectionHelper +{ +public: + explicit RangeSelectionHelper( + rtl::Reference<::chart::ChartModel> xChartDocument ); + ~RangeSelectionHelper(); + + bool hasRangeSelection(); + css::uno::Reference< css::sheet::XRangeSelection > const & getRangeSelection(); + void raiseRangeSelectionDocument(); + bool chooseRange( + const OUString & aCurrentRange, + const OUString & aUIString, + RangeSelectionListenerParent & rListenerParent ); + void stopRangeListening( bool bRemoveListener = true ); + bool verifyCellRange( const OUString & rRangeStr ); + bool verifyArguments( const css::uno::Sequence< css::beans::PropertyValue >& rArguments ); + +private: + css::uno::Reference< css::sheet::XRangeSelection > + m_xRangeSelection; + + rtl::Reference<::chart::ChartModel> m_xChartDocument; + + css::uno::Reference< css::sheet::XRangeSelectionListener > + m_xRangeSelectionListener; +}; + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/RangeSelectionListener.hxx b/chart2/source/inc/RangeSelectionListener.hxx new file mode 100644 index 000000000000..873043f9b4a5 --- /dev/null +++ b/chart2/source/inc/RangeSelectionListener.hxx @@ -0,0 +1,75 @@ +/* -*- 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 . + */ +#pragma once + +#include "ControllerLockGuard.hxx" +#include <cppuhelper/implbase.hxx> +#include <com/sun/star/sheet/XRangeSelectionListener.hpp> +#include <rtl/ref.hxx> + +namespace weld +{ +class DialogController; +} + +namespace chart +{ +class ChartModel; + +class RangeSelectionListenerParent +{ +public: + virtual void listeningFinished(const OUString& rNewRange) = 0; + virtual void disposingRangeSelection() = 0; + + void enableRangeChoosing(bool bEnable, weld::DialogController* pDialog); + +protected: + ~RangeSelectionListenerParent() {} + +private: + OUString m_sRestorePageIdent; +}; + +class RangeSelectionListener final + : public ::cppu::WeakImplHelper<css::sheet::XRangeSelectionListener> +{ +public: + explicit RangeSelectionListener( + RangeSelectionListenerParent& rParent, OUString aInitialRange, + const rtl::Reference<::chart::ChartModel>& xModelToLockController); + virtual ~RangeSelectionListener() override; + +protected: + // ____ XRangeSelectionListener ____ + virtual void SAL_CALL done(const css::sheet::RangeSelectionEvent& aEvent) override; + virtual void SAL_CALL aborted(const css::sheet::RangeSelectionEvent& aEvent) override; + + // ____ XEventListener ____ + virtual void SAL_CALL disposing(const css::lang::EventObject& Source) override; + +private: + RangeSelectionListenerParent& m_rParent; + OUString m_aRange; + ControllerLockGuardUNO m_aControllerLockGuard; +}; + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/ReferenceSizeProvider.hxx b/chart2/source/inc/ReferenceSizeProvider.hxx index 253ab79fb7b4..006618dd5dba 100644 --- a/chart2/source/inc/ReferenceSizeProvider.hxx +++ b/chart2/source/inc/ReferenceSizeProvider.hxx @@ -16,18 +16,17 @@ * 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 +#pragma once #include <com/sun/star/uno/Reference.hxx> #include <com/sun/star/awt/Size.hpp> -#include "charttoolsdllapi.hxx" +#include <rtl/ref.hxx> +#include <ChartModel.hxx> namespace com::sun::star { namespace chart2 { class XTitle; class XTitled; - class XChartDocument; } namespace beans { class XPropertySet; @@ -37,7 +36,7 @@ namespace com::sun::star { namespace chart { -class OOO_DLLPUBLIC_CHARTTOOLS ReferenceSizeProvider +class ReferenceSizeProvider { public: @@ -51,7 +50,7 @@ public: ReferenceSizeProvider( css::awt::Size aPageSize, - const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc ); + const rtl::Reference<::chart::ChartModel> & xChartDoc ); const css::awt::Size& getPageSize() const { return m_aPageSize;} @@ -64,7 +63,7 @@ public: with state NO, AUTO_RESIZE_AMBIGUOUS is returned. */ static AutoResizeState getAutoResizeState( - const css::uno::Reference< css::chart2::XChartDocument > & xChartDoc ); + const rtl::Reference<::chart::ChartModel> & 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 @@ -77,7 +76,7 @@ public: class at the XPropertySet, and the adapted font sizes if bAdaptFontSizes is </sal_True>. */ - SAL_DLLPRIVATE void setValuesAtPropertySet( + void setValuesAtPropertySet( const css::uno::Reference< css::beans::XPropertySet > & xProp, bool bAdaptFontSizes = true ); @@ -85,7 +84,7 @@ public: class at the XTitle, and the adapted font sizes at the contained XFormattedStrings */ - SAL_DLLPRIVATE void setValuesAtTitle( + void setValuesAtTitle( const css::uno::Reference< css::chart2::XTitle > & xTitle ); /** Sets the internal value at all data series in the currently set model. @@ -95,12 +94,12 @@ public: void setValuesAtAllDataSeries(); private: - SAL_DLLPRIVATE bool useAutoScale() const { return m_bUseAutoScale;} + 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 ); + 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 @@ -109,24 +108,21 @@ private: 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( + static void getAutoResizeFromPropSet( const css::uno::Reference< css::beans::XPropertySet > & xProp, AutoResizeState & rInOutState ); - SAL_DLLPRIVATE void impl_setValuesAtTitled( + void impl_setValuesAtTitled( const css::uno::Reference< css::chart2::XTitled > & xTitled ); - SAL_DLLPRIVATE static void impl_getAutoResizeFromTitled( + 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; + rtl::Reference<::chart::ChartModel> 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 index a5b2b3b16975..0b9600e99dc5 100644 --- a/chart2/source/inc/RegressionCalculationHelper.hxx +++ b/chart2/source/inc/RegressionCalculationHelper.hxx @@ -16,19 +16,15 @@ * 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 +#pragma once #include <com/sun/star/uno/Sequence.hxx> -#include <rtl/math.hxx> - +#include <cmath> #include <utility> #include <vector> -namespace chart -{ -namespace RegressionCalculationHelper +namespace chart::RegressionCalculationHelper { typedef std::pair< std::vector< double >, std::vector< double > > tDoubleVectorPair; @@ -133,10 +129,6 @@ public: } }; -} // namespace RegressionCalculationHelper -} // namespace chart - -// INCLUDED_CHART2_SOURCE_INC_REGRESSIONCALCULATIONHELPER_HXX -#endif +} // namespace chart::RegressionCalculationHelper /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/RegressionCurveCalculator.hxx b/chart2/source/inc/RegressionCurveCalculator.hxx index 183db2b65c06..ebb3ad40f616 100644 --- a/chart2/source/inc/RegressionCurveCalculator.hxx +++ b/chart2/source/inc/RegressionCurveCalculator.hxx @@ -16,8 +16,7 @@ * 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 +#pragma once #include <cppuhelper/implbase.hxx> #include <rtl/ustrbuf.hxx> @@ -43,33 +42,13 @@ public: 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; + sal_Int32 aPeriod, + sal_Int32 nMovingType) override; virtual void SAL_CALL recalculateRegression( const css::uno::Sequence< double >& aXValues, @@ -95,11 +74,30 @@ protected: virtual void SAL_CALL setXYNames( const OUString& aXName, const OUString& aYName ) override; + +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; + sal_Int32 mnMovingType; }; } // 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 index 8fa4071471d0..a730b91d900d 100644 --- a/chart2/source/inc/RegressionCurveHelper.hxx +++ b/chart2/source/inc/RegressionCurveHelper.hxx @@ -16,78 +16,91 @@ * 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 +#pragma once +#include <config_options.h> #include <svx/chrtitem.hxx> -#include "charttoolsdllapi.hxx" +#include <rtl/ref.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 { class ChartModel; } +namespace chart { class DataSeries; } +namespace chart { class RegressionCurveModel; } +namespace chart { class RegressionCurveCalculator; } -namespace chart -{ - -namespace RegressionCurveHelper +namespace chart::RegressionCurveHelper { /// returns a model mean-value line - css::uno::Reference<css::chart2::XRegressionCurve> createMeanValueLine(); + rtl::Reference<::chart::RegressionCurveModel> createMeanValueLine(); /// returns a model regression curve - css::uno::Reference<css::chart2::XRegressionCurve> - createRegressionCurveByServiceName( const OUString& aServiceName ); + rtl::Reference<::chart::RegressionCurveModel> + createRegressionCurveByServiceName( std::u16string_view aServiceName ); - OOO_DLLPUBLIC_CHARTTOOLS bool hasMeanValueLine( + bool hasMeanValueLine( const css::uno::Reference<css::chart2::XRegressionCurveContainer> & xRegCnt ); + bool hasMeanValueLine( + const rtl::Reference<::chart::DataSeries> & xRegCnt ); - OOO_DLLPUBLIC_CHARTTOOLS bool isMeanValueLine( + bool isMeanValueLine( const css::uno::Reference<css::chart2::XRegressionCurve> & xRegCurve ); + bool isMeanValueLine( + const rtl::Reference<::chart::RegressionCurveModel> & xRegCurve ); - OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference<css::chart2::XRegressionCurve> + rtl::Reference<::chart::RegressionCurveModel> getMeanValueLine( const css::uno::Reference<css::chart2::XRegressionCurveContainer> & xRegCnt ); + rtl::Reference<::chart::RegressionCurveModel> + getMeanValueLine( + const rtl::Reference<::chart::DataSeries> & 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( + void addMeanValueLine( css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xRegCnt, const css::uno::Reference<css::beans::XPropertySet>& xSeriesProp ); + void addMeanValueLine( + rtl::Reference<::chart::DataSeries> const & xRegCnt, + const css::uno::Reference<css::beans::XPropertySet>& xSeriesProp ); - OOO_DLLPUBLIC_CHARTTOOLS void removeMeanValueLine( + void removeMeanValueLine( css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xRegCnt ); + void removeMeanValueLine( + rtl::Reference<::chart::DataSeries> 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> + rtl::Reference<::chart::RegressionCurveModel> getFirstCurveNotMeanValueLine( const css::uno::Reference<css::chart2::XRegressionCurveContainer>& xCurveContainer ); + rtl::Reference<::chart::RegressionCurveModel> + getFirstCurveNotMeanValueLine( + const rtl::Reference<::chart::DataSeries>& xCurveContainer ); /** Returns the regression curve found at the index provided. */ - OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference<css::chart2::XRegressionCurve> + rtl::Reference<::chart::RegressionCurveModel> getRegressionCurveAtIndex( - const css::uno::Reference<css::chart2::XRegressionCurveContainer>& xCurveContainer, + const rtl::Reference<::chart::DataSeries>& 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( + SvxChartRegress getFirstRegressTypeNotMeanValueLine( const css::uno::Reference<css::chart2::XRegressionCurveContainer>& xCurveContainer ); - OOO_DLLPUBLIC_CHARTTOOLS SvxChartRegress getRegressionType( + SvxChartRegress getRegressionType( const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve ); /** @param xPropertySource is taken as source to copy all properties from if @@ -95,7 +108,7 @@ namespace RegressionCurveHelper @param xEquationProperties is set at the new regression curve as equation properties if not null */ - OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference<css::chart2::XRegressionCurve> + rtl::Reference<::chart::RegressionCurveModel> addRegressionCurve( SvxChartRegress eType, css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xCurveContainer, @@ -103,25 +116,33 @@ namespace RegressionCurveHelper css::uno::Reference<css::beans::XPropertySet>(), const css::uno::Reference<css::beans::XPropertySet>& xEquationProperties = css::uno::Reference<css::beans::XPropertySet>() ); + rtl::Reference<::chart::RegressionCurveModel> + addRegressionCurve( + SvxChartRegress eType, + rtl::Reference<::chart::DataSeries> 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 ); + bool removeAllExceptMeanValueLine( + rtl::Reference<::chart::DataSeries> const & xCurveContainer ); - OOO_DLLPUBLIC_CHARTTOOLS void removeEquations( - css::uno::Reference<css::chart2::XRegressionCurveContainer> const & xCurveContainer ); + void removeEquations( + rtl::Reference<::chart::DataSeries> const & xCurveContainer ); - OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference<css::chart2::XRegressionCurve> + rtl::Reference<::chart::RegressionCurveModel> 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 ); + rtl::Reference<::chart::RegressionCurveCalculator> + createRegressionCurveCalculatorByServiceName( std::u16string_view aServiceName ); /** recalculates the regression parameters according to the data given in - the data source. + the data series. 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 @@ -131,54 +152,35 @@ namespace RegressionCurveHelper 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 ); + const rtl::Reference<RegressionCurveCalculator>& xOutCurveCalculator, + const rtl::Reference<::chart::DataSeries>& xSeries, + const rtl::Reference<::chart::ChartModel>& xModel ); - OOO_DLLPUBLIC_CHARTTOOLS OUString getUINameForRegressionCurve( - const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve ); + OUString getUINameForRegressionCurve( + const rtl::Reference<RegressionCurveModel>& xCurve ); - OOO_DLLPUBLIC_CHARTTOOLS OUString getRegressionCurveName( - const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve ); + OUString getRegressionCurveName( + const rtl::Reference<RegressionCurveModel>& xCurve ); - OOO_DLLPUBLIC_CHARTTOOLS OUString getRegressionCurveGenericName( - const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve ); + OUString getRegressionCurveGenericName( + const rtl::Reference<RegressionCurveModel>& 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 ); + OUString getRegressionCurveSpecificName( + const rtl::Reference<RegressionCurveModel>& xCurve ); - OOO_DLLPUBLIC_CHARTTOOLS void resetEquationPosition( + 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 ); + sal_Int32 getRegressionCurveIndex( + const rtl::Reference<::chart::DataSeries>& xContainer, + const rtl::Reference<::chart::RegressionCurveModel>& xCurve ); - OOO_DLLPUBLIC_CHARTTOOLS bool hasEquation(const css::uno::Reference<css::chart2::XRegressionCurve>& xCurve ); -} + bool hasEquation(const rtl::Reference<RegressionCurveModel>& xCurve ); + bool MayHaveCorrelationCoefficient(const rtl::Reference<RegressionCurveModel>& xCurve ); } // namespace chart -#endif // INCLUDED_CHART2_SOURCE_INC_REGRESSIONCURVEHELPER_HXX - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/RegressionCurveModel.hxx b/chart2/source/inc/RegressionCurveModel.hxx new file mode 100644 index 000000000000..25729f849bb8 --- /dev/null +++ b/chart2/source/inc/RegressionCurveModel.hxx @@ -0,0 +1,245 @@ +/* -*- 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 . + */ +#pragma once + +#include "OPropertySet.hxx" + +#include <cppuhelper/implbase.hxx> +#include <comphelper/uno3.hxx> +#include <sal/types.h> + +#include <com/sun/star/chart2/XRegressionCurve.hpp> + +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/lang/XServiceName.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include "ModifyListenerHelper.hxx" + +namespace chart +{ +class RegressionCurveCalculator; + +namespace impl +{ +typedef ::cppu::WeakImplHelper< + css::lang::XServiceInfo, + css::lang::XServiceName, + css::chart2::XRegressionCurve, + css::util::XCloneable, + css::util::XModifyBroadcaster, + css::util::XModifyListener > + RegressionCurveModel_Base; +} + +class SAL_DLLPUBLIC_RTTI RegressionCurveModel : + public impl::RegressionCurveModel_Base, + public ::property::OPropertySet +{ +public: + enum tCurveType + { + CURVE_TYPE_MEAN_VALUE, + CURVE_TYPE_LINEAR, + CURVE_TYPE_LOGARITHM, + CURVE_TYPE_EXPONENTIAL, + CURVE_TYPE_POWER, + CURVE_TYPE_POLYNOMIAL, + CURVE_TYPE_MOVING_AVERAGE + }; + + RegressionCurveModel( tCurveType eCurveType ); + RegressionCurveModel( const RegressionCurveModel & rOther ); + virtual ~RegressionCurveModel() override; + + /// merge XInterface implementations + DECLARE_XINTERFACE() + /// merge XTypeProvider implementations + DECLARE_XTYPEPROVIDER() + +protected: + // ____ OPropertySet ____ + virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override; + + // ____ OPropertySet ____ + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + // ____ XPropertySet ____ + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL + getPropertySetInfo() override; + +public: + // ____ XRegressionCurve ____ + virtual css::uno::Reference< css::chart2::XRegressionCurveCalculator > SAL_CALL getCalculator() override; + virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getEquationProperties() override; + virtual void SAL_CALL setEquationProperties( + const css::uno::Reference< css::beans::XPropertySet >& xEquationProperties ) override; + + // ____ XServiceName ____ + virtual OUString SAL_CALL getServiceName() 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; + + rtl::Reference< RegressionCurveCalculator > getCurveCalculator(); + +protected: + // ____ 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; + + using ::cppu::OPropertySetHelper::disposing; + + // ____ OPropertySet ____ + virtual void firePropertyChangeEvent() override; + + void fireModifyEvent(); + +private: + const tCurveType m_eRegressionCurveType; + + rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder; + css::uno::Reference< css::beans::XPropertySet > m_xEquationProperties; + void setPropertyMayHaveR2(); +}; + +// implementations for factory instantiation + +class MeanValueRegressionCurve : public RegressionCurveModel +{ +public: + explicit MeanValueRegressionCurve(); + explicit MeanValueRegressionCurve( + const MeanValueRegressionCurve & rOther ); + virtual ~MeanValueRegressionCurve() override; + + // ____ XCloneable ____ + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() 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; +}; + +class LinearRegressionCurve : public RegressionCurveModel +{ +public: + explicit LinearRegressionCurve(); + explicit LinearRegressionCurve( const LinearRegressionCurve & rOther ); + virtual ~LinearRegressionCurve() override; + + // ____ XCloneable ____ + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() 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; +}; + +class LogarithmicRegressionCurve : public RegressionCurveModel +{ +public: + explicit LogarithmicRegressionCurve(); + explicit LogarithmicRegressionCurve( const LogarithmicRegressionCurve & rOther ); + virtual ~LogarithmicRegressionCurve() override; + + // ____ XCloneable ____ + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() 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; +}; + +class ExponentialRegressionCurve : public RegressionCurveModel +{ +public: + explicit ExponentialRegressionCurve(); + explicit ExponentialRegressionCurve( const ExponentialRegressionCurve & rOther ); + virtual ~ExponentialRegressionCurve() override; + + // ____ XCloneable ____ + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() 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; +}; + +class PotentialRegressionCurve : public RegressionCurveModel +{ +public: + explicit PotentialRegressionCurve(); + explicit PotentialRegressionCurve( const PotentialRegressionCurve & rOther ); + virtual ~PotentialRegressionCurve() override; + + // ____ XCloneable ____ + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() 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; +}; + +class PolynomialRegressionCurve : public RegressionCurveModel +{ +public: + explicit PolynomialRegressionCurve(); + explicit PolynomialRegressionCurve( const PolynomialRegressionCurve & rOther ); + virtual ~PolynomialRegressionCurve() override; + + // ____ XCloneable ____ + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() 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; +}; + +class MovingAverageRegressionCurve : public RegressionCurveModel +{ +public: + explicit MovingAverageRegressionCurve(); + explicit MovingAverageRegressionCurve( const MovingAverageRegressionCurve & rOther ); + virtual ~MovingAverageRegressionCurve() override; + + // ____ XCloneable ____ + virtual css::uno::Reference< css::util::XCloneable > SAL_CALL createClone() 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; +}; + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/RelativePositionHelper.hxx b/chart2/source/inc/RelativePositionHelper.hxx index 961a55e99f6e..71b25fc153b1 100644 --- a/chart2/source/inc/RelativePositionHelper.hxx +++ b/chart2/source/inc/RelativePositionHelper.hxx @@ -17,13 +17,12 @@ * 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 +#pragma once +#include <config_options.h> #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; } @@ -31,7 +30,7 @@ namespace com::sun::star::chart2 { struct RelativeSize; } namespace chart { -class OOO_DLLPUBLIC_CHARTTOOLS RelativePositionHelper +class RelativePositionHelper { public: /** returns the upper left corner of an object that has size aObjectSize and @@ -61,7 +60,7 @@ public: been changed to the given one. The passed object size is taken into account for shifting the position. */ - SAL_DLLPRIVATE static css::chart2::RelativePosition + static css::chart2::RelativePosition getReanchoredPosition( const css::chart2::RelativePosition & rPosition, const css::chart2::RelativeSize & rObjectSize, @@ -100,6 +99,5 @@ public: }; } //namespace chart -#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/RelativeSizeHelper.hxx b/chart2/source/inc/RelativeSizeHelper.hxx index 517804096100..753d4deabe83 100644 --- a/chart2/source/inc/RelativeSizeHelper.hxx +++ b/chart2/source/inc/RelativeSizeHelper.hxx @@ -16,19 +16,20 @@ * 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 +#pragma once -#include "charttoolsdllapi.hxx" +#include <config_options.h> 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 css = ::com::sun::star; +class SvxShapeText; namespace chart { -class OOO_DLLPUBLIC_CHARTTOOLS RelativeSizeHelper +class RelativeSizeHelper { public: static double calculate( @@ -42,13 +43,15 @@ public: const css::awt::Size & rOldReferenceSize, const css::awt::Size & rNewReferenceSize ); + static void adaptFontSizes( + SvxShapeText& 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 index 31d96d155b91..816b4b2471a7 100644 --- a/chart2/source/inc/ResId.hxx +++ b/chart2/source/inc/ResId.hxx @@ -16,20 +16,15 @@ * 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 +#pragma once #include <rtl/ustring.hxx> -#include "charttoolsdllapi.hxx" +#include <unotools/resmgr.hxx> namespace chart { - -OUString OOO_DLLPUBLIC_CHARTTOOLS SchResId(const char *pId); +OUString SchResId(TranslateId aId); } // 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 index 7314ce84ebbc..6f6310933d1a 100644 --- a/chart2/source/inc/Scaling.hxx +++ b/chart2/source/inc/Scaling.hxx @@ -16,8 +16,7 @@ * 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 +#pragma once #include <com/sun/star/chart2/XScaling.hpp> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -27,7 +26,7 @@ namespace chart { -class LogarithmicScaling : +class LogarithmicScaling final : public ::cppu::WeakImplHelper< css::chart2::XScaling, css::lang::XServiceName, @@ -60,7 +59,7 @@ private: const double m_fLogOfBase; }; -class ExponentialScaling : +class ExponentialScaling final : public ::cppu::WeakImplHelper< css::chart2::XScaling, css::lang::XServiceName, @@ -92,7 +91,7 @@ private: const double m_fBase; }; -class LinearScaling : public ::cppu::WeakImplHelper< +class LinearScaling final : public ::cppu::WeakImplHelper< css::chart2::XScaling, css::lang::XServiceName, css::lang::XServiceInfo @@ -124,7 +123,7 @@ private: const double m_fOffset; }; -class PowerScaling : public ::cppu::WeakImplHelper< +class PowerScaling final : public ::cppu::WeakImplHelper< css::chart2::XScaling, css::lang::XServiceName, css::lang::XServiceInfo @@ -156,6 +155,5 @@ private: }; } //namespace chart -#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/SceneProperties.hxx b/chart2/source/inc/SceneProperties.hxx index 9fedd60a643f..69eaec2b4c16 100644 --- a/chart2/source/inc/SceneProperties.hxx +++ b/chart2/source/inc/SceneProperties.hxx @@ -16,12 +16,11 @@ * 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 +#pragma once +#include <config_options.h> #include "PropertyHelper.hxx" #include "FastPropertyIdRanges.hxx" -#include "charttoolsdllapi.hxx" #include <vector> @@ -72,14 +71,12 @@ namespace SceneProperties PROP_SCENE_LIGHT_ON_8 }; - OOO_DLLPUBLIC_CHARTTOOLS void AddPropertiesToVector( + void AddPropertiesToVector( std::vector< css::beans::Property > & rOutProperties ); - OOO_DLLPUBLIC_CHARTTOOLS void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ); + 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 index 14e5fe6ee71e..718befc4e533 100644 --- a/chart2/source/inc/StackMode.hxx +++ b/chart2/source/inc/StackMode.hxx @@ -16,8 +16,7 @@ * 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 +#pragma once namespace chart { @@ -33,7 +32,4 @@ enum class StackMode } // 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 index d9793456917f..44fcb600d38c 100644 --- a/chart2/source/inc/StatisticsHelper.hxx +++ b/chart2/source/inc/StatisticsHelper.hxx @@ -16,57 +16,54 @@ * 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 +#pragma once +#include <config_options.h> #include <com/sun/star/uno/Reference.h> #include <rtl/ustring.hxx> -#include "charttoolsdllapi.hxx" +#include <rtl/ref.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 { class DataSeries; } -namespace chart -{ - -namespace StatisticsHelper +namespace chart::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 ); + double getVariance( const css::uno::Sequence< double > & rData ); // square root of the variance - OOO_DLLPUBLIC_CHARTTOOLS double getStandardDeviation( const css::uno::Sequence< double > & rData ); + 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 ); + double getStandardError( const css::uno::Sequence< double > & rData ); - OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::chart2::data::XLabeledDataSequence > + 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 > + 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( + double getErrorFromDataSource( const css::uno::Reference< css::chart2::data::XDataSource > & xDataSource, sal_Int32 nIndex, bool bPositiveValue, bool bYError = true ); - OOO_DLLPUBLIC_CHARTTOOLS void setErrorDataSequence( + void setErrorDataSequence( const css::uno::Reference< css::chart2::data::XDataSource > & xDataSource, const css::uno::Reference< css::chart2::data::XDataProvider > & xDataProvider, const OUString & rNewRange, @@ -75,33 +72,29 @@ namespace StatisticsHelper OUString const * pXMLRange = nullptr ); /// @return the newly created or existing error bar object - OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::beans::XPropertySet > + css::uno::Reference< css::beans::XPropertySet > addErrorBars( - const css::uno::Reference< css::chart2::XDataSeries > & xDataSeries, + const rtl::Reference< ::chart::DataSeries > & xDataSeries, sal_Int32 nStyle, bool bYError = true ); - OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference< css::beans::XPropertySet > + css::uno::Reference< css::beans::XPropertySet > getErrorBars( - const css::uno::Reference< css::chart2::XDataSeries > & xDataSeries, + const rtl::Reference< ::chart::DataSeries > & xDataSeries, bool bYError = true ); - OOO_DLLPUBLIC_CHARTTOOLS bool hasErrorBars( - const css::uno::Reference< css::chart2::XDataSeries > & xDataSeries, + bool hasErrorBars( + const rtl::Reference< ::chart::DataSeries > & xDataSeries, bool bYError = true ); - OOO_DLLPUBLIC_CHARTTOOLS void removeErrorBars( - const css::uno::Reference< css::chart2::XDataSeries > & xDataSeries, + void removeErrorBars( + const rtl::Reference< ::chart::DataSeries > & xDataSeries, bool bYError = true ); - OOO_DLLPUBLIC_CHARTTOOLS bool usesErrorBarRanges( - const css::uno::Reference< css::chart2::XDataSeries > & xDataSeries, + bool usesErrorBarRanges( + const rtl::Reference< ::chart::DataSeries > & 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 index 52c97392b5c9..04df1f8a22a3 100644 --- a/chart2/source/inc/ThreeDHelper.hxx +++ b/chart2/source/inc/ThreeDHelper.hxx @@ -17,19 +17,17 @@ * 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 +#pragma once +#include <config_options.h> #include <com/sun/star/drawing/CameraGeometry.hpp> -#include "charttoolsdllapi.hxx" - -namespace com::sun::star::beans { class XPropertySet; } -namespace com::sun::star::chart2 { class XDiagram; } +#include <rtl/ref.hxx> namespace chart { +class Diagram; -enum ThreeDLookScheme +enum class ThreeDLookScheme { ThreeDLookScheme_Simple, ThreeDLookScheme_Realistic, @@ -46,7 +44,7 @@ enum CuboidPlanePosition CuboidPlanePosition_Back }; -class OOO_DLLPUBLIC_CHARTTOOLS ThreeDHelper +class ThreeDHelper { public: @@ -58,23 +56,6 @@ public: */ 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; } @@ -85,48 +66,32 @@ public: sal_Int32 nElevationDeg, sal_Int32 nRotationDeg , double& rfXAngleRad, double& rfYAngleRad, double& rfZAngleRad ); - SAL_DLLPRIVATE static void convertXYZAngleRadToElevationRotationDeg( + 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 void ensureCameraDistanceRange( double& rfCameraDistance ); + 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 ); + static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardLeftWall( const rtl::Reference< + ::chart::Diagram >& xDiagram ); + static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBackWall(const rtl::Reference< + ::chart::Diagram >& xDiagram ); + static CuboidPlanePosition getAutomaticCuboidPlanePositionForStandardBottom(const rtl::Reference< + ::chart::Diagram >& xDiagram ); //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 + static void getRoundedEdgesAndObjectLines( const rtl::Reference< ::chart::Diagram >& xDiagram , sal_Int32& rnRoundedEdges, sal_Int32& rnObjectLines ); - static void setRoundedEdgesAndObjectLines( const css::uno::Reference< css::chart2::XDiagram >& xDiagram + static void setRoundedEdgesAndObjectLines( const rtl::Reference< ::chart::Diagram >& xDiagram , sal_Int32 nRoundedEdges, sal_Int32 nObjectLines ); }; } //namespace chart -#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/TrueGuard.hxx b/chart2/source/inc/TimerTriggeredControllerLock.hxx index 109c64a06c03..d7a5d7652ce9 100644 --- a/chart2/source/inc/TrueGuard.hxx +++ b/chart2/source/inc/TimerTriggeredControllerLock.hxx @@ -16,24 +16,39 @@ * 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 + +#pragma once + +#include <vcl/timer.hxx> +#include <rtl/ref.hxx> + +#include <memory> namespace chart { -/** This guard sets the given boolean reference to true in the constructor and to false in the destructor - */ -class TrueGuard final +class ControllerLockGuardUNO; +} + +namespace chart +{ +class ChartModel; + +class TimerTriggeredControllerLock final { public: - explicit TrueGuard(bool& rbTrueDuringGuardedTime); - ~TrueGuard(); + TimerTriggeredControllerLock(rtl::Reference<::chart::ChartModel> xModel); + ~TimerTriggeredControllerLock(); + + void startTimer(); private: - bool& m_rbTrueDuringGuardedTime; + rtl::Reference<::chart::ChartModel> m_xModel; + std::unique_ptr<ControllerLockGuardUNO> m_apControllerLockGuard; + AutoTimer m_aTimer; + + DECL_LINK(TimerTimeout, Timer*, void); }; -} -// INCLUDED_CHART2_SOURCE_INC_TRUEGUARD_HXX -#endif + +} //namespace chart /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/Title.hxx b/chart2/source/inc/Title.hxx new file mode 100644 index 000000000000..ba16c5377617 --- /dev/null +++ b/chart2/source/inc/Title.hxx @@ -0,0 +1,109 @@ +/* -*- 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 . + */ +#pragma once + +#include "OPropertySet.hxx" +#include <cppuhelper/implbase.hxx> +#include <comphelper/uno3.hxx> +#include <com/sun/star/chart2/XTitle.hpp> +#include <com/sun/star/lang/XServiceInfo.hpp> +#include <com/sun/star/util/XCloneable.hpp> +#include "ModifyListenerHelper.hxx" + +namespace chart +{ + +namespace impl +{ +typedef ::cppu::WeakImplHelper< + css::chart2::XTitle, + css::lang::XServiceInfo, + css::util::XCloneable, + css::util::XModifyBroadcaster, + css::util::XModifyListener > + Title_Base; +} + +class Title final : + public impl::Title_Base, + public ::property::OPropertySet +{ +public: + explicit Title(); + virtual ~Title() 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; + + /// merge XInterface implementations + DECLARE_XINTERFACE() + /// merge XTypeProvider implementations + DECLARE_XTYPEPROVIDER() + + explicit Title( const Title & rOther ); + + // ____ OPropertySet ____ + virtual void GetDefaultValue( sal_Int32 nHandle, css::uno::Any& rAny ) const override; + + // ____ OPropertySet ____ + virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; + + // ____ XPropertySet ____ + virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL + getPropertySetInfo() override; + + // ____ XTitle ____ + virtual css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > > SAL_CALL getText() override; + virtual void SAL_CALL setText( const css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > >& Strings ) 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: + + // ____ 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; + + // ____ OPropertySet ____ + virtual void firePropertyChangeEvent() override; + using OPropertySet::disposing; + + void fireModifyEvent(); + + css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > > m_aStrings; + + rtl::Reference<ModifyEventForwarder> m_xModifyEventForwarder; +}; + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/TitleHelper.hxx b/chart2/source/inc/TitleHelper.hxx index e16beda39134..3f52ab105f8d 100644 --- a/chart2/source/inc/TitleHelper.hxx +++ b/chart2/source/inc/TitleHelper.hxx @@ -16,23 +16,21 @@ * 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 +#pragma once #include <com/sun/star/uno/Reference.h> +#include <rtl/ref.hxx> #include <rtl/ustring.hxx> -#include "charttoolsdllapi.hxx" +#include "Title.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 +class TitleHelper { public: enum eTitleType @@ -52,51 +50,46 @@ public: TITLE_AT_STANDARD_Y_AXIS_POSITION //equals the X_AXIS_TITLE for barchart }; - static css::uno::Reference< css::chart2::XTitle > + static rtl::Reference< ::chart::Title > getTitle( eTitleType nTitleIndex , ChartModel& rModel ); - static css::uno::Reference< css::chart2::XTitle > + static rtl::Reference< ::chart::Title > getTitle( eTitleType nTitleIndex - , const css::uno::Reference< css::frame::XModel >& xModel ); + , const rtl::Reference< ::chart::ChartModel >& xModel ); - static css::uno::Reference< - css::chart2::XTitle > + static rtl::Reference< ::chart::Title > createTitle( eTitleType nTitleIndex , const OUString& rTitleText - , const css::uno::Reference< css::frame::XModel >& xModel + , const rtl::Reference< ::chart::ChartModel >& xModel , const css::uno::Reference< css::uno::XComponentContext > & xContext , ReferenceSizeProvider * pRefSizeProvider = nullptr ); - static css::uno::Reference< - css::chart2::XTitle > + static rtl::Reference< ::chart::Title > createOrShowTitle( eTitleType nTitleIndex , const OUString& rTitleText - , const css::uno::Reference< css::frame::XModel >& xModel + , const rtl::Reference< ::chart::ChartModel >& xModel , const css::uno::Reference< css::uno::XComponentContext > & xContex ); static void removeTitle( eTitleType nTitleIndex - , const css::uno::Reference< css::frame::XModel >& xModel ); + , const rtl::Reference< ::chart::ChartModel >& 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 OUString getCompleteString( const rtl::Reference< ::chart::Title >& xTitle ); + static OUString getUnstackedStr( const OUString& rNewText ); + static void setFormattedString( const rtl::Reference< ::chart::Title >& xTitle, + const css::uno::Sequence< css::uno::Reference< css::chart2::XFormattedString > >& aNewFormattedTitle ); static void setCompleteString( const OUString& rNewText - , const css::uno::Reference< css::chart2::XTitle >& xTitle + , const rtl::Reference< ::chart::Title >& 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); + , const float * pDefaultCharHeight = nullptr + , bool bDialogTitle = false ); static bool getTitleType( eTitleType& rType - , const css::uno::Reference< css::chart2::XTitle >& xTitle - , const css::uno::Reference< css::frame::XModel >& xModel ); + , const rtl::Reference< ::chart::Title >& xTitle + , const rtl::Reference< ::chart::ChartModel >& xModel ); + static void hideTitle( eTitleType nTitleIndex, + const rtl::Reference< ::chart::ChartModel > & xModel); }; } //namespace chart -#endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/UncachedDataSequence.hxx b/chart2/source/inc/UncachedDataSequence.hxx index 0829ceffafa0..5691413af528 100644 --- a/chart2/source/inc/UncachedDataSequence.hxx +++ b/chart2/source/inc/UncachedDataSequence.hxx @@ -16,15 +16,15 @@ * 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 +#pragma once // helper classes -#include <cppuhelper/compbase.hxx> +#include <comphelper/compbase.hxx> #include <comphelper/uno3.hxx> #include <comphelper/broadcasthelper.hxx> -#include <comphelper/propertycontainer.hxx> +#include <comphelper/propertycontainer2.hxx> #include <comphelper/proparrhlp.hxx> +#include <rtl/ref.hxx> // interfaces and types #include <com/sun/star/lang/XServiceInfo.hpp> @@ -37,14 +37,15 @@ #include <com/sun/star/util/XModifiable.hpp> namespace com::sun::star::beans { class XPropertySetInfo; } -namespace com::sun::star::chart2 { class XInternalDataProvider; } namespace chart { +class InternalDataProvider; +class ModifyEventForwarder; namespace impl { -typedef ::cppu::WeakComponentImplHelper< +typedef ::comphelper::WeakComponentImplHelper< css::chart2::data::XDataSequence, css::chart2::data::XNumericalDataSequence, css::chart2::data::XTextualDataSequence, @@ -67,8 +68,7 @@ typedef ::cppu::WeakComponentImplHelper< * 'label 2', ...</p> */ class UncachedDataSequence final : - public ::comphelper::OMutexAndBroadcastHelper, - public ::comphelper::OPropertyContainer, + public ::comphelper::OPropertyContainer2, public ::comphelper::OPropertyArrayUsageHelper< UncachedDataSequence >, public impl::UncachedDataSequence_Base { @@ -77,11 +77,11 @@ public: lifetime is at least as long as the one of this object. */ UncachedDataSequence( - const css::uno::Reference< css::chart2::XInternalDataProvider > & xIntDataProv, - const OUString & rRangeRepresentation ); + rtl::Reference< InternalDataProvider > xIntDataProv, + OUString aRangeRepresentation ); UncachedDataSequence( - const css::uno::Reference< css::chart2::XInternalDataProvider > & xIntDataProv, - const OUString & rRangeRepresentation, + rtl::Reference< InternalDataProvider > xIntDataProv, + OUString aRangeRepresentation, const OUString & rRole ); UncachedDataSequence( const UncachedDataSequence & rSource ); virtual ~UncachedDataSequence() override; @@ -101,7 +101,7 @@ private: /// @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; + virtual ::cppu::IPropertyArrayHelper& getInfoHelper() override; /// @see ::comphelper::OPropertyArrayUsageHelper virtual ::cppu::IPropertyArrayHelper* createArrayHelper() const override; @@ -161,15 +161,11 @@ private: */ void registerProperties(); - css::uno::Reference< css::chart2::XInternalDataProvider > m_xDataProvider; - OUString m_aSourceRepresentation; - css::uno::Reference< css::util::XModifyListener > - m_xModifyEventForwarder; + rtl::Reference< InternalDataProvider > m_xDataProvider; + OUString m_aSourceRepresentation; + rtl::Reference<ModifyEventForwarder> 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 index 93d7af9fda42..0254cafe7035 100644 --- a/chart2/source/inc/UserDefinedProperties.hxx +++ b/chart2/source/inc/UserDefinedProperties.hxx @@ -16,15 +16,15 @@ * 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 +#pragma once +#include <config_options.h> #include "FastPropertyIdRanges.hxx" -#include "charttoolsdllapi.hxx" #include <vector> namespace com::sun::star::beans { struct Property; } +namespace css = ::com::sun::star; namespace chart { @@ -46,13 +46,10 @@ namespace UserDefinedProperties PROP_XML_USERDEF }; - OOO_DLLPUBLIC_CHARTTOOLS void AddPropertiesToVector( + 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 index 08568f25316a..e312f7bee56f 100644 --- a/chart2/source/inc/WeakListenerAdapter.hxx +++ b/chart2/source/inc/WeakListenerAdapter.hxx @@ -16,11 +16,9 @@ * 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 +#pragma once #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> @@ -40,68 +38,33 @@ namespace chart 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 > +class WeakSelectionChangeListenerAdapter final : + public ::cppu::WeakImplHelper< css::view::XSelectionChangeListener > { public: - explicit WeakListenerAdapter( const css::uno::Reference< Listener > & xListener ) : - m_xListener( xListener ) - {} - explicit WeakListenerAdapter( const css::uno::WeakReference< Listener > & xListener ) : - m_xListener( xListener ) - {} + explicit WeakSelectionChangeListenerAdapter( + const css::uno::Reference< css::view::XSelectionChangeListener > & xListener ) + : m_xListener( xListener ) {} + virtual ~WeakSelectionChangeListenerAdapter() override; protected: + // ____ XSelectionChangeListener ____ + virtual void SAL_CALL selectionChanged( + const css::lang::EventObject& aEvent ) override; + // ____ 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 ); + css::uno::Reference< css::view::XSelectionChangeListener > xEventListener( m_xListener ); 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; + css::uno::WeakReference< css::view::XSelectionChangeListener > m_xListener; }; } // 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 index a3632118171d..d793cfdd15fe 100644 --- a/chart2/source/inc/WrappedDefaultProperty.hxx +++ b/chart2/source/inc/WrappedDefaultProperty.hxx @@ -16,21 +16,19 @@ * 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 +#pragma once #include "WrappedProperty.hxx" -#include "charttoolsdllapi.hxx" namespace chart { -class OOO_DLLPUBLIC_CHARTTOOLS WrappedDefaultProperty : public WrappedProperty +class WrappedDefaultProperty : public WrappedProperty { public: explicit WrappedDefaultProperty( const OUString& rOuterName, const OUString& rInnerName, - const css::uno::Any& rNewOuterDefault ); + css::uno::Any aNewOuterDefault ); virtual ~WrappedDefaultProperty() override; virtual void setPropertyToDefault( @@ -48,6 +46,5 @@ private: } // 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 index ba2bc0aac459..afc1237f7d17 100644 --- a/chart2/source/inc/WrappedDirectStateProperty.hxx +++ b/chart2/source/inc/WrappedDirectStateProperty.hxx @@ -16,30 +16,24 @@ * 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 +#pragma once #include "WrappedProperty.hxx" -#include "charttoolsdllapi.hxx" namespace chart { - -class OOO_DLLPUBLIC_CHARTTOOLS WrappedDirectStateProperty : - public WrappedProperty +class WrappedDirectStateProperty : public WrappedProperty { public: - explicit WrappedDirectStateProperty( - const OUString& rOuterName, const OUString& rInnerName ); + 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; + 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 index 185e06d663a5..0340358c8122 100644 --- a/chart2/source/inc/WrappedIgnoreProperty.hxx +++ b/chart2/source/inc/WrappedIgnoreProperty.hxx @@ -16,18 +16,16 @@ * 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 +#pragma once #include "WrappedProperty.hxx" -#include "charttoolsdllapi.hxx" #include <vector> namespace chart { -class OOO_DLLPUBLIC_CHARTTOOLS WrappedIgnoreProperty final : public WrappedProperty +class WrappedIgnoreProperty final : public WrappedProperty { public: WrappedIgnoreProperty( const OUString& rOuterName, const css::uno::Any& rDefaultValue ); @@ -37,30 +35,27 @@ public: 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; +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; +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; +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 +class 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 ); + static void addIgnoreFillProperties_without_BitmapProperties( std::vector< std::unique_ptr<WrappedProperty> >& rList ); + 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 index 82b9f3b0cbd9..d2560cfa783d 100644 --- a/chart2/source/inc/WrappedProperty.hxx +++ b/chart2/source/inc/WrappedProperty.hxx @@ -16,13 +16,12 @@ * 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 +#pragma once +#include <config_options.h> #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> @@ -34,13 +33,13 @@ namespace com::sun::star::uno { template <class interface_type> class Reference; namespace chart { -class OOO_DLLPUBLIC_CHARTTOOLS WrappedProperty +class 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 ); + WrappedProperty( OUString aOuterName, OUString aInnerName ); virtual ~WrappedProperty(); const OUString& getOuterName() const { return m_aOuterName;} @@ -84,7 +83,4 @@ typedef std::map< sal_Int32, std::unique_ptr<const WrappedProperty> > tWrappedPr } //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 index 09c768fc75f0..88dd8248d6e9 100644 --- a/chart2/source/inc/WrappedPropertySet.hxx +++ b/chart2/source/inc/WrappedPropertySet.hxx @@ -16,12 +16,10 @@ * 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 +#pragma once +#include <config_options.h> #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> @@ -29,6 +27,7 @@ #include <cppuhelper/implbase.hxx> #include <memory> +#include <mutex> #include <vector> namespace cppu { class IPropertyArrayHelper; } @@ -37,9 +36,8 @@ namespace cppu { class OPropertyArrayHelper; } namespace chart { -class OOO_DLLPUBLIC_CHARTTOOLS WrappedPropertySet : - public MutexContainer - , public ::cppu::WeakImplHelper +class WrappedPropertySet : + public ::cppu::WeakImplHelper < css::beans::XPropertySet , css::beans::XMultiPropertySet , css::beans::XPropertyState @@ -96,15 +94,17 @@ protected: //methods 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(); + css::uno::Reference< css::beans::XPropertyState > getInnerPropertyState(); ::cppu::IPropertyArrayHelper& getInfoHelper(); - SAL_DLLPRIVATE tWrappedPropertyMap& getWrappedPropertyMap(); + tWrappedPropertyMap& getWrappedPropertyMap(); const WrappedProperty* getWrappedProperty( const OUString& rOuterName ); const WrappedProperty* getWrappedProperty( sal_Int32 nHandle ); -protected: //member + std::mutex m_aMutex; + +private: css::uno::Reference< css::beans::XPropertySetInfo > m_xInfo;//outer PropertySetInfo std::unique_ptr<::cppu::OPropertyArrayHelper> m_pPropertyArrayHelper;//holds all possible outer properties @@ -120,7 +120,4 @@ protected: //member } //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 index 207770dbbed9..ba8ac8481e0f 100644 --- a/chart2/source/inc/XMLRangeHelper.hxx +++ b/chart2/source/inc/XMLRangeHelper.hxx @@ -16,19 +16,15 @@ * 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 +#pragma once #include <sal/types.h> #include <rtl/ustring.hxx> -#include "charttoolsdllapi.hxx" -namespace chart -{ -namespace XMLRangeHelper +namespace chart::XMLRangeHelper { -struct OOO_DLLPUBLIC_CHARTTOOLS Cell +struct Cell { sal_Int32 nColumn; sal_Int32 nRow; @@ -47,7 +43,7 @@ struct OOO_DLLPUBLIC_CHARTTOOLS Cell bool empty() const { return bIsEmpty; } }; -struct OOO_DLLPUBLIC_CHARTTOOLS CellRange +struct CellRange { Cell aUpperLeft; Cell aLowerRight; @@ -58,10 +54,6 @@ CellRange getCellRangeFromXMLString( const OUString & rXMLString ); OUString getXMLStringFromCellRange( const CellRange & rRange ); -} // namespace XMLRangeHelper -} // namespace chart - -// INCLUDED_CHART2_SOURCE_INC_XMLRANGEHELPER_HXX -#endif +} // namespace chart::XMLRangeHelper /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/chartview/ChartSfxItemIds.hxx b/chart2/source/inc/chartview/ChartSfxItemIds.hxx index 2d02f2f8bd2b..43341728d4da 100644 --- a/chart2/source/inc/chartview/ChartSfxItemIds.hxx +++ b/chart2/source/inc/chartview/ChartSfxItemIds.hxx @@ -16,8 +16,7 @@ * 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 +#pragma once #include <svl/typedwhich.hxx> @@ -33,165 +32,181 @@ class SvxBrushItem; class SvxChartKindErrorItem; class SvxChartTextOrderItem; class SvxChartRegressItem; +class SdrAngleItem; +class SvxChartColorPaletteItem; // 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); +inline constexpr sal_uInt16 SCHATTR_START = 1; + +inline constexpr sal_uInt16 SCHATTR_DATADESCR_START (SCHATTR_START); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATADESCR_SHOW_NUMBER (SCHATTR_DATADESCR_START); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATADESCR_SHOW_PERCENTAGE (SCHATTR_DATADESCR_START + 1); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATADESCR_SHOW_CATEGORY (SCHATTR_DATADESCR_START + 2); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATADESCR_SHOW_SYMBOL (SCHATTR_DATADESCR_START + 3); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATADESCR_WRAP_TEXT (SCHATTR_DATADESCR_START + 4); +inline constexpr TypedWhichId<SfxStringItem> SCHATTR_DATADESCR_SEPARATOR (SCHATTR_DATADESCR_START + 5); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_DATADESCR_PLACEMENT (SCHATTR_DATADESCR_START + 6); +inline constexpr TypedWhichId<SfxIntegerListItem> SCHATTR_DATADESCR_AVAILABLE_PLACEMENTS (SCHATTR_DATADESCR_START + 7); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATADESCR_NO_PERCENTVALUE (SCHATTR_DATADESCR_START + 8); //percentage values should not be offered +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATADESCR_CUSTOM_LEADER_LINES (SCHATTR_DATADESCR_START + 9); +inline constexpr TypedWhichId<SfxUInt32Item> SCHATTR_PERCENT_NUMBERFORMAT_VALUE (SCHATTR_DATADESCR_START + 10); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_PERCENT_NUMBERFORMAT_SOURCE (SCHATTR_DATADESCR_START + 11); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME (SCHATTR_DATADESCR_START + 12); +inline constexpr sal_uInt16 SCHATTR_DATADESCR_END (SCHATTR_DATADESCR_SHOW_DATA_SERIES_NAME); //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); +inline constexpr sal_uInt16 SCHATTR_LEGEND_START (SCHATTR_DATADESCR_END + 1); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_LEGEND_POS (SCHATTR_LEGEND_START); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_LEGEND_SHOW (SCHATTR_LEGEND_START + 1); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_LEGEND_NO_OVERLAY (SCHATTR_LEGEND_START + 2); +inline 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); +inline constexpr sal_uInt16 SCHATTR_TEXT_START (SCHATTR_LEGEND_END + 1); +inline constexpr TypedWhichId<SdrAngleItem> SCHATTR_TEXT_DEGREES (SCHATTR_TEXT_START); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_TEXT_STACKED (SCHATTR_TEXT_START + 1); +inline 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); +inline constexpr sal_uInt16 SCHATTR_STAT_START (SCHATTR_TEXT_END + 1); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_STAT_AVERAGE (SCHATTR_STAT_START); +inline constexpr TypedWhichId<SvxChartKindErrorItem> SCHATTR_STAT_KIND_ERROR (SCHATTR_STAT_START + 1); +inline constexpr TypedWhichId<SvxDoubleItem> SCHATTR_STAT_PERCENT (SCHATTR_STAT_START + 2); +inline constexpr TypedWhichId<SvxDoubleItem> SCHATTR_STAT_BIGERROR (SCHATTR_STAT_START + 3); +inline constexpr TypedWhichId<SvxDoubleItem> SCHATTR_STAT_CONSTPLUS (SCHATTR_STAT_START + 4); +inline constexpr TypedWhichId<SvxDoubleItem> SCHATTR_STAT_CONSTMINUS (SCHATTR_STAT_START + 5); +inline constexpr TypedWhichId<SvxChartIndicateItem> SCHATTR_STAT_INDICATE (SCHATTR_STAT_START + 6); +inline constexpr TypedWhichId<SfxStringItem> SCHATTR_STAT_RANGE_POS (SCHATTR_STAT_START + 7); +inline constexpr TypedWhichId<SfxStringItem> SCHATTR_STAT_RANGE_NEG (SCHATTR_STAT_START + 8); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_STAT_ERRORBAR_TYPE (SCHATTR_STAT_START + 9); +inline 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); +inline 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); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_STYLE_DEEP (SCHATTR_STYLE_START ); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_STYLE_3D (SCHATTR_STYLE_START + 1); +inline 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); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_STYLE_BASETYPE (SCHATTR_STYLE_START + 3);// Line,Area,...,Pie +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_STYLE_LINES (SCHATTR_STYLE_START + 4);// draw line +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_STYLE_PERCENT (SCHATTR_STYLE_START + 5); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_STYLE_STACKED (SCHATTR_STYLE_START + 6); +inline 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 ); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_STYLE_SYMBOL (SCHATTR_STYLE_START + 8); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_STYLE_SHAPE (SCHATTR_STYLE_START + 9); +inline 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. +inline 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); +inline 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); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXISTYPE (SCHATTR_AXIS_START); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_REVERSE (SCHATTR_AXIS_START + 1); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_AUTO_MIN (SCHATTR_AXIS_START + 2); +inline constexpr TypedWhichId<SvxDoubleItem> SCHATTR_AXIS_MIN (SCHATTR_AXIS_START + 3); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_AUTO_MAX (SCHATTR_AXIS_START + 4); +inline constexpr TypedWhichId<SvxDoubleItem> SCHATTR_AXIS_MAX (SCHATTR_AXIS_START + 5); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_AUTO_STEP_MAIN (SCHATTR_AXIS_START + 6); +inline constexpr TypedWhichId<SvxDoubleItem> SCHATTR_AXIS_STEP_MAIN (SCHATTR_AXIS_START + 7); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXIS_MAIN_TIME_UNIT (SCHATTR_AXIS_START + 8); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_AUTO_STEP_HELP (SCHATTR_AXIS_START + 9); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXIS_STEP_HELP (SCHATTR_AXIS_START + 10); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXIS_HELP_TIME_UNIT (SCHATTR_AXIS_START + 11); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_AUTO_TIME_RESOLUTION (SCHATTR_AXIS_START + 12); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXIS_TIME_RESOLUTION (SCHATTR_AXIS_START + 13); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_LOGARITHM (SCHATTR_AXIS_START + 14); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_AUTO_DATEAXIS (SCHATTR_AXIS_START + 15); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_ALLOW_DATEAXIS (SCHATTR_AXIS_START + 16); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_AUTO_ORIGIN (SCHATTR_AXIS_START + 17); +inline 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); +inline constexpr sal_uInt16 SCHATTR_AXIS_POSITION_START (SCHATTR_AXIS_ORIGIN + 1); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXIS_TICKS (SCHATTR_AXIS_POSITION_START); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXIS_HELPTICKS (SCHATTR_AXIS_POSITION_START + 1); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXIS_POSITION (SCHATTR_AXIS_POSITION_START + 2); +inline constexpr TypedWhichId<SvxDoubleItem> SCHATTR_AXIS_POSITION_VALUE (SCHATTR_AXIS_POSITION_START + 3); +inline constexpr TypedWhichId<SfxUInt32Item> SCHATTR_AXIS_CROSSING_MAIN_AXIS_NUMBERFORMAT (SCHATTR_AXIS_POSITION_START + 4); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_SHIFTED_CATEGORY_POSITION (SCHATTR_AXIS_POSITION_START + 5); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXIS_LABEL_POSITION (SCHATTR_AXIS_POSITION_START + 6); +inline 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); +inline constexpr sal_uInt16 SCHATTR_AXIS_LABEL_START (SCHATTR_AXIS_MARK_POSITION + 1); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_SHOWDESCR (SCHATTR_AXIS_LABEL_START); +inline constexpr TypedWhichId<SvxChartTextOrderItem> SCHATTR_AXIS_LABEL_ORDER (SCHATTR_AXIS_LABEL_START + 1); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_LABEL_OVERLAP (SCHATTR_AXIS_LABEL_START + 2); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_AXIS_LABEL_BREAK (SCHATTR_AXIS_LABEL_START + 3); +inline constexpr sal_uInt16 SCHATTR_AXIS_LABEL_END (SCHATTR_AXIS_LABEL_BREAK); -constexpr sal_uInt16 SCHATTR_AXIS_END (SCHATTR_AXIS_LABEL_END); +inline 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); +inline constexpr TypedWhichId<SvxBrushItem> SCHATTR_SYMBOL_BRUSH (SCHATTR_AXIS_END + 1); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_STOCK_VOLUME (SCHATTR_AXIS_END + 2); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_STOCK_UPDOWN (SCHATTR_AXIS_END + 3); +inline constexpr TypedWhichId<SvxSizeItem> SCHATTR_SYMBOL_SIZE (SCHATTR_AXIS_END + 4); +inline 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); +inline 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); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_BAR_OVERLAP (SCHATTR_CHARTTYPE_START ); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_BAR_GAPWIDTH (SCHATTR_CHARTTYPE_START + 1); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_BAR_CONNECT (SCHATTR_CHARTTYPE_START + 2); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_NUM_OF_LINES_FOR_BAR (SCHATTR_CHARTTYPE_START + 3); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_SPLINE_ORDER (SCHATTR_CHARTTYPE_START + 4); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_SPLINE_RESOLUTION (SCHATTR_CHARTTYPE_START + 5); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_GROUP_BARS_PER_AXIS (SCHATTR_CHARTTYPE_START + 6); +inline constexpr TypedWhichId<SdrAngleItem> SCHATTR_STARTING_ANGLE (SCHATTR_CHARTTYPE_START + 7); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_CLOCKWISE (SCHATTR_CHARTTYPE_START + 8); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_MISSING_VALUE_TREATMENT (SCHATTR_CHARTTYPE_START + 9); +inline constexpr TypedWhichId<SfxIntegerListItem> SCHATTR_AVAILABLE_MISSING_VALUE_TREATMENTS (SCHATTR_CHARTTYPE_START + 10); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_INCLUDE_HIDDEN_CELLS (SCHATTR_CHARTTYPE_START + 11); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_HIDE_LEGEND_ENTRY (SCHATTR_CHARTTYPE_START + 12); + +inline 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); +inline constexpr sal_uInt16 SCHATTR_MISC_START (SCHATTR_CHARTTYPE_END + 1); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_AXIS_FOR_ALL_SERIES (SCHATTR_MISC_START); +inline 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); +inline constexpr sal_uInt16 SCHATTR_REGRESSION_START (SCHATTR_MISC_END + 1); +inline constexpr TypedWhichId<SvxChartRegressItem> SCHATTR_REGRESSION_TYPE (SCHATTR_REGRESSION_START); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_REGRESSION_SHOW_EQUATION (SCHATTR_REGRESSION_START + 1); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_REGRESSION_SHOW_COEFF (SCHATTR_REGRESSION_START + 2); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_REGRESSION_DEGREE (SCHATTR_REGRESSION_START + 3); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_REGRESSION_PERIOD (SCHATTR_REGRESSION_START + 4); +inline constexpr TypedWhichId<SvxDoubleItem> SCHATTR_REGRESSION_EXTRAPOLATE_FORWARD (SCHATTR_REGRESSION_START + 5); +inline constexpr TypedWhichId<SvxDoubleItem> SCHATTR_REGRESSION_EXTRAPOLATE_BACKWARD (SCHATTR_REGRESSION_START + 6); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_REGRESSION_SET_INTERCEPT (SCHATTR_REGRESSION_START + 7); +inline constexpr TypedWhichId<SvxDoubleItem> SCHATTR_REGRESSION_INTERCEPT_VALUE (SCHATTR_REGRESSION_START + 8); +inline constexpr TypedWhichId<SfxStringItem> SCHATTR_REGRESSION_CURVE_NAME (SCHATTR_REGRESSION_START + 9); +inline constexpr TypedWhichId<SfxStringItem> SCHATTR_REGRESSION_XNAME (SCHATTR_REGRESSION_START + 10); +inline constexpr TypedWhichId<SfxStringItem> SCHATTR_REGRESSION_YNAME (SCHATTR_REGRESSION_START + 11); +inline constexpr TypedWhichId<SfxInt32Item> SCHATTR_REGRESSION_MOVING_TYPE (SCHATTR_REGRESSION_START + 12); +inline constexpr sal_uInt16 SCHATTR_REGRESSION_END (SCHATTR_REGRESSION_MOVING_TYPE); + +inline constexpr sal_uInt16 SCHATTR_DATA_TABLE_START (SCHATTR_REGRESSION_END + 1); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATA_TABLE_HORIZONTAL_BORDER (SCHATTR_DATA_TABLE_START + 0); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATA_TABLE_VERTICAL_BORDER (SCHATTR_DATA_TABLE_START + 1); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATA_TABLE_OUTLINE (SCHATTR_DATA_TABLE_START + 2); +inline constexpr TypedWhichId<SfxBoolItem> SCHATTR_DATA_TABLE_KEYS (SCHATTR_DATA_TABLE_START + 3); +inline constexpr sal_uInt16 SCHATTR_DATA_TABLE_END (SCHATTR_DATA_TABLE_KEYS); + +inline constexpr sal_uInt16 SCHATTR_COLOR_PALETTE_START (SCHATTR_DATA_TABLE_END + 1); +inline constexpr TypedWhichId<SvxChartColorPaletteItem> SCHATTR_COLOR_PALETTE (SCHATTR_COLOR_PALETTE_START); +inline constexpr sal_uInt16 SCHATTR_COLOR_PALETTE_END (SCHATTR_COLOR_PALETTE); + +inline constexpr sal_uInt16 SCHATTR_END (SCHATTR_COLOR_PALETTE_END); // values for Items @@ -223,6 +238,4 @@ constexpr sal_uInt16 SCHATTR_END (SCHATTR_REGRESSION_END); #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 index 203c3c390bd1..8c10bd098cc6 100644 --- a/chart2/source/inc/chartview/DataPointSymbolSupplier.hxx +++ b/chart2/source/inc/chartview/DataPointSymbolSupplier.hxx @@ -17,29 +17,24 @@ * 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 +#pragma once -#include <chartview/chartviewdllapi.hxx> -#include <com/sun/star/uno/Reference.h> +#include <rtl/ref.hxx> +#include <svx/unoshape.hxx> -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 +class 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 + static rtl::Reference< SvxShapeGroup > + create2DSymbolList( const rtl::Reference<SvxDrawPage>& 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 index bd9189dbff88..c5101899087d 100644 --- a/chart2/source/inc/chartview/DrawModelWrapper.hxx +++ b/chart2/source/inc/chartview/DrawModelWrapper.hxx @@ -16,18 +16,14 @@ * 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 +#pragma once #include <svx/svdmodel.hxx> - -#include <chartview/chartviewdllapi.hxx> +#include <svx/unopage.hxx> +#include <svx/unoshape.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; @@ -35,42 +31,40 @@ class SdrObject; namespace chart { -class OOO_DLLPUBLIC_CHARTVIEW DrawModelWrapper : private SdrModel +class DrawModelWrapper final : private SdrModel { private: - SfxItemPool* m_pChartItemPool; - - css::uno::Reference< css::drawing::XDrawPage > m_xMainDrawPage; - css::uno::Reference< css::drawing::XDrawPage > m_xHiddenDrawPage; - + rtl::Reference<SvxDrawPage> m_xMainDrawPage; + rtl::Reference<SvxDrawPage> m_xHiddenDrawPage; + rtl::Reference<SfxItemPool> m_xChartItemPool; VclPtr<OutputDevice> m_pRefDevice; public: - SAL_DLLPRIVATE DrawModelWrapper(); - SAL_DLLPRIVATE virtual ~DrawModelWrapper() override; + DrawModelWrapper(); + 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(); + const rtl::Reference<SvxDrawPage> & getMainDrawPage(); + 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(); + const rtl::Reference<SvxDrawPage> & getHiddenDrawPage(); - static css::uno::Reference< css::drawing::XShapes > - getChartRootShape( const css::uno::Reference< css::drawing::XDrawPage>& xPage ); + static rtl::Reference<SvxShapeGroupAnyD> + getChartRootShape( const rtl::Reference<SvxDrawPage>& xPage ); - SAL_DLLPRIVATE void lockControllers(); - SAL_DLLPRIVATE void unlockControllers(); + void lockControllers(); + void unlockControllers(); OutputDevice* getReferenceDevice() const; SfxItemPool& GetItemPool(); - SAL_DLLPRIVATE virtual css::uno::Reference< css::uno::XInterface > + virtual css::uno::Reference< css::frame::XModel > createUnoModel() override; - SAL_DLLPRIVATE css::uno::Reference< css::frame::XModel > + const css::uno::Reference< css::frame::XModel > & getUnoModel(); SdrModel& getSdrModel(); @@ -85,11 +79,10 @@ public: 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 ); + static bool removeShape( const rtl::Reference<SvxShape>& xShape ); void dumpAsXml(xmlTextWriterPtr pWriter) const override; }; } //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 index 731d4c087a91..350d6e35ef67 100644 --- a/chart2/source/inc/chartview/ExplicitScaleValues.hxx +++ b/chart2/source/inc/chartview/ExplicitScaleValues.hxx @@ -16,25 +16,26 @@ * 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 +#pragma once -#include <chartview/chartviewdllapi.hxx> +#include <config_options.h> #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 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 +struct ExplicitScaleData { ExplicitScaleData(); @@ -42,14 +43,14 @@ struct OOO_DLLPUBLIC_CHARTVIEW ExplicitScaleData double Maximum; double Origin; - css::chart2::AxisOrientation Orientation; + css::chart2::AxisOrientation Orientation; - css::uno::Reference< css::chart2::XScaling > Scaling; + 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; + sal_Int32 AxisType; //see css::chart2::AxisType + bool m_bShiftedCategoryPosition; + sal_Int32 TimeResolution; //constant of type <type>css::chart::TimeUnit</type> + Date NullDate; }; struct ExplicitSubIncrement @@ -72,14 +73,14 @@ struct ExplicitSubIncrement /** describes how tickmarks are positioned on the scale of an axis. */ -struct OOO_DLLPUBLIC_CHARTVIEW ExplicitIncrementData +struct ExplicitIncrementData { ExplicitIncrementData(); /** the following two members are only for date-time axis */ - css::chart::TimeInterval MajorTimeInterval; - css::chart::TimeInterval MinorTimeInterval; + css::chart::TimeInterval MajorTimeInterval; + css::chart::TimeInterval MinorTimeInterval; /** the other members are for *not* date-time axis */ @@ -104,7 +105,7 @@ struct OOO_DLLPUBLIC_CHARTVIEW ExplicitIncrementData <p><member>PostEquidistant</member> rules whether the <member>Distance</member> is meant to be a value before or after scaling.</p> */ - double Distance; + double Distance; /** <member>PostEquidistant</member> rules whether the member <member>Distance</member> @@ -116,7 +117,7 @@ struct OOO_DLLPUBLIC_CHARTVIEW ExplicitIncrementData If <member>PostEquidistant</member> equals <FALSE/> <member>Distance</member> is given in values before <type>XScaling</type> is applied.</p> */ - bool PostEquidistant; + bool PostEquidistant; /** The <member>BaseValue</member> gives a starting point on the scale to which all further main tickmarks are relatively positioned. @@ -134,7 +135,7 @@ struct OOO_DLLPUBLIC_CHARTVIEW ExplicitIncrementData And setting BaseValue to 2, -2, 4, -4 etc. in this example leads to the same result as BaseValue=0.</p> */ - double BaseValue; + double BaseValue; /** <member>SubIncrements</member> describes the positioning of further sub tickmarks on the scale of an axis. @@ -145,10 +146,9 @@ struct OOO_DLLPUBLIC_CHARTVIEW ExplicitIncrementData positions of subsequent tickmarks in relation to their parent tickmarks given by the preceding SubIncrement.</p> */ - std::vector< ExplicitSubIncrement > SubIncrements; + 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 deleted file mode 100644 index e2ff1e01a334..000000000000 --- a/chart2/source/inc/chartview/ExplicitValueProvider.hxx +++ /dev/null @@ -1,98 +0,0 @@ -/* -*- 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/defines.hxx b/chart2/source/inc/defines.hxx index 135afe44bbef..1eb464bc203a 100644 --- a/chart2/source/inc/defines.hxx +++ b/chart2/source/inc/defines.hxx @@ -17,11 +17,8 @@ * 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 +#pragma once -#define FIXED_SIZE_FOR_3D_CHART_VOLUME 10000.0 - -#endif +constexpr double FIXED_SIZE_FOR_3D_CHART_VOLUME = 10000.0; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/res_BarGeometry.hxx b/chart2/source/inc/res_BarGeometry.hxx index 235c5f4fe5ca..9e0c01870f29 100644 --- a/chart2/source/inc/res_BarGeometry.hxx +++ b/chart2/source/inc/res_BarGeometry.hxx @@ -16,8 +16,7 @@ * 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 +#pragma once #include <vcl/weld.hxx> @@ -43,6 +42,4 @@ private: } //namespace chart -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/servicenames.hxx b/chart2/source/inc/servicenames.hxx index a63c0939321a..ebc6c18a77c3 100644 --- a/chart2/source/inc/servicenames.hxx +++ b/chart2/source/inc/servicenames.hxx @@ -16,40 +16,14 @@ * 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 +#pragma once -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" +#include <rtl/ustring.hxx> -#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 +//@todo create your own service containing the service com.sun.star.document.OfficeDocument -#endif +inline constexpr OUString CHART_VIEW_SERVICE_IMPLEMENTATION_NAME + = u"com.sun.star.comp.chart2.ChartView"_ustr; +inline constexpr OUString CHART_VIEW_SERVICE_NAME = u"com.sun.star.chart2.ChartView"_ustr; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/servicenames_charttypes.hxx b/chart2/source/inc/servicenames_charttypes.hxx index 9a1ee83db019..fe4bcb1126bf 100644 --- a/chart2/source/inc/servicenames_charttypes.hxx +++ b/chart2/source/inc/servicenames_charttypes.hxx @@ -16,24 +16,33 @@ * 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 +#pragma once -namespace chart { +#include <rtl/ustring.hxx> -#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 +inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_AREA + = u"com.sun.star.chart2.AreaChartType"_ustr; +inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_BAR + = u"com.sun.star.chart2.BarChartType"_ustr; +inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_COLUMN + = u"com.sun.star.chart2.ColumnChartType"_ustr; +inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_HISTOGRAM + = u"com.sun.star.chart2.HistogramChartType"_ustr; +inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_LINE + = u"com.sun.star.chart2.LineChartType"_ustr; +inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_SCATTER + = u"com.sun.star.chart2.ScatterChartType"_ustr; +inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_PIE + = u"com.sun.star.chart2.PieChartType"_ustr; +inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_NET + = u"com.sun.star.chart2.NetChartType"_ustr; +inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_FILLED_NET + = u"com.sun.star.chart2.FilledNetChartType"_ustr; +inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_CANDLESTICK + = u"com.sun.star.chart2.CandleStickChartType"_ustr; +inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_BUBBLE + = u"com.sun.star.chart2.BubbleChartType"_ustr; +inline constexpr OUString CHART2_SERVICE_NAME_CHARTTYPE_FUNNEL + = u"com.sun.star.chart2.FunnelChartType"_ustr; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/servicenames_coosystems.hxx b/chart2/source/inc/servicenames_coosystems.hxx index 17648619948b..065155a8bb37 100644 --- a/chart2/source/inc/servicenames_coosystems.hxx +++ b/chart2/source/inc/servicenames_coosystems.hxx @@ -16,16 +16,11 @@ * 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 +#pragma once -namespace chart -{ +#include <rtl/ustring.hxx> -#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 +inline constexpr OUString CHART2_COOSYSTEM_CARTESIAN_VIEW_SERVICE_NAME = u"com.sun.star.chart2.CoordinateSystems.CartesianView"_ustr; +inline constexpr OUString CHART2_COOSYSTEM_POLAR_VIEW_SERVICE_NAME = u"com.sun.star.chart2.CoordinateSystems.PolarView"_ustr; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |