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

Caolán McNamara (via logerrit) logerrit at kemper.freedesktop.org
Fri Feb 14 08:58:53 UTC 2020


 solenv/sanitizers/ui/svx.suppr                 |    1 
 svx/UIConfig_svx.mk                            |    1 
 svx/inc/pch/precompiled_svxcore.hxx            |    3 
 svx/source/tbxctrls/tbunosearchcontrollers.cxx |   91 +++++++++++++++++++------
 svx/uiconfig/ui/checkbuttonbox.ui              |   27 +++++++
 5 files changed, 101 insertions(+), 22 deletions(-)

New commits:
commit 3688235a8d059285ce8dcf6d2fb6c522b0b6501a
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Feb 13 17:02:19 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Feb 14 09:58:34 2020 +0100

    weld SearchFormattedControl Item Window
    
    Change-Id: Ifda9e514ae0329a756ec365a40ec1ccfcfea14ba
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88621
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/svx/inc/pch/precompiled_svxcore.hxx b/svx/inc/pch/precompiled_svxcore.hxx
index 78a9fee9c8c6..8efd27097cac 100644
--- a/svx/inc/pch/precompiled_svxcore.hxx
+++ b/svx/inc/pch/precompiled_svxcore.hxx
@@ -13,7 +13,7 @@
  manual changes will be rewritten by the next run of update_pch.sh (which presumably
  also fixes all possible problems, so it's usually better to use it).
 
- Generated on 2020-02-13 15:10:47 using:
+ Generated on 2020-02-13 17:01:33 using:
  ./bin/update_pch svx svxcore --cutoff=7 --exclude:system --include:module --exclude:local
 
  If after updating build fails, use the following command to locate conflicting headers:
@@ -62,6 +62,7 @@
 #include <osl/getglobalmutex.hxx>
 #include <osl/interlck.h>
 #include <osl/mutex.hxx>
+#include <osl/thread.h>
 #include <osl/time.h>
 #include <rtl/alloc.h>
 #include <rtl/character.hxx>
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index 8d753e347f29..b786b03fc2da 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -58,7 +58,6 @@
 #include <rtl/ref.hxx>
 #include <rtl/instance.hxx>
 #include <svx/srchdlg.hxx>
-#include <vcl/button.hxx>
 #include <vcl/event.hxx>
 #include <vcl/fixed.hxx>
 #include <vcl/window.hxx>
@@ -158,14 +157,14 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext
                     sFindText = pItemWin->get_active_text();
             } else if ( sItemCommand == COMMAND_MATCHCASE )
             {
-                CheckButtonItemWindow* pItemWin = static_cast<CheckButtonItemWindow*>( pToolBox->GetItemWindow(id) );
+                CheckButtonItemWindow* pItemWin = static_cast<CheckButtonItemWindow*>(pToolBox->GetItemWindow(id));
                 if (pItemWin)
                     aMatchCase = pItemWin->get_active();
             } else if ( sItemCommand == COMMAND_SEARCHFORMATTED )
             {
-                CheckBox* pItemWin = static_cast<CheckBox*>( pToolBox->GetItemWindow(id) );
+                CheckButtonItemWindow* pItemWin = static_cast<CheckButtonItemWindow*>(pToolBox->GetItemWindow(id));
                 if (pItemWin)
-                    bSearchFormatted = pItemWin->IsChecked();
+                    bSearchFormatted = pItemWin->get_active();
             }
         }
     }
@@ -970,14 +969,14 @@ public:
     virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
 
 private:
-    VclPtr<CheckBox> m_pSearchFormattedControl;
+    VclPtr<CheckButtonItemWindow> m_xSearchFormattedControl;
 };
 
 SearchFormattedToolboxController::SearchFormattedToolboxController( const css::uno::Reference< css::uno::XComponentContext >& rxContext )
     : svt::ToolboxController( rxContext,
         css::uno::Reference< css::frame::XFrame >(),
         COMMAND_SEARCHFORMATTED )
-    , m_pSearchFormattedControl(nullptr)
+    , m_xSearchFormattedControl(nullptr)
 {
 }
 
@@ -1026,7 +1025,7 @@ void SAL_CALL SearchFormattedToolboxController::dispose()
 
     svt::ToolboxController::dispose();
 
-    m_pSearchFormattedControl.disposeAndClear();
+    m_xSearchFormattedControl.disposeAndClear();
 }
 
 // XInitialization
