summaryrefslogtreecommitdiff
path: root/writerfilter/source/rtftok
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@suse.cz>2012-05-10 10:07:10 +0200
committerMiklos Vajna <vmiklos@suse.cz>2012-05-10 10:08:21 +0200
commit78e02045791fb179a031ef7a5bbacb8a71669cba (patch)
tree876a13b134b7925648692e07d116011bd3fa784f /writerfilter/source/rtftok
parentb7ef4c31a623b3763434379df0a56c10bec77080 (diff)
RTFDocumentImpl::runProps: avoid copy&paste
Change-Id: I3b1f03c0a3236461e753ef236881313ea7daa0d0
Diffstat (limited to 'writerfilter/source/rtftok')
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.cxx46
-rw-r--r--writerfilter/source/rtftok/rtfdocumentimpl.hxx2
2 files changed, 20 insertions, 28 deletions
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 1fd3d4dce577..a1f27be46b49 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.cxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
@@ -439,6 +439,22 @@ void RTFDocumentImpl::checkNeedPap()
}
}
+void RTFDocumentImpl::runProps()
+{
+ if (!m_pCurrentBuffer)
+ {
+ writerfilter::Reference<Properties>::Pointer_t const pProperties(
+ new RTFReferenceProperties(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms)
+ );
+ Mapper().props(pProperties);
+ }
+ else
+ {
+ RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms));
+ m_pCurrentBuffer->push_back(make_pair(BUFFER_PROPS, pValue));
+ }
+}
+
void RTFDocumentImpl::runBreak()
{
sal_uInt8 sBreak[] = { 0xd };
@@ -979,20 +995,7 @@ void RTFDocumentImpl::text(OUString& rString)
if (m_aStates.top().nDestinationState == DESTINATION_NORMAL
|| m_aStates.top().nDestinationState == DESTINATION_FIELDRESULT
|| m_aStates.top().nDestinationState == DESTINATION_SHAPETEXT)
- {
- if (!m_pCurrentBuffer)
- {
- writerfilter::Reference<Properties>::Pointer_t const pProperties(
- new RTFReferenceProperties(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms)
- );
- Mapper().props(pProperties);
- }
- else
- {
- RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms));
- m_pCurrentBuffer->push_back(make_pair(BUFFER_PROPS, pValue));
- }
- }
+ runProps();
if (!m_pCurrentBuffer)
Mapper().utext(reinterpret_cast<sal_uInt8 const*>(rString.getStr()), rString.getLength());
else
@@ -1419,20 +1422,7 @@ int RTFDocumentImpl::dispatchSymbol(RTFKeyword nKeyword)
bool bNeedPap = m_bNeedPap;
checkNeedPap();
if (bNeedPap)
- {
- if (!m_pCurrentBuffer)
- {
- writerfilter::Reference<Properties>::Pointer_t const pProperties(
- new RTFReferenceProperties(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms)
- );
- Mapper().props(pProperties);
- }
- else
- {
- RTFValue::Pointer_t pValue(new RTFValue(m_aStates.top().aCharacterAttributes, m_aStates.top().aCharacterSprms));
- m_pCurrentBuffer->push_back(make_pair(BUFFER_PROPS, pValue));
- }
- }
+ runProps();
if (!m_pCurrentBuffer)
parBreak();
else if (m_aStates.top().nDestinationState != DESTINATION_SHAPETEXT)
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.hxx b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
index 2e23b0d79a26..0f1a4cab662c 100644
--- a/writerfilter/source/rtftok/rtfdocumentimpl.hxx
+++ b/writerfilter/source/rtftok/rtfdocumentimpl.hxx
@@ -405,6 +405,8 @@ namespace writerfilter {
void text(rtl::OUString& rString);
// Sends a single character to dmapper, taking care of buffering.
void singleChar(sal_uInt8 nValue);
+ // Sends run properties to dmapper, taking care of buffering.
+ void runProps();
void parBreak();
void tableBreak();
void checkNeedPap();