[Libreoffice-commits] core.git: 2 commits - cui/source include/oox include/unotools officecfg/registry oox/Library_oox.mk oox/source sw/CppunitTest_sw_ooxmlexport.mk unotools/source

Andres Gomez agomez at igalia.com
Wed Oct 16 03:24:19 PDT 2013


 cui/source/inc/cuires.hrc                                  |    2 
 cui/source/options/optfltr.cxx                             |    6 
 cui/source/options/optfltr.hxx                             |    3 
 cui/source/options/optfltr.src                             |    4 
 include/oox/drawingml/shape.hxx                            |    5 
 include/unotools/fltrcfg.hxx                               |    3 
 officecfg/registry/schema/org/openoffice/Office/Common.xcs |    6 
 oox/Library_oox.mk                                         |    2 
 oox/source/drawingml/shape.cxx                             |  173 +++++++++++--
 oox/source/shape/ShapeContextHandler.cxx                   |    1 
 sw/CppunitTest_sw_ooxmlexport.mk                           |    2 
 unotools/source/config/fltrcfg.cxx                         |   23 +
 12 files changed, 204 insertions(+), 26 deletions(-)

New commits:
commit c0e3574ce0434d295f7e6f4c66c9656847b22e30
Author: Andres Gomez <agomez at igalia.com>
Date:   Thu Sep 26 20:35:48 2013 +0300

    oox: added methods to lock Smart-Art edition
    
    Added the possibility of rendering the basic shapes generated for a
    Smart-Art into a bitmap and replacing them with it in order to not
    letting to edit the Smart-Art. This possibility is controlled using a
    configuration parameter located at Options -> Load/Save -> MS Office
    -> SmartArt to LibreOffice shapes or reverse.
    
    Made the "oox" library to depend on the "drawinglayer" and "svx"
    libraries.
    
    Made the "ooxmlexport" C++ unit tests in the "sw" module to depend on
    the "drawinglayer" and "svx" components.
    
    Fixed to set to diagram type a new "oox::drawingml::Shape"
    representing a Smart-Art in the "getShape" method of the
    "oox::shape::ShapeContextHandler" class.
    
    Added the "keepDiagramCompatibilityInfo" and "renderDiagramToGraphic"
    protected methods to the "oox::drawingml::Shape"
    class. "keepDiagramCompatibilityInfo" is now called after an instance
    of type "FRAMETYPE_DIAGRAM" has added all its children in the
    "addShape" method and the proper setting is in place.
    
    "keepDiagramCompatibilityInfo" substitutes previous similar code in
    the "createAndInsert" method and also calls "renderDiagramToGraphic".
    
    The "renderDiagramToGraphic" renders the basic shapes in a Smart-Art
    into a PNG image and replaces these basic shapes with a new
    "GraphicObjectShape" filled with the new PNG image. It also sets the
    "MoveProtect" and "SizeProtect" properties of the
    "GraphicObjectShape".
    
    Change-Id: Ie4002238ff5fae758a5881b03735bf1f0721ed5b
    Reviewed-on: https://gerrit.libreoffice.org/6059
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/include/oox/drawingml/shape.hxx b/include/oox/drawingml/shape.hxx
index 95108e7..0631c0a 100644
--- a/include/oox/drawingml/shape.hxx
+++ b/include/oox/drawingml/shape.hxx
@@ -201,6 +201,11 @@ protected:
                             ShapeIdMap* pShapeMap,
                             basegfx::B2DHomMatrix& aTransformation );
 
