[Libreoffice-commits] core.git: 4 commits - include/oox oox/Library_oox.mk oox/source sw/qa sw/source writerfilter/source

Jacobo Aragunde Pérez jaragunde at igalia.com
Tue May 6 07:33:15 PDT 2014


 include/oox/drawingml/scene3dcontext.hxx                    |   12 
 include/oox/drawingml/shape3dproperties.hxx                 |   81 +-----
 include/oox/export/drawingml.hxx                            |    1 
 oox/Library_oox.mk                                          |    1 
 oox/source/drawingml/scene3dcontext.cxx                     |  150 ++----------
 oox/source/drawingml/shape.cxx                              |    6 
 oox/source/drawingml/shape3dproperties.cxx                  |  115 +++++++++
 oox/source/drawingml/shapepropertiescontext.cxx             |    4 
 oox/source/export/drawingml.cxx                             |   75 ++++++
 oox/source/export/shapes.cxx                                |    1 
 sw/qa/extras/ooxmlexport/data/table-theme-preservation.docx |binary
 sw/qa/extras/ooxmlexport/ooxmlexport.cxx                    |    4 
 sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx                 |   32 ++
 sw/source/filter/ww8/docxattributeoutput.cxx                |   11 
 writerfilter/source/dmapper/CellColorHandler.cxx            |   13 +
 writerfilter/source/dmapper/TablePropertiesHandler.cxx      |    2 
 16 files changed, 318 insertions(+), 190 deletions(-)

New commits:
commit 36e22e83a1ca3106d6ef3fbb6ba066a447a65601
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Tue May 6 12:45:54 2014 +0200

    oox: preserve camera rotation on shape 3D effects.
    
    Camera options in shape 3D effects can have rotation settings like in
    the following example:
    
      <a:camera prst="perspectiveRelaxedModerately" zoom="150000">
         <a:rot lat="19490639" lon="0" rev="12900001"/>
      </a:camera>
    
    This patch preserves the a:rot tag and its attributes using the
    shape grab bag. We created the class Scene3DRotationPropertiesContext
    to be piled on top of a Scene3DPropertiesContext and process the
    contents of the child item. It also adds a unit test for this case.
    
    Change-Id: Id6bf58ad05fe5b49061619b6750ed0658badc9af

