[Libreoffice-commits] core.git: 7 commits - oox/source sw/inc sw/qa sw/source

Jacobo Aragunde Pérez jaragunde at igalia.com
Wed Apr 30 07:46:43 PDT 2014


 oox/source/drawingml/effectpropertiescontext.cxx             |   38 ++++
 oox/source/export/drawingml.cxx                              |  100 +++++++++--
 sw/inc/hints.hxx                                             |    2 
 sw/qa/extras/ooxmlexport/data/shape-effect-preservation.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx                  |   41 ++++
 sw/source/core/attr/hints.cxx                                |    7 
 sw/source/core/text/txtfrm.cxx                               |   22 +-
 sw/source/core/txtnode/thints.cxx                            |   20 +-
 8 files changed, 207 insertions(+), 23 deletions(-)

New commits:
commit ae4e79e7728b39bdb98f023d950dbbfa7c4c38d4
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Wed Apr 30 12:14:02 2014 +0200

    oox: Code protection against empty effects
    
    This is an extra check against clumsy programmers like me to prevent
    generating incorrect documents.
    
    Change-Id: I22261e3b6123a9a44461683519e33224f08adb5a

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index a1f00fd..1fde44a 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2251,20 +2251,23 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
         }
     }
 
-    mpFS->startElementNS(XML_a, XML_effectLst, FSEND);
-    sax_fastparser::XFastAttributeListRef xAttrList( aOuterShdwAttrList );
-    mpFS->startElement( nEffectToken, xAttrList );
-
-    if( bContainsColor )
+    if( nEffectToken > 0 )
     {
-        if( sSchemeClr.isEmpty() )
-            WriteColor( nRgbClr, nAlpha );
-        else
-            WriteColor( sSchemeClr, aTransformations );
-    }
+        mpFS->startElementNS(XML_a, XML_effectLst, FSEND);
+        sax_fastparser::XFastAttributeListRef xAttrList( aOuterShdwAttrList );
+        mpFS->startElement( nEffectToken, xAttrList );
 
-    mpFS->endElement( nEffectToken );
-    mpFS->endElementNS(XML_a, XML_effectLst);
+        if( bContainsColor )
+        {
+            if( sSchemeClr.isEmpty() )
+                WriteColor( nRgbClr, nAlpha );
+            else
+                WriteColor( sSchemeClr, aTransformations );
+        }
+
+        mpFS->endElement( nEffectToken );
+        mpFS->endElementNS(XML_a, XML_effectLst);
+    }
 }
 
 }
commit 2310af236659f4fdd4c26b1e277e568d04a20687
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Wed Apr 30 11:18:49 2014 +0200

    ooxml: Preserve blur effect on shapes.
    
    Reused the code for other effects just adding the new attribute
    "grow".
    
    I didn't add a unit test for this effect because I found no way to
    apply it to an object in Word, but it's technically part of the
    standard.
    
    Change-Id: I391aff17f59d49d6bf339a71481dcdb51c537c9e

diff --git a/oox/source/drawingml/effectpropertiescontext.cxx b/oox/source/drawingml/effectpropertiescontext.cxx
index 6699678..2493ec9 100644
--- a/oox/source/drawingml/effectpropertiescontext.cxx
+++ b/oox/source/drawingml/effectpropertiescontext.cxx
@@ -80,6 +80,9 @@ void EffectPropertiesContext::saveUnsupportedAttribs( const AttributeList& rAttr
     if( rAttribs.hasAttribute( XML_stPos ) )
         mrEffectProperties.appendUnsupportedEffectAttrib( "stPos",
                                                           makeAny( rAttribs.getInteger( XML_stPos, 0 ) ) );
+    if( rAttribs.hasAttribute( XML_grow ) )
+        mrEffectProperties.appendUnsupportedEffectAttrib( "grow",
+                                                          makeAny( rAttribs.getInteger( XML_grow, 0 ) ) );
 }
 
 ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
