include/svtools/ctrlbox.hxx | 11 - include/vcl/combobox.hxx | 3 include/vcl/salvtables.hxx | 6 include/vcl/weld.hxx | 14 - svtools/source/control/ctrlbox.cxx | 11 - svx/UIConfig_svx.mk | 1 svx/source/sidebar/paragraph/ParaSpacingWindow.cxx | 10 - svx/source/sidebar/paragraph/ParaSpacingWindow.hxx | 2 svx/source/tbxctrls/tbunocontroller.cxx | 181 +++++++++------------ svx/uiconfig/ui/fontsizebox.ui | 29 --- vcl/source/app/salvtables.cxx | 26 --- vcl/source/control/combobox.cxx | 15 - vcl/unx/gtk3/gtk3gtkinst.cxx | 78 --------- 13 files changed, 94 insertions(+), 293 deletions(-)
New commits: commit 1600dd7929d18b6d234bdb975798882ef73722a7 Author: Szymon Kłos <[email protected]> AuthorDate: Thu Jul 2 09:30:51 2020 +0200 Commit: Szymon Kłos <[email protected]> CommitDate: Thu Jul 2 11:04:50 2020 +0200 Revert "weld SvxFontSizeBox_Impl" This reverts commit f3ad8a70c3c15fd57891b0d2fe0bb0a5d2aa39a2. Change caused font size combbobx to not work on mobile devices in online. Change-Id: I41fc370866689b047aeeec056dff708e24dbc11f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/97722 Tested-by: Jenkins CollaboraOffice <[email protected]> Reviewed-by: Szymon Kłos <[email protected]> diff --git a/include/svtools/ctrlbox.hxx b/include/svtools/ctrlbox.hxx index bd762e51bbc7..a02484d005aa 100644 --- a/include/svtools/ctrlbox.hxx +++ b/include/svtools/ctrlbox.hxx @@ -439,7 +439,6 @@ class SVT_DLLPUBLIC SvtFontSizeBox bPtRelative:1, bStdSize:1; Link<weld::ComboBox&, void> m_aChangeHdl; - Link<weld::Widget&, void> m_aFocusOutHdl; std::unique_ptr<weld::ComboBox> m_xComboBox; sal_uInt16 GetDecimalDigits() const { return nDecimalDigits; } @@ -473,24 +472,14 @@ public: bool IsPtRelative() const { return bPtRelative; } void connect_changed(const Link<weld::ComboBox&, void>& rLink) { m_aChangeHdl = rLink; } - void connect_focus_out(const Link<weld::Widget&, void>& rLink) { m_aFocusOutHdl = rLink; } - void connect_key_press(const Link<const KeyEvent&, bool>& rLink) { m_xComboBox->connect_key_press(rLink); } OUString get_active_text() const { return m_xComboBox->get_active_text(); } void set_active_text(const OUString& rText) { m_xComboBox->set_active_text(rText); } void set_sensitive(bool bSensitive) { m_xComboBox->set_sensitive(bSensitive); } - int get_active() const { return m_xComboBox->get_active(); } int get_value() const; void set_value(int nValue); void save_value() { nSavedValue = get_value(); } int get_saved_value() const { return nSavedValue; } bool get_value_changed_from_saved() const { return get_value() != get_saved_value(); } - int get_count() const { return m_xComboBox->get_count(); } - OUString get_text(int i) const { return m_xComboBox->get_text(i); } - void grab_focus() { m_xComboBox->grab_focus(); } - bool has_focus() const { return m_xComboBox->has_focus(); } - void connect_entry_activate(const Link<weld::ComboBox&, bool>& rLink) { m_xComboBox->connect_entry_activate(rLink); } - void disable_entry_completion() { m_xComboBox->set_entry_completion(false, false); } - boost::property_tree::ptree get_property_tree() const; private: SvtFontSizeBox(const SvtFontSizeBox&) = delete; diff --git a/include/vcl/combobox.hxx b/include/vcl/combobox.hxx index 83f8beef71e9..5484023778c7 100644 --- a/include/vcl/combobox.hxx +++ b/include/vcl/combobox.hxx @@ -153,9 +153,6 @@ public: void SetNoSelection(); tools::Rectangle GetBoundingRectangle( sal_Int32 nItem ) const; - // determine if Select was called due to something selected from the menu - bool IsModifyByMenu() const; - /** checks whether a certain point lies within the bounds of a list item and returns the item as well as the character position the point is at. diff --git a/include/vcl/salvtables.hxx b/include/vcl/salvtables.hxx index 6eb89c1a72d4..31ba8c564eb8 100644 --- a/include/vcl/salvtables.hxx +++ b/include/vcl/salvtables.hxx @@ -341,8 +341,6 @@ public: virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> get_drop_target() override; - virtual boost::property_tree::ptree get_property_tree() const override; - virtual void set_stack_background() override; virtual void set_highlight_background() override; @@ -783,8 +781,6 @@ public: virtual bool has_entry() const override; - virtual bool changed_by_menu() const override; - virtual void set_entry_message_type(weld::EntryMessageType /*eType*/) override; virtual void set_entry_text(const OUString& /*rText*/) override; @@ -826,8 +822,6 @@ public: virtual void insert_separator(int pos, const OUString& /*rId*/) override; - virtual bool changed_by_menu() const override; - virtual void set_entry_text(const OUString& rText) override; virtual void set_entry_width_chars(int nChars) override; diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 4dfbeb9317bc..d5fd850fdcc4 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -27,8 +27,6 @@ #include <com/sun/star/accessibility/XAccessibleRelationSet.hpp> #include <com/sun/star/accessibility/XAccessible.hpp> -#include <boost/property_tree/ptree_fwd.hpp> - #include <assert.h> #include <memory> #include <vector> @@ -250,8 +248,6 @@ public: virtual css::uno::Reference<css::datatransfer::dnd::XDropTarget> get_drop_target() = 0; - virtual boost::property_tree::ptree get_property_tree() const = 0; - virtual ~Widget() {} }; @@ -628,17 +624,7 @@ public: virtual int find_id(const OUString& rId) const = 0; void remove_id(const OUString& rId) { remove(find_id(rId)); } - /* m_aChangeHdl is called when the active item is changed. The can be due - to the user selecting a different item from the list or while typing - into the entry of a combo box with an entry. - - Use changed_by_menu() to discover whether an item was actually selected - from the menu. - */ void connect_changed(const Link<ComboBox&, void>& rLink) { m_aChangeHdl = rLink; } - - virtual bool changed_by_menu() const = 0; - virtual void connect_popup_toggled(const Link<ComboBox&, void>& rLink) { m_aPopupToggledHdl = rLink; diff --git a/svtools/source/control/ctrlbox.cxx b/svtools/source/control/ctrlbox.cxx index 95347ffcb0bb..8efb03a0e568 100644 --- a/svtools/source/control/ctrlbox.cxx +++ b/svtools/source/control/ctrlbox.cxx @@ -52,8 +52,6 @@ #include <rtl/bootstrap.hxx> -#include <boost/property_tree/ptree.hpp> - #include <borderline.hrc> #include <stdio.h> @@ -1106,12 +1104,7 @@ SvtFontSizeBox::SvtFontSizeBox(std::unique_ptr<weld::ComboBox> p) m_xComboBox->connect_changed(LINK(this, SvtFontSizeBox, ModifyHdl)); } -boost::property_tree::ptree SvtFontSizeBox::get_property_tree() const -{ - return m_xComboBox->get_property_tree(); -} - -IMPL_LINK(SvtFontSizeBox, ReformatHdl, weld::Widget&, rWidget, void) +IMPL_LINK_NOARG(SvtFontSizeBox, ReformatHdl, weld::Widget&, void) { FontSizeNames aFontSizeNames(Application::GetSettings().GetUILanguageTag().getLanguageType()); if (!bRelativeMode || !aFontSizeNames.IsEmpty()) @@ -1121,8 +1114,6 @@ IMPL_LINK(SvtFontSizeBox, ReformatHdl, weld::Widget&, rWidget, void) } set_value(get_value()); - - m_aFocusOutHdl.Call(rWidget); } IMPL_LINK(SvtFontSizeBox, ModifyHdl, weld::ComboBox&, rBox, void) diff --git a/svx/UIConfig_svx.mk b/svx/UIConfig_svx.mk index ab701884332a..dc4e4df5b8cf 100644 --- a/svx/UIConfig_svx.mk +++ b/svx/UIConfig_svx.mk @@ -49,7 +49,6 @@ $(eval $(call gb_UIConfig_add_uifiles,svx,\ svx/uiconfig/ui/floatingundoredo \ svx/uiconfig/ui/fontworkgallerydialog \ svx/uiconfig/ui/fontworkspacingdialog \ - svx/uiconfig/ui/fontsizebox \ svx/uiconfig/ui/formdatamenu \ svx/uiconfig/ui/formlinkwarndialog \ svx/uiconfig/ui/formnavimenu \ diff --git a/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx b/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx index d6bf95f83a00..d944c616a600 100644 --- a/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx +++ b/svx/source/sidebar/paragraph/ParaSpacingWindow.cxx @@ -136,7 +136,7 @@ ParaAboveSpacingWindow::ParaAboveSpacingWindow(vcl::Window* pParent) m_xAboveContainer->show(); m_xBelowContainer->hide(); - SetSizePixel(get_preferred_size()); + SetSizePixel(GetOptimalSize()); } void ParaAboveSpacingWindow::GetFocus() @@ -152,7 +152,7 @@ ParaBelowSpacingWindow::ParaBelowSpacingWindow(vcl::Window* pParent) m_xAboveContainer->hide(); m_xBelowContainer->show(); - SetSizePixel(get_preferred_size()); + SetSizePixel(GetOptimalSize()); } void ParaBelowSpacingWindow::GetFocus() @@ -359,7 +359,7 @@ ParaLeftSpacingWindow::ParaLeftSpacingWindow(vcl::Window* pParent) m_xAfterContainer->hide(); m_xFirstLineContainer->hide(); - SetSizePixel(get_preferred_size()); + SetSizePixel(GetOptimalSize()); } void ParaLeftSpacingWindow::GetFocus() @@ -376,7 +376,7 @@ ParaRightSpacingWindow::ParaRightSpacingWindow(vcl::Window* pParent) m_xAfterContainer->show(); m_xFirstLineContainer->hide(); - SetSizePixel(get_preferred_size()); + SetSizePixel(GetOptimalSize()); } void ParaRightSpacingWindow::GetFocus() @@ -393,7 +393,7 @@ ParaFirstLineSpacingWindow::ParaFirstLineSpacingWindow(vcl::Window* pParent) m_xAfterContainer->hide(); m_xFirstLineContainer->show(); - SetSizePixel(get_preferred_size()); + SetSizePixel(GetOptimalSize()); } void ParaFirstLineSpacingWindow::GetFocus() diff --git a/svx/source/sidebar/paragraph/ParaSpacingWindow.hxx b/svx/source/sidebar/paragraph/ParaSpacingWindow.hxx index 9196a4a9f3d7..6a25e338f784 100644 --- a/svx/source/sidebar/paragraph/ParaSpacingWindow.hxx +++ b/svx/source/sidebar/paragraph/ParaSpacingWindow.hxx @@ -22,6 +22,8 @@ #include <cppuhelper/queryinterface.hxx> #include <editeng/ulspitem.hxx> #include <editeng/lrspitem.hxx> +#include <vcl/builder.hxx> +#include <vcl/layout.hxx> #include <vcl/EnumContext.hxx> #include <svx/relfld.hxx> #include <vcl/InterimItemWindow.hxx> diff --git a/svx/source/tbxctrls/tbunocontroller.cxx b/svx/source/tbxctrls/tbunocontroller.cxx index b87d313a9ad4..ae76544c8037 100644 --- a/svx/source/tbxctrls/tbunocontroller.cxx +++ b/svx/source/tbxctrls/tbunocontroller.cxx @@ -86,40 +86,32 @@ class FontHeightToolBoxControl : public svt::ToolboxController, css::awt::FontDescriptor m_aCurrentFont; }; -class SvxFontSizeBox_Impl : public InterimItemWindow +class SvxFontSizeBox_Impl : public FontSizeBox { public: SvxFontSizeBox_Impl( vcl::Window* pParent, const uno::Reference< frame::XFrame >& _xFrame, FontHeightToolBoxControl& rCtrl ); - virtual void dispose() override; - virtual ~SvxFontSizeBox_Impl() override; void statusChanged_Impl( long nHeight, bool bErase ); void UpdateFont( const css::awt::FontDescriptor& rCurrentFont ); void SetOptimalSize(); + virtual bool EventNotify( NotifyEvent& rNEvt ) override; virtual boost::property_tree::ptree DumpAsPropertyTree() override; protected: + virtual void Select() override; virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; - virtual void GetFocus() override; private: - FontHeightToolBoxControl& m_rCtrl; + FontHeightToolBoxControl* m_pCtrl; OUString m_aCurText; + Size const m_aLogicalSize; bool m_bRelease; uno::Reference< frame::XFrame > m_xFrame; - std::unique_ptr<SvtFontSizeBox> m_xWidget; void ReleaseFocus_Impl(); - - void Select(); - - DECL_LINK(SelectHdl, weld::ComboBox&, void); - DECL_LINK(KeyInputHdl, const KeyEvent&, bool); - DECL_LINK(ActivateHdl, weld::ComboBox&, bool); - DECL_LINK(FocusOutHdl, weld::Widget&, void); }; SvxFontSizeBox_Impl::SvxFontSizeBox_Impl( @@ -127,38 +119,16 @@ SvxFontSizeBox_Impl::SvxFontSizeBox_Impl( const uno::Reference< frame::XFrame >& _xFrame, FontHeightToolBoxControl& _rCtrl ) : - InterimItemWindow(_pParent, "svx/ui/fontsizebox.ui", "FontSizeBox"), + FontSizeBox( _pParent, WinBits( WB_DROPDOWN ) ), - m_rCtrl ( _rCtrl ), + m_pCtrl ( &_rCtrl ), + m_aLogicalSize ( 0,100 ), m_bRelease ( true ), - m_xFrame ( _xFrame ), - m_xWidget(new SvtFontSizeBox(m_xBuilder->weld_combo_box("fontsize"))) + m_xFrame ( _xFrame ) { + SetValue( 0 ); + SetText( "" ); set_id("fontsizecombobox"); - m_xWidget->set_value(0); - m_xWidget->set_active_text(""); - m_xWidget->disable_entry_completion(); - - m_xWidget->connect_changed(LINK(this, SvxFontSizeBox_Impl, SelectHdl)); - m_xWidget->connect_key_press(LINK(this, SvxFontSizeBox_Impl, KeyInputHdl)); - m_xWidget->connect_entry_activate(LINK(this, SvxFontSizeBox_Impl, ActivateHdl)); - m_xWidget->connect_focus_out(LINK(this, SvxFontSizeBox_Impl, FocusOutHdl)); -} - -void SvxFontSizeBox_Impl::dispose() -{ - m_xWidget.reset(); - InterimItemWindow::dispose(); -} - -SvxFontSizeBox_Impl::~SvxFontSizeBox_Impl() -{ - disposeOnce(); -} - -void SvxFontSizeBox_Impl::GetFocus() -{ - m_xWidget->grab_focus(); } void SvxFontSizeBox_Impl::ReleaseFocus_Impl() @@ -173,35 +143,30 @@ void SvxFontSizeBox_Impl::ReleaseFocus_Impl() m_xFrame->getContainerWindow()->setFocus(); } -IMPL_LINK(SvxFontSizeBox_Impl, SelectHdl, weld::ComboBox&, rCombo, void) -{ - if (rCombo.changed_by_menu()) // only when picked from the list - Select(); -} - -IMPL_LINK_NOARG(SvxFontSizeBox_Impl, ActivateHdl, weld::ComboBox&, bool) -{ - Select(); - return true; -} void SvxFontSizeBox_Impl::Select() { - sal_Int64 nSelVal = m_xWidget->get_value(); - float fSelVal = float( nSelVal ) / 10; + FontSizeBox::Select(); + + if ( !IsTravelSelect() ) + { + sal_Int64 nSelVal = GetValue(); + float fSelVal = float( nSelVal ) / 10; - uno::Sequence< beans::PropertyValue > aArgs( 1 ); - aArgs[0].Name = "FontHeight.Height"; - aArgs[0].Value <<= fSelVal; + uno::Sequence< beans::PropertyValue > aArgs( 1 ); + aArgs[0].Name = "FontHeight.Height"; + aArgs[0].Value <<= fSelVal; - /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call. - This instance may be deleted in the meantime (i.e. when a dialog is opened - while in Dispatch()), accessing members will crash in this case. */ - ReleaseFocus_Impl(); + /* #i33380# DR 2004-09-03 Moved the following line above the Dispatch() call. + This instance may be deleted in the meantime (i.e. when a dialog is opened + while in Dispatch()), accessing members will crash in this case. */ + ReleaseFocus_Impl(); - m_rCtrl.dispatchCommand( aArgs ); + m_pCtrl->dispatchCommand( aArgs ); + } } + void SvxFontSizeBox_Impl::statusChanged_Impl( long nPoint, bool bErase ) { if ( !bErase ) @@ -210,22 +175,23 @@ void SvxFontSizeBox_Impl::statusChanged_Impl( long nPoint, bool bErase ) long nVal = nPoint; // changed => set new value - if (m_xWidget->get_value() != nVal) - m_xWidget->set_value(nVal); + if ( GetValue() != nVal ) + SetValue( nVal ); } else { // delete value in the display - m_xWidget->set_value(-1L); - m_xWidget->set_active_text(""); + SetValue( -1L ); + SetText( "" ); } - m_xWidget->save_value(); + SaveValue(); } + void SvxFontSizeBox_Impl::UpdateFont( const css::awt::FontDescriptor& rCurrentFont ) { // filling up the sizes list - auto nOldVal = m_xWidget->get_value(); // memorize old value + sal_Int64 nOldVal = GetValue(); // memorize old value const FontList* _pFontList = nullptr; std::unique_ptr<FontList> aHold( new FontList( this )); _pFontList = aHold.get(); @@ -236,49 +202,61 @@ void SvxFontSizeBox_Impl::UpdateFont( const css::awt::FontDescriptor& rCurrentFo _aFontMetric.SetFamilyName( rCurrentFont.Name ); _aFontMetric.SetStyleName( rCurrentFont.StyleName ); _aFontMetric.SetFontHeight( rCurrentFont.Height ); - m_xWidget->Fill(&_aFontMetric, _pFontList); + Fill( &_aFontMetric, _pFontList ); } else { - m_xWidget->Fill(nullptr, _pFontList); + Fill( nullptr, _pFontList ); } - m_xWidget->set_value(nOldVal); // restore old value - m_aCurText = m_xWidget->get_active_text(); // memorize to reset at ESC + SetValue( nOldVal ); // restore old value + m_aCurText = GetText(); // memorize to reset at ESC } -IMPL_LINK(SvxFontSizeBox_Impl, KeyInputHdl, const KeyEvent&, rKEvt, bool) + +bool SvxFontSizeBox_Impl::EventNotify( NotifyEvent& rNEvt ) { bool bHandled = false; - sal_uInt16 nCode = rKEvt.GetKeyCode().GetCode(); + if ( rNEvt.GetType() == MouseNotifyEvent::KEYINPUT ) + { + sal_uInt16 nCode = rNEvt.GetKeyEvent()->GetKeyCode().GetCode(); - switch (nCode) + switch ( nCode ) + { + case KEY_RETURN: + case KEY_TAB: + { + if ( KEY_TAB == nCode ) + m_bRelease = false; + else + bHandled = true; + Select(); + break; + } + + case KEY_ESCAPE: + SetText( m_aCurText ); + if ( typeid( *GetParent() ) != typeid( sfx2::sidebar::SidebarToolBox ) ) + ReleaseFocus_Impl(); + bHandled = true; + break; + } + } + else if( MouseNotifyEvent::LOSEFOCUS == rNEvt.GetType() ) { - case KEY_TAB: - m_bRelease = false; - Select(); - break; - - case KEY_ESCAPE: - m_xWidget->set_active_text(m_aCurText); - if ( typeid( *GetParent() ) != typeid( sfx2::sidebar::SidebarToolBox ) ) - ReleaseFocus_Impl(); - bHandled = true; - break; + vcl::Window* pFocusWin = Application::GetFocusWindow(); + if(!HasFocus() && GetSubEdit() != pFocusWin) + SetText(GetSavedValue()); } - return bHandled || ChildKeyInput(rKEvt); -} - -IMPL_LINK_NOARG(SvxFontSizeBox_Impl, FocusOutHdl, weld::Widget&, void) -{ - if (!m_xWidget->has_focus()) // a combobox can be comprised of different subwidget so double-check if none of those has focus - m_xWidget->set_value(m_xWidget->get_saved_value()); + return bHandled || FontSizeBox::EventNotify( rNEvt ); } void SvxFontSizeBox_Impl::SetOptimalSize() { - SetSizePixel(get_preferred_size()); + Size aPrefSize(LogicToPixel(m_aLogicalSize, MapMode(MapUnit::MapAppFont))); + aPrefSize.setWidth( get_preferred_size().Width() ); + SetSizePixel(aPrefSize); } void SvxFontSizeBox_Impl::DataChanged( const DataChangedEvent& rDCEvt ) @@ -288,18 +266,20 @@ void SvxFontSizeBox_Impl::DataChanged( const DataChangedEvent& rDCEvt ) { SetOptimalSize(); } + + FontSizeBox::DataChanged( rDCEvt ); } boost::property_tree::ptree SvxFontSizeBox_Impl::DumpAsPropertyTree() { - boost::property_tree::ptree aTree(m_xWidget->get_property_tree()); + boost::property_tree::ptree aTree(FontSizeBox::DumpAsPropertyTree()); boost::property_tree::ptree aEntries; - for (int i = 0, nCount = m_xWidget->get_count(); i < nCount; ++i) + for (int i = 0; i < GetEntryCount(); ++i) { boost::property_tree::ptree aEntry; - aEntry.put("", m_xWidget->get_text(i)); + aEntry.put("", GetEntry(i)); aEntries.push_back(std::make_pair("", aEntry)); } @@ -307,15 +287,14 @@ boost::property_tree::ptree SvxFontSizeBox_Impl::DumpAsPropertyTree() boost::property_tree::ptree aSelected; - int nActive = m_xWidget->get_active(); - if (nActive != -1) + for (int i = 0; i < GetSelectedEntryCount(); ++i) { boost::property_tree::ptree aEntry; - aEntry.put("", nActive); + aEntry.put("", GetSelectedEntryPos(i)); aSelected.push_back(std::make_pair("", aEntry)); } - aTree.put("selectedCount", nActive == -1 ? 0 : 1); + aTree.put("selectedCount", GetSelectedEntryCount()); aTree.add_child("selectedEntries", aSelected); aTree.put("command", ".uno:FontHeight"); diff --git a/svx/uiconfig/ui/fontsizebox.ui b/svx/uiconfig/ui/fontsizebox.ui deleted file mode 100644 index c1702822b3e2..000000000000 --- a/svx/uiconfig/ui/fontsizebox.ui +++ /dev/null @@ -1,29 +0,0 @@ -<?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.22.1 --> -<interface domain="svx"> - <requires lib="gtk+" version="3.18"/> - <object class="GtkBox" id="FontSizeBox"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="spacing">6</property> - <child> - <object class="GtkComboBoxText" id="fontsize"> - <property name="visible">True</property> - <property name="can_focus">False</property> - <property name="hexpand">True</property> - <property name="has_entry">True</property> - <child internal-child="entry"> - <object class="GtkEntry"> - <property name="can_focus">True</property> - </object> - </child> - </object> - <packing> - <property name="expand">False</property> - <property name="fill">True</property> - <property name="position">0</property> - </packing> - </child> - </object> -</interface> diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index a8ef10f9f127..2219a3d72ebe 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -73,8 +73,6 @@ #include <wizdlg.hxx> #include <vcl/salvtables.hxx> -#include <boost/property_tree/ptree.hpp> - SalFrame::SalFrame() : m_pWindow(nullptr) , m_pProc(nullptr) @@ -682,11 +680,6 @@ css::uno::Reference<css::datatransfer::dnd::XDropTarget> SalInstanceWidget::get_ return m_xWidget->GetDropTarget(); } -boost::property_tree::ptree SalInstanceWidget::get_property_tree() const -{ - return m_xWidget->DumpAsPropertyTree(); -} - void SalInstanceWidget::set_stack_background() { set_background(m_xWidget->GetSettings().GetStyleSettings().GetWindowColor());; @@ -5499,11 +5492,6 @@ void SalInstanceComboBoxWithoutEdit::insert_separator(int pos, const OUString& / m_xComboBox->AddSeparator(nInsertPos - 1); } -bool SalInstanceComboBoxWithoutEdit::changed_by_menu() const -{ - return true; -} - bool SalInstanceComboBoxWithoutEdit::has_entry() const { return false; @@ -5569,11 +5557,6 @@ IMPL_LINK_NOARG(SalInstanceComboBoxWithoutEdit, SelectHdl, ListBox&, void) return true; } - bool SalInstanceComboBoxWithEdit::changed_by_menu() const - { - return m_xComboBox->IsModifyByMenu(); // && !m_xComboBox->IsTravelSelect(); - } - void SalInstanceComboBoxWithEdit::set_entry_message_type(weld::EntryMessageType eType) { if (eType == weld::EntryMessageType::Error) @@ -5674,7 +5657,6 @@ private: DECL_LINK(KeyPressListener, VclWindowEvent&, void); SalInstanceEntry* m_pEntry; SalInstanceTreeView* m_pTreeView; - bool m_bTreeChange; public: SalInstanceEntryTreeView(vcl::Window *pContainer, SalInstanceBuilder* pBuilder, bool bTakeOwnership, std::unique_ptr<weld::Entry> xEntry, std::unique_ptr<weld::TreeView> xTreeView) @@ -5682,7 +5664,6 @@ public: , SalInstanceContainer(pContainer, pBuilder, bTakeOwnership) , m_pEntry(dynamic_cast<SalInstanceEntry*>(m_xEntry.get())) , m_pTreeView(dynamic_cast<SalInstanceTreeView*>(m_xTreeView.get())) - , m_bTreeChange(false) { assert(m_pEntry && m_pTreeView); @@ -5721,11 +5702,6 @@ public: m_xEntry->connect_focus_out(rLink); } - virtual bool changed_by_menu() const override - { - return m_bTreeChange; - } - virtual ~SalInstanceEntryTreeView() override { Edit& rEntry = m_pEntry->getEntry(); @@ -5754,9 +5730,7 @@ IMPL_LINK(SalInstanceEntryTreeView, KeyPressListener, VclWindowEvent&, rEvent, v m_xEntry->set_text(m_xTreeView->get_selected_text()); m_xEntry->select_region(0, -1); m_pTreeView->enable_notify_events(); - m_bTreeChange = true; m_pEntry->fire_signal_changed(); - m_bTreeChange = false; } } diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 45f6e78b5569..4363f868c482 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -53,7 +53,6 @@ struct ComboBox::Impl sal_Unicode m_cMultiSep; bool m_isDDAutoSize : 1; bool m_isSyntheticModify : 1; - bool m_isMenuModify : 1; bool m_isMatchCase : 1; sal_Int32 m_nMaxWidthChars; sal_Int32 m_nWidthInChars; @@ -66,7 +65,6 @@ struct ComboBox::Impl , m_cMultiSep(0) , m_isDDAutoSize(false) , m_isSyntheticModify(false) - , m_isMenuModify(false) , m_isMatchCase(false) , m_nMaxWidthChars(0) , m_nWidthInChars(-1) @@ -140,7 +138,6 @@ void ComboBox::Impl::ImplInitComboBoxData() m_nDDHeight = 0; m_isDDAutoSize = true; m_isSyntheticModify = false; - m_isMenuModify = false; m_isMatchCase = false; m_cMultiSep = ';'; m_nMaxWidthChars = -1; @@ -421,8 +418,9 @@ IMPL_LINK_NOARG(ComboBox::Impl, ImplSelectHdl, LinkParamNone*, void) } // #84652# Call GrabFocus and EndPopupMode before calling Select/Modify, but after changing the text - bool bMenuSelect = bPopup && !m_pImplLB->IsTravelSelect() && (!m_rThis.IsMultiSelectionEnabled() || !m_pImplLB->GetSelectModifier()); - if (bMenuSelect) + + if (bPopup && !m_pImplLB->IsTravelSelect() && + (!m_rThis.IsMultiSelectionEnabled() || !m_pImplLB->GetSelectModifier())) { m_pFloatWin->EndPopupMode(); m_rThis.GrabFocus(); @@ -432,19 +430,12 @@ IMPL_LINK_NOARG(ComboBox::Impl, ImplSelectHdl, LinkParamNone*, void) { m_pSubEdit->SetModifyFlag(); m_isSyntheticModify = true; - m_isMenuModify = bMenuSelect; m_rThis.Modify(); - m_isMenuModify = false; m_isSyntheticModify = false; m_rThis.Select(); } } -bool ComboBox::IsModifyByMenu() const -{ - return m_pImpl->m_isMenuModify; -} - IMPL_LINK_NOARG( ComboBox::Impl, ImplListItemSelectHdl, LinkParamNone*, void ) { m_rThis.CallEventListeners( VclEventId::DropdownSelect ); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index b2f5f1b72d9e..d66997c954a2 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -85,8 +85,6 @@ #include <window.h> #include <numeric> -#include <boost/property_tree/ptree.hpp> - using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::lang; @@ -2672,12 +2670,6 @@ public: return m_xDropTarget.get(); } - virtual boost::property_tree::ptree get_property_tree() const override - { - //not implemented for the gtk variant - return boost::property_tree::ptree(); - } - virtual void set_stack_background() override { OUString sColor = Application::GetSettings().GetStyleSettings().GetWindowColor().AsRGBHexString(); @@ -11187,7 +11179,6 @@ private: bool m_bPopupActive; bool m_bAutoComplete; bool m_bAutoCompleteCaseSensitive; - bool m_bChangedByMenu; gulong m_nToggleFocusInSignalId; gulong m_nToggleFocusOutSignalId; gulong m_nChangedSignalId; @@ -11197,8 +11188,6 @@ private: gulong m_nEntryActivateSignalId; gulong m_nEntryFocusInSignalId; gulong m_nEntryFocusOutSignalId; - gulong m_nOriginalMenuActivateEventId; - gulong m_nMenuActivateSignalId; guint m_nAutoCompleteIdleId; static gboolean idleAutoComplete(gpointer widget) @@ -11296,13 +11285,7 @@ private: { GtkInstanceComboBox* pThis = static_cast<GtkInstanceComboBox*>(widget); SolarMutexGuard aGuard; - pThis->fire_signal_changed(); - } - - void fire_signal_changed() - { - signal_changed(); - m_bChangedByMenu = false; + pThis->signal_changed(); } static void signalPopupToggled(GtkComboBox*, GParamSpec*, gpointer widget) @@ -11477,27 +11460,6 @@ private: return bDone; } - static void signalMenuActivate(GtkWidget* pWidget, const gchar *path, gpointer widget) - { - GtkInstanceComboBox* pThis = static_cast<GtkInstanceComboBox*>(widget); - return pThis->signal_menu_activate(pWidget, path); - } - - void signal_menu_activate(GtkWidget* pWidget, const gchar *path) - { - // we disabled the original menu-active to get our own handler in first - // so we know before changed is called that it will be called by the - // menu, now block our handler and unblock the original and replay the - // event to call the original handler - m_bChangedByMenu = true; - g_signal_handler_block(m_pMenu, m_nMenuActivateSignalId); - g_signal_handler_unblock(m_pMenu, m_nOriginalMenuActivateEventId); - guint nMenuActivateSignalId = g_signal_lookup("menu-activate", G_TYPE_FROM_INSTANCE(m_pMenu)); - g_signal_emit(pWidget, nMenuActivateSignalId, 0, path); - g_signal_handler_block(m_pMenu, m_nOriginalMenuActivateEventId); - g_signal_handler_unblock(m_pMenu, m_nMenuActivateSignalId); - } - bool signal_key_press(const GdkEventKey* pEvent) { KeyEvent aKEvt(GtkToVcl(*pEvent)); @@ -11628,21 +11590,10 @@ private: return; m_pMenu = GTK_MENU(pWidget); - guint nKeyPressSignalId = g_signal_lookup("key-press-event", GTK_TYPE_MENU); - gulong nOriginalMenuKeyPressEventId = g_signal_handler_find(m_pMenu, - static_cast<GSignalMatchType>(G_SIGNAL_MATCH_DATA | G_SIGNAL_MATCH_ID), - nKeyPressSignalId, 0, + guint nSignalId = g_signal_lookup("key-press-event", GTK_TYPE_MENU); + gulong nOriginalMenuKeyPressEventId = g_signal_handler_find(m_pMenu, G_SIGNAL_MATCH_DATA, nSignalId, 0, nullptr, nullptr, m_pComboBox); - guint nMenuActivateSignalId = g_signal_lookup("menu-activate", G_TYPE_FROM_INSTANCE(m_pMenu)); - m_nOriginalMenuActivateEventId = g_signal_handler_find(m_pMenu, - static_cast<GSignalMatchType>(G_SIGNAL_MATCH_DATA | G_SIGNAL_MATCH_ID), - nMenuActivateSignalId, 0, - nullptr, nullptr, m_pComboBox); - - g_signal_handler_block(m_pMenu, m_nOriginalMenuActivateEventId); - m_nMenuActivateSignalId = g_signal_connect(m_pMenu, "menu-activate", G_CALLBACK(signalMenuActivate), this); - g_signal_handler_block(m_pMenu, nOriginalMenuKeyPressEventId); g_signal_connect(m_pMenu, "key-press-event", G_CALLBACK(signalKeyPress), this); } @@ -11669,13 +11620,10 @@ public: , m_bPopupActive(false) , m_bAutoComplete(false) , m_bAutoCompleteCaseSensitive(false) - , m_bChangedByMenu(false) , m_nToggleFocusInSignalId(0) , m_nToggleFocusOutSignalId(0) , m_nChangedSignalId(g_signal_connect(m_pComboBox, "changed", G_CALLBACK(signalChanged), this)) , m_nPopupShownSignalId(g_signal_connect(m_pComboBox, "notify::popup-shown", G_CALLBACK(signalPopupToggled), this)) - , m_nOriginalMenuActivateEventId(0) - , m_nMenuActivateSignalId(0) , m_nAutoCompleteIdleId(0) { GList* cells = gtk_cell_layout_get_cells(GTK_CELL_LAYOUT(m_pComboBox)); @@ -11738,7 +11686,6 @@ public: disable_notify_events(); OString aId(OUStringToOString(rStr, RTL_TEXTENCODING_UTF8)); gtk_combo_box_set_active_id(m_pComboBox, aId.getStr()); - m_bChangedByMenu = false; enable_notify_events(); } @@ -11785,7 +11732,6 @@ public: { disable_notify_events(); gtk_combo_box_set_active(m_pComboBox, pos); - m_bChangedByMenu = false; enable_notify_events(); } @@ -12099,17 +12045,8 @@ public: return gtk_widget_has_focus(m_pToggleButton) || GtkInstanceWidget::has_focus(); } - virtual bool changed_by_menu() const override - { - return m_bChangedByMenu; - } - virtual ~GtkInstanceComboBox() override { - if (m_nOriginalMenuActivateEventId) - g_signal_handler_unblock(m_pMenu, m_nOriginalMenuActivateEventId); - if (m_nMenuActivateSignalId) - g_signal_handler_disconnect(m_pMenu, m_nMenuActivateSignalId); if (m_nAutoCompleteIdleId) g_source_remove(m_nAutoCompleteIdleId); if (GtkEntry* pEntry = get_entry()) @@ -12139,7 +12076,6 @@ private: gulong m_nEntryInsertTextSignalId; guint m_nAutoCompleteIdleId; bool m_bAutoCompleteCaseSensitive; - bool m_bTreeChange; bool signal_key_press(GdkEventKey* pEvent) { @@ -12167,9 +12103,7 @@ private: } m_xEntry->select_region(0, -1); enable_notify_events(); - m_bTreeChange = true; m_pEntry->fire_signal_changed(); - m_bTreeChange = false; return true; } return false; @@ -12270,7 +12204,6 @@ public: , m_pTreeView(dynamic_cast<GtkInstanceTreeView*>(m_xTreeView.get())) , m_nAutoCompleteIdleId(0) , m_bAutoCompleteCaseSensitive(false) - , m_bTreeChange(false) { assert(m_pEntry); GtkWidget* pWidget = m_pEntry->getWidget(); @@ -12327,11 +12260,6 @@ public: GtkInstanceContainer::disable_notify_events(); } - virtual bool changed_by_menu() const override - { - return m_bTreeChange; - } - virtual ~GtkInstanceEntryTreeView() override { if (m_nAutoCompleteIdleId) _______________________________________________ Libreoffice-commits mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits
