summaryrefslogtreecommitdiff
path: root/comphelper/source/container/embeddedobjectcontainer.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'comphelper/source/container/embeddedobjectcontainer.cxx')
-rw-r--r--comphelper/source/container/embeddedobjectcontainer.cxx49
1 files changed, 26 insertions, 23 deletions
diff --git a/comphelper/source/container/embeddedobjectcontainer.cxx b/comphelper/source/container/embeddedobjectcontainer.cxx
index 17740e7ef09b..9f84b7afa053 100644
--- a/comphelper/source/container/embeddedobjectcontainer.cxx
+++ b/comphelper/source/container/embeddedobjectcontainer.cxx
@@ -1,3 +1,4 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -51,7 +52,7 @@
#include <comphelper/embeddedobjectcontainer.hxx>
#include <comphelper/sequence.hxx>
#include <cppuhelper/weakref.hxx>
-#include <hash_map>
+#include <boost/unordered_map.hpp>
#include <algorithm>
#include <rtl/logfile.hxx>
@@ -77,7 +78,7 @@ struct eqObjectName_Impl
}
};
-typedef std::hash_map
+typedef boost::unordered_map
<
::rtl::OUString,
::com::sun::star::uno::Reference < com::sun::star::embed::XEmbeddedObject >,
@@ -108,12 +109,12 @@ const uno::Reference < embed::XStorage >& EmbedImpl::GetReplacements()
try
{
mxImageStorage = mxStorage->openStorageElement(
- ::rtl::OUString::createFromAscii( "ObjectReplacements" ), embed::ElementModes::READWRITE );
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ObjectReplacements")), embed::ElementModes::READWRITE );
}
catch ( uno::Exception& )
{
mxImageStorage = mxStorage->openStorageElement(
- ::rtl::OUString::createFromAscii( "ObjectReplacements" ), embed::ElementModes::READ );
+ ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ObjectReplacements")), embed::ElementModes::READ );
}
}
@@ -171,7 +172,7 @@ sal_Bool EmbeddedObjectContainer::CommitImageSubStorage()
{
// get the open mode from the parent storage
sal_Int32 nMode = 0;
- uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("OpenMode") );
+ uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OpenMode")) );
if ( aAny >>= nMode )
bReadOnlyMode = !(nMode & embed::ElementModes::WRITE );
} // if ( xSet.is() )
@@ -203,7 +204,7 @@ void EmbeddedObjectContainer::ReleaseImageSubStorage()
}
catch( uno::Exception& )
{
- OSL_ASSERT( "Problems releasing image substorage!\n" );
+ OSL_FAIL( "Problems releasing image substorage!\n" );
}
}
}
@@ -317,7 +318,7 @@ sal_Bool EmbeddedObjectContainer::HasInstantiatedEmbeddedObject( const ::rtl::OU
aIt++;
}
- OSL_ENSURE( 0, "Unknown object!" );
+ OSL_FAIL( "Unknown object!" );
return ::rtl::OUString();
}
@@ -363,7 +364,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::Get_Impl( con
{
// get the open mode from the parent storage
sal_Int32 nMode = 0;
- uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("OpenMode") );
+ uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("OpenMode")) );
if ( aAny >>= nMode )
bReadOnlyMode = !(nMode & embed::ElementModes::WRITE );
}
@@ -714,8 +715,7 @@ sal_Bool EmbeddedObjectContainer::CopyEmbeddedObject( EmbeddedObjectContainer& r
{
RTL_LOGFILE_CONTEXT( aLog, "comphelper (mv76033) comphelper::EmbeddedObjectContainer::CopyEmbeddedObject" );
- OSL_ENSURE( sal_False,
- "This method is depricated! Use EmbeddedObjectContainer::CopyAndGetEmbeddedObject() to copy object!\n" );
+ OSL_FAIL( "This method is depricated! Use EmbeddedObjectContainer::CopyAndGetEmbeddedObject() to copy object!\n" );
// get the object name before(!) it is assigned to a new storage
::rtl::OUString aOrigName;
@@ -843,7 +843,7 @@ uno::Reference < embed::XEmbeddedObject > EmbeddedObjectContainer::CopyAndGetEmb
{
// impossibility to copy readonly property is not treated as an error for now
// but the assertion is helpful to detect such scenarios and review them
- OSL_ENSURE( sal_False, "Could not copy readonly property!\n" );
+ OSL_FAIL( "Could not copy readonly property!\n" );
}
}
}
@@ -911,7 +911,7 @@ sal_Bool EmbeddedObjectContainer::MoveEmbeddedObject( EmbeddedObjectContainer& r
catch ( uno::Exception& e )
{
(void)e;
- OSL_ENSURE( sal_False, "Failed to insert embedded object into storage!" );
+ OSL_FAIL( "Failed to insert embedded object into storage!" );
bRet = sal_False;
}
@@ -943,7 +943,7 @@ sal_Bool EmbeddedObjectContainer::MoveEmbeddedObject( EmbeddedObjectContainer& r
}
catch ( uno::Exception& )
{
- OSL_ENSURE( sal_False, "Failed to remove object from storage!" );
+ OSL_FAIL( "Failed to remove object from storage!" );
bRet = sal_False;
}
}
@@ -1008,13 +1008,13 @@ sal_Bool EmbeddedObjectContainer::MoveEmbeddedObject( const ::rtl::OUString& rNa
}
catch ( uno::Exception& )
{
- OSL_ENSURE(0,"Could not move object!");
+ OSL_FAIL("Could not move object!");
return sal_False;
}
}
else
- OSL_ENSURE(0,"Unknown object!");
+ OSL_FAIL("Unknown object!");
return sal_False;
}
@@ -1030,7 +1030,7 @@ sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < e
#if OSL_DEBUG_LEVEL > 1
uno::Reference < container::XNameAccess > xAccess( pImpl->mxStorage, uno::UNO_QUERY );
uno::Reference < embed::XLinkageSupport > xLink( xPersist, uno::UNO_QUERY );
- sal_Bool bIsNotEmbedded = !xPersist.is() || xLink.is() && xLink->isLink();
+ sal_Bool bIsNotEmbedded = !xPersist.is() || ( xLink.is() && xLink->isLink() );
// if the object has a persistance and the object is not a link than it must have persistence entry in the storage
OSL_ENSURE( bIsNotEmbedded || xAccess->hasByName(aName), "Removing element not present in storage!" );
@@ -1093,7 +1093,7 @@ sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < e
}
catch( uno::Exception& )
{
- OSL_ENSURE( sal_False, "Can not set the new media type to a storage!\n" );
+ OSL_FAIL( "Can not set the new media type to a storage!\n" );
}
}
@@ -1135,6 +1135,7 @@ sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < e
}
OSL_ENSURE( bFound, "Object not found for removal!" );
+ (void)bFound;
if ( xPersist.is() )
{
// remove replacement image (if there is one)
@@ -1152,7 +1153,7 @@ sal_Bool EmbeddedObjectContainer::RemoveEmbeddedObject( const uno::Reference < e
}
catch ( uno::Exception& )
{
- OSL_ENSURE( sal_False, "Failed to remove object from storage!" );
+ OSL_FAIL( "Failed to remove object from storage!" );
return sal_False;
}
}
@@ -1216,7 +1217,7 @@ uno::Reference < io::XInputStream > EmbeddedObjectContainer::GetGraphicStream( c
uno::Reference < beans::XPropertySet > xSet( xStream, uno::UNO_QUERY );
if ( xSet.is() )
{
- uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString::createFromAscii("MediaType") );
+ uno::Any aAny = xSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")) );
aAny >>= *pMediaType;
}
}
@@ -1271,13 +1272,13 @@ sal_Bool EmbeddedObjectContainer::InsertGraphicStream( const com::sun::star::uno
if ( !xPropSet.is() )
throw uno::RuntimeException();
- xPropSet->setPropertyValue( ::rtl::OUString::createFromAscii( "UseCommonStoragePasswordEncryption" ),
+ xPropSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("UseCommonStoragePasswordEncryption")),
uno::makeAny( (sal_Bool)sal_True ) );
uno::Any aAny;
aAny <<= rMediaType;
- xPropSet->setPropertyValue( ::rtl::OUString::createFromAscii("MediaType"), aAny );
+ xPropSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MediaType")), aAny );
- xPropSet->setPropertyValue( ::rtl::OUString::createFromAscii( "Compressed" ),
+ xPropSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Compressed")),
uno::makeAny( (sal_Bool)sal_True ) );
}
catch( uno::Exception& )
@@ -1363,7 +1364,7 @@ namespace {
}
catch( uno::Exception& )
{
- OSL_ENSURE( sal_False, "The pictures storage is not available!\n" );
+ OSL_FAIL( "The pictures storage is not available!\n" );
}
}
@@ -1661,3 +1662,5 @@ sal_Bool EmbeddedObjectContainer::SetPersistentEntries(const uno::Reference< emb
return bError;
}
}
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */