From 4a4bdc142ab7a41b69512d54302851e7fbb3100b Mon Sep 17 00:00:00 2001 From: Markus Mohrhard Date: Sun, 21 Apr 2013 02:49:04 +0200 Subject: fix the remaining issues with the changed handling of ErrorBar props Change-Id: I75c839cbfccbe84e7aa98aef6959bcd0c5390ab6 --- chart2/Library_chartcore.mk | 1 + .../controller/chartapiwrapper/AreaWrapper.cxx | 4 +- .../controller/chartapiwrapper/AxisWrapper.cxx | 4 +- .../chartapiwrapper/DataSeriesPointWrapper.cxx | 4 +- .../controller/chartapiwrapper/DiagramWrapper.cxx | 4 +- .../controller/chartapiwrapper/GridWrapper.cxx | 4 +- .../controller/chartapiwrapper/LegendWrapper.cxx | 4 +- .../chartapiwrapper/MinMaxLineWrapper.cxx | 6 +- .../controller/chartapiwrapper/TitleWrapper.cxx | 4 +- .../chartapiwrapper/UpDownBarWrapper.cxx | 6 +- .../chartapiwrapper/WallFloorWrapper.cxx | 4 +- chart2/source/inc/ErrorBar.hxx | 4 +- chart2/source/inc/LineProperties.hxx | 69 ++------ chart2/source/inc/LinePropertiesHelper.hxx | 71 ++++++++ chart2/source/model/main/Axis.cxx | 10 +- chart2/source/model/main/DataPointProperties.cxx | 18 +- chart2/source/model/main/GridProperties.cxx | 8 +- chart2/source/model/main/Legend.cxx | 6 +- chart2/source/model/main/PageBackground.cxx | 8 +- chart2/source/model/main/StockBar.cxx | 8 +- chart2/source/model/main/Title.cxx | 8 +- chart2/source/model/main/Wall.cxx | 8 +- chart2/source/tools/AxisHelper.cxx | 10 +- chart2/source/tools/ErrorBar.cxx | 24 ++- chart2/source/tools/LineProperties.cxx | 191 ++++++--------------- chart2/source/tools/LinePropertiesHelper.cxx | 174 +++++++++++++++++++ chart2/source/tools/RegressionCurveModel.cxx | 8 +- chart2/source/tools/RegressionEquation.cxx | 8 +- 28 files changed, 410 insertions(+), 268 deletions(-) create mode 100644 chart2/source/inc/LinePropertiesHelper.hxx create mode 100644 chart2/source/tools/LinePropertiesHelper.cxx diff --git a/chart2/Library_chartcore.mk b/chart2/Library_chartcore.mk index 66fbfda6172b..0a5db3fe17f0 100644 --- a/chart2/Library_chartcore.mk +++ b/chart2/Library_chartcore.mk @@ -185,6 +185,7 @@ $(eval $(call gb_Library_add_exception_objects,chartcore,\ chart2/source/tools/LegendHelper \ chart2/source/tools/LifeTime \ chart2/source/tools/LinearRegressionCurveCalculator \ + chart2/source/tools/LinePropertiesHelper \ chart2/source/tools/LineProperties \ chart2/source/tools/LogarithmicRegressionCurveCalculator \ chart2/source/tools/MeanValueRegressionCurveCalculator \ diff --git a/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx b/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx index cab6a3097203..e7c4b542435d 100644 --- a/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/AreaWrapper.cxx @@ -26,7 +26,7 @@ #include #include -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "FillProperties.hxx" #include "UserDefinedProperties.hxx" @@ -55,7 +55,7 @@ private: Sequence< Property > lcl_GetPropertySequence() { ::std::vector< ::com::sun::star::beans::Property > aProperties; - ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); ::chart::FillProperties::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); diff --git a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx index 0ca9408a63fb..89f4364f58b7 100644 --- a/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/AxisWrapper.cxx @@ -36,7 +36,7 @@ #include #include "CharacterProperties.hxx" -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "UserDefinedProperties.hxx" #include "WrappedCharacterHeightProperty.hxx" #include "WrappedTextRotationProperty.hxx" @@ -354,7 +354,7 @@ private: ::std::vector< ::com::sun::star::beans::Property > aProperties; lcl_AddPropertiesToVector( aProperties ); ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); - ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties ); diff --git a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx index c605de072ab4..2b37fec5ad87 100644 --- a/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DataSeriesPointWrapper.cxx @@ -25,7 +25,7 @@ #include "DiagramHelper.hxx" #include "ContainerHelper.hxx" #include "ChartModelHelper.hxx" -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "FillProperties.hxx" #include "CharacterProperties.hxx" #include "UserDefinedProperties.hxx" @@ -174,7 +174,7 @@ uno::Sequence< Property > lcl_GetPropertySequence( DataSeriesPointWrapper::eType WrappedDataCaptionProperties::addProperties( aProperties ); //for series and points ::chart::FillProperties::AddPropertiesToVector( aProperties ); - ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); ::chart::wrapper::WrappedScaleTextProperties::addProperties( aProperties ); diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index edb3289c1cce..8c31e5838355 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -55,7 +55,7 @@ #include #include -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "FillProperties.hxx" #include "UserDefinedProperties.hxx" #include "SceneProperties.hxx" @@ -430,7 +430,7 @@ private: { ::std::vector< ::com::sun::star::beans::Property > aProperties; lcl_AddPropertiesToVector( aProperties ); - ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); ::chart::FillProperties::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); ::chart::SceneProperties::AddPropertiesToVector( aProperties ); diff --git a/chart2/source/controller/chartapiwrapper/GridWrapper.cxx b/chart2/source/controller/chartapiwrapper/GridWrapper.cxx index 4180e87dc0da..77f97d072261 100644 --- a/chart2/source/controller/chartapiwrapper/GridWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/GridWrapper.cxx @@ -27,7 +27,7 @@ #include #include -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "UserDefinedProperties.hxx" #include "WrappedDefaultProperty.hxx" @@ -58,7 +58,7 @@ private: Sequence< Property > lcl_GetPropertySequence() { ::std::vector< ::com::sun::star::beans::Property > aProperties; - ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); ::std::sort( aProperties.begin(), aProperties.end(), diff --git a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx index 563817814c09..262ab9e93ec9 100644 --- a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx @@ -32,7 +32,7 @@ #include #include "CharacterProperties.hxx" -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "FillProperties.hxx" #include "UserDefinedProperties.hxx" #include "WrappedCharacterHeightProperty.hxx" @@ -253,7 +253,7 @@ private: ::std::vector< ::com::sun::star::beans::Property > aProperties; lcl_AddPropertiesToVector( aProperties ); ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); - ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); ::chart::FillProperties::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); ::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties ); diff --git a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx index ac1086140584..2c287e1084dc 100644 --- a/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/MinMaxLineWrapper.cxx @@ -28,7 +28,7 @@ #include #include -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "UserDefinedProperties.hxx" using namespace ::com::sun::star; @@ -55,7 +55,7 @@ struct StaticMinMaxLineWrapperDefaults_Initializer private: void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) { - ::chart::LineProperties::AddDefaultsToMap( rOutMap ); + ::chart::LinePropertiesHelper::AddDefaultsToMap( rOutMap ); } }; @@ -76,7 +76,7 @@ private: { ::std::vector< ::com::sun::star::beans::Property > aProperties; - ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); ::std::sort( aProperties.begin(), aProperties.end(), diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx index 34af3c4d89f5..ad07eb12c70a 100644 --- a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx @@ -27,7 +27,7 @@ #include #include "CharacterProperties.hxx" -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "FillProperties.hxx" #include "UserDefinedProperties.hxx" #include "WrappedCharacterHeightProperty.hxx" @@ -179,7 +179,7 @@ private: ::std::vector< beans::Property > aProperties; lcl_AddPropertiesToVector( aProperties ); ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); - ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); ::chart::FillProperties::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); ::chart::wrapper::WrappedAutomaticPositionProperties::addProperties( aProperties ); diff --git a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx index ed66e266a63f..ec5e3dcf9f73 100644 --- a/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/UpDownBarWrapper.cxx @@ -27,7 +27,7 @@ #include #include -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "FillProperties.hxx" #include "UserDefinedProperties.hxx" @@ -57,7 +57,7 @@ private: { ::std::vector< ::com::sun::star::beans::Property > aProperties; - ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); ::chart::FillProperties::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); @@ -110,7 +110,7 @@ struct StaticUpDownBarWrapperDefaults_Initializer private: void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) { - ::chart::LineProperties::AddDefaultsToMap( rOutMap ); + ::chart::LinePropertiesHelper::AddDefaultsToMap( rOutMap ); ::chart::FillProperties::AddDefaultsToMap( rOutMap ); } }; diff --git a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx index f0ed4563452c..bad2b3d6e76a 100644 --- a/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/WallFloorWrapper.cxx @@ -26,7 +26,7 @@ #include #include "FillProperties.hxx" -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "UserDefinedProperties.hxx" #include "WrappedDirectStateProperty.hxx" @@ -60,7 +60,7 @@ private: { ::std::vector< ::com::sun::star::beans::Property > aProperties; ::chart::FillProperties::AddPropertiesToVector( aProperties ); - ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); ::std::sort( aProperties.begin(), aProperties.end(), diff --git a/chart2/source/inc/ErrorBar.hxx b/chart2/source/inc/ErrorBar.hxx index 1b76c9c3001b..dee86eaa5f25 100644 --- a/chart2/source/inc/ErrorBar.hxx +++ b/chart2/source/inc/ErrorBar.hxx @@ -23,6 +23,7 @@ #include "ServiceMacros.hxx" #include "ModifyListenerHelper.hxx" #include "charttoolsdllapi.hxx" +#include "LineProperties.hxx" #include #include @@ -59,7 +60,8 @@ typedef ::cppu::WeakImplHelper7< class ErrorBar : public MutexContainer, - public impl::ErrorBar_Base + public impl::ErrorBar_Base, + public LineProperties { private: bool mbShowPositiveError; diff --git a/chart2/source/inc/LineProperties.hxx b/chart2/source/inc/LineProperties.hxx index 5b4c3761caa8..5df037292ff1 100644 --- a/chart2/source/inc/LineProperties.hxx +++ b/chart2/source/inc/LineProperties.hxx @@ -5,67 +5,34 @@ * 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 CHART_LINEPROPERTIES_HXX -#define CHART_LINEPROPERTIES_HXX -#include "PropertyHelper.hxx" -#include "FastPropertyIdRanges.hxx" -#include "charttoolsdllapi.hxx" -#include +#ifndef CHART2_LINE_PROPERTIES_HXX +#define CHART2_LINE_PROPERTIES_HXX -#include +#include +#include +#include +#include -namespace chart +class LineProperties { +private: + OUString maDashName; + sal_Int32 mnLineWidth; + com::sun::star::drawing::LineStyle meLineStyle; + com::sun::star::util::Color maLineColor; + sal_uInt8 mnLineTransparence; + com::sun::star::drawing::LineJoint meLineJoint; -// implements service LineProperties -class OOO_DLLPUBLIC_CHARTTOOLS LineProperties -{ public: - // FastProperty Ids for properties - enum - { - // com.sun.star.drawing.LineProperties - PROP_LINE_STYLE = FAST_PROPERTY_ID_START_LINE_PROP, - PROP_LINE_DASH, - PROP_LINE_DASH_NAME, //not in service description - PROP_LINE_COLOR, - PROP_LINE_TRANSPARENCE, - PROP_LINE_WIDTH, - PROP_LINE_JOINT - }; - - static void AddPropertiesToVector( - ::std::vector< ::com::sun::star::beans::Property > & rOutProperties ); - - static void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ); - - SAL_DLLPRIVATE static bool IsLineVisible( const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet >& xLineProperties ); - SAL_DLLPRIVATE static void SetLineVisible( const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet >& xLineProperties ); - static void SetLineInvisible( const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet >& xLineProperties ); - -private: - // not implemented LineProperties(); -}; + LineProperties(const LineProperties&); -} // namespace chart + com::sun::star::uno::Any getPropertyValue(const OUString& rName); + void setPropertyValue(const OUString& rName, const com::sun::star::uno::Any& rAny); +}; -// CHART_LINEPROPERTIES_HXX #endif /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/inc/LinePropertiesHelper.hxx b/chart2/source/inc/LinePropertiesHelper.hxx new file mode 100644 index 000000000000..ea465a9fe7d4 --- /dev/null +++ b/chart2/source/inc/LinePropertiesHelper.hxx @@ -0,0 +1,71 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef CHART_LINEPROPERTIES_HXX +#define CHART_LINEPROPERTIES_HXX + +#include "PropertyHelper.hxx" +#include "FastPropertyIdRanges.hxx" +#include "charttoolsdllapi.hxx" +#include + +#include + +namespace chart +{ + +// implements service LineProperties +class LinePropertiesHelper +{ +public: + // FastProperty Ids for properties + enum + { + // com.sun.star.drawing.LineProperties + PROP_LINE_STYLE = FAST_PROPERTY_ID_START_LINE_PROP, + PROP_LINE_DASH, + PROP_LINE_DASH_NAME, //not in service description + PROP_LINE_COLOR, + PROP_LINE_TRANSPARENCE, + PROP_LINE_WIDTH, + PROP_LINE_JOINT + }; + + OOO_DLLPUBLIC_CHARTTOOLS static void AddPropertiesToVector( + ::std::vector< ::com::sun::star::beans::Property > & rOutProperties ); + + OOO_DLLPUBLIC_CHARTTOOLS static void AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ); + + SAL_DLLPRIVATE static bool IsLineVisible( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xLineProperties ); + SAL_DLLPRIVATE static void SetLineVisible( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xLineProperties ); + static void SetLineInvisible( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xLineProperties ); + +private: + // not implemented + LinePropertiesHelper(); +}; + +} // namespace chart + +// CHART_LINEPROPERTIES_HXX +#endif + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/model/main/Axis.cxx b/chart2/source/model/main/Axis.cxx index 59e3d126ea2a..35fcabb89571 100644 --- a/chart2/source/model/main/Axis.cxx +++ b/chart2/source/model/main/Axis.cxx @@ -21,7 +21,7 @@ #include "GridProperties.hxx" #include "macros.hxx" #include "CharacterProperties.hxx" -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "UserDefinedProperties.hxx" #include "PropertyHelper.hxx" #include "ContainerHelper.hxx" @@ -194,7 +194,7 @@ private: void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) { ::chart::CharacterProperties::AddDefaultsToMap( rOutMap ); - ::chart::LineProperties::AddDefaultsToMap( rOutMap ); + ::chart::LinePropertiesHelper::AddDefaultsToMap( rOutMap ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_SHOW, true ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_AXIS_CROSSOVER_POSITION, ::com::sun::star::chart::ChartAxisPosition_ZERO ); @@ -235,7 +235,7 @@ private: ::std::vector< ::com::sun::star::beans::Property > aProperties; lcl_AddPropertiesToVector( aProperties ); ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); - ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); ::std::sort( aProperties.begin(), aProperties.end(), @@ -312,7 +312,7 @@ Axis::Axis( Reference< uno::XComponentContext > const & /* xContext */ ) : { osl_atomic_increment(&m_refCount); setFastPropertyValue_NoBroadcast( - ::chart::LineProperties::PROP_LINE_COLOR, uno::makeAny( static_cast< sal_Int32 >( 0xb3b3b3 ) ) ); // gray30 + ::chart::LinePropertiesHelper::PROP_LINE_COLOR, uno::makeAny( static_cast< sal_Int32 >( 0xb3b3b3 ) ) ); // gray30 if( m_xGrid.is()) ModifyListenerHelper::addListener( m_xGrid, m_xModifyEventForwarder ); @@ -405,7 +405,7 @@ void Axis::AllocateSubGrids() for( sal_Int32 i = nOldSubIncCount; i < nNewSubIncCount; ++i ) { m_aSubGridProperties[ i ] = new GridProperties(); - LineProperties::SetLineInvisible( m_aSubGridProperties[ i ] ); + LinePropertiesHelper::SetLineInvisible( m_aSubGridProperties[ i ] ); aNewBroadcasters.push_back( m_aSubGridProperties[ i ] ); } } diff --git a/chart2/source/model/main/DataPointProperties.cxx b/chart2/source/model/main/DataPointProperties.cxx index de4f0b6e62f4..32befb374889 100644 --- a/chart2/source/model/main/DataPointProperties.cxx +++ b/chart2/source/model/main/DataPointProperties.cxx @@ -19,7 +19,7 @@ #include "DataPointProperties.hxx" #include "macros.hxx" -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "FillProperties.hxx" #include @@ -158,25 +158,25 @@ void DataPointProperties::AddPropertiesToVector( // --------------- rOutProperties.push_back( Property( "LineStyle", - LineProperties::PROP_LINE_STYLE, + LinePropertiesHelper::PROP_LINE_STYLE, ::getCppuType( reinterpret_cast< const drawing::LineStyle * >(0)), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT )); rOutProperties.push_back( Property( "LineWidth", - LineProperties::PROP_LINE_WIDTH, + LinePropertiesHelper::PROP_LINE_WIDTH, ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEDEFAULT )); rOutProperties.push_back( Property( "LineDash", - LineProperties::PROP_LINE_DASH, + LinePropertiesHelper::PROP_LINE_DASH, ::getCppuType( reinterpret_cast< const drawing::LineDash * >(0)), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEVOID )); rOutProperties.push_back( Property( "LineDashName", - LineProperties::PROP_LINE_DASH_NAME, + LinePropertiesHelper::PROP_LINE_DASH_NAME, ::getCppuType( reinterpret_cast< const OUString * >(0)), beans::PropertyAttribute::BOUND | beans::PropertyAttribute::MAYBEVOID )); @@ -368,10 +368,10 @@ void DataPointProperties::AddDefaultsToMap( PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_DATAPOINT_BORDER_TRANSPARENCY, 0 ); //line - PropertyHelper::setPropertyValueDefault( rOutMap, LineProperties::PROP_LINE_STYLE, drawing::LineStyle_SOLID ); - PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, LineProperties::PROP_LINE_WIDTH, 0 ); - PropertyHelper::setPropertyValueDefault( rOutMap, LineProperties::PROP_LINE_DASH, drawing::LineDash()); - PropertyHelper::setEmptyPropertyValueDefault( rOutMap, LineProperties::PROP_LINE_DASH_NAME ); + PropertyHelper::setPropertyValueDefault( rOutMap, LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_SOLID ); + PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, LinePropertiesHelper::PROP_LINE_WIDTH, 0 ); + PropertyHelper::setPropertyValueDefault( rOutMap, LinePropertiesHelper::PROP_LINE_DASH, drawing::LineDash()); + PropertyHelper::setEmptyPropertyValueDefault( rOutMap, LinePropertiesHelper::PROP_LINE_DASH_NAME ); //fill bitmap PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, FillProperties::PROP_FILL_BITMAP_OFFSETX, 0 ); diff --git a/chart2/source/model/main/GridProperties.cxx b/chart2/source/model/main/GridProperties.cxx index fd713a9aa5f2..27a444369d1d 100644 --- a/chart2/source/model/main/GridProperties.cxx +++ b/chart2/source/model/main/GridProperties.cxx @@ -19,7 +19,7 @@ #include "GridProperties.hxx" -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "UserDefinedProperties.hxx" #include "PropertyHelper.hxx" #include "macros.hxx" @@ -70,13 +70,13 @@ struct StaticGridDefaults_Initializer private: void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) { - ::chart::LineProperties::AddDefaultsToMap( rOutMap ); + ::chart::LinePropertiesHelper::AddDefaultsToMap( rOutMap ); ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_GRID_SHOW, false ); // override other defaults ::chart::PropertyHelper::setPropertyValue< sal_Int32 >( - rOutMap, ::chart::LineProperties::PROP_LINE_COLOR, 0xb3b3b3 ); // gray30 + rOutMap, ::chart::LinePropertiesHelper::PROP_LINE_COLOR, 0xb3b3b3 ); // gray30 } }; @@ -97,7 +97,7 @@ private: { ::std::vector< Property > aProperties; lcl_AddPropertiesToVector( aProperties ); - ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); ::std::sort( aProperties.begin(), aProperties.end(), diff --git a/chart2/source/model/main/Legend.cxx b/chart2/source/model/main/Legend.cxx index 2173f933c7be..21d9e5c4a244 100644 --- a/chart2/source/model/main/Legend.cxx +++ b/chart2/source/model/main/Legend.cxx @@ -19,7 +19,7 @@ #include "Legend.hxx" #include "macros.hxx" -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "FillProperties.hxx" #include "CharacterProperties.hxx" #include "UserDefinedProperties.hxx" @@ -116,7 +116,7 @@ struct StaticLegendDefaults_Initializer private: void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) { - ::chart::LineProperties::AddDefaultsToMap( rOutMap ); + ::chart::LinePropertiesHelper::AddDefaultsToMap( rOutMap ); ::chart::FillProperties::AddDefaultsToMap( rOutMap ); ::chart::CharacterProperties::AddDefaultsToMap( rOutMap ); @@ -148,7 +148,7 @@ private: { ::std::vector< ::com::sun::star::beans::Property > aProperties; lcl_AddPropertiesToVector( aProperties ); - ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); ::chart::FillProperties::AddPropertiesToVector( aProperties ); ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); diff --git a/chart2/source/model/main/PageBackground.cxx b/chart2/source/model/main/PageBackground.cxx index 5728f9c26fef..d200ca510efb 100644 --- a/chart2/source/model/main/PageBackground.cxx +++ b/chart2/source/model/main/PageBackground.cxx @@ -19,7 +19,7 @@ #include "PageBackground.hxx" #include "macros.hxx" -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "FillProperties.hxx" #include "UserDefinedProperties.hxx" #include "ContainerHelper.hxx" @@ -53,12 +53,12 @@ struct StaticPageBackgroundDefaults_Initializer private: void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) { - ::chart::LineProperties::AddDefaultsToMap( rOutMap ); + ::chart::LinePropertiesHelper::AddDefaultsToMap( rOutMap ); ::chart::FillProperties::AddDefaultsToMap( rOutMap ); // override other defaults ::chart::PropertyHelper::setPropertyValue< sal_Int32 >( rOutMap, ::chart::FillProperties::PROP_FILL_COLOR, 0xffffff ); - ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LineProperties::PROP_LINE_STYLE, drawing::LineStyle_NONE ); + ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_NONE ); } }; @@ -78,7 +78,7 @@ private: uno::Sequence< Property > lcl_GetPropertySequence() { ::std::vector< ::com::sun::star::beans::Property > aProperties; - ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); ::chart::FillProperties::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); diff --git a/chart2/source/model/main/StockBar.cxx b/chart2/source/model/main/StockBar.cxx index 02d63f9bc7ef..9cf832463e33 100644 --- a/chart2/source/model/main/StockBar.cxx +++ b/chart2/source/model/main/StockBar.cxx @@ -19,7 +19,7 @@ #include "StockBar.hxx" -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "FillProperties.hxx" #include "UserDefinedProperties.hxx" #include "PropertyHelper.hxx" @@ -58,7 +58,7 @@ private: uno::Sequence< Property > lcl_GetPropertySequence() { ::std::vector< ::com::sun::star::beans::Property > aProperties; - ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); ::chart::FillProperties::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); @@ -99,7 +99,7 @@ struct StaticStockBarDefaults_Initializer private: void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) { - ::chart::LineProperties::AddDefaultsToMap( rOutMap ); + ::chart::LinePropertiesHelper::AddDefaultsToMap( rOutMap ); ::chart::FillProperties::AddDefaultsToMap( rOutMap ); // override other defaults @@ -129,7 +129,7 @@ StockBar::StockBar( bool bRisingCourse ) : ::chart::FillProperties::PROP_FILL_COLOR, uno::makeAny( sal_Int32( 0x000000 ))); // black setFastPropertyValue_NoBroadcast( - ::chart::LineProperties::PROP_LINE_COLOR, + ::chart::LinePropertiesHelper::PROP_LINE_COLOR, uno::makeAny( sal_Int32( 0xb3b3b3 ))); // gray30 } } diff --git a/chart2/source/model/main/Title.cxx b/chart2/source/model/main/Title.cxx index bd127e899ed9..346a967058af 100644 --- a/chart2/source/model/main/Title.cxx +++ b/chart2/source/model/main/Title.cxx @@ -20,7 +20,7 @@ #include "Title.hxx" #include "macros.hxx" #include "FormattedString.hxx" -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "FillProperties.hxx" #include "ContainerHelper.hxx" #include "CloneHelper.hxx" @@ -156,7 +156,7 @@ struct StaticTitleDefaults_Initializer private: void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) { - ::chart::LineProperties::AddDefaultsToMap( rOutMap ); + ::chart::LinePropertiesHelper::AddDefaultsToMap( rOutMap ); ::chart::FillProperties::AddDefaultsToMap( rOutMap ); // ParagraphProperties @@ -176,7 +176,7 @@ private: // override other defaults ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::FillProperties::PROP_FILL_STYLE, drawing::FillStyle_NONE ); - ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LineProperties::PROP_LINE_STYLE, drawing::LineStyle_NONE ); + ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_NONE ); } }; @@ -197,7 +197,7 @@ private: { ::std::vector< ::com::sun::star::beans::Property > aProperties; lcl_AddPropertiesToVector( aProperties ); - ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); ::chart::FillProperties::AddPropertiesToVector( aProperties ); ::std::sort( aProperties.begin(), aProperties.end(), diff --git a/chart2/source/model/main/Wall.cxx b/chart2/source/model/main/Wall.cxx index cc80cf6351a0..1a666388bbf4 100644 --- a/chart2/source/model/main/Wall.cxx +++ b/chart2/source/model/main/Wall.cxx @@ -19,7 +19,7 @@ #include "Wall.hxx" #include "macros.hxx" -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "FillProperties.hxx" #include "UserDefinedProperties.hxx" #include "ContainerHelper.hxx" @@ -59,11 +59,11 @@ struct StaticWallDefaults_Initializer private: void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) { - ::chart::LineProperties::AddDefaultsToMap( rOutMap ); + ::chart::LinePropertiesHelper::AddDefaultsToMap( rOutMap ); ::chart::FillProperties::AddDefaultsToMap( rOutMap ); // override other defaults - ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LineProperties::PROP_LINE_STYLE, drawing::LineStyle_NONE ); + ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_NONE ); } }; @@ -83,7 +83,7 @@ private: uno::Sequence< Property > lcl_GetPropertySequence() { ::std::vector< ::com::sun::star::beans::Property > aProperties; - ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); ::chart::FillProperties::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); diff --git a/chart2/source/tools/AxisHelper.cxx b/chart2/source/tools/AxisHelper.cxx index a91d05ace485..8a769f808f3a 100644 --- a/chart2/source/tools/AxisHelper.cxx +++ b/chart2/source/tools/AxisHelper.cxx @@ -23,7 +23,7 @@ #include "ChartTypeHelper.hxx" #include "macros.hxx" #include "AxisIndexDefines.hxx" -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "ContainerHelper.hxx" #include "servicenames_coosystems.hxx" #include "DataSeriesHelper.hxx" @@ -463,7 +463,7 @@ void AxisHelper::makeAxisVisible( const Reference< XAxis >& xAxis ) if( xProps.is() ) { xProps->setPropertyValue( "Show", uno::makeAny( sal_True ) ); - LineProperties::SetLineVisible( xProps ); + LinePropertiesHelper::SetLineVisible( xProps ); xProps->setPropertyValue( "DisplayLabels", uno::makeAny( sal_True ) ); } } @@ -473,7 +473,7 @@ void AxisHelper::makeGridVisible( const Reference< beans::XPropertySet >& xGridP if( xGridProperties.is() ) { xGridProperties->setPropertyValue( "Show", uno::makeAny( sal_True ) ); - LineProperties::SetLineVisible( xGridProperties ); + LinePropertiesHelper::SetLineVisible( xGridProperties ); } } @@ -665,7 +665,7 @@ sal_Bool AxisHelper::isAxisVisible( const Reference< XAxis >& xAxis ) if( xProps.is() ) { xProps->getPropertyValue( "Show" ) >>= bRet; - bRet = bRet && ( LineProperties::IsLineVisible( xProps ) + bRet = bRet && ( LinePropertiesHelper::IsLineVisible( xProps ) || areAxisLabelsVisible( xProps ) ); } @@ -689,7 +689,7 @@ sal_Bool AxisHelper::isGridVisible( const Reference< beans::XPropertySet >& xGri if( xGridProperies.is() ) { xGridProperies->getPropertyValue( "Show" ) >>= bRet; - bRet = bRet && LineProperties::IsLineVisible( xGridProperies ); + bRet = bRet && LinePropertiesHelper::IsLineVisible( xGridProperies ); } return bRet; diff --git a/chart2/source/tools/ErrorBar.cxx b/chart2/source/tools/ErrorBar.cxx index 0c9132388e4a..c42d7640b309 100644 --- a/chart2/source/tools/ErrorBar.cxx +++ b/chart2/source/tools/ErrorBar.cxx @@ -30,14 +30,15 @@ #include #include +#include +#include +#include + #include #include using namespace ::com::sun::star; -using ::com::sun::star::beans::Property; -using ::osl::MutexGuard; - namespace { @@ -59,8 +60,12 @@ const SfxItemPropertySet* GetErrorBarPropertySet() {MAP_CHAR_LEN("NegativeError"),3,&getCppuType((const double*)0), 0, 0}, {MAP_CHAR_LEN("ErrorBarStyle"),4,&getCppuType((sal_Int32*)0),0,0}, {MAP_CHAR_LEN("Weight"),5,&getCppuType((const double*)0),0,0}, - {MAP_CHAR_LEN(""),6,&getBooleanCppuType(), 0, 0}, - {MAP_CHAR_LEN(""),7,&getCppuType((OUString*)0),0,0}, + {MAP_CHAR_LEN("LineStyle"),7,&getCppuType((com::sun::star::drawing::LineStyle*)0),0,0}, + {MAP_CHAR_LEN("LineDashName"),7,&getCppuType((OUString*)0),0,0}, + {MAP_CHAR_LEN("LineWidth"),7,&getCppuType((sal_Int32*)0),0,0}, + {MAP_CHAR_LEN("LineColor"),7,&getCppuType((com::sun::star::util::Color*)0),0,0}, + {MAP_CHAR_LEN("LineTransparence"),7,&getCppuType((sal_uInt8*)0),0,0}, + {MAP_CHAR_LEN("LineJoint"),7,&getCppuType((com::sun::star::drawing::LineJoint*)0),0,0}, {0,0,0,0,0,0} }; static SfxItemPropertySet aPropSet( aErrorBarPropertyMap_Impl ); @@ -79,6 +84,7 @@ uno::Reference< beans::XPropertySet > createErrorBar( const uno::Reference< uno: ErrorBar::ErrorBar( uno::Reference< uno::XComponentContext > const & xContext ) : + LineProperties(), mbShowPositiveError(true), mbShowNegativeError(true), mfPositiveError(0), @@ -91,6 +97,7 @@ ErrorBar::ErrorBar( ErrorBar::ErrorBar( const ErrorBar & rOther ) : MutexContainer(), impl::ErrorBar_Base(), + LineProperties(rOther), mbShowPositiveError(rOther.mbShowPositiveError), mbShowNegativeError(rOther.mbShowNegativeError), mfPositiveError(rOther.mfPositiveError), @@ -143,7 +150,9 @@ void ErrorBar::setPropertyValue( const OUString& rPropName, const uno::Any& rAny else if(rPropName == "ShowNegativeError") rAny >>= mbShowNegativeError; else - SAL_WARN("chart2", "asked for property value: " << rPropName); + LineProperties::setPropertyValue(rPropName, rAny); + + m_xModifyEventForwarder->modified( lang::EventObject( static_cast< uno::XWeak* >( this ))); } uno::Any ErrorBar::getPropertyValue(const OUString& rPropName) @@ -161,7 +170,8 @@ uno::Any ErrorBar::getPropertyValue(const OUString& rPropName) else if(rPropName == "ShowNegativeError") aRet <<= mbShowNegativeError; else - SAL_WARN("chart2", "asked for property value: " << rPropName); + aRet = LineProperties::getPropertyValue(rPropName); + SAL_WARN_IF(!aRet.hasValue(), "chart2", "asked for property value: " << rPropName); return aRet; } diff --git a/chart2/source/tools/LineProperties.cxx b/chart2/source/tools/LineProperties.cxx index e3c88d9860c3..c7c94778bc84 100644 --- a/chart2/source/tools/LineProperties.cxx +++ b/chart2/source/tools/LineProperties.cxx @@ -5,170 +5,87 @@ * 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 . */ #include "LineProperties.hxx" -#include "macros.hxx" -#include -#include -#include -#include -using namespace ::com::sun::star; +using namespace com::sun::star; -using ::com::sun::star::beans::Property; - -namespace chart +LineProperties::LineProperties(): + mnLineWidth(0), + meLineStyle(drawing::LineStyle_SOLID), + maLineColor(0), + mnLineTransparence(0), + meLineJoint(drawing::LineJoint_ROUND) { - -void LineProperties::AddPropertiesToVector( - ::std::vector< Property > & rOutProperties ) -{ - // Line Properties see service drawing::LineProperties - // --------------- - rOutProperties.push_back( - Property( "LineStyle", - PROP_LINE_STYLE, - ::getCppuType( reinterpret_cast< const drawing::LineStyle * >(0)), - beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT )); - - rOutProperties.push_back( - Property( "LineDash", - PROP_LINE_DASH, - ::getCppuType( reinterpret_cast< const drawing::LineDash * >(0)), - beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEVOID )); - -//not in service description - rOutProperties.push_back( - Property( "LineDashName", - PROP_LINE_DASH_NAME, - ::getCppuType( reinterpret_cast< const OUString * >(0)), - beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT - | beans::PropertyAttribute::MAYBEVOID )); - - rOutProperties.push_back( - Property( "LineColor", - PROP_LINE_COLOR, - ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), - beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT )); - - rOutProperties.push_back( - Property( "LineTransparence", - PROP_LINE_TRANSPARENCE, - ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)), - beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT )); - - rOutProperties.push_back( - Property( "LineWidth", - PROP_LINE_WIDTH, - ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), - beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT )); - - rOutProperties.push_back( - Property( "LineJoint", - PROP_LINE_JOINT, - ::getCppuType( reinterpret_cast< const drawing::LineJoint * >(0)), - beans::PropertyAttribute::BOUND - | beans::PropertyAttribute::MAYBEDEFAULT )); } -void LineProperties::AddDefaultsToMap( - ::chart::tPropertyValueMap & rOutMap ) +LineProperties::LineProperties(const LineProperties& r): + maDashName(r.maDashName), + mnLineWidth(r.mnLineWidth), + meLineStyle(r.meLineStyle), + maLineColor(r.maLineColor), + mnLineTransparence(r.mnLineTransparence), + meLineJoint(r.meLineJoint) { - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINE_STYLE, drawing::LineStyle_SOLID ); - ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINE_WIDTH, 0 ); - ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINE_COLOR, 0x000000 ); // black - ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_LINE_TRANSPARENCE, 0 ); - ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINE_JOINT, drawing::LineJoint_ROUND ); } -bool LineProperties::IsLineVisible( const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet >& xLineProperties ) +uno::Any LineProperties::getPropertyValue(const OUString& rName) { - bool bRet = false; - try + uno::Any aRet; + if(rName == "DashName") { - if( xLineProperties.is() ) - { - drawing::LineStyle aLineStyle(drawing::LineStyle_SOLID); - xLineProperties->getPropertyValue( "LineStyle" ) >>= aLineStyle; - if( aLineStyle != drawing::LineStyle_NONE ) - { - sal_Int16 nLineTransparence=0; - xLineProperties->getPropertyValue( "LineTransparence" ) >>= nLineTransparence; - if(100!=nLineTransparence) - { - bRet = true; - } - } - } + aRet <<= maDashName; } - catch( const uno::Exception & ex ) + else if(rName == "LineWidth") { - ASSERT_EXCEPTION( ex ); + aRet <<= mnLineWidth; } - return bRet; -} - -void LineProperties::SetLineVisible( const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet >& xLineProperties ) -{ - try + else if(rName == "LineStyle") { - if( xLineProperties.is() ) - { - drawing::LineStyle aLineStyle(drawing::LineStyle_SOLID); - xLineProperties->getPropertyValue( "LineStyle" ) >>= aLineStyle; - if( aLineStyle == drawing::LineStyle_NONE ) - xLineProperties->setPropertyValue( "LineStyle", uno::makeAny( drawing::LineStyle_SOLID ) ); - - sal_Int16 nLineTransparence=0; - xLineProperties->getPropertyValue( "LineTransparence" ) >>= nLineTransparence; - if(100==nLineTransparence) - xLineProperties->setPropertyValue( "LineTransparence", uno::makeAny( sal_Int16(0) ) ); - } + aRet = uno::makeAny(meLineStyle); + } + else if(rName == "LineColor") + { + aRet <<= maLineColor; } - catch( const uno::Exception & ex ) + else if(rName == "LineTransparence") { - ASSERT_EXCEPTION( ex ); + aRet <<= mnLineTransparence; } + else if(rName == "LineJoint") + { + aRet <<= meLineJoint; + } + return aRet; } -void LineProperties::SetLineInvisible( const ::com::sun::star::uno::Reference< - ::com::sun::star::beans::XPropertySet >& xLineProperties ) +void LineProperties::setPropertyValue(const OUString& rName, const uno::Any& rAny) { - try + if(rName == "DashName") + { + rAny >>= maDashName; + } + else if(rName == "LineWidth") { - if( xLineProperties.is() ) - { - drawing::LineStyle aLineStyle(drawing::LineStyle_SOLID); - xLineProperties->getPropertyValue( "LineStyle" ) >>= aLineStyle; - if( aLineStyle != drawing::LineStyle_NONE ) - xLineProperties->setPropertyValue( "LineStyle", uno::makeAny( drawing::LineStyle_NONE ) ); - } + rAny >>= mnLineWidth; } - catch( const uno::Exception & ex ) + else if(rName == "LineStyle") { - ASSERT_EXCEPTION( ex ); + rAny >>= meLineStyle; + } + else if(rName == "LineColor") + { + rAny >>= maLineColor; + } + else if(rName == "LineTransparence") + { + rAny >>= mnLineTransparence; + } + else if(rName == "LineJoint") + { + rAny >>= meLineJoint; } } -} // namespace chart - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/tools/LinePropertiesHelper.cxx b/chart2/source/tools/LinePropertiesHelper.cxx new file mode 100644 index 000000000000..a965fc3039d8 --- /dev/null +++ b/chart2/source/tools/LinePropertiesHelper.cxx @@ -0,0 +1,174 @@ +/* -*- 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 . + */ + +#include "LinePropertiesHelper.hxx" +#include "macros.hxx" +#include +#include +#include +#include + +using namespace ::com::sun::star; + +using ::com::sun::star::beans::Property; + +namespace chart +{ + +void LinePropertiesHelper::AddPropertiesToVector( + ::std::vector< Property > & rOutProperties ) +{ + // Line Properties see service drawing::LineProperties + // --------------- + rOutProperties.push_back( + Property( "LineStyle", + PROP_LINE_STYLE, + ::getCppuType( reinterpret_cast< const drawing::LineStyle * >(0)), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT )); + + rOutProperties.push_back( + Property( "LineDash", + PROP_LINE_DASH, + ::getCppuType( reinterpret_cast< const drawing::LineDash * >(0)), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEVOID )); + +//not in service description + rOutProperties.push_back( + Property( "LineDashName", + PROP_LINE_DASH_NAME, + ::getCppuType( reinterpret_cast< const OUString * >(0)), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT + | beans::PropertyAttribute::MAYBEVOID )); + + rOutProperties.push_back( + Property( "LineColor", + PROP_LINE_COLOR, + ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT )); + + rOutProperties.push_back( + Property( "LineTransparence", + PROP_LINE_TRANSPARENCE, + ::getCppuType( reinterpret_cast< const sal_Int16 * >(0)), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT )); + + rOutProperties.push_back( + Property( "LineWidth", + PROP_LINE_WIDTH, + ::getCppuType( reinterpret_cast< const sal_Int32 * >(0)), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT )); + + rOutProperties.push_back( + Property( "LineJoint", + PROP_LINE_JOINT, + ::getCppuType( reinterpret_cast< const drawing::LineJoint * >(0)), + beans::PropertyAttribute::BOUND + | beans::PropertyAttribute::MAYBEDEFAULT )); +} + +void LinePropertiesHelper::AddDefaultsToMap( + ::chart::tPropertyValueMap & rOutMap ) +{ + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINE_STYLE, drawing::LineStyle_SOLID ); + ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINE_WIDTH, 0 ); + ::chart::PropertyHelper::setPropertyValueDefault< sal_Int32 >( rOutMap, PROP_LINE_COLOR, 0x000000 ); // black + ::chart::PropertyHelper::setPropertyValueDefault< sal_Int16 >( rOutMap, PROP_LINE_TRANSPARENCE, 0 ); + ::chart::PropertyHelper::setPropertyValueDefault( rOutMap, PROP_LINE_JOINT, drawing::LineJoint_ROUND ); +} + +bool LinePropertiesHelper::IsLineVisible( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xLineProperties ) +{ + bool bRet = false; + try + { + if( xLineProperties.is() ) + { + drawing::LineStyle aLineStyle(drawing::LineStyle_SOLID); + xLineProperties->getPropertyValue( "LineStyle" ) >>= aLineStyle; + if( aLineStyle != drawing::LineStyle_NONE ) + { + sal_Int16 nLineTransparence=0; + xLineProperties->getPropertyValue( "LineTransparence" ) >>= nLineTransparence; + if(100!=nLineTransparence) + { + bRet = true; + } + } + } + } + catch( const uno::Exception & ex ) + { + ASSERT_EXCEPTION( ex ); + } + return bRet; +} + +void LinePropertiesHelper::SetLineVisible( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xLineProperties ) +{ + try + { + if( xLineProperties.is() ) + { + drawing::LineStyle aLineStyle(drawing::LineStyle_SOLID); + xLineProperties->getPropertyValue( "LineStyle" ) >>= aLineStyle; + if( aLineStyle == drawing::LineStyle_NONE ) + xLineProperties->setPropertyValue( "LineStyle", uno::makeAny( drawing::LineStyle_SOLID ) ); + + sal_Int16 nLineTransparence=0; + xLineProperties->getPropertyValue( "LineTransparence" ) >>= nLineTransparence; + if(100==nLineTransparence) + xLineProperties->setPropertyValue( "LineTransparence", uno::makeAny( sal_Int16(0) ) ); + } + } + catch( const uno::Exception & ex ) + { + ASSERT_EXCEPTION( ex ); + } +} + +void LinePropertiesHelper::SetLineInvisible( const ::com::sun::star::uno::Reference< + ::com::sun::star::beans::XPropertySet >& xLineProperties ) +{ + try + { + if( xLineProperties.is() ) + { + drawing::LineStyle aLineStyle(drawing::LineStyle_SOLID); + xLineProperties->getPropertyValue( "LineStyle" ) >>= aLineStyle; + if( aLineStyle != drawing::LineStyle_NONE ) + xLineProperties->setPropertyValue( "LineStyle", uno::makeAny( drawing::LineStyle_NONE ) ); + } + } + catch( const uno::Exception & ex ) + { + ASSERT_EXCEPTION( ex ); + } +} + +} // namespace chart + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/tools/RegressionCurveModel.cxx b/chart2/source/tools/RegressionCurveModel.cxx index 0522af8b4cc5..2dd96ed2be86 100644 --- a/chart2/source/tools/RegressionCurveModel.cxx +++ b/chart2/source/tools/RegressionCurveModel.cxx @@ -19,7 +19,7 @@ #include "RegressionCurveModel.hxx" #include "macros.hxx" -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "RegressionCurveHelper.hxx" #include "RegressionCalculationHelper.hxx" #include "RegressionEquation.hxx" @@ -62,7 +62,7 @@ struct StaticXXXDefaults_Initializer private: void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) { - ::chart::LineProperties::AddDefaultsToMap( rOutMap ); + ::chart::LinePropertiesHelper::AddDefaultsToMap( rOutMap ); } }; @@ -82,7 +82,7 @@ private: uno::Sequence< Property > lcl_GetPropertySequence() { ::std::vector< ::com::sun::star::beans::Property > aProperties; - ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); ::std::sort( aProperties.begin(), aProperties.end(), ::chart::PropertyNameLess() ); @@ -126,7 +126,7 @@ RegressionCurveModel::RegressionCurveModel( // set 0 line width (default) hard, so that it is always written to XML, // because the old implementation uses different defaults setFastPropertyValue_NoBroadcast( - LineProperties::PROP_LINE_WIDTH, uno::makeAny( sal_Int32( 0 ))); + LinePropertiesHelper::PROP_LINE_WIDTH, uno::makeAny( sal_Int32( 0 ))); ModifyListenerHelper::addListener( m_xEquationProperties, m_xModifyEventForwarder ); } diff --git a/chart2/source/tools/RegressionEquation.cxx b/chart2/source/tools/RegressionEquation.cxx index 16f771a16729..e8bdfe9720d8 100644 --- a/chart2/source/tools/RegressionEquation.cxx +++ b/chart2/source/tools/RegressionEquation.cxx @@ -19,7 +19,7 @@ #include "RegressionEquation.hxx" -#include "LineProperties.hxx" +#include "LinePropertiesHelper.hxx" #include "FillProperties.hxx" #include "UserDefinedProperties.hxx" #include "CharacterProperties.hxx" @@ -109,7 +109,7 @@ struct StaticRegressionEquationDefaults_Initializer private: void lcl_AddDefaultsToMap( ::chart::tPropertyValueMap & rOutMap ) { - ::chart::LineProperties::AddDefaultsToMap( rOutMap ); + ::chart::LinePropertiesHelper::AddDefaultsToMap( rOutMap ); ::chart::FillProperties::AddDefaultsToMap( rOutMap ); ::chart::CharacterProperties::AddDefaultsToMap( rOutMap ); @@ -119,7 +119,7 @@ private: // override other defaults ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::FillProperties::PROP_FILL_STYLE, drawing::FillStyle_NONE ); - ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LineProperties::PROP_LINE_STYLE, drawing::LineStyle_NONE ); + ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::LinePropertiesHelper::PROP_LINE_STYLE, drawing::LineStyle_NONE ); float fDefaultCharHeight = 10.0; ::chart::PropertyHelper::setPropertyValue( rOutMap, ::chart::CharacterProperties::PROP_CHAR_CHAR_HEIGHT, fDefaultCharHeight ); @@ -145,7 +145,7 @@ private: { ::std::vector< ::com::sun::star::beans::Property > aProperties; lcl_AddPropertiesToVector( aProperties ); - ::chart::LineProperties::AddPropertiesToVector( aProperties ); + ::chart::LinePropertiesHelper::AddPropertiesToVector( aProperties ); ::chart::FillProperties::AddPropertiesToVector( aProperties ); ::chart::CharacterProperties::AddPropertiesToVector( aProperties ); ::chart::UserDefinedProperties::AddPropertiesToVector( aProperties ); -- cgit v1.2.3