@@ -1045,12 +1044,11 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL SearchFormattedToolboxControll
     if ( pParent )
     {
         ToolBox* pToolbar = static_cast<ToolBox*>(pParent.get());
-        m_pSearchFormattedControl = VclPtr<CheckBox>::Create( pToolbar, 0 );
-        m_pSearchFormattedControl->SetText( SvxResId( RID_SVXSTR_FINDBAR_SEARCHFORMATTED ) );
-        Size aSize( m_pSearchFormattedControl->GetOptimalSize() );
-        m_pSearchFormattedControl->SetSizePixel( aSize );
+        m_xSearchFormattedControl = VclPtr<CheckButtonItemWindow>::Create(pToolbar);
+        m_xSearchFormattedControl->set_label(SvxResId(RID_SVXSTR_FINDBAR_SEARCHFORMATTED));
+        m_xSearchFormattedControl->SetOptimalSize();
     }
-    xItemWindow = VCLUnoHelper::GetInterface( m_pSearchFormattedControl );
+    xItemWindow = VCLUnoHelper::GetInterface(m_xSearchFormattedControl);
 
     return xItemWindow;
 }
commit 13b15ca63a476ff8c8da0761395d49d6c8127371
Author:     Caolán McNamara <caolanm at redhat.com>
AuthorDate: Thu Feb 13 16:48:02 2020 +0000
Commit:     Caolán McNamara <caolanm at redhat.com>
CommitDate: Fri Feb 14 09:58:21 2020 +0100

    weld MatchCaseControl Item Window
    
    Change-Id: I33a8d96c449e653284d570ef534dcc453f27ad5e
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/88619
    Tested-by: Caolán McNamara <caolanm at redhat.com>
    Reviewed-by: Caolán McNamara <caolanm at redhat.com>

diff --git a/solenv/sanitizers/ui/svx.suppr b/solenv/sanitizers/ui/svx.suppr
index 29229ee2d030..b79bd11a0dab 100644
--- a/solenv/sanitizers/ui/svx.suppr
+++ b/solenv/sanitizers/ui/svx.suppr
@@ -6,6 +6,7 @@ svx/uiconfig/ui/asianphoneticguidedialog.ui://GtkLabel[@id='basetextft'] orphan-
 svx/uiconfig/ui/asianphoneticguidedialog.ui://GtkLabel[@id='rubytextft'] orphan-label
 svx/uiconfig/ui/asianphoneticguidedialog.ui://GtkEntry[@id='Left1ED'] no-labelled-by
 svx/uiconfig/ui/asianphoneticguidedialog.ui://GtkEntry[@id='Right1ED'] no-labelled-by
+svx/uiconfig/ui/checkbuttonbox.ui://GtkCheckButton[@id='checkbutton'] button-no-label
 svx/uiconfig/ui/colorwindow.ui://GtkButton[@id='auto_color_button'] button-no-label
 svx/uiconfig/ui/columnswindow.ui://GtkSpinButton[@id='spinbutton'] no-labelled-by
 svx/uiconfig/ui/compressgraphicdialog.ui://GtkLabel[@id='label13'] orphan-label
diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk
index 561bdac0482a..542c42ad8b7b 100644
--- a/svx/UIConfig_svx.mk
+++ b/svx/UIConfig_svx.mk
@@ -23,6 +23,7 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\
 	svx/uiconfig/ui/asianphoneticguidedialog \
 	svx/uiconfig/ui/cellmenu \
 	svx/uiconfig/ui/charsetmenu \
+	svx/uiconfig/ui/checkbuttonbox \
 	svx/uiconfig/ui/chineseconversiondialog \
 	svx/uiconfig/ui/chinesedictionary \
 	svx/uiconfig/ui/classificationdialog \
diff --git a/svx/source/tbxctrls/tbunosearchcontrollers.cxx b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
index 3769273ac3df..8d753e347f29 100644
--- a/svx/source/tbxctrls/tbunosearchcontrollers.cxx
+++ b/svx/source/tbxctrls/tbunosearchcontrollers.cxx
@@ -78,6 +78,58 @@ static const char COMMAND_SEARCHFORMATTED[] = ".uno:SearchFormattedDisplayString
 
 static const sal_Int32       REMEMBER_SIZE = 10;
 
+class CheckButtonItemWindow final : public InterimItemWindow
+{
+public:
+    CheckButtonItemWindow(vcl::Window* pParent)
+        : InterimItemWindow(pParent, "svx/ui/checkbuttonbox.ui", "CheckButtonBox")
+        , m_xWidget(m_xBuilder->weld_check_button("checkbutton"))
+    {
+        m_xWidget->connect_key_press(LINK(this, CheckButtonItemWindow, KeyInputHdl));
+    }
+
+    void SetOptimalSize()
+    {
+        SetSizePixel(m_xWidget->get_preferred_size());
+    }
+
+    void set_label(const OUString& rText)
+    {
+        m_xWidget->set_label(rText);
+    }
+
+    bool get_active() const
+    {
+        return m_xWidget->get_active();
+    }
+
+    virtual void dispose() override
+    {
+        m_xWidget.reset();
+        InterimItemWindow::dispose();
+    }
+
+    virtual ~CheckButtonItemWindow() override
+    {
+        disposeOnce();
+    }
+
+    virtual void GetFocus() override
+    {
+        m_xWidget->grab_focus();
+    }
+
+private:
+    std::unique_ptr<weld::CheckButton> m_xWidget;
+
+    DECL_LINK(KeyInputHdl, const KeyEvent&, bool);
+};
+
+IMPL_LINK(CheckButtonItemWindow, KeyInputHdl, const KeyEvent&, rKeyEvent, bool)
+{
+    return ChildKeyInput(rKeyEvent);
+}
+
 void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
                          const css::uno::Reference< css::frame::XFrame >& xFrame,
                          const ToolBox* pToolBox,
