[Libreoffice-commits] core.git: Branch 'feature/chart-style-experiment-markus' - chart2/source

2019-08-27 Thread Markus Mohrhard (via logerrit)
 chart2/source/inc/OPropertySet.hxx   |2 ++
 chart2/source/tools/OPropertySet.cxx |   20 
 2 files changed, 18 insertions(+), 4 deletions(-)

New commits:
commit 7c5dd833e1f62a1cae9ce4ae804146032bd5e841
Author: Markus Mohrhard 
AuthorDate: Wed Aug 28 00:35:03 2019 +0800
Commit: Markus Mohrhard 
CommitDate: Wed Aug 28 00:35:03 2019 +0800

the default value now needs to come from the style if the style is available

Change-Id: I54b3563aabcde71e7bcddacc8a7a5b1a9eb70ccd

diff --git a/chart2/source/inc/OPropertySet.hxx 
b/chart2/source/inc/OPropertySet.hxx
index 12a55c677661..50e40b9fa082 100644
--- a/chart2/source/inc/OPropertySet.hxx
+++ b/chart2/source/inc/OPropertySet.hxx
@@ -69,6 +69,8 @@ protected:
  */
 virtual css::uno::Any GetDefaultValue( sal_Int32 nHandle ) const = 0;
 
+css::uno::Any GetDefault(sal_Int32 nHandle) const;
+
 /** The InfoHelper table contains all property names and types of
 this object.
 
diff --git a/chart2/source/tools/OPropertySet.cxx 
b/chart2/source/tools/OPropertySet.cxx
index fe4c69700fad..33ed2bcb0a53 100644
--- a/chart2/source/tools/OPropertySet.cxx
+++ b/chart2/source/tools/OPropertySet.cxx
@@ -105,6 +105,18 @@ Sequence< sal_Int8 > SAL_CALL
 return css::uno::Sequence();
 }
 
+Any OPropertySet::GetDefault(sal_Int32 nHandle) const
+{
+Reference xStyle = m_pImplProperties->GetStyle();
+if (xStyle.is())
+{
+css::uno::Reference 
xStylePropSet(xStyle, css::uno::UNO_QUERY);
+return xStylePropSet->getFastPropertyValue(nHandle);
+}
+
+return GetDefaultValue(nHandle);
+}
+
 //  XPropertyState 
 beans::PropertyState SAL_CALL
 OPropertySet::getPropertyState( const OUString& PropertyName )
@@ -143,7 +155,7 @@ Any SAL_CALL
 {
 cppu::IPropertyArrayHelper & rPH = getInfoHelper();
 
-return GetDefaultValue( rPH.getHandleByName( aPropertyName ) );
+return GetDefault( rPH.getHandleByName( aPropertyName ) );
 }
 
 //  XMultiPropertyStates 
@@ -184,7 +196,7 @@ Sequence< Any > SAL_CALL
 
 for( ; nI < nElements; ++nI )
 {
-pResultArray[ nI ] = GetDefaultValue(
+pResultArray[ nI ] = GetDefault(
 rPH.getHandleByName( aPropertyNames[ nI ] ));
 }
 
@@ -242,7 +254,7 @@ void SAL_CALL OPropertySet::setFastPropertyValue_NoBroadcast
 Any aDefault;
 try
 {
-aDefault = GetDefaultValue( nHandle );
+aDefault = GetDefault( nHandle );
 }
 catch( const beans::UnknownPropertyException& )
 {
@@ -322,7 +334,7 @@ void SAL_CALL OPropertySet::getFastPropertyValue
 // => take the default value
 try
 {
-rValue = GetDefaultValue( nHandle );
+rValue = GetDefault( nHandle );
 }
 catch( const beans::UnknownPropertyException& )
 {
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'feature/chart-style-experiment-markus' - chart2/source chart2/uiconfig

2019-08-11 Thread Markus Mohrhard (via logerrit)
 chart2/source/controller/sidebar/ChartElementsPanel.cxx |   17 +
 chart2/source/controller/sidebar/ChartElementsPanel.hxx |2 
 chart2/source/inc/ChartStyle.hxx|2 
 chart2/source/tools/ChartStyle.cxx  |5 +
 chart2/uiconfig/ui/sidebarelements.ui   |   47 ++--
 5 files changed, 66 insertions(+), 7 deletions(-)

New commits:
commit 1f72a43b2fa1ce5edf53bc23bd478b31d727dd69
Author: Markus Mohrhard 
AuthorDate: Mon Aug 12 04:14:30 2019 +0800
Commit: Markus Mohrhard 
CommitDate: Mon Aug 12 04:14:30 2019 +0800

initial stab at adding ugly chart style selector

Change-Id: Ica266b608d5868be5abe04929c912673e7c4f011

diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx 
b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
index ac48b0a7e9cb..b445fd6d 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx
@@ -33,6 +33,7 @@
 #include 
 #include 
 #include 
+#include 
 
 #include 
 
@@ -303,6 +304,8 @@ ChartElementsPanel::ChartElementsPanel(
 get(mpTextTitle, "text_title");
 get(mpTextSubTitle, "text_subtitle");
 
+get(mpLBStylesBox, "cb_styles");
+
 maTextTitle = mpTextTitle->GetText();
 maTextSubTitle = mpTextSubTitle->GetText();
 
@@ -339,6 +342,8 @@ void ChartElementsPanel::dispose()
 mpLBLegendPosition.clear();
 mpBoxLegend.clear();
 
+mpLBStylesBox.clear();
+
 mpLBAxis.clear();
 mpLBGrid.clear();
 
@@ -433,7 +438,6 @@ void ChartElementsPanel::updateData()
 mpCB2ndXAxis->Check(isAxisVisible(mxModel, AxisType::X_SECOND));
 mpCB2ndYAxis->Check(isAxisVisible(mxModel, AxisType::Y_SECOND));
 
-
 bool bSupportsMainAxis = ChartTypeHelper::isSupportingMainAxis(
 getChartType(mxModel), 0, 0);
 if (bSupportsMainAxis)
@@ -479,6 +483,17 @@ void ChartElementsPanel::updateData()
 }
 
 mpLBLegendPosition->SelectEntryPos(getLegendPos(mxModel));
+
+css::uno::Sequence aChartStyles = 
::chart::getChartStyles()->getElementNames();
+mpLBStylesBox->Clear();
+for (auto& rStyle : aChartStyles)
+{
+mpLBStylesBox->InsertEntry(rStyle);
+}
+
+ChartModel* pModel = getChartModel(mxModel);
+OUString aCurrentChartStyleName = 
css::uno::Reference(pModel->getChartStyle(), 
css::uno::UNO_QUERY_THROW)->getName();
+mpLBStylesBox->SelectEntry(aCurrentChartStyleName);
 }
 
 VclPtr ChartElementsPanel::Create (
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx 
b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
index eca293645cc4..b5719621e88b 100644
--- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx
+++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx
@@ -95,6 +95,8 @@ private:
 VclPtr mpLBLegendPosition;
 VclPtr mpBoxLegend;
 
+VclPtr mpLBStylesBox;
+
 vcl::EnumContext maContext;
 
 css::uno::Reference mxModel;
diff --git a/chart2/source/inc/ChartStyle.hxx b/chart2/source/inc/ChartStyle.hxx
index 30ecdfe0a6b4..c82611ee163c 100644
--- a/chart2/source/inc/ChartStyle.hxx
+++ b/chart2/source/inc/ChartStyle.hxx
@@ -116,7 +116,7 @@ private:
 void register_styles();
 };
 
-css::uno::Reference getChartStyles();
+OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference 
getChartStyles();
 
 } // namespace chart
 
diff --git a/chart2/source/tools/ChartStyle.cxx 
b/chart2/source/tools/ChartStyle.cxx
index b2ccf466fcfd..cb172fa30be7 100644
--- a/chart2/source/tools/ChartStyle.cxx
+++ b/chart2/source/tools/ChartStyle.cxx
@@ -252,6 +252,9 @@ void ChartStyles::addInitialStyles()
 {
 css::uno::Any aDefaultStyle;
 css::uno::Reference xChartStyle = new ChartStyle;
+css::uno::Reference xStyle(xChartStyle, 
css::uno::UNO_QUERY_THROW);
+xStyle->setName("Default");
+
 aDefaultStyle <<= xChartStyle;
 insertByName("Default", aDefaultStyle);
 }
@@ -301,7 +304,7 @@ css::uno::Any ChartStyles::getByName(const OUString& rName)
 
 css::uno::Sequence ChartStyles::getElementNames()
 {
-return css::uno::Sequence();
+return comphelper::mapKeysToSequence(maChartStyles);
 }
 
 sal_Bool ChartStyles::hasByName(const OUString& rName)
diff --git a/chart2/uiconfig/ui/sidebarelements.ui 
b/chart2/uiconfig/ui/sidebarelements.ui
index c4ec4cd49e2d..89ac8c9fd314 100644
--- a/chart2/uiconfig/ui/sidebarelements.ui
+++ b/chart2/uiconfig/ui/sidebarelements.ui
@@ -1,5 +1,5 @@
 
-
+
 
   
   
@@ -9,9 +9,9 @@
   
 True
 False
+6
 vertical
 6
-6
 
   
 True
@@ -99,14 +99,14 @@
 False
 
   
-Show Legend
 True
 True
 False
+Show Legend
+5
 True
 0
 

[Libreoffice-commits] core.git: Branch 'feature/chart-style-experiment-markus' - chart2/source

2019-08-09 Thread Markus Mohrhard (via logerrit)
 chart2/source/model/main/ChartModel_Persistence.cxx |8 
 chart2/source/tools/ChartStyle.cxx  |   19 +++
 2 files changed, 19 insertions(+), 8 deletions(-)

New commits:
commit 78f6221057f13eec4a736d12b282a5904a68d883
Author: Markus Mohrhard 
AuthorDate: Sat Aug 10 03:18:09 2019 +0800
Commit: Markus Mohrhard 
CommitDate: Sat Aug 10 03:18:09 2019 +0800

move chart wall default formatting to style

Change-Id: Ieddeb087df2c60ffa59c5ebba378f862350377bf

diff --git a/chart2/source/model/main/ChartModel_Persistence.cxx 
b/chart2/source/model/main/ChartModel_Persistence.cxx
index db3b05ea195c..6ab5ebf9135b 100644
--- a/chart2/source/model/main/ChartModel_Persistence.cxx
+++ b/chart2/source/model/main/ChartModel_Persistence.cxx
@@ -434,14 +434,6 @@ void ChartModel::insertDefaultChart()
 //set some new 'defaults' for wall and floor
 if( xDiagram.is() )
 {
-Reference< beans::XPropertySet > xWall( 
xDiagram->getWall() );
-if( xWall.is() )
-{
-xWall->setPropertyValue( "LineStyle", uno::Any( 
drawing::LineStyle_SOLID ) );
-xWall->setPropertyValue( "FillStyle", uno::Any( 
drawing::FillStyle_NONE ) );
-xWall->setPropertyValue( "LineColor", uno::Any( 
static_cast< sal_Int32 >( 0xb3b3b3 ) ) ); // gray30
-xWall->setPropertyValue( "FillColor", uno::Any( 
static_cast< sal_Int32 >( 0xe6e6e6 ) ) ); // gray10
-}
 Reference< beans::XPropertySet > xFloor( 
xDiagram->getFloor() );
 if( xFloor.is() )
 {
diff --git a/chart2/source/tools/ChartStyle.cxx 
b/chart2/source/tools/ChartStyle.cxx
index b383f4316b03..71e94867dc3a 100644
--- a/chart2/source/tools/ChartStyle.cxx
+++ b/chart2/source/tools/ChartStyle.cxx
@@ -142,6 +142,16 @@ void ChartStyle::register_styles()
 *chart::wall::StaticWallInfo::get(), 
*chart::wall::StaticWallInfoHelper::get(),
 *chart::wall::StaticWallDefaults::get());
 
+css::uno::Reference xWallStyle
+= m_xChartStyle[css::chart2::ChartObjectType::WALL];
+
+xWallStyle->setPropertyValue("LineStyle", 
css::uno::Any(css::drawing::LineStyle_SOLID));
+xWallStyle->setPropertyValue("FillStyle", 
css::uno::Any(css::drawing::FillStyle_NONE));
+xWallStyle->setPropertyValue("LineColor",
+ 
css::uno::Any(static_cast(0xb3b3b3))); // gray30
+xWallStyle->setPropertyValue("FillColor",
+ 
css::uno::Any(static_cast(0xe6e6e6))); // gray10
+
 m_xChartStyle[css::chart2::ChartObjectType::GRID] = new ChartObjectStyle(
 *chart::grid::StaticGridInfo::get(), 
*chart::grid::StaticGridInfoHelper::get(),
 *chart::grid::StaticGridDefaults::get());
@@ -187,6 +197,15 @@ ChartStyle::applyStyleToDiagram(const 
css::uno::Reference
 m_xChartStyle.find(css::chart2::ChartObjectType::LEGEND)->second,
 css::uno::UNO_QUERY_THROW));
 }
+
+css::uno::Reference 
xWallStyle(xDiagram->getWall(),
+   
css::uno::UNO_QUERY);
+if (xWallStyle.is())
+{
+xWallStyle->setStyle(css::uno::Reference(
+m_xChartStyle.find(css::chart2::ChartObjectType::WALL)->second,
+css::uno::UNO_QUERY_THROW));
+}
 }
 
 //
___
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

[Libreoffice-commits] core.git: Branch 'feature/chart-style-experiment-markus' - chart2/source

2019-08-09 Thread Gagandeep Singh (via logerrit)
 chart2/source/inc/Axis.hxx  |  165 ++
 chart2/source/inc/DataPoint.hxx |  134 +++
 chart2/source/inc/DataSeries.hxx|  216 
 chart2/source/inc/Diagram.hxx   |  248 
 chart2/source/inc/GridProperties.hxx|  133 +++
 chart2/source/inc/PageBackground.hxx|  134 +++
 chart2/source/inc/StockBar.hxx  |  125 ++
 chart2/source/inc/Title.hxx |  143 
 chart2/source/inc/Wall.hxx  |   78 +---
 chart2/source/model/inc/DataSeries.hxx  |  172 ---
 chart2/source/model/inc/Diagram.hxx |  186 -
 chart2/source/model/inc/StockBar.hxx|   96 --
 chart2/source/model/main/Axis.cxx   |  148 +++-
 chart2/source/model/main/Axis.hxx   |  138 ---
 chart2/source/model/main/DataPoint.cxx  |   59 ++
 chart2/source/model/main/DataPoint.hxx  |  116 -
 chart2/source/model/main/DataSeries.cxx |   82 +
 chart2/source/model/main/Diagram.cxx|  120 +
 chart2/source/model/main/GridProperties.cxx |   97 --
 chart2/source/model/main/GridProperties.hxx |  105 ---
 chart2/source/model/main/PageBackground.cxx |   97 --
 chart2/source/model/main/PageBackground.hxx |  104 ---
 chart2/source/model/main/StockBar.cxx   |   93 --
 chart2/source/model/main/Title.cxx  |  133 ++-
 chart2/source/model/main/Title.hxx  |  115 
 chart2/source/model/main/Wall.cxx   |   95 --
 chart2/source/tools/ChartStyle.cxx  |   43 
 27 files changed, 1797 insertions(+), 1578 deletions(-)

New commits:
commit fea89c0e865c83e048d2221f897d1f6a4046505c
Author: Gagandeep Singh 
AuthorDate: Thu Aug 8 16:17:00 2019 +0530
Commit: Markus Mohrhard 
CommitDate: Sat Aug 10 02:30:54 2019 +0800

This updates the chart model elements to be used with ChartStyles.cxx

Based on Markus' patch: d63f1346a6c5767d995c787fe2bb36b023a64788

Change-Id: I712793f7299ca33773b004711400af4e070c6485

diff --git a/chart2/source/inc/Axis.hxx b/chart2/source/inc/Axis.hxx
new file mode 100644
index ..0d93322c1465
--- /dev/null
+++ b/chart2/source/inc/Axis.hxx
@@ -0,0 +1,165 @@
+/* -*- 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_AXIS_HXX
+#define INCLUDED_CHART2_SOURCE_MODEL_MAIN_AXIS_HXX
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+namespace chart
+{
+namespace impl
+{
+typedef ::cppu::WeakImplHelper
+Axis_Base;
+}
+
+namespace axis
+{
+struct StaticAxisInfo_Initializer
+{
+css::uno::Reference* operator()();
+};
+
+struct StaticAxisInfo
+: public 
rtl::StaticAggregate,
+  StaticAxisInfo_Initializer>
+{
+};
+
+struct StaticAxisDefaults_Initializer
+{
+::chart::tPropertyValueMap* operator()();
+};
+
+struct StaticAxisDefaults
+: public rtl::StaticAggregate<::chart::tPropertyValueMap, 
StaticAxisDefaults_Initializer>
+{
+};
+
+struct StaticAxisInfoHelper_Initializer
+{
+::cppu::OPropertyArrayHelper* operator()();
+};
+
+struct StaticAxisInfoHelper
+: public rtl::StaticAggregate<::cppu::OPropertyArrayHelper, 
StaticAxisInfoHelper_Initializer>
+{
+};
+}
+
+class Axis final : public MutexContainer, 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 SAL_CALL getSupportedServiceNames() 
override;
+
+/// merge XInterface implementations
+DECLARE_XINTERFACE()
+/// merge XTypeProvider implementations
+DECLARE_XTYPEPROVIDER()
+
+private:
+