@@ -109,6 +112,7 @@ ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement,
         case A_TOKEN( glow ):
         case A_TOKEN( softEdge ):
         case A_TOKEN( reflection ):
+        case A_TOKEN( blur ):
         {
             if( nElement == A_TOKEN( glow ) )
                 mrEffectProperties.msUnsupportedEffectName = "glow";
@@ -116,6 +120,8 @@ ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement,
                 mrEffectProperties.msUnsupportedEffectName = "softEdge";
             else if( nElement == A_TOKEN( reflection ) )
                 mrEffectProperties.msUnsupportedEffectName = "reflection";
+            else if( nElement == A_TOKEN( blur ) )
+                mrEffectProperties.msUnsupportedEffectName = "blur";
             saveUnsupportedAttribs( rAttribs );
             return new ColorContext( *this, mrEffectProperties.maShadow.moShadowColor );
         }
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 8cf14e3..a1f00fd 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2102,7 +2102,7 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
     {
         if( aEffectProps[i].Name == "outerShdw" || aEffectProps[i].Name == "innerShdw"
                 || aEffectProps[i].Name == "glow" || aEffectProps[i].Name == "softEdge"
-                || aEffectProps[i].Name == "reflection" )
+                || aEffectProps[i].Name == "reflection" || aEffectProps[i].Name == "blur" )
         {
             // assign the proper tag and enable bContainsColor if necessary
             if( aEffectProps[i].Name == "outerShdw" )
@@ -2124,6 +2124,8 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
                 nEffectToken = FSNS( XML_a, XML_softEdge );
             else if( aEffectProps[i].Name == "reflection" )
                 nEffectToken = FSNS( XML_a, XML_reflection );
+            else if( aEffectProps[i].Name == "blur" )
+                nEffectToken = FSNS( XML_a, XML_blur );
 
             // read tag attributes
             uno::Sequence< beans::PropertyValue > aOuterShdwProps;
@@ -2220,6 +2222,12 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
                     aOuterShdwProps[j].Value >>= nVal;
                     aOuterShdwAttrList->add( XML_stPos, OString::number( nVal ).getStr() );
                 }
+                else if( aOuterShdwProps[j].Name == "grow" )
+                {
+                    sal_Int32 nVal = 0;
+                    aOuterShdwProps[j].Value >>= nVal;
+                    aOuterShdwAttrList->add( XML_grow, OString::number( nVal ).getStr() );
+                }
             }
         }
         else if(aEffectProps[i].Name == "ShadowRgbClr")
commit f519bfdef11d7b14fbdc7bdbeb286783e08416ed
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Tue Apr 29 20:28:18 2014 +0200

    ooxml: Preserve reflection effect on shapes.
    
    Reused most of the code of other effects, but adding some new
    attributes specific for this effect. Finally, modified an existing
    unit test to add a check for reflection.
    
    Change-Id: Iffd0c1203e9c66a8d7b7f748d98d9c3ef01c7bbf

