[Libreoffice-commits] .: Branch 'libreoffice-3-5' - 3 commits - writerfilter/source

Caolán McNamara caolan at kemper.freedesktop.org
Thu Apr 5 07:03:36 PDT 2012


 writerfilter/source/rtftok/rtfdocumentimpl.cxx |  182 +++++++++++++++++--------
 writerfilter/source/rtftok/rtfdocumentimpl.hxx |   33 +++-
 2 files changed, 149 insertions(+), 66 deletions(-)

New commits:
commit 830c2151d48e0821b183348c1778856f7d85d296
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Sat Mar 24 14:55:09 2012 +0100

    fdo#47036 fix RTF import of multi-paragraph exact height textboxes

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 16d5c75..2d82e28 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3493,6 +3493,7 @@ RTFFrame::RTFFrame(RTFParserState* pParserState)
     nHoriAnchor(0),
     nVertAlign(0),
     nVertAnchor(0),
+    nHRule(NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_auto),
     nAnchorType(0)
 {
 }
@@ -3580,7 +3581,12 @@ RTFSprms RTFFrame::getSprms()
                 break;
             case NS_sprm::LN_PWHeightAbs:
                 if ( nH != 0 )
-                    pValue.reset(new RTFValue(nH));
+                {
+                    if (nHRule == NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_exact)
+                        pValue.reset(new RTFValue(-nH)); // The negative value just sets nHRule
+                    else
+                        pValue.reset(new RTFValue(nH));
+                }
                 break;
             case NS_sprm::LN_PDxaWidth:
                 if ( nW != 0 )
@@ -3610,12 +3616,8 @@ RTFSprms RTFFrame::getSprms()
                 break;
             case NS_ooxml::LN_CT_FramePr_hRule:
                 {
-                    sal_Int32 nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_auto;
                     if ( nH < 0 )
-                    {
                         nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_exact;
-                        nH = -nH; // The negative value just sets nHRule
-                    }
                     else if ( nH > 0 )
                         nHRule = NS_ooxml::LN_Value_wordprocessingml_ST_HeightRule_atLeast;
                     pValue.reset(new RTFValue(nHRule));
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 3a148f5..9626063 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -214,6 +214,7 @@ namespace writerfilter {
                 sal_Int32 nX, nY, nW, nH;
                 sal_Int32 nHoriPadding, nVertPadding;
                 sal_Int32 nHoriAlign, nHoriAnchor, nVertAlign, nVertAnchor;
+                Id nHRule;
             public:
                 RTFFrame(RTFParserState* pParserState);
                 sal_Int16 nAnchorType;
commit 3e59fa4f3ba1408939e4f937cea29fa614f84b37
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Sat Mar 24 13:04:54 2012 +0100

    fdo#47036 fix RTF import of shapes inside text frames at the start of the doc

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index aca4519..16d5c75 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -3266,6 +3266,12 @@ int RTFDocumentImpl::popState()
         Mapper().startShape(xShape);
         Mapper().endShape();
     }
+    else if (m_aStates.top().nDestinationState == DESTINATION_SHAPE && m_aStates.top().aFrame.inFrame())
+    {
+        m_aStates.top().resetFrame();
+        parBreak();
+        m_bNeedPap = true;
+    }
 
     // See if we need to end a track change
     RTFValue::Pointer_t pTrackchange = m_aStates.top().aCharacterSprms.find(NS_ooxml::LN_trackchange);
@@ -3493,6 +3499,11 @@ RTFFrame::RTFFrame(RTFParserState* pParserState)
 
 void RTFFrame::setSprm(Id nId, Id nValue)
 {
+    if (m_pParserState->m_pDocumentImpl->getFirstRun())
+    {
+        m_pParserState->m_pDocumentImpl->checkFirstRun();
+        m_pParserState->m_pDocumentImpl->setNeedPar(false);
+    }
     switch (nId)
     {
         case NS_sprm::LN_PDxaWidth:
commit eff7424629df3fa30afb35c56d9605e77c69241e
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Sat Mar 24 10:07:40 2012 +0100

    rtftok: various refactoring
    
    To allow frame keywords at the start of the document, we need to:
    - a single setter method for all frame properties
    - make the parser state know about its document
    - make the frame know about its parser state

diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 9600414..aca4519 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -268,7 +268,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
     m_xFrame(xFrame),
     m_xStatusIndicator(xStatusIndicator),
     m_nGroup(0),
-    m_aDefaultState(),
+    m_aDefaultState(this),
     m_bSkipUnknown(false),
     m_aFontEncodings(),
     m_aFontIndexes(),
@@ -413,6 +413,16 @@ void RTFDocumentImpl::checkFirstRun()
     }
 }
 
+bool RTFDocumentImpl::getFirstRun()
+{
+    return m_bFirstRun;
+}
+
+void RTFDocumentImpl::setNeedPar(bool bNeedPar)
+{
+    m_bNeedPar = bNeedPar;
+}
+
 void RTFDocumentImpl::checkNeedPap()
 {
     if (m_bNeedPap)
@@ -806,12 +816,12 @@ int RTFDocumentImpl::resolveChars(char ch)
     return 0;
 }
 
-bool RTFDocumentImpl::inFrame()
+bool RTFFrame::inFrame()
 {
-    return m_aStates.top().aFrame.nW > 0
-        || m_aStates.top().aFrame.nH > 0
-        || m_aStates.top().aFrame.nX > 0
-        || m_aStates.top().aFrame.nY > 0;
+    return nW > 0
+        || nH > 0
+        || nX > 0
+        || nY > 0;
 }
 
 void RTFDocumentImpl::text(OUString& rString)
@@ -1099,7 +1109,7 @@ int RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
             m_aStates.top().nDestinationState = DESTINATION_LEVELNUMBERS;
             break;
         case RTF_SHPPICT:
-            m_aStates.top().aFrame = RTFFrame();
+            m_aStates.top().resetFrame();
             m_aStates.top().nDestinationState = DESTINATION_SHPPICT;
             break;
         case RTF_PICT:
@@ -1372,7 +1382,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
                 }
                 // but don't emit properties yet, since they may change till the first text token arrives
                 m_bNeedPap = true;
