Files
libreoffice/embeddedobj/source/commonembedding/persistence.cxx

1919 lines
74 KiB
C++
Raw Normal View History

2003-10-27 12:05:38 +00:00
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2003-10-27 12:05:38 +00:00
*
* Copyright 2000, 2010 Oracle and/or its affiliates.
2003-10-27 12:05:38 +00:00
*
* OpenOffice.org - a multi-platform office productivity suite
2003-10-27 12:05:38 +00:00
*
* This file is part of OpenOffice.org.
2003-10-27 12:05:38 +00:00
*
* OpenOffice.org is free software: you can redistribute it and/or modify
* it under the terms of the GNU Lesser General Public License version 3
* only, as published by the Free Software Foundation.
2003-10-27 12:05:38 +00:00
*
* OpenOffice.org is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU Lesser General Public License version 3 for more details
* (a copy is included in the LICENSE file that accompanied this code).
2003-10-27 12:05:38 +00:00
*
* You should have received a copy of the GNU Lesser General Public License
* version 3 along with OpenOffice.org. If not, see
* <http://www.openoffice.org/license.html>
* for a copy of the LGPLv3 License.
2003-10-27 12:05:38 +00:00
*
************************************************************************/
// MARKER(update_precomp.py): autogen include statement, do not remove
#include "precompiled_embeddedobj.hxx"
2003-10-27 12:05:38 +00:00
#include <commonembobj.hxx>
#include <com/sun/star/embed/Aspects.hpp>
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
#include <com/sun/star/document/XStorageBasedDocument.hpp>
2003-10-27 12:05:38 +00:00
#include <com/sun/star/embed/EmbedStates.hpp>
#include <com/sun/star/embed/EmbedVerbs.hpp>
#include <com/sun/star/embed/EntryInitModes.hpp>
#include <com/sun/star/embed/XStorage.hpp>
#include <com/sun/star/embed/XOptimizedStorage.hpp>
2003-10-27 12:05:38 +00:00
#include <com/sun/star/embed/ElementModes.hpp>
#include <com/sun/star/embed/EmbedUpdateModes.hpp>
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/frame/XStorable.hpp>
#include <com/sun/star/frame/XLoadable.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/frame/XModule.hpp>
2003-10-27 12:05:38 +00:00
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
#include <com/sun/star/lang/XSingleServiceFactory.hpp>
#include <com/sun/star/lang/DisposedException.hpp>
#include <com/sun/star/util/XModifiable.hpp>
#ifndef _COM_SUN_STAR_CONTAINER_XNAMEACCEESS_HPP_
#include <com/sun/star/container/XNameAccess.hpp>
#endif
#include <com/sun/star/container/XChild.hpp>
2003-10-27 12:05:38 +00:00
#include <com/sun/star/util/XCloseable.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/IllegalTypeException.hpp>
#include <com/sun/star/chart2/XChartDocument.hpp>
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
#include <comphelper/fileformat.h>
#include <comphelper/storagehelper.hxx>
#include <comphelper/mimeconfighelper.hxx>
#include <comphelper/namedvaluecollection.hxx>
#include <rtl/logfile.hxx>
2003-10-27 12:05:38 +00:00
#include <tools/diagnose_ex.h>
#define USE_STORAGEBASED_DOCUMENT
2003-10-27 12:05:38 +00:00
using namespace ::com::sun::star;
//------------------------------------------------------
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
uno::Sequence< beans::PropertyValue > GetValuableArgs_Impl( const uno::Sequence< beans::PropertyValue >& aMedDescr,
sal_Bool bCanUseDocumentBaseURL )
{
uno::Sequence< beans::PropertyValue > aResult;
sal_Int32 nResLen = 0;
for ( sal_Int32 nInd = 0; nInd < aMedDescr.getLength(); nInd++ )
{
if ( aMedDescr[nInd].Name.equalsAscii( "ComponentData" )
|| aMedDescr[nInd].Name.equalsAscii( "DocumentTitle" )
|| aMedDescr[nInd].Name.equalsAscii( "InteractionHandler" )
|| aMedDescr[nInd].Name.equalsAscii( "JumpMark" )
// || aMedDescr[nInd].Name.equalsAscii( "Password" ) makes no sence for embedded objects
|| aMedDescr[nInd].Name.equalsAscii( "Preview" )
|| aMedDescr[nInd].Name.equalsAscii( "ReadOnly" )
|| aMedDescr[nInd].Name.equalsAscii( "StartPresentation" )
|| aMedDescr[nInd].Name.equalsAscii( "RepairPackage" )
|| aMedDescr[nInd].Name.equalsAscii( "StatusIndicator" )
|| aMedDescr[nInd].Name.equalsAscii( "ViewData" )
|| aMedDescr[nInd].Name.equalsAscii( "ViewId" )
|| aMedDescr[nInd].Name.equalsAscii( "MacroExecutionMode" )
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
|| aMedDescr[nInd].Name.equalsAscii( "UpdateDocMode" )
CWS-TOOLING: integrate CWS cmcfixes51 2008-12-08 10:12:55 +0100 cmc r264975 : #i96203# protect with ifdefs to avoid unused symbol on mac 2008-12-05 12:23:47 +0100 cmc r264898 : CWS-TOOLING: rebase CWS cmcfixes51 to trunk@264807 (milestone: DEV300:m37) 2008-12-01 14:45:17 +0100 cmc r264606 : #i76655# ehlos apparently required 2008-11-28 17:49:30 +0100 cmc r264567 : #i96655# remove newly unused method 2008-11-28 10:41:28 +0100 cmc r264531 : #i96647# better ppc-bridges flushCode impl 2008-11-27 12:58:40 +0100 cmc r264478 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 12:32:49 +0100 cmc r264476 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 12:26:02 +0100 cmc r264475 : #i96655# redundant old table export helpers 2008-11-27 11:49:06 +0100 cmc r264473 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 11:38:35 +0100 cmc r264471 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 11:14:21 +0100 cmc r264467 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 11:06:22 +0100 cmc r264464 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 10:58:18 +0100 cmc r264462 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 10:41:44 +0100 cmc r264461 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 10:19:24 +0100 cmc r264460 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 10:13:39 +0100 cmc r264459 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 10:06:14 +0100 cmc r264458 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 09:59:54 +0100 cmc r264457 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 09:52:51 +0100 cmc r264456 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 09:48:26 +0100 cmc r264454 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 09:40:20 +0100 cmc r264452 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 09:35:26 +0100 cmc r264451 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 09:31:00 +0100 cmc r264450 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 09:24:08 +0100 cmc r264449 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 00:26:15 +0100 cmc r264443 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 00:21:01 +0100 cmc r264442 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-27 00:09:40 +0100 cmc r264441 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 23:51:56 +0100 cmc r264440 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 23:49:09 +0100 cmc r264439 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 18:09:54 +0100 cmc r264432 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 18:07:40 +0100 cmc r264431 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 17:28:02 +0100 cmc r264429 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 17:27:39 +0100 cmc r264428 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 17:18:36 +0100 cmc r264426 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 16:22:16 +0100 cmc r264415 : #i96624# make implicit braces and brackets explicit to avoid warnings 2008-11-26 16:00:23 +0100 cmc r264409 : #i90426# remove warnings from svtools 2008-11-26 15:59:17 +0100 cmc r264408 : #i90426# remove warnings 2008-11-26 15:47:32 +0100 cmc r264404 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 14:46:57 +0100 cmc r264394 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 14:19:50 +0100 cmc r264387 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 14:15:26 +0100 cmc r264386 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 14:11:26 +0100 cmc r264384 : #i96084# confirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 13:44:23 +0100 cmc r264380 : #i96084# comfirm existing logic with explicit brackets to remove new gcc warnings 2008-11-26 13:12:24 +0100 cmc r264372 : #i96604# silence new warnings 2008-11-26 12:35:02 +0100 cmc r264369 : #i96203# make qstarter work in 3-layer land 2008-11-26 12:33:04 +0100 cmc r264368 : #i96170# ensure gtypes are up and running
2008-12-11 07:05:03 +00:00
|| (aMedDescr[nInd].Name.equalsAscii( "DocumentBaseURL" ) && bCanUseDocumentBaseURL) )
{
aResult.realloc( ++nResLen );
aResult[nResLen-1] = aMedDescr[nInd];
}
}
return aResult;
}
2003-10-27 12:05:38 +00:00
//------------------------------------------------------
uno::Sequence< beans::PropertyValue > addAsTemplate( const uno::Sequence< beans::PropertyValue >& aOrig )
{
sal_Bool bAsTemplateSet = sal_False;
sal_Int32 nLength = aOrig.getLength();
uno::Sequence< beans::PropertyValue > aResult( nLength );
for ( sal_Int32 nInd = 0; nInd < nLength; nInd++ )
{
aResult[nInd].Name = aOrig[nInd].Name;
if ( aResult[nInd].Name.equalsAscii( "AsTemplate" ) )
{
aResult[nInd].Value <<= sal_True;
bAsTemplateSet = sal_True;
}
else
aResult[nInd].Value = aOrig[nInd].Value;
}
if ( !bAsTemplateSet )
{
aResult.realloc( nLength + 1 );
aResult[nLength].Name = ::rtl::OUString::createFromAscii( "AsTemplate" );
aResult[nLength].Value <<= sal_True;
}
return aResult;
}
//------------------------------------------------------
uno::Reference< io::XInputStream > createTempInpStreamFromStor(
const uno::Reference< embed::XStorage >& xStorage,
const uno::Reference< lang::XMultiServiceFactory >& xFactory )
{
OSL_ENSURE( xStorage.is(), "The storage can not be empty!" );
uno::Reference< io::XInputStream > xResult;
const ::rtl::OUString aServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.io.TempFile" ) );
uno::Reference < io::XStream > xTempStream = uno::Reference < io::XStream > (
xFactory->createInstance ( aServiceName ),
uno::UNO_QUERY );
if ( xTempStream.is() )
{
uno::Reference < lang::XSingleServiceFactory > xStorageFactory(
xFactory->createInstance ( ::rtl::OUString::createFromAscii( "com.sun.star.embed.StorageFactory" ) ),
uno::UNO_QUERY );
uno::Sequence< uno::Any > aArgs( 2 );
aArgs[0] <<= xTempStream;
aArgs[1] <<= embed::ElementModes::READWRITE;
2003-10-27 12:05:38 +00:00
uno::Reference< embed::XStorage > xTempStorage( xStorageFactory->createInstanceWithArguments( aArgs ),
uno::UNO_QUERY );
if ( !xTempStorage.is() )
throw uno::RuntimeException(); // TODO:
try
{
xStorage->copyToStorage( xTempStorage );
} catch( uno::Exception& e )
{
throw embed::StorageWrappedTargetException(
2003-10-27 12:05:38 +00:00
::rtl::OUString::createFromAscii( "Can't copy storage!" ),
uno::Reference< uno::XInterface >(),
uno::makeAny( e ) );
}
try {
uno::Reference< lang::XComponent > xComponent( xTempStorage, uno::UNO_QUERY );
OSL_ENSURE( xComponent.is(), "Wrong storage implementation!" );
if ( xComponent.is() )
xComponent->dispose();
}
catch ( uno::Exception& )
{
}
try {
uno::Reference< io::XOutputStream > xTempOut = xTempStream->getOutputStream();
if ( xTempOut.is() )
xTempOut->closeOutput();
}
catch ( uno::Exception& )
{
}
xResult = xTempStream->getInputStream();
}
return xResult;
}
//------------------------------------------------------
static void TransferMediaType( const uno::Reference< embed::XStorage >& i_rSource, const uno::Reference< embed::XStorage >& i_rTarget )
{
try
{
const uno::Reference< beans::XPropertySet > xSourceProps( i_rSource, uno::UNO_QUERY_THROW );
const uno::Reference< beans::XPropertySet > xTargetProps( i_rTarget, uno::UNO_QUERY_THROW );
const ::rtl::OUString sMediaTypePropName( RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) );
xTargetProps->setPropertyValue( sMediaTypePropName, xSourceProps->getPropertyValue( sMediaTypePropName ) );
}
catch( const uno::Exception& )
{
DBG_UNHANDLED_EXCEPTION();
}
}
//------------------------------------------------------
static uno::Reference< util::XCloseable > CreateDocument( const uno::Reference< lang::XMultiServiceFactory >& _rxFactory,
const ::rtl::OUString& _rDocumentServiceName, bool _bEmbeddedScriptSupport, const bool i_bDocumentRecoverySupport )
{
::comphelper::NamedValueCollection aArguments;
aArguments.put( "EmbeddedObject", (sal_Bool)sal_True );
aArguments.put( "EmbeddedScriptSupport", (sal_Bool)_bEmbeddedScriptSupport );
aArguments.put( "DocumentRecoverySupport", (sal_Bool)i_bDocumentRecoverySupport );
uno::Reference< uno::XInterface > xDocument;
try
{
xDocument = _rxFactory->createInstanceWithArguments( _rDocumentServiceName, aArguments.getWrappedPropertyValues() );
}
catch( const uno::Exception& )
{
// some of our embedded object implementations (in particular chart) do neither support
// the EmbeddedObject, nor the EmbeddedScriptSupport argument. Also, they do not support
// XInitialization, which means the default factory from cppuhelper will throw an
// IllegalArgumentException when we try to create the instance with arguments.
// Okay, so we fall back to creating the instance without any arguments.
xDocument = _rxFactory->createInstance( _rDocumentServiceName );
}
return uno::Reference< util::XCloseable >( xDocument, uno::UNO_QUERY );
}
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
//------------------------------------------------------
static void SetDocToEmbedded( const uno::Reference< frame::XModel > xDocument, const ::rtl::OUString& aModuleName )
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
{
if ( xDocument.is() )
{
uno::Sequence< beans::PropertyValue > aSeq( 1 );
aSeq[0].Name = ::rtl::OUString::createFromAscii( "SetEmbedded" );
aSeq[0].Value <<= sal_True;
xDocument->attachResource( ::rtl::OUString(), aSeq );
if ( aModuleName.getLength() )
{
try
{
uno::Reference< frame::XModule > xModule( xDocument, uno::UNO_QUERY_THROW );
xModule->setIdentifier( aModuleName );
}
catch( uno::Exception& )
{}
}
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
}
}
//------------------------------------------------------
void OCommonEmbeddedObject::SwitchOwnPersistence( const uno::Reference< embed::XStorage >& xNewParentStorage,
const uno::Reference< embed::XStorage >& xNewObjectStorage,
const ::rtl::OUString& aNewName )
{
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
if ( xNewParentStorage == m_xParentStorage && aNewName.equals( m_aEntryName ) )
{
OSL_ENSURE( xNewObjectStorage == m_xObjectStorage, "The storage must be the same!\n" );
return;
}
uno::Reference< lang::XComponent > xComponent( m_xObjectStorage, uno::UNO_QUERY );
OSL_ENSURE( !m_xObjectStorage.is() || xComponent.is(), "Wrong storage implementation!" );
m_xObjectStorage = xNewObjectStorage;
m_xParentStorage = xNewParentStorage;
m_aEntryName = aNewName;
#ifdef USE_STORAGEBASED_DOCUMENT
// the linked document should not be switched
if ( !m_bIsLink )
{
uno::Reference< document::XStorageBasedDocument > xDoc( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
if ( xDoc.is() )
SwitchDocToStorage_Impl( xDoc, m_xObjectStorage );
}
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
#endif
try {
if ( xComponent.is() )
xComponent->dispose();
}
catch ( uno::Exception& )
{
}
}
//------------------------------------------------------
void OCommonEmbeddedObject::SwitchOwnPersistence( const uno::Reference< embed::XStorage >& xNewParentStorage,
const ::rtl::OUString& aNewName )
{
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
if ( xNewParentStorage == m_xParentStorage && aNewName.equals( m_aEntryName ) )
return;
sal_Int32 nStorageMode = m_bReadOnly ? embed::ElementModes::READ : embed::ElementModes::READWRITE;
uno::Reference< embed::XStorage > xNewOwnStorage = xNewParentStorage->openStorageElement( aNewName, nStorageMode );
OSL_ENSURE( xNewOwnStorage.is(), "The method can not return empty reference!" );
SwitchOwnPersistence( xNewParentStorage, xNewOwnStorage, aNewName );
}
//------------------------------------------------------
void OCommonEmbeddedObject::EmbedAndReparentDoc_Impl( const uno::Reference< util::XCloseable >& i_rxDocument ) const
{
SetDocToEmbedded( uno::Reference< frame::XModel >( i_rxDocument, uno::UNO_QUERY ), m_aModuleName );
try
{
uno::Reference < container::XChild > xChild( i_rxDocument, uno::UNO_QUERY );
if ( xChild.is() )
xChild->setParent( m_xParent );
}
catch( const lang::NoSupportException & )
{
OSL_ENSURE( false, "OCommonEmbeddedObject::EmbedAndReparentDoc: cannot set parent at document!" );
}
}
2003-10-27 12:05:38 +00:00
//------------------------------------------------------
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
uno::Reference< util::XCloseable > OCommonEmbeddedObject::InitNewDocument_Impl()
2003-10-27 12:05:38 +00:00
{
uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xFactory, GetDocumentServiceName(),
m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) );
2003-10-27 12:05:38 +00:00
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
uno::Reference< frame::XModel > xModel( xDocument, uno::UNO_QUERY );
uno::Reference< frame::XLoadable > xLoadable( xModel, uno::UNO_QUERY );
2003-10-27 12:05:38 +00:00
if ( !xLoadable.is() )
throw uno::RuntimeException();
try
{
// set the document mode to embedded as the first action on document!!!
EmbedAndReparentDoc_Impl( xDocument );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
// if we have a storage to recover the document from, do not use initNew, but instead load from that storage
bool bInitNew = true;
if ( m_xRecoveryStorage.is() )
{
uno::Reference< document::XStorageBasedDocument > xDoc( xLoadable, uno::UNO_QUERY );
OSL_ENSURE( xDoc.is(), "OCommonEmbeddedObject::InitNewDocument_Impl: cannot recover from a storage when the document is not storage based!" );
if ( xDoc.is() )
{
::comphelper::NamedValueCollection aLoadArgs;
FillDefaultLoadArgs_Impl( m_xRecoveryStorage, aLoadArgs );
xDoc->loadFromStorage( m_xRecoveryStorage, aLoadArgs.getPropertyValues() );
SwitchDocToStorage_Impl( xDoc, m_xObjectStorage );
bInitNew = false;
}
}
if ( bInitNew )
{
// init document as a new
xLoadable->initNew();
}
xModel->attachResource( xModel->getURL(), m_aDocMediaDescriptor );
2003-10-27 12:05:38 +00:00
}
catch( uno::Exception& )
{
uno::Reference< util::XCloseable > xCloseable( xDocument, uno::UNO_QUERY );
if ( xCloseable.is() )
{
try
{
xCloseable->close( sal_True );
}
catch( uno::Exception& )
{
}
}
throw; // TODO
}
return xDocument;
}
//------------------------------------------------------
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl()
2003-10-27 12:05:38 +00:00
{
uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xFactory, GetDocumentServiceName(),
m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) );
2003-10-27 12:05:38 +00:00
uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY );
if ( !xLoadable.is() )
throw uno::RuntimeException();
sal_Int32 nLen = 2;
uno::Sequence< beans::PropertyValue > aArgs( nLen );
2003-10-27 12:05:38 +00:00
aArgs[0].Name = ::rtl::OUString::createFromAscii( "URL" );
aArgs[0].Value <<= m_aLinkURL;
aArgs[1].Name = ::rtl::OUString::createFromAscii( "FilterName" );
aArgs[1].Value <<= m_aLinkFilterName;
if ( m_bLinkHasPassword )
{
aArgs.realloc( ++nLen );
aArgs[nLen-1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Password" ) );
aArgs[nLen-1].Value <<= m_aLinkPassword;
}
aArgs.realloc( m_aDocMediaDescriptor.getLength() + nLen );
for ( sal_Int32 nInd = 0; nInd < m_aDocMediaDescriptor.getLength(); nInd++ )
{
aArgs[nInd+nLen].Name = m_aDocMediaDescriptor[nInd].Name;
aArgs[nInd+nLen].Value = m_aDocMediaDescriptor[nInd].Value;
}
2003-10-27 12:05:38 +00:00
try
{
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
// the document is not really an embedded one, it is a link
EmbedAndReparentDoc_Impl( xDocument );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
// load the document
2003-10-27 12:05:38 +00:00
xLoadable->load( aArgs );
if ( !m_bLinkHasPassword )
{
// check if there is a password to cache
uno::Reference< frame::XModel > xModel( xLoadable, uno::UNO_QUERY_THROW );
uno::Sequence< beans::PropertyValue > aProps = xModel->getArgs();
for ( sal_Int32 nInd = 0; nInd < aProps.getLength(); nInd++ )
if ( aProps[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Password" ) ) )
&& ( aProps[nInd].Value >>= m_aLinkPassword ) )
{
m_bLinkHasPassword = sal_True;
break;
}
}
2003-10-27 12:05:38 +00:00
}
catch( uno::Exception& )
{
uno::Reference< util::XCloseable > xCloseable( xDocument, uno::UNO_QUERY );
if ( xCloseable.is() )
{
try
{
xCloseable->close( sal_True );
}
catch( uno::Exception& )
{
}
}
throw; // TODO
}
return xDocument;
}
//------------------------------------------------------
::rtl::OUString OCommonEmbeddedObject::GetFilterName( sal_Int32 nVersion ) const
{
::rtl::OUString aFilterName = GetPresetFilterName();
if ( !aFilterName.getLength() )
{
try {
::comphelper::MimeConfigurationHelper aHelper( m_xFactory );
aFilterName = aHelper.GetDefaultFilterFromServiceName( GetDocumentServiceName(), nVersion );
} catch( uno::Exception& )
{}
}
return aFilterName;
}
//------------------------------------------------------
void OCommonEmbeddedObject::FillDefaultLoadArgs_Impl( const uno::Reference< embed::XStorage >& i_rxStorage,
::comphelper::NamedValueCollection& o_rLoadArgs ) const
{
o_rLoadArgs.put( "DocumentBaseURL", GetBaseURL_Impl() );
o_rLoadArgs.put( "HierarchicalDocumentName", m_aEntryName );
o_rLoadArgs.put( "ReadOnly", m_bReadOnly );
::rtl::OUString aFilterName = GetFilterName( ::comphelper::OStorageHelper::GetXStorageFormat( i_rxStorage ) );
OSL_ENSURE( aFilterName.getLength(), "OCommonEmbeddedObject::FillDefaultLoadArgs_Impl: Wrong document service name!" );
if ( !aFilterName.getLength() )
throw io::IOException(); // TODO: error message/code
o_rLoadArgs.put( "FilterName", aFilterName );
}
2003-10-27 12:05:38 +00:00
//------------------------------------------------------
uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorage_Impl()
2003-10-27 12:05:38 +00:00
{
ENSURE_OR_THROW( m_xObjectStorage.is(), "no object storage" );
const uno::Reference< embed::XStorage > xSourceStorage( m_xRecoveryStorage.is() ? m_xRecoveryStorage : m_xObjectStorage );
2003-10-27 12:05:38 +00:00
uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xFactory, GetDocumentServiceName(),
m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) );
//#i103460# ODF: take the size given from the parent frame as default
uno::Reference< chart2::XChartDocument > xChart( xDocument, uno::UNO_QUERY );
if( xChart.is() )
{
uno::Reference< embed::XVisualObject > xChartVisualObject( xChart, uno::UNO_QUERY );
if( xChartVisualObject.is() )
xChartVisualObject->setVisualAreaSize( embed::Aspects::MSOLE_CONTENT, m_aDefaultSizeForChart_In_100TH_MM );
}
2003-10-27 12:05:38 +00:00
uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
uno::Reference< document::XStorageBasedDocument > xDoc
#ifdef USE_STORAGEBASED_DOCUMENT
( xDocument, uno::UNO_QUERY )
#endif
;
if ( !xDoc.is() && !xLoadable.is() ) ///BUG: This should be || instead of && ?
2003-10-27 12:05:38 +00:00
throw uno::RuntimeException();
::comphelper::NamedValueCollection aLoadArgs;
FillDefaultLoadArgs_Impl( xSourceStorage, aLoadArgs );
2004-10-13 17:03:30 +00:00
uno::Reference< io::XInputStream > xTempInpStream;
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
if ( !xDoc.is() )
{
xTempInpStream = createTempInpStreamFromStor( xSourceStorage, m_xFactory );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
if ( !xTempInpStream.is() )
throw uno::RuntimeException();
::rtl::OUString aTempFileURL;
try
{
// no need to let the file stay after the stream is removed since the embedded document
// can not be stored directly
uno::Reference< beans::XPropertySet > xTempStreamProps( xTempInpStream, uno::UNO_QUERY_THROW );
xTempStreamProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Uri" ) ) >>= aTempFileURL;
}
catch( uno::Exception& )
{
}
OSL_ENSURE( aTempFileURL.getLength(), "Coudn't retrieve temporary file URL!\n" );
aLoadArgs.put( "URL", aTempFileURL );
aLoadArgs.put( "InputStream", xTempInpStream );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
}
// aLoadArgs.put( "AsTemplate", sal_True );
2003-10-27 12:05:38 +00:00
aLoadArgs.merge( m_aDocMediaDescriptor, true );
2003-10-27 12:05:38 +00:00
try
{
// set the document mode to embedded as the first step!!!
EmbedAndReparentDoc_Impl( xDocument );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
if ( xDoc.is() )
{
xDoc->loadFromStorage( xSourceStorage, aLoadArgs.getPropertyValues() );
if ( xSourceStorage != m_xObjectStorage )
SwitchDocToStorage_Impl( xDoc, m_xObjectStorage );
}
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
else
xLoadable->load( aLoadArgs.getPropertyValues() );
2003-10-27 12:05:38 +00:00
}
catch( uno::Exception& )
{
uno::Reference< util::XCloseable > xCloseable( xDocument, uno::UNO_QUERY );
if ( xCloseable.is() )
{
try
{
xCloseable->close( sal_True );
}
catch( uno::Exception& )
{
DBG_UNHANDLED_EXCEPTION();
2003-10-27 12:05:38 +00:00
}
}
throw; // TODO
}
return xDocument;
}
//------------------------------------------------------
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
uno::Reference< io::XInputStream > OCommonEmbeddedObject::StoreDocumentToTempStream_Impl(
sal_Int32 nStorageFormat,
const ::rtl::OUString& aBaseURL,
const ::rtl::OUString& aHierarchName )
2003-10-27 12:05:38 +00:00
{
uno::Reference < io::XOutputStream > xTempOut(
m_xFactory->createInstance ( ::rtl::OUString::createFromAscii( "com.sun.star.io.TempFile" ) ),
uno::UNO_QUERY );
uno::Reference< io::XInputStream > aResult( xTempOut, uno::UNO_QUERY );
if ( !xTempOut.is() || !aResult.is() )
throw uno::RuntimeException(); // TODO:
uno::Reference< frame::XStorable > xStorable;
{
osl::MutexGuard aGuard( m_aMutex );
if ( m_pDocHolder )
xStorable = uno::Reference< frame::XStorable > ( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
}
2003-10-27 12:05:38 +00:00
if( !xStorable.is() )
throw uno::RuntimeException(); // TODO:
::rtl::OUString aFilterName = GetFilterName( nStorageFormat );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
2003-10-27 12:05:38 +00:00
OSL_ENSURE( aFilterName.getLength(), "Wrong document service name!" );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
if ( !aFilterName.getLength() )
throw io::IOException(); // TODO:
2003-10-27 12:05:38 +00:00
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
uno::Sequence< beans::PropertyValue > aArgs( 4 );
2003-10-27 12:05:38 +00:00
aArgs[0].Name = ::rtl::OUString::createFromAscii( "FilterName" );
aArgs[0].Value <<= aFilterName;
aArgs[1].Name = ::rtl::OUString::createFromAscii( "OutputStream" );
aArgs[1].Value <<= xTempOut;
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
aArgs[2].Name = ::rtl::OUString::createFromAscii( "DocumentBaseURL" );
aArgs[2].Value <<= aBaseURL;
aArgs[3].Name = ::rtl::OUString::createFromAscii( "HierarchicalDocumentName" );
aArgs[3].Value <<= aHierarchName;
2003-10-27 12:05:38 +00:00
xStorable->storeToURL( ::rtl::OUString::createFromAscii( "private:stream" ), aArgs );
try
{
xTempOut->closeOutput();
}
catch( uno::Exception& )
{
OSL_ENSURE( sal_False, "Looks like stream was closed already" );
}
return aResult;
}
//------------------------------------------------------
void OCommonEmbeddedObject::SaveObject_Impl()
{
if ( m_xClientSite.is() )
{
try
{
// check whether the component is modified,
// if not there is no need for storing
uno::Reference< util::XModifiable > xModifiable( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
if ( xModifiable.is() && !xModifiable->isModified() )
return;
}
catch( uno::Exception& )
{}
2003-10-27 12:05:38 +00:00
try {
m_xClientSite->saveObject();
}
catch( uno::Exception& )
{
OSL_ENSURE( sal_False, "The object was not stored!\n" );
}
}
}
//------------------------------------------------------
::rtl::OUString OCommonEmbeddedObject::GetBaseURL_Impl() const
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
{
::rtl::OUString aBaseURL;
sal_Int32 nInd = 0;
if ( m_xClientSite.is() )
{
try
{
uno::Reference< frame::XModel > xParentModel( m_xClientSite->getComponent(), uno::UNO_QUERY_THROW );
uno::Sequence< beans::PropertyValue > aModelProps = xParentModel->getArgs();
for ( nInd = 0; nInd < aModelProps.getLength(); nInd++ )
if ( aModelProps[nInd].Name.equals(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DocumentBaseURL" ) ) ) )
{
aModelProps[nInd].Value >>= aBaseURL;
break;
}
}
catch( uno::Exception& )
{}
}
if ( !aBaseURL.getLength() )
{
for ( nInd = 0; nInd < m_aDocMediaDescriptor.getLength(); nInd++ )
if ( m_aDocMediaDescriptor[nInd].Name.equals(
::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DocumentBaseURL" ) ) ) )
{
m_aDocMediaDescriptor[nInd].Value >>= aBaseURL;
break;
}
}
if ( !aBaseURL.getLength() )
aBaseURL = m_aDefaultParentBaseURL;
return aBaseURL;
}
//------------------------------------------------------
::rtl::OUString OCommonEmbeddedObject::GetBaseURLFrom_Impl(
const uno::Sequence< beans::PropertyValue >& lArguments,
const uno::Sequence< beans::PropertyValue >& lObjArgs )
{
::rtl::OUString aBaseURL;
sal_Int32 nInd = 0;
for ( nInd = 0; nInd < lArguments.getLength(); nInd++ )
if ( lArguments[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DocumentBaseURL" ) ) ) )
{
lArguments[nInd].Value >>= aBaseURL;
break;
}
if ( !aBaseURL.getLength() )
{
for ( nInd = 0; nInd < lObjArgs.getLength(); nInd++ )
if ( lObjArgs[nInd].Name.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultParentBaseURL" ) ) ) )
{
lObjArgs[nInd].Value >>= aBaseURL;
break;
}
}
return aBaseURL;
}
//------------------------------------------------------
void OCommonEmbeddedObject::SwitchDocToStorage_Impl( const uno::Reference< document::XStorageBasedDocument >& xDoc, const uno::Reference< embed::XStorage >& xStorage )
{
xDoc->switchToStorage( xStorage );
uno::Reference< util::XModifiable > xModif( xDoc, uno::UNO_QUERY );
if ( xModif.is() )
xModif->setModified( sal_False );
if ( m_xRecoveryStorage.is() )
m_xRecoveryStorage.clear();
}
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
//------------------------------------------------------
void OCommonEmbeddedObject::StoreDocToStorage_Impl( const uno::Reference< embed::XStorage >& xStorage,
sal_Int32 nStorageFormat,
const ::rtl::OUString& aBaseURL,
const ::rtl::OUString& aHierarchName,
sal_Bool bAttachToTheStorage )
2003-10-27 12:05:38 +00:00
{
OSL_ENSURE( xStorage.is(), "No storage is provided for storing!" );
if ( !xStorage.is() )
throw uno::RuntimeException(); // TODO:
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
#ifdef USE_STORAGEBASED_DOCUMENT
uno::Reference< document::XStorageBasedDocument > xDoc;
{
osl::MutexGuard aGuard( m_aMutex );
if ( m_pDocHolder )
xDoc = uno::Reference< document::XStorageBasedDocument >( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
}
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
if ( xDoc.is() )
{
::rtl::OUString aFilterName = GetFilterName( nStorageFormat );
2003-10-27 12:05:38 +00:00
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
OSL_ENSURE( aFilterName.getLength(), "Wrong document service name!" );
if ( !aFilterName.getLength() )
throw io::IOException(); // TODO:
2003-10-27 12:05:38 +00:00
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
uno::Sequence< beans::PropertyValue > aArgs( 3 );
aArgs[0].Name = ::rtl::OUString::createFromAscii( "FilterName" );
aArgs[0].Value <<= aFilterName;
aArgs[2].Name = ::rtl::OUString::createFromAscii( "DocumentBaseURL" );
aArgs[2].Value <<= aBaseURL;
aArgs[1].Name = ::rtl::OUString::createFromAscii( "HierarchicalDocumentName" );
aArgs[1].Value <<= aHierarchName;
xDoc->storeToStorage( xStorage, aArgs );
if ( bAttachToTheStorage )
SwitchDocToStorage_Impl( xDoc, xStorage );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
}
else
#endif
{
// store document to temporary stream based on temporary file
uno::Reference < io::XInputStream > xTempIn = StoreDocumentToTempStream_Impl( nStorageFormat, aBaseURL, aHierarchName );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
OSL_ENSURE( xTempIn.is(), "The stream reference can not be empty!\n" );
// open storage based on document temporary file for reading
uno::Reference < lang::XSingleServiceFactory > xStorageFactory(
m_xFactory->createInstance ( ::rtl::OUString::createFromAscii( "com.sun.star.embed.StorageFactory" ) ),
uno::UNO_QUERY );
uno::Sequence< uno::Any > aArgs(1);
aArgs[0] <<= xTempIn;
uno::Reference< embed::XStorage > xTempStorage( xStorageFactory->createInstanceWithArguments( aArgs ),
uno::UNO_QUERY );
if ( !xTempStorage.is() )
throw uno::RuntimeException(); // TODO:
2003-10-27 12:05:38 +00:00
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
// object storage must be commited automatically
xTempStorage->copyToStorage( xStorage );
}
2003-10-27 12:05:38 +00:00
}
//------------------------------------------------------
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
uno::Reference< util::XCloseable > OCommonEmbeddedObject::CreateDocFromMediaDescr_Impl(
2003-10-27 12:05:38 +00:00
const uno::Sequence< beans::PropertyValue >& aMedDescr )
{
uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xFactory, GetDocumentServiceName(),
m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) );
2003-10-27 12:05:38 +00:00
uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY );
if ( !xLoadable.is() )
throw uno::RuntimeException();
try
{
// set the document mode to embedded as the first action on the document!!!
EmbedAndReparentDoc_Impl( xDocument );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
xLoadable->load( addAsTemplate( aMedDescr ) );
2003-10-27 12:05:38 +00:00
}
catch( uno::Exception& )
{
uno::Reference< util::XCloseable > xCloseable( xDocument, uno::UNO_QUERY );
if ( xCloseable.is() )
{
try
{
xCloseable->close( sal_True );
}
catch( uno::Exception& )
{
}
}
throw; // TODO
}
return xDocument;
}
//------------------------------------------------------
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
uno::Reference< util::XCloseable > OCommonEmbeddedObject::CreateTempDocFromLink_Impl()
2003-10-27 12:05:38 +00:00
{
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
uno::Reference< util::XCloseable > xResult;
2003-10-27 12:05:38 +00:00
OSL_ENSURE( m_bIsLink, "The object is not a linked one!\n" );
uno::Sequence< beans::PropertyValue > aTempMediaDescr;
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
sal_Int32 nStorageFormat = SOFFICE_FILEFORMAT_CURRENT;
try {
nStorageFormat = ::comphelper::OStorageHelper::GetXStorageFormat( m_xParentStorage );
}
catch ( beans::IllegalTypeException& )
{
// the container just has an unknown type, use current file format
}
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
catch ( uno::Exception& )
{
OSL_ENSURE( sal_False, "Can not retrieve storage media type!\n" );
}
if ( m_pDocHolder->GetComponent().is() )
2003-10-27 12:05:38 +00:00
{
aTempMediaDescr.realloc( 4 );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
// TODO/LATER: may be private:stream should be used as target URL
::rtl::OUString aTempFileURL;
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
uno::Reference< io::XInputStream > xTempStream = StoreDocumentToTempStream_Impl( SOFFICE_FILEFORMAT_CURRENT,
::rtl::OUString(),
::rtl::OUString() );
try
{
// no need to let the file stay after the stream is removed since the embedded document
// can not be stored directly
uno::Reference< beans::XPropertySet > xTempStreamProps( xTempStream, uno::UNO_QUERY_THROW );
xTempStreamProps->getPropertyValue( ::rtl::OUString::createFromAscii( "Uri" ) ) >>= aTempFileURL;
}
catch( uno::Exception& )
{
}
OSL_ENSURE( aTempFileURL.getLength(), "Coudn't retrieve temporary file URL!\n" );
2003-10-27 12:05:38 +00:00
aTempMediaDescr[0].Name = ::rtl::OUString::createFromAscii( "URL" );
aTempMediaDescr[0].Value <<= aTempFileURL;
2003-10-27 12:05:38 +00:00
aTempMediaDescr[1].Name = ::rtl::OUString::createFromAscii( "InputStream" );
aTempMediaDescr[1].Value <<= xTempStream;
2003-10-27 12:05:38 +00:00
aTempMediaDescr[2].Name = ::rtl::OUString::createFromAscii( "FilterName" );
aTempMediaDescr[2].Value <<= GetFilterName( nStorageFormat );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
aTempMediaDescr[3].Name = ::rtl::OUString::createFromAscii( "AsTemplate" );
aTempMediaDescr[3].Value <<= sal_True;
2003-10-27 12:05:38 +00:00
}
else
{
aTempMediaDescr.realloc( 2 );
2003-10-27 12:05:38 +00:00
aTempMediaDescr[0].Name = ::rtl::OUString::createFromAscii( "URL" );
aTempMediaDescr[0].Value <<= m_aLinkURL;
aTempMediaDescr[1].Name = ::rtl::OUString::createFromAscii( "FilterName" );
aTempMediaDescr[1].Value <<= m_aLinkFilterName;
// aTempMediaDescr[2].Name = ::rtl::OUString::createFromAscii( "AsTemplate" );
// aTempMediaDescr[2].Value <<= sal_True;
2003-10-27 12:05:38 +00:00
}
xResult = CreateDocFromMediaDescr_Impl( aTempMediaDescr );
return xResult;
}
//------------------------------------------------------
void SAL_CALL OCommonEmbeddedObject::setPersistentEntry(
2003-10-27 12:05:38 +00:00
const uno::Reference< embed::XStorage >& xStorage,
const ::rtl::OUString& sEntName,
sal_Int32 nEntryConnectionMode,
const uno::Sequence< beans::PropertyValue >& lArguments,
const uno::Sequence< beans::PropertyValue >& lObjArgs )
2003-10-27 12:05:38 +00:00
throw ( lang::IllegalArgumentException,
embed::WrongStateException,
io::IOException,
uno::Exception,
uno::RuntimeException )
{
RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OCommonEmbeddedObject::setPersistentEntry" );
2003-10-27 12:05:38 +00:00
// the type of the object must be already set
// a kind of typedetection should be done in the factory
::osl::MutexGuard aGuard( m_aMutex );
if ( m_bDisposed )
throw lang::DisposedException(); // TODO
if ( !xStorage.is() )
throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "No parent storage is provided!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
2003-10-27 12:05:38 +00:00
1 );
if ( !sEntName.getLength() )
throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "Empty element name is provided!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
2003-10-27 12:05:38 +00:00
2 );
// May be LOADED should be forbidden here ???
if ( ( m_nObjectState != -1 || nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
&& ( m_nObjectState == -1 || nEntryConnectionMode != embed::EntryInitModes::NO_INIT ) )
2003-10-27 12:05:38 +00:00
{
// if the object is not loaded
// it can not get persistant representation without initialization
// if the object is loaded
// it can switch persistant representation only without initialization
throw embed::WrongStateException(
::rtl::OUString::createFromAscii( "Can't change persistant representation of activated object!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
2003-10-27 12:05:38 +00:00
}
if ( m_bWaitSaveCompleted )
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
{
if ( nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
saveCompleted( ( m_xParentStorage != xStorage || !m_aEntryName.equals( sEntName ) ) );
else
throw embed::WrongStateException(
::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
}
2003-10-27 12:05:38 +00:00
// for now support of this interface is required to allow breaking of links and converting them to normal embedded
// objects, so the persist name must be handled correctly ( althowgh no real persist entry is used )
// OSL_ENSURE( !m_bIsLink, "This method implementation must not be used for links!\n" );
if ( m_bIsLink )
{
m_aEntryName = sEntName;
return;
}
2003-10-27 12:05:38 +00:00
uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY );
if ( !xNameAccess.is() )
throw uno::RuntimeException(); //TODO
// detect entry existence
sal_Bool bElExists = xNameAccess->hasByName( sEntName );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
m_aDocMediaDescriptor = GetValuableArgs_Impl( lArguments,
nEntryConnectionMode != embed::EntryInitModes::MEDIA_DESCRIPTOR_INIT );
2003-10-27 12:05:38 +00:00
m_bReadOnly = sal_False;
for ( sal_Int32 nInd = 0; nInd < lArguments.getLength(); nInd++ )
if ( lArguments[nInd].Name.equalsAscii( "ReadOnly" ) )
lArguments[nInd].Value >>= m_bReadOnly;
// TODO: use lObjArgs for StoreVisualReplacement
for ( sal_Int32 nObjInd = 0; nObjInd < lObjArgs.getLength(); nObjInd++ )
if ( lObjArgs[nObjInd].Name.equalsAscii( "OutplaceDispatchInterceptor" ) )
{
uno::Reference< frame::XDispatchProviderInterceptor > xDispatchInterceptor;
if ( lObjArgs[nObjInd].Value >>= xDispatchInterceptor )
m_pDocHolder->SetOutplaceDispatchInterceptor( xDispatchInterceptor );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
}
else if ( lObjArgs[nObjInd].Name.equalsAscii( "DefaultParentBaseURL" ) )
{
lObjArgs[nObjInd].Value >>= m_aDefaultParentBaseURL;
}
else if ( lObjArgs[nObjInd].Name.equalsAscii( "Parent" ) )
{
lObjArgs[nObjInd].Value >>= m_xParent;
}
else if ( lObjArgs[nObjInd].Name.equalsAscii( "IndividualMiscStatus" ) )
{
sal_Int64 nMiscStatus=0;
lObjArgs[nObjInd].Value >>= nMiscStatus;
m_nMiscStatus |= nMiscStatus;
}
else if ( lObjArgs[nObjInd].Name.equalsAscii( "CloneFrom" ) )
{
uno::Reference < embed::XEmbeddedObject > xObj;
lObjArgs[nObjInd].Value >>= xObj;
if ( xObj.is() )
{
m_bHasClonedSize = sal_True;
m_aClonedSize = xObj->getVisualAreaSize( embed::Aspects::MSOLE_CONTENT );
m_nClonedMapUnit = xObj->getMapUnit( embed::Aspects::MSOLE_CONTENT );
}
}
else if ( lObjArgs[nObjInd].Name.equalsAscii( "OutplaceFrameProperties" ) )
{
uno::Sequence< uno::Any > aOutFrameProps;
uno::Sequence< beans::NamedValue > aOutFramePropsTyped;
if ( lObjArgs[nObjInd].Value >>= aOutFrameProps )
{
m_pDocHolder->SetOutplaceFrameProperties( aOutFrameProps );
}
else if ( lObjArgs[nObjInd].Value >>= aOutFramePropsTyped )
{
aOutFrameProps.realloc( aOutFramePropsTyped.getLength() );
uno::Any* pProp = aOutFrameProps.getArray();
for ( const beans::NamedValue* pTypedProp = aOutFramePropsTyped.getConstArray();
pTypedProp != aOutFramePropsTyped.getConstArray() + aOutFramePropsTyped.getLength();
++pTypedProp, ++pProp
)
{
*pProp <<= *pTypedProp;
}
m_pDocHolder->SetOutplaceFrameProperties( aOutFrameProps );
}
else
OSL_ENSURE( false, "OCommonEmbeddedObject::setPersistentEntry: illegal type for argument 'OutplaceFrameProperties'!" );
}
else if ( lObjArgs[nObjInd].Name.equalsAscii( "ModuleName" ) )
{
lObjArgs[nObjInd].Value >>= m_aModuleName;
}
else if ( lObjArgs[nObjInd].Name.equalsAscii( "EmbeddedScriptSupport" ) )
{
OSL_VERIFY( lObjArgs[nObjInd].Value >>= m_bEmbeddedScriptSupport );
}
else if ( lObjArgs[nObjInd].Name.equalsAscii( "DocumentRecoverySupport" ) )
{
OSL_VERIFY( lObjArgs[nObjInd].Value >>= m_bDocumentRecoverySupport );
}
else if ( lObjArgs[nObjInd].Name.equalsAscii( "RecoveryStorage" ) )
{
OSL_VERIFY( lObjArgs[nObjInd].Value >>= m_xRecoveryStorage );
}
sal_Int32 nStorageMode = m_bReadOnly ? embed::ElementModes::READ : embed::ElementModes::READWRITE;
2003-10-27 12:05:38 +00:00
SwitchOwnPersistence( xStorage, sEntName );
2003-10-27 12:05:38 +00:00
if ( nEntryConnectionMode == embed::EntryInitModes::DEFAULT_INIT )
2003-10-27 12:05:38 +00:00
{
if ( bElExists )
{
// the initialization from existing storage allows to leave object in loaded state
m_nObjectState = embed::EmbedStates::LOADED;
2003-10-27 12:05:38 +00:00
}
else
{
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
m_pDocHolder->SetComponent( InitNewDocument_Impl(), m_bReadOnly );
if ( !m_pDocHolder->GetComponent().is() )
2003-10-27 12:05:38 +00:00
throw io::IOException(); // TODO: can not create document
m_nObjectState = embed::EmbedStates::RUNNING;
2003-10-27 12:05:38 +00:00
}
}
else
{
if ( ( nStorageMode & embed::ElementModes::READWRITE ) != embed::ElementModes::READWRITE )
2003-10-27 12:05:38 +00:00
throw io::IOException();
if ( nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
2003-10-27 12:05:38 +00:00
{
// the document just already changed its storage to store to
// the links to OOo documents for now ignore this call
// TODO: OOo links will have persistence so it will be switched here
2003-10-27 12:05:38 +00:00
}
else if ( nEntryConnectionMode == embed::EntryInitModes::TRUNCATE_INIT )
2003-10-27 12:05:38 +00:00
{
if ( m_xRecoveryStorage.is() )
TransferMediaType( m_xRecoveryStorage, m_xObjectStorage );
2003-10-27 12:05:38 +00:00
// TODO:
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
m_pDocHolder->SetComponent( InitNewDocument_Impl(), m_bReadOnly );
2003-10-27 12:05:38 +00:00
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
if ( !m_pDocHolder->GetComponent().is() )
2003-10-27 12:05:38 +00:00
throw io::IOException(); // TODO: can not create document
m_nObjectState = embed::EmbedStates::RUNNING;
2003-10-27 12:05:38 +00:00
}
else if ( nEntryConnectionMode == embed::EntryInitModes::MEDIA_DESCRIPTOR_INIT )
2003-10-27 12:05:38 +00:00
{
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
m_pDocHolder->SetComponent( CreateDocFromMediaDescr_Impl( lArguments ), m_bReadOnly );
m_nObjectState = embed::EmbedStates::RUNNING;
2003-10-27 12:05:38 +00:00
}
//else if ( nEntryConnectionMode == embed::EntryInitModes::TRANSFERABLE_INIT )
2003-10-27 12:05:38 +00:00
//{
//TODO:
//}
else
throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "Wrong connection mode is provided!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
2003-10-27 12:05:38 +00:00
3 );
}
}
//------------------------------------------------------
void SAL_CALL OCommonEmbeddedObject::storeToEntry( const uno::Reference< embed::XStorage >& xStorage,
const ::rtl::OUString& sEntName,
const uno::Sequence< beans::PropertyValue >& lArguments,
const uno::Sequence< beans::PropertyValue >& lObjArgs )
2003-10-27 12:05:38 +00:00
throw ( lang::IllegalArgumentException,
embed::WrongStateException,
io::IOException,
uno::Exception,
uno::RuntimeException )
{
RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OCommonEmbeddedObject::storeToEntry" );
::osl::ResettableMutexGuard aGuard( m_aMutex );
2003-10-27 12:05:38 +00:00
if ( m_bDisposed )
throw lang::DisposedException(); // TODO
if ( m_nObjectState == -1 )
{
// the object is still not loaded
throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "Can't store object without persistence!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
2003-10-27 12:05:38 +00:00
}
if ( m_bWaitSaveCompleted )
throw embed::WrongStateException(
::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
2003-10-27 12:05:38 +00:00
// for now support of this interface is required to allow breaking of links and converting them to normal embedded
// objects, so the persist name must be handled correctly ( althowgh no real persist entry is used )
// OSL_ENSURE( !m_bIsLink, "This method implementation must not be used for links!\n" );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
if ( m_bIsLink )
return;
OSL_ENSURE( m_xParentStorage.is() && m_xObjectStorage.is(), "The object has no valid persistence!\n" );
2003-10-27 12:05:38 +00:00
sal_Int32 nTargetStorageFormat = SOFFICE_FILEFORMAT_CURRENT;
sal_Int32 nOriginalStorageFormat = SOFFICE_FILEFORMAT_CURRENT;
try {
nTargetStorageFormat = ::comphelper::OStorageHelper::GetXStorageFormat( xStorage );
}
catch ( beans::IllegalTypeException& )
{
// the container just has an unknown type, use current file format
}
catch ( uno::Exception& )
{
OSL_ENSURE( sal_False, "Can not retrieve target storage media type!\n" );
}
try
{
nOriginalStorageFormat = ::comphelper::OStorageHelper::GetXStorageFormat( m_xParentStorage );
}
catch ( beans::IllegalTypeException& )
{
// the container just has an unknown type, use current file format
}
catch ( uno::Exception& )
{
OSL_ENSURE( sal_False, "Can not retrieve own storage media type!\n" );
}
sal_Bool bTryOptimization = sal_False;
for ( sal_Int32 nInd = 0; nInd < lObjArgs.getLength(); nInd++ )
{
// StoreVisualReplacement and VisualReplacement args have no sence here
if ( lObjArgs[nInd].Name.equalsAscii( "CanTryOptimization" ) )
lObjArgs[nInd].Value >>= bTryOptimization;
}
sal_Bool bSwitchBackToLoaded = sal_False;
// Storing to different format can be done only in running state.
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
if ( m_nObjectState == embed::EmbedStates::LOADED )
{
// TODO/LATER: copying is not legal for documents with relative links.
if ( nTargetStorageFormat == nOriginalStorageFormat )
{
sal_Bool bOptimizationWorks = sal_False;
if ( bTryOptimization )
{
try
{
// try to use optimized copying
uno::Reference< embed::XOptimizedStorage > xSource( m_xParentStorage, uno::UNO_QUERY_THROW );
uno::Reference< embed::XOptimizedStorage > xTarget( xStorage, uno::UNO_QUERY_THROW );
xSource->copyElementDirectlyTo( m_aEntryName, xTarget, sEntName );
bOptimizationWorks = sal_True;
}
catch( uno::Exception& )
{
}
}
if ( !bOptimizationWorks )
m_xParentStorage->copyElementTo( m_aEntryName, xStorage, sEntName );
}
else
{
changeState( embed::EmbedStates::RUNNING );
bSwitchBackToLoaded = sal_True;
}
}
if ( m_nObjectState != embed::EmbedStates::LOADED )
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
{
uno::Reference< embed::XStorage > xSubStorage =
xStorage->openStorageElement( sEntName, embed::ElementModes::READWRITE );
2003-10-27 12:05:38 +00:00
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
if ( !xSubStorage.is() )
throw uno::RuntimeException(); //TODO
aGuard.clear();
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
// TODO/LATER: support hierarchical name for embedded objects in embedded objects
StoreDocToStorage_Impl( xSubStorage, nTargetStorageFormat, GetBaseURLFrom_Impl( lArguments, lObjArgs ), sEntName, sal_False );
aGuard.reset();
if ( bSwitchBackToLoaded )
changeState( embed::EmbedStates::LOADED );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
}
2003-10-27 12:05:38 +00:00
// TODO: should the listener notification be done?
}
//------------------------------------------------------
void SAL_CALL OCommonEmbeddedObject::storeAsEntry( const uno::Reference< embed::XStorage >& xStorage,
const ::rtl::OUString& sEntName,
const uno::Sequence< beans::PropertyValue >& lArguments,
const uno::Sequence< beans::PropertyValue >& lObjArgs )
2003-10-27 12:05:38 +00:00
throw ( lang::IllegalArgumentException,
embed::WrongStateException,
io::IOException,
uno::Exception,
uno::RuntimeException )
{
RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OCommonEmbeddedObject::storeAsEntry" );
// TODO: use lObjArgs
::osl::ResettableMutexGuard aGuard( m_aMutex );
2003-10-27 12:05:38 +00:00
if ( m_bDisposed )
throw lang::DisposedException(); // TODO
if ( m_nObjectState == -1 )
{
// the object is still not loaded
throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "Can't store object without persistence!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
2003-10-27 12:05:38 +00:00
}
if ( m_bWaitSaveCompleted )
throw embed::WrongStateException(
::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
2003-10-27 12:05:38 +00:00
// for now support of this interface is required to allow breaking of links and converting them to normal embedded
// objects, so the persist name must be handled correctly ( althowgh no real persist entry is used )
// OSL_ENSURE( !m_bIsLink, "This method implementation must not be used for links!\n" );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
if ( m_bIsLink )
{
m_aNewEntryName = sEntName;
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
return;
}
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
OSL_ENSURE( m_xParentStorage.is() && m_xObjectStorage.is(), "The object has no valid persistence!\n" );
sal_Int32 nTargetStorageFormat = SOFFICE_FILEFORMAT_CURRENT;
sal_Int32 nOriginalStorageFormat = SOFFICE_FILEFORMAT_CURRENT;
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
try {
nTargetStorageFormat = ::comphelper::OStorageHelper::GetXStorageFormat( xStorage );
}
catch ( beans::IllegalTypeException& )
{
// the container just has an unknown type, use current file format
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
}
catch ( uno::Exception& )
{
OSL_ENSURE( sal_False, "Can not retrieve target storage media type!\n" );
}
try
{
nOriginalStorageFormat = ::comphelper::OStorageHelper::GetXStorageFormat( m_xParentStorage );
}
catch ( beans::IllegalTypeException& )
{
// the container just has an unknown type, use current file format
}
catch ( uno::Exception& )
{
OSL_ENSURE( sal_False, "Can not retrieve own storage media type!\n" );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
}
PostEvent_Impl( ::rtl::OUString::createFromAscii( "OnSaveAs" ) );
sal_Bool bTryOptimization = sal_False;
for ( sal_Int32 nInd = 0; nInd < lObjArgs.getLength(); nInd++ )
{
// StoreVisualReplacement and VisualReplacement args have no sence here
if ( lObjArgs[nInd].Name.equalsAscii( "CanTryOptimization" ) )
lObjArgs[nInd].Value >>= bTryOptimization;
}
sal_Bool bSwitchBackToLoaded = sal_False;
// Storing to different format can be done only in running state.
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
if ( m_nObjectState == embed::EmbedStates::LOADED )
{
// TODO/LATER: copying is not legal for documents with relative links.
if ( nTargetStorageFormat == nOriginalStorageFormat )
{
sal_Bool bOptimizationWorks = sal_False;
if ( bTryOptimization )
{
try
{
// try to use optimized copying
uno::Reference< embed::XOptimizedStorage > xSource( m_xParentStorage, uno::UNO_QUERY_THROW );
uno::Reference< embed::XOptimizedStorage > xTarget( xStorage, uno::UNO_QUERY_THROW );
xSource->copyElementDirectlyTo( m_aEntryName, xTarget, sEntName );
bOptimizationWorks = sal_True;
}
catch( uno::Exception& )
{
}
}
if ( !bOptimizationWorks )
m_xParentStorage->copyElementTo( m_aEntryName, xStorage, sEntName );
}
else
{
changeState( embed::EmbedStates::RUNNING );
bSwitchBackToLoaded = sal_True;
}
}
2003-10-27 12:05:38 +00:00
uno::Reference< embed::XStorage > xSubStorage =
xStorage->openStorageElement( sEntName, embed::ElementModes::READWRITE );
2003-10-27 12:05:38 +00:00
if ( !xSubStorage.is() )
throw uno::RuntimeException(); //TODO
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
if ( m_nObjectState != embed::EmbedStates::LOADED )
{
aGuard.clear();
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
// TODO/LATER: support hierarchical name for embedded objects in embedded objects
StoreDocToStorage_Impl( xSubStorage, nTargetStorageFormat, GetBaseURLFrom_Impl( lArguments, lObjArgs ), sEntName, sal_False );
aGuard.reset();
if ( bSwitchBackToLoaded )
changeState( embed::EmbedStates::LOADED );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
}
2003-10-27 12:05:38 +00:00
m_bWaitSaveCompleted = sal_True;
m_xNewObjectStorage = xSubStorage;
m_xNewParentStorage = xStorage;
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
m_aNewEntryName = sEntName;
m_aNewDocMediaDescriptor = GetValuableArgs_Impl( lArguments, sal_True );
2003-10-27 12:05:38 +00:00
// TODO: register listeners for storages above, in case thay are disposed
// an exception will be thrown on saveCompleted( true )
// TODO: should the listener notification be done here or in saveCompleted?
}
//------------------------------------------------------
void SAL_CALL OCommonEmbeddedObject::saveCompleted( sal_Bool bUseNew )
throw ( embed::WrongStateException,
uno::Exception,
uno::RuntimeException )
{
RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OCommonEmbeddedObject::saveCompleted" );
2003-10-27 12:05:38 +00:00
::osl::MutexGuard aGuard( m_aMutex );
if ( m_bDisposed )
throw lang::DisposedException(); // TODO
if ( m_nObjectState == -1 )
{
// the object is still not loaded
throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "Can't store object without persistence!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
2003-10-27 12:05:38 +00:00
}
// for now support of this interface is required to allow breaking of links and converting them to normal embedded
// objects, so the persist name must be handled correctly ( althowgh no real persist entry is used )
// OSL_ENSURE( !m_bIsLink, "This method implementation must not be used for links!\n" );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
if ( m_bIsLink )
{
if ( bUseNew )
m_aEntryName = m_aNewEntryName;
m_aNewEntryName = ::rtl::OUString();
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
return;
}
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
// it is allowed to call saveCompleted( false ) for nonstored objects
if ( !m_bWaitSaveCompleted && !bUseNew )
return;
2003-10-27 12:05:38 +00:00
OSL_ENSURE( m_bWaitSaveCompleted, "Unexpected saveCompleted() call!\n" );
if ( !m_bWaitSaveCompleted )
throw io::IOException(); // TODO: illegal call
OSL_ENSURE( m_xNewObjectStorage.is() && m_xNewParentStorage.is() , "Internal object information is broken!\n" );
if ( !m_xNewObjectStorage.is() || !m_xNewParentStorage.is() )
throw uno::RuntimeException(); // TODO: broken internal information
if ( bUseNew )
{
SwitchOwnPersistence( m_xNewParentStorage, m_xNewObjectStorage, m_aNewEntryName );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
m_aDocMediaDescriptor = m_aNewDocMediaDescriptor;
uno::Reference< util::XModifiable > xModif( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
if ( xModif.is() )
xModif->setModified( sal_False );
PostEvent_Impl( ::rtl::OUString::createFromAscii( "OnSaveAsDone" ) );
}
else
{
2003-10-27 12:05:38 +00:00
try {
uno::Reference< lang::XComponent > xComponent( m_xNewObjectStorage, uno::UNO_QUERY );
2003-10-27 12:05:38 +00:00
OSL_ENSURE( xComponent.is(), "Wrong storage implementation!" );
if ( xComponent.is() )
xComponent->dispose();
}
catch ( uno::Exception& )
{
}
}
m_xNewObjectStorage = uno::Reference< embed::XStorage >();
m_xNewParentStorage = uno::Reference< embed::XStorage >();
m_aNewEntryName = ::rtl::OUString();
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
m_aNewDocMediaDescriptor.realloc( 0 );
2003-10-27 12:05:38 +00:00
m_bWaitSaveCompleted = sal_False;
if ( bUseNew )
{
// TODO: notify listeners
if ( m_nUpdateMode == embed::EmbedUpdateModes::ALWAYS_UPDATE )
2003-10-27 12:05:38 +00:00
{
// TODO: update visual representation
}
}
}
//------------------------------------------------------
sal_Bool SAL_CALL OCommonEmbeddedObject::hasEntry()
throw ( embed::WrongStateException,
uno::RuntimeException )
{
::osl::MutexGuard aGuard( m_aMutex );
if ( m_bDisposed )
throw lang::DisposedException(); // TODO
if ( m_bWaitSaveCompleted )
throw embed::WrongStateException(
::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
2003-10-27 12:05:38 +00:00
if ( m_xObjectStorage.is() )
return sal_True;
return sal_False;
}
//------------------------------------------------------
::rtl::OUString SAL_CALL OCommonEmbeddedObject::getEntryName()
throw ( embed::WrongStateException,
uno::RuntimeException )
{
::osl::MutexGuard aGuard( m_aMutex );
if ( m_bDisposed )
throw lang::DisposedException(); // TODO
if ( m_nObjectState == -1 )
{
// the object is still not loaded
throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object persistence is not initialized!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
2003-10-27 12:05:38 +00:00
}
if ( m_bWaitSaveCompleted )
throw embed::WrongStateException(
::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
2003-10-27 12:05:38 +00:00
return m_aEntryName;
}
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
//------------------------------------------------------
void SAL_CALL OCommonEmbeddedObject::storeOwn()
throw ( embed::WrongStateException,
io::IOException,
uno::Exception,
uno::RuntimeException )
{
RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OCommonEmbeddedObject::storeOwn" );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
// during switching from Activated to Running and from Running to Loaded states the object will
// ask container to store the object, the container has to make decision
// to do so or not
::osl::ResettableMutexGuard aGuard( m_aMutex );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
if ( m_bDisposed )
throw lang::DisposedException(); // TODO
if ( m_nObjectState == -1 )
{
// the object is still not loaded
throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "Can't store object without persistence!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
}
if ( m_bWaitSaveCompleted )
throw embed::WrongStateException(
::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
if ( m_bReadOnly )
throw io::IOException(); // TODO: access denied
// nothing to do, if the object is in loaded state
if ( m_nObjectState == embed::EmbedStates::LOADED )
return;
PostEvent_Impl( ::rtl::OUString::createFromAscii( "OnSave" ) );
OSL_ENSURE( m_pDocHolder->GetComponent().is(), "If an object is activated or in running state it must have a document!\n" );
if ( !m_pDocHolder->GetComponent().is() )
throw uno::RuntimeException();
if ( m_bIsLink )
{
// TODO: just store the document to it's location
uno::Reference< frame::XStorable > xStorable( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
if ( !xStorable.is() )
throw uno::RuntimeException(); // TODO
// free the main mutex for the storing time
aGuard.clear();
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
xStorable->store();
aGuard.reset();
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
}
else
{
OSL_ENSURE( m_xParentStorage.is() && m_xObjectStorage.is(), "The object has no valid persistence!\n" );
if ( !m_xObjectStorage.is() )
throw io::IOException(); //TODO: access denied
sal_Int32 nStorageFormat = SOFFICE_FILEFORMAT_CURRENT;
try {
nStorageFormat = ::comphelper::OStorageHelper::GetXStorageFormat( m_xParentStorage );
}
catch ( beans::IllegalTypeException& )
{
// the container just has an unknown type, use current file format
}
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
catch ( uno::Exception& )
{
OSL_ENSURE( sal_False, "Can not retrieve storage media type!\n" );
}
aGuard.clear();
StoreDocToStorage_Impl( m_xObjectStorage, nStorageFormat, GetBaseURL_Impl(), m_aEntryName, sal_True );
aGuard.reset();
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
}
uno::Reference< util::XModifiable > xModif( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
if ( xModif.is() )
xModif->setModified( sal_False );
PostEvent_Impl( ::rtl::OUString::createFromAscii( "OnSaveDone" ) );
}
2003-10-27 12:05:38 +00:00
//------------------------------------------------------
sal_Bool SAL_CALL OCommonEmbeddedObject::isReadonly()
throw ( embed::WrongStateException,
uno::RuntimeException )
{
::osl::MutexGuard aGuard( m_aMutex );
if ( m_bDisposed )
throw lang::DisposedException(); // TODO
if ( m_nObjectState == -1 )
{
// the object is still not loaded
throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object persistence is not initialized!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
2003-10-27 12:05:38 +00:00
}
if ( m_bWaitSaveCompleted )
throw embed::WrongStateException(
::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
2003-10-27 12:05:38 +00:00
return m_bReadOnly;
}
//------------------------------------------------------
void SAL_CALL OCommonEmbeddedObject::reload(
const uno::Sequence< beans::PropertyValue >& lArguments,
const uno::Sequence< beans::PropertyValue >& lObjArgs )
2003-10-27 12:05:38 +00:00
throw ( lang::IllegalArgumentException,
embed::WrongStateException,
io::IOException,
uno::Exception,
uno::RuntimeException )
{
// TODO: use lObjArgs
2003-12-15 08:49:27 +00:00
// for now this method is used only to switch readonly state
2003-10-27 12:05:38 +00:00
::osl::MutexGuard aGuard( m_aMutex );
if ( m_bDisposed )
throw lang::DisposedException(); // TODO
if ( m_nObjectState == -1 )
{
// the object is still not loaded
throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The object persistence is not initialized!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
2003-10-27 12:05:38 +00:00
}
if ( m_nObjectState != embed::EmbedStates::LOADED )
2003-12-15 08:49:27 +00:00
{
// the object is still not loaded
throw embed::WrongStateException(
::rtl::OUString::createFromAscii( "The object must be in loaded state to be reloaded!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
2003-12-15 08:49:27 +00:00
}
2003-10-27 12:05:38 +00:00
if ( m_bWaitSaveCompleted )
throw embed::WrongStateException(
::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
2003-10-27 12:05:38 +00:00
if ( m_bIsLink )
{
// reload of the link
::rtl::OUString aOldLinkFilter = m_aLinkFilterName;
::rtl::OUString aNewLinkFilter;
for ( sal_Int32 nInd = 0; nInd < lArguments.getLength(); nInd++ )
{
if ( lArguments[nInd].Name.equalsAscii( "URL" ) )
{
// the new URL
lArguments[nInd].Value >>= m_aLinkURL;
m_aLinkFilterName = ::rtl::OUString();
}
else if ( lArguments[nInd].Name.equalsAscii( "FilterName" ) )
{
lArguments[nInd].Value >>= aNewLinkFilter;
m_aLinkFilterName = ::rtl::OUString();
}
}
::comphelper::MimeConfigurationHelper aHelper( m_xFactory );
if ( !m_aLinkFilterName.getLength() )
{
if ( aNewLinkFilter.getLength() )
m_aLinkFilterName = aNewLinkFilter;
else
{
uno::Sequence< beans::PropertyValue > aArgs( 1 );
aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
aArgs[0].Value <<= m_aLinkURL;
m_aLinkFilterName = aHelper.UpdateMediaDescriptorWithFilterName( aArgs, sal_False );
}
}
if ( !aOldLinkFilter.equals( m_aLinkFilterName ) )
{
uno::Sequence< beans::NamedValue > aObject = aHelper.GetObjectPropsByFilter( m_aLinkFilterName );
// TODO/LATER: probably the document holder could be cleaned explicitly as in the destructor
m_pDocHolder->release();
m_pDocHolder = NULL;
LinkInit_Impl( aObject, lArguments, lObjArgs );
}
}
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
m_aDocMediaDescriptor = GetValuableArgs_Impl( lArguments, sal_True );
// TODO: use lObjArgs for StoreVisualReplacement
for ( sal_Int32 nObjInd = 0; nObjInd < lObjArgs.getLength(); nObjInd++ )
if ( lObjArgs[nObjInd].Name.equalsAscii( "OutplaceDispatchInterceptor" ) )
{
uno::Reference< frame::XDispatchProviderInterceptor > xDispatchInterceptor;
if ( lObjArgs[nObjInd].Value >>= xDispatchInterceptor )
m_pDocHolder->SetOutplaceDispatchInterceptor( xDispatchInterceptor );
break;
}
2003-10-27 12:05:38 +00:00
// TODO:
2003-12-15 08:49:27 +00:00
// when document allows reloading through API the object can be reloaded not only in loaded state
sal_Bool bOldReadOnlyValue = m_bReadOnly;
m_bReadOnly = sal_False;
for ( sal_Int32 nInd = 0; nInd < lArguments.getLength(); nInd++ )
if ( lArguments[nInd].Name.equalsAscii( "ReadOnly" ) )
lArguments[nInd].Value >>= m_bReadOnly;
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
if ( bOldReadOnlyValue != m_bReadOnly && !m_bIsLink )
2003-12-15 08:49:27 +00:00
{
// close own storage
try {
uno::Reference< lang::XComponent > xComponent( m_xObjectStorage, uno::UNO_QUERY );
OSL_ENSURE( !m_xObjectStorage.is() || xComponent.is(), "Wrong storage implementation!" );
if ( xComponent.is() )
xComponent->dispose();
}
catch ( uno::Exception& )
{
}
sal_Int32 nStorageMode = m_bReadOnly ? embed::ElementModes::READ : embed::ElementModes::READWRITE;
m_xObjectStorage = m_xParentStorage->openStorageElement( m_aEntryName, nStorageMode );
2003-12-15 08:49:27 +00:00
}
2003-10-27 12:05:38 +00:00
}
2003-11-04 13:30:21 +00:00
//------------------------------------------------------
void SAL_CALL OCommonEmbeddedObject::breakLink( const uno::Reference< embed::XStorage >& xStorage,
const ::rtl::OUString& sEntName )
throw ( lang::IllegalArgumentException,
embed::WrongStateException,
io::IOException,
uno::Exception,
uno::RuntimeException )
{
::osl::ResettableMutexGuard aGuard( m_aMutex );
if ( m_bDisposed )
throw lang::DisposedException(); // TODO
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
if ( !m_bIsLink )
{
// it must be a linked initialized object
throw embed::WrongStateException(
::rtl::OUString::createFromAscii( "The object is not a valid linked object!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
}
#if 0
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
else
{
// the current implementation of OOo links does not implement this method since it does not implement
// all the set of interfaces required for OOo embedded object ( XEmbedPersist is not supported ).
throw io::IOException(); // TODO:
}
#endif
2003-11-04 13:30:21 +00:00
if ( !xStorage.is() )
throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "No parent storage is provided!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
2003-11-04 13:30:21 +00:00
1 );
if ( !sEntName.getLength() )
throw lang::IllegalArgumentException( ::rtl::OUString::createFromAscii( "Empty element name is provided!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
2003-11-04 13:30:21 +00:00
2 );
if ( !m_bIsLink || m_nObjectState == -1 )
{
// it must be a linked initialized object
throw embed::WrongStateException(
::rtl::OUString::createFromAscii( "The object is not a valid linked object!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
2003-11-04 13:30:21 +00:00
}
if ( m_bWaitSaveCompleted )
throw embed::WrongStateException(
::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
2003-11-04 13:30:21 +00:00
uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY );
if ( !xNameAccess.is() )
throw uno::RuntimeException(); //TODO
// detect entry existence
/*sal_Bool bElExists =*/ xNameAccess->hasByName( sEntName );
2003-11-04 13:30:21 +00:00
m_bReadOnly = sal_False;
// sal_Int32 nStorageMode = embed::ElementModes::READWRITE;
2003-11-04 13:30:21 +00:00
if ( m_xParentStorage != xStorage || !m_aEntryName.equals( sEntName ) )
SwitchOwnPersistence( xStorage, sEntName );
2003-11-04 13:30:21 +00:00
// for linked object it means that it becomes embedded object
// the document must switch it's persistence also
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
// TODO/LATER: handle the case when temp doc can not be created
2003-11-04 13:30:21 +00:00
// the document is a new embedded object so it must be marked as modified
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
uno::Reference< util::XCloseable > xDocument = CreateTempDocFromLink_Impl();
uno::Reference< util::XModifiable > xModif( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
2003-11-04 13:30:21 +00:00
if ( !xModif.is() )
throw uno::RuntimeException();
try
{
xModif->setModified( sal_True );
}
catch( uno::Exception& )
{}
INTEGRATION: CWS mav09 (1.7.2); FILE MERGED 2004/09/28 09:50:29 mav 1.7.2.23: #i27773# resync 2004/09/16 22:01:32 mav 1.7.2.22: RESYNC: (1.8-1.9); FILE MERGED 2004/09/13 13:39:55 mav 1.7.2.21: #i27773# do not allow typedetection to provide stream and mode 2004/09/02 14:58:20 mba 1.7.2.20: #i27773#: prepare to use DocumentBasedStorage 2004/08/17 13:58:16 mav 1.7.2.19: #i27773# BaseURL and Hierarchical object name 2004/08/17 10:09:30 mav 1.7.2.18: #i27773# slight changes 2004/08/16 09:33:31 mav 1.7.2.17: #i27773# storage format 2004/07/15 10:32:09 mav 1.7.2.16: #i27773# commit changes made offline 2004/07/01 11:48:18 mav 1.7.2.15: #i27773# links storing on deactivation 2004/06/25 11:49:11 mav 1.7.2.14: #i27773# linkage support 2004/06/24 17:13:42 mav 1.7.2.13: #i27773# reactivate linking support for OOo documents 2004/06/18 16:14:26 mav 1.7.2.12: #i27773# embedded document should not be modified if it's persistance is up to date 2004/06/18 14:18:11 mba 1.7.2.11: #i27773#: special objects implementation 2004/06/10 16:19:49 mav 1.7.2.10: #i27773# use configuration for conversion purposes 2004/05/18 12:34:41 mav 1.7.2.9: #i27773# solve resync problems 2004/05/17 18:24:28 mav 1.7.2.8: RESYNC: (1.7-1.8); FILE MERGED 2004/05/17 08:40:56 mav 1.7.2.7: #i27773# allow to storeAs/storeTo object even in loaded state 2004/05/12 15:47:25 mav 1.7.2.6: #i27773# allow to use setPersistentEntry in saveCompleted mode 2004/05/12 10:12:28 mav 1.7.2.5: #i27773# graphical replacement and persistance setting related changes 2004/05/06 16:46:36 mba 1.7.2.4: #i27773#: some bugfixes in first testing 2004/05/05 13:54:43 mba 1.7.2.3: #i27773#: typo 2004/02/23 10:02:39 mav 1.7.2.2: #115011# let object document be embedded 2004/02/19 10:31:36 mav 1.7.2.1: #115011# embedded object representation
2004-10-04 18:49:49 +00:00
m_pDocHolder->SetComponent( xDocument, m_bReadOnly );
OSL_ENSURE( m_pDocHolder->GetComponent().is(), "If document cant be created, an exception must be thrown!\n" );
2003-11-04 13:30:21 +00:00
if ( m_nObjectState == embed::EmbedStates::LOADED )
{
// the state is changed and can not be switched to loaded state back without saving
m_nObjectState = embed::EmbedStates::RUNNING;
StateChangeNotification_Impl( sal_False, embed::EmbedStates::LOADED, m_nObjectState, aGuard );
}
else if ( m_nObjectState == embed::EmbedStates::ACTIVE )
2003-11-04 13:30:21 +00:00
m_pDocHolder->Show();
m_bIsLink = sal_False;
m_aLinkFilterName = ::rtl::OUString();
m_aLinkURL = ::rtl::OUString();
}
2003-10-27 12:05:38 +00:00
//------------------------------------------------------
sal_Bool SAL_CALL OCommonEmbeddedObject::isLink()
throw ( embed::WrongStateException,
uno::RuntimeException )
{
::osl::MutexGuard aGuard( m_aMutex );
if ( m_bDisposed )
throw lang::DisposedException(); // TODO
// Actually this information is clear even in case object is wayting for saveCompleted
// if ( m_bWaitSaveCompleted )
// throw embed::WrongStateException(
// ::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
// uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) );
2003-10-27 12:05:38 +00:00
return m_bIsLink;
}
//------------------------------------------------------
::rtl::OUString SAL_CALL OCommonEmbeddedObject::getLinkURL()
2003-11-04 13:30:21 +00:00
throw ( embed::WrongStateException,
uno::Exception,
uno::RuntimeException )
2003-10-27 12:05:38 +00:00
{
::osl::MutexGuard aGuard( m_aMutex );
if ( m_bDisposed )
throw lang::DisposedException(); // TODO
// Actually this information is clear even in case object is wayting for saveCompleted
// if ( m_bWaitSaveCompleted )
// throw embed::WrongStateException(
// ::rtl::OUString::createFromAscii( "The object waits for saveCompleted() call!\n" ),
// uno::Reference< uno::XInterface >( reinterpret_cast< ::cppu::OWeakObject* >(this) ) );
2003-10-27 12:05:38 +00:00
if ( !m_bIsLink )
throw embed::WrongStateException(
::rtl::OUString::createFromAscii( "The object is not a link object!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
2003-10-27 12:05:38 +00:00
return m_aLinkURL;
}