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>
This commit is contained in:
parent
b50f595b34
commit
cc1ed7fbce
@ -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);
|
||||
|
||||
}
|
||||
|
||||
|
@ -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) );
|
||||
|
||||
saveCompleted( m_xParentStorage != xStorage || m_aEntryName != sEntName );
|
||||
|
||||
}
|
||||
|
||||
if ( nEntryConnectionMode == embed::EntryInitModes::DEFAULT_INIT
|
||||
|| nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
|
||||
{
|
||||
if ( xStorage->hasByName( sEntName ) )
|
||||
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 );
|
||||
|
||||
{
|
||||
m_xParentStorage = xStorage;
|
||||
m_aEntryName = sEntName;
|
||||
m_nObjectState = embed::EmbedStates::LOADED;
|
||||
}
|
||||
else
|
||||
if ( !xStorage->hasByName( sEntName ) )
|
||||
throw lang::IllegalArgumentException( "Wrong entry is provided!",
|
||||
static_cast< ::cppu::OWeakObject* >(this),
|
||||
2 );
|
||||
|
||||
}
|
||||
else
|
||||
throw lang::IllegalArgumentException( "Wrong connection mode is provided!",
|
||||
static_cast< ::cppu::OWeakObject* >(this),
|
||||
3 );
|
||||
m_xParentStorage = xStorage;
|
||||
m_aEntryName = sEntName;
|
||||
m_nObjectState = embed::EmbedStates::LOADED;
|
||||
}
|
||||
|
||||
|
||||
|
@ -903,8 +903,12 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID )
|
||||
else
|
||||
#endif
|
||||
{
|
||||
if ( nVerbID == -9 )
|
||||
if ( nVerbID != -9 )
|
||||
{
|
||||
|
||||
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
|
||||
@ -957,21 +961,15 @@ void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID )
|
||||
if (m_aTempDumpURL.isEmpty())
|
||||
m_aTempDumpURL = lcl_ExtractObject(m_xFactory, m_xObjectStream);
|
||||
|
||||
if (!m_aTempDumpURL.isEmpty())
|
||||
{
|
||||
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);
|
||||
}
|
||||
else
|
||||
throw embed::UnreachableStateException();
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
throw embed::UnreachableStateException();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -120,16 +120,13 @@ 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() )
|
||||
{
|
||||
if ( !xTempOutStream.is() )
|
||||
throw io::IOException(); // TODO:
|
||||
// copy stream contents to the file
|
||||
::comphelper::OStorageHelper::CopyInputToOutput( xInStream, xTempOutStream );
|
||||
xTempOutStream->closeOutput();
|
||||
xTempOutStream.clear();
|
||||
}
|
||||
else
|
||||
throw io::IOException(); // TODO:
|
||||
}
|
||||
catch( const packages::WrongPasswordException& )
|
||||
{
|
||||
KillFile_Impl( aResult, xFactory );
|
||||
@ -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() )
|
||||
{
|
||||
if ( !xTempOutStream.is() )
|
||||
throw io::IOException(); // TODO:
|
||||
::comphelper::OStorageHelper::CopyInputToOutput( xInStream, xTempOutStream );
|
||||
xTempOutStream->flush();
|
||||
}
|
||||
else
|
||||
throw io::IOException(); // TODO:
|
||||
|
||||
return xTempFile;
|
||||
}
|
||||
|
||||
@ -388,8 +381,9 @@ 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() )
|
||||
{
|
||||
if ( !xTempOutStream.is() )
|
||||
throw io::IOException(); // TODO:
|
||||
|
||||
// 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();
|
||||
@ -489,9 +483,6 @@ void OleEmbeddedObject::InsertVisualCache_Impl( const uno::Reference< io::XStrea
|
||||
xTempSeek->seek( 0 );
|
||||
if ( xCachedSeek.is() )
|
||||
xCachedSeek->seek( 0 );
|
||||
}
|
||||
else
|
||||
throw io::IOException(); // TODO:
|
||||
|
||||
// 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 );
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
};
|
||||
|
@ -1028,21 +1028,19 @@ void Binding::setValue( const css::uno::Any& aValue )
|
||||
if( ! supportsType( aValue.getValueType() ) )
|
||||
throw IncompatibleTypesException( EXCEPT( "type unsupported" ) );
|
||||
|
||||
if( maBindingExpression.hasValue() )
|
||||
{
|
||||
if( !maBindingExpression.hasValue() )
|
||||
throw InvalidBindingStateException( EXCEPT( "no suitable node found" ) );
|
||||
|
||||
css::uno::Reference<css::xml::dom::XNode> xNode = maBindingExpression.getNode();
|
||||
if( xNode.is() )
|
||||
{
|
||||
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" ) );
|
||||
}
|
||||
else
|
||||
throw InvalidBindingStateException( EXCEPT( "no suitable node found" ) );
|
||||
}
|
||||
else
|
||||
throw InvalidBindingStateException( EXCEPT( "no suitable node found" ) );
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 );
|
||||
}
|
||||
|
||||
|
||||
|
@ -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
|
||||
|
@ -79,12 +79,18 @@ 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 )
|
||||
if ( !(Element >>= aPropertySetElement) )
|
||||
{
|
||||
throw IllegalArgumentException(
|
||||
WRONG_TYPE_EXCEPTION,
|
||||
static_cast<OWeakObject *>(this), 2 );
|
||||
}
|
||||
|
||||
if ( nSize == Index )
|
||||
m_aPropertySetVector.push_back( aPropertySetElement );
|
||||
else
|
||||
@ -93,50 +99,34 @@ void SAL_CALL PropertySetContainer::insertByIndex( sal_Int32 Index, const css::u
|
||||
aIter += Index;
|
||||
m_aPropertySetVector.insert( aIter, aPropertySetElement );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw IllegalArgumentException(
|
||||
WRONG_TYPE_EXCEPTION,
|
||||
static_cast<OWeakObject *>(this), 2 );
|
||||
}
|
||||
}
|
||||
else
|
||||
throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
|
||||
}
|
||||
|
||||
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 )
|
||||
{
|
||||
m_aPropertySetVector[ Index ] = aPropertySetElement;
|
||||
}
|
||||
else
|
||||
if ( !(Element >>= aPropertySetElement) )
|
||||
{
|
||||
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
|
||||
|
@ -166,18 +166,20 @@ 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 );
|
||||
@ -189,37 +191,29 @@ void SAL_CALL ItemContainer::insertByIndex( sal_Int32 Index, const Any& aItem )
|
||||
}
|
||||
else
|
||||
throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
|
||||
}
|
||||
else
|
||||
throw IllegalArgumentException( WRONG_TYPE_EXCEPTION,
|
||||
static_cast<OWeakObject *>(this), 2 );
|
||||
}
|
||||
|
||||
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
|
||||
|
@ -182,18 +182,19 @@ 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 );
|
||||
@ -205,35 +206,28 @@ void SAL_CALL RootItemContainer::insertByIndex( sal_Int32 Index, const Any& aIte
|
||||
}
|
||||
else
|
||||
throw IndexOutOfBoundsException( OUString(), static_cast<OWeakObject *>(this) );
|
||||
}
|
||||
else
|
||||
throw IllegalArgumentException( WRONG_TYPE_EXCEPTION, static_cast<OWeakObject *>(this), 2 );
|
||||
}
|
||||
|
||||
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 >& )
|
||||
|
@ -359,8 +359,9 @@ 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();
|
||||
@ -411,9 +412,7 @@ void SAL_CALL ConfigurationAccess_WindowState::insertByName( const OUString& rRe
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
throw IllegalArgumentException();
|
||||
|
||||
}
|
||||
|
||||
// XNameReplace
|
||||
@ -423,8 +422,9 @@ 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() )
|
||||
{
|
||||
@ -444,15 +444,14 @@ void SAL_CALL ConfigurationAccess_WindowState::replaceByName( const OUString& rR
|
||||
Reference< XNameAccess > xNameAccess;
|
||||
Any a( m_xConfigAccess->getByName( rResourceURL ));
|
||||
|
||||
if ( a >>= xNameAccess )
|
||||
{
|
||||
if ( !(a >>= xNameAccess) )
|
||||
throw NoSuchElementException();
|
||||
|
||||
WindowStateInfo& rWinStateInfo( impl_insertCacheAndReturnWinState( rResourceURL, xNameAccess ));
|
||||
impl_fillStructFromSequence( rWinStateInfo, aPropSet );
|
||||
m_bModified = true;
|
||||
pIter = m_aResourceURLToInfoCache.find( rResourceURL );
|
||||
}
|
||||
else
|
||||
throw NoSuchElementException();
|
||||
|
||||
}
|
||||
|
||||
if ( m_bModified && pIter != m_aResourceURLToInfoCache.end() )
|
||||
@ -482,9 +481,7 @@ void SAL_CALL ConfigurationAccess_WindowState::replaceByName( const OUString& rR
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
throw IllegalArgumentException();
|
||||
|
||||
}
|
||||
|
||||
// container.XContainerListener
|
||||
|
@ -277,14 +277,12 @@ Any SAL_CALL MenuBarWrapper::getByName(
|
||||
fillPopupControllerCache();
|
||||
|
||||
PopupControllerCache::const_iterator pIter = m_aPopupControllerCache.find( aName );
|
||||
if ( pIter != m_aPopupControllerCache.end() )
|
||||
{
|
||||
if ( pIter == m_aPopupControllerCache.end() )
|
||||
throw container::NoSuchElementException();
|
||||
|
||||
uno::Reference< frame::XDispatchProvider > xDispatchProvider;
|
||||
xDispatchProvider = pIter->second.m_xDispatchProvider;
|
||||
return uno::makeAny( xDispatchProvider );
|
||||
}
|
||||
else
|
||||
throw container::NoSuchElementException();
|
||||
}
|
||||
|
||||
Sequence< OUString > SAL_CALL MenuBarWrapper::getElementNames()
|
||||
|
@ -69,8 +69,9 @@ void SAL_CALL StatusBarWrapper::dispose()
|
||||
m_aListenerContainer.disposeAndClear( aEvent );
|
||||
|
||||
SolarMutexGuard g;
|
||||
if ( !m_bDisposed )
|
||||
{
|
||||
if ( m_bDisposed )
|
||||
throw DisposedException();
|
||||
|
||||
if ( m_xStatusBarManager.is() )
|
||||
m_xStatusBarManager->dispose();
|
||||
m_xStatusBarManager.clear();
|
||||
@ -79,9 +80,7 @@ void SAL_CALL StatusBarWrapper::dispose()
|
||||
m_xContext.clear();
|
||||
|
||||
m_bDisposed = true;
|
||||
}
|
||||
else
|
||||
throw DisposedException();
|
||||
|
||||
}
|
||||
|
||||
// XInitialization
|
||||
|
@ -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;
|
||||
}
|
||||
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;
|
||||
}
|
||||
default:
|
||||
keys[key_count].key = curr;
|
||||
keys[key_count++].desc.clear();
|
||||
|
@ -221,8 +221,9 @@ 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) {
|
||||
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)
|
||||
@ -296,8 +297,7 @@ TextConversion_ko::getConversions( const OUString& aText, sal_Int32 nStartPos, s
|
||||
return result;
|
||||
}
|
||||
}
|
||||
} else
|
||||
throw NoSupportException(); // Conversion type is not supported in this service.
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
|
@ -283,7 +283,8 @@ 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) ) {
|
||||
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;
|
||||
@ -296,15 +297,14 @@ TextConversion_zh::getConversion( const OUString& aText, sal_Int32 nStartPos, sa
|
||||
// word to word dictionary
|
||||
return getWordConversion(aText, nStartPos, nLength, toSChinese, nConversionOptions, offset);
|
||||
}
|
||||
} else
|
||||
throw NoSupportException(); // Conversion type is not supported in this service.
|
||||
}
|
||||
|
||||
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;
|
||||
@ -319,8 +319,6 @@ TextConversion_zh::getConversionWithOffset( const OUString& aText, sal_Int32 nSt
|
||||
// word to word dictionary
|
||||
return getWordConversion(aText, nStartPos, nLength, toSChinese, nConversionOptions, offset);
|
||||
}
|
||||
} else
|
||||
throw NoSupportException(); // Conversion type is not supported in this service.
|
||||
}
|
||||
|
||||
sal_Bool SAL_CALL
|
||||
|
@ -361,8 +361,13 @@ namespace dlgprov
|
||||
|
||||
// get input stream provider
|
||||
Reference< io::XInputStreamProvider > xISP;
|
||||
if ( xLibContainer.is() )
|
||||
if ( !xLibContainer.is() )
|
||||
{
|
||||
throw IllegalArgumentException(
|
||||
"DialogProviderImpl::getDialog: library container not found!",
|
||||
Reference< XInterface >(), 1 );
|
||||
}
|
||||
|
||||
// load dialog library
|
||||
if ( !xLibContainer->isLibraryLoaded( sLibName ) )
|
||||
xLibContainer->loadLibrary( sLibName );
|
||||
@ -374,8 +379,13 @@ namespace dlgprov
|
||||
aElement >>= xDialogLib;
|
||||
}
|
||||
|
||||
if ( xDialogLib.is() )
|
||||
if ( !xDialogLib.is() )
|
||||
{
|
||||
throw IllegalArgumentException(
|
||||
"DialogProviderImpl::getDialogModel: library not found!",
|
||||
Reference< XInterface >(), 1 );
|
||||
}
|
||||
|
||||
// get input stream provider
|
||||
if ( xDialogLib->hasByName( sDlgName ) )
|
||||
{
|
||||
@ -389,20 +399,8 @@ namespace dlgprov
|
||||
"DialogProviderImpl::getDialogModel: dialog not found!",
|
||||
Reference< XInterface >(), 1 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw IllegalArgumentException(
|
||||
"DialogProviderImpl::getDialogModel: library not found!",
|
||||
Reference< XInterface >(), 1 );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw IllegalArgumentException(
|
||||
"DialogProviderImpl::getDialog: library container not found!",
|
||||
Reference< XInterface >(), 1 );
|
||||
}
|
||||
|
||||
|
||||
|
||||
if ( xISP.is() )
|
||||
xInput = xISP->createInputStream();
|
||||
|
@ -117,20 +117,19 @@ void SAL_CALL PresenterTextView::initialize (const Sequence<Any>& rArguments)
|
||||
{
|
||||
ThrowIfDisposed();
|
||||
|
||||
if (rArguments.getLength() == 1)
|
||||
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));
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw RuntimeException("PresenterTextView: invalid number of arguments",
|
||||
static_cast<XWeak*>(this));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Any PresenterTextView::GetPropertyValue (const OUString& rsPropertyName)
|
||||
|
@ -511,7 +511,11 @@ 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)) {
|
||||
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);
|
||||
@ -525,12 +529,11 @@ readStream(struct DocumentMetadataAccess_Impl & i_rImpl,
|
||||
i_rImpl.m_xRepository->importGraph(rdf::FileFormat::RDF_XML,
|
||||
xInStream, xURI, xBaseURI);
|
||||
} else {
|
||||
if (!i_xStorage->isStorageElement(dir)) {
|
||||
throw mkException(
|
||||
"readStream: is not a stream",
|
||||
ucb::IOErrorCode_NO_FILE, i_rBaseURI + i_rPath, i_rPath);
|
||||
"readStream: is not a directory",
|
||||
ucb::IOErrorCode_NO_DIRECTORY, i_rBaseURI + dir, dir);
|
||||
}
|
||||
} else {
|
||||
if (i_xStorage->isStorageElement(dir)) {
|
||||
const uno::Reference<embed::XStorage> xDir(
|
||||
i_xStorage->openStorageElement(dir,
|
||||
embed::ElementModes::READ));
|
||||
@ -547,11 +550,6 @@ readStream(struct DocumentMetadataAccess_Impl & i_rImpl,
|
||||
}
|
||||
} catch (const uno::Exception &) { }
|
||||
readStream(i_rImpl, xDir, rest, i_rBaseURI+dir+"/" );
|
||||
} else {
|
||||
throw mkException(
|
||||
"readStream: is not a directory",
|
||||
ucb::IOErrorCode_NO_DIRECTORY, i_rBaseURI + dir, dir);
|
||||
}
|
||||
}
|
||||
} catch (const container::NoSuchElementException & e) {
|
||||
throw mkException(e.Message, ucb::IOErrorCode_NOT_EXISTING_PATH,
|
||||
|
@ -1408,13 +1408,23 @@ void ImplementationRegistration::prepareRegister(
|
||||
// set implLoaderUrl
|
||||
}
|
||||
|
||||
if( m_xSMgr.is() ) {
|
||||
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())
|
||||
if (!xAct.is())
|
||||
{
|
||||
throw CannotRegisterImplementationException(
|
||||
"ImplementationRegistration::registerImplementation() - The service "
|
||||
+ activatorName + " cannot be instantiated" );
|
||||
}
|
||||
|
||||
Reference < XSimpleRegistry > xRegistry;
|
||||
|
||||
if (xReg.is())
|
||||
@ -1432,13 +1442,7 @@ void ImplementationRegistration::prepareRegister(
|
||||
doRegister(m_xSMgr, m_xCtx, xAct, xRegistry, implementationLoaderUrl,
|
||||
locationUrl, registeredLocationUrl);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw CannotRegisterImplementationException(
|
||||
"ImplementationRegistration::registerImplementation() - The service "
|
||||
+ activatorName + " cannot be instantiated" );
|
||||
}
|
||||
|
||||
}
|
||||
catch( CannotRegisterImplementationException & )
|
||||
{
|
||||
@ -1456,13 +1460,7 @@ void ImplementationRegistration::prepareRegister(
|
||||
"ImplementationRegistration::registerImplementation() "
|
||||
"MergeConflictException during registration (" + e.Message + ")" );
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
throw CannotRegisterImplementationException(
|
||||
"ImplementationRegistration::registerImplementation() "
|
||||
"no componentcontext available to instantiate loader" );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
@ -1677,8 +1675,12 @@ void ImplementationRegistration::doRegister(
|
||||
|
||||
bool bSuccess =
|
||||
xAct->writeRegistryInfo(xSourceKey, implementationLoaderUrl, locationUrl);
|
||||
if ( bSuccess )
|
||||
if ( !bSuccess )
|
||||
{
|
||||
throw CannotRegisterImplementationException(
|
||||
"ImplementationRegistration::doRegistration() component registration signaled failure" );
|
||||
}
|
||||
|
||||
prepareRegistry(xDest, xSourceKey, implementationLoaderUrl, registeredLocationUrl, xCtx);
|
||||
|
||||
xSourceKey->closeKey();
|
||||
@ -1688,12 +1690,7 @@ void ImplementationRegistration::doRegister(
|
||||
stoc_impreg::mergeKeys( xDestKey, xSourceKey );
|
||||
xDestKey->closeKey();
|
||||
xSourceKey->closeKey();
|
||||
}
|
||||
else
|
||||
{
|
||||
throw CannotRegisterImplementationException(
|
||||
"ImplementationRegistration::doRegistration() component registration signaled failure" );
|
||||
}
|
||||
|
||||
|
||||
// Cleanup Source registry.
|
||||
if ( xSourceKey->isValid() )
|
||||
|
@ -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)
|
||||
|
@ -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 )
|
||||
|
Loading…
x
Reference in New Issue
Block a user