-                m_bWasInFrame = inFrame();
+                m_bWasInFrame = m_aStates.top().aFrame.inFrame();
                 if (!m_bWasInFrame)
                     m_bNeedPar = false;
             }
@@ -1738,7 +1748,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
         case RTF_PARD:
             m_aStates.top().aParagraphSprms = m_aDefaultState.aParagraphSprms;
             m_aStates.top().aParagraphAttributes = m_aDefaultState.aParagraphAttributes;
-            m_aStates.top().aFrame = RTFFrame();
+            m_aStates.top().resetFrame();
             m_pCurrentBuffer = 0;
             break;
         case RTF_SECTD:
@@ -1988,25 +1998,25 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
         case RTF_PNGBLIP:
             m_aStates.top().aPicture.nStyle = BMPSTYLE_PNG;
             break;
-        case RTF_POSYT: m_aStates.top().aFrame.nVertAlign = NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_top; break;
-        case RTF_POSYB: m_aStates.top().aFrame.nVertAlign = NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_bottom; break;
-        case RTF_POSYC: m_aStates.top().aFrame.nVertAlign = NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_center; break;
-        case RTF_POSYIN: m_aStates.top().aFrame.nVertAlign = NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_inside; break;
-        case RTF_POSYOUT: m_aStates.top().aFrame.nVertAlign = NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_outside; break;
-        case RTF_POSYIL: m_aStates.top().aFrame.nVertAlign = NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_inline; break;
-
-        case RTF_PHMRG: m_aStates.top().aFrame.nHoriAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_margin; break;
-        case RTF_PVMRG: m_aStates.top().aFrame.nVertAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_margin; break;
-        case RTF_PHPG: m_aStates.top().aFrame.nHoriAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_page; break;
-        case RTF_PVPG: m_aStates.top().aFrame.nVertAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_page; break;
-        case RTF_PHCOL: m_aStates.top().aFrame.nHoriAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_text; break;
-        case RTF_PVPARA: m_aStates.top().aFrame.nVertAnchor = NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_text; break;
-
-        case RTF_POSXC: m_aStates.top().aFrame.nHoriAlign = NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_center; break;
-        case RTF_POSXI: m_aStates.top().aFrame.nHoriAlign = NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_inside; break;
-        case RTF_POSXO: m_aStates.top().aFrame.nHoriAlign = NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_outside; break;
-        case RTF_POSXL: m_aStates.top().aFrame.nHoriAlign = NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_left; break;
-        case RTF_POSXR: m_aStates.top().aFrame.nHoriAlign = NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_right; break;
+        case RTF_POSYT: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_top); break;
+        case RTF_POSYB: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_bottom); break;
+        case RTF_POSYC: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_center); break;
+        case RTF_POSYIN: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_inside); break;
+        case RTF_POSYOUT: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_outside); break;
+        case RTF_POSYIL: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, NS_ooxml::LN_Value_wordprocessingml_ST_YAlign_inline); break;
+
+        case RTF_PHMRG: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor, NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_margin); break;
+        case RTF_PVMRG: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor, NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_margin); break;
+        case RTF_PHPG: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor, NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_page); break;
+        case RTF_PVPG: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor, NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_page); break;
+        case RTF_PHCOL: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor, NS_ooxml::LN_Value_wordprocessingml_ST_HAnchor_text); break;
+        case RTF_PVPARA: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor, NS_ooxml::LN_Value_wordprocessingml_ST_VAnchor_text); break;
+
+        case RTF_POSXC: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_center); break;
+        case RTF_POSXI: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_inside); break;
+        case RTF_POSXO: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_outside); break;
+        case RTF_POSXL: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_left); break;
+        case RTF_POSXR: m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, NS_ooxml::LN_Value_wordprocessingml_ST_XAlign_right); break;
 
         case RTF_DPLINE:
                 {
@@ -2132,21 +2142,21 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
         return 0;
 
     // Frame size / position.
-    sal_Int32 *pSprm = 0;
+    Id nId = 0;
     switch (nKeyword)
     {
-        case RTF_ABSW: pSprm = &m_aStates.top().aFrame.nW; break;
-        case RTF_ABSH: pSprm = &m_aStates.top().aFrame.nH; break;
-        case RTF_POSX: pSprm = &m_aStates.top().aFrame.nX; m_aStates.top().aFrame.nHoriAlign = 0; break;
-        case RTF_POSY: pSprm = &m_aStates.top().aFrame.nY; m_aStates.top().aFrame.nVertAlign = 0; break;
+        case RTF_ABSW: nId = NS_sprm::LN_PDxaWidth; break;
+        case RTF_ABSH: nId = NS_sprm::LN_PWHeightAbs; break;
+        case RTF_POSX: nId = NS_ooxml::LN_CT_FramePr_x; m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, 0); break;
+        case RTF_POSY: nId = NS_ooxml::LN_CT_FramePr_y; m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, 0); break;
         default: break;
     }
