[Libreoffice-commits] core.git: Branch 'feature/chart-style-experiment-markus' - 2 commits - chart2/source offapi/com
chart2/source/inc/ChartStyle.hxx | 14 - chart2/source/model/main/ChartModel.cxx|2 chart2/source/tools/ChartStyle.cxx | 77 + offapi/com/sun/star/chart2/XChartStyle.idl |7 ++ 4 files changed, 99 insertions(+), 1 deletion(-) New commits: commit 77792f9c9c0b92182a0855fae9dcf9274efa0730 Author: Markus Mohrhard AuthorDate: Fri Aug 16 23:13:30 2019 +0800 Commit: Markus Mohrhard CommitDate: Fri Aug 16 23:13:30 2019 +0800 format file Change-Id: I42c0069b63ced24eee99d43a7319cc50fd629e30 diff --git a/chart2/source/inc/ChartStyle.hxx b/chart2/source/inc/ChartStyle.hxx index fc1f06270f90..54cbc5fe243b 100644 --- a/chart2/source/inc/ChartStyle.hxx +++ b/chart2/source/inc/ChartStyle.hxx @@ -101,8 +101,8 @@ public: virtual void SAL_CALL applyStyleToTitle(const css::uno::Reference& xTitle) override; -virtual void SAL_CALL -applyStyleToBackground(const css::uno::Reference& xBackground) override; +virtual void SAL_CALL applyStyleToBackground( +const css::uno::Reference& xBackground) override; // XStyle virtual sal_Bool SAL_CALL isUserDefined() override; @@ -124,7 +124,8 @@ private: void applyStyleToAxis(const css::uno::Reference& xAxis); -void applyStyleToCoordinates(const css::uno::Reference& xCooSysCont); +void applyStyleToCoordinates( +const css::uno::Reference& xCooSysCont); }; OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference getChartStyles(); commit 2e31f4ab53b77ebbb0932ced6cafe8e2c8af49a2 Author: Gagandeep Singh AuthorDate: Tue Aug 13 15:28:38 2019 +0530 Commit: Markus Mohrhard CommitDate: Fri Aug 16 19:40:46 2019 +0800 Add more methods to XChartStyle.idl for applying styles to title, axis,.. Change-Id: I6ce9b3da584671636830122ef9ac9f6b9f54d132 diff --git a/chart2/source/inc/ChartStyle.hxx b/chart2/source/inc/ChartStyle.hxx index c82611ee163c..fc1f06270f90 100644 --- a/chart2/source/inc/ChartStyle.hxx +++ b/chart2/source/inc/ChartStyle.hxx @@ -24,6 +24,7 @@ #include #include #include +#include #include #include #include @@ -95,7 +96,13 @@ public: SAL_CALL getStyleForObject(const sal_Int16 nChartObjectType) override; virtual void SAL_CALL -applyStyleToDiagram(const css::uno::Reference& xDiagram); +applyStyleToDiagram(const css::uno::Reference& xDiagram) override; + +virtual void SAL_CALL +applyStyleToTitle(const css::uno::Reference& xTitle) override; + +virtual void SAL_CALL +applyStyleToBackground(const css::uno::Reference& xBackground) override; // XStyle virtual sal_Bool SAL_CALL isUserDefined() override; @@ -114,6 +121,10 @@ private: std::map> m_xChartStyle; void register_styles(); + +void applyStyleToAxis(const css::uno::Reference& xAxis); + +void applyStyleToCoordinates(const css::uno::Reference& xCooSysCont); }; OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference getChartStyles(); diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 7c500abd4a07..4cda0d5882fc 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -935,6 +935,8 @@ void SAL_CALL ChartModel::setTitleObject( const uno::Reference< chart2::XTitle > ModifyListenerHelper::addListener( m_xTitle, this ); } setModified( true ); + +m_xChartStyle->applyStyleToTitle( xTitle ); } // _ XChartStyled _ diff --git a/chart2/source/tools/ChartStyle.cxx b/chart2/source/tools/ChartStyle.cxx index cb172fa30be7..2847b3db7f7d 100644 --- a/chart2/source/tools/ChartStyle.cxx +++ b/chart2/source/tools/ChartStyle.cxx @@ -21,6 +21,7 @@ #include #include #include +#include #include #include #include @@ -187,6 +188,56 @@ css::uno::Sequence SAL_CALL ChartStyle::getSupportedServiceNames() return { "com.sun.star.chart2.ChartStyle" }; } +void SAL_CALL ChartStyle::applyStyleToTitle(const css::uno::Reference& xTitle) +{ +css::uno::Reference xTitleStyle(xTitle, css::uno::UNO_QUERY); +if (xTitleStyle.is()) +{ +xTitleStyle->setStyle(css::uno::Reference( +m_xChartStyle.find(css::chart2::ChartObjectType::TITLE)->second, +css::uno::UNO_QUERY_THROW)); +} +} + +void ChartStyle::applyStyleToAxis(const css::uno::Reference& xAxis) +{ +css::uno::Reference xAxisStyle(xAxis, css::uno::UNO_QUERY); +if (xAxisStyle.is()) +{ +xAxisStyle->setStyle(css::uno::Reference( +m_xChartStyle.find(css::chart2::ChartObjectType::AXIS)->second, +css::uno::UNO_QUERY_THROW)); +} + +css::uno::Reference xTitled(xAxis, css::uno::UNO_QUERY); +if (xTitled.is()) +{ +css::uno::Reference xTitle = xTitled->getTitleObject(); +if (xTitle.is()) +applyStyleToTitle(xTitle); +} +} + +void ChartStyle::applyStyleToCoordinates( +const
[Libreoffice-commits] core.git: Branch 'feature/chart-style-experiment-markus' - 2 commits - chart2/source
chart2/source/chartcore.component |4 chart2/source/inc/ChartStyle.hxx| 22 - chart2/source/model/main/ChartModel.cxx |5 - chart2/source/tools/ChartStyle.cxx | 129 ++-- chart2/source/view/main/VTitle.cxx |3 5 files changed, 148 insertions(+), 15 deletions(-) New commits: commit 4bf7014ba4b265fa0947bf4e6cc8bbee8f2ab94f Author: Markus Mohrhard AuthorDate: Mon Aug 12 03:27:52 2019 +0800 Commit: Markus Mohrhard CommitDate: Mon Aug 12 03:27:52 2019 +0800 tdf#126837: fix incorrect handling of visible flag for chart titles Change-Id: Idb8dfa18e924324dcf27339fd18ff90616651d40 diff --git a/chart2/source/view/main/VTitle.cxx b/chart2/source/view/main/VTitle.cxx index d0633263f8af..967edd72f55a 100644 --- a/chart2/source/view/main/VTitle.cxx +++ b/chart2/source/view/main/VTitle.cxx @@ -113,6 +113,9 @@ void VTitle::createShapes( m_nYPos = rPos.Y; uno::Reference< beans::XPropertySet > xTitleProperties( m_xTitle, uno::UNO_QUERY ); +sal_Bool bVisible = true; +if ((xTitleProperties->getPropertyValue("Visible") >>= bVisible) && !bVisible) +return; try { commit 816332b04ded68f0729bef34dd8774cb8fdabaf1 Author: Markus Mohrhard AuthorDate: Mon Aug 12 02:32:09 2019 +0800 Commit: Markus Mohrhard CommitDate: Mon Aug 12 03:06:14 2019 +0800 implement a ChartStyles object Change-Id: Id7992faa801816be99c47f2bea754108b0296da5 diff --git a/chart2/source/chartcore.component b/chart2/source/chartcore.component index 4bb0f689c788..f58ba98ba3ac 100644 --- a/chart2/source/chartcore.component +++ b/chart2/source/chartcore.component @@ -256,8 +256,4 @@ constructor="com_sun_star_comp_chart2_ChartView_get_implementation"> - - - diff --git a/chart2/source/inc/ChartStyle.hxx b/chart2/source/inc/ChartStyle.hxx index c12441e1cd76..30ecdfe0a6b4 100644 --- a/chart2/source/inc/ChartStyle.hxx +++ b/chart2/source/inc/ChartStyle.hxx @@ -16,6 +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_CHARTSTYLE_HXX #define INCLUDED_CHART2_SOURCE_INC_CHARTSTYLE_HXX @@ -25,13 +26,14 @@ #include #include #include +#include #include #include "PropertyHelper.hxx" #include "OPropertySet.hxx" #include "MutexContainer.hxx" -namespace chart2 +namespace chart { namespace impl { @@ -77,7 +79,8 @@ private: css::uno::Reference mxPropSetInfo; }; -class ChartStyle : public cppu::WeakImplHelper +class ChartStyle : public cppu::WeakImplHelper { public: explicit ChartStyle(); @@ -94,15 +97,28 @@ public: virtual void SAL_CALL applyStyleToDiagram(const css::uno::Reference& xDiagram); +// XStyle +virtual sal_Bool SAL_CALL isUserDefined() override; +virtual sal_Bool SAL_CALL isInUse() override; +virtual OUString SAL_CALL getParentStyle() override; +virtual void setParentStyle(const OUString& rParentStyle) override; + +// XNamed +virtual OUString SAL_CALL getName() override; +virtual void SAL_CALL setName(const OUString& rName) override; + private: sal_Int16 m_nNumObjects; +OUString maName; std::map> m_xChartStyle; void register_styles(); }; -} // namespace chart2 +css::uno::Reference getChartStyles(); + +} // namespace chart // INCLUDED_CHART2_SOURCE_INC_CHARTSTYLE_HXX #endif diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index ba5a5d399445..7c500abd4a07 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -31,6 +31,7 @@ #include #include #include +#include #include #include @@ -110,8 +111,8 @@ ChartModel::ChartModel(uno::Reference const & xContext) ModifyListenerHelper::addListener( m_xPageBackground, this ); m_xChartTypeManager.set( xContext->getServiceManager()->createInstanceWithContext( "com.sun.star.chart2.ChartTypeManager", m_xContext ), uno::UNO_QUERY ); -m_xChartStyle.set( xContext->getServiceManager()->createInstanceWithContext( -"com.sun.star.chart2.ChartStyle" , m_xContext ), uno::UNO_QUERY ); + +::chart::getChartStyles()->getByName("Default") >>= m_xChartStyle; } osl_atomic_decrement(_refCount); } diff --git a/chart2/source/tools/ChartStyle.cxx b/chart2/source/tools/ChartStyle.cxx index 71e94867dc3a..b2ccf466fcfd 100644 --- a/chart2/source/tools/ChartStyle.cxx +++ b/chart2/source/tools/ChartStyle.cxx @@ -22,6 +22,7 @@ #include #include #include +#include #include #include @@ -49,7 +50,7 @@ class XComponentContext; } } -namespace chart2 +namespace chart { ChartObjectStyle::ChartObjectStyle(css::uno::Reference xPropSetInfo, ::cppu::IPropertyArrayHelper& rArrayHelper, @@ -208,19 +209,135
[Libreoffice-commits] core.git: Branch 'feature/chart-style-experiment-markus' - 2 commits - chart2/source offapi/com
chart2/source/inc/ChartStyle.hxx|3 ++ chart2/source/model/main/ChartModel.cxx |2 + chart2/source/model/main/ChartModel_Persistence.cxx | 11 chart2/source/tools/ChartStyle.cxx | 25 offapi/com/sun/star/chart2/XChartStyle.idl |3 ++ 5 files changed, 39 insertions(+), 5 deletions(-) New commits: commit b91405200821542b714c19eb65c5ec0532499913 Author: Markus Mohrhard AuthorDate: Sat Aug 10 01:17:50 2019 +0800 Commit: Markus Mohrhard CommitDate: Sat Aug 10 01:19:49 2019 +0800 move default chart legend formatting to the style Change-Id: If996e2d86ce07e91da77789732a1abf1ae1b3f99 diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx index 87a0a742b7d9..db3b05ea195c 100644 --- a/chart2/source/model/main/ChartModel_Persistence.cxx +++ b/chart2/source/model/main/ChartModel_Persistence.cxx @@ -416,11 +416,6 @@ void ChartModel::insertDefaultChart() Reference< beans::XPropertySet > xLegendProperties( xLegend, uno::UNO_QUERY ); if( xLegendProperties.is() ) { -xLegendProperties->setPropertyValue( "FillStyle", uno::Any( drawing::FillStyle_NONE )); -xLegendProperties->setPropertyValue( "LineStyle", uno::Any( drawing::LineStyle_NONE )); -xLegendProperties->setPropertyValue( "LineColor", uno::Any( static_cast< sal_Int32 >( 0xb3b3b3 ) )); // gray30 -xLegendProperties->setPropertyValue( "FillColor", uno::Any( static_cast< sal_Int32 >( 0xe6e6e6 ) ) ); // gray10 - if( bIsRTL ) xLegendProperties->setPropertyValue( "AnchorPosition", uno::Any( chart2::LegendPosition_LINE_START )); } diff --git a/chart2/source/tools/ChartStyle.cxx b/chart2/source/tools/ChartStyle.cxx index 8aac449dcf90..6c7c0bafe093 100644 --- a/chart2/source/tools/ChartStyle.cxx +++ b/chart2/source/tools/ChartStyle.cxx @@ -19,6 +19,8 @@ #include #include +#include +#include #include #include @@ -104,6 +106,15 @@ void ChartStyle::register_styles() m_xChartStyle[css::chart2::ChartObjectType::LEGEND] = new ChartObjectStyle( *chart::legend::StaticLegendInfo::get(), *chart::legend::StaticLegendInfoHelper::get(), *chart::legend::StaticLegendDefaults::get()); + +css::uno::Reference xLegendStyle += m_xChartStyle[css::chart2::ChartObjectType::LEGEND]; +xLegendStyle->setPropertyValue("FillStyle", css::uno::Any(css::drawing::FillStyle_NONE)); +xLegendStyle->setPropertyValue("LineStyle", css::uno::Any(css::drawing::LineStyle_NONE)); +xLegendStyle->setPropertyValue("LineColor", + css::uno::Any(static_cast(0xb3b3b3))); // gray30 +xLegendStyle->setPropertyValue("FillColor", + css::uno::Any(static_cast(0xe6e6e6))); // gray10 } // _ XServiceInfo _ commit 3ff4ac00a7bdee0e7cecaf5c35bc8056bc3f1d41 Author: Markus Mohrhard AuthorDate: Sat Aug 10 01:19:23 2019 +0800 Commit: Markus Mohrhard CommitDate: Sat Aug 10 01:19:48 2019 +0800 add initial code to apply style to chart Change-Id: I33207f95236f4102f8ae5620465494b3384f diff --git a/chart2/source/inc/ChartStyle.hxx b/chart2/source/inc/ChartStyle.hxx index 2c1fb3d9e7f8..c12441e1cd76 100644 --- a/chart2/source/inc/ChartStyle.hxx +++ b/chart2/source/inc/ChartStyle.hxx @@ -91,6 +91,9 @@ public: virtual css::uno::Reference SAL_CALL getStyleForObject(const sal_Int16 nChartObjectType) override; +virtual void SAL_CALL +applyStyleToDiagram(const css::uno::Reference& xDiagram); + private: sal_Int16 m_nNumObjects; diff --git a/chart2/source/model/main/ChartModel.cxx b/chart2/source/model/main/ChartModel.cxx index 262070310591..ba5a5d399445 100644 --- a/chart2/source/model/main/ChartModel.cxx +++ b/chart2/source/model/main/ChartModel.cxx @@ -687,6 +687,8 @@ void SAL_CALL ChartModel::setFirstDiagram( const uno::Reference< chart2::XDiagra ModifyListenerHelper::removeListener( xOldDiagram, xListener ); ModifyListenerHelper::addListener( xDiagram, xListener ); setModified( true ); + +m_xChartStyle->applyStyleToDiagram(xDiagram); } Reference< chart2::data::XDataSource > ChartModel::impl_createDefaultData() diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx b/chart2/source/model/main/ChartModel_Persistence.cxx index 642aceb626ae..87a0a742b7d9 100644 --- a/chart2/source/model/main/ChartModel_Persistence.cxx +++ b/chart2/source/model/main/ChartModel_Persistence.cxx @@ -732,6 +732,12 @@ void SAL_CALL ChartModel::modified( const lang::EventObject& rEvenObject) } unlockControllers(); } +uno::Reference xDiagram(rEvenObject.Source, uno::UNO_QUERY); +if (xDiagram.is()) +{ +if
[Libreoffice-commits] core.git: Branch 'feature/chart-style-experiment-markus' - 2 commits - chart2/source
chart2/source/inc/ChartStyle.hxx| 43 +++ chart2/source/inc/Legend.hxx| 134 chart2/source/model/main/Legend.cxx | 116 +-- chart2/source/model/main/Legend.hxx | 107 chart2/source/tools/ChartStyle.cxx | 111 + 5 files changed, 277 insertions(+), 234 deletions(-) New commits: commit d63f1346a6c5767d995c787fe2bb36b023a64788 Author: Markus Mohrhard AuthorDate: Wed Aug 7 05:10:41 2019 +0800 Commit: Markus Mohrhard CommitDate: Wed Aug 7 05:10:41 2019 +0800 store the first style in ChartStyle Change-Id: Ib72b2c9aeb3ba2c09e8be6edbbd713cb2512b3e7 diff --git a/chart2/source/inc/ChartStyle.hxx b/chart2/source/inc/ChartStyle.hxx index f01fa6769524..2c1fb3d9e7f8 100644 --- a/chart2/source/inc/ChartStyle.hxx +++ b/chart2/source/inc/ChartStyle.hxx @@ -33,13 +33,24 @@ namespace chart2 { +namespace impl +{ +typedef ::cppu::WeakImplHelper ChartObjectStyle_Base; +} -class ChartObjectStyle : public chart::MutexContainer, public property::OPropertySet, public css::style::XStyle +class ChartObjectStyle : public chart::MutexContainer, + public impl::ChartObjectStyle_Base, + public property::OPropertySet { public: -ChartObjectStyle(::cppu::IPropertyArrayHelper& rArrayHelper, const chart::tPropertyValueMap& rPropertyMap); +ChartObjectStyle(css::uno::Reference xPropertySetInfo, + ::cppu::IPropertyArrayHelper& rArrayHelper, + const chart::tPropertyValueMap& rPropertyMap); virtual ~ChartObjectStyle(); +/// merge XInterface implementations +DECLARE_XINTERFACE() + virtual sal_Bool SAL_CALL isUserDefined() override; virtual sal_Bool SAL_CALL isInUse() override; @@ -47,32 +58,34 @@ public: virtual void SAL_CALL setParentStyle(const OUString&) override; // OPropertySet -virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const override; +virtual css::uno::Any GetDefaultValue(sal_Int32 nHandle) const override; // OPropertySet -virtual ::cppu::IPropertyArrayHelper & SAL_CALL getInfoHelper() override; +virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper() override; // XPropertySet -virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL -getPropertySetInfo() override; +virtual css::uno::Reference +SAL_CALL getPropertySetInfo() override; -private: +virtual OUString SAL_CALL getName(); +virtual void SAL_CALL setName(const OUString&); + +private: ::cppu::IPropertyArrayHelper& mrArrayHelper; const chart::tPropertyValueMap& mrPropertyMap; +css::uno::Reference mxPropSetInfo; }; -class ChartStyle : public cppu::WeakImplHelper< - css::chart2::XChartStyle -, css::lang::XServiceInfo > +class ChartStyle : public cppu::WeakImplHelper { public: explicit ChartStyle(); virtual ~ChartStyle(); /// 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; +virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; +virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() override; // _ XChartStyle _ virtual css::uno::Reference @@ -82,6 +95,8 @@ private: sal_Int16 m_nNumObjects; std::map> m_xChartStyle; + +void register_styles(); }; } // namespace chart2 diff --git a/chart2/source/inc/Legend.hxx b/chart2/source/inc/Legend.hxx new file mode 100644 index ..b3685eb5862a --- /dev/null +++ b/chart2/source/inc/Legend.hxx @@ -0,0 +1,134 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ +#ifndef INCLUDED_CHART2_SOURCE_MODEL_MAIN_LEGEND_HXX +#define INCLUDED_CHART2_SOURCE_MODEL_MAIN_LEGEND_HXX + +#include