framework/inc/xml/toolboxdocumenthandler.hxx | 8 ----- framework/source/fwe/xml/toolboxdocumenthandler.cxx | 27 +++++--------------- 2 files changed, 8 insertions(+), 27 deletions(-)
New commits: commit 601db233f5cc7ee8bcd948681345fa37d5bb1d84 Author: Noel Grandin <noelgran...@gmail.com> AuthorDate: Thu Apr 27 18:43:39 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Fri Apr 28 08:24:45 2023 +0200 remove dodgy code in OReadToolBoxDocumentHandler comparing hashcodes without doing an actual comparison is not safe. Code was like this since commit 6845330a228f7b516425e2dcb0aa5f2cdfaedc85 Author: Carsten Driesner <c...@openoffice.org> Date: Wed Oct 17 09:57:37 2001 +0000 #87255# support toolbar item style and help id Change-Id: Ie49647da257e6199d9502c916da2dd3d39d52377 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/151136 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/framework/inc/xml/toolboxdocumenthandler.hxx b/framework/inc/xml/toolboxdocumenthandler.hxx index 721d02936616..f134054267ae 100644 --- a/framework/inc/xml/toolboxdocumenthandler.hxx +++ b/framework/inc/xml/toolboxdocumenthandler.hxx @@ -100,14 +100,6 @@ class OReadToolBoxDocumentHandler final : public OReadToolBoxDocumentHandler_Bas css::uno::Reference< css::container::XIndexContainer > m_rItemContainer; css::uno::Reference< css::xml::sax::XLocator > m_xLocator; - sal_Int32 m_nHashCode_Style_Radio; - sal_Int32 m_nHashCode_Style_Left; - sal_Int32 m_nHashCode_Style_AutoSize; - sal_Int32 m_nHashCode_Style_DropDown; - sal_Int32 m_nHashCode_Style_Repeat; - sal_Int32 m_nHashCode_Style_DropDownOnly; - sal_Int32 m_nHashCode_Style_Text; - sal_Int32 m_nHashCode_Style_Image; OUString m_aType; OUString m_aLabel; OUString m_aStyle; diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx index 595845279d4c..67d67ed308a9 100644 --- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx +++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx @@ -149,16 +149,6 @@ OReadToolBoxDocumentHandler::OReadToolBoxDocumentHandler( const Reference< XInde } } - // pre-calculate a hash code for all style strings to speed up xml read process - m_nHashCode_Style_Radio = OUString( ATTRIBUTE_ITEMSTYLE_RADIO ).hashCode(); - m_nHashCode_Style_Left = OUString( ATTRIBUTE_ITEMSTYLE_LEFT ).hashCode(); - m_nHashCode_Style_AutoSize = OUString( ATTRIBUTE_ITEMSTYLE_AUTOSIZE ).hashCode(); - m_nHashCode_Style_DropDown = OUString( ATTRIBUTE_ITEMSTYLE_DROPDOWN ).hashCode(); - m_nHashCode_Style_Repeat = OUString( ATTRIBUTE_ITEMSTYLE_REPEAT ).hashCode(); - m_nHashCode_Style_DropDownOnly = OUString( ATTRIBUTE_ITEMSTYLE_DROPDOWNONLY ).hashCode(); - m_nHashCode_Style_Text = OUString( ATTRIBUTE_ITEMSTYLE_TEXT ).hashCode(); - m_nHashCode_Style_Image = OUString( ATTRIBUTE_ITEMSTYLE_IMAGE ).hashCode(); - m_bToolBarStartFound = false; m_bToolBarItemStartFound = false; m_bToolBarSpaceStartFound = false; @@ -310,22 +300,21 @@ void SAL_CALL OReadToolBoxDocumentHandler::startElement( OUString aToken = aTemp.getToken( 0, ' ', nIndex ); if ( !aToken.isEmpty() ) { - sal_Int32 nHashCode = aToken.hashCode(); - if ( nHashCode == m_nHashCode_Style_Radio ) + if ( aToken == ATTRIBUTE_ITEMSTYLE_RADIO ) nItemBits |= css::ui::ItemStyle::RADIO_CHECK; - else if ( nHashCode == m_nHashCode_Style_Left ) + else if ( aToken == ATTRIBUTE_ITEMSTYLE_LEFT ) nItemBits |= css::ui::ItemStyle::ALIGN_LEFT; - else if ( nHashCode == m_nHashCode_Style_AutoSize ) + else if ( aToken == ATTRIBUTE_ITEMSTYLE_AUTOSIZE ) nItemBits |= css::ui::ItemStyle::AUTO_SIZE; - else if ( nHashCode == m_nHashCode_Style_Repeat ) + else if ( aToken == ATTRIBUTE_ITEMSTYLE_REPEAT ) nItemBits |= css::ui::ItemStyle::REPEAT; - else if ( nHashCode == m_nHashCode_Style_DropDownOnly ) + else if ( aToken == ATTRIBUTE_ITEMSTYLE_DROPDOWNONLY ) nItemBits |= css::ui::ItemStyle::DROPDOWN_ONLY; - else if ( nHashCode == m_nHashCode_Style_DropDown ) + else if ( aToken == ATTRIBUTE_ITEMSTYLE_DROPDOWN ) nItemBits |= css::ui::ItemStyle::DROP_DOWN; - else if ( nHashCode == m_nHashCode_Style_Text ) + else if ( aToken == ATTRIBUTE_ITEMSTYLE_TEXT ) nItemBits |= css::ui::ItemStyle::TEXT; - else if ( nHashCode == m_nHashCode_Style_Image ) + else if ( aToken == ATTRIBUTE_ITEMSTYLE_IMAGE ) nItemBits |= css::ui::ItemStyle::ICON; } }