[Libreoffice-commits] .: writerfilter/source
Miklos Vajna
vmiklos at kemper.freedesktop.org
Thu May 10 01:08:19 PDT 2012
writerfilter/source/rtftok/rtfdocumentimpl.cxx | 46 +++++++++----------------
writerfilter/source/rtftok/rtfdocumentimpl.hxx | 2 +
2 files changed, 20 insertions(+), 28 deletions(-)
New commits:
commit 78e02045791fb179a031ef7a5bbacb8a71669cba
Author: Miklos Vajna <vmiklos at suse.cz>
Date: Thu May 10 10:07:10 2012 +0200
RTFDocumentImpl::runProps: avoid copy&paste
Change-Id: I3b1f03c0a3236461e753ef236881313ea7daa0d0
diff --git a/writerfilter/source/rtftok/rtfdocumentimpl.cxx b/writerfilter/source/rtftok/rtfdocumentimpl.cxx
index 1fd3d4d..a1f27be 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 2e23b0d..0f1a4ca 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();
More information about the Libreoffice-commits
mailing list