[Libreoffice-commits] .: 2 commits - oox/inc oox/source

Radek Doulík rodo at kemper.freedesktop.org
Wed Aug 17 04:15:44 PDT 2011


 oox/inc/oox/drawingml/textliststyle.hxx  |    4 ++
 oox/source/drawingml/shape.cxx           |    5 ++
 oox/source/drawingml/table/tablecell.cxx |   53 +++++++++++++++----------------
 oox/source/drawingml/textliststyle.cxx   |   11 ++++++
 oox/source/drawingml/textparagraph.cxx   |    3 +
 oox/source/ppt/pptshape.cxx              |    6 +--
 6 files changed, 51 insertions(+), 31 deletions(-)

New commits:
commit 83a0796604dedc039a3e65c02453b7de1429316d
Author: Radek Doulik <rodo at novell.com>
Date:   Wed Aug 17 13:12:52 2011 +0200

    fix how table style is applied
    
     - make sure it doesn't replace character properties of textbody inside cells
     - fixes bnc#705991

diff --git a/oox/source/drawingml/table/tablecell.cxx b/oox/source/drawingml/table/tablecell.cxx
index be51773..d4bbbcf 100644
--- a/oox/source/drawingml/table/tablecell.cxx
+++ b/oox/source/drawingml/table/tablecell.cxx
@@ -97,14 +97,15 @@ void applyBorder( TableStylePart& rTableStylePart, sal_Int32 nLineType, oox::dra
         rLineProperties.assignUsed( *aIter->second );
 }
 
-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,
-     oox::drawingml::LineProperties& rBottomBorder,
-     oox::drawingml::LineProperties& rTopLeftToBottomRightBorder,
-     oox::drawingml::LineProperties& rBottomLeftToTopRightBorder,
-    TableStylePart& rTableStylePart )
+void applyTableStylePart( oox::drawingml::FillProperties& rFillProperties,
+                          TextCharacterProperties& aTextCharProps,
+                          oox::drawingml::LineProperties& rLeftBorder,
+                          oox::drawingml::LineProperties& rRightBorder,
+                          oox::drawingml::LineProperties& rTopBorder,
+                          oox::drawingml::LineProperties& rBottomBorder,
+                          oox::drawingml::LineProperties& rTopLeftToBottomRightBorder,
+                          oox::drawingml::LineProperties& rBottomLeftToTopRightBorder,
+                          TableStylePart& rTableStylePart )
 {
     boost::shared_ptr< ::oox::drawingml::FillProperties >& rPartFillPropertiesPtr( rTableStylePart.getFillProperties() );
     if ( rPartFillPropertiesPtr.get() )
@@ -117,19 +118,16 @@ void applyTableStylePart( const ::oox::core::XmlFilterBase& rFilterBase, const R
     applyBorder( rTableStylePart, XML_tl2br, rTopLeftToBottomRightBorder );
     applyBorder( rTableStylePart, XML_tr2bl, rBottomLeftToTopRightBorder );
 
-    TextCharacterProperties aTextCharProps;
     aTextCharProps.maLatinFont = rTableStylePart.getLatinFont();
     aTextCharProps.maAsianFont = rTableStylePart.getAsianFont();
     aTextCharProps.maComplexFont = rTableStylePart.getComplexFont();
     aTextCharProps.maSymbolFont = rTableStylePart.getSymbolFont();
-    aTextCharProps.maCharColor = rTableStylePart.getTextColor();
+    if (rTableStylePart.getTextColor().isUsed())
+        aTextCharProps.maCharColor = rTableStylePart.getTextColor();
     if( rTableStylePart.getTextBoldStyle().is_initialized() )
         aTextCharProps.moBold = rTableStylePart.getTextBoldStyle();
     if( rTableStylePart.getTextItalicStyle().is_initialized() )
         aTextCharProps.moItalic = rTableStylePart.getTextItalicStyle();
-
-    PropertySet aPropSet( rxStart );
-    aTextCharProps.pushToPropSet( aPropSet, rFilterBase, true );
 }
 
 void applyTableCellProperties( const Reference < ::com::sun::star::table::XCell >& rxCell, const TableCell& rTableCell )
@@ -171,7 +169,6 @@ 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 );
@@ -189,7 +186,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
     if ( rBackgroundFillPropertiesPtr.get() )
         aFillProperties.assignUsed( *rBackgroundFillPropertiesPtr );
 
