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 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( pToolBox->GetItemWindow(id) ); + CheckButtonItemWindow* pItemWin = static_cast( pToolBox->GetItemWindow(id) ); if (pItemWin) - aMatchCase = pItemWin->IsChecked(); + aMatchCase = pItemWin->get_active(); } else if ( sItemCommand == COMMAND_SEARCHFORMATTED ) { CheckBox* pItemWin = static_cast( pToolBox->GetItemWindow(id) ); @@ -800,14 +852,14 @@ public: virtual void SAL_CALL statusChanged( const css::frame::FeatureStateEvent& rEvent ) override; private: - VclPtr m_pMatchCaseControl; + VclPtr 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(pParent.get()); - m_pMatchCaseControl = VclPtr::Create( pToolbar, 0 ); - m_pMatchCaseControl->SetText( SvxResId( RID_SVXSTR_FINDBAR_MATCHCASE ) ); - Size aSize( m_pMatchCaseControl->GetOptimalSize() ); - m_pMatchCaseControl->SetSizePixel( aSize ); + m_xMatchCaseControl = VclPtr::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 @@ + + + + + + True + False + True + 6 + + + True + True + False + True + True + True + True + + + False + True + 0 + + + +