INTEGRATION: CWS mav21 (1.13.28); FILE MERGED
2007/06/12 10:09:01 mav 1.13.28.3: #i75233# the OLE objects have no classID registration, but they are known by mediatype 2007/03/28 13:12:05 mav 1.13.28.2: #i75820# allow to support factory only 2007/03/08 12:39:01 mav 1.13.28.1: #i75233# the implementation for unknown objects
This commit is contained in:
@@ -4,9 +4,9 @@
|
|||||||
*
|
*
|
||||||
* $RCSfile: xcreator.cxx,v $
|
* $RCSfile: xcreator.cxx,v $
|
||||||
*
|
*
|
||||||
* $Revision: 1.13 $
|
* $Revision: 1.14 $
|
||||||
*
|
*
|
||||||
* last change: $Author: obo $ $Date: 2006-10-12 11:21:30 $
|
* last change: $Author: hr $ $Date: 2007-06-26 16:05:07 $
|
||||||
*
|
*
|
||||||
* The Contents of this file are made available subject to
|
* The Contents of this file are made available subject to
|
||||||
* the terms of GNU Lesser General Public License Version 2.1.
|
* the terms of GNU Lesser General Public License Version 2.1.
|
||||||
@@ -71,8 +71,9 @@
|
|||||||
#include <rtl/logfile.hxx>
|
#include <rtl/logfile.hxx>
|
||||||
|
|
||||||
|
|
||||||
#include "xcreator.hxx"
|
#include <xcreator.hxx>
|
||||||
#include "convert.hxx"
|
#include <convert.hxx>
|
||||||
|
#include <dummyobject.hxx>
|
||||||
|
|
||||||
|
|
||||||
using namespace ::com::sun::star;
|
using namespace ::com::sun::star;
|
||||||
@@ -178,6 +179,7 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta
|
|||||||
throw container::NoSuchElementException();
|
throw container::NoSuchElementException();
|
||||||
|
|
||||||
::rtl::OUString aMediaType;
|
::rtl::OUString aMediaType;
|
||||||
|
::rtl::OUString aEmbedFactory;
|
||||||
if ( xStorage->isStorageElement( sEntName ) )
|
if ( xStorage->isStorageElement( sEntName ) )
|
||||||
{
|
{
|
||||||
// the object must be based on storage
|
// the object must be based on storage
|
||||||
@@ -223,6 +225,8 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta
|
|||||||
try {
|
try {
|
||||||
uno::Any aAny = xPropSet->getPropertyValue( ::rtl::OUString::createFromAscii( "MediaType" ) );
|
uno::Any aAny = xPropSet->getPropertyValue( ::rtl::OUString::createFromAscii( "MediaType" ) );
|
||||||
aAny >>= aMediaType;
|
aAny >>= aMediaType;
|
||||||
|
if ( aMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.sun.star.oleobject" ) ) ) )
|
||||||
|
aEmbedFactory = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OLEEmbeddedObjectFactory" ) );
|
||||||
}
|
}
|
||||||
catch ( uno::Exception& )
|
catch ( uno::Exception& )
|
||||||
{
|
{
|
||||||
@@ -239,24 +243,27 @@ uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInsta
|
|||||||
}
|
}
|
||||||
|
|
||||||
OSL_ENSURE( aMediaType.getLength(), "No media type is specified for the object!" );
|
OSL_ENSURE( aMediaType.getLength(), "No media type is specified for the object!" );
|
||||||
::rtl::OUString aEmbedFactory;
|
if ( aMediaType.getLength() && !aEmbedFactory.getLength() )
|
||||||
if ( aMediaType.getLength() )
|
|
||||||
aEmbedFactory = m_aConfigHelper.GetFactoryNameByMediaType( aMediaType );
|
aEmbedFactory = m_aConfigHelper.GetFactoryNameByMediaType( aMediaType );
|
||||||
|
|
||||||
if ( !aEmbedFactory.getLength() )
|
if ( aEmbedFactory.getLength() )
|
||||||
{
|
{
|
||||||
// use system fallback
|
uno::Reference< uno::XInterface > xFact = m_xFactory->createInstance( aEmbedFactory );
|
||||||
// TODO: in future users factories can be tested
|
|
||||||
aEmbedFactory = ::rtl::OUString::createFromAscii( "com.sun.star.embed.OLEEmbeddedObjectFactory" );
|
uno::Reference< embed::XEmbedObjectCreator > xEmbCreator( xFact, uno::UNO_QUERY );
|
||||||
|
if ( xEmbCreator.is() )
|
||||||
|
return xEmbCreator->createInstanceInitFromEntry( xStorage, sEntName, aMedDescr, lObjArgs );
|
||||||
|
|
||||||
|
uno::Reference < embed::XEmbedObjectFactory > xEmbFact( xFact, uno::UNO_QUERY );
|
||||||
|
if ( xEmbFact.is() )
|
||||||
|
return xEmbFact->createInstanceUserInit( uno::Sequence< sal_Int8 >(), ::rtl::OUString(), xStorage, sEntName, embed::EntryInitModes::DEFAULT_INIT, aMedDescr, lObjArgs);
|
||||||
}
|
}
|
||||||
|
|
||||||
uno::Reference< embed::XEmbedObjectCreator > xEmbCreator(
|
// the default object should be created, it will allow to store the contents on the next saving
|
||||||
m_xFactory->createInstance( aEmbedFactory ),
|
uno::Reference< uno::XInterface > xResult( static_cast< cppu::OWeakObject* >( new ODummyEmbeddedObject() ) );
|
||||||
uno::UNO_QUERY );
|
uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY_THROW );
|
||||||
if ( !xEmbCreator.is() )
|
xPersist->setPersistentEntry( xStorage, sEntName, embed::EntryInitModes::DEFAULT_INIT, aMedDescr, lObjArgs );
|
||||||
throw uno::RuntimeException(); // TODO:
|
return xResult;
|
||||||
|
|
||||||
return xEmbCreator->createInstanceInitFromEntry( xStorage, sEntName, aMedDescr, lObjArgs );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//-------------------------------------------------------------------------
|
//-------------------------------------------------------------------------
|
||||||
|
Reference in New Issue
Block a user