diff options
-rw-r--r-- | oox/inc/oox/mathml/import.hxx | 7 | ||||
-rw-r--r-- | starmath/inc/unomodel.hxx | 1 | ||||
-rw-r--r-- | starmath/source/unomodel.cxx | 5 | ||||
-rw-r--r-- | writerfilter/source/dmapper/DomainMapper_Impl.cxx | 10 |
4 files changed, 23 insertions, 0 deletions
diff --git a/oox/inc/oox/mathml/import.hxx b/oox/inc/oox/mathml/import.hxx index 715426405dba..8c922abf73ac 100644 --- a/oox/inc/oox/mathml/import.hxx +++ b/oox/inc/oox/mathml/import.hxx @@ -29,6 +29,7 @@ #define _STARMATHIMPORT_HXX #include <com/sun/star/embed/XEmbeddedObject.hpp> +#include <tools/gen.hxx> #include <oox/dllapi.h> @@ -40,11 +41,17 @@ namespace formulaimport class XmlStream; } +/** + Interface class, StarMath will implement readFormulaOoxml() to read OOXML + representing the formula and getFormulaSize() to provide the size of the resulting + formula. + */ class OOX_DLLPUBLIC FormulaImportBase { public: FormulaImportBase(); virtual void readFormulaOoxml( oox::formulaimport::XmlStream& stream ) = 0; + virtual Size getFormulaSize() const = 0; }; } // namespace diff --git a/starmath/inc/unomodel.hxx b/starmath/inc/unomodel.hxx index 5243d414442e..cf01ec401f78 100644 --- a/starmath/inc/unomodel.hxx +++ b/starmath/inc/unomodel.hxx @@ -108,6 +108,7 @@ public: virtual void writeFormulaOoxml( ::sax_fastparser::FSHelperPtr m_pSerializer, oox::core::OoxmlVersion version ); // oox::FormulaImportBase virtual void readFormulaOoxml( oox::formulaimport::XmlStream& stream ); + virtual Size getFormulaSize() const; static ::com::sun::star::uno::Sequence< rtl::OUString > getSupportedServiceNames_Static(); static ::rtl::OUString getImplementationName_Static(); diff --git a/starmath/source/unomodel.cxx b/starmath/source/unomodel.cxx index 4bbbf9db703d..70627ac21cef 100644 --- a/starmath/source/unomodel.cxx +++ b/starmath/source/unomodel.cxx @@ -1140,4 +1140,9 @@ void SmModel::readFormulaOoxml( oox::formulaimport::XmlStream& stream ) static_cast< SmDocShell* >( GetObjectShell())->readFormulaOoxml( stream ); } +Size SmModel::getFormulaSize() const +{ + return static_cast< SmDocShell* >( GetObjectShell())->GetSize(); +} + /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index 58928646e575..41749643f0a4 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -75,6 +75,7 @@ #include <rtl/ustrbuf.hxx> #include <rtl/string.h> #include "FieldTypes.hxx" +#include <oox/mathml/import.hxx> #include <tools/string.hxx> #ifdef DEBUG_DOMAINMAPPER @@ -1102,6 +1103,15 @@ void DomainMapper_Impl::appendStarMath( const Value& val ) xStarMathProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_STREAM_NAME ), val.getAny()); + + uno::Reference< uno::XInterface > xInterface( formula->getComponent(), uno::UNO_QUERY ); + Size size( 1000, 1000 ); + if( oox::FormulaImportBase* formulaimport = dynamic_cast< oox::FormulaImportBase* >( xInterface.get())) + size = formulaimport->getFormulaSize(); + xStarMathProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_WIDTH ), + uno::makeAny( int(size.Width()))); + xStarMathProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_HEIGHT ), + uno::makeAny( int(size.Height()))); // mimic the treatment of graphics here.. it seems anchoring as character // gives a better ( visually ) result xStarMathProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_ANCHOR_TYPE ), |