summaryrefslogtreecommitdiff
path: root/embeddedobj
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2007-05-22 18:35:56 +0000
committerVladimir Glazounov <vg@openoffice.org>2007-05-22 18:35:56 +0000
commit5c2b734621a67ae0fe70e93880a62ec5f5de0afd (patch)
tree488461b959cfc5f8e2ad7a3487948c4bb85c3681 /embeddedobj
parentcc8ee77356836879ec2fbb729a3dbce46ef5395d (diff)
INTEGRATION: CWS chart2mst3 (1.19.10); FILE MERGED
2007/04/25 02:21:06 bm 1.19.10.15: RESYNC: (1.28-1.29); FILE MERGED 2007/02/07 13:28:44 iha 1.19.10.14: RESYNC: (1.27-1.28); FILE MERGED 2007/02/01 13:36:01 tl 1.19.10.13: #i55007# workaround for components that do not implement document::XEventListener 2007/01/10 15:39:34 iha 1.19.10.12: switch back to old factory name for charts now as we only have the new chart 2006/11/30 16:15:25 mba 1.19.10.11: hotfix removed; fixed in layoutmanager.cxx 2006/11/28 10:57:50 bm 1.19.10.10: hotfix to avoid crash for new chart 2006/11/24 16:16:27 bm 1.19.10.9: RESYNC: (1.26-1.27); FILE MERGED 2006/10/27 07:54:20 cd 1.19.10.8: #i65734# Provide dispatch providers to support menu merging with non-sfx2 based application modules 2006/10/20 10:56:01 bm 1.19.10.7: #i55991# adapted change xDocument->xDoc (warning removed in 1.20.4.3) 2006/10/18 20:58:42 bm 1.19.10.6: RESYNC: (1.24-1.26); FILE MERGED 2006/05/11 09:29:06 bm 1.19.10.5: service name of the chart ist ChartDocument not ChartModel 2006/05/05 14:15:21 bm 1.19.10.4: RESYNC: (1.23-1.24); FILE MERGED 2006/01/25 11:15:31 bm 1.19.10.3: RESYNC: (1.22-1.23); FILE MERGED 2005/10/07 12:59:57 bm 1.19.10.2: RESYNC: (1.19-1.22); FILE MERGED 2005/06/03 08:26:13 bm 1.19.10.1: enable embedded chart. This solution is not final!
Diffstat (limited to 'embeddedobj')
-rw-r--r--embeddedobj/source/general/docholder.cxx60
1 files changed, 49 insertions, 11 deletions
diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx
index acdb0a14358a..2d72ac472398 100644
--- a/embeddedobj/source/general/docholder.cxx
+++ b/embeddedobj/source/general/docholder.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: docholder.cxx,v $
*
- * $Revision: 1.29 $
+ * $Revision: 1.30 $
*
- * last change: $Author: ihi $ $Date: 2007-04-16 16:50:44 $
+ * last change: $Author: vg $ $Date: 2007-05-22 19:35:56 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -388,6 +388,14 @@ void DocumentHolder::CloseDocument( sal_Bool bDeliverOwnership, sal_Bool bWaitFo
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() )
@@ -1041,6 +1049,14 @@ void DocumentHolder::SetComponent( const uno::Reference< util::XCloseable >& xDo
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);
@@ -1070,13 +1086,33 @@ sal_Bool DocumentHolder::LoadDocToFrame( sal_Bool bInPlace )
aArgs[2].Value <<= sal_Int16(1);
}
- xComponentLoader->loadComponentFromURL( rtl::OUString::createFromAscii( "private:object" ),
- rtl::OUString::createFromAscii( "_self" ),
- 0,
- aArgs );
+ bool bIsChart = false;
+ uno::Reference< lang::XServiceInfo > xInfo( xDoc, uno::UNO_QUERY );
+ if( xInfo.is())
+ {
+ bIsChart = xInfo->supportsService(
+ ::rtl::OUString::createFromAscii("com.sun.star.chart2.ChartDocument"));
+ }
+
+ if( bIsChart )
+ {
+ xComponentLoader->loadComponentFromURL(
+ ::rtl::OUString::createFromAscii( "private:factory/schart" ),
+ ::rtl::OUString::createFromAscii( "_self" ),
+ 0,
+ aArgs );
+ }
+ else
+ {
+ xComponentLoader->loadComponentFromURL( rtl::OUString::createFromAscii( "private:object" ),
+ rtl::OUString::createFromAscii( "_self" ),
+ 0,
+ aArgs );
+ }
+
- ::rtl::OUString aDocumentName;
- uno::Reference < frame::XModel > xDocument( m_xComponent, uno::UNO_QUERY );
+// ::rtl::OUString aDocumentName;
+// uno::Reference < frame::XModel > xDocument( m_xComponent, uno::UNO_QUERY );
//REMOVE uno::Sequence< beans::PropertyValue > aDocArgs = xDocument->getArgs();
//REMOVE for ( sal_Int32 nInd = 0; nInd < aDocArgs.getLength(); nInd++ )
@@ -1417,11 +1453,13 @@ void SAL_CALL DocumentHolder::notifyTermination( const lang::EventObject& aSourc
}
//---------------------------------------------------------------------------
-void SAL_CALL DocumentHolder::modified( const lang::EventObject& )
+void SAL_CALL DocumentHolder::modified( const lang::EventObject& aEvent )
throw ( uno::RuntimeException )
{
- if( m_pEmbedObj )
- m_pEmbedObj->update(); // TODO ???
+ // 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 );
}
//---------------------------------------------------------------------------