-    if (pSprm)
+    if (nId > 0)
     {
         m_bNeedPap = true;
         // Don't try to support text frames inside tables for now.
         if (m_pCurrentBuffer != &m_aTableBuffer)
-            *pSprm = nParam;
+            m_aStates.top().aFrame.setSprm(nId, nParam);
         return 0;
     }
 
@@ -2638,26 +2648,27 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
             lcl_putNestedSprm(m_aDefaultState.aParagraphSprms, NS_ooxml::LN_EG_SectPrContents_endnotePr, NS_ooxml::LN_EG_FtnEdnNumProps_numStart, pIntValue);
             break;
         case RTF_DFRMTXTX:
-            m_aStates.top().aFrame.nHoriPadding = nParam;
+            m_aStates.top().aFrame.setSprm(NS_sprm::LN_PDxaFromText, nParam);
             break;
         case RTF_DFRMTXTY:
-            m_aStates.top().aFrame.nVertPadding = nParam;
+            m_aStates.top().aFrame.setSprm(NS_sprm::LN_PDyaFromText, nParam);
             break;
         case RTF_DXFRTEXT:
-            m_aStates.top().aFrame.nVertPadding = m_aStates.top().aFrame.nHoriPadding = nParam;
+            m_aStates.top().aFrame.setSprm(NS_sprm::LN_PDxaFromText, nParam);
+            m_aStates.top().aFrame.setSprm(NS_sprm::LN_PDyaFromText, nParam);
             break;
         case RTF_FLYVERT:
             {
                 RTFVertOrient aVertOrient(nParam);
-                m_aStates.top().aFrame.nVertAlign = aVertOrient.GetAlign();
-                m_aStates.top().aFrame.nVertAnchor = aVertOrient.GetAnchor();
+                m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, aVertOrient.GetAlign());
+                m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_vAnchor, aVertOrient.GetAnchor());
             }
             break;
         case RTF_FLYHORZ:
             {
                 RTFHoriOrient aHoriOrient(nParam);
-                m_aStates.top().aFrame.nHoriAlign = aHoriOrient.GetAlign();
-                m_aStates.top().aFrame.nHoriAnchor = aHoriOrient.GetAnchor();
+                m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_xAlign, aHoriOrient.GetAlign());
+                m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_hAnchor, aHoriOrient.GetAnchor());
             }
             break;
         case RTF_FLYANCHOR:
@@ -2800,7 +2811,7 @@ int RTFDocumentImpl::pushState()
 
     checkUnicode();
     m_nGroupStartPos = Strm().Tell();
-    RTFParserState aState;
+    RTFParserState aState(this);
     if (m_aStates.empty())
         aState = m_aDefaultState;
     else
@@ -2891,7 +2902,6 @@ int RTFDocumentImpl::popState()
     bool bPopShapeProperties = false;
     bool bPopPictureProperties = false;
     bool bFaltEnd = false;
-    RTFFrame aFrame;
     bool bPopFrame = false;
     RTFParserState aState(m_aStates.top());
 
@@ -3239,10 +3249,7 @@ int RTFDocumentImpl::popState()
     }
     else if (m_aStates.top().nDestinationState == DESTINATION_FLYMAINCONTENT
             || m_aStates.top().nDestinationState == DESTINATION_SHPPICT)
-    {
-        aFrame = m_aStates.top().aFrame;
         bPopFrame = true;
-    }
     else if (m_aStates.top().nDestinationState == DESTINATION_DRAWINGOBJECT && m_aStates.top().aDrawingObject.xShape.is())
     {
         RTFDrawingObject& rDrawing = m_aStates.top().aDrawingObject;
@@ -3315,7 +3322,7 @@ int RTFDocumentImpl::popState()
     else if (bFaltEnd)
         m_aStates.top().aTableSprms = aSprms;
     else if (bPopFrame)
-        m_aStates.top().aFrame = aFrame;
+        m_aStates.top().aFrame = aState.aFrame;
     if (bPopPictureProperties)
     {
         m_aStates.top().aPicture = aPicture;
@@ -3398,8 +3405,9 @@ void RTFDocumentImpl::checkUnicode(bool bUnicode, bool bHex)
     }
 }
 
-RTFParserState::RTFParserState()
-    : nInternalState(INTERNAL_NORMAL),
+RTFParserState::RTFParserState(RTFDocumentImpl *pDocumentImpl)
+    : m_pDocumentImpl(pDocumentImpl),
+    nInternalState(INTERNAL_NORMAL),
     nDestinationState(DESTINATION_NORMAL),
     nBorderState(BORDER_NONE),
     aTableSprms(),
@@ -3427,7 +3435,7 @@ RTFParserState::RTFParserState()
     aPicture(),
     aShape(),
     aDrawingObject(),
-    aFrame(),
+    aFrame(this),
     nCellX(0),
     nCells(0),
     bIsCjk(false),
@@ -3439,6 +3447,11 @@ RTFParserState::RTFParserState()
 {
 }
 
+void RTFParserState::resetFrame()
+{
+    aFrame = RTFFrame(this);
+}
+
 RTFColorTableEntry::RTFColorTableEntry()
     : nRed(0),
     nGreen(0),
@@ -3462,8 +3475,9 @@ RTFPicture::RTFPicture()
 {
 }
 
-RTFFrame::RTFFrame()
-    : nX(0),
+RTFFrame::RTFFrame(RTFParserState* pParserState)
+    : m_pParserState(pParserState),
+    nX(0),
     nY(0),
     nW(0),
     nH(0),
@@ -3477,6 +3491,45 @@ RTFFrame::RTFFrame()
 {
 }
 