@@ -106,9 +158,9 @@ void impl_executeSearch( const css::uno::Reference< css::uno::XComponentContext
                     sFindText = pItemWin->get_active_text();
             } else if ( sItemCommand == COMMAND_MATCHCASE )
             {
-                CheckBox* pItemWin = static_cast<CheckBox*>( pToolBox->GetItemWindow(id) );
+                CheckButtonItemWindow* pItemWin = static_cast<CheckButtonItemWindow*>( pToolBox->GetItemWindow(id) );
                 if (pItemWin)
-                    aMatchCase = pItemWin->IsChecked();
+                    aMatchCase = pItemWin->get_active();
             } else if ( sItemCommand == COMMAND_SEARCHFORMATTED )
             {
                 CheckBox* pItemWin = static_cast<CheckBox*>( pToolBox->GetItemWindow(id) );
@@ -800,14 +852,14 @@ public:
     virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) override;
 
 private:
-    VclPtr<CheckBox> m_pMatchCaseControl;
+    VclPtr<CheckButtonItemWindow> m_xMatchCaseControl;
 };
 
 MatchCaseToolboxController::MatchCaseToolboxController( const css::uno::Reference< css::uno::XComponentContext >& rxContext )
     : svt::ToolboxController( rxContext,
         css::uno::Reference< css::frame::XFrame >(),
         COMMAND_MATCHCASE )
-    , m_pMatchCaseControl(nullptr)
+    , m_xMatchCaseControl(nullptr)
 {
 }
 
@@ -856,7 +908,7 @@ void SAL_CALL MatchCaseToolboxController::dispose()
 
     svt::ToolboxController::dispose();
 
-    m_pMatchCaseControl.disposeAndClear();
+    m_xMatchCaseControl.disposeAndClear();
 }
 
 // XInitialization
@@ -875,12 +927,11 @@ css::uno::Reference< css::awt::XWindow > SAL_CALL MatchCaseToolboxController::cr
     if ( pParent )
     {
         ToolBox* pToolbar = static_cast<ToolBox*>(pParent.get());
-        m_pMatchCaseControl = VclPtr<CheckBox>::Create( pToolbar, 0 );
-        m_pMatchCaseControl->SetText( SvxResId( RID_SVXSTR_FINDBAR_MATCHCASE ) );
-        Size aSize( m_pMatchCaseControl->GetOptimalSize() );
-        m_pMatchCaseControl->SetSizePixel( aSize );
+        m_xMatchCaseControl = VclPtr<CheckButtonItemWindow>::Create(pToolbar);
+        m_xMatchCaseControl->set_label(SvxResId(RID_SVXSTR_FINDBAR_MATCHCASE));
+        m_xMatchCaseControl->SetOptimalSize();
     }
-    xItemWindow = VCLUnoHelper::GetInterface( m_pMatchCaseControl );
+    xItemWindow = VCLUnoHelper::GetInterface(m_xMatchCaseControl);
 
     return xItemWindow;
 }
diff --git a/svx/uiconfig/ui/checkbuttonbox.ui b/svx/uiconfig/ui/checkbuttonbox.ui
new file mode 100644
index 000000000000..7d2ac5c3d0a7
--- /dev/null
+++ b/svx/uiconfig/ui/checkbuttonbox.ui
@@ -0,0 +1,27 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!-- Generated with glade 3.22.1 -->
+<interface domain="sc">
+  <requires lib="gtk+" version="3.18"/>
+  <object class="GtkBox" id="CheckButtonBox">
+    <property name="visible">True</property>
+    <property name="can_focus">False</property>
+    <property name="hexpand">True</property>
+    <property name="spacing">6</property>
+    <child>
+      <object class="GtkCheckButton" id="checkbutton">
+        <property name="visible">True</property>
+        <property name="can_focus">True</property>
+        <property name="receives_default">False</property>
+        <property name="hexpand">True</property>
+        <property name="vexpand">True</property>
+        <property name="use_underline">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>
+  </object>
+</interface>


More information about the Libreoffice-commits mailing list