[Libreoffice-commits] .: 7 commits - oox/inc oox/source starmath/inc starmath/sdi starmath/source sw/inc sw/source writerfilter/source

Lubos Lunak llunak at kemper.freedesktop.org
Tue Nov 29 04:27:56 PST 2011


 oox/inc/oox/mathml/import.hxx                     |   14 ++---
 oox/inc/oox/mathml/importutils.hxx                |   21 +++++++
 oox/source/mathml/import.cxx                      |    4 -
 starmath/inc/unomodel.hxx                         |    1 
 starmath/source/ooxmlimport.cxx                   |   16 +++---
 starmath/source/unomodel.cxx                      |    5 +
 sw/inc/docsh.hxx                                  |    2 
 sw/inc/unoprnms.hxx                               |    8 +--
 sw/inc/unotxdoc.hxx                               |    5 -
 sw/source/core/unocore/unoframe.cxx               |   15 ++++-
 sw/source/core/unocore/unoprnms.cxx               |    6 +-
 sw/source/ui/app/docsh2.cxx                       |   12 ----
 sw/source/ui/uno/unotxdoc.cxx                     |    5 -
 writerfilter/source/dmapper/DomainMapper_Impl.cxx |   58 ++++++++++++----------
 14 files changed, 94 insertions(+), 78 deletions(-)

New commits:
commit eca8fc7069d5e79d641151494e5d1c782066f1e2
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri Nov 25 18:55:53 2011 +0100

    EMBEDDED_OBJECT UNO property now works, remove hack

diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index c86c2a2..2091ac6 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2287,7 +2287,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
                         pDoc->SetFlyName((SwFlyFrmFmt&)*pFmt2, sName);
                 }
             }
-            else if( pStreamName && false )
+            else if( pStreamName )
             {
                 ::rtl::OUString sStreamName;
                 (*pStreamName) >>= sStreamName;
@@ -2303,8 +2303,7 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
             else if( pEmbeddedObject || pStreamName )
             {
                 uno::Reference< embed::XEmbeddedObject > obj;
-//                (*pEmbeddedObject) >>= obj;
-                (*pStreamName) >>= obj;
+                (*pEmbeddedObject) >>= obj;
                 svt::EmbeddedObjectRef xObj;
                 xObj.Assign( obj, embed::Aspects::MSOLE_CONTENT );
 
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 4174964..1ce2b53 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1101,7 +1101,7 @@ void DomainMapper_Impl::appendStarMath( const Value& val )
             uno::Reference< text::XTextContent > xStarMath( m_xTextFactory->createInstance(sEmbeddedService), uno::UNO_QUERY_THROW );
             uno::Reference< beans::XPropertySet > xStarMathProperties(xStarMath, uno::UNO_QUERY_THROW);
 
-            xStarMathProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_STREAM_NAME ),
+            xStarMathProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_EMBEDDED_OBJECT ),
                 val.getAny());
 
             uno::Reference< uno::XInterface > xInterface( formula->getComponent(), uno::UNO_QUERY );
commit 1c58ec8e3d1f9fe282d66a5be6671cd674766ff6
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri Nov 25 18:52:24 2011 +0100

    fix unoprms content mismatch (gee, it even had a FIXME comment)

diff --git a/sw/inc/unoprnms.hxx b/sw/inc/unoprnms.hxx
index 3a92a6f..8df75ee 100644
--- a/sw/inc/unoprnms.hxx
+++ b/sw/inc/unoprnms.hxx
@@ -799,16 +799,16 @@ enum SwPropNameIds
 /* 0736 */  UNO_NAME_OUTLINE_LEVEL,
 
 /* 0737 */  UNO_NAME_DESCRIPTION,
-/* 0740 */  UNO_NAME_EMBEDDED_OBJECT,
-
-// FIXME: these number comments cannot be right post merge - fix them up ...
 /* 0738 */  UNO_NAME_META,
 /* 0739 */  UNO_NAME_IS_TEMPLATE,
 /* 0740 */  UNO_NAME_VBA_DOCOBJ,
 /* 0741 */  UNO_NAME_NESTED_TEXT_CONTENT,
 /* 0742 */  UNO_NAME_SEPARATOR_LINE_STYLE,
 /* 0743 */  UNO_NAME_FOOTNOTE_LINE_STYLE,
-/* 0744 */  SW_PROPNAME_END
+/* 0744 */  UNO_NAME_EMBEDDED_OBJECT,
+/* 0745 */  SW_PROPNAME_END
+
+// new items in this array must match SwPropNameTab aPropNameTab
 };
 
 struct SwPropNameLen
diff --git a/sw/source/core/unocore/unoprnms.cxx b/sw/source/core/unocore/unoprnms.cxx
index e67f8c3..28e9d48 100644
--- a/sw/source/core/unocore/unoprnms.cxx
+++ b/sw/source/core/unocore/unoprnms.cxx
@@ -775,14 +775,14 @@ const SwPropNameTab aPropNameTab = {
 /* 0736 UNO_NAME_OUTLINE_LEVEL */       {MAP_CHAR_LEN("OutlineLevel")},//#outline level,add<-zhaojianwei Outlinelevel
 /* 0737 UNO_NAME_DESCRIPTION */         {MAP_CHAR_LEN("Description")},
 /* 0738 UNO_NAME_META */        {MAP_CHAR_LEN("InContentMetadata")},
-// FIXME: these numbers are not correct post merge ...
 /* 0739 UNO_NAME_IS_TEMPLATE */       {MAP_CHAR_LEN("IsTemplate")},
-/* 0740 UNO_NAME_EMBEDDED_OBJECT */ {MAP_CHAR_LEN("EmbeddedObject")},
 /* 0740 UNO_NAME_VBA_DOCOBJ */       {MAP_CHAR_LEN("ThisVBADocObj")},
-
 /* 0741 UNO_NAME_NESTED_TEXT_CONTENT */ {MAP_CHAR_LEN("NestedTextContent")},
 /* 0742 UNO_NAME_SEPARATOR_LINE_STYLE */ {MAP_CHAR_LEN("SeparatorLineStyle")},
 /* 0743 UNO_NAME_FOOTNOTE_LINE_STYLE */ {MAP_CHAR_LEN("FootnoteLineStyle")},
+/* 0744 UNO_NAME_EMBEDDED_OBJECT */ {MAP_CHAR_LEN("EmbeddedObject")},
+
+// new items in this array must match enum SwPropNameIds
 };
 
 const SwPropNameLen& SwGetPropName( sal_uInt16 nId )
commit a4f73a0ba4e8cd42c0f895d7418bbccff951af3c
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri Nov 25 17:12:54 2011 +0100

    remove executable bit from source files

diff --git a/starmath/inc/starmath.hrc b/starmath/inc/starmath.hrc
old mode 100755
new mode 100644
diff --git a/starmath/sdi/smath.sdi b/starmath/sdi/smath.sdi
old mode 100755
new mode 100644
diff --git a/starmath/sdi/smslots.sdi b/starmath/sdi/smslots.sdi
old mode 100755
new mode 100644
diff --git a/starmath/source/dialog.hrc b/starmath/source/dialog.hrc
old mode 100755
new mode 100644
diff --git a/starmath/source/toolbox.hrc b/starmath/source/toolbox.hrc
old mode 100755
new mode 100644
commit 34a98b79da15793bb9c1454239ae9162c4db94c0
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri Nov 25 17:08:17 2011 +0100

    set properly initial size of starmath component when importing docx

diff --git a/oox/inc/oox/mathml/import.hxx b/oox/inc/oox/mathml/import.hxx
index 7154264..8c922ab 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 5243d41..cf01ec4 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 4bbbf9d..70627ac 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 5892864..4174964 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 ),
commit 93be239c9512c27369e1134150610248e93d6157
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri Nov 25 15:15:47 2011 +0100

    the bit hackish addFormula() shortcut is no longer necessary

diff --git a/oox/inc/oox/mathml/import.hxx b/oox/inc/oox/mathml/import.hxx
index 961a4f6..7154264 100644
--- a/oox/inc/oox/mathml/import.hxx
+++ b/oox/inc/oox/mathml/import.hxx
@@ -40,13 +40,6 @@ namespace formulaimport
 class XmlStream;
 }
 
-class OOX_DLLPUBLIC FormulaImportHelper
-{
-public:
-    FormulaImportHelper();
-    virtual void addFormula( com::sun::star::uno::Reference< com::sun::star::embed::XEmbeddedObject > ) = 0;
-};
-
 class OOX_DLLPUBLIC FormulaImportBase
 {
 public:
diff --git a/oox/source/mathml/import.cxx b/oox/source/mathml/import.cxx
index 4553006..bb13db3 100644
--- a/oox/source/mathml/import.cxx
+++ b/oox/source/mathml/import.cxx
@@ -35,10 +35,6 @@ FormulaImportBase::FormulaImportBase()
 {
 }
 
-FormulaImportHelper::FormulaImportHelper()
-{
-}
-
 } // namespace
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/docsh.hxx b/sw/inc/docsh.hxx
index e62699a..96a1eaa 100644
--- a/sw/inc/docsh.hxx
+++ b/sw/inc/docsh.hxx
@@ -143,8 +143,6 @@ protected:
 public:
     using SotObject::GetInterface;
 
