Kaydet (Commit) 8c9b0568 authored tarafından Maxime de Roucy's avatar Maxime de Roucy Kaydeden (comit) Miklos Vajna

minor update in rtfdocumentimpl.cxx

Change-Id: Ie32166edbc3efb603ccb5e98d8c2cac66ecc2f47
Reviewed-on: https://gerrit.libreoffice.org/3083Reviewed-by: 's avatarMiklos Vajna <vmiklos@suse.cz>
Tested-by: 's avatarMiklos Vajna <vmiklos@suse.cz>
üst ea8602bd
...@@ -839,6 +839,7 @@ int RTFDocumentImpl::resolvePict(bool bInline) ...@@ -839,6 +839,7 @@ int RTFDocumentImpl::resolvePict(bool bInline)
} }
writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aAttributes, aSprms)); writerfilter::Reference<Properties>::Pointer_t const pProperties(new RTFReferenceProperties(aAttributes, aSprms));
checkFirstRun(); checkFirstRun();
if (!m_aStates.top().pCurrentBuffer) if (!m_aStates.top().pCurrentBuffer)
{ {
Mapper().props(pProperties); Mapper().props(pProperties);
...@@ -850,6 +851,7 @@ int RTFDocumentImpl::resolvePict(bool bInline) ...@@ -850,6 +851,7 @@ int RTFDocumentImpl::resolvePict(bool bInline)
RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms)); RTFValue::Pointer_t pValue(new RTFValue(aAttributes, aSprms));
m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_PROPS, pValue)); m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_PROPS, pValue));
} }
return 0; return 0;
} }
...@@ -948,7 +950,9 @@ bool RTFFrame::inFrame() ...@@ -948,7 +950,9 @@ bool RTFFrame::inFrame()
void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool bRunProps) void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool bRunProps)
{ {
sal_uInt8 sValue[] = { nValue }; sal_uInt8 sValue[] = { nValue };
if (!m_aStates.top().pCurrentBuffer) RTFBuffer_t* pCurrentBuffer = m_aStates.top().pCurrentBuffer;
if (!pCurrentBuffer)
{ {
Mapper().startCharacterGroup(); Mapper().startCharacterGroup();
// Should we send run properties? // Should we send run properties?
...@@ -959,10 +963,10 @@ void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool bRunProps) ...@@ -959,10 +963,10 @@ void RTFDocumentImpl::singleChar(sal_uInt8 nValue, bool bRunProps)
} }
else else
{ {
m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, RTFValue::Pointer_t())); pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, RTFValue::Pointer_t()));
RTFValue::Pointer_t pValue(new RTFValue(*sValue)); RTFValue::Pointer_t pValue(new RTFValue(*sValue));
m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_TEXT, pValue)); pCurrentBuffer->push_back(make_pair(BUFFER_TEXT, pValue));
m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_ENDRUN, RTFValue::Pointer_t())); pCurrentBuffer->push_back(make_pair(BUFFER_ENDRUN, RTFValue::Pointer_t()));
} }
} }
...@@ -1109,31 +1113,37 @@ void RTFDocumentImpl::text(OUString& rString) ...@@ -1109,31 +1113,37 @@ void RTFDocumentImpl::text(OUString& rString)
return; return;
} }
if (!m_aStates.top().pCurrentBuffer && m_aStates.top().nDestinationState != DESTINATION_FOOTNOTE) RTFBuffer_t* pCurrentBuffer = m_aStates.top().pCurrentBuffer;
if (!pCurrentBuffer && m_aStates.top().nDestinationState != DESTINATION_FOOTNOTE)
Mapper().startCharacterGroup(); Mapper().startCharacterGroup();
else if (m_aStates.top().pCurrentBuffer) else if (pCurrentBuffer)
{ {
RTFValue::Pointer_t pValue; RTFValue::Pointer_t pValue;
m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, pValue)); pCurrentBuffer->push_back(make_pair(BUFFER_STARTRUN, pValue));
} }
if (m_aStates.top().nDestinationState == DESTINATION_NORMAL if (m_aStates.top().nDestinationState == DESTINATION_NORMAL
|| m_aStates.top().nDestinationState == DESTINATION_FIELDRESULT || m_aStates.top().nDestinationState == DESTINATION_FIELDRESULT
|| m_aStates.top().nDestinationState == DESTINATION_SHAPETEXT) || m_aStates.top().nDestinationState == DESTINATION_SHAPETEXT)
runProps(); runProps();
if (!m_aStates.top().pCurrentBuffer)
if (!pCurrentBuffer)
Mapper().utext(reinterpret_cast<sal_uInt8 const*>(rString.getStr()), rString.getLength()); Mapper().utext(reinterpret_cast<sal_uInt8 const*>(rString.getStr()), rString.getLength());
else else
{ {
RTFValue::Pointer_t pValue(new RTFValue(rString)); RTFValue::Pointer_t pValue(new RTFValue(rString));
m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_UTEXT, pValue)); pCurrentBuffer->push_back(make_pair(BUFFER_UTEXT, pValue));
} }
m_bNeedCr = true; m_bNeedCr = true;
if (!m_aStates.top().pCurrentBuffer && m_aStates.top().nDestinationState != DESTINATION_FOOTNOTE)
if (!pCurrentBuffer && m_aStates.top().nDestinationState != DESTINATION_FOOTNOTE)
Mapper().endCharacterGroup(); Mapper().endCharacterGroup();
else if(m_aStates.top().pCurrentBuffer) else if(pCurrentBuffer)
{ {
RTFValue::Pointer_t pValue; RTFValue::Pointer_t pValue;
m_aStates.top().pCurrentBuffer->push_back(make_pair(BUFFER_ENDRUN, pValue)); pCurrentBuffer->push_back(make_pair(BUFFER_ENDRUN, pValue));
} }
} }
...@@ -2380,6 +2390,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword) ...@@ -2380,6 +2390,7 @@ int RTFDocumentImpl::dispatchFlag(RTFKeyword nKeyword)
{ {
if (!m_aStates.top().pCurrentBuffer) if (!m_aStates.top().pCurrentBuffer)
m_aStates.top().pCurrentBuffer = &m_aSuperBuffer; m_aStates.top().pCurrentBuffer = &m_aSuperBuffer;
RTFValue::Pointer_t pValue(new RTFValue("superscript")); RTFValue::Pointer_t pValue(new RTFValue("superscript"));
m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue); m_aStates.top().aCharacterSprms.set(NS_ooxml::LN_EG_RPrBase_vertAlign, pValue);
} }
...@@ -2716,12 +2727,14 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam) ...@@ -2716,12 +2727,14 @@ int RTFDocumentImpl::dispatchValue(RTFKeyword nKeyword, int nParam)
case RTF_POSY: nId = NS_ooxml::LN_CT_FramePr_y; m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, 0); break; case RTF_POSY: nId = NS_ooxml::LN_CT_FramePr_y; m_aStates.top().aFrame.setSprm(NS_ooxml::LN_CT_FramePr_yAlign, 0); break;
default: break; default: break;
} }
if (nId > 0) if (nId > 0)
{ {
m_bNeedPap = true; m_bNeedPap = true;
// Don't try to support text frames inside tables for now. // Don't try to support text frames inside tables for now.
if (m_aStates.top().pCurrentBuffer != &m_aTableBuffer) if (m_aStates.top().pCurrentBuffer != &m_aTableBuffer)
m_aStates.top().aFrame.setSprm(nId, nParam); m_aStates.top().aFrame.setSprm(nId, nParam);
return 0; return 0;
} }
...@@ -4285,6 +4298,7 @@ int RTFDocumentImpl::popState() ...@@ -4285,6 +4298,7 @@ int RTFDocumentImpl::popState()
else if (m_xDocumentProperties.is()) else if (m_xDocumentProperties.is())
m_xDocumentProperties->setTitle(aState.aDestinationText.makeStringAndClear()); m_xDocumentProperties->setTitle(aState.aDestinationText.makeStringAndClear());
} }
if (aState.pCurrentBuffer == &m_aSuperBuffer) if (aState.pCurrentBuffer == &m_aSuperBuffer)
{ {
OSL_ASSERT(m_aStates.top().pCurrentBuffer == 0); OSL_ASSERT(m_aStates.top().pCurrentBuffer == 0);
...@@ -4294,6 +4308,7 @@ int RTFDocumentImpl::popState() ...@@ -4294,6 +4308,7 @@ int RTFDocumentImpl::popState()
m_bHasFootnote = false; m_bHasFootnote = false;
} }
if (m_aStates.size()) if (m_aStates.size())
{ {
m_aStates.top().nCells = aState.nCells; m_aStates.top().nCells = aState.nCells;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment