writerfilter: make RTFParserState members private, final part

Change-Id: I14e5bb0df50647801bf6c322132a76037185cada
Reviewed-on: https://gerrit.libreoffice.org/72564
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
diff --git a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
index 51e0734..69879fc 100644
--- a/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchsymbol.cxx
@@ -170,7 +170,7 @@ RTFError RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
        }
        break;
        case RTF_HEXCHAR:
            m_aStates.top().nInternalState = RTFInternalState::HEX;
            m_aStates.top().setInternalState(RTFInternalState::HEX);
            break;
        case RTF_CELL:
        case RTF_NESTCELL:
diff --git a/writerfilter/source/rtftok/rtfdispatchvalue.cxx b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
index 57637ce..e12a57f 100644
--- a/writerfilter/source/rtftok/rtfdispatchvalue.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchvalue.cxx
@@ -1257,7 +1257,7 @@ RTFError RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
            break;
        case RTF_BIN:
        {
            m_aStates.top().nInternalState = RTFInternalState::BIN;
            m_aStates.top().setInternalState(RTFInternalState::BIN);
            m_aStates.top().setBinaryToRead(nParam);
        }
        break;
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 9a49087..c2c1397 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1168,7 +1168,7 @@ void RTFDocumentImpl::resolvePict(bool const bInline, uno::Reference<drawing::XS

RTFError RTFDocumentImpl::resolveChars(char ch)
{
    if (m_aStates.top().nInternalState == RTFInternalState::BIN)
    if (m_aStates.top().getInternalState() == RTFInternalState::BIN)
    {
        m_pBinaryData.reset(new SvMemoryStream());
        m_pBinaryData->WriteChar(ch);
@@ -1177,7 +1177,7 @@ RTFError RTFDocumentImpl::resolveChars(char ch)
            Strm().ReadChar(ch);
            m_pBinaryData->WriteChar(ch);
        }
        m_aStates.top().nInternalState = RTFInternalState::NORMAL;
        m_aStates.top().setInternalState(RTFInternalState::NORMAL);
        return RTFError::OK;
    }

@@ -1187,10 +1187,11 @@ RTFError RTFDocumentImpl::resolveChars(char ch)
    bool bSkipped = false;

    while (!Strm().eof()
           && (m_aStates.top().nInternalState == RTFInternalState::HEX
           && (m_aStates.top().getInternalState() == RTFInternalState::HEX
               || (ch != '{' && ch != '}' && ch != '\\')))
    {
        if (m_aStates.top().nInternalState == RTFInternalState::HEX || (ch != 0x0d && ch != 0x0a))
        if (m_aStates.top().getInternalState() == RTFInternalState::HEX
            || (ch != 0x0d && ch != 0x0a))
        {
            if (m_aStates.top().getCharsToSkip() == 0)
            {
@@ -1209,7 +1210,7 @@ RTFError RTFDocumentImpl::resolveChars(char ch)
        }

        // read a single char if we're in hex mode
        if (m_aStates.top().nInternalState == RTFInternalState::HEX)
        if (m_aStates.top().getInternalState() == RTFInternalState::HEX)
            break;

        if (RTL_TEXTENCODING_MS_932 == m_aStates.top().getCurrentEncoding())
@@ -1239,10 +1240,10 @@ RTFError RTFDocumentImpl::resolveChars(char ch)

        Strm().ReadChar(ch);
    }
    if (m_aStates.top().nInternalState != RTFInternalState::HEX && !Strm().eof())
    if (m_aStates.top().getInternalState() != RTFInternalState::HEX && !Strm().eof())
        Strm().SeekRel(-1);

    if (m_aStates.top().nInternalState == RTFInternalState::HEX
    if (m_aStates.top().getInternalState() == RTFInternalState::HEX
        && m_aStates.top().getDestination() != Destination::LEVELNUMBERS)
    {
        if (!bSkipped)
@@ -3508,11 +3509,11 @@ RTFError RTFDocumentImpl::handleEmbeddedObject()

bool RTFDocumentImpl::isInBackground() { return m_aStates.top().getInBackground(); }

RTFInternalState RTFDocumentImpl::getInternalState() { return m_aStates.top().nInternalState; }
RTFInternalState RTFDocumentImpl::getInternalState() { return m_aStates.top().getInternalState(); }

void RTFDocumentImpl::setInternalState(RTFInternalState nInternalState)
{
    m_aStates.top().nInternalState = nInternalState;
    m_aStates.top().setInternalState(nInternalState);
}

Destination RTFDocumentImpl::getDestination() { return m_aStates.top().getDestination(); }
@@ -3554,7 +3555,7 @@ void RTFDocumentImpl::checkUnicode(bool bUnicode, bool bHex)

RTFParserState::RTFParserState(RTFDocumentImpl* pDocumentImpl)
    : m_pDocumentImpl(pDocumentImpl)
    , nInternalState(RTFInternalState::NORMAL)
    , m_nInternalState(RTFInternalState::NORMAL)
    , m_eDestination(Destination::NORMAL)
    , m_eFieldStatus(RTFFieldStatus::NONE)
    , m_nBorderState(RTFBorderState::NONE)
@@ -3602,7 +3603,7 @@ RTFShape::RTFShape() = default;
RTFDrawingObject::RTFDrawingObject() = default;

RTFFrame::RTFFrame(RTFParserState* pParserState)
    : m_pDocumentImpl(pParserState->m_pDocumentImpl)
    : m_pDocumentImpl(pParserState->getDocumentImpl())
    , m_nX(0)
    , m_nY(0)
    , m_nW(0)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index bcbbbdf..24739f68 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -521,11 +521,13 @@ public:
    RTFFieldStatus getFieldStatus() const { return m_eFieldStatus; }
    void setDestination(Destination eDestination) { m_eDestination = eDestination; }
    Destination getDestination() const { return m_eDestination; }

    RTFDocumentImpl* m_pDocumentImpl;
    RTFInternalState nInternalState;
    void setInternalState(RTFInternalState nInternalState) { m_nInternalState = nInternalState; }
    RTFInternalState getInternalState() const { return m_nInternalState; }
    RTFDocumentImpl* getDocumentImpl() { return m_pDocumentImpl; }

private:
    RTFDocumentImpl* m_pDocumentImpl;
    RTFInternalState m_nInternalState;
    Destination m_eDestination;
    RTFFieldStatus m_eFieldStatus;
    RTFBorderState m_nBorderState;