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 <markus.mohrh...@googlemail.com> AuthorDate: Mon Aug 12 04:14:30 2019 +0800 Commit: Markus Mohrhard <markus.mohrh...@googlemail.com> 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..b445fd88886d 100644 --- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx +++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx @@ -33,6 +33,7 @@ #include <AxisHelper.hxx> #include <DiagramHelper.hxx> #include <ChartTypeHelper.hxx> +#include <ChartStyle.hxx> #include <ChartModel.hxx> @@ -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<OUString> aChartStyles = ::chart::getChartStyles()->getElementNames(); + mpLBStylesBox->Clear(); + for (auto& rStyle : aChartStyles) + { + mpLBStylesBox->InsertEntry(rStyle); + } + + ChartModel* pModel = getChartModel(mxModel); + OUString aCurrentChartStyleName = css::uno::Reference<css::style::XStyle>(pModel->getChartStyle(), css::uno::UNO_QUERY_THROW)->getName(); + mpLBStylesBox->SelectEntry(aCurrentChartStyleName); } VclPtr<vcl::Window> 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<ListBox> mpLBLegendPosition; VclPtr<VclHBox> mpBoxLegend; + VclPtr<ListBox> mpLBStylesBox; + vcl::EnumContext maContext; css::uno::Reference<css::frame::XModel> 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<css::container::XNameContainer> getChartStyles(); +OOO_DLLPUBLIC_CHARTTOOLS css::uno::Reference<css::container::XNameContainer> 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<css::chart2::XChartStyle> xChartStyle = new ChartStyle; + css::uno::Reference<css::style::XStyle> 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<OUString> ChartStyles::getElementNames() { - return css::uno::Sequence<OUString>(); + 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 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="chart"> <requires lib="gtk+" version="3.18"/> <object class="GtkGrid" id="ChartElementsPanel"> @@ -9,9 +9,9 @@ <object class="GtkBox" id="container"> <property name="visible">True</property> <property name="can_focus">False</property> + <property name="border_width">6</property> <property name="orientation">vertical</property> <property name="spacing">6</property> - <property name="border_width">6</property> <child> <object class="GtkFrame" id="frame1"> <property name="visible">True</property> @@ -99,14 +99,14 @@ <property name="can_focus">False</property> <child> <object class="GtkCheckButton" id="checkbutton_legend"> - <property name="tooltip_text" translatable="yes" context="sidebarelements|checkbutton_legend|tooltip_text">Show Legend</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">False</property> + <property name="tooltip_text" translatable="yes" context="sidebarelements|checkbutton_legend|tooltip_text">Show Legend</property> + <property name="margin_right">5</property> <property name="use_underline">True</property> <property name="xalign">0</property> <property name="draw_indicator">True</property> - <property name="margin_right">5</property> </object> <packing> <property name="left_attach">0</property> @@ -493,6 +493,45 @@ <property name="position">4</property> </packing> </child> + <child> + <object class="GtkGrid" id="grid6"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <child> + <object class="GtkLabel" id="label_style"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="label" translatable="yes" context="sidebarelements|label_chart_style">Chart Style:</property> + <accessibility> + <relation type="label-for" target="cb_styles"/> + </accessibility> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkComboBoxText" id="cb_styles"> + <property name="visible">True</property> + <property name="can_focus">False</property> + <property name="hexpand">True</property> + <accessibility> + <relation type="labelled-by" target="label_style"/> + </accessibility> + </object> + <packing> + <property name="left_attach">1</property> + <property name="top_attach">0</property> + </packing> + </child> + </object> + <packing> + <property name="expand">False</property> + <property name="fill">True</property> + <property name="position">5</property> + </packing> + </child> </object> <packing> <property name="left_attach">0</property> _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits