fix the "last char is missing from footnote when Word produces the rtf" bug
This commit is contained in:
parent
d80ff1025b
commit
70569eb6d6
3 changed files with 21 additions and 0 deletions
|
@ -264,6 +264,7 @@ RTFDocumentImpl::RTFDocumentImpl(uno::Reference<uno::XComponentContext> const& x
|
|||
m_bFirstRun(true),
|
||||
m_bFirstRow(true),
|
||||
m_bNeedPap(false),
|
||||
m_bNeedCr(false),
|
||||
m_aListTableSprms(),
|
||||
m_aSettingsTableSprms(),
|
||||
m_xStorage(),
|
||||
|
@ -333,6 +334,18 @@ bool RTFDocumentImpl::isSubstream()
|
|||
return m_bIsSubstream;
|
||||
}
|
||||
|
||||
void RTFDocumentImpl::finishSubstream()
|
||||
{
|
||||
// At the end of a footnote stream, we need to emit a run break when importing from Word.
|
||||
// We can't do so unconditionally, as Writer already writes a \par at the end of the footnote.
|
||||
if (m_bNeedCr)
|
||||
{
|
||||
Mapper().startCharacterGroup();
|
||||
runBreak();
|
||||
Mapper().endCharacterGroup();
|
||||
}
|
||||
}
|
||||
|
||||
void RTFDocumentImpl::setIgnoreFirst(OUString& rIgnoreFirst)
|
||||
{
|
||||
m_aIgnoreFirst = rIgnoreFirst;
|
||||
|
@ -390,6 +403,7 @@ void RTFDocumentImpl::runBreak()
|
|||
{
|
||||
sal_uInt8 sBreak[] = { 0xd };
|
||||
Mapper().text(sBreak, 1);
|
||||
m_bNeedCr = false;
|
||||
}
|
||||
|
||||
void RTFDocumentImpl::tableBreak()
|
||||
|
@ -832,6 +846,7 @@ void RTFDocumentImpl::text(OUString& rString)
|
|||
RTFValue::Pointer_t pValue(new RTFValue(rString));
|
||||
m_pCurrentBuffer->push_back(make_pair(BUFFER_UTEXT, pValue));
|
||||
}
|
||||
m_bNeedCr = true;
|
||||
if (!m_pCurrentBuffer && m_aStates.top().nDestinationState != DESTINATION_FOOTNOTE)
|
||||
Mapper().endCharacterGroup();
|
||||
else if(m_pCurrentBuffer)
|
||||
|
|
|
@ -273,6 +273,7 @@ namespace writerfilter {
|
|||
void setSubstream(bool bIsSubtream);
|
||||
void setAuthor(rtl::OUString& rAuthor);
|
||||
bool isSubstream();
|
||||
void finishSubstream();
|
||||
void setIgnoreFirst(rtl::OUString& rIgnoreFirst);
|
||||
void seek(sal_uInt32 nPos);
|
||||
com::sun::star::uno::Reference<com::sun::star::lang::XMultiServiceFactory> getModelFactory();
|
||||
|
@ -342,6 +343,8 @@ namespace writerfilter {
|
|||
bool m_bFirstRow;
|
||||
/// If paragraph properties should be emitted on next run.
|
||||
bool m_bNeedPap;
|
||||
/// If we need to emit a CR at the end of substream.
|
||||
bool m_bNeedCr;
|
||||
/// The list table and list override table combined.
|
||||
RTFSprms m_aListTableSprms;
|
||||
/// The settings table.
|
||||
|
|
|
@ -83,7 +83,10 @@ int RTFTokenizer::resolveParse()
|
|||
if ((ret = m_rImport.popState()))
|
||||
return ret;
|
||||
if (m_rImport.isSubstream() && m_rImport.getGroup() == 0)
|
||||
{
|
||||
m_rImport.finishSubstream();
|
||||
return 0;
|
||||
}
|
||||
break;
|
||||
case '\\':
|
||||
if ((ret = resolveKeyword()))
|
||||
|
|
Loading…
Reference in a new issue