diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-09-20 21:29:41 +0200 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2015-09-20 21:33:58 +0200 |
commit | 85eb1e5148ec657c8e582a0faf3ffa75009a4788 (patch) | |
tree | 8db62c278ce2ec3b657f5ece9f9d2b47eb580e74 /chart2 | |
parent | e1afea91e9662424480b8ad9f50842cfa224331e (diff) |
use localized string for title text, tdf#94294
Change-Id: Id27e5c3794b728ce79d63b6c7d552df0cc1ba239
Diffstat (limited to 'chart2')
-rw-r--r-- | chart2/source/controller/sidebar/ChartElementsPanel.cxx | 49 | ||||
-rw-r--r-- | chart2/source/controller/sidebar/ChartElementsPanel.hxx | 8 | ||||
-rw-r--r-- | chart2/uiconfig/ui/sidebarelements.ui | 66 |
3 files changed, 68 insertions, 55 deletions
diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.cxx b/chart2/source/controller/sidebar/ChartElementsPanel.cxx index 985f9974a163..8d9317a8199a 100644 --- a/chart2/source/controller/sidebar/ChartElementsPanel.cxx +++ b/chart2/source/controller/sidebar/ChartElementsPanel.cxx @@ -37,7 +37,6 @@ #include <comphelper/processfactory.hxx> #include "LegendHelper.hxx" -#include "TitleHelper.hxx" #include "ChartModelHelper.hxx" #include "AxisHelper.hxx" #include "DiagramHelper.hxx" @@ -119,18 +118,6 @@ bool isTitleVisisble(css::uno::Reference<css::frame::XModel> xModel, TitleHelper return TitleHelper::getTitle(eTitle, xModel).is(); } -void setTitleVisible(css::uno::Reference<css::frame::XModel> xModel, TitleHelper::eTitleType eTitle, bool bVisible) -{ - if (bVisible) - { - TitleHelper::createTitle(eTitle, "Title", xModel, comphelper::getProcessComponentContext()); - } - else - { - TitleHelper::removeTitle(eTitle, xModel); - } -} - bool isGridVisible(css::uno::Reference<css::frame::XModel> xModel, GridType eType) { Reference< chart2::XDiagram > xDiagram(ChartModelHelper::findDiagram(xModel)); @@ -313,6 +300,12 @@ ChartElementsPanel::ChartElementsPanel( get(mpLBLegendPosition, "comboboxtext_legend"); get(mpBoxLegend, "box_legend"); + get(mpTextTitle, "text_title"); + get(mpTextSubTitle, "text_subtitle"); + + maTextTitle = mpTextTitle->GetText(); + maTextSubTitle = mpTextSubTitle->GetText(); + Initialize(); } @@ -347,6 +340,9 @@ void ChartElementsPanel::dispose() mpLBLegendPosition.clear(); mpBoxLegend.clear(); + mpTextTitle.clear(); + mpTextSubTitle.clear(); + PanelLayout::dispose(); } @@ -472,29 +468,29 @@ IMPL_LINK_TYPED(ChartElementsPanel, CheckBoxHdl, Button*, pButton, void) CheckBox* pCheckBox = static_cast<CheckBox*>(pButton); bool bChecked = pCheckBox->IsChecked(); if (pCheckBox == mpCBTitle.get()) - setTitleVisible(mxModel, TitleHelper::MAIN_TITLE, bChecked); + setTitleVisible(TitleHelper::MAIN_TITLE, bChecked); else if (pCheckBox == mpCBSubtitle.get()) - setTitleVisible(mxModel, TitleHelper::SUB_TITLE, bChecked); + setTitleVisible(TitleHelper::SUB_TITLE, bChecked); else if (pCheckBox == mpCBXAxis.get()) setAxisVisible(mxModel, AxisType::X_MAIN, bChecked); else if (pCheckBox == mpCBXAxisTitle.get()) - setTitleVisible(mxModel, TitleHelper::X_AXIS_TITLE, bChecked); + setTitleVisible(TitleHelper::X_AXIS_TITLE, bChecked); else if (pCheckBox == mpCBYAxis.get()) setAxisVisible(mxModel, AxisType::Y_MAIN, bChecked); else if (pCheckBox == mpCBYAxisTitle.get()) - setTitleVisible(mxModel, TitleHelper::Y_AXIS_TITLE, bChecked); + setTitleVisible(TitleHelper::Y_AXIS_TITLE, bChecked); else if (pCheckBox == mpCBZAxis.get()) setAxisVisible(mxModel, AxisType::Z_MAIN, bChecked); else if (pCheckBox == mpCBZAxisTitle.get()) - setTitleVisible(mxModel, TitleHelper::Z_AXIS_TITLE, bChecked); + setTitleVisible(TitleHelper::Z_AXIS_TITLE, bChecked); else if (pCheckBox == mpCB2ndXAxis.get()) setAxisVisible(mxModel, AxisType::X_SECOND, bChecked); else if (pCheckBox == mpCB2ndXAxisTitle.get()) - setTitleVisible(mxModel, TitleHelper::SECONDARY_X_AXIS_TITLE, bChecked); + setTitleVisible(TitleHelper::SECONDARY_X_AXIS_TITLE, bChecked); else if (pCheckBox == mpCB2ndYAxis.get()) setAxisVisible(mxModel, AxisType::Y_SECOND, bChecked); else if (pCheckBox == mpCB2ndYAxisTitle.get()) - setTitleVisible(mxModel, TitleHelper::SECONDARY_Y_AXIS_TITLE, bChecked); + setTitleVisible(TitleHelper::SECONDARY_Y_AXIS_TITLE, bChecked); else if (pCheckBox == mpCBLegend.get()) { mpBoxLegend->Enable( bChecked ); @@ -517,6 +513,19 @@ IMPL_LINK_NOARG(ChartElementsPanel, LegendPosHdl) return 0; } +void ChartElementsPanel::setTitleVisible(TitleHelper::eTitleType eTitle, bool bVisible) +{ + if (bVisible) + { + OUString aText = eTitle == TitleHelper::SUB_TITLE ? maTextSubTitle : maTextTitle; + TitleHelper::createTitle(eTitle, aText, mxModel, comphelper::getProcessComponentContext()); + } + else + { + TitleHelper::removeTitle(eTitle, mxModel); + } +} + }} // end of namespace ::chart::sidebar /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/chart2/source/controller/sidebar/ChartElementsPanel.hxx b/chart2/source/controller/sidebar/ChartElementsPanel.hxx index c5ffae24e632..39d78d9ddaac 100644 --- a/chart2/source/controller/sidebar/ChartElementsPanel.hxx +++ b/chart2/source/controller/sidebar/ChartElementsPanel.hxx @@ -25,6 +25,7 @@ #include <svx/sidebar/PanelLayout.hxx> #include <vcl/layout.hxx> #include "ChartSidebarModifyListener.hxx" +#include "TitleHelper.hxx" #include <com/sun/star/util/XModifyListener.hpp> @@ -89,6 +90,8 @@ private: VclPtr<CheckBox> mpCBGridHorizontalMajor; VclPtr<CheckBox> mpCBGridVerticalMinor; VclPtr<CheckBox> mpCBGridHorizontalMinor; + VclPtr<FixedText> mpTextTitle; + VclPtr<FixedText> mpTextSubTitle; VclPtr<ListBox> mpLBLegendPosition; VclPtr<VclHBox> mpBoxLegend; @@ -101,8 +104,13 @@ private: bool mbModelValid; + OUString maTextTitle; + OUString maTextSubTitle; + void Initialize(); + void setTitleVisible(TitleHelper::eTitleType eTitle, bool bVisible); + DECL_LINK_TYPED(CheckBoxHdl, Button*, void); DECL_LINK(LegendPosHdl, void*); }; diff --git a/chart2/uiconfig/ui/sidebarelements.ui b/chart2/uiconfig/ui/sidebarelements.ui index 20d02e2a424a..e844314facf6 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.16.1 --> +<!-- Generated with glade 3.18.3 --> <interface> <requires lib="gtk+" version="3.0"/> <object class="GtkGrid" id="ChartElementsPanel"> @@ -42,8 +42,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -58,8 +56,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -211,8 +207,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -227,8 +221,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -243,8 +235,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -259,8 +249,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -275,8 +263,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -291,8 +277,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">2</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -306,8 +290,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -321,8 +303,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">3</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -336,8 +316,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -351,8 +329,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">4</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -406,8 +382,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -422,8 +396,6 @@ <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -438,8 +410,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">0</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> @@ -454,8 +424,6 @@ <packing> <property name="left_attach">1</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> </object> @@ -479,12 +447,40 @@ <property name="position">3</property> </packing> </child> + <child> + <object class="GtkGrid" id="grid4"> + <property name="can_focus">False</property> + <child> + <object class="GtkLabel" id="text_title"> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Title</property> + </object> + <packing> + <property name="left_attach">0</property> + <property name="top_attach">0</property> + </packing> + </child> + <child> + <object class="GtkLabel" id="text_subtitle"> + <property name="can_focus">False</property> + <property name="label" translatable="yes">Subtitle</property> + </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">4</property> + </packing> + </child> </object> <packing> <property name="left_attach">0</property> <property name="top_attach">1</property> - <property name="width">1</property> - <property name="height">1</property> </packing> </child> <child> |