[Libreoffice-commits] core.git: sw/source sw/uiconfig

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Dec 20 14:51:53 UTC 2019


 sw/source/uibase/sidebar/StylePresetsPanel.cxx |   25 +++++++++--------
 sw/source/uibase/sidebar/StylePresetsPanel.hxx |    5 ++-
 sw/uiconfig/swriter/ui/sidebarstylepresets.ui  |   36 +++++++++++++------------
 3 files changed, 37 insertions(+), 29 deletions(-)

New commits:
commit 1bae6297723af8e5a601a6ddf6134ca5b62a558e
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Fri Dec 20 09:18:17 2019 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Dec 20 15:50:42 2019 +0100

    weld StylePresetsPanel
    
    Change-Id: I827819c8891de828013ce8a38d5acf9e7fec3985
    Reviewed-on: https://gerrit.libreoffice.org/85584
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>
    Tested-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/sw/source/uibase/sidebar/StylePresetsPanel.cxx b/sw/source/uibase/sidebar/StylePresetsPanel.cxx
index 0ab90e10d08b..2e83338d6f1a 100644
--- a/sw/source/uibase/sidebar/StylePresetsPanel.cxx
+++ b/sw/source/uibase/sidebar/StylePresetsPanel.cxx
@@ -156,13 +156,13 @@ VclPtr<vcl::Window> StylePresetsPanel::Create (vcl::Window* pParent,
 
 StylePresetsPanel::StylePresetsPanel(vcl::Window* pParent,
                                const css::uno::Reference<css::frame::XFrame>& rxFrame)
-    : PanelLayout(pParent, "StylePresetsPanel", "modules/swriter/ui/sidebarstylepresets.ui", rxFrame)
+    : PanelLayout(pParent, "StylePresetsPanel", "modules/swriter/ui/sidebarstylepresets.ui", rxFrame, true)
+    , mxValueSet(new SvtValueSet(nullptr))
+    , mxValueSetWin(new weld::CustomWeld(*m_xBuilder, "valueset", *mxValueSet))
 {
-    get(mpValueSet, "valueset");
+    mxValueSet->SetColCount(2);
 
-    mpValueSet->SetColCount(2);
-
-    mpValueSet->SetDoubleClickHdl(LINK(this, StylePresetsPanel, DoubleClickHdl));
+    mxValueSet->SetDoubleClickHdl(LINK(this, StylePresetsPanel, DoubleClickHdl));
 
     RefreshList();
 }
@@ -181,10 +181,12 @@ void StylePresetsPanel::RefreshList()
                 OUString aName = aTemplates.GetName(i,j);
                 OUString aURL = aTemplates.GetPath(i,j);
                 BitmapEx aPreview = CreatePreview(aURL, aName);
-                mpValueSet->InsertItem(j, Image(aPreview), aName);
+                sal_uInt16 nId = j + 1;
+                mxValueSet->InsertItem(nId, Image(aPreview), aName);
                 maTemplateEntries.push_back(std::make_unique<TemplateEntry>(aURL));
-                mpValueSet->SetItemData(j, maTemplateEntries.back().get());
+                mxValueSet->SetItemData(nId, maTemplateEntries.back().get());
             }
+            mxValueSet->SetOptimalSize();
         }
     }
 }
@@ -196,15 +198,16 @@ StylePresetsPanel::~StylePresetsPanel()
 
 void StylePresetsPanel::dispose()
 {
-    mpValueSet.disposeAndClear();
+    mxValueSetWin.reset();
+    mxValueSet.reset();
 
     PanelLayout::dispose();
 }
 