diff --git a/oox/source/drawingml/effectpropertiescontext.cxx b/oox/source/drawingml/effectpropertiescontext.cxx
index 8a2a6f4..6699678 100644
--- a/oox/source/drawingml/effectpropertiescontext.cxx
+++ b/oox/source/drawingml/effectpropertiescontext.cxx
@@ -65,6 +65,21 @@ void EffectPropertiesContext::saveUnsupportedAttribs( const AttributeList& rAttr
     if( rAttribs.hasAttribute( XML_rad ) )
         mrEffectProperties.appendUnsupportedEffectAttrib( "rad",
                                                           makeAny( rAttribs.getInteger( XML_rad, 0 ) ) );
+    if( rAttribs.hasAttribute( XML_endA ) )
+        mrEffectProperties.appendUnsupportedEffectAttrib( "endA",
+                                                          makeAny( rAttribs.getInteger( XML_endA, 0 ) ) );
+    if( rAttribs.hasAttribute( XML_endPos ) )
+        mrEffectProperties.appendUnsupportedEffectAttrib( "endPos",
+                                                          makeAny( rAttribs.getInteger( XML_endPos, 0 ) ) );
+    if( rAttribs.hasAttribute( XML_fadeDir ) )
+        mrEffectProperties.appendUnsupportedEffectAttrib( "fadeDir",
+                                                          makeAny( rAttribs.getInteger( XML_fadeDir, 0 ) ) );
+    if( rAttribs.hasAttribute( XML_stA ) )
+        mrEffectProperties.appendUnsupportedEffectAttrib( "stA",
+                                                          makeAny( rAttribs.getInteger( XML_stA, 0 ) ) );
+    if( rAttribs.hasAttribute( XML_stPos ) )
+        mrEffectProperties.appendUnsupportedEffectAttrib( "stPos",
+                                                          makeAny( rAttribs.getInteger( XML_stPos, 0 ) ) );
 }
 
 ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
@@ -93,11 +108,14 @@ ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement,
         break;
         case A_TOKEN( glow ):
         case A_TOKEN( softEdge ):
+        case A_TOKEN( reflection ):
         {
             if( nElement == A_TOKEN( glow ) )
                 mrEffectProperties.msUnsupportedEffectName = "glow";
-            else
+            else if( nElement == A_TOKEN( softEdge ) )
                 mrEffectProperties.msUnsupportedEffectName = "softEdge";
+            else if( nElement == A_TOKEN( reflection ) )
+                mrEffectProperties.msUnsupportedEffectName = "reflection";
             saveUnsupportedAttribs( rAttribs );
             return new ColorContext( *this, mrEffectProperties.maShadow.moShadowColor );
         }
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 84a6e0f..8cf14e3 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2101,7 +2101,8 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
     for( sal_Int32 i=0; i < aEffectProps.getLength(); ++i )
     {
         if( aEffectProps[i].Name == "outerShdw" || aEffectProps[i].Name == "innerShdw"
-                || aEffectProps[i].Name == "glow" || aEffectProps[i].Name == "softEdge" )
+                || aEffectProps[i].Name == "glow" || aEffectProps[i].Name == "softEdge"
+                || aEffectProps[i].Name == "reflection" )
         {
             // assign the proper tag and enable bContainsColor if necessary
             if( aEffectProps[i].Name == "outerShdw" )
@@ -2121,6 +2122,8 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
             }
             else if( aEffectProps[i].Name == "softEdge" )
                 nEffectToken = FSNS( XML_a, XML_softEdge );
+            else if( aEffectProps[i].Name == "reflection" )
+                nEffectToken = FSNS( XML_a, XML_reflection );
 
             // read tag attributes
             uno::Sequence< beans::PropertyValue > aOuterShdwProps;
@@ -2187,6 +2190,36 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
                     aOuterShdwProps[j].Value >>= nVal;
                     aOuterShdwAttrList->add( XML_rad, OString::number( nVal ).getStr() );
                 }
+                else if( aOuterShdwProps[j].Name == "endA" )
+                {
+                    sal_Int32 nVal = 0;
+                    aOuterShdwProps[j].Value >>= nVal;
+                    aOuterShdwAttrList->add( XML_endA, OString::number( nVal ).getStr() );
+                }
+                else if( aOuterShdwProps[j].Name == "endPos" )
+                {
+                    sal_Int32 nVal = 0;
+                    aOuterShdwProps[j].Value >>= nVal;
+                    aOuterShdwAttrList->add( XML_endPos, OString::number( nVal ).getStr() );
+                }
+                else if( aOuterShdwProps[j].Name == "fadeDir" )
+                {
+                    sal_Int32 nVal = 0;
+                    aOuterShdwProps[j].Value >>= nVal;
+                    aOuterShdwAttrList->add( XML_fadeDir, OString::number( nVal ).getStr() );
+                }
+                else if( aOuterShdwProps[j].Name == "stA" )
+                {
+                    sal_Int32 nVal = 0;
+                    aOuterShdwProps[j].Value >>= nVal;
+                    aOuterShdwAttrList->add( XML_stA, OString::number( nVal ).getStr() );
+                }
+                else if( aOuterShdwProps[j].Name == "stPos" )
+                {
+                    sal_Int32 nVal = 0;
+                    aOuterShdwProps[j].Value >>= nVal;
+                    aOuterShdwAttrList->add( XML_stPos, OString::number( nVal ).getStr() );
+                }
             }
         }
         else if(aEffectProps[i].Name == "ShadowRgbClr")
diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
index f65f535..6ec9982 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
@@ -1125,6 +1125,23 @@ DECLARE_OOXMLEXPORT_TEST(testShapeEffectPreservation, "shape-effect-preservation
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow/a:schemeClr/a:alpha",
             "val", "40000");
+
+    // 6th shape with reflection
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[7]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection",
+            "blurRad", "6350");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[7]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection",
+            "stA", "50000");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[7]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection",
+            "endA", "300");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[7]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection",
+            "endPos", "55500");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[7]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:reflection/*",
+            0 ); // should not be present
 }
 
 DECLARE_OOXMLEXPORT_TEST(fdo77719, "fdo77719.docx")
commit 9a61470eb1fa161cba70f2e9c4ea8817dc7f617e
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Tue Apr 29 20:16:36 2014 +0200

    ooxml: Preserve glow effect on shapes.
    
    Reused most of the code of outerShdw and innerShdw effects. Modified
    an existing unit test to add a check for innerShdw.
    
    Change-Id: I7328fe696721d28c35b26ca1b702c7f64c63ab21

diff --git a/oox/source/drawingml/effectpropertiescontext.cxx b/oox/source/drawingml/effectpropertiescontext.cxx
index 90e7050..8a2a6f4 100644
--- a/oox/source/drawingml/effectpropertiescontext.cxx
+++ b/oox/source/drawingml/effectpropertiescontext.cxx
@@ -91,9 +91,13 @@ ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement,
             return new ColorContext( *this, mrEffectProperties.maShadow.moShadowColor );
         }
         break;
+        case A_TOKEN( glow ):
         case A_TOKEN( softEdge ):
         {
-            mrEffectProperties.msUnsupportedEffectName = "softEdge";
+            if( nElement == A_TOKEN( glow ) )
+                mrEffectProperties.msUnsupportedEffectName = "glow";
+            else
+                mrEffectProperties.msUnsupportedEffectName = "softEdge";
             saveUnsupportedAttribs( rAttribs );
             return new ColorContext( *this, mrEffectProperties.maShadow.moShadowColor );
         }
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index e9b4b2b..84a6e0f 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2101,7 +2101,7 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
     for( sal_Int32 i=0; i < aEffectProps.getLength(); ++i )
     {
         if( aEffectProps[i].Name == "outerShdw" || aEffectProps[i].Name == "innerShdw"
-                || aEffectProps[i].Name == "softEdge" )
+                || aEffectProps[i].Name == "glow" || aEffectProps[i].Name == "softEdge" )
         {
             // assign the proper tag and enable bContainsColor if necessary
             if( aEffectProps[i].Name == "outerShdw" )
@@ -2114,6 +2114,11 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
                 nEffectToken = FSNS( XML_a, XML_innerShdw );
                 bContainsColor = true;
             }
+            else if( aEffectProps[i].Name == "glow" )
+            {
+                nEffectToken = FSNS( XML_a, XML_glow );
+                bContainsColor = true;
+            }
             else if( aEffectProps[i].Name == "softEdge" )
                 nEffectToken = FSNS( XML_a, XML_softEdge );
 
diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
index 9a213e3..f65f535 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
@@ -1111,6 +1111,20 @@ DECLARE_OOXMLEXPORT_TEST(testShapeEffectPreservation, "shape-effect-preservation
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:softEdge/*",
             0 ); // should not be present
+
+    // 5th shape with glow effect, scheme color
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow",
+            "rad", "101600");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow/a:schemeClr",
+            "val", "accent2");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow/a:schemeClr/a:satMod",
+            "val", "175000");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[6]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:glow/a:schemeClr/a:alpha",
+            "val", "40000");
 }
 
 DECLARE_OOXMLEXPORT_TEST(fdo77719, "fdo77719.docx")
commit 5b3f88bfea3111e9b9fb26ef9d84f9018c11ab7e
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Tue Apr 29 19:55:35 2014 +0200

    ooxml: Preserve soft edge effect on shapes.
    
    Reused most of the code of outerShdw and innerShdw effects, but adding
    a new attribute "rad" and a flag to check if a color definition must
    be written inside the effect definition. Finally, modified an existing
    unit test to add a check for softEdge.
    
    Change-Id: I0d32714bde9a5b05c726acd47b85b1dea3c6a581

diff --git a/oox/source/drawingml/effectpropertiescontext.cxx b/oox/source/drawingml/effectpropertiescontext.cxx
index 40f7318..90e7050 100644
--- a/oox/source/drawingml/effectpropertiescontext.cxx
+++ b/oox/source/drawingml/effectpropertiescontext.cxx
@@ -62,6 +62,9 @@ void EffectPropertiesContext::saveUnsupportedAttribs( const AttributeList& rAttr
     if( rAttribs.hasAttribute( XML_sy ) )
         mrEffectProperties.appendUnsupportedEffectAttrib( "sy",
                                                           makeAny( rAttribs.getInteger( XML_sy, 0 ) ) );
+    if( rAttribs.hasAttribute( XML_rad ) )
+        mrEffectProperties.appendUnsupportedEffectAttrib( "rad",
+                                                          makeAny( rAttribs.getInteger( XML_rad, 0 ) ) );
 }
 
 ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs )
@@ -88,6 +91,13 @@ ContextHandlerRef EffectPropertiesContext::onCreateContext( sal_Int32 nElement,
             return new ColorContext( *this, mrEffectProperties.maShadow.moShadowColor );
         }
         break;
+        case A_TOKEN( softEdge ):
+        {
+            mrEffectProperties.msUnsupportedEffectName = "softEdge";
+            saveUnsupportedAttribs( rAttribs );
+            return new ColorContext( *this, mrEffectProperties.maShadow.moShadowColor );
+        }
+        break;
     }
 
     return 0;
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index ece1fa2..e9b4b2b 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2092,6 +2092,7 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
         return;
 
     OUString sSchemeClr;
+    bool bContainsColor = false;
     sal_uInt32 nRgbClr = 0;
     sal_Int32 nEffectToken = 0;
     sal_Int32 nAlpha = MAX_PERCENT;
@@ -2099,11 +2100,24 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
     sax_fastparser::FastAttributeList *aOuterShdwAttrList = mpFS->createAttrList();
     for( sal_Int32 i=0; i < aEffectProps.getLength(); ++i )
     {
-        if( aEffectProps[i].Name == "outerShdw" || aEffectProps[i].Name == "innerShdw" )
+        if( aEffectProps[i].Name == "outerShdw" || aEffectProps[i].Name == "innerShdw"
+                || aEffectProps[i].Name == "softEdge" )
         {
-            nEffectToken = ( aEffectProps[i].Name == "outerShdw") ?
-                    FSNS( XML_a, XML_outerShdw ) :
-                    FSNS( XML_a, XML_innerShdw );
+            // assign the proper tag and enable bContainsColor if necessary
+            if( aEffectProps[i].Name == "outerShdw" )
+            {
+                nEffectToken = FSNS( XML_a, XML_outerShdw );
+                bContainsColor = true;
+            }
+            else if( aEffectProps[i].Name == "innerShdw" )
+            {
+                nEffectToken = FSNS( XML_a, XML_innerShdw );
+                bContainsColor = true;
+            }
+            else if( aEffectProps[i].Name == "softEdge" )
+                nEffectToken = FSNS( XML_a, XML_softEdge );
+
+            // read tag attributes
             uno::Sequence< beans::PropertyValue > aOuterShdwProps;
             aEffectProps[i].Value >>= aOuterShdwProps;
             for( sal_Int32 j=0; j < aOuterShdwProps.getLength(); ++j )
@@ -2162,6 +2176,12 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
                     aOuterShdwProps[j].Value >>= nVal;
                     aOuterShdwAttrList->add( XML_sy, OString::number( nVal ).getStr() );
                 }
+                else if( aOuterShdwProps[j].Name == "rad" )
+                {
+                    sal_Int32 nVal = 0;
+                    aOuterShdwProps[j].Value >>= nVal;
+                    aOuterShdwAttrList->add( XML_rad, OString::number( nVal ).getStr() );
+                }
             }
         }
         else if(aEffectProps[i].Name == "ShadowRgbClr")
@@ -2189,10 +2209,13 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
     sax_fastparser::XFastAttributeListRef xAttrList( aOuterShdwAttrList );
     mpFS->startElement( nEffectToken, xAttrList );
 
-    if( sSchemeClr.isEmpty() )
-        WriteColor( nRgbClr, nAlpha );
-    else
-        WriteColor( sSchemeClr, aTransformations );
+    if( bContainsColor )
+    {
+        if( sSchemeClr.isEmpty() )
+            WriteColor( nRgbClr, nAlpha );
+        else
+            WriteColor( sSchemeClr, aTransformations );
+    }
 
     mpFS->endElement( nEffectToken );
     mpFS->endElementNS(XML_a, XML_effectLst);
diff --git a/sw/qa/extras/ooxmlexport/data/shape-effect-preservation.docx b/sw/qa/extras/ooxmlexport/data/shape-effect-preservation.docx
index 35c7aba..bd0ac80 100644
Binary files a/sw/qa/extras/ooxmlexport/data/shape-effect-preservation.docx and b/sw/qa/extras/ooxmlexport/data/shape-effect-preservation.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
index 50ce902..9a213e3 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
@@ -1087,7 +1087,7 @@ DECLARE_OOXMLEXPORT_TEST(testShapeEffectPreservation, "shape-effect-preservation
             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:outerShdw/a:schemeClr/a:alpha",
             "val", "40000");
 
-    // second shape with inner shadow, rgb color
+    // third shape with inner shadow, rgb color
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw",
             "blurRad", "63500");
@@ -1103,6 +1103,14 @@ DECLARE_OOXMLEXPORT_TEST(testShapeEffectPreservation, "shape-effect-preservation
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[3]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:innerShdw/a:srgbClr/a:alpha",
             "val", "50000");
+
+    // 4th shape with soft edge
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:softEdge",
+            "rad", "127000");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[5]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:effectLst/a:softEdge/*",
+            0 ); // should not be present
 }
 
 DECLARE_OOXMLEXPORT_TEST(fdo77719, "fdo77719.docx")
commit dddae1f0b950f1ce8ab4bcd24991f1917fa36aa6
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Sat Apr 26 12:21:00 2014 +0200

    fdo#71556: Remove unwanted a11y event on text insertion
    
    The accessibility event text-attributes-changed was being emitted
    every time we typed because typing implies changing the RSID internal
    format attribute. This change was triggering the event but it
    shouldn't, as it is an invisible attribute.
    
    I had added a new member to SwUpdateAttr class to be able to indicate
    which format attributes are being changed (until now, it just
    indicated that some attribute changed with RES_TXTATR_AUTOFMT and no
    more details). This member is populated when an SwUpdateAttr object
    is being created for a RES_TXTATR_AUTOFMT. Finally, I check the
    contents of this list to look for relevant a11y attributes before
    issuing the events, if there aren't then no events are issued.
    
    Change-Id: Ieaedf888ccc1bff9c7af64a1412ca1d3b5411351

diff --git a/sw/inc/hints.hxx b/sw/inc/hints.hxx
index 82eb27c..be1f1ac 100644
--- a/sw/inc/hints.hxx
+++ b/sw/inc/hints.hxx
@@ -99,7 +99,9 @@ public:
     sal_Int32 nStart;
     sal_Int32 nEnd;
     sal_uInt16 nWhichAttr;
+    std::vector<sal_uInt16> aWhichFmtAttr; // attributes changed inside RES_TXTATR_AUTOFMT
     SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW );
+    SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW, std::vector<sal_uInt16> aW );
 };
 
 /** SwRefMarkFldUpdate is sent when the referencemarks should be updated.
diff --git a/sw/source/core/attr/hints.cxx b/sw/source/core/attr/hints.cxx
index 44614b8..9b0f6a6 100644
--- a/sw/source/core/attr/hints.cxx
+++ b/sw/source/core/attr/hints.cxx
@@ -45,7 +45,12 @@ SwDelTxt::SwDelTxt( sal_Int32 nS, sal_Int32 nL )
 }
 
 SwUpdateAttr::SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW )
-    : SwMsgPoolItem( RES_UPDATE_ATTR ), nStart( nS ), nEnd( nE ), nWhichAttr( nW )
+    : SwMsgPoolItem( RES_UPDATE_ATTR ), nStart( nS ), nEnd( nE ), nWhichAttr( nW ), aWhichFmtAttr()
+{
+}
+
+SwUpdateAttr::SwUpdateAttr( sal_Int32 nS, sal_Int32 nE, sal_uInt16 nW, std::vector<sal_uInt16> aW )
+    : SwMsgPoolItem( RES_UPDATE_ATTR ), nStart( nS ), nEnd( nE ), nWhichAttr( nW ), aWhichFmtAttr( aW )
 {
 }
 
diff --git a/sw/source/core/text/txtfrm.cxx b/sw/source/core/text/txtfrm.cxx
index 0139fd7..1da7fa4 100644
--- a/sw/source/core/text/txtfrm.cxx
+++ b/sw/source/core/text/txtfrm.cxx
@@ -845,6 +845,16 @@ static bool isA11yRelevantAttribute(MSHORT nWhich)
     return nWhich != RES_CHRATR_RSID;
 }
 
+static bool hasA11yRelevantAttribute( const std::vector<MSHORT>& nWhich )
+{
+    for( std::vector<MSHORT>::const_iterator nItr = nWhich.begin();
+            nItr < nWhich.end(); ++nItr )
+        if ( isA11yRelevantAttribute( *nItr ) )
+            return true;
+
+    return false;
+}
+
 void SwTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
 {
     const MSHORT nWhich = pOld ? pOld->Which() : pNew ? pNew->Which() : 0;
@@ -967,11 +977,15 @@ void SwTxtFrm::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew )
                 }
             }
 
-            // #i104008#
-            SwViewShell* pViewSh = getRootFrm() ? getRootFrm()->GetCurrShell() : 0;
-            if ( pViewSh  )
+            if( isA11yRelevantAttribute( ((SwUpdateAttr*)pNew)->nWhichAttr ) &&
+                    hasA11yRelevantAttribute( ((SwUpdateAttr*)pNew)->aWhichFmtAttr ) )
             {
-                pViewSh->InvalidateAccessibleParaAttrs( *this );
+                // #i104008#
+                SwViewShell* pViewSh = getRootFrm() ? getRootFrm()->GetCurrShell() : 0;
+                if ( pViewSh  )
+                {
+                    pViewSh->InvalidateAccessibleParaAttrs( *this );
+                }
             }
         }
         break;
diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx
index 60336fb1..cae6296 100644
--- a/sw/source/core/txtnode/thints.cxx
+++ b/sw/source/core/txtnode/thints.cxx
@@ -2955,6 +2955,7 @@ bool SwpHints::TryInsertHint(
 
     sal_Int32 *pHtEnd = pHint->GetEnd();
     sal_uInt16 nWhich = pHint->Which();
+    std::vector<sal_uInt16> aWhichSublist;
 
     switch( nWhich )
     {
@@ -2972,10 +2973,9 @@ bool SwpHints::TryInsertHint(
     // #i75430# Recalc hidden flags if necessary
     case RES_TXTATR_AUTOFMT:
     {
+        boost::shared_ptr<SfxItemSet> const pSet( pHint->GetAutoFmt().GetStyleHandle() );
         if (*pHint->GetStart() == *pHint->GetEnd())
         {
-            boost::shared_ptr<SfxItemSet> const pSet(
-                    pHint->GetAutoFmt().GetStyleHandle());
             if (pSet->Count() == 1 && pSet->GetItem(RES_CHRATR_RSID, false))
             {   // empty range RSID-only hints could cause trouble, there's no
                 rNode.DestroyAttr(pHint); // need for them so don't insert
@@ -2986,6 +2986,19 @@ bool SwpHints::TryInsertHint(
         const SfxPoolItem* pHiddenItem = CharFmt::GetItem( *pHint, RES_CHRATR_HIDDEN );
         if ( pHiddenItem )
             rNode.SetCalcHiddenCharFlags();
+
+        // fdo#71556: populate aWhichFmtAttr member of SwMsgPoolItem
+        const sal_uInt16 *pRanges = pSet->GetRanges();
+        while( (*pRanges) != 0 )
+        {
+            sal_uInt16 nBeg = (*pRanges);
+            ++pRanges;
+            sal_uInt16 nEnd = (*pRanges);
+            ++pRanges;
+            for( sal_uInt16 nSubElem = nBeg; nSubElem <= nEnd; ++nSubElem )
+                if( pSet->HasItem( nSubElem ) )
+                    aWhichSublist.push_back( nSubElem );
+        }
         break;
     }
     case RES_TXTATR_INETFMT:
@@ -3237,7 +3250,8 @@ bool SwpHints::TryInsertHint(
     // ... und die Abhaengigen benachrichtigen
     if ( rNode.GetDepends() )
     {
-        SwUpdateAttr aHint( nHtStart, nHtStart == nHintEnd ? nHintEnd + 1 : nHintEnd, nWhich );
+        SwUpdateAttr aHint( nHtStart, nHtStart == nHintEnd ? nHintEnd + 1 : nHintEnd,
+                nWhich, aWhichSublist );
         rNode.ModifyNotification( 0, &aHint );
     }
 
commit 62f6bb72f00e30427e29b499c24432f5f980fa9f
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Thu Apr 24 12:36:16 2014 +0200

    oox: syntax fix: wrong index
    
    Change-Id: I8b76da14c75050f60b0af10cdadda821484db4f1

diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 5cdc69c..ece1fa2 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2105,7 +2105,7 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
                     FSNS( XML_a, XML_outerShdw ) :
                     FSNS( XML_a, XML_innerShdw );
             uno::Sequence< beans::PropertyValue > aOuterShdwProps;
-            aEffectProps[0].Value >>= aOuterShdwProps;
+            aEffectProps[i].Value >>= aOuterShdwProps;
             for( sal_Int32 j=0; j < aOuterShdwProps.getLength(); ++j )
             {
                 if( aOuterShdwProps[j].Name == "algn" )


More information about the Libreoffice-commits mailing list