diff --git a/include/oox/drawingml/scene3dcontext.hxx b/include/oox/drawingml/scene3dcontext.hxx
index bbee4e6..82af76e 100644
--- a/include/oox/drawingml/scene3dcontext.hxx
+++ b/include/oox/drawingml/scene3dcontext.hxx
@@ -27,6 +27,17 @@ namespace oox { namespace drawingml {
 
 struct Shape3DProperties;
 
+class Scene3DRotationPropertiesContext : public ::oox::core::ContextHandler2
+{
+public:
+    Scene3DRotationPropertiesContext( ::oox::core::ContextHandler2Helper& rParent, RotationProperties& rRotationProperties ) throw();
+
+    ::oox::core::ContextHandlerRef onCreateContext( ::sal_Int32 Element, const ::oox::AttributeList& rAttribs ) SAL_OVERRIDE;
+
+private:
+    RotationProperties& mrRotationProperties;
+};
+
 class Scene3DPropertiesContext : public ::oox::core::ContextHandler2
 {
 public:
diff --git a/include/oox/drawingml/shape3dproperties.hxx b/include/oox/drawingml/shape3dproperties.hxx
index 9d89753..efce9e0 100644
--- a/include/oox/drawingml/shape3dproperties.hxx
+++ b/include/oox/drawingml/shape3dproperties.hxx
@@ -36,6 +36,13 @@ namespace drawingml {
 
 
 
+struct RotationProperties
+{
+    OptValue< sal_Int32 > mnLatitude;
+    OptValue< sal_Int32 > mnLongitude;
+    OptValue< sal_Int32 > mnRevolution;
+};
+
 struct Shape3DProperties
 {
     OptValue< sal_Int32 > mnPreset;
@@ -43,6 +50,7 @@ struct Shape3DProperties
     OptValue< float > mfZoom;
     OptValue< sal_Int32 > mnLightRigDirection;
     OptValue< sal_Int32 > mnLightRigType;
+    RotationProperties maCameraRotation;
 
     /** Overwrites all members that are explicitly set in rSourceProps. */
     void                assignUsed( const Shape3DProperties& rSourceProps );
diff --git a/oox/source/drawingml/scene3dcontext.cxx b/oox/source/drawingml/scene3dcontext.cxx
index c9855e1..21c564c 100644
--- a/oox/source/drawingml/scene3dcontext.cxx
+++ b/oox/source/drawingml/scene3dcontext.cxx
@@ -52,8 +52,9 @@ ContextHandlerRef Scene3DPropertiesContext::onCreateContext( sal_Int32 aElementT
             mr3DProperties.mfZoom = rAttribs.getInteger( XML_zoom, 100000 ) / 100000.0;
         if( rAttribs.hasAttribute( XML_prst ) )
             mr3DProperties.mnPreset = rAttribs.getToken( XML_prst, XML_none );
-        // TODO: nested element XML_rot
-        break;
+
+        return new Scene3DRotationPropertiesContext( *this, mr3DProperties.maCameraRotation );
+
     case A_TOKEN( lightRig ):
         mr3DProperties.mnLightRigDirection = rAttribs.getToken( XML_dir, XML_none );
         mr3DProperties.mnLightRigType = rAttribs.getToken( XML_rig, XML_none );
@@ -66,6 +67,25 @@ ContextHandlerRef Scene3DPropertiesContext::onCreateContext( sal_Int32 aElementT
     return 0;
 }
 
+Scene3DRotationPropertiesContext::Scene3DRotationPropertiesContext( ContextHandler2Helper& rParent, RotationProperties& rRotationProperties ) throw()
+: ContextHandler2( rParent )
+, mrRotationProperties( rRotationProperties )
+{
+}
+
+ContextHandlerRef Scene3DRotationPropertiesContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
+{
+    switch( aElementToken )
+    {
+    case A_TOKEN( rot ):
+        mrRotationProperties.mnLatitude = rAttribs.getInteger( XML_lat, 0 );
+        mrRotationProperties.mnLongitude = rAttribs.getInteger( XML_lon, 0 );
+        mrRotationProperties.mnRevolution = rAttribs.getInteger( XML_rev, 0 );
+        break;
+    }
+    return 0;
+}
+
 } }
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/shape3dproperties.cxx b/oox/source/drawingml/shape3dproperties.cxx
index 86498aa..853ed46 100644
--- a/oox/source/drawingml/shape3dproperties.cxx
+++ b/oox/source/drawingml/shape3dproperties.cxx
@@ -120,7 +120,7 @@ OUString Shape3DProperties::getCameraPrstName( sal_Int32 nElement )
 
 css::uno::Sequence< css::beans::PropertyValue > Shape3DProperties::getCameraAttributes()
 {
-    css::uno::Sequence<css::beans::PropertyValue> aSeq(3);
+    css::uno::Sequence<css::beans::PropertyValue> aSeq(6);
     sal_Int32 nSize = 0;
     if( mfFieldOfVision.has() )
     {
@@ -140,6 +140,24 @@ css::uno::Sequence< css::beans::PropertyValue > Shape3DProperties::getCameraAttr
         aSeq[nSize].Value = css::uno::Any( getCameraPrstName( mnPreset.use() ) );
         nSize++;
     }
+    if( maCameraRotation.mnLatitude.has() )
+    {
+        aSeq[nSize].Name = "rotLat";
+        aSeq[nSize].Value = css::uno::Any( maCameraRotation.mnLatitude.use() );
+        nSize++;
+    }
+    if( maCameraRotation.mnLongitude.has() )
+    {
+        aSeq[nSize].Name = "rotLon";
+        aSeq[nSize].Value = css::uno::Any( maCameraRotation.mnLongitude.use() );
+        nSize++;
+    }
+    if( maCameraRotation.mnRevolution.has() )
+    {
+        aSeq[nSize].Name = "rotRev";
+        aSeq[nSize].Value = css::uno::Any( maCameraRotation.mnRevolution.use() );
+        nSize++;
+    }
     aSeq.realloc( nSize );
     return aSeq;
 }
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 6f61016..5d08216 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2288,7 +2288,9 @@ void DrawingML::WriteShape3DEffects( Reference< XPropertySet > xPropSet )
     if( aEffectProps.getLength() == 0 )
         return;
 
+    bool bCameraRotationPresent = false;
     sax_fastparser::FastAttributeList *aCameraAttrList = mpFS->createAttrList();
+    sax_fastparser::FastAttributeList *aCameraRotationAttrList = mpFS->createAttrList();
     for( sal_Int32 i=0; i < aEffectProps.getLength(); ++i )
     {
         if( aEffectProps[i].Name == "prst" )
@@ -2309,12 +2311,32 @@ void DrawingML::WriteShape3DEffects( Reference< XPropertySet > xPropSet )
             aEffectProps[i].Value >>= fVal;
             aCameraAttrList->add( XML_zoom, OString::number( fVal * 100000 ).getStr() );
         }
+        else if( aEffectProps[i].Name == "rotLat" ||
+                aEffectProps[i].Name == "rotLon" ||
+                aEffectProps[i].Name == "rotRev" )
+        {
+            sal_Int32 nVal = 0, nToken = XML_none;
+            aEffectProps[i].Value >>= nVal;
+            if( aEffectProps[i].Name == "rotLat" )
+                nToken = XML_lat;
+            else if( aEffectProps[i].Name == "rotLon" )
+                nToken = XML_lon;
+            else if( aEffectProps[i].Name == "rotRev" )
+                nToken = XML_rev;
+            aCameraRotationAttrList->add( nToken, OString::number( nVal ).getStr() );
+            bCameraRotationPresent = true;
+        }
     }
 
     mpFS->startElementNS( XML_a, XML_scene3d, FSEND );
 
     sax_fastparser::XFastAttributeListRef xAttrList( aCameraAttrList );
     mpFS->startElementNS( XML_a, XML_camera, xAttrList );
+    if( bCameraRotationPresent )
+    {
+        sax_fastparser::XFastAttributeListRef xRotAttrList( aCameraRotationAttrList );
+        mpFS->singleElementNS( XML_a, XML_rot, xRotAttrList );
+    }
     mpFS->endElementNS( XML_a, XML_camera );
 
     // a:lightRig with Word default values - Word won't open the document if this is not present
diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
index 5bb9a21..e88d320 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
@@ -1158,11 +1158,23 @@ DECLARE_OOXMLEXPORT_TEST(testShape3DEffectPreservation, "shape-3d-effect-preserv
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera",
             "zoom", "150000");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera/a:rot",
+            "lat", "19490639");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera/a:rot",
+            "lon", "0");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera/a:rot",
+            "rev", "12900001");
 
     // second shape
     assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
             "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera",
             "prst", "isometricLeftDown");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera/a:rot",
+            0);
 }
 
 DECLARE_OOXMLEXPORT_TEST(fdo77719, "fdo77719.docx")
commit 1b7773cb071c7bbf60ea023551f35375b6120d4a
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Mon May 5 17:24:59 2014 +0200

    oox: preserve scene3d/camera effects on shapes.
    
    Shapes can contain 3D effects like in the following example:
    
      <a:scene3d>
        <a:camera prst="isometricLeftDown" zoom="150000"/>
        <a:lightRig rig="threePt" dir="t"/>
      </a:scene3d>
    
    This patch preserves the a:camera tag and its attributes using the
    shape grab bag. It also adds a unit test for this case.
    
    Change-Id: Ic6a78031d2e1fb84a2bacd97b5cc9c55d9dbaa95

diff --git a/include/oox/drawingml/shape3dproperties.hxx b/include/oox/drawingml/shape3dproperties.hxx
index d39aee8..9d89753 100644
--- a/include/oox/drawingml/shape3dproperties.hxx
+++ b/include/oox/drawingml/shape3dproperties.hxx
@@ -46,6 +46,10 @@ struct Shape3DProperties
 
     /** Overwrites all members that are explicitly set in rSourceProps. */
     void                assignUsed( const Shape3DProperties& rSourceProps );
