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

Miklos Vajna vmiklos at kemper.freedesktop.org
Tue May 29 00:11:46 PDT 2012


 oox/source/shape/ShapeContextHandler.cxx      |   26 +++++++++++++++++++++
 oox/source/shape/ShapeContextHandler.hxx      |    2 +
 writerfilter/source/dmapper/GraphicImport.cxx |    1 
 writerfilter/source/ooxml/model.xml           |   31 ++++++++++++++++++++++++++
 4 files changed, 60 insertions(+)

New commits:
commit 8c6fb76c2cc24c336a28702b5f7f31cb5964129a
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue May 29 08:37:07 2012 +0200

    oox: initial smartart text is imported into Writer

diff --git a/oox/source/shape/ShapeContextHandler.cxx b/oox/source/shape/ShapeContextHandler.cxx
index 3234238..5ceb101 100644
--- a/oox/source/shape/ShapeContextHandler.cxx
+++ b/oox/source/shape/ShapeContextHandler.cxx
@@ -30,6 +30,7 @@
 #include "oox/vml/vmldrawingfragment.hxx"
 #include "oox/vml/vmlshape.hxx"
 #include "oox/vml/vmlshapecontainer.hxx"
+#include "oox/drawingml/diagram/diagram.hxx"
 
 namespace oox { namespace shape {
 
@@ -120,6 +121,19 @@ ShapeContextHandler::getDrawingShapeContext()
 }
 
 uno::Reference<xml::sax::XFastContextHandler>
+ShapeContextHandler::getDiagramShapeContext()
+{
+    if (!mxDiagramShapeContext.is())
+    {
+        FragmentHandlerRef rFragmentHandler(new ShapeFragmentHandler(*mxFilterBase, msRelationFragmentPath));
+        mpShape.reset(new Shape());
+        mxDiagramShapeContext.set(new DiagramGraphicDataContext(*rFragmentHandler, mpShape));
+    }
+
+    return mxDiagramShapeContext;
+}
+
+uno::Reference<xml::sax::XFastContextHandler>
 ShapeContextHandler::getContextHandler()
 {
     uno::Reference<xml::sax::XFastContextHandler> xResult;
@@ -130,6 +144,9 @@ ShapeContextHandler::getContextHandler()
         case NMSP_vml:
             xResult.set(getDrawingShapeContext());
             break;
+        case NMSP_dmlDiagram:
+            xResult.set(getDiagramShapeContext());
+            break;
         default:
             xResult.set(getGraphicShapeContext(mnStartToken));
             break;
@@ -154,6 +171,9 @@ void SAL_CALL ShapeContextHandler::startFastElement
 
     mpThemePtr.reset(new Theme());
 
+    if (Element == DGM_TOKEN(relIds))
+        createFastChildContext(Element, Attribs);
+
     uno::Reference<XFastContextHandler> xContextHandler(getContextHandler());
 
     if (xContextHandler.is())
@@ -247,6 +267,12 @@ ShapeContextHandler::getShape() throw (uno::RuntimeException)
             if( const ::oox::vml::ShapeBase* pShape = mpDrawing->getShapes().takeLastShape() )
                 xResult = pShape->convertAndInsert( xShapes );
         }
+        else if (getContextHandler() == getDiagramShapeContext())
+        {
+            basegfx::B2DHomMatrix aMatrix;
+            mpShape->addShape( *mxFilterBase, mpThemePtr.get(), xShapes, aMatrix );
+            xResult = mpShape->getXShape();
+        }
         else if (mpShape.get() != NULL)
         {
             basegfx::B2DHomMatrix aTransformation;
diff --git a/oox/source/shape/ShapeContextHandler.hxx b/oox/source/shape/ShapeContextHandler.hxx
index df9c398..95aee66 100644
--- a/oox/source/shape/ShapeContextHandler.hxx
+++ b/oox/source/shape/ShapeContextHandler.hxx
@@ -159,6 +159,7 @@ private:
     GraphicShapeContextPtr;
     css::uno::Reference<XFastContextHandler> mxDrawingFragmentHandler;
     css::uno::Reference<XFastContextHandler> mxGraphicShapeContext;
+    css::uno::Reference<XFastContextHandler> mxDiagramShapeContext;
 
     core::XmlFilterRef mxFilterBase;
     drawingml::ThemePtr mpThemePtr;
@@ -168,6 +169,7 @@ private:
 
     css::uno::Reference<XFastContextHandler> getGraphicShapeContext(::sal_Int32 Element);
     css::uno::Reference<XFastContextHandler> getDrawingShapeContext();
+    css::uno::Reference<XFastContextHandler> getDiagramShapeContext();
     css::uno::Reference<XFastContextHandler> getContextHandler();
 };
 
commit 028d56943cac2a6f5eeec5f9f675e20814cb7447
Author: Miklos Vajna <vmiklos at suse.cz>
Date:   Tue May 29 08:36:29 2012 +0200

    writerfilter: read dgm:relIds element and its attributes

diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx
index 4a71e1c..5429bbc 100644
--- a/writerfilter/source/dmapper/GraphicImport.cxx
+++ b/writerfilter/source/dmapper/GraphicImport.cxx
@@ -1165,6 +1165,7 @@ void GraphicImport::lcl_sprm(Sprm & rSprm)
         case NS_ooxml::LN_CT_WrapPath_lineTo: // 90925;
         case NS_ooxml::LN_graphic_graphic:
         case NS_ooxml::LN_pic_pic:
+        case NS_ooxml::LN_dgm_relIds:
         {
             writerfilter::Reference<Properties>::Pointer_t pProperties = rSprm.getProps();
             if( pProperties.get())
diff --git a/writerfilter/source/ooxml/model.xml b/writerfilter/source/ooxml/model.xml
index c5fea31..dbaa151 100644
--- a/writerfilter/source/ooxml/model.xml
+++ b/writerfilter/source/ooxml/model.xml
@@ -8,6 +8,7 @@
   <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/main" alias="drawingml" id="dml"/>
   <namespace-alias name="urn:schemas-microsoft-com:vml" alias="vml" id="vml"/>
   <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/picture" alias="picture" id="dmlPicture"/>
+  <namespace-alias name="http://schemas.openxmlformats.org/drawingml/2006/diagram" alias="diagram" id="dmlDiagram"/>
   <namespace-alias name="urn:schemas-microsoft-com:office:word" alias="vml_wordprocessingDrawing" id="vmlWord"/>
   <namespace-alias name="http://schemas.openxmlformats.org/wordprocessingml/2006/main" alias="wordprocessingml" id="doc"/>
   <namespace-alias name="http://schemas.openxmlformats.org/officeDocument/2006/math" alias="math" id="officeMath"/>
@@ -5146,6 +5147,7 @@
       <define name="CT_GraphicalObjectData">
         <zeroOrMore>
           <ref name="pic"/>
+          <ref name="relIds"/>
           <element>
             <anyName/>
             <ref name="BUILT_IN_ANY_TYPE"/>
@@ -5171,6 +5173,7 @@
     </grammar>
     <resource name="CT_GraphicalObjectData" resource="Properties" tag="shape">
       <element name="pic" tokenid="ooxml:CT_GraphicalObjectData_pic"/>
+      <element name="relIds" tokenid="ooxml:CT_GraphicalObjectData_relIds"/>
       <attribute name="uri" tokenid="ooxml:CT_GraphicalObjectData_uri"/>
     </resource>
     <resource name="CT_GraphicalObject" resource="Properties" tag="shape">
@@ -8415,6 +8418,25 @@
           <ref name="CT_Picture"/>
         </element>
       </define>
+      <define xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" name="CT_RelIds">
+        <attribute name="r:dm">
+          <text/>
+        </attribute>
+        <attribute name="r:lo">
+          <text/>
+        </attribute>
+        <attribute name="r:qs">
+          <text/>
+        </attribute>
+        <attribute name="r:cs">
+          <text/>
+        </attribute>
+      </define>
+      <define name="relIds">
+        <element xmlns:dgm="http://schemas.openxmlformats.org/drawingml/2006/diagram" name="dgm:relIds">
+          <ref name="CT_RelIds"/>
+        </element>
+      </define>
     </grammar>
     <resource name="CT_PictureNonVisual" resource="Properties" tag="shape">
       <element name="cNvPr" tokenid="ooxml:CT_PictureNonVisual_cNvPr"/>
@@ -8428,6 +8450,15 @@
     <resource name="pic" resource="Properties" tag="shape">
       <element name="pic" tokenid="ooxml:pic_pic"/>
     </resource>
+    <resource xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" name="CT_RelIds" resource="Shape" tag="shape">
+      <attribute name="r:dm" tokenid="ooxml:CT_RelIds_dm"/>
+      <attribute name="r:lo" tokenid="ooxml:CT_RelIds_lo"/>
+      <attribute name="r:qs" tokenid="ooxml:CT_RelIds_qs"/>
+      <attribute name="r:cs" tokenid="ooxml:CT_RelIds_cs"/>
+    </resource>
+    <resource name="relIds" resource="Shape" tag="shape">
+      <element xmlns:dgm="http://schemas.openxmlformats.org/drawingml/2006/diagram" name="dgm:relIds" tokenid="ooxml:dgm_relIds"/>
+    </resource>
   </namespace>
   <namespace name="vml-main" file="vml-main.rng" todo="ignore">
     <start name="shape"/>


More information about the Libreoffice-commits mailing list