summaryrefslogtreecommitdiff
path: root/embeddedobj
diff options
context:
space:
mode:
Diffstat (limited to 'embeddedobj')
-rw-r--r--embeddedobj/source/commonembedding/embedobj.cxx6
-rw-r--r--embeddedobj/source/commonembedding/miscobj.cxx10
-rw-r--r--embeddedobj/source/commonembedding/persistence.cxx10
-rw-r--r--embeddedobj/source/inc/commonembobj.hxx7
4 files changed, 31 insertions, 2 deletions
diff --git a/embeddedobj/source/commonembedding/embedobj.cxx b/embeddedobj/source/commonembedding/embedobj.cxx
index 668c4a53508f..85f9b8b0b2c9 100644
--- a/embeddedobj/source/commonembedding/embedobj.cxx
+++ b/embeddedobj/source/commonembedding/embedobj.cxx
@@ -696,3 +696,9 @@ void SAL_CALL OCommonEmbeddedObject::setParent( const com::sun::star::uno::Refer
}
}
+// 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;
+}
diff --git a/embeddedobj/source/commonembedding/miscobj.cxx b/embeddedobj/source/commonembedding/miscobj.cxx
index 58a5e87fe418..e557437e336d 100644
--- a/embeddedobj/source/commonembedding/miscobj.cxx
+++ b/embeddedobj/source/commonembedding/miscobj.cxx
@@ -361,9 +361,14 @@ uno::Any SAL_CALL OCommonEmbeddedObject::queryInterface( const uno::Type& rType
{
uno::Any aReturn;
- aReturn <<= ::cppu::queryInterface(
+ 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::XEmbeddedObject* >( this ),
static_cast< embed::XInplaceObject* >( this ),
static_cast< embed::XVisualObject* >( this ),
static_cast< embed::XCommonEmbedPersist* >( static_cast< embed::XEmbedPersist* >( this ) ),
@@ -374,6 +379,7 @@ uno::Any SAL_CALL OCommonEmbeddedObject::queryInterface( const uno::Type& rType
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() )
diff --git a/embeddedobj/source/commonembedding/persistence.cxx b/embeddedobj/source/commonembedding/persistence.cxx
index 8d33935168b6..47b16bf961af 100644
--- a/embeddedobj/source/commonembedding/persistence.cxx
+++ b/embeddedobj/source/commonembedding/persistence.cxx
@@ -58,6 +58,7 @@
#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>
@@ -463,6 +464,15 @@ uno::Reference< util::XCloseable > OCommonEmbeddedObject::LoadDocumentFromStorag
uno::Reference< util::XCloseable > xDocument( CreateDocument( m_xFactory, GetDocumentServiceName(),
m_bEmbeddedScriptSupport ) );
+ //#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
diff --git a/embeddedobj/source/inc/commonembobj.hxx b/embeddedobj/source/inc/commonembobj.hxx
index afd199af9207..5a2827de3aa6 100644
--- a/embeddedobj/source/inc/commonembobj.hxx
+++ b/embeddedobj/source/inc/commonembobj.hxx
@@ -47,6 +47,7 @@
#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 {
@@ -85,6 +86,7 @@ class OCommonEmbeddedObject : public ::com::sun::star::embed::XEmbeddedObject
, 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:
@@ -159,6 +161,7 @@ protected:
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 );
@@ -492,6 +495,10 @@ public:
// 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