+
+    OUString            getCameraPrstName( sal_Int32 nElement );
+
+    css::uno::Sequence< css::beans::PropertyValue > getCameraAttributes();
 };
 
 
diff --git a/include/oox/export/drawingml.hxx b/include/oox/export/drawingml.hxx
index 7793e6b..852387d 100644
--- a/include/oox/export/drawingml.hxx
+++ b/include/oox/export/drawingml.hxx
@@ -174,6 +174,7 @@ public:
     void WriteFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > xPropSet );
     void WriteShapeStyle( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
     void WriteShapeEffects( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
+    void WriteShape3DEffects( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
 
     static void ResetCounters();
 
diff --git a/oox/source/drawingml/scene3dcontext.cxx b/oox/source/drawingml/scene3dcontext.cxx
index bc0c1b9..c9855e1 100644
--- a/oox/source/drawingml/scene3dcontext.cxx
+++ b/oox/source/drawingml/scene3dcontext.cxx
@@ -46,9 +46,12 @@ ContextHandlerRef Scene3DPropertiesContext::onCreateContext( sal_Int32 aElementT
     switch( aElementToken )
     {
     case A_TOKEN( camera ):
-        mr3DProperties.mfFieldOfVision = rAttribs.getInteger( XML_fov, 0 ) / 60000.0; // 60000ths of degree
-        mr3DProperties.mfZoom = rAttribs.getInteger( XML_zoom, 100000 ) / 100000.0;
-        mr3DProperties.mnPreset = rAttribs.getToken( XML_prst, XML_none );
+        if( rAttribs.hasAttribute( XML_fov ) )
+            mr3DProperties.mfFieldOfVision = rAttribs.getInteger( XML_fov, 0 ) / 60000.0; // 60000ths of degree
+        if( rAttribs.hasAttribute( XML_zoom ) )
+            mr3DProperties.mfZoom = rAttribs.getInteger( XML_zoom, 100000 ) / 100000.0;
+        if( rAttribs.hasAttribute( XML_prst ) )
+            mr3DProperties.mnPreset = rAttribs.getToken( XML_prst, XML_none );
         // TODO: nested element XML_rot
         break;
     case A_TOKEN( lightRig ):
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index 4e06de0..72a7920 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -924,6 +924,11 @@ Reference< XShape > Shape::createAndInsert(
 
                 putPropertyToGrabBag( "EffectProperties", Any( aEffectsGrabBag ) );
             }
+
+            // add 3D effects if any
+            Sequence< PropertyValue > aCamera3DEffects = get3DProperties().getCameraAttributes();
+            if( aCamera3DEffects.getLength() > 0 )
+                putPropertyToGrabBag( "3DEffectProperties", Any( aCamera3DEffects ) );
         }
 
         // These can have a custom geometry, so position should be set here,
diff --git a/oox/source/drawingml/shape3dproperties.cxx b/oox/source/drawingml/shape3dproperties.cxx
index 1ef3f5d..86498aa 100644
--- a/oox/source/drawingml/shape3dproperties.cxx
+++ b/oox/source/drawingml/shape3dproperties.cxx
@@ -31,6 +31,7 @@
 #include <com/sun/star/graphic/XGraphicTransformer.hpp>
 #include "oox/helper/propertymap.hxx"
 #include "oox/helper/propertyset.hxx"
+#include "oox/token/tokens.hxx"
 
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::drawing;
@@ -46,6 +47,102 @@ namespace oox {
 namespace drawingml {
 
 
+OUString Shape3DProperties::getCameraPrstName( sal_Int32 nElement )
+{
+    switch( nElement )
+    {
+        case XML_legacyObliqueTopLeft:          return OUString( "legacyObliqueTopLeft" );
+        case XML_legacyObliqueTop:              return OUString( "legacyObliqueTop" );
+        case XML_legacyObliqueTopRight:         return OUString( "legacyObliqueTopRight" );
+        case XML_legacyObliqueLeft:             return OUString( "legacyObliqueLeft" );
+        case XML_legacyObliqueFront:            return OUString( "legacyObliqueFront" );
+        case XML_legacyObliqueRight:            return OUString( "legacyObliqueRight" );
+        case XML_legacyObliqueBottomLeft:       return OUString( "legacyObliqueBottomLeft" );
+        case XML_legacyObliqueBottom:           return OUString( "legacyObliqueBottom" );
+        case XML_legacyObliqueBottomRight:      return OUString( "legacyObliqueBottomRight" );
+        case XML_legacyPerspectiveTopLeft:      return OUString( "legacyPerspectiveTopLeft" );
+        case XML_legacyPerspectiveTop:          return OUString( "legacyPerspectiveTop" );
+        case XML_legacyPerspectiveTopRight:     return OUString( "legacyPerspectiveTopRight" );
+        case XML_legacyPerspectiveLeft:         return OUString( "legacyPerspectiveLeft" );
+        case XML_legacyPerspectiveFront:        return OUString( "legacyPerspectiveFront" );
+        case XML_legacyPerspectiveRight:        return OUString( "legacyPerspectiveRight" );
+        case XML_legacyPerspectiveBottomLeft:   return OUString( "legacyPerspectiveBottomLeft" );
+        case XML_legacyPerspectiveBottom:       return OUString( "legacyPerspectiveBottom" );
+        case XML_legacyPerspectiveBottomRight:  return OUString( "legacyPerspectiveBottomRight" );
+        case XML_orthographicFront:             return OUString( "orthographicFront" );
+        case XML_isometricTopUp:                return OUString( "isometricTopUp" );
+        case XML_isometricTopDown:              return OUString( "isometricTopDown" );
+        case XML_isometricBottomUp:             return OUString( "isometricBottomUp" );
+        case XML_isometricBottomDown:           return OUString( "isometricBottomDown" );
+        case XML_isometricLeftUp:               return OUString( "isometricLeftUp" );
+        case XML_isometricLeftDown:             return OUString( "isometricLeftDown" );
+        case XML_isometricRightUp:              return OUString( "isometricRightUp" );
+        case XML_isometricRightDown:            return OUString( "isometricRightDown" );
+        case XML_isometricOffAxis1Left:         return OUString( "isometricOffAxis1Left" );
+        case XML_isometricOffAxis1Right:        return OUString( "isometricOffAxis1Right" );
+        case XML_isometricOffAxis1Top:          return OUString( "isometricOffAxis1Top" );
+        case XML_isometricOffAxis2Left:         return OUString( "isometricOffAxis2Left" );
+        case XML_isometricOffAxis2Right:        return OUString( "isometricOffAxis2Right" );
+        case XML_isometricOffAxis2Top:          return OUString( "isometricOffAxis2Top" );
+        case XML_isometricOffAxis3Left:         return OUString( "isometricOffAxis3Left" );
+        case XML_isometricOffAxis3Right:        return OUString( "isometricOffAxis3Right" );
+        case XML_isometricOffAxis3Bottom:       return OUString( "isometricOffAxis3Bottom" );
+        case XML_isometricOffAxis4Left:         return OUString( "isometricOffAxis4Left" );
+        case XML_isometricOffAxis4Right:        return OUString( "isometricOffAxis4Right" );
+        case XML_isometricOffAxis4Bottom:       return OUString( "isometricOffAxis4Bottom" );
+        case XML_obliqueTopLeft:                return OUString( "obliqueTopLeft" );
+        case XML_obliqueTop:                    return OUString( "obliqueTop" );
+        case XML_obliqueTopRight:               return OUString( "obliqueTopRight" );
+        case XML_obliqueLeft:                   return OUString( "obliqueLeft" );
+        case XML_obliqueRight:                  return OUString( "obliqueRight" );
+        case XML_obliqueBottomLeft:             return OUString( "obliqueBottomLeft" );
+        case XML_obliqueBottom:                 return OUString( "obliqueBottom" );
+        case XML_obliqueBottomRight:            return OUString( "obliqueBottomRight" );
+        case XML_perspectiveFront:              return OUString( "perspectiveFront" );
+        case XML_perspectiveLeft:               return OUString( "perspectiveLeft" );
+        case XML_perspectiveRight:              return OUString( "perspectiveRight" );
+        case XML_perspectiveAbove:              return OUString( "perspectiveAbove" );
+        case XML_perspectiveBelow:              return OUString( "perspectiveBelow" );
+        case XML_perspectiveAboveLeftFacing:        return OUString( "perspectiveAboveLeftFacing" );
+        case XML_perspectiveAboveRightFacing:       return OUString( "perspectiveAboveRightFacing" );
+        case XML_perspectiveContrastingLeftFacing:  return OUString( "perspectiveContrastingLeftFacing" );
+        case XML_perspectiveContrastingRightFacing: return OUString( "perspectiveContrastingRightFacing" );
+        case XML_perspectiveHeroicLeftFacing:       return OUString( "perspectiveHeroicLeftFacing" );
+        case XML_perspectiveHeroicRightFacing:      return OUString( "perspectiveHeroicRightFacing" );
+        case XML_perspectiveHeroicExtremeLeftFacing:    return OUString( "perspectiveHeroicExtremeLeftFacing" );
+        case XML_perspectiveHeroicExtremeRightFacing:   return OUString( "perspectiveHeroicExtremeRightFacing" );
+        case XML_perspectiveRelaxed:                    return OUString( "perspectiveRelaxed" );
+        case XML_perspectiveRelaxedModerately:          return OUString( "perspectiveRelaxedModerately" );
+    }
+    SAL_WARN( "oox.drawingml", "Shape3DProperties::getCameraPrstName - unexpected prst type" );
+    return OUString();
+}
+
+css::uno::Sequence< css::beans::PropertyValue > Shape3DProperties::getCameraAttributes()
+{
+    css::uno::Sequence<css::beans::PropertyValue> aSeq(3);
+    sal_Int32 nSize = 0;
+    if( mfFieldOfVision.has() )
+    {
+        aSeq[nSize].Name = "fov";
+        aSeq[nSize].Value = css::uno::Any( mfFieldOfVision.use() );
+        nSize++;
+    }
+    if( mfZoom.has() )
+    {
+        aSeq[nSize].Name = "zoom";
+        aSeq[nSize].Value = css::uno::Any( mfZoom.use() );
+        nSize++;
+    }
+    if( mnPreset.has() )
+    {
+        aSeq[nSize].Name = "prst";
+        aSeq[nSize].Value = css::uno::Any( getCameraPrstName( mnPreset.use() ) );
+        nSize++;
+    }
+    aSeq.realloc( nSize );
+    return aSeq;
+}
 
 
 
diff --git a/oox/source/drawingml/shapepropertiescontext.cxx b/oox/source/drawingml/shapepropertiescontext.cxx
index 10130d3..0823e67 100644
--- a/oox/source/drawingml/shapepropertiescontext.cxx
+++ b/oox/source/drawingml/shapepropertiescontext.cxx
@@ -94,7 +94,7 @@ ContextHandlerRef ShapePropertiesContext::onCreateContext( sal_Int32 aElementTok
     case A_TOKEN( effectDag ):  // CT_EffectContainer
         return new EffectPropertiesContext( *this, mrShape.getEffectProperties() );
 
-    // todo
+    // todo not supported by core, only for preservation via grab bags
     case A_TOKEN( scene3d ):    // CT_Scene3D
         return new Scene3DPropertiesContext( *this, mrShape.get3DProperties() );
         break;
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 1fde44a..6f61016 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -2270,6 +2270,59 @@ void DrawingML::WriteShapeEffects( Reference< XPropertySet > rXPropSet )
     }
 }
 
+void DrawingML::WriteShape3DEffects( Reference< XPropertySet > xPropSet )
+{
+    // check existence of the grab bag
+    if( !GetProperty( xPropSet, "InteropGrabBag" ) )
+        return;
+
+    // extract the relevant properties from the grab bag
+    Sequence< PropertyValue > aGrabBag, aEffectProps;
+    mAny >>= aGrabBag;
+    for( sal_Int32 i=0; i < aGrabBag.getLength(); ++i )
+        if( aGrabBag[i].Name == "3DEffectProperties" )
+        {
+            aGrabBag[i].Value >>= aEffectProps;
+            break;
+        }
+    if( aEffectProps.getLength() == 0 )
+        return;
+
+    sax_fastparser::FastAttributeList *aCameraAttrList = mpFS->createAttrList();
+    for( sal_Int32 i=0; i < aEffectProps.getLength(); ++i )
+    {
+        if( aEffectProps[i].Name == "prst" )
+        {
+            OUString sVal;
+            aEffectProps[i].Value >>= sVal;
+            aCameraAttrList->add( XML_prst, OUStringToOString( sVal, RTL_TEXTENCODING_UTF8 ).getStr() );
+        }
+        else if( aEffectProps[i].Name == "fov" )
+        {
+            float fVal = 0;
+            aEffectProps[i].Value >>= fVal;
+            aCameraAttrList->add( XML_fov, OString::number( fVal * 60000 ).getStr() );
+        }
+        else if( aEffectProps[i].Name == "zoom" )
+        {
+            float fVal = 1;
+            aEffectProps[i].Value >>= fVal;
+            aCameraAttrList->add( XML_zoom, OString::number( fVal * 100000 ).getStr() );
+        }
+    }
+
+    mpFS->startElementNS( XML_a, XML_scene3d, FSEND );
+
+    sax_fastparser::XFastAttributeListRef xAttrList( aCameraAttrList );
+    mpFS->startElementNS( XML_a, XML_camera, xAttrList );
+    mpFS->endElementNS( XML_a, XML_camera );
+
+    // a:lightRig with Word default values - Word won't open the document if this is not present
+    mpFS->singleElementNS( XML_a, XML_lightRig, XML_rig, "threePt", XML_dir, "t", FSEND );
+
+    mpFS->endElementNS( XML_a, XML_scene3d );
+}
+
 }
 }
 
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 49d1a4b..c9eaa6f 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -374,6 +374,7 @@ ShapeExport& ShapeExport::WriteCustomShape( Reference< XShape > xShape )
         WriteFill( rXPropSet );
         WriteOutline( rXPropSet );
         WriteShapeEffects( rXPropSet );
+        WriteShape3DEffects( rXPropSet );
     }
 
     pFS->endElementNS( mnXmlNamespace, XML_spPr );
diff --git a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
index 913a611..5bb9a21 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlsdrexport.cxx
@@ -1145,6 +1145,26 @@ DECLARE_OOXMLEXPORT_TEST(testShapeEffectPreservation, "shape-effect-preservation
             0 ); // should not be present
 }
 
+DECLARE_OOXMLEXPORT_TEST(testShape3DEffectPreservation, "shape-3d-effect-preservation.docx")
+{
+    xmlDocPtr pXmlDoc = parseExport("word/document.xml");
+    if (!pXmlDoc)
+       return;
+
+    // first shape
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera",
+            "prst", "perspectiveRelaxedModerately");
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[1]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera",
+            "zoom", "150000");
+
+    // second shape
+    assertXPath(pXmlDoc, "/w:document/w:body/w:p[2]/w:r/mc:AlternateContent/mc:Choice/w:drawing/"
+            "wp:anchor/a:graphic/a:graphicData/wps:wsp/wps:spPr/a:scene3d/a:camera",
+            "prst", "isometricLeftDown");
+}
+
 DECLARE_OOXMLEXPORT_TEST(fdo77719, "fdo77719.docx")
 {
     xmlDocPtr pXmlDoc = parseExport("word/document.xml");
commit 8d2a5c16c7e487b407aced891da17e5c2486f2ff
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Wed Apr 30 19:00:43 2014 +0200

    oox: Integrate Shape3DProperties and Scene3DPropertiesContext
    
    Code for these two classes was already present but it was commented
    out or left outside of the build system because it didn't even
    compile. I've brought it back and made it compile, but it has no use
    yet. The goal is using it to preserve 3D transformations.
    
    At scene3dcontext.cxx I removed the text chunks found in the middle
    of the source and corrected some mistakes; I also modified the
    conversion of "fov" attribute.
    
    At shape3dproperties.hxx I removed all the struct members because
    they seemed to have been copied&pasted from another file, and added
    only those members that made sense. Removed useless function
    definitions.
    
    Change-Id: I2c00ea638e1a4fb1a3820bc4c322488296d3e6d7

diff --git a/include/oox/drawingml/scene3dcontext.hxx b/include/oox/drawingml/scene3dcontext.hxx
index 2ebe581..bbee4e6 100644
--- a/include/oox/drawingml/scene3dcontext.hxx
+++ b/include/oox/drawingml/scene3dcontext.hxx
@@ -21,6 +21,7 @@
 #define INCLUDED_OOX_DRAWINGML_SCENE3DCONTEXT_HXX
 
 #include <oox/core/contexthandler2.hxx>
+#include "oox/drawingml/shape3dproperties.hxx"
 
 namespace oox { namespace drawingml {
 
diff --git a/include/oox/drawingml/shape3dproperties.hxx b/include/oox/drawingml/shape3dproperties.hxx
index 24c22af..d39aee8 100644
--- a/include/oox/drawingml/shape3dproperties.hxx
+++ b/include/oox/drawingml/shape3dproperties.hxx
@@ -36,83 +36,16 @@ namespace drawingml {
 
 
 
-struct Shape3DPropertyNames
-{
-    OUString     maFillStyle;
-    OUString     maFillColor;
-    OUString     maFillTransparence;
-    OUString     maFillGradient;
-    OUString     maFillBitmap;
-    OUString     maFillBitmapMode;
-    OUString     maFillBitmapTile;
-    OUString     maFillBitmapStretch;
-    OUString     maFillBitmapLogicalSize;
-    OUString     maFillBitmapSizeX;
-    OUString     maFillBitmapSizeY;
-    OUString     maFillBitmapOffsetX;
-    OUString     maFillBitmapOffsetY;
-    OUString     maFillBitmapRectanglePoint;
-    bool                mbNamedFillGradient;
-    bool                mbNamedFillBitmap;
-    bool                mbTransformGraphic;
-
-    Shape3DPropertyNames();
-};
-
-
-
 struct Shape3DProperties
 {
-    typedef ::std::map< double, Color > GradientStopMap;
-
-    OptValue< sal_Int32 > moFillType;           /// Fill type (OOXML token).
-    OptValue< bool >    moRotateWithShape;      /// True = rotate gradient/bitmap with shape.
-    Color               maFillColor;            /// Solid fill color and transparence.
-    GradientStopMap     maGradientStops;        /// Gradient stops (colors/transparence).
-    OptValue< sal_Int32 > moGradientPath;       /// If set, gradient follows rectangle, circle, or shape.
-    OptValue< sal_Int32 > moShadeAngle;         /// Rotation angle of linear gradients.
-    OptValue< bool >    moShadeScaled;
-    OptValue< sal_Int32 > moFlipModeToken;
-    OptValue< com::sun::star::geometry::IntegerRectangle2D > moFillToRect;
-    OptValue< com::sun::star::geometry::IntegerRectangle2D > moTileRect;
-    OptValue< sal_Int32 > moPattPreset;         /// Preset pattern type.
-    Color               maPattFgColor;          /// Pattern foreground color.
-    Color               maPattBgColor;          /// Pattern background color.
-    ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > mxGraphic;
-    Color               maColorChangeFrom;      /// Start color of color transformation.
-    Color               maColorChangeTo;        /// Destination color of color transformation.
-    OptValue< sal_Int32 > moBitmapMode;         /// Bitmap tile or stretch.
-    OptValue< sal_Int32 > moTileX;              /// Width of bitmap tiles.
-    OptValue< sal_Int32 > moTileY;              /// Height of bitmap tiles.
-    OptValue< sal_Int32 > moTileSX;
-    OptValue< sal_Int32 > moTileSY;
-    OptValue< sal_Int32 > moTileAlign;          /// Anchor point inside bitmap.
-
-    static Shape3DPropertyNames DEFAULTNAMES;      /// Default fill property names for shape fill.
-    static Shape3DPropertyNames DEFAULTPICNAMES;   /// Default fill property names for pictures.
+    OptValue< sal_Int32 > mnPreset;
+    OptValue< float > mfFieldOfVision;
+    OptValue< float > mfZoom;
+    OptValue< sal_Int32 > mnLightRigDirection;
+    OptValue< sal_Int32 > mnLightRigType;
 
     /** Overwrites all members that are explicitly set in rSourceProps. */
     void                assignUsed( const Shape3DProperties& rSourceProps );
-
-    /** Tries to resolve current settings to a solid color, e.g. returns the
-        start color of a gradient. */
-    Color               getBestSolidColor() const;
-
-    /** Writes the properties to the passed property map. */
-    void                pushToPropMap(
-                            PropertyMap& rPropMap,
-                            const Shape3DPropertyNames& rPropNames,
-                            const ::oox::core::XmlFilterBase& rFilter,
-                            ::oox::core::ModelObjectContainer& rObjContainer,
-                            sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const;
-
-    /** Writes the properties to the passed property set. */
-    void                pushToPropSet(
-                            PropertySet& rPropSet,
-                            const Shape3DPropertyNames& rPropNames,
-                            const ::oox::core::XmlFilterBase& rFilter,
-                            ::oox::core::ModelObjectContainer& rObjContainer,
-                            sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const;
 };
 
 
diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk
index 791c2f0..4df15bc 100644
--- a/oox/Library_oox.mk
+++ b/oox/Library_oox.mk
@@ -153,6 +153,7 @@ $(eval $(call gb_Library_add_exception_objects,oox,\
     oox/source/drawingml/linepropertiescontext \
     oox/source/drawingml/lineproperties \
     oox/source/drawingml/objectdefaultcontext \
+    oox/source/drawingml/scene3dcontext \
     oox/source/drawingml/shapecontext \
     oox/source/drawingml/shape \
     oox/source/drawingml/shape3dproperties \
diff --git a/oox/source/drawingml/scene3dcontext.cxx b/oox/source/drawingml/scene3dcontext.cxx
index 24323ef..bc0c1b9 100644
--- a/oox/source/drawingml/scene3dcontext.cxx
+++ b/oox/source/drawingml/scene3dcontext.cxx
@@ -25,146 +25,39 @@
 #include "oox/drawingml/colorchoicecontext.hxx"
 #include "oox/drawingml/drawingmltypes.hxx"
 #include "oox/drawingml/fillproperties.hxx"
-#include "oox/core/namespaces.hxx"
 #include "oox/core/xmlfilterbase.hxx"
 #include "oox/helper/attributelist.hxx"
 
-using ::oox::core::ContextHandler;
-using ::oox::core::XmlFilterBase;
+using namespace ::oox::core;
 using namespace ::com::sun::star;
 using namespace ::com::sun::star::uno;
 using namespace ::com::sun::star::xml::sax;
 
 namespace oox { namespace drawingml {
 
-Scene3DContext::Scene3DContext( ContextHandler2Helper& rParent, Shape3DProperties& r3DProperties ) throw()
+Scene3DPropertiesContext::Scene3DPropertiesContext( ContextHandler2Helper& rParent, Shape3DProperties& r3DProperties ) throw()
 : ContextHandler2( rParent )
 , mr3DProperties( r3DProperties )
 {
 }
 
-ContextHandlerRef Scene3DContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
+ContextHandlerRef Scene3DPropertiesContext::onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs )
 {
     switch( aElementToken )
     {
-    case NMSP_DRAWINGML|XML_camera:
-        mr3DProperties.mfFieldOfVision = rAttribs.getInteger( XML_fov, 0 ) / 36000000.0;
+    case A_TOKEN( camera ):
+        mr3DProperties.mfFieldOfVision = rAttribs.getInteger( XML_fov, 0 ) / 60000.0; // 60000ths of degree
         mr3DProperties.mfZoom = rAttribs.getInteger( XML_zoom, 100000 ) / 100000.0;
         mr3DProperties.mnPreset = rAttribs.getToken( XML_prst, XML_none );
-
-legacyObliqueTopLeft
-legacyObliqueTop
-legacyObliqueTopRight
-legacyObliqueLeft
-legacyObliqueFront
-legacyObliqueRight
-legacyObliqueBottomLeft
-legacyObliqueBottom
-legacyObliqueBottomRight
-legacyPerspectiveTopLeft
-legacyPerspectiveTop
-legacyPerspectiveTopRight
-legacyPerspectiveLeft
-legacyPerspectiveFront
-legacyPerspectiveRight
-legacyPerspectiveBottomLeft
-legacyPerspectiveBottom
-legacyPerspectiveBottomRight
-orthographicFront
-isometricTopUp
-isometricTopDown
-isometricBottomUp
-isometricBottomDown
-isometricLeftUp
-isometricLeftDown
-isometricRightUp
-isometricRightDown
-isometricOffAxis1Left
-isometricOffAxis1Right
-isometricOffAxis1Top
-isometricOffAxis2Left
-isometricOffAxis2Right
-isometricOffAxis2Top
-isometricOffAxis3Left
-isometricOffAxis3Right
-isometricOffAxis3Bottom
-isometricOffAxis4Left
-isometricOffAxis4Right
-isometricOffAxis4Bottom
-obliqueTopLeft
-obliqueTop
-obliqueTopRight
-obliqueLeft
-obliqueRight
-obliqueBottomLeft
-obliqueBottom
-obliqueBottomRight
-perspectiveFront
-perspectiveLeft
-perspectiveRight
-perspectiveAbove
-perspectiveBelow
-perspectiveAboveLeftFacing
-perspectiveAboveRightFacing
-perspectiveContrastingLeftFacing
-perspectiveContrastingRightFacing
-perspectiveHeroicLeftFacing
-perspectiveHeroicRightFacing
-perspectiveHeroicExtremeLeftFacing
-perspectiveHeroicExtremeRightFacing
-perspectiveRelaxed
-perspectiveRelaxedModerately
-
-
         // TODO: nested element XML_rot
         break;
-    case NMSP_DRAWINGML|XML_lightRig:
+    case A_TOKEN( lightRig ):
         mr3DProperties.mnLightRigDirection = rAttribs.getToken( XML_dir, XML_none );
-
-XML_tl
-XML_t
-XML_tr
-XML_l
-XML_r
-XML_bl
-XML_b
-XML_br
-
-
         mr3DProperties.mnLightRigType = rAttribs.getToken( XML_rig, XML_none );
-
-XML_legacyFlat1
-XML_legacyFlat2
-XML_legacyFlat3
-XML_legacyFlat4
-XML_legacyNormal1
-XML_legacyNormal2
-XML_legacyNormal3
-XML_legacyNormal4
-XML_legacyHarsh1
-XML_legacyHarsh2
-XML_legacyHarsh3
-XML_legacyHarsh4
-XML_threePt
-XML_balanced
-XML_soft
-XML_harsh
-XML_flood
-XML_contrasting
-XML_morning
-XML_sunrise
-XML_sunset
-XML_chilly
-XML_freezing
-XML_flat
-XML_twoPt
-XML_glow
-XML_brightRoom
-
         // TODO: nested element XML_rot
         break;
-    case NMSP_DRAWINGML|XML_backdrop:
-    case NMSP_DRAWINGML|XML_extLst:
+    case A_TOKEN( backdrop ):
+    case A_TOKEN( extLst ):
         return 0; // TODO: later (backdrop is not supported by core anyway)
     }
     return 0;
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index fd5cb40..4e06de0 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -93,6 +93,7 @@ Shape::Shape( const sal_Char* pServiceName, bool bDefaultHeight )
 , mpFillPropertiesPtr( new FillProperties )
 , mpGraphicPropertiesPtr( new GraphicProperties )
 , mpCustomShapePropertiesPtr( new CustomShapeProperties )
+, mp3DPropertiesPtr( new Shape3DProperties )
 , mpEffectPropertiesPtr( new EffectProperties )
 , mpMasterTextListStyle( new TextListStyle )
 , mnSubType( 0 )
diff --git a/oox/source/drawingml/shapepropertiescontext.cxx b/oox/source/drawingml/shapepropertiescontext.cxx
index 488f8a0..10130d3 100644
--- a/oox/source/drawingml/shapepropertiescontext.cxx
+++ b/oox/source/drawingml/shapepropertiescontext.cxx
@@ -96,7 +96,7 @@ ContextHandlerRef ShapePropertiesContext::onCreateContext( sal_Int32 aElementTok
 
     // todo
     case A_TOKEN( scene3d ):    // CT_Scene3D
-//      return new Scene3DContext( *this, rAttribs, *(mrShape.get3DShapeProperties()) );
+        return new Scene3DPropertiesContext( *this, mrShape.get3DProperties() );
         break;
 
     // todo
commit 9bb6956197c5caaa150fc8ed52233741749a4060
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Mon May 5 11:50:58 2014 +0200

    ooxml: fix cell theme color and shade preservation
    
    The cell property w:shd was not being properly preserved when the
    shade value was different from "clear". The shading affects the cell
    color and the exporter was not taking that into account when comparing
    the cell color with the original color to know if the user had changed
    it.
    
    Besides, we were not preserving the attributes themeColor, themeTint
    and themeShade.
    
    I have modified the existing unit test testTableThemePreservation to
    add a check for those new attributes.
    
    Change-Id: I06d2e668486803cba039eacb717a69413bd5a1df

diff --git a/sw/qa/extras/ooxmlexport/data/table-theme-preservation.docx b/sw/qa/extras/ooxmlexport/data/table-theme-preservation.docx
index 522dac8..ae4ede0 100644
Binary files a/sw/qa/extras/ooxmlexport/data/table-theme-preservation.docx and b/sw/qa/extras/ooxmlexport/data/table-theme-preservation.docx differ
diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
index 55b08e7..8c99382 100644
--- a/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
+++ b/sw/qa/extras/ooxmlexport/ooxmlexport.cxx
@@ -1972,6 +1972,10 @@ DECLARE_OOXMLEXPORT_TEST(testTableThemePreservation, "table-theme-preservation.d
     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeFill", "accent6");
     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeFillShade", "80");
     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeFillTint", "");
+    assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "val", "horzStripe");
+    assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeColor", "accent3");
+    assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "themeTint", "33");
+    assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tr[2]/w:tc[3]/w:tcPr/w:shd", "color", "E7EEEE");
 
     // check table style has been preserved
     assertXPath(pXmlDocument, "/w:document/w:body/w:tbl/w:tblPr/w:tblStyle", "val", "Sombreadoclaro-nfasis1");
diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx
index 66b1b26..553b444 100644
--- a/sw/source/filter/ww8/docxattributeoutput.cxx
+++ b/sw/source/filter/ww8/docxattributeoutput.cxx
@@ -2896,7 +2896,7 @@ void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_
             sw::util::HasItem<SfxGrabBagItem>( pFmt->GetAttrSet(), RES_FRMATR_GRABBAG )->GetGrabBag();
 
     OString sOriginalColor;
-    std::map<OUString, com::sun::star::uno::Any>::iterator aGrabBagElement = aGrabBag.find("fill");
+    std::map<OUString, com::sun::star::uno::Any>::iterator aGrabBagElement = aGrabBag.find("originalColor");
     if( aGrabBagElement != aGrabBag.end() )
         sOriginalColor = OUStringToOString( aGrabBagElement->second.get<OUString>(), RTL_TEXTENCODING_UTF8 );
 
@@ -2911,7 +2911,6 @@ void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_
     else
     {
         ::sax_fastparser::FastAttributeList* aAttrList = NULL;
-        AddToAttrList( aAttrList, FSNS( XML_w, XML_fill ), sColor.getStr() );
 
         for( aGrabBagElement = aGrabBag.begin(); aGrabBagElement != aGrabBag.end(); ++aGrabBagElement )
         {
@@ -2922,6 +2921,14 @@ void DocxAttributeOutput::TableBackgrounds( ww8::WW8TableNodeInfoInner::Pointer_
                 AddToAttrList( aAttrList, FSNS( XML_w, XML_themeFillTint ), sValue.getStr() );
             else if( aGrabBagElement->first == "themeFillShade")
                 AddToAttrList( aAttrList, FSNS( XML_w, XML_themeFillShade ), sValue.getStr() );
+            else if( aGrabBagElement->first == "fill" )
+                AddToAttrList( aAttrList, FSNS( XML_w, XML_fill ), sValue.getStr() );
+            else if( aGrabBagElement->first == "themeColor")
+                AddToAttrList( aAttrList, FSNS( XML_w, XML_themeColor ), sValue.getStr() );
+            else if( aGrabBagElement->first == "themeTint")
+                AddToAttrList( aAttrList, FSNS( XML_w, XML_themeTint ), sValue.getStr() );
+            else if( aGrabBagElement->first == "themeShade")
+                AddToAttrList( aAttrList, FSNS( XML_w, XML_themeShade ), sValue.getStr() );
             else if( aGrabBagElement->first == "color")
                 AddToAttrList( aAttrList, FSNS( XML_w, XML_color ), sValue.getStr() );
             else if( aGrabBagElement->first == "val")
diff --git a/writerfilter/source/dmapper/CellColorHandler.cxx b/writerfilter/source/dmapper/CellColorHandler.cxx
index c883991..c70936d 100644
--- a/writerfilter/source/dmapper/CellColorHandler.cxx
+++ b/writerfilter/source/dmapper/CellColorHandler.cxx
@@ -131,6 +131,15 @@ void CellColorHandler::lcl_attribute(Id rName, Value & rVal)
         case NS_ooxml::LN_CT_Shd_themeFillTint:
             createGrabBag("themeFillTint", uno::makeAny(OUString::number(nIntValue, 16)));
             break;
+        case NS_ooxml::LN_CT_Shd_themeColor:
+            createGrabBag("themeColor", uno::makeAny(TDefTableHandler::getThemeColorTypeString(nIntValue)));
+        break;
+        case NS_ooxml::LN_CT_Shd_themeShade:
+            createGrabBag("themeShade", uno::makeAny(OUString::number(nIntValue, 16)));
+        break;
+        case NS_ooxml::LN_CT_Shd_themeTint:
+            createGrabBag("themeTint", uno::makeAny(OUString::number(nIntValue, 16)));
+            break;
         default:
             OSL_FAIL( "unknown attribute");
     }
@@ -319,6 +328,10 @@ TablePropertyMapPtr  CellColorHandler::getProperties()
     pPropertyMap->Insert( m_OutputFormat == Form ? PROP_BACK_COLOR
                         : m_OutputFormat == Paragraph ? PROP_PARA_BACK_COLOR
                         : PROP_CHAR_BACK_COLOR, uno::makeAny( nApplyColor ));
+
+    createGrabBag("originalColor", uno::makeAny( OStringToOUString(
+            msfilter::util::ConvertColor( nApplyColor, true ), RTL_TEXTENCODING_UTF8 )));
+
     return pPropertyMap;
 }
 
diff --git a/writerfilter/source/dmapper/TablePropertiesHandler.cxx b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
index b839e2e..0edbd71 100644
--- a/writerfilter/source/dmapper/TablePropertiesHandler.cxx
+++ b/writerfilter/source/dmapper/TablePropertiesHandler.cxx
@@ -324,10 +324,10 @@ namespace dmapper {
                     CellColorHandlerPtr pCellColorHandler( new CellColorHandler );
                     pCellColorHandler->enableInteropGrabBag("shd"); //enable to store shd unsupported props in grab bag
                     pProperties->resolve( *pCellColorHandler );
+                    TablePropertyMapPtr pPropertyMap = pCellColorHandler->getProperties();
                     beans::PropertyValue aGrabBag = pCellColorHandler->getInteropGrabBag();
                     if (m_pCurrentInteropGrabBag)
                         m_pCurrentInteropGrabBag->push_back(aGrabBag);
-                    TablePropertyMapPtr pPropertyMap = pCellColorHandler->getProperties();
                     pPropertyMap->Insert( PROP_CELL_INTEROP_GRAB_BAG, aGrabBag.Value );
                     cellProps( pPropertyMap );
                 }


More information about the Libreoffice-commits mailing list