+    void                keepDiagramCompatibilityInfo( ::oox::core::XmlFilterBase& rFilterBase );
+
+    ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >
+                        renderDiagramToGraphic( ::oox::core::XmlFilterBase& rFilterBase );
+
     virtual OUString finalizeServiceName(
                             ::oox::core::XmlFilterBase& rFilter,
                             const OUString& rServiceName,
diff --git a/oox/Library_oox.mk b/oox/Library_oox.mk
index a20b548..dd30e70 100644
--- a/oox/Library_oox.mk
+++ b/oox/Library_oox.mk
@@ -39,6 +39,7 @@ $(eval $(call gb_Library_use_libraries,oox,\
     cppu \
     cppuhelper \
     editeng \
+    drawinglayer \
     msfilter \
     sal \
 	i18nlangtag \
@@ -46,6 +47,7 @@ $(eval $(call gb_Library_use_libraries,oox,\
     sfx \
     svl \
     svt \
+    svx \
     svxcore \
     sot \
     tl \
diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx
index f174b34..f9aa426 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -37,7 +37,10 @@
 #include "oox/helper/propertyset.hxx"
 
 #include <tools/solar.h>        // for the F_PI180 define
+#include <tools/gen.hxx>
+#include <tools/mapunit.hxx>
 #include <editeng/unoprnms.hxx>
+#include <com/sun/star/awt/Size.hpp>
 #include <com/sun/star/graphic/XGraphic.hpp>
 #include <com/sun/star/container/XNamed.hpp>
 #include <com/sun/star/container/XNameContainer.hpp>
@@ -46,14 +49,23 @@
 #include <com/sun/star/xml/AttributeData.hpp>
 #include <com/sun/star/drawing/HomogenMatrix3.hpp>
 #include <com/sun/star/drawing/TextVerticalAdjust.hpp>
+#include <com/sun/star/drawing/GraphicExportFilter.hpp>
 #include <com/sun/star/text/XText.hpp>
 #include <com/sun/star/chart2/XChartDocument.hpp>
 #include <com/sun/star/style/ParagraphAdjust.hpp>
+#include <com/sun/star/io/XOutputStream.hpp>
+
 #include <basegfx/point/b2dpoint.hxx>
 #include <basegfx/polygon/b2dpolygon.hxx>
 #include <basegfx/matrix/b2dhommatrix.hxx>
 #include <com/sun/star/document/XActionLockable.hpp>
 #include <com/sun/star/chart2/data/XDataReceiver.hpp>
+#include <svl/outstrm.hxx>
+#include <unotools/streamwrap.hxx>
+#include <unotools/fltrcfg.hxx>
+#include <vcl/graph.hxx>
+#include <vcl/graphicfilter.hxx>
+#include <vcl/svapp.hxx>
 
 using namespace ::oox::core;
 using namespace ::com::sun::star;
@@ -222,10 +234,18 @@ void Shape::addShape(
             Reference< XShapes > xShapes( xShape, UNO_QUERY );
             if ( xShapes.is() )
                 addChildren( rFilterBase, *this, pTheme, xShapes, pShapeRect ? *pShapeRect : awt::Rectangle( maPosition.X, maPosition.Y, maSize.Width, maSize.Height ), pShapeMap, aMatrix );
+
+
+            if( meFrameType == FRAMETYPE_DIAGRAM )
+            {
+                if( !SvtFilterOptions::Get().IsSmartArt2Shape() )
+                    keepDiagramCompatibilityInfo( rFilterBase );
+            }
         }
     }
-    catch( const Exception&  )
+    catch( const Exception& e )
     {
+        SAL_WARN( "oox.drawingml", OSL_THIS_FUNC << "Exception: " << e.Message );
     }
 }
 
@@ -587,27 +607,6 @@ Reference< XShape > Shape::createAndInsert(
             }
         }
 
-        // ... but for the InteropGrabBag property
-        const OUString& aGrabBagPropName = OUString::createFromAscii(UNO_NAME_MISC_OBJ_INTEROPGRABBAG);
-        if( maDiagramDoms.hasElements() && xSetInfo.is() && xSetInfo->hasPropertyByName( aGrabBagPropName ) )
-        {
-            Sequence<PropertyValue> aGrabBag;
-            xSet->getPropertyValue( aGrabBagPropName ) >>= aGrabBag;
-
-            // we keep the previous items, if present
-            if (aGrabBag.hasElements())
-            {
-                sal_Int32 length = aGrabBag.getLength();
-                aGrabBag.realloc(length+maDiagramDoms.getLength());
-
-                for(sal_Int32 i = 0; i < maDiagramDoms.getLength(); ++i)
-                    aGrabBag[length+i] = maDiagramDoms[i];
-
-                xSet->setPropertyValue( aGrabBagPropName, Any( aGrabBag ) );
-            } else
-                xSet->setPropertyValue( aGrabBagPropName, Any( maDiagramDoms ) );
-        }
-
         if( bIsCustomShape )
         {
             if ( mbFlipH )
@@ -654,6 +653,136 @@ Reference< XShape > Shape::createAndInsert(
     return mxShape;
 }
 
+void Shape::keepDiagramCompatibilityInfo( XmlFilterBase& rFilterBase )
+{
+    try
+    {
+        if( !maDiagramDoms.hasElements() )
+            return;
+
+        Reference < XPropertySet > xSet( mxShape, UNO_QUERY_THROW );
+        Reference < XPropertySetInfo > xSetInfo( xSet->getPropertySetInfo() );
+        if ( !xSetInfo.is() )
+            return;
+
+        const OUString& aGrabBagPropName = OUString( UNO_NAME_MISC_OBJ_INTEROPGRABBAG );
+        if( !xSetInfo->hasPropertyByName( aGrabBagPropName ) )
+            return;
+
+        Sequence < PropertyValue > aGrabBag;
+        xSet->getPropertyValue( aGrabBagPropName ) >>= aGrabBag;
+
+        // We keep the previous items, if present
+        if ( aGrabBag.hasElements() )
+        {
+            sal_Int32 length = aGrabBag.getLength();
+            aGrabBag.realloc( length+maDiagramDoms.getLength() );
+
+            for( sal_Int32 i = 0; i < maDiagramDoms.getLength(); ++i )
+                aGrabBag[length+i] = maDiagramDoms[i];
+
+            xSet->setPropertyValue( aGrabBagPropName, Any( aGrabBag ) );
+        } else
+            xSet->setPropertyValue( aGrabBagPropName, Any( maDiagramDoms ) );
+
+        xSet->setPropertyValue( OUString( "MoveProtect" ), Any( sal_True ) );
+        xSet->setPropertyValue( OUString( "SizeProtect" ), Any( sal_True ) );
+
+        // Replace existing shapes with a new Graphic Object rendered
+        // from them
+        Reference < XShape > xShape( renderDiagramToGraphic( rFilterBase ) );
+        Reference < XShapes > xShapes( mxShape, UNO_QUERY_THROW );
+        while( xShapes->hasElements() )
+            xShapes->remove( Reference < XShape > ( xShapes->getByIndex( 0 ),  UNO_QUERY_THROW ) );
+        xShapes->add( xShape );
+    }
+    catch( const Exception& e )
+    {
+        SAL_WARN( "oox.drawingml", OSL_THIS_FUNC << "Exception: " << e.Message );
+    }
+}
+
+Reference < XShape > Shape::renderDiagramToGraphic( XmlFilterBase& rFilterBase )
+{
+    Reference< XShape > xShape;
+
+    try
+    {
+        if( !maDiagramDoms.hasElements() )
+            return xShape;
+
+        // Stream in which to place the rendered shape
+        SvMemoryStream mpTempStream;
+        Reference < io::XStream > xStream( new utl::OStreamWrapper( mpTempStream ) );
+        Reference < io::XOutputStream > xOutputStream( xStream->getOutputStream() );
+
+        // Rendering format
+        OUString sFormat( "PNG" );
+
+        // Size of the rendering
+        awt::Size aActualSize = mxShape->getSize();
+        Size aResolution( Application::GetDefaultDevice()->LogicToPixel( Size( 100, 100 ), MAP_CM ) );
+        double fPixelsPer100thmm = static_cast < double > ( aResolution.Width() ) / 100000.0;
+        awt::Size aSize = awt::Size( static_cast < sal_Int32 > ( ( fPixelsPer100thmm * aActualSize.Width ) + 0.5 ),
+                                     static_cast < sal_Int32 > ( ( fPixelsPer100thmm * aActualSize.Height ) + 0.5 ) );
+
+        Sequence< PropertyValue > aFilterData( 7 );
+        aFilterData[ 0 ].Name = OUString( "Compression" );
+        aFilterData[ 0 ].Value <<= static_cast < sal_Int32 > ( 9 );
+        aFilterData[ 1 ].Name = OUString( "Interlaced" );
+        aFilterData[ 1 ].Value <<= static_cast < sal_Int32 > ( 1 );
+        aFilterData[ 2 ].Name = OUString( "Translucent" );
+        aFilterData[ 2 ].Value <<= static_cast < sal_Int32 > ( 1 );
+        aFilterData[ 3 ].Name = OUString( "PixelWidth" );
+        aFilterData[ 3 ].Value <<= aSize.Width;
+        aFilterData[ 4 ].Name = OUString( "PixelHeight" );
+        aFilterData[ 4 ].Value <<= aSize.Height;
+        aFilterData[ 5 ].Name = OUString( "LogicalWidth" );
+        aFilterData[ 5 ].Value <<= aActualSize.Width;
+        aFilterData[ 6 ].Name = OUString( "LogicalHeight" );
+        aFilterData[ 6 ].Value <<= aActualSize.Height;
+
+        Sequence < PropertyValue > aDescriptor( 3 );
+        aDescriptor[ 0 ].Name = OUString( "OutputStream" );
+        aDescriptor[ 0 ].Value <<= xOutputStream;
+        aDescriptor[ 1 ].Name = OUString( "FilterName" );
+        aDescriptor[ 1 ].Value <<= sFormat;
+        aDescriptor[ 2 ].Name = OUString( "FilterData" );
+        aDescriptor[ 2 ].Value <<= aFilterData;
+
+        Reference < lang::XComponent > xSourceDoc( mxShape, UNO_QUERY_THROW );
+        Reference < XGraphicExportFilter > xGraphicExporter = GraphicExportFilter::create( rFilterBase.getComponentContext() );
+        xGraphicExporter->setSourceDocument( xSourceDoc );
+        xGraphicExporter->filter( aDescriptor );
+
+        mpTempStream.Seek( STREAM_SEEK_TO_BEGIN );
+
+        Graphic aGraphic;
+        GraphicFilter aFilter( sal_False );
+        if ( !aFilter.ImportGraphic( aGraphic, "", mpTempStream, GRFILTER_FORMAT_NOTFOUND, NULL, 0, static_cast < Sequence < PropertyValue >* > ( NULL ), NULL ) == GRFILTER_OK )
+        {
+            SAL_WARN( "oox.drawingml", OSL_THIS_FUNC
+                      << "Unable to import rendered stream into graphic object" );
+            return xShape;
+        }
+
+        Reference < graphic::XGraphic > xGraphic( aGraphic.GetXGraphic() );
+        Reference < lang::XMultiServiceFactory > xServiceFact( rFilterBase.getModel(), UNO_QUERY_THROW );
+        xShape = Reference < XShape > ( xServiceFact->createInstance( OUString( "com.sun.star.drawing.GraphicObjectShape" ) ), UNO_QUERY_THROW );
+        Reference < XPropertySet > xPropSet( xShape, UNO_QUERY_THROW );
+        xPropSet->setPropertyValue( OUString( "Graphic" ), Any( xGraphic ) );
+        xPropSet->setPropertyValue( OUString( "MoveProtect" ), Any( sal_True ) );
+        xPropSet->setPropertyValue( OUString( "SizeProtect" ), Any( sal_True ) );
+        xPropSet->setPropertyValue( OUString( "Name" ), Any( OUString( "RenderedShapes" ) ) );
+    }
+    catch( const Exception& e )
+    {
+        SAL_WARN( "oox.drawingml", OSL_THIS_FUNC << "Exception: " << e.Message );
+    }
+
+    return xShape;
+}
+
 void Shape::setTextBody(const TextBodyPtr & pTextBody)
 {
     mpTextBody = pTextBody;
diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx
index 96d4849..dbbd41d 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -356,6 +356,7 @@ ShapeContextHandler::getShape() throw (uno::RuntimeException)
                     DiagramGraphicDataContext* pDiagramGraphicDataContext = dynamic_cast<DiagramGraphicDataContext*>(mxDiagramShapeContext.get());
                     OUString aFragmentPath(pDiagramGraphicDataContext->getFragmentPathFromRelId(*aIt));
                     oox::drawingml::ShapePtr pShapePtr( new Shape( "com.sun.star.drawing.GroupShape" ) );
+                    pShapePtr->setDiagramType();
                     mxFilterBase->importFragment(new ShapeDrawingFragmentHandler(*mxFilterBase, aFragmentPath, pShapePtr));
 
                     uno::Sequence<beans::PropertyValue> aValue(mpShape->getDiagramDoms());
diff --git a/sw/CppunitTest_sw_ooxmlexport.mk b/sw/CppunitTest_sw_ooxmlexport.mk
index 0158be6..4927c0d 100644
--- a/sw/CppunitTest_sw_ooxmlexport.mk
+++ b/sw/CppunitTest_sw_ooxmlexport.mk
@@ -53,6 +53,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_ooxmlexport,\
 	canvas/source/factory/canvasfactory \
     comphelper/util/comphelp \
     configmgr/source/configmgr \
+	drawinglayer/drawinglayer \
     embeddedobj/util/embobj \
     fileaccess/source/fileacc \
     filter/source/config/cache/filterconfig1 \
@@ -71,6 +72,7 @@ $(eval $(call gb_CppunitTest_use_components,sw_ooxmlexport,\
     starmath/util/sm \
     svl/source/fsstor/fsstorage \
     svtools/util/svt \
+	svx/util/svx \
     toolkit/util/tk \
     ucb/source/core/ucb1 \
     ucb/source/ucp/file/ucpfile1 \
commit 2eba5391d3fa3232ba2b0a187c4c51736ab2ec3d
Author: Jacobo Aragunde Pérez <jaragunde at igalia.com>
Date:   Tue Oct 1 10:59:01 2013 +0200

    unotools: add menu option to enable/disable Smart-Art lock
    
    The point of this menu option is that locked Smart-Art shapes would
    preserve the original XML files attached so they could be exported
    back to docx with no loss.
    
    The new menu option is located at Options -> Load/Save -> MS Office ->
    SmartArt to LibreOffice shapes or reverse.
    
    Change-Id: I6aafc2eb83404ee2c0b8538b2f6fbbbd4363e7d3
    Reviewed-on: https://gerrit.libreoffice.org/6138
    Reviewed-by: Miklos Vajna <vmiklos at collabora.co.uk>
    Tested-by: Miklos Vajna <vmiklos at collabora.co.uk>

diff --git a/cui/source/inc/cuires.hrc b/cui/source/inc/cuires.hrc
index 0b8cf5a..4a887c2 100644
--- a/cui/source/inc/cuires.hrc
+++ b/cui/source/inc/cuires.hrc
@@ -454,6 +454,8 @@
 #define RID_SVXSTR_YES                                      (RID_SVX_START + 1249)
 #define RID_SVXSTR_NO                                       (RID_SVX_START + 1250)
 
+#define RID_SVXSTR_CHG_SMARTART                             (RID_SVX_START + 1251)
+
 #endif
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/cui/source/options/optfltr.cxx b/cui/source/options/optfltr.cxx
index d6ec297..30409b4 100644
--- a/cui/source/options/optfltr.cxx
+++ b/cui/source/options/optfltr.cxx
@@ -32,6 +32,7 @@ enum MSFltrPg2_CheckBoxEntries {
     Writer,
     Calc,
     Impress,
+    SmartArt,
     InvalidCBEntry
 };
 
@@ -136,6 +137,7 @@ OfaMSFilterTabPage2::OfaMSFilterTabPage2( Window* pParent, const SfxItemSet& rSe
     sChgToFromWriter(CUI_RES(RID_SVXSTR_CHG_WRITER)),
     sChgToFromCalc(CUI_RES(RID_SVXSTR_CHG_CALC)),
     sChgToFromImpress(CUI_RES(RID_SVXSTR_CHG_IMPRESS)),
+    sChgToFromSmartArt(CUI_RES(RID_SVXSTR_CHG_SMARTART)),
     pCheckButtonData(0)
 {
     get(m_pCheckLBContainer, "checklbcontainer");
@@ -193,6 +195,8 @@ sal_Bool OfaMSFilterTabPage2::FillItemSet( SfxItemSet& )
                         &SvtFilterOptions::SetPowerPoint2Impress },
         { Impress,  &SvtFilterOptions::IsImpress2PowerPoint,
                         &SvtFilterOptions::SetImpress2PowerPoint },
+        { SmartArt,  &SvtFilterOptions::IsSmartArt2Shape,
+                        &SvtFilterOptions::SetSmartArt2Shape },
         { InvalidCBEntry, 0, 0 }
     };
 
@@ -238,6 +242,7 @@ void OfaMSFilterTabPage2::Reset( const SfxItemSet& )
         InsertEntry( sChgToFromCalc, static_cast< sal_IntPtr >( Calc ) );
     if ( aModuleOpt.IsModuleInstalled( SvtModuleOptions::E_SIMPRESS ) )
         InsertEntry( sChgToFromImpress, static_cast< sal_IntPtr >( Impress ) );
+    InsertEntry( sChgToFromSmartArt, static_cast< sal_IntPtr >( SmartArt ), true, false );
 
     static struct ChkCBoxEntries{
         MSFltrPg2_CheckBoxEntries eType;
@@ -251,6 +256,7 @@ void OfaMSFilterTabPage2::Reset( const SfxItemSet& )
         { Calc,     &SvtFilterOptions::IsCalc2Excel },
         { Impress,  &SvtFilterOptions::IsPowerPoint2Impress },
         { Impress,  &SvtFilterOptions::IsImpress2PowerPoint },
+        { SmartArt, &SvtFilterOptions::IsSmartArt2Shape },
         { InvalidCBEntry, NULL }
     };
 
diff --git a/cui/source/options/optfltr.hxx b/cui/source/options/optfltr.hxx
index a81d5c6..7ae6721 100644
--- a/cui/source/options/optfltr.hxx
+++ b/cui/source/options/optfltr.hxx
@@ -79,7 +79,8 @@ class OfaMSFilterTabPage2 : public SfxTabPage
     OUString sChgToFromMath,
            sChgToFromWriter,
            sChgToFromCalc,
-           sChgToFromImpress;
+           sChgToFromImpress,
+           sChgToFromSmartArt;
     SvLBoxButtonData*   pCheckButtonData;
 
     OfaMSFilterTabPage2( Window* pParent, const SfxItemSet& rSet );
diff --git a/cui/source/options/optfltr.src b/cui/source/options/optfltr.src
index 628b26d..41b378c 100644
--- a/cui/source/options/optfltr.src
+++ b/cui/source/options/optfltr.src
@@ -43,5 +43,9 @@ String RID_SVXSTR_CHG_IMPRESS
 {
     Text [ en-US ] = "PowerPoint to %PRODUCTNAME Impress or reverse";
 };
+String RID_SVXSTR_CHG_SMARTART
+{
+    Text [ en-US ] = "SmartArt to %PRODUCTNAME shapes or reverse";
+};
 
 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/include/unotools/fltrcfg.hxx b/include/unotools/fltrcfg.hxx
index 0356aee..71425a3 100644
--- a/include/unotools/fltrcfg.hxx
+++ b/include/unotools/fltrcfg.hxx
@@ -79,6 +79,9 @@ public:
     sal_Bool IsImpress2PowerPoint() const;
     void SetImpress2PowerPoint( sal_Bool bFlag );
 
+    sal_Bool IsSmartArt2Shape() const;
+    void SetSmartArt2Shape( sal_Bool bFlag );
+
     sal_Bool IsEnablePPTPreview() const;
     sal_Bool IsEnableCalcPreview() const;
     sal_Bool IsEnableWordPreview() const;
diff --git a/officecfg/registry/schema/org/openoffice/Office/Common.xcs b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
index ccc6d12..9484a5f 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Common.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Common.xcs
@@ -3977,6 +3977,12 @@
             </info>
             <value>true</value>
           </prop>
+          <prop oor:name="SmartArtToShapes" oor:type="xs:boolean" oor:nillable="false">
+            <info>
+              <desc>Specifies if OOXML SmartArt objects are converted into LO shapes.</desc>
+            </info>
+            <value>false</value>
+          </prop>
           <prop oor:name="ImportWWFieldsAsEnhancedFields" oor:type="xs:boolean" oor:nillable="false">
             <info>
               <desc>Flag to control use of enhanced fields.</desc>
diff --git a/unotools/source/config/fltrcfg.cxx b/unotools/source/config/fltrcfg.cxx
index 29678a1..09829db 100644
--- a/unotools/source/config/fltrcfg.cxx
+++ b/unotools/source/config/fltrcfg.cxx
@@ -48,6 +48,7 @@ using namespace com::sun::star::uno;
 #define FILTERCFG_ENABLE_WORD_PREVIEW   0x80000
 #define FILTERCFG_USE_ENHANCED_FIELDS   0x100000
 #define FILTERCFG_WORD_WBCTBL           0x200000
+#define FILTERCFG_SMARTART_SHAPE_LOAD   0x400000
 
 class SvtAppFilterOptions_Impl : public utl::ConfigItem
 {
@@ -240,7 +241,8 @@ struct SvtFilterOptions_Impl
             FILTERCFG_CALC_SAVE |
             FILTERCFG_IMPRESS_LOAD |
             FILTERCFG_IMPRESS_SAVE |
-            FILTERCFG_USE_ENHANCED_FIELDS;
+            FILTERCFG_USE_ENHANCED_FIELDS |
+            FILTERCFG_SMARTART_SHAPE_LOAD;
         Load();
     }
 
@@ -314,7 +316,7 @@ const Sequence<OUString>& SvtFilterOptions::GetPropertyNames()
     static Sequence<OUString> aNames;
     if(!aNames.getLength())
     {
-        int nCount = 12;
+        int nCount = 13;
         aNames.realloc(nCount);
         static const char* aPropNames[] =
         {
@@ -329,7 +331,8 @@ const Sequence<OUString>& SvtFilterOptions::GetPropertyNames()
             "Export/EnablePowerPointPreview",   //  8
             "Export/EnableExcelPreview",        //  9
             "Export/EnableWordPreview",         // 10
-            "Import/ImportWWFieldsAsEnhancedFields" // 11
+            "Import/ImportWWFieldsAsEnhancedFields", // 11
+            "Import/SmartArtToShapes"           // 12
         };
         OUString* pNames = aNames.getArray();
         for(int i = 0; i < nCount; i++)
@@ -355,6 +358,7 @@ static sal_uLong lcl_GetFlag(sal_Int32 nProp)
         case  9: nFlag = FILTERCFG_ENABLE_EXCEL_PREVIEW; break;
         case 10: nFlag = FILTERCFG_ENABLE_WORD_PREVIEW; break;
         case 11: nFlag = FILTERCFG_USE_ENHANCED_FIELDS; break;
+        case 12: nFlag = FILTERCFG_SMARTART_SHAPE_LOAD; break;
 
         default: OSL_FAIL("illegal value");
     }
@@ -597,6 +601,19 @@ void SvtFilterOptions::SetImpress2PowerPoint( sal_Bool bFlag )
     SetModified();
 }
 
+
+// -----------------------------------------------------------------------
+sal_Bool SvtFilterOptions::IsSmartArt2Shape() const
+{
+    return pImp->IsFlag( FILTERCFG_SMARTART_SHAPE_LOAD );
+}
+
+void SvtFilterOptions::SetSmartArt2Shape( sal_Bool bFlag )
+{
+    pImp->SetFlag( FILTERCFG_SMARTART_SHAPE_LOAD, bFlag );
+    SetModified();
+}
+
 namespace
 {
     class theFilterOptions


More information about the Libreoffice-commits mailing list