-    applyTableStylePart( rFilterBase, xStart, aFillProperties,
+    applyTableStylePart( aFillProperties, aTextStyleProps,
         aLinePropertiesLeft,
         aLinePropertiesRight,
         aLinePropertiesTop,
@@ -200,7 +197,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
 
     if ( rProperties.isFirstRow() && ( nRow == 0 ) )
     {
-        applyTableStylePart( rFilterBase, xStart, aFillProperties,
+        applyTableStylePart( aFillProperties, aTextStyleProps,
             aLinePropertiesLeft,
             aLinePropertiesRight,
             aLinePropertiesTop,
@@ -211,7 +208,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
     }
     if ( rProperties.isLastRow() && ( nRow == nMaxRow ) )
     {
-        applyTableStylePart( rFilterBase, xStart, aFillProperties,
+        applyTableStylePart( aFillProperties, aTextStyleProps,
             aLinePropertiesLeft,
             aLinePropertiesRight,
             aLinePropertiesTop,
@@ -222,7 +219,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
     }
     if ( rProperties.isFirstCol() && ( nColumn == 0 ) )
     {
-        applyTableStylePart( rFilterBase, xStart, aFillProperties,
+        applyTableStylePart( aFillProperties, aTextStyleProps,
             aLinePropertiesLeft,
             aLinePropertiesRight,
             aLinePropertiesTop,
@@ -233,7 +230,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
     }
     if ( rProperties.isLastCol() && ( nColumn == nMaxColumn ) )
     {
-        applyTableStylePart( rFilterBase, xStart, aFillProperties,
+        applyTableStylePart( aFillProperties, aTextStyleProps,
             aLinePropertiesLeft,
             aLinePropertiesRight,
             aLinePropertiesTop,
@@ -252,7 +249,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
                 nBand++;
             if ( nBand & 1 )
             {
-                applyTableStylePart( rFilterBase, xStart, aFillProperties,
+                applyTableStylePart( aFillProperties, aTextStyleProps,
                     aLinePropertiesLeft,
                     aLinePropertiesRight,
                     aLinePropertiesTop,
@@ -263,7 +260,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
             }
             else
             {
-                applyTableStylePart( rFilterBase, xStart, aFillProperties,
+                applyTableStylePart( aFillProperties, aTextStyleProps,
                     aLinePropertiesLeft,
                     aLinePropertiesRight,
                     aLinePropertiesTop,
@@ -276,7 +273,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
     }
     if ( ( nRow == 0 ) && ( nColumn == 0 ) )
     {
-        applyTableStylePart( rFilterBase, xStart, aFillProperties,
+        applyTableStylePart( aFillProperties, aTextStyleProps,
             aLinePropertiesLeft,
             aLinePropertiesRight,
             aLinePropertiesTop,
@@ -287,7 +284,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
     }
     if ( ( nRow == nMaxRow ) && ( nColumn == 0 ) )
     {
-        applyTableStylePart( rFilterBase, xStart, aFillProperties,
+        applyTableStylePart( aFillProperties, aTextStyleProps,
             aLinePropertiesLeft,
             aLinePropertiesRight,
             aLinePropertiesTop,
@@ -298,7 +295,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
     }
     if ( ( nRow == 0 ) && ( nColumn == nMaxColumn ) )
     {
-        applyTableStylePart( rFilterBase, xStart, aFillProperties,
+        applyTableStylePart( aFillProperties, aTextStyleProps,
             aLinePropertiesLeft,
             aLinePropertiesRight,
             aLinePropertiesTop,
@@ -309,7 +306,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
     }
     if ( ( nRow == nMaxColumn ) && ( nColumn == nMaxColumn ) )
     {
-        applyTableStylePart( rFilterBase, xStart, aFillProperties,
+        applyTableStylePart( aFillProperties, aTextStyleProps,
             aLinePropertiesLeft,
             aLinePropertiesRight,
             aLinePropertiesTop,
@@ -328,7 +325,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
                 nBand++;
             if ( nBand & 1 )
             {
-                applyTableStylePart( rFilterBase, xStart, aFillProperties,
+                applyTableStylePart( aFillProperties, aTextStyleProps,
                     aLinePropertiesLeft,
                     aLinePropertiesRight,
                     aLinePropertiesTop,
@@ -339,7 +336,7 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
             }
             else
             {
-                applyTableStylePart( rFilterBase, xStart, aFillProperties,
+                applyTableStylePart( aFillProperties, aTextStyleProps,
                     aLinePropertiesLeft,
                     aLinePropertiesRight,
                     aLinePropertiesTop,
@@ -368,6 +365,8 @@ void TableCell::pushToXCell( const ::oox::core::XmlFilterBase& rFilterBase, ::oo
     // TODO: phClr?
     aFillProperties.pushToPropMap( aPropMap, rFilterBase.getGraphicHelper() );
     PropertySet( xPropSet ).setProperties( aPropMap );
+
+    getTextBody()->insertAt( rFilterBase, xText, xAt, aTextStyleProps, pMasterTextListStyle );
 }
 
 } } }
diff --git a/oox/source/drawingml/textparagraph.cxx b/oox/source/drawingml/textparagraph.cxx
index 1f198b7..964932f 100644
--- a/oox/source/drawingml/textparagraph.cxx
+++ b/oox/source/drawingml/textparagraph.cxx
@@ -73,9 +73,10 @@ void TextParagraph::insertAt(
         if ( rListStyle.size() )
             pTextParagraphStyle = rListStyle[ nLevel ];
 
-        TextCharacterProperties aTextCharacterStyle( rTextStyleProperties );
+        TextCharacterProperties aTextCharacterStyle;
         if ( pTextParagraphStyle.get() )
             aTextCharacterStyle.assignUsed( pTextParagraphStyle->getTextCharacterProperties() );
+        aTextCharacterStyle.assignUsed( rTextStyleProperties );
         aTextCharacterStyle.assignUsed( maProperties.getTextCharacterProperties() );
 
         if( !bFirst )
commit dee4142489bb287bb8d506d3549957dea46a72c0
Author: Radek Doulik <rodo at novell.com>
Date:   Wed Aug 17 10:39:00 2011 +0200

    fixed regression of a57a4078fcd9a0490bd661e3ced6fcbbe69fae73
    
     - fixes bnc#705991

diff --git a/oox/inc/oox/drawingml/textliststyle.hxx b/oox/inc/oox/drawingml/textliststyle.hxx
index 29d8f29..5ce8ef7 100644
--- a/oox/inc/oox/drawingml/textliststyle.hxx
+++ b/oox/inc/oox/drawingml/textliststyle.hxx
@@ -51,6 +51,10 @@ public:
     inline const TextParagraphPropertiesVector& getAggregationListStyle() const { return maAggregationListStyle; };
     inline TextParagraphPropertiesVector&       getAggregationListStyle() { return maAggregationListStyle; };
 
+#if OSL_DEBUG_LEVEL > 0
+    void dump() const;
+#endif
+
 protected:
 
     TextParagraphPropertiesVector maListStyle;
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index dd68c3c..656df0b 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -232,6 +232,8 @@ void Shape::addShape(
 
 void Shape::applyShapeReference( const Shape& rReferencedShape )
 {
+    OSL_TRACE("apply shape reference: %s to shape id: %s", rtl::OUStringToOString(rReferencedShape.msId, RTL_TEXTENCODING_UTF8 ).getStr(), rtl::OUStringToOString(msId, RTL_TEXTENCODING_UTF8 ).getStr());
+
     if ( rReferencedShape.mpTextBody.get() )
         mpTextBody = TextBodyPtr( new TextBody( *rReferencedShape.mpTextBody.get() ) );
     else
@@ -534,6 +536,7 @@ Reference< XShape > Shape::createAndInsert(
                     if( pTheme )
                         if( const TextCharacterProperties* pCharProps = pTheme->getFontStyle( pFontRef->mnThemedIdx ) )
                             aCharStyleProperties.assignUsed( *pCharProps );
+                    OSL_TRACE("use font color");
                     aCharStyleProperties.maCharColor.assignIfUsed( pFontRef->maPhClr );
                 }
 
@@ -576,6 +579,8 @@ TextBodyPtr Shape::getTextBody()
 
 void Shape::setMasterTextListStyle( const TextListStylePtr& pMasterTextListStyle )
 {
+    OSL_TRACE("set master text list style to shape id: %s", rtl::OUStringToOString(msId, RTL_TEXTENCODING_UTF8 ).getStr());
+
     mpMasterTextListStyle = pMasterTextListStyle;
 }
 
diff --git a/oox/source/drawingml/textliststyle.cxx b/oox/source/drawingml/textliststyle.cxx
index 520c5d6..edd50f0 100644
--- a/oox/source/drawingml/textliststyle.cxx
+++ b/oox/source/drawingml/textliststyle.cxx
@@ -66,6 +66,17 @@ void TextListStyle::apply( const TextListStyle& rTextListStyle )
     applyStyleList( rTextListStyle.getListStyle(), getListStyle() );
 }
 
+#if OSL_DEBUG_LEVEL > 0
+void TextListStyle::dump() const
+{
+    for ( int i = 0; i < 9; i++ )
+    {
+        OSL_TRACE("text list style level: %d", i);
+        maListStyle[i]->dump();
+    }
+}
+#endif
+
 } }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/ppt/pptshape.cxx b/oox/source/ppt/pptshape.cxx
index fc3abfc..8ea04c4 100644
--- a/oox/source/ppt/pptshape.cxx
+++ b/oox/source/ppt/pptshape.cxx
@@ -142,6 +142,7 @@ void PPTShape::addShape(
             if ( sServiceName != OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.GraphicObjectShape")) &&
                  sServiceName != OUString(RTL_CONSTASCII_USTRINGPARAM("com.sun.star.drawing.OLE2Shape")) )
             {
+                OSL_TRACE("has master: %p", rSlidePersist.getMasterPersist().get());
                 switch( mnSubType )
                 {
                     case XML_ctrTitle :
@@ -228,9 +229,6 @@ void PPTShape::addShape(
 
             OSL_TRACE("shape service: %s", rtl::OUStringToOString(sServiceName, RTL_TEXTENCODING_UTF8 ).getStr());
 
-            if( mnSubType && aMasterTextListStyle && getSubTypeIndex() != -1 )
-                aMasterTextListStyle.reset();
-
             // use placeholder index if possible
             if( mnSubType && getSubTypeIndex() && getSubTypeIndex() != -1 && rSlidePersist.getMasterPersist().get() ) {
                 oox::drawingml::ShapePtr pPlaceholder = PPTShape::findPlaceholderByIndex( getSubTypeIndex(), rSlidePersist.getMasterPersist()->getShapes()->getChildren() );
@@ -253,6 +251,8 @@ void PPTShape::addShape(
                         // pPlaceholder->getMasterTextListStyle()->dump();
 
                         aMasterTextListStyle = pNewTextListStyle;
+                        // OSL_TRACE("combined master text list style");
+                        // aMasterTextListStyle->dump();
                     }
                     if( pPPTPlaceholder->mpPlaceholder.get() ) {
                         OSL_TRACE("placeholder has parent placeholder: %s type: %s index: %d",


More information about the Libreoffice-commits mailing list