summaryrefslogtreecommitdiff
path: root/writerfilter/source/rtftok
diff options
context:
space:
mode:
authorJustin Luth <justin_luth@sil.org>2021-04-13 17:57:58 +0200
committerJustin Luth <justin_luth@sil.org>2021-04-14 12:23:25 +0200
commit4ed7a2c8af03bc0f45df1f03fd160ccbf045ed4f (patch)
treef42e057813ac74c94d9140400fa5e92ac090cf2c /writerfilter/source/rtftok
parent7526e77820956238a1a903d73ff15a49c082d6de (diff)
tdf#100961 rtf import: fldlock is FIXEDFLD
This depends on another fix in this bug report for exporting. I'm not sure why I even bother trying to work on RTF stuff. I'm not really into black magic. Change-Id: If596cae011a261a80ca13962932bf25561c0f63f Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114062 Tested-by: Jenkins Reviewed-by: Justin Luth <justin_luth@sil.org>
Diffstat (limited to 'writerfilter/source/rtftok')
-rw-r--r--writerfilter/source/rtftok/rtfdispatchdestination.cxx1
-rw-r--r--writerfilter/source/rtftok/rtfdispatchflag.cxx6
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx4
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx3
4 files changed, 14 insertions, 0 deletions
diff --git a/writerfilter/source/rtftok/rtfdispatchdestination.cxx b/writerfilter/source/rtftok/rtfdispatchdestination.cxx
index 2f7975073a37..11db48a0ec6d 100644
--- a/writerfilter/source/rtftok/rtfdispatchdestination.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchdestination.cxx
@@ -63,6 +63,7 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
break;
case RTFKeyword::FIELD:
m_aStates.top().setDestination(Destination::FIELD);
+ m_aStates.top().setFieldLocked(false);
break;
case RTFKeyword::FLDINST:
{
diff --git a/writerfilter/source/rtftok/rtfdispatchflag.cxx b/writerfilter/source/rtftok/rtfdispatchflag.cxx
index c56124106eb2..7bfa56d42d7c 100644
--- a/writerfilter/source/rtftok/rtfdispatchflag.cxx
+++ b/writerfilter/source/rtftok/rtfdispatchflag.cxx
@@ -1234,6 +1234,12 @@ RTFError RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
new RTFValue(1));
}
break;
+ case RTFKeyword::FLDLOCK:
+ {
+ if (m_aStates.top().getDestination() == Destination::FIELD)
+ m_aStates.top().setFieldLocked(true);
+ }
+ break;
default:
{
SAL_INFO("writerfilter", "TODO handle flag '" << keywordToString(nKeyword) << "'");
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 7066c7b5c53e..f4a66c5c3c98 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -2223,6 +2223,9 @@ RTFError RTFDocumentImpl::beforePopState(RTFParserState& rState)
}
m_aFormfieldAttributes.clear();
m_aFormfieldSprms.clear();
+
+ if (m_aStates.top().isFieldLocked())
+ singleChar(cFieldLock);
singleChar(cFieldSep);
}
break;
@@ -3642,6 +3645,7 @@ RTFParserState::RTFParserState(RTFDocumentImpl* pDocumentImpl)
, m_nInternalState(RTFInternalState::NORMAL)
, m_eDestination(Destination::NORMAL)
, m_eFieldStatus(RTFFieldStatus::NONE)
+ , m_bFieldLocked(false)
, m_nBorderState(RTFBorderState::NONE)
, m_nCurrentEncoding(rtl_getTextEncodingFromWindowsCharset(0))
, m_nUc(1)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 991cca90a562..b7f7335eb7d9 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -516,6 +516,8 @@ public:
RTFBorderState getBorderState() const { return m_nBorderState; }
void setFieldStatus(RTFFieldStatus eFieldStatus) { m_eFieldStatus = eFieldStatus; }
RTFFieldStatus getFieldStatus() const { return m_eFieldStatus; }
+ void setFieldLocked(bool bSet) { m_bFieldLocked = bSet; }
+ bool isFieldLocked() { return m_bFieldLocked; }
void setDestination(Destination eDestination) { m_eDestination = eDestination; }
Destination getDestination() const { return m_eDestination; }
void setInternalState(RTFInternalState nInternalState) { m_nInternalState = nInternalState; }
@@ -527,6 +529,7 @@ private:
RTFInternalState m_nInternalState;
Destination m_eDestination;
RTFFieldStatus m_eFieldStatus;
+ bool m_bFieldLocked;
RTFBorderState m_nBorderState;
// font table, stylesheet table
RTFSprms m_aTableSprms;