[Libreoffice-commits] .: 2 commits - writerfilter/source

Miklos Vajna vmiklos at kemper.freedesktop.org
Mon Jul 23 09:12:18 PDT 2012


 writerfilter/source/rtftok/rtfdocumentimpl.cxx |   52 +++++++++++++++++++++++--
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |    8 +++
 2 files changed, 55 insertions(+), 5 deletions(-)

New commits:
commit c7d590293eae63bcd86bf48f58b3d563b8883511
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Mon Jul 23 18:09:32 2012 +0200

    implement import of RTF_{MD,MDPR,MBEGCHR,MENDCHR}
    
    Change-Id: Ie671977d523e1fb7142f62ca2d8d47e65082d3fd

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 8088406..36b3fa6 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -952,6 +952,8 @@ void RTFDocumentImpl::text(OUString& rString)
         case DESTINATION_ATNID:
         case DESTINATION_MR:
         case DESTINATION_MCHR:
+        case DESTINATION_MBEGCHR:
+        case DESTINATION_MENDCHR:
             m_aStates.top().aDestinationText.append(rString);
             break;
         case DESTINATION_EQINSTRUCTION:
@@ -1449,10 +1451,24 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
         case RTF_MCHR:
             m_aStates.top().nDestinationState = DESTINATION_MCHR;
             break;
+        case RTF_MBEGCHR:
+            m_aStates.top().nDestinationState = DESTINATION_MBEGCHR;
+            break;
+        case RTF_MENDCHR:
+            m_aStates.top().nDestinationState = DESTINATION_MENDCHR;
+            break;
         case RTF_ME:
             m_aMathBuffer.appendOpeningTag(M_TOKEN(e));
             m_aStates.top().nDestinationState = DESTINATION_ME;
             break;
+        case RTF_MD:
+            m_aMathBuffer.appendOpeningTag(M_TOKEN(d));
+            m_aStates.top().nDestinationState = DESTINATION_MD;
+            break;
+        case RTF_MDPR:
+            m_aMathBuffer.appendOpeningTag(M_TOKEN(dPr));
+            m_aStates.top().nDestinationState = DESTINATION_MDPR;
+            break;
         default:
             SAL_INFO("writerfilter", OSL_THIS_FUNC << ": TODO handle destination '" << lcl_RtfToString(nKeyword) << "'");
             // Make sure we skip destinations (even without \*) till we don't handle them
@@ -3550,12 +3566,22 @@ int RTFDocumentImpl::popState()
         m_aMathBuffer.appendClosingTag(M_TOKEN(acc));
     else if (m_aStates.top().nDestinationState == DESTINATION_MACCPR)
         m_aMathBuffer.appendClosingTag(M_TOKEN(accPr));
-    else if (m_aStates.top().nDestinationState == DESTINATION_MCHR)
+    else if (m_aStates.top().nDestinationState == DESTINATION_MCHR ||
+            m_aStates.top().nDestinationState == DESTINATION_MBEGCHR ||
+            m_aStates.top().nDestinationState == DESTINATION_MENDCHR)
     {
         oox::formulaimport::XmlStream::AttributeList aAttribs;
         aAttribs[M_TOKEN(val)] = m_aStates.top().aDestinationText.makeStringAndClear();
-        m_aMathBuffer.appendOpeningTag(M_TOKEN(chr), aAttribs);
-        m_aMathBuffer.appendClosingTag(M_TOKEN(chr));
+        sal_Int32 nToken = 0;
+        switch (m_aStates.top().nDestinationState)
+        {
+            case DESTINATION_MCHR: nToken = M_TOKEN(chr); break;
+            case DESTINATION_MBEGCHR: nToken = M_TOKEN(begChr); break;
+            case DESTINATION_MENDCHR: nToken = M_TOKEN(endChr); break;
+            default: break;
+        }
+        m_aMathBuffer.appendOpeningTag(nToken, aAttribs);
+        m_aMathBuffer.appendClosingTag(nToken);
     }
     else if (m_aStates.top().nDestinationState == DESTINATION_ME)
         m_aMathBuffer.appendClosingTag(M_TOKEN(e));
@@ -3563,6 +3589,10 @@ int RTFDocumentImpl::popState()
         m_aMathBuffer.appendClosingTag(M_TOKEN(bar));
     else if (m_aStates.top().nDestinationState == DESTINATION_MBARPR)
         m_aMathBuffer.appendClosingTag(M_TOKEN(barPr));
