summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-09-27 09:11:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-09-27 11:02:56 +0200
commitcc1ed7fbce20f90650f96acc2846b6f232c8ab0f (patch)
treefcd441cdf9568861363894f63107967adf571f81
parentFix typos (diff)
downloadcore-cc1ed7fbce20f90650f96acc2846b6f232c8ab0f.tar.gz
core-cc1ed7fbce20f90650f96acc2846b6f232c8ab0f.zip
loplugin:flatten in various
Change-Id: I42dca691ffadbddad38a7e8f978b1da9d5d9a7b0 Reviewed-on: https://gerrit.libreoffice.org/42842 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
-rw-r--r--compilerplugins/clang/flatten.cxx2
-rw-r--r--embeddedobj/source/general/dummyobject.cxx33
-rw-r--r--embeddedobj/source/msole/oleembed.cxx104
-rw-r--r--embeddedobj/source/msole/olepersist.cxx200
-rw-r--r--forms/source/xforms/NameContainer.hxx25
-rw-r--r--forms/source/xforms/binding.cxx26
-rw-r--r--forms/source/xforms/collection.hxx35
-rw-r--r--forms/source/xforms/namedcollection.hxx6
-rw-r--r--framework/source/fwe/helper/propertysetcontainer.cxx83
-rw-r--r--framework/source/fwi/uielement/itemcontainer.cxx56
-rw-r--r--framework/source/fwi/uielement/rootitemcontainer.cxx54
-rw-r--r--framework/source/uiconfiguration/windowstateconfiguration.cxx175
-rw-r--r--framework/source/uielement/menubarwrapper.cxx12
-rw-r--r--framework/source/uielement/statusbarwrapper.cxx23
-rw-r--r--i18npool/source/indexentry/indexentrysupplier_default.cxx21
-rw-r--r--i18npool/source/textconversion/textconversion_ko.cxx142
-rw-r--r--i18npool/source/textconversion/textconversion_zh.cxx56
-rw-r--r--scripting/source/dlgprov/dlgprov.cxx64
-rw-r--r--sd/source/ui/presenter/PresenterTextView.cxx19
-rw-r--r--sfx2/source/doc/DocumentMetadataAccess.cxx62
-rw-r--r--stoc/source/implementationregistration/implreg.cxx107
-rw-r--r--stoc/source/servicemanager/servicemanager.cxx39
-rw-r--r--sw/source/ui/vba/vbasystem.cxx30
23 files changed, 646 insertions, 728 deletions
diff --git a/compilerplugins/clang/flatten.cxx b/compilerplugins/clang/flatten.cxx
index 4ca9d4fc4382..aeb72714b6f8 100644
--- a/compilerplugins/clang/flatten.cxx
+++ b/compilerplugins/clang/flatten.cxx
@@ -344,7 +344,7 @@ std::string Flatten::getSourceAsString(SourceRange range)
return std::string( p1, p2 - p1);
}
-loplugin::Plugin::Registration< Flatten > X("flatten", false);
+loplugin::Plugin::Registration< Flatten > X("flatten", true);
}
diff --git a/embeddedobj/source/general/dummyobject.cxx b/embeddedobj/source/general/dummyobject.cxx
index fa44b4db4286..935ad015fb0b 100644
--- a/embeddedobj/source/general/dummyobject.cxx
+++ b/embeddedobj/source/general/dummyobject.cxx
@@ -293,34 +293,29 @@ void SAL_CALL ODummyEmbeddedObject::setPersistentEntry(
if ( m_bWaitSaveCompleted )
{
- if ( nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
- saveCompleted( m_xParentStorage != xStorage || m_aEntryName != sEntName );
- else
+ if ( nEntryConnectionMode != embed::EntryInitModes::NO_INIT )
throw embed::WrongStateException(
"The object waits for saveCompleted() call!",
static_cast< ::cppu::OWeakObject* >(this) );
- }
- if ( nEntryConnectionMode == embed::EntryInitModes::DEFAULT_INIT
- || nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
- {
- if ( xStorage->hasByName( sEntName ) )
-
- {
- m_xParentStorage = xStorage;
- m_aEntryName = sEntName;
- m_nObjectState = embed::EmbedStates::LOADED;
- }
- else
- throw lang::IllegalArgumentException( "Wrong entry is provided!",
- static_cast< ::cppu::OWeakObject* >(this),
- 2 );
+ saveCompleted( m_xParentStorage != xStorage || m_aEntryName != sEntName );
}
- else
+
+ if ( nEntryConnectionMode != embed::EntryInitModes::DEFAULT_INIT
+ && nEntryConnectionMode != embed::EntryInitModes::NO_INIT )
throw lang::IllegalArgumentException( "Wrong connection mode is provided!",
static_cast< ::cppu::OWeakObject* >(this),
3 );
+
+ if ( !xStorage->hasByName( sEntName ) )
+ throw lang::IllegalArgumentException( "Wrong entry is provided!",
+ static_cast< ::cppu::OWeakObject* >(this),
+ 2 );
+
+ m_xParentStorage = xStorage;
+ m_aEntryName = sEntName;
+ m_nObjectState = embed::EmbedStates::LOADED;
}
diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx
index b00cea109890..e8139480b39d 100644
--- a/embeddedobj/source/msole/oleembed.cxx
+++ b/embeddedobj/source/msole/oleembed.cxx
@@ -903,75 +903,73 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID )
else
#endif
{
- if ( nVerbID == -9 )
+ if ( nVerbID != -9 )
{
- // the workaround verb to show the object in case no server is available
- // if it is possible, the object will be converted to OOo format
- if ( !m_bTriedConversion )
+ throw embed::UnreachableStateException();
+ }
+
+ // the workaround verb to show the object in case no server is available
+
+ // if it is possible, the object will be converted to OOo format
+ if ( !m_bTriedConversion )
+ {
+ m_bTriedConversion = true;
+ if ( TryToConvertToOOo( m_xObjectStream ) )
{
- m_bTriedConversion = true;
- if ( TryToConvertToOOo( m_xObjectStream ) )
- {
- changeState( embed::EmbedStates::ACTIVE );
- return;
- }
+ changeState( embed::EmbedStates::ACTIVE );
+ return;
}
+ }
- if ( !m_xOwnView.is() && m_xObjectStream.is() && m_aFilterName != "Text" )
- {
- try {
- uno::Reference< io::XSeekable > xSeekable( m_xObjectStream, uno::UNO_QUERY );
- if ( xSeekable.is() )
- xSeekable->seek( 0 );
+ if ( !m_xOwnView.is() && m_xObjectStream.is() && m_aFilterName != "Text" )
+ {
+ try {
+ uno::Reference< io::XSeekable > xSeekable( m_xObjectStream, uno::UNO_QUERY );
+ if ( xSeekable.is() )
+ xSeekable->seek( 0 );
- m_xOwnView = new OwnView_Impl( m_xFactory, m_xObjectStream->getInputStream() );
- }
- catch( uno::RuntimeException& )
- {
- throw;
- }
- catch (uno::Exception const& e)
- {
- SAL_WARN("embeddedobj.ole", "OleEmbeddedObject::doVerb: "
- "-9 fallback path: exception caught: " << e.Message);
- }
+ m_xOwnView = new OwnView_Impl( m_xFactory, m_xObjectStream->getInputStream() );
}
-
- // it may be the OLE Storage, try to extract stream
- if ( !m_xOwnView.is() && m_xObjectStream.is() && m_aFilterName == "Text" )
+ catch( uno::RuntimeException& )
{
- uno::Reference< io::XStream > xStream = lcl_ExtractObjectStream( m_xFactory, m_xObjectStream );
-
- if ( TryToConvertToOOo( xStream ) )
- {
- changeState( embed::EmbedStates::ACTIVE );
- return;
- }
+ throw;
}
-
- if (!m_xOwnView.is() || !m_xOwnView->Open())
+ catch (uno::Exception const& e)
{
- //Make a RO copy and see if the OS can find something to at
- //least display the content for us
- if (m_aTempDumpURL.isEmpty())
- m_aTempDumpURL = lcl_ExtractObject(m_xFactory, m_xObjectStream);
+ SAL_WARN("embeddedobj.ole", "OleEmbeddedObject::doVerb: "
+ "-9 fallback path: exception caught: " << e.Message);
+ }
+ }
- if (!m_aTempDumpURL.isEmpty())
- {
- uno::Reference< css::system::XSystemShellExecute > xSystemShellExecute(
- css::system::SystemShellExecute::create(comphelper::getComponentContext(m_xFactory)) );
- xSystemShellExecute->execute(m_aTempDumpURL, OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY);
- }
- else
- throw embed::UnreachableStateException();
+ // it may be the OLE Storage, try to extract stream
+ if ( !m_xOwnView.is() && m_xObjectStream.is() && m_aFilterName == "Text" )
+ {
+ uno::Reference< io::XStream > xStream = lcl_ExtractObjectStream( m_xFactory, m_xObjectStream );
+
+ if ( TryToConvertToOOo( xStream ) )
+ {
+ changeState( embed::EmbedStates::ACTIVE );
+ return;
}
}
- else
+
+ if (!m_xOwnView.is() || !m_xOwnView->Open())
{
+ //Make a RO copy and see if the OS can find something to at
+ //least display the content for us
+ if (m_aTempDumpURL.isEmpty())
+ m_aTempDumpURL = lcl_ExtractObject(m_xFactory, m_xObjectStream);
+
+ if (m_aTempDumpURL.isEmpty())
+ throw embed::UnreachableStateException();
+
+ uno::Reference< css::system::XSystemShellExecute > xSystemShellExecute(
+ css::system::SystemShellExecute::create(comphelper::getComponentContext(m_xFactory)) );
+ xSystemShellExecute->execute(m_aTempDumpURL, OUString(), css::system::SystemShellExecuteFlags::URIS_ONLY);
- throw embed::UnreachableStateException();
}
+
}
}
diff --git a/embeddedobj/source/msole/olepersist.cxx b/embeddedobj/source/msole/olepersist.cxx
index cff38074655a..b8a42b373bc2 100644
--- a/embeddedobj/source/msole/olepersist.cxx
+++ b/embeddedobj/source/msole/olepersist.cxx
@@ -120,15 +120,12 @@ OUString GetNewFilledTempFile_Impl( const uno::Reference< io::XInputStream >& xI
ucb::SimpleFileAccess::create( comphelper::getComponentContext(xFactory) ) );
uno::Reference< io::XOutputStream > xTempOutStream = xTempAccess->openFileWrite( aResult );
- if ( xTempOutStream.is() )
- {
- // copy stream contents to the file
- ::comphelper::OStorageHelper::CopyInputToOutput( xInStream, xTempOutStream );
- xTempOutStream->closeOutput();
- xTempOutStream.clear();
- }
- else
+ if ( !xTempOutStream.is() )
throw io::IOException(); // TODO:
+ // copy stream contents to the file
+ ::comphelper::OStorageHelper::CopyInputToOutput( xInStream, xTempOutStream );
+ xTempOutStream->closeOutput();
+ xTempOutStream.clear();
}
catch( const packages::WrongPasswordException& )
{
@@ -267,14 +264,10 @@ uno::Reference< io::XStream > OleEmbeddedObject::GetNewFilledTempStream_Impl( co
uno::UNO_QUERY_THROW );
uno::Reference< io::XOutputStream > xTempOutStream = xTempFile->getOutputStream();
- if ( xTempOutStream.is() )
- {
- ::comphelper::OStorageHelper::CopyInputToOutput( xInStream, xTempOutStream );
- xTempOutStream->flush();
- }
- else
+ if ( !xTempOutStream.is() )
throw io::IOException(); // TODO:
-
+ ::comphelper::OStorageHelper::CopyInputToOutput( xInStream, xTempOutStream );
+ xTempOutStream->flush();
return xTempFile;
}
@@ -388,110 +381,108 @@ void OleEmbeddedObject::InsertVisualCache_Impl( const uno::Reference< io::XStrea
uno::Reference< io::XSeekable > xTempSeek( xTempFile, uno::UNO_QUERY_THROW );
uno::Reference< io::XOutputStream > xTempOutStream = xTempFile->getOutputStream();
- if ( xTempOutStream.is() )
- {
- // the OlePres stream must have additional header
- // TODO/LATER: might need to be extended in future (actually makes sense only for SO7 format)
- uno::Reference< io::XInputStream > xInCacheStream = xCachedVisualRepresentation->getInputStream();
- if ( !xInCacheStream.is() )
- throw uno::RuntimeException();
+ if ( !xTempOutStream.is() )
+ throw io::IOException(); // TODO:
- // write 0xFFFFFFFF at the beginning
- uno::Sequence< sal_Int8 > aData( 4 );
- * reinterpret_cast<sal_uInt32*>(aData.getArray()) = 0xFFFFFFFF;
+ // the OlePres stream must have additional header
+ // TODO/LATER: might need to be extended in future (actually makes sense only for SO7 format)
+ uno::Reference< io::XInputStream > xInCacheStream = xCachedVisualRepresentation->getInputStream();
+ if ( !xInCacheStream.is() )
+ throw uno::RuntimeException();
- xTempOutStream->writeBytes( aData );
+ // write 0xFFFFFFFF at the beginning
+ uno::Sequence< sal_Int8 > aData( 4 );
+ * reinterpret_cast<sal_uInt32*>(aData.getArray()) = 0xFFFFFFFF;
- // write clipboard format
- uno::Sequence< sal_Int8 > aSigData( 2 );
- xInCacheStream->readBytes( aSigData, 2 );
- if ( aSigData.getLength() < 2 )
- throw io::IOException();
+ xTempOutStream->writeBytes( aData );
- if ( aSigData[0] == 'B' && aSigData[1] == 'M' )
- {
- // it's a bitmap
- aData[0] = 0x02; aData[1] = 0; aData[2] = 0; aData[3] = 0;
- }
- else
- {
- // treat it as a metafile
- aData[0] = 0x03; aData[1] = 0; aData[2] = 0; aData[3] = 0;
- }
- xTempOutStream->writeBytes( aData );
+ // write clipboard format
+ uno::Sequence< sal_Int8 > aSigData( 2 );
+ xInCacheStream->readBytes( aSigData, 2 );
+ if ( aSigData.getLength() < 2 )
+ throw io::IOException();
- // write job related information
- aData[0] = 0x04; aData[1] = 0; aData[2] = 0; aData[3] = 0;
- xTempOutStream->writeBytes( aData );
+ if ( aSigData[0] == 'B' && aSigData[1] == 'M' )
+ {
+ // it's a bitmap
+ aData[0] = 0x02; aData[1] = 0; aData[2] = 0; aData[3] = 0;
+ }
+ else
+ {
+ // treat it as a metafile
+ aData[0] = 0x03; aData[1] = 0; aData[2] = 0; aData[3] = 0;
+ }
+ xTempOutStream->writeBytes( aData );
- // write aspect
- aData[0] = 0x01; aData[1] = 0; aData[2] = 0; aData[3] = 0;
- xTempOutStream->writeBytes( aData );
+ // write job related information
+ aData[0] = 0x04; aData[1] = 0; aData[2] = 0; aData[3] = 0;
+ xTempOutStream->writeBytes( aData );
- // write l-index
- * reinterpret_cast<sal_uInt32*>(aData.getArray()) = 0xFFFFFFFF;
- xTempOutStream->writeBytes( aData );
+ // write aspect
+ aData[0] = 0x01; aData[1] = 0; aData[2] = 0; aData[3] = 0;
+ xTempOutStream->writeBytes( aData );
- // write adv. flags
- aData[0] = 0x02; aData[1] = 0; aData[2] = 0; aData[3] = 0;
- xTempOutStream->writeBytes( aData );
+ // write l-index
+ * reinterpret_cast<sal_uInt32*>(aData.getArray()) = 0xFFFFFFFF;
+ xTempOutStream->writeBytes( aData );
- // write compression
- * reinterpret_cast<sal_uInt32*>(aData.getArray()) = 0x0;
- xTempOutStream->writeBytes( aData );
+ // write adv. flags
+ aData[0] = 0x02; aData[1] = 0; aData[2] = 0; aData[3] = 0;
+ xTempOutStream->writeBytes( aData );
- // get the size
- awt::Size aSize = getVisualAreaSize( embed::Aspects::MSOLE_CONTENT );
- sal_Int32 nIndex = 0;
+ // write compression
+ * reinterpret_cast<sal_uInt32*>(aData.getArray()) = 0x0;
+ xTempOutStream->writeBytes( aData );
- // write width
- for ( nIndex = 0; nIndex < 4; nIndex++ )
- {
- aData[nIndex] = (sal_Int8)( aSize.Width % 0x100 );
- aSize.Width /= 0x100;
- }
- xTempOutStream->writeBytes( aData );
-
- // write height
- for ( nIndex = 0; nIndex < 4; nIndex++ )
- {
- aData[nIndex] = (sal_Int8)( aSize.Height % 0x100 );
- aSize.Height /= 0x100;
- }
- xTempOutStream->writeBytes( aData );
+ // get the size
+ awt::Size aSize = getVisualAreaSize( embed::Aspects::MSOLE_CONTENT );
+ sal_Int32 nIndex = 0;
- // write garbage, it will be overwritten by the size
- xTempOutStream->writeBytes( aData );
+ // write width
+ for ( nIndex = 0; nIndex < 4; nIndex++ )
+ {
+ aData[nIndex] = (sal_Int8)( aSize.Width % 0x100 );
+ aSize.Width /= 0x100;
+ }
+ xTempOutStream->writeBytes( aData );
- // write first bytes that was used to detect the type
- xTempOutStream->writeBytes( aSigData );
+ // write height
+ for ( nIndex = 0; nIndex < 4; nIndex++ )
+ {
+ aData[nIndex] = (sal_Int8)( aSize.Height % 0x100 );
+ aSize.Height /= 0x100;
+ }
+ xTempOutStream->writeBytes( aData );
- // write the rest of the stream
- ::comphelper::OStorageHelper::CopyInputToOutput( xInCacheStream, xTempOutStream );
+ // write garbage, it will be overwritten by the size
+ xTempOutStream->writeBytes( aData );
- // write the size of the stream
- sal_Int64 nLength = xTempSeek->getLength() - 40;
- if ( nLength < 0 || nLength >= 0xFFFFFFFF )
- {
- SAL_WARN( "embeddedobj.ole", "Length is not acceptable!" );
- return;
- }
- for ( sal_Int32 nInd = 0; nInd < 4; nInd++ )
- {
- aData[nInd] = (sal_Int8)( ( (sal_uInt64) nLength ) % 0x100 );
- nLength /= 0x100;
- }
- xTempSeek->seek( 36 );
- xTempOutStream->writeBytes( aData );
+ // write first bytes that was used to detect the type
+ xTempOutStream->writeBytes( aSigData );
- xTempOutStream->flush();
+ // write the rest of the stream
+ ::comphelper::OStorageHelper::CopyInputToOutput( xInCacheStream, xTempOutStream );
- xTempSeek->seek( 0 );
- if ( xCachedSeek.is() )
- xCachedSeek->seek( 0 );
+ // write the size of the stream
+ sal_Int64 nLength = xTempSeek->getLength() - 40;
+ if ( nLength < 0 || nLength >= 0xFFFFFFFF )
+ {
+ SAL_WARN( "embeddedobj.ole", "Length is not acceptable!" );
+ return;
}
- else
- throw io::IOException(); // TODO:
+ for ( sal_Int32 nInd = 0; nInd < 4; nInd++ )
+ {
+ aData[nInd] = (sal_Int8)( ( (sal_uInt64) nLength ) % 0x100 );
+ nLength /= 0x100;
+ }
+ xTempSeek->seek( 36 );
+ xTempOutStream->writeBytes( aData );
+
+ xTempOutStream->flush();
+
+ xTempSeek->seek( 0 );
+ if ( xCachedSeek.is() )
+ xCachedSeek->seek( 0 );
// insert the result file as replacement image
OUString aCacheName = "\002OlePres000";
@@ -1164,7 +1155,7 @@ void OleEmbeddedObject::StoreToLocation_Impl(
}
}
#endif
- else
+ else if (true) // loplugin:flatten
{
throw io::IOException(); // TODO
}
@@ -1304,12 +1295,11 @@ void SAL_CALL OleEmbeddedObject::setPersistentEntry(
if ( m_bWaitSaveCompleted )
{
- if ( nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
- saveCompleted( m_xParentStorage != xStorage || m_aEntryName != sEntName );
- else
+ if ( nEntryConnectionMode != embed::EntryInitModes::NO_INIT )
throw embed::WrongStateException(
"The object waits for saveCompleted() call!",
static_cast< ::cppu::OWeakObject* >(this) );
+ saveCompleted( m_xParentStorage != xStorage || m_aEntryName != sEntName );
}
uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY_THROW );
diff --git a/forms/source/xforms/NameContainer.hxx b/forms/source/xforms/NameContainer.hxx
index f5aad0950ea2..99a667a1baca 100644
--- a/forms/source/xforms/NameContainer.hxx
+++ b/forms/source/xforms/NameContainer.hxx
@@ -127,13 +127,11 @@ public:
const css::uno::Any& aElement ) override
{
T aItem;
- if( aElement >>= aItem )
- if( hasByName( rName ) )
- replace( rName, aItem );
- else
- throw css::container::NoSuchElementException();
- else
+ if( !(aElement >>= aItem) )
throw css::lang::IllegalArgumentException();
+ if( !hasByName( rName ) )
+ throw css::container::NoSuchElementException();
+ replace( rName, aItem );
}
@@ -145,22 +143,19 @@ public:
const css::uno::Any& aElement ) override
{
T aItem;
- if( aElement >>= aItem )
- if( ! hasByName( rName ) )
- insert( rName, aItem );
- else
- throw css::container::ElementExistException();
- else
+ if( !(aElement >>= aItem) )
throw css::lang::IllegalArgumentException();
+ if( hasByName( rName ) )
+ throw css::container::ElementExistException();
+ insert( rName, aItem );
}
virtual void SAL_CALL removeByName(
const OUString& rName ) override
{
- if( hasByName( rName ) )
- remove( rName );
- else
+ if( !hasByName( rName ) )
throw css::container::NoSuchElementException();
+ remove( rName );
}
};
diff --git a/forms/source/xforms/binding.cxx b/forms/source/xforms/binding.cxx
index 247286ad643d..2b9cc9f97390 100644
--- a/forms/source/xforms/binding.cxx
+++ b/forms/source/xforms/binding.cxx
@@ -1028,21 +1028,19 @@ void Binding::setValue( const css::uno::Any& aValue )
if( ! supportsType( aValue.getValueType() ) )
throw IncompatibleTypesException( EXCEPT( "type unsupported" ) );
- if( maBindingExpression.hasValue() )
- {
- css::uno::Reference<css::xml::dom::XNode> xNode = maBindingExpression.getNode();
- if( xNode.is() )
- {
- OUString sValue = Convert::get().toXSD( aValue );
- bool bSuccess = getModelImpl()->setSimpleContent( xNode, sValue );
- if( ! bSuccess )
- throw InvalidBindingStateException( EXCEPT( "can't set value" ) );
- }
- else
- throw InvalidBindingStateException( EXCEPT( "no suitable node found" ) );
- }
- else
+ if( !maBindingExpression.hasValue() )
throw InvalidBindingStateException( EXCEPT( "no suitable node found" ) );
+
+ css::uno::Reference<css::xml::dom::XNode> xNode = maBindingExpression.getNode();
+ if( !xNode.is() )
+ throw InvalidBindingStateException( EXCEPT( "no suitable node found" ) );
+
+ OUString sValue = Convert::get().toXSD( aValue );
+ bool bSuccess = getModelImpl()->setSimpleContent( xNode, sValue );
+ if( ! bSuccess )
+ throw InvalidBindingStateException( EXCEPT( "can't set value" ) );
+
+
}
diff --git a/forms/source/xforms/collection.hxx b/forms/source/xforms/collection.hxx
index fe40dc4c9633..f38d75ce458c 100644
--- a/forms/source/xforms/collection.hxx
+++ b/forms/source/xforms/collection.hxx
@@ -162,10 +162,9 @@ public:
virtual css::uno::Any SAL_CALL getByIndex( sal_Int32 nIndex ) override
{
- if( isValidIndex( nIndex ) )
- return css::uno::makeAny( getItem( nIndex ) );
- else
+ if( !isValidIndex( nIndex ) )
throw css::lang::IndexOutOfBoundsException();
+ return css::uno::makeAny( getItem( nIndex ) );
}
// XIndexReplace : XIndexAccess
@@ -173,13 +172,11 @@ public:
const css::uno::Any& aElement ) override
{
T t;
- if( isValidIndex( nIndex) )
- if( ( aElement >>= t ) && isValid( t ) )
- setItem( nIndex, t );
- else
- throw css::lang::IllegalArgumentException();
- else
+ if( !isValidIndex( nIndex) )
throw css::lang::IndexOutOfBoundsException();
+ if( !( aElement >>= t ) || !isValid( t ) )
+ throw css::lang::IllegalArgumentException();
+ setItem( nIndex, t );
}
// XEnumerationAccess : XElementAccess
@@ -199,25 +196,21 @@ public:
virtual void SAL_CALL insert( const css::uno::Any& aElement ) override
{
T t;
- if( ( aElement >>= t ) && isValid( t ) )
- if( ! hasItem( t ) )
- addItem( t );
- else
- throw css::container::ElementExistException();
- else
+ if( !( aElement >>= t ) || !isValid( t ) )
throw css::lang::IllegalArgumentException();
+ if( hasItem( t ) )
+ throw css::container::ElementExistException();
+ addItem( t );
}
virtual void SAL_CALL remove( const css::uno::Any& aElement ) override
{
T t;
- if( aElement >>= t )
- if( hasItem( t ) )
- removeItem( t );
- else
- throw css::container::NoSuchElementException();
- else
+ if( !(aElement >>= t) )
throw css::lang::IllegalArgumentException();
+ if( !hasItem( t ) )
+ throw css::container::NoSuchElementException();
+ removeItem( t );
}
diff --git a/forms/source/xforms/namedcollection.hxx b/forms/source/xforms/namedcollection.hxx
index c0a31bd99b83..7546ba271035 100644
--- a/forms/source/xforms/namedcollection.hxx
+++ b/forms/source/xforms/namedcollection.hxx
@@ -98,11 +98,9 @@ public:
virtual css::uno::Any SAL_CALL getByName(
const OUString& aName ) override
{
- if( hasItem( aName ) )
- return css::uno::makeAny( getItem( aName ) );
- else
+ if( !hasItem( aName ) )
throw css::container::NoSuchElementException();
-
+ return css::uno::makeAny( getItem( aName ) );
}
virtual css::uno::Sequence<OUString> SAL_CALL getElementNames() override
diff --git a/framework/source/fwe/helper/propertysetcontainer.cxx b/framework/source/fwe/helper/propertysetcontainer.cxx
index 9f856691e343..5051d776f470 100644
--- a/framework/source/fwe/helper/propertysetcontainer.cxx
+++ b/framework/source/fwe/helper/propertysetcontainer.cxx
@@ -79,64 +79,54 @@ void SAL_CALL PropertySetContainer::insertByIndex( sal_Int32 Index, const css::u
sal_Int32 nSize = m_aPropertySetVector.size();
- if ( nSize >= Index )
+ if ( nSize < Index )
+ throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
+
+ Reference< XPropertySet > aPropertySetElement;
+
+ if ( !(Element >>= aPropertySetElement) )
{
- Reference< XPropertySet > aPropertySetElement;
-
- if ( Element >>= aPropertySetElement )
- {
- if ( nSize == Index )
- m_aPropertySetVector.push_back( aPropertySetElement );
- else
- {
- PropertySetVector::iterator aIter = m_aPropertySetVector.begin();
- aIter += Index;
- m_aPropertySetVector.insert( aIter, aPropertySetElement );
- }
- }
- else
- {
- throw IllegalArgumentException(
- WRONG_TYPE_EXCEPTION,
- static_cast<OWeakObject *>(this), 2 );
- }
+ throw IllegalArgumentException(
+ WRONG_TYPE_EXCEPTION,
+ static_cast<OWeakObject *>(this), 2 );
}
+
+ if ( nSize == Index )
+ m_aPropertySetVector.push_back( aPropertySetElement );
else
- throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
+ {
+ PropertySetVector::iterator aIter = m_aPropertySetVector.begin();
+ aIter += Index;
+ m_aPropertySetVector.insert( aIter, aPropertySetElement );
+ }
}
void SAL_CALL PropertySetContainer::removeByIndex( sal_Int32 nIndex )
{
SolarMutexGuard g;
- if ( (sal_Int32)m_aPropertySetVector.size() > nIndex )
- {
- m_aPropertySetVector.erase(m_aPropertySetVector.begin() + nIndex);
- }
- else
+ if ( !((sal_Int32)m_aPropertySetVector.size() > nIndex) )
throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
+
+ m_aPropertySetVector.erase(m_aPropertySetVector.begin() + nIndex);
}
// XIndexReplace
void SAL_CALL PropertySetContainer::replaceByIndex( sal_Int32 Index, const css::uno::Any& Element )
{
- if ( (sal_Int32)m_aPropertySetVector.size() > Index )
+ if ( !((sal_Int32)m_aPropertySetVector.size() > Index) )
+ throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
+
+ Reference< XPropertySet > aPropertySetElement;
+
+ if ( !(Element >>= aPropertySetElement) )
{
- Reference< XPropertySet > aPropertySetElement;
-
- if ( Element >>= aPropertySetElement )
- {
- m_aPropertySetVector[ Index ] = aPropertySetElement;
- }
- else
- {
- throw IllegalArgumentException(
- WRONG_TYPE_EXCEPTION,
- static_cast<OWeakObject *>(this), 2 );
- }
+ throw IllegalArgumentException(
+ WRONG_TYPE_EXCEPTION,
+ static_cast<OWeakObject *>(this), 2 );
}
- else
- throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
+
+ m_aPropertySetVector[ Index ] = aPropertySetElement;
}
// XIndexAccess
@@ -151,15 +141,10 @@ Any SAL_CALL PropertySetContainer::getByIndex( sal_Int32 Index )
{
SolarMutexGuard g;
- if ( (sal_Int32)m_aPropertySetVector.size() > Index )
- {
- Any a;
-
- a <<= m_aPropertySetVector[ Index ];
- return a;
- }
- else
+ if ( (sal_Int32)m_aPropertySetVector.size() <= Index )
throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
+
+ return Any(m_aPropertySetVector[ Index ]);
}
// XElementAccess
diff --git a/framework/source/fwi/uielement/itemcontainer.cxx b/framework/source/fwi/uielement/itemcontainer.cxx
index fd9149376162..ec57f33b07a4 100644
--- a/framework/source/fwi/uielement/itemcontainer.cxx
+++ b/framework/source/fwi/uielement/itemcontainer.cxx
@@ -166,60 +166,54 @@ sal_Int32 SAL_CALL ItemContainer::getCount()
Any SAL_CALL ItemContainer::getByIndex( sal_Int32 Index )
{
ShareGuard aLock( m_aShareMutex );
- if ( sal_Int32( m_aItemVector.size()) > Index )
- return makeAny( m_aItemVector[Index] );
- else
+ if ( sal_Int32( m_aItemVector.size()) <= Index )
throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
+
+ return makeAny( m_aItemVector[Index] );
}
// XIndexContainer
void SAL_CALL ItemContainer::insertByIndex( sal_Int32 Index, const Any& aItem )
{
Sequence< PropertyValue > aSeq;
- if ( aItem >>= aSeq )
+ if ( !(aItem >>= aSeq) )
+ throw IllegalArgumentException( WRONG_TYPE_EXCEPTION,
+ static_cast<OWeakObject *>(this), 2 );
+
+ ShareGuard aLock( m_aShareMutex );
+ if ( sal_Int32( m_aItemVector.size()) == Index )
+ m_aItemVector.push_back( aSeq );
+ else if ( sal_Int32( m_aItemVector.size()) >Index )
{
- ShareGuard aLock( m_aShareMutex );
- if ( sal_Int32( m_aItemVector.size()) == Index )
- m_aItemVector.push_back( aSeq );
- else if ( sal_Int32( m_aItemVector.size()) >Index )
- {
- std::vector< Sequence< PropertyValue > >::iterator aIter = m_aItemVector.begin();
- aIter += Index;
- m_aItemVector.insert( aIter, aSeq );
- }
- else
- throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
+ std::vector< Sequence< PropertyValue > >::iterator aIter = m_aItemVector.begin();
+ aIter += Index;
+ m_aItemVector.insert( aIter, aSeq );
}
else
- throw IllegalArgumentException( WRONG_TYPE_EXCEPTION,
- static_cast<OWeakObject *>(this), 2 );
+ throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
}
void SAL_CALL ItemContainer::removeByIndex( sal_Int32 nIndex )
{
ShareGuard aLock( m_aShareMutex );
- if ( (sal_Int32)m_aItemVector.size() > nIndex )
- {
- m_aItemVector.erase(m_aItemVector.begin() + nIndex);
- }
- else
+ if ( (sal_Int32)m_aItemVector.size() <= nIndex )
throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
+
+ m_aItemVector.erase(m_aItemVector.begin() + nIndex);
}
void SAL_CALL ItemContainer::replaceByIndex( sal_Int32 Index, const Any& aItem )
{
Sequence< PropertyValue > aSeq;
- if ( aItem >>= aSeq )
- {
- ShareGuard aLock( m_aShareMutex );
- if ( sal_Int32( m_aItemVector.size()) > Index )
- m_aItemVector[Index] = aSeq;
- else
- throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
- }
- else
+ if ( !(aItem >>= aSeq) )
throw IllegalArgumentException( WRONG_TYPE_EXCEPTION,
static_cast<OWeakObject *>(this), 2 );
+
+ ShareGuard aLock( m_aShareMutex );
+ if ( !(sal_Int32( m_aItemVector.size()) > Index) )
+ throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
+
+ m_aItemVector[Index] = aSeq;
}
} // namespace framework
diff --git a/framework/source/fwi/uielement/rootitemcontainer.cxx b/framework/source/fwi/uielement/rootitemcontainer.cxx
index 5b065a835f3c..72f41e761a1e 100644
--- a/framework/source/fwi/uielement/rootitemcontainer.cxx
+++ b/framework/source/fwi/uielement/rootitemcontainer.cxx
@@ -182,58 +182,52 @@ sal_Int32 SAL_CALL RootItemContainer::getCount()
Any SAL_CALL RootItemContainer::getByIndex( sal_Int32 Index )
{
ShareGuard aLock( m_aShareMutex );
- if ( sal_Int32( m_aItemVector.size()) > Index )
- return makeAny( m_aItemVector[Index] );
- else
+ if ( sal_Int32( m_aItemVector.size()) <= Index )
throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
+
+ return makeAny( m_aItemVector[Index] );
}
// XIndexContainer
void SAL_CALL RootItemContainer::insertByIndex( sal_Int32 Index, const Any& aItem )
{
Sequence< PropertyValue > aSeq;
- if ( aItem >>= aSeq )
+ if ( !(aItem >>= aSeq) )
+ throw IllegalArgumentException( WRONG_TYPE_EXCEPTION, static_cast<OWeakObject *>(this), 2 );
+
+ ShareGuard aLock( m_aShareMutex );
+ if ( sal_Int32( m_aItemVector.size()) == Index )
+ m_aItemVector.push_back( aSeq );
+ else if ( sal_Int32( m_aItemVector.size()) >Index )
{
- ShareGuard aLock( m_aShareMutex );
- if ( sal_Int32( m_aItemVector.size()) == Index )
- m_aItemVector.push_back( aSeq );
- else if ( sal_Int32( m_aItemVector.size()) >Index )
- {
- std::vector< Sequence< PropertyValue > >::iterator aIter = m_aItemVector.begin();
- aIter += Index;
- m_aItemVector.insert( aIter, aSeq );
- }
- else
- throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
+ std::vector< Sequence< PropertyValue > >::iterator aIter = m_aItemVector.begin();
+ aIter += Index;
+ m_aItemVector.insert( aIter, aSeq );
}
else
- throw IllegalArgumentException( WRONG_TYPE_EXCEPTION, static_cast<OWeakObject *>(this), 2 );
+ throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
}
void SAL_CALL RootItemContainer::removeByIndex( sal_Int32 nIndex )
{
ShareGuard aLock( m_aShareMutex );
- if ( (sal_Int32)m_aItemVector.size() > nIndex )
- {
- m_aItemVector.erase(m_aItemVector.begin() + nIndex);
- }
- else
+ if ( (sal_Int32)m_aItemVector.size() <= nIndex )
throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
+
+ m_aItemVector.erase(m_aItemVector.begin() + nIndex);
}
void SAL_CALL RootItemContainer::replaceByIndex( sal_Int32 Index, const Any& aItem )
{
Sequence< PropertyValue > aSeq;
- if ( aItem >>= aSeq )
- {
- ShareGuard aLock( m_aShareMutex );
- if ( sal_Int32( m_aItemVector.size()) > Index )
- m_aItemVector[Index] = aSeq;
- else
- throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
- }
- else
+ if ( !(aItem >>= aSeq) )
throw IllegalArgumentException( WRONG_TYPE_EXCEPTION, static_cast<OWeakObject *>(this), 2 );
+
+ ShareGuard aLock( m_aShareMutex );
+ if ( !(sal_Int32( m_aItemVector.size()) > Index) )
+ throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
+
+ m_aItemVector[Index] = aSeq;
}
Reference< XInterface > SAL_CALL RootItemContainer::createInstanceWithContext( const Reference< XComponentContext >& )
diff --git a/framework/source/uiconfiguration/windowstateconfiguration.cxx b/framework/source/uiconfiguration/windowstateconfiguration.cxx
index 024fa761e823..97c71e7a39b4 100644
--- a/framework/source/uiconfiguration/windowstateconfiguration.cxx
+++ b/framework/source/uiconfiguration/windowstateconfiguration.cxx
@@ -359,61 +359,60 @@ void SAL_CALL ConfigurationAccess_WindowState::insertByName( const OUString& rRe
osl::ResettableMutexGuard g(m_aMutex);
Sequence< PropertyValue > aPropSet;
- if ( aPropertySet >>= aPropSet )
+ if ( !(aPropertySet >>= aPropSet) )
+ throw IllegalArgumentException();
+
+ ResourceURLToInfoCache::const_iterator pIter = m_aResourceURLToInfoCache.find( rResourceURL );
+ if ( pIter != m_aResourceURLToInfoCache.end() )
+ throw ElementExistException();
+ else
{
- ResourceURLToInfoCache::const_iterator pIter = m_aResourceURLToInfoCache.find( rResourceURL );
- if ( pIter != m_aResourceURLToInfoCache.end() )
- throw ElementExistException();
- else
+ if ( !m_bConfigAccessInitialized )
{
- if ( !m_bConfigAccessInitialized )
- {
- impl_initializeConfigAccess();
- m_bConfigAccessInitialized = true;
- }
+ impl_initializeConfigAccess();
+ m_bConfigAccessInitialized = true;
+ }
- // Try to ask our configuration access
- if ( m_xConfigAccess.is() )
+ // Try to ask our configuration access
+ if ( m_xConfigAccess.is() )
+ {
+ if ( m_xConfigAccess->hasByName( rResourceURL ) )
+ throw ElementExistException();
+ else
{
- if ( m_xConfigAccess->hasByName( rResourceURL ) )
- throw ElementExistException();
- else
+ WindowStateInfo aWinStateInfo;
+ impl_fillStructFromSequence( aWinStateInfo, aPropSet );
+ m_aResourceURLToInfoCache.emplace( rResourceURL, aWinStateInfo );
+
+ // insert must be write-through => insert element into configuration
+ Reference< XNameContainer > xNameContainer( m_xConfigAccess, UNO_QUERY );
+ if ( xNameContainer.is() )
{
- WindowStateInfo aWinStateInfo;
- impl_fillStructFromSequence( aWinStateInfo, aPropSet );
- m_aResourceURLToInfoCache.emplace( rResourceURL, aWinStateInfo );
+ Reference< XSingleServiceFactory > xFactory( m_xConfigAccess, UNO_QUERY );
+ g.clear();
- // insert must be write-through => insert element into configuration
- Reference< XNameContainer > xNameContainer( m_xConfigAccess, UNO_QUERY );
- if ( xNameContainer.is() )
+ try
{
- Reference< XSingleServiceFactory > xFactory( m_xConfigAccess, UNO_QUERY );
- g.clear();
-
- try
- {
- Reference< XPropertySet > xPropSet( xFactory->createInstance(), UNO_QUERY );
- if ( xPropSet.is() )
- {
- Any a;
- impl_putPropertiesFromStruct( aWinStateInfo, xPropSet );
- a <<= xPropSet;
- xNameContainer->insertByName( rResourceURL, a );
- Reference< XChangesBatch > xFlush( xFactory, UNO_QUERY );
- if ( xFlush.is() )
- xFlush->commitChanges();
- }
- }
- catch ( const Exception& )
+ Reference< XPropertySet > xPropSet( xFactory->createInstance(), UNO_QUERY );
+ if ( xPropSet.is() )
{
+ Any a;
+ impl_putPropertiesFromStruct( aWinStateInfo, xPropSet );
+ a <<= xPropSet;
+ xNameContainer->insertByName( rResourceURL, a );
+ Reference< XChangesBatch > xFlush( xFactory, UNO_QUERY );
+ if ( xFlush.is() )
+ xFlush->commitChanges();
}
}
+ catch ( const Exception& )
+ {
+ }
}
}
}
}
- else
- throw IllegalArgumentException();
+
}
// XNameReplace
@@ -423,68 +422,66 @@ void SAL_CALL ConfigurationAccess_WindowState::replaceByName( const OUString& rR
osl::ResettableMutexGuard g(m_aMutex);
Sequence< PropertyValue > aPropSet;
- if ( aPropertySet >>= aPropSet )
+ if ( !(aPropertySet >>= aPropSet) )
+ throw IllegalArgumentException();
+
+ ResourceURLToInfoCache::iterator pIter = m_aResourceURLToInfoCache.find( rResourceURL );
+ if ( pIter != m_aResourceURLToInfoCache.end() )
+ {
+ WindowStateInfo& rWinStateInfo = pIter->second;
+ impl_fillStructFromSequence( rWinStateInfo, aPropSet );
+ m_bModified = true;
+ }
+ else
{
- ResourceURLToInfoCache::iterator pIter = m_aResourceURLToInfoCache.find( rResourceURL );
- if ( pIter != m_aResourceURLToInfoCache.end() )
+ if ( !m_bConfigAccessInitialized )
{
- WindowStateInfo& rWinStateInfo = pIter->second;
- impl_fillStructFromSequence( rWinStateInfo, aPropSet );
- m_bModified = true;
+ impl_initializeConfigAccess();
+ m_bConfigAccessInitialized = true;
}
- else
- {
- if ( !m_bConfigAccessInitialized )
- {
- impl_initializeConfigAccess();
- m_bConfigAccessInitialized = true;
- }
- // Try to ask our configuration access
- Reference< XNameAccess > xNameAccess;
- Any a( m_xConfigAccess->getByName( rResourceURL ));
+ // Try to ask our configuration access
+ Reference< XNameAccess > xNameAccess;
+ Any a( m_xConfigAccess->getByName( rResourceURL ));
- if ( a >>= xNameAccess )
- {
- WindowStateInfo& rWinStateInfo( impl_insertCacheAndReturnWinState( rResourceURL, xNameAccess ));
- impl_fillStructFromSequence( rWinStateInfo, aPropSet );
- m_bModified = true;
- pIter = m_aResourceURLToInfoCache.find( rResourceURL );
- }
- else
- throw NoSuchElementException();
- }
+ if ( !(a >>= xNameAccess) )
+ throw NoSuchElementException();
+
+ WindowStateInfo& rWinStateInfo( impl_insertCacheAndReturnWinState( rResourceURL, xNameAccess ));
+ impl_fillStructFromSequence( rWinStateInfo, aPropSet );
+ m_bModified = true;
+ pIter = m_aResourceURLToInfoCache.find( rResourceURL );
- if ( m_bModified && pIter != m_aResourceURLToInfoCache.end() )
+ }
+
+ if ( m_bModified && pIter != m_aResourceURLToInfoCache.end() )
+ {
+ Reference< XNameContainer > xNameContainer( m_xConfigAccess, UNO_QUERY );
+ if ( xNameContainer.is() )
{
- Reference< XNameContainer > xNameContainer( m_xConfigAccess, UNO_QUERY );
- if ( xNameContainer.is() )
- {
- WindowStateInfo aWinStateInfo( pIter->second );
- OUString aResourceURL( pIter->first );
- m_bModified = false;
- g.clear();
+ WindowStateInfo aWinStateInfo( pIter->second );
+ OUString aResourceURL( pIter->first );
+ m_bModified = false;
+ g.clear();
- try
+ try
+ {
+ Reference< XPropertySet > xPropSet;
+ if ( xNameContainer->getByName( aResourceURL ) >>= xPropSet )
{
- Reference< XPropertySet > xPropSet;
- if ( xNameContainer->getByName( aResourceURL ) >>= xPropSet )
- {
- impl_putPropertiesFromStruct( aWinStateInfo, xPropSet );
+ impl_putPropertiesFromStruct( aWinStateInfo, xPropSet );
- Reference< XChangesBatch > xFlush( m_xConfigAccess, UNO_QUERY );
- if ( xFlush.is() )
- xFlush->commitChanges();
- }
- }
- catch ( const Exception& )
- {
+ Reference< XChangesBatch > xFlush( m_xConfigAccess, UNO_QUERY );
+ if ( xFlush.is() )
+ xFlush->commitChanges();
}
}
+ catch ( const Exception& )
+ {
+ }
}
}
- else
- throw IllegalArgumentException();
+
}
// container.XContainerListener
diff --git a/framework/source/uielement/menubarwrapper.cxx b/framework/source/uielement/menubarwrapper.cxx
index 9fc4ccee6167..68357213e697 100644
--- a/framework/source/uielement/menubarwrapper.cxx
+++ b/framework/source/uielement/menubarwrapper.cxx
@@ -277,14 +277,12 @@ Any SAL_CALL MenuBarWrapper::getByName(
fillPopupControllerCache();
PopupControllerCache::const_iterator pIter = m_aPopupControllerCache.find( aName );
- if ( pIter != m_aPopupControllerCache.end() )
- {
- uno::Reference< frame::XDispatchProvider > xDispatchProvider;
- xDispatchProvider = pIter->second.m_xDispatchProvider;
- return uno::makeAny( xDispatchProvider );
- }
- else
+ if ( pIter == m_aPopupControllerCache.end() )
throw container::NoSuchElementException();
+
+ uno::Reference< frame::XDispatchProvider > xDispatchProvider;
+ xDispatchProvider = pIter->second.m_xDispatchProvider;
+ return uno::makeAny( xDispatchProvider );
}
Sequence< OUString > SAL_CALL MenuBarWrapper::getElementNames()
diff --git a/framework/source/uielement/statusbarwrapper.cxx b/framework/source/uielement/statusbarwrapper.cxx
index 2cf60b555e1a..003d6b5b00ba 100644
--- a/framework/source/uielement/statusbarwrapper.cxx
+++ b/framework/source/uielement/statusbarwrapper.cxx
@@ -69,19 +69,18 @@ void SAL_CALL StatusBarWrapper::dispose()
m_aListenerContainer.disposeAndClear( aEvent );
SolarMutexGuard g;
- if ( !m_bDisposed )
- {
- if ( m_xStatusBarManager.is() )
- m_xStatusBarManager->dispose();
- m_xStatusBarManager.clear();
- m_xConfigSource.clear();
- m_xConfigData.clear();
- m_xContext.clear();
-
- m_bDisposed = true;
- }
- else
+ if ( m_bDisposed )
throw DisposedException();
+
+ if ( m_xStatusBarManager.is() )
+ m_xStatusBarManager->dispose();
+ m_xStatusBarManager.clear();
+ m_xConfigSource.clear();
+ m_xConfigData.clear();
+ m_xContext.clear();
+
+ m_bDisposed = true;
+
}
// XInitialization
diff --git a/i18npool/source/indexentry/indexentrysupplier_default.cxx b/i18npool/source/indexentry/indexentrysupplier_default.cxx
index 419d84c80c5e..d0673a9d50ed 100644
--- a/i18npool/source/indexentry/indexentrysupplier_default.cxx
+++ b/i18npool/source/indexentry/indexentrysupplier_default.cxx
@@ -187,15 +187,15 @@ void Index::makeIndexKeys(const lang::Locale &rLocale, const OUString &algorithm
continue;
switch(curr) {
- case u'-':
- if (key_count > 0 && i + 1 < len ) {
+ case u'-': {
+ if (key_count <= 0 || i + 1 >= len)
+ throw RuntimeException();
for (curr = keyStr[++i]; key_count < MAX_KEYS && keys[key_count-1].key < curr; key_count++) {
keys[key_count].key = keys[key_count-1].key+1;
keys[key_count].desc.clear();
}
- } else
- throw RuntimeException();
- break;
+ break;
+ }
case u'[':
for (i++; i < len && keyStr[i] != ']'; i++) {
if (unicode::isWhiteSpace(keyStr[i])) {
@@ -212,8 +212,10 @@ void Index::makeIndexKeys(const lang::Locale &rLocale, const OUString &algorithm
case u'{':
close = '}';
SAL_FALLTHROUGH;
- case u'(':
- if (key_count > 0) {
+ case u'(': {
+ if (key_count <= 0)
+ throw RuntimeException();
+
sal_Int16 end = i+1;
for (; end < len && keyStr[end] != close; end++) ;
@@ -228,9 +230,8 @@ void Index::makeIndexKeys(const lang::Locale &rLocale, const OUString &algorithm
keys[key_count++].desc.clear();
}
i=end+1;
- } else
- throw RuntimeException();
- break;
+ break;
+ }
default:
keys[key_count].key = curr;
keys[key_count++].desc.clear();
diff --git a/i18npool/source/textconversion/textconversion_ko.cxx b/i18npool/source/textconversion/textconversion_ko.cxx
index e9a788f5a461..645acc93144c 100644
--- a/i18npool/source/textconversion/textconversion_ko.cxx
+++ b/i18npool/source/textconversion/textconversion_ko.cxx
@@ -221,83 +221,83 @@ TextConversion_ko::getConversions( const OUString& aText, sal_Int32 nStartPos, s
result.Boundary.startPos = result.Boundary.endPos = 0;
// do conversion only when there are right conversion type and dictionary services.
- if (nConversionType == TextConversionType::TO_HANGUL ||
- nConversionType == TextConversionType::TO_HANJA) {
- sal_Int32 start, end, length = aText.getLength() - nStartPos;
-
- if (length < 0 || nStartPos < 0)
- length = 0;
- else if (length > nLength)
- length = nLength;
-
- sal_Int16 scriptType = SCRIPT_OTHERS;
- sal_Int32 len = 1;
- bool toHanja = (nConversionType == TextConversionType::TO_HANJA);
- // FROM_LEFT: Hangul -> Hanja
- // FROM_RIGHT: Hanja -> Hangul
- ConversionDirection eDirection = toHanja ? ConversionDirection_FROM_LEFT : ConversionDirection_FROM_RIGHT;
- sal_Int32 maxLength = toHanja ? maxLeftLength : maxRightLength;
- if (maxLength == 0) maxLength = 1;
-
- // search for a max length of convertible text
- for (start = 0, end = 0; start < length; start++) {
- if (end <= start) {
- scriptType = checkScriptType(aText[nStartPos + start]);
- if (nConversionType == TextConversionType::TO_HANJA) {
- if (scriptType != SCRIPT_HANGUL) // skip non-Hangul characters
- continue;
- } else {
- if (scriptType != SCRIPT_HANJA) // skip non-Hanja characters
- continue;
- }
- end = start + 1;
- }
- if (nConversionOptions & TextConversionOption::CHARACTER_BY_CHARACTER) {
- result.Candidates = getCharConversions(aText, nStartPos + start, len, toHanja); // char2char conversion
+ if (nConversionType != TextConversionType::TO_HANGUL &&
+ nConversionType != TextConversionType::TO_HANJA)
+ throw NoSupportException(); // Conversion type is not supported in this service.
+ sal_Int32 start, end, length = aText.getLength() - nStartPos;
+
+ if (length < 0 || nStartPos < 0)
+ length = 0;
+ else if (length > nLength)
+ length = nLength;
+
+ sal_Int16 scriptType = SCRIPT_OTHERS;
+ sal_Int32 len = 1;
+ bool toHanja = (nConversionType == TextConversionType::TO_HANJA);
+ // FROM_LEFT: Hangul -> Hanja
+ // FROM_RIGHT: Hanja -> Hangul
+ ConversionDirection eDirection = toHanja ? ConversionDirection_FROM_LEFT : ConversionDirection_FROM_RIGHT;
+ sal_Int32 maxLength = toHanja ? maxLeftLength : maxRightLength;
+ if (maxLength == 0) maxLength = 1;
+
+ // search for a max length of convertible text
+ for (start = 0, end = 0; start < length; start++) {
+ if (end <= start) {
+ scriptType = checkScriptType(aText[nStartPos + start]);
+ if (nConversionType == TextConversionType::TO_HANJA) {
+ if (scriptType != SCRIPT_HANGUL) // skip non-Hangul characters
+ continue;
} else {
- for (; end < length && end - start < maxLength; end++)
- if (checkScriptType(aText[nStartPos + end]) != scriptType)
- break;
-
- for (len = end - start; len > 0; len--) {
- if (len > 1) {
- try {
- if (xCDL.is())
- result.Candidates = xCDL->queryConversions(aText, start + nStartPos, len,
- aLocale, ConversionDictionaryType::HANGUL_HANJA, eDirection, nConversionOptions); // user dictionary
- }
- catch ( NoSupportException & ) {
- // clear reference (when there is no user dictionary) in order
- // to not always have to catch this exception again
- // in further calls. (save time)
- xCDL = nullptr;
- }
- catch (...) {
- // catch all other exceptions to allow
- // querying the system dictionary in the next line
- }
- if (xCD.is() && toHanja) { // System dictionary would not do Hanja_to_Hangul conversion.
- candidates = xCD->getConversions(aText, start + nStartPos, len, eDirection, nConversionOptions);
- result.Candidates += candidates;
- }
- } else if (! toHanja) { // do whole word character 2 character conversion for Hanja to Hangul conversion
- result.Candidates = getCharConversions(aText, nStartPos + start, length - start, toHanja);
- if (result.Candidates.hasElements())
- len = result.Candidates[0].getLength();
+ if (scriptType != SCRIPT_HANJA) // skip non-Hanja characters
+ continue;
+ }
+ end = start + 1;
+ }
+ if (nConversionOptions & TextConversionOption::CHARACTER_BY_CHARACTER) {
+ result.Candidates = getCharConversions(aText, nStartPos + start, len, toHanja); // char2char conversion
+ } else {
+ for (; end < length && end - start < maxLength; end++)
+ if (checkScriptType(aText[nStartPos + end]) != scriptType)
+ break;
+
+ for (len = end - start; len > 0; len--) {
+ if (len > 1) {
+ try {
+ if (xCDL.is())
+ result.Candidates = xCDL->queryConversions(aText, start + nStartPos, len,
+ aLocale, ConversionDictionaryType::HANGUL_HANJA, eDirection, nConversionOptions); // user dictionary
+ }
+ catch ( NoSupportException & ) {
+ // clear reference (when there is no user dictionary) in order
+ // to not always have to catch this exception again
+ // in further calls. (save time)
+ xCDL = nullptr;
+ }
+ catch (...) {
+ // catch all other exceptions to allow
+ // querying the system dictionary in the next line
}
+ if (xCD.is() && toHanja) { // System dictionary would not do Hanja_to_Hangul conversion.
+ candidates = xCD->getConversions(aText, start + nStartPos, len, eDirection, nConversionOptions);
+ result.Candidates += candidates;
+ }
+ } else if (! toHanja) { // do whole word character 2 character conversion for Hanja to Hangul conversion
+ result.Candidates = getCharConversions(aText, nStartPos + start, length - start, toHanja);
if (result.Candidates.hasElements())
- break;
+ len = result.Candidates[0].getLength();
}
- }
- // found match
- if (result.Candidates.hasElements()) {
- result.Boundary.startPos = start + nStartPos;
- result.Boundary.endPos = start + len + nStartPos;
- return result;
+ if (result.Candidates.hasElements())
+ break;
}
}
- } else
- throw NoSupportException(); // Conversion type is not supported in this service.
+ // found match
+ if (result.Candidates.hasElements()) {
+ result.Boundary.startPos = start + nStartPos;
+ result.Boundary.endPos = start + len + nStartPos;
+ return result;
+ }
+ }
+
return result;
}
diff --git a/i18npool/source/textconversion/textconversion_zh.cxx b/i18npool/source/textconversion/textconversion_zh.cxx
index 224c7dea8d74..ae08f5221e3d 100644
--- a/i18npool/source/textconversion/textconversion_zh.cxx
+++ b/i18npool/source/textconversion/textconversion_zh.cxx
@@ -283,44 +283,42 @@ OUString SAL_CALL
TextConversion_zh::getConversion( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
const Locale& rLocale, sal_Int16 nConversionType, sal_Int32 nConversionOptions)
{
- if (rLocale.Language == "zh" && ( nConversionType == TextConversionType::TO_SCHINESE || nConversionType == TextConversionType::TO_TCHINESE) ) {
-
- aLocale=rLocale;
- bool toSChinese = nConversionType == TextConversionType::TO_SCHINESE;
-
- if (nConversionOptions & TextConversionOption::CHARACTER_BY_CHARACTER)
- // char to char dictionary
- return getCharConversion(aText, nStartPos, nLength, toSChinese, nConversionOptions);
- else {
- Sequence <sal_Int32> offset;
- // word to word dictionary
- return getWordConversion(aText, nStartPos, nLength, toSChinese, nConversionOptions, offset);
- }
- } else
+ if (rLocale.Language != "zh" || ( nConversionType != TextConversionType::TO_SCHINESE && nConversionType != TextConversionType::TO_TCHINESE) )
throw NoSupportException(); // Conversion type is not supported in this service.
+
+ aLocale=rLocale;
+ bool toSChinese = nConversionType == TextConversionType::TO_SCHINESE;
+
+ if (nConversionOptions & TextConversionOption::CHARACTER_BY_CHARACTER)
+ // char to char dictionary
+ return getCharConversion(aText, nStartPos, nLength, toSChinese, nConversionOptions);
+ else {
+ Sequence <sal_Int32> offset;
+ // word to word dictionary
+ return getWordConversion(aText, nStartPos, nLength, toSChinese, nConversionOptions, offset);
+ }
}
OUString SAL_CALL
TextConversion_zh::getConversionWithOffset( const OUString& aText, sal_Int32 nStartPos, sal_Int32 nLength,
const Locale& rLocale, sal_Int16 nConversionType, sal_Int32 nConversionOptions, Sequence<sal_Int32>& offset)
{
- if (rLocale.Language == "zh" && ( nConversionType == TextConversionType::TO_SCHINESE || nConversionType == TextConversionType::TO_TCHINESE) ) {
+ if (rLocale.Language != "zh" || ( nConversionType != TextConversionType::TO_SCHINESE && nConversionType != TextConversionType::TO_TCHINESE) )
+ throw NoSupportException(); // Conversion type is not supported in this service.
- aLocale=rLocale;
- bool toSChinese = nConversionType == TextConversionType::TO_SCHINESE;
+ aLocale=rLocale;
+ bool toSChinese = nConversionType == TextConversionType::TO_SCHINESE;
- if (nConversionOptions & TextConversionOption::CHARACTER_BY_CHARACTER) {
- offset.realloc(0);
- // char to char dictionary
- return getCharConversion(aText, nStartPos, nLength, toSChinese, nConversionOptions);
- } else {
- if (offset.getLength() < 2*nLength)
- offset.realloc(2*nLength);
- // word to word dictionary
- return getWordConversion(aText, nStartPos, nLength, toSChinese, nConversionOptions, offset);
- }
- } else
- throw NoSupportException(); // Conversion type is not supported in this service.
+ if (nConversionOptions & TextConversionOption::CHARACTER_BY_CHARACTER) {
+ offset.realloc(0);
+ // char to char dictionary
+ return getCharConversion(aText, nStartPos, nLength, toSChinese, nConversionOptions);
+ } else {
+ if (offset.getLength() < 2*nLength)
+ offset.realloc(2*nLength);
+ // word to word dictionary
+ return getWordConversion(aText, nStartPos, nLength, toSChinese, nConversionOptions, offset);
+ }
}
sal_Bool SAL_CALL
diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx
index 00899e8da5f8..df16f43ffe24 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -361,49 +361,47 @@ namespace dlgprov
// get input stream provider
Reference< io::XInputStreamProvider > xISP;
- if ( xLibContainer.is() )
+ if ( !xLibContainer.is() )
{
- // load dialog library
- if ( !xLibContainer->isLibraryLoaded( sLibName ) )
- xLibContainer->loadLibrary( sLibName );
+ throw IllegalArgumentException(
+ "DialogProviderImpl::getDialog: library container not found!",
+ Reference< XInterface >(), 1 );
+ }
- // get dialog library
- if ( xLibContainer->hasByName( sLibName ) )
- {
- Any aElement = xLibContainer->getByName( sLibName );
- aElement >>= xDialogLib;
- }
+ // load dialog library
+ if ( !xLibContainer->isLibraryLoaded( sLibName ) )
+ xLibContainer->loadLibrary( sLibName );
- if ( xDialogLib.is() )
- {
- // get input stream provider
- if ( xDialogLib->hasByName( sDlgName ) )
- {
- Any aElement = xDialogLib->getByName( sDlgName );
- aElement >>= xISP;
- }
+ // get dialog library
+ if ( xLibContainer->hasByName( sLibName ) )
+ {
+ Any aElement = xLibContainer->getByName( sLibName );
+ aElement >>= xDialogLib;
+ }
- if ( !xISP.is() )
- {
- throw IllegalArgumentException(
- "DialogProviderImpl::getDialogModel: dialog not found!",
- Reference< XInterface >(), 1 );
- }
- }
- else
- {
- throw IllegalArgumentException(
- "DialogProviderImpl::getDialogModel: library not found!",
- Reference< XInterface >(), 1 );
- }
+ if ( !xDialogLib.is() )
+ {
+ throw IllegalArgumentException(
+ "DialogProviderImpl::getDialogModel: library not found!",
+ Reference< XInterface >(), 1 );
}
- else
+
+ // get input stream provider
+ if ( xDialogLib->hasByName( sDlgName ) )
+ {
+ Any aElement = xDialogLib->getByName( sDlgName );
+ aElement >>= xISP;
+ }
+
+ if ( !xISP.is() )
{
throw IllegalArgumentException(
- "DialogProviderImpl::getDialog: library container not found!",
+ "DialogProviderImpl::getDialogModel: dialog not found!",
Reference< XInterface >(), 1 );
}
+
+
if ( xISP.is() )
xInput = xISP->createInputStream();
msDialogLibName = sLibName;
diff --git a/sd/source/ui/presenter/PresenterTextView.cxx b/sd/source/ui/presenter/PresenterTextView.cxx
index 87679f849c11..09d8aa5d6ad1 100644
--- a/sd/source/ui/presenter/PresenterTextView.cxx
+++ b/sd/source/ui/presenter/PresenterTextView.cxx
@@ -117,20 +117,19 @@ void SAL_CALL PresenterTextView::initialize (const Sequence<Any>& rArguments)
{
ThrowIfDisposed();
- if (rArguments.getLength() == 1)
- {
- Reference<rendering::XCanvas> xCanvas (rArguments[0], UNO_QUERY_THROW);
- if (xCanvas.is())
- {
- mpImplementation->SetCanvas(
- cppcanvas::VCLFactory::createCanvas(xCanvas));
- }
- }
- else
+ if (!(rArguments.getLength() == 1))
{
throw RuntimeException("PresenterTextView: invalid number of arguments",
static_cast<XWeak*>(this));
}
+
+ Reference<rendering::XCanvas> xCanvas (rArguments[0], UNO_QUERY_THROW);
+ if (xCanvas.is())
+ {
+ mpImplementation->SetCanvas(
+ cppcanvas::VCLFactory::createCanvas(xCanvas));
+ }
+
}
Any PresenterTextView::GetPropertyValue (const OUString& rsPropertyName)
diff --git a/sfx2/source/doc/DocumentMetadataAccess.cxx b/sfx2/source/doc/DocumentMetadataAccess.cxx
index 3255b03f3dfd..50e6572b57d0 100644
--- a/sfx2/source/doc/DocumentMetadataAccess.cxx
+++ b/sfx2/source/doc/DocumentMetadataAccess.cxx
@@ -511,47 +511,45 @@ readStream(struct DocumentMetadataAccess_Impl & i_rImpl,
try {
if (!splitPath(i_rPath, dir, rest)) throw uno::RuntimeException();
if (dir.isEmpty()) {
- if (i_xStorage->isStreamElement(i_rPath)) {
- const uno::Reference<io::XStream> xStream(
- i_xStorage->openStreamElement(i_rPath,
- embed::ElementModes::READ), uno::UNO_SET_THROW);
- const uno::Reference<io::XInputStream> xInStream(
- xStream->getInputStream(), uno::UNO_SET_THROW );
- const uno::Reference<rdf::XURI> xBaseURI(
- rdf::URI::create(i_rImpl.m_xContext, i_rBaseURI));
- const uno::Reference<rdf::XURI> xURI(
- rdf::URI::createNS(i_rImpl.m_xContext,
- i_rBaseURI, i_rPath));
- i_rImpl.m_xRepository->importGraph(rdf::FileFormat::RDF_XML,
- xInStream, xURI, xBaseURI);
- } else {
+ if (!i_xStorage->isStreamElement(i_rPath)) {
throw mkException(
"readStream: is not a stream",
ucb::IOErrorCode_NO_FILE, i_rBaseURI + i_rPath, i_rPath);
}
+ const uno::Reference<io::XStream> xStream(
+ i_xStorage->openStreamElement(i_rPath,
+ embed::ElementModes::READ), uno::UNO_SET_THROW);
+ const uno::Reference<io::XInputStream> xInStream(
+ xStream->getInputStream(), uno::UNO_SET_THROW );
+ const uno::Reference<rdf::XURI> xBaseURI(
+ rdf::URI::create(i_rImpl.m_xContext, i_rBaseURI));
+ const uno::Reference<rdf::XURI> xURI(
+ rdf::URI::createNS(i_rImpl.m_xContext,
+ i_rBaseURI, i_rPath));
+ i_rImpl.m_xRepository->importGraph(rdf::FileFormat::RDF_XML,
+ xInStream, xURI, xBaseURI);
} else {
- if (i_xStorage->isStorageElement(dir)) {
- const uno::Reference<embed::XStorage> xDir(
- i_xStorage->openStorageElement(dir,
- embed::ElementModes::READ));
- const uno::Reference< beans::XPropertySet > xDirProps(xDir,
- uno::UNO_QUERY_THROW);
- try {
- OUString mimeType;
- xDirProps->getPropertyValue(
- utl::MediaDescriptor::PROP_MEDIATYPE() )
- >>= mimeType;
- if (mimeType.startsWith(s_odfmime)) {
- SAL_WARN("sfx", "readStream: refusing to recurse into embedded document");
- return;
- }
- } catch (const uno::Exception &) { }
- readStream(i_rImpl, xDir, rest, i_rBaseURI+dir+"/" );
- } else {
+ if (!i_xStorage->isStorageElement(dir)) {
throw mkException(
"readStream: is not a directory",
ucb::IOErrorCode_NO_DIRECTORY, i_rBaseURI + dir, dir);
}
+ const uno::Reference<embed::XStorage> xDir(
+ i_xStorage->openStorageElement(dir,
+ embed::ElementModes::READ));
+ const uno::Reference< beans::XPropertySet > xDirProps(xDir,
+ uno::UNO_QUERY_THROW);
+ try {
+ OUString mimeType;
+ xDirProps->getPropertyValue(
+ utl::MediaDescriptor::PROP_MEDIATYPE() )
+ >>= mimeType;
+ if (mimeType.startsWith(s_odfmime)) {
+ SAL_WARN("sfx", "readStream: refusing to recurse into embedded document");
+ return;
+ }
+ } catch (const uno::Exception &) { }
+ readStream(i_rImpl, xDir, rest, i_rBaseURI+dir+"/" );
}
} catch (const container::NoSuchElementException & e) {
throw mkException(e.Message, ucb::IOErrorCode_NOT_EXISTING_PATH,
diff --git a/stoc/source/implementationregistration/implreg.cxx b/stoc/source/implementationregistration/implreg.cxx
index 3a08defbb377..4dae09f124f5 100644
--- a/stoc/source/implementationregistration/implreg.cxx
+++ b/stoc/source/implementationregistration/implreg.cxx
@@ -1408,61 +1408,59 @@ void ImplementationRegistration::prepareRegister(
// set implLoaderUrl
}
- if( m_xSMgr.is() ) {
- try
+ if( !m_xSMgr.is() ) {
+ throw CannotRegisterImplementationException(
+ "ImplementationRegistration::registerImplementation() "
+ "no componentcontext available to instantiate loader" );
+ }
+
+ try
+ {
+ Reference < XImplementationLoader > xAct(
+ m_xSMgr->createInstanceWithContext(activatorName, m_xCtx) , UNO_QUERY );
+ if (!xAct.is())
{
- Reference < XImplementationLoader > xAct(
- m_xSMgr->createInstanceWithContext(activatorName, m_xCtx) , UNO_QUERY );
- if (xAct.is())
- {
- Reference < XSimpleRegistry > xRegistry;
+ throw CannotRegisterImplementationException(
+ "ImplementationRegistration::registerImplementation() - The service "
+ + activatorName + " cannot be instantiated" );
+ }
- if (xReg.is())
- {
- // registry supplied by user
- xRegistry = xReg;
- }
- else
- {
- xRegistry = getRegistryFromServiceManager();
- }
+ Reference < XSimpleRegistry > xRegistry;
- if ( xRegistry.is())
- {
- doRegister(m_xSMgr, m_xCtx, xAct, xRegistry, implementationLoaderUrl,
- locationUrl, registeredLocationUrl);
- }
- }
- else
- {
- throw CannotRegisterImplementationException(
- "ImplementationRegistration::registerImplementation() - The service "
- + activatorName + " cannot be instantiated" );
- }
- }
- catch( CannotRegisterImplementationException & )
+ if (xReg.is())
{
- throw;
+ // registry supplied by user
+ xRegistry = xReg;
}
- catch( const InvalidRegistryException & e )
+ else
{
- throw CannotRegisterImplementationException(
- "ImplementationRegistration::registerImplementation() "
- "InvalidRegistryException during registration (" + e.Message + ")" );
+ xRegistry = getRegistryFromServiceManager();
}
- catch( const MergeConflictException & e )
+
+ if ( xRegistry.is())
{
- throw CannotRegisterImplementationException(
- "ImplementationRegistration::registerImplementation() "
- "MergeConflictException during registration (" + e.Message + ")" );
+ doRegister(m_xSMgr, m_xCtx, xAct, xRegistry, implementationLoaderUrl,
+ locationUrl, registeredLocationUrl);
}
+
}
- else
+ catch( CannotRegisterImplementationException & )
+ {
+ throw;
+ }
+ catch( const InvalidRegistryException & e )
{
throw CannotRegisterImplementationException(
- "ImplementationRegistration::registerImplementation() "
- "no componentcontext available to instantiate loader" );
+ "ImplementationRegistration::registerImplementation() "
+ "InvalidRegistryException during registration (" + e.Message + ")" );
}
+ catch( const MergeConflictException & e )
+ {
+ throw CannotRegisterImplementationException(
+ "ImplementationRegistration::registerImplementation() "
+ "MergeConflictException during registration (" + e.Message + ")" );
+ }
+
}
@@ -1677,24 +1675,23 @@ void ImplementationRegistration::doRegister(
bool bSuccess =
xAct->writeRegistryInfo(xSourceKey, implementationLoaderUrl, locationUrl);
- if ( bSuccess )
- {
- prepareRegistry(xDest, xSourceKey, implementationLoaderUrl, registeredLocationUrl, xCtx);
-
- xSourceKey->closeKey();
-
- xSourceKey = xReg->getRootKey();
- Reference < XRegistryKey > xDestKey = xDest->getRootKey();
- stoc_impreg::mergeKeys( xDestKey, xSourceKey );
- xDestKey->closeKey();
- xSourceKey->closeKey();
- }
- else
+ if ( !bSuccess )
{
throw CannotRegisterImplementationException(
"ImplementationRegistration::doRegistration() component registration signaled failure" );
}
+ prepareRegistry(xDest, xSourceKey, implementationLoaderUrl, registeredLocationUrl, xCtx);
+
+ xSourceKey->closeKey();
+
+ xSourceKey = xReg->getRootKey();
+ Reference < XRegistryKey > xDestKey = xDest->getRootKey();
+ stoc_impreg::mergeKeys( xDestKey, xSourceKey );
+ xDestKey->closeKey();
+ xSourceKey->closeKey();
+
+
// Cleanup Source registry.
if ( xSourceKey->isValid() )
xSourceKey->closeKey();
diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx
index a6d31551b7a1..6186ad209bf8 100644
--- a/stoc/source/servicemanager/servicemanager.cxx
+++ b/stoc/source/servicemanager/servicemanager.cxx
@@ -558,17 +558,16 @@ void SAL_CALL OServiceManagerWrapper::setPropertyValue(
if ( PropertyName == "DefaultContext" )
{
Reference< XComponentContext > xContext;
- if (aValue >>= xContext)
- {
- MutexGuard aGuard( m_mutex );
- m_xContext = xContext;
- }
- else
+ if (!(aValue >>= xContext))
{
throw IllegalArgumentException(
"no XComponentContext given!",
static_cast<OWeakObject *>(this), 1 );
}
+
+ MutexGuard aGuard( m_mutex );
+ m_xContext = xContext;
+
}
else
{
@@ -698,27 +697,23 @@ void OServiceManager::setPropertyValue(
const OUString& PropertyName, const Any& aValue )
{
check_undisposed();
- if ( PropertyName == "DefaultContext" )
- {
- Reference< XComponentContext > xContext;
- if (aValue >>= xContext)
- {
- MutexGuard aGuard( m_mutex );
- m_xContext = xContext;
- }
- else
- {
- throw IllegalArgumentException(
- "no XComponentContext given!",
- static_cast<OWeakObject *>(this), 1 );
- }
- }
- else
+ if ( PropertyName != "DefaultContext" )
{
throw UnknownPropertyException(
"unknown property " + PropertyName,
static_cast<OWeakObject *>(this) );
}
+
+ Reference< XComponentContext > xContext;
+ if (!(aValue >>= xContext))
+ {
+ throw IllegalArgumentException(
+ "no XComponentContext given!",
+ static_cast<OWeakObject *>(this), 1 );
+ }
+
+ MutexGuard aGuard( m_mutex );
+ m_xContext = xContext;
}
Any OServiceManager::getPropertyValue(const OUString& PropertyName)
diff --git a/sw/source/ui/vba/vbasystem.cxx b/sw/source/ui/vba/vbasystem.cxx
index 7781f6660c65..95eec3f1ed2e 100644
--- a/sw/source/ui/vba/vbasystem.cxx
+++ b/sw/source/ui/vba/vbasystem.cxx
@@ -90,14 +90,7 @@ uno::Any PrivateProfileStringListener::getValueEvent()
{
// get the private profile string
OUString sValue;
- if(!maFileName.isEmpty())
- {
- // get key/value from a file
- Config aCfg( maFileName );
- aCfg.SetGroup( maGroupName );
- sValue = OStringToOUString(aCfg.ReadKey(maKey), RTL_TEXTENCODING_DONTKNOW);
- }
- else
+ if(maFileName.isEmpty())
{
// get key/value from Windows registry
#ifdef _WIN32
@@ -129,6 +122,12 @@ uno::Any PrivateProfileStringListener::getValueEvent()
#endif
}
+ // get key/value from a file
+ Config aCfg( maFileName );
+ aCfg.SetGroup( maGroupName );
+ sValue = OStringToOUString(aCfg.ReadKey(maKey), RTL_TEXTENCODING_DONTKNOW);
+
+
return uno::makeAny( sValue );
}
@@ -137,14 +136,7 @@ void PrivateProfileStringListener::setValueEvent( const css::uno::Any& value )
// set the private profile string
OUString aValue;
value >>= aValue;
- if(!maFileName.isEmpty())
- {
- // set value into a file
- Config aCfg( maFileName );
- aCfg.SetGroup( maGroupName );
- aCfg.WriteKey( maKey, OUStringToOString(aValue, RTL_TEXTENCODING_DONTKNOW) );
- }
- else
+ if(maFileName.isEmpty())
{
//set value into Windows registry
#ifdef _WIN32
@@ -172,6 +164,12 @@ void PrivateProfileStringListener::setValueEvent( const css::uno::Any& value )
#endif
}
+ // set value into a file
+ Config aCfg( maFileName );
+ aCfg.SetGroup( maGroupName );
+ aCfg.WriteKey( maKey, OUStringToOString(aValue, RTL_TEXTENCODING_DONTKNOW) );
+
+
}
SwVbaSystem::SwVbaSystem( uno::Reference<uno::XComponentContext > const & xContext ): SwVbaSystem_BASE( uno::Reference< XHelperInterface >(), xContext )