[Libreoffice-commits] .: Branch 'ooo-build-3-2-1' - patches/dev300
Radek DoulÃk
rodo at kemper.freedesktop.org
Wed Nov 10 12:54:39 PST 2010
patches/dev300/apply | 1
patches/dev300/oox-pptx-import-fix-table-style.diff | 282 ++++++++++++++++++++
2 files changed, 283 insertions(+)
New commits:
commit a71b8b1d8a45b483968e16aa861e5aabdcec0f74
Author: Radek Doulik <rodo at novell.com>
Date: Wed Nov 10 21:34:04 2010 +0100
fix how the table cells style is applied in pptx import, n#650008
* patches/dev300/apply:
* patches/dev300/oox-pptx-import-fix-table-style.diff:
diff --git a/patches/dev300/apply b/patches/dev300/apply
index dfaf09d..97c532c 100644
--- a/patches/dev300/apply
+++ b/patches/dev300/apply
@@ -4156,3 +4156,4 @@ netbook-window-decoration-update.diff, n#621116, rodo
oox-pptx-import-fix-customshapes-and-groups.diff, n#621739, rodo
oox-pptx-import-fix-groups-2.diff, n#619678, rodo
oox-pptx-import-fix-text-paragraph-autofit.diff, n#650035, rodo
+oox-pptx-import-fix-table-style.diff, n#650008, rodo
diff --git a/patches/dev300/oox-pptx-import-fix-table-style.diff b/patches/dev300/oox-pptx-import-fix-table-style.diff
new file mode 100644
index 0000000..b5bf855
--- /dev/null
+++ b/patches/dev300/oox-pptx-import-fix-table-style.diff
@@ -0,0 +1,282 @@
+From 1024c37c05a0d9b771271b13a829332086fca888 Mon Sep 17 00:00:00 2001
+From: Radek Doulik <rodo at novell.com>
+Date: Wed, 10 Nov 2010 21:24:12 +0100
+Subject: [PATCH] fix how the table cells style is applied in pptx import, n#650008
+
+---
+ oox/inc/oox/drawingml/textcharacterproperties.hxx | 6 ++-
+ oox/inc/oox/drawingml/textliststyle.hxx | 2 +-
+ oox/source/drawingml/table/tablecell.cxx | 39 ++++++++++++--------
+ .../drawingml/table/tablestyletextstylecontext.cxx | 24 +++++++-----
+ oox/source/drawingml/textcharacterproperties.cxx | 26 ++++++++------
+ oox/source/drawingml/textliststyle.cxx | 2 +-
+ oox/source/helper/propertymap.cxx | 3 ++
+ 7 files changed, 61 insertions(+), 41 deletions(-)
+
+diff --git oox/inc/oox/drawingml/textcharacterproperties.hxx oox/inc/oox/drawingml/textcharacterproperties.hxx
+index 08102e8..d9e6f7b 100644
+--- oox/inc/oox/drawingml/textcharacterproperties.hxx
++++ oox/inc/oox/drawingml/textcharacterproperties.hxx
+@@ -73,12 +73,14 @@ struct TextCharacterProperties
+ /** Writes the properties to the passed property map. */
+ void pushToPropMap(
+ PropertyMap& rPropMap,
+- const ::oox::core::XmlFilterBase& rFilter ) const;
++ const ::oox::core::XmlFilterBase& rFilter,
++ bool bUseOptional = false ) const;
+
+ /** Writes the properties to the passed property set. */
+ void pushToPropSet(
+ PropertySet& rPropSet,
+- const ::oox::core::XmlFilterBase& rFilter ) const;
++ const ::oox::core::XmlFilterBase& rFilter,
++ bool bUseOptional = false ) const;
+ };
+
+ // ============================================================================
+diff --git oox/source/drawingml/table/tablecell.cxx oox/source/drawingml/table/tablecell.cxx
+index 5fc1c99..9cd346b 100644
+--- oox/source/drawingml/table/tablecell.cxx
++++ oox/source/drawingml/table/tablecell.cxx
+@@ -99,7 +99,7 @@ void applyBorder( TableStylePart& rTableStylePart, sal_Int32 nLineType, oox::dra
+ rLineProperties.assignUsed( *aIter->second );
+ }
+
+-void applyTableStylePart( const ::oox::core::XmlFilterBase& rFilterBase, const Reference < ::com::sun::star::table::XCell >& rxCell, oox::drawingml::FillProperties& rFillProperties,
++void applyTableStylePart( const ::oox::core::XmlFilterBase& rFilterBase, const Reference < text::XTextRange >& rxStart, oox::drawingml::FillProperties& rFillProperties,
+ oox::drawingml::LineProperties& rLeftBorder,
+ oox::drawingml::LineProperties& rRightBorder,
+ oox::drawingml::LineProperties& rTopBorder,
+@@ -125,9 +125,13 @@ void applyTableStylePart( const ::oox::core::XmlFilterBase& rFilterBase, const R
+ aTextCharProps.maComplexFont = rTableStylePart.getComplexFont();
+ aTextCharProps.maSymbolFont = rTableStylePart.getSymbolFont();
+ aTextCharProps.maCharColor = rTableStylePart.getTextColor();
++ if( rTableStylePart.getTextBoldStyle().is_initialized() )
++ aTextCharProps.moBold = rTableStylePart.getTextBoldStyle();
++ if( rTableStylePart.getTextItalicStyle().is_initialized() )
++ aTextCharProps.moItalic = rTableStylePart.getTextItalicStyle();
+
+- PropertySet aPropSet( rxCell );
+- aTextCharProps.pushToPropSet( aPropSet, rFilterBase );
++ PropertySet aPropSet( rxStart );
++ aTextCharProps.pushToPropSet( aPropSet, rFilterBase, true );
+ }
+
+ void applyTableCellProperties( const Reference < ::com::sun::star::table::XCell >& rxCell, const TableCell& rTableCell )
+@@ -170,6 +174,9 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
+ applyTableCellProperties( rxCell, *this );
+ TextCharacterProperties aTextStyleProps;
+ getTextBody()->insertAt( rFilterBase, xText, xAt, aTextStyleProps, pMasterTextListStyle );
++ xAt->gotoStart( sal_True );
++ Reference< text::XTextRange > xStart( xAt, UNO_QUERY );
++ xAt->gotoEnd( sal_True );
+
+ Reference< XPropertySet > xPropSet( rxCell, UNO_QUERY_THROW );
+ oox::drawingml::FillProperties aFillProperties;
+@@ -184,7 +191,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
+ if ( rBackgroundFillPropertiesPtr.get() )
+ aFillProperties.assignUsed( *rBackgroundFillPropertiesPtr );
+
+- applyTableStylePart( rFilterBase, rxCell, aFillProperties,
++ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+@@ -195,7 +202,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
+
+ if ( rProperties.isFirstRow() && ( nRow == 0 ) )
+ {
+- applyTableStylePart( rFilterBase, rxCell, aFillProperties,
++ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+@@ -206,7 +213,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
+ }
+ if ( rProperties.isLastRow() && ( nRow == nMaxRow ) )
+ {
+- applyTableStylePart( rFilterBase, rxCell, aFillProperties,
++ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+@@ -217,7 +224,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
+ }
+ if ( rProperties.isFirstCol() && ( nColumn == 0 ) )
+ {
+- applyTableStylePart( rFilterBase, rxCell, aFillProperties,
++ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+@@ -228,7 +235,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
+ }
+ if ( rProperties.isLastCol() && ( nColumn == nMaxColumn ) )
+ {
+- applyTableStylePart( rFilterBase, rxCell, aFillProperties,
++ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+@@ -247,7 +254,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
+ nBand++;
+ if ( nBand & 1 )
+ {
+- applyTableStylePart( rFilterBase, rxCell, aFillProperties,
++ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+@@ -258,7 +265,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
+ }
+ else
+ {
+- applyTableStylePart( rFilterBase, rxCell, aFillProperties,
++ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+@@ -271,7 +278,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
+ }
+ if ( ( nRow == 0 ) && ( nColumn == 0 ) )
+ {
+- applyTableStylePart( rFilterBase, rxCell, aFillProperties,
++ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+@@ -282,7 +289,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
+ }
+ if ( ( nRow == nMaxRow ) && ( nColumn == 0 ) )
+ {
+- applyTableStylePart( rFilterBase, rxCell, aFillProperties,
++ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+@@ -293,7 +300,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
+ }
+ if ( ( nRow == 0 ) && ( nColumn == nMaxColumn ) )
+ {
+- applyTableStylePart( rFilterBase, rxCell, aFillProperties,
++ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+@@ -304,7 +311,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
+ }
+ if ( ( nRow == nMaxColumn ) && ( nColumn == nMaxColumn ) )
+ {
+- applyTableStylePart( rFilterBase, rxCell, aFillProperties,
++ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+@@ -323,7 +330,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
+ nBand++;
+ if ( nBand & 1 )
+ {
+- applyTableStylePart( rFilterBase, rxCell, aFillProperties,
++ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+@@ -334,7 +341,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
+ }
+ else
+ {
+- applyTableStylePart( rFilterBase, rxCell, aFillProperties,
++ applyTableStylePart( rFilterBase, xStart, aFillProperties,
+ aLinePropertiesLeft,
+ aLinePropertiesRight,
+ aLinePropertiesTop,
+diff --git oox/source/drawingml/table/tablestyletextstylecontext.cxx oox/source/drawingml/table/tablestyletextstylecontext.cxx
+index 520894f..e65e09a 100644
+--- oox/source/drawingml/table/tablestyletextstylecontext.cxx
++++ oox/source/drawingml/table/tablestyletextstylecontext.cxx
+@@ -46,17 +46,21 @@ TableStyleTextStyleContext::TableStyleTextStyleContext( ContextHandler& rParent,
+ : ContextHandler( rParent )
+ , mrTableStylePart( rTableStylePart )
+ {
+- sal_Int32 nB = xAttribs->getOptionalValueToken( XML_b, XML_def );
+- if ( nB == XML_on )
+- mrTableStylePart.getTextBoldStyle() = ::boost::optional< sal_Bool >( sal_True );
+- else if ( nB == XML_off )
+- mrTableStylePart.getTextBoldStyle() = ::boost::optional< sal_Bool >( sal_False );
++ if( xAttribs->hasAttribute( XML_b ) ) {
++ sal_Int32 nB = xAttribs->getOptionalValueToken( XML_b, XML_def );
++ if ( nB == XML_on )
++ mrTableStylePart.getTextBoldStyle() = ::boost::optional< sal_Bool >( sal_True );
++ else if ( nB == XML_off )
++ mrTableStylePart.getTextBoldStyle() = ::boost::optional< sal_Bool >( sal_False );
++ }
+
+- sal_Int32 nI = xAttribs->getOptionalValueToken( XML_i, XML_def );
+- if ( nI == XML_on )
+- mrTableStylePart.getTextItalicStyle() = ::boost::optional< sal_Bool >( sal_True );
+- else if ( nI == XML_off )
+- mrTableStylePart.getTextItalicStyle() = ::boost::optional< sal_Bool >( sal_False );
++ if( xAttribs->hasAttribute( XML_i ) ) {
++ sal_Int32 nI = xAttribs->getOptionalValueToken( XML_i, XML_def );
++ if ( nI == XML_on )
++ mrTableStylePart.getTextItalicStyle() = ::boost::optional< sal_Bool >( sal_True );
++ else if ( nI == XML_off )
++ mrTableStylePart.getTextItalicStyle() = ::boost::optional< sal_Bool >( sal_False );
++ }
+ }
+
+ TableStyleTextStyleContext::~TableStyleTextStyleContext()
+diff --git oox/source/drawingml/textcharacterproperties.cxx oox/source/drawingml/textcharacterproperties.cxx
+index 4db1cd9..d9ffd8c 100644
+--- oox/source/drawingml/textcharacterproperties.cxx
++++ oox/source/drawingml/textcharacterproperties.cxx
+@@ -70,7 +70,7 @@ void TextCharacterProperties::assignUsed( const TextCharacterProperties& rSource
+ moUnderlineFillFollowText.assignIfUsed( rSourceProps.moUnderlineFillFollowText );
+ }
+
+-void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFilterBase& rFilter ) const
++ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFilterBase& rFilter, bool bUseOptional ) const
+ {
+ OUString aFontName;
+ sal_Int16 nFontPitch = 0;
+@@ -134,15 +134,19 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
+ rPropMap[ PROP_CharStrikeout ] <<= GetFontStrikeout( moStrikeout.get( XML_noStrike ) );
+ rPropMap[ PROP_CharCaseMap ] <<= GetCaseMap( moCaseMap.get( XML_none ) );
+
+- float fWeight = moBold.get( false ) ? awt::FontWeight::BOLD : awt::FontWeight::NORMAL;
+- rPropMap[ PROP_CharWeight ] <<= fWeight;
+- rPropMap[ PROP_CharWeightAsian ] <<= fWeight;
+- rPropMap[ PROP_CharWeightComplex ] <<= fWeight;
++ if( !bUseOptional || moBold.has() ) {
++ float fWeight = moBold.get( false ) ? awt::FontWeight::BOLD : awt::FontWeight::NORMAL;
++ rPropMap[ PROP_CharWeight ] <<= fWeight;
++ rPropMap[ PROP_CharWeightAsian ] <<= fWeight;
++ rPropMap[ PROP_CharWeightComplex ] <<= fWeight;
++ }
+
+- awt::FontSlant eSlant = moItalic.get( false ) ? awt::FontSlant_ITALIC : awt::FontSlant_NONE;
+- rPropMap[ PROP_CharPosture ] <<= eSlant;
+- rPropMap[ PROP_CharPostureAsian ] <<= eSlant;
+- rPropMap[ PROP_CharPostureComplex ] <<= eSlant;
++ if( !bUseOptional || moItalic.has() ) {
++ awt::FontSlant eSlant = moItalic.get( false ) ? awt::FontSlant_ITALIC : awt::FontSlant_NONE;
++ rPropMap[ PROP_CharPosture ] <<= eSlant;
++ rPropMap[ PROP_CharPostureAsian ] <<= eSlant;
++ rPropMap[ PROP_CharPostureComplex ] <<= eSlant;
++ }
+
+ bool bUnderlineFillFollowText = moUnderlineFillFollowText.get( false );
+ if( moUnderline.has() && maUnderlineColor.isUsed() && !bUnderlineFillFollowText )
+@@ -152,10 +156,10 @@ void TextCharacterProperties::pushToPropMap( PropertyMap& rPropMap, const XmlFil
+ }
+ }
+
+-void TextCharacterProperties::pushToPropSet( PropertySet& rPropSet, const XmlFilterBase& rFilter ) const
++ void TextCharacterProperties::pushToPropSet( PropertySet& rPropSet, const XmlFilterBase& rFilter, bool bUseOptional ) const
+ {
+ PropertyMap aPropMap;
+- pushToPropMap( aPropMap, rFilter );
++ pushToPropMap( aPropMap, rFilter, bUseOptional );
+ rPropSet.setProperties( aPropMap );
+ }
+
More information about the Libreoffice-commits
mailing list