summaryrefslogtreecommitdiff
path: root/oox
diff options
context:
space:
mode:
authorEike Rathke <erack@redhat.com>2011-11-24 23:33:32 +0100
committerEike Rathke <erack@redhat.com>2011-11-25 01:01:16 +0100
commita70f7bfc5ee22aa54c98cb8aab69b5eb97a86bbd (patch)
tree8d194fd10b91673892c795bfc3a580ffafb72ac5 /oox
parent36018b12c460dd0e537f2a1aff8cb78a356cafbd (diff)
calc69: #i117836# repair import of multiline cells and cells with leading font escapement
# Original author: Daniel Rentz [dr] <daniel.rentz@oracle.com> * found as LGPLv3-only fix at svn rev 1172134 (http://svn.apache.org/viewvc?view=revision&revision=1172134)
Diffstat (limited to 'oox')
-rw-r--r--oox/inc/oox/xls/richstring.hxx1
-rw-r--r--oox/source/xls/commentsbuffer.cxx2
-rw-r--r--oox/source/xls/richstring.cxx16
-rw-r--r--oox/source/xls/worksheethelper.cxx5
4 files changed, 14 insertions, 10 deletions
diff --git a/oox/inc/oox/xls/richstring.hxx b/oox/inc/oox/xls/richstring.hxx
index cf20fba8c7d5..8efffdf34286 100644
--- a/oox/inc/oox/xls/richstring.hxx
+++ b/oox/inc/oox/xls/richstring.hxx
@@ -276,6 +276,7 @@ public:
formatting for the first text portion, e.g. font escapement. */
void convert(
const ::com::sun::star::uno::Reference< ::com::sun::star::text::XText >& rxText,
+ bool bReplaceOld,
const Font* pFirstPortionFont = 0 ) const;
private:
diff --git a/oox/source/xls/commentsbuffer.cxx b/oox/source/xls/commentsbuffer.cxx
index c8a8d7df4e8d..55dd28b35283 100644
--- a/oox/source/xls/commentsbuffer.cxx
+++ b/oox/source/xls/commentsbuffer.cxx
@@ -284,7 +284,7 @@ void Comment::finalizeImport()
// insert text and convert text formatting
maModel.mxText->finalizeImport();
Reference< XText > xAnnoText( xAnnoShape, UNO_QUERY_THROW );
- maModel.mxText->convert( xAnnoText );
+ maModel.mxText->convert( xAnnoText, true );
}
catch( Exception& )
{
diff --git a/oox/source/xls/richstring.cxx b/oox/source/xls/richstring.cxx
index 6a2bbd9eab1a..7b025e58a687 100644
--- a/oox/source/xls/richstring.cxx
+++ b/oox/source/xls/richstring.cxx
@@ -110,9 +110,10 @@ void RichStringPortion::convert( const Reference< XText >& rxText, const Font* p
mxFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_TEXT );
}
- /* Some font attributes cannot be set to cell formattiing in Calc but
- require to use rich formatting, e.g. font escapement. */
- if( lclNeedsRichTextFormat( pFont ) )
+ /* Some font attributes cannot be set to cell formatting in Calc but
+ require to use rich formatting, e.g. font escapement. But do not
+ use the passed font if this portion has its own font. */
+ else if( lclNeedsRichTextFormat( pFont ) )
{
PropertySet aPropSet( xRange );
pFont->writeToPropertySet( aPropSet, FONT_PROPTYPE_TEXT );
@@ -534,12 +535,12 @@ bool RichString::extractPlainString( OUString& orString, const Font* pFirstPorti
if( (maTextPortions.size() == 1) && !maTextPortions.front()->hasFont() && !lclNeedsRichTextFormat( pFirstPortionFont ) )
{
orString = maTextPortions.front()->getText();
- return true;
+ return orString.indexOf( '\x0A' ) < 0;
}
return false;
}
-void RichString::convert( const Reference< XText >& rxText, const Font* pFirstPortionFont ) const
+void RichString::convert( const Reference< XText >& rxText, bool bReplaceOld, const Font* pFirstPortionFont ) const
{
if (maTextPortions.size() == 1)
{
@@ -551,12 +552,11 @@ void RichString::convert( const Reference< XText >& rxText, const Font* pFirstPo
return;
}
- bool bReplace = true;
for( PortionVector::const_iterator aIt = maTextPortions.begin(), aEnd = maTextPortions.end(); aIt != aEnd; ++aIt )
{
- (*aIt)->convert( rxText, pFirstPortionFont, bReplace );
+ (*aIt)->convert( rxText, pFirstPortionFont, bReplaceOld );
pFirstPortionFont = 0; // use passed font for first portion only
- bReplace = false; // do not replace first portion text with following portions
+ bReplaceOld = false; // do not replace first portion text with following portions
}
}
diff --git a/oox/source/xls/worksheethelper.cxx b/oox/source/xls/worksheethelper.cxx
index a74e24f3343b..02802a392783 100644
--- a/oox/source/xls/worksheethelper.cxx
+++ b/oox/source/xls/worksheethelper.cxx
@@ -1679,7 +1679,10 @@ void WorksheetHelper::putRichString( const CellAddress& rAddress, const RichStri
{
Reference< XText > xText( getCell( rAddress ), UNO_QUERY );
OSL_ENSURE( xText.is(), "WorksheetHelper::putRichString - missing text interface" );
- rString.convert( xText, pFirstPortionFont );
+ /* Passing false will always append the portions to the XText. This is
+ essential for special rich formatting attributes at the leading text
+ portion supported by edit cells only, e.g. font escapement. */
+ rString.convert( xText, false, pFirstPortionFont );
}
void WorksheetHelper::putFormulaTokens( const CellAddress& rAddress, const ApiTokenSequence& rTokens ) const