toolkit/source/controls/controlmodelcontainerbase.cxx |   30 +++---------------
 1 file changed, 6 insertions(+), 24 deletions(-)

New commits:
commit c47038d1248340a4e0347a06707ab317da787b3b
Author:     Julien Nabet <serval2...@yahoo.fr>
AuthorDate: Thu Oct 5 10:53:54 2023 +0200
Commit:     Julien Nabet <serval2...@yahoo.fr>
CommitDate: Thu Oct 5 12:16:52 2023 +0200

    Replace 3 lcl_throw* by throwing the right exception directly (toolkit)
    
    Change-Id: Ia351741e46faa6463fac2124262da0153ebe19dc
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/157585
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>
    Reviewed-by: Julien Nabet <serval2...@yahoo.fr>
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Tested-by: Jenkins

diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx 
b/toolkit/source/controls/controlmodelcontainerbase.cxx
index 14933e96affc..c82f1052eee3 100644
--- a/toolkit/source/controls/controlmodelcontainerbase.cxx
+++ b/toolkit/source/controls/controlmodelcontainerbase.cxx
@@ -134,24 +134,6 @@ public:
 };
 
 
-static void lcl_throwIllegalArgumentException( )
-{   // throwing is expensive (in terms of code size), thus we hope the 
compiler does not inline this...
-    throw IllegalArgumentException();
-}
-
-
-static void lcl_throwNoSuchElementException( )
-{   // throwing is expensive (in terms of code size), thus we hope the 
compiler does not inline this...
-    throw NoSuchElementException();
-}
-
-
-static void lcl_throwElementExistException( )
-{   // throwing is expensive (in terms of code size), thus we hope the 
compiler does not inline this...
-    throw ElementExistException();
-}
-
-
 static OUString getTabIndexPropertyName( )
 {
     return "TabIndex";
@@ -435,11 +417,11 @@ void ControlModelContainerBase::replaceByName( const 
OUString& aName, const Any&
     Reference< XControlModel > xNewModel;
     aElement >>= xNewModel;
     if ( !xNewModel.is() )
-        lcl_throwIllegalArgumentException();
+        throw IllegalArgumentException();
 
     UnoControlModelHolderVector::iterator aElementPos = ImplFindElement( aName 
);
     if ( maModels.end() == aElementPos )
-        lcl_throwNoSuchElementException();
+        throw NoSuchElementException();
     // Dialog behaviour is to have all containee names unique (MSO Userform is 
the same)
     // With container controls you could have constructed an existing 
hierarchy and are now
     // add this to an existing container, in this case a name nested in the 
containment
@@ -478,7 +460,7 @@ Any ControlModelContainerBase::getByName( const OUString& 
aName )
 {
     UnoControlModelHolderVector::iterator aElementPos = ImplFindElement( aName 
);
     if ( maModels.end() == aElementPos )
-        lcl_throwNoSuchElementException();
+        throw NoSuchElementException();
 
     return Any( aElementPos->first );
 }
@@ -534,11 +516,11 @@ void ControlModelContainerBase::insertByName( const 
OUString& aName, const Any&
 
 
     if ( aName.isEmpty() || !xM.is() )
-        lcl_throwIllegalArgumentException();
+        throw IllegalArgumentException();
 
     UnoControlModelHolderVector::iterator aElementPos = ImplFindElement( aName 
);
     if ( maModels.end() != aElementPos )
-        lcl_throwElementExistException();
+        throw ElementExistException();
 
     // Dialog behaviour is to have all containee names unique (MSO Userform is 
the same)
     // With container controls you could have constructed an existing 
hierarchy and are now
@@ -571,7 +553,7 @@ void ControlModelContainerBase::removeByName( const 
OUString& aName )
 
     UnoControlModelHolderVector::iterator aElementPos = ImplFindElement( aName 
);
     if ( maModels.end() == aElementPos )
-        lcl_throwNoSuchElementException();
+        throw NoSuchElementException();
 
     // Dialog behaviour is to have all containee names unique (MSO Userform is 
the same)
     // With container controls you could have constructed an existing 
hierarchy and are now

Reply via email to