Kaydet (Commit) dd971d00 authored tarafından Katarina Behrens's avatar Katarina Behrens Kaydeden (comit) Eike Rathke

tdf#92296: Fix off-by-one formatting of text runs on OOXML export

This essentially reverts commit 8865ed2e
and implements a different fix for tdf#90812:
If the formatting of entire cell is uniform, remove formatting of the
leading text run and create corresponding cell style. In all other cases,
write out formattings for each individual run.

Change-Id: I7724b7a474f773f2cdc39e9150d843642fb05bbe
Reviewed-on: https://gerrit.libreoffice.org/19811Reviewed-by: 's avatarEike Rathke <erack@redhat.com>
Tested-by: 's avatarEike Rathke <erack@redhat.com>
üst 2dd20b47
...@@ -428,10 +428,9 @@ void XclExpString::WriteXml( XclExpXmlStream& rStrm ) const ...@@ -428,10 +428,9 @@ void XclExpString::WriteXml( XclExpXmlStream& rStrm ) const
const XclExpFont* pFont = NULL; const XclExpFont* pFont = NULL;
for ( ; aIt != aEnd; ++aIt ) for ( ; aIt != aEnd; ++aIt )
{ {
// pFont getting first then pass it to run otherwise pFont is NULL.
pFont = rFonts.GetFont( aIt->mnFontIdx );
nStart = lcl_WriteRun( rStrm, GetUnicodeBuffer(), nStart = lcl_WriteRun( rStrm, GetUnicodeBuffer(),
nStart, aIt->mnChar-nStart, pFont ); nStart, aIt->mnChar-nStart, pFont );
pFont = rFonts.GetFont( aIt->mnFontIdx );
} }
lcl_WriteRun( rStrm, GetUnicodeBuffer(), lcl_WriteRun( rStrm, GetUnicodeBuffer(),
nStart, GetUnicodeBuffer().size() - nStart, pFont ); nStart, GetUnicodeBuffer().size() - nStart, pFont );
......
...@@ -723,13 +723,18 @@ void XclExpLabelCell::Init( const XclExpRoot& rRoot, ...@@ -723,13 +723,18 @@ void XclExpLabelCell::Init( const XclExpRoot& rRoot,
mxText = xText; mxText = xText;
mnSstIndex = 0; mnSstIndex = 0;
// create the cell format const XclFormatRunVec& rFormats = mxText->GetFormats();
sal_uInt16 nXclFont = mxText->RemoveLeadingFont(); // Create the cell format and remove formatting of the leading run
if( GetXFId() == EXC_XFID_NOTFOUND ) // if the entire string is equally formatted
if( rFormats.size() == 1 )
{ {
OSL_ENSURE( nXclFont != EXC_FONT_NOTFOUND, "XclExpLabelCell::Init - leading font not found" ); sal_uInt16 nXclFont = mxText->RemoveLeadingFont();
bool bForceLineBreak = mxText->IsWrapped(); if( GetXFId() == EXC_XFID_NOTFOUND )
SetXFId( rRoot.GetXFBuffer().InsertWithFont( pPattern, ApiScriptType::WEAK, nXclFont, bForceLineBreak ) ); {
OSL_ENSURE( nXclFont != EXC_FONT_NOTFOUND, "XclExpLabelCell::Init - leading font not found" );
bool bForceLineBreak = mxText->IsWrapped();
SetXFId( rRoot.GetXFBuffer().InsertWithFont( pPattern, ApiScriptType::WEAK, nXclFont, bForceLineBreak ) );
}
} }
// get auto-wrap attribute from cell format // get auto-wrap attribute from cell format
......
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