-    void addFormula( com::sun::star::uno::Reference< com::sun::star::embed::XEmbeddedObject > p);
-
     // but we implement this ourselves.
     SFX_DECL_INTERFACE(SW_DOCSHELL)
     SFX_DECL_OBJECTFACTORY()
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index ca21090..5d61a9a 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -181,8 +181,7 @@ SwXTextDocumentBaseClass;
 
 class SW_DLLPUBLIC SwXTextDocument : public SwXTextDocumentBaseClass,
     public SvxFmMSFactory,
-    public SfxBaseModel,
-    public oox::FormulaImportHelper
+    public SfxBaseModel
 {
     ActionContextArr        aActionArr;
     SwRefreshListenerContainer  aRefreshCont;
@@ -254,8 +253,6 @@ public:
     virtual void SAL_CALL acquire(  ) throw();
     virtual void SAL_CALL release(  ) throw();
 
-    virtual void addFormula( com::sun::star::uno::Reference< com::sun::star::embed::XEmbeddedObject > p );
-
     //XWeak
     virtual css::uno::Reference< css::uno::XAdapter > SAL_CALL queryAdapter(  ) throw(css::uno::RuntimeException);
 
diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx
index 7de6a36..c86c2a2 100644
--- a/sw/source/core/unocore/unoframe.cxx
+++ b/sw/source/core/unocore/unoframe.cxx
@@ -2310,6 +2310,16 @@ void SwXFrame::attachToRange(const uno::Reference< text::XTextRange > & xTextRan
 
                 pDoc->GetIDocumentUndoRedo().StartUndo(UNDO_INSERT, NULL);
 
+                // Not sure if these setParent() and InsertEmbeddedObject() calls are really
+                // needed, it seems to work without, but logic from code elsewhere suggests
+                // they should be done.
+                SfxObjectShell& mrPers = *pDoc->GetPersist();
+                uno::Reference < container::XChild > xChild( obj, uno::UNO_QUERY );
+                if ( xChild.is() )
+                    xChild->setParent( mrPers.GetModel() );
+                ::rtl::OUString rName;
+                mrPers.GetEmbeddedObjectContainer().InsertEmbeddedObject( obj, rName );
+
                 SwFlyFrmFmt* pFrmFmt = 0;
                 pFrmFmt = pDoc->Insert( aPam, xObj, &aFrmSet, NULL, NULL );
                 pDoc->GetIDocumentUndoRedo().EndUndo(UNDO_INSERT, NULL);
diff --git a/sw/source/ui/app/docsh2.cxx b/sw/source/ui/app/docsh2.cxx
index 47a064f..4903ff8 100644
--- a/sw/source/ui/app/docsh2.cxx
+++ b/sw/source/ui/app/docsh2.cxx
@@ -155,18 +155,6 @@ SfxDocumentInfoDialog* SwDocShell::CreateDocumentInfoDialog(
     return pDlg;
 }
 
-void SwDocShell::addFormula( uno::Reference< embed::XEmbeddedObject > p )
-{
-    SfxObjectShell& mrPers = *GetDoc()->GetPersist();
-    uno::Reference < container::XChild > xChild( p, uno::UNO_QUERY );
-    if ( xChild.is() )
-        xChild->setParent( mrPers.GetModel() );
-    ::rtl::OUString rName;
-    bool bSuccess = mrPers.GetEmbeddedObjectContainer().InsertEmbeddedObject( p, rName );
-    if (bSuccess)
-        {}
-}
-
 // Disable "multiple layout"
 
 void    SwDocShell::ToggleBrowserMode(sal_Bool bSet, SwView* _pView )
diff --git a/sw/source/ui/uno/unotxdoc.cxx b/sw/source/ui/uno/unotxdoc.cxx
index 8d63654..6ac9808 100644
--- a/sw/source/ui/uno/unotxdoc.cxx
+++ b/sw/source/ui/uno/unotxdoc.cxx
@@ -407,11 +407,6 @@ SwXTextDocument::~SwXTextDocument()
     delete m_pRenderData;
 }
 
-void SwXTextDocument::addFormula( uno::Reference< embed::XEmbeddedObject > p )
-{
-    pDocShell->addFormula(p);
-}
-
 SwXDocumentPropertyHelper * SwXTextDocument::GetPropertyHelper ()
 {
     if(!xPropertyHelper.is())
diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 4833bba..5892864 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -26,8 +26,6 @@
  *
  ************************************************************************/
 
-#include <oox/mathml/import.hxx>
-
 #include <DomainMapper_Impl.hxx>
 #include <ConversionHelper.hxx>
 #include <DomainMapperTableHandler.hxx>
@@ -1096,8 +1094,6 @@ void DomainMapper_Impl::appendStarMath( const Value& val )
     val.getAny() >>= formula;
     if( formula.is() )
     {
-        if( oox::FormulaImportHelper* import = dynamic_cast< oox::FormulaImportHelper* >( GetTextDocument().get()))
-            import->addFormula( formula );
         static const rtl::OUString sEmbeddedService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextEmbeddedObject"));
         try
         {
commit 86eccc72c502ed08938b4b2d2f4e0fdda17f82cb
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri Nov 25 13:43:52 2011 +0100

    clean up and format code

diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
index 389b2b3..4833bba 100644
--- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx
+++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx
@@ -1092,32 +1092,32 @@ void DomainMapper_Impl::appendOLE( const ::rtl::OUString& rStreamName, OLEHandle
 
 void DomainMapper_Impl::appendStarMath( const Value& val )
 {
-            uno::Reference< embed::XEmbeddedObject > formula;
-            val.getAny() >>= formula;
-            if( formula.is() )
-            {
-                if( oox::FormulaImportHelper* import = dynamic_cast< oox::FormulaImportHelper* >( GetTextDocument().get()))
-                    import->addFormula( formula );
-    static const rtl::OUString sEmbeddedService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextEmbeddedObject"));
-    try
+    uno::Reference< embed::XEmbeddedObject > formula;
+    val.getAny() >>= formula;
+    if( formula.is() )
     {
-        uno::Reference< text::XTextContent > xOLE( m_xTextFactory->createInstance(sEmbeddedService), uno::UNO_QUERY_THROW );
-        uno::Reference< beans::XPropertySet > xOLEProperties(xOLE, uno::UNO_QUERY_THROW);
-
-        xOLEProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_STREAM_NAME ),
-                        val.getAny());
-        // 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 ) );
-        appendTextContent( xOLE, uno::Sequence< beans::PropertyValue >() );
+        if( oox::FormulaImportHelper* import = dynamic_cast< oox::FormulaImportHelper* >( GetTextDocument().get()))
+            import->addFormula( formula );
+        static const rtl::OUString sEmbeddedService(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.text.TextEmbeddedObject"));
+        try
+        {
+            uno::Reference< text::XTextContent > xStarMath( m_xTextFactory->createInstance(sEmbeddedService), uno::UNO_QUERY_THROW );
+            uno::Reference< beans::XPropertySet > xStarMathProperties(xStarMath, uno::UNO_QUERY_THROW);
 
+            xStarMathProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_STREAM_NAME ),
+                val.getAny());
+            // mimic the treatment of graphics here.. it seems anchoring as character
+            // gives a better ( visually ) result
+            xStarMathProperties->setPropertyValue(PropertyNameSupplier::GetPropertyNameSupplier().GetName( PROP_ANCHOR_TYPE ),
+                uno::makeAny( text::TextContentAnchorType_AS_CHARACTER ) );
+            appendTextContent( xStarMath, uno::Sequence< beans::PropertyValue >() );
+        }
+        catch( const uno::Exception& rEx )
+        {
+            (void)rEx;
+            OSL_FAIL( "Exception in creation of StarMath object" );
+        }
     }
-    catch( const uno::Exception& rEx )
-    {
-        (void)rEx;
-        OSL_FAIL( "Exception in creation of OLE object" );
-    }
-            }
 }
 
 uno::Reference< beans::XPropertySet > DomainMapper_Impl::appendTextSectionAfter(
commit f034c452c5aad4f8a38045530486a6afd27aa215
Author: Luboš Luňák <l.lunak at suse.cz>
Date:   Fri Nov 25 13:16:04 2011 +0100

    simplify attribute retrieval syntax a bit

diff --git a/oox/inc/oox/mathml/importutils.hxx b/oox/inc/oox/mathml/importutils.hxx
index 3a59320..ca212aa 100644
--- a/oox/inc/oox/mathml/importutils.hxx
+++ b/oox/inc/oox/mathml/importutils.hxx
@@ -91,6 +91,15 @@ public:
         AttributeList attributes;
         rtl::OUString text;
         /**
+         This function returns value of the given attribute, or the passed default value if not found.
+         The type of the default value selects the return type (OUString here).
+        */
+        rtl::OUString attribute( int token, const rtl::OUString& def = rtl::OUString()) const;
+        /**
+         @overload
+        */
+        bool attribute( int token, bool def ) const;
+        /**
          Converts to true if the tag has a valid token, false otherwise. Allows simple
          usage in if(), for example 'if( XmlStream::Tag foo = stream.checkOpeningTag( footoken ))'.
         */
@@ -169,6 +178,18 @@ public:
     void appendCharacters( const rtl::OUString& characters );
 };
 
+inline
+rtl::OUString XmlStream::Tag::attribute( int t, const rtl::OUString& def ) const
+{
+    return attributes.attribute( t, def );
+}
+
+inline
+bool XmlStream::Tag::attribute( int t, bool def ) const
+{
+    return attributes.attribute( t, def );
+}
+
 } // namespace
 } // namespace
 
