chart2/source/controller/dialogs/TextDirectionListBox.cxx |   15 ---
 chart2/source/controller/dialogs/res_LegendPosition.cxx   |   64 ++++++++++++++
 chart2/source/controller/dialogs/tp_LegendPosition.cxx    |   25 ++---
 chart2/source/controller/dialogs/tp_LegendPosition.hxx    |    9 -
 chart2/source/controller/inc/TextDirectionListBox.hxx     |    6 -
 chart2/source/controller/inc/res_LegendPosition.hxx       |    7 +
 chart2/uiconfig/ui/tp_LegendPosition.ui                   |   25 +----
 extras/source/glade/libreoffice-catalog.xml.in            |    3 
 solenv/sanitizers/ui/modules/schart.suppr                 |    3 
 9 files changed, 93 insertions(+), 64 deletions(-)

New commits:
commit c8ecf827f4ba8f2ff81a58c45bea773d52828723
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sat Oct 13 21:25:11 2018 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sun Oct 14 15:03:37 2018 +0200

    TextDirectionListBox is gone now
    
    Change-Id: If71c156164b51362754b6996f46917e30aee5b87
    Reviewed-on: https://gerrit.libreoffice.org/61753
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/chart2/source/controller/dialogs/TextDirectionListBox.cxx 
b/chart2/source/controller/dialogs/TextDirectionListBox.cxx
index a622e2b651d2..1114cd8b52f2 100644
--- a/chart2/source/controller/dialogs/TextDirectionListBox.cxx
+++ b/chart2/source/controller/dialogs/TextDirectionListBox.cxx
@@ -27,21 +27,6 @@
 namespace chart
 {
 
-TextDirectionListBox::TextDirectionListBox( vcl::Window* pParent ) :
-    svx::FrameDirectionListBox( pParent, WB_BORDER | WB_TABSTOP | WB_DROPDOWN)
-{
-    InsertEntryValue( SchResId( STR_TEXT_DIRECTION_LTR ), 
SvxFrameDirection::Horizontal_LR_TB );
-    InsertEntryValue( SchResId( STR_TEXT_DIRECTION_RTL ), 
SvxFrameDirection::Horizontal_RL_TB );
-    InsertEntryValue( SchResId( STR_TEXT_DIRECTION_SUPER ), 
SvxFrameDirection::Environment );
-
-    if( !SvtLanguageOptions().IsCTLFontEnabled() )
-    {
-        Hide();
-    }
-}
-
-VCL_BUILDER_FACTORY(TextDirectionListBox)
-
 
SchTextDirectionListBox::SchTextDirectionListBox(std::unique_ptr<weld::ComboBox>
 pControl)
     : svx::SvxFrameDirectionListBox(std::move(pControl))
 {
diff --git a/chart2/source/controller/inc/TextDirectionListBox.hxx 
b/chart2/source/controller/inc/TextDirectionListBox.hxx
index e04fcca15718..766c8a95c1fb 100644
--- a/chart2/source/controller/inc/TextDirectionListBox.hxx
+++ b/chart2/source/controller/inc/TextDirectionListBox.hxx
@@ -27,12 +27,6 @@ namespace vcl { class Window; }
 namespace chart
 {
 
-class TextDirectionListBox : public svx::FrameDirectionListBox
-{
-public:
-    explicit            TextDirectionListBox( vcl::Window* pParent );
-};
-
 class SchTextDirectionListBox : public svx::SvxFrameDirectionListBox
 {
 public:
diff --git a/extras/source/glade/libreoffice-catalog.xml.in 
b/extras/source/glade/libreoffice-catalog.xml.in
index 27a9e815670b..3b365dbff79c 100644
--- a/extras/source/glade/libreoffice-catalog.xml.in
+++ b/extras/source/glade/libreoffice-catalog.xml.in
@@ -274,9 +274,6 @@
     <glade-widget-class title="Frame Direction ListBox" 
name="svxlo-FrameDirectionListBox"
                         generic-name="FrameDirectionListBox" 
parent="GtkComboBox"
                         icon-name="widget-gtk-combobox"/>
-    <glade-widget-class title="Text Direction ListBox" 
name="chartcontrollerlo-TextDirectionListBox"
-                        generic-name="TextDirectionListBox" 
parent="svxlo-FrameDirectionListBox"
-                        icon-name="widget-gtk-combobox"/>
     <glade-widget-class title="Chart Light Button" 
name="chartcontrollerlo-LightButton"
                         generic-name="ChartLightButton" parent="GtkButton"
                         icon-name="widget-gtk-button"/>
diff --git a/solenv/sanitizers/ui/modules/schart.suppr 
b/solenv/sanitizers/ui/modules/schart.suppr
index 9d4d00d02d9a..cabe450598bb 100644
--- a/solenv/sanitizers/ui/modules/schart.suppr
+++ b/solenv/sanitizers/ui/modules/schart.suppr
@@ -25,12 +25,10 @@ 
chart2/uiconfig/ui/titlerotationtabpage.ui://GtkSpinButton[@id='OrientDegree'] n
 chart2/uiconfig/ui/titlerotationtabpage.ui://GtkLabel[@id='degreeL'] 
orphan-label
 chart2/uiconfig/ui/titlerotationtabpage.ui://GtkLabel[@id='labelABCD'] 
orphan-label
 chart2/uiconfig/ui/titlerotationtabpage.ui://GtkLabel[@id='textdirL'] 
orphan-label
-chart2/uiconfig/ui/titlerotationtabpage.ui://chartcontrollerlo-TextDirectionListBox[@id='textdirLB']
 no-labelled-by
 chart2/uiconfig/ui/tp_axisLabel.ui://GtkSpinButton[@id='OrientDegree'] 
no-labelled-by
 chart2/uiconfig/ui/tp_axisLabel.ui://GtkLabel[@id='degreeL'] orphan-label
 chart2/uiconfig/ui/tp_axisLabel.ui://GtkLabel[@id='labelABCD'] orphan-label
 chart2/uiconfig/ui/tp_axisLabel.ui://GtkLabel[@id='textdirL'] orphan-label
-chart2/uiconfig/ui/tp_axisLabel.ui://chartcontrollerlo-TextDirectionListBox[@id='textdirLB']
 no-labelled-by
 chart2/uiconfig/ui/tp_ChartType.ui://GtkLabel[@id='FT_CAPTION_FOR_WIZARD'] 
orphan-label
 chart2/uiconfig/ui/tp_ChartType.ui://GtkTreeView[@id='charttype:border'] 
no-labelled-by
 chart2/uiconfig/ui/tp_DataLabel.ui://GtkLabel[@id='CT_LABEL_DIAL'] orphan-label
@@ -48,7 +46,6 @@ 
chart2/uiconfig/ui/tp_ErrorBars.ui://GtkLabel[@id='STR_DATA_SELECT_RANGE_FOR_POS
 
chart2/uiconfig/ui/tp_ErrorBars.ui://GtkLabel[@id='STR_DATA_SELECT_RANGE_FOR_NEGATIVE_ERRORBARS']
 orphan-label
 
chart2/uiconfig/ui/tp_ErrorBars.ui://GtkLabel[@id='STR_CONTROLTEXT_ERROR_BARS_FROM_DATA']
 orphan-label
 chart2/uiconfig/ui/tp_LegendPosition.ui://GtkLabel[@id='FT_LEGEND_TEXTDIR'] 
orphan-label
-chart2/uiconfig/ui/tp_LegendPosition.ui://chartcontrollerlo-TextDirectionListBox[@id='LB_LEGEND_TEXTDIR']
 no-labelled-by
 chart2/uiconfig/ui/tp_RangeChooser.ui://GtkLabel[@id='FT_CAPTION_FOR_WIZARD'] 
orphan-label
 chart2/uiconfig/ui/tp_RangeChooser.ui://GtkLabel[@id='STR_PAGE_DATA_RANGE'] 
orphan-label
 chart2/uiconfig/ui/tp_SeriesToAxis.ui://GtkLabel[@id='FT_MISSING_VALUES'] 
orphan-label
commit 60c5c3576a3dc2907e308aa8272e90a6b2d2b38a
Author:     Caolán McNamara <caol...@redhat.com>
AuthorDate: Sat Oct 13 21:20:32 2018 +0100
Commit:     Caolán McNamara <caol...@redhat.com>
CommitDate: Sun Oct 14 15:03:25 2018 +0200

    weld SchLegendPosTabPage
    
    Change-Id: Iee0b2a028119d3d65eb613ce65f05c9ab3f778fc
    Reviewed-on: https://gerrit.libreoffice.org/61752
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caol...@redhat.com>
    Tested-by: Caolán McNamara <caol...@redhat.com>

diff --git a/chart2/source/controller/dialogs/res_LegendPosition.cxx 
b/chart2/source/controller/dialogs/res_LegendPosition.cxx
index 85750e4b6e71..0d6963266ec9 100644
--- a/chart2/source/controller/dialogs/res_LegendPosition.cxx
+++ b/chart2/source/controller/dialogs/res_LegendPosition.cxx
@@ -240,6 +240,17 @@ void LegendPositionResources::SetChangeHdl( const 
Link<LinkParamNone*,void>& rLi
     m_aChangeLink = rLink;
 }
 
+SchLegendPositionResources::SchLegendPositionResources(weld::Builder& rBuilder)
+    : m_xCC() // unused in this scenario
+    , m_xCbxShow() // unused in this scenario, assumed to be visible
+    , m_xRbtLeft(rBuilder.weld_radio_button("left"))
+    , m_xRbtRight(rBuilder.weld_radio_button("right"))
+    , m_xRbtTop(rBuilder.weld_radio_button("top"))
+    , m_xRbtBottom(rBuilder.weld_radio_button("bottom"))
+{
+    impl_setRadioButtonToggleHdl();
+}
+
 SchLegendPositionResources::SchLegendPositionResources(weld::Builder& rBuilder,
     const uno::Reference< uno::XComponentContext >& xCC)
     : m_xCC(xCC)
@@ -367,6 +378,54 @@ IMPL_LINK_NOARG(SchLegendPositionResources, 
PositionEnableHdl, weld::ToggleButto
     m_aChangeLink.Call(nullptr);
 }
 
+void SchLegendPositionResources::initFromItemSet( const SfxItemSet& rInAttrs )
+{
+    const SfxPoolItem* pPoolItem = nullptr;
+    if( rInAttrs.GetItemState( SCHATTR_LEGEND_POS, true, &pPoolItem ) == 
SfxItemState::SET )
+    {
+        chart2::LegendPosition nLegendPosition = 
static_cast<chart2::LegendPosition>(static_cast<const 
SfxInt32Item*>(pPoolItem)->GetValue());
+        switch( nLegendPosition )
+        {
+            case chart2::LegendPosition_LINE_START:
+                m_xRbtLeft->set_active(true);
+                break;
+            case chart2::LegendPosition_PAGE_START:
+                m_xRbtTop->set_active(true);
+                break;
+            case chart2::LegendPosition_LINE_END:
+                m_xRbtRight->set_active(true);
+                break;
+            case chart2::LegendPosition_PAGE_END:
+                m_xRbtBottom->set_active(true);
+                break;
+            default:
+                break;
+        }
+    }
+
+    if (m_xCbxShow && rInAttrs.GetItemState( SCHATTR_LEGEND_SHOW, true, 
&pPoolItem ) == SfxItemState::SET)
+    {
+        bool bShow = static_cast< const SfxBoolItem * >( pPoolItem 
)->GetValue();
+        m_xCbxShow->set_active(bShow);
+    }
+}
+
+void SchLegendPositionResources::writeToItemSet( SfxItemSet& rOutAttrs ) const
+{
+    chart2::LegendPosition nLegendPosition = chart2::LegendPosition_CUSTOM;
+    if( m_xRbtLeft->get_active() )
+        nLegendPosition = chart2::LegendPosition_LINE_START;
+    else if( m_xRbtTop->get_active() )
+        nLegendPosition = chart2::LegendPosition_PAGE_START;
+    else if( m_xRbtRight->get_active() )
+        nLegendPosition = chart2::LegendPosition_LINE_END;
+    else if( m_xRbtBottom->get_active() )
+        nLegendPosition = chart2::LegendPosition_PAGE_END;
+    rOutAttrs.Put( SfxInt32Item(SCHATTR_LEGEND_POS, 
static_cast<sal_Int32>(nLegendPosition) ) );
+
+    rOutAttrs.Put( SfxBoolItem(SCHATTR_LEGEND_SHOW, !m_xCbxShow || 
m_xCbxShow->get_active()) );
+}
+
 IMPL_LINK(SchLegendPositionResources, PositionChangeHdl, weld::ToggleButton&, 
rRadio, void )
 {
     //for each radio click there are coming two change events
@@ -376,6 +435,11 @@ IMPL_LINK(SchLegendPositionResources, PositionChangeHdl, 
weld::ToggleButton&, rR
         m_aChangeLink.Call(nullptr);
 }
 
+void SchLegendPositionResources::SetChangeHdl( const 
Link<LinkParamNone*,void>& rLink )
+{
+    m_aChangeLink = rLink;
+}
+
 } //namespace chart
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.cxx 
b/chart2/source/controller/dialogs/tp_LegendPosition.cxx
index e572d8076816..a16aec38a439 100644
--- a/chart2/source/controller/dialogs/tp_LegendPosition.cxx
+++ b/chart2/source/controller/dialogs/tp_LegendPosition.cxx
@@ -28,16 +28,11 @@
 namespace chart
 {
 
-SchLegendPosTabPage::SchLegendPosTabPage(vcl::Window* pWindow, const 
SfxItemSet& rInAttrs)
-    : SfxTabPage( pWindow
-                 ,"tp_LegendPosition"
-                 ,"modules/schart/ui/tp_LegendPosition.ui"
-                 , &rInAttrs )
-    , m_aLegendPositionResources(*this)
+SchLegendPosTabPage::SchLegendPosTabPage(TabPageParent pWindow, const 
SfxItemSet& rInAttrs)
+    : SfxTabPage(pWindow, "modules/schart/ui/tp_LegendPosition.ui", 
"tp_LegendPosition", &rInAttrs)
+    , m_aLegendPositionResources(*m_xBuilder)
+    , m_xLbTextDirection(new 
SchTextDirectionListBox(m_xBuilder->weld_combo_box("LB_LEGEND_TEXTDIR")))
 {
-    get(m_pLbTextDirection,"LB_LEGEND_TEXTDIR");
-
-    m_pLbTextDirection->SetDropDownLineCount(3);
 }
 
 SchLegendPosTabPage::~SchLegendPosTabPage()
@@ -47,22 +42,22 @@ SchLegendPosTabPage::~SchLegendPosTabPage()
 
 void SchLegendPosTabPage::dispose()
 {
-    m_pLbTextDirection.clear();
+    m_xLbTextDirection.reset();
     SfxTabPage::dispose();
 }
 
 
-VclPtr<SfxTabPage> SchLegendPosTabPage::Create(TabPageParent pWindow, const 
SfxItemSet* rOutAttrs)
+VclPtr<SfxTabPage> SchLegendPosTabPage::Create(TabPageParent pParent, const 
SfxItemSet* rOutAttrs)
 {
-    return VclPtr<SchLegendPosTabPage>::Create(pWindow.pParent, *rOutAttrs);
+    return VclPtr<SchLegendPosTabPage>::Create(pParent, *rOutAttrs);
 }
 
 bool SchLegendPosTabPage::FillItemSet(SfxItemSet* rOutAttrs)
 {
     m_aLegendPositionResources.writeToItemSet(*rOutAttrs);
 
-    if( m_pLbTextDirection->GetSelectedEntryCount() > 0 )
-        rOutAttrs->Put( SvxFrameDirectionItem( 
m_pLbTextDirection->GetSelectEntryValue(), EE_PARA_WRITINGDIR ) );
+    if (m_xLbTextDirection->get_active() != -1)
+        
rOutAttrs->Put(SvxFrameDirectionItem(m_xLbTextDirection->get_active_id(), 
EE_PARA_WRITINGDIR));
 
     return true;
 }
@@ -73,7 +68,7 @@ void SchLegendPosTabPage::Reset(const SfxItemSet* rInAttrs)
 
     const SfxPoolItem* pPoolItem = nullptr;
     if( rInAttrs->GetItemState( EE_PARA_WRITINGDIR, true, &pPoolItem ) == 
SfxItemState::SET )
-        m_pLbTextDirection->SelectEntryValue( static_cast<const 
SvxFrameDirectionItem*>(pPoolItem)->GetValue() );
+        m_xLbTextDirection->set_active_id( static_cast<const 
SvxFrameDirectionItem*>(pPoolItem)->GetValue() );
 }
 
 } //namespace chart
diff --git a/chart2/source/controller/dialogs/tp_LegendPosition.hxx 
b/chart2/source/controller/dialogs/tp_LegendPosition.hxx
index 7fd77f9c877c..77d1773cf598 100644
--- a/chart2/source/controller/dialogs/tp_LegendPosition.hxx
+++ b/chart2/source/controller/dialogs/tp_LegendPosition.hxx
@@ -20,8 +20,7 @@
 #define INCLUDED_CHART2_SOURCE_CONTROLLER_DIALOGS_TP_LEGENDPOSITION_HXX
 
 #include <sfx2/tabdlg.hxx>
-#include <vcl/fixed.hxx>
-
+#include <vcl/weld.hxx>
 #include <res_LegendPosition.hxx>
 #include <TextDirectionListBox.hxx>
 
@@ -32,11 +31,11 @@ class SchLegendPosTabPage : public SfxTabPage
 {
 private:
 
-    LegendPositionResources  m_aLegendPositionResources;
-    VclPtr<TextDirectionListBox>    m_pLbTextDirection;
+    SchLegendPositionResources  m_aLegendPositionResources;
+    std::unique_ptr<SchTextDirectionListBox> m_xLbTextDirection;
 
 public:
-    SchLegendPosTabPage(vcl::Window* pParent, const SfxItemSet& rInAttrs);
+    SchLegendPosTabPage(TabPageParent pParent, const SfxItemSet& rInAttrs);
     virtual ~SchLegendPosTabPage() override;
     virtual void dispose() override;
 
diff --git a/chart2/source/controller/inc/res_LegendPosition.hxx 
b/chart2/source/controller/inc/res_LegendPosition.hxx
index 9dc6f6fef230..1568781e4818 100644
--- a/chart2/source/controller/inc/res_LegendPosition.hxx
+++ b/chart2/source/controller/inc/res_LegendPosition.hxx
@@ -74,6 +74,8 @@ class SchLegendPositionResources final
 {
 
 public:
+    //constructor without Display checkbox
+    SchLegendPositionResources(weld::Builder& rBuilder);
     //constructor inclusive Display checkbox
     SchLegendPositionResources(weld::Builder& rBuilder, const 
css::uno::Reference<
                        css::uno::XComponentContext>& xCC );
@@ -82,6 +84,11 @@ public:
     void writeToResources( const css::uno::Reference< css::frame::XModel >& 
xChartModel );
     void writeToModel( const css::uno::Reference< css::frame::XModel >& 
xChartModel ) const;
 
+    void initFromItemSet( const SfxItemSet& rInAttrs );
+    void writeToItemSet( SfxItemSet& rOutAttrs ) const;
+
+    void SetChangeHdl( const Link<LinkParamNone*,void>& rLink );
+
     DECL_LINK(PositionEnableHdl, weld::ToggleButton&, void);
     DECL_LINK(PositionChangeHdl, weld::ToggleButton&, void);
 
diff --git a/chart2/uiconfig/ui/tp_LegendPosition.ui 
b/chart2/uiconfig/ui/tp_LegendPosition.ui
index 53302b506877..5ea8d662fbf6 100644
--- a/chart2/uiconfig/ui/tp_LegendPosition.ui
+++ b/chart2/uiconfig/ui/tp_LegendPosition.ui
@@ -1,7 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
 <interface domain="chart">
-  <!-- interface-requires gtk+ 3.0 -->
-  <!-- interface-requires LibreOffice 1.0 -->
+  <requires lib="gtk+" version="3.18"/>
   <object class="GtkBox" id="tp_LegendPosition">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -34,13 +34,10 @@
                     <property name="use_underline">True</property>
                     <property name="xalign">0</property>
                     <property name="draw_indicator">True</property>
-                    <property name="group">right</property>
                   </object>
                   <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>
@@ -52,13 +49,11 @@
                     <property name="use_underline">True</property>
                     <property name="xalign">0</property>
                     <property name="draw_indicator">True</property>
-                    <property name="group">top</property>
+                    <property name="group">left</property>
                   </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>
@@ -70,13 +65,11 @@
                     <property name="use_underline">True</property>
                     <property name="xalign">0</property>
                     <property name="draw_indicator">True</property>
-                    <property name="group">bottom</property>
+                    <property name="group">left</property>
                   </object>
                   <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>
@@ -93,8 +86,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>
               </object>
@@ -105,8 +96,8 @@
           <object class="GtkLabel" id="TXT_POSITION">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">0</property>
             <property name="label" translatable="yes" 
context="tp_LegendPosition|TXT_POSITION">Position</property>
+            <property name="xalign">0</property>
             <attributes>
               <attribute name="weight" value="bold"/>
             </attributes>
@@ -140,9 +131,9 @@
                   <object class="GtkLabel" id="FT_LEGEND_TEXTDIR">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
-                    <property name="xalign">0</property>
                     <property name="label" translatable="yes" 
context="tp_LegendPosition|FT_LEGEND_TEXTDIR">Te_xt direction</property>
                     <property name="use_underline">True</property>
+                    <property name="xalign">0</property>
                   </object>
                   <packing>
                     <property name="expand">False</property>
@@ -151,7 +142,7 @@
                   </packing>
                 </child>
                 <child>
-                  <object class="chartcontrollerlo-TextDirectionListBox" 
id="LB_LEGEND_TEXTDIR">
+                  <object class="GtkComboBoxText" id="LB_LEGEND_TEXTDIR">
                     <property name="visible">True</property>
                     <property name="can_focus">False</property>
                   </object>
@@ -169,8 +160,8 @@
           <object class="GtkLabel" id="TXT_ORIENTATION">
             <property name="visible">True</property>
             <property name="can_focus">False</property>
-            <property name="xalign">0</property>
             <property name="label" translatable="yes" 
context="tp_LegendPosition|TXT_ORIENTATION">Text Orientation</property>
+            <property name="xalign">0</property>
             <attributes>
               <attribute name="weight" value="bold"/>
             </attributes>
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to