summaryrefslogtreecommitdiff
path: root/embeddedobj/source
diff options
context:
space:
mode:
Diffstat (limited to 'embeddedobj/source')
-rw-r--r--embeddedobj/source/commonembedding/embedobj.cxx708
-rw-r--r--embeddedobj/source/commonembedding/inplaceobj.cxx91
-rwxr-xr-xembeddedobj/source/commonembedding/makefile.mk56
-rw-r--r--embeddedobj/source/commonembedding/miscobj.cxx704
-rw-r--r--embeddedobj/source/commonembedding/persistence.cxx1913
-rw-r--r--embeddedobj/source/commonembedding/register.cxx88
-rw-r--r--embeddedobj/source/commonembedding/specialobject.cxx234
-rw-r--r--embeddedobj/source/commonembedding/visobj.cxx238
-rw-r--r--embeddedobj/source/commonembedding/xfactory.cxx564
-rw-r--r--embeddedobj/source/commonembedding/xfactory.hxx127
-rw-r--r--embeddedobj/source/general/docholder.cxx1351
-rw-r--r--embeddedobj/source/general/dummyobject.cxx724
-rw-r--r--embeddedobj/source/general/intercept.cxx428
-rwxr-xr-xembeddedobj/source/general/makefile.mk60
-rw-r--r--embeddedobj/source/general/xcreator.cxx493
-rw-r--r--embeddedobj/source/inc/closepreventer.hxx40
-rw-r--r--embeddedobj/source/inc/commonembobj.hxx523
-rw-r--r--embeddedobj/source/inc/docholder.hxx211
-rw-r--r--embeddedobj/source/inc/dummyobject.hxx299
-rw-r--r--embeddedobj/source/inc/intercept.hxx169
-rw-r--r--embeddedobj/source/inc/oleembobj.hxx548
-rw-r--r--embeddedobj/source/inc/specialobject.hxx92
-rw-r--r--embeddedobj/source/inc/targetstatecontrol.hxx50
-rw-r--r--embeddedobj/source/inc/xcreator.hxx93
-rw-r--r--embeddedobj/source/msole/advisesink.cxx136
-rw-r--r--embeddedobj/source/msole/advisesink.hxx58
-rw-r--r--embeddedobj/source/msole/closepreventer.cxx54
-rwxr-xr-xembeddedobj/source/msole/emboleobj.component35
-rwxr-xr-xembeddedobj/source/msole/emboleobj.windows.component39
-rwxr-xr-xembeddedobj/source/msole/exports.dxp1
-rw-r--r--embeddedobj/source/msole/graphconvert.cxx135
-rwxr-xr-xembeddedobj/source/msole/makefile.mk136
-rw-r--r--embeddedobj/source/msole/mtnotification.hxx57
-rw-r--r--embeddedobj/source/msole/olecomponent.cxx1797
-rw-r--r--embeddedobj/source/msole/olecomponent.hxx182
-rw-r--r--embeddedobj/source/msole/oleembed.cxx1126
-rw-r--r--embeddedobj/source/msole/olemisc.cxx700
-rw-r--r--embeddedobj/source/msole/olepersist.cxx2132
-rw-r--r--embeddedobj/source/msole/oleregister.cxx84
-rw-r--r--embeddedobj/source/msole/olevisual.cxx446
-rw-r--r--embeddedobj/source/msole/olewrapclient.cxx160
-rw-r--r--embeddedobj/source/msole/olewrapclient.hxx58
-rw-r--r--embeddedobj/source/msole/ownview.cxx659
-rw-r--r--embeddedobj/source/msole/ownview.hxx92
-rwxr-xr-xembeddedobj/source/msole/platform.h51
-rw-r--r--embeddedobj/source/msole/xdialogcreator.cxx385
-rw-r--r--embeddedobj/source/msole/xdialogcreator.hxx79
-rw-r--r--embeddedobj/source/msole/xolefactory.cxx344
-rw-r--r--embeddedobj/source/msole/xolefactory.hxx86
49 files changed, 0 insertions, 18836 deletions
diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx
deleted file mode 100644
index fd8a9f557a..0000000000
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ /dev/null
@@ -1,708 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-#include <com/sun/star/embed/EmbedStates.hpp>
-#include <com/sun/star/embed/EmbedVerbs.hpp>
-#include <com/sun/star/embed/EmbedUpdateModes.hpp>
-#include <com/sun/star/embed/XEmbeddedClient.hpp>
-#include <com/sun/star/embed/XInplaceClient.hpp>
-#include <com/sun/star/embed/XWindowSupplier.hpp>
-#include <com/sun/star/embed/StateChangeInProgressException.hpp>
-#include <com/sun/star/embed/Aspects.hpp>
-
-#include <com/sun/star/awt/XWindowPeer.hpp>
-#include <com/sun/star/util/XCloseBroadcaster.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <com/sun/star/util/XModifiable.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/XComponentLoader.hpp>
-#include <com/sun/star/frame/XDispatchProviderInterception.hpp>
-#include <com/sun/star/frame/XModuleManager.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-
-#include <com/sun/star/embed/EmbedMisc.hpp>
-
-#include <rtl/logfile.hxx>
-
-#include <targetstatecontrol.hxx>
-
-#include "commonembobj.hxx"
-#include "intercept.hxx"
-
-
-using namespace ::com::sun::star;
-
-awt::Rectangle GetRectangleInterception( const awt::Rectangle& aRect1, const awt::Rectangle& aRect2 )
-{
- awt::Rectangle aResult;
-
- OSL_ENSURE( aRect1.Width >= 0 && aRect2.Width >= 0 && aRect1.Height >= 0 && aRect2.Height >= 0,
- "Offset must not be less then zero!" );
-
- aResult.X = aRect1.X > aRect2.X ? aRect1.X : aRect2.X;
- aResult.Y = aRect1.Y > aRect2.Y ? aRect1.Y : aRect2.Y;
-
- sal_Int32 nRight1 = aRect1.X + aRect1.Width;
- sal_Int32 nBottom1 = aRect1.Y + aRect1.Height;
- sal_Int32 nRight2 = aRect2.X + aRect2.Width;
- sal_Int32 nBottom2 = aRect2.Y + aRect2.Height;
- aResult.Width = ( nRight1 < nRight2 ? nRight1 : nRight2 ) - aResult.X;
- aResult.Height = ( nBottom1 < nBottom2 ? nBottom1 : nBottom2 ) - aResult.Y;
-
- return aResult;
-}
-
-//----------------------------------------------
-sal_Int32 OCommonEmbeddedObject::ConvertVerbToState_Impl( sal_Int32 nVerb )
-{
- for ( sal_Int32 nInd = 0; nInd < m_aVerbTable.getLength(); nInd++ )
- if ( m_aVerbTable[nInd][0] == nVerb )
- return m_aVerbTable[nInd][1];
-
- throw lang::IllegalArgumentException(); // TODO: unexpected verb provided
-}
-
-//----------------------------------------------
-void OCommonEmbeddedObject::Deactivate()
-{
- uno::Reference< util::XModifiable > xModif( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
-
- // no need to lock for the initialization
- uno::Reference< embed::XEmbeddedClient > xClientSite = m_xClientSite;
- if ( !xClientSite.is() )
- throw embed::WrongStateException(); //TODO: client site is not set!
-
- // store document if it is modified
- if ( xModif.is() && xModif->isModified() )
- {
- try {
- xClientSite->saveObject();
- }
- catch( embed::ObjectSaveVetoException& )
- {
- }
- catch( uno::Exception& e )
- {
- throw embed::StorageWrappedTargetException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The client could not store the object!" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ),
- uno::makeAny( e ) );
- }
- }
-
- m_pDocHolder->CloseFrame();
-
- xClientSite->visibilityChanged( sal_False );
-}
-
-//----------------------------------------------
-void OCommonEmbeddedObject::StateChangeNotification_Impl( sal_Bool bBeforeChange, sal_Int32 nOldState, sal_Int32 nNewState ,::osl::ResettableMutexGuard& rGuard )
-{
- if ( m_pInterfaceContainer )
- {
- ::cppu::OInterfaceContainerHelper* pContainer = m_pInterfaceContainer->getContainer(
- ::getCppuType( ( const uno::Reference< embed::XStateChangeListener >*) NULL ) );
- if ( pContainer != NULL )
- {
- lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
- ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
-
- // should be locked after the method is finished successfully
- rGuard.clear();
-
- while (pIterator.hasMoreElements())
- {
- try
- {
- if ( bBeforeChange )
- ((embed::XStateChangeListener*)pIterator.next())->changingState( aSource, nOldState, nNewState );
- else
- ((embed::XStateChangeListener*)pIterator.next())->stateChanged( aSource, nOldState, nNewState );
- }
- catch( uno::Exception& )
- {
- // even if the listener complains ignore it for now
- }
-
- if ( m_bDisposed )
- return;
- }
-
- rGuard.reset();
- }
- }
-}
-
-//----------------------------------------------
-void OCommonEmbeddedObject::SwitchStateTo_Impl( sal_Int32 nNextState )
-{
- // TODO: may be needs interaction handler to detect wherether the object state
- // can be changed even after errors
-
- if ( m_nObjectState == embed::EmbedStates::LOADED )
- {
- if ( nNextState == embed::EmbedStates::RUNNING )
- {
- // after the object reaches the running state the cloned size is not necessary any more
- m_bHasClonedSize = sal_False;
-
- if ( m_bIsLink )
- {
- m_pDocHolder->SetComponent( LoadLink_Impl(), m_bReadOnly );
- }
- else
- {
- uno::Reference < embed::XEmbedPersist > xPersist( static_cast < embed::XClassifiedObject* > (this), uno::UNO_QUERY );
- if ( xPersist.is() )
- {
- // in case embedded object is in loaded state the contents must
- // be stored in the related storage and the storage
- // must be created already
- if ( !m_xObjectStorage.is() )
- throw io::IOException(); //TODO: access denied
-
- m_pDocHolder->SetComponent( LoadDocumentFromStorage_Impl(), m_bReadOnly );
- }
- else
- {
- // objects without persistence will be initialized internally
- uno::Sequence < uno::Any > aArgs(1);
- aArgs[0] <<= uno::Reference < embed::XEmbeddedObject >( this );
- uno::Reference< util::XCloseable > xDocument(
- m_xFactory->createInstanceWithArguments( GetDocumentServiceName(), aArgs ), uno::UNO_QUERY );
-
- uno::Reference < container::XChild > xChild( xDocument, uno::UNO_QUERY );
- if ( xChild.is() )
- xChild->setParent( m_xParent );
-
- m_pDocHolder->SetComponent( xDocument, m_bReadOnly );
- }
- }
-
- if ( !m_pDocHolder->GetComponent().is() )
- throw embed::UnreachableStateException(); //TODO: can't open document
-
- m_nObjectState = nNextState;
- }
- else
- {
- OSL_FAIL( "Unacceptable state switch!\n" );
- throw uno::RuntimeException(); // TODO
- }
- }
- else if ( m_nObjectState == embed::EmbedStates::RUNNING )
- {
- if ( nNextState == embed::EmbedStates::LOADED )
- {
- m_nClonedMapUnit = m_pDocHolder->GetMapUnit( embed::Aspects::MSOLE_CONTENT );
- m_bHasClonedSize = m_pDocHolder->GetExtent( embed::Aspects::MSOLE_CONTENT, &m_aClonedSize );
-
- // actually frame should not exist at this point
- m_pDocHolder->CloseDocument( sal_False, sal_False );
-
- m_nObjectState = nNextState;
- }
- else
- {
- if ( nNextState == embed::EmbedStates::INPLACE_ACTIVE )
- {
- if ( !m_xClientSite.is() )
- throw embed::WrongStateException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "client site not set, yet" ) ),
- *this
- );
-
- uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY );
- if ( xInplaceClient.is() && xInplaceClient->canInplaceActivate() )
- {
- xInplaceClient->activatingInplace();
-
- uno::Reference< embed::XWindowSupplier > xClientWindowSupplier( xInplaceClient, uno::UNO_QUERY );
- if ( !xClientWindowSupplier.is() )
- throw uno::RuntimeException(); // TODO: the inplace client implementation must support XWinSupp
-
- m_xClientWindow = xClientWindowSupplier->getWindow();
- m_aOwnRectangle = xInplaceClient->getPlacement();
- m_aClipRectangle = xInplaceClient->getClipRectangle();
- awt::Rectangle aRectangleToShow = GetRectangleInterception( m_aOwnRectangle, m_aClipRectangle );
-
- // create own window based on the client window
- // place and resize the window according to the rectangles
- uno::Reference< awt::XWindowPeer > xClientWindowPeer( m_xClientWindow, uno::UNO_QUERY );
- if ( !xClientWindowPeer.is() )
- throw uno::RuntimeException(); // TODO: the container window must support the interface
-
- // dispatch provider may not be provided
- uno::Reference< frame::XDispatchProvider > xContainerDP = xInplaceClient->getInplaceDispatchProvider();
- sal_Bool bOk = m_pDocHolder->ShowInplace( xClientWindowPeer, aRectangleToShow, xContainerDP );
- m_nObjectState = nNextState;
- if ( !bOk )
- {
- SwitchStateTo_Impl( embed::EmbedStates::RUNNING );
- throw embed::WrongStateException(); //TODO: can't activate inplace
- }
- }
- else
- throw embed::WrongStateException(); //TODO: can't activate inplace
- }
- else if ( nNextState == embed::EmbedStates::ACTIVE )
- {
- if ( !m_xClientSite.is() )
- throw embed::WrongStateException(); //TODO: client site is not set!
-
- // create frame and load document in the frame
- m_pDocHolder->Show();
-
- m_xClientSite->visibilityChanged( sal_True );
- m_nObjectState = nNextState;
- }
- else
- {
- OSL_FAIL( "Unacceptable state switch!\n" );
- throw uno::RuntimeException(); // TODO
- }
- }
- }
- else if ( m_nObjectState == embed::EmbedStates::INPLACE_ACTIVE )
- {
- if ( nNextState == embed::EmbedStates::RUNNING )
- {
- uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY );
- if ( !xInplaceClient.is() )
- throw uno::RuntimeException();
-
- m_xClientSite->visibilityChanged( sal_True );
-
- xInplaceClient->deactivatedInplace();
- Deactivate();
- m_nObjectState = nNextState;
- }
- else if ( nNextState == embed::EmbedStates::UI_ACTIVE )
- {
- if ( !(m_nMiscStatus & embed::EmbedMisc::MS_EMBED_NOUIACTIVATE) )
- {
- uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY_THROW );
- // TODO:
- uno::Reference< ::com::sun::star::frame::XLayoutManager > xContainerLM =
- xInplaceClient->getLayoutManager();
- if ( xContainerLM.is() )
- {
- // dispatch provider may not be provided
- uno::Reference< frame::XDispatchProvider > xContainerDP = xInplaceClient->getInplaceDispatchProvider();
-
- // get the container module name
- ::rtl::OUString aModuleName;
- try
- {
- uno::Reference< embed::XComponentSupplier > xCompSupl( m_xClientSite, uno::UNO_QUERY_THROW );
- uno::Reference< uno::XInterface > xContDoc( xCompSupl->getComponent(), uno::UNO_QUERY_THROW );
-
- uno::Reference< frame::XModuleManager > xManager(
- m_xFactory->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ) ) ),
- uno::UNO_QUERY_THROW );
-
- aModuleName = xManager->identify( xContDoc );
- }
- catch( uno::Exception& )
- {}
-
- // if currently another object is UIactive it will be deactivated; usually this will activate the LM of
- // the container. Locking the LM will prevent flicker.
- xContainerLM->lock();
- xInplaceClient->activatingUI();
- sal_Bool bOk = m_pDocHolder->ShowUI( xContainerLM, xContainerDP, aModuleName );
- xContainerLM->unlock();
-
- if ( bOk )
- {
- m_nObjectState = nNextState;
- m_pDocHolder->ResizeHatchWindow();
- }
- else
- {
- xInplaceClient->deactivatedUI();
- throw embed::WrongStateException(); //TODO: can't activate UI
- }
- }
- else
- throw embed::WrongStateException(); //TODO: can't activate UI
- }
- }
- else
- {
- OSL_FAIL( "Unacceptable state switch!\n" );
- throw uno::RuntimeException(); // TODO
- }
- }
- else if ( m_nObjectState == embed::EmbedStates::ACTIVE )
- {
- if ( nNextState == embed::EmbedStates::RUNNING )
- {
- Deactivate();
- m_nObjectState = nNextState;
- }
- else
- {
- OSL_FAIL( "Unacceptable state switch!\n" );
- throw uno::RuntimeException(); // TODO
- }
- }
- else if ( m_nObjectState == embed::EmbedStates::UI_ACTIVE )
- {
- if ( nNextState == embed::EmbedStates::INPLACE_ACTIVE )
- {
- uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY_THROW );
- uno::Reference< ::com::sun::star::frame::XLayoutManager > xContainerLM =
- xInplaceClient->getLayoutManager();
-
- sal_Bool bOk = sal_False;
- if ( xContainerLM.is() )
- bOk = m_pDocHolder->HideUI( xContainerLM );
-
- if ( bOk )
- {
- m_nObjectState = nNextState;
- m_pDocHolder->ResizeHatchWindow();
- xInplaceClient->deactivatedUI();
- }
- else
- throw embed::WrongStateException(); //TODO: can't activate UI
- }
- }
- else
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object is in unacceptable state!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-}
-
-//----------------------------------------------
-uno::Sequence< sal_Int32 > OCommonEmbeddedObject::GetIntermediateStatesSequence_Impl( sal_Int32 nNewState )
-{
- sal_Int32 nCurInd = 0;
- for ( nCurInd = 0; nCurInd < m_aAcceptedStates.getLength(); nCurInd++ )
- if ( m_aAcceptedStates[nCurInd] == m_nObjectState )
- break;
-
- if ( nCurInd == m_aAcceptedStates.getLength() )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object is in unacceptable state!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- sal_Int32 nDestInd = 0;
- for ( nDestInd = 0; nDestInd < m_aAcceptedStates.getLength(); nDestInd++ )
- if ( m_aAcceptedStates[nDestInd] == nNewState )
- break;
-
- if ( nDestInd == m_aAcceptedStates.getLength() )
- throw embed::UnreachableStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The state either not reachable, or the object allows the state only as an intermediate one!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- m_nObjectState,
- nNewState );
-
- return m_pIntermediateStatesSeqs[nCurInd][nDestInd];
-}
-
-//----------------------------------------------
-void SAL_CALL OCommonEmbeddedObject::changeState( sal_Int32 nNewState )
- throw ( embed::UnreachableStateException,
- embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OCommonEmbeddedObject::changeState" );
-
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ), uno::UNO_QUERY);
- {
- ::osl::ResettableMutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- sal_Int32 nOldState = m_nObjectState;
-
- if ( m_nTargetState != -1 )
- {
- // means that the object is currently trying to reach the target state
- throw embed::StateChangeInProgressException( ::rtl::OUString(),
- uno::Reference< uno::XInterface >(),
- m_nTargetState );
- }
- else
- {
- TargetStateControl_Impl aControl( m_nTargetState, nNewState );
-
- // in case the object is already in requested state
- if ( m_nObjectState == nNewState )
- {
- // if active object is activated again, bring it's window to top
- if ( m_nObjectState == embed::EmbedStates::ACTIVE )
- m_pDocHolder->Show();
-
- return;
- }
-
- // retrieve sequence of states that should be passed to reach desired state
- uno::Sequence< sal_Int32 > aIntermediateStates = GetIntermediateStatesSequence_Impl( nNewState );
-
- // notify listeners that the object is going to change the state
- StateChangeNotification_Impl( sal_True, nOldState, nNewState,aGuard );
-
- try {
- for ( sal_Int32 nInd = 0; nInd < aIntermediateStates.getLength(); nInd++ )
- SwitchStateTo_Impl( aIntermediateStates[nInd] );
-
- SwitchStateTo_Impl( nNewState );
- }
- catch( uno::Exception& )
- {
- if ( nOldState != m_nObjectState )
- // notify listeners that the object has changed the state
- StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState, aGuard );
-
- throw;
- }
- }
-
- // notify listeners that the object has changed the state
- StateChangeNotification_Impl( sal_False, nOldState, nNewState, aGuard );
-
- // let the object window be shown
- if ( nNewState == embed::EmbedStates::UI_ACTIVE || nNewState == embed::EmbedStates::INPLACE_ACTIVE )
- PostEvent_Impl( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnVisAreaChanged" ) ),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-}
-
-//----------------------------------------------
-uno::Sequence< sal_Int32 > SAL_CALL OCommonEmbeddedObject::getReachableStates()
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- return m_aAcceptedStates;
-}
-
-//----------------------------------------------
-sal_Int32 SAL_CALL OCommonEmbeddedObject::getCurrentState()
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- return m_nObjectState;
-}
-
-//----------------------------------------------
-void SAL_CALL OCommonEmbeddedObject::doVerb( sal_Int32 nVerbID )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- embed::UnreachableStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OCommonEmbeddedObject::doVerb" );
-
- ::osl::ResettableMutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- // for internal documents this call is just a duplicate of changeState
- sal_Int32 nNewState = -1;
- try
- {
- nNewState = ConvertVerbToState_Impl( nVerbID );
- }
- catch( uno::Exception& )
- {}
-
- if ( nNewState == -1 )
- {
- // TODO/LATER: Save Copy as... verb ( -8 ) is implemented by container
- // TODO/LATER: check if the verb is a supported one and if it is produce related operation
- }
- else
- {
- aGuard.clear();
- changeState( nNewState );
- }
-}
-
-//----------------------------------------------
-uno::Sequence< embed::VerbDescriptor > SAL_CALL OCommonEmbeddedObject::getSupportedVerbs()
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- return m_aObjectVerbs;
-}
-
-//----------------------------------------------
-void SAL_CALL OCommonEmbeddedObject::setClientSite(
- const uno::Reference< embed::XEmbeddedClient >& xClient )
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_xClientSite != xClient)
- {
- if ( m_nObjectState != embed::EmbedStates::LOADED && m_nObjectState != embed::EmbedStates::RUNNING )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The client site can not be set currently!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- m_xClientSite = xClient;
- }
-}
-
-//----------------------------------------------
-uno::Reference< embed::XEmbeddedClient > SAL_CALL OCommonEmbeddedObject::getClientSite()
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- return m_xClientSite;
-}
-
-//----------------------------------------------
-void SAL_CALL OCommonEmbeddedObject::update()
- throw ( embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- PostEvent_Impl( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnVisAreaChanged" ) ),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-}
-
-//----------------------------------------------
-void SAL_CALL OCommonEmbeddedObject::setUpdateMode( sal_Int32 nMode )
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- OSL_ENSURE( nMode == embed::EmbedUpdateModes::ALWAYS_UPDATE
- || nMode == embed::EmbedUpdateModes::EXPLICIT_UPDATE,
- "Unknown update mode!\n" );
- m_nUpdateMode = nMode;
-}
-
-//----------------------------------------------
-sal_Int64 SAL_CALL OCommonEmbeddedObject::getStatus( sal_Int64 )
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- return m_nMiscStatus;
-}
-
-//----------------------------------------------
-void SAL_CALL OCommonEmbeddedObject::setContainerName( const ::rtl::OUString& sName )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- m_aContainerName = sName;
-}
-
-com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL OCommonEmbeddedObject::getParent() throw (::com::sun::star::uno::RuntimeException)
-{
- return m_xParent;
-}
-
-void SAL_CALL OCommonEmbeddedObject::setParent( const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& xParent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException)
-{
- m_xParent = xParent;
- if ( m_nObjectState != -1 && m_nObjectState != embed::EmbedStates::LOADED )
- {
- uno::Reference < container::XChild > xChild( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
- if ( xChild.is() )
- xChild->setParent( xParent );
- }
-}
-
-// XDefaultSizeTransmitter
-void SAL_CALL OCommonEmbeddedObject::setDefaultSize( const ::com::sun::star::awt::Size& rSize_100TH_MM ) throw (::com::sun::star::uno::RuntimeException)
-{
- //#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this method
- m_aDefaultSizeForChart_In_100TH_MM = rSize_100TH_MM;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/commonembedding/inplaceobj.cxx b/embeddedobj/source/commonembedding/inplaceobj.cxx
deleted file mode 100644
index bec36d34a0..0000000000
--- a/embeddedobj/source/commonembedding/inplaceobj.cxx
+++ /dev/null
@@ -1,91 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-#include <com/sun/star/embed/EmbedStates.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-
-#include "commonembobj.hxx"
-
-
-using namespace ::com::sun::star;
-
-awt::Rectangle GetRectangleInterception( const awt::Rectangle& aRect1, const awt::Rectangle& aRect2 );
-sal_Bool RectanglesEqual( const awt::Rectangle& aRect1, const awt::Rectangle& aRect2 )
-{
- return ( aRect1.X == aRect2.X
- && aRect1.Y == aRect2.Y
- && aRect1.Width == aRect2.Width
- && aRect1.Height == aRect2.Height );
-}
-
-void SAL_CALL OCommonEmbeddedObject::setObjectRectangles( const awt::Rectangle& aPosRect,
- const awt::Rectangle& aClipRect )
- throw ( embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState != embed::EmbedStates::INPLACE_ACTIVE
- && m_nObjectState != embed::EmbedStates::UI_ACTIVE )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object is not activated inplace!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- awt::Rectangle aNewRectToShow = GetRectangleInterception( aPosRect, aClipRect );
- awt::Rectangle aOldRectToShow = GetRectangleInterception( m_aOwnRectangle, m_aClipRectangle );
-
- // the clip rectangle changes view only in case interception is also changed
- if ( !RectanglesEqual( m_aOwnRectangle, aPosRect )
- || ( !RectanglesEqual( m_aClipRectangle, aPosRect ) && !RectanglesEqual( aOldRectToShow, aNewRectToShow ) ) )
- m_pDocHolder->PlaceFrame( aNewRectToShow );
-
- m_aOwnRectangle = aPosRect;
- m_aClipRectangle = aClipRect;
-}
-
-void SAL_CALL OCommonEmbeddedObject::enableModeless( sal_Bool /*bEnable*/ )
- throw ( embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- // TODO: notify model that it can not use modal dialogs
-}
-
-void SAL_CALL OCommonEmbeddedObject::translateAccelerators(
- const uno::Sequence< awt::KeyEvent >& /*aKeys*/ )
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- // TODO: UI activation related
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/commonembedding/makefile.mk b/embeddedobj/source/commonembedding/makefile.mk
deleted file mode 100755
index d731b729d9..0000000000
--- a/embeddedobj/source/commonembedding/makefile.mk
+++ /dev/null
@@ -1,56 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# 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.
-#
-# 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).
-#
-# 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.
-#
-#*************************************************************************
-
-PRJ=..$/..
-
-PRJNAME=embeddedobj
-TARGET=commonembed
-ENABLE_EXCEPTIONS=true
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-LIBTARGET=NO
-USE_DEFFILE=NO
-
-# --- Files --------------------------------------------------------
-
-SLOFILES = \
- $(SLO)$/register.obj\
- $(SLO)$/xfactory.obj\
- $(SLO)$/miscobj.obj\
- $(SLO)$/embedobj.obj\
- $(SLO)$/specialobject.obj\
- $(SLO)$/persistence.obj\
- $(SLO)$/inplaceobj.obj\
- $(SLO)$/visobj.obj
-
-# --- Targets -------------------------------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx
deleted file mode 100644
index 59bdae5905..0000000000
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ /dev/null
@@ -1,704 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-
-#include <commonembobj.hxx>
-#include <com/sun/star/embed/EmbedStates.hpp>
-#include <com/sun/star/embed/EmbedVerbs.hpp>
-#include <com/sun/star/embed/XStorage.hpp>
-#include <com/sun/star/embed/EmbedUpdateModes.hpp>
-#include <com/sun/star/embed/XInplaceClient.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/beans/NamedValue.hpp>
-
-#include <cppuhelper/typeprovider.hxx>
-#include <cppuhelper/interfacecontainer.h>
-#include <comphelper/mimeconfighelper.hxx>
-
-#include "closepreventer.hxx"
-#include "intercept.hxx"
-
-using namespace ::com::sun::star;
-
-
-uno::Sequence< beans::PropertyValue > GetValuableArgs_Impl( const uno::Sequence< beans::PropertyValue >& aMedDescr,
- sal_Bool bCanUseDocumentBaseURL );
-
-//------------------------------------------------------
-OCommonEmbeddedObject::OCommonEmbeddedObject( const uno::Reference< lang::XMultiServiceFactory >& xFactory,
- const uno::Sequence< beans::NamedValue >& aObjProps )
-: m_pDocHolder( NULL )
-, m_pInterfaceContainer( NULL )
-, m_bReadOnly( sal_False )
-, m_bDisposed( sal_False )
-, m_bClosed( sal_False )
-, m_nObjectState( -1 )
-, m_nTargetState( -1 )
-, m_nUpdateMode ( embed::EmbedUpdateModes::ALWAYS_UPDATE )
-, m_xFactory( xFactory )
-, m_nMiscStatus( 0 )
-, m_bEmbeddedScriptSupport( sal_True )
-, m_bDocumentRecoverySupport( sal_True )
-, m_bWaitSaveCompleted( sal_False )
-, m_bIsLink( sal_False )
-, m_bLinkHasPassword( sal_False )
-, m_bHasClonedSize( sal_False )
-, m_nClonedMapUnit( 0 )
-{
- CommonInit_Impl( aObjProps );
-}
-
-//------------------------------------------------------
-OCommonEmbeddedObject::OCommonEmbeddedObject(
- const uno::Reference< lang::XMultiServiceFactory >& xFactory,
- const uno::Sequence< beans::NamedValue >& aObjProps,
- const uno::Sequence< beans::PropertyValue >& aMediaDescr,
- const uno::Sequence< beans::PropertyValue >& aObjectDescr )
-: m_pDocHolder( NULL )
-, m_pInterfaceContainer( NULL )
-, m_bReadOnly( sal_False )
-, m_bDisposed( sal_False )
-, m_bClosed( sal_False )
-, m_nObjectState( embed::EmbedStates::LOADED )
-, m_nTargetState( -1 )
-, m_nUpdateMode ( embed::EmbedUpdateModes::ALWAYS_UPDATE )
-, m_xFactory( xFactory )
-, m_nMiscStatus( 0 )
-, m_bEmbeddedScriptSupport( sal_True )
-, m_bDocumentRecoverySupport( sal_True )
-, m_bWaitSaveCompleted( sal_False )
-, m_bIsLink( sal_True )
-, m_bLinkHasPassword( sal_False )
-, m_bHasClonedSize( sal_False )
-, m_nClonedMapUnit( 0 )
-{
- // linked object has no own persistence so it is in loaded state starting from creation
- LinkInit_Impl( aObjProps, aMediaDescr, aObjectDescr );
-}
-
-//------------------------------------------------------
-void OCommonEmbeddedObject::CommonInit_Impl( const uno::Sequence< beans::NamedValue >& aObjectProps )
-{
- OSL_ENSURE( m_xFactory.is(), "No ServiceFactory is provided!\n" );
- if ( !m_xFactory.is() )
- throw uno::RuntimeException();
-
- m_pDocHolder = new DocumentHolder( m_xFactory, this );
- m_pDocHolder->acquire();
-
- // parse configuration entries
- // TODO/LATER: in future UI names can be also provided here
- for ( sal_Int32 nInd = 0; nInd < aObjectProps.getLength(); nInd++ )
- {
- if ( aObjectProps[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ClassID" ) ) )
- aObjectProps[nInd].Value >>= m_aClassID;
- else if ( aObjectProps[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ObjectDocumentServiceName" ) ) )
- aObjectProps[nInd].Value >>= m_aDocServiceName;
- else if ( aObjectProps[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ObjectDocumentFilterName" ) ) )
- aObjectProps[nInd].Value >>= m_aPresetFilterName;
- else if ( aObjectProps[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ObjectMiscStatus" ) ) )
- aObjectProps[nInd].Value >>= m_nMiscStatus;
- else if ( aObjectProps[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ObjectVerbs" ) ) )
- aObjectProps[nInd].Value >>= m_aObjectVerbs;
- }
-
- if ( m_aClassID.getLength() != 16 /*|| !m_aDocServiceName.getLength()*/ )
- throw uno::RuntimeException(); // something goes really wrong
-
- // accepted states
- m_aAcceptedStates.realloc( NUM_SUPPORTED_STATES );
-
- m_aAcceptedStates[0] = embed::EmbedStates::LOADED;
- m_aAcceptedStates[1] = embed::EmbedStates::RUNNING;
- m_aAcceptedStates[2] = embed::EmbedStates::INPLACE_ACTIVE;
- m_aAcceptedStates[3] = embed::EmbedStates::UI_ACTIVE;
- m_aAcceptedStates[4] = embed::EmbedStates::ACTIVE;
-
-
- // intermediate states
- // In the following table the first index points to starting state,
- // the second one to the target state, and the sequence referenced by
- // first two indexes contains intermediate states, that should be
- // passed by object to reach the target state.
- // If the sequence is empty that means that indirect switch from start
- // state to the target state is forbidden, only if direct switch is possible
- // the state can be reached.
-
- m_pIntermediateStatesSeqs[0][2].realloc( 1 );
- m_pIntermediateStatesSeqs[0][2][0] = embed::EmbedStates::RUNNING;
-
- m_pIntermediateStatesSeqs[0][3].realloc( 2 );
- m_pIntermediateStatesSeqs[0][3][0] = embed::EmbedStates::RUNNING;
- m_pIntermediateStatesSeqs[0][3][1] = embed::EmbedStates::INPLACE_ACTIVE;
-
- m_pIntermediateStatesSeqs[0][4].realloc( 1 );
- m_pIntermediateStatesSeqs[0][4][0] = embed::EmbedStates::RUNNING;
-
- m_pIntermediateStatesSeqs[1][3].realloc( 1 );
- m_pIntermediateStatesSeqs[1][3][0] = embed::EmbedStates::INPLACE_ACTIVE;
-
- m_pIntermediateStatesSeqs[2][0].realloc( 1 );
- m_pIntermediateStatesSeqs[2][0][0] = embed::EmbedStates::RUNNING;
-
- m_pIntermediateStatesSeqs[3][0].realloc( 2 );
- m_pIntermediateStatesSeqs[3][0][0] = embed::EmbedStates::INPLACE_ACTIVE;
- m_pIntermediateStatesSeqs[3][0][1] = embed::EmbedStates::RUNNING;
-
- m_pIntermediateStatesSeqs[3][1].realloc( 1 );
- m_pIntermediateStatesSeqs[3][1][0] = embed::EmbedStates::INPLACE_ACTIVE;
-
- m_pIntermediateStatesSeqs[4][0].realloc( 1 );
- m_pIntermediateStatesSeqs[4][0][0] = embed::EmbedStates::RUNNING;
-
- // verbs table
- sal_Int32 nVerbTableSize = 0;
- for ( sal_Int32 nVerbInd = 0; nVerbInd < m_aObjectVerbs.getLength(); nVerbInd++ )
- {
- if ( m_aObjectVerbs[nVerbInd].VerbID == embed::EmbedVerbs::MS_OLEVERB_PRIMARY )
- {
- m_aVerbTable.realloc( ++nVerbTableSize );
- m_aVerbTable[nVerbTableSize - 1].realloc( 2 );
- m_aVerbTable[nVerbTableSize - 1][0] = m_aObjectVerbs[nVerbInd].VerbID;
- m_aVerbTable[nVerbTableSize - 1][1] = embed::EmbedStates::UI_ACTIVE;
- }
- else if ( m_aObjectVerbs[nVerbInd].VerbID == embed::EmbedVerbs::MS_OLEVERB_SHOW )
- {
- m_aVerbTable.realloc( ++nVerbTableSize );
- m_aVerbTable[nVerbTableSize - 1].realloc( 2 );
- m_aVerbTable[nVerbTableSize - 1][0] = m_aObjectVerbs[nVerbInd].VerbID;
- m_aVerbTable[nVerbTableSize - 1][1] = embed::EmbedStates::UI_ACTIVE;
- }
- else if ( m_aObjectVerbs[nVerbInd].VerbID == embed::EmbedVerbs::MS_OLEVERB_OPEN )
- {
- m_aVerbTable.realloc( ++nVerbTableSize );
- m_aVerbTable[nVerbTableSize - 1].realloc( 2 );
- m_aVerbTable[nVerbTableSize - 1][0] = m_aObjectVerbs[nVerbInd].VerbID;
- m_aVerbTable[nVerbTableSize - 1][1] = embed::EmbedStates::ACTIVE;
- }
- else if ( m_aObjectVerbs[nVerbInd].VerbID == embed::EmbedVerbs::MS_OLEVERB_IPACTIVATE )
- {
- m_aVerbTable.realloc( ++nVerbTableSize );
- m_aVerbTable[nVerbTableSize - 1].realloc( 2 );
- m_aVerbTable[nVerbTableSize - 1][0] = m_aObjectVerbs[nVerbInd].VerbID;
- m_aVerbTable[nVerbTableSize - 1][1] = embed::EmbedStates::INPLACE_ACTIVE;
- }
- else if ( m_aObjectVerbs[nVerbInd].VerbID == embed::EmbedVerbs::MS_OLEVERB_UIACTIVATE )
- {
- m_aVerbTable.realloc( ++nVerbTableSize );
- m_aVerbTable[nVerbTableSize - 1].realloc( 2 );
- m_aVerbTable[nVerbTableSize - 1][0] = m_aObjectVerbs[nVerbInd].VerbID;
- m_aVerbTable[nVerbTableSize - 1][1] = embed::EmbedStates::UI_ACTIVE;
- }
- else if ( m_aObjectVerbs[nVerbInd].VerbID == embed::EmbedVerbs::MS_OLEVERB_HIDE )
- {
- m_aVerbTable.realloc( ++nVerbTableSize );
- m_aVerbTable[nVerbTableSize - 1].realloc( 2 );
- m_aVerbTable[nVerbTableSize - 1][0] = m_aObjectVerbs[nVerbInd].VerbID;
- m_aVerbTable[nVerbTableSize - 1][1] = embed::EmbedStates::RUNNING;
- }
- }
-}
-
-//------------------------------------------------------
-void OCommonEmbeddedObject::LinkInit_Impl(
- const uno::Sequence< beans::NamedValue >& aObjectProps,
- const uno::Sequence< beans::PropertyValue >& aMediaDescr,
- const uno::Sequence< beans::PropertyValue >& aObjectDescr )
-{
- // setPersistance has no effect on own links, so the complete initialization must be done here
-
- for ( sal_Int32 nInd = 0; nInd < aMediaDescr.getLength(); nInd++ )
- if ( aMediaDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "URL" ) ) )
- aMediaDescr[nInd].Value >>= m_aLinkURL;
- else if ( aMediaDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FilterName" ) ) )
- aMediaDescr[nInd].Value >>= m_aLinkFilterName;
-
- OSL_ENSURE( m_aLinkURL.getLength() && m_aLinkFilterName.getLength(), "Filter and URL must be provided!\n" );
-
- m_bReadOnly = sal_True;
- if ( m_aLinkFilterName.getLength() )
- {
- ::comphelper::MimeConfigurationHelper aHelper( m_xFactory );
- ::rtl::OUString aExportFilterName = aHelper.GetExportFilterFromImportFilter( m_aLinkFilterName );
- m_bReadOnly = !( aExportFilterName.equals( m_aLinkFilterName ) );
- }
-
- m_aDocMediaDescriptor = GetValuableArgs_Impl( aMediaDescr, sal_False );
-
- uno::Reference< frame::XDispatchProviderInterceptor > xDispatchInterceptor;
- for ( sal_Int32 nObjInd = 0; nObjInd < aObjectDescr.getLength(); nObjInd++ )
- if ( aObjectDescr[nObjInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OutplaceDispatchInterceptor" ) ) )
- {
- aObjectDescr[nObjInd].Value >>= xDispatchInterceptor;
- break;
- }
- else if ( aObjectDescr[nObjInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Parent" ) ) )
- {
- aObjectDescr[nObjInd].Value >>= m_xParent;
- }
-
- CommonInit_Impl( aObjectProps );
-
- if ( xDispatchInterceptor.is() )
- m_pDocHolder->SetOutplaceDispatchInterceptor( xDispatchInterceptor );
-}
-
-//------------------------------------------------------
-OCommonEmbeddedObject::~OCommonEmbeddedObject()
-{
- if ( m_pInterfaceContainer || m_pDocHolder )
- {
- m_refCount++;
- try {
- lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
-
- if ( m_pInterfaceContainer )
- {
- m_pInterfaceContainer->disposeAndClear( aSource );
-
- delete m_pInterfaceContainer;
- m_pInterfaceContainer = NULL;
- }
- } catch( uno::Exception& ) {}
-
- try {
- if ( m_pDocHolder )
- {
- m_pDocHolder->CloseFrame();
- try {
- m_pDocHolder->CloseDocument( sal_True, sal_True );
- } catch ( uno::Exception& ) {}
- m_pDocHolder->FreeOffice();
-
- m_pDocHolder->release();
- m_pDocHolder = NULL;
- }
- } catch( uno::Exception& ) {}
- }
-}
-
-//------------------------------------------------------
-void OCommonEmbeddedObject::requestPositioning( const awt::Rectangle& aRect )
-{
- // the method is called in case object is inplace active and the object window was resized
-
- OSL_ENSURE( m_xClientSite.is(), "The client site must be set for inplace active object!\n" );
- if ( m_xClientSite.is() )
- {
- uno::Reference< embed::XInplaceClient > xInplaceClient( m_xClientSite, uno::UNO_QUERY );
-
- OSL_ENSURE( xInplaceClient.is(), "The client site must support XInplaceClient to allow inplace activation!\n" );
- if ( xInplaceClient.is() )
- {
- try {
- xInplaceClient->changedPlacement( aRect );
- }
- catch( uno::Exception& )
- {
- OSL_FAIL( "Exception on request to resize!\n" );
- }
- }
- }
-}
-
-//------------------------------------------------------
-void OCommonEmbeddedObject::PostEvent_Impl( const ::rtl::OUString& aEventName,
- const uno::Reference< uno::XInterface >& /*xSource*/ )
-{
- if ( m_pInterfaceContainer )
- {
- ::cppu::OInterfaceContainerHelper* pIC = m_pInterfaceContainer->getContainer(
- ::getCppuType((const uno::Reference< document::XEventListener >*)0) );
- if( pIC )
- {
- document::EventObject aEvent;
- aEvent.EventName = aEventName;
- aEvent.Source = uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) );
- // For now all the events are sent as object events
- // aEvent.Source = ( xSource.is() ? xSource
- // : uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ) );
- ::cppu::OInterfaceIteratorHelper aIt( *pIC );
- while( aIt.hasMoreElements() )
- {
- try
- {
- ((document::XEventListener *)aIt.next())->notifyEvent( aEvent );
- }
- catch( uno::RuntimeException& )
- {
- aIt.remove();
- }
-
- // the listener could dispose the object.
- if ( m_bDisposed )
- return;
- }
- }
- }
-}
-
-//------------------------------------------------------
-uno::Any SAL_CALL OCommonEmbeddedObject::queryInterface( const uno::Type& rType )
- throw( uno::RuntimeException )
-{
- uno::Any aReturn;
-
- if ( rType == ::getCppuType( (uno::Reference< embed::XEmbeddedObject > const *)0 ))
- {
- void * p = static_cast< embed::XEmbeddedObject * >( this );
- return uno::Any( &p, rType );
- }
- else
- aReturn <<= ::cppu::queryInterface(
- rType,
- static_cast< embed::XInplaceObject* >( this ),
- static_cast< embed::XVisualObject* >( this ),
- static_cast< embed::XCommonEmbedPersist* >( static_cast< embed::XEmbedPersist* >( this ) ),
- static_cast< embed::XEmbedPersist* >( this ),
- static_cast< embed::XLinkageSupport* >( this ),
- static_cast< embed::XStateChangeBroadcaster* >( this ),
- static_cast< embed::XClassifiedObject* >( this ),
- static_cast< embed::XComponentSupplier* >( this ),
- static_cast< util::XCloseable* >( this ),
- static_cast< container::XChild* >( this ),
- static_cast< chart2::XDefaultSizeTransmitter* >( this ),
- static_cast< document::XEventBroadcaster* >( this ) );
-
- if ( aReturn.hasValue() )
- return aReturn;
- else
- return ::cppu::OWeakObject::queryInterface( rType ) ;
-
-}
-
-//------------------------------------------------------
-void SAL_CALL OCommonEmbeddedObject::acquire()
- throw()
-{
- ::cppu::OWeakObject::acquire() ;
-}
-
-//------------------------------------------------------
-void SAL_CALL OCommonEmbeddedObject::release()
- throw()
-{
- ::cppu::OWeakObject::release() ;
-}
-
-//------------------------------------------------------
-uno::Sequence< uno::Type > SAL_CALL OCommonEmbeddedObject::getTypes()
- throw( uno::RuntimeException )
-{
- static ::cppu::OTypeCollection* pTypeCollection = NULL;
-
- if ( !pTypeCollection )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( !pTypeCollection )
- {
- if ( m_bIsLink )
- {
- static ::cppu::OTypeCollection aTypeCollection(
- ::getCppuType( (const uno::Reference< lang::XTypeProvider >*)NULL ),
- ::getCppuType( (const uno::Reference< embed::XEmbeddedObject >*)NULL ),
- ::getCppuType( (const uno::Reference< embed::XInplaceObject >*)NULL ),
- ::getCppuType( (const uno::Reference< embed::XCommonEmbedPersist >*)NULL ),
- ::getCppuType( (const uno::Reference< container::XChild >*)NULL ),
- ::getCppuType( (const uno::Reference< embed::XLinkageSupport >*)NULL ) );
-
- pTypeCollection = &aTypeCollection ;
- }
- else
- {
- static ::cppu::OTypeCollection aTypeCollection(
- ::getCppuType( (const uno::Reference< lang::XTypeProvider >*)NULL ),
- ::getCppuType( (const uno::Reference< embed::XEmbeddedObject >*)NULL ),
- ::getCppuType( (const uno::Reference< embed::XInplaceObject >*)NULL ),
- ::getCppuType( (const uno::Reference< embed::XCommonEmbedPersist >*)NULL ),
- ::getCppuType( (const uno::Reference< container::XChild >*)NULL ),
- ::getCppuType( (const uno::Reference< embed::XEmbedPersist >*)NULL ) );
-
- pTypeCollection = &aTypeCollection ;
- }
- }
- }
-
- return pTypeCollection->getTypes() ;
-
-}
-
-//------------------------------------------------------
-uno::Sequence< sal_Int8 > SAL_CALL OCommonEmbeddedObject::getImplementationId()
- throw( uno::RuntimeException )
-{
- static ::cppu::OImplementationId* pID = NULL ;
-
- if ( !pID )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() ) ;
- if ( !pID )
- {
- static ::cppu::OImplementationId aID( sal_False ) ;
- pID = &aID ;
- }
- }
-
- return pID->getImplementationId() ;
-}
-
-//------------------------------------------------------
-uno::Sequence< sal_Int8 > SAL_CALL OCommonEmbeddedObject::getClassID()
- throw ( uno::RuntimeException )
-{
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- return m_aClassID;
-}
-
-//------------------------------------------------------
-::rtl::OUString SAL_CALL OCommonEmbeddedObject::getClassName()
- throw ( uno::RuntimeException )
-{
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- return m_aClassName;
-}
-
-//------------------------------------------------------
-void SAL_CALL OCommonEmbeddedObject::setClassInfo(
- const uno::Sequence< sal_Int8 >& /*aClassID*/, const ::rtl::OUString& /*aClassName*/ )
- throw ( lang::NoSupportException,
- uno::RuntimeException )
-{
- // the object class info can not be changed explicitly
- throw lang::NoSupportException(); //TODO:
-}
-
-//------------------------------------------------------
-uno::Reference< util::XCloseable > SAL_CALL OCommonEmbeddedObject::getComponent()
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- // add an exception
- if ( m_nObjectState == -1 )
- {
- // the object is still not loaded
- throw uno::RuntimeException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Can't store object without persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- return uno::Reference< util::XCloseable >( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
-}
-
-//----------------------------------------------
-void SAL_CALL OCommonEmbeddedObject::addStateChangeListener( const uno::Reference< embed::XStateChangeListener >& xListener )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( !m_pInterfaceContainer )
- m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
-
- m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< embed::XStateChangeListener >*)0 ),
- xListener );
-}
-
-//----------------------------------------------
-void SAL_CALL OCommonEmbeddedObject::removeStateChangeListener(
- const uno::Reference< embed::XStateChangeListener >& xListener )
- throw (uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_pInterfaceContainer )
- m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< embed::XStateChangeListener >*)0 ),
- xListener );
-}
-
-//----------------------------------------------
-void SAL_CALL OCommonEmbeddedObject::close( sal_Bool bDeliverOwnership )
- throw ( util::CloseVetoException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bClosed )
- throw lang::DisposedException(); // TODO
-
- uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >( this ) );
- lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
-
- if ( m_pInterfaceContainer )
- {
- ::cppu::OInterfaceContainerHelper* pContainer =
- m_pInterfaceContainer->getContainer( ::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) );
- if ( pContainer != NULL )
- {
- ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
- while (pIterator.hasMoreElements())
- {
- try
- {
- ((util::XCloseListener*)pIterator.next())->queryClosing( aSource, bDeliverOwnership );
- }
- catch( uno::RuntimeException& )
- {
- pIterator.remove();
- }
- }
- }
-
- pContainer = m_pInterfaceContainer->getContainer(
- ::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) );
- if ( pContainer != NULL )
- {
- ::cppu::OInterfaceIteratorHelper pCloseIterator(*pContainer);
- while (pCloseIterator.hasMoreElements())
- {
- try
- {
- ((util::XCloseListener*)pCloseIterator.next())->notifyClosing( aSource );
- }
- catch( uno::RuntimeException& )
- {
- pCloseIterator.remove();
- }
- }
- }
-
- m_pInterfaceContainer->disposeAndClear( aSource );
- }
-
- m_bDisposed = sal_True; // the object is disposed now for outside
-
- // it is possible that the document can not be closed, in this case if the argument is false
- // the exception will be thrown otherwise in addition to exception the object must register itself
- // as termination listener and listen for document events
-
- if ( m_pDocHolder )
- {
- m_pDocHolder->CloseFrame();
-
- try {
- m_pDocHolder->CloseDocument( bDeliverOwnership, bDeliverOwnership );
- }
- catch( uno::Exception& )
- {
- if ( bDeliverOwnership )
- {
- m_pDocHolder->release();
- m_pDocHolder = NULL;
- m_bClosed = sal_True;
- }
-
- throw;
- }
-
- m_pDocHolder->FreeOffice();
-
- m_pDocHolder->release();
- m_pDocHolder = NULL;
- }
-
- // TODO: for now the storage will be disposed by the object, but after the document
- // will use the storage, the storage will be disposed by the document and recreated by the object
- if ( m_xObjectStorage.is() )
- {
- uno::Reference< lang::XComponent > xComp( m_xObjectStorage, uno::UNO_QUERY );
- OSL_ENSURE( xComp.is(), "Storage does not support XComponent!\n" );
-
- if ( xComp.is() )
- {
- try {
- xComp->dispose();
- } catch ( uno::Exception& ) {}
- }
-
- m_xObjectStorage.clear();
- m_xRecoveryStorage.clear();
- }
-
- m_bClosed = sal_True; // the closing succeeded
-}
-
-//----------------------------------------------
-void SAL_CALL OCommonEmbeddedObject::addCloseListener( const uno::Reference< util::XCloseListener >& xListener )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( !m_pInterfaceContainer )
- m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
-
- m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< util::XCloseListener >*)0 ), xListener );
-}
-
-//----------------------------------------------
-void SAL_CALL OCommonEmbeddedObject::removeCloseListener( const uno::Reference< util::XCloseListener >& xListener )
- throw (uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_pInterfaceContainer )
- m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< util::XCloseListener >*)0 ),
- xListener );
-}
-
-//------------------------------------------------------
-void SAL_CALL OCommonEmbeddedObject::addEventListener( const uno::Reference< document::XEventListener >& xListener )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( !m_pInterfaceContainer )
- m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
-
- m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< document::XEventListener >*)0 ), xListener );
-}
-
-//------------------------------------------------------
-void SAL_CALL OCommonEmbeddedObject::removeEventListener( const uno::Reference< document::XEventListener >& xListener )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_pInterfaceContainer )
- m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< document::XEventListener >*)0 ),
- xListener );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx
deleted file mode 100644
index fe6d000174..0000000000
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ /dev/null
@@ -1,1913 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-
-#include <commonembobj.hxx>
-#include <com/sun/star/embed/Aspects.hpp>
-#include <com/sun/star/document/XStorageBasedDocument.hpp>
-#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>
-#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>
-#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>
-
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XChild.hpp>
-#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>
-
-#include <comphelper/fileformat.h>
-#include <comphelper/storagehelper.hxx>
-#include <comphelper/mimeconfighelper.hxx>
-#include <comphelper/namedvaluecollection.hxx>
-
-#include <rtl/logfile.hxx>
-
-#include <tools/diagnose_ex.h>
-
-#define USE_STORAGEBASED_DOCUMENT
-
-using namespace ::com::sun::star;
-
-
-//------------------------------------------------------
-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.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ComponentData" ) )
- || aMedDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DocumentTitle" ) )
- || aMedDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "InteractionHandler" ) )
- || aMedDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "JumpMark" ) )
- // || aMedDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Password" ) ) makes no sence for embedded objects
- || aMedDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Preview" ) )
- || aMedDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ReadOnly" ) )
- || aMedDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StartPresentation" ) )
- || aMedDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "RepairPackage" ) )
- || aMedDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StatusIndicator" ) )
- || aMedDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ViewData" ) )
- || aMedDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ViewId" ) )
- || aMedDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "MacroExecutionMode" ) )
- || aMedDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "UpdateDocMode" ) )
- || (aMedDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DocumentBaseURL" ) ) && bCanUseDocumentBaseURL) )
- {
- aResult.realloc( ++nResLen );
- aResult[nResLen-1] = aMedDescr[nInd];
- }
- }
-
- return aResult;
-}
-
-//------------------------------------------------------
-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.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "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(RTL_CONSTASCII_USTRINGPARAM( "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(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.StorageFactory" )) ),
- uno::UNO_QUERY );
-
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[0] <<= xTempStream;
- aArgs[1] <<= embed::ElementModes::READWRITE;
- 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(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "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& )
- {
- // if an embedded object implementation does not support XInitialization,
- // 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.
- OSL_ASSERT("Consider implementing interface XInitialization to avoid duplicate construction");
- xDocument = _rxFactory->createInstance( _rDocumentServiceName );
- }
-
- return uno::Reference< util::XCloseable >( xDocument, uno::UNO_QUERY );
-}
-
-//------------------------------------------------------
-static void SetDocToEmbedded( const uno::Reference< frame::XModel > xDocument, const ::rtl::OUString& aModuleName )
-{
- if ( xDocument.is() )
- {
- uno::Sequence< beans::PropertyValue > aSeq( 1 );
- aSeq[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "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& )
- {}
- }
- }
-}
-
-//------------------------------------------------------
-void OCommonEmbeddedObject::SwitchOwnPersistence( const uno::Reference< embed::XStorage >& xNewParentStorage,
- const uno::Reference< embed::XStorage >& xNewObjectStorage,
- const ::rtl::OUString& aNewName )
-{
- 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 );
- }
-#endif
-
- try {
- if ( xComponent.is() )
- xComponent->dispose();
- }
- catch ( uno::Exception& )
- {
- }
-}
-
-//------------------------------------------------------
-void OCommonEmbeddedObject::SwitchOwnPersistence( const uno::Reference< embed::XStorage >& xNewParentStorage,
- const ::rtl::OUString& aNewName )
-{
- 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_FAIL( "OCommonEmbeddedObject::EmbedAndReparentDoc: cannot set parent at document!" );
- }
-}
-
-//------------------------------------------------------
-uno::Reference< util::XCloseable > OCommonEmbeddedObject::InitNewDocument_Impl()
-{
- uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xFactory, GetDocumentServiceName(),
- m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) );
-
- uno::Reference< frame::XModel > xModel( xDocument, uno::UNO_QUERY );
- uno::Reference< frame::XLoadable > xLoadable( xModel, uno::UNO_QUERY );
- if ( !xLoadable.is() )
- throw uno::RuntimeException();
-
- try
- {
- // set the document mode to embedded as the first action on document!!!
- EmbedAndReparentDoc_Impl( xDocument );
-
- // 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 );
- }
- 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;
-}
-
-//------------------------------------------------------
-uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadLink_Impl()
-{
- uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xFactory, GetDocumentServiceName(),
- m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) );
-
- 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 );
- aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "URL" ));
- aArgs[0].Value <<= m_aLinkURL;
- aArgs[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "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;
- }
-
- try
- {
- // the document is not really an embedded one, it is a link
- EmbedAndReparentDoc_Impl( xDocument );
-
- // load the document
- 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;
- }
- }
- }
- 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 );
-}
-
-//------------------------------------------------------
-uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorage_Impl()
-{
- ENSURE_OR_THROW( m_xObjectStorage.is(), "no object storage" );
-
- const uno::Reference< embed::XStorage > xSourceStorage( m_xRecoveryStorage.is() ? m_xRecoveryStorage : m_xObjectStorage );
-
- 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 );
- }
-
- uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY );
- 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 && ?
- throw uno::RuntimeException();
-
- ::comphelper::NamedValueCollection aLoadArgs;
- FillDefaultLoadArgs_Impl( xSourceStorage, aLoadArgs );
-
- uno::Reference< io::XInputStream > xTempInpStream;
- if ( !xDoc.is() )
- {
- xTempInpStream = createTempInpStreamFromStor( xSourceStorage, m_xFactory );
- 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(RTL_CONSTASCII_USTRINGPARAM( "Uri" )) ) >>= aTempFileURL;
- }
- catch( uno::Exception& )
- {
- }
-
- OSL_ENSURE( aTempFileURL.getLength(), "Coudn't retrieve temporary file URL!\n" );
-
- aLoadArgs.put( "URL", aTempFileURL );
- aLoadArgs.put( "InputStream", xTempInpStream );
- }
-
-
- aLoadArgs.merge( m_aDocMediaDescriptor, true );
-
- try
- {
- // set the document mode to embedded as the first step!!!
- EmbedAndReparentDoc_Impl( xDocument );
-
- if ( xDoc.is() )
- {
- xDoc->loadFromStorage( xSourceStorage, aLoadArgs.getPropertyValues() );
- if ( xSourceStorage != m_xObjectStorage )
- SwitchDocToStorage_Impl( xDoc, m_xObjectStorage );
- }
- else
- xLoadable->load( aLoadArgs.getPropertyValues() );
- }
- 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();
- }
- }
-
- throw; // TODO
- }
-
- return xDocument;
-}
-
-//------------------------------------------------------
-uno::Reference< io::XInputStream > OCommonEmbeddedObject::StoreDocumentToTempStream_Impl(
- sal_Int32 nStorageFormat,
- const ::rtl::OUString& aBaseURL,
- const ::rtl::OUString& aHierarchName )
-{
- uno::Reference < io::XOutputStream > xTempOut(
- m_xFactory->createInstance ( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "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 );
- }
-
- if( !xStorable.is() )
- throw uno::RuntimeException(); // TODO:
-
- ::rtl::OUString aFilterName = GetFilterName( nStorageFormat );
-
- OSL_ENSURE( aFilterName.getLength(), "Wrong document service name!" );
- if ( !aFilterName.getLength() )
- throw io::IOException(); // TODO:
-
- uno::Sequence< beans::PropertyValue > aArgs( 4 );
- aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "FilterName" ));
- aArgs[0].Value <<= aFilterName;
- aArgs[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "OutputStream" ));
- aArgs[1].Value <<= xTempOut;
- aArgs[2].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentBaseURL" ));
- aArgs[2].Value <<= aBaseURL;
- aArgs[3].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HierarchicalDocumentName" ));
- aArgs[3].Value <<= aHierarchName;
-
- xStorable->storeToURL( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "private:stream" )), aArgs );
- try
- {
- xTempOut->closeOutput();
- }
- catch( uno::Exception& )
- {
- OSL_FAIL( "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& )
- {}
-
- try {
- m_xClientSite->saveObject();
- }
- catch( uno::Exception& )
- {
- OSL_FAIL( "The object was not stored!\n" );
- }
- }
-}
-
-//------------------------------------------------------
-::rtl::OUString OCommonEmbeddedObject::GetBaseURL_Impl() const
-{
- ::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();
-}
-
-//------------------------------------------------------
-void OCommonEmbeddedObject::StoreDocToStorage_Impl( const uno::Reference< embed::XStorage >& xStorage,
- sal_Int32 nStorageFormat,
- const ::rtl::OUString& aBaseURL,
- const ::rtl::OUString& aHierarchName,
- sal_Bool bAttachToTheStorage )
-{
- OSL_ENSURE( xStorage.is(), "No storage is provided for storing!" );
-
- if ( !xStorage.is() )
- throw uno::RuntimeException(); // TODO:
-
-#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 );
- }
-
- if ( xDoc.is() )
- {
- ::rtl::OUString aFilterName = GetFilterName( nStorageFormat );
-
- OSL_ENSURE( aFilterName.getLength(), "Wrong document service name!" );
- if ( !aFilterName.getLength() )
- throw io::IOException(); // TODO:
-
- uno::Sequence< beans::PropertyValue > aArgs( 3 );
- aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "FilterName" ));
- aArgs[0].Value <<= aFilterName;
- aArgs[2].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DocumentBaseURL" ));
- aArgs[2].Value <<= aBaseURL;
- aArgs[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HierarchicalDocumentName" ));
- aArgs[1].Value <<= aHierarchName;
-
- xDoc->storeToStorage( xStorage, aArgs );
- if ( bAttachToTheStorage )
- SwitchDocToStorage_Impl( xDoc, xStorage );
- }
- else
-#endif
- {
- // store document to temporary stream based on temporary file
- uno::Reference < io::XInputStream > xTempIn = StoreDocumentToTempStream_Impl( nStorageFormat, aBaseURL, aHierarchName );
-
- 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(RTL_CONSTASCII_USTRINGPARAM( "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:
-
- // object storage must be commited automatically
- xTempStorage->copyToStorage( xStorage );
- }
-}
-
-//------------------------------------------------------
-uno::Reference< util::XCloseable > OCommonEmbeddedObject::CreateDocFromMediaDescr_Impl(
- const uno::Sequence< beans::PropertyValue >& aMedDescr )
-{
- uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xFactory, GetDocumentServiceName(),
- m_bEmbeddedScriptSupport, m_bDocumentRecoverySupport ) );
-
- 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 );
-
- xLoadable->load( addAsTemplate( aMedDescr ) );
- }
- 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;
-}
-
-//------------------------------------------------------
-uno::Reference< util::XCloseable > OCommonEmbeddedObject::CreateTempDocFromLink_Impl()
-{
- uno::Reference< util::XCloseable > xResult;
-
- OSL_ENSURE( m_bIsLink, "The object is not a linked one!\n" );
-
- uno::Sequence< beans::PropertyValue > aTempMediaDescr;
-
- 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
- }
- catch ( uno::Exception& )
- {
- OSL_FAIL( "Can not retrieve storage media type!\n" );
- }
-
- if ( m_pDocHolder->GetComponent().is() )
- {
- aTempMediaDescr.realloc( 4 );
-
- // TODO/LATER: may be private:stream should be used as target URL
- ::rtl::OUString aTempFileURL;
- 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(RTL_CONSTASCII_USTRINGPARAM( "Uri" )) ) >>= aTempFileURL;
- }
- catch( uno::Exception& )
- {
- }
-
- OSL_ENSURE( aTempFileURL.getLength(), "Coudn't retrieve temporary file URL!\n" );
-
- aTempMediaDescr[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "URL" ));
- aTempMediaDescr[0].Value <<= aTempFileURL;
- aTempMediaDescr[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "InputStream" ));
- aTempMediaDescr[1].Value <<= xTempStream;
- aTempMediaDescr[2].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "FilterName" ));
- aTempMediaDescr[2].Value <<= GetFilterName( nStorageFormat );
- aTempMediaDescr[3].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "AsTemplate" ));
- aTempMediaDescr[3].Value <<= sal_True;
- }
- else
- {
- aTempMediaDescr.realloc( 2 );
- aTempMediaDescr[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "URL" ));
- aTempMediaDescr[0].Value <<= m_aLinkURL;
- aTempMediaDescr[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "FilterName" ));
- aTempMediaDescr[1].Value <<= m_aLinkFilterName;
- }
-
- xResult = CreateDocFromMediaDescr_Impl( aTempMediaDescr );
-
- return xResult;
-}
-
-//------------------------------------------------------
-void SAL_CALL OCommonEmbeddedObject::setPersistentEntry(
- 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 )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OCommonEmbeddedObject::setPersistentEntry" );
-
- // 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(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 1 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 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 ) )
- {
- // 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(RTL_CONSTASCII_USTRINGPARAM( "Can't change persistant representation of activated object!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- if ( m_bWaitSaveCompleted )
- {
- if ( nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
- {
- // saveCompleted is expected, handle it accordingly
- if ( m_xNewParentStorage == xStorage && m_aNewEntryName.equals( sEntName ) )
- {
- saveCompleted( sal_True );
- return;
- }
-
- // if a completely different entry is provided, switch first back to the old persistence in saveCompleted
- // and then switch to the target persistence
- sal_Bool bSwitchFurther = ( m_xParentStorage != xStorage || !m_aEntryName.equals( sEntName ) );
- saveCompleted( sal_False );
- if ( !bSwitchFurther )
- return;
- }
- else
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- // 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;
- }
-
- 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 );
-
- m_aDocMediaDescriptor = GetValuableArgs_Impl( lArguments,
- nEntryConnectionMode != embed::EntryInitModes::MEDIA_DESCRIPTOR_INIT );
-
- m_bReadOnly = sal_False;
- for ( sal_Int32 nInd = 0; nInd < lArguments.getLength(); nInd++ )
- if ( lArguments[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ReadOnly" ) ) )
- lArguments[nInd].Value >>= m_bReadOnly;
-
- // TODO: use lObjArgs for StoreVisualReplacement
- for ( sal_Int32 nObjInd = 0; nObjInd < lObjArgs.getLength(); nObjInd++ )
- if ( lObjArgs[nObjInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OutplaceDispatchInterceptor" ) ) )
- {
- uno::Reference< frame::XDispatchProviderInterceptor > xDispatchInterceptor;
- if ( lObjArgs[nObjInd].Value >>= xDispatchInterceptor )
- m_pDocHolder->SetOutplaceDispatchInterceptor( xDispatchInterceptor );
- }
- else if ( lObjArgs[nObjInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DefaultParentBaseURL" ) ) )
- {
- lObjArgs[nObjInd].Value >>= m_aDefaultParentBaseURL;
- }
- else if ( lObjArgs[nObjInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "Parent" ) ) )
- {
- lObjArgs[nObjInd].Value >>= m_xParent;
- }
- else if ( lObjArgs[nObjInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "IndividualMiscStatus" ) ) )
- {
- sal_Int64 nMiscStatus=0;
- lObjArgs[nObjInd].Value >>= nMiscStatus;
- m_nMiscStatus |= nMiscStatus;
- }
- else if ( lObjArgs[nObjInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "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.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "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_FAIL( "OCommonEmbeddedObject::setPersistentEntry: illegal type for argument 'OutplaceFrameProperties'!" );
- }
- else if ( lObjArgs[nObjInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ModuleName" ) ) )
- {
- lObjArgs[nObjInd].Value >>= m_aModuleName;
- }
- else if ( lObjArgs[nObjInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "EmbeddedScriptSupport" ) ) )
- {
- OSL_VERIFY( lObjArgs[nObjInd].Value >>= m_bEmbeddedScriptSupport );
- }
- else if ( lObjArgs[nObjInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DocumentRecoverySupport" ) ) )
- {
- OSL_VERIFY( lObjArgs[nObjInd].Value >>= m_bDocumentRecoverySupport );
- }
- else if ( lObjArgs[nObjInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "RecoveryStorage" ) ) )
- {
- OSL_VERIFY( lObjArgs[nObjInd].Value >>= m_xRecoveryStorage );
- }
-
-
- sal_Int32 nStorageMode = m_bReadOnly ? embed::ElementModes::READ : embed::ElementModes::READWRITE;
-
- SwitchOwnPersistence( xStorage, sEntName );
-
- if ( nEntryConnectionMode == embed::EntryInitModes::DEFAULT_INIT )
- {
- if ( bElExists )
- {
- // the initialization from existing storage allows to leave object in loaded state
- m_nObjectState = embed::EmbedStates::LOADED;
- }
- else
- {
- m_pDocHolder->SetComponent( InitNewDocument_Impl(), m_bReadOnly );
- if ( !m_pDocHolder->GetComponent().is() )
- throw io::IOException(); // TODO: can not create document
-
- m_nObjectState = embed::EmbedStates::RUNNING;
- }
- }
- else
- {
- if ( ( nStorageMode & embed::ElementModes::READWRITE ) != embed::ElementModes::READWRITE )
- throw io::IOException();
-
- if ( nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
- {
- // 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
- }
- else if ( nEntryConnectionMode == embed::EntryInitModes::TRUNCATE_INIT )
- {
- if ( m_xRecoveryStorage.is() )
- TransferMediaType( m_xRecoveryStorage, m_xObjectStorage );
-
- // TODO:
- m_pDocHolder->SetComponent( InitNewDocument_Impl(), m_bReadOnly );
-
- if ( !m_pDocHolder->GetComponent().is() )
- throw io::IOException(); // TODO: can not create document
-
- m_nObjectState = embed::EmbedStates::RUNNING;
- }
- else if ( nEntryConnectionMode == embed::EntryInitModes::MEDIA_DESCRIPTOR_INIT )
- {
- m_pDocHolder->SetComponent( CreateDocFromMediaDescr_Impl( lArguments ), m_bReadOnly );
- m_nObjectState = embed::EmbedStates::RUNNING;
- }
- //else if ( nEntryConnectionMode == embed::EntryInitModes::TRANSFERABLE_INIT )
- //{
- //TODO:
- //}
- else
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Wrong connection mode is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 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 )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OCommonEmbeddedObject::storeToEntry" );
-
- ::osl::ResettableMutexGuard 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(RTL_CONSTASCII_USTRINGPARAM( "Can't store object without persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- // 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 )
- return;
-
- 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;
- try {
- nTargetStorageFormat = ::comphelper::OStorageHelper::GetXStorageFormat( xStorage );
- }
- catch ( beans::IllegalTypeException& )
- {
- // the container just has an unknown type, use current file format
- }
- catch ( uno::Exception& )
- {
- OSL_FAIL( "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_FAIL( "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.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CanTryOptimization" ) ) )
- lObjArgs[nInd].Value >>= bTryOptimization;
- }
-
- sal_Bool bSwitchBackToLoaded = sal_False;
-
- // Storing to different format can be done only in running state.
- 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 )
- {
- uno::Reference< embed::XStorage > xSubStorage =
- xStorage->openStorageElement( sEntName, embed::ElementModes::READWRITE );
-
- if ( !xSubStorage.is() )
- throw uno::RuntimeException(); //TODO
-
- aGuard.clear();
- // 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 );
- }
-
- // 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 )
- 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 );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- {
- // the object is still not loaded
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Can't store object without persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- // 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_aNewEntryName = sEntName;
- return;
- }
-
- 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;
- try {
- nTargetStorageFormat = ::comphelper::OStorageHelper::GetXStorageFormat( xStorage );
- }
- catch ( beans::IllegalTypeException& )
- {
- // the container just has an unknown type, use current file format
- }
- catch ( uno::Exception& )
- {
- OSL_FAIL( "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_FAIL( "Can not retrieve own storage media type!\n" );
- }
-
- PostEvent_Impl( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "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.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CanTryOptimization" ) ) )
- lObjArgs[nInd].Value >>= bTryOptimization;
- }
-
- sal_Bool bSwitchBackToLoaded = sal_False;
-
- // Storing to different format can be done only in running state.
- 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;
- }
- }
-
- uno::Reference< embed::XStorage > xSubStorage =
- xStorage->openStorageElement( sEntName, embed::ElementModes::READWRITE );
-
- if ( !xSubStorage.is() )
- throw uno::RuntimeException(); //TODO
-
- if ( m_nObjectState != embed::EmbedStates::LOADED )
- {
- aGuard.clear();
- // 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 );
- }
-
- m_bWaitSaveCompleted = sal_True;
- m_xNewObjectStorage = xSubStorage;
- m_xNewParentStorage = xStorage;
- m_aNewEntryName = sEntName;
- m_aNewDocMediaDescriptor = GetValuableArgs_Impl( lArguments, sal_True );
-
- // 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" );
-
- ::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(RTL_CONSTASCII_USTRINGPARAM( "Can't store object without persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- // 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 )
- {
- if ( bUseNew )
- m_aEntryName = m_aNewEntryName;
- m_aNewEntryName = ::rtl::OUString();
- return;
- }
-
- // it is allowed to call saveCompleted( false ) for nonstored objects
- if ( !m_bWaitSaveCompleted && !bUseNew )
- return;
-
- 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 );
- 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(RTL_CONSTASCII_USTRINGPARAM( "OnSaveAsDone" ) ));
- }
- else
- {
- try {
- uno::Reference< lang::XComponent > xComponent( m_xNewObjectStorage, uno::UNO_QUERY );
- 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();
- m_aNewDocMediaDescriptor.realloc( 0 );
- m_bWaitSaveCompleted = sal_False;
-
- if ( bUseNew )
- {
- // TODO: notify listeners
-
- if ( m_nUpdateMode == embed::EmbedUpdateModes::ALWAYS_UPDATE )
- {
- // 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(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- 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(RTL_CONSTASCII_USTRINGPARAM( "The object persistence is not initialized!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- return m_aEntryName;
-}
-
-//------------------------------------------------------
-void SAL_CALL OCommonEmbeddedObject::storeOwn()
- throw ( embed::WrongStateException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OCommonEmbeddedObject::storeOwn" );
-
- // 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 );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- {
- // the object is still not loaded
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Can't store object without persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- 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(RTL_CONSTASCII_USTRINGPARAM( "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();
-
- xStorable->store();
-
- aGuard.reset();
- }
- 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
- }
- catch ( uno::Exception& )
- {
- OSL_FAIL( "Can not retrieve storage media type!\n" );
- }
-
- aGuard.clear();
- StoreDocToStorage_Impl( m_xObjectStorage, nStorageFormat, GetBaseURL_Impl(), m_aEntryName, sal_True );
- aGuard.reset();
- }
-
- uno::Reference< util::XModifiable > xModif( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
- if ( xModif.is() )
- xModif->setModified( sal_False );
-
- PostEvent_Impl( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "OnSaveDone" )) );
-}
-
-//------------------------------------------------------
-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(RTL_CONSTASCII_USTRINGPARAM( "The object persistence is not initialized!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- return m_bReadOnly;
-}
-
-//------------------------------------------------------
-void SAL_CALL OCommonEmbeddedObject::reload(
- const uno::Sequence< beans::PropertyValue >& lArguments,
- const uno::Sequence< beans::PropertyValue >& lObjArgs )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- // TODO: use lObjArgs
- // for now this method is used only to switch readonly state
-
- ::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(RTL_CONSTASCII_USTRINGPARAM( "The object persistence is not initialized!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- if ( m_nObjectState != embed::EmbedStates::LOADED )
- {
- // the object is still not loaded
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object must be in loaded state to be reloaded!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- 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.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "URL" ) ) )
- {
- // the new URL
- lArguments[nInd].Value >>= m_aLinkURL;
- m_aLinkFilterName = ::rtl::OUString();
- }
- else if ( lArguments[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "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 );
- }
- }
-
- 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.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OutplaceDispatchInterceptor" ) ) )
- {
- uno::Reference< frame::XDispatchProviderInterceptor > xDispatchInterceptor;
- if ( lObjArgs[nObjInd].Value >>= xDispatchInterceptor )
- m_pDocHolder->SetOutplaceDispatchInterceptor( xDispatchInterceptor );
-
- break;
- }
-
- // TODO:
- // 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.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ReadOnly" ) ) )
- lArguments[nInd].Value >>= m_bReadOnly;
-
- if ( bOldReadOnlyValue != m_bReadOnly && !m_bIsLink )
- {
- // 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 );
- }
-}
-
-//------------------------------------------------------
-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
-
- if ( !m_bIsLink )
- {
- // it must be a linked initialized object
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object is not a valid linked object!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
- 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 ).
- }
-
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 1 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 2 );
-
- if ( !m_bIsLink || m_nObjectState == -1 )
- {
- // it must be a linked initialized object
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object is not a valid linked object!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- 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 );
-
- m_bReadOnly = sal_False;
-
- if ( m_xParentStorage != xStorage || !m_aEntryName.equals( sEntName ) )
- SwitchOwnPersistence( xStorage, sEntName );
-
- // for linked object it means that it becomes embedded object
- // the document must switch it's persistence also
-
- // TODO/LATER: handle the case when temp doc can not be created
- // the document is a new embedded object so it must be marked as modified
- uno::Reference< util::XCloseable > xDocument = CreateTempDocFromLink_Impl();
- uno::Reference< util::XModifiable > xModif( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
- if ( !xModif.is() )
- throw uno::RuntimeException();
- try
- {
- xModif->setModified( sal_True );
- }
- catch( uno::Exception& )
- {}
-
- m_pDocHolder->SetComponent( xDocument, m_bReadOnly );
- OSL_ENSURE( m_pDocHolder->GetComponent().is(), "If document cant be created, an exception must be thrown!\n" );
-
- 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 )
- m_pDocHolder->Show();
-
- m_bIsLink = sal_False;
- m_aLinkFilterName = ::rtl::OUString();
- m_aLinkURL = ::rtl::OUString();
-}
-
-//------------------------------------------------------
-sal_Bool SAL_CALL OCommonEmbeddedObject::isLink()
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- return m_bIsLink;
-}
-
-//------------------------------------------------------
-::rtl::OUString SAL_CALL OCommonEmbeddedObject::getLinkURL()
- throw ( embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( !m_bIsLink )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object is not a link object!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- return m_aLinkURL;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/commonembedding/register.cxx b/embeddedobj/source/commonembedding/register.cxx
deleted file mode 100644
index 4e88967eb1..0000000000
--- a/embeddedobj/source/commonembedding/register.cxx
+++ /dev/null
@@ -1,88 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-
-
-#include <com/sun/star/registry/XRegistryKey.hpp>
-#include <com/sun/star/registry/InvalidRegistryException.hpp>
-#include <cppuhelper/factory.hxx>
-
-#include "xfactory.hxx"
-#include "xcreator.hxx"
-
-using namespace ::com::sun::star;
-
-
-extern "C" {
-
-SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
-{
- void * pRet = 0;
-
- ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplName ) );
- uno::Reference< lang::XSingleServiceFactory > xFactory;
-
- if ( pServiceManager )
- {
- if ( aImplName.equals( OOoEmbeddedObjectFactory::impl_staticGetImplementationName() ) )
- {
- xFactory= ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>( pServiceManager ),
- OOoEmbeddedObjectFactory::impl_staticGetImplementationName(),
- OOoEmbeddedObjectFactory::impl_staticCreateSelfInstance,
- OOoEmbeddedObjectFactory::impl_staticGetSupportedServiceNames() );
- }
- else if ( aImplName.equals( OOoSpecialEmbeddedObjectFactory::impl_staticGetImplementationName() ) )
- {
- xFactory= ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>( pServiceManager ),
- OOoSpecialEmbeddedObjectFactory::impl_staticGetImplementationName(),
- OOoSpecialEmbeddedObjectFactory::impl_staticCreateSelfInstance,
- OOoSpecialEmbeddedObjectFactory::impl_staticGetSupportedServiceNames() );
- }
- else if ( aImplName.equals( UNOEmbeddedObjectCreator::impl_staticGetImplementationName() ) )
- {
- xFactory= ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>( pServiceManager ),
- UNOEmbeddedObjectCreator::impl_staticGetImplementationName(),
- UNOEmbeddedObjectCreator::impl_staticCreateSelfInstance,
- UNOEmbeddedObjectCreator::impl_staticGetSupportedServiceNames() );
- }
- }
-
- if ( xFactory.is() )
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
-
- return pRet;
-}
-
-} // extern "C"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/commonembedding/specialobject.cxx b/embeddedobj/source/commonembedding/specialobject.cxx
deleted file mode 100644
index aaa8ebb2f1..0000000000
--- a/embeddedobj/source/commonembedding/specialobject.cxx
+++ /dev/null
@@ -1,234 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-#include <com/sun/star/ui/dialogs/XExecutableDialog.hpp>
-#include <com/sun/star/embed/EmbedStates.hpp>
-#include <com/sun/star/embed/EmbedVerbs.hpp>
-#include <com/sun/star/embed/EmbedUpdateModes.hpp>
-#include <com/sun/star/embed/XEmbeddedClient.hpp>
-#include <com/sun/star/embed/XInplaceClient.hpp>
-#include <com/sun/star/embed/XWindowSupplier.hpp>
-#include <com/sun/star/embed/Aspects.hpp>
-#include <com/sun/star/awt/XWindowPeer.hpp>
-#include <com/sun/star/util/XCloseBroadcaster.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <com/sun/star/util/XModifiable.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/XComponentLoader.hpp>
-#include <com/sun/star/frame/XDispatchProviderInterception.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/embed/EmbedMapUnits.hpp>
-
-#include <cppuhelper/typeprovider.hxx>
-
-#include "specialobject.hxx"
-#include "intercept.hxx"
-
-using namespace ::com::sun::star;
-
-
-OSpecialEmbeddedObject::OSpecialEmbeddedObject( const uno::Reference< lang::XMultiServiceFactory >& xFactory, const uno::Sequence< beans::NamedValue >& aObjectProps )
-: OCommonEmbeddedObject( xFactory, aObjectProps )
-{
- maSize.Width = maSize.Height = 10000;
- m_nObjectState = embed::EmbedStates::LOADED;
-}
-
-//------------------------------------------------------
-uno::Any SAL_CALL OSpecialEmbeddedObject::queryInterface( const uno::Type& rType )
- throw( uno::RuntimeException )
-{
- uno::Any aReturn;
-
- aReturn <<= ::cppu::queryInterface( rType,
- static_cast< embed::XEmbeddedObject* >( this ),
- static_cast< embed::XInplaceObject* >( this ),
- static_cast< embed::XVisualObject* >( this ),
- static_cast< embed::XClassifiedObject* >( this ),
- static_cast< embed::XComponentSupplier* >( this ),
- static_cast< util::XCloseable* >( this ),
- static_cast< document::XEventBroadcaster* >( this ) );
- if ( aReturn.hasValue() )
- return aReturn;
- else
- return ::cppu::OWeakObject::queryInterface( rType ) ;
-
-}
-
-//------------------------------------------------------
-uno::Sequence< uno::Type > SAL_CALL OSpecialEmbeddedObject::getTypes()
- throw( uno::RuntimeException )
-{
- static ::cppu::OTypeCollection* pTypeCollection = NULL;
-
- if ( !pTypeCollection )
- {
- ::osl::MutexGuard aGuard( ::osl::Mutex::getGlobalMutex() );
- if ( !pTypeCollection )
- {
- static ::cppu::OTypeCollection aTypeCollection(
- ::getCppuType( (const uno::Reference< lang::XTypeProvider >*)NULL ),
- ::getCppuType( (const uno::Reference< embed::XEmbeddedObject >*)NULL ),
- ::getCppuType( (const uno::Reference< embed::XInplaceObject >*)NULL ) );
-
- pTypeCollection = &aTypeCollection ;
- }
- }
-
- return pTypeCollection->getTypes() ;
-
-}
-
-embed::VisualRepresentation SAL_CALL OSpecialEmbeddedObject::getPreferredVisualRepresentation( sal_Int64 nAspect )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- // TODO: if object is in loaded state it should switch itself to the running state
- if ( m_nObjectState == -1 || m_nObjectState == embed::EmbedStates::LOADED )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The own object has no model!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
- if ( nAspect == embed::Aspects::MSOLE_ICON )
- // no representation can be retrieved
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Illegal call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- // TODO: return for the aspect of the document
- embed::VisualRepresentation aVisualRepresentation;
- return aVisualRepresentation;
-}
-
-void SAL_CALL OSpecialEmbeddedObject::setVisualAreaSize( sal_Int64 nAspect, const awt::Size& aSize )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
- if ( nAspect == embed::Aspects::MSOLE_ICON )
- // no representation can be retrieved
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Illegal call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- maSize = aSize;
-}
-
-awt::Size SAL_CALL OSpecialEmbeddedObject::getVisualAreaSize( sal_Int64 nAspect )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
- if ( nAspect == embed::Aspects::MSOLE_ICON )
- // no representation can be retrieved
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Illegal call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The own object has no model!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- awt::Size aResult;
- return maSize;
-}
-
-sal_Int32 SAL_CALL OSpecialEmbeddedObject::getMapUnit( sal_Int64 nAspect )
- throw ( uno::Exception,
- uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
- if ( nAspect == embed::Aspects::MSOLE_ICON )
- // no representation can be retrieved
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Illegal call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- return embed::EmbedMapUnits::ONE_100TH_MM;
-}
-
-void SAL_CALL OSpecialEmbeddedObject::changeState( sal_Int32 nNewState )
- throw ( ::com::sun::star::embed::UnreachableStateException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException )
-{
- if ( nNewState == embed::EmbedStates::UI_ACTIVE )
- nNewState = embed::EmbedStates::INPLACE_ACTIVE;
- OCommonEmbeddedObject::changeState( nNewState );
-}
-
-void SAL_CALL OSpecialEmbeddedObject::doVerb( sal_Int32 nVerbID )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- embed::UnreachableStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- if ( nVerbID == -7 )
- {
-
- uno::Reference < ui::dialogs::XExecutableDialog > xDlg( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
- if ( xDlg.is() )
- xDlg->execute();
- else
- throw embed::UnreachableStateException();
- }
- else
- OCommonEmbeddedObject::doVerb( nVerbID );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/commonembedding/visobj.cxx b/embeddedobj/source/commonembedding/visobj.cxx
deleted file mode 100644
index 3403c81614..0000000000
--- a/embeddedobj/source/commonembedding/visobj.cxx
+++ /dev/null
@@ -1,238 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-#include <com/sun/star/embed/Aspects.hpp>
-#include <com/sun/star/embed/EmbedStates.hpp>
-#include <com/sun/star/datatransfer/XTransferable.hpp>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/lang/DisposedException.hpp>
-
-#include <rtl/logfile.hxx>
-
-
-#include <commonembobj.hxx>
-
-
-using namespace ::com::sun::star;
-
-void SAL_CALL OCommonEmbeddedObject::setVisualAreaSize( sal_Int64 nAspect, const awt::Size& aSize )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OCommonEmbeddedObject::setVisualAreaSize" );
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
- if ( nAspect == embed::Aspects::MSOLE_ICON )
- // no representation can be retrieved
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Illegal call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The own object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- m_bHasClonedSize = sal_False;
-
- sal_Bool bBackToLoaded = sal_False;
- if ( m_nObjectState == embed::EmbedStates::LOADED )
- {
- changeState( embed::EmbedStates::RUNNING );
-
- // the links should be switched back to loaded state for now to avoid locking problems
- bBackToLoaded = m_bIsLink;
- }
-
- sal_Bool bSuccess = m_pDocHolder->SetExtent( nAspect, aSize );
-
- if ( bBackToLoaded )
- changeState( embed::EmbedStates::LOADED );
-
- if ( !bSuccess )
- throw uno::Exception(); // TODO:
-}
-
-awt::Size SAL_CALL OCommonEmbeddedObject::getVisualAreaSize( sal_Int64 nAspect )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OCommonEmbeddedObject::getVisualAreaSize" );
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The own object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
-
- if ( m_bHasClonedSize )
- return m_aClonedSize;
-
- sal_Bool bBackToLoaded = sal_False;
- if ( m_nObjectState == embed::EmbedStates::LOADED )
- {
- changeState( embed::EmbedStates::RUNNING );
-
- // the links should be switched back to loaded state for now to avoid locking problems
- bBackToLoaded = m_bIsLink;
- }
-
- awt::Size aResult;
- sal_Bool bSuccess = m_pDocHolder->GetExtent( nAspect, &aResult );
-
- if ( bBackToLoaded )
- changeState( embed::EmbedStates::LOADED );
-
- if ( !bSuccess )
- throw uno::Exception(); // TODO:
-
- return aResult;
-}
-
-sal_Int32 SAL_CALL OCommonEmbeddedObject::getMapUnit( sal_Int64 nAspect )
- throw ( uno::Exception,
- uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
- if ( nAspect == embed::Aspects::MSOLE_ICON )
- // no representation can be retrieved
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Illegal call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The own object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- if ( m_bHasClonedSize )
- return m_nClonedMapUnit;
-
- sal_Bool bBackToLoaded = sal_False;
- if ( m_nObjectState == embed::EmbedStates::LOADED )
- {
- changeState( embed::EmbedStates::RUNNING );
-
- // the links should be switched back to loaded state for now to avoid locking problems
- bBackToLoaded = m_bIsLink;
- }
-
- sal_Int32 nResult = m_pDocHolder->GetMapUnit( nAspect );
-
- if ( bBackToLoaded )
- changeState( embed::EmbedStates::LOADED );
-
- if ( nResult < 0 )
- throw uno::Exception(); // TODO:
-
- return nResult;
-}
-
-embed::VisualRepresentation SAL_CALL OCommonEmbeddedObject::getPreferredVisualRepresentation( sal_Int64 nAspect )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OCommonEmbeddedObject::getPrefferedVisualRepresentation" );
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The own object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
-
- OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
- if ( nAspect == embed::Aspects::MSOLE_ICON )
- // no representation can be retrieved
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Illegal call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- sal_Bool bBackToLoaded = sal_False;
- if ( m_nObjectState == embed::EmbedStates::LOADED )
- {
- changeState( embed::EmbedStates::RUNNING );
-
- // the links should be switched back to loaded state for now to avoid locking problems
- bBackToLoaded = m_bIsLink;
- }
-
- OSL_ENSURE( m_pDocHolder->GetComponent().is(), "Running or Active object has no component!\n" );
-
- // TODO: return for the aspect of the document
- embed::VisualRepresentation aVisualRepresentation;
-
- uno::Reference< embed::XVisualObject > xVisualObject( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
- if( xVisualObject.is())
- {
- aVisualRepresentation = xVisualObject->getPreferredVisualRepresentation( nAspect );
- }
- else
- {
- uno::Reference< datatransfer::XTransferable > xTransferable( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
- if (!xTransferable.is() )
- throw uno::RuntimeException();
-
- datatransfer::DataFlavor aDataFlavor(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" )),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "GDIMetaFile" )),
- ::getCppuType( (const uno::Sequence< sal_Int8 >*) NULL ) );
-
- if( xTransferable->isDataFlavorSupported( aDataFlavor ))
- {
- aVisualRepresentation.Data = xTransferable->getTransferData( aDataFlavor );
- aVisualRepresentation.Flavor = aDataFlavor;
- }
- else
- throw uno::RuntimeException();
- }
-
- if ( bBackToLoaded )
- changeState( embed::EmbedStates::LOADED );
-
- return aVisualRepresentation;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/commonembedding/xfactory.cxx b/embeddedobj/source/commonembedding/xfactory.cxx
deleted file mode 100644
index 3fa388d9eb..0000000000
--- a/embeddedobj/source/commonembedding/xfactory.cxx
+++ /dev/null
@@ -1,564 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-#include <com/sun/star/embed/ElementModes.hpp>
-#include <com/sun/star/embed/EntryInitModes.hpp>
-#include <com/sun/star/document/XTypeDetection.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-
-#include <rtl/logfile.hxx>
-
-
-#include "xfactory.hxx"
-#include "commonembobj.hxx"
-#include "specialobject.hxx"
-#include "oleembobj.hxx"
-
-
-using namespace ::com::sun::star;
-
-//-------------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL OOoEmbeddedObjectFactory::impl_staticGetSupportedServiceNames()
-{
- uno::Sequence< ::rtl::OUString > aRet(2);
- aRet[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.OOoEmbeddedObjectFactory"));
- aRet[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.embed.OOoEmbeddedObjectFactory"));
- return aRet;
-}
-
-//-------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OOoEmbeddedObjectFactory::impl_staticGetImplementationName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.embed.OOoEmbeddedObjectFactory"));
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::impl_staticCreateSelfInstance(
- const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
-{
- return uno::Reference< uno::XInterface >( *new OOoEmbeddedObjectFactory( xServiceManager ) );
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInstanceInitFromEntry(
- const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const uno::Sequence< beans::PropertyValue >& aMediaDescr,
- const uno::Sequence< beans::PropertyValue >& lObjArgs )
- throw ( lang::IllegalArgumentException,
- container::NoSuchElementException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OOoEmbeddedObjectFactory::createInstanceInitFromEntry" );
-
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 1 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 2 );
-
- uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY );
- if ( !xNameAccess.is() )
- throw uno::RuntimeException(); //TODO
-
- // detect entry existence
- if ( !xNameAccess->hasByName( sEntName ) )
- throw container::NoSuchElementException();
-
- uno::Reference< uno::XInterface > xResult;
- if ( xStorage->isStorageElement( sEntName ) )
- {
- // the object must be based on storage
- uno::Reference< embed::XStorage > xSubStorage =
- xStorage->openStorageElement( sEntName, embed::ElementModes::READ );
-
- uno::Reference< beans::XPropertySet > xPropSet( xSubStorage, uno::UNO_QUERY );
- if ( !xPropSet.is() )
- throw uno::RuntimeException();
-
- ::rtl::OUString aMediaType;
- try {
- uno::Any aAny = xPropSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MediaType" )) );
- aAny >>= aMediaType;
- }
- catch ( uno::Exception& )
- {
- }
-
- try {
- uno::Reference< lang::XComponent > xComp( xSubStorage, uno::UNO_QUERY );
- if ( xComp.is() )
- xComp->dispose();
- }
- catch ( uno::Exception& )
- {
- }
- xSubStorage = uno::Reference< embed::XStorage >();
-
- uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByMediaType( aMediaType );
- if ( !aObject.getLength() )
- throw io::IOException(); // unexpected mimetype of the storage
-
- xResult = uno::Reference< uno::XInterface >(
- static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject(
- m_xFactory,
- aObject ) ),
- uno::UNO_QUERY );
- }
- else
- {
- // the object must be OOo embedded object, if it is not an exception must be thrown
- throw io::IOException(); // TODO:
- }
-
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
-
- if ( !xPersist.is() )
- throw uno::RuntimeException(); // TODO: the interface must be supported by own document objects
-
- xPersist->setPersistentEntry( xStorage,
- sEntName,
- embed::EntryInitModes::DEFAULT_INIT,
- aMediaDescr,
- lObjArgs );
-
- return xResult;
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInstanceInitFromMediaDescriptor(
- const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const uno::Sequence< beans::PropertyValue >& aMediaDescr,
- const uno::Sequence< beans::PropertyValue >& lObjArgs )
- throw ( lang::IllegalArgumentException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OOoEmbeddedObjectFactory::createInstanceInitFromMediaDescriptor" );
-
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 1 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 2 );
-
- uno::Sequence< beans::PropertyValue > aTempMedDescr( aMediaDescr );
-
- // check if there is FilterName
- ::rtl::OUString aFilterName = m_aConfigHelper.UpdateMediaDescriptorWithFilterName( aTempMedDescr, sal_False );
-
- uno::Reference< uno::XInterface > xResult;
-
- // find document service name
- if ( aFilterName.getLength() )
- {
- uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByFilter( aFilterName );
- if ( !aObject.getLength() )
- throw io::IOException(); // unexpected mimetype of the storage
-
-
- xResult = uno::Reference< uno::XInterface >(
- static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject(
- m_xFactory,
- aObject ) ),
- uno::UNO_QUERY );
- }
- else
- {
- // the object must be OOo embedded object, if it is not an exception must be thrown
- throw io::IOException(); // TODO:
- }
-
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
-
- if ( !xPersist.is() )
- throw uno::RuntimeException(); // TODO: the interface must be supported ( what about applets? )
-
- xPersist->setPersistentEntry( xStorage,
- sEntName,
- embed::EntryInitModes::MEDIA_DESCRIPTOR_INIT,
- aTempMedDescr,
- lObjArgs );
-
- return xResult;
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInstanceInitNew(
- const uno::Sequence< sal_Int8 >& aClassID,
- const ::rtl::OUString& /*aClassName*/,
- const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const uno::Sequence< beans::PropertyValue >& lObjArgs )
- throw ( lang::IllegalArgumentException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OOoEmbeddedObjectFactory::createInstanceInitNew" );
-
- uno::Reference< uno::XInterface > xResult;
-
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 3 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 4 );
-
- uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByClassID( aClassID );
- if ( !aObject.getLength() )
- throw io::IOException(); // unexpected mimetype of the storage
-
- xResult = uno::Reference< uno::XInterface >(
- static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject(
- m_xFactory,
- aObject ) ),
- uno::UNO_QUERY );
-
-
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
-
- if ( !xPersist.is() )
- throw uno::RuntimeException(); // TODO: the interface must be supported by own document objects
-
- xPersist->setPersistentEntry( xStorage,
- sEntName,
- embed::EntryInitModes::TRUNCATE_INIT,
- uno::Sequence< beans::PropertyValue >(),
- lObjArgs );
-
- return xResult;
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInstanceUserInit(
- const uno::Sequence< sal_Int8 >& aClassID,
- const ::rtl::OUString& /*aClassName*/,
- 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 )
- throw ( lang::IllegalArgumentException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OOoEmbeddedObjectFactory::createInstanceUserInit" );
-
- // the initialization is completelly controlled by user
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 1 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 2 );
-
- uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByClassID( aClassID );
- if ( !aObject.getLength() )
- throw io::IOException(); // unexpected mimetype of the storage
-
- uno::Sequence< beans::PropertyValue > aTempMedDescr( lArguments );
- if ( nEntryConnectionMode == embed::EntryInitModes::MEDIA_DESCRIPTOR_INIT )
- {
- ::rtl::OUString aFilterName = m_aConfigHelper.UpdateMediaDescriptorWithFilterName( aTempMedDescr, aObject );
- if ( !aFilterName.getLength() )
- // the object must be OOo embedded object, if it is not an exception must be thrown
- throw io::IOException(); // TODO:
- }
-
- uno::Reference< uno::XInterface > xResult = uno::Reference< uno::XInterface > (
- static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject(
- m_xFactory,
- aObject ) ),
- uno::UNO_QUERY );
-
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
- if ( xPersist.is() )
- {
- xPersist->setPersistentEntry( xStorage,
- sEntName,
- nEntryConnectionMode,
- aTempMedDescr,
- lObjArgs );
-
- }
- else
- throw uno::RuntimeException(); // TODO:
-
- return xResult;
-}
-
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInstanceLink(
- const uno::Reference< embed::XStorage >& /*xStorage*/,
- const ::rtl::OUString& /*sEntName*/,
- const uno::Sequence< beans::PropertyValue >& aMediaDescr,
- const uno::Sequence< beans::PropertyValue >& lObjArgs )
- throw ( lang::IllegalArgumentException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OOoEmbeddedObjectFactory::createInstanceLink" );
-
- uno::Reference< uno::XInterface > xResult;
-
- uno::Sequence< beans::PropertyValue > aTempMedDescr( aMediaDescr );
-
- // check if there is URL, URL must exist
- ::rtl::OUString aURL;
- for ( sal_Int32 nInd = 0; nInd < aTempMedDescr.getLength(); nInd++ )
- if ( aTempMedDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "URL" ) ) )
- aTempMedDescr[nInd].Value >>= aURL;
-
- if ( !aURL.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No URL for the link is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 3 );
-
- ::rtl::OUString aFilterName = m_aConfigHelper.UpdateMediaDescriptorWithFilterName( aTempMedDescr, sal_False );
-
- if ( aFilterName.getLength() )
- {
- uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByFilter( aFilterName );
- if ( !aObject.getLength() )
- throw io::IOException(); // unexpected mimetype of the storage
-
-
- xResult = uno::Reference< uno::XInterface >(
- static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject(
- m_xFactory,
- aObject,
- aTempMedDescr,
- lObjArgs ) ),
- uno::UNO_QUERY );
- }
- else
- {
- // the object must be OOo embedded object, if it is not an exception must be thrown
- throw io::IOException(); // TODO:
- }
-
- return xResult;
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL OOoEmbeddedObjectFactory::createInstanceLinkUserInit(
- const uno::Sequence< sal_Int8 >& aClassID,
- const ::rtl::OUString& /*aClassName*/,
- const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const uno::Sequence< beans::PropertyValue >& lArguments,
- const uno::Sequence< beans::PropertyValue >& lObjArgs )
- throw ( lang::IllegalArgumentException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OOoEmbeddedObjectFactory::createInstanceLinkUserInit" );
-
- uno::Reference< uno::XInterface > xResult;
-
- // the initialization is completelly controlled by user
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 1 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 2 );
-
- uno::Sequence< beans::PropertyValue > aTempMedDescr( lArguments );
-
- ::rtl::OUString aURL;
- for ( sal_Int32 nInd = 0; nInd < aTempMedDescr.getLength(); nInd++ )
- if ( aTempMedDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "URL" ) ) )
- aTempMedDescr[nInd].Value >>= aURL;
-
- if ( !aURL.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No URL for the link is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 3 );
-
- uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByClassID( aClassID );
- if ( !aObject.getLength() )
- throw io::IOException(); // unexpected mimetype of the storage
-
- ::rtl::OUString aFilterName = m_aConfigHelper.UpdateMediaDescriptorWithFilterName( aTempMedDescr, aObject );
-
- if ( aFilterName.getLength() )
- {
-
- xResult = uno::Reference< uno::XInterface >(
- static_cast< ::cppu::OWeakObject* > ( new OCommonEmbeddedObject(
- m_xFactory,
- aObject,
- aTempMedDescr,
- lObjArgs ) ),
- uno::UNO_QUERY );
- }
- else
- {
- // the object must be OOo embedded object, if it is not an exception must be thrown
- throw io::IOException(); // TODO:
- }
-
- return xResult;
-}
-
-//-------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OOoEmbeddedObjectFactory::getImplementationName()
- throw ( uno::RuntimeException )
-{
- return impl_staticGetImplementationName();
-}
-
-//-------------------------------------------------------------------------
-sal_Bool SAL_CALL OOoEmbeddedObjectFactory::supportsService( const ::rtl::OUString& ServiceName )
- throw ( uno::RuntimeException )
-{
- uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
-
- for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
- if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
- return sal_True;
-
- return sal_False;
-}
-
-//-------------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL OOoEmbeddedObjectFactory::getSupportedServiceNames()
- throw ( uno::RuntimeException )
-{
- return impl_staticGetSupportedServiceNames();
-}
-
-//-------------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL OOoSpecialEmbeddedObjectFactory::impl_staticGetSupportedServiceNames()
-{
- uno::Sequence< ::rtl::OUString > aRet(2);
- aRet[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.OOoSpecialEmbeddedObjectFactory"));
- aRet[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.embed.OOoSpecialEmbeddedObjectFactory"));
- return aRet;
-}
-
-//-------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OOoSpecialEmbeddedObjectFactory::impl_staticGetImplementationName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.embed.OOoSpecialEmbeddedObjectFactory"));
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL OOoSpecialEmbeddedObjectFactory::impl_staticCreateSelfInstance(
- const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
-{
- return uno::Reference< uno::XInterface >( *new OOoSpecialEmbeddedObjectFactory( xServiceManager ) );
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL OOoSpecialEmbeddedObjectFactory::createInstanceUserInit(
- const uno::Sequence< sal_Int8 >& aClassID,
- const ::rtl::OUString& /*aClassName*/,
- 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*/ )
- throw ( lang::IllegalArgumentException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- uno::Sequence< beans::NamedValue > aObject = m_aConfigHelper.GetObjectPropsByClassID( aClassID );
- if ( !aObject.getLength() )
- throw io::IOException(); // unexpected mimetype of the storage
-
- uno::Reference< uno::XInterface > xResult(
- static_cast< ::cppu::OWeakObject* > ( new OSpecialEmbeddedObject(
- m_xFactory,
- aObject ) ),
- uno::UNO_QUERY );
- return xResult;
-}
-
-//-------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OOoSpecialEmbeddedObjectFactory::getImplementationName()
- throw ( uno::RuntimeException )
-{
- return impl_staticGetImplementationName();
-}
-
-//-------------------------------------------------------------------------
-sal_Bool SAL_CALL OOoSpecialEmbeddedObjectFactory::supportsService( const ::rtl::OUString& ServiceName )
- throw ( uno::RuntimeException )
-{
- uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
-
- for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
- if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
- return sal_True;
-
- return sal_False;
-}
-
-//-------------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL OOoSpecialEmbeddedObjectFactory::getSupportedServiceNames()
- throw ( uno::RuntimeException )
-{
- return impl_staticGetSupportedServiceNames();
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/commonembedding/xfactory.hxx b/embeddedobj/source/commonembedding/xfactory.hxx
deleted file mode 100644
index 3faeb71cb1..0000000000
--- a/embeddedobj/source/commonembedding/xfactory.hxx
+++ /dev/null
@@ -1,127 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef __XFACTORY_HXX_
-#define __XFACTORY_HXX_
-
-#include <com/sun/star/embed/XEmbedObjectCreator.hpp>
-#include <com/sun/star/embed/XEmbedObjectFactory.hpp>
-#include <com/sun/star/embed/XLinkCreator.hpp>
-#include <com/sun/star/embed/XLinkFactory.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <cppuhelper/implbase2.hxx>
-#include <cppuhelper/implbase5.hxx>
-#include <comphelper/mimeconfighelper.hxx>
-
-class OOoEmbeddedObjectFactory : public ::cppu::WeakImplHelper5<
- ::com::sun::star::embed::XEmbedObjectCreator,
- ::com::sun::star::embed::XEmbedObjectFactory,
- ::com::sun::star::embed::XLinkCreator,
- ::com::sun::star::embed::XLinkFactory,
- ::com::sun::star::lang::XServiceInfo >
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
-
- ::comphelper::MimeConfigurationHelper m_aConfigHelper;
-
-public:
- OOoEmbeddedObjectFactory(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
- : m_xFactory( xFactory )
- , m_aConfigHelper( xFactory )
- {
- OSL_ENSURE( xFactory.is(), "No service manager is provided!\n" );
- }
-
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL impl_staticGetSupportedServiceNames();
-
- static ::rtl::OUString SAL_CALL impl_staticGetImplementationName();
-
- static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
- impl_staticCreateSelfInstance(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
-
-
- // XEmbedObjectCreator
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceInitNew( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceInitFromEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceInitFromMediaDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XEmbedObjectFactory
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceUserInit( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, sal_Int32 nEntryConnectionMode, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XLinkCreator
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceLink( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XLinkFactory
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceLinkUserInit( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
-
-};
-
-class OOoSpecialEmbeddedObjectFactory : public ::cppu::WeakImplHelper2<
- ::com::sun::star::embed::XEmbedObjectFactory,
- ::com::sun::star::lang::XServiceInfo >
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
-
- ::comphelper::MimeConfigurationHelper m_aConfigHelper;
-
-public:
- OOoSpecialEmbeddedObjectFactory(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
- : m_xFactory( xFactory )
- , m_aConfigHelper( xFactory )
- {
- OSL_ENSURE( xFactory.is(), "No service manager is provided!\n" );
- }
-
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL impl_staticGetSupportedServiceNames();
-
- static ::rtl::OUString SAL_CALL impl_staticGetImplementationName();
-
- static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
- impl_staticCreateSelfInstance(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
-
- // XEmbedObjectFactory
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceUserInit( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, sal_Int32 nEntryConnectionMode, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx
deleted file mode 100644
index 675ae8c2cb..0000000000
--- a/embeddedobj/source/general/docholder.cxx
+++ /dev/null
@@ -1,1351 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-#include <com/sun/star/embed/Aspects.hpp>
-#include <com/sun/star/uno/XComponentContext.hpp>
-#include <com/sun/star/frame/XComponentLoader.hpp>
-#include <com/sun/star/frame/XSynchronousFrameLoader.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/lang/XSingleServiceFactory.hpp>
-#include <com/sun/star/lang/XSingleComponentFactory.hpp>
-#include <com/sun/star/util/XCloseBroadcaster.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/beans/NamedValue.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
-#include <com/sun/star/frame/XFramesSupplier.hpp>
-#include <com/sun/star/frame/XDispatchHelper.hpp>
-#include <com/sun/star/frame/FrameSearchFlag.hpp>
-#include <com/sun/star/frame/XControllerBorder.hpp>
-#include <com/sun/star/util/XModifyBroadcaster.hpp>
-#include <com/sun/star/frame/XDispatchProviderInterception.hpp>
-#include <com/sun/star/awt/XTopWindow.hpp>
-#include <com/sun/star/awt/PosSize.hpp>
-#include <com/sun/star/awt/XView.hpp>
-#include <com/sun/star/awt/WindowAttribute.hpp>
-#include <com/sun/star/awt/VclWindowPeerAttribute.hpp>
-#include <com/sun/star/bridge/XBridgeSupplier2.hpp>
-#include <com/sun/star/bridge/ModelDependent.hpp>
-#include <com/sun/star/embed/XHatchWindow.hpp>
-#include <com/sun/star/embed/XHatchWindowFactory.hpp>
-#include <com/sun/star/embed/XInplaceClient.hpp>
-#include <com/sun/star/frame/XLayoutManager.hpp>
-#include <com/sun/star/frame/XMenuBarMergingAcceptor.hpp>
-#include <com/sun/star/frame/XModuleManager.hpp>
-#include <com/sun/star/ui/XDockingAreaAcceptor.hpp>
-#include <com/sun/star/ui/XUIElementSettings.hpp>
-#include <com/sun/star/ui/XUIConfigurationManager.hpp>
-#include <com/sun/star/ui/XUIConfigurationManagerSupplier.hpp>
-#include <com/sun/star/ui/XModuleUIConfigurationManagerSupplier.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-#include <com/sun/star/embed/StateChangeInProgressException.hpp>
-
-#include <com/sun/star/embed/EmbedMisc.hpp>
-#include <com/sun/star/embed/EmbedStates.hpp>
-#include <osl/diagnose.h>
-#include <rtl/process.h>
-
-#include <comphelper/processfactory.hxx>
-#include <comphelper/namedvaluecollection.hxx>
-
-#include "docholder.hxx"
-#include "commonembobj.hxx"
-#include "intercept.hxx"
-
-
-#define HATCH_BORDER_WIDTH (((m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) && \
- m_pEmbedObj->getCurrentState()!=embed::EmbedStates::UI_ACTIVE) ? 0 : 4 )
-
-using namespace ::com::sun::star;
-
-//===========================================================================
-
-class IntCounterGuard {
- sal_Int32& m_nFlag;
-public:
- IntCounterGuard( sal_Int32& nFlag )
- : m_nFlag( nFlag )
- {
- m_nFlag++;
- }
-
- ~IntCounterGuard()
- {
- if ( m_nFlag )
- m_nFlag--;
- }
-};
-
-//===========================================================================
-
-static void InsertMenu_Impl( const uno::Reference< container::XIndexContainer >& xTargetMenu,
- sal_Int32 nTargetIndex,
- const uno::Reference< container::XIndexAccess >& xSourceMenu,
- sal_Int32 nSourceIndex,
- const ::rtl::OUString aContModuleName,
- const uno::Reference< frame::XDispatchProvider >& xSourceDisp )
-{
- sal_Int32 nInd = 0;
- ::rtl::OUString aModuleIdentPropName( RTL_CONSTASCII_USTRINGPARAM( "ModuleIdentifier" ) );
- ::rtl::OUString aDispProvPropName( RTL_CONSTASCII_USTRINGPARAM( "DispatchProvider" ) );
- sal_Bool bModuleNameSet = sal_False;
- sal_Bool bDispProvSet = sal_False;
-
- uno::Sequence< beans::PropertyValue > aSourceProps;
- xSourceMenu->getByIndex( nSourceIndex ) >>= aSourceProps;
- uno::Sequence< beans::PropertyValue > aTargetProps( aSourceProps.getLength() );
- for ( nInd = 0; nInd < aSourceProps.getLength(); nInd++ )
- {
- aTargetProps[nInd].Name = aSourceProps[nInd].Name;
- if ( aContModuleName.getLength() && aTargetProps[nInd].Name.equals( aModuleIdentPropName ) )
- {
- aTargetProps[nInd].Value <<= aContModuleName;
- bModuleNameSet = sal_True;
- }
- else if ( aTargetProps[nInd].Name.equals( aDispProvPropName ) )
- {
- aTargetProps[nInd].Value <<= xSourceDisp;
- bDispProvSet = sal_True;
- }
- else
- aTargetProps[nInd].Value = aSourceProps[nInd].Value;
- }
-
- if ( !bModuleNameSet && aContModuleName.getLength() )
- {
- aTargetProps.realloc( ++nInd );
- aTargetProps[nInd-1].Name = aModuleIdentPropName;
- aTargetProps[nInd-1].Value <<= aContModuleName;
- }
-
- if ( !bDispProvSet && xSourceDisp.is() )
- {
- aTargetProps.realloc( ++nInd );
- aTargetProps[nInd-1].Name = aDispProvPropName;
- aTargetProps[nInd-1].Value <<= xSourceDisp;
- }
-
- xTargetMenu->insertByIndex( nTargetIndex, uno::makeAny( aTargetProps ) );
-}
-
-//===========================================================================
-DocumentHolder::DocumentHolder( const uno::Reference< lang::XMultiServiceFactory >& xFactory,
- OCommonEmbeddedObject* pEmbObj )
-: m_pEmbedObj( pEmbObj ),
- m_pInterceptor( NULL ),
- m_xFactory( xFactory ),
- m_bReadOnly( sal_False ),
- m_bWaitForClose( sal_False ),
- m_bAllowClosing( sal_False ),
- m_bDesktopTerminated( sal_False ),
- m_nNoBorderResizeReact( 0 ),
- m_nNoResizeReact( 0 )
-{
- m_aOutplaceFrameProps.realloc( 3 );
- beans::NamedValue aArg;
-
- aArg.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("TopWindow"));
- aArg.Value <<= sal_True;
- m_aOutplaceFrameProps[0] <<= aArg;
-
- aArg.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("MakeVisible"));
- aArg.Value <<= sal_False;
- m_aOutplaceFrameProps[1] <<= aArg;
-
- const ::rtl::OUString aServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.frame.Desktop" ) );
- uno::Reference< frame::XDesktop > xDesktop( m_xFactory->createInstance( aServiceName ), uno::UNO_QUERY );
- if ( xDesktop.is() )
- {
- m_refCount++;
- try
- {
- xDesktop->addTerminateListener( this );
- }
- catch ( uno::Exception& )
- {
- }
- m_refCount--;
-
- aArg.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentFrame"));
- aArg.Value <<= xDesktop; //TODO/LATER: should use parent document frame
- m_aOutplaceFrameProps[2] <<= aArg;
- }
- else
- m_aOutplaceFrameProps.realloc( 2 );
-}
-
-//---------------------------------------------------------------------------
-DocumentHolder::~DocumentHolder()
-{
- m_refCount++; // to allow deregistration as a listener
-
- if( m_xFrame.is() )
- CloseFrame();
-
- if ( m_xComponent.is() )
- {
- try {
- CloseDocument( sal_True, sal_False );
- } catch( uno::Exception& ) {}
- }
-
- if ( m_pInterceptor )
- {
- m_pInterceptor->DisconnectDocHolder();
- m_pInterceptor->release();
- }
-
- if ( !m_bDesktopTerminated )
- FreeOffice();
-}
-
-//---------------------------------------------------------------------------
-void DocumentHolder::CloseFrame()
-{
- uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xFrame, uno::UNO_QUERY );
- if ( xCloseBroadcaster.is() )
- xCloseBroadcaster->removeCloseListener( ( util::XCloseListener* )this );
-
- uno::Reference<util::XCloseable> xCloseable(
- m_xFrame,uno::UNO_QUERY );
- if( xCloseable.is() )
- try {
- xCloseable->close( sal_True );
- }
- catch( const uno::Exception& ) {
- }
- else {
- uno::Reference<lang::XComponent> xComp( m_xFrame,uno::UNO_QUERY );
- if( xComp.is() )
- xComp->dispose();
- }
-
- uno::Reference< lang::XComponent > xComp( m_xHatchWindow, uno::UNO_QUERY );
- if ( xComp.is() )
- xComp->dispose();
-
- m_xHatchWindow = uno::Reference< awt::XWindow >();
- m_xOwnWindow = uno::Reference< awt::XWindow >();
- m_xFrame = uno::Reference< frame::XFrame >();
-}
-
-//---------------------------------------------------------------------------
-void DocumentHolder::FreeOffice()
-{
- const ::rtl::OUString aServiceName ( RTL_CONSTASCII_USTRINGPARAM ( "com.sun.star.frame.Desktop" ) );
- uno::Reference< frame::XDesktop > xDesktop( m_xFactory->createInstance( aServiceName ), uno::UNO_QUERY );
- if ( xDesktop.is() )
- {
- xDesktop->removeTerminateListener( this );
-
- // the following code is commented out since for now there is still no completely correct way to detect
- // whether the office can be terminated, so it is better to have unnecessary process running than
- // to loose any data
-
-// uno::Reference< frame::XFramesSupplier > xFramesSupplier( xDesktop, uno::UNO_QUERY );
-// if ( xFramesSupplier.is() )
-// {
-// uno::Reference< frame::XFrames > xFrames = xFramesSupplier->getFrames();
-// if ( xFrames.is() && !xFrames->hasElements() )
-// {
-// try
-// {
-// xDesktop->terminate();
-// }
-// catch( uno::Exception & )
-// {}
-// }
-// }
- }
-}
-
-//---------------------------------------------------------------------------
-void DocumentHolder::CloseDocument( sal_Bool bDeliverOwnership, sal_Bool bWaitForClose )
-{
- uno::Reference< util::XCloseBroadcaster > xBroadcaster( m_xComponent, uno::UNO_QUERY );
- if ( xBroadcaster.is() )
- {
- uno::Reference< document::XEventBroadcaster > xEventBroadcaster( m_xComponent, uno::UNO_QUERY );
- if ( xEventBroadcaster.is() )
- xEventBroadcaster->removeEventListener( ( document::XEventListener* )this );
- else
- {
- // the object does not support document::XEventBroadcaster interface
- // use the workaround, register for modified events
- uno::Reference< util::XModifyBroadcaster > xModifyBroadcaster( m_xComponent, uno::UNO_QUERY );
- if ( xModifyBroadcaster.is() )
- xModifyBroadcaster->removeModifyListener( ( util::XModifyListener* )this );
- }
-
- uno::Reference< util::XCloseable > xCloseable( xBroadcaster, uno::UNO_QUERY );
- if ( xCloseable.is() )
- {
- m_bAllowClosing = sal_True;
- m_bWaitForClose = bWaitForClose;
- xCloseable->close( bDeliverOwnership );
- }
- }
-
- m_xComponent = 0;
-}
-
-//---------------------------------------------------------------------------
-void DocumentHolder::PlaceFrame( const awt::Rectangle& aNewRect )
-{
- OSL_ENSURE( m_xFrame.is() && m_xOwnWindow.is(),
- "The object does not have windows required for inplace mode!" );
-
- //TODO: may need mutex locking???
- if ( m_xFrame.is() && m_xOwnWindow.is() )
- {
- // the frame can be replaced only in inplace mode
- frame::BorderWidths aOldWidths;
- IntCounterGuard aGuard( m_nNoBorderResizeReact );
-
- do
- {
- aOldWidths = m_aBorderWidths;
-
- awt::Rectangle aHatchRect = AddBorderToArea( aNewRect );
-
- ResizeWindows_Impl( aHatchRect );
-
- } while ( aOldWidths.Left != m_aBorderWidths.Left
- || aOldWidths.Top != m_aBorderWidths.Top
- || aOldWidths.Right != m_aBorderWidths.Right
- || aOldWidths.Bottom != m_aBorderWidths.Bottom );
-
- m_aObjRect = aNewRect;
- }
-}
-
-//---------------------------------------------------------------------------
-void DocumentHolder::ResizeWindows_Impl( const awt::Rectangle& aHatchRect )
-{
- OSL_ENSURE( m_xFrame.is() && m_xOwnWindow.is() /*&& m_xHatchWindow.is()*/,
- "The object does not have windows required for inplace mode!" );
- if ( m_xHatchWindow.is() )
- {
- m_xOwnWindow->setPosSize( HATCH_BORDER_WIDTH,
- HATCH_BORDER_WIDTH,
- aHatchRect.Width - 2*HATCH_BORDER_WIDTH,
- aHatchRect.Height - 2*HATCH_BORDER_WIDTH,
- awt::PosSize::POSSIZE );
-
-
- m_xHatchWindow->setPosSize( aHatchRect.X,
- aHatchRect.Y,
- aHatchRect.Width,
- aHatchRect.Height,
- awt::PosSize::POSSIZE );
- }
- else
- m_xOwnWindow->setPosSize( aHatchRect.X + HATCH_BORDER_WIDTH,
- aHatchRect.Y + HATCH_BORDER_WIDTH,
- aHatchRect.Width - 2*HATCH_BORDER_WIDTH,
- aHatchRect.Height - 2*HATCH_BORDER_WIDTH,
- awt::PosSize::POSSIZE );
-}
-
-//---------------------------------------------------------------------------
-sal_Bool DocumentHolder::SetFrameLMVisibility( const uno::Reference< frame::XFrame >& xFrame, sal_Bool bVisible )
-{
- sal_Bool bResult = sal_False;
-
- try
- {
- uno::Reference< ::com::sun::star::frame::XLayoutManager > xLayoutManager;
- uno::Reference< beans::XPropertySet > xPropSet( xFrame, uno::UNO_QUERY_THROW );
- xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))) >>= xLayoutManager;
- if ( xLayoutManager.is() )
- {
- xLayoutManager->setVisible( bVisible );
-
- // MBA: locking is done only on the container LM, because it is not about hiding windows, it's about
- // giving up control over the component window (and stopping to listen for resize events of the container window)
- if ( bVisible )
- xLayoutManager->unlock();
- else
- xLayoutManager->lock();
-
- bResult = sal_True;
- }
- }
- catch( uno::Exception& )
- {}
-
- return bResult;
-}
-
-//---------------------------------------------------------------------------
-sal_Bool DocumentHolder::ShowInplace( const uno::Reference< awt::XWindowPeer >& xParent,
- const awt::Rectangle& aRectangleToShow,
- const uno::Reference< frame::XDispatchProvider >& xContDisp )
-{
- OSL_ENSURE( !m_xFrame.is(), "A frame exists already!" );
-
- if ( !m_xFrame.is() )
- {
- uno::Reference < frame::XModel > xModel( GetComponent(), uno::UNO_QUERY );
- awt::Rectangle aHatchRectangle = AddBorderToArea( aRectangleToShow );
-
- awt::Rectangle aOwnRectangle( HATCH_BORDER_WIDTH,
- HATCH_BORDER_WIDTH,
- aHatchRectangle.Width - 2*HATCH_BORDER_WIDTH,
- aHatchRectangle.Height - 2*HATCH_BORDER_WIDTH );
- uno::Reference< awt::XWindow > xHWindow;
- uno::Reference< awt::XWindowPeer > xMyParent( xParent );
-
- if ( xModel.is() )
- {
-
- uno::Reference< embed::XHatchWindowFactory > xHatchFactory(
- m_xFactory->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.HatchWindowFactory" )) ),
- uno::UNO_QUERY );
-
- if ( !xHatchFactory.is() )
- throw uno::RuntimeException();
-
- uno::Reference< embed::XHatchWindow > xHatchWindow =
- xHatchFactory->createHatchWindowInstance( xParent,
- aHatchRectangle,
- awt::Size( HATCH_BORDER_WIDTH, HATCH_BORDER_WIDTH ) );
-
- uno::Reference< awt::XWindowPeer > xHatchWinPeer( xHatchWindow, uno::UNO_QUERY );
- xHWindow = uno::Reference< awt::XWindow >( xHatchWinPeer, uno::UNO_QUERY );
- if ( !xHWindow.is() )
- throw uno::RuntimeException(); // TODO: can not create own window
-
- xHatchWindow->setController( uno::Reference< embed::XHatchWindowController >(
- static_cast< embed::XHatchWindowController* >( this ) ) );
-
- xMyParent = xHatchWinPeer;
- }
- else
- {
- aOwnRectangle.X += aHatchRectangle.X;
- aOwnRectangle.Y += aHatchRectangle.Y;
- }
-
- awt::WindowDescriptor aOwnWinDescriptor( awt::WindowClass_TOP,
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("dockingwindow") ),
- xMyParent,
- 0,
- awt::Rectangle(),//aOwnRectangle,
- awt::WindowAttribute::SHOW | awt::VclWindowPeerAttribute::CLIPCHILDREN );
-
- uno::Reference< awt::XToolkit > xToolkit(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.Toolkit" )) ),
- uno::UNO_QUERY );
- if ( !xToolkit.is() )
- throw uno::RuntimeException();
-
- uno::Reference< awt::XWindowPeer > xNewWinPeer = xToolkit->createWindow( aOwnWinDescriptor );
- uno::Reference< awt::XWindow > xOwnWindow( xNewWinPeer, uno::UNO_QUERY );
- if ( !xOwnWindow.is() )
- throw uno::RuntimeException(); // TODO: can not create own window
-
- // create a frame based on the specified window
- uno::Reference< lang::XSingleServiceFactory > xFrameFact(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.TaskCreator" )) ),
- uno::UNO_QUERY_THROW );
-
- uno::Sequence< uno::Any > aArgs( 2 );
- beans::NamedValue aArg;
-
- aArg.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ContainerWindow"));
- aArg.Value <<= xOwnWindow;
- aArgs[0] <<= aArg;
-
- uno::Reference< frame::XFrame > xContFrame( xContDisp, uno::UNO_QUERY );
- if ( xContFrame.is() )
- {
- aArg.Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ParentFrame"));
- aArg.Value <<= xContFrame;
- aArgs[1] <<= aArg;
- }
- else
- aArgs.realloc( 1 );
-
- // the call will create, initialize the frame, and register it in the parent
- m_xFrame.set( xFrameFact->createInstanceWithArguments( aArgs ), uno::UNO_QUERY_THROW );
-
- m_xHatchWindow = xHWindow;
- m_xOwnWindow = xOwnWindow;
-
- if ( !SetFrameLMVisibility( m_xFrame, sal_False ) )
- {
- OSL_FAIL( "Can't deactivate LayoutManager!\n" );
- // TODO/LATER: error handling?
- }
-
- // m_bIsInplace = sal_True; TODO: ?
-
- uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xFrame, uno::UNO_QUERY );
- if ( xCloseBroadcaster.is() )
- xCloseBroadcaster->addCloseListener( ( util::XCloseListener* )this );
-
- // TODO: some listeners to the frame and the window ( resize for example )
- }
-
- if ( m_xComponent.is() )
- {
- if ( !LoadDocToFrame( sal_True ) )
- {
- CloseFrame();
- return sal_False;
- }
-
- uno::Reference< frame::XControllerBorder > xControllerBorder( m_xFrame->getController(), uno::UNO_QUERY );
- if ( xControllerBorder.is() )
- {
- m_aBorderWidths = xControllerBorder->getBorder();
- xControllerBorder->addBorderResizeListener( (frame::XBorderResizeListener*)this );
- }
-
- PlaceFrame( aRectangleToShow );
-
- if ( m_xHatchWindow.is() )
- m_xHatchWindow->setVisible( sal_True );
-
- return sal_True;
- }
-
- return sal_False;
-}
-
-//---------------------------------------------------------------------------
-uno::Reference< container::XIndexAccess > DocumentHolder::RetrieveOwnMenu_Impl()
-{
- uno::Reference< container::XIndexAccess > xResult;
-
- uno::Reference< ::com::sun::star::ui::XUIConfigurationManagerSupplier > xUIConfSupplier(
- m_xComponent,
- uno::UNO_QUERY );
- uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > xUIConfigManager;
- if( xUIConfSupplier.is())
- {
- xUIConfigManager.set(
- xUIConfSupplier->getUIConfigurationManager(),
- uno::UNO_QUERY_THROW );
- }
-
- try
- {
- if( xUIConfigManager.is())
- {
- xResult = xUIConfigManager->getSettings(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:resource/menubar/menubar" ) ),
- sal_False );
- }
- }
- catch( uno::Exception )
- {}
-
- if ( !xResult.is() )
- {
- // no internal document configuration, use the one from the module
- uno::Reference< ::com::sun::star::frame::XModuleManager > xModuleMan(
- m_xFactory->createInstance(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.ModuleManager" ) ) ),
- uno::UNO_QUERY_THROW );
- ::rtl::OUString aModuleIdent =
- xModuleMan->identify( uno::Reference< uno::XInterface >( m_xComponent, uno::UNO_QUERY ) );
-
- if ( aModuleIdent.getLength() )
- {
- uno::Reference< ::com::sun::star::ui::XModuleUIConfigurationManagerSupplier > xModConfSupplier(
- m_xFactory->createInstance( ::rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ui.ModuleUIConfigurationManagerSupplier" ) ) ),
- uno::UNO_QUERY_THROW );
- uno::Reference< ::com::sun::star::ui::XUIConfigurationManager > xModUIConfMan(
- xModConfSupplier->getUIConfigurationManager( aModuleIdent ),
- uno::UNO_QUERY_THROW );
- xResult = xModUIConfMan->getSettings(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:resource/menubar/menubar" ) ),
- sal_False );
- }
- }
-
- if ( !xResult.is() )
- throw uno::RuntimeException();
-
- return xResult;
-}
-
-//---------------------------------------------------------------------------
-void DocumentHolder::FindConnectPoints(
- const uno::Reference< container::XIndexAccess >& xMenu,
- sal_Int32 nConnectPoints[2] )
- throw ( uno::Exception )
-{
- nConnectPoints[0] = -1;
- nConnectPoints[1] = -1;
- for ( sal_Int32 nInd = 0; nInd < xMenu->getCount(); nInd++ )
- {
- uno::Sequence< beans::PropertyValue > aProps;
- xMenu->getByIndex( nInd ) >>= aProps;
- rtl::OUString aCommand;
- for ( sal_Int32 nSeqInd = 0; nSeqInd < aProps.getLength(); nSeqInd++ )
- if ( aProps[nSeqInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CommandURL" ) ) )
- {
- aProps[nSeqInd].Value >>= aCommand;
- break;
- }
-
- if ( !aCommand.getLength() )
- throw uno::RuntimeException();
-
- if ( aCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ".uno:PickList" ) ) )
- nConnectPoints[0] = nInd;
- else if ( aCommand.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( ".uno:WindowList" ) ) )
- nConnectPoints[1] = nInd;
- }
-}
-
-//---------------------------------------------------------------------------
-uno::Reference< container::XIndexAccess > DocumentHolder::MergeMenuesForInplace(
- const uno::Reference< container::XIndexAccess >& xContMenu,
- const uno::Reference< frame::XDispatchProvider >& xContDisp,
- const ::rtl::OUString& aContModuleName,
- const uno::Reference< container::XIndexAccess >& xOwnMenu,
- const uno::Reference< frame::XDispatchProvider >& xOwnDisp )
- throw ( uno::Exception )
-{
- // TODO/LATER: use dispatch providers on merge
-
- sal_Int32 nContPoints[2];
- sal_Int32 nOwnPoints[2];
-
- uno::Reference< lang::XSingleComponentFactory > xIndAccessFact( xContMenu, uno::UNO_QUERY_THROW );
-
- uno::Reference< uno::XComponentContext > xComponentContext;
-
- uno::Reference< beans::XPropertySet > xProps( ::comphelper::getProcessServiceFactory(), uno::UNO_QUERY );
- if ( xProps.is() )
- xProps->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "DefaultContext" ))) >>=
- xComponentContext;
-
- uno::Reference< container::XIndexContainer > xMergedMenu(
- xIndAccessFact->createInstanceWithContext( xComponentContext ),
- uno::UNO_QUERY_THROW );
-
- FindConnectPoints( xContMenu, nContPoints );
- FindConnectPoints( xOwnMenu, nOwnPoints );
-
- for ( sal_Int32 nInd = 0; nInd < xOwnMenu->getCount(); nInd++ )
- {
- if ( nOwnPoints[0] == nInd )
- {
- if ( nContPoints[0] >= 0 && nContPoints[0] < xContMenu->getCount() )
- {
- InsertMenu_Impl( xMergedMenu, nInd, xContMenu, nContPoints[0], aContModuleName, xContDisp );
- }
- }
- else if ( nOwnPoints[1] == nInd )
- {
- if ( nContPoints[1] >= 0 && nContPoints[1] < xContMenu->getCount() )
- {
- InsertMenu_Impl( xMergedMenu, nInd, xContMenu, nContPoints[1], aContModuleName, xContDisp );
- }
- }
- else
- InsertMenu_Impl( xMergedMenu, nInd, xOwnMenu, nInd, ::rtl::OUString(), xOwnDisp );
- }
-
- return uno::Reference< container::XIndexAccess >( xMergedMenu, uno::UNO_QUERY_THROW );
-}
-
-//---------------------------------------------------------------------------
-sal_Bool DocumentHolder::MergeMenues_Impl( const uno::Reference< ::com::sun::star::frame::XLayoutManager >& xOwnLM,
- const uno::Reference< ::com::sun::star::frame::XLayoutManager >& xContLM,
- const uno::Reference< frame::XDispatchProvider >& xContDisp,
- const ::rtl::OUString& aContModuleName )
-{
- sal_Bool bMenuMerged = sal_False;
- try
- {
- uno::Reference< ::com::sun::star::ui::XUIElementSettings > xUISettings(
- xContLM->getElement(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:resource/menubar/menubar" ) ) ),
- uno::UNO_QUERY_THROW );
- uno::Reference< container::XIndexAccess > xContMenu = xUISettings->getSettings( sal_True );
- if ( !xContMenu.is() )
- throw uno::RuntimeException();
-
- uno::Reference< container::XIndexAccess > xOwnMenu = RetrieveOwnMenu_Impl();
- uno::Reference< frame::XDispatchProvider > xOwnDisp( m_xFrame, uno::UNO_QUERY_THROW );
-
- uno::Reference< container::XIndexAccess > xMergedMenu = MergeMenuesForInplace( xContMenu, xContDisp, aContModuleName, xOwnMenu, xOwnDisp );
- uno::Reference< ::com::sun::star::frame::XMenuBarMergingAcceptor > xMerge( xOwnLM,
- uno::UNO_QUERY_THROW );
- bMenuMerged = xMerge->setMergedMenuBar( xMergedMenu );
- }
- catch( uno::Exception& )
- {}
-
- return bMenuMerged;
-}
-
-sal_Bool DocumentHolder::ShowUI( const uno::Reference< ::com::sun::star::frame::XLayoutManager >& xContainerLM,
- const uno::Reference< frame::XDispatchProvider >& xContainerDP,
- const ::rtl::OUString& aContModuleName )
-{
- sal_Bool bResult = sal_False;
- if ( xContainerLM.is() )
- {
- // the LM of the embedded frame and its current DockingAreaAcceptor
- uno::Reference< ::com::sun::star::frame::XLayoutManager > xOwnLM;
- uno::Reference< ::com::sun::star::ui::XDockingAreaAcceptor > xDocAreaAcc;
-
- try
- {
- uno::Reference< beans::XPropertySet > xPropSet( m_xFrame, uno::UNO_QUERY_THROW );
- xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))) >>= xOwnLM;
- xDocAreaAcc = xContainerLM->getDockingAreaAcceptor();
- }
- catch( uno::Exception& ){}
-
- // make sure that lock state of LM is correct even if an exception is thrown in between
- sal_Bool bUnlock = sal_False;
- sal_Bool bLock = sal_False;
- if ( xOwnLM.is() && xDocAreaAcc.is() )
- {
- try
- {
- // take over the control over the containers window
- // as long as the LM is invisible and locked an empty tool space will be used on resizing
- xOwnLM->setDockingAreaAcceptor( xDocAreaAcc );
-
- // try to merge menues; don't do anything else if it fails
- if ( MergeMenues_Impl( xOwnLM, xContainerLM, xContainerDP, aContModuleName ) )
- {
- // make sure that the container LM does not control the size of the containers window anymore
- // this must be done after merging menues as we won't get the container menu otherwise
- xContainerLM->setDockingAreaAcceptor( uno::Reference < ui::XDockingAreaAcceptor >() );
-
- // prevent further changes at this LM
- xContainerLM->setVisible( sal_False );
- xContainerLM->lock();
- bUnlock = sal_True;
-
- // by unlocking the LM each layout change will now resize the containers window; pending layouts will be processed now
- xOwnLM->setVisible( sal_True );
-
- uno::Reference< frame::XFramesSupplier > xSupp( m_xFrame->getCreator(), uno::UNO_QUERY );
- if ( xSupp.is() )
- xSupp->setActiveFrame( m_xFrame );
-
- xOwnLM->unlock();
- bLock = sal_True;
- bResult = sal_True;
-
- // TODO/LATER: The following action should be done only if the window is not hidden
- // otherwise the activation must fail, unfortunatelly currently it is not possible
- // to detect whether the window is hidden using UNO API
- m_xOwnWindow->setFocus();
- }
- }
- catch( uno::Exception& )
- {
- // activation failed; reestablish old state
- try
- {
- uno::Reference< frame::XFramesSupplier > xSupp( m_xFrame->getCreator(), uno::UNO_QUERY );
- if ( xSupp.is() )
- xSupp->setActiveFrame( 0 );
-
- // remove control about containers window from own LM
- if ( bLock )
- xOwnLM->lock();
- xOwnLM->setVisible( sal_False );
- xOwnLM->setDockingAreaAcceptor( uno::Reference< ::com::sun::star::ui::XDockingAreaAcceptor >() );
-
- // unmerge menu
- uno::Reference< ::com::sun::star::frame::XMenuBarMergingAcceptor > xMerge( xOwnLM, uno::UNO_QUERY_THROW );
- xMerge->removeMergedMenuBar();
- }
- catch( uno::Exception& ) {}
-
- try
- {
- // reestablish control of containers window
- xContainerLM->setDockingAreaAcceptor( xDocAreaAcc );
- xContainerLM->setVisible( sal_True );
- if ( bUnlock )
- xContainerLM->unlock();
- }
- catch( uno::Exception& ) {}
- }
- }
- }
-
- return bResult;
-}
-
-//---------------------------------------------------------------------------
-sal_Bool DocumentHolder::HideUI( const uno::Reference< ::com::sun::star::frame::XLayoutManager >& xContainerLM )
-{
- sal_Bool bResult = sal_False;
-
- if ( xContainerLM.is() )
- {
- uno::Reference< ::com::sun::star::frame::XLayoutManager > xOwnLM;
-
- try {
- uno::Reference< beans::XPropertySet > xPropSet( m_xFrame, uno::UNO_QUERY_THROW );
- xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))) >>= xOwnLM;
- } catch( uno::Exception& )
- {}
-
- if ( xOwnLM.is() )
- {
- try {
- uno::Reference< frame::XFramesSupplier > xSupp( m_xFrame->getCreator(), uno::UNO_QUERY );
- if ( xSupp.is() )
- xSupp->setActiveFrame( 0 );
-
- uno::Reference< ::com::sun::star::ui::XDockingAreaAcceptor > xDocAreaAcc = xOwnLM->getDockingAreaAcceptor();
-
- xOwnLM->setDockingAreaAcceptor( uno::Reference < ui::XDockingAreaAcceptor >() );
- xOwnLM->lock();
- xOwnLM->setVisible( sal_False );
-
- uno::Reference< ::com::sun::star::frame::XMenuBarMergingAcceptor > xMerge( xOwnLM, uno::UNO_QUERY_THROW );
- xMerge->removeMergedMenuBar();
-
- xContainerLM->setDockingAreaAcceptor( xDocAreaAcc );
- xContainerLM->setVisible( sal_True );
- xContainerLM->unlock();
-
- xContainerLM->doLayout();
- bResult = sal_True;
- }
- catch( uno::Exception& )
- {
- SetFrameLMVisibility( m_xFrame, sal_True );
- }
- }
- }
-
- return bResult;
-}
-
-//---------------------------------------------------------------------------
-uno::Reference< frame::XFrame > DocumentHolder::GetDocFrame()
-{
- // the frame for outplace activation
- if ( !m_xFrame.is() )
- {
- uno::Reference< lang::XSingleServiceFactory > xFrameFact(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.TaskCreator" ) )),
- uno::UNO_QUERY_THROW );
-
- m_xFrame.set(xFrameFact->createInstanceWithArguments( m_aOutplaceFrameProps ), uno::UNO_QUERY_THROW);
-
- uno::Reference< frame::XDispatchProviderInterception > xInterception( m_xFrame, uno::UNO_QUERY );
- if ( xInterception.is() )
- {
- if ( m_pInterceptor )
- {
- m_pInterceptor->DisconnectDocHolder();
- m_pInterceptor->release();
- m_pInterceptor = NULL;
- }
-
- m_pInterceptor = new Interceptor( this );
- m_pInterceptor->acquire();
-
- // register interceptor from outside
- if ( m_xOutplaceInterceptor.is() )
- xInterception->registerDispatchProviderInterceptor( m_xOutplaceInterceptor );
-
- xInterception->registerDispatchProviderInterceptor( m_pInterceptor );
- }
-
- uno::Reference< util::XCloseBroadcaster > xCloseBroadcaster( m_xFrame, uno::UNO_QUERY );
- if ( xCloseBroadcaster.is() )
- xCloseBroadcaster->addCloseListener( ( util::XCloseListener* )this );
- }
-
- if ( m_xComponent.is() )
- {
- uno::Reference< ::com::sun::star::frame::XLayoutManager > xOwnLM;
- try {
- uno::Reference< beans::XPropertySet > xPropSet( m_xFrame, uno::UNO_QUERY_THROW );
- xPropSet->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "LayoutManager" ))) >>= xOwnLM;
- } catch( uno::Exception& )
- {}
-
- if ( xOwnLM.is() )
- xOwnLM->lock();
-
- // TODO/LATER: get it for the real aspect
- awt::Size aSize;
- GetExtent( embed::Aspects::MSOLE_CONTENT, &aSize );
- LoadDocToFrame(sal_False);
-
- if ( xOwnLM.is() )
- {
- xOwnLM->unlock();
- xOwnLM->lock();
- }
-
- SetExtent( embed::Aspects::MSOLE_CONTENT, aSize );
-
- if ( xOwnLM.is() )
- xOwnLM->unlock();
- }
-
- try
- {
- uno::Reference< awt::XWindow > xHWindow = m_xFrame->getContainerWindow();
-
- if( xHWindow.is() )
- {
- uno::Reference< beans::XPropertySet > xMonProps( m_xFactory->createInstance(rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.awt.DisplayAccess" ) ) ), uno::UNO_QUERY_THROW );
- const rtl::OUString sPropName( RTL_CONSTASCII_USTRINGPARAM( "DefaultDisplay" ) );
- sal_Int32 nDisplay = 0;
- xMonProps->getPropertyValue( sPropName ) >>= nDisplay;
-
- uno::Reference< container::XIndexAccess > xMultiMon( xMonProps, uno::UNO_QUERY_THROW );
- uno::Reference< beans::XPropertySet > xMonitor( xMultiMon->getByIndex( nDisplay ), uno::UNO_QUERY_THROW );
- awt::Rectangle aWorkRect;
- xMonitor->getPropertyValue( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "WorkArea" ) ) ) >>= aWorkRect;
- awt::Rectangle aWindowRect = xHWindow->getPosSize();
-
- if (( aWindowRect.Width < aWorkRect.Width) && ( aWindowRect.Height < aWorkRect.Height ))
- {
- int OffsetX = ( aWorkRect.Width - aWindowRect.Width ) / 2 + aWorkRect.X;
- int OffsetY = ( aWorkRect.Height - aWindowRect.Height ) /2 + aWorkRect.Y;
- xHWindow->setPosSize( OffsetX, OffsetY, aWindowRect.Width, aWindowRect.Height, awt::PosSize::POS );
- }
- else
- {
- xHWindow->setPosSize( aWorkRect.X, aWorkRect.Y, aWorkRect.Width, aWorkRect.Height, awt::PosSize::POSSIZE );
- }
-
- xHWindow->setVisible( sal_True );
- }
- }
- catch ( uno::Exception& )
- {
- }
-
- return m_xFrame;
-}
-
-//---------------------------------------------------------------------------
-void DocumentHolder::SetComponent( const uno::Reference< util::XCloseable >& xDoc, sal_Bool bReadOnly )
-{
- if ( m_xComponent.is() )
- {
- // May be should be improved
- try {
- CloseDocument( sal_True, sal_False );
- } catch( uno::Exception& )
- {}
- }
-
- m_xComponent = xDoc;
-
- m_bReadOnly = bReadOnly;
- m_bAllowClosing = sal_False;
-
- uno::Reference< util::XCloseBroadcaster > xBroadcaster( m_xComponent, uno::UNO_QUERY );
- if ( xBroadcaster.is() )
- xBroadcaster->addCloseListener( ( util::XCloseListener* )this );
-
- uno::Reference< document::XEventBroadcaster > xEventBroadcaster( m_xComponent, uno::UNO_QUERY );
- if ( xEventBroadcaster.is() )
- xEventBroadcaster->addEventListener( ( document::XEventListener* )this );
- else
- {
- // the object does not support document::XEventBroadcaster interface
- // use the workaround, register for modified events
- uno::Reference< util::XModifyBroadcaster > xModifyBroadcaster( m_xComponent, uno::UNO_QUERY );
- if ( xModifyBroadcaster.is() )
- xModifyBroadcaster->addModifyListener( ( util::XModifyListener* )this );
- }
-
- if ( m_xFrame.is() )
- LoadDocToFrame(sal_False);
-}
-
-//---------------------------------------------------------------------------
-sal_Bool DocumentHolder::LoadDocToFrame( sal_Bool bInPlace )
-{
- if ( m_xFrame.is() && m_xComponent.is() )
- {
- uno::Reference < frame::XModel > xDoc( m_xComponent, uno::UNO_QUERY );
- if ( xDoc.is() )
- {
- // load new document in to the frame
- uno::Reference< frame::XComponentLoader > xComponentLoader( m_xFrame, uno::UNO_QUERY_THROW );
-
- ::comphelper::NamedValueCollection aArgs;
- aArgs.put( "Model", m_xComponent );
- aArgs.put( "ReadOnly", m_bReadOnly );
- if ( bInPlace )
- aArgs.put( "PluginMode", sal_Int16(1) );
- ::rtl::OUString sUrl;
- uno::Reference< lang::XServiceInfo> xServiceInfo(xDoc,uno::UNO_QUERY);
- if ( xServiceInfo.is()
- && xServiceInfo->supportsService(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.report.ReportDefinition"))) )
- {
- sUrl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM(".component:DB/ReportDesign"));
- }
- else if( xServiceInfo.is()
- && xServiceInfo->supportsService( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.chart2.ChartDocument")) ))
- sUrl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:factory/schart"));
- else
- sUrl = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("private:object"));
-
- xComponentLoader->loadComponentFromURL( sUrl,
- rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "_self" )),
- 0,
- aArgs.getPropertyValues() );
-
- return sal_True;
- }
- else
- {
- uno::Reference < frame::XSynchronousFrameLoader > xLoader( m_xComponent, uno::UNO_QUERY );
- if ( xLoader.is() )
- return xLoader->load( uno::Sequence < beans::PropertyValue >(), m_xFrame );
- else
- return sal_False;
- }
- }
-
- return sal_True;
-}
-
-//---------------------------------------------------------------------------
-void DocumentHolder::Show()
-{
- if( m_xFrame.is() )
- {
- m_xFrame->activate();
- uno::Reference<awt::XTopWindow> xTopWindow( m_xFrame->getContainerWindow(), uno::UNO_QUERY );
- if( xTopWindow.is() )
- xTopWindow->toFront();
- }
- else
- GetDocFrame();
-}
-
-//---------------------------------------------------------------------------
-sal_Bool DocumentHolder::SetExtent( sal_Int64 nAspect, const awt::Size& aSize )
-{
- uno::Reference< embed::XVisualObject > xDocVis( m_xComponent, uno::UNO_QUERY );
- if ( xDocVis.is() )
- {
- try
- {
- xDocVis->setVisualAreaSize( nAspect, aSize );
- return sal_True;
- }
- catch( uno::Exception& )
- {
- // TODO: Error handling
- }
- }
-
- return sal_False;
-}
-
-//---------------------------------------------------------------------------
-sal_Bool DocumentHolder::GetExtent( sal_Int64 nAspect, awt::Size *pSize )
-{
- uno::Reference< embed::XVisualObject > xDocVis( m_xComponent, uno::UNO_QUERY );
- if ( pSize && xDocVis.is() )
- {
- try
- {
- *pSize = xDocVis->getVisualAreaSize( nAspect );
- return sal_True;
- }
- catch( uno::Exception& )
- {
- // TODO: Error handling
- }
- }
-
- return sal_False;
-}
-
-//---------------------------------------------------------------------------
-sal_Int32 DocumentHolder::GetMapUnit( sal_Int64 nAspect )
-{
- uno::Reference< embed::XVisualObject > xDocVis( m_xComponent, uno::UNO_QUERY );
- if ( xDocVis.is() )
- {
- try
- {
- return xDocVis->getMapUnit( nAspect );
- }
- catch( uno::Exception& )
- {
- // TODO: Error handling
- }
- }
-
- return 0;
-}
-
-//---------------------------------------------------------------------------
-awt::Rectangle DocumentHolder::CalculateBorderedArea( const awt::Rectangle& aRect )
-{
- return awt::Rectangle( aRect.X + m_aBorderWidths.Left + HATCH_BORDER_WIDTH,
- aRect.Y + m_aBorderWidths.Top + HATCH_BORDER_WIDTH,
- aRect.Width - m_aBorderWidths.Left - m_aBorderWidths.Right - 2*HATCH_BORDER_WIDTH,
- aRect.Height - m_aBorderWidths.Top - m_aBorderWidths.Bottom - 2*HATCH_BORDER_WIDTH );
-}
-
-//---------------------------------------------------------------------------
-awt::Rectangle DocumentHolder::AddBorderToArea( const awt::Rectangle& aRect )
-{
- return awt::Rectangle( aRect.X - m_aBorderWidths.Left - HATCH_BORDER_WIDTH,
- aRect.Y - m_aBorderWidths.Top - HATCH_BORDER_WIDTH,
- aRect.Width + m_aBorderWidths.Left + m_aBorderWidths.Right + 2*HATCH_BORDER_WIDTH,
- aRect.Height + m_aBorderWidths.Top + m_aBorderWidths.Bottom + 2*HATCH_BORDER_WIDTH );
-}
-
-//---------------------------------------------------------------------------
-void SAL_CALL DocumentHolder::disposing( const com::sun::star::lang::EventObject& aSource )
- throw (uno::RuntimeException)
-{
- if ( m_xComponent.is() && m_xComponent == aSource.Source )
- {
- m_xComponent = 0;
- if ( m_bWaitForClose )
- {
- m_bWaitForClose = sal_False;
- FreeOffice();
- }
- }
-
- if( m_xFrame.is() && m_xFrame == aSource.Source )
- {
- m_xHatchWindow = uno::Reference< awt::XWindow >();
- m_xOwnWindow = uno::Reference< awt::XWindow >();
- m_xFrame = uno::Reference< frame::XFrame >();
- }
-}
-
-
-//---------------------------------------------------------------------------
-void SAL_CALL DocumentHolder::queryClosing( const lang::EventObject& aSource, sal_Bool /*bGetsOwnership*/ )
- throw (util::CloseVetoException, uno::RuntimeException)
-{
- if ( m_xComponent.is() && m_xComponent == aSource.Source && !m_bAllowClosing )
- throw util::CloseVetoException();
-}
-
-//---------------------------------------------------------------------------
-void SAL_CALL DocumentHolder::notifyClosing( const lang::EventObject& aSource )
- throw (uno::RuntimeException)
-{
- if ( m_xComponent.is() && m_xComponent == aSource.Source )
- {
- m_xComponent = 0;
- if ( m_bWaitForClose )
- {
- m_bWaitForClose = sal_False;
- FreeOffice();
- }
- }
-
- if( m_xFrame.is() && m_xFrame == aSource.Source )
- {
- m_xHatchWindow = uno::Reference< awt::XWindow >();
- m_xOwnWindow = uno::Reference< awt::XWindow >();
- m_xFrame = uno::Reference< frame::XFrame >();
- }
-}
-
-//---------------------------------------------------------------------------
-void SAL_CALL DocumentHolder::queryTermination( const lang::EventObject& )
- throw (frame::TerminationVetoException, uno::RuntimeException)
-{
- if ( m_bWaitForClose )
- throw frame::TerminationVetoException();
-}
-
-//---------------------------------------------------------------------------
-void SAL_CALL DocumentHolder::notifyTermination( const lang::EventObject& aSource )
- throw (uno::RuntimeException)
-{
- OSL_ENSURE( !m_xComponent.is(), "Just a disaster..." );
-
- uno::Reference< frame::XDesktop > xDesktop( aSource.Source, uno::UNO_QUERY );
- m_bDesktopTerminated = sal_True;
- if ( xDesktop.is() )
- xDesktop->removeTerminateListener( ( frame::XTerminateListener* )this );
-}
-
-//---------------------------------------------------------------------------
-void SAL_CALL DocumentHolder::modified( const lang::EventObject& aEvent )
- throw ( uno::RuntimeException )
-{
- // if the component does not support document::XEventBroadcaster
- // the modify notifications are used as workaround, but only for running state
- if( aEvent.Source == m_xComponent && m_pEmbedObj && m_pEmbedObj->getCurrentState() == embed::EmbedStates::RUNNING )
- m_pEmbedObj->PostEvent_Impl( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "OnVisAreaChanged" ) ), aEvent.Source );
-}
-
-//---------------------------------------------------------------------------
-void SAL_CALL DocumentHolder::notifyEvent( const document::EventObject& Event )
- throw ( uno::RuntimeException )
-{
- if( m_pEmbedObj && Event.Source == m_xComponent )
- {
- // for now the ignored events are not forwarded, but sent by the object itself
- if ( !Event.EventName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OnSave" ) )
- && !Event.EventName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OnSaveDone" ) )
- && !Event.EventName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OnSaveAs" ) )
- && !Event.EventName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OnSaveAsDone" ) )
- && !( Event.EventName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OnVisAreaChanged" ) ) && m_nNoResizeReact ) )
- m_pEmbedObj->PostEvent_Impl( Event.EventName, Event.Source );
- }
-}
-
-//---------------------------------------------------------------------------
-void SAL_CALL DocumentHolder::borderWidthsChanged( const uno::Reference< uno::XInterface >& aObject,
- const frame::BorderWidths& aNewSize )
- throw ( uno::RuntimeException )
-{
- // TODO: may require mutex introduction ???
- if ( m_pEmbedObj && m_xFrame.is() && aObject == m_xFrame->getController() )
- {
- if ( m_aBorderWidths.Left != aNewSize.Left
- || m_aBorderWidths.Right != aNewSize.Right
- || m_aBorderWidths.Top != aNewSize.Top
- || m_aBorderWidths.Bottom != aNewSize.Bottom )
- {
- m_aBorderWidths = aNewSize;
- if ( !m_nNoBorderResizeReact )
- PlaceFrame( m_aObjRect );
- }
- }
-}
-
-//---------------------------------------------------------------------------
-void SAL_CALL DocumentHolder::requestPositioning( const awt::Rectangle& aRect )
- throw (uno::RuntimeException)
-{
- // TODO: may require mutex introduction ???
- if ( m_pEmbedObj )
- {
- // borders should not be counted
- awt::Rectangle aObjRect = CalculateBorderedArea( aRect );
- IntCounterGuard aGuard( m_nNoResizeReact );
- m_pEmbedObj->requestPositioning( aObjRect );
- }
-}
-
-//---------------------------------------------------------------------------
-awt::Rectangle SAL_CALL DocumentHolder::calcAdjustedRectangle( const awt::Rectangle& aRect )
- throw (uno::RuntimeException)
-{
- // Solar mutex should be locked already since this is a call from HatchWindow with focus
- awt::Rectangle aResult( aRect );
-
- if ( m_xFrame.is() )
- {
- // borders should not be counted
- uno::Reference< frame::XControllerBorder > xControllerBorder( m_xFrame->getController(), uno::UNO_QUERY );
- if ( xControllerBorder.is() )
- {
- awt::Rectangle aObjRect = CalculateBorderedArea( aRect );
- aObjRect = xControllerBorder->queryBorderedArea( aObjRect );
- aResult = AddBorderToArea( aObjRect );
- }
- }
-
- awt::Rectangle aMinRectangle = AddBorderToArea( awt::Rectangle() );
- if ( aResult.Width < aMinRectangle.Width + 2 )
- aResult.Width = aMinRectangle.Width + 2;
- if ( aResult.Height < aMinRectangle.Height + 2 )
- aResult.Height = aMinRectangle.Height + 2;
-
- return aResult;
-}
-
-void SAL_CALL DocumentHolder::activated( ) throw (::com::sun::star::uno::RuntimeException)
-{
- if ( (m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_ACTIVATEWHENVISIBLE) )
- {
- if ( m_pEmbedObj->getCurrentState() != embed::EmbedStates::UI_ACTIVE &&
- !(m_pEmbedObj->getStatus(embed::Aspects::MSOLE_CONTENT)&embed::EmbedMisc::MS_EMBED_NOUIACTIVATE) )
- {
- try
- {
- m_pEmbedObj->changeState( embed::EmbedStates::UI_ACTIVE );
- }
- catch ( com::sun::star::embed::StateChangeInProgressException& )
- {
- // must catch this exception because focus is grabbed while UI activation in doVerb()
- }
- catch ( com::sun::star::uno::Exception& )
- {
- // no outgoing exceptions specified here
- }
- }
- else
- {
- uno::Reference< frame::XFramesSupplier > xSupp( m_xFrame->getCreator(), uno::UNO_QUERY );
- if ( xSupp.is() )
- xSupp->setActiveFrame( m_xFrame );
- }
- }
-}
-
-void DocumentHolder::ResizeHatchWindow()
-{
- awt::Rectangle aHatchRect = AddBorderToArea( m_aObjRect );
- ResizeWindows_Impl( aHatchRect );
- uno::Reference< embed::XHatchWindow > xHatchWindow( m_xHatchWindow, uno::UNO_QUERY );
- xHatchWindow->setHatchBorderSize( awt::Size( HATCH_BORDER_WIDTH, HATCH_BORDER_WIDTH ) );
-}
-
-void SAL_CALL DocumentHolder::deactivated( ) throw (::com::sun::star::uno::RuntimeException)
-{
- // deactivation is too unspecific to be useful; usually we only trigger code from activation
- // so UIDeactivation is actively triggered by the container
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/general/dummyobject.cxx b/embeddedobj/source/general/dummyobject.cxx
deleted file mode 100644
index e2a5fbde0e..0000000000
--- a/embeddedobj/source/general/dummyobject.cxx
+++ /dev/null
@@ -1,724 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-#include "precompiled_embeddedobj.hxx"
-#include <com/sun/star/embed/EmbedStates.hpp>
-#include <com/sun/star/embed/EmbedVerbs.hpp>
-#include <com/sun/star/embed/EmbedUpdateModes.hpp>
-#include <com/sun/star/embed/XEmbeddedClient.hpp>
-#include <com/sun/star/embed/XInplaceClient.hpp>
-#include <com/sun/star/embed/XWindowSupplier.hpp>
-#include <com/sun/star/embed/StateChangeInProgressException.hpp>
-#include <com/sun/star/embed/EmbedStates.hpp>
-#include <com/sun/star/embed/Aspects.hpp>
-#include <com/sun/star/embed/EmbedMapUnits.hpp>
-#include <com/sun/star/embed/EntryInitModes.hpp>
-#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-
-#include <cppuhelper/interfacecontainer.h>
-
-#include <dummyobject.hxx>
-
-
-using namespace ::com::sun::star;
-
-//----------------------------------------------
-void ODummyEmbeddedObject::CheckInit()
-{
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-}
-
-//----------------------------------------------
-void ODummyEmbeddedObject::PostEvent_Impl( const ::rtl::OUString& aEventName,
- const uno::Reference< uno::XInterface >& /*xSource*/ )
-{
- if ( m_pInterfaceContainer )
- {
- ::cppu::OInterfaceContainerHelper* pIC = m_pInterfaceContainer->getContainer(
- ::getCppuType((const uno::Reference< document::XEventListener >*)0) );
- if( pIC )
- {
- document::EventObject aEvent;
- aEvent.EventName = aEventName;
- aEvent.Source = uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) );
- // For now all the events are sent as object events
- // aEvent.Source = ( xSource.is() ? xSource
- // : uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >( this ) ) );
- ::cppu::OInterfaceIteratorHelper aIt( *pIC );
- while( aIt.hasMoreElements() )
- {
- try
- {
- ((document::XEventListener *)aIt.next())->notifyEvent( aEvent );
- }
- catch( uno::RuntimeException& )
- {
- aIt.remove();
- }
-
- // the listener could dispose the object.
- if ( m_bDisposed )
- return;
- }
- }
- }
-}
-
-//----------------------------------------------
-ODummyEmbeddedObject::~ODummyEmbeddedObject()
-{
-}
-
-//----------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::changeState( sal_Int32 nNewState )
- throw ( embed::UnreachableStateException,
- embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- if ( nNewState == embed::EmbedStates::LOADED )
- return;
-
- throw embed::UnreachableStateException();
-}
-
-//----------------------------------------------
-uno::Sequence< sal_Int32 > SAL_CALL ODummyEmbeddedObject::getReachableStates()
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- uno::Sequence< sal_Int32 > aResult( 1 );
- aResult[0] = embed::EmbedStates::LOADED;
-
- return aResult;
-}
-
-//----------------------------------------------
-sal_Int32 SAL_CALL ODummyEmbeddedObject::getCurrentState()
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- return m_nObjectState;
-}
-
-//----------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::doVerb( sal_Int32 )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- embed::UnreachableStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- // no supported verbs
-}
-
-//----------------------------------------------
-uno::Sequence< embed::VerbDescriptor > SAL_CALL ODummyEmbeddedObject::getSupportedVerbs()
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- return uno::Sequence< embed::VerbDescriptor >();
-}
-
-//----------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::setClientSite(
- const uno::Reference< embed::XEmbeddedClient >& xClient )
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- m_xClientSite = xClient;
-}
-
-//----------------------------------------------
-uno::Reference< embed::XEmbeddedClient > SAL_CALL ODummyEmbeddedObject::getClientSite()
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- return m_xClientSite;
-}
-
-//----------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::update()
- throw ( embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-}
-
-//----------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::setUpdateMode( sal_Int32 )
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-}
-
-//----------------------------------------------
-sal_Int64 SAL_CALL ODummyEmbeddedObject::getStatus( sal_Int64 )
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- return 0;
-}
-
-//----------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::setContainerName( const ::rtl::OUString& )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-}
-
-//----------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::setVisualAreaSize( sal_Int64 nAspect, const awt::Size& aSize )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
- if ( nAspect == embed::Aspects::MSOLE_ICON )
- // no representation can be retrieved
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Illegal call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- m_nCachedAspect = nAspect;
- m_aCachedSize = aSize;
- m_bHasCachedSize = sal_True;
-}
-
-//----------------------------------------------
-awt::Size SAL_CALL ODummyEmbeddedObject::getVisualAreaSize( sal_Int64 nAspect )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
- if ( nAspect == embed::Aspects::MSOLE_ICON )
- // no representation can be retrieved
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Illegal call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- if ( !m_bHasCachedSize || m_nCachedAspect != nAspect )
- throw embed::NoVisualAreaSizeException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No size available!\n" ) ),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- return m_aCachedSize;
-}
-
-//----------------------------------------------
-sal_Int32 SAL_CALL ODummyEmbeddedObject::getMapUnit( sal_Int64 nAspect )
- throw ( uno::Exception,
- uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
- if ( nAspect == embed::Aspects::MSOLE_ICON )
- // no representation can be retrieved
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Illegal call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- return embed::EmbedMapUnits::ONE_100TH_MM;
-}
-
-//----------------------------------------------
-embed::VisualRepresentation SAL_CALL ODummyEmbeddedObject::getPreferredVisualRepresentation( sal_Int64 )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- // no representation can be retrieved
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Illegal call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-}
-
-//----------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::setPersistentEntry(
- 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 */ )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 1 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 2 );
-
- if ( ( m_nObjectState != -1 || nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
- && ( m_nObjectState == -1 || nEntryConnectionMode != embed::EntryInitModes::NO_INIT ) )
- {
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Can't change persistant representation of activated object!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- if ( m_bWaitSaveCompleted )
- {
- if ( nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
- saveCompleted( ( m_xParentStorage != xStorage || !m_aEntryName.equals( sEntName ) ) );
- else
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- if ( nEntryConnectionMode == embed::EntryInitModes::DEFAULT_INIT
- || nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
- {
- if ( xStorage->hasByName( sEntName ) )
-
- {
- m_xParentStorage = xStorage;
- m_aEntryName = sEntName;
- m_nObjectState = embed::EmbedStates::LOADED;
- }
- else
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Wrong entry is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 2 );
-
- }
- else
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Wrong connection mode is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 3 );
-}
-
-//------------------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::storeToEntry( const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const uno::Sequence< beans::PropertyValue >& /* lArguments */,
- const uno::Sequence< beans::PropertyValue >& /* lObjArgs */ )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- m_xParentStorage->copyElementTo( m_aEntryName, xStorage, sEntName );
-}
-
-//------------------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::storeAsEntry( const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const uno::Sequence< beans::PropertyValue >& /* lArguments */,
- const uno::Sequence< beans::PropertyValue >& /* lObjArgs */ )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- PostEvent_Impl( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "OnSaveAs" )),
- uno::Reference< uno::XInterface >( static_cast< cppu::OWeakObject* >( this ) ) );
-
- m_xParentStorage->copyElementTo( m_aEntryName, xStorage, sEntName );
-
- m_bWaitSaveCompleted = sal_True;
- m_xNewParentStorage = xStorage;
- m_aNewEntryName = sEntName;
-}
-
-//------------------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::saveCompleted( sal_Bool bUseNew )
- throw ( embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- // it is allowed to call saveCompleted( false ) for nonstored objects
- if ( !m_bWaitSaveCompleted && !bUseNew )
- return;
-
- OSL_ENSURE( m_bWaitSaveCompleted, "Unexpected saveCompleted() call!\n" );
- if ( !m_bWaitSaveCompleted )
- throw io::IOException(); // TODO: illegal call
-
- OSL_ENSURE( m_xNewParentStorage.is() , "Internal object information is broken!\n" );
- if ( !m_xNewParentStorage.is() )
- throw uno::RuntimeException(); // TODO: broken internal information
-
- if ( bUseNew )
- {
- m_xParentStorage = m_xNewParentStorage;
- m_aEntryName = m_aNewEntryName;
-
- PostEvent_Impl( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "OnSaveAsDone" )),
- uno::Reference< uno::XInterface >( static_cast< cppu::OWeakObject* >( this ) ) );
- }
-
- m_xNewParentStorage = uno::Reference< embed::XStorage >();
- m_aNewEntryName = ::rtl::OUString();
- m_bWaitSaveCompleted = sal_False;
-}
-
-//------------------------------------------------------
-sal_Bool SAL_CALL ODummyEmbeddedObject::hasEntry()
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- if ( m_aEntryName.getLength() )
- return sal_True;
-
- return sal_False;
-}
-
-//------------------------------------------------------
-::rtl::OUString SAL_CALL ODummyEmbeddedObject::getEntryName()
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- return m_aEntryName;
-}
-
-//------------------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::storeOwn()
- throw ( embed::WrongStateException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- // the object can not be activated or changed
- return;
-}
-
-//------------------------------------------------------
-sal_Bool SAL_CALL ODummyEmbeddedObject::isReadonly()
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- // this object can not be changed
- return sal_True;
-}
-
-//------------------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::reload(
- const uno::Sequence< beans::PropertyValue >& /* lArguments */,
- const uno::Sequence< beans::PropertyValue >& /* lObjArgs */ )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- // nothing to reload
-}
-
-//------------------------------------------------------
-uno::Sequence< sal_Int8 > SAL_CALL ODummyEmbeddedObject::getClassID()
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- // currently the class ID is empty
- // TODO/LATER: should a special class ID be used in this case?
- return uno::Sequence< sal_Int8 >();
-}
-
-//------------------------------------------------------
-::rtl::OUString SAL_CALL ODummyEmbeddedObject::getClassName()
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- return ::rtl::OUString();
-}
-
-//------------------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::setClassInfo(
- const uno::Sequence< sal_Int8 >& /*aClassID*/, const ::rtl::OUString& /*aClassName*/ )
- throw ( lang::NoSupportException,
- uno::RuntimeException )
-{
- throw lang::NoSupportException();
-}
-
-//------------------------------------------------------
-uno::Reference< util::XCloseable > SAL_CALL ODummyEmbeddedObject::getComponent()
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- CheckInit();
-
- return uno::Reference< util::XCloseable >();
-}
-
-//----------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::addStateChangeListener( const uno::Reference< embed::XStateChangeListener >& xListener )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- return;
-
- if ( !m_pInterfaceContainer )
- m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
-
- m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< embed::XStateChangeListener >*)0 ),
- xListener );
-}
-
-//----------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::removeStateChangeListener(
- const uno::Reference< embed::XStateChangeListener >& xListener )
- throw (uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_pInterfaceContainer )
- m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< embed::XStateChangeListener >*)0 ),
- xListener );
-}
-
-//----------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::close( sal_Bool bDeliverOwnership )
- throw ( util::CloseVetoException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >( this ) );
- lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
-
- if ( m_pInterfaceContainer )
- {
- ::cppu::OInterfaceContainerHelper* pContainer =
- m_pInterfaceContainer->getContainer( ::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) );
- if ( pContainer != NULL )
- {
- ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
- while (pIterator.hasMoreElements())
- {
- try
- {
- ((util::XCloseListener*)pIterator.next())->queryClosing( aSource, bDeliverOwnership );
- }
- catch( uno::RuntimeException& )
- {
- pIterator.remove();
- }
- }
- }
-
- pContainer = m_pInterfaceContainer->getContainer(
- ::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) );
- if ( pContainer != NULL )
- {
- ::cppu::OInterfaceIteratorHelper pCloseIterator(*pContainer);
- while (pCloseIterator.hasMoreElements())
- {
- try
- {
- ((util::XCloseListener*)pCloseIterator.next())->notifyClosing( aSource );
- }
- catch( uno::RuntimeException& )
- {
- pCloseIterator.remove();
- }
- }
- }
-
- m_pInterfaceContainer->disposeAndClear( aSource );
- }
-
- m_bDisposed = sal_True; // the object is disposed now for outside
-}
-
-//----------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::addCloseListener( const uno::Reference< util::XCloseListener >& xListener )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- return;
-
- if ( !m_pInterfaceContainer )
- m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
-
- m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< util::XCloseListener >*)0 ), xListener );
-}
-
-//----------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::removeCloseListener( const uno::Reference< util::XCloseListener >& xListener )
- throw (uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_pInterfaceContainer )
- m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< util::XCloseListener >*)0 ),
- xListener );
-}
-
-//------------------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::addEventListener( const uno::Reference< document::XEventListener >& xListener )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- return;
-
- if ( !m_pInterfaceContainer )
- m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
-
- m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< document::XEventListener >*)0 ), xListener );
-}
-
-//------------------------------------------------------
-void SAL_CALL ODummyEmbeddedObject::removeEventListener( const uno::Reference< document::XEventListener >& xListener )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_pInterfaceContainer )
- m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< document::XEventListener >*)0 ),
- xListener );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/general/intercept.cxx b/embeddedobj/source/general/intercept.cxx
deleted file mode 100644
index 6877691321..0000000000
--- a/embeddedobj/source/general/intercept.cxx
+++ /dev/null
@@ -1,428 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-#include <com/sun/star/embed/EmbedStates.hpp>
-#include <cppuhelper/weak.hxx>
-
-#include "intercept.hxx"
-#include "docholder.hxx"
-#include "commonembobj.hxx"
-
-using namespace ::com::sun::star;
-
-
-#define IUL 6
-
-
-uno::Sequence< ::rtl::OUString > Interceptor::m_aInterceptedURL(IUL);
-
-struct equalOUString
-{
- bool operator()(
- const rtl::OUString& rKey1,
- const rtl::OUString& rKey2 ) const
- {
- return !!( rKey1 == rKey2 );
- }
-};
-
-
-struct hashOUString
-{
- size_t operator()( const rtl::OUString& rName ) const
- {
- return rName.hashCode();
- }
-};
-
-
-
-class StatusChangeListenerContainer
- : public ::cppu::OMultiTypeInterfaceContainerHelperVar<
-rtl::OUString,hashOUString,equalOUString>
-{
-public:
- StatusChangeListenerContainer( ::osl::Mutex& aMutex )
- : cppu::OMultiTypeInterfaceContainerHelperVar<
- rtl::OUString,hashOUString,equalOUString>(aMutex)
- {
- }
-};
-
-
-void Interceptor::DisconnectDocHolder()
-{
- osl::MutexGuard aGuard( m_aMutex );
- m_pDocHolder = NULL;
-}
-
-void SAL_CALL
-Interceptor::addEventListener(
- const uno::Reference<lang::XEventListener >& Listener )
- throw( uno::RuntimeException )
-{
- osl::MutexGuard aGuard( m_aMutex );
-
- if ( ! m_pDisposeEventListeners )
- m_pDisposeEventListeners =
- new cppu::OInterfaceContainerHelper( m_aMutex );
-
- m_pDisposeEventListeners->addInterface( Listener );
-}
-
-
-void SAL_CALL
-Interceptor::removeEventListener(
- const uno::Reference< lang::XEventListener >& Listener )
- throw( uno::RuntimeException )
-{
- osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_pDisposeEventListeners )
- m_pDisposeEventListeners->removeInterface( Listener );
-}
-
-
-Interceptor::Interceptor( DocumentHolder* pDocHolder )
- : m_pDocHolder( pDocHolder ),
- m_pDisposeEventListeners(0),
- m_pStatCL(0)
-{
- m_aInterceptedURL[0] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(".uno:Save"));
- m_aInterceptedURL[1] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(".uno:SaveAll"));
- m_aInterceptedURL[2] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(".uno:CloseDoc"));
- m_aInterceptedURL[3] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(".uno:CloseWin"));
- m_aInterceptedURL[4] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(".uno:CloseFrame"));
- m_aInterceptedURL[5] = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM(".uno:SaveAs"));
-
-}
-
-
-Interceptor::~Interceptor()
-{
- if( m_pDisposeEventListeners )
- delete m_pDisposeEventListeners;
-
- if(m_pStatCL)
- delete m_pStatCL;
-}
-
-
-
-//XDispatch
-void SAL_CALL
-Interceptor::dispatch(
- const util::URL& URL,
- const uno::Sequence<
- beans::PropertyValue >& Arguments )
- throw (uno::RuntimeException)
-{
- osl::MutexGuard aGuard(m_aMutex);
- if( m_pDocHolder )
- {
- if(URL.Complete == m_aInterceptedURL[0])
- m_pDocHolder->GetEmbedObject()->SaveObject_Impl();
- else if(URL.Complete == m_aInterceptedURL[2] ||
- URL.Complete == m_aInterceptedURL[3] ||
- URL.Complete == m_aInterceptedURL[4])
- {
- try {
- m_pDocHolder->GetEmbedObject()->changeState( embed::EmbedStates::RUNNING );
- }
- catch( uno::Exception& )
- {
- }
- }
- else if ( URL.Complete == m_aInterceptedURL[5] )
- {
- uno::Sequence< beans::PropertyValue > aNewArgs = Arguments;
- sal_Int32 nInd = 0;
-
- while( nInd < aNewArgs.getLength() )
- {
- if ( aNewArgs[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "SaveTo" ) ) )
- {
- aNewArgs[nInd].Value <<= sal_True;
- break;
- }
- nInd++;
- }
-
- if ( nInd == aNewArgs.getLength() )
- {
- aNewArgs.realloc( nInd + 1 );
- aNewArgs[nInd].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "SaveTo" ));
- aNewArgs[nInd].Value <<= sal_True;
- }
-
- uno::Reference< frame::XDispatch > xDispatch = m_xSlaveDispatchProvider->queryDispatch(
- URL, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "_self" )), 0 );
- if ( xDispatch.is() )
- xDispatch->dispatch( URL, aNewArgs );
- }
- }
-}
-
-void SAL_CALL
-Interceptor::addStatusListener(
- const uno::Reference<
- frame::XStatusListener >& Control,
- const util::URL& URL )
- throw (
- uno::RuntimeException
- )
-{
- if(!Control.is())
- return;
-
- if(URL.Complete == m_aInterceptedURL[0])
- { // Save
- frame::FeatureStateEvent aStateEvent;
- aStateEvent.FeatureURL.Complete = m_aInterceptedURL[0];
- aStateEvent.FeatureDescriptor = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("Update"));
- aStateEvent.IsEnabled = sal_True;
- aStateEvent.Requery = sal_False;
- aStateEvent.State <<= (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("($1) ")) + m_pDocHolder->GetTitle() );
- Control->statusChanged(aStateEvent);
-
- {
- osl::MutexGuard aGuard(m_aMutex);
- if(!m_pStatCL)
- m_pStatCL =
- new StatusChangeListenerContainer(m_aMutex);
- }
-
- m_pStatCL->addInterface(URL.Complete,Control);
- return;
- }
-
- sal_Int32 i = 2;
- if(URL.Complete == m_aInterceptedURL[i] ||
- URL.Complete == m_aInterceptedURL[++i] ||
- URL.Complete == m_aInterceptedURL[++i] )
- { // Close and return
- frame::FeatureStateEvent aStateEvent;
- aStateEvent.FeatureURL.Complete = m_aInterceptedURL[i];
- aStateEvent.FeatureDescriptor = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("Close and Return"));
- aStateEvent.IsEnabled = sal_True;
- aStateEvent.Requery = sal_False;
- aStateEvent.State <<= (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("($2) ")) + m_pDocHolder->GetTitle() );
- Control->statusChanged(aStateEvent);
-
-
- {
- osl::MutexGuard aGuard(m_aMutex);
- if(!m_pStatCL)
- m_pStatCL =
- new StatusChangeListenerContainer(m_aMutex);
- }
-
- m_pStatCL->addInterface(URL.Complete,Control);
- return;
- }
-
- if(URL.Complete == m_aInterceptedURL[5])
- { // SaveAs
- frame::FeatureStateEvent aStateEvent;
- aStateEvent.FeatureURL.Complete = m_aInterceptedURL[5];
- aStateEvent.FeatureDescriptor = rtl::OUString(
- RTL_CONSTASCII_USTRINGPARAM("SaveCopyTo"));
- aStateEvent.IsEnabled = sal_True;
- aStateEvent.Requery = sal_False;
- aStateEvent.State <<= (rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("($3)")));
- Control->statusChanged(aStateEvent);
-
- {
- osl::MutexGuard aGuard(m_aMutex);
- if(!m_pStatCL)
- m_pStatCL =
- new StatusChangeListenerContainer(m_aMutex);
- }
-
- m_pStatCL->addInterface(URL.Complete,Control);
- return;
- }
-
-}
-
-
-void SAL_CALL
-Interceptor::removeStatusListener(
- const uno::Reference<
- frame::XStatusListener >& Control,
- const util::URL& URL )
- throw (
- uno::RuntimeException
- )
-{
- if(!(Control.is() && m_pStatCL))
- return;
- else {
- m_pStatCL->removeInterface(URL.Complete,Control);
- return;
- }
-}
-
-
-//XInterceptorInfo
-uno::Sequence< ::rtl::OUString >
-SAL_CALL
-Interceptor::getInterceptedURLs( )
- throw (
- uno::RuntimeException
- )
-{
- // now implemented as update
-
- return m_aInterceptedURL;
-}
-
-
-// XDispatchProvider
-
-uno::Reference< frame::XDispatch > SAL_CALL
-Interceptor::queryDispatch(
- const util::URL& URL,
- const ::rtl::OUString& TargetFrameName,
- sal_Int32 SearchFlags )
- throw (
- uno::RuntimeException
- )
-{
- osl::MutexGuard aGuard(m_aMutex);
- if(URL.Complete == m_aInterceptedURL[0])
- return (frame::XDispatch*)this;
- else if(URL.Complete == m_aInterceptedURL[1])
- return (frame::XDispatch*)0 ;
- else if(URL.Complete == m_aInterceptedURL[2])
- return (frame::XDispatch*)this;
- else if(URL.Complete == m_aInterceptedURL[3])
- return (frame::XDispatch*)this;
- else if(URL.Complete == m_aInterceptedURL[4])
- return (frame::XDispatch*)this;
- else if(URL.Complete == m_aInterceptedURL[5])
- return (frame::XDispatch*)this;
- else {
- if(m_xSlaveDispatchProvider.is())
- return m_xSlaveDispatchProvider->queryDispatch(
- URL,TargetFrameName,SearchFlags);
- else
- return uno::Reference<frame::XDispatch>(0);
- }
-}
-
-uno::Sequence< uno::Reference< frame::XDispatch > > SAL_CALL
-Interceptor::queryDispatches(
- const uno::Sequence<frame::DispatchDescriptor >& Requests )
- throw (
- uno::RuntimeException
- )
-{
- uno::Sequence< uno::Reference< frame::XDispatch > > aRet;
- osl::MutexGuard aGuard(m_aMutex);
- if(m_xSlaveDispatchProvider.is())
- aRet = m_xSlaveDispatchProvider->queryDispatches(Requests);
- else
- aRet.realloc(Requests.getLength());
-
- for(sal_Int32 i = 0; i < Requests.getLength(); ++i)
- if(m_aInterceptedURL[0] == Requests[i].FeatureURL.Complete)
- aRet[i] = (frame::XDispatch*) this;
- else if(m_aInterceptedURL[1] == Requests[i].FeatureURL.Complete)
- aRet[i] = (frame::XDispatch*) 0;
- else if(m_aInterceptedURL[2] == Requests[i].FeatureURL.Complete)
- aRet[i] = (frame::XDispatch*) this;
- else if(m_aInterceptedURL[3] == Requests[i].FeatureURL.Complete)
- aRet[i] = (frame::XDispatch*) this;
- else if(m_aInterceptedURL[4] == Requests[i].FeatureURL.Complete)
- aRet[i] = (frame::XDispatch*) this;
- else if(m_aInterceptedURL[5] == Requests[i].FeatureURL.Complete)
- aRet[i] = (frame::XDispatch*) this;
-
- return aRet;
-}
-
-
-
-//XDispatchProviderInterceptor
-
-uno::Reference< frame::XDispatchProvider > SAL_CALL
-Interceptor::getSlaveDispatchProvider( )
- throw (
- uno::RuntimeException
- )
-{
- osl::MutexGuard aGuard(m_aMutex);
- return m_xSlaveDispatchProvider;
-}
-
-void SAL_CALL
-Interceptor::setSlaveDispatchProvider(
- const uno::Reference< frame::XDispatchProvider >& NewDispatchProvider )
- throw (
- uno::RuntimeException
- )
-{
- osl::MutexGuard aGuard(m_aMutex);
- m_xSlaveDispatchProvider = NewDispatchProvider;
-}
-
-
-uno::Reference< frame::XDispatchProvider > SAL_CALL
-Interceptor::getMasterDispatchProvider( )
- throw (
- uno::RuntimeException
- )
-{
- osl::MutexGuard aGuard(m_aMutex);
- return m_xMasterDispatchProvider;
-}
-
-
-void SAL_CALL
-Interceptor::setMasterDispatchProvider(
- const uno::Reference< frame::XDispatchProvider >& NewSupplier )
- throw (
- uno::RuntimeException
- )
-{
- osl::MutexGuard aGuard(m_aMutex);
- m_xMasterDispatchProvider = NewSupplier;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/general/makefile.mk b/embeddedobj/source/general/makefile.mk
deleted file mode 100755
index 2aab057358..0000000000
--- a/embeddedobj/source/general/makefile.mk
+++ /dev/null
@@ -1,60 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# 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.
-#
-# 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).
-#
-# 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.
-#
-#*************************************************************************
-
-PRJ=..$/..
-
-PRJNAME=embeddedobj
-TARGET=embedobj
-
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-LIBTARGET=NO
-USE_DEFFILE=NO
-
-# --- Files --------------------------------------------------------
-
-SLOFILES = \
- $(SLO)$/xcreator.obj\
- $(SLO)$/docholder.obj\
- $(SLO)$/dummyobject.obj\
- $(SLO)$/intercept.obj
-
-
-EXCEPTIONSFILES= \
- $(SLO)$/xcreator.obj\
- $(SLO)$/docholder.obj\
- $(SLO)$/dummyobject.obj\
- $(SLO)$/intercept.obj
-
-
-# --- Targets -------------------------------------------------------
-
-.INCLUDE : target.mk
-
diff --git a/embeddedobj/source/general/xcreator.cxx b/embeddedobj/source/general/xcreator.cxx
deleted file mode 100644
index f91d345501..0000000000
--- a/embeddedobj/source/general/xcreator.cxx
+++ /dev/null
@@ -1,493 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-#include <com/sun/star/embed/ElementModes.hpp>
-#include <com/sun/star/embed/EntryInitModes.hpp>
-#include <com/sun/star/embed/XEmbedObjectFactory.hpp>
-#include <com/sun/star/embed/XLinkFactory.hpp>
-#include <com/sun/star/document/XTypeDetection.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-
-#include <rtl/logfile.hxx>
-
-
-#include <xcreator.hxx>
-#include <dummyobject.hxx>
-
-
-using namespace ::com::sun::star;
-
-
-//-------------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL UNOEmbeddedObjectCreator::impl_staticGetSupportedServiceNames()
-{
- uno::Sequence< ::rtl::OUString > aRet(2);
- aRet[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.EmbeddedObjectCreator"));
- aRet[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.embed.EmbeddedObjectCreator"));
- return aRet;
-}
-
-//-------------------------------------------------------------------------
-::rtl::OUString SAL_CALL UNOEmbeddedObjectCreator::impl_staticGetImplementationName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.embed.EmbeddedObjectCreator"));
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::impl_staticCreateSelfInstance(
- const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
-{
- return uno::Reference< uno::XInterface >( *new UNOEmbeddedObjectCreator( xServiceManager ) );
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInstanceInitNew(
- const uno::Sequence< sal_Int8 >& aClassID,
- const ::rtl::OUString& aClassName,
- const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const uno::Sequence< beans::PropertyValue >& lObjArgs )
- throw ( lang::IllegalArgumentException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) UNOEmbeddedObjectCreator::createInstanceInitNew" );
-
- uno::Reference< uno::XInterface > xResult;
-
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 3 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 4 );
-
- ::rtl::OUString aEmbedFactory = m_aConfigHelper.GetFactoryNameByClassID( aClassID );
- if ( !aEmbedFactory.getLength() )
- {
- // use system fallback
- // TODO: in future users factories can be tested
- aEmbedFactory = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OLEEmbeddedObjectFactory" ));
- }
-
- uno::Reference < uno::XInterface > xFact( m_xFactory->createInstance( aEmbedFactory ) );
- uno::Reference< embed::XEmbedObjectCreator > xEmbCreator( xFact, uno::UNO_QUERY );
- if ( xEmbCreator.is() )
- return xEmbCreator->createInstanceInitNew( aClassID, aClassName, xStorage, sEntName, lObjArgs );
-
- uno::Reference < embed::XEmbedObjectFactory > xEmbFact( xFact, uno::UNO_QUERY );
- if ( !xEmbFact.is() )
- throw uno::RuntimeException();
- return xEmbFact->createInstanceUserInit( aClassID, aClassName, xStorage, sEntName, embed::EntryInitModes::TRUNCATE_INIT, uno::Sequence < beans::PropertyValue >(), lObjArgs);
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInstanceInitFromEntry(
- const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const uno::Sequence< beans::PropertyValue >& aMedDescr,
- const uno::Sequence< beans::PropertyValue >& lObjArgs )
- throw ( lang::IllegalArgumentException,
- container::NoSuchElementException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) UNOEmbeddedObjectCreator::createInstanceInitFromEntry" );
-
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 1 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 2 );
-
- uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY );
- if ( !xNameAccess.is() )
- throw uno::RuntimeException(); //TODO
-
- // detect entry existence
- if ( !xNameAccess->hasByName( sEntName ) )
- throw container::NoSuchElementException();
-
- ::rtl::OUString aMediaType;
- ::rtl::OUString aEmbedFactory;
- if ( xStorage->isStorageElement( sEntName ) )
- {
- // the object must be based on storage
- uno::Reference< embed::XStorage > xSubStorage =
- xStorage->openStorageElement( sEntName, embed::ElementModes::READ );
-
- uno::Reference< beans::XPropertySet > xPropSet( xSubStorage, uno::UNO_QUERY );
- if ( !xPropSet.is() )
- throw uno::RuntimeException();
-
- try {
- uno::Any aAny = xPropSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ));
- aAny >>= aMediaType;
- }
- catch ( uno::Exception& )
- {
- }
-
- try {
- uno::Reference< lang::XComponent > xComp( xSubStorage, uno::UNO_QUERY );
- if ( xComp.is() )
- xComp->dispose();
- }
- catch ( uno::Exception& )
- {
- }
- }
- else
- {
- // the object must be based on stream
- // it means for now that this is an OLE object
-
- // the object will be created as embedded object
- // after it is loaded it can detect that it is a link
-
- uno::Reference< io::XStream > xSubStream =
- xStorage->openStreamElement( sEntName, embed::ElementModes::READ );
-
- uno::Reference< beans::XPropertySet > xPropSet( xSubStream, uno::UNO_QUERY );
- if ( !xPropSet.is() )
- throw uno::RuntimeException();
-
- try {
- uno::Any aAny = xPropSet->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MediaType" ) ));
- aAny >>= aMediaType;
- if ( aMediaType.equals( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "application/vnd.sun.star.oleobject" ) ) ) )
- aEmbedFactory = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OLEEmbeddedObjectFactory" ) );
- }
- catch ( uno::Exception& )
- {
- }
-
- try {
- uno::Reference< lang::XComponent > xComp( xSubStream, uno::UNO_QUERY );
- if ( xComp.is() )
- xComp->dispose();
- }
- catch ( uno::Exception& )
- {
- }
- }
-
- OSL_ENSURE( aMediaType.getLength(), "No media type is specified for the object!" );
- if ( aMediaType.getLength() && !aEmbedFactory.getLength() )
- aEmbedFactory = m_aConfigHelper.GetFactoryNameByMediaType( aMediaType );
-
- if ( aEmbedFactory.getLength() )
- {
- uno::Reference< uno::XInterface > xFact = m_xFactory->createInstance( aEmbedFactory );
-
- uno::Reference< embed::XEmbedObjectCreator > xEmbCreator( xFact, uno::UNO_QUERY );
- if ( xEmbCreator.is() )
- return xEmbCreator->createInstanceInitFromEntry( xStorage, sEntName, aMedDescr, lObjArgs );
-
- uno::Reference < embed::XEmbedObjectFactory > xEmbFact( xFact, uno::UNO_QUERY );
- if ( xEmbFact.is() )
- return xEmbFact->createInstanceUserInit( uno::Sequence< sal_Int8 >(), ::rtl::OUString(), xStorage, sEntName, embed::EntryInitModes::DEFAULT_INIT, aMedDescr, lObjArgs);
- }
-
- // the default object should be created, it will allow to store the contents on the next saving
- uno::Reference< uno::XInterface > xResult( static_cast< cppu::OWeakObject* >( new ODummyEmbeddedObject() ) );
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY_THROW );
- xPersist->setPersistentEntry( xStorage, sEntName, embed::EntryInitModes::DEFAULT_INIT, aMedDescr, lObjArgs );
- return xResult;
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInstanceInitFromMediaDescriptor(
- const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const uno::Sequence< beans::PropertyValue >& aMediaDescr,
- const uno::Sequence< beans::PropertyValue >& lObjArgs )
- throw ( lang::IllegalArgumentException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) UNOEmbeddedObjectCreator::createInstanceInitFromMediaDescriptor" );
-
- // TODO: use lObjArgs
-
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 1 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 2 );
-
- uno::Reference< uno::XInterface > xResult;
- uno::Sequence< beans::PropertyValue > aTempMedDescr( aMediaDescr );
-
- // check if there is FilterName
- ::rtl::OUString aFilterName = m_aConfigHelper.UpdateMediaDescriptorWithFilterName( aTempMedDescr, sal_False );
-
- if ( aFilterName.getLength() )
- {
- // the object can be loaded by one of the office application
- uno::Reference< embed::XEmbedObjectCreator > xOOoEmbCreator(
- m_xFactory->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OOoEmbeddedObjectFactory" ) )),
- uno::UNO_QUERY );
- if ( !xOOoEmbCreator.is() )
- throw uno::RuntimeException(); // TODO:
-
- xResult = xOOoEmbCreator->createInstanceInitFromMediaDescriptor( xStorage,
- sEntName,
- aTempMedDescr,
- lObjArgs );
- }
- else
- {
- // must be an OLE object
-
- // TODO: in future, when more object types are possible this place seems
- // to be a weak one, probably configuration must provide a type detection service
- // for every factory, so any file could go through services until it is recognized
- // or there is no more services
- // Or for example the typename can be used to detect object type if typedetection
- // was also extended.
-
- uno::Reference< embed::XEmbedObjectCreator > xOleEmbCreator(
- m_xFactory->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OLEEmbeddedObjectFactory" ) )),
- uno::UNO_QUERY );
- if ( !xOleEmbCreator.is() )
- throw uno::RuntimeException(); // TODO:
-
- xResult = xOleEmbCreator->createInstanceInitFromMediaDescriptor( xStorage, sEntName, aTempMedDescr, lObjArgs );
- }
-
- return xResult;
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInstanceUserInit(
- const uno::Sequence< sal_Int8 >& aClassID,
- const ::rtl::OUString& sClassName,
- const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- sal_Int32 nEntryConnectionMode,
- const uno::Sequence< beans::PropertyValue >& aArgs,
- const uno::Sequence< beans::PropertyValue >& aObjectArgs )
- throw ( lang::IllegalArgumentException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) UNOEmbeddedObjectCreator::createInstanceUserInit" );
-
- uno::Reference< uno::XInterface > xResult;
-
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 3 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 4 );
-
- ::rtl::OUString aEmbedFactory = m_aConfigHelper.GetFactoryNameByClassID( aClassID );
- uno::Reference< embed::XEmbedObjectFactory > xEmbFactory(
- m_xFactory->createInstance( aEmbedFactory ),
- uno::UNO_QUERY );
- if ( !xEmbFactory.is() )
- throw uno::RuntimeException(); // TODO:
-
- return xEmbFactory->createInstanceUserInit( aClassID,
- sClassName,
- xStorage,
- sEntName,
- nEntryConnectionMode,
- aArgs,
- aObjectArgs );
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInstanceLink(
- const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const uno::Sequence< beans::PropertyValue >& aMediaDescr,
- const uno::Sequence< beans::PropertyValue >& lObjArgs )
- throw ( lang::IllegalArgumentException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) UNOEmbeddedObjectCreator::createInstanceLink" );
-
- uno::Reference< uno::XInterface > xResult;
-
- uno::Sequence< beans::PropertyValue > aTempMedDescr( aMediaDescr );
-
- // check if there is URL, URL must exist
- ::rtl::OUString aURL;
- for ( sal_Int32 nInd = 0; nInd < aTempMedDescr.getLength(); nInd++ )
- if ( aTempMedDescr[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "URL" ) ) )
- aTempMedDescr[nInd].Value >>= aURL;
-
- if ( !aURL.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No URL for the link is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 3 );
-
- ::rtl::OUString aFilterName = m_aConfigHelper.UpdateMediaDescriptorWithFilterName( aTempMedDescr, sal_False );
-
- if ( aFilterName.getLength() )
- {
- // the object can be loaded by one of the office application
- uno::Reference< embed::XLinkCreator > xOOoLinkCreator(
- m_xFactory->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OOoEmbeddedObjectFactory" ) )),
- uno::UNO_QUERY );
- if ( !xOOoLinkCreator.is() )
- throw uno::RuntimeException(); // TODO:
-
- xResult = xOOoLinkCreator->createInstanceLink( xStorage,
- sEntName,
- aTempMedDescr,
- lObjArgs );
- }
- else
- {
- // must be an OLE link
-
- // TODO: in future, when more object types are possible this place seems
- // to be a weak one, probably configuration must provide a type detection service
- // for every factory, so any file could go through services until it is recognized
- // or there is no more services
- // Or for example the typename can be used to detect object type if typedetection
- // was also extended.
-
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >(
- static_cast< ::cppu::OWeakObject* >(this) ),
- 3 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >(
- static_cast< ::cppu::OWeakObject* >(this) ),
- 4 );
-
- uno::Reference< embed::XLinkCreator > xLinkCreator(
- m_xFactory->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OLEEmbeddedObjectFactory" ) )),
- uno::UNO_QUERY );
- if ( !xLinkCreator.is() )
- throw uno::RuntimeException(); // TODO:
-
- xResult = xLinkCreator->createInstanceLink( xStorage, sEntName, aTempMedDescr, lObjArgs );
- }
-
- return xResult;
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL UNOEmbeddedObjectCreator::createInstanceLinkUserInit(
- const uno::Sequence< sal_Int8 >& aClassID,
- const ::rtl::OUString& aClassName,
- const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const uno::Sequence< beans::PropertyValue >& lArguments,
- const uno::Sequence< beans::PropertyValue >& lObjArgs )
- throw ( lang::IllegalArgumentException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) UNOEmbeddedObjectCreator::createInstanceLinkUserInit" );
-
- uno::Reference< uno::XInterface > xResult;
-
- ::rtl::OUString aEmbedFactory = m_aConfigHelper.GetFactoryNameByClassID( aClassID );
- uno::Reference< embed::XLinkFactory > xLinkFactory(
- m_xFactory->createInstance( aEmbedFactory ),
- uno::UNO_QUERY );
- if ( !xLinkFactory.is() )
- throw uno::RuntimeException(); // TODO:
-
- return xLinkFactory->createInstanceLinkUserInit( aClassID,
- aClassName,
- xStorage,
- sEntName,
- lArguments,
- lObjArgs );
-
-}
-
-//-------------------------------------------------------------------------
-::rtl::OUString SAL_CALL UNOEmbeddedObjectCreator::getImplementationName()
- throw ( uno::RuntimeException )
-{
- return impl_staticGetImplementationName();
-}
-
-//-------------------------------------------------------------------------
-sal_Bool SAL_CALL UNOEmbeddedObjectCreator::supportsService( const ::rtl::OUString& ServiceName )
- throw ( uno::RuntimeException )
-{
- uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
-
- for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
- if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
- return sal_True;
-
- return sal_False;
-}
-
-//-------------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL UNOEmbeddedObjectCreator::getSupportedServiceNames()
- throw ( uno::RuntimeException )
-{
- return impl_staticGetSupportedServiceNames();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/inc/closepreventer.hxx b/embeddedobj/source/inc/closepreventer.hxx
deleted file mode 100644
index 22908596f7..0000000000
--- a/embeddedobj/source/inc/closepreventer.hxx
+++ /dev/null
@@ -1,40 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-#include <com/sun/star/util/XCloseListener.hpp>
-#include <cppuhelper/implbase1.hxx>
-
-class OClosePreventer : public ::cppu::WeakImplHelper1 < ::com::sun::star::util::XCloseListener >
-{
- virtual void SAL_CALL queryClosing( const ::com::sun::star::lang::EventObject& Source, sal_Bool GetsOwnership ) throw (::com::sun::star::util::CloseVetoException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL notifyClosing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx
deleted file mode 100644
index a7c8964c4f..0000000000
--- a/embeddedobj/source/inc/commonembobj.hxx
+++ /dev/null
@@ -1,523 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef _INC_COMMONEMBOBJ_HXX_
-#define _INC_COMMONEMBOBJ_HXX_
-
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/document/XStorageBasedDocument.hpp>
-#include <com/sun/star/embed/XEmbeddedObject.hpp>
-#include <com/sun/star/embed/XVisualObject.hpp>
-#include <com/sun/star/embed/XEmbedPersist.hpp>
-#include <com/sun/star/embed/XLinkageSupport.hpp>
-#include <com/sun/star/embed/XClassifiedObject.hpp>
-#include <com/sun/star/embed/XComponentSupplier.hpp>
-#include <com/sun/star/embed/XInplaceObject.hpp>
-#include <com/sun/star/embed/XStateChangeBroadcaster.hpp>
-#include <com/sun/star/awt/XWindow.hpp>
-#include <com/sun/star/awt/Rectangle.hpp>
-#include <com/sun/star/document/XEventBroadcaster.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <com/sun/star/chart2/XDefaultSizeTransmitter.hpp>
-#include <cppuhelper/weak.hxx>
-
-namespace com { namespace sun { namespace star {
- namespace embed {
- class XStorage;
- }
- namespace frame {
- class XModel;
- class XFrame;
- }
- namespace lang {
- class XMultiServiceFactory;
- }
- namespace util {
- class XCloseListener;
- }
- namespace beans {
- struct PropertyValue;
- struct NamedValue;
- }
-}}}
-
-namespace cppu {
- class OMultiTypeInterfaceContainerHelper;
-}
-
-namespace comphelper {
- class NamedValueCollection;
-}
-
-#define NUM_SUPPORTED_STATES 5
-// #define NUM_SUPPORTED_VERBS 5
-
-#include "docholder.hxx"
-
-class Interceptor;
-
-class OCommonEmbeddedObject : public ::com::sun::star::embed::XEmbeddedObject
- , public ::com::sun::star::embed::XEmbedPersist
- , public ::com::sun::star::embed::XLinkageSupport
- , public ::com::sun::star::embed::XInplaceObject
- , public ::com::sun::star::container::XChild
- , public ::com::sun::star::chart2::XDefaultSizeTransmitter
- , public ::cppu::OWeakObject
-{
-protected:
- ::osl::Mutex m_aMutex;
-
- DocumentHolder* m_pDocHolder;
-
- ::cppu::OMultiTypeInterfaceContainerHelper* m_pInterfaceContainer;
-
- sal_Bool m_bReadOnly;
-
- sal_Bool m_bDisposed;
- sal_Bool m_bClosed;
-
- sal_Int32 m_nObjectState;
- sal_Int32 m_nTargetState; // should be -1 exept during state changing
- sal_Int32 m_nUpdateMode;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
-
- ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aDocMediaDescriptor;
-
- ::com::sun::star::uno::Sequence< sal_Int8 > m_aClassID;
- ::rtl::OUString m_aClassName;
-
- ::rtl::OUString m_aDocServiceName;
- ::rtl::OUString m_aPresetFilterName;
-
- sal_Int64 m_nMiscStatus;
-
- ::com::sun::star::uno::Sequence< ::com::sun::star::embed::VerbDescriptor > m_aObjectVerbs;
-
- ::com::sun::star::uno::Sequence< sal_Int32 > m_aAcceptedStates;
- ::com::sun::star::uno::Sequence< sal_Int32 > m_pIntermediateStatesSeqs[NUM_SUPPORTED_STATES][NUM_SUPPORTED_STATES];
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Sequence< sal_Int32 > > m_aVerbTable;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient > m_xClientSite;
-
- ::rtl::OUString m_aContainerName;
- ::rtl::OUString m_aDefaultParentBaseURL;
- ::rtl::OUString m_aModuleName;
- sal_Bool m_bEmbeddedScriptSupport;
- sal_Bool m_bDocumentRecoverySupport;
-
- Interceptor* m_pInterceptor;
-
- // following information will be used between SaveAs and SaveCompleted
- sal_Bool m_bWaitSaveCompleted;
- ::rtl::OUString m_aNewEntryName;
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xNewParentStorage;
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xNewObjectStorage;
- ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue > m_aNewDocMediaDescriptor;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xClientWindow; // ???
- ::com::sun::star::awt::Rectangle m_aOwnRectangle;
- ::com::sun::star::awt::Rectangle m_aClipRectangle;
-
- sal_Bool m_bIsLink;
-
- // embedded object related stuff
- ::rtl::OUString m_aEntryName;
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xParentStorage;
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xObjectStorage;
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xRecoveryStorage;
-
- // link related stuff
- ::rtl::OUString m_aLinkURL;
- ::rtl::OUString m_aLinkFilterName;
- sal_Bool m_bLinkHasPassword;
- ::rtl::OUString m_aLinkPassword;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent;
-
- sal_Bool m_bHasClonedSize; // the object has cached size
- ::com::sun::star::awt::Size m_aClonedSize;
- sal_Int32 m_nClonedMapUnit;
- ::com::sun::star::awt::Size m_aDefaultSizeForChart_In_100TH_MM;//#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this member
-
-private:
- void CommonInit_Impl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aObjectProps );
-
- void LinkInit_Impl( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aObjectProps,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aObjectDescr );
-
-
- void SwitchOwnPersistence(
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xNewParentStorage,
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xNewObjectStorage,
- const ::rtl::OUString& aNewName );
-
- void SwitchOwnPersistence(
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xNewParentStorage,
- const ::rtl::OUString& aNewName );
-
- ::rtl::OUString GetDocumentServiceName() const { return m_aDocServiceName; }
- ::rtl::OUString GetPresetFilterName() const { return m_aPresetFilterName; }
-
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >
- StoreDocumentToTempStream_Impl( sal_Int32 nStorageFormat,
- const ::rtl::OUString& aBaseURL,
- const ::rtl::OUString& aHierarchName );
-
- sal_Int32 ConvertVerbToState_Impl( sal_Int32 nVerb );
-
- void Deactivate();
-
- void StateChangeNotification_Impl( sal_Bool bBeforeChange, sal_Int32 nOldState, sal_Int32 nNewState,::osl::ResettableMutexGuard& _rGuard );
-
- void SwitchStateTo_Impl( sal_Int32 nNextState );
-
- ::com::sun::star::uno::Sequence< sal_Int32 > GetIntermediateStatesSequence_Impl( sal_Int32 nNewState );
-
- ::rtl::OUString GetFilterName( sal_Int32 nVersion ) const;
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > LoadDocumentFromStorage_Impl();
-
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > LoadLink_Impl();
-
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > InitNewDocument_Impl();
-
- void StoreDocToStorage_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- sal_Int32 nStorageVersion,
- const ::rtl::OUString& aBaseURL,
- const ::rtl::OUString& aHierarchName,
- sal_Bool bAttachToStorage );
-
- void SwitchDocToStorage_Impl(
- const ::com::sun::star::uno::Reference< ::com::sun::star::document::XStorageBasedDocument >& xDoc,
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage );
-
- void FillDefaultLoadArgs_Impl(
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& i_rxStorage,
- ::comphelper::NamedValueCollection& o_rLoadArgs
- ) const;
-
- void EmbedAndReparentDoc_Impl(
- const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable >& i_rxDocument
- ) const;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > CreateDocFromMediaDescr_Impl(
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMedDescr );
-
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > CreateTempDocFromLink_Impl();
-
- ::rtl::OUString GetBaseURL_Impl() const;
- ::rtl::OUString GetBaseURLFrom_Impl(
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs );
-
-public:
- OCommonEmbeddedObject(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aObjectProps );
-
- // no persistance for linked objects, so the descriptors are provided in constructor
- OCommonEmbeddedObject(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aObjectProps,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aObjectDescr );
-
- virtual ~OCommonEmbeddedObject();
-
- void SaveObject_Impl();
-
- void requestPositioning( const ::com::sun::star::awt::Rectangle& aRect );
-
- // not a real listener and should not be
- void PostEvent_Impl( const ::rtl::OUString& aEventName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xSource =
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >() );
-
-// XInterface
-
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType )
- throw( ::com::sun::star::uno::RuntimeException ) ;
-
- virtual void SAL_CALL acquire()
- throw();
-
- virtual void SAL_CALL release()
- throw();
-
-// XTypeProvider
-
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
- throw( ::com::sun::star::uno::RuntimeException ) ;
-
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getImplementationId()
- throw( ::com::sun::star::uno::RuntimeException ) ;
-
-// XEmbeddedObject
-
- virtual void SAL_CALL changeState( sal_Int32 nNewState )
- throw ( ::com::sun::star::embed::UnreachableStateException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getReachableStates()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Int32 SAL_CALL getCurrentState()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL doVerb( sal_Int32 nVerbID )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::embed::UnreachableStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::embed::VerbDescriptor > SAL_CALL getSupportedVerbs()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setClientSite(
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient >& xClient )
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient > SAL_CALL getClientSite()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL update()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setUpdateMode( sal_Int32 nMode )
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Int64 SAL_CALL getStatus( sal_Int64 nAspect )
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setContainerName( const ::rtl::OUString& sName )
- throw ( ::com::sun::star::uno::RuntimeException );
-
-
-// XVisualObject
-
- virtual void SAL_CALL setVisualAreaSize( sal_Int64 nAspect, const ::com::sun::star::awt::Size& aSize )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::awt::Size SAL_CALL getVisualAreaSize( sal_Int64 nAspect )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Int32 SAL_CALL getMapUnit( sal_Int64 nAspect )
- throw ( ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException);
-
-// XEmbedPersist
-
- virtual void SAL_CALL setPersistentEntry(
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- sal_Int32 nEntryConnectionMode,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL storeToEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL storeAsEntry(
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL saveCompleted( sal_Bool bUseNew )
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Bool SAL_CALL hasEntry()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::rtl::OUString SAL_CALL getEntryName()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
-// XLinkageSupport
-
- virtual void SAL_CALL breakLink( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Bool SAL_CALL isLink()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException);
-
- virtual ::rtl::OUString SAL_CALL getLinkURL()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException);
-
-
-// XCommonEmbedPersist
-
- virtual void SAL_CALL storeOwn()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Bool SAL_CALL isReadonly()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL reload(
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
-
-// XInplaceObject
-
- virtual void SAL_CALL setObjectRectangles( const ::com::sun::star::awt::Rectangle& aPosRect,
- const ::com::sun::star::awt::Rectangle& aClipRect )
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL enableModeless( sal_Bool bEnable )
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL translateAccelerators(
- const ::com::sun::star::uno::Sequence< ::com::sun::star::awt::KeyEvent >& aKeys )
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
-// XClassifiedObject
-
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getClassID()
- throw ( ::com::sun::star::uno::RuntimeException );
-
- virtual ::rtl::OUString SAL_CALL getClassName()
- throw ( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setClassInfo(
- const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName )
- throw ( ::com::sun::star::lang::NoSupportException,
- ::com::sun::star::uno::RuntimeException );
-
-
-// XComponentSupplier
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > SAL_CALL getComponent()
- throw ( ::com::sun::star::uno::RuntimeException );
-
-// XStateChangeBroadcaster
- virtual void SAL_CALL addStateChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStateChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeStateChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStateChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
-
-// XCloseable
-
- virtual void SAL_CALL close( sal_Bool DeliverOwnership )
- throw ( ::com::sun::star::util::CloseVetoException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL addCloseListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener >& Listener )
- throw ( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL removeCloseListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener >& Listener )
- throw ( ::com::sun::star::uno::RuntimeException );
-
-// XEventBroadcaster
- virtual void SAL_CALL addEventListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener >& Listener )
- throw ( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL removeEventListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener >& Listener )
- throw ( ::com::sun::star::uno::RuntimeException );
-
- // XChild
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
-
- // XDefaultSizeTransmitter
- //#i103460# charts do not necessaryly have an own size within ODF files, in this case they need to use the size settings from the surrounding frame, which is made available with this method
- virtual void SAL_CALL setDefaultSize( const ::com::sun::star::awt::Size& rSize_100TH_MM ) throw (::com::sun::star::uno::RuntimeException);
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/inc/docholder.hxx b/embeddedobj/source/inc/docholder.hxx
deleted file mode 100644
index b1ac54d691..0000000000
--- a/embeddedobj/source/inc/docholder.hxx
+++ /dev/null
@@ -1,211 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef _DOCHOLDER_HXX_
-#define _DOCHOLDER_HXX_
-
-#include <com/sun/star/util/XCloseListener.hpp>
-#include <com/sun/star/frame/XTerminateListener.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <com/sun/star/document/XEventListener.hpp>
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
-#include <com/sun/star/frame/XBorderResizeListener.hpp>
-#include <com/sun/star/frame/BorderWidths.hpp>
-#include <com/sun/star/awt/XWindowPeer.hpp>
-#include <com/sun/star/awt/Size.hpp>
-#include <com/sun/star/awt/Rectangle.hpp>
-#include <com/sun/star/embed/XHatchWindowController.hpp>
-#include <com/sun/star/frame/XLayoutManager.hpp>
-#include <cppuhelper/implbase6.hxx>
-
-class OCommonEmbeddedObject;
-class Interceptor;
-
-class DocumentHolder :
- public ::cppu::WeakImplHelper6<
- ::com::sun::star::util::XCloseListener,
- ::com::sun::star::frame::XTerminateListener,
- ::com::sun::star::util::XModifyListener,
- ::com::sun::star::document::XEventListener,
- ::com::sun::star::frame::XBorderResizeListener,
- ::com::sun::star::embed::XHatchWindowController >
-{
-private:
-
- OCommonEmbeddedObject* m_pEmbedObj;
-
- Interceptor* m_pInterceptor;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor > m_xOutplaceInterceptor;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > m_xComponent;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > m_xFrame;
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xOwnWindow; // set for inplace objects
- ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > m_xHatchWindow; // set for inplace objects
-
- ::com::sun::star::awt::Rectangle m_aObjRect;
- ::com::sun::star::frame::BorderWidths m_aBorderWidths;
-
- ::rtl::OUString m_aContainerName;
- ::rtl::OUString m_aDocumentNamePart;
-
- sal_Bool m_bReadOnly;
-
- sal_Bool m_bWaitForClose;
- sal_Bool m_bAllowClosing;
- sal_Bool m_bDesktopTerminated;
-
- sal_Int32 m_nNoBorderResizeReact;
- sal_Int32 m_nNoResizeReact;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::ui::XDockingAreaAcceptor > m_xCachedDocAreaAcc;
-
- ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > m_aOutplaceFrameProps;
-
-
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame > GetDocFrame();
- sal_Bool LoadDocToFrame( sal_Bool );
-
- ::com::sun::star::awt::Rectangle CalculateBorderedArea( const ::com::sun::star::awt::Rectangle& aRect );
- ::com::sun::star::awt::Rectangle AddBorderToArea( const ::com::sun::star::awt::Rectangle& aRect );
-
- void ResizeWindows_Impl( const ::com::sun::star::awt::Rectangle& aHatchRect );
-
- ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > RetrieveOwnMenu_Impl();
- sal_Bool MergeMenues_Impl(
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& xOwnLM,
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& xContLM,
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xContDisp,
- const ::rtl::OUString& aContModuleName );
-
-public:
-
- static void FindConnectPoints(
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xMenu,
- sal_Int32 nConnectPoints[2] )
- throw ( ::com::sun::star::uno::Exception );
-
- static ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess > MergeMenuesForInplace(
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xContMenu,
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xContDisp,
- const ::rtl::OUString& aContModuleName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::container::XIndexAccess >& xOwnMenu,
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xOwnDisp )
- throw ( ::com::sun::star::uno::Exception );
-
-
- DocumentHolder( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
- OCommonEmbeddedObject* pEmbObj );
- ~DocumentHolder();
-
- OCommonEmbeddedObject* GetEmbedObject() { return m_pEmbedObj; }
-
- void SetComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable >& xDoc, sal_Bool bReadOnly );
- void ResizeHatchWindow();
- void LockOffice();
- void FreeOffice();
-
- void CloseDocument( sal_Bool bDeliverOwnership, sal_Bool bWaitForClose );
- void CloseFrame();
-
- rtl::OUString GetTitle() const
- {
- return m_aContainerName + ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( " - " )) + m_aDocumentNamePart;
- }
-
- rtl::OUString GetContainerName() const { return m_aContainerName; }
-
- void SetOutplaceFrameProperties( const ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Any > aProps )
- { m_aOutplaceFrameProps = aProps; }
-
- void PlaceFrame( const ::com::sun::star::awt::Rectangle& aNewRect );
-
- sal_Bool SetFrameLMVisibility( const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >& xFrame,
- sal_Bool bVisible );
-
- sal_Bool ShowInplace( const ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindowPeer >& xParent,
- const ::com::sun::star::awt::Rectangle& aRectangleToShow,
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xContainerDP );
-
- sal_Bool ShowUI(
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& xContainerLM,
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider >& xContainerDP,
- const ::rtl::OUString& aContModuleName );
- sal_Bool HideUI(
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XLayoutManager >& xContainerLM );
-
- void Show();
-
- sal_Bool SetExtent( sal_Int64 nAspect, const ::com::sun::star::awt::Size& aSize );
- sal_Bool GetExtent( sal_Int64 nAspect, ::com::sun::star::awt::Size *pSize );
-
- sal_Int32 GetMapUnit( sal_Int64 nAspect );
-
- void SetOutplaceDispatchInterceptor(
- const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProviderInterceptor >&
- xOutplaceInterceptor )
- {
- m_xOutplaceInterceptor = xOutplaceInterceptor;
- }
-
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > GetComponent() { return m_xComponent; }
-
-// XEventListener
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
-
-// XCloseListener
- virtual void SAL_CALL queryClosing( const ::com::sun::star::lang::EventObject& Source, sal_Bool GetsOwnership ) throw (::com::sun::star::util::CloseVetoException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL notifyClosing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
-
-// XTerminateListener
- virtual void SAL_CALL queryTermination( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::frame::TerminationVetoException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL notifyTermination( const ::com::sun::star::lang::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
-
-// XModifyListener
- virtual void SAL_CALL modified( const ::com::sun::star::lang::EventObject& aEvent ) throw ( ::com::sun::star::uno::RuntimeException );
-
-// XEventListener
- virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event ) throw ( ::com::sun::star::uno::RuntimeException );
-
-// XBorderResizeListener
- virtual void SAL_CALL borderWidthsChanged( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& aObject, const ::com::sun::star::frame::BorderWidths& aNewSize ) throw (::com::sun::star::uno::RuntimeException);
-
-// XHatchWindowController
- virtual void SAL_CALL requestPositioning( const ::com::sun::star::awt::Rectangle& aRect ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::awt::Rectangle SAL_CALL calcAdjustedRectangle( const ::com::sun::star::awt::Rectangle& aRect ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL activated( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL deactivated( ) throw (::com::sun::star::uno::RuntimeException);
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/inc/dummyobject.hxx b/embeddedobj/source/inc/dummyobject.hxx
deleted file mode 100644
index c288deaede..0000000000
--- a/embeddedobj/source/inc/dummyobject.hxx
+++ /dev/null
@@ -1,299 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef _INC_DUMMYOBJECT_HXX_
-#define _INC_DUMMYOBJECT_HXX_
-
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/embed/XEmbeddedObject.hpp>
-#include <com/sun/star/embed/XEmbedPersist.hpp>
-#include <cppuhelper/implbase2.hxx>
-
-namespace com { namespace sun { namespace star {
- namespace embed {
- class XStorage;
- }
- namespace frame {
- class XModel;
- class XFrame;
- }
- namespace lang {
- class XMultiServiceFactory;
- }
- namespace util {
- class XCloseListener;
- }
- namespace beans {
- struct PropertyValue;
- struct NamedValue;
- }
-}}}
-
-namespace cppu {
- class OMultiTypeInterfaceContainerHelper;
-}
-
-class ODummyEmbeddedObject : public ::cppu::WeakImplHelper2
- < ::com::sun::star::embed::XEmbeddedObject
- , ::com::sun::star::embed::XEmbedPersist >
-{
- ::osl::Mutex m_aMutex;
- ::cppu::OMultiTypeInterfaceContainerHelper* m_pInterfaceContainer;
- sal_Bool m_bDisposed;
-
- ::rtl::OUString m_aEntryName;
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xParentStorage;
- sal_Int32 m_nObjectState;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient > m_xClientSite;
-
- sal_Int64 m_nCachedAspect;
- ::com::sun::star::awt::Size m_aCachedSize;
- sal_Bool m_bHasCachedSize;
-
- // following information will be used between SaveAs and SaveCompleted
- sal_Bool m_bWaitSaveCompleted;
- ::rtl::OUString m_aNewEntryName;
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xNewParentStorage;
-
-protected:
- void CheckInit();
- void PostEvent_Impl( const ::rtl::OUString& aEventName,
- const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& xSource );
-
-public:
-
- ODummyEmbeddedObject()
- : m_pInterfaceContainer( NULL )
- , m_bDisposed( sal_False )
- , m_nObjectState( -1 )
- , m_nCachedAspect( 0 )
- , m_bHasCachedSize( sal_False )
- , m_bWaitSaveCompleted( sal_False )
- {}
-
- ~ODummyEmbeddedObject();
-
-// XEmbeddedObject
-
- virtual void SAL_CALL changeState( sal_Int32 nNewState )
- throw ( ::com::sun::star::embed::UnreachableStateException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getReachableStates()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Int32 SAL_CALL getCurrentState()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL doVerb( sal_Int32 nVerbID )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::embed::UnreachableStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::embed::VerbDescriptor > SAL_CALL getSupportedVerbs()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setClientSite(
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient >& xClient )
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient > SAL_CALL getClientSite()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL update()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setUpdateMode( sal_Int32 nMode )
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Int64 SAL_CALL getStatus( sal_Int64 nAspect )
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setContainerName( const ::rtl::OUString& sName )
- throw ( ::com::sun::star::uno::RuntimeException );
-
-
-// XVisualObject
-
- virtual void SAL_CALL setVisualAreaSize( sal_Int64 nAspect, const ::com::sun::star::awt::Size& aSize )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::awt::Size SAL_CALL getVisualAreaSize( sal_Int64 nAspect )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Int32 SAL_CALL getMapUnit( sal_Int64 nAspect )
- throw ( ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException);
-
-// XEmbedPersist
-
- virtual void SAL_CALL setPersistentEntry(
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- sal_Int32 nEntryConnectionMode,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL storeToEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL storeAsEntry(
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL saveCompleted( sal_Bool bUseNew )
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Bool SAL_CALL hasEntry()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::rtl::OUString SAL_CALL getEntryName()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
-
-// XCommonEmbedPersist
-
- virtual void SAL_CALL storeOwn()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Bool SAL_CALL isReadonly()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL reload(
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
-
-// XClassifiedObject
-
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getClassID()
- throw ( ::com::sun::star::uno::RuntimeException );
-
- virtual ::rtl::OUString SAL_CALL getClassName()
- throw ( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setClassInfo(
- const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName )
- throw ( ::com::sun::star::lang::NoSupportException,
- ::com::sun::star::uno::RuntimeException );
-
-
-// XComponentSupplier
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > SAL_CALL getComponent()
- throw ( ::com::sun::star::uno::RuntimeException );
-
-// XStateChangeBroadcaster
- virtual void SAL_CALL addStateChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStateChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeStateChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStateChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
-
-// XCloseable
-
- virtual void SAL_CALL close( sal_Bool DeliverOwnership )
- throw ( ::com::sun::star::util::CloseVetoException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL addCloseListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener >& Listener )
- throw ( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL removeCloseListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener >& Listener )
- throw ( ::com::sun::star::uno::RuntimeException );
-
-// XEventBroadcaster
- virtual void SAL_CALL addEventListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener >& Listener )
- throw ( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL removeEventListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener >& Listener )
- throw ( ::com::sun::star::uno::RuntimeException );
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/inc/intercept.hxx b/embeddedobj/source/inc/intercept.hxx
deleted file mode 100644
index 6201f65b11..0000000000
--- a/embeddedobj/source/inc/intercept.hxx
+++ /dev/null
@@ -1,169 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef _INTERCEPT_HXX_
-#define _INTERCEPT_HXX_
-
-#include <osl/mutex.hxx>
-#include <cppuhelper/implbase3.hxx>
-#include <cppuhelper/interfacecontainer.hxx>
-#include <com/sun/star/frame/XDispatchProviderInterceptor.hpp>
-#include <com/sun/star/frame/XInterceptorInfo.hpp>
-#include <com/sun/star/frame/XDispatch.hpp>
-
-
-class StatusChangeListenerContainer;
-class DocumentHolder;
-
-class Interceptor : public ::cppu::WeakImplHelper3< ::com::sun::star::frame::XDispatchProviderInterceptor,
- ::com::sun::star::frame::XInterceptorInfo,
- ::com::sun::star::frame::XDispatch>
-{
-public:
-
- Interceptor( DocumentHolder* pDocHolder );
- ~Interceptor();
-
- void DisconnectDocHolder();
- // overwritten to release the statuslistner.
-
- // XComponent
- virtual void SAL_CALL
- addEventListener(
- const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& xListener )
- throw( com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL
- removeEventListener( const com::sun::star::uno::Reference< com::sun::star::lang::XEventListener >& aListener )
- throw( com::sun::star::uno::RuntimeException );
-
- //XDispatch
- virtual void SAL_CALL
- dispatch(
- const ::com::sun::star::util::URL& URL,
- const ::com::sun::star::uno::Sequence<
- ::com::sun::star::beans::PropertyValue >& Arguments )
- throw (::com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL
- addStatusListener(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XStatusListener >& Control,
- const ::com::sun::star::util::URL& URL )
- throw (
- ::com::sun::star::uno::RuntimeException
- );
-
- virtual void SAL_CALL
- removeStatusListener(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XStatusListener >& Control,
- const ::com::sun::star::util::URL& URL )
- throw (
- ::com::sun::star::uno::RuntimeException
- );
-
- //XInterceptorInfo
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString >
- SAL_CALL getInterceptedURLs( )
- throw (
- ::com::sun::star::uno::RuntimeException
- );
-
- //XDispatchProvider ( inherited by XDispatchProviderInterceptor )
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XDispatch > SAL_CALL
- queryDispatch(
- const ::com::sun::star::util::URL& URL,
- const ::rtl::OUString& TargetFrameName,
- sal_Int32 SearchFlags )
- throw (
- ::com::sun::star::uno::RuntimeException
- );
-
- virtual ::com::sun::star::uno::Sequence<
- ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XDispatch > > SAL_CALL
- queryDispatches(
- const ::com::sun::star::uno::Sequence<
- ::com::sun::star::frame::DispatchDescriptor >& Requests )
- throw (
- ::com::sun::star::uno::RuntimeException
- );
-
-
- //XDispatchProviderInterceptor
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XDispatchProvider > SAL_CALL
- getSlaveDispatchProvider( )
- throw (
- ::com::sun::star::uno::RuntimeException
- );
-
- virtual void SAL_CALL
- setSlaveDispatchProvider(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XDispatchProvider >& NewDispatchProvider )
- throw (
- ::com::sun::star::uno::RuntimeException
- );
-
- virtual ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XDispatchProvider > SAL_CALL
- getMasterDispatchProvider( )
- throw (
- ::com::sun::star::uno::RuntimeException
- );
-
- virtual void SAL_CALL
- setMasterDispatchProvider(
- const ::com::sun::star::uno::Reference<
- ::com::sun::star::frame::XDispatchProvider >& NewSupplier )
- throw (
- ::com::sun::star::uno::RuntimeException
- );
-
-
-private:
-
- osl::Mutex m_aMutex;
-
- DocumentHolder* m_pDocHolder;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xSlaveDispatchProvider;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatchProvider > m_xMasterDispatchProvider;
-
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > m_aInterceptedURL;
-
- cppu::OInterfaceContainerHelper* m_pDisposeEventListeners;
- StatusChangeListenerContainer* m_pStatCL;
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/inc/oleembobj.hxx b/embeddedobj/source/inc/oleembobj.hxx
deleted file mode 100644
index bdf175e4a7..0000000000
--- a/embeddedobj/source/inc/oleembobj.hxx
+++ /dev/null
@@ -1,548 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef _INC_OLEEMBOBJ_HXX_
-#define _INC_OLEEMBOBJ_HXX_
-
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/embed/XEmbeddedObject.hpp>
-#include <com/sun/star/embed/XInplaceObject.hpp>
-#include <com/sun/star/embed/XVisualObject.hpp>
-#include <com/sun/star/embed/XEmbedPersist.hpp>
-#include <com/sun/star/embed/XLinkageSupport.hpp>
-#include <com/sun/star/embed/XClassifiedObject.hpp>
-#include <com/sun/star/embed/XComponentSupplier.hpp>
-#include <com/sun/star/embed/VerbDescriptor.hpp>
-#include <com/sun/star/document/XEventBroadcaster.hpp>
-#include <com/sun/star/container/XChild.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <com/sun/star/util/XCloseListener.hpp>
-#include <cppuhelper/implbase5.hxx>
-
-#include <osl/thread.h>
-
-namespace cppu {
- class OMultiTypeInterfaceContainerHelper;
-}
-
-class VerbExecutionController
-{
- // the following mutex is allowed to be locked only for variables initialization, so no deadlock can be caused
- ::osl::Mutex m_aVerbExecutionMutex;
-
- sal_Bool m_bVerbExecutionInProgress;
- oslThreadIdentifier m_nVerbExecutionThreadIdentifier;
- sal_Bool m_bChangedOnVerbExecution;
-
- sal_Bool m_bWasEverActive;
- sal_Int32 m_nNotificationLock;
-
-public:
-
- VerbExecutionController()
- : m_bVerbExecutionInProgress( sal_False )
- , m_nVerbExecutionThreadIdentifier( 0 )
- , m_bChangedOnVerbExecution( sal_False )
- , m_bWasEverActive( sal_False )
- , m_nNotificationLock( 0 )
- {}
-#ifdef WNT
- void StartControlExecution();
- sal_Bool EndControlExecution_WasModified();
- void ModificationNotificationIsDone();
-#endif
- void LockNotification();
- void UnlockNotification();
-
- // no need to lock anything to check the value of the numeric members
- sal_Bool CanDoNotification() { return ( !m_bVerbExecutionInProgress && !m_bWasEverActive && !m_nNotificationLock ); }
- // ... or to change it
- void ObjectIsActive() { m_bWasEverActive = sal_True; }
-};
-
-class VerbExecutionControllerGuard
-{
- VerbExecutionController& m_rController;
-public:
-
- VerbExecutionControllerGuard( VerbExecutionController& rController )
- : m_rController( rController )
- {
- m_rController.LockNotification();
- }
-
- ~VerbExecutionControllerGuard()
- {
- m_rController.UnlockNotification();
- }
-};
-
-
-class OleComponent;
-class OwnView_Impl;
-class OleEmbeddedObject : public ::cppu::WeakImplHelper5
- < ::com::sun::star::embed::XEmbeddedObject
- , ::com::sun::star::embed::XEmbedPersist
- , ::com::sun::star::embed::XLinkageSupport
- , ::com::sun::star::embed::XInplaceObject
- , ::com::sun::star::container::XChild >
-{
- friend class OleComponent;
-
- ::osl::Mutex m_aMutex;
-
- OleComponent* m_pOleComponent;
-
- ::cppu::OMultiTypeInterfaceContainerHelper* m_pInterfaceContainer;
-
- sal_Bool m_bReadOnly;
-
- sal_Int32 m_bDisposed;
- sal_Int32 m_nObjectState;
- sal_Int32 m_nTargetState;
- sal_Int32 m_nUpdateMode;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
-
- ::com::sun::star::uno::Sequence< sal_Int8 > m_aClassID;
- ::rtl::OUString m_aClassName;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient > m_xClientSite;
-
- ::rtl::OUString m_aContainerName;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener > m_xClosePreventer;
-
- sal_Bool m_bWaitSaveCompleted;
- sal_Bool m_bNewVisReplInStream;
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xNewCachedVisRepl;
- ::rtl::OUString m_aNewEntryName;
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xNewParentStorage;
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xNewObjectStream;
- sal_Bool m_bStoreLoaded;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xCachedVisualRepresentation;
- sal_Bool m_bVisReplInitialized;
- sal_Bool m_bVisReplInStream;
- sal_Bool m_bStoreVisRepl;
-
- sal_Bool m_bIsLink;
-
- // TODO/LATER: may need to cache more than one aspect in future
- sal_Bool m_bHasCachedSize; // the object has cached size
- ::com::sun::star::awt::Size m_aCachedSize;
- sal_Int64 m_nCachedAspect;
-
- sal_Bool m_bHasSizeToSet; // the object has cached size that should be set to OLE component
- ::com::sun::star::awt::Size m_aSizeToSet; // this size might be different from the cached one ( scaling is applied )
- sal_Int64 m_nAspectToSet;
-
-
- // cache the status of the object
- // TODO/LATER: may need to cache more than one aspect in future
- sal_Bool m_bGotStatus;
- sal_Int64 m_nStatus;
- sal_Int64 m_nStatusAspect;
-
- // embedded object related stuff
- ::rtl::OUString m_aEntryName;
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > m_xParentStorage;
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > m_xObjectStream;
-
- // link related stuff
- ::rtl::OUString m_aLinkURL; // ???
-
- // points to own view provider if the the object has no server
- OwnView_Impl* m_pOwnView;
-
- // whether the object should be initialized from clipboard in case of default initialization
- sal_Bool m_bFromClipboard;
-
- ::rtl::OUString m_aTempURL;
-
- ::rtl::OUString m_aTempDumpURL;
-
- // STAMPIT solution
- // the following member is used during verb execution to detect whether the verb execution modifies the object
- VerbExecutionController m_aVerbExecutionController;
-
- // if the following member is set, the object works in wrapper mode
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedObject > m_xWrappedObject;
- sal_Bool m_bTriedConversion;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > m_xParent;
-
-protected:
-
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > TryToGetAcceptableFormat_Impl(
- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream )
- throw ( ::com::sun::star::uno::Exception );
-
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > GetNewFilledTempStream_Impl(
- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInStream )
- throw( ::com::sun::star::io::IOException );
-#ifdef WNT
- void SwitchComponentToRunningState_Impl();
-#endif
- void MakeEventListenerNotification_Impl( const ::rtl::OUString& aEventName );
-#ifdef WNT
- void StateChangeNotification_Impl( sal_Bool bBeforeChange, sal_Int32 nOldState, sal_Int32 nNewState );
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > GetStreamForSaving();
-
-
- ::com::sun::star::uno::Sequence< sal_Int32 > GetIntermediateVerbsSequence_Impl( sal_Int32 nNewState );
-
- ::com::sun::star::uno::Sequence< sal_Int32 > GetReachableStatesList_Impl(
- const ::com::sun::star::uno::Sequence< ::com::sun::star::embed::VerbDescriptor >& aVerbList );
-#endif
-
- void CloseComponent();
- void Dispose();
-
- void SwitchOwnPersistence(
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xNewParentStorage,
- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xNewObjectStream,
- const ::rtl::OUString& aNewName );
-
- void SwitchOwnPersistence(
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xNewParentStorage,
- const ::rtl::OUString& aNewName );
-
- void GetRidOfComponent();
-
- void StoreToLocation_Impl(
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs,
- sal_Bool bSaveAs )
- throw ( ::com::sun::star::uno::Exception );
-#ifdef WNT
- void StoreObjectToStream( ::com::sun::star::uno::Reference< ::com::sun::star::io::XOutputStream > xOutStream )
- throw ( ::com::sun::star::uno::Exception );
-#endif
- void InsertVisualCache_Impl(
- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xTargetStream,
- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xCachedVisualRepresentation )
- throw ( ::com::sun::star::uno::Exception );
-
- void RemoveVisualCache_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xTargetStream )
- throw ( ::com::sun::star::uno::Exception );
-
- void SetVisReplInStream( sal_Bool bExists );
- sal_Bool HasVisReplInStream();
-
- ::com::sun::star::embed::VisualRepresentation GetVisualRepresentationInNativeFormat_Impl(
- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > xCachedVisRepr )
- throw ( ::com::sun::star::uno::Exception );
-
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > TryToRetrieveCachedVisualRepresentation_Impl(
- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream >& xStream,
- sal_Bool bAllowRepair50 = sal_False )
- throw ();
-#ifdef WNT
- sal_Bool SaveObject_Impl();
- sal_Bool OnShowWindow_Impl( sal_Bool bShow );
- void CreateOleComponent_Impl( OleComponent* pOleComponent = NULL );
- void CreateOleComponentAndLoad_Impl( OleComponent* pOleComponent = NULL );
- void CreateOleComponentFromClipboard_Impl( OleComponent* pOleComponent = NULL );
-#endif
- void SetObjectIsLink_Impl( sal_Bool bIsLink ) { m_bIsLink = bIsLink; }
-
-#ifdef WNT
- ::rtl::OUString CreateTempURLEmpty_Impl();
- ::rtl::OUString GetTempURL_Impl();
-#endif
- ::rtl::OUString GetContainerName_Impl() { return m_aContainerName; }
-
- // the following 4 methods are related to switch to wrapping mode
- void MoveListeners();
- ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage > CreateTemporarySubstorage( ::rtl::OUString& o_aStorageName );
- ::rtl::OUString MoveToTemporarySubstream();
- sal_Bool TryToConvertToOOo();
-
-public:
- // in case a new object must be created the class ID must be specified
- OleEmbeddedObject( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
- const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID,
- const ::rtl::OUString& aClassName );
-
- // in case object will be loaded from a persistent entry or from a file the class ID will be detected on loading
- // factory can do it for OOo objects, but for OLE objects OS dependent code is required
- OleEmbeddedObject( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
- sal_Bool bLink );
-#ifdef WNT
- // this constructor let object be initialized from clipboard
- OleEmbeddedObject( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory );
-#endif
-
- virtual ~OleEmbeddedObject();
-
-#ifdef WNT
- void OnIconChanged_Impl();
- void OnViewChanged_Impl();
- void OnClosed_Impl();
-#endif
-
-// XEmbeddedObject
-
- virtual void SAL_CALL changeState( sal_Int32 nNewState )
- throw ( ::com::sun::star::embed::UnreachableStateException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Sequence< sal_Int32 > SAL_CALL getReachableStates()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Int32 SAL_CALL getCurrentState()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL doVerb( sal_Int32 nVerbID )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::embed::UnreachableStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::embed::VerbDescriptor > SAL_CALL getSupportedVerbs()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setClientSite(
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient >& xClient )
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::embed::XEmbeddedClient > SAL_CALL getClientSite()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL update()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setUpdateMode( sal_Int32 nMode )
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Int64 SAL_CALL getStatus( sal_Int64 nAspect )
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setContainerName( const ::rtl::OUString& sName )
- throw ( ::com::sun::star::uno::RuntimeException );
-
-
-// XVisualObject
-
- virtual void SAL_CALL setVisualAreaSize( sal_Int64 nAspect, const ::com::sun::star::awt::Size& aSize )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::awt::Size SAL_CALL getVisualAreaSize( sal_Int64 nAspect )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Int32 SAL_CALL getMapUnit( sal_Int64 nAspect )
- throw ( ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException);
-
-
-// XEmbedPersist
-
- virtual void SAL_CALL setPersistentEntry(
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- sal_Int32 nEntryConnectionMode,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL storeToEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL storeAsEntry(
- const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL saveCompleted( sal_Bool bUseNew )
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Bool SAL_CALL hasEntry()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::rtl::OUString SAL_CALL getEntryName()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
-// XLinkageSupport
-
- virtual void SAL_CALL breakLink( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Bool SAL_CALL isLink()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException);
-
- virtual ::rtl::OUString SAL_CALL getLinkURL()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException);
-
-// XCommonEmbedPersist
- virtual void SAL_CALL storeOwn()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Bool SAL_CALL isReadonly()
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL reload(
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::io::IOException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
-// XClassifiedObject
-
- virtual ::com::sun::star::uno::Sequence< sal_Int8 > SAL_CALL getClassID()
- throw ( ::com::sun::star::uno::RuntimeException );
-
- virtual ::rtl::OUString SAL_CALL getClassName()
- throw ( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setClassInfo(
- const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName )
- throw ( ::com::sun::star::lang::NoSupportException,
- ::com::sun::star::uno::RuntimeException );
-
-// XStateChangeBroadcaster
- virtual void SAL_CALL addStateChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStateChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeStateChangeListener( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStateChangeListener >& xListener ) throw (::com::sun::star::uno::RuntimeException);
-
-
-// XComponentSupplier
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseable > SAL_CALL getComponent()
- throw ( ::com::sun::star::uno::RuntimeException );
-
-// XCloseable
-
- virtual void SAL_CALL close( sal_Bool DeliverOwnership )
- throw ( ::com::sun::star::util::CloseVetoException,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL addCloseListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener >& Listener )
- throw ( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL removeCloseListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener >& Listener )
- throw ( ::com::sun::star::uno::RuntimeException );
-
-// XEventBroadcaster
- virtual void SAL_CALL addEventListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener >& Listener )
- throw ( ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL removeEventListener(
- const ::com::sun::star::uno::Reference< ::com::sun::star::document::XEventListener >& Listener )
- throw ( ::com::sun::star::uno::RuntimeException );
-
-// XInplaceObject ( only for wrapping scenario here )
-
- virtual void SAL_CALL setObjectRectangles( const ::com::sun::star::awt::Rectangle& aPosRect,
- const ::com::sun::star::awt::Rectangle& aClipRect )
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL enableModeless( sal_Bool bEnable )
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL translateAccelerators(
- const ::com::sun::star::uno::Sequence< ::com::sun::star::awt::KeyEvent >& aKeys )
- throw ( ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::RuntimeException );
-
- // XChild ( only for wrapping scenario here )
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL getParent( ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setParent( const ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface >& Parent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException);
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/inc/specialobject.hxx b/embeddedobj/source/inc/specialobject.hxx
deleted file mode 100644
index e181fe8ccf..0000000000
--- a/embeddedobj/source/inc/specialobject.hxx
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef _INC_SPECIALOBJECT_HXX_
-#define _INC_SPECIALOBJECT_HXX_
-
-#include <com/sun/star/awt/Size.hpp>
-
-#include "commonembobj.hxx"
-
-class OSpecialEmbeddedObject : public OCommonEmbeddedObject
-{
-private:
- com::sun::star::awt::Size maSize;
-public:
- OSpecialEmbeddedObject(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
- const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::NamedValue >& aObjectProps );
-
- // XInterface
- virtual ::com::sun::star::uno::Any SAL_CALL queryInterface( const ::com::sun::star::uno::Type& rType )
- throw( ::com::sun::star::uno::RuntimeException ) ;
-
- // XTypeProvider
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::uno::Type > SAL_CALL getTypes()
- throw( ::com::sun::star::uno::RuntimeException ) ;
-
- // XVisualObject
- virtual ::com::sun::star::embed::VisualRepresentation SAL_CALL getPreferredVisualRepresentation( ::sal_Int64 nAspect )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL setVisualAreaSize( sal_Int64 nAspect, const ::com::sun::star::awt::Size& aSize )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual ::com::sun::star::awt::Size SAL_CALL getVisualAreaSize( sal_Int64 nAspect )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual sal_Int32 SAL_CALL getMapUnit( sal_Int64 nAspect )
- throw ( ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL changeState( sal_Int32 nNewState )
- throw ( ::com::sun::star::embed::UnreachableStateException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-
- virtual void SAL_CALL doVerb( sal_Int32 nVerbID )
- throw ( ::com::sun::star::lang::IllegalArgumentException,
- ::com::sun::star::embed::WrongStateException,
- ::com::sun::star::embed::UnreachableStateException,
- ::com::sun::star::uno::Exception,
- ::com::sun::star::uno::RuntimeException );
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/inc/targetstatecontrol.hxx b/embeddedobj/source/inc/targetstatecontrol.hxx
deleted file mode 100644
index 4361b78410..0000000000
--- a/embeddedobj/source/inc/targetstatecontrol.hxx
+++ /dev/null
@@ -1,50 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-#include <sal/types.h>
-#include <osl/diagnose.h>
-
-class TargetStateControl_Impl
-{
- sal_Int32& m_nTargetStateVariable;
-public:
- TargetStateControl_Impl( sal_Int32& nVariable, sal_Int32 nValue )
- : m_nTargetStateVariable( nVariable )
- {
- OSL_ENSURE( m_nTargetStateVariable == -1, "The target state variable is not initialized properly!\n" );
- m_nTargetStateVariable = nValue;
- }
-
- ~TargetStateControl_Impl()
- {
- m_nTargetStateVariable = -1;
- }
-};
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/inc/xcreator.hxx b/embeddedobj/source/inc/xcreator.hxx
deleted file mode 100644
index ae9a4a361b..0000000000
--- a/embeddedobj/source/inc/xcreator.hxx
+++ /dev/null
@@ -1,93 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef __XCREATOR_HXX_
-#define __XCREATOR_HXX_
-
-#include <com/sun/star/embed/XEmbedObjectCreator.hpp>
-#include <com/sun/star/embed/XEmbedObjectFactory.hpp>
-#include <com/sun/star/embed/XLinkCreator.hpp>
-#include <com/sun/star/embed/XLinkFactory.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-
-
-#include <cppuhelper/implbase5.hxx>
-#include <comphelper/mimeconfighelper.hxx>
-
-class UNOEmbeddedObjectCreator : public ::cppu::WeakImplHelper5<
- ::com::sun::star::embed::XEmbedObjectCreator,
- ::com::sun::star::embed::XEmbedObjectFactory,
- ::com::sun::star::embed::XLinkCreator,
- ::com::sun::star::embed::XLinkFactory,
- ::com::sun::star::lang::XServiceInfo >
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
-
- ::comphelper::MimeConfigurationHelper m_aConfigHelper;
-public:
- UNOEmbeddedObjectCreator(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
- : m_xFactory( xFactory )
- , m_aConfigHelper( xFactory )
- {
- OSL_ENSURE( xFactory.is(), "No service manager is provided!\n" );
- }
-
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL impl_staticGetSupportedServiceNames();
-
- static ::rtl::OUString SAL_CALL impl_staticGetImplementationName();
-
- static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
- impl_staticCreateSelfInstance(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
-
-
- // XEmbedObjectCreator
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceInitNew( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceInitFromEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMedDescr, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceInitFromMediaDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XEmbedObjectFactory
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceUserInit( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& sClassName, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, sal_Int32 nEntryConnectionMode, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aObjectArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XLinkCreator
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceLink( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XLinkFactory
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceLinkUserInit( const ::com::sun::star::uno::Sequence< ::sal_Int8 >& aClassID, const ::rtl::OUString& sClassName, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntryName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aArgs, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aObjectArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/advisesink.cxx b/embeddedobj/source/msole/advisesink.cxx
deleted file mode 100644
index f8027bf854..0000000000
--- a/embeddedobj/source/msole/advisesink.cxx
+++ /dev/null
@@ -1,136 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-
-#include <osl/diagnose.h>
-#include <advisesink.hxx>
-#include <olecomponent.hxx>
-
-#include <rtl/ref.hxx>
-
-OleWrapperAdviseSink::OleWrapperAdviseSink( OleComponent* pOleComp )
-: m_nRefCount( 0 )
-, m_pOleComp( pOleComp )
-{
- OSL_ENSURE( m_pOleComp, "No ole component is provided!\n" );
-}
-
-OleWrapperAdviseSink::~OleWrapperAdviseSink()
-{
-}
-
-STDMETHODIMP OleWrapperAdviseSink::QueryInterface( REFIID riid , void** ppv )
-{
- *ppv=NULL;
-
- if ( riid == IID_IUnknown )
- *ppv = (IUnknown*)this;
-
- if ( riid == IID_IAdviseSink )
- *ppv = (IAdviseSink*)this;
-
- if ( *ppv != NULL )
- {
- ((IUnknown*)*ppv)->AddRef();
- return S_OK;
- }
-
- return E_NOINTERFACE;
-}
-
-STDMETHODIMP_(ULONG) OleWrapperAdviseSink::AddRef()
-{
- return osl_incrementInterlockedCount( &m_nRefCount);
-}
-
-STDMETHODIMP_(ULONG) OleWrapperAdviseSink::Release()
-{
- ULONG nReturn = --m_nRefCount;
- if ( m_nRefCount == 0 )
- delete this;
-
- return nReturn;
-}
-
-void OleWrapperAdviseSink::disconnectOleComponent()
-{
- // must not be called from the descructor of OleComponent!!!
- osl::MutexGuard aGuard( m_aMutex );
- m_pOleComp = NULL;
-}
-
-STDMETHODIMP_(void) OleWrapperAdviseSink::OnDataChange(LPFORMATETC, LPSTGMEDIUM)
-{
- // Unused for now ( no registration for IDataObject events )
-}
-
-STDMETHODIMP_(void) OleWrapperAdviseSink::OnViewChange(DWORD dwAspect, LONG)
-{
- ::rtl::Reference< OleComponent > xLockComponent;
-
- {
- osl::MutexGuard aGuard( m_aMutex );
- if ( m_pOleComp )
- xLockComponent = m_pOleComp;
- }
-
- if ( xLockComponent.is() )
- xLockComponent->OnViewChange_Impl( dwAspect );
-}
-
-STDMETHODIMP_(void) OleWrapperAdviseSink::OnRename(LPMONIKER)
-{
- // handled by default inprocess handler
-}
-
-STDMETHODIMP_(void) OleWrapperAdviseSink::OnSave(void)
-{
- // TODO: ???
- // The object knows about document saving already since it contolls it as ClienSite
- // other interested listeners must be registered for the object
-}
-
-STDMETHODIMP_(void) OleWrapperAdviseSink::OnClose(void)
-{
- ::rtl::Reference< OleComponent > xLockComponent;
-
- {
- osl::MutexGuard aGuard( m_aMutex );
- if ( m_pOleComp )
- xLockComponent = m_pOleComp;
- }
-
- if ( xLockComponent.is() )
- xLockComponent->OnClose_Impl();
-
- // TODO: sometimes it can be necessary to simulate OnShowWindow( False ) here
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/advisesink.hxx b/embeddedobj/source/msole/advisesink.hxx
deleted file mode 100644
index 83fac1e920..0000000000
--- a/embeddedobj/source/msole/advisesink.hxx
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-#include <osl/interlck.h>
-#include <osl/mutex.hxx>
-#include <platform.h>
-
-class OleComponent;
-class OleWrapperAdviseSink : public IAdviseSink
-{
-protected:
- osl::Mutex m_aMutex;
- oslInterlockedCount m_nRefCount;
- OleComponent* m_pOleComp;
-
-public:
- OleWrapperAdviseSink( OleComponent* pOleComp );
- OleWrapperAdviseSink(void);
- virtual ~OleWrapperAdviseSink();
-
- void disconnectOleComponent();
- STDMETHODIMP QueryInterface(REFIID, void**);
- STDMETHODIMP_(ULONG) AddRef(void);
- STDMETHODIMP_(ULONG) Release(void);
-
- STDMETHODIMP_(void) OnDataChange(LPFORMATETC, LPSTGMEDIUM);
- STDMETHODIMP_(void) OnViewChange(DWORD, LONG);
- STDMETHODIMP_(void) OnRename(LPMONIKER);
- STDMETHODIMP_(void) OnSave(void);
- STDMETHODIMP_(void) OnClose(void);
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/closepreventer.cxx b/embeddedobj/source/msole/closepreventer.cxx
deleted file mode 100644
index 8fac42da6e..0000000000
--- a/embeddedobj/source/msole/closepreventer.cxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-
-#include "closepreventer.hxx"
-
-void SAL_CALL OClosePreventer::queryClosing( const ::com::sun::star::lang::EventObject&, sal_Bool )
- throw (::com::sun::star::util::CloseVetoException, ::com::sun::star::uno::RuntimeException)
-{
- throw ::com::sun::star::util::CloseVetoException();
-}
-
-void SAL_CALL OClosePreventer::notifyClosing( const com::sun::star::lang::EventObject& )
- throw (::com::sun::star::uno::RuntimeException)
-{
- // just a disaster
- OSL_FAIL( "The object can not be prevented from closing!\n" );
-}
-
-void SAL_CALL OClosePreventer::disposing( const com::sun::star::lang::EventObject& )
- throw (::com::sun::star::uno::RuntimeException)
-{
- // just a disaster
- OSL_FAIL( "The object can not be prevented from closing!\n" );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/emboleobj.component b/embeddedobj/source/msole/emboleobj.component
deleted file mode 100755
index 96f8ed0d8d..0000000000
--- a/embeddedobj/source/msole/emboleobj.component
+++ /dev/null
@@ -1,35 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--**********************************************************************
-*
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
-*
-* OpenOffice.org - a multi-platform office productivity suite
-*
-* This file is part of OpenOffice.org.
-*
-* 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.
-*
-* 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).
-*
-* 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.
-*
-**********************************************************************-->
-
-<component loader="com.sun.star.loader.SharedLibrary"
- xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.embed.OLEEmbeddedObjectFactory">
- <service name="com.sun.star.comp.embed.OLEEmbeddedObjectFactory"/>
- <service name="com.sun.star.embed.OLEEmbeddedObjectFactory"/>
- </implementation>
-</component>
diff --git a/embeddedobj/source/msole/emboleobj.windows.component b/embeddedobj/source/msole/emboleobj.windows.component
deleted file mode 100755
index 644a1d4f19..0000000000
--- a/embeddedobj/source/msole/emboleobj.windows.component
+++ /dev/null
@@ -1,39 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!--**********************************************************************
-*
-* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-*
-* Copyright 2000, 2010 Oracle and/or its affiliates.
-*
-* OpenOffice.org - a multi-platform office productivity suite
-*
-* This file is part of OpenOffice.org.
-*
-* 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.
-*
-* 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).
-*
-* 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.
-*
-**********************************************************************-->
-
-<component loader="com.sun.star.loader.SharedLibrary"
- xmlns="http://openoffice.org/2010/uno-components">
- <implementation name="com.sun.star.comp.embed.MSOLEObjectSystemCreator">
- <service name="com.sun.star.comp.embed.MSOLEObjectSystemCreator"/>
- <service name="com.sun.star.embed.MSOLEObjectSystemCreator"/>
- </implementation>
- <implementation name="com.sun.star.comp.embed.OLEEmbeddedObjectFactory">
- <service name="com.sun.star.comp.embed.OLEEmbeddedObjectFactory"/>
- <service name="com.sun.star.embed.OLEEmbeddedObjectFactory"/>
- </implementation>
-</component>
diff --git a/embeddedobj/source/msole/exports.dxp b/embeddedobj/source/msole/exports.dxp
deleted file mode 100755
index 7003307892..0000000000
--- a/embeddedobj/source/msole/exports.dxp
+++ /dev/null
@@ -1 +0,0 @@
-component_getFactory
diff --git a/embeddedobj/source/msole/graphconvert.cxx b/embeddedobj/source/msole/graphconvert.cxx
deleted file mode 100644
index bd178f08a1..0000000000
--- a/embeddedobj/source/msole/graphconvert.cxx
+++ /dev/null
@@ -1,135 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/embed/Aspects.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/graphic/XGraphicProvider.hpp>
-#include <com/sun/star/graphic/XGraphic.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <tools/link.hxx>
-#include <osl/mutex.hxx>
-#include <unotools/streamwrap.hxx>
-#include <comphelper/processfactory.hxx>
-#include <comphelper/seqstream.hxx>
-#include <tools/stream.hxx>
-
-#include "mtnotification.hxx"
-#include "oleembobj.hxx"
-
-
-using namespace ::com::sun::star;
-
-
-sal_Bool ConvertBufferToFormat( void* pBuf,
- sal_uInt32 nBufSize,
- const ::rtl::OUString& aMimeType,
- uno::Any& aResult )
-{
- // produces sequence with data in requested format and returns it in aResult
- if ( pBuf )
- {
- uno::Sequence < sal_Int8 > aData( (sal_Int8*)pBuf, nBufSize );
- uno::Reference < io::XInputStream > xIn = new comphelper::SequenceInputStream( aData );
- try
- {
- uno::Reference < graphic::XGraphicProvider > xGraphicProvider( comphelper::getProcessServiceFactory()->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.graphic.GraphicProvider")) ), uno::UNO_QUERY );
- if( xGraphicProvider.is() )
- {
- uno::Sequence< beans::PropertyValue > aMediaProperties( 1 );
- aMediaProperties[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "InputStream" ));
- aMediaProperties[0].Value <<= xIn;
- uno::Reference< graphic::XGraphic > xGraphic( xGraphicProvider->queryGraphic( aMediaProperties ) );
- if( xGraphic.is() )
- {
- SvMemoryStream aNewStream( 65535, 65535 );
- uno::Reference < io::XStream > xOut = new utl::OStreamWrapper( aNewStream );
- uno::Sequence< beans::PropertyValue > aOutMediaProperties( 2 );
- aOutMediaProperties[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "OutputStream" ));
- aOutMediaProperties[0].Value <<= xOut;
- aOutMediaProperties[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MimeType" ));
- aOutMediaProperties[1].Value <<= aMimeType;
-
- xGraphicProvider->storeGraphic( xGraphic, aOutMediaProperties );
- aResult <<= uno::Sequence< sal_Int8 >( reinterpret_cast< const sal_Int8* >( aNewStream.GetData() ), aNewStream.Seek( STREAM_SEEK_TO_END ) );
- return sal_True;
- }
- }
- }
- catch (uno::Exception&)
- {}
- }
-
- return sal_False;
-}
-
-// =====================================================================
-// MainThreadNotificationRequest
-// =====================================================================
-MainThreadNotificationRequest::MainThreadNotificationRequest( const ::rtl::Reference< OleEmbeddedObject >& xObj, sal_uInt16 nNotificationType, sal_uInt32 nAspect )
-: m_pObject( xObj.get() )
-, m_xObject( static_cast< embed::XEmbeddedObject* >( xObj.get() ) )
-, m_nNotificationType( nNotificationType )
-, m_nAspect( nAspect )
-{}
-
-void SAL_CALL MainThreadNotificationRequest::notify (const uno::Any& ) throw (uno::RuntimeException)
-{
- if ( m_pObject )
- {
- try
- {
- uno::Reference< uno::XInterface > xLock = m_xObject.get();
- if ( xLock.is() )
- {
- // this is the main thread, the solar mutex must be locked
- if ( m_nNotificationType == OLECOMP_ONCLOSE )
- m_pObject->OnClosed_Impl();
- else if ( m_nAspect == embed::Aspects::MSOLE_CONTENT )
- m_pObject->OnViewChanged_Impl();
- else if ( m_nAspect == embed::Aspects::MSOLE_ICON )
- m_pObject->OnIconChanged_Impl();
- }
- }
- catch( uno::Exception& )
- {
- // ignore all the errors
- }
- }
-}
-
-MainThreadNotificationRequest::~MainThreadNotificationRequest()
-{
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/makefile.mk b/embeddedobj/source/msole/makefile.mk
deleted file mode 100755
index 09121474b1..0000000000
--- a/embeddedobj/source/msole/makefile.mk
+++ /dev/null
@@ -1,136 +0,0 @@
-#*************************************************************************
-#
-# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
-#
-# Copyright 2000, 2010 Oracle and/or its affiliates.
-#
-# OpenOffice.org - a multi-platform office productivity suite
-#
-# This file is part of OpenOffice.org.
-#
-# 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.
-#
-# 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).
-#
-# 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.
-#
-#*************************************************************************
-
-PRJ=..$/..
-
-PRJNAME=embeddedobj
-TARGET=emboleobj
-
-
-# --- Settings -----------------------------------------------------
-
-.INCLUDE : settings.mk
-
-# .IF "$(DISABLE_ATL)"==""
-
-LIBTARGET=NO
-USE_DEFFILE=YES
-
-# --- Files --------------------------------------------------------
-
-SHL1TARGET= $(TARGET)
-
-SHL1IMPLIB= i$(TARGET)
-
-SLOFILES = \
- $(SLO)$/closepreventer.obj\
- $(SLO)$/oleregister.obj\
- $(SLO)$/xolefactory.obj\
- $(SLO)$/olepersist.obj\
- $(SLO)$/oleembed.obj\
- $(SLO)$/olevisual.obj\
- $(SLO)$/olemisc.obj\
- $(SLO)$/ownview.obj
-
-EXCEPTIONSFILES= \
- $(SLO)$/closepreventer.obj\
- $(SLO)$/oleregister.obj\
- $(SLO)$/xolefactory.obj\
- $(SLO)$/olepersist.obj\
- $(SLO)$/oleembed.obj\
- $(SLO)$/olevisual.obj\
- $(SLO)$/olemisc.obj\
- $(SLO)$/ownview.obj
-
-.IF "$(GUI)"=="WNT"
-
-SLOFILES += \
- $(SLO)$/graphconvert.obj\
- $(SLO)$/olecomponent.obj\
- $(SLO)$/olewrapclient.obj\
- $(SLO)$/xdialogcreator.obj\
- $(SLO)$/advisesink.obj
-
-EXCEPTIONSFILES += \
- $(SLO)$/graphconvert.obj\
- $(SLO)$/olecomponent.obj\
- $(SLO)$/olewrapclient.obj\
- $(SLO)$/xdialogcreator.obj\
- $(SLO)$/advisesink.obj
-
-.ENDIF
-
-SHL1OBJS= $(SLOFILES)
-
-SHL1STDLIBS=\
- $(UNOTOOLSLIB)\
- $(SALLIB)\
- $(CPPULIB)\
- $(CPPUHELPERLIB)\
- $(COMPHELPERLIB)\
- $(TOOLSLIB)
-
-
-.IF "$(GUI)"=="WNT"
-.IF "$(COM)"=="GCC"
-EMBOBJLIB=-lembobj
-.ELSE
-EMBOBJLIB=iembobj.lib
-.ENDIF
-
-SHL1STDLIBS+=\
- $(EMBOBJLIB)\
- $(OLE32LIB)\
- $(GDI32LIB)\
- $(UUIDLIB)\
- $(OLEAUT32LIB)
-
-DEF1EXPORTFILE= exports.dxp
-
-.ENDIF
-
-
-SHL1DEF= $(MISC)$/$(SHL1TARGET).def
-
-DEF1NAME= $(SHL1TARGET)
-
-# .ENDIF
-# --- Targets -------------------------------------------------------
-
-.INCLUDE : target.mk
-
-ALLTAR : $(MISC)/emboleobj.component
-
-.IF "$(OS)" == "WNT"
-my_platform = .windows
-.END
-
-$(MISC)/emboleobj.component .ERRREMOVE : $(SOLARENV)/bin/createcomponent.xslt \
- emboleobj.component
- $(XSLTPROC) --nonet --stringparam uri \
- '$(COMPONENTPREFIX_BASIS_NATIVE)$(SHL1TARGETN:f)' -o $@ \
- $(SOLARENV)/bin/createcomponent.xslt emboleobj$(my_platform).component
diff --git a/embeddedobj/source/msole/mtnotification.hxx b/embeddedobj/source/msole/mtnotification.hxx
deleted file mode 100644
index d64a9bd28b..0000000000
--- a/embeddedobj/source/msole/mtnotification.hxx
+++ /dev/null
@@ -1,57 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/embed/XEmbeddedObject.hpp>
-#include <com/sun/star/awt/XCallback.hpp>
-#include <cppuhelper/implbase1.hxx>
-
-#include <rtl/ref.hxx>
-
-class OleEmbeddedObject;
-
-#define OLECOMP_ONVIEWCHANGE 1
-#define OLECOMP_ONCLOSE 2
-
-class MainThreadNotificationRequest : public cppu::WeakImplHelper1< com::sun::star::awt::XCallback >
-{
- OleEmbeddedObject* m_pObject;
- ::com::sun::star::uno::WeakReference< ::com::sun::star::embed::XEmbeddedObject > m_xObject;
-
- sal_uInt16 m_nNotificationType;
- sal_uInt32 m_nAspect;
-
-public:
- virtual void SAL_CALL notify (const com::sun::star::uno::Any& rUserData)
- throw (com::sun::star::uno::RuntimeException);
- MainThreadNotificationRequest( const ::rtl::Reference< OleEmbeddedObject >& xObj, sal_uInt16 nNotificationType, sal_uInt32 nAspect = 0 );
- ~MainThreadNotificationRequest();
-};
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/olecomponent.cxx b/embeddedobj/source/msole/olecomponent.cxx
deleted file mode 100644
index e1cf3fb91c..0000000000
--- a/embeddedobj/source/msole/olecomponent.cxx
+++ /dev/null
@@ -1,1797 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-#include <com/sun/star/lang/IllegalArgumentException.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/embed/WrongStateException.hpp>
-#include <com/sun/star/embed/UnreachableStateException.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/io/XTruncate.hpp>
-#include <com/sun/star/awt/XRequestCallback.hpp>
-
-#include <platform.h>
-#include <cppuhelper/interfacecontainer.h>
-#include <comphelper/mimeconfighelper.hxx>
-#include <comphelper/storagehelper.hxx>
-#include <osl/file.hxx>
-#include <rtl/ref.hxx>
-
-#include <olecomponent.hxx>
-#include <olewrapclient.hxx>
-#include <advisesink.hxx>
-#include <oleembobj.hxx>
-#include <mtnotification.hxx>
-
-using namespace ::com::sun::star;
-using namespace ::comphelper;
-#define MAX_ENUM_ELE 20
-#define FORMATS_NUM 3
-
-// ============ class ComSmart =====================
-namespace {
-
-template< class T > class ComSmart
-{
- T* m_pInterface;
-
- void OwnRelease()
- {
- if ( m_pInterface )
- {
- T* pInterface = m_pInterface;
- m_pInterface = NULL;
- pInterface->Release();
- }
- }
-
-public:
- ComSmart()
- : m_pInterface( NULL )
- {}
-
- ComSmart( const ComSmart<T>& rObj )
- : m_pInterface( rObj.m_pInterface )
- {
- if ( m_pInterface != NULL )
- m_pInterface->AddRef();
- }
-
- ComSmart( T* pInterface )
- : m_pInterface( pInterface )
- {
- if ( m_pInterface != NULL )
- m_pInterface->AddRef();
- }
-
- ~ComSmart()
- {
- OwnRelease();
- }
-
- ComSmart& operator=( const ComSmart<T>& rObj )
- {
- OwnRelease();
-
- m_pInterface = rObj.m_pInterface;
-
- if ( m_pInterface != NULL )
- m_pInterface->AddRef();
-
- return *this;
- }
-
- ComSmart<T>& operator=( T* pInterface )
- {
- OwnRelease();
-
- m_pInterface = pInterface;
-
- if ( m_pInterface != NULL )
- m_pInterface->AddRef();
-
- return *this;
- }
-
- operator T*() const
- {
- return m_pInterface;
- }
-
- T& operator*() const
- {
- return *m_pInterface;
- }
-
- T** operator&()
- {
- OwnRelease();
-
- m_pInterface = NULL;
-
- return &m_pInterface;
- }
-
- T* operator->() const
- {
- return m_pInterface;
- }
-
- BOOL operator==( const ComSmart<T>& rObj ) const
- {
- return ( m_pInterface == rObj.m_pInterface );
- }
-
- BOOL operator!=( const ComSmart<T>& rObj ) const
- {
- return ( m_pInterface != rObj.m_pInterface );
- }
-
- BOOL operator==( const T* pInterface ) const
- {
- return ( m_pInterface == pInterface );
- }
-
- BOOL operator!=( const T* pInterface ) const
- {
- return ( m_pInterface != pInterface );
- }
-};
-
-}
-
-// ============ class ComSmart =====================
-
-sal_Bool ConvertBufferToFormat( void* pBuf,
- sal_uInt32 nBufSize,
- const ::rtl::OUString& aFormatShortName,
- uno::Any& aResult );
-
-::rtl::OUString GetNewTempFileURL_Impl( const uno::Reference< lang::XMultiServiceFactory >& xFactory ) throw( io::IOException );
-
-typedef ::std::vector< FORMATETC* > FormatEtcList;
-
-FORMATETC pFormatTemplates[FORMATS_NUM] = {
- { CF_ENHMETAFILE, NULL, 0, -1, TYMED_ENHMF },
- { CF_METAFILEPICT, NULL, 0, -1, TYMED_MFPICT },
- { CF_BITMAP, NULL, 0, -1, TYMED_GDI } };
-
-
-struct OleComponentNative_Impl {
- ComSmart< IUnknown > m_pObj;
- ComSmart< IOleObject > m_pOleObject;
- ComSmart< IViewObject2 > m_pViewObject2;
- ComSmart< IStorage > m_pIStorage;
- FormatEtcList m_aFormatsList;
- uno::Sequence< datatransfer::DataFlavor > m_aSupportedGraphFormats;
-
- OleComponentNative_Impl()
- {
- // TODO: Extend format list
- m_aSupportedGraphFormats.realloc( 5 );
-
- m_aSupportedGraphFormats[0] = datatransfer::DataFlavor(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice-emf;windows_formatname=\"Image EMF\"" )),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Windows Enhanced Metafile" )),
- getCppuType( (const uno::Sequence< sal_Int8 >*) 0 ) );
-
- m_aSupportedGraphFormats[1] = datatransfer::DataFlavor(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice-wmf;windows_formatname=\"Image WMF\"" )),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Windows Metafile" )),
- getCppuType( (const uno::Sequence< sal_Int8 >*) 0 ) );
-
- m_aSupportedGraphFormats[2] = datatransfer::DataFlavor(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"" )),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Bitmap" )),
- getCppuType( (const uno::Sequence< sal_Int8 >*) 0 ) );
-
- m_aSupportedGraphFormats[3] = datatransfer::DataFlavor(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "image/png" )),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "PNG" )),
- getCppuType( (const uno::Sequence< sal_Int8 >*) 0 ) );
-
- m_aSupportedGraphFormats[0] = datatransfer::DataFlavor(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" )),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "GDIMetafile" )),
- getCppuType( (const uno::Sequence< sal_Int8 >*) 0 ) );
- }
-
- void AddSupportedFormat( const FORMATETC& aFormatEtc );
-
- FORMATETC* GetSupportedFormatForAspect( sal_uInt32 nRequestedAspect );
-
- sal_Bool ConvertDataForFlavor( const STGMEDIUM& aMedium,
- const datatransfer::DataFlavor& aFlavor,
- uno::Any& aResult );
-
- sal_Bool GraphicalFlavor( const datatransfer::DataFlavor& aFlavor );
-
- uno::Sequence< datatransfer::DataFlavor > GetFlavorsForAspects( sal_uInt32 nSupportedAspects );
-};
-
-//----------------------------------------------
-DWORD GetAspectFromFlavor( const datatransfer::DataFlavor& aFlavor )
-{
- if ( aFlavor.MimeType.indexOf( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ";Aspect=THUMBNAIL" )) ) != -1 )
- return DVASPECT_THUMBNAIL;
- else if ( aFlavor.MimeType.indexOf( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ";Aspect=ICON" )) ) != -1 )
- return DVASPECT_ICON;
- else if ( aFlavor.MimeType.indexOf( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ";Aspect=DOCPRINT" )) ) != -1 )
- return DVASPECT_DOCPRINT;
- else
- return DVASPECT_CONTENT;
-}
-
-//----------------------------------------------
-::rtl::OUString GetFlavorSuffixFromAspect( DWORD nAsp )
-{
- ::rtl::OUString aResult;
-
- if ( nAsp == DVASPECT_THUMBNAIL )
- aResult = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ";Aspect=THUMBNAIL" ));
- else if ( nAsp == DVASPECT_ICON )
- aResult = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ";Aspect=ICON" ));
- else if ( nAsp == DVASPECT_DOCPRINT )
- aResult = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( ";Aspect=DOCPRINT" ));
-
- // no suffix for DVASPECT_CONTENT
-
- return aResult;
-}
-
-//----------------------------------------------
-HRESULT OpenIStorageFromURL_Impl( const ::rtl::OUString& aURL, IStorage** ppIStorage )
-{
- OSL_ENSURE( ppIStorage, "The pointer must not be empty!" );
-
- ::rtl::OUString aFilePath;
- if ( !ppIStorage || ::osl::FileBase::getSystemPathFromFileURL( aURL, aFilePath ) != ::osl::FileBase::E_None )
- throw uno::RuntimeException(); // TODO: something dangerous happend
-
- return StgOpenStorage( reinterpret_cast<LPCWSTR>(aFilePath.getStr()),
- NULL,
- STGM_READWRITE | STGM_TRANSACTED, // | STGM_DELETEONRELEASE,
- NULL,
- 0,
- ppIStorage );
-}
-
-//----------------------------------------------
-sal_Bool OleComponentNative_Impl::ConvertDataForFlavor( const STGMEDIUM& aMedium,
- const datatransfer::DataFlavor& aFlavor,
- uno::Any& aResult )
-{
- sal_Bool bAnyIsReady = sal_False;
-
- // try to convert data from Medium format to specified Flavor format
- if ( aFlavor.DataType == getCppuType( ( const uno::Sequence< sal_Int8 >* ) 0 ) )
- {
- // first the GDI-metafile must be generated
-
- unsigned char* pBuf = NULL;
- sal_uInt32 nBufSize = 0;
- ::rtl::OUString aFormat;
-
- if ( aMedium.tymed == TYMED_MFPICT ) // Win Metafile
- {
- aFormat = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/x-wmf"));
- METAFILEPICT* pMF = ( METAFILEPICT* )GlobalLock( aMedium.hMetaFilePict );
- if ( pMF )
- {
- nBufSize = GetMetaFileBitsEx( pMF->hMF, 0, NULL ) + 22;
- pBuf = new unsigned char[nBufSize];
-
-
- // TODO/LATER: the unit size must be calculated correctly
- *( (long* )pBuf ) = 0x9ac6cdd7L;
- *( (short* )( pBuf+6 )) = ( SHORT ) 0;
- *( (short* )( pBuf+8 )) = ( SHORT ) 0;
- *( (short* )( pBuf+10 )) = ( SHORT ) pMF->xExt;
- *( (short* )( pBuf+12 )) = ( SHORT ) pMF->yExt;
- *( (short* )( pBuf+14 )) = ( USHORT ) 2540;
-
-
- if ( nBufSize && nBufSize == GetMetaFileBitsEx( pMF->hMF, nBufSize - 22, pBuf + 22 ) )
- {
- if ( aFlavor.MimeType.matchAsciiL( "application/x-openoffice-wmf;windows_formatname=\"Image WMF\"", 57 ) )
- {
- aResult <<= uno::Sequence< sal_Int8 >( ( sal_Int8* )pBuf, nBufSize );
- bAnyIsReady = sal_True;
- }
- }
-
- GlobalUnlock( aMedium.hMetaFilePict );
- }
- }
- else if ( aMedium.tymed == TYMED_ENHMF ) // Enh Metafile
- {
- aFormat = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/x-emf"));
- nBufSize = GetEnhMetaFileBits( aMedium.hEnhMetaFile, 0, NULL );
- pBuf = new unsigned char[nBufSize];
- if ( nBufSize && nBufSize == GetEnhMetaFileBits( aMedium.hEnhMetaFile, nBufSize, pBuf ) )
- {
- if ( aFlavor.MimeType.matchAsciiL( "application/x-openoffice-emf;windows_formatname=\"Image EMF\"", 57 ) )
- {
- aResult <<= uno::Sequence< sal_Int8 >( ( sal_Int8* )pBuf, nBufSize );
- bAnyIsReady = sal_True;
- }
- }
- }
- else if ( aMedium.tymed == TYMED_GDI ) // Bitmap
- {
- aFormat = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("image/x-MS-bmp"));
- nBufSize = GetBitmapBits( aMedium.hBitmap, 0, NULL );
- pBuf = new unsigned char[nBufSize];
- if ( nBufSize && nBufSize == sal::static_int_cast< ULONG >( GetBitmapBits( aMedium.hBitmap, nBufSize, pBuf ) ) )
- {
- if ( aFlavor.MimeType.matchAsciiL( "application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"", 54 ) )
- {
- aResult <<= uno::Sequence< sal_Int8 >( ( sal_Int8* )pBuf, nBufSize );
- bAnyIsReady = sal_True;
- }
- }
- }
-
- if ( pBuf && !bAnyIsReady )
- {
- for ( sal_Int32 nInd = 0; nInd < m_aSupportedGraphFormats.getLength(); nInd++ )
- if ( aFlavor.MimeType.match( m_aSupportedGraphFormats[nInd].MimeType )
- && aFlavor.DataType == m_aSupportedGraphFormats[nInd].DataType
- && aFlavor.DataType == getCppuType( (const uno::Sequence< sal_Int8 >*) 0 ) )
- {
- bAnyIsReady = ConvertBufferToFormat( ( void* )pBuf, nBufSize, aFormat, aResult );
- break;
- }
- }
-
- delete[] pBuf;
- }
-
- return bAnyIsReady;
-}
-
-//----------------------------------------------
-sal_Bool OleComponentNative_Impl::GraphicalFlavor( const datatransfer::DataFlavor& aFlavor )
-{
- // Actually all the required graphical formats must be supported
- for ( sal_Int32 nInd = 0; nInd < m_aSupportedGraphFormats.getLength(); nInd++ )
- if ( aFlavor.MimeType.match( m_aSupportedGraphFormats[nInd].MimeType )
- && aFlavor.DataType == m_aSupportedGraphFormats[nInd].DataType )
- return sal_True;
-
- return sal_False;
-}
-
-//----------------------------------------------
-sal_Bool GetClassIDFromSequence_Impl( uno::Sequence< sal_Int8 > aSeq, CLSID& aResult )
-{
- if ( aSeq.getLength() == 16 )
- {
- aResult.Data1 = ( ( ( ( ( ( sal_uInt8 )aSeq[0] << 8 ) + ( sal_uInt8 )aSeq[1] ) << 8 ) + ( sal_uInt8 )aSeq[2] ) << 8 ) + ( sal_uInt8 )aSeq[3];
- aResult.Data2 = ( ( sal_uInt8 )aSeq[4] << 8 ) + ( sal_uInt8 )aSeq[5];
- aResult.Data3 = ( ( sal_uInt8 )aSeq[6] << 8 ) + ( sal_uInt8 )aSeq[7];
- for( int nInd = 0; nInd < 8; nInd++ )
- aResult.Data4[nInd] = ( sal_uInt8 )aSeq[nInd+8];
-
- return sal_True;
- }
-
- return sal_False;
-}
-
-//----------------------------------------------
-::rtl::OUString WinAccToVcl_Impl( const sal_Unicode* pStr )
-{
- ::rtl::OUString aResult;
-
- if( pStr )
- {
- while ( *pStr )
- {
- if ( *pStr == '&' )
- {
- aResult += ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "~" ));
- while( *( ++pStr ) == '&' );
- }
- else
- {
- aResult += ::rtl::OUString( pStr, 1 );
- pStr++;
- }
- }
- }
-
- return aResult;
-}
-
-//----------------------------------------------
-OleComponent::OleComponent( const uno::Reference< lang::XMultiServiceFactory >& xFactory, OleEmbeddedObject* pUnoOleObject )
-: m_pInterfaceContainer( NULL )
-, m_bDisposed( sal_False )
-, m_bModified( sal_False )
-, m_pNativeImpl( new OleComponentNative_Impl() )
-, m_xFactory( xFactory )
-, m_pOleWrapClientSite( NULL )
-, m_pImplAdviseSink( NULL )
-, m_pUnoOleObject( pUnoOleObject )
-, m_nOLEMiscFlags( 0 )
-, m_nAdvConn( 0 )
-, m_bOleInitialized( sal_False )
-, m_bWorkaroundActive( sal_False )
-{
- OSL_ENSURE( m_pUnoOleObject, "No owner object is provided!" );
-
- HRESULT hr = OleInitialize( NULL );
- OSL_ENSURE( hr == S_OK || hr == S_FALSE, "The ole can not be successfuly initialized\n" );
- if ( hr == S_OK || hr == S_FALSE )
- m_bOleInitialized = sal_True;
-
- m_pOleWrapClientSite = new OleWrapperClientSite( ( OleComponent* )this );
- m_pOleWrapClientSite->AddRef();
-
- m_pImplAdviseSink = new OleWrapperAdviseSink( ( OleComponent* )this );
- m_pImplAdviseSink->AddRef();
-
-}
-
-//----------------------------------------------
-OleComponent::~OleComponent()
-{
- OSL_ENSURE( !m_pOleWrapClientSite && !m_pImplAdviseSink && !m_pInterfaceContainer && !m_bOleInitialized,
- "The object was not closed successfully! DISASTER is possible!" );
-
- if ( m_pOleWrapClientSite || m_pImplAdviseSink || m_pInterfaceContainer || m_bOleInitialized )
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- m_refCount++;
- try {
- Dispose();
- } catch( uno::Exception& ) {}
- }
-
- for ( FormatEtcList::iterator aIter = m_pNativeImpl->m_aFormatsList.begin();
- aIter != m_pNativeImpl->m_aFormatsList.end();
- ++aIter )
- {
- delete (*aIter);
- (*aIter) = NULL;
- }
- m_pNativeImpl->m_aFormatsList.clear();
-
- delete m_pNativeImpl;
-}
-
-//----------------------------------------------
-void OleComponentNative_Impl::AddSupportedFormat( const FORMATETC& aFormatEtc )
-{
- FORMATETC* pFormatToInsert = new FORMATETC( aFormatEtc );
- m_aFormatsList.push_back( pFormatToInsert );
-}
-
-//----------------------------------------------
-FORMATETC* OleComponentNative_Impl::GetSupportedFormatForAspect( sal_uInt32 nRequestedAspect )
-{
- for ( FormatEtcList::iterator aIter = m_aFormatsList.begin();
- aIter != m_aFormatsList.end();
- ++aIter )
- if ( (*aIter) && (*aIter)->dwAspect == nRequestedAspect )
- return (*aIter);
-
- return NULL;
-}
-
-//----------------------------------------------
-void OleComponent::Dispose()
-{
- // the mutex must be locked before this method is called
- if ( m_bDisposed )
- return;
-
- CloseObject();
-
- if ( m_pOleWrapClientSite )
- {
- m_pOleWrapClientSite->disconnectOleComponent();
- m_pOleWrapClientSite->Release();
- m_pOleWrapClientSite = NULL;
- }
-
- if ( m_pImplAdviseSink )
- {
- m_pImplAdviseSink->disconnectOleComponent();
- m_pImplAdviseSink->Release();
- m_pImplAdviseSink = NULL;
- }
-
- if ( m_pInterfaceContainer )
- {
- lang::EventObject aEvent( static_cast< ::cppu::OWeakObject* >( this ) );
- m_pInterfaceContainer->disposeAndClear( aEvent );
-
- delete m_pInterfaceContainer;
- m_pInterfaceContainer = NULL;
- }
-
- if ( m_bOleInitialized )
- {
- // since the disposing can happen not only from main thread but also from a clipboard
- // the deinitialization might lead to a disaster, SO7 does not deinitialize OLE at all
- // so currently the same approach is selected as workaround
- // OleUninitialize();
- m_bOleInitialized = sal_False;
- }
-
- m_bDisposed = sal_True;
-}
-
-//----------------------------------------------
-void OleComponent::disconnectEmbeddedObject()
-{
- // must not be called from destructor of UNO OLE object!!!
- osl::MutexGuard aGuard( m_aMutex );
- m_pUnoOleObject = NULL;
-}
-
-//----------------------------------------------
-void OleComponent::CreateNewIStorage_Impl()
-{
- // TODO: in future a global memory could be used instead of file.
-
- // write the stream to the temporary file
- ::rtl::OUString aTempURL;
-
- OSL_ENSURE( m_pUnoOleObject, "Unexpected object absence!" );
- if ( m_pUnoOleObject )
- aTempURL = m_pUnoOleObject->CreateTempURLEmpty_Impl();
- else
- aTempURL = GetNewTempFileURL_Impl( m_xFactory );
-
- if ( !aTempURL.getLength() )
- throw uno::RuntimeException(); // TODO
-
- // open an IStorage based on the temporary file
- ::rtl::OUString aTempFilePath;
- if ( ::osl::FileBase::getSystemPathFromFileURL( aTempURL, aTempFilePath ) != ::osl::FileBase::E_None )
- throw uno::RuntimeException(); // TODO: something dangerous happend
-
- HRESULT hr = StgCreateDocfile( reinterpret_cast<LPCWSTR>(aTempFilePath.getStr()), STGM_CREATE | STGM_READWRITE | STGM_TRANSACTED | STGM_DELETEONRELEASE, 0, &m_pNativeImpl->m_pIStorage );
- if ( FAILED( hr ) || !m_pNativeImpl->m_pIStorage )
- throw io::IOException(); // TODO: transport error code?
-}
-
-//----------------------------------------------
-uno::Sequence< datatransfer::DataFlavor > OleComponentNative_Impl::GetFlavorsForAspects( sal_uInt32 nSupportedAspects )
-{
- uno::Sequence< datatransfer::DataFlavor > aResult;
- for ( sal_uInt32 nAsp = 1; nAsp <= 8; nAsp *= 2 )
- if ( ( nSupportedAspects & nAsp ) == nAsp )
- {
- ::rtl::OUString aAspectSuffix = GetFlavorSuffixFromAspect( nAsp );
-
- sal_Int32 nLength = aResult.getLength();
- aResult.realloc( nLength + m_aSupportedGraphFormats.getLength() );
-
- for ( sal_Int32 nInd = 0; nInd < m_aSupportedGraphFormats.getLength(); nInd++ )
- {
- aResult[nLength + nInd].MimeType = m_aSupportedGraphFormats[nInd].MimeType + aAspectSuffix;
- aResult[nLength + nInd].HumanPresentableName = m_aSupportedGraphFormats[nInd].HumanPresentableName;
- aResult[nLength + nInd].DataType = m_aSupportedGraphFormats[nInd].DataType;
- }
- }
-
- return aResult;
-}
-
-//----------------------------------------------
-void OleComponent::RetrieveObjectDataFlavors_Impl()
-{
- if ( !m_pNativeImpl->m_pOleObject )
- throw embed::WrongStateException(); // TODO: the object is in wrong state
-
- if ( !m_aDataFlavors.getLength() )
- {
- ComSmart< IDataObject > pDataObject;
- HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IDataObject, (void**)&pDataObject );
- if ( SUCCEEDED( hr ) && pDataObject )
- {
- ComSmart< IEnumFORMATETC > pFormatEnum;
- hr = pDataObject->EnumFormatEtc( DATADIR_GET, &pFormatEnum );
- if ( SUCCEEDED( hr ) && pFormatEnum )
- {
- FORMATETC pElem[ MAX_ENUM_ELE ];
- ULONG nNum = 0;
-
- // if it is possible to retrieve at least one supported graphical format for an aspect
- // this format can be converted to other supported formats
- sal_uInt32 nSupportedAspects = 0;
- do
- {
- HRESULT hr = pFormatEnum->Next( MAX_ENUM_ELE, pElem, &nNum );
- if( hr == S_OK || hr == S_FALSE )
- {
- for( sal_uInt32 nInd = 0; nInd < FORMATS_NUM; nInd++ )
- {
- if ( pElem[nInd].cfFormat == pFormatTemplates[nInd].cfFormat
- && pElem[nInd].tymed == pFormatTemplates[nInd].tymed )
- nSupportedAspects |= pElem[nInd].dwAspect;
- }
- }
- else
- break;
- }
- while( nNum == MAX_ENUM_ELE );
-
- m_aDataFlavors = m_pNativeImpl->GetFlavorsForAspects( nSupportedAspects );
- }
- }
-
- if ( !m_aDataFlavors.getLength() )
- {
- // TODO:
- // for any reason the object could not provide this information
- // try to get access to the cached representation
- }
- }
-}
-
-//----------------------------------------------
-sal_Bool OleComponent::InitializeObject_Impl()
-// There will be no static objects!
-{
- if ( !m_pNativeImpl->m_pObj )
- return sal_False;
-
- // the linked object will be detected here
- ComSmart< IOleLink > pOleLink;
- HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IOleLink, (void**)&pOleLink );
- OSL_ENSURE( m_pUnoOleObject, "Unexpected object absence!" );
- if ( m_pUnoOleObject )
- m_pUnoOleObject->SetObjectIsLink_Impl( sal_Bool( pOleLink != NULL ) );
-
-
- hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IViewObject2, (void**)&m_pNativeImpl->m_pViewObject2 );
- if ( FAILED( hr ) || !m_pNativeImpl->m_pViewObject2 )
- return sal_False;
-
-
- // remove all the caches
- IOleCache* pIOleCache = NULL;
- if ( SUCCEEDED( m_pNativeImpl->m_pObj->QueryInterface( IID_IOleCache, (void**)&pIOleCache ) ) && pIOleCache )
- {
- IEnumSTATDATA* pEnumSD = NULL;
- HRESULT hr = pIOleCache->EnumCache( &pEnumSD );
-
- if ( SUCCEEDED( hr ) && pEnumSD )
- {
- pEnumSD->Reset();
- STATDATA aSD;
- DWORD nNum;
- while( SUCCEEDED( pEnumSD->Next( 1, &aSD, &nNum ) ) && nNum == 1 )
- hr = pIOleCache->Uncache( aSD.dwConnection );
- }
-
- // No IDataObject implementation, caching must be used instead
- DWORD nConn;
- FORMATETC aFormat = { 0, 0, DVASPECT_CONTENT, -1, TYMED_MFPICT };
- hr = pIOleCache->Cache( &aFormat, ADVFCACHE_ONSAVE, &nConn );
-
- pIOleCache->Release();
- pIOleCache = NULL;
- }
-
- hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IOleObject, (void**)&m_pNativeImpl->m_pOleObject );
- if ( FAILED( hr ) || !m_pNativeImpl->m_pOleObject )
- return sal_False; // Static objects are not supported, they should be inserted as graphics
-
- m_pNativeImpl->m_pOleObject->GetMiscStatus( DVASPECT_CONTENT, ( DWORD* )&m_nOLEMiscFlags );
- // TODO: use other misc flags also
- // the object should have drawable aspect even in case it supports only iconic representation
- // if ( m_nOLEMiscFlags & OLEMISC_ONLYICONIC )
-
- m_pNativeImpl->m_pOleObject->SetClientSite( m_pOleWrapClientSite );
-
- // the only need in this registration is workaround for close notification
- m_pNativeImpl->m_pOleObject->Advise( m_pImplAdviseSink, ( DWORD* )&m_nAdvConn );
- m_pNativeImpl->m_pViewObject2->SetAdvise( DVASPECT_CONTENT, 0, m_pImplAdviseSink );
-
- OleSetContainedObject( m_pNativeImpl->m_pOleObject, TRUE );
-
- return sal_True;
-}
-
-//----------------------------------------------
-void OleComponent::LoadEmbeddedObject( const ::rtl::OUString& aTempURL )
-{
- if ( !aTempURL.getLength() )
- throw lang::IllegalArgumentException(); // TODO
-
- if ( m_pNativeImpl->m_pIStorage )
- throw io::IOException(); // TODO the object is already initialized or wrong initialization is done
-
- // open an IStorage based on the temporary file
- HRESULT hr = OpenIStorageFromURL_Impl( aTempURL, &m_pNativeImpl->m_pIStorage );
-
- if ( FAILED( hr ) || !m_pNativeImpl->m_pIStorage )
- throw io::IOException(); // TODO: transport error code?
-
- hr = OleLoad( m_pNativeImpl->m_pIStorage, IID_IUnknown, NULL, (void**)&m_pNativeImpl->m_pObj );
- if ( FAILED( hr ) || !m_pNativeImpl->m_pObj )
- {
- throw uno::RuntimeException();
- }
-
- if ( !InitializeObject_Impl() )
- throw uno::RuntimeException(); // TODO
-}
-
-//----------------------------------------------
-void OleComponent::CreateObjectFromClipboard()
-{
- if ( m_pNativeImpl->m_pIStorage )
- throw io::IOException(); // TODO:the object is already initialized
-
- CreateNewIStorage_Impl();
- if ( !m_pNativeImpl->m_pIStorage )
- throw uno::RuntimeException(); // TODO
-
- IDataObject * pDO = NULL;
- HRESULT hr = OleGetClipboard( &pDO );
- if( SUCCEEDED( hr ) && pDO )
- {
- hr = OleQueryCreateFromData( pDO );
- if( S_OK == GetScode( hr ) )
- {
- hr = OleCreateFromData( pDO,
- IID_IUnknown,
- OLERENDER_DRAW, // OLERENDER_FORMAT
- NULL, // &aFormat,
- NULL,
- m_pNativeImpl->m_pIStorage,
- (void**)&m_pNativeImpl->m_pObj );
- }
- else
- {
- // Static objects are not supported
- pDO->Release();
- }
- }
-
- if ( FAILED( hr ) || !m_pNativeImpl->m_pObj )
- throw uno::RuntimeException();
-
- if ( !InitializeObject_Impl() )
- throw uno::RuntimeException(); // TODO
-}
-
-//----------------------------------------------
-void OleComponent::CreateNewEmbeddedObject( const uno::Sequence< sal_Int8 >& aSeqCLSID )
-{
- CLSID aClsID;
-
- if ( !GetClassIDFromSequence_Impl( aSeqCLSID, aClsID ) )
- throw lang::IllegalArgumentException(); // TODO
-
- if ( m_pNativeImpl->m_pIStorage )
- throw io::IOException(); // TODO:the object is already initialized
-
- CreateNewIStorage_Impl();
- if ( !m_pNativeImpl->m_pIStorage )
- throw uno::RuntimeException(); // TODO
-
- // FORMATETC aFormat = { CF_METAFILEPICT, NULL, nAspect, -1, TYMED_MFPICT }; // for OLE..._DRAW should be NULL
-
- HRESULT hr = OleCreate( aClsID,
- IID_IUnknown,
- OLERENDER_DRAW, // OLERENDER_FORMAT
- NULL, // &aFormat,
- NULL,
- m_pNativeImpl->m_pIStorage,
- (void**)&m_pNativeImpl->m_pObj );
-
- if ( FAILED( hr ) || !m_pNativeImpl->m_pObj )
- throw uno::RuntimeException(); // TODO
-
- if ( !InitializeObject_Impl() )
- throw uno::RuntimeException(); // TODO
-
- // TODO: getExtent???
-}
-
-//----------------------------------------------
-void OleComponent::CreateObjectFromData( const uno::Reference< datatransfer::XTransferable >& )
-// Static objects are not supported, they should be inserted as graphics
-{
- // TODO: May be this call is useless since there are no static objects
- // and nonstatic objects will be created based on OLEstorage ( stream ).
- // ???
-
- // OleQueryCreateFromData...
-}
-
-//----------------------------------------------
-void OleComponent::CreateObjectFromFile( const ::rtl::OUString& aFileURL )
-{
- if ( m_pNativeImpl->m_pIStorage )
- throw io::IOException(); // TODO:the object is already initialized
-
- CreateNewIStorage_Impl();
- if ( !m_pNativeImpl->m_pIStorage )
- throw uno::RuntimeException(); // TODO:
-
- ::rtl::OUString aFilePath;
- if ( ::osl::FileBase::getSystemPathFromFileURL( aFileURL, aFilePath ) != ::osl::FileBase::E_None )
- throw uno::RuntimeException(); // TODO: something dangerous happend
-
- HRESULT hr = OleCreateFromFile( CLSID_NULL,
- reinterpret_cast<LPCWSTR>(aFilePath.getStr()),
- IID_IUnknown,
- OLERENDER_DRAW, // OLERENDER_FORMAT
- NULL,
- NULL,
- m_pNativeImpl->m_pIStorage,
- (void**)&m_pNativeImpl->m_pObj );
-
- if ( FAILED( hr ) || !m_pNativeImpl->m_pObj )
- throw uno::RuntimeException(); // TODO
-
- if ( !InitializeObject_Impl() )
- throw uno::RuntimeException(); // TODO
-}
-
-//----------------------------------------------
-void OleComponent::CreateLinkFromFile( const ::rtl::OUString& aFileURL )
-{
- if ( m_pNativeImpl->m_pIStorage )
- throw io::IOException(); // TODO:the object is already initialized
-
- CreateNewIStorage_Impl();
- if ( !m_pNativeImpl->m_pIStorage )
- throw uno::RuntimeException(); // TODO:
-
- ::rtl::OUString aFilePath;
- if ( ::osl::FileBase::getSystemPathFromFileURL( aFileURL, aFilePath ) != ::osl::FileBase::E_None )
- throw uno::RuntimeException(); // TODO: something dangerous happend
-
- HRESULT hr = OleCreateLinkToFile( reinterpret_cast<LPCWSTR>(aFilePath.getStr()),
- IID_IUnknown,
- OLERENDER_DRAW, // OLERENDER_FORMAT
- NULL,
- NULL,
- m_pNativeImpl->m_pIStorage,
- (void**)&m_pNativeImpl->m_pObj );
-
- if ( FAILED( hr ) || !m_pNativeImpl->m_pObj )
- throw uno::RuntimeException(); // TODO
-
- if ( !InitializeObject_Impl() )
- throw uno::RuntimeException(); // TODO
-}
-
-//----------------------------------------------
-void OleComponent::InitEmbeddedCopyOfLink( OleComponent* pOleLinkComponent )
-{
- if ( !pOleLinkComponent || !pOleLinkComponent->m_pNativeImpl->m_pObj )
- throw lang::IllegalArgumentException(); // TODO
-
- if ( m_pNativeImpl->m_pIStorage )
- throw io::IOException(); // TODO:the object is already initialized
-
- ComSmart< IDataObject > pDataObject;
- HRESULT hr = pOleLinkComponent->m_pNativeImpl->m_pObj->QueryInterface( IID_IDataObject, (void**)&pDataObject );
- if ( SUCCEEDED( hr ) && pDataObject && SUCCEEDED( OleQueryCreateFromData( pDataObject ) ) )
- {
- // the object must be already disconnected from the temporary URL
- CreateNewIStorage_Impl();
- if ( !m_pNativeImpl->m_pIStorage )
- throw uno::RuntimeException(); // TODO:
-
- hr = OleCreateFromData( pDataObject,
- IID_IUnknown,
- OLERENDER_DRAW,
- NULL,
- NULL,
- m_pNativeImpl->m_pIStorage,
- (void**)&m_pNativeImpl->m_pObj );
- }
-
- if ( !m_pNativeImpl->m_pObj )
- {
- ComSmart< IOleLink > pOleLink;
- hr = pOleLinkComponent->m_pNativeImpl->m_pObj->QueryInterface( IID_IOleLink, (void**)&pOleLink );
- if ( FAILED( hr ) || !pOleLink )
- throw io::IOException(); // TODO: the object doesn't support IOleLink
-
- ComSmart< IMoniker > pMoniker;
- hr = pOleLink->GetSourceMoniker( &pMoniker );
- if ( FAILED( hr ) || !pMoniker )
- throw io::IOException(); // TODO: can not retrieve moniker
-
- // In case of file moniker life is easy : )
- DWORD aMonType = 0;
- hr = pMoniker->IsSystemMoniker( &aMonType );
- if ( SUCCEEDED( hr ) && aMonType == MKSYS_FILEMONIKER )
- {
- ComSmart< IMalloc > pMalloc;
- CoGetMalloc( 1, &pMalloc ); // if fails there will be a memory leak
- OSL_ENSURE( pMalloc, "CoGetMalloc() failed!" );
-
- LPOLESTR pOleStr = NULL;
- hr = pOleLink->GetSourceDisplayName( &pOleStr );
- if ( SUCCEEDED( hr ) && pOleStr )
- {
- ::rtl::OUString aFilePath( ( sal_Unicode* )pOleStr );
- if ( pMalloc )
- pMalloc->Free( ( void* )pOleStr );
-
- hr = OleCreateFromFile( CLSID_NULL,
- reinterpret_cast<LPCWSTR>(aFilePath.getStr()),
- IID_IUnknown,
- OLERENDER_DRAW, // OLERENDER_FORMAT
- NULL,
- NULL,
- m_pNativeImpl->m_pIStorage,
- (void**)&m_pNativeImpl->m_pObj );
- }
- }
-
- // in case of other moniker types the only way is to get storage
- if ( !m_pNativeImpl->m_pObj )
- {
- ComSmart< IBindCtx > pBindCtx;
- hr = CreateBindCtx( 0, ( LPBC FAR* )&pBindCtx );
- if ( SUCCEEDED( hr ) && pBindCtx )
- {
- ComSmart< IStorage > pObjectStorage;
- hr = pMoniker->BindToStorage( pBindCtx, NULL, IID_IStorage, (void**)&pObjectStorage );
- if ( SUCCEEDED( hr ) && pObjectStorage )
- {
- hr = pObjectStorage->CopyTo( 0, NULL, NULL, m_pNativeImpl->m_pIStorage );
- if ( SUCCEEDED( hr ) )
- hr = OleLoad( m_pNativeImpl->m_pIStorage, IID_IUnknown, NULL, (void**)&m_pNativeImpl->m_pObj );
- }
- }
- }
- }
-
- // If object could not be created the only way is to use graphical representation
- if ( FAILED( hr ) || !m_pNativeImpl->m_pObj )
- throw uno::RuntimeException(); // TODO
-
- if ( !InitializeObject_Impl() )
- throw uno::RuntimeException(); // TODO
-}
-
-//----------------------------------------------
-void OleComponent::RunObject()
-{
- OSL_ENSURE( m_pNativeImpl->m_pOleObject, "The pointer can not be set to NULL here!\n" );
- if ( !m_pNativeImpl->m_pOleObject )
- throw embed::WrongStateException(); // TODO: the object is in wrong state
-
- if ( !OleIsRunning( m_pNativeImpl->m_pOleObject ) )
- {
- HRESULT hr = S_OK;
- try
- {
- hr = OleRun( m_pNativeImpl->m_pObj );
- }
- catch( ... )
- {
- int i = 0;
- i++;
- }
-
- if ( FAILED( hr ) )
- {
- if ( hr == REGDB_E_CLASSNOTREG )
- throw embed::UnreachableStateException(); // the object server is not installed
- else
- throw io::IOException();
- }
- }
-}
-
-//----------------------------------------------
-awt::Size OleComponent::CalculateWithFactor( const awt::Size& aSize,
- const awt::Size& aMultiplier,
- const awt::Size& aDivisor )
-{
- awt::Size aResult;
-
- sal_Int64 nWidth = (sal_Int64)aSize.Width * (sal_Int64)aMultiplier.Width / (sal_Int64)aDivisor.Width;
- sal_Int64 nHeight = (sal_Int64)aSize.Height * (sal_Int64)aMultiplier.Height / (sal_Int64)aDivisor.Height;
- OSL_ENSURE( nWidth < SAL_MAX_INT32 && nWidth > SAL_MIN_INT32
- && nHeight < SAL_MAX_INT32 && nHeight > SAL_MIN_INT32,
- "Unacceptable result size!" );
-
- aResult.Width = (sal_Int32)nWidth;
- aResult.Height = (sal_Int32)nHeight;
-
- return aResult;
-}
-
-//----------------------------------------------
-void OleComponent::CloseObject()
-{
- if ( m_pNativeImpl->m_pOleObject && OleIsRunning( m_pNativeImpl->m_pOleObject ) )
- m_pNativeImpl->m_pOleObject->Close( OLECLOSE_NOSAVE ); // must be saved before
-}
-
-//----------------------------------------------
-uno::Sequence< embed::VerbDescriptor > OleComponent::GetVerbList()
-{
- if ( !m_pNativeImpl->m_pOleObject )
- throw embed::WrongStateException(); // TODO: the object is in wrong state
-
- if( !m_aVerbList.getLength() )
- {
- ComSmart< IEnumOLEVERB > pEnum;
- if( SUCCEEDED( m_pNativeImpl->m_pOleObject->EnumVerbs( &pEnum ) ) )
- {
- OLEVERB szEle[ MAX_ENUM_ELE ];
- ULONG nNum = 0;
- sal_Int32 nSeqSize = 0;
-
- do
- {
- HRESULT hr = pEnum->Next( MAX_ENUM_ELE, szEle, &nNum );
- if( hr == S_OK || hr == S_FALSE )
- {
- m_aVerbList.realloc( nSeqSize += nNum );
- for( sal_uInt32 nInd = 0; nInd < nNum; nInd++ )
- {
- m_aVerbList[nSeqSize-nNum+nInd].VerbID = szEle[ nInd ].lVerb;
- m_aVerbList[nSeqSize-nNum+nInd].VerbName = WinAccToVcl_Impl( reinterpret_cast<const sal_Unicode*>(szEle[ nInd ].lpszVerbName) );
- m_aVerbList[nSeqSize-nNum+nInd].VerbFlags = szEle[ nInd ].fuFlags;
- m_aVerbList[nSeqSize-nNum+nInd].VerbAttributes = szEle[ nInd ].grfAttribs;
- }
- }
- else
- break;
- }
- while( nNum == MAX_ENUM_ELE );
- }
- }
-
- return m_aVerbList;
-}
-
-//----------------------------------------------
-void OleComponent::ExecuteVerb( sal_Int32 nVerbID )
-{
- if ( !m_pNativeImpl->m_pOleObject )
- throw embed::WrongStateException(); // TODO
-
- HRESULT hr = OleRun( m_pNativeImpl->m_pOleObject );
- if ( FAILED( hr ) )
- throw io::IOException(); // TODO: a specific exception that transport error code can be thrown here
-
- // TODO: probably extents should be set here and stored in aRect
- // TODO: probably the parent window also should be set
- hr = m_pNativeImpl->m_pOleObject->DoVerb( nVerbID, NULL, m_pOleWrapClientSite, 0, NULL, NULL );
-
- if ( FAILED( hr ) )
- throw io::IOException(); // TODO
-
- // TODO/LATER: the real names should be used here
- m_pNativeImpl->m_pOleObject->SetHostNames( L"app name", L"untitled" );
-}
-
-//----------------------------------------------
-void OleComponent::SetHostName( const ::rtl::OUString&,
- const ::rtl::OUString& )
-{
- if ( !m_pNativeImpl->m_pOleObject )
- throw embed::WrongStateException(); // TODO: the object is in wrong state
-
- // TODO: use aContName and aEmbDocName in m_pNativeImpl->m_pOleObject->SetHostNames()
-}
-
-//----------------------------------------------
-void OleComponent::SetExtent( const awt::Size& aVisAreaSize, sal_Int64 nAspect )
-{
- if ( !m_pNativeImpl->m_pOleObject )
- throw embed::WrongStateException(); // TODO: the object is in wrong state
-
- DWORD nMSAspect = ( DWORD )nAspect; // first 32 bits are for MS aspects
-
- SIZEL aSize = { aVisAreaSize.Width, aVisAreaSize.Height };
- HRESULT hr = m_pNativeImpl->m_pOleObject->SetExtent( nMSAspect, &aSize );
-
- if ( FAILED( hr ) )
- {
- // TODO/LATER: is it correct? In future user code probably should be ready for the exception.
- // if the object is running but not activated, RPC_E_SERVER_DIED error code is returned by OLE package
- // in this case just do nothing
- // Also Visio returns E_FAIL on resize if it is in running state
- // if ( hr != RPC_E_SERVER_DIED )
- throw io::IOException(); // TODO
- }
-}
-
-//----------------------------------------------
-awt::Size OleComponent::GetExtent( sal_Int64 nAspect )
-{
- if ( !m_pNativeImpl->m_pOleObject )
- throw embed::WrongStateException(); // TODO: the object is in wrong state
-
- DWORD nMSAspect = ( DWORD )nAspect; // first 32 bits are for MS aspects
- awt::Size aSize;
- sal_Bool bGotSize = sal_False;
-
- if ( nMSAspect == DVASPECT_CONTENT )
- {
- // Try to get the size from the replacement image first
- ComSmart< IDataObject > pDataObject;
- HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IDataObject, (void**)&pDataObject );
- if ( SUCCEEDED( hr ) || pDataObject )
- {
- STGMEDIUM aMedium;
- FORMATETC aFormat = pFormatTemplates[1]; // use windows metafile format
- aFormat.dwAspect = nMSAspect;
-
- hr = pDataObject->GetData( &aFormat, &aMedium );
- if ( SUCCEEDED( hr ) && aMedium.tymed == TYMED_MFPICT ) // Win Metafile
- {
- METAFILEPICT* pMF = ( METAFILEPICT* )GlobalLock( aMedium.hMetaFilePict );
- if ( pMF )
- {
- // the object uses 0.01 mm as unit, so the metafile size should be converted to object unit
- sal_Int64 nMult = 1;
- sal_Int64 nDiv = 1;
- switch( pMF->mm )
- {
- case MM_HIENGLISH:
- nMult = 254;
- nDiv = 100;
- break;
-
- case MM_LOENGLISH:
- nMult = 254;
- nDiv = 10;
- break;
-
- case MM_LOMETRIC:
- nMult = 10;
- break;
-
- case MM_TWIPS:
- nMult = 254;
- nDiv = 144;
- break;
-
- case MM_ISOTROPIC:
- case MM_ANISOTROPIC:
- case MM_HIMETRIC:
- // do nothing
- break;
- }
-
- sal_Int64 nX = ( (sal_Int64)abs( pMF->xExt ) ) * nMult / nDiv;
- sal_Int64 nY = ( (sal_Int64)abs( pMF->yExt ) ) * nMult / nDiv;
- if ( nX < SAL_MAX_INT32 && nY < SAL_MAX_INT32 )
- {
- aSize.Width = ( sal_Int32 )nX;
- aSize.Height = ( sal_Int32 )nY;
- bGotSize = sal_True;
- }
- else
- OSL_FAIL( "Unexpected size is provided!" );
- }
- }
- }
- }
-
- if ( !bGotSize )
- throw lang::IllegalArgumentException();
-
- return aSize;
-}
-
-//----------------------------------------------
-awt::Size OleComponent::GetCachedExtent( sal_Int64 nAspect )
-{
- if ( !m_pNativeImpl->m_pOleObject )
- throw embed::WrongStateException(); // TODO: the object is in wrong state
-
- DWORD nMSAspect = ( DWORD )nAspect; // first 32 bits are for MS aspects
- SIZEL aSize;
-
- HRESULT hr = m_pNativeImpl->m_pViewObject2->GetExtent( nMSAspect, -1, NULL, &aSize );
-
- if ( FAILED( hr ) )
- {
- // TODO/LATER: is it correct?
- // if there is no appropriate cache for the aspect, OLE_E_BLANK error code is returned
- // if ( hr == OLE_E_BLANK )
- // throw lang::IllegalArgumentException();
- //else
- // throw io::IOException(); // TODO
-
- throw lang::IllegalArgumentException();
- }
-
- return awt::Size( aSize.cx, aSize.cy );
-}
-
-//----------------------------------------------
-awt::Size OleComponent::GetReccomendedExtent( sal_Int64 nAspect )
-{
- if ( !m_pNativeImpl->m_pOleObject )
- throw embed::WrongStateException(); // TODO: the object is in wrong state
-
- DWORD nMSAspect = ( DWORD )nAspect; // first 32 bits are for MS aspects
- SIZEL aSize;
- HRESULT hr = m_pNativeImpl->m_pOleObject->GetExtent( nMSAspect, &aSize );
- if ( FAILED( hr ) )
- throw lang::IllegalArgumentException();
-
- return awt::Size( aSize.cx, aSize.cy );
-}
-
-//----------------------------------------------
-sal_Int64 OleComponent::GetMiscStatus( sal_Int64 nAspect )
-{
- if ( !m_pNativeImpl->m_pOleObject )
- throw embed::WrongStateException(); // TODO: the object is in wrong state
-
- sal_uInt32 nResult;
- m_pNativeImpl->m_pOleObject->GetMiscStatus( ( DWORD )nAspect, ( DWORD* )&nResult );
- return ( sal_Int64 )nResult; // first 32 bits are for MS flags
-}
-
-//----------------------------------------------
-uno::Sequence< sal_Int8 > OleComponent::GetCLSID()
-{
- if ( !m_pNativeImpl->m_pOleObject )
- throw embed::WrongStateException(); // TODO: the object is in wrong state
-
- GUID aCLSID;
- HRESULT hr = m_pNativeImpl->m_pOleObject->GetUserClassID( &aCLSID );
- if ( FAILED( hr ) )
- throw io::IOException(); // TODO:
-
- return MimeConfigurationHelper::GetSequenceClassID( aCLSID.Data1, aCLSID.Data2, aCLSID.Data3,
- aCLSID.Data4[0], aCLSID.Data4[1],
- aCLSID.Data4[2], aCLSID.Data4[3],
- aCLSID.Data4[4], aCLSID.Data4[5],
- aCLSID.Data4[6], aCLSID.Data4[7] );
-}
-
-//----------------------------------------------
-sal_Bool OleComponent::IsDirty()
-{
- if ( !m_pNativeImpl->m_pOleObject )
- throw embed::WrongStateException(); // TODO: the object is in wrong state
-
- if ( IsWorkaroundActive() )
- return sal_True;
-
- ComSmart< IPersistStorage > pPersistStorage;
- HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IPersistStorage, (void**)&pPersistStorage );
- if ( FAILED( hr ) || !pPersistStorage )
- throw io::IOException(); // TODO
-
- hr = pPersistStorage->IsDirty();
- return ( hr != S_FALSE );
-}
-
-//----------------------------------------------
-void OleComponent::StoreOwnTmpIfNecessary()
-{
- if ( !m_pNativeImpl->m_pOleObject )
- throw embed::WrongStateException(); // TODO: the object is in wrong state
-
- ComSmart< IPersistStorage > pPersistStorage;
- HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IPersistStorage, (void**)&pPersistStorage );
- if ( FAILED( hr ) || !pPersistStorage )
- throw io::IOException(); // TODO
-
- if ( m_bWorkaroundActive || pPersistStorage->IsDirty() != S_FALSE )
- {
- hr = OleSave( pPersistStorage, m_pNativeImpl->m_pIStorage, TRUE );
- if ( FAILED( hr ) )
- {
- // Till now was required only for AcrobatReader7.0.8
- GUID aCLSID;
- hr = m_pNativeImpl->m_pOleObject->GetUserClassID( &aCLSID );
- if ( FAILED( hr ) )
- throw io::IOException(); // TODO
-
- hr = WriteClassStg( m_pNativeImpl->m_pIStorage, aCLSID );
- if ( FAILED( hr ) )
- throw io::IOException(); // TODO
-
- // the result of the following call is not checked because some objects, for example AcrobatReader7.0.8
- // return error even in case the saving was done correctly
- hr = pPersistStorage->Save( m_pNativeImpl->m_pIStorage, TRUE );
-
- // another workaround for AcrobatReader7.0.8 object, this object might think that it is not changed
- // when it has been created from file, although it must be saved
- m_bWorkaroundActive = sal_True;
- }
-
- hr = m_pNativeImpl->m_pIStorage->Commit( STGC_DEFAULT );
- if ( FAILED( hr ) )
- throw io::IOException(); // TODO
-
- hr = pPersistStorage->SaveCompleted( NULL );
- if ( FAILED( hr ) && hr != E_UNEXPECTED )
- throw io::IOException(); // TODO
-
- }
-}
-
-//----------------------------------------------
-sal_Bool OleComponent::SaveObject_Impl()
-{
- sal_Bool bResult = sal_False;
- OleEmbeddedObject* pLockObject = NULL;
-
- {
- osl::MutexGuard aGuard( m_aMutex );
- if ( m_pUnoOleObject )
- {
- pLockObject = m_pUnoOleObject;
- pLockObject->acquire();
- }
- }
-
- if ( pLockObject )
- {
- bResult = pLockObject->SaveObject_Impl();
- pLockObject->release();
- }
-
- return bResult;
-}
-
-//----------------------------------------------
-sal_Bool OleComponent::OnShowWindow_Impl( bool bShow )
-{
- sal_Bool bResult = sal_False;
- OleEmbeddedObject* pLockObject = NULL;
-
- {
- osl::MutexGuard aGuard( m_aMutex );
-
- if ( m_pUnoOleObject )
- {
- pLockObject = m_pUnoOleObject;
- pLockObject->acquire();
- }
- }
-
- if ( pLockObject )
- {
- bResult = pLockObject->OnShowWindow_Impl( bShow );
- pLockObject->release();
- }
-
- return bResult;
-}
-
-//----------------------------------------------
-void OleComponent::OnViewChange_Impl( sal_uInt32 dwAspect )
-{
- // TODO: check if it is enough or may be saving notifications are required for Visio2000
- ::rtl::Reference< OleEmbeddedObject > xLockObject;
-
- {
- osl::MutexGuard aGuard( m_aMutex );
- if ( m_pUnoOleObject )
- xLockObject = m_pUnoOleObject;
- }
-
- if ( xLockObject.is() )
- {
- uno::Reference < awt::XRequestCallback > xRequestCallback(
- m_xFactory->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AsyncCallback") )),
- uno::UNO_QUERY );
- xRequestCallback->addCallback( new MainThreadNotificationRequest( xLockObject, OLECOMP_ONVIEWCHANGE, dwAspect ), uno::Any() );
- }
-}
-
-//----------------------------------------------
-void OleComponent::OnClose_Impl()
-{
- ::rtl::Reference< OleEmbeddedObject > xLockObject;
-
- {
- osl::MutexGuard aGuard( m_aMutex );
- if ( m_pUnoOleObject )
- xLockObject = m_pUnoOleObject;
- }
-
- if ( xLockObject.is() )
- {
- uno::Reference < awt::XRequestCallback > xRequestCallback(
- m_xFactory->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.awt.AsyncCallback") )),
- uno::UNO_QUERY );
- xRequestCallback->addCallback( new MainThreadNotificationRequest( xLockObject, OLECOMP_ONCLOSE ), uno::Any() );
- }
-}
-
-// XCloseable
-//----------------------------------------------
-void SAL_CALL OleComponent::close( sal_Bool bDeliverOwnership )
- throw ( util::CloseVetoException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >( this ) );
- lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
-
- if ( m_pInterfaceContainer )
- {
- ::cppu::OInterfaceContainerHelper* pContainer =
- m_pInterfaceContainer->getContainer( ::getCppuType( ( const uno::Reference< util::XCloseListener >* ) NULL ) );
- if ( pContainer != NULL )
- {
- ::cppu::OInterfaceIteratorHelper pIterator( *pContainer );
- while ( pIterator.hasMoreElements() )
- {
- try
- {
- ( (util::XCloseListener* )pIterator.next() )->queryClosing( aSource, bDeliverOwnership );
- }
- catch( uno::RuntimeException& )
- {
- pIterator.remove();
- }
- }
- }
-
- pContainer = m_pInterfaceContainer->getContainer(
- ::getCppuType( ( const uno::Reference< util::XCloseListener >* ) NULL ) );
- if ( pContainer != NULL )
- {
- ::cppu::OInterfaceIteratorHelper pCloseIterator( *pContainer );
- while ( pCloseIterator.hasMoreElements() )
- {
- try
- {
- ( (util::XCloseListener* )pCloseIterator.next() )->notifyClosing( aSource );
- }
- catch( uno::RuntimeException& )
- {
- pCloseIterator.remove();
- }
- }
- }
- }
-
- Dispose();
-}
-
-//----------------------------------------------
-void SAL_CALL OleComponent::addCloseListener( const uno::Reference< util::XCloseListener >& xListener )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( !m_pInterfaceContainer )
- m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
-
- m_pInterfaceContainer->addInterface( ::getCppuType( ( const uno::Reference< util::XCloseListener >* )0 ), xListener );
-}
-
-//----------------------------------------------
-void SAL_CALL OleComponent::removeCloseListener( const uno::Reference< util::XCloseListener >& xListener )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_pInterfaceContainer )
- m_pInterfaceContainer->removeInterface( ::getCppuType( ( const uno::Reference< util::XCloseListener >* )0 ),
- xListener );
-}
-
-// XTransferable
-//----------------------------------------------
-uno::Any SAL_CALL OleComponent::getTransferData( const datatransfer::DataFlavor& aFlavor )
- throw ( datatransfer::UnsupportedFlavorException,
- io::IOException,
- uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( !m_pNativeImpl->m_pOleObject )
- throw embed::WrongStateException(); // TODO: the object is in wrong state
-
- uno::Any aResult;
- sal_Bool bSupportedFlavor = sal_False;
-
- if ( m_pNativeImpl->GraphicalFlavor( aFlavor ) )
- {
- DWORD nRequestedAspect = GetAspectFromFlavor( aFlavor );
- // if own icon is set and icon aspect is requested the own icon can be returned directly
-
- ComSmart< IDataObject > pDataObject;
- HRESULT hr = m_pNativeImpl->m_pObj->QueryInterface( IID_IDataObject, (void**)&pDataObject );
- if ( FAILED( hr ) || !pDataObject )
- throw io::IOException(); // TODO: transport error code
-
- // The following optimization does not make much sence currently just because
- // only one aspect is supported, and only three formats for the aspect are supported
- // and moreover it is not guarantied that the once returned format will be supported further
- // example - i52106
- // TODO/LATER: bring the optimization back when other aspects are supported
-
- // FORMATETC* pFormatEtc = m_pNativeImpl->GetSupportedFormatForAspect( nRequestedAspect );
- // if ( pFormatEtc )
- // {
- // STGMEDIUM aMedium;
- // hr = pDataObject->GetData( pFormatEtc, &aMedium );
- // if ( SUCCEEDED( hr ) )
- // bSupportedFlavor = m_pNativeImpl->ConvertDataForFlavor( aMedium, aFlavor, aResult );
- // }
- // else
- {
- // the supported format of the application is still not found, find one
- for ( sal_Int32 nInd = 0; nInd < FORMATS_NUM; nInd++ )
- {
- STGMEDIUM aMedium;
- FORMATETC aFormat = pFormatTemplates[nInd];
- aFormat.dwAspect = nRequestedAspect;
-
- hr = pDataObject->GetData( &aFormat, &aMedium );
- if ( SUCCEEDED( hr ) )
- {
- bSupportedFlavor = m_pNativeImpl->ConvertDataForFlavor( aMedium, aFlavor, aResult );
- if ( bSupportedFlavor )
- {
- // TODO/LATER: bring the optimization back when other aspects are supported
- // m_pNativeImpl->AddSupportedFormat( aFormat );
- break;
- }
- }
- }
- }
-
- // If the replacement could not be retrieved, the cached representaion should be used
- // currently it is not necessary to retrieve it here, so it is implemented in the object itself
- }
- // TODO: Investigate if there is already the format name
- // and whether this format is really required
- else if ( aFlavor.DataType == getCppuType( ( const uno::Reference< io::XInputStream >* ) 0 )
- && aFlavor.MimeType.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "application/x-openoffice-contentstream" ) ) )
- {
- // allow to retrieve stream-representation of the object persistence
- bSupportedFlavor = sal_True;
- uno::Reference < io::XStream > xTempFileStream(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
- uno::UNO_QUERY );
-
- if ( !xTempFileStream.is() )
- throw uno::RuntimeException(); // TODO
-
- uno::Reference< io::XOutputStream > xTempOutStream = xTempFileStream->getOutputStream();
- uno::Reference< io::XInputStream > xTempInStream = xTempFileStream->getInputStream();
- if ( xTempOutStream.is() && xTempInStream.is() )
- {
- OSL_ENSURE( m_pUnoOleObject, "Unexpected object absence!" );
- if ( !m_pUnoOleObject )
- throw uno::RuntimeException();
-
- m_pUnoOleObject->StoreObjectToStream( xTempOutStream );
-
- xTempOutStream->closeOutput();
- xTempOutStream = uno::Reference< io::XOutputStream >();
- }
- else
- throw io::IOException(); // TODO:
-
- aResult <<= xTempInStream;
- }
-
- if ( !bSupportedFlavor )
- throw datatransfer::UnsupportedFlavorException();
-
- return aResult;
-}
-
-//----------------------------------------------
-uno::Sequence< datatransfer::DataFlavor > SAL_CALL OleComponent::getTransferDataFlavors()
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( !m_pNativeImpl->m_pOleObject )
- throw embed::WrongStateException(); // TODO: the object is in wrong state
-
- RetrieveObjectDataFlavors_Impl();
-
- return m_aDataFlavors;
-}
-
-//----------------------------------------------
-sal_Bool SAL_CALL OleComponent::isDataFlavorSupported( const datatransfer::DataFlavor& aFlavor )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( !m_pNativeImpl->m_pOleObject )
- throw embed::WrongStateException(); // TODO: the object is in wrong state
-
- if ( !m_aDataFlavors.getLength() )
- {
- RetrieveObjectDataFlavors_Impl();
- }
-
- for ( sal_Int32 nInd = 0; nInd < m_aDataFlavors.getLength(); nInd++ )
- if ( m_aDataFlavors[nInd].MimeType.equals( aFlavor.MimeType ) && m_aDataFlavors[nInd].DataType == aFlavor.DataType )
- return sal_True;
-
- return sal_False;
-}
-
-void SAL_CALL OleComponent::dispose() throw (::com::sun::star::uno::RuntimeException)
-{
- try
- {
- close( sal_True );
- }
- catch ( uno::Exception& )
- {
- }
-}
-
-void SAL_CALL OleComponent::addEventListener( const uno::Reference< lang::XEventListener >& xListener )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( !m_pInterfaceContainer )
- m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
-
- m_pInterfaceContainer->addInterface( ::getCppuType( ( const uno::Reference< lang::XEventListener >* )0 ), xListener );
-}
-
-//----------------------------------------------
-void SAL_CALL OleComponent::removeEventListener( const uno::Reference< lang::XEventListener >& xListener )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_pInterfaceContainer )
- m_pInterfaceContainer->removeInterface( ::getCppuType( ( const uno::Reference< lang::XEventListener >* )0 ),
- xListener );
-}
-
-sal_Int64 SAL_CALL OleComponent::getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException)
-{
- try
- {
- uno::Sequence < sal_Int8 > aCLSID = GetCLSID();
- if ( MimeConfigurationHelper::ClassIDsEqual( aIdentifier, aCLSID ) )
- return (sal_Int64) (IUnknown*) m_pNativeImpl->m_pObj;
-
- // compatibility hack for old versions: CLSID was used in wrong order (SvGlobalName order)
- sal_Int32 nLength = aIdentifier.getLength();
- if ( nLength == 16 )
- {
- for ( sal_Int32 n=8; n<16; n++ )
- if ( aIdentifier[n] != aCLSID[n] )
- return 0;
- if ( aIdentifier[7] == aCLSID[6] &&
- aIdentifier[6] == aCLSID[7] &&
- aIdentifier[5] == aCLSID[4] &&
- aIdentifier[4] == aCLSID[5] &&
- aIdentifier[3] == aCLSID[0] &&
- aIdentifier[2] == aCLSID[1] &&
- aIdentifier[1] == aCLSID[2] &&
- aIdentifier[0] == aCLSID[3] )
- return (sal_Int64) (IUnknown*) m_pNativeImpl->m_pObj;
- }
- }
- catch ( uno::Exception& )
- {
- }
-
- return 0;
-}
-
-sal_Bool SAL_CALL OleComponent::isModified() throw (::com::sun::star::uno::RuntimeException)
-{
- return m_bModified;
-}
-
-void SAL_CALL OleComponent::setModified( sal_Bool bModified )
- throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException)
-{
- m_bModified = bModified;
-
- if ( bModified && m_pInterfaceContainer )
- {
- ::cppu::OInterfaceContainerHelper* pContainer =
- m_pInterfaceContainer->getContainer( ::getCppuType( ( const uno::Reference< util::XModifyListener >* ) NULL ) );
- if ( pContainer != NULL )
- {
- ::cppu::OInterfaceIteratorHelper pIterator( *pContainer );
- while ( pIterator.hasMoreElements() )
- {
- try
- {
- lang::EventObject aEvent( (util::XModifiable*) this );
- ((util::XModifyListener*)pIterator.next())->modified( aEvent );
- }
- catch( uno::RuntimeException& )
- {
- pIterator.remove();
- }
- }
- }
- }
-}
-
-void SAL_CALL OleComponent::addModifyListener( const com::sun::star::uno::Reference < com::sun::star::util::XModifyListener >& xListener ) throw(::com::sun::star::uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( !m_pInterfaceContainer )
- m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
-
- m_pInterfaceContainer->addInterface( ::getCppuType( ( const uno::Reference< util::XModifyListener >* )0 ), xListener );
-}
-
-void SAL_CALL OleComponent::removeModifyListener( const com::sun::star::uno::Reference < com::sun::star::util::XModifyListener >& xListener) throw(::com::sun::star::uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_pInterfaceContainer )
- m_pInterfaceContainer->removeInterface( ::getCppuType( ( const uno::Reference< util::XModifyListener >* )0 ),
- xListener );
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/olecomponent.hxx b/embeddedobj/source/msole/olecomponent.hxx
deleted file mode 100644
index 00c4eb5c60..0000000000
--- a/embeddedobj/source/msole/olecomponent.hxx
+++ /dev/null
@@ -1,182 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef _INC_OLECOMPONENT_HXX_
-#define _INC_OLECOMPONENT_HXX_
-
-#include <com/sun/star/uno/Sequence.hxx>
-#include <com/sun/star/uno/Reference.hxx>
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <com/sun/star/datatransfer/XTransferable.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/embed/XOptimizedStorage.hpp>
-#include <com/sun/star/embed/VerbDescriptor.hpp>
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/awt/Size.hpp>
-#include <com/sun/star/lang/XUnoTunnel.hpp>
-#include <cppuhelper/implbase5.hxx>
-#include <com/sun/star/util/XModifiable.hpp>
-#include <com/sun/star/util/XModifyListener.hpp>
-
-#include <vector>
-
-
-namespace com { namespace sun { namespace star {
-}}}
-
-namespace cppu {
- class OMultiTypeInterfaceContainerHelper;
-}
-
-class OleWrapperClientSite;
-class OleWrapperAdviseSink;
-class OleEmbeddedObject;
-struct OleComponentNative_Impl;
-
-class OleComponent : public ::cppu::WeakImplHelper5< ::com::sun::star::util::XCloseable, ::com::sun::star::lang::XComponent,
- ::com::sun::star::lang::XUnoTunnel, ::com::sun::star::util::XModifiable,
- ::com::sun::star::datatransfer::XTransferable >
-{
- ::osl::Mutex m_aMutex;
- ::cppu::OMultiTypeInterfaceContainerHelper* m_pInterfaceContainer;
-
- sal_Bool m_bDisposed;
- sal_Bool m_bModified;
- OleComponentNative_Impl* m_pNativeImpl;
-
- OleEmbeddedObject* m_pUnoOleObject;
- OleWrapperClientSite* m_pOleWrapClientSite;
- OleWrapperAdviseSink* m_pImplAdviseSink;
-
- sal_Int32 m_nOLEMiscFlags;
- sal_Int32 m_nAdvConn;
-
- ::com::sun::star::uno::Sequence< ::com::sun::star::embed::VerbDescriptor > m_aVerbList;
- ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > m_aDataFlavors;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
-
- sal_Bool m_bOleInitialized;
-
- // specifies whether the workaround for some rare embedded objects is activated ( f.e. AcrobatReader 7.0.8 object )
- // such objects report the dirty state wrongly sometimes and do not allow to store them any time
- sal_Bool m_bWorkaroundActive;
-
- sal_Bool InitializeObject_Impl();
-
- void CreateNewIStorage_Impl();
- void RetrieveObjectDataFlavors_Impl();
- void Dispose();
-
-
-public:
- OleComponent( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& m_xFactory,
- OleEmbeddedObject* pOleObj );
-
- virtual ~OleComponent();
-
- OleComponent* createEmbeddedCopyOfLink();
-
- void disconnectEmbeddedObject();
-
- static ::com::sun::star::awt::Size CalculateWithFactor( const ::com::sun::star::awt::Size& aSize,
- const ::com::sun::star::awt::Size& aMultiplier,
- const ::com::sun::star::awt::Size& aDivisor );
-
- ::com::sun::star::awt::Size CalculateTheRealSize( const ::com::sun::star::awt::Size& aContSize, sal_Bool bUpdate );
-
- // ==== Initialization ==================================================
- void LoadEmbeddedObject( const ::rtl::OUString& aTempURL );
- void CreateObjectFromClipboard();
- void CreateNewEmbeddedObject( const ::com::sun::star::uno::Sequence< sal_Int8 >& aSeqCLSID );
- void CreateObjectFromData(
- const ::com::sun::star::uno::Reference< ::com::sun::star::datatransfer::XTransferable >& xTransfer );
- void CreateObjectFromFile( const ::rtl::OUString& aFileName );
- void CreateLinkFromFile( const ::rtl::OUString& aFileName );
- void InitEmbeddedCopyOfLink( OleComponent* pOleLinkComponent );
-
- // ======================================================================
- void RunObject(); // switch OLE object to running state
- void CloseObject(); // switch OLE object to loaded state
-
- ::com::sun::star::uno::Sequence< ::com::sun::star::embed::VerbDescriptor > GetVerbList();
-
- void ExecuteVerb( sal_Int32 nVerbID );
- void SetHostName( const ::rtl::OUString& aContName, const ::rtl::OUString& aEmbDocName );
- void SetExtent( const ::com::sun::star::awt::Size& aVisAreaSize, sal_Int64 nAspect );
-
- ::com::sun::star::awt::Size GetExtent( sal_Int64 nAspect );
- ::com::sun::star::awt::Size GetCachedExtent( sal_Int64 nAspect );
- ::com::sun::star::awt::Size GetReccomendedExtent( sal_Int64 nAspect );
-
- sal_Int64 GetMiscStatus( sal_Int64 nAspect );
-
- ::com::sun::star::uno::Sequence< sal_Int8 > GetCLSID();
-
- sal_Bool IsWorkaroundActive() { return m_bWorkaroundActive; }
- sal_Bool IsDirty();
-
- void StoreOwnTmpIfNecessary();
-
- sal_Bool SaveObject_Impl();
- sal_Bool OnShowWindow_Impl( bool bShow );
- void OnViewChange_Impl( sal_uInt32 dwAspect );
- void OnClose_Impl();
-
- // XCloseable
- virtual void SAL_CALL close( sal_Bool DeliverOwnership ) throw (::com::sun::star::util::CloseVetoException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addCloseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeCloseListener( const ::com::sun::star::uno::Reference< ::com::sun::star::util::XCloseListener >& Listener ) throw (::com::sun::star::uno::RuntimeException);
-
- // XTransferable
- virtual ::com::sun::star::uno::Any SAL_CALL getTransferData( const ::com::sun::star::datatransfer::DataFlavor& aFlavor ) throw (::com::sun::star::datatransfer::UnsupportedFlavorException, ::com::sun::star::io::IOException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::com::sun::star::datatransfer::DataFlavor > SAL_CALL getTransferDataFlavors( ) throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL isDataFlavorSupported( const ::com::sun::star::datatransfer::DataFlavor& aFlavor ) throw (::com::sun::star::uno::RuntimeException);
-
- // XComponent
- virtual void SAL_CALL dispose() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addEventListener(const com::sun::star::uno::Reference < com::sun::star::lang::XEventListener >& aListener) throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeEventListener(const com::sun::star::uno::Reference < com::sun::star::lang::XEventListener >& aListener) throw (::com::sun::star::uno::RuntimeException);
-
- // XUnoTunnel
- virtual sal_Int64 SAL_CALL getSomething( const ::com::sun::star::uno::Sequence< sal_Int8 >& aIdentifier ) throw(::com::sun::star::uno::RuntimeException) ;
-
- // XModifiable
- virtual sal_Bool SAL_CALL isModified() throw (::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL setModified( sal_Bool bModified )
- throw (::com::sun::star::beans::PropertyVetoException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL addModifyListener( const com::sun::star::uno::Reference < com::sun::star::util::XModifyListener >& xListener ) throw(::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL removeModifyListener( const com::sun::star::uno::Reference < com::sun::star::util::XModifyListener >& xListener) throw(::com::sun::star::uno::RuntimeException);
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/oleembed.cxx b/embeddedobj/source/msole/oleembed.cxx
deleted file mode 100644
index 5db0267d21..0000000000
--- a/embeddedobj/source/msole/oleembed.cxx
+++ /dev/null
@@ -1,1126 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-
-#include <oleembobj.hxx>
-#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/ElementModes.hpp>
-#include <com/sun/star/embed/EmbedUpdateModes.hpp>
-#include <com/sun/star/embed/Aspects.hpp>
-#include <com/sun/star/embed/NeedsRunningStateException.hpp>
-#include <com/sun/star/embed/StateChangeInProgressException.hpp>
-#include <com/sun/star/embed/EmbedMisc.hpp>
-#include <com/sun/star/embed/XEmbedObjectCreator.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/beans/NamedValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/frame/XLoadable.hpp>
-#include <com/sun/star/document/XStorageBasedDocument.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/system/XSystemShellExecute.hpp>
-#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
-
-#include <rtl/logfile.hxx>
-#include <cppuhelper/interfacecontainer.h>
-#include <comphelper/mimeconfighelper.hxx>
-#include <comphelper/storagehelper.hxx>
-
-
-#include <targetstatecontrol.hxx>
-
-#include <olecomponent.hxx>
-
-#include "ownview.hxx"
-
-using namespace ::com::sun::star;
-
-#ifdef WNT
-//----------------------------------------------
-void OleEmbeddedObject::SwitchComponentToRunningState_Impl()
-{
- if ( m_pOleComponent )
- {
- try
- {
- m_pOleComponent->RunObject();
- }
- catch( embed::UnreachableStateException& )
- {
- GetRidOfComponent();
- throw;
- }
- catch( embed::WrongStateException& )
- {
- GetRidOfComponent();
- throw;
- }
- }
- else
- {
- throw embed::UnreachableStateException();
- }
-}
-
-//----------------------------------------------
-uno::Sequence< sal_Int32 > OleEmbeddedObject::GetReachableStatesList_Impl(
- const uno::Sequence< embed::VerbDescriptor >& aVerbList )
-{
- uno::Sequence< sal_Int32 > aStates(2);
- aStates[0] = embed::EmbedStates::LOADED;
- aStates[1] = embed::EmbedStates::RUNNING;
- for ( sal_Int32 nInd = 0; nInd < aVerbList.getLength(); nInd++ )
- if ( aVerbList[nInd].VerbID == embed::EmbedVerbs::MS_OLEVERB_OPEN )
- {
- aStates.realloc(3);
- aStates[2] = embed::EmbedStates::ACTIVE;
- }
-
- return aStates;
-}
-
-//----------------------------------------------
-uno::Sequence< sal_Int32 > OleEmbeddedObject::GetIntermediateVerbsSequence_Impl( sal_Int32 nNewState )
-{
- OSL_ENSURE( m_nObjectState != embed::EmbedStates::LOADED, "Loaded object is switched to running state without verbs using!" );
-
- // actually there will be only one verb
- if ( m_nObjectState == embed::EmbedStates::RUNNING && nNewState == embed::EmbedStates::ACTIVE )
- {
- uno::Sequence< sal_Int32 > aVerbs( 1 );
- aVerbs[0] = embed::EmbedVerbs::MS_OLEVERB_OPEN;
- }
-
- return uno::Sequence< sal_Int32 >();
-}
-#endif
-//----------------------------------------------
-void OleEmbeddedObject::MoveListeners()
-{
- if ( m_pInterfaceContainer )
- {
- // move state change listeners
- {
- ::cppu::OInterfaceContainerHelper* pStateChangeContainer =
- m_pInterfaceContainer->getContainer( ::getCppuType( ( const uno::Reference< embed::XStateChangeListener >*) NULL ) );
- if ( pStateChangeContainer != NULL )
- {
- uno::Reference< embed::XStateChangeBroadcaster > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- ::cppu::OInterfaceIteratorHelper pIterator( *pStateChangeContainer );
- while ( pIterator.hasMoreElements() )
- {
- try
- {
- xWrappedObject->addStateChangeListener( (embed::XStateChangeListener*)pIterator.next() );
- }
- catch( uno::RuntimeException& )
- {
- pIterator.remove();
- }
- }
- }
- }
- }
-
- // move event listeners
- {
- ::cppu::OInterfaceContainerHelper* pEventContainer =
- m_pInterfaceContainer->getContainer( ::getCppuType( ( const uno::Reference< document::XEventListener >*) NULL ) );
- if ( pEventContainer != NULL )
- {
- uno::Reference< document::XEventBroadcaster > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- ::cppu::OInterfaceIteratorHelper pIterator( *pEventContainer );
- while ( pIterator.hasMoreElements() )
- {
- try
- {
- xWrappedObject->addEventListener( (document::XEventListener*)pIterator.next() );
- }
- catch( uno::RuntimeException& )
- {
- pIterator.remove();
- }
- }
- }
- }
- }
-
- // move close listeners
- {
- ::cppu::OInterfaceContainerHelper* pCloseContainer =
- m_pInterfaceContainer->getContainer( ::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) );
- if ( pCloseContainer != NULL )
- {
- uno::Reference< util::XCloseBroadcaster > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- ::cppu::OInterfaceIteratorHelper pIterator( *pCloseContainer );
- while ( pIterator.hasMoreElements() )
- {
- try
- {
- xWrappedObject->addCloseListener( (util::XCloseListener*)pIterator.next() );
- }
- catch( uno::RuntimeException& )
- {
- pIterator.remove();
- }
- }
- }
- }
- }
-
- delete m_pInterfaceContainer;
- m_pInterfaceContainer = NULL;
- }
-}
-
-//----------------------------------------------
-uno::Reference< embed::XStorage > OleEmbeddedObject::CreateTemporarySubstorage( ::rtl::OUString& o_aStorageName )
-{
- uno::Reference< embed::XStorage > xResult;
-
- for ( sal_Int32 nInd = 0; nInd < 32000 && !xResult.is(); nInd++ )
- {
- ::rtl::OUString aName = ::rtl::OUString::valueOf( nInd );
- aName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TMPSTOR" ) );
- aName += m_aEntryName;
- if ( !m_xParentStorage->hasByName( aName ) )
- {
- xResult = m_xParentStorage->openStorageElement( aName, embed::ElementModes::READWRITE );
- o_aStorageName = aName;
- }
- }
-
- if ( !xResult.is() )
- {
- o_aStorageName = ::rtl::OUString();
- throw uno::RuntimeException();
- }
-
- return xResult;
-}
-
-//----------------------------------------------
-::rtl::OUString OleEmbeddedObject::MoveToTemporarySubstream()
-{
- ::rtl::OUString aResult;
- for ( sal_Int32 nInd = 0; nInd < 32000 && !aResult.getLength(); nInd++ )
- {
- ::rtl::OUString aName = ::rtl::OUString::valueOf( nInd );
- aName += ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TMPSTREAM" ) );
- aName += m_aEntryName;
- if ( !m_xParentStorage->hasByName( aName ) )
- {
- m_xParentStorage->renameElement( m_aEntryName, aName );
- aResult = aName;
- }
- }
-
- if ( !aResult.getLength() )
- throw uno::RuntimeException();
-
- return aResult;
-}
-
-//----------------------------------------------
-sal_Bool OleEmbeddedObject::TryToConvertToOOo()
-{
- sal_Bool bResult = sal_False;
-
- ::rtl::OUString aStorageName;
- ::rtl::OUString aTmpStreamName;
- sal_Int32 nStep = 0;
-
- if ( m_pOleComponent || m_bReadOnly )
- return sal_False;
-
- try
- {
- changeState( embed::EmbedStates::LOADED );
-
- // the stream must be seekable
- uno::Reference< io::XSeekable > xSeekable( m_xObjectStream, uno::UNO_QUERY_THROW );
- xSeekable->seek( 0 );
- ::rtl::OUString aFilterName = OwnView_Impl::GetFilterNameFromExtentionAndInStream( m_xFactory, ::rtl::OUString(), m_xObjectStream->getInputStream() );
-
- // use the solution only for OOXML format currently
- if ( aFilterName.getLength()
- && ( aFilterName.equals( ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "Calc MS Excel 2007 XML" ) ) )
- || aFilterName.equals( ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "Impress MS PowerPoint 2007 XML" ) ) )
- || aFilterName.equals( ::rtl::OUString ( RTL_CONSTASCII_USTRINGPARAM( "MS Word 2007 XML" ) ) ) ) )
- {
- uno::Reference< container::XNameAccess > xFilterFactory(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.FilterFactory" ) )),
- uno::UNO_QUERY_THROW );
-
- ::rtl::OUString aDocServiceName;
- uno::Any aFilterAnyData = xFilterFactory->getByName( aFilterName );
- uno::Sequence< beans::PropertyValue > aFilterData;
- if ( aFilterAnyData >>= aFilterData )
- {
- for ( sal_Int32 nInd = 0; nInd < aFilterData.getLength(); nInd++ )
- if ( aFilterData[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "DocumentService" ) ) )
- aFilterData[nInd].Value >>= aDocServiceName;
- }
-
- if ( aDocServiceName.getLength() )
- {
- // create the model
- uno::Sequence< uno::Any > aArguments(1);
- aArguments[0] <<= beans::NamedValue( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "EmbeddedObject" ) ), uno::makeAny( (sal_Bool)sal_True ));
-
- uno::Reference< util::XCloseable > xDocument( m_xFactory->createInstanceWithArguments( aDocServiceName, aArguments ), uno::UNO_QUERY_THROW );
- uno::Reference< frame::XLoadable > xLoadable( xDocument, uno::UNO_QUERY_THROW );
- uno::Reference< document::XStorageBasedDocument > xStorDoc( xDocument, uno::UNO_QUERY_THROW );
-
- // let the model behave as embedded one
- uno::Reference< frame::XModel > xModel( xDocument, uno::UNO_QUERY_THROW );
- uno::Sequence< beans::PropertyValue > aSeq( 1 );
- aSeq[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "SetEmbedded" ));
- aSeq[0].Value <<= sal_True;
- xModel->attachResource( ::rtl::OUString(), aSeq );
-
- // load the model from the stream
- uno::Sequence< beans::PropertyValue > aArgs( 5 );
- aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "HierarchicalDocumentName" ));
- aArgs[0].Value <<= m_aEntryName;
- aArgs[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ReadOnly" ));
- aArgs[1].Value <<= sal_True;
- aArgs[2].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "FilterName" ));
- aArgs[2].Value <<= aFilterName;
- aArgs[3].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "URL" ));
- aArgs[3].Value <<= ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "private:stream" ));
- aArgs[4].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "InputStream" ));
- aArgs[4].Value <<= m_xObjectStream->getInputStream();
-
- xSeekable->seek( 0 );
- xLoadable->load( aArgs );
-
- // the model is successfuly loaded, create a new storage and store the model to the storage
- uno::Reference< embed::XStorage > xTmpStorage = CreateTemporarySubstorage( aStorageName );
- xStorDoc->storeToStorage( xTmpStorage, uno::Sequence< beans::PropertyValue >() );
- xDocument->close( sal_True );
- uno::Reference< beans::XPropertySet > xStorProps( xTmpStorage, uno::UNO_QUERY_THROW );
- ::rtl::OUString aMediaType;
- xStorProps->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MediaType" )) ) >>= aMediaType;
- xTmpStorage->dispose();
-
- // look for the related embedded object factory
- ::comphelper::MimeConfigurationHelper aConfigHelper( m_xFactory );
- ::rtl::OUString aEmbedFactory;
- if ( aMediaType.getLength() )
- aEmbedFactory = aConfigHelper.GetFactoryNameByMediaType( aMediaType );
-
- if ( !aEmbedFactory.getLength() )
- throw uno::RuntimeException();
-
- uno::Reference< uno::XInterface > xFact = m_xFactory->createInstance( aEmbedFactory );
-
- uno::Reference< embed::XEmbedObjectCreator > xEmbCreator( xFact, uno::UNO_QUERY_THROW );
-
- // now the object should be adjusted to become the wrapper
- nStep = 1;
- uno::Reference< lang::XComponent > xComp( m_xObjectStream, uno::UNO_QUERY_THROW );
- xComp->dispose();
- m_xObjectStream = uno::Reference< io::XStream >();
- m_nObjectState = -1;
-
- nStep = 2;
- aTmpStreamName = MoveToTemporarySubstream();
-
- nStep = 3;
- m_xParentStorage->renameElement( aStorageName, m_aEntryName );
-
- nStep = 4;
- m_xWrappedObject.set( xEmbCreator->createInstanceInitFromEntry( m_xParentStorage, m_aEntryName, uno::Sequence< beans::PropertyValue >(), uno::Sequence< beans::PropertyValue >() ), uno::UNO_QUERY_THROW );
-
- bResult = sal_True; // the change is no more revertable
- try
- {
- m_xParentStorage->removeElement( aTmpStreamName );
- }
- catch( uno::Exception& )
- {
- // the success of the removing is not so important
- }
- }
- }
- }
- catch( uno::Exception& )
- {
- // repair the object if necessary
- switch( nStep )
- {
- case 4:
- case 3:
- if ( aTmpStreamName.getLength() && aTmpStreamName != m_aEntryName )
- try
- {
- if ( m_xParentStorage->hasByName( m_aEntryName ) )
- m_xParentStorage->removeElement( m_aEntryName );
- m_xParentStorage->renameElement( aTmpStreamName, m_aEntryName );
- }
- catch ( uno::Exception& )
- {
- try {
- close( sal_True );
- } catch( uno::Exception& ) {}
-
- m_xParentStorage->dispose(); // ??? the storage has information loss, it should be closed without commiting!
- throw uno::RuntimeException(); // the repairing is not possible
- }
- case 2:
- try
- {
- m_xObjectStream = m_xParentStorage->openStreamElement( m_aEntryName, m_bReadOnly ? embed::ElementModes::READ : embed::ElementModes::READWRITE );
- m_nObjectState = embed::EmbedStates::LOADED;
- }
- catch( uno::Exception& )
- {
- try {
- close( sal_True );
- } catch( uno::Exception& ) {}
-
- throw uno::RuntimeException(); // the repairing is not possible
- }
- // no break as designed!
-
- case 1:
- case 0:
- if ( aStorageName.getLength() )
- try {
- m_xParentStorage->removeElement( aStorageName );
- } catch( uno::Exception& ) { OSL_FAIL( "Can not remove temporary storage!" ); }
- break;
- }
- }
-
- if ( bResult )
- {
- // the conversion was done successfuly, now the additional initializations should happen
-
- MoveListeners();
- m_xWrappedObject->setClientSite( m_xClientSite );
- if ( m_xParent.is() )
- {
- uno::Reference< container::XChild > xChild( m_xWrappedObject, uno::UNO_QUERY );
- if ( xChild.is() )
- xChild->setParent( m_xParent );
- }
-
- }
-
- return bResult;
-}
-
-//----------------------------------------------
-void SAL_CALL OleEmbeddedObject::changeState( sal_Int32 nNewState )
- throw ( embed::UnreachableStateException,
- embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObject::changeState" );
-
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->changeState( nNewState );
- return;
- }
- // end wrapping related part ====================
-
- ::osl::ResettableMutexGuard aGuard( m_aMutex );
-
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- // in case the object is already in requested state
- if ( m_nObjectState == nNewState )
- return;
-
-#ifdef WNT
- if ( m_pOleComponent )
- {
- if ( m_nTargetState != -1 )
- {
- // means that the object is currently trying to reach the target state
- throw embed::StateChangeInProgressException( ::rtl::OUString(),
- uno::Reference< uno::XInterface >(),
- m_nTargetState );
- }
-
- TargetStateControl_Impl aControl( m_nTargetState, nNewState );
-
- // TODO: additional verbs can be a problem, since nobody knows how the object
- // will behave after activation
-
- sal_Int32 nOldState = m_nObjectState;
- aGuard.clear();
- StateChangeNotification_Impl( sal_True, nOldState, nNewState );
- aGuard.reset();
-
- try
- {
- if ( nNewState == embed::EmbedStates::LOADED )
- {
- // This means just closing of the current object
- // If component can not be closed the object stays in loaded state
- // and it holds reference to "incomplete" component
- // If the object is switched to running state later
- // the component will become "complete"
-
- // the loaded state must be set before, because of notifications!
- m_nObjectState = nNewState;
-
- {
- VerbExecutionControllerGuard aVerbGuard( m_aVerbExecutionController );
- m_pOleComponent->CloseObject();
- }
-
- aGuard.clear();
- StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState );
- aGuard.reset();
- }
- else if ( nNewState == embed::EmbedStates::RUNNING || nNewState == embed::EmbedStates::ACTIVE )
- {
- if ( m_nObjectState == embed::EmbedStates::LOADED )
- {
- // if the target object is in loaded state and a different state is specified
- // as a new one the object first must be switched to running state.
-
- // the component can exist already in nonrunning state
- // it can be created during loading to detect type of object
- CreateOleComponentAndLoad_Impl( m_pOleComponent );
-
- SwitchComponentToRunningState_Impl();
- m_nObjectState = embed::EmbedStates::RUNNING;
- aGuard.clear();
- StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState );
- aGuard.reset();
-
- if ( m_pOleComponent && m_bHasSizeToSet )
- {
- aGuard.clear();
- try {
- m_pOleComponent->SetExtent( m_aSizeToSet, m_nAspectToSet );
- m_bHasSizeToSet = sal_False;
- }
- catch( uno::Exception& ) {}
- aGuard.reset();
- }
-
- if ( m_nObjectState == nNewState )
- return;
- }
-
- // so now the object is either switched from Active to Running state or vise versa
- // the notification about object state change will be done asynchronously
- if ( m_nObjectState == embed::EmbedStates::RUNNING && nNewState == embed::EmbedStates::ACTIVE )
- {
- // execute OPEN verb, if object does not reach active state it is an object's problem
- aGuard.clear();
- m_pOleComponent->ExecuteVerb( embed::EmbedVerbs::MS_OLEVERB_OPEN );
- aGuard.reset();
-
- // some objects do not allow to set the size even in running state
- if ( m_pOleComponent && m_bHasSizeToSet )
- {
- aGuard.clear();
- try {
- m_pOleComponent->SetExtent( m_aSizeToSet, m_nAspectToSet );
- m_bHasSizeToSet = sal_False;
- }
- catch( uno::Exception& ) {}
- aGuard.reset();
- }
-
- m_nObjectState = nNewState;
- }
- else if ( m_nObjectState == embed::EmbedStates::ACTIVE && nNewState == embed::EmbedStates::RUNNING )
- {
- aGuard.clear();
- m_pOleComponent->CloseObject();
- m_pOleComponent->RunObject(); // Should not fail, the object already was active
- aGuard.reset();
- m_nObjectState = nNewState;
- }
- else
- {
- throw embed::UnreachableStateException();
- }
- }
- else
- throw embed::UnreachableStateException();
- }
- catch( uno::Exception& )
- {
- aGuard.clear();
- StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState );
- throw;
- }
- }
- else
-#endif
- {
- throw embed::UnreachableStateException();
- }
-}
-
-//----------------------------------------------
-uno::Sequence< sal_Int32 > SAL_CALL OleEmbeddedObject::getReachableStates()
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObject::getReachableStates" );
-
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- return xWrappedObject->getReachableStates();
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
-#ifdef WNT
- if ( m_pOleComponent )
- {
- if ( m_nObjectState == embed::EmbedStates::LOADED )
- {
- // the list of supported verbs can be retrieved only when object is in running state
- throw embed::NeedsRunningStateException(); // TODO:
- }
-
- // the list of states can only be guessed based on standard verbs,
- // since there is no way to detect what additional verbs do
- return GetReachableStatesList_Impl( m_pOleComponent->GetVerbList() );
- }
- else
-#endif
- {
- return uno::Sequence< sal_Int32 >();
- }
-}
-
-//----------------------------------------------
-sal_Int32 SAL_CALL OleEmbeddedObject::getCurrentState()
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- return xWrappedObject->getCurrentState();
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- // TODO: Shouldn't we ask object? ( I guess no )
- return m_nObjectState;
-}
-
-namespace
-{
- bool lcl_CopyStream(uno::Reference<io::XInputStream> xIn, uno::Reference<io::XOutputStream> xOut)
- {
- const sal_Int32 nChunkSize = 4096;
- uno::Sequence< sal_Int8 > aData(nChunkSize);
- sal_Int32 nTotalRead = 0;
- sal_Int32 nRead;
- do
- {
- nRead = xIn->readBytes(aData, nChunkSize);
- nTotalRead += nRead;
- xOut->writeBytes(aData);
- } while (nRead == nChunkSize);
- return nTotalRead != 0;
- }
-
- //Dump the objects content to a tempfile, just the "CONTENTS" stream if
- //there is one for non-compound documents, otherwise the whole content.
- //On success a file is returned which must be removed by the caller
- rtl::OUString lcl_ExtractObject(::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > xFactory,
- ::com::sun::star::uno::Reference< ::com::sun::star::io::XStream > xObjectStream)
- {
- rtl::OUString sUrl;
-
- // the solution is only active for Unix systems
-#ifndef WNT
- uno::Reference <beans::XPropertySet> xNativeTempFile(
- xFactory->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.io.TempFile"))), uno::UNO_QUERY_THROW);
- uno::Reference < io::XStream > xStream(xNativeTempFile, uno::UNO_QUERY_THROW);
-
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[0] <<= xObjectStream;
- aArgs[1] <<= (sal_Bool)sal_True; // do not create copy
- uno::Reference< container::XNameContainer > xNameContainer(
- xFactory->createInstanceWithArguments(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.OLESimpleStorage")),
- aArgs ), uno::UNO_QUERY_THROW );
-
- uno::Reference< io::XStream > xCONTENTS;
- xNameContainer->getByName(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("CONTENTS"))) >>= xCONTENTS;
-
- sal_Bool bCopied = xCONTENTS.is() && lcl_CopyStream(xCONTENTS->getInputStream(), xStream->getOutputStream());
-
- uno::Reference< io::XSeekable > xSeekableStor(xObjectStream, uno::UNO_QUERY);
- if (xSeekableStor.is())
- xSeekableStor->seek(0);
-
- if (!bCopied)
- bCopied = lcl_CopyStream(xObjectStream->getInputStream(), xStream->getOutputStream());
-
- if (bCopied)
- {
- xNativeTempFile->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveFile")),
- uno::makeAny(sal_False));
- uno::Any aUrl = xNativeTempFile->getPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("Uri")));
- aUrl >>= sUrl;
-
- xNativeTempFile = uno::Reference<beans::XPropertySet>();
-
- uno::Reference<ucb::XSimpleFileAccess> xSimpleFileAccess(
- xFactory->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.ucb.SimpleFileAccess"))),
- uno::UNO_QUERY_THROW);
-
- xSimpleFileAccess->setReadOnly(sUrl, sal_True);
- }
- else
- {
- xNativeTempFile->setPropertyValue(::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("RemoveFile")),
- uno::makeAny(sal_True));
- }
-#endif
- return sUrl;
- }
-}
-
-//----------------------------------------------
-void SAL_CALL OleEmbeddedObject::doVerb( sal_Int32 nVerbID )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- embed::UnreachableStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObject::doVerb" );
-
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->doVerb( nVerbID );
- return;
- }
- // end wrapping related part ====================
-
- ::osl::ResettableMutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
-#ifdef WNT
- if ( m_pOleComponent )
- {
- sal_Int32 nOldState = m_nObjectState;
-
- // TODO/LATER detect target state here and do a notification
- // StateChangeNotification_Impl( sal_True, nOldState, nNewState );
- if ( m_nObjectState == embed::EmbedStates::LOADED )
- {
- // if the target object is in loaded state
- // it must be switched to running state to execute verb
- aGuard.clear();
- changeState( embed::EmbedStates::RUNNING );
- aGuard.reset();
- }
-
- try {
- if ( !m_pOleComponent )
- throw uno::RuntimeException();
-
- // ==== the STAMPIT related solution =============================
- m_aVerbExecutionController.StartControlExecution();
- // ===============================================================
-
- m_pOleComponent->ExecuteVerb( nVerbID );
-
- // ==== the STAMPIT related solution =============================
- sal_Bool bModifiedOnExecution = m_aVerbExecutionController.EndControlExecution_WasModified();
-
- // this workaround is implemented for STAMPIT object
- // if object was modified during verb execution it is saved here
- if ( bModifiedOnExecution && m_pOleComponent->IsDirty() )
- SaveObject_Impl();
- // ===============================================================
- }
- catch( uno::Exception& )
- {
- // ==== the STAMPIT related solution =============================
- m_aVerbExecutionController.EndControlExecution_WasModified();
- // ===============================================================
-
- aGuard.clear();
- StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState );
- throw;
- }
-
- }
- else
-#endif
- {
- if ( nVerbID == -9 )
- {
- // the workaround verb to show the object in case no server is available
-
- // if it is possible, the object will be converted to OOo format
- if ( !m_bTriedConversion )
- {
- m_bTriedConversion = sal_True;
- if ( TryToConvertToOOo() )
- {
- changeState( embed::EmbedStates::UI_ACTIVE );
- return;
- }
- }
-
- if ( !m_pOwnView && m_xObjectStream.is() )
- {
- try {
- uno::Reference< io::XSeekable > xSeekable( m_xObjectStream, uno::UNO_QUERY );
- if ( xSeekable.is() )
- xSeekable->seek( 0 );
-
- m_pOwnView = new OwnView_Impl( m_xFactory, m_xObjectStream->getInputStream() );
- m_pOwnView->acquire();
- }
- catch( uno::RuntimeException& )
- {
- throw;
- }
- catch( uno::Exception& )
- {
- }
- }
-
- if ( !m_pOwnView || !m_pOwnView->Open() )
- {
- //Make a RO copy and see if the OS can find something to at
- //least display the content for us
- if (!m_aTempDumpURL.getLength())
- m_aTempDumpURL = lcl_ExtractObject(m_xFactory, m_xObjectStream);
-
- if (m_aTempDumpURL.getLength())
- {
- uno::Reference< ::com::sun::star::system::XSystemShellExecute > xSystemShellExecute( m_xFactory->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.system.SystemShellExecute"))),
- uno::UNO_QUERY_THROW);
- xSystemShellExecute->execute(m_aTempDumpURL, ::rtl::OUString(), ::com::sun::star::system::SystemShellExecuteFlags::DEFAULTS);
- }
- else
- throw embed::UnreachableStateException();
- }
- }
- else
- {
-
- throw embed::UnreachableStateException();
- }
- }
-}
-
-//----------------------------------------------
-uno::Sequence< embed::VerbDescriptor > SAL_CALL OleEmbeddedObject::getSupportedVerbs()
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObject::getSupportedVerb" );
-
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- return xWrappedObject->getSupportedVerbs();
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-#ifdef WNT
- if ( m_pOleComponent )
- {
- // registry could be used in this case
- // if ( m_nObjectState == embed::EmbedStates::LOADED )
- // {
- // // the list of supported verbs can be retrieved only when object is in running state
- // throw embed::NeedsRunningStateException(); // TODO:
- // }
-
- return m_pOleComponent->GetVerbList();
- }
- else
-#endif
- {
- return uno::Sequence< embed::VerbDescriptor >();
- }
-}
-
-//----------------------------------------------
-void SAL_CALL OleEmbeddedObject::setClientSite(
- const uno::Reference< embed::XEmbeddedClient >& xClient )
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->setClientSite( xClient );
- return;
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_xClientSite != xClient)
- {
- if ( m_nObjectState != embed::EmbedStates::LOADED && m_nObjectState != embed::EmbedStates::RUNNING )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The client site can not be set currently!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- m_xClientSite = xClient;
- }
-}
-
-//----------------------------------------------
-uno::Reference< embed::XEmbeddedClient > SAL_CALL OleEmbeddedObject::getClientSite()
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- return xWrappedObject->getClientSite();
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- return m_xClientSite;
-}
-
-//----------------------------------------------
-void SAL_CALL OleEmbeddedObject::update()
- throw ( embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->update();
- return;
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- if ( m_nUpdateMode == embed::EmbedUpdateModes::EXPLICIT_UPDATE )
- {
- // TODO: update view representation
- }
- else
- {
- // the object must be up to date
- OSL_ENSURE( m_nUpdateMode == embed::EmbedUpdateModes::ALWAYS_UPDATE, "Unknown update mode!\n" );
- }
-}
-
-//----------------------------------------------
-void SAL_CALL OleEmbeddedObject::setUpdateMode( sal_Int32 nMode )
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->setUpdateMode( nMode );
- return;
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object has no persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- OSL_ENSURE( nMode == embed::EmbedUpdateModes::ALWAYS_UPDATE
- || nMode == embed::EmbedUpdateModes::EXPLICIT_UPDATE,
- "Unknown update mode!\n" );
- m_nUpdateMode = nMode;
-}
-
-//----------------------------------------------
-sal_Int64 SAL_CALL OleEmbeddedObject::getStatus( sal_Int64
- nAspect
-)
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- return xWrappedObject->getStatus( nAspect );
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object must be in running state!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- sal_Int64 nResult = 0;
-
-#ifdef WNT
- if ( m_bGotStatus && m_nStatusAspect == nAspect )
- nResult = m_nStatus;
- else if ( m_pOleComponent )
- {
-
- m_nStatus = m_pOleComponent->GetMiscStatus( nAspect );
- m_nStatusAspect = nAspect;
- m_bGotStatus = sal_True;
- nResult = m_nStatus;
- }
-#endif
-
- // this implementation needs size to be provided after object loading/creating to work in optimal way
- return ( nResult | embed::EmbedMisc::EMBED_NEEDSSIZEONLOAD );
-}
-
-//----------------------------------------------
-void SAL_CALL OleEmbeddedObject::setContainerName( const ::rtl::OUString& sName )
- throw ( uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->setContainerName( sName );
- return;
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- m_aContainerName = sName;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/olemisc.cxx b/embeddedobj/source/msole/olemisc.cxx
deleted file mode 100644
index 0df2b84ad6..0000000000
--- a/embeddedobj/source/msole/olemisc.cxx
+++ /dev/null
@@ -1,700 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-#include <com/sun/star/embed/EmbedUpdateModes.hpp>
-#include <com/sun/star/embed/EmbedStates.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-
-#include <cppuhelper/interfacecontainer.h>
-
-#include <oleembobj.hxx>
-#include <olecomponent.hxx>
-
-#include "ownview.hxx"
-
-using namespace ::com::sun::star;
-
-sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang::XMultiServiceFactory >& xFactory );
-
-
-//------------------------------------------------------
-OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< lang::XMultiServiceFactory >& xFactory,
- const uno::Sequence< sal_Int8 >& aClassID,
- const ::rtl::OUString& aClassName )
-: m_pOleComponent( NULL )
-, m_pInterfaceContainer( NULL )
-, m_bReadOnly( sal_False )
-, m_bDisposed( sal_False )
-, m_nObjectState( -1 )
-, m_nTargetState( -1 )
-, m_nUpdateMode ( embed::EmbedUpdateModes::ALWAYS_UPDATE )
-, m_xFactory( xFactory )
-, m_aClassID( aClassID )
-, m_aClassName( aClassName )
-, m_bWaitSaveCompleted( sal_False )
-, m_bNewVisReplInStream( sal_True )
-, m_bStoreLoaded( sal_False )
-, m_bVisReplInitialized( sal_False )
-, m_bVisReplInStream( sal_False )
-, m_bStoreVisRepl( sal_False )
-, m_bIsLink( sal_False )
-, m_bHasCachedSize( sal_False )
-, m_nCachedAspect( 0 )
-, m_bHasSizeToSet( sal_False )
-, m_nAspectToSet( 0 )
-, m_bGotStatus( sal_False )
-, m_nStatus( 0 )
-, m_nStatusAspect( 0 )
-, m_pOwnView( NULL )
-, m_bFromClipboard( sal_False )
-, m_bTriedConversion( sal_False )
-{
-}
-
-//------------------------------------------------------
-// In case of loading from persistent entry the classID of the object
-// will be retrieved from the entry, during construction it is unknown
-OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< lang::XMultiServiceFactory >& xFactory, sal_Bool bLink )
-: m_pOleComponent( NULL )
-, m_pInterfaceContainer( NULL )
-, m_bReadOnly( sal_False )
-, m_bDisposed( sal_False )
-, m_nObjectState( -1 )
-, m_nTargetState( -1 )
-, m_nUpdateMode( embed::EmbedUpdateModes::ALWAYS_UPDATE )
-, m_xFactory( xFactory )
-, m_bWaitSaveCompleted( sal_False )
-, m_bNewVisReplInStream( sal_True )
-, m_bStoreLoaded( sal_False )
-, m_bVisReplInitialized( sal_False )
-, m_bVisReplInStream( sal_False )
-, m_bStoreVisRepl( sal_False )
-, m_bIsLink( bLink )
-, m_bHasCachedSize( sal_False )
-, m_nCachedAspect( 0 )
-, m_bHasSizeToSet( sal_False )
-, m_nAspectToSet( 0 )
-, m_bGotStatus( sal_False )
-, m_nStatus( 0 )
-, m_nStatusAspect( 0 )
-, m_pOwnView( NULL )
-, m_bFromClipboard( sal_False )
-, m_bTriedConversion( sal_False )
-{
-}
-#ifdef WNT
-//------------------------------------------------------
-// this constructor let object be initialized from clipboard
-OleEmbeddedObject::OleEmbeddedObject( const uno::Reference< lang::XMultiServiceFactory >& xFactory )
-: m_pOleComponent( NULL )
-, m_pInterfaceContainer( NULL )
-, m_bReadOnly( sal_False )
-, m_bDisposed( sal_False )
-, m_nObjectState( -1 )
-, m_nTargetState( -1 )
-, m_nUpdateMode( embed::EmbedUpdateModes::ALWAYS_UPDATE )
-, m_xFactory( xFactory )
-, m_bWaitSaveCompleted( sal_False )
-, m_bNewVisReplInStream( sal_True )
-, m_bStoreLoaded( sal_False )
-, m_bVisReplInitialized( sal_False )
-, m_bVisReplInStream( sal_False )
-, m_bStoreVisRepl( sal_False )
-, m_bIsLink( sal_False )
-, m_bHasCachedSize( sal_False )
-, m_nCachedAspect( 0 )
-, m_bHasSizeToSet( sal_False )
-, m_nAspectToSet( 0 )
-, m_bGotStatus( sal_False )
-, m_nStatus( 0 )
-, m_nStatusAspect( 0 )
-, m_pOwnView( NULL )
-, m_bFromClipboard( sal_True )
-, m_bTriedConversion( sal_False )
-{
-}
-#endif
-//------------------------------------------------------
-OleEmbeddedObject::~OleEmbeddedObject()
-{
- OSL_ENSURE( !m_pInterfaceContainer && !m_pOleComponent && !m_xObjectStream.is(),
- "The object is not closed! DISASTER is possible!" );
-
- if ( m_pOleComponent || m_pInterfaceContainer || m_xObjectStream.is() )
- {
- // the component must be cleaned during closing
- m_refCount++; // to avoid crash
- try {
- Dispose();
- } catch( uno::Exception& ) {}
- }
-
- if ( m_aTempURL.getLength() )
- KillFile_Impl( m_aTempURL, m_xFactory );
-
- if ( m_aTempDumpURL.getLength() )
- KillFile_Impl( m_aTempDumpURL, m_xFactory );
-}
-
-//------------------------------------------------------
-void OleEmbeddedObject::MakeEventListenerNotification_Impl( const ::rtl::OUString& aEventName )
-{
- if ( m_pInterfaceContainer )
- {
- ::cppu::OInterfaceContainerHelper* pContainer =
- m_pInterfaceContainer->getContainer(
- ::getCppuType( ( const uno::Reference< document::XEventListener >*) NULL ) );
- if ( pContainer != NULL )
- {
- document::EventObject aEvent( static_cast< ::cppu::OWeakObject* >( this ), aEventName );
- ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
- while (pIterator.hasMoreElements())
- {
- try
- {
- ((document::XEventListener*)pIterator.next())->notifyEvent( aEvent );
- }
- catch( uno::RuntimeException& )
- {
- }
- }
- }
- }
-}
-#ifdef WNT
-//----------------------------------------------
-void OleEmbeddedObject::StateChangeNotification_Impl( sal_Bool bBeforeChange, sal_Int32 nOldState, sal_Int32 nNewState )
-{
- if ( m_pInterfaceContainer )
- {
- ::cppu::OInterfaceContainerHelper* pContainer = m_pInterfaceContainer->getContainer(
- ::getCppuType( ( const uno::Reference< embed::XStateChangeListener >*) NULL ) );
- if ( pContainer != NULL )
- {
- lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
- ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
-
- while (pIterator.hasMoreElements())
- {
- if ( bBeforeChange )
- {
- try
- {
- ((embed::XStateChangeListener*)pIterator.next())->changingState( aSource, nOldState, nNewState );
- }
- catch( uno::Exception& )
- {
- // even if the listener complains ignore it for now
- }
- }
- else
- {
- try
- {
- ((embed::XStateChangeListener*)pIterator.next())->stateChanged( aSource, nOldState, nNewState );
- }
- catch( uno::Exception& )
- {
- // if anything happened it is problem of listener, ignore it
- }
- }
- }
- }
- }
-}
-#endif
-//------------------------------------------------------
-void OleEmbeddedObject::GetRidOfComponent()
-{
-#ifdef WNT
- if ( m_pOleComponent )
- {
- if ( m_nObjectState != -1 && m_nObjectState != embed::EmbedStates::LOADED )
- SaveObject_Impl();
-
- m_pOleComponent->removeCloseListener( m_xClosePreventer );
- try
- {
- m_pOleComponent->close( sal_False );
- }
- catch( uno::Exception& )
- {
- // TODO: there should be a special listener to wait for component closing
- // and to notify object, may be object itself can be such a listener
- m_pOleComponent->addCloseListener( m_xClosePreventer );
- throw;
- }
-
- m_pOleComponent->disconnectEmbeddedObject();
- m_pOleComponent->release();
- m_pOleComponent = NULL;
- }
-#endif
-}
-
-//------------------------------------------------------
-void OleEmbeddedObject::Dispose()
-{
- if ( m_pInterfaceContainer )
- {
- lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
- m_pInterfaceContainer->disposeAndClear( aSource );
- delete m_pInterfaceContainer;
- m_pInterfaceContainer = NULL;
- }
-
- if ( m_pOwnView )
- {
- m_pOwnView->Close();
- m_pOwnView->release();
- m_pOwnView = NULL;
- }
-
- if ( m_pOleComponent )
- try {
- GetRidOfComponent();
- } catch( uno::Exception& )
- {
- m_bDisposed = true;
- throw; // TODO: there should be a special listener that will close object when
- // component is finally closed
- }
-
- if ( m_xObjectStream.is() )
- {
- uno::Reference< lang::XComponent > xComp( m_xObjectStream, uno::UNO_QUERY );
- OSL_ENSURE( xComp.is(), "Storage stream doesn't support XComponent!\n" );
-
- if ( xComp.is() )
- {
- try {
- xComp->dispose();
- } catch( uno::Exception& ) {}
- }
- m_xObjectStream = uno::Reference< io::XStream >();
- }
-
- m_xParentStorage = uno::Reference< embed::XStorage >();
-
- m_bDisposed = true;
-}
-
-//------------------------------------------------------
-uno::Sequence< sal_Int8 > SAL_CALL OleEmbeddedObject::getClassID()
- throw ( uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- return xWrappedObject->getClassID();
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- return m_aClassID;
-}
-
-//------------------------------------------------------
-::rtl::OUString SAL_CALL OleEmbeddedObject::getClassName()
- throw ( uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- return xWrappedObject->getClassName();
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- return m_aClassName;
-}
-
-//------------------------------------------------------
-void SAL_CALL OleEmbeddedObject::setClassInfo(
- const uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName )
- throw ( lang::NoSupportException,
- uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->setClassInfo( aClassID, aClassName );
- return;
- }
- // end wrapping related part ====================
-
- // the object class info can not be changed explicitly
- throw lang::NoSupportException(); //TODO:
-}
-
-//------------------------------------------------------
-uno::Reference< util::XCloseable > SAL_CALL OleEmbeddedObject::getComponent()
- throw ( uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- return xWrappedObject->getComponent();
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_nObjectState == -1 ) // || m_nObjectState == embed::EmbedStates::LOADED )
- {
- // the object is still not running
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object is not loaded!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- if ( !m_pOleComponent )
- {
- // TODO/LATER: Is it correct???
- return uno::Reference< util::XCloseable >();
- // throw uno::RuntimeException(); // TODO
- }
-
- return uno::Reference< util::XCloseable >( static_cast< ::cppu::OWeakObject* >( m_pOleComponent ), uno::UNO_QUERY );
-}
-
-//----------------------------------------------
-void SAL_CALL OleEmbeddedObject::addStateChangeListener( const uno::Reference< embed::XStateChangeListener >& xListener )
- throw ( uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XStateChangeBroadcaster > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->addStateChangeListener( xListener );
- return;
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( !m_pInterfaceContainer )
- m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
-
- m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< embed::XStateChangeListener >*)0 ),
- xListener );
-}
-
-//----------------------------------------------
-void SAL_CALL OleEmbeddedObject::removeStateChangeListener(
- const uno::Reference< embed::XStateChangeListener >& xListener )
- throw (uno::RuntimeException)
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XStateChangeBroadcaster > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->removeStateChangeListener( xListener );
- return;
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_pInterfaceContainer )
- m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< embed::XStateChangeListener >*)0 ),
- xListener );
-}
-
-
-//----------------------------------------------
-void SAL_CALL OleEmbeddedObject::close( sal_Bool bDeliverOwnership )
- throw ( util::CloseVetoException,
- uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->close( bDeliverOwnership );
- return;
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- uno::Reference< uno::XInterface > xSelfHold( static_cast< ::cppu::OWeakObject* >( this ) );
- lang::EventObject aSource( static_cast< ::cppu::OWeakObject* >( this ) );
-
- if ( m_pInterfaceContainer )
- {
- ::cppu::OInterfaceContainerHelper* pContainer =
- m_pInterfaceContainer->getContainer( ::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) );
- if ( pContainer != NULL )
- {
- ::cppu::OInterfaceIteratorHelper pIterator(*pContainer);
- while (pIterator.hasMoreElements())
- {
- try
- {
- ((util::XCloseListener*)pIterator.next())->queryClosing( aSource, bDeliverOwnership );
- }
- catch( uno::RuntimeException& )
- {
- pIterator.remove();
- }
- }
- }
-
- pContainer = m_pInterfaceContainer->getContainer(
- ::getCppuType( ( const uno::Reference< util::XCloseListener >*) NULL ) );
- if ( pContainer != NULL )
- {
- ::cppu::OInterfaceIteratorHelper pCloseIterator(*pContainer);
- while (pCloseIterator.hasMoreElements())
- {
- try
- {
- ((util::XCloseListener*)pCloseIterator.next())->notifyClosing( aSource );
- }
- catch( uno::RuntimeException& )
- {
- pCloseIterator.remove();
- }
- }
- }
- }
-
- Dispose();
-}
-
-//----------------------------------------------
-void SAL_CALL OleEmbeddedObject::addCloseListener( const uno::Reference< util::XCloseListener >& xListener )
- throw ( uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->addCloseListener( xListener );
- return;
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( !m_pInterfaceContainer )
- m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
-
- m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< util::XCloseListener >*)0 ), xListener );
-}
-
-//----------------------------------------------
-void SAL_CALL OleEmbeddedObject::removeCloseListener( const uno::Reference< util::XCloseListener >& xListener )
- throw (uno::RuntimeException)
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->removeCloseListener( xListener );
- return;
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_pInterfaceContainer )
- m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< util::XCloseListener >*)0 ),
- xListener );
-}
-
-//------------------------------------------------------
-void SAL_CALL OleEmbeddedObject::addEventListener( const uno::Reference< document::XEventListener >& xListener )
- throw ( uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->addEventListener( xListener );
- return;
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( !m_pInterfaceContainer )
- m_pInterfaceContainer = new ::cppu::OMultiTypeInterfaceContainerHelper( m_aMutex );
-
- m_pInterfaceContainer->addInterface( ::getCppuType( (const uno::Reference< document::XEventListener >*)0 ), xListener );
-}
-
-//------------------------------------------------------
-void SAL_CALL OleEmbeddedObject::removeEventListener(
- const uno::Reference< document::XEventListener >& xListener )
- throw ( uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->removeEventListener( xListener );
- return;
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_pInterfaceContainer )
- m_pInterfaceContainer->removeInterface( ::getCppuType( (const uno::Reference< document::XEventListener >*)0 ),
- xListener );
-}
-
-// XInplaceObject ( wrapper related implementation )
-//------------------------------------------------------
-void SAL_CALL OleEmbeddedObject::setObjectRectangles( const awt::Rectangle& aPosRect,
- const awt::Rectangle& aClipRect )
- throw ( embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XInplaceObject > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->setObjectRectangles( aPosRect, aClipRect );
- return;
- }
- // end wrapping related part ====================
-
- throw embed::WrongStateException();
-}
-
-//------------------------------------------------------
-void SAL_CALL OleEmbeddedObject::enableModeless( sal_Bool bEnable )
- throw ( embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XInplaceObject > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->enableModeless( bEnable );
- return;
- }
- // end wrapping related part ====================
-
- throw embed::WrongStateException();
-}
-
-//------------------------------------------------------
-void SAL_CALL OleEmbeddedObject::translateAccelerators(
- const uno::Sequence< awt::KeyEvent >& aKeys )
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XInplaceObject > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->translateAccelerators( aKeys );
- return;
- }
- // end wrapping related part ====================
-
-}
-
-// XChild
-//------------------------------------------------------
-com::sun::star::uno::Reference< com::sun::star::uno::XInterface > SAL_CALL OleEmbeddedObject::getParent() throw (::com::sun::star::uno::RuntimeException)
-{
- // begin wrapping related part ====================
- uno::Reference< container::XChild > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- return xWrappedObject->getParent();
- }
- // end wrapping related part ====================
-
- return m_xParent;
-}
-
-//------------------------------------------------------
-void SAL_CALL OleEmbeddedObject::setParent( const com::sun::star::uno::Reference< com::sun::star::uno::XInterface >& xParent ) throw (::com::sun::star::lang::NoSupportException, ::com::sun::star::uno::RuntimeException)
-{
- // begin wrapping related part ====================
- uno::Reference< container::XChild > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->setParent( xParent );
- return;
- }
- // end wrapping related part ====================
-
- m_xParent = xParent;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/olepersist.cxx b/embeddedobj/source/msole/olepersist.cxx
deleted file mode 100644
index 39193312e0..0000000000
--- a/embeddedobj/source/msole/olepersist.cxx
+++ /dev/null
@@ -1,2132 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-
-#include <oleembobj.hxx>
-#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/XTransactedObject.hpp>
-#include <com/sun/star/embed/ElementModes.hpp>
-#include <com/sun/star/embed/EmbedUpdateModes.hpp>
-#include <com/sun/star/embed/Aspects.hpp>
-#include <com/sun/star/embed/XOptimizedStorage.hpp>
-#include <com/sun/star/lang/XComponent.hpp>
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/io/XTruncate.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-
-#include <rtl/logfile.hxx>
-
-#include <comphelper/storagehelper.hxx>
-#include <comphelper/mimeconfighelper.hxx>
-#include <comphelper/classids.hxx>
-
-
-#include <olecomponent.hxx>
-#include <closepreventer.hxx>
-
-using namespace ::com::sun::star;
-using namespace ::comphelper;
-
-//-------------------------------------------------------------------------
-sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang::XMultiServiceFactory >& xFactory )
-{
- if ( !xFactory.is() )
- return sal_False;
-
- sal_Bool bRet = sal_False;
-
- try
- {
- uno::Reference < ucb::XSimpleFileAccess > xAccess(
- xFactory->createInstance (
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) )),
- uno::UNO_QUERY );
-
- if ( xAccess.is() )
- {
- xAccess->kill( aURL );
- bRet = sal_True;
- }
- }
- catch( uno::Exception& )
- {
- }
-
- return bRet;
-}
-
-//----------------------------------------------
-::rtl::OUString GetNewTempFileURL_Impl( const uno::Reference< lang::XMultiServiceFactory >& xFactory )
-{
- OSL_ENSURE( xFactory.is(), "No factory is provided!\n" );
-
- ::rtl::OUString aResult;
-
- uno::Reference < beans::XPropertySet > xTempFile(
- xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
- uno::UNO_QUERY );
-
- if ( !xTempFile.is() )
- throw uno::RuntimeException(); // TODO
-
- try {
- xTempFile->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RemoveFile" )), uno::makeAny( sal_False ) );
- uno::Any aUrl = xTempFile->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Uri" ) ));
- aUrl >>= aResult;
- }
- catch ( uno::Exception& )
- {
- }
-
- if ( !aResult.getLength() )
- throw uno::RuntimeException(); // TODO: can not create tempfile
-
- return aResult;
-}
-
-//-----------------------------------------------
-::rtl::OUString GetNewFilledTempFile_Impl( const uno::Reference< io::XInputStream >& xInStream,
- const uno::Reference< lang::XMultiServiceFactory >& xFactory )
- throw ( io::IOException,
- uno::RuntimeException )
-{
- OSL_ENSURE( xInStream.is() && xFactory.is(), "Wrong parameters are provided!\n" );
-
- ::rtl::OUString aResult = GetNewTempFileURL_Impl( xFactory );
-
- if ( aResult.getLength() )
- {
- try {
- uno::Reference < ucb::XSimpleFileAccess > xTempAccess(
- xFactory->createInstance (
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) )),
- uno::UNO_QUERY );
-
- if ( !xTempAccess.is() )
- throw uno::RuntimeException(); // TODO:
-
- uno::Reference< io::XOutputStream > xTempOutStream = xTempAccess->openFileWrite( aResult );
- if ( xTempOutStream.is() )
- {
- // copy stream contents to the file
- ::comphelper::OStorageHelper::CopyInputToOutput( xInStream, xTempOutStream );
- xTempOutStream->closeOutput();
- xTempOutStream = uno::Reference< io::XOutputStream >();
- }
- else
- throw io::IOException(); // TODO:
- }
- catch( packages::WrongPasswordException& )
- {
- KillFile_Impl( aResult, xFactory );
- throw io::IOException(); //TODO:
- }
- catch( io::IOException& )
- {
- KillFile_Impl( aResult, xFactory );
- throw;
- }
- catch( uno::RuntimeException& )
- {
- KillFile_Impl( aResult, xFactory );
- throw;
- }
- catch( uno::Exception& )
- {
- KillFile_Impl( aResult, xFactory );
- aResult = ::rtl::OUString();
- }
- }
-
- return aResult;
-}
-#ifdef WNT
-::rtl::OUString GetNewFilledTempFile_Impl( const uno::Reference< embed::XOptimizedStorage >& xParentStorage, const ::rtl::OUString& aEntryName, const uno::Reference< lang::XMultiServiceFactory >& xFactory )
- throw( io::IOException, uno::RuntimeException )
-{
- ::rtl::OUString aResult;
-
- try
- {
- uno::Reference < beans::XPropertySet > xTempFile(
- xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
- uno::UNO_QUERY );
- uno::Reference < io::XStream > xTempStream( xTempFile, uno::UNO_QUERY_THROW );
-
- xParentStorage->copyStreamElementData( aEntryName, xTempStream );
-
- xTempFile->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RemoveFile" )), uno::makeAny( sal_False ) );
- uno::Any aUrl = xTempFile->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Uri" ) ));
- aUrl >>= aResult;
- }
- catch( uno::RuntimeException& )
- {
- throw;
- }
- catch( uno::Exception& )
- {
- }
-
- if ( !aResult.getLength() )
- throw io::IOException();
-
- return aResult;
-}
-
-//------------------------------------------------------
-void SetStreamMediaType_Impl( const uno::Reference< io::XStream >& xStream, const ::rtl::OUString& aMediaType )
-{
- uno::Reference< beans::XPropertySet > xPropSet( xStream, uno::UNO_QUERY );
- if ( !xPropSet.is() )
- throw uno::RuntimeException(); // TODO: all the storage streams must support XPropertySet
-
- xPropSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "MediaType" )), uno::makeAny( aMediaType ) );
-}
-#endif
-//------------------------------------------------------
-void LetCommonStoragePassBeUsed_Impl( const uno::Reference< io::XStream >& xStream )
-{
- uno::Reference< beans::XPropertySet > xPropSet( xStream, uno::UNO_QUERY );
- if ( !xPropSet.is() )
- throw uno::RuntimeException(); // Only StorageStreams must be provided here, they must implement the interface
-
- xPropSet->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "UseCommonStoragePasswordEncryption" )),
- uno::makeAny( (sal_Bool)sal_True ) );
-}
-#ifdef WNT
-//------------------------------------------------------
-void VerbExecutionController::StartControlExecution()
-{
- osl::MutexGuard aGuard( m_aVerbExecutionMutex );
-
- // the class is used to detect STAMPIT object, that can never be active
- if ( !m_bVerbExecutionInProgress && !m_bWasEverActive )
- {
- m_bVerbExecutionInProgress = sal_True;
- m_nVerbExecutionThreadIdentifier = osl_getThreadIdentifier( NULL );
- m_bChangedOnVerbExecution = sal_False;
- }
-}
-
-//------------------------------------------------------
-sal_Bool VerbExecutionController::EndControlExecution_WasModified()
-{
- osl::MutexGuard aGuard( m_aVerbExecutionMutex );
-
- sal_Bool bResult = sal_False;
- if ( m_bVerbExecutionInProgress && m_nVerbExecutionThreadIdentifier == osl_getThreadIdentifier( NULL ) )
- {
- bResult = m_bChangedOnVerbExecution;
- m_bVerbExecutionInProgress = sal_False;
- }
-
- return bResult;
-}
-
-//------------------------------------------------------
-void VerbExecutionController::ModificationNotificationIsDone()
-{
- osl::MutexGuard aGuard( m_aVerbExecutionMutex );
-
- if ( m_bVerbExecutionInProgress && osl_getThreadIdentifier( NULL ) == m_nVerbExecutionThreadIdentifier )
- m_bChangedOnVerbExecution = sal_True;
-}
-#endif
-//-----------------------------------------------
-void VerbExecutionController::LockNotification()
-{
- osl::MutexGuard aGuard( m_aVerbExecutionMutex );
- if ( m_nNotificationLock < SAL_MAX_INT32 )
- m_nNotificationLock++;
-}
-
-//-----------------------------------------------
-void VerbExecutionController::UnlockNotification()
-{
- osl::MutexGuard aGuard( m_aVerbExecutionMutex );
- if ( m_nNotificationLock > 0 )
- m_nNotificationLock--;
-}
-
-//-----------------------------------------------
-uno::Reference< io::XStream > OleEmbeddedObject::GetNewFilledTempStream_Impl( const uno::Reference< io::XInputStream >& xInStream )
- throw( io::IOException )
-{
- OSL_ENSURE( xInStream.is(), "Wrong parameter is provided!\n" );
-
- uno::Reference < io::XStream > xTempFile(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
- uno::UNO_QUERY_THROW );
-
- uno::Reference< io::XOutputStream > xTempOutStream = xTempFile->getOutputStream();
- if ( xTempOutStream.is() )
- {
- ::comphelper::OStorageHelper::CopyInputToOutput( xInStream, xTempOutStream );
- xTempOutStream->flush();
- }
- else
- throw io::IOException(); // TODO:
-
- return xTempFile;
-}
-
-//------------------------------------------------------
-uno::Reference< io::XStream > OleEmbeddedObject::TryToGetAcceptableFormat_Impl( const uno::Reference< io::XStream >& xStream )
- throw ( uno::Exception )
-{
- // TODO/LATER: Actually this should be done by a centralized component ( may be a graphical filter )
- if ( !m_xFactory.is() )
- throw uno::RuntimeException();
-
- uno::Reference< io::XInputStream > xInStream = xStream->getInputStream();
- if ( !xInStream.is() )
- throw uno::RuntimeException();
-
- uno::Reference< io::XSeekable > xSeek( xStream, uno::UNO_QUERY_THROW );
- xSeek->seek( 0 );
-
- uno::Sequence< sal_Int8 > aData( 8 );
- sal_Int32 nRead = xInStream->readBytes( aData, 8 );
- xSeek->seek( 0 );
-
- if ( ( nRead >= 2 && aData[0] == 'B' && aData[1] == 'M' )
- || ( nRead >= 4 && aData[0] == 1 && aData[1] == 0 && aData[2] == 9 && aData[3] == 0 ) )
- {
- // it should be a bitmap or a Metafile
- return xStream;
- }
-
-
- sal_uInt32 nHeaderOffset = 0;
- if ( ( nRead >= 8 && aData[0] == -1 && aData[1] == -1 && aData[2] == -1 && aData[3] == -1 )
- && ( aData[4] == 2 || aData[4] == 3 || aData[4] == 14 ) && aData[5] == 0 && aData[6] == 0 && aData[7] == 0 )
- {
- nHeaderOffset = 40;
- xSeek->seek( 8 );
-
- // TargetDevice might be used in future, currently the cache has specified NULL
- uno::Sequence< sal_Int8 > aHeadData( 4 );
- nRead = xInStream->readBytes( aHeadData, 4 );
- sal_uInt32 nLen = 0;
- if ( nRead == 4 && aHeadData.getLength() == 4 )
- nLen = ( ( ( (sal_uInt32)aHeadData[3] * 0x100 + (sal_uInt32)aHeadData[2] ) * 0x100 ) + (sal_uInt32)aHeadData[1] ) * 0x100 + (sal_uInt32)aHeadData[0];
- if ( nLen > 4 )
- {
- xInStream->skipBytes( nLen - 4 );
- nHeaderOffset += nLen - 4;
- }
-
- }
- else if ( nRead > 4 )
- {
- // check whether the first bytes represent the size
- sal_uInt32 nSize = 0;
- for ( sal_Int32 nInd = 3; nInd >= 0; nInd-- )
- nSize = ( nSize << 8 ) + (sal_uInt8)aData[nInd];
-
- if ( nSize == xSeek->getLength() - 4 )
- nHeaderOffset = 4;
- }
-
- if ( nHeaderOffset )
- {
- // this is either a bitmap or a metafile clipboard format, retrieve the pure stream
- uno::Reference < io::XStream > xResult(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
- uno::UNO_QUERY_THROW );
- uno::Reference < io::XSeekable > xResultSeek( xResult, uno::UNO_QUERY_THROW );
- uno::Reference < io::XOutputStream > xResultOut = xResult->getOutputStream();
- uno::Reference < io::XInputStream > xResultIn = xResult->getInputStream();
- if ( !xResultOut.is() || !xResultIn.is() )
- throw uno::RuntimeException();
-
- xSeek->seek( nHeaderOffset ); // header size for these formats
- ::comphelper::OStorageHelper::CopyInputToOutput( xInStream, xResultOut );
- xResultOut->closeOutput();
- xResultSeek->seek( 0 );
- xSeek->seek( 0 );
-
- return xResult;
- }
-
- return uno::Reference< io::XStream >();
-}
-
-//------------------------------------------------------
-void OleEmbeddedObject::InsertVisualCache_Impl( const uno::Reference< io::XStream >& xTargetStream,
- const uno::Reference< io::XStream >& xCachedVisualRepresentation )
- throw ( uno::Exception )
-{
- OSL_ENSURE( xTargetStream.is() && xCachedVisualRepresentation.is(), "Invalid argumants!\n" );
-
- if ( !xTargetStream.is() || !xCachedVisualRepresentation.is() )
- throw uno::RuntimeException();
-
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[0] <<= xTargetStream;
- aArgs[1] <<= (sal_Bool)sal_True; // do not create copy
-
- uno::Reference< container::XNameContainer > xNameContainer(
- m_xFactory->createInstanceWithArguments(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OLESimpleStorage" )),
- aArgs ),
- uno::UNO_QUERY );
-
- if ( !xNameContainer.is() )
- throw uno::RuntimeException();
-
- uno::Reference< io::XSeekable > xCachedSeek( xCachedVisualRepresentation, uno::UNO_QUERY_THROW );
- if ( xCachedSeek.is() )
- xCachedSeek->seek( 0 );
-
- uno::Reference < io::XStream > xTempFile(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
- uno::UNO_QUERY_THROW );
-
- uno::Reference< io::XSeekable > xTempSeek( xTempFile, uno::UNO_QUERY_THROW );
- uno::Reference< io::XOutputStream > xTempOutStream = xTempFile->getOutputStream();
- if ( xTempOutStream.is() )
- {
- // the OlePres stream must have additional header
- // TODO/LATER: might need to be extended in future ( actually makes sence only for SO7 format )
- uno::Reference< io::XInputStream > xInCacheStream = xCachedVisualRepresentation->getInputStream();
- if ( !xInCacheStream.is() )
- throw uno::RuntimeException();
-
- // write 0xFFFFFFFF at the beginning
- uno::Sequence< sal_Int8 > aData( 4 );
- *( (sal_uInt32*)aData.getArray() ) = 0xFFFFFFFF;
-
- xTempOutStream->writeBytes( aData );
-
- // write clipboard format
- uno::Sequence< sal_Int8 > aSigData( 2 );
- xInCacheStream->readBytes( aSigData, 2 );
- if ( aSigData.getLength() < 2 )
- throw io::IOException();
-
- if ( aSigData[0] == 'B' && aSigData[1] == 'M' )
- {
- // it's a bitmap
- aData[0] = 0x02; aData[1] = 0; aData[2] = 0; aData[3] = 0;
- }
- else
- {
- // treat it as a metafile
- aData[0] = 0x03; aData[1] = 0; aData[2] = 0; aData[3] = 0;
- }
- xTempOutStream->writeBytes( aData );
-
- // write job related information
- aData[0] = 0x04; aData[1] = 0; aData[2] = 0; aData[3] = 0;
- xTempOutStream->writeBytes( aData );
-
- // write aspect
- aData[0] = 0x01; aData[1] = 0; aData[2] = 0; aData[3] = 0;
- xTempOutStream->writeBytes( aData );
-
- // write l-index
- *( (sal_uInt32*)aData.getArray() ) = 0xFFFFFFFF;
- xTempOutStream->writeBytes( aData );
-
- // write adv. flags
- aData[0] = 0x02; aData[1] = 0; aData[2] = 0; aData[3] = 0;
- xTempOutStream->writeBytes( aData );
-
- // write compression
- *( (sal_uInt32*)aData.getArray() ) = 0x0;
- xTempOutStream->writeBytes( aData );
-
- // get the size
- awt::Size aSize = getVisualAreaSize( embed::Aspects::MSOLE_CONTENT );
- sal_Int32 nIndex = 0;
-
- // write width
- for ( nIndex = 0; nIndex < 4; nIndex++ )
- {
- aData[nIndex] = (sal_Int8)( aSize.Width % 0x100 );
- aSize.Width /= 0x100;
- }
- xTempOutStream->writeBytes( aData );
-
- // write height
- for ( nIndex = 0; nIndex < 4; nIndex++ )
- {
- aData[nIndex] = (sal_Int8)( aSize.Height % 0x100 );
- aSize.Height /= 0x100;
- }
- xTempOutStream->writeBytes( aData );
-
- // write garbage, it will be overwritten by the size
- xTempOutStream->writeBytes( aData );
-
- // write first bytes that was used to detect the type
- xTempOutStream->writeBytes( aSigData );
-
- // write the rest of the stream
- ::comphelper::OStorageHelper::CopyInputToOutput( xInCacheStream, xTempOutStream );
-
- // write the size of the stream
- sal_Int64 nLength = xTempSeek->getLength() - 40;
- if ( nLength < 0 || nLength >= 0xFFFFFFFF )
- {
- OSL_FAIL( "Length is not acceptable!" );
- return;
- }
- for ( sal_Int32 nInd = 0; nInd < 4; nInd++ )
- {
- aData[nInd] = (sal_Int8)( ( (sal_uInt64) nLength ) % 0x100 );
- nLength /= 0x100;
- }
- xTempSeek->seek( 36 );
- xTempOutStream->writeBytes( aData );
-
- xTempOutStream->flush();
-
- xTempSeek->seek( 0 );
- if ( xCachedSeek.is() )
- xCachedSeek->seek( 0 );
- }
- else
- throw io::IOException(); // TODO:
-
- // insert the result file as replacement image
- ::rtl::OUString aCacheName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "\002OlePres000" ));
- if ( xNameContainer->hasByName( aCacheName ) )
- xNameContainer->replaceByName( aCacheName, uno::makeAny( xTempFile ) );
- else
- xNameContainer->insertByName( aCacheName, uno::makeAny( xTempFile ) );
-
- uno::Reference< embed::XTransactedObject > xTransacted( xNameContainer, uno::UNO_QUERY );
- if ( !xTransacted.is() )
- throw uno::RuntimeException();
-
- xTransacted->commit();
-}
-
-//------------------------------------------------------
-void OleEmbeddedObject::RemoveVisualCache_Impl( const uno::Reference< io::XStream >& xTargetStream )
- throw ( uno::Exception )
-{
- OSL_ENSURE( xTargetStream.is(), "Invalid argumant!\n" );
- if ( !xTargetStream.is() )
- throw uno::RuntimeException();
-
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[0] <<= xTargetStream;
- aArgs[1] <<= (sal_Bool)sal_True; // do not create copy
- uno::Reference< container::XNameContainer > xNameContainer(
- m_xFactory->createInstanceWithArguments(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OLESimpleStorage" )),
- aArgs ),
- uno::UNO_QUERY );
-
- if ( !xNameContainer.is() )
- throw uno::RuntimeException();
-
- for ( sal_uInt8 nInd = 0; nInd < 10; nInd++ )
- {
- ::rtl::OUString aStreamName(RTL_CONSTASCII_USTRINGPARAM( "\002OlePres00" ));
- aStreamName += ::rtl::OUString::valueOf( (sal_Int32)nInd );
- if ( xNameContainer->hasByName( aStreamName ) )
- xNameContainer->removeByName( aStreamName );
- }
-
- uno::Reference< embed::XTransactedObject > xTransacted( xNameContainer, uno::UNO_QUERY );
- if ( !xTransacted.is() )
- throw uno::RuntimeException();
-
- xTransacted->commit();
-}
-
-//------------------------------------------------------
-void OleEmbeddedObject::SetVisReplInStream( sal_Bool bExists )
-{
- m_bVisReplInitialized = sal_True;
- m_bVisReplInStream = bExists;
-}
-
-//------------------------------------------------------
-sal_Bool OleEmbeddedObject::HasVisReplInStream()
-{
- if ( !m_bVisReplInitialized )
- {
- if ( m_xCachedVisualRepresentation.is() )
- SetVisReplInStream( sal_True );
- else
- {
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObject::HasVisualReplInStream, analizing" );
-
- uno::Reference< io::XInputStream > xStream;
-
- OSL_ENSURE( !m_pOleComponent || m_aTempURL.getLength(), "The temporary file must exist if there is a component!\n" );
- if ( m_aTempURL.getLength() )
- {
- try
- {
- // open temporary file for reading
- uno::Reference < ucb::XSimpleFileAccess > xTempAccess(
- m_xFactory->createInstance (
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) )),
- uno::UNO_QUERY );
-
- if ( !xTempAccess.is() )
- throw uno::RuntimeException(); // TODO:
-
- xStream = xTempAccess->openFileRead( m_aTempURL );
- }
- catch( uno::Exception& )
- {}
- }
-
- if ( !xStream.is() )
- xStream = m_xObjectStream->getInputStream();
-
- if ( xStream.is() )
- {
- sal_Bool bExists = sal_False;
-
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[0] <<= xStream;
- aArgs[1] <<= (sal_Bool)sal_True; // do not create copy
- uno::Reference< container::XNameContainer > xNameContainer(
- m_xFactory->createInstanceWithArguments(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OLESimpleStorage" )),
- aArgs ),
- uno::UNO_QUERY );
-
- if ( xNameContainer.is() )
- {
- for ( sal_uInt8 nInd = 0; nInd < 10 && !bExists; nInd++ )
- {
- ::rtl::OUString aStreamName(RTL_CONSTASCII_USTRINGPARAM( "\002OlePres00" ));
- aStreamName += ::rtl::OUString::valueOf( (sal_Int32)nInd );
- try
- {
- bExists = xNameContainer->hasByName( aStreamName );
- }
- catch( uno::Exception& )
- {}
- }
- }
-
- SetVisReplInStream( bExists );
- }
- }
- }
-
- return m_bVisReplInStream;
-}
-
-//------------------------------------------------------
-uno::Reference< io::XStream > OleEmbeddedObject::TryToRetrieveCachedVisualRepresentation_Impl(
- const uno::Reference< io::XStream >& xStream,
- sal_Bool bAllowToRepair50 )
- throw ()
-{
- uno::Reference< io::XStream > xResult;
-
- if ( xStream.is() )
- {
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObject::TryToRetrieveCachedVisualRepresentation, retrieving" );
-
- uno::Reference< container::XNameContainer > xNameContainer;
- uno::Sequence< uno::Any > aArgs( 2 );
- aArgs[0] <<= xStream;
- aArgs[1] <<= (sal_Bool)sal_True; // do not create copy
- try
- {
- xNameContainer = uno::Reference< container::XNameContainer >(
- m_xFactory->createInstanceWithArguments(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OLESimpleStorage" )),
- aArgs ),
- uno::UNO_QUERY );
- }
- catch( uno::Exception& )
- {}
-
- if ( xNameContainer.is() )
- {
- for ( sal_uInt8 nInd = 0; nInd < 10; nInd++ )
- {
- ::rtl::OUString aStreamName(RTL_CONSTASCII_USTRINGPARAM( "\002OlePres00" ));
- aStreamName += ::rtl::OUString::valueOf( (sal_Int32)nInd );
- uno::Reference< io::XStream > xCachedCopyStream;
- try
- {
- if ( ( xNameContainer->getByName( aStreamName ) >>= xCachedCopyStream ) && xCachedCopyStream.is() )
- {
- xResult = TryToGetAcceptableFormat_Impl( xCachedCopyStream );
- if ( xResult.is() )
- break;
- }
- }
- catch( uno::Exception& )
- {}
-
- if ( nInd == 0 )
- {
- // to be compatible with the old versions Ole10Native is checked after OlePress000
- aStreamName = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "\001Ole10Native" ) );
- try
- {
- if ( ( xNameContainer->getByName( aStreamName ) >>= xCachedCopyStream ) && xCachedCopyStream.is() )
- {
- xResult = TryToGetAcceptableFormat_Impl( xCachedCopyStream );
- if ( xResult.is() )
- break;
- }
- }
- catch( uno::Exception& )
- {}
- }
- }
-
- try
- {
- if ( bAllowToRepair50 && !xResult.is() )
- {
- ::rtl::OUString aOrigContName( RTL_CONSTASCII_USTRINGPARAM( "Ole-Object" ) );
- if ( xNameContainer->hasByName( aOrigContName ) )
- {
- uno::Reference< embed::XClassifiedObject > xClassified( xNameContainer, uno::UNO_QUERY_THROW );
- uno::Sequence< sal_Int8 > aClassID;
- if ( MimeConfigurationHelper::ClassIDsEqual( xClassified->getClassID(), MimeConfigurationHelper::GetSequenceClassID( SO3_OUT_CLASSID ) ) )
- {
- // this is an OLE object wrongly stored in 5.0 format
- // this object must be repaired since SO7 has done it
-
- uno::Reference< io::XOutputStream > xOutputStream = xStream->getOutputStream();
- uno::Reference< io::XTruncate > xTruncate( xOutputStream, uno::UNO_QUERY_THROW );
-
- uno::Reference< io::XInputStream > xOrigInputStream;
- if ( ( xNameContainer->getByName( aOrigContName ) >>= xOrigInputStream )
- && xOrigInputStream.is() )
- {
- // the provided input stream must be based on temporary medium and must be independent
- // from the stream the storage is based on
- uno::Reference< io::XSeekable > xOrigSeekable( xOrigInputStream, uno::UNO_QUERY );
- if ( xOrigSeekable.is() )
- xOrigSeekable->seek( 0 );
-
- uno::Reference< lang::XComponent > xNameContDisp( xNameContainer, uno::UNO_QUERY_THROW );
- xNameContDisp->dispose(); // free the original stream
-
- xTruncate->truncate();
- ::comphelper::OStorageHelper::CopyInputToOutput( xOrigInputStream, xOutputStream );
- xOutputStream->flush();
-
- if ( xStream == m_xObjectStream )
- {
- if ( m_aTempURL.getLength() )
- {
- // this is the own stream, so the temporary URL must be cleaned if it exists
- KillFile_Impl( m_aTempURL, m_xFactory );
- m_aTempURL = ::rtl::OUString();
- }
-
-#ifdef WNT
- // retry to create the component after recovering
- GetRidOfComponent();
-
- try
- {
- CreateOleComponentAndLoad_Impl( NULL );
- m_aClassID = m_pOleComponent->GetCLSID(); // was not set during consruction
- }
- catch( uno::Exception& )
- {
- GetRidOfComponent();
- }
-#endif
- }
-
- xResult = TryToRetrieveCachedVisualRepresentation_Impl( xStream, sal_False );
- }
- }
- }
- }
- }
- catch( uno::Exception& )
- {}
- }
- }
-
- return xResult;
-}
-
-//------------------------------------------------------
-void OleEmbeddedObject::SwitchOwnPersistence( const uno::Reference< embed::XStorage >& xNewParentStorage,
- const uno::Reference< io::XStream >& xNewObjectStream,
- const ::rtl::OUString& aNewName )
-{
- if ( xNewParentStorage == m_xParentStorage && aNewName.equals( m_aEntryName ) )
- {
- OSL_ENSURE( xNewObjectStream == m_xObjectStream, "The streams must be the same!\n" );
- return;
- }
-
- try {
- uno::Reference< lang::XComponent > xComponent( m_xObjectStream, uno::UNO_QUERY );
- OSL_ENSURE( !m_xObjectStream.is() || xComponent.is(), "Wrong stream implementation!" );
- if ( xComponent.is() )
- xComponent->dispose();
- }
- catch ( uno::Exception& )
- {
- }
-
- m_xObjectStream = xNewObjectStream;
- m_xParentStorage = xNewParentStorage;
- m_aEntryName = aNewName;
-}
-
-//------------------------------------------------------
-void OleEmbeddedObject::SwitchOwnPersistence( const uno::Reference< embed::XStorage >& xNewParentStorage,
- const ::rtl::OUString& aNewName )
-{
- if ( xNewParentStorage == m_xParentStorage && aNewName.equals( m_aEntryName ) )
- return;
-
- sal_Int32 nStreamMode = m_bReadOnly ? embed::ElementModes::READ : embed::ElementModes::READWRITE;
-
- uno::Reference< io::XStream > xNewOwnStream = xNewParentStorage->openStreamElement( aNewName, nStreamMode );
- OSL_ENSURE( xNewOwnStream.is(), "The method can not return empty reference!" );
-
- SwitchOwnPersistence( xNewParentStorage, xNewOwnStream, aNewName );
-}
-
-#ifdef WNT
-//----------------------------------------------
-sal_Bool OleEmbeddedObject::SaveObject_Impl()
-{
- sal_Bool bResult = sal_False;
-
- if ( m_xClientSite.is() )
- {
- try
- {
- m_xClientSite->saveObject();
- bResult = sal_True;
- }
- catch( uno::Exception& )
- {
- }
- }
-
- return bResult;
-}
-
-//----------------------------------------------
-sal_Bool OleEmbeddedObject::OnShowWindow_Impl( sal_Bool bShow )
-{
- ::osl::ResettableMutexGuard aGuard( m_aMutex );
-
- sal_Bool bResult = sal_False;
-
- OSL_ENSURE( m_nObjectState != -1, "The object has no persistence!\n" );
- OSL_ENSURE( m_nObjectState != embed::EmbedStates::LOADED, "The object get OnShowWindow in loaded state!\n" );
- if ( m_nObjectState == -1 || m_nObjectState == embed::EmbedStates::LOADED )
- return sal_False;
-
- // the object is either activated or deactivated
- sal_Int32 nOldState = m_nObjectState;
- if ( bShow && m_nObjectState == embed::EmbedStates::RUNNING )
- {
- m_nObjectState = embed::EmbedStates::ACTIVE;
- m_aVerbExecutionController.ObjectIsActive();
-
- aGuard.clear();
- StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState );
- }
- else if ( !bShow && m_nObjectState == embed::EmbedStates::ACTIVE )
- {
- m_nObjectState = embed::EmbedStates::RUNNING;
- aGuard.clear();
- StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState );
- }
-
- if ( m_xClientSite.is() )
- {
- try
- {
- m_xClientSite->visibilityChanged( bShow );
- bResult = sal_True;
- }
- catch( uno::Exception& )
- {
- }
- }
-
- return bResult;
-}
-
-//------------------------------------------------------
-void OleEmbeddedObject::OnIconChanged_Impl()
-{
- // TODO/LATER: currently this notification seems to be impossible
- // MakeEventListenerNotification_Impl( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "OnIconChanged" )) );
-}
-
-//------------------------------------------------------
-void OleEmbeddedObject::OnViewChanged_Impl()
-{
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- // For performance reasons the notification currently is ignored, STAMPIT object is the exception,
- // it can never be active and never call SaveObject, so it is the only way to detect that it is changed
-
- // ==== the STAMPIT related solution =============================
- // the following variable is used to detect whether the object was modified during verb execution
- m_aVerbExecutionController.ModificationNotificationIsDone();
-
- // The following things are controlled by VerbExecutionController:
- // - if the verb execution is in progress and the view is changed the object will be stored
- // after the execution, so there is no need to send the notification.
- // - the STAMPIT object can never be active.
- if ( m_aVerbExecutionController.CanDoNotification()
- && m_pOleComponent && m_nUpdateMode == embed::EmbedUpdateModes::ALWAYS_UPDATE )
- {
- OSL_ENSURE( MimeConfigurationHelper::ClassIDsEqual( m_aClassID, MimeConfigurationHelper::GetSequenceClassID( 0x852ee1c9, 0x9058, 0x44ba, 0x8c,0x6c,0x0c,0x5f,0xc6,0x6b,0xdb,0x8d ) )
- || MimeConfigurationHelper::ClassIDsEqual( m_aClassID, MimeConfigurationHelper::GetSequenceClassID( 0xcf1b4491, 0xbea3, 0x4c9f, 0xa7,0x0f,0x22,0x1b,0x1e,0xca,0xef,0x3e ) ),
- "Expected to be triggered for STAMPIT only! Please contact developers!\n" );
-
- // The view is changed while the object is in running state, save the new object
- m_xCachedVisualRepresentation = uno::Reference< io::XStream >();
- SaveObject_Impl();
- MakeEventListenerNotification_Impl( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "OnVisAreaChanged" )) );
- }
- // ===============================================================
-}
-
-//------------------------------------------------------
-void OleEmbeddedObject::OnClosed_Impl()
-{
- if ( m_bDisposed )
- throw lang::DisposedException();
-
- if ( m_nObjectState != embed::EmbedStates::LOADED )
- {
- sal_Int32 nOldState = m_nObjectState;
- m_nObjectState = embed::EmbedStates::LOADED;
- StateChangeNotification_Impl( sal_False, nOldState, m_nObjectState );
- }
-}
-
-//------------------------------------------------------
-::rtl::OUString OleEmbeddedObject::CreateTempURLEmpty_Impl()
-{
- OSL_ENSURE( !m_aTempURL.getLength(), "The object has already the temporary file!" );
- m_aTempURL = GetNewTempFileURL_Impl( m_xFactory );
-
- return m_aTempURL;
-}
-
-//------------------------------------------------------
-::rtl::OUString OleEmbeddedObject::GetTempURL_Impl()
-{
- if ( !m_aTempURL.getLength() )
- {
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObject::GetTempURL_Impl, tempfile creation" );
-
- // if there is no temporary file, it will be created from the own entry
- uno::Reference< embed::XOptimizedStorage > xOptParStorage( m_xParentStorage, uno::UNO_QUERY );
- if ( xOptParStorage.is() )
- {
- m_aTempURL = GetNewFilledTempFile_Impl( xOptParStorage, m_aEntryName, m_xFactory );
- }
- else if ( m_xObjectStream.is() )
- {
- // load object from the stream
- uno::Reference< io::XInputStream > xInStream = m_xObjectStream->getInputStream();
- if ( !xInStream.is() )
- throw io::IOException(); // TODO: access denied
-
- m_aTempURL = GetNewFilledTempFile_Impl( xInStream, m_xFactory );
- }
- }
-
- return m_aTempURL;
-}
-
-//------------------------------------------------------
-void OleEmbeddedObject::CreateOleComponent_Impl( OleComponent* pOleComponent )
-{
- if ( !m_pOleComponent )
- {
- m_pOleComponent = pOleComponent ? pOleComponent : new OleComponent( m_xFactory, this );
- m_pOleComponent->acquire(); // TODO: needs holder?
-
- if ( !m_xClosePreventer.is() )
- m_xClosePreventer = uno::Reference< util::XCloseListener >(
- static_cast< ::cppu::OWeakObject* >( new OClosePreventer ),
- uno::UNO_QUERY );
-
- m_pOleComponent->addCloseListener( m_xClosePreventer );
- }
-}
-
-//------------------------------------------------------
-void OleEmbeddedObject::CreateOleComponentAndLoad_Impl( OleComponent* pOleComponent )
-{
- if ( !m_pOleComponent )
- {
- if ( !m_xObjectStream.is() )
- throw uno::RuntimeException();
-
- CreateOleComponent_Impl( pOleComponent );
-
- // after the loading the object can appear as a link
- // will be detected later by olecomponent
-
- GetTempURL_Impl();
- if ( !m_aTempURL.getLength() )
- throw uno::RuntimeException(); // TODO
-
- m_pOleComponent->LoadEmbeddedObject( m_aTempURL );
- }
-}
-
-//------------------------------------------------------
-void OleEmbeddedObject::CreateOleComponentFromClipboard_Impl( OleComponent* pOleComponent )
-{
- if ( !m_pOleComponent )
- {
- if ( !m_xObjectStream.is() )
- throw uno::RuntimeException();
-
- CreateOleComponent_Impl( pOleComponent );
-
- // after the loading the object can appear as a link
- // will be detected later by olecomponent
- m_pOleComponent->CreateObjectFromClipboard();
- }
-}
-
-//------------------------------------------------------
-uno::Reference< io::XOutputStream > OleEmbeddedObject::GetStreamForSaving()
-{
- if ( !m_xObjectStream.is() )
- throw uno::RuntimeException(); //TODO:
-
- uno::Reference< io::XOutputStream > xOutStream = m_xObjectStream->getOutputStream();
- if ( !xOutStream.is() )
- throw io::IOException(); //TODO: access denied
-
- uno::Reference< io::XTruncate > xTruncate( xOutStream, uno::UNO_QUERY );
- if ( !xTruncate.is() )
- throw uno::RuntimeException(); //TODO:
-
- xTruncate->truncate();
-
- return xOutStream;
-}
-
-//----------------------------------------------
-void OleEmbeddedObject::StoreObjectToStream( uno::Reference< io::XOutputStream > xOutStream )
- throw ( uno::Exception )
-{
- // this method should be used only on windows
- if ( m_pOleComponent )
- m_pOleComponent->StoreOwnTmpIfNecessary();
-
- // now all the changes should be in temporary location
- if ( !m_aTempURL )
- throw uno::RuntimeException();
-
- // open temporary file for reading
- uno::Reference < ucb::XSimpleFileAccess > xTempAccess(
- m_xFactory->createInstance (
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) )),
- uno::UNO_QUERY );
-
- if ( !xTempAccess.is() )
- throw uno::RuntimeException(); // TODO:
-
- uno::Reference< io::XInputStream > xTempInStream = xTempAccess->openFileRead( m_aTempURL );
- OSL_ENSURE( xTempInStream.is(), "The object's temporary file can not be reopened for reading!\n" );
-
- // TODO: use bStoreVisReplace
-
- if ( xTempInStream.is() )
- {
- // write all the contents to XOutStream
- uno::Reference< io::XTruncate > xTrunc( xOutStream, uno::UNO_QUERY );
- if ( !xTrunc.is() )
- throw uno::RuntimeException(); //TODO:
-
- xTrunc->truncate();
-
- ::comphelper::OStorageHelper::CopyInputToOutput( xTempInStream, xOutStream );
- }
- else
- throw io::IOException(); // TODO:
-
- // TODO: should the view replacement be in the stream ???
- // probably it must be specified on storing
-}
-#endif
-//------------------------------------------------------
-void OleEmbeddedObject::StoreToLocation_Impl(
- const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const uno::Sequence< beans::PropertyValue >& /*lArguments*/,
- const uno::Sequence< beans::PropertyValue >& lObjArgs,
- sal_Bool bSaveAs )
- throw ( uno::Exception )
-{
- // TODO: use lObjArgs
- // TODO: exchange StoreVisualReplacement by SO file format version?
-
- if ( m_nObjectState == -1 )
- {
- // the object is still not loaded
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Can't store object without persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- OSL_ENSURE( m_xParentStorage.is() && m_xObjectStream.is(), "The object has no valid persistence!\n" );
-
- sal_Bool bVisReplIsStored = sal_False;
-
- sal_Bool bTryOptimization = sal_False;
- sal_Bool bStoreVis = m_bStoreVisRepl;
- uno::Reference< io::XStream > xCachedVisualRepresentation;
- for ( sal_Int32 nInd = 0; nInd < lObjArgs.getLength(); nInd++ )
- {
- if ( lObjArgs[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StoreVisualReplacement" ) ) )
- lObjArgs[nInd].Value >>= bStoreVis;
- else if ( lObjArgs[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "VisualReplacement" ) ) )
- lObjArgs[nInd].Value >>= xCachedVisualRepresentation;
- else if ( lObjArgs[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CanTryOptimization" ) ) )
- lObjArgs[nInd].Value >>= bTryOptimization;
- }
-
- // ignore visual representation provided from outside if it should not be stored
- if ( !bStoreVis )
- xCachedVisualRepresentation = uno::Reference< io::XStream >();
-
- if ( bStoreVis && !HasVisReplInStream() && !xCachedVisualRepresentation.is() )
- throw io::IOException(); // TODO: there is no cached visual representation and nothing is provided from outside
-
- // if the representation is provided from outside it should be copied to a local stream
- sal_Bool bNeedLocalCache = xCachedVisualRepresentation.is();
-
- uno::Reference< io::XStream > xTargetStream;
-
- sal_Bool bStoreLoaded = sal_False;
- if ( m_nObjectState == embed::EmbedStates::LOADED
-#ifdef WNT
- // if the object was NOT modified after storing it can be just copied
- // as if it was in loaded state
- || ( m_pOleComponent && !m_pOleComponent->IsDirty() )
-#endif
- )
- {
- sal_Bool bOptimizedCopyingDone = sal_False;
-
- if ( bTryOptimization && bStoreVis == HasVisReplInStream() )
- {
- try
- {
- uno::Reference< embed::XOptimizedStorage > xSourceOptStor( m_xParentStorage, uno::UNO_QUERY_THROW );
- uno::Reference< embed::XOptimizedStorage > xTargetOptStor( xStorage, uno::UNO_QUERY_THROW );
- xSourceOptStor->copyElementDirectlyTo( m_aEntryName, xTargetOptStor, sEntName );
- bOptimizedCopyingDone = sal_True;
- }
- catch( uno::Exception& )
- {
- }
- }
-
- if ( !bOptimizedCopyingDone )
- {
- // if optimized copying fails a normal one should be tried
- m_xParentStorage->copyElementTo( m_aEntryName, xStorage, sEntName );
- }
-
- // the locally retrieved representation is always preferable
- // since the object is in loaded state the representation is unchanged
- if ( m_xCachedVisualRepresentation.is() )
- {
- xCachedVisualRepresentation = m_xCachedVisualRepresentation;
- bNeedLocalCache = sal_False;
- }
-
- bVisReplIsStored = HasVisReplInStream();
- bStoreLoaded = sal_True;
- }
-#ifdef WNT
- else if ( m_pOleComponent )
- {
- xTargetStream =
- xStorage->openStreamElement( sEntName, embed::ElementModes::READWRITE );
- if ( !xTargetStream.is() )
- throw io::IOException(); //TODO: access denied
-
- SetStreamMediaType_Impl( xTargetStream, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "application/vnd.sun.star.oleobject" ) ));
- uno::Reference< io::XOutputStream > xOutStream = xTargetStream->getOutputStream();
- if ( !xOutStream.is() )
- throw io::IOException(); //TODO: access denied
-
- StoreObjectToStream( xOutStream );
- bVisReplIsStored = sal_True;
-
- if ( bSaveAs )
- {
- // no need to do it on StoreTo since in this case the replacement is in the stream
- // and there is no need to cache it even if it is thrown away because the object
- // is not changed by StoreTo action
-
- uno::Reference< io::XStream > xTmpCVRepresentation =
- TryToRetrieveCachedVisualRepresentation_Impl( xTargetStream );
-
- // the locally retrieved representation is always preferable
- if ( xTmpCVRepresentation.is() )
- {
- xCachedVisualRepresentation = xTmpCVRepresentation;
- bNeedLocalCache = sal_False;
- }
- }
- }
-#endif
- else
- {
- throw io::IOException(); // TODO
- }
-
- if ( !xTargetStream.is() )
- {
- xTargetStream =
- xStorage->openStreamElement( sEntName, embed::ElementModes::READWRITE );
- if ( !xTargetStream.is() )
- throw io::IOException(); //TODO: access denied
- }
-
- LetCommonStoragePassBeUsed_Impl( xTargetStream );
-
- if ( bStoreVis != bVisReplIsStored )
- {
- if ( bStoreVis )
- {
- if ( !xCachedVisualRepresentation.is() )
- xCachedVisualRepresentation = TryToRetrieveCachedVisualRepresentation_Impl( xTargetStream );
-
- OSL_ENSURE( xCachedVisualRepresentation.is(), "No representation is available!" );
-
- // the following copying will be done in case it is SaveAs anyway
- // if it is not SaveAs the seekable access is not required currently
- // TODO/LATER: may be required in future
- if ( bSaveAs )
- {
- uno::Reference< io::XSeekable > xCachedSeek( xCachedVisualRepresentation, uno::UNO_QUERY );
- if ( !xCachedSeek.is() )
- {
- xCachedVisualRepresentation
- = GetNewFilledTempStream_Impl( xCachedVisualRepresentation->getInputStream() );
- bNeedLocalCache = sal_False;
- }
- }
-
- InsertVisualCache_Impl( xTargetStream, xCachedVisualRepresentation );
- }
- else
- {
- // the removed representation could be cached by this method
- if ( !xCachedVisualRepresentation.is() )
- xCachedVisualRepresentation = TryToRetrieveCachedVisualRepresentation_Impl( xTargetStream );
-
- RemoveVisualCache_Impl( xTargetStream );
- }
- }
-
- if ( bSaveAs )
- {
- m_bWaitSaveCompleted = sal_True;
- m_xNewObjectStream = xTargetStream;
- m_xNewParentStorage = xStorage;
- m_aNewEntryName = sEntName;
- m_bNewVisReplInStream = bStoreVis;
- m_bStoreLoaded = bStoreLoaded;
-
- if ( xCachedVisualRepresentation.is() )
- {
- if ( bNeedLocalCache )
- m_xNewCachedVisRepl = GetNewFilledTempStream_Impl( xCachedVisualRepresentation->getInputStream() );
- else
- m_xNewCachedVisRepl = xCachedVisualRepresentation;
- }
-
- // TODO: register listeners for storages above, in case they are disposed
- // an exception will be thrown on saveCompleted( true )
- }
- else
- {
- uno::Reference< lang::XComponent > xComp( xTargetStream, uno::UNO_QUERY );
- if ( xComp.is() )
- {
- try {
- xComp->dispose();
- } catch( uno::Exception& )
- {
- }
- }
- }
-}
-
-//------------------------------------------------------
-void SAL_CALL OleEmbeddedObject::setPersistentEntry(
- 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 )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObject::setPersistentEntry" );
-
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbedPersist > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->setPersistentEntry( xStorage, sEntName, nEntryConnectionMode, lArguments, lObjArgs );
- return;
- }
- // end wrapping related part ====================
-
- // TODO: use lObjArgs
-
- // the type of the object must be already set
- // a kind of typedetection should be done in the factory;
- // the only exception is object initialized from a stream,
- // the class ID will be detected from the stream
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 1 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 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 ) )
- {
- // 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(RTL_CONSTASCII_USTRINGPARAM( "Can't change persistant representation of activated object!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- if ( m_bWaitSaveCompleted )
- {
- if ( nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
- saveCompleted( ( m_xParentStorage != xStorage || !m_aEntryName.equals( sEntName ) ) );
- else
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- 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 );
-
- m_bReadOnly = sal_False;
- sal_Int32 nInd = 0;
- for ( nInd = 0; nInd < lArguments.getLength(); nInd++ )
- if ( lArguments[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "ReadOnly" ) ) )
- lArguments[nInd].Value >>= m_bReadOnly;
-
-#ifdef WNT
- sal_Int32 nStorageMode = m_bReadOnly ? embed::ElementModes::READ : embed::ElementModes::READWRITE;
-#endif
-
- SwitchOwnPersistence( xStorage, sEntName );
-
- for ( nInd = 0; nInd < lObjArgs.getLength(); nInd++ )
- if ( lObjArgs[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "StoreVisualReplacement" ) ) )
- lObjArgs[nInd].Value >>= m_bStoreVisRepl;
-
-#ifdef WNT
- if ( nEntryConnectionMode == embed::EntryInitModes::DEFAULT_INIT )
- {
- if ( m_bFromClipboard )
- {
- // the object should be initialized from clipboard
- // inpossibility to initialize the object means error here
- CreateOleComponentFromClipboard_Impl( NULL );
- m_aClassID = m_pOleComponent->GetCLSID(); // was not set during consruction
- m_pOleComponent->RunObject();
- m_nObjectState = embed::EmbedStates::RUNNING;
- }
- else if ( bElExists )
- {
- // load object from the stream
- // after the loading the object can appear as a link
- // will be detected by olecomponent
- try
- {
- CreateOleComponentAndLoad_Impl( NULL );
- m_aClassID = m_pOleComponent->GetCLSID(); // was not set during consruction
- }
- catch( uno::Exception& )
- {
- // TODO/LATER: detect classID of the object if possible
- // means that the object inprocess server could not be successfuly instantiated
- GetRidOfComponent();
- }
-
- m_nObjectState = embed::EmbedStates::LOADED;
- }
- else
- {
- // create a new object
- CreateOleComponent_Impl();
- m_pOleComponent->CreateNewEmbeddedObject( m_aClassID );
- m_pOleComponent->RunObject();
- m_nObjectState = embed::EmbedStates::RUNNING;
- }
- }
- else
- {
- if ( ( nStorageMode & embed::ElementModes::READWRITE ) != embed::ElementModes::READWRITE )
- throw io::IOException();
-
- if ( nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
- {
- // the document just already changed its stream to store to;
- // the links to OLE documents switch their persistence in the same way
- // as normal embedded objects
- }
- else if ( nEntryConnectionMode == embed::EntryInitModes::TRUNCATE_INIT )
- {
- // create a new object, that will be stored in specified stream
- CreateOleComponent_Impl();
-
- m_pOleComponent->CreateNewEmbeddedObject( m_aClassID );
- m_pOleComponent->RunObject();
- m_nObjectState = embed::EmbedStates::RUNNING;
- }
- else if ( nEntryConnectionMode == embed::EntryInitModes::MEDIA_DESCRIPTOR_INIT )
- {
- // use URL ( may be content or stream later ) from MediaDescriptor to initialize object
- ::rtl::OUString aURL;
- for ( sal_Int32 nInd = 0; nInd < lArguments.getLength(); nInd++ )
- if ( lArguments[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "URL" ) ) )
- lArguments[nInd].Value >>= aURL;
-
- if ( !aURL.getLength() )
- throw lang::IllegalArgumentException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty URL is provided in the media descriptor!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 4 );
-
- CreateOleComponent_Impl();
-
- // TODO: the m_bIsLink value must be set already
- if ( !m_bIsLink )
- m_pOleComponent->CreateObjectFromFile( aURL );
- else
- m_pOleComponent->CreateLinkFromFile( aURL );
-
- m_pOleComponent->RunObject();
- m_aClassID = m_pOleComponent->GetCLSID(); // was not set during consruction
-
- m_nObjectState = embed::EmbedStates::RUNNING;
- }
- //else if ( nEntryConnectionMode == embed::EntryInitModes::TRANSFERABLE_INIT )
- //{
- //TODO:
- //}
- else
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Wrong connection mode is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 3 );
- }
-#else
- // On unix the ole object can not do anything except storing itself somewere
- if ( nEntryConnectionMode == embed::EntryInitModes::DEFAULT_INIT && bElExists )
- {
- // TODO/LATER: detect classID of the object
- // can be a real problem for the links
-
- m_nObjectState = embed::EmbedStates::LOADED;
- }
- else if ( nEntryConnectionMode == embed::EntryInitModes::NO_INIT )
- {
- // do nothing, the object has already switched it's persistence
- }
- else
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Wrong connection mode is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 3 );
-
-#endif
-}
-
-//------------------------------------------------------
-void SAL_CALL OleEmbeddedObject::storeToEntry( const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const uno::Sequence< beans::PropertyValue >& lArguments,
- const uno::Sequence< beans::PropertyValue >& lObjArgs )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObject::storeToEntry" );
-
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbedPersist > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->storeToEntry( xStorage, sEntName, lArguments, lObjArgs );
- return;
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- VerbExecutionControllerGuard aVerbGuard( m_aVerbExecutionController );
-
- StoreToLocation_Impl( xStorage, sEntName, lArguments, lObjArgs, sal_False );
-
- // TODO: should the listener notification be done?
-}
-
-//------------------------------------------------------
-void SAL_CALL OleEmbeddedObject::storeAsEntry( const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const uno::Sequence< beans::PropertyValue >& lArguments,
- const uno::Sequence< beans::PropertyValue >& lObjArgs )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObject::storeAsEntry" );
-
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbedPersist > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->storeAsEntry( xStorage, sEntName, lArguments, lObjArgs );
- return;
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- VerbExecutionControllerGuard aVerbGuard( m_aVerbExecutionController );
-
- StoreToLocation_Impl( xStorage, sEntName, lArguments, lObjArgs, sal_True );
-
- // TODO: should the listener notification be done here or in saveCompleted?
-}
-
-//------------------------------------------------------
-void SAL_CALL OleEmbeddedObject::saveCompleted( sal_Bool bUseNew )
- throw ( embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObject::saveCompleted" );
-
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbedPersist > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->saveCompleted( bUseNew );
- return;
- }
- // end wrapping related part ====================
-
- ::osl::ResettableMutexGuard 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(RTL_CONSTASCII_USTRINGPARAM( "Can't store object without persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- // it is allowed to call saveCompleted( false ) for nonstored objects
- if ( !m_bWaitSaveCompleted && !bUseNew )
- return;
-
- OSL_ENSURE( m_bWaitSaveCompleted, "Unexpected saveCompleted() call!\n" );
- if ( !m_bWaitSaveCompleted )
- throw io::IOException(); // TODO: illegal call
-
- OSL_ENSURE( m_xNewObjectStream.is() && m_xNewParentStorage.is() , "Internal object information is broken!\n" );
- if ( !m_xNewObjectStream.is() || !m_xNewParentStorage.is() )
- throw uno::RuntimeException(); // TODO: broken internal information
-
- if ( bUseNew )
- {
- SwitchOwnPersistence( m_xNewParentStorage, m_xNewObjectStream, m_aNewEntryName );
- m_bStoreVisRepl = m_bNewVisReplInStream;
- SetVisReplInStream( m_bNewVisReplInStream );
- m_xCachedVisualRepresentation = m_xNewCachedVisRepl;
- }
- else
- {
- // close remembered stream
- try {
- uno::Reference< lang::XComponent > xComponent( m_xNewObjectStream, uno::UNO_QUERY );
- OSL_ENSURE( xComponent.is(), "Wrong storage implementation!" );
- if ( xComponent.is() )
- xComponent->dispose();
- }
- catch ( uno::Exception& )
- {
- }
- }
-
- sal_Bool bStoreLoaded = m_bStoreLoaded;
-
- m_xNewObjectStream = uno::Reference< io::XStream >();
- m_xNewParentStorage = uno::Reference< embed::XStorage >();
- m_aNewEntryName = ::rtl::OUString();
- m_bWaitSaveCompleted = sal_False;
- m_bNewVisReplInStream = sal_False;
- m_xNewCachedVisRepl = uno::Reference< io::XStream >();
- m_bStoreLoaded = sal_False;
-
- if ( bUseNew && m_pOleComponent && m_nUpdateMode == embed::EmbedUpdateModes::ALWAYS_UPDATE && !bStoreLoaded
- && m_nObjectState != embed::EmbedStates::LOADED )
- {
- // the object replacement image should be updated, so the cached size as well
- m_bHasCachedSize = sal_False;
- try
- {
- // the call will cache the size in case of success
- // probably it might need to be done earlier, while the object is in active state
- getVisualAreaSize( embed::Aspects::MSOLE_CONTENT );
- }
- catch( uno::Exception& )
- {}
- }
-
- aGuard.clear();
- if ( bUseNew )
- {
- MakeEventListenerNotification_Impl( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "OnSaveAsDone" ) ));
-
- // the object can be changed only on windows
- // the notification should be done only if the object is not in loaded state
- if ( m_pOleComponent && m_nUpdateMode == embed::EmbedUpdateModes::ALWAYS_UPDATE && !bStoreLoaded )
- {
- MakeEventListenerNotification_Impl( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "OnVisAreaChanged" ) ));
- }
- }
-}
-
-//------------------------------------------------------
-sal_Bool SAL_CALL OleEmbeddedObject::hasEntry()
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbedPersist > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- return xWrappedObject->hasEntry();
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- if ( m_xObjectStream.is() )
- return sal_True;
-
- return sal_False;
-}
-
-//------------------------------------------------------
-::rtl::OUString SAL_CALL OleEmbeddedObject::getEntryName()
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbedPersist > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- return xWrappedObject->getEntryName();
- }
- // end wrapping related part ====================
-
- ::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(RTL_CONSTASCII_USTRINGPARAM( "The object persistence is not initialized!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- return m_aEntryName;
-}
-
-
-//------------------------------------------------------
-void SAL_CALL OleEmbeddedObject::storeOwn()
- throw ( embed::WrongStateException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObject::storeOwn" );
-
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbedPersist > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->storeOwn();
- return;
- }
- // end wrapping related part ====================
-
- // 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 );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- VerbExecutionControllerGuard aVerbGuard( m_aVerbExecutionController );
-
- if ( m_nObjectState == -1 )
- {
- // the object is still not loaded
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Can't store object without persistence!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- if ( m_bReadOnly )
- throw io::IOException(); // TODO: access denied
-
- LetCommonStoragePassBeUsed_Impl( m_xObjectStream );
-
- sal_Bool bStoreLoaded = sal_True;
-
-#ifdef WNT
- if ( m_nObjectState != embed::EmbedStates::LOADED && m_pOleComponent && m_pOleComponent->IsDirty() )
- {
- bStoreLoaded = sal_False;
-
- OSL_ENSURE( m_xParentStorage.is() && m_xObjectStream.is(), "The object has no valid persistence!\n" );
-
- if ( !m_xObjectStream.is() )
- throw io::IOException(); //TODO: access denied
-
- SetStreamMediaType_Impl( m_xObjectStream, ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "application/vnd.sun.star.oleobject" ) ));
- uno::Reference< io::XOutputStream > xOutStream = m_xObjectStream->getOutputStream();
- if ( !xOutStream.is() )
- throw io::IOException(); //TODO: access denied
-
- // TODO: does this work for links too?
- StoreObjectToStream( GetStreamForSaving() );
-
- // the replacement is changed probably, and it must be in the object stream
- if ( !m_pOleComponent->IsWorkaroundActive() )
- m_xCachedVisualRepresentation = uno::Reference< io::XStream >();
- SetVisReplInStream( sal_True );
- }
-#endif
-
- if ( m_bStoreVisRepl != HasVisReplInStream() )
- {
- if ( m_bStoreVisRepl )
- {
- // the m_xCachedVisualRepresentation must be set or it should be already stored
- if ( m_xCachedVisualRepresentation.is() )
- InsertVisualCache_Impl( m_xObjectStream, m_xCachedVisualRepresentation );
- else
- {
- m_xCachedVisualRepresentation = TryToRetrieveCachedVisualRepresentation_Impl( m_xObjectStream );
- OSL_ENSURE( m_xCachedVisualRepresentation.is(), "No representation is available!" );
- }
- }
- else
- {
- if ( !m_xCachedVisualRepresentation.is() )
- m_xCachedVisualRepresentation = TryToRetrieveCachedVisualRepresentation_Impl( m_xObjectStream );
- RemoveVisualCache_Impl( m_xObjectStream );
- }
-
- SetVisReplInStream( m_bStoreVisRepl );
- }
-
- if ( m_pOleComponent && m_nUpdateMode == embed::EmbedUpdateModes::ALWAYS_UPDATE && !bStoreLoaded )
- {
- // the object replacement image should be updated, so the cached size as well
- m_bHasCachedSize = sal_False;
- try
- {
- // the call will cache the size in case of success
- // probably it might need to be done earlier, while the object is in active state
- getVisualAreaSize( embed::Aspects::MSOLE_CONTENT );
- }
- catch( uno::Exception& )
- {}
- }
-
- aGuard.clear();
-
- MakeEventListenerNotification_Impl( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "OnSaveDone" ) ));
-
- // the object can be changed only on Windows
- // the notification should be done only if the object is not in loaded state
- if ( m_pOleComponent && m_nUpdateMode == embed::EmbedUpdateModes::ALWAYS_UPDATE && !bStoreLoaded )
- MakeEventListenerNotification_Impl( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "OnVisAreaChanged" ) ));
-}
-
-//------------------------------------------------------
-sal_Bool SAL_CALL OleEmbeddedObject::isReadonly()
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbedPersist > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- return xWrappedObject->isReadonly();
- }
- // end wrapping related part ====================
-
- ::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(RTL_CONSTASCII_USTRINGPARAM( "The object persistence is not initialized!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- return m_bReadOnly;
-}
-
-//------------------------------------------------------
-void SAL_CALL OleEmbeddedObject::reload(
- const uno::Sequence< beans::PropertyValue >& lArguments,
- const uno::Sequence< beans::PropertyValue >& lObjArgs )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbedPersist > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->reload( lArguments, lObjArgs );
- return;
- }
- // end wrapping related part ====================
-
- // TODO: use lObjArgs
-
- ::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(RTL_CONSTASCII_USTRINGPARAM( "The object persistence is not initialized!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- // TODO:
- // throw away current document
- // load new document from current storage
- // use meaningfull part of lArguments
-}
-
-//------------------------------------------------------
-void SAL_CALL OleEmbeddedObject::breakLink( const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XLinkageSupport > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->breakLink( xStorage, sEntName );
- return;
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 1 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 2 );
-
- // TODO: The object must be at least in Running state;
- if ( !m_bIsLink || m_nObjectState == -1 || !m_pOleComponent )
- {
- // it must be a linked initialized object
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object is not a valid linked object!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- if ( m_bReadOnly )
- throw io::IOException(); // TODO: Access denied
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
-
-#ifdef WNT
- if ( m_pOleComponent )
- {
- // TODO: create an object based on the link
-
- // disconnect the old temporary URL
- ::rtl::OUString aOldTempURL = m_aTempURL;
- m_aTempURL = ::rtl::OUString();
-
- OleComponent* pNewOleComponent = new OleComponent( m_xFactory, this );
- try {
- pNewOleComponent->InitEmbeddedCopyOfLink( m_pOleComponent );
- }
- catch ( uno::Exception& )
- {
- delete pNewOleComponent;
- if ( m_aTempURL )
- KillFile_Impl( m_aTempURL, m_xFactory );
- m_aTempURL = aOldTempURL;
- throw;
- }
-
- try {
- GetRidOfComponent();
- }
- catch( uno::Exception& )
- {
- delete pNewOleComponent;
- if ( m_aTempURL )
- KillFile_Impl( m_aTempURL, m_xFactory );
- m_aTempURL = aOldTempURL;
- throw;
- }
-
- KillFile_Impl( aOldTempURL, m_xFactory );
-
- CreateOleComponent_Impl( pNewOleComponent );
-
- if ( m_xParentStorage != xStorage || !m_aEntryName.equals( sEntName ) )
- SwitchOwnPersistence( xStorage, sEntName );
-
- if ( m_nObjectState != embed::EmbedStates::LOADED )
- {
- // TODO: should we activate the new object if the link was activated?
-
- sal_Int32 nTargetState = m_nObjectState;
- m_nObjectState = embed::EmbedStates::LOADED;
-
- if ( m_nObjectState == embed::EmbedStates::RUNNING )
- m_pOleComponent->RunObject(); // the object already was in running state, the server must be installed
- else // m_nObjectState == embed::EmbedStates::ACTIVE
- {
- m_pOleComponent->RunObject(); // the object already was in running state, the server must be installed
- m_pOleComponent->ExecuteVerb( embed::EmbedVerbs::MS_OLEVERB_OPEN );
- }
-
- m_nObjectState = nTargetState;
- }
-
- m_bIsLink = sal_False;
- m_aLinkURL = ::rtl::OUString();
- }
- else
-#endif
- {
- throw io::IOException(); //TODO:
- }
-}
-
-//------------------------------------------------------
-sal_Bool SAL_CALL OleEmbeddedObject::isLink()
- throw ( embed::WrongStateException,
- uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XLinkageSupport > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- return xWrappedObject->isLink();
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- return m_bIsLink;
-}
-
-//------------------------------------------------------
-::rtl::OUString SAL_CALL OleEmbeddedObject::getLinkURL()
- throw ( embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XLinkageSupport > xWrappedObject( m_xWrappedObject, uno::UNO_QUERY );
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- return xWrappedObject->getLinkURL();
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- if ( m_bWaitSaveCompleted )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object waits for saveCompleted() call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- if ( !m_bIsLink )
- throw embed::WrongStateException(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object is not a link object!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- // TODO: probably the link URL can be retrieved from OLE
-
- return m_aLinkURL;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/oleregister.cxx b/embeddedobj/source/msole/oleregister.cxx
deleted file mode 100644
index b34e4f389c..0000000000
--- a/embeddedobj/source/msole/oleregister.cxx
+++ /dev/null
@@ -1,84 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-
-
-#include <com/sun/star/registry/XRegistryKey.hpp>
-#include <com/sun/star/registry/InvalidRegistryException.hpp>
-#include <cppuhelper/factory.hxx>
-
-#include "xolefactory.hxx"
-#include "xdialogcreator.hxx"
-
-using namespace ::com::sun::star;
-
-
-extern "C" {
-
-SAL_DLLPUBLIC_EXPORT void * SAL_CALL component_getFactory( const sal_Char * pImplName, void * pServiceManager, void * /*pRegistryKey*/ )
-{
- void * pRet = 0;
-
- ::rtl::OUString aImplName( ::rtl::OUString::createFromAscii( pImplName ) );
- uno::Reference< lang::XSingleServiceFactory > xFactory;
-
- if ( pServiceManager )
- {
- if ( aImplName.equals( OleEmbeddedObjectFactory::impl_staticGetImplementationName() ) )
- {
- xFactory= ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>( pServiceManager ),
- OleEmbeddedObjectFactory::impl_staticGetImplementationName(),
- OleEmbeddedObjectFactory::impl_staticCreateSelfInstance,
- OleEmbeddedObjectFactory::impl_staticGetSupportedServiceNames() );
- }
-#ifdef WNT
- // the following service makes sence only on windows
- else if ( aImplName.equals( MSOLEDialogObjectCreator::impl_staticGetImplementationName() ) )
- {
- xFactory= ::cppu::createOneInstanceFactory( reinterpret_cast< lang::XMultiServiceFactory*>( pServiceManager ),
- MSOLEDialogObjectCreator::impl_staticGetImplementationName(),
- MSOLEDialogObjectCreator::impl_staticCreateSelfInstance,
- MSOLEDialogObjectCreator::impl_staticGetSupportedServiceNames() );
- }
-#endif
- }
-
- if ( xFactory.is() )
- {
- xFactory->acquire();
- pRet = xFactory.get();
- }
-
- return pRet;
-}
-
-} // extern "C"
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/olevisual.cxx b/embeddedobj/source/msole/olevisual.cxx
deleted file mode 100644
index 7925b0940d..0000000000
--- a/embeddedobj/source/msole/olevisual.cxx
+++ /dev/null
@@ -1,446 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-#include <com/sun/star/lang/DisposedException.hpp>
-#include <com/sun/star/embed/EmbedStates.hpp>
-#include <com/sun/star/embed/EmbedMapUnits.hpp>
-#include <com/sun/star/embed/EmbedMisc.hpp>
-#include <com/sun/star/embed/Aspects.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/embed/NoVisualAreaSizeException.hpp>
-
-#include <rtl/logfile.hxx>
-
-#include <oleembobj.hxx>
-#include <olecomponent.hxx>
-#include <comphelper/mimeconfighelper.hxx>
-#include <comphelper/seqstream.hxx>
-
-using namespace ::com::sun::star;
-using namespace ::comphelper;
-
-embed::VisualRepresentation OleEmbeddedObject::GetVisualRepresentationInNativeFormat_Impl(
- const uno::Reference< io::XStream > xCachedVisRepr )
- throw ( uno::Exception )
-{
- embed::VisualRepresentation aVisualRepr;
-
- // TODO: detect the format in the future for now use workaround
- uno::Reference< io::XInputStream > xInStream = xCachedVisRepr->getInputStream();
- uno::Reference< io::XSeekable > xSeekable( xCachedVisRepr, uno::UNO_QUERY );
- if ( !xInStream.is() || !xSeekable.is() )
- throw uno::RuntimeException();
-
- uno::Sequence< sal_Int8 > aSeq( 2 );
- xInStream->readBytes( aSeq, 2 );
- xSeekable->seek( 0 );
- if ( aSeq.getLength() == 2 && aSeq[0] == 'B' && aSeq[1] == 'M' )
- {
- // it's a bitmap
- aVisualRepr.Flavor = datatransfer::DataFlavor(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice-bitmap;windows_formatname=\"Bitmap\"" )),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Bitmap" )),
- ::getCppuType( (const uno::Sequence< sal_Int8 >*) NULL ) );
- }
- else
- {
- // it's a metafile
- aVisualRepr.Flavor = datatransfer::DataFlavor(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice-wmf;windows_formatname=\"Image WMF\"" )),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Windows Metafile" )),
- ::getCppuType( (const uno::Sequence< sal_Int8 >*) NULL ) );
- }
-
- sal_Int32 nStreamLength = (sal_Int32)xSeekable->getLength();
- uno::Sequence< sal_Int8 > aRepresent( nStreamLength );
- xInStream->readBytes( aRepresent, nStreamLength );
- aVisualRepr.Data <<= aRepresent;
-
- return aVisualRepr;
-}
-
-void SAL_CALL OleEmbeddedObject::setVisualAreaSize( sal_Int64 nAspect, const awt::Size& aSize )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObject::setVisualAreaSize" );
-
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- xWrappedObject->setVisualAreaSize( nAspect, aSize );
- return;
- }
- // end wrapping related part ====================
-
- ::osl::ResettableMutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
- if ( nAspect == embed::Aspects::MSOLE_ICON )
- // no representation can be retrieved
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Illegal call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object is not loaded!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
-#ifdef WNT
- // RECOMPOSE_ON_RESIZE misc flag means that the object has to be switched to running state on resize.
- // SetExtent() is called only for objects that require it,
- // it should not be called for MSWord documents to workaround problem i49369
- // If cached size is not set, that means that this is the size initialization, so there is no need to set the real size
- sal_Bool bAllowToSetExtent =
- ( ( getStatus( nAspect ) & embed::EmbedMisc::MS_EMBED_RECOMPOSEONRESIZE )
- && !MimeConfigurationHelper::ClassIDsEqual( m_aClassID, MimeConfigurationHelper::GetSequenceClassID( 0x00020906L, 0x0000, 0x0000,
- 0xc0,0x00,0x00,0x00,0x00,0x00,0x00,0x46 ) )
- && m_bHasCachedSize );
-
- if ( m_nObjectState == embed::EmbedStates::LOADED && bAllowToSetExtent )
- {
- aGuard.clear();
- try {
- changeState( embed::EmbedStates::RUNNING );
- }
- catch( uno::Exception& )
- {
- OSL_FAIL( "The object should not be resized without activation!\n" );
- }
- aGuard.reset();
- }
-
- if ( m_pOleComponent && m_nObjectState != embed::EmbedStates::LOADED && bAllowToSetExtent )
- {
- awt::Size aSizeToSet = aSize;
- aGuard.clear();
- try {
- m_pOleComponent->SetExtent( aSizeToSet, nAspect ); // will throw an exception in case of failure
- m_bHasSizeToSet = sal_False;
- }
- catch( uno::Exception& )
- {
- // some objects do not allow to set the size even in running state
- m_bHasSizeToSet = sal_True;
- m_aSizeToSet = aSizeToSet;
- m_nAspectToSet = nAspect;
- }
- aGuard.reset();
- }
-#endif
-
- // cache the values
- m_bHasCachedSize = sal_True;
- m_aCachedSize = aSize;
- m_nCachedAspect = nAspect;
-}
-
-awt::Size SAL_CALL OleEmbeddedObject::getVisualAreaSize( sal_Int64 nAspect )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObject::getVisualAreaSize" );
-
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- return xWrappedObject->getVisualAreaSize( nAspect );
- }
- // end wrapping related part ====================
-
- ::osl::ResettableMutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
- if ( nAspect == embed::Aspects::MSOLE_ICON )
- // no representation can be retrieved
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Illegal call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object is not loaded!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- awt::Size aResult;
-
-#ifdef WNT
- // TODO/LATER: Support different aspects
- if ( m_pOleComponent && !m_bHasSizeToSet && nAspect == embed::Aspects::MSOLE_CONTENT )
- {
- try
- {
- // the cached size updated every time the object is stored
- if ( m_bHasCachedSize )
- {
- aResult = m_aCachedSize;
- }
- else
- {
- // there is no internal cache
- awt::Size aSize;
- aGuard.clear();
-
- sal_Bool bSuccess = sal_False;
- if ( getCurrentState() == embed::EmbedStates::LOADED )
- {
- OSL_FAIL( "Loaded object has no cached size!\n" );
-
- // try to switch the object to RUNNING state and request the value again
- try {
- changeState( embed::EmbedStates::RUNNING );
- }
- catch( uno::Exception )
- {
- throw embed::NoVisualAreaSizeException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No size available!\n" ) ),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
- }
-
- try
- {
- // first try to get size using replacement image
- aSize = m_pOleComponent->GetExtent( nAspect ); // will throw an exception in case of failure
- bSuccess = sal_True;
- }
- catch( uno::Exception& )
- {
- }
-
- if ( !bSuccess )
- {
- try
- {
- // second try the cached replacement image
- aSize = m_pOleComponent->GetCachedExtent( nAspect ); // will throw an exception in case of failure
- bSuccess = sal_True;
- }
- catch( uno::Exception& )
- {
- }
- }
-
- if ( !bSuccess )
- {
- try
- {
- // third try the size reported by the object
- aSize = m_pOleComponent->GetReccomendedExtent( nAspect ); // will throw an exception in case of failure
- bSuccess = sal_True;
- }
- catch( uno::Exception& )
- {
- }
- }
-
- if ( !bSuccess )
- throw embed::NoVisualAreaSizeException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No size available!\n" ) ),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- aGuard.reset();
-
- m_aCachedSize = aSize;
- m_nCachedAspect = nAspect;
- m_bHasCachedSize = sal_True;
-
- aResult = m_aCachedSize;
- }
- }
- catch ( embed::NoVisualAreaSizeException& )
- {
- throw;
- }
- catch ( uno::Exception& )
- {
- throw embed::NoVisualAreaSizeException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No size available!\n" ) ),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
- }
- else
-#endif
- {
- // return cached value
- if ( m_bHasCachedSize )
- {
- OSL_ENSURE( nAspect == m_nCachedAspect, "Unexpected aspect is requested!\n" );
- aResult = m_aCachedSize;
- }
- else
- {
- throw embed::NoVisualAreaSizeException(
- ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "No size available!\n" ) ),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
- }
-
- return aResult;
-}
-
-embed::VisualRepresentation SAL_CALL OleEmbeddedObject::getPreferredVisualRepresentation( sal_Int64 nAspect )
- throw ( lang::IllegalArgumentException,
- embed::WrongStateException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObject::getPreferredVisualRepresentation" );
-
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- return xWrappedObject->getPreferredVisualRepresentation( nAspect );
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
- if ( nAspect == embed::Aspects::MSOLE_ICON )
- // no representation can be retrieved
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Illegal call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- // TODO: if the object has cached representation then it should be returned
- // TODO: if the object has no cached representation and is in loaded state it should switch itself to the running state
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object is not loaded!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- embed::VisualRepresentation aVisualRepr;
-
- // TODO: in case of different aspects they must be applied to the mediatype and XTransferable must be used
- // the cache is used only as a fallback if object is not in loaded state
- if ( !m_xCachedVisualRepresentation.is() && ( !m_bVisReplInitialized || m_bVisReplInStream )
- && m_nObjectState == embed::EmbedStates::LOADED )
- {
- m_xCachedVisualRepresentation = TryToRetrieveCachedVisualRepresentation_Impl( m_xObjectStream, sal_True );
- SetVisReplInStream( m_xCachedVisualRepresentation.is() );
- }
-
- if ( m_xCachedVisualRepresentation.is() )
- {
- return GetVisualRepresentationInNativeFormat_Impl( m_xCachedVisualRepresentation );
- }
-#ifdef WNT
- else if ( m_pOleComponent )
- {
- try
- {
- if ( m_nObjectState == embed::EmbedStates::LOADED )
- changeState( embed::EmbedStates::RUNNING );
-
- datatransfer::DataFlavor aDataFlavor(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice-wmf;windows_formatname=\"Image WMF\"" )),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Windows Metafile" )),
- ::getCppuType( (const uno::Sequence< sal_Int8 >*) NULL ) );
-
- aVisualRepr.Data = m_pOleComponent->getTransferData( aDataFlavor );
- aVisualRepr.Flavor = aDataFlavor;
-
- uno::Sequence< sal_Int8 > aVisReplSeq;
- aVisualRepr.Data >>= aVisReplSeq;
- if ( aVisReplSeq.getLength() )
- {
- m_xCachedVisualRepresentation = GetNewFilledTempStream_Impl(
- uno::Reference< io::XInputStream > ( static_cast< io::XInputStream* > (
- new ::comphelper::SequenceInputStream( aVisReplSeq ) ) ) );
- }
-
- return aVisualRepr;
- }
- catch( uno::Exception& )
- {}
- }
-#endif
-
- // the cache is used only as a fallback if object is not in loaded state
- if ( !m_xCachedVisualRepresentation.is() && ( !m_bVisReplInitialized || m_bVisReplInStream ) )
- {
- m_xCachedVisualRepresentation = TryToRetrieveCachedVisualRepresentation_Impl( m_xObjectStream );
- SetVisReplInStream( m_xCachedVisualRepresentation.is() );
- }
-
- if ( !m_xCachedVisualRepresentation.is() )
- {
- // no representation can be retrieved
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Illegal call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
- }
-
- return GetVisualRepresentationInNativeFormat_Impl( m_xCachedVisualRepresentation );
-}
-
-sal_Int32 SAL_CALL OleEmbeddedObject::getMapUnit( sal_Int64 nAspect )
- throw ( uno::Exception,
- uno::RuntimeException)
-{
- // begin wrapping related part ====================
- uno::Reference< embed::XEmbeddedObject > xWrappedObject = m_xWrappedObject;
- if ( xWrappedObject.is() )
- {
- // the object was converted to OOo embedded object, the current implementation is now only a wrapper
- return xWrappedObject->getMapUnit( nAspect );
- }
- // end wrapping related part ====================
-
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( m_bDisposed )
- throw lang::DisposedException(); // TODO
-
- OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
- if ( nAspect == embed::Aspects::MSOLE_ICON )
- // no representation can be retrieved
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Illegal call!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- if ( m_nObjectState == -1 )
- throw embed::WrongStateException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "The object is not loaded!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
-
- return embed::EmbedMapUnits::ONE_100TH_MM;
-}
-
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/olewrapclient.cxx b/embeddedobj/source/msole/olewrapclient.cxx
deleted file mode 100644
index 57b66baaf5..0000000000
--- a/embeddedobj/source/msole/olewrapclient.cxx
+++ /dev/null
@@ -1,160 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-
-#include <osl/diagnose.h>
-
-#include "olewrapclient.hxx"
-#include "olecomponent.hxx"
-
-// TODO: May be a mutex must be introduced
-
-OleWrapperClientSite::OleWrapperClientSite( OleComponent* pOleComp )
-: m_nRefCount( 0 )
-, m_pOleComp( pOleComp )
-{
- OSL_ENSURE( m_pOleComp, "No ole component is provided!\n" );
-}
-
-OleWrapperClientSite::~OleWrapperClientSite()
-{
-}
-
-STDMETHODIMP OleWrapperClientSite::QueryInterface( REFIID riid , void** ppv )
-{
- *ppv=NULL;
-
- if ( riid == IID_IUnknown )
- *ppv = (IUnknown*)this;
-
- if ( riid == IID_IOleClientSite )
- *ppv = (IOleClientSite*)this;
-
- if ( *ppv != NULL )
- {
- ((IUnknown*)*ppv)->AddRef();
- return S_OK;
- }
-
- return E_NOINTERFACE;
-}
-
-STDMETHODIMP_(ULONG) OleWrapperClientSite::AddRef()
-{
- return osl_incrementInterlockedCount( &m_nRefCount);
-}
-
-STDMETHODIMP_(ULONG) OleWrapperClientSite::Release()
-{
- ULONG nReturn = --m_nRefCount;
- if ( m_nRefCount == 0 )
- delete this;
-
- return nReturn;
-}
-
-void OleWrapperClientSite::disconnectOleComponent()
-{
- // must not be called from the descructor of OleComponent!!!
- osl::MutexGuard aGuard( m_aMutex );
- m_pOleComp = NULL;
-}
-
-STDMETHODIMP OleWrapperClientSite::SaveObject()
-{
- OleComponent* pLockComponent = NULL;
- HRESULT hResult = E_FAIL;
-
- {
- osl::MutexGuard aGuard( m_aMutex );
- if ( m_pOleComp )
- {
- pLockComponent = m_pOleComp;
- pLockComponent->acquire();
- }
- }
-
- if ( pLockComponent )
- {
- if ( pLockComponent->SaveObject_Impl() )
- hResult = S_OK;
-
- pLockComponent->release();
- }
-
- return hResult;
-}
-
-STDMETHODIMP OleWrapperClientSite::GetMoniker( DWORD, DWORD, LPMONIKER *ppmk )
-{
- *ppmk = NULL;
- return E_NOTIMPL;
-}
-
-STDMETHODIMP OleWrapperClientSite::GetContainer( LPOLECONTAINER* ppContainer )
-{
- *ppContainer = NULL;
- return E_NOTIMPL;
-}
-
-STDMETHODIMP OleWrapperClientSite::ShowObject(void)
-{
- return S_OK;
-}
-
-STDMETHODIMP OleWrapperClientSite::OnShowWindow( BOOL bShow )
-{
- OleComponent* pLockComponent = NULL;
-
- // TODO/LATER: redirect the notification to the main thread so that SolarMutex can be locked
- {
- osl::MutexGuard aGuard( m_aMutex );
- if ( m_pOleComp )
- {
- pLockComponent = m_pOleComp;
- pLockComponent->acquire();
- }
- }
-
- if ( pLockComponent )
- {
- pLockComponent->OnShowWindow_Impl( bShow ); // the result is not interesting
- pLockComponent->release();
- }
-
- return S_OK;
-}
-
-STDMETHODIMP OleWrapperClientSite::RequestNewObjectLayout(void)
-{
- return E_NOTIMPL;
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/olewrapclient.hxx b/embeddedobj/source/msole/olewrapclient.hxx
deleted file mode 100644
index e054b0b12d..0000000000
--- a/embeddedobj/source/msole/olewrapclient.hxx
+++ /dev/null
@@ -1,58 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-#include <osl/interlck.h>
-#include <osl/mutex.hxx>
-#include <platform.h>
-
-class OleComponent;
-class OleWrapperClientSite : public IOleClientSite
-{
- osl::Mutex m_aMutex;
- oslInterlockedCount m_nRefCount;
- OleComponent* m_pOleComp;
-
-public:
- OleWrapperClientSite( OleComponent* pOleComp );
- virtual ~OleWrapperClientSite(void);
-
- void disconnectOleComponent();
-
- STDMETHODIMP QueryInterface(REFIID, void**);
- STDMETHODIMP_(ULONG) AddRef(void);
- STDMETHODIMP_(ULONG) Release(void);
-
- STDMETHODIMP SaveObject(void);
- STDMETHODIMP GetMoniker(DWORD, DWORD, LPMONIKER *);
- STDMETHODIMP GetContainer(LPOLECONTAINER *);
- STDMETHODIMP ShowObject(void);
- STDMETHODIMP OnShowWindow(BOOL);
- STDMETHODIMP RequestNewObjectLayout(void);
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/ownview.cxx b/embeddedobj/source/msole/ownview.cxx
deleted file mode 100644
index 2bcd14f024..0000000000
--- a/embeddedobj/source/msole/ownview.cxx
+++ /dev/null
@@ -1,659 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-#include <com/sun/star/frame/XFrame.hpp>
-#include <com/sun/star/frame/XController.hpp>
-#include <com/sun/star/frame/XComponentLoader.hpp>
-#include <com/sun/star/awt/XTopWindow.hpp>
-#include <com/sun/star/embed/XClassifiedObject.hpp>
-#include <com/sun/star/io/XStream.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/io/XSeekable.hpp>
-#include <com/sun/star/task/XInteractionHandler.hpp>
-#include <com/sun/star/ucb/XSimpleFileAccess.hpp>
-#include <com/sun/star/util/XCloseable.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-
-#include <com/sun/star/document/XEventBroadcaster.hpp>
-#include <com/sun/star/document/XEventListener.hpp>
-#include <com/sun/star/document/XTypeDetection.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <cppuhelper/implbase1.hxx>
-#include <comphelper/storagehelper.hxx>
-#include <comphelper/mimeconfighelper.hxx>
-
-#include "ownview.hxx"
-
-
-using namespace ::com::sun::star;
-using namespace ::comphelper;
-
-::rtl::OUString GetNewTempFileURL_Impl( const uno::Reference< lang::XMultiServiceFactory >& xFactory ) throw( io::IOException );
-::rtl::OUString GetNewFilledTempFile_Impl( const uno::Reference< io::XInputStream >& xInStream, const uno::Reference< lang::XMultiServiceFactory >& xFactory ) throw( io::IOException );
-sal_Bool KillFile_Impl( const ::rtl::OUString& aURL, const uno::Reference< lang::XMultiServiceFactory >& xFactory );
-uno::Reference< io::XStream > TryToGetAcceptableFormat_Impl( const uno::Reference< io::XStream >& xStream, const uno::Reference< lang::XMultiServiceFactory >& xFactory ) throw ( uno::Exception );
-
-//========================================================
-// Dummy interaction handler
-//========================================================
-//--------------------------------------------------------
-class DummyHandler_Impl : public ::cppu::WeakImplHelper1< task::XInteractionHandler >
-{
-public:
- DummyHandler_Impl() {}
- ~DummyHandler_Impl();
-
- virtual void SAL_CALL handle( const uno::Reference< task::XInteractionRequest >& xRequest )
- throw( uno::RuntimeException );
-};
-
-//--------------------------------------------------------
-DummyHandler_Impl::~DummyHandler_Impl()
-{
-}
-
-//--------------------------------------------------------
-void SAL_CALL DummyHandler_Impl::handle( const uno::Reference< task::XInteractionRequest >& )
- throw( uno::RuntimeException )
-{
- return;
-}
-
-//========================================================
-// Object viewer
-//========================================================
-//--------------------------------------------------------
-OwnView_Impl::OwnView_Impl( const uno::Reference< lang::XMultiServiceFactory >& xFactory,
- const uno::Reference< io::XInputStream >& xInputStream )
-: m_xFactory( xFactory )
-, m_bBusy( sal_False )
-, m_bUseNative( sal_False )
-{
- if ( !xFactory.is() || !xInputStream.is() )
- throw uno::RuntimeException();
-
- m_aTempFileURL = GetNewFilledTempFile_Impl( xInputStream, m_xFactory );
-}
-
-//--------------------------------------------------------
-OwnView_Impl::~OwnView_Impl()
-{
- try {
- KillFile_Impl( m_aTempFileURL, m_xFactory );
- } catch( uno::Exception& ) {}
-
- try {
- if ( m_aNativeTempURL.getLength() )
- KillFile_Impl( m_aNativeTempURL, m_xFactory );
- } catch( uno::Exception& ) {}
-}
-
-//--------------------------------------------------------
-sal_Bool OwnView_Impl::CreateModelFromURL( const ::rtl::OUString& aFileURL )
-{
- sal_Bool bResult = sal_False;
-
- if ( aFileURL.getLength() )
- {
- try {
- uno::Reference < frame::XComponentLoader > xDocumentLoader(
- m_xFactory->createInstance (
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" ) )),
- uno::UNO_QUERY );
-
- if ( xDocumentLoader.is() )
- {
- uno::Sequence< beans::PropertyValue > aArgs( m_aFilterName.getLength() ? 5 : 4 );
-
- aArgs[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "URL" ));
- aArgs[0].Value <<= aFileURL;
-
- aArgs[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "ReadOnly" ));
- aArgs[1].Value <<= sal_True;
-
- aArgs[2].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "InteractionHandler" ));
- aArgs[2].Value <<= uno::Reference< task::XInteractionHandler >(
- static_cast< ::cppu::OWeakObject* >( new DummyHandler_Impl() ), uno::UNO_QUERY );
-
- aArgs[3].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "DontEdit" ));
- aArgs[3].Value <<= sal_True;
-
- if ( m_aFilterName.getLength() )
- {
- aArgs[4].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "FilterName" ));
- aArgs[4].Value <<= m_aFilterName;
- }
-
- uno::Reference< frame::XModel > xModel( xDocumentLoader->loadComponentFromURL(
- aFileURL,
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "_blank" )),
- 0,
- aArgs ),
- uno::UNO_QUERY );
-
- if ( xModel.is() )
- {
- uno::Reference< document::XEventBroadcaster > xBroadCaster( xModel, uno::UNO_QUERY );
- if ( xBroadCaster.is() )
- xBroadCaster->addEventListener( uno::Reference< document::XEventListener >(
- static_cast< ::cppu::OWeakObject* >( this ),
- uno::UNO_QUERY ) );
-
- uno::Reference< util::XCloseable > xCloseable( xModel, uno::UNO_QUERY );
- if ( xCloseable.is() )
- {
- xCloseable->addCloseListener( uno::Reference< util::XCloseListener >(
- static_cast< ::cppu::OWeakObject* >( this ),
- uno::UNO_QUERY ) );
-
- ::osl::MutexGuard aGuard( m_aMutex );
- m_xModel = xModel;
- bResult = sal_True;
- }
- }
- }
- }
- catch( uno::Exception& )
- {
- }
- }
-
- return bResult;
-}
-
-//--------------------------------------------------------
-sal_Bool OwnView_Impl::CreateModel( sal_Bool bUseNative )
-{
- sal_Bool bResult = sal_False;
-
- try {
- bResult = CreateModelFromURL( bUseNative ? m_aNativeTempURL : m_aTempFileURL );
- }
- catch( uno::Exception& )
- {
- }
-
- return bResult;
-}
-
-//--------------------------------------------------------
-::rtl::OUString OwnView_Impl::GetFilterNameFromExtentionAndInStream(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
- const ::rtl::OUString& aNameWithExtention,
- const uno::Reference< io::XInputStream >& xInputStream )
-{
- if ( !xInputStream.is() )
- throw uno::RuntimeException();
-
- uno::Reference< document::XTypeDetection > xTypeDetection(
- xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.document.TypeDetection" ) )),
- uno::UNO_QUERY_THROW );
-
- ::rtl::OUString aTypeName;
-
- if ( aNameWithExtention.getLength() )
- {
- ::rtl::OUString aURLToAnalyze =
- ( ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "file:///" ) ) + aNameWithExtention );
- aTypeName = xTypeDetection->queryTypeByURL( aURLToAnalyze );
- }
-
- uno::Sequence< beans::PropertyValue > aArgs( aTypeName.getLength() ? 3 : 2 );
- aArgs[0].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "URL" ) );
- aArgs[0].Value <<= ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "private:stream" ) );
- aArgs[1].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "InputStream" ) );
- aArgs[1].Value <<= xInputStream;
- if ( aTypeName.getLength() )
- {
- aArgs[2].Name = ::rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "TypeName" ) );
- aArgs[2].Value <<= aTypeName;
- }
-
- aTypeName = xTypeDetection->queryTypeByDescriptor( aArgs, sal_True );
-
- ::rtl::OUString aFilterName;
- for ( sal_Int32 nInd = 0; nInd < aArgs.getLength(); nInd++ )
- if ( aArgs[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "FilterName" ) ) )
- aArgs[nInd].Value >>= aFilterName;
-
- if ( !aFilterName.getLength() && aTypeName.getLength() )
- {
- // get the default filter name for the type
- uno::Reference< container::XNameAccess > xNameAccess( xTypeDetection, uno::UNO_QUERY_THROW );
- uno::Sequence< beans::PropertyValue > aTypes;
-
- if ( xNameAccess.is() && ( xNameAccess->getByName( aTypeName ) >>= aTypes ) )
- {
- for ( sal_Int32 nInd = 0; nInd < aTypes.getLength(); nInd++ )
- {
- if ( aTypes[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "PreferredFilter" ) ) && ( aTypes[nInd].Value >>= aFilterName ) )
- {
- aTypes[nInd].Value >>= aFilterName;
- break;
- }
- }
- }
- }
-
- return aFilterName;
-}
-
-//--------------------------------------------------------
-sal_Bool OwnView_Impl::ReadContentsAndGenerateTempFile( const uno::Reference< io::XInputStream >& xInStream,
- sal_Bool bParseHeader )
-{
- uno::Reference< io::XSeekable > xSeekable( xInStream, uno::UNO_QUERY_THROW );
- xSeekable->seek( 0 );
-
- // create m_aNativeTempURL
- ::rtl::OUString aNativeTempURL;
- uno::Reference < beans::XPropertySet > xNativeTempFile(
- m_xFactory->createInstance( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.io.TempFile" ) )),
- uno::UNO_QUERY_THROW );
- uno::Reference < io::XStream > xNativeTempStream( xNativeTempFile, uno::UNO_QUERY_THROW );
- uno::Reference < io::XOutputStream > xNativeOutTemp = xNativeTempStream->getOutputStream();
- uno::Reference < io::XInputStream > xNativeInTemp = xNativeTempStream->getInputStream();
- if ( !xNativeOutTemp.is() || !xNativeInTemp.is() )
- throw uno::RuntimeException();
-
- try {
- xNativeTempFile->setPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "RemoveFile" )), uno::makeAny( sal_False ) );
- uno::Any aUrl = xNativeTempFile->getPropertyValue( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Uri" ) ));
- aUrl >>= aNativeTempURL;
- }
- catch ( uno::Exception& )
- {
- }
-
- sal_Bool bFailed = sal_False;
- ::rtl::OUString aFileSuffix;
-
- if ( bParseHeader )
- {
- uno::Sequence< sal_Int8 > aReadSeq( 4 );
- // read the complete size of the Object Package
- if ( xInStream->readBytes( aReadSeq, 4 ) != 4 )
- return sal_False;
- // read the first header ( have no idea what does this header mean )
- if ( xInStream->readBytes( aReadSeq, 2 ) != 2 || aReadSeq[0] != 2 || aReadSeq[1] != 0 )
- return sal_False;
-
- // read file name
- // only extension is interesting so only subset of symbols is accepted
- do
- {
- if ( xInStream->readBytes( aReadSeq, 1 ) != 1 )
- return sal_False;
-
- if (
- (aReadSeq[0] >= '0' && aReadSeq[0] <= '9') ||
- (aReadSeq[0] >= 'a' && aReadSeq[0] <= 'z') ||
- (aReadSeq[0] >= 'A' && aReadSeq[0] <= 'Z') ||
- aReadSeq[0] == '.'
- )
- {
- aFileSuffix += ::rtl::OUString::valueOf( (sal_Unicode) aReadSeq[0] );
- }
-
- } while( aReadSeq[0] );
-
- // skip url
- do
- {
- if ( xInStream->readBytes( aReadSeq, 1 ) != 1 )
- return sal_False;
- } while( aReadSeq[0] );
-
- // check the next header
- if ( xInStream->readBytes( aReadSeq, 4 ) != 4
- || aReadSeq[0] || aReadSeq[1] || aReadSeq[2] != 3 || aReadSeq[3] )
- return sal_False;
-
- // get the size of the next entry
- if ( xInStream->readBytes( aReadSeq, 4 ) != 4 )
- return sal_False;
-
- sal_uInt32 nUrlSize = (sal_uInt8)aReadSeq[0]
- + (sal_uInt8)aReadSeq[1] * 0x100
- + (sal_uInt8)aReadSeq[2] * 0x10000
- + (sal_uInt8)aReadSeq[3] * 0x1000000;
- sal_Int64 nTargetPos = xSeekable->getPosition() + nUrlSize;
-
- xSeekable->seek( nTargetPos );
-
- // get the size of stored data
- if ( xInStream->readBytes( aReadSeq, 4 ) != 4 )
- return sal_False;
-
- sal_uInt32 nDataSize = (sal_uInt8)aReadSeq[0]
- + (sal_uInt8)aReadSeq[1] * 0x100
- + (sal_uInt8)aReadSeq[2] * 0x10000
- + (sal_uInt8)aReadSeq[3] * 0x1000000;
-
- aReadSeq.realloc( 32000 );
- sal_uInt32 nRead = 0;
- while ( nRead < nDataSize )
- {
- sal_uInt32 nToRead = ( nDataSize - nRead > 32000 ) ? 32000 : nDataSize - nRead;
- sal_uInt32 nLocalRead = xInStream->readBytes( aReadSeq, nToRead );
-
-
- if ( !nLocalRead )
- {
- bFailed = sal_True;
- break;
- }
- else if ( nLocalRead == 32000 )
- xNativeOutTemp->writeBytes( aReadSeq );
- else
- {
- uno::Sequence< sal_Int8 > aToWrite( aReadSeq );
- aToWrite.realloc( nLocalRead );
- xNativeOutTemp->writeBytes( aToWrite );
- }
-
- nRead += nLocalRead;
- }
- }
- else
- {
- uno::Sequence< sal_Int8 > aData( 8 );
- if ( xInStream->readBytes( aData, 8 ) == 8
- && aData[0] == -1 && aData[1] == -1 && aData[2] == -1 && aData[3] == -1
- && ( aData[4] == 2 || aData[4] == 3 ) && aData[5] == 0 && aData[6] == 0 && aData[7] == 0 )
- {
- // the header has to be removed
- xSeekable->seek( 40 );
- }
- else
- {
- // the usual Ole10Native format
- xSeekable->seek( 4 );
- }
-
- ::comphelper::OStorageHelper::CopyInputToOutput( xInStream, xNativeOutTemp );
- }
-
- xNativeOutTemp->closeOutput();
-
- // The temporary native file is created, now the filter must be detected
- if ( !bFailed )
- {
- m_aFilterName = GetFilterNameFromExtentionAndInStream( m_xFactory, aFileSuffix, xNativeInTemp );
- m_aNativeTempURL = aNativeTempURL;
- }
-
- return !bFailed;
-}
-
-//--------------------------------------------------------
-void OwnView_Impl::CreateNative()
-{
- if ( m_aNativeTempURL.getLength() )
- return;
-
- try
- {
- uno::Reference < ucb::XSimpleFileAccess > xAccess(
- m_xFactory->createInstance (
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.ucb.SimpleFileAccess" ) )),
- uno::UNO_QUERY_THROW );
-
- uno::Reference< io::XInputStream > xInStream = xAccess->openFileRead( m_aTempFileURL );
- if ( !xInStream.is() )
- throw uno::RuntimeException();
-
- uno::Sequence< uno::Any > aArgs( 1 );
- aArgs[0] <<= xInStream;
- uno::Reference< container::XNameAccess > xNameAccess(
- m_xFactory->createInstanceWithArguments(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OLESimpleStorage" )),
- aArgs ),
- uno::UNO_QUERY_THROW );
-
- ::rtl::OUString aSubStreamName = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "\1Ole10Native" ));
- uno::Reference< embed::XClassifiedObject > xStor( xNameAccess, uno::UNO_QUERY_THROW );
- uno::Sequence< sal_Int8 > aStorClassID = xStor->getClassID();
-
- if ( xNameAccess->hasByName( aSubStreamName ) )
- {
- sal_uInt8 aClassID[] =
- { 0x00, 0x03, 0x00, 0x0C, 0x00, 0x00, 0x00, 0x00, 0xC0, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x46 };
- uno::Sequence< sal_Int8 > aPackageClassID( (sal_Int8*)aClassID, 16 );
-
- uno::Reference< io::XStream > xSubStream;
- xNameAccess->getByName( aSubStreamName ) >>= xSubStream;
- if ( xSubStream.is() )
- {
- sal_Bool bOk = sal_False;
-
- if ( MimeConfigurationHelper::ClassIDsEqual( aPackageClassID, aStorClassID ) )
- {
- // the storage represents Object Package
-
- bOk = ReadContentsAndGenerateTempFile( xSubStream->getInputStream(), sal_True );
-
- if ( !bOk && m_aNativeTempURL.getLength() )
- {
- KillFile_Impl( m_aNativeTempURL, m_xFactory );
- m_aNativeTempURL = ::rtl::OUString();
- }
- }
-
- if ( !bOk )
- {
- bOk = ReadContentsAndGenerateTempFile( xSubStream->getInputStream(), sal_False );
-
- if ( !bOk && m_aNativeTempURL.getLength() )
- {
- KillFile_Impl( m_aNativeTempURL, m_xFactory );
- m_aNativeTempURL = ::rtl::OUString();
- }
- }
- }
- }
- else
- {
- // TODO/LATER: No native stream, needs a new solution
- }
- }
- catch( uno::Exception& )
- {}
-}
-
-//--------------------------------------------------------
-sal_Bool OwnView_Impl::Open()
-{
- sal_Bool bResult = sal_False;
-
- uno::Reference< frame::XModel > xExistingModel;
-
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- xExistingModel = m_xModel;
- if ( m_bBusy )
- return sal_False;
-
- m_bBusy = sal_True;
- }
-
- if ( xExistingModel.is() )
- {
- try {
- uno::Reference< frame::XController > xController = xExistingModel->getCurrentController();
- if ( xController.is() )
- {
- uno::Reference< frame::XFrame > xFrame = xController->getFrame();
- if ( xFrame.is() )
- {
- xFrame->activate();
- uno::Reference<awt::XTopWindow> xTopWindow( xFrame->getContainerWindow(), uno::UNO_QUERY );
- if(xTopWindow.is())
- xTopWindow->toFront();
-
- bResult = sal_True;
- }
- }
- }
- catch( uno::Exception& )
- {
- }
- }
- else
- {
- bResult = CreateModel( m_bUseNative );
-
- if ( !bResult && !m_bUseNative )
- {
- // the original storage can not be recognized
- if ( !m_aNativeTempURL.getLength() )
- {
- // create a temporary file for the native representation if there is no
- CreateNative();
- }
-
- if ( m_aNativeTempURL.getLength() )
- {
- bResult = CreateModel( sal_True );
- if ( bResult )
- m_bUseNative = sal_True;
- }
- }
- }
-
- m_bBusy = sal_False;
-
- return bResult;
-}
-
-//--------------------------------------------------------
-void OwnView_Impl::Close()
-{
- uno::Reference< frame::XModel > xModel;
-
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( !m_xModel.is() )
- return;
- xModel = m_xModel;
- m_xModel = uno::Reference< frame::XModel >();
-
- if ( m_bBusy )
- return;
-
- m_bBusy = sal_True;
- }
-
- try {
- uno::Reference< document::XEventBroadcaster > xBroadCaster( xModel, uno::UNO_QUERY );
- if ( xBroadCaster.is() )
- xBroadCaster->removeEventListener( uno::Reference< document::XEventListener >(
- static_cast< ::cppu::OWeakObject* >( this ),
- uno::UNO_QUERY ) );
-
- uno::Reference< util::XCloseable > xCloseable( xModel, uno::UNO_QUERY );
- if ( xCloseable.is() )
- {
- xCloseable->removeCloseListener( uno::Reference< util::XCloseListener >(
- static_cast< ::cppu::OWeakObject* >( this ),
- uno::UNO_QUERY ) );
- xCloseable->close( sal_True );
- }
- }
- catch( uno::Exception& )
- {}
-
- m_bBusy = sal_False;
-}
-
-//--------------------------------------------------------
-void SAL_CALL OwnView_Impl::notifyEvent( const document::EventObject& aEvent )
- throw ( uno::RuntimeException )
-{
-
- uno::Reference< frame::XModel > xModel;
-
- {
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( aEvent.Source == m_xModel && aEvent.EventName.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "OnSaveAsDone" ) ) )
- {
- // SaveAs operation took place, so just forget the model and deregister listeners
- xModel = m_xModel;
- m_xModel = uno::Reference< frame::XModel >();
- }
- }
-
- if ( xModel.is() )
- {
- try {
- uno::Reference< document::XEventBroadcaster > xBroadCaster( xModel, uno::UNO_QUERY );
- if ( xBroadCaster.is() )
- xBroadCaster->removeEventListener( uno::Reference< document::XEventListener >(
- static_cast< ::cppu::OWeakObject* >( this ),
- uno::UNO_QUERY ) );
-
- uno::Reference< util::XCloseable > xCloseable( xModel, uno::UNO_QUERY );
- if ( xCloseable.is() )
- xCloseable->removeCloseListener( uno::Reference< util::XCloseListener >(
- static_cast< ::cppu::OWeakObject* >( this ),
- uno::UNO_QUERY ) );
- }
- catch( uno::Exception& )
- {}
- }
-}
-
-//--------------------------------------------------------
-void SAL_CALL OwnView_Impl::queryClosing( const lang::EventObject&, sal_Bool )
- throw ( util::CloseVetoException,
- uno::RuntimeException )
-{
-}
-
-//--------------------------------------------------------
-void SAL_CALL OwnView_Impl::notifyClosing( const lang::EventObject& Source )
- throw ( uno::RuntimeException )
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( Source.Source == m_xModel )
- m_xModel = uno::Reference< frame::XModel >();
-}
-
-//--------------------------------------------------------
-void SAL_CALL OwnView_Impl::disposing( const lang::EventObject& Source )
- throw (uno::RuntimeException)
-{
- ::osl::MutexGuard aGuard( m_aMutex );
- if ( Source.Source == m_xModel )
- m_xModel = uno::Reference< frame::XModel >();
-};
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/ownview.hxx b/embeddedobj/source/msole/ownview.hxx
deleted file mode 100644
index 1768ca61cd..0000000000
--- a/embeddedobj/source/msole/ownview.hxx
+++ /dev/null
@@ -1,92 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef __OWNVIEW_HXX_
-#define __OWNVIEW_HXX_
-
-#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/util/XCloseListener.hpp>
-#include <com/sun/star/document/XEventListener.hpp>
-#include <com/sun/star/frame/XModel.hpp>
-#include <com/sun/star/io/XStream.hpp>
-#include <com/sun/star/io/XInputStream.hpp>
-#include <cppuhelper/implbase2.hxx>
-
-#include <osl/mutex.hxx>
-
-class OwnView_Impl : public ::cppu::WeakImplHelper2 < ::com::sun::star::util::XCloseListener,
- ::com::sun::star::document::XEventListener >
-{
- ::osl::Mutex m_aMutex;
-
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
- ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel > m_xModel;
-
- ::rtl::OUString m_aTempFileURL;
- ::rtl::OUString m_aNativeTempURL;
-
- ::rtl::OUString m_aFilterName;
-
- sal_Bool m_bBusy;
-
- sal_Bool m_bUseNative;
-
-private:
- sal_Bool CreateModelFromURL( const ::rtl::OUString& aFileURL );
-
- sal_Bool CreateModel( sal_Bool bUseNative );
-
- sal_Bool ReadContentsAndGenerateTempFile( const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xStream, sal_Bool bParseHeader );
-
- void CreateNative();
-
-public:
- static ::rtl::OUString GetFilterNameFromExtentionAndInStream(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
- const ::rtl::OUString& aNameWithExtention,
- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xInputStream );
-
- OwnView_Impl( const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory,
- const ::com::sun::star::uno::Reference< ::com::sun::star::io::XInputStream >& xStream );
- virtual ~OwnView_Impl();
-
- sal_Bool Open();
-
- void Close();
-
- virtual void SAL_CALL notifyEvent( const ::com::sun::star::document::EventObject& Event ) throw (::com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL queryClosing( const ::com::sun::star::lang::EventObject& Source, sal_Bool GetsOwnership ) throw (::com::sun::star::util::CloseVetoException, ::com::sun::star::uno::RuntimeException);
- virtual void SAL_CALL notifyClosing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
-
- virtual void SAL_CALL disposing( const ::com::sun::star::lang::EventObject& Source ) throw (::com::sun::star::uno::RuntimeException);
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/platform.h b/embeddedobj/source/msole/platform.h
deleted file mode 100755
index 20ffb3f305..0000000000
--- a/embeddedobj/source/msole/platform.h
+++ /dev/null
@@ -1,51 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef _PLATFORM_H_
-#define _PLATFORM_H_
-
-#define STRICT
-#ifndef _WIN32_WINNT
-#define _WIN32_WINNT 0x0400
-#endif
-#define _ATL_APARTMENT_THREADED
-
-#if defined _MSC_VER
-#pragma warning(push, 1)
-#pragma warning(disable: 4548 4555 4917)
-#endif
-
-#include "windows.h"
-
-#if defined _MSC_VER
-#pragma warning(pop)
-#endif
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/xdialogcreator.cxx b/embeddedobj/source/msole/xdialogcreator.cxx
deleted file mode 100644
index 4bcc7836c3..0000000000
--- a/embeddedobj/source/msole/xdialogcreator.cxx
+++ /dev/null
@@ -1,385 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-#include <com/sun/star/embed/XEmbedObjectCreator.hpp>
-#include <com/sun/star/embed/XEmbeddedObject.hpp>
-#include <com/sun/star/embed/EntryInitModes.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/datatransfer/DataFlavor.hpp>
-#include <com/sun/star/ucb/CommandAbortedException.hpp>
-
-
-#include <osl/thread.h>
-#include <osl/file.hxx>
-#include <osl/module.hxx>
-#include <comphelper/classids.hxx>
-
-#include "platform.h"
-#include <comphelper/mimeconfighelper.hxx>
-
-#include "xdialogcreator.hxx"
-#include "oleembobj.hxx"
-#include <xdialogcreator.hxx>
-#include <oleembobj.hxx>
-
-
-#ifdef WNT
-
-#include <oledlg.h>
-
-class InitializedOleGuard
-{
-public:
- InitializedOleGuard()
- {
- if ( !SUCCEEDED( OleInitialize( NULL ) ) )
- throw ::com::sun::star::uno::RuntimeException();
- }
-
- ~InitializedOleGuard()
- {
- OleUninitialize();
- }
-};
-
-extern "C" {
-typedef UINT STDAPICALLTYPE OleUIInsertObjectA_Type(LPOLEUIINSERTOBJECTA);
-}
-
-#endif
-
-
-using namespace ::com::sun::star;
-using namespace ::comphelper;
-//-------------------------------------------------------------------------
-uno::Sequence< sal_Int8 > GetRelatedInternalID_Impl( const uno::Sequence< sal_Int8 >& aClassID )
-{
- // Writer
- if ( MimeConfigurationHelper::ClassIDsEqual( aClassID, MimeConfigurationHelper::GetSequenceClassID( SO3_SW_OLE_EMBED_CLASSID_60 ) )
- || MimeConfigurationHelper::ClassIDsEqual( aClassID, MimeConfigurationHelper::GetSequenceClassID( SO3_SW_OLE_EMBED_CLASSID_8 ) ) )
- return MimeConfigurationHelper::GetSequenceClassID( SO3_SW_CLASSID_60 );
-
- // Calc
- if ( MimeConfigurationHelper::ClassIDsEqual( aClassID, MimeConfigurationHelper::GetSequenceClassID( SO3_SC_OLE_EMBED_CLASSID_60 ) )
- || MimeConfigurationHelper::ClassIDsEqual( aClassID, MimeConfigurationHelper::GetSequenceClassID( SO3_SC_OLE_EMBED_CLASSID_8 ) ) )
- return MimeConfigurationHelper::GetSequenceClassID( SO3_SC_CLASSID_60 );
-
- // Impress
- if ( MimeConfigurationHelper::ClassIDsEqual( aClassID, MimeConfigurationHelper::GetSequenceClassID( SO3_SIMPRESS_OLE_EMBED_CLASSID_60 ) )
- || MimeConfigurationHelper::ClassIDsEqual( aClassID, MimeConfigurationHelper::GetSequenceClassID( SO3_SIMPRESS_OLE_EMBED_CLASSID_8 ) ) )
- return MimeConfigurationHelper::GetSequenceClassID( SO3_SIMPRESS_CLASSID_60 );
-
- // Draw
- if ( MimeConfigurationHelper::ClassIDsEqual( aClassID, MimeConfigurationHelper::GetSequenceClassID( SO3_SDRAW_OLE_EMBED_CLASSID_60 ) )
- || MimeConfigurationHelper::ClassIDsEqual( aClassID, MimeConfigurationHelper::GetSequenceClassID( SO3_SDRAW_OLE_EMBED_CLASSID_8 ) ) )
- return MimeConfigurationHelper::GetSequenceClassID( SO3_SDRAW_CLASSID_60 );
-
- // Chart
- if ( MimeConfigurationHelper::ClassIDsEqual( aClassID, MimeConfigurationHelper::GetSequenceClassID( SO3_SCH_OLE_EMBED_CLASSID_60 ) )
- || MimeConfigurationHelper::ClassIDsEqual( aClassID, MimeConfigurationHelper::GetSequenceClassID( SO3_SCH_OLE_EMBED_CLASSID_8 ) ) )
- return MimeConfigurationHelper::GetSequenceClassID( SO3_SCH_CLASSID_60 );
-
- // Math
- if ( MimeConfigurationHelper::ClassIDsEqual( aClassID, MimeConfigurationHelper::GetSequenceClassID( SO3_SM_OLE_EMBED_CLASSID_60 ) )
- || MimeConfigurationHelper::ClassIDsEqual( aClassID, MimeConfigurationHelper::GetSequenceClassID( SO3_SM_OLE_EMBED_CLASSID_8 ) ) )
- return MimeConfigurationHelper::GetSequenceClassID( SO3_SM_CLASSID_60 );
-
- return aClassID;
-}
-
-//-------------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL MSOLEDialogObjectCreator::impl_staticGetSupportedServiceNames()
-{
- uno::Sequence< ::rtl::OUString > aRet(2);
- aRet[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.MSOLEObjectSystemCreator"));
- aRet[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.embed.MSOLEObjectSystemCreator"));
- return aRet;
-}
-
-//-------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MSOLEDialogObjectCreator::impl_staticGetImplementationName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.embed.MSOLEObjectSystemCreator"));
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL MSOLEDialogObjectCreator::impl_staticCreateSelfInstance(
- const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
-{
- return uno::Reference< uno::XInterface >( *new MSOLEDialogObjectCreator( xServiceManager ) );
-}
-
-//-------------------------------------------------------------------------
-embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceByDialog(
- const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const uno::Sequence< beans::PropertyValue >& aInObjArgs )
- throw ( lang::IllegalArgumentException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- embed::InsertedObjectInfo aObjectInfo;
- uno::Sequence< beans::PropertyValue > aObjArgs( aInObjArgs );
-
-#ifdef WNT
-
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 1 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 2 );
-
- InitializedOleGuard aGuard;
-
- OLEUIINSERTOBJECT io;
- char szFile[MAX_PATH];
- UINT uTemp;
-
- memset(&io, 0, sizeof(io));
-
- io.cbStruct = sizeof(io);
- io.hWndOwner = GetActiveWindow();
-
- szFile[0] = 0;
- io.lpszFile = szFile;
- io.cchFile = MAX_PATH;
-
- io.dwFlags = IOF_SELECTCREATENEW | IOF_DISABLELINK;
-
-
- ::osl::Module aOleDlgLib;
- if( !aOleDlgLib.load( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "oledlg" ) ) ))
- throw uno::RuntimeException();
-
- OleUIInsertObjectA_Type * pInsertFct = (OleUIInsertObjectA_Type *)
- aOleDlgLib.getSymbol( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "OleUIInsertObjectA" ) ));
- if( !pInsertFct )
- throw uno::RuntimeException();
-
- uTemp=pInsertFct(&io);
-
- if ( OLEUI_OK == uTemp )
- {
- if (io.dwFlags & IOF_SELECTCREATENEW)
- {
- uno::Reference< embed::XEmbedObjectCreator > xEmbCreator(
- m_xFactory->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.EmbeddedObjectCreator" ) )),
- uno::UNO_QUERY );
- if ( !xEmbCreator.is() )
- throw uno::RuntimeException();
-
- uno::Sequence< sal_Int8 > aClassID = MimeConfigurationHelper::GetSequenceClassID( io.clsid.Data1,
- io.clsid.Data2,
- io.clsid.Data3,
- io.clsid.Data4[0],
- io.clsid.Data4[1],
- io.clsid.Data4[2],
- io.clsid.Data4[3],
- io.clsid.Data4[4],
- io.clsid.Data4[5],
- io.clsid.Data4[6],
- io.clsid.Data4[7] );
-
- aClassID = GetRelatedInternalID_Impl( aClassID );
-
- //TODO: retrieve ClassName
- ::rtl::OUString aClassName;
- aObjectInfo.Object = uno::Reference< embed::XEmbeddedObject >(
- xEmbCreator->createInstanceInitNew( aClassID, aClassName, xStorage, sEntName, aObjArgs ),
- uno::UNO_QUERY );
- }
- else
- {
- ::rtl::OUString aFileName = ::rtl::OStringToOUString( ::rtl::OString( szFile ), osl_getThreadTextEncoding() );
- rtl::OUString aFileURL;
- if ( osl::FileBase::getFileURLFromSystemPath( aFileName, aFileURL ) != osl::FileBase::E_None )
- throw uno::RuntimeException();
-
- uno::Sequence< beans::PropertyValue > aMediaDescr( 1 );
- aMediaDescr[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "URL" ));
- aMediaDescr[0].Value <<= aFileURL;
-
- // TODO: use config helper for type detection
- uno::Reference< embed::XEmbedObjectCreator > xEmbCreator;
- ::comphelper::MimeConfigurationHelper aHelper( m_xFactory );
-
- if ( aHelper.AddFilterNameCheckOwnFile( aMediaDescr ) )
- xEmbCreator = uno::Reference< embed::XEmbedObjectCreator >(
- m_xFactory->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.EmbeddedObjectCreator" ) )),
- uno::UNO_QUERY );
- else
- xEmbCreator = uno::Reference< embed::XEmbedObjectCreator >(
- m_xFactory->createInstance(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.embed.OLEEmbeddedObjectFactory" ) )),
- uno::UNO_QUERY );
-
- if ( !xEmbCreator.is() )
- throw uno::RuntimeException();
-
- aObjectInfo.Object = uno::Reference< embed::XEmbeddedObject >(
- xEmbCreator->createInstanceInitFromMediaDescriptor( xStorage, sEntName, aMediaDescr, aObjArgs ),
- uno::UNO_QUERY );
- }
-
- if ( ( io.dwFlags & IOF_CHECKDISPLAYASICON) && io.hMetaPict != NULL )
- {
- METAFILEPICT* pMF = ( METAFILEPICT* )GlobalLock( io.hMetaPict );
- if ( pMF )
- {
- sal_uInt32 nBufSize = GetMetaFileBitsEx( pMF->hMF, 0, NULL );
- uno::Sequence< sal_Int8 > aMetafile( nBufSize + 22 );
- sal_uInt8* pBuf = (sal_uInt8*)( aMetafile.getArray() );
- *( (long* )pBuf ) = 0x9ac6cdd7L;
- *( (short* )( pBuf+6 )) = ( SHORT ) 0;
- *( (short* )( pBuf+8 )) = ( SHORT ) 0;
- *( (short* )( pBuf+10 )) = ( SHORT ) pMF->xExt;
- *( (short* )( pBuf+12 )) = ( SHORT ) pMF->yExt;
- *( (short* )( pBuf+14 )) = ( USHORT ) 2540;
-
- if ( nBufSize && nBufSize == GetMetaFileBitsEx( pMF->hMF, nBufSize, pBuf+22 ) )
- {
- datatransfer::DataFlavor aFlavor(
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "application/x-openoffice-wmf;windows_formatname=\"Image WMF\"" )),
- ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Image WMF" )),
- getCppuType( ( const uno::Sequence< sal_Int8 >* ) 0 ) );
-
- aObjectInfo.Options.realloc( 2 );
- aObjectInfo.Options[0].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Icon" ));
- aObjectInfo.Options[0].Value <<= aMetafile;
- aObjectInfo.Options[1].Name = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "IconFormat" ));
- aObjectInfo.Options[1].Value <<= aFlavor;
- }
-
- GlobalUnlock( io.hMetaPict );
- }
- }
- }
- else
- throw ucb::CommandAbortedException();
-
-#else
- throw lang::NoSupportException(); // TODO:
-#endif
-
- OSL_ENSURE( aObjectInfo.Object.is(), "No object was created!\n" );
- if ( !aObjectInfo.Object.is() )
- throw uno::RuntimeException();
-
- return aObjectInfo;
-}
-
-//-------------------------------------------------------------------------
-embed::InsertedObjectInfo SAL_CALL MSOLEDialogObjectCreator::createInstanceInitFromClipboard(
- const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntryName,
- const uno::Sequence< beans::PropertyValue >& aObjectArgs )
- throw ( lang::IllegalArgumentException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- embed::InsertedObjectInfo aObjectInfo;
-
-#ifdef WNT
-
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 1 );
-
- if ( !sEntryName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 2 );
-
- uno::Reference< embed::XEmbeddedObject > xResult(
- static_cast< ::cppu::OWeakObject* > ( new OleEmbeddedObject( m_xFactory ) ),
- uno::UNO_QUERY );
-
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
-
- if ( !xPersist.is() )
- throw uno::RuntimeException(); // TODO: the interface must be supported by own document objects
-
- xPersist->setPersistentEntry( xStorage,
- sEntryName,
- embed::EntryInitModes::DEFAULT_INIT,
- uno::Sequence< beans::PropertyValue >(),
- aObjectArgs );
-
- aObjectInfo.Object = xResult;
-
- // TODO/LATER: in case of iconifie object the icon should be stored in aObjectInfo
-#else
- throw lang::NoSupportException(); // TODO:
-#endif
-
- OSL_ENSURE( aObjectInfo.Object.is(), "No object was created!\n" );
- if ( !aObjectInfo.Object.is() )
- throw uno::RuntimeException();
-
- return aObjectInfo;
-}
-
-//-------------------------------------------------------------------------
-::rtl::OUString SAL_CALL MSOLEDialogObjectCreator::getImplementationName()
- throw ( uno::RuntimeException )
-{
- return impl_staticGetImplementationName();
-}
-
-//-------------------------------------------------------------------------
-sal_Bool SAL_CALL MSOLEDialogObjectCreator::supportsService( const ::rtl::OUString& ServiceName )
- throw ( uno::RuntimeException )
-{
- uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
-
- for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
- if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
- return sal_True;
-
- return sal_False;
-}
-
-//-------------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL MSOLEDialogObjectCreator::getSupportedServiceNames()
- throw ( uno::RuntimeException )
-{
- return impl_staticGetSupportedServiceNames();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/xdialogcreator.hxx b/embeddedobj/source/msole/xdialogcreator.hxx
deleted file mode 100644
index 7d20ad0388..0000000000
--- a/embeddedobj/source/msole/xdialogcreator.hxx
+++ /dev/null
@@ -1,79 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef __XDIALOGCREATOR_HXX_
-#define __XDIALOGCREATOR_HXX_
-
-#include <com/sun/star/embed/XInsertObjectDialog.hpp>
-#include <com/sun/star/embed/XEmbedObjectClipboardCreator.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-
-
-#include <cppuhelper/implbase3.hxx>
-
-
-class MSOLEDialogObjectCreator : public ::cppu::WeakImplHelper3<
- ::com::sun::star::embed::XInsertObjectDialog,
- ::com::sun::star::embed::XEmbedObjectClipboardCreator,
- ::com::sun::star::lang::XServiceInfo >
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
-
-public:
- MSOLEDialogObjectCreator(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
- : m_xFactory( xFactory )
- {
- OSL_ENSURE( xFactory.is(), "No service manager is provided!\n" );
- }
-
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL impl_staticGetSupportedServiceNames();
-
- static ::rtl::OUString SAL_CALL impl_staticGetImplementationName();
-
- static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
- impl_staticCreateSelfInstance(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
-
-
- // XInsertObjectDialog
- virtual ::com::sun::star::embed::InsertedObjectInfo SAL_CALL createInstanceByDialog( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XEmbedObjectClipboardCreator
- virtual ::com::sun::star::embed::InsertedObjectInfo SAL_CALL createInstanceInitFromClipboard( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntryName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aObjectArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/xolefactory.cxx b/embeddedobj/source/msole/xolefactory.cxx
deleted file mode 100644
index 64339daf36..0000000000
--- a/embeddedobj/source/msole/xolefactory.cxx
+++ /dev/null
@@ -1,344 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-// MARKER(update_precomp.py): autogen include statement, do not remove
-#include "precompiled_embeddedobj.hxx"
-#include <com/sun/star/embed/ElementModes.hpp>
-#include <com/sun/star/embed/EntryInitModes.hpp>
-#include <com/sun/star/beans/PropertyValue.hpp>
-#include <com/sun/star/beans/XPropertySet.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/embed/Aspects.hpp>
-
-#include <rtl/logfile.hxx>
-
-
-#include "xolefactory.hxx"
-#include "oleembobj.hxx"
-
-
-using namespace ::com::sun::star;
-
-// TODO: do not create OLE objects that represent OOo documents
-
-//-------------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL OleEmbeddedObjectFactory::impl_staticGetSupportedServiceNames()
-{
- uno::Sequence< ::rtl::OUString > aRet(2);
- aRet[0] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.embed.OLEEmbeddedObjectFactory"));
- aRet[1] = ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.embed.OLEEmbeddedObjectFactory"));
- return aRet;
-}
-
-//-------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OleEmbeddedObjectFactory::impl_staticGetImplementationName()
-{
- return ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.comp.embed.OLEEmbeddedObjectFactory"));
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL OleEmbeddedObjectFactory::impl_staticCreateSelfInstance(
- const uno::Reference< lang::XMultiServiceFactory >& xServiceManager )
-{
- return uno::Reference< uno::XInterface >( *new OleEmbeddedObjectFactory( xServiceManager ) );
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL OleEmbeddedObjectFactory::createInstanceInitFromEntry(
- const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const uno::Sequence< beans::PropertyValue >& aMedDescr,
- const uno::Sequence< beans::PropertyValue >& lObjArgs )
- throw ( lang::IllegalArgumentException,
- container::NoSuchElementException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObjectFactory::createInstanceInitFromEntry" );
-
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 1 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 2 );
-
- uno::Reference< container::XNameAccess > xNameAccess( xStorage, uno::UNO_QUERY );
- if ( !xNameAccess.is() )
- throw uno::RuntimeException(); //TODO
-
- // detect entry existence
- if ( !xNameAccess->hasByName( sEntName ) )
- throw container::NoSuchElementException();
-
- if ( !xStorage->isStreamElement( sEntName ) )
- {
- // if it is not an OLE object throw an exception
- throw io::IOException(); // TODO:
- }
-
- uno::Reference< uno::XInterface > xResult(
- static_cast< ::cppu::OWeakObject* > ( new OleEmbeddedObject( m_xFactory, sal_False ) ),
- uno::UNO_QUERY );
-
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
-
- if ( !xPersist.is() )
- throw uno::RuntimeException(); // TODO: the interface must be supported by own document objects
-
- xPersist->setPersistentEntry( xStorage,
- sEntName,
- embed::EntryInitModes::DEFAULT_INIT,
- aMedDescr,
- lObjArgs );
-
- for ( sal_Int32 nInd = 0; nInd < lObjArgs.getLength(); nInd++ )
- {
- if ( lObjArgs[nInd].Name.equalsAsciiL( RTL_CONSTASCII_STRINGPARAM( "CloneFrom" ) ) )
- {
- try
- {
- uno::Reference < embed::XEmbeddedObject > xObj;
- uno::Reference < embed::XEmbeddedObject > xNew( xResult, uno::UNO_QUERY );
- lObjArgs[nInd].Value >>= xObj;
- if ( xObj.is() )
- xNew->setVisualAreaSize( embed::Aspects::MSOLE_CONTENT, xObj->getVisualAreaSize( embed::Aspects::MSOLE_CONTENT ) );
- }
- catch ( uno::Exception& ) {};
- break;
- }
- }
-
- return xResult;
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL OleEmbeddedObjectFactory::createInstanceInitFromMediaDescriptor(
- const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const uno::Sequence< beans::PropertyValue >& aMediaDescr,
- const uno::Sequence< beans::PropertyValue >& lObjArgs )
- throw ( lang::IllegalArgumentException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObjectFactory::createInstanceInitFromMediaDescriptor" );
-
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 1 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 2 );
-
- uno::Reference< uno::XInterface > xResult(
- static_cast< ::cppu::OWeakObject* > ( new OleEmbeddedObject( m_xFactory, sal_False ) ),
- uno::UNO_QUERY );
-
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
-
- if ( !xPersist.is() )
- throw uno::RuntimeException(); // TODO: the interface must be supported ( what about applets? )
-
- xPersist->setPersistentEntry( xStorage,
- sEntName,
- embed::EntryInitModes::MEDIA_DESCRIPTOR_INIT,
- aMediaDescr,
- lObjArgs );
-
- return xResult;
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL OleEmbeddedObjectFactory::createInstanceInitNew(
- const uno::Sequence< sal_Int8 >& aClassID,
- const ::rtl::OUString& aClassName,
- const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const uno::Sequence< beans::PropertyValue >& lObjArgs )
- throw ( lang::IllegalArgumentException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException)
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObjectFactory::createInstanceInitNew" );
-
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 3 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 4 );
-
- uno::Reference< uno::XInterface > xResult(
- static_cast< ::cppu::OWeakObject* > ( new OleEmbeddedObject( m_xFactory, aClassID, aClassName ) ),
- uno::UNO_QUERY );
-
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
-
- if ( !xPersist.is() )
- throw uno::RuntimeException(); // TODO: the interface must be supported by own document objects
-
- xPersist->setPersistentEntry( xStorage,
- sEntName,
- embed::EntryInitModes::TRUNCATE_INIT,
- uno::Sequence< beans::PropertyValue >(),
- lObjArgs );
-
- return xResult;
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL OleEmbeddedObjectFactory::createInstanceLink(
- const uno::Reference< embed::XStorage >& xStorage,
- const ::rtl::OUString& sEntName,
- const uno::Sequence< beans::PropertyValue >& aMediaDescr,
- const uno::Sequence< beans::PropertyValue >& lObjArgs )
- throw ( lang::IllegalArgumentException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObjectFactory::createInstanceLink" );
-
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >(
- static_cast< ::cppu::OWeakObject* >(this) ),
- 1 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >(
- static_cast< ::cppu::OWeakObject* >(this) ),
- 2 );
-
- uno::Reference< uno::XInterface > xResult(
- static_cast< ::cppu::OWeakObject* > ( new OleEmbeddedObject( m_xFactory, sal_True ) ),
- uno::UNO_QUERY );
-
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
-
- if ( !xPersist.is() )
- throw uno::RuntimeException(); // TODO: the interface must be supported by own document objects
-
- xPersist->setPersistentEntry( xStorage,
- sEntName,
- embed::EntryInitModes::MEDIA_DESCRIPTOR_INIT,
- aMediaDescr,
- lObjArgs );
-
- return xResult;
-}
-
-//-------------------------------------------------------------------------
-uno::Reference< uno::XInterface > SAL_CALL OleEmbeddedObjectFactory::createInstanceUserInit(
- const uno::Sequence< sal_Int8 >& aClassID,
- const ::rtl::OUString& aClassName,
- 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 )
- throw ( lang::IllegalArgumentException,
- io::IOException,
- uno::Exception,
- uno::RuntimeException )
-{
- RTL_LOGFILE_CONTEXT( aLog, "embeddedobj (mv76033) OleEmbeddedObjectFactory::createInstanceUserInit" );
-
- // the initialization is completelly controlled by user
- if ( !xStorage.is() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "No parent storage is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 1 );
-
- if ( !sEntName.getLength() )
- throw lang::IllegalArgumentException( ::rtl::OUString(RTL_CONSTASCII_USTRINGPARAM( "Empty element name is provided!\n" )),
- uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ),
- 2 );
-
- uno::Reference< uno::XInterface > xResult(
- static_cast< ::cppu::OWeakObject* > ( new OleEmbeddedObject( m_xFactory, aClassID, aClassName ) ),
- uno::UNO_QUERY );
-
- uno::Reference< embed::XEmbedPersist > xPersist( xResult, uno::UNO_QUERY );
- if ( xPersist.is() )
- {
- xPersist->setPersistentEntry( xStorage,
- sEntName,
- embed::EntryInitModes::DEFAULT_INIT,
- uno::Sequence< beans::PropertyValue >(),
- lObjArgs );
-
- }
- else
- throw uno::RuntimeException(); // TODO:
-
- return xResult;
-}
-
-//-------------------------------------------------------------------------
-::rtl::OUString SAL_CALL OleEmbeddedObjectFactory::getImplementationName()
- throw ( uno::RuntimeException )
-{
- return impl_staticGetImplementationName();
-}
-
-//-------------------------------------------------------------------------
-sal_Bool SAL_CALL OleEmbeddedObjectFactory::supportsService( const ::rtl::OUString& ServiceName )
- throw ( uno::RuntimeException )
-{
- uno::Sequence< ::rtl::OUString > aSeq = impl_staticGetSupportedServiceNames();
-
- for ( sal_Int32 nInd = 0; nInd < aSeq.getLength(); nInd++ )
- if ( ServiceName.compareTo( aSeq[nInd] ) == 0 )
- return sal_True;
-
- return sal_False;
-}
-
-//-------------------------------------------------------------------------
-uno::Sequence< ::rtl::OUString > SAL_CALL OleEmbeddedObjectFactory::getSupportedServiceNames()
- throw ( uno::RuntimeException )
-{
- return impl_staticGetSupportedServiceNames();
-}
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/embeddedobj/source/msole/xolefactory.hxx b/embeddedobj/source/msole/xolefactory.hxx
deleted file mode 100644
index 4fea7d3065..0000000000
--- a/embeddedobj/source/msole/xolefactory.hxx
+++ /dev/null
@@ -1,86 +0,0 @@
-/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * 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.
- *
- * 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).
- *
- * 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.
- *
- ************************************************************************/
-
-#ifndef __XFACTORY_HXX_
-#define __XFACTORY_HXX_
-
-#include <com/sun/star/embed/XEmbedObjectCreator.hpp>
-#include <com/sun/star/embed/XEmbedObjectFactory.hpp>
-#include <com/sun/star/embed/XLinkCreator.hpp>
-#include <com/sun/star/lang/XServiceInfo.hpp>
-
-
-#include <cppuhelper/implbase4.hxx>
-
-
-class OleEmbeddedObjectFactory : public ::cppu::WeakImplHelper4<
- ::com::sun::star::embed::XEmbedObjectCreator,
- ::com::sun::star::embed::XEmbedObjectFactory,
- ::com::sun::star::embed::XLinkCreator,
- ::com::sun::star::lang::XServiceInfo >
-{
- ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory > m_xFactory;
-
-public:
- OleEmbeddedObjectFactory(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xFactory )
- : m_xFactory( xFactory )
- {
- OSL_ENSURE( xFactory.is(), "No service manager is provided!\n" );
- }
-
- static ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL impl_staticGetSupportedServiceNames();
-
- static ::rtl::OUString SAL_CALL impl_staticGetImplementationName();
-
- static ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL
- impl_staticCreateSelfInstance(
- const ::com::sun::star::uno::Reference< ::com::sun::star::lang::XMultiServiceFactory >& xServiceManager );
-
-
- // XEmbedObjectCreator
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceInitNew( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceInitFromEntry( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMedDescr, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::container::NoSuchElementException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceInitFromMediaDescriptor( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XEmbedObjectFactory
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceUserInit( const ::com::sun::star::uno::Sequence< sal_Int8 >& aClassID, const ::rtl::OUString& aClassName, const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, sal_Int32 nEntryConnectionMode, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lArguments, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XLinkCreator
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::uno::XInterface > SAL_CALL createInstanceLink( const ::com::sun::star::uno::Reference< ::com::sun::star::embed::XStorage >& xStorage, const ::rtl::OUString& sEntName, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& aMediaDescr, const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& lObjArgs ) throw (::com::sun::star::lang::IllegalArgumentException, ::com::sun::star::io::IOException, ::com::sun::star::uno::Exception, ::com::sun::star::uno::RuntimeException);
-
- // XServiceInfo
- virtual ::rtl::OUString SAL_CALL getImplementationName() throw (::com::sun::star::uno::RuntimeException);
- virtual sal_Bool SAL_CALL supportsService( const ::rtl::OUString& ServiceName ) throw (::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Sequence< ::rtl::OUString > SAL_CALL getSupportedServiceNames() throw (::com::sun::star::uno::RuntimeException);
-
-};
-
-#endif
-
-/* vim:set shiftwidth=4 softtabstop=4 expandtab: */