diff --git a/starmath/source/ooxmlimport.cxx b/starmath/source/ooxmlimport.cxx
index f309442..4b187ad 100644
--- a/starmath/source/ooxmlimport.cxx
+++ b/starmath/source/ooxmlimport.cxx
@@ -104,7 +104,7 @@ OUString SmOoxmlImport::handleAcc()
     {
         if( XmlStream::Tag chr = stream.checkOpeningTag( M_TOKEN( chr )))
         {
-            acc = chr.attributes.attribute( M_TOKEN( val ));
+            acc = chr.attribute( M_TOKEN( val ));
             stream.ensureClosingTag( M_TOKEN( chr ));
         }
         stream.ensureClosingTag( M_TOKEN( accPr ));
@@ -165,9 +165,9 @@ OUString SmOoxmlImport::handleBar()
     {
         if( XmlStream::Tag pos = stream.checkOpeningTag( M_TOKEN( pos )))
         {
-            if( pos.attributes.attribute( M_TOKEN( val )) == STR( "top" ))
+            if( pos.attribute( M_TOKEN( val )) == STR( "top" ))
                 topbot = top;
-            else if( pos.attributes.attribute( M_TOKEN( val )) == STR( "bot" ))
+            else if( pos.attribute( M_TOKEN( val )) == STR( "bot" ))
                 topbot = bot;
             stream.ensureClosingTag( M_TOKEN( pos ));
         }
@@ -189,7 +189,7 @@ OUString SmOoxmlImport::handleBorderBox()
     {
         if( XmlStream::Tag strikeH = stream.checkOpeningTag( M_TOKEN( strikeH )))
         {
-            if( strikeH.attributes.attribute( M_TOKEN( val ), false ))
+            if( strikeH.attribute( M_TOKEN( val ), false ))
                 isStrikeH = true;
             stream.ensureClosingTag( M_TOKEN( strikeH ));
         }
@@ -248,11 +248,11 @@ OUString SmOoxmlImport::handleF()
     {
         if( XmlStream::Tag type = stream.checkOpeningTag( M_TOKEN( type )))
         {
-            if( type.attributes.attribute( M_TOKEN( val )) == STR( "bar" ))
+            if( type.attribute( M_TOKEN( val )) == STR( "bar" ))
                 operation = bar;
-            else if( type.attributes.attribute( M_TOKEN( val )) == STR( "lin" ))
+            else if( type.attribute( M_TOKEN( val )) == STR( "lin" ))
                 operation = lin;
-            else if( type.attributes.attribute( M_TOKEN( val )) == STR( "noBar" ))
+            else if( type.attribute( M_TOKEN( val )) == STR( "noBar" ))
                 operation = noBar;
             stream.ensureClosingTag( M_TOKEN( type ));
         }
@@ -290,7 +290,7 @@ OUString SmOoxmlImport::handleR()
     XmlStream::Tag rtag = stream.ensureOpeningTag( M_TOKEN( t ));
     // TODO bail out if failure?
     OUString text = rtag.text;
-    if( rtag.attributes.attribute( OOX_TOKEN( xml, space )) != STR( "preserve" ))
+    if( rtag.attribute( OOX_TOKEN( xml, space )) != STR( "preserve" ))
         text = text.trim();
     stream.ensureClosingTag( M_TOKEN( t ));
     stream.ensureClosingTag( M_TOKEN( r ));


More information about the Libreoffice-commits mailing list