-IMPL_LINK_NOARG(StylePresetsPanel, DoubleClickHdl, ValueSet*, void)
+IMPL_LINK_NOARG(StylePresetsPanel, DoubleClickHdl, SvtValueSet*, void)
 {
-    sal_Int32 nItemId = mpValueSet->GetSelectedItemId();
-    TemplateEntry* pEntry = static_cast<TemplateEntry*>(mpValueSet->GetItemData(nItemId));
+    sal_Int32 nItemId = mxValueSet->GetSelectedItemId();
+    TemplateEntry* pEntry = static_cast<TemplateEntry*>(mxValueSet->GetItemData(nItemId));
 
     SwDocShell* pDocSh = static_cast<SwDocShell*>(SfxObjectShell::Current());
     if (pDocSh)
diff --git a/sw/source/uibase/sidebar/StylePresetsPanel.hxx b/sw/source/uibase/sidebar/StylePresetsPanel.hxx
index b392f9cb077e..abb3fae568e5 100644
--- a/sw/source/uibase/sidebar/StylePresetsPanel.hxx
+++ b/sw/source/uibase/sidebar/StylePresetsPanel.hxx
@@ -52,11 +52,12 @@ private:
     virtual ~StylePresetsPanel() override;
     virtual void dispose() override;
 
-    VclPtr<ValueSet> mpValueSet;
+    std::unique_ptr<SvtValueSet> mxValueSet;
+    std::unique_ptr<weld::CustomWeld> mxValueSetWin;
 
     std::vector<std::unique_ptr<TemplateEntry>> maTemplateEntries;
 
-    DECL_LINK(DoubleClickHdl, ValueSet*, void);
+    DECL_LINK(DoubleClickHdl, SvtValueSet*, void);
 };
 
 }} // end of namespace sw::sidebar
diff --git a/sw/uiconfig/swriter/ui/sidebarstylepresets.ui b/sw/uiconfig/swriter/ui/sidebarstylepresets.ui
index 170df5515cea..3258fe2ba7f5 100644
--- a/sw/uiconfig/swriter/ui/sidebarstylepresets.ui
+++ b/sw/uiconfig/swriter/ui/sidebarstylepresets.ui
@@ -1,8 +1,7 @@
 <?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.22.1 -->
 <interface domain="sw">
   <requires lib="gtk+" version="3.18"/>
-  <requires lib="LibreOffice" version="1.0"/>
   <object class="GtkGrid" id="StylePresetsPanel">
     <property name="visible">True</property>
     <property name="can_focus">False</property>
@@ -19,13 +18,28 @@
             <property name="row_spacing">6</property>
             <property name="column_spacing">6</property>
             <child>
-              <object class="GtkTreeView" id="listbox">
+              <object class="GtkScrolledWindow" id="valuesetwin">
                 <property name="visible">True</property>
                 <property name="can_focus">True</property>
                 <property name="hexpand">True</property>
-                <property name="show_expanders">False</property>
-                <child internal-child="selection">
-                  <object class="GtkTreeSelection" id="treeview-selection1"/>
+                <property name="vexpand">True</property>
+                <property name="hscrollbar_policy">never</property>
+                <property name="vscrollbar_policy">never</property>
+                <property name="shadow_type">in</property>
+                <child>
+                  <object class="GtkViewport">
+                    <property name="visible">True</property>
+                    <property name="can_focus">False</property>
+                    <child>
+                      <object class="GtkDrawingArea" id="valueset">
+                        <property name="visible">True</property>
+                        <property name="can_focus">True</property>
+                        <property name="events">GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_KEY_PRESS_MASK | GDK_KEY_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
+                        <property name="hexpand">True</property>
+                        <property name="vexpand">True</property>
+                      </object>
+                    </child>
+                  </object>
                 </child>
               </object>
               <packing>
@@ -33,16 +47,6 @@
                 <property name="top_attach">0</property>
               </packing>
             </child>
-            <child>
-              <object class="svtlo-ValueSet" id="valueset">
-                <property name="visible">True</property>
-                <property name="can_focus">False</property>
-              </object>
-              <packing>
-                <property name="left_attach">0</property>
-                <property name="top_attach">1</property>
-              </packing>
-            </child>
           </object>
         </child>
       </object>


More information about the Libreoffice-commits mailing list