[Libreoffice-commits] core.git: include/svx svx/inc svx/source svx/uiconfig svx/UIConfig_svx.mk

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Mon Jan 27 19:28:52 UTC 2020


 include/svx/strings.hrc                   |    4 -
 svx/UIConfig_svx.mk                       |    1 
 svx/inc/bitmaps.hlst                      |    4 -
 svx/source/tbxctrls/extrusioncontrols.cxx |   89 +++++++++++++----------
 svx/source/tbxctrls/extrusioncontrols.hxx |   14 ++-
 svx/uiconfig/ui/surfacewindow.ui          |  114 ++++++++++++++++++++++++++++++
 6 files changed, 177 insertions(+), 49 deletions(-)

New commits:
commit 28f660a61d82f518391ef2ad5f99129a2ea542ee
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Mon Jan 27 13:45:44 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Mon Jan 27 20:27:51 2020 +0100

    weld ExtrusionSurfaceWindow
    
    Change-Id: I13b61c8e4ef0a251472b02061fa150451a7b03a5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/87530
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/include/svx/strings.hrc b/include/svx/strings.hrc
index 171eb4053659..e9d79ff25f89 100644
--- a/include/svx/strings.hrc
+++ b/include/svx/strings.hrc
@@ -1032,10 +1032,6 @@
 #define RID_SVXSTR_DIRECTION_SW                             NC_("RID_SVXSTR_DIRECTION_SW", "Extrusion South-West")
 #define RID_SVXSTR_DIRECTION_S                              NC_("RID_SVXSTR_DIRECTION_S", "Extrusion South")
 #define RID_SVXSTR_DIRECTION_SE                             NC_("RID_SVXSTR_DIRECTION_SE", "Extrusion South-East")
-#define RID_SVXSTR_WIREFRAME                                NC_("RID_SVXSTR_WIREFRAME", "~Wire Frame")
-#define RID_SVXSTR_MATTE                                    NC_("RID_SVXSTR_MATTE", "~Matt")
-#define RID_SVXSTR_PLASTIC                                  NC_("RID_SVXSTR_PLASTIC", "~Plastic")
-#define RID_SVXSTR_METAL                                    NC_("RID_SVXSTR_METAL", "Me~tal")
 #define RID_SVXSTR_DEPTH_0                                  NC_("RID_SVXSTR_DEPTH_0", "~0 cm")
 #define RID_SVXSTR_DEPTH_1                                  NC_("RID_SVXSTR_DEPTH_1", "~1 cm")
 #define RID_SVXSTR_DEPTH_2                                  NC_("RID_SVXSTR_DEPTH_2", "~2.5 cm")
diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk
index a7f943c2548c..e1f1783607c5 100644
--- a/svx/UIConfig_svx.mk
+++ b/svx/UIConfig_svx.mk
@@ -111,6 +111,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\
 	svx/uiconfig/ui/sidebarstylespanel \
 	svx/uiconfig/ui/sidebartextpanel \
 	svx/uiconfig/ui/stylemenu \
+	svx/uiconfig/ui/surfacewindow \
 	svx/uiconfig/ui/tablewindow \
 	svx/uiconfig/ui/textcharacterspacingcontrol \
 	svx/uiconfig/ui/textcontrolchardialog \
diff --git a/svx/inc/bitmaps.hlst b/svx/inc/bitmaps.hlst
index 648d86d356ff..9cbe6e66405e 100644
--- a/svx/inc/bitmaps.hlst
+++ b/svx/inc/bitmaps.hlst
@@ -74,10 +74,6 @@
 #define RID_SVXBMP_LIGHT_PREVIEW_FROM_BOTTOM_LEFT   "svx/res/lightfrombottomleft_22.png"
 #define RID_SVXBMP_LIGHT_PREVIEW_FROM_BOTTOM        "svx/res/lightfrombottom_22.png"
 #define RID_SVXBMP_LIGHT_PREVIEW_FROM_BOTTOM_RIGHT  "svx/res/lightfrombottomright_22.png"
