summaryrefslogtreecommitdiff
path: root/writerfilter
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.co.uk>2016-03-09 11:59:14 +0100
committerMiklos Vajna <vmiklos@collabora.co.uk>2016-03-09 14:18:28 +0100
commitcf773edad7033b23c53b5e9a60ecc0b56d7f83f9 (patch)
tree0c5c53aa9e05465db04faa77726c110998dab38f /writerfilter
parent38dd218425b3e4a56d71af7082eea1dda24b48da (diff)
RTF import: handle \userprops and \propname
Change-Id: I3fa0be5186603006e671779933625efff5d31867
Diffstat (limited to 'writerfilter')
-rw-r--r--writerfilter/source/rtftok/rtfcontrolwords.hxx2
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx17
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx3
3 files changed, 22 insertions, 0 deletions
diff --git a/writerfilter/source/rtftok/rtfcontrolwords.hxx b/writerfilter/source/rtftok/rtfcontrolwords.hxx
index dfbbabf5ba35..dab8196fbc2a 100644
--- a/writerfilter/source/rtftok/rtfcontrolwords.hxx
+++ b/writerfilter/source/rtftok/rtfcontrolwords.hxx
@@ -156,6 +156,8 @@ enum class Destination
FOOTNOTESEPARATOR,
INDEXENTRY,
TOCENTRY,
+ USERPROPS,
+ PROPNAME,
};
enum RTFKeyword
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 187eb5ad54fb..7d7ee399e4e2 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -1290,6 +1290,7 @@ void RTFDocumentImpl::text(OUString& rString)
case Destination::MGROW:
case Destination::INDEXENTRY:
case Destination::TOCENTRY:
+ case Destination::PROPNAME:
m_aStates.top().pDestinationText->append(rString);
break;
default:
@@ -2051,6 +2052,13 @@ RTFError RTFDocumentImpl::dispatchDestination(RTFKeyword nKeyword)
m_aStates.top().eDestination = Destination::FOOTNOTESEPARATOR;
m_aStates.top().aCharacterAttributes.set(NS_ooxml::LN_CT_FtnEdn_type, std::make_shared<RTFValue>(NS_ooxml::LN_Value_doc_ST_FtnEdn_separator));
break;
+ case RTF_USERPROPS:
+ // Container of all user-defined properties.
+ m_aStates.top().eDestination = Destination::USERPROPS;
+ break;
+ case RTF_PROPNAME:
+ m_aStates.top().eDestination = Destination::PROPNAME;
+ break;
default:
{
// Check if it's a math token.
@@ -5874,6 +5882,11 @@ RTFError RTFDocumentImpl::popState()
if (aState.bCreatedShapeGroup)
m_pSdrImport->popParent();
break;
+ case Destination::PROPNAME:
+ if (&m_aStates.top().aDestinationText != m_aStates.top().pDestinationText)
+ break; // not for nested group
+ aState.aPropName = m_aStates.top().pDestinationText->makeStringAndClear();
+ break;
default:
break;
}
@@ -6143,6 +6156,10 @@ RTFError RTFDocumentImpl::popState()
m_aStates.top().aDrawingObject.nBottom = aState.aDrawingObject.nBottom;
}
break;
+ case Destination::PROPNAME:
+ if (m_aStates.top().eDestination == Destination::USERPROPS)
+ m_aStates.top().aPropName = aState.aPropName;
+ break;
default:
{
if (!m_aStates.empty() && m_aStates.top().eDestination == Destination::PICT)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 37727d8afffd..9445ac9c1555 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -297,6 +297,9 @@ public:
bool bInShape; ///< If we're inside a \shp group.
bool bCreatedShapeGroup; ///< A GroupShape was created and pushed to the parent stack.
bool bStartedTrackchange; ///< Track change is started, need to end it before popping.
+
+ /// User-defined property: key name.
+ OUString aPropName;
};
/// An RTF stack is similar to std::stack, except that it has an operator[].