summaryrefslogtreecommitdiff
path: root/embeddedobj/source/commonembedding
diff options
context:
space:
mode:
authorVladimir Glazounov <vg@openoffice.org>2007-05-22 18:35:35 +0000
committerVladimir Glazounov <vg@openoffice.org>2007-05-22 18:35:35 +0000
commit773599646149b5fd11226e1ee4492ca4db5892b4 (patch)
tree68c4b0516e53c0f6cfae6b1a8d9f3a5107f44152 /embeddedobj/source/commonembedding
parent20cfa719e19f3c917155086ef8d700000822f804 (diff)
INTEGRATION: CWS chart2mst3 (1.4.30); FILE MERGED
2007/03/19 15:27:02 bm 1.4.30.6: #i75418# prefer getPreferredVisualRepresentation over getTransferData of the XTransferable interface 2006/11/30 14:06:13 mba 1.4.30.5: #i64497#: parent is now set before objects are loaded 2006/10/18 20:58:09 bm 1.4.30.4: RESYNC: (1.6-1.11); FILE MERGED 2006/01/25 11:14:36 bm 1.4.30.3: RESYNC: (1.5-1.6); FILE MERGED 2005/10/07 12:57:57 bm 1.4.30.2: RESYNC: (1.4-1.5); FILE MERGED 2005/06/03 08:26:47 bm 1.4.30.1: use embedding API for replacement
Diffstat (limited to 'embeddedobj/source/commonembedding')
-rw-r--r--embeddedobj/source/commonembedding/visobj.cxx46
1 files changed, 34 insertions, 12 deletions
diff --git a/embeddedobj/source/commonembedding/visobj.cxx b/embeddedobj/source/commonembedding/visobj.cxx
index 79ffb4c48d..2974f47d8a 100644
--- a/embeddedobj/source/commonembedding/visobj.cxx
+++ b/embeddedobj/source/commonembedding/visobj.cxx
@@ -4,9 +4,9 @@
*
* $RCSfile: visobj.cxx,v $
*
- * $Revision: 1.11 $
+ * $Revision: 1.12 $
*
- * last change: $Author: mav $ $Date: 2006-10-16 06:20:55 $
+ * last change: $Author: vg $ $Date: 2007-05-22 19:35:35 $
*
* The Contents of this file are made available subject to
* the terms of GNU Lesser General Public License Version 2.1.
@@ -85,6 +85,8 @@ void SAL_CALL OCommonEmbeddedObject::setVisualAreaSize( sal_Int64 nAspect, const
throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The own object has no persistence!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
+ m_bHasCachedSize = sal_False;
+
if ( m_nObjectState == embed::EmbedStates::LOADED )
changeState( embed::EmbedStates::RUNNING );
@@ -110,6 +112,9 @@ awt::Size SAL_CALL OCommonEmbeddedObject::getVisualAreaSize( sal_Int64 nAspect )
OSL_ENSURE( nAspect != embed::Aspects::MSOLE_ICON, "For iconified objects no graphical replacement is required!\n" );
+ if ( m_bHasCachedSize )
+ return m_aCachedSize;
+
if ( m_nObjectState == embed::EmbedStates::LOADED )
changeState( embed::EmbedStates::RUNNING );
@@ -137,6 +142,9 @@ sal_Int32 SAL_CALL OCommonEmbeddedObject::getMapUnit( sal_Int64 nAspect )
throw embed::WrongStateException( ::rtl::OUString::createFromAscii( "The own object has no persistence!\n" ),
uno::Reference< uno::XInterface >( static_cast< ::cppu::OWeakObject* >(this) ) );
+ if ( m_bHasCachedSize )
+ return m_nMapUnit;
+
if ( m_nObjectState == embed::EmbedStates::LOADED )
changeState( embed::EmbedStates::RUNNING );
@@ -178,17 +186,31 @@ embed::VisualRepresentation SAL_CALL OCommonEmbeddedObject::getPreferredVisualRe
// TODO: return for the aspect of the document
embed::VisualRepresentation aVisualRepresentation;
- uno::Reference< datatransfer::XTransferable > xTransferable( m_pDocHolder->GetComponent(), uno::UNO_QUERY );
- if ( !xTransferable.is() )
- throw uno::RuntimeException();
-
- datatransfer::DataFlavor aDataFlavor(
- ::rtl::OUString::createFromAscii( "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" ),
- ::rtl::OUString::createFromAscii( "GDIMetaFile" ),
- ::getCppuType( (const uno::Sequence< sal_Int8 >*) NULL ) );
- aVisualRepresentation.Data = xTransferable->getTransferData( aDataFlavor );
- aVisualRepresentation.Flavor = aDataFlavor;
+ 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::createFromAscii( "application/x-openoffice-gdimetafile;windows_formatname=\"GDIMetaFile\"" ),
+ ::rtl::OUString::createFromAscii( "GDIMetaFile" ),
+ ::getCppuType( (const uno::Sequence< sal_Int8 >*) NULL ) );
+
+ if( xTransferable->isDataFlavorSupported( aDataFlavor ))
+ {
+ aVisualRepresentation.Data = xTransferable->getTransferData( aDataFlavor );
+ aVisualRepresentation.Flavor = aDataFlavor;
+ }
+ else
+ throw uno::RuntimeException();
+ }
return aVisualRepresentation;
}