+void RTFFrame::setSprm(Id nId, Id nValue)
+{
+    switch (nId)
+    {
+        case NS_sprm::LN_PDxaWidth:
+            nW = nValue;
+            break;
+        case NS_sprm::LN_PWHeightAbs:
+            nH = nValue;
+            break;
+        case NS_ooxml::LN_CT_FramePr_x:
+            nX = nValue;
+            break;
+        case NS_ooxml::LN_CT_FramePr_y:
+            nY = nValue;
+            break;
+        case NS_sprm::LN_PDxaFromText:
+            nHoriPadding = nValue;
+            break;
+        case NS_sprm::LN_PDyaFromText:
+            nVertPadding = nValue;
+            break;
+        case NS_ooxml::LN_CT_FramePr_xAlign:
+            nHoriAlign = nValue;
+            break;
+        case NS_ooxml::LN_CT_FramePr_hAnchor:
+            nHoriAnchor = nValue;
+            break;
+        case NS_ooxml::LN_CT_FramePr_yAlign:
+            nVertAlign = nValue;
+            break;
+        case NS_ooxml::LN_CT_FramePr_vAnchor:
+            nVertAnchor = nValue;
+            break;
+        default:
+            break;
+    }
+}
+
 RTFSprms RTFFrame::getSprms()
 {
     RTFSprms sprms;
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 4a28e62..3a148f5 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -204,26 +204,40 @@ namespace writerfilter {
                 RTFBmpStyles nStyle;
         };
 
+        class RTFParserState;
+
         /// Stores the properties of a frame
         class RTFFrame
         {
-            public:
-                RTFFrame();
+            private:
+                RTFParserState* m_pParserState;
                 sal_Int32 nX, nY, nW, nH;
                 sal_Int32 nHoriPadding, nVertPadding;
                 sal_Int32 nHoriAlign, nHoriAnchor, nVertAlign, nVertAnchor;
+            public:
+                RTFFrame(RTFParserState* pParserState);
                 sal_Int16 nAnchorType;
 
                 /// Convert the stored properties to Sprms
                 RTFSprms getSprms();
+                /// Store a property
+                void setSprm(Id nId, Id nValue);
                 bool hasProperties();
+                /// If we got tokens indicating we're in a frame.
+                bool inFrame();
         };
 
+        class RTFDocumentImpl;
+
         /// State of the parser, which gets saved / restored when changing groups.
         class RTFParserState
         {
             public:
-                RTFParserState();
+                RTFParserState(RTFDocumentImpl* pDocumentImpl);
+                /// Resets aFrame.
+                void resetFrame();
+
+                RTFDocumentImpl* m_pDocumentImpl;
                 RTFInternalState nInternalState;
                 RTFDesitnationState nDestinationState;
                 RTFBorderState nBorderState;
@@ -343,6 +357,13 @@ namespace writerfilter {
                 int dispatchToggle(RTFKeyword nKeyword, bool bParam, int nParam);
                 int dispatchValue(RTFKeyword nKeyword, int nParam);
 
+                /// If this is the first run of the document, starts the initial paragraph.
+                void checkFirstRun();
+                /// If the initial paragraph is started.
+                bool getFirstRun();
+                /// If we need to add a dummy paragraph before a section break.
+                void setNeedPar(bool bNeedPar);
+
             private:
                 SvStream& Strm();
                 sal_uInt32 getColorTable(sal_uInt32 nIndex);
@@ -357,13 +378,9 @@ namespace writerfilter {
                 void text(rtl::OUString& rString);
                 void parBreak();
                 void tableBreak();
-                /// If this is the first run of the document, starts the initial paragraph.
-                void checkFirstRun();
                 void checkNeedPap();
                 void sectBreak(bool bFinal);
                 void replayBuffer(RTFBuffer_t& rBuffer);
-                /// If we got tokens indicating we're in a frame.
-                bool inFrame();
                 /// If we have some unicode or hex characters to send.
                 void checkUnicode(bool bUnicode = true, bool bHex = true);
 
@@ -395,7 +412,6 @@ namespace writerfilter {
                 bool m_bNeedPap;
                 /// If we need to emit a CR at the end of substream.
                 bool m_bNeedCr;
-                /// If we need to add a dummy paragraph before a section break.
                 bool m_bNeedPar;
                 /// The list table and list override table combined.
                 RTFSprms m_aListTableSprms;


More information about the Libreoffice-commits mailing list