-#define RID_SVXBMP_WIRE_FRAME                       "svx/res/wireframe_16.png"
-#define RID_SVXBMP_MATTE                            "svx/res/matte_16.png"
-#define RID_SVXBMP_PLASTIC                          "svx/res/plastic_16.png"
-#define RID_SVXBMP_METAL                            "svx/res/metal_16.png"
 #define RID_SVXBMP_DEPTH_0                          "svx/res/extrusion0inch_16.png"
 #define RID_SVXBMP_DEPTH_1                          "svx/res/extrusion05inch_16.png"
 #define RID_SVXBMP_DEPTH_2                          "svx/res/extrusion1inch_16.png"
diff --git a/svx/source/tbxctrls/extrusioncontrols.cxx b/svx/source/tbxctrls/extrusioncontrols.cxx
index 76fcb3a5e048..18201c948d58 100644
--- a/svx/source/tbxctrls/extrusioncontrols.cxx
+++ b/svx/source/tbxctrls/extrusioncontrols.cxx
@@ -794,36 +794,37 @@ com_sun_star_comp_svx_ExtrusionLightingControl_get_implementation(
 
 static const char g_sExtrusionSurface[] = ".uno:ExtrusionSurface";
 
-ExtrusionSurfaceWindow::ExtrusionSurfaceWindow(
-    svt::ToolboxController& rController,
-    vcl::Window* pParentWindow)
-    : ToolbarMenu(rController.getFrameInterface(), pParentWindow, WB_STDPOPUP)
-    , mrController(rController)
+ExtrusionSurfaceWindow::ExtrusionSurfaceWindow(svt::PopupWindowController* pControl, weld::Widget* pParent)
+    : WeldToolbarPopup(pControl->getFrameInterface(), pParent, "svx/ui/surfacewindow.ui", "SurfaceWindow")
+    , mxControl(pControl)
+    , mxWireFrame(m_xBuilder->weld_radio_button("wireframe"))
+    , mxMatt(m_xBuilder->weld_radio_button("matt"))
+    , mxPlastic(m_xBuilder->weld_radio_button("plastic"))
+    , mxMetal(m_xBuilder->weld_radio_button("metal"))
 {
-    SetSelectHdl( LINK( this, ExtrusionSurfaceWindow, SelectHdl ) );
-
-    Image aImgSurface1(StockImage::Yes, RID_SVXBMP_WIRE_FRAME);
-    Image aImgSurface2(StockImage::Yes, RID_SVXBMP_MATTE);
-    Image aImgSurface3(StockImage::Yes, RID_SVXBMP_PLASTIC);
-    Image aImgSurface4(StockImage::Yes, RID_SVXBMP_METAL);
-
-    appendEntry(0, SvxResId(RID_SVXSTR_WIREFRAME), aImgSurface1);
-    appendEntry(1, SvxResId(RID_SVXSTR_MATTE), aImgSurface2);
-    appendEntry(2, SvxResId(RID_SVXSTR_PLASTIC), aImgSurface3);
-    appendEntry(3, SvxResId(RID_SVXSTR_METAL), aImgSurface4);
-
-    SetOutputSizePixel( getMenuSize() );
+    mxWireFrame->connect_clicked(LINK(this, ExtrusionSurfaceWindow, SelectHdl));
+    mxMatt->connect_clicked(LINK(this, ExtrusionSurfaceWindow, SelectHdl));
+    mxPlastic->connect_clicked(LINK(this, ExtrusionSurfaceWindow, SelectHdl));
+    mxMetal->connect_clicked(LINK(this, ExtrusionSurfaceWindow, SelectHdl));
 
     AddStatusListener( g_sExtrusionSurface );
 }
 
+void ExtrusionSurfaceWindow::GrabFocus()
+{
+    mxWireFrame->grab_focus();
+}
+
 void ExtrusionSurfaceWindow::implSetSurface( int nSurface, bool bEnabled )
 {
-    for(int i = 0; i < 4; ++i)
-    {
-        checkEntry( i, (i == nSurface) && bEnabled );
-        enableEntry( i, bEnabled );
-    }
+    mxWireFrame->set_active(nSurface == 0 && bEnabled);
+    mxWireFrame->set_sensitive(bEnabled);
+    mxMatt->set_active(nSurface == 1 && bEnabled);
+    mxMatt->set_sensitive(bEnabled);
+    mxPlastic->set_active(nSurface == 2 && bEnabled);
+    mxPlastic->set_sensitive(bEnabled);
+    mxMetal->set_active(nSurface == 3 && bEnabled);
+    mxMetal->set_sensitive(bEnabled);
 }
 
 void ExtrusionSurfaceWindow::statusChanged(
@@ -845,23 +846,27 @@ void ExtrusionSurfaceWindow::statusChanged(
     }
 }
 
-
-IMPL_LINK_NOARG(ExtrusionSurfaceWindow, SelectHdl, ToolbarMenu*, void)
+IMPL_LINK_NOARG(ExtrusionSurfaceWindow, SelectHdl, weld::Button&, void)
 {
-    if ( IsInPopupMode() )
-        EndPopupMode();
+    sal_Int32 nSurface;
+    if (mxWireFrame->get_active())
+        nSurface = 0;
+    else if (mxMatt->get_active())
+        nSurface = 1;
+    else if (mxPlastic->get_active())
+        nSurface = 2;
+    else
+        nSurface = 3;
 
-    sal_Int32 nSurface = getSelectedEntryId();
-    if( nSurface >= 0 )
-    {
-        Sequence< PropertyValue > aArgs( 1 );
-        aArgs[0].Name = OUString(g_sExtrusionSurface).copy(5);
-        aArgs[0].Value <<= nSurface;
+    Sequence< PropertyValue > aArgs( 1 );
+    aArgs[0].Name = OUString(g_sExtrusionSurface).copy(5);
+    aArgs[0].Value <<= nSurface;
 
-        mrController.dispatchCommand( g_sExtrusionSurface, aArgs );
+    mxControl->dispatchCommand( g_sExtrusionSurface, aArgs );
 
-        implSetSurface( nSurface, true );
-    }
+    implSetSurface( nSurface, true );
+
+    mxControl->EndPopupMode();
 }
 
 ExtrusionSurfaceControl::ExtrusionSurfaceControl(
@@ -875,9 +880,19 @@ ExtrusionSurfaceControl::ExtrusionSurfaceControl(
 {
 }
 
+std::unique_ptr<WeldToolbarPopup> ExtrusionSurfaceControl::weldPopupWindow()
+{
+    return std::make_unique<ExtrusionSurfaceWindow>(this, m_pToolbar);
+}
+
 VclPtr<vcl::Window> ExtrusionSurfaceControl::createVclPopupWindow( vcl::Window* pParent )
 {
-    return VclPtr<ExtrusionSurfaceWindow>::Create( *this, pParent );
+    mxInterimPopover = VclPtr<InterimToolbarPopup>::Create(getFrameInterface(), pParent,
+        std::make_unique<ExtrusionSurfaceWindow>(this, pParent->GetFrameWeld()));
+
+    mxInterimPopover->Show();
+
+    return mxInterimPopover;
 }
 
 // XInitialization
diff --git a/svx/source/tbxctrls/extrusioncontrols.hxx b/svx/source/tbxctrls/extrusioncontrols.hxx
index af46a1ee395e..67d99359b5b8 100644
--- a/svx/source/tbxctrls/extrusioncontrols.hxx
+++ b/svx/source/tbxctrls/extrusioncontrols.hxx
@@ -170,17 +170,22 @@ public:
     virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override;
 };
 
-class ExtrusionSurfaceWindow : public svtools::ToolbarMenu
+class ExtrusionSurfaceWindow final : public WeldToolbarPopup
 {
 private:
-    svt::ToolboxController& mrController;
+    rtl::Reference<svt::PopupWindowController> mxControl;
+    std::unique_ptr<weld::RadioButton> mxWireFrame;
+    std::unique_ptr<weld::RadioButton> mxMatt;
+    std::unique_ptr<weld::RadioButton> mxPlastic;
+    std::unique_ptr<weld::RadioButton> mxMetal;
 
-    DECL_LINK( SelectHdl, ToolbarMenu*, void );
+    DECL_LINK( SelectHdl, weld::Button&, void );
 
     void    implSetSurface( int nSurface, bool bEnabled );
 
 public:
-    ExtrusionSurfaceWindow( svt::ToolboxController& rController, vcl::Window* pParentWindow );
+    ExtrusionSurfaceWindow(svt::PopupWindowController* pControl, weld::Widget* pParentWindow);
+    virtual void GrabFocus() override;
 
     virtual void statusChanged( const css::frame::FeatureStateEvent& Event ) override;
 };
@@ -191,6 +196,7 @@ class ExtrusionSurfaceControl : public svt::PopupWindowController
 public:
     explicit ExtrusionSurfaceControl( const css::uno::Reference< css::uno::XComponentContext >& rxContext );
 
+    virtual std::unique_ptr<WeldToolbarPopup> weldPopupWindow() override;
     virtual VclPtr<vcl::Window> createVclPopupWindow( vcl::Window* pParent ) override;
 
     // XInitialization
diff --git a/svx/uiconfig/ui/surfacewindow.ui b/svx/uiconfig/ui/surfacewindow.ui
new file mode 100644
index 000000000000..d8ee6219e773
--- /dev/null
+++ b/svx/uiconfig/ui/surfacewindow.ui
@@ -0,0 +1,114 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="svx">
+  <requires lib="gtk+" version="3.18"/>
+  <object class="GtkImage" id="image1">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">svx/res/plastic_16.png</property>
+  </object>
+  <object class="GtkImage" id="image2">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">svx/res/matte_16.png</property>
+  </object>
+  <object class="GtkImage" id="image3">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">svx/res/metal_16.png</property>
+  </object>
+  <object class="GtkImage" id="image4">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="icon_name">svx/res/wireframe_16.png</property>
+  </object>
+  <object class="GtkPopover" id="SurfaceWindow">
+    <property name="can_focus">False</property>
+    <property name="no_show_all">True</property>
+    <property name="border_width">4</property>
+    <child>
+      <object class="GtkBox" id="container">
+        <property name="visible">True</property>
+        <property name="can_focus">False</property>
+        <property name="orientation">vertical</property>
+        <property name="spacing">6</property>
+        <child>
+          <object class="GtkRadioButton" id="wireframe">
+            <property name="label" translatable="yes" context="surfacewindow|RID_SVXSTR_WIREFRAME">_Wire Frame</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="image">image4</property>
+            <property name="use_underline">True</property>
+            <property name="xalign">0</property>
+            <property name="always_show_image">True</property>
+            <property name="active">True</property>
+            <property name="draw_indicator">True</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">0</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkRadioButton" id="matt">
+            <property name="label" translatable="yes" context="surfacewindow|RID_SVXSTR_MATTE">_Matt</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="image">image2</property>
+            <property name="use_underline">True</property>
+            <property name="xalign">0</property>
+            <property name="always_show_image">True</property>
+            <property name="draw_indicator">True</property>
+            <property name="group">wireframe</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">1</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkRadioButton" id="plastic">
+            <property name="label" translatable="yes" context="surfacewindow|RID_SVXSTR_PLASTIC">_Plastic</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="image">image1</property>
+            <property name="use_underline">True</property>
+            <property name="xalign">0</property>
+            <property name="always_show_image">True</property>
+            <property name="draw_indicator">True</property>
+            <property name="group">wireframe</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">2</property>
+          </packing>
+        </child>
+        <child>
+          <object class="GtkRadioButton" id="metal">
+            <property name="label" translatable="yes" context="surfacewindow|RID_SVXSTR_METAL">Me_tal</property>
+            <property name="visible">True</property>
+            <property name="can_focus">True</property>
+            <property name="receives_default">False</property>
+            <property name="image">image3</property>
+            <property name="use_underline">True</property>
+            <property name="xalign">0</property>
+            <property name="always_show_image">True</property>
+            <property name="draw_indicator">True</property>
+            <property name="group">wireframe</property>
+          </object>
+          <packing>
+            <property name="expand">False</property>
+            <property name="fill">True</property>
+            <property name="position">3</property>
+          </packing>
+        </child>
+      </object>
+    </child>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list