+    else if (m_aStates.top().nDestinationState == DESTINATION_MD)
+        m_aMathBuffer.appendClosingTag(M_TOKEN(d));
+    else if (m_aStates.top().nDestinationState == DESTINATION_MDPR)
+        m_aMathBuffer.appendClosingTag(M_TOKEN(dPr));
 
     // See if we need to end a track change
     RTFValue::Pointer_t pTrackchange = m_aStates.top().aCharacterSprms.find(NS_ooxml::LN_trackchange);
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 6b700c9..9a7ffff 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -132,7 +132,11 @@ namespace writerfilter {
             DESTINATION_MCHR,
             DESTINATION_ME,
             DESTINATION_MBAR,
-            DESTINATION_MBARPR
+            DESTINATION_MBARPR,
+            DESTINATION_MD,
+            DESTINATION_MDPR,
+            DESTINATION_MBEGCHR,
+            DESTINATION_MENDCHR
         };
 
         enum RTFBorderState
commit 43e4ae79f2c09e0fe596a7dc96eb9f2498439490
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Mon Jul 23 17:40:56 2012 +0200

    implement RTF_MBAR{,PR}
    
    Change-Id: Id5acca5c734f69797d5c19fdcfc0ccb4717127f6

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 3581f30..8088406 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1400,6 +1400,7 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
             m_aStates.top().nDestinationState = DESTINATION_ATNID;
             break;
         case RTF_MMATH:
+        case RTF_MOMATHPARA:
             // Nothing to do here (just enter the destination) till RTF_MMATHPR is implemented.
             break;
         case RTF_MOMATH:
@@ -1437,6 +1438,14 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
             m_aMathBuffer.appendOpeningTag(M_TOKEN(accPr));
             m_aStates.top().nDestinationState = DESTINATION_MACCPR;
             break;
+        case RTF_MBAR:
+            m_aMathBuffer.appendOpeningTag(M_TOKEN(bar));
+            m_aStates.top().nDestinationState = DESTINATION_MBAR;
+            break;
+        case RTF_MBARPR:
+            m_aMathBuffer.appendOpeningTag(M_TOKEN(barPr));
+            m_aStates.top().nDestinationState = DESTINATION_MBARPR;
+            break;
         case RTF_MCHR:
             m_aStates.top().nDestinationState = DESTINATION_MCHR;
             break;
@@ -3099,7 +3108,8 @@ int RTFDocumentImpl::pushState()
             (m_aStates.top().nDestinationState == DESTINATION_FIELDINSTRUCTION && !m_bEq) ||
             m_aStates.top().nDestinationState == DESTINATION_MOMATH ||
             m_aStates.top().nDestinationState == DESTINATION_MNUM ||
-            m_aStates.top().nDestinationState == DESTINATION_MDEN)
+            m_aStates.top().nDestinationState == DESTINATION_MDEN ||
+            m_aStates.top().nDestinationState == DESTINATION_ME)
         m_aStates.top().nDestinationState = DESTINATION_NORMAL;
     else if (m_aStates.top().nDestinationState == DESTINATION_FIELDINSTRUCTION && m_bEq)
         m_aStates.top().nDestinationState = DESTINATION_EQINSTRUCTION;
@@ -3549,6 +3559,10 @@ int RTFDocumentImpl::popState()
     }
     else if (m_aStates.top().nDestinationState == DESTINATION_ME)
         m_aMathBuffer.appendClosingTag(M_TOKEN(e));
+    else if (m_aStates.top().nDestinationState == DESTINATION_MBAR)
+        m_aMathBuffer.appendClosingTag(M_TOKEN(bar));
+    else if (m_aStates.top().nDestinationState == DESTINATION_MBARPR)
+        m_aMathBuffer.appendClosingTag(M_TOKEN(barPr));
 
     // See if we need to end a track change
     RTFValue::Pointer_t pTrackchange = m_aStates.top().aCharacterSprms.find(NS_ooxml::LN_trackchange);
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index dd98a28..6b700c9 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -130,7 +130,9 @@ namespace writerfilter {
             DESTINATION_MACC,
             DESTINATION_MACCPR,
             DESTINATION_MCHR,
-            DESTINATION_ME
+            DESTINATION_ME,
+            DESTINATION_MBAR,
+            DESTINATION_MBARPR
         };
 
         enum RTFBorderState


More information about the Libreoffice-commits mailing list