summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorLuboš Luňák <l.lunak@suse.cz>2011-11-18 18:09:43 +0100
committerLuboš Luňák <l.lunak@suse.cz>2011-11-24 18:43:57 +0100
commite9462ed2d978dc3e641227ea9f553eeed4d81a97 (patch)
tree8b77274817348852458ed19be1bd46bb66d0a749 /writerfilter
parent1d163e4835b4906eb4559851e5ab2470b26332fe (diff)
ooxml mathml import - first very basic implementation
still needs a number of cleanups (and handling more of course)
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/Library_ooxml.mk1
-rw-r--r--writerfilter/source/dmapper/DomainMapper_Impl.cxx12
-rw-r--r--writerfilter/source/ooxml/OOXMLFastContextHandler.cxx19
-rw-r--r--writerfilter/source/ooxml/OOXMLFastContextHandler.hxx5
4 files changed, 17 insertions, 20 deletions
diff --git a/writerfilter/Library_ooxml.mk b/writerfilter/Library_ooxml.mk
index 53a0342d114f..d2f52f5e5569 100644
--- a/writerfilter/Library_ooxml.mk
+++ b/writerfilter/Library_ooxml.mk
@@ -59,6 +59,7 @@ $(eval $(call gb_Library_add_linked_libs,ooxml,\
doctok \
i18nisolang1 \
i18npaper \
+ oox \
resourcemodel \
sal \
tl \
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index f358ea13d1fd..0f5c78740e4a 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1092,34 +1092,24 @@ void DomainMapper_Impl::appendOLE( const ::rtl::OUString& rStreamName, OLEHandle
void DomainMapper_Impl::appendStarMath( const Value& val )
{
- fprintf(stderr,"SM 1 %s\n", typeid(*GetTextDocument().get()).name());
uno::Reference< embed::XEmbeddedObject > formula;
val.getAny() >>= formula;
if( formula.is() )
{
- if( OoxmlFormulaImportBase* import = dynamic_cast< OoxmlFormulaImportBase* >( GetTextDocument().get()))
- {
- fprintf( stderr,"SM 3 %p\n", import );
+ if( OoxmlFormulaImportHelper* import = dynamic_cast< OoxmlFormulaImportHelper* >( GetTextDocument().get()))
import->addFormula( formula );
- }
static const rtl::OUString sEmbeddedService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextEmbeddedObject"));
try
{
uno::Reference< text::XTextContent > xOLE( m_xTextFactory->createInstance(sEmbeddedService), uno::UNO_QUERY_THROW );
- fprintf(stderr,"SM4\n");
uno::Reference< beans::XPropertySet > xOLEProperties(xOLE, uno::UNO_QUERY_THROW);
- fprintf(stderr,"SM5\n");
- sleep(10);
xOLEProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_STREAM_NAME ),
val.getAny());
- fprintf(stderr,"SM6\n");
// mimic the treatment of graphics here.. it seems anchoring as character
// gives a better ( visually ) result
xOLEProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_ANCHOR_TYPE ), uno::makeAny( text::TextContentAnchorType_AS_CHARACTER ) );
- fprintf(stderr,"SM7\n");
appendTextContent( xOLE, uno::Sequence< beans::PropertyValue >() );
- fprintf(stderr,"SM8\n");
}
catch( const uno::Exception& rEx )
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
index 10a0331d6668..e2040e4a0132 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.cxx
@@ -2373,16 +2373,17 @@ Token_t OOXMLFastContextHandlerWrapper::getToken() const
OOXMLFastContextHandlerMath::OOXMLFastContextHandlerMath(OOXMLFastContextHandler* pContext)
: OOXMLFastContextHandlerProperties(pContext)
{
- fprintf( stderr, "MMM ctor\n" );
}
OOXMLFastContextHandlerMath::~OOXMLFastContextHandlerMath()
{
- fprintf( stderr, "MMM dtor\n" );
SvGlobalName name( SO3_SM_CLASSID );
comphelper::EmbeddedObjectContainer container;
rtl::OUString aName; // TODO?
uno::Reference< embed::XEmbeddedObject > ref = container.CreateEmbeddedObject( name.GetByteSequence(), aName );
+ uno::Reference< uno::XInterface > component( ref->getComponent(), uno::UNO_QUERY );
+ if( OoxmlFormulaImportBase* import = dynamic_cast< OoxmlFormulaImportBase* >( component.get()))
+ import->readFormulaOoxml( buffer );
if (isForwardEvents())
{
OOXMLPropertySet * pProps = new OOXMLPropertySetImpl();
@@ -2397,22 +2398,22 @@ void OOXMLFastContextHandlerMath::lcl_startFastElement(Token_t Element,
const uno::Reference< xml::sax::XFastAttributeList >& Attribs)
throw (uno::RuntimeException, xml::sax::SAXException)
{
- fprintf( stderr, "MMM start %d\n", Element );
+ buffer.appendOpeningTag( Element, Attribs );
+ fprintf(stderr,"OPEN %d\n", Element);
}
void OOXMLFastContextHandlerMath::lcl_endFastElement(Token_t Element)
throw (uno::RuntimeException, xml::sax::SAXException)
{
- fprintf( stderr, "MMM end %d\n", Element );
- OOXMLFastContextHandlerProperties::lcl_endFastElement( Element );
+ buffer.appendClosingTag( Element );
+ fprintf(stderr,"CLOSE %d\n", Element);
}
uno::Reference< xml::sax::XFastContextHandler >
-OOXMLFastContextHandlerMath::lcl_createFastChildContext(Token_t Element,
- const uno::Reference< xml::sax::XFastAttributeList >& Attribs)
+OOXMLFastContextHandlerMath::lcl_createFastChildContext(Token_t,
+ const uno::Reference< xml::sax::XFastAttributeList >&)
throw (uno::RuntimeException, xml::sax::SAXException)
{
- fprintf( stderr, "MMM child %d\n", Element );
uno::Reference< xml::sax::XFastContextHandler > xContextHandler;
xContextHandler.set( this );
return xContextHandler;
@@ -2421,7 +2422,7 @@ OOXMLFastContextHandlerMath::lcl_createFastChildContext(Token_t Element,
void OOXMLFastContextHandlerMath::lcl_characters(const ::rtl::OUString& aChars)
throw (uno::RuntimeException, xml::sax::SAXException)
{
- fprintf( stderr, "MMM chars %s\n", rtl::OUStringToOString( aChars, RTL_TEXTENCODING_UTF8 ).getStr());
+ buffer.appendCharacters( aChars );
}
diff --git a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
index 9f7c082c98ac..16eef9abfdd6 100644
--- a/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
+++ b/writerfilter/source/ooxml/OOXMLFastContextHandler.hxx
@@ -44,6 +44,8 @@
#include <ooxml/OOXMLFastTokens.hxx>
#include <svtools/embedhlp.hxx>
+#include <oox/export/starmathimport.hxx>
+
namespace writerfilter {
namespace ooxml
{
@@ -658,6 +660,9 @@ protected:
throw (uno::RuntimeException, xml::sax::SAXException);
virtual void lcl_characters(const ::rtl::OUString & aChars) throw (uno::RuntimeException, xml::sax::SAXException);
+
+private:
+ ooxmlformulaimport::XmlStreamBuilder buffer;
};