[Libreoffice-commits] .: 12 commits - filter/source oox/inc oox/source
Katarina Machalkova
bubli at kemper.freedesktop.org
Tue Oct 19 09:25:14 PDT 2010
filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu | 2
filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_Template.xcu | 2
filter/source/config/fragments/types/MS_PowerPoint_2007_XML.xcu | 2
oox/inc/oox/core/filterbase.hxx | 5
oox/inc/oox/core/xmlfilterbase.hxx | 31
oox/inc/oox/drawingml/chart/converterbase.hxx | 2
oox/inc/oox/drawingml/customshapeproperties.hxx | 1
oox/inc/oox/drawingml/diagram/datamodelcontext.hxx | 54
oox/inc/oox/drawingml/diagram/diagram.hxx | 242 ---
oox/inc/oox/drawingml/diagram/diagramfragmenthandler.hxx | 100 -
oox/inc/oox/drawingml/diagram/diagramlayoutatoms.hxx | 209 ---
oox/inc/oox/drawingml/drawingmltypes.hxx | 3
oox/inc/oox/drawingml/graphicshapecontext.hxx | 5
oox/inc/oox/drawingml/scene3dcontext.hxx | 56
oox/inc/oox/drawingml/shape.hxx | 29
oox/inc/oox/drawingml/shape3dproperties.hxx | 134 +
oox/inc/oox/drawingml/theme.hxx | 8
oox/inc/oox/export/drawingml.hxx | 17
oox/inc/oox/export/shapes.hxx | 26
oox/inc/oox/ppt/dgmimport.hxx | 71 +
oox/inc/oox/ppt/dgmlayout.hxx | 72 +
oox/inc/oox/ppt/pptimport.hxx | 5
oox/inc/oox/xls/excelfilter.hxx | 2
oox/inc/oox/xls/workbookhelper.hxx | 2
oox/source/core/facreg.cxx | 6
oox/source/core/filterbase.cxx | 9
oox/source/core/xmlfilterbase.cxx | 167 ++
oox/source/drawingml/chart/chartspaceconverter.cxx | 5
oox/source/drawingml/chart/converterbase.cxx | 4
oox/source/drawingml/chart/datasourceconverter.cxx | 13
oox/source/drawingml/clrscheme.cxx | 2
oox/source/drawingml/color.cxx | 1
oox/source/drawingml/customshapegeometry.cxx | 6
oox/source/drawingml/diagram/constraintlistcontext.cxx | 102 +
oox/source/drawingml/diagram/constraintlistcontext.hxx | 54
oox/source/drawingml/diagram/datamodelcontext.cxx | 234 ++-
oox/source/drawingml/diagram/datamodelcontext.hxx | 57
oox/source/drawingml/diagram/diagram.cxx | 498 ++++++-
oox/source/drawingml/diagram/diagram.hxx | 323 ++++
oox/source/drawingml/diagram/diagramdefinitioncontext.cxx | 13
oox/source/drawingml/diagram/diagramdefinitioncontext.hxx | 2
oox/source/drawingml/diagram/diagramfragmenthandler.cxx | 185 +-
oox/source/drawingml/diagram/diagramfragmenthandler.hxx | 117 +
oox/source/drawingml/diagram/diagramlayoutatoms.cxx | 691 +++++++++-
oox/source/drawingml/diagram/diagramlayoutatoms.hxx | 318 ++++
oox/source/drawingml/diagram/layoutnodecontext.cxx | 148 +-
oox/source/drawingml/diagram/layoutnodecontext.hxx | 3
oox/source/drawingml/diagram/makefile.mk | 1
oox/source/drawingml/drawingmltypes.cxx | 4
oox/source/drawingml/fillproperties.cxx | 3
oox/source/drawingml/graphicshapecontext.cxx | 58
oox/source/drawingml/lineproperties.cxx | 5
oox/source/drawingml/makefile.mk | 1
oox/source/drawingml/scene3dcontext.cxx | 189 ++
oox/source/drawingml/shape.cxx | 52
oox/source/drawingml/shape3dproperties.cxx | 66
oox/source/drawingml/shapepropertiescontext.cxx | 6
oox/source/drawingml/textparagraph.cxx | 9
oox/source/drawingml/textparagraphproperties.cxx | 1
oox/source/export/drawingml.cxx | 181 ++
oox/source/export/shapes.cxx | 32
oox/source/helper/storagebase.cxx | 20
oox/source/ppt/dgmimport.cxx | 135 +
oox/source/ppt/dgmlayout.cxx | 193 ++
oox/source/ppt/makefile.mk | 2
oox/source/ppt/pptimport.cxx | 30
oox/source/ppt/presentationfragmenthandler.cxx | 23
oox/source/ppt/slidepersist.cxx | 13
oox/source/shape/ShapeFilterBase.cxx | 4
oox/source/shape/ShapeFilterBase.hxx | 2
oox/source/xls/excelfilter.cxx | 2
oox/source/xls/workbookhelper.cxx | 4
72 files changed, 4028 insertions(+), 1046 deletions(-)
New commits:
commit 57c9047e1b107bb079eb22ff9771ea5f2e33af69
Author: Katarina Machalkova <kmachalkova at suse.cz>
Date: Tue Oct 19 17:14:37 2010 +0200
New files from oox-smartart-import.diff
diff --git a/oox/inc/oox/drawingml/scene3dcontext.hxx b/oox/inc/oox/drawingml/scene3dcontext.hxx
new file mode 100644
index 0000000..c64bbf3
--- /dev/null
+++ b/oox/inc/oox/drawingml/scene3dcontext.hxx
@@ -0,0 +1,56 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: fillpropertiesgroupcontext.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_DRAWINGML_SCENE3DPROPERTIESCONTEXT_HPP
+#define OOX_DRAWINGML_SCENE3DPROPERTIESCONTEXT_HPP
+
+#include "oox/core/contexthandler.hxx"
+
+namespace oox { namespace drawingml {
+
+struct Shape3DProperties;
+
+// ---------------------------------------------------------------------
+
+class Scene3DPropertiesContext : public ::oox::core::ContextHandler
+{
+public:
+ Scene3DPropertiesContext( ::oox::core::ContextHandler& rParent, Shape3DProperties& r3DProperties ) throw();
+
+ ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs )
+ throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
+
+private:
+ Shape3DProperties& mr3DProperties;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SCENE3DPROPERTIESCONTEXT_HPP
diff --git a/oox/inc/oox/drawingml/shape3dproperties.hxx b/oox/inc/oox/drawingml/shape3dproperties.hxx
new file mode 100644
index 0000000..1ebee30
--- /dev/null
+++ b/oox/inc/oox/drawingml/shape3dproperties.hxx
@@ -0,0 +1,134 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: fillproperties.hxx,v $
+ * $Revision: 1.7 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_DRAWINGML_SHAPE3DPROPERTIES_HXX
+#define OOX_DRAWINGML_SHAPE3DPROPERTIES_HXX
+
+#include <map>
+#include <com/sun/star/graphic/XGraphic.hpp>
+#include <com/sun/star/geometry/IntegerRectangle2D.hpp>
+#include "oox/core/xmlfilterbase.hxx"
+#include "oox/drawingml/color.hxx"
+#include "oox/helper/helper.hxx"
+
+namespace oox { class PropertyMap; }
+namespace oox { class PropertySet; }
+namespace oox { namespace core { class ModelObjectContainer; } }
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+struct Shape3DPropertyNames
+{
+ ::rtl::OUString maFillStyle;
+ ::rtl::OUString maFillColor;
+ ::rtl::OUString maFillTransparence;
+ ::rtl::OUString maFillGradient;
+ ::rtl::OUString maFillBitmap;
+ ::rtl::OUString maFillBitmapMode;
+ ::rtl::OUString maFillBitmapTile;
+ ::rtl::OUString maFillBitmapStretch;
+ ::rtl::OUString maFillBitmapLogicalSize;
+ ::rtl::OUString maFillBitmapSizeX;
+ ::rtl::OUString maFillBitmapSizeY;
+ ::rtl::OUString maFillBitmapOffsetX;
+ ::rtl::OUString maFillBitmapOffsetY;
+ ::rtl::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.
+
+ /** 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;
+};
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
+
+#endif
diff --git a/oox/inc/oox/ppt/dgmimport.hxx b/oox/inc/oox/ppt/dgmimport.hxx
new file mode 100644
index 0000000..955b1fa
--- /dev/null
+++ b/oox/inc/oox/ppt/dgmimport.hxx
@@ -0,0 +1,71 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: pptimport.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_POWERPOINT_QUICKDIAGRAMMINGIMPORT_HXX
+#define OOX_POWERPOINT_QUICKDIAGRAMMINGIMPORT_HXX
+
+#include "oox/core/xmlfilterbase.hxx"
+
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <oox/drawingml/theme.hxx>
+#include "oox/ppt/presentationfragmenthandler.hxx"
+#include "oox/ppt/slidepersist.hxx"
+#include "tokens.hxx"
+#include <vector>
+#include <map>
+
+namespace oox { namespace ppt {
+
+// ---------------------------------------------------------------------
+
+class QuickDiagrammingImport : public oox::core::XmlFilterBase
+{
+public:
+
+ QuickDiagrammingImport( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr );
+
+ // from FilterBase
+ virtual bool importDocument() throw();
+ virtual bool exportDocument() throw();
+
+ virtual const ::oox::drawingml::Theme* getCurrentTheme() const;
+ virtual sal_Int32 getSchemeClr( sal_Int32 nColorSchemeToken ) const;
+ virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
+
+ virtual oox::vml::Drawing* getVmlDrawing();
+ virtual oox::drawingml::chart::ChartConverter* getChartConverter();
+
+private:
+ virtual ::rtl::OUString implGetImplementationName() const;
+};
+
+} }
+
+#endif // OOX_POWERPOINT_QUICKDIAGRAMMINGIMPORT_HXX
diff --git a/oox/inc/oox/ppt/dgmlayout.hxx b/oox/inc/oox/ppt/dgmlayout.hxx
new file mode 100644
index 0000000..8e3847b
--- /dev/null
+++ b/oox/inc/oox/ppt/dgmlayout.hxx
@@ -0,0 +1,72 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: pptimport.hxx,v $
+ * $Revision: 1.6 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_POWERPOINT_QUICKDIAGRAMMINGLAYOUT_HXX
+#define OOX_POWERPOINT_QUICKDIAGRAMMINGLAYOUT_HXX
+
+#include "oox/core/xmlfilterbase.hxx"
+
+#include <com/sun/star/animations/XAnimationNode.hpp>
+#include <oox/drawingml/theme.hxx>
+#include "oox/ppt/presentationfragmenthandler.hxx"
+#include "oox/ppt/slidepersist.hxx"
+#include "tokens.hxx"
+#include <vector>
+#include <map>
+
+namespace oox { namespace ppt {
+
+// ---------------------------------------------------------------------
+
+class QuickDiagrammingLayout : public oox::core::XmlFilterBase
+{
+public:
+
+ QuickDiagrammingLayout( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr );
+
+ // from FilterBase
+ virtual bool importDocument() throw();
+ virtual bool exportDocument() throw();
+
+ virtual const ::oox::drawingml::Theme* getCurrentTheme() const;
+ virtual sal_Int32 getSchemeClr( sal_Int32 nColorSchemeToken ) const;
+ virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
+
+ virtual ::oox::vml::Drawing* getVmlDrawing();
+ virtual ::oox::drawingml::chart::ChartConverter* getChartConverter();
+
+private:
+ virtual ::rtl::OUString implGetImplementationName() const;
+ drawingml::ThemePtr mpThemePtr;
+};
+
+} }
+
+#endif // OOX_POWERPOINT_QUICKDIAGRAMMINGLAYOUT_HXX
diff --git a/oox/source/drawingml/diagram/constraintlistcontext.cxx b/oox/source/drawingml/diagram/constraintlistcontext.cxx
new file mode 100644
index 0000000..5351977
--- /dev/null
+++ b/oox/source/drawingml/diagram/constraintlistcontext.cxx
@@ -0,0 +1,102 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile$
+ * $Revision$
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "constraintlistcontext.hxx"
+#include "oox/helper/attributelist.hxx"
+#include "oox/core/namespaces.hxx"
+
+using namespace ::oox::core;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using ::rtl::OUString;
+
+namespace oox { namespace drawingml {
+
+// CT_ConstraintLists
+ConstraintListContext::ConstraintListContext( ContextHandler& rParent,
+ const Reference< XFastAttributeList >&,
+ const LayoutAtomPtr &pNode )
+ : ContextHandler( rParent )
+ , mpNode( pNode )
+{
+ OSL_ENSURE( pNode, "Node must NOT be NULL" );
+}
+
+
+ConstraintListContext::~ConstraintListContext()
+{
+}
+
+void SAL_CALL ConstraintListContext::endFastElement( ::sal_Int32 )
+ throw (SAXException, RuntimeException)
+{
+}
+
+Reference< XFastContextHandler > SAL_CALL
+ConstraintListContext::createFastChildContext( ::sal_Int32 aElement,
+ const Reference< XFastAttributeList >& xAttribs )
+ throw (SAXException, RuntimeException)
+{
+ Reference< XFastContextHandler > xRet;
+
+ OUString aEmptyStr;
+
+ switch( aElement )
+ {
+ case NMSP_DIAGRAM|XML_constr:
+ {
+ ConstraintAtomPtr pNode( new ConstraintAtom() );
+ mpNode->addChild( pNode );
+
+ AttributeList aAttribs( xAttribs );
+ pNode->setFor( aAttribs.getToken( XML_for, XML_none ) );
+ pNode->setForName( aAttribs.getString( XML_forName, aEmptyStr ) );
+ pNode->setPointType( aAttribs.getToken( XML_ptType, XML_none ) );
+ pNode->setType( aAttribs.getToken( XML_type, XML_none ) );
+ pNode->setRefFor( aAttribs.getToken( XML_refFor, XML_none ) );
+ pNode->setRefForName( aAttribs.getString( XML_refForName, aEmptyStr ) );
+ pNode->setRefType( aAttribs.getToken( XML_refType, XML_none ) );
+ pNode->setRefPointType( aAttribs.getToken( XML_refPtType, XML_none ) );
+ pNode->setFactor( aAttribs.getDouble( XML_fact, 1.0 ) );
+ pNode->setValue( aAttribs.getDouble( XML_val, 0.0 ) );
+ pNode->setOperator( aAttribs.getToken( XML_op, XML_none ) );
+ break;
+ }
+ default:
+ break;
+ }
+ if( !xRet.is() )
+ xRet.set(this);
+
+ return xRet;
+}
+
+
+} }
diff --git a/oox/source/drawingml/diagram/constraintlistcontext.hxx b/oox/source/drawingml/diagram/constraintlistcontext.hxx
new file mode 100644
index 0000000..ecbb04c
--- /dev/null
+++ b/oox/source/drawingml/diagram/constraintlistcontext.hxx
@@ -0,0 +1,54 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile$
+ * $Revision$
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_DRAWINGML_CONSTRAINTLISTCONTEXT_HXX
+#define OOX_DRAWINGML_CONSTRAINTLISTCONTEXT_HXX
+
+#include "oox/core/contexthandler.hxx"
+#include "diagramlayoutatoms.hxx"
+#include "diagram.hxx"
+
+namespace oox { namespace drawingml {
+
+class ConstraintListContext : public ::oox::core::ContextHandler
+{
+public:
+ ConstraintListContext( ContextHandler& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, const LayoutAtomPtr &pNode );
+ virtual ~ConstraintListContext();
+
+ virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+private:
+ LayoutAtomPtr mpNode;
+};
+
+} }
+
+#endif
diff --git a/oox/source/drawingml/diagram/datamodelcontext.hxx b/oox/source/drawingml/diagram/datamodelcontext.hxx
new file mode 100644
index 0000000..be79609
--- /dev/null
+++ b/oox/source/drawingml/diagram/datamodelcontext.hxx
@@ -0,0 +1,57 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: datamodelcontext.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef OOX_DRAWINGML_SHAPECONTEXT_HXX
+#define OOX_DRAWINGML_SHAPECONTEXT_HXX
+
+#include <com/sun/star/drawing/XShapes.hpp>
+
+#include "oox/core/contexthandler.hxx"
+#include "diagram.hxx"
+
+namespace oox { namespace drawingml {
+
+// CT_DataModel
+class DataModelContext : public ::oox::core::ContextHandler
+{
+public:
+ DataModelContext( ::oox::core::ContextHandler& rParent, const DiagramDataPtr & pDataModelPtr );
+ virtual ~DataModelContext();
+
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+protected:
+ DiagramDataPtr mpDataModel;
+};
+
+} }
+
+#endif // OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX
diff --git a/oox/source/drawingml/diagram/diagram.hxx b/oox/source/drawingml/diagram/diagram.hxx
new file mode 100644
index 0000000..6c8075c
--- /dev/null
+++ b/oox/source/drawingml/diagram/diagram.hxx
@@ -0,0 +1,323 @@
+/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile$
+ * $Revision$
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_DRAWINGML_DIAGRAM_DIAGRAM_HXX
+#define OOX_DRAWINGML_DIAGRAM_DIAGRAM_HXX
+
+#include <map>
+#include <vector>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
+
+#include <rtl/ustring.hxx>
+
+#include "tokens.hxx"
+#include "oox/drawingml/shape.hxx"
+#include "oox/drawingml/fillproperties.hxx"
+
+namespace com { namespace sun { namespace star {
+ namespace xml { namespace dom { class XDocument; } }
+} } }
+
+namespace oox { namespace drawingml {
+
+namespace dgm {
+
+/** A Connection
+ */
+struct Connection
+{
+ Connection() :
+ mnType( 0 ),
+ mnSourceOrder( 0 ),
+ mnDestOrder( 0 )
+ {}
+
+ void dump();
+
+ sal_Int32 mnType;
+ ::rtl::OUString msModelId;
+ ::rtl::OUString msSourceId;
+ ::rtl::OUString msDestId;
+ ::rtl::OUString msParTransId;
+ ::rtl::OUString msPresId;
+ ::rtl::OUString msSibTransId;
+ sal_Int32 mnSourceOrder;
+ sal_Int32 mnDestOrder;
+
+};
+
+typedef std::vector< Connection > Connections;
+
+
+/** A point
+ */
+struct Point
+{
+ Point() :
+ mnType(0),
+ mnMaxChildren(-1),
+ mnPreferredChildren(-1),
+ mnDirection(XML_norm),
+ mnHierarchyBranch(XML_std),
+ mnResizeHandles(XML_rel),
+ mnCustomAngle(-1),
+ mnPercentageNeighbourWidth(-1),
+ mnPercentageNeighbourHeight(-1),
+ mnPercentageOwnWidth(-1),
+ mnPercentageOwnHeight(-1),
+ mnIncludeAngleScale(-1),
+ mnRadiusScale(-1),
+ mnWidthScale(-1),
+ mnHeightScale(-1),
+ mnWidthOverride(-1),
+ mnHeightOverride(-1),
+ mnLayoutStyleCount(-1),
+ mnLayoutStyleIndex(-1),
+
+ mbOrgChartEnabled(false),
+ mbBulletEnabled(false),
+ mbCoherent3DOffset(false),
+ mbCustomHorizontalFlip(false),
+ mbCustomVerticalFlip(false),
+ mbCustomText(false),
+ mbIsPlaceholder(false)
+ {}
+ void dump();
+
+ ShapePtr mpShape;
+
+ rtl::OUString msCnxId;
+ rtl::OUString msModelId;
+ rtl::OUString msColorTransformCategoryId;
+ rtl::OUString msColorTransformTypeId;
+ rtl::OUString msLayoutCategoryId;
+ rtl::OUString msLayoutTypeId;
+ rtl::OUString msPlaceholderText;
+ rtl::OUString msPresentationAssociationId;
+ rtl::OUString msPresentationLayoutName;
+ rtl::OUString msPresentationLayoutStyleLabel;
+ rtl::OUString msQuickStyleCategoryId;
+ rtl::OUString msQuickStyleTypeId;
+
+ sal_Int32 mnType;
+ sal_Int32 mnMaxChildren;
+ sal_Int32 mnPreferredChildren;
+ sal_Int32 mnDirection;
+ sal_Int32 mnHierarchyBranch;
+ sal_Int32 mnResizeHandles;
+ sal_Int32 mnCustomAngle;
+ sal_Int32 mnPercentageNeighbourWidth;
+ sal_Int32 mnPercentageNeighbourHeight;
+ sal_Int32 mnPercentageOwnWidth;
+ sal_Int32 mnPercentageOwnHeight;
+ sal_Int32 mnIncludeAngleScale;
+ sal_Int32 mnRadiusScale;
+ sal_Int32 mnWidthScale;
+ sal_Int32 mnHeightScale;
+ sal_Int32 mnWidthOverride;
+ sal_Int32 mnHeightOverride;
+ sal_Int32 mnLayoutStyleCount;
+ sal_Int32 mnLayoutStyleIndex;
+
+ bool mbOrgChartEnabled;
+ bool mbBulletEnabled;
+ bool mbCoherent3DOffset;
+ bool mbCustomHorizontalFlip;
+ bool mbCustomVerticalFlip;
+ bool mbCustomText;
+ bool mbIsPlaceholder;
+};
+
+typedef std::vector< Point > Points;
+
+}
+
+class LayoutNode;
+typedef boost::shared_ptr< LayoutNode > LayoutNodePtr;
+
+////////////////////
+
+class DiagramData
+{
+public:
+ typedef std::map< rtl::OUString, dgm::Point* > PointNameMap;
+ typedef std::map< rtl::OUString,
+ std::vector<dgm::Point*> > PointsNameMap;
+ typedef std::map< rtl::OUString, const dgm::Connection* > ConnectionNameMap;
+ typedef std::map< rtl::OUString,
+ std::vector<std::pair<rtl::OUString,sal_Int32> > > StringMap;
+
+ DiagramData();
+ FillPropertiesPtr & getFillProperties()
+ { return mpFillProperties; }
+ dgm::Connections & getConnections()
+ { return maConnections; }
+ dgm::Points & getPoints()
+ { return maPoints; }
+ ConnectionNameMap & getConnectionNameMap()
+ { return maConnectionNameMap; }
+ StringMap & getPresOfNameMap()
+ { return maPresOfNameMap; }
+ PointNameMap & getPointNameMap()
+ { return maPointNameMap; }
+ PointsNameMap & getPointsPresNameMap()
+ { return maPointsPresNameMap; }
+ void dump();
+private:
+ FillPropertiesPtr mpFillProperties;
+ dgm::Connections maConnections;
+ dgm::Points maPoints;
+ PointNameMap maPointNameMap;
+ PointsNameMap maPointsPresNameMap;
+ ConnectionNameMap maConnectionNameMap;
+ StringMap maPresOfNameMap;
+};
+
+typedef boost::shared_ptr< DiagramData > DiagramDataPtr;
+
+
+
+////////////////////
+
+class DiagramLayout
+{
+public:
+ void setDefStyle( const ::rtl::OUString & sDefStyle )
+ { msDefStyle = sDefStyle; }
+ void setMinVer( const ::rtl::OUString & sMinVer )
+ { msMinVer = sMinVer; }
+ void setUniqueId( const ::rtl::OUString & sUniqueId )
+ { msUniqueId = sUniqueId; }
+ const ::rtl::OUString & getUniqueId()
+ { return msUniqueId; }
+ void setTitle( const ::rtl::OUString & sTitle )
+ { msTitle = sTitle; }
+ void setDesc( const ::rtl::OUString & sDesc )
+ { msDesc = sDesc; }
+
+ LayoutNodePtr & getNode()
+ { return mpNode; }
+ const LayoutNodePtr & getNode() const
+ { return mpNode; }
+ DiagramDataPtr & getSampData()
+ { return mpSampData; }
+ const DiagramDataPtr & getSampData() const
+ { return mpSampData; }
+ DiagramDataPtr & getStyleData()
+ { return mpStyleData; }
+ const DiagramDataPtr & getStyleData() const
+ { return mpStyleData; }
+
+ void layout( const dgm::Points & pTree, const com::sun::star::awt::Point & pt );
+
+private:
+ ::rtl::OUString msDefStyle;
+ ::rtl::OUString msMinVer;
+ ::rtl::OUString msUniqueId;
+
+ ::rtl::OUString msTitle;
+ ::rtl::OUString msDesc;
+ LayoutNodePtr mpNode;
+ DiagramDataPtr mpSampData;
+ DiagramDataPtr mpStyleData;
+ // TODO
+ // catLst
+ // clrData
+};
+
+typedef boost::shared_ptr< DiagramLayout > DiagramLayoutPtr;
+
+///////////////////////
+
+struct DiagramStyle
+{
+ ShapeStyleRef maFillStyle;
+ ShapeStyleRef maLineStyle;
+ ShapeStyleRef maEffectStyle;
+ ShapeStyleRef maTextStyle;
+};
+
+typedef std::map<rtl::OUString,DiagramStyle> DiagramQStyleMap;
+
+struct DiagramColor
+{
+ oox::drawingml::Color maFillColor;
+ oox::drawingml::Color maLineColor;
+ oox::drawingml::Color maEffectColor;
+ oox::drawingml::Color maTextFillColor;
+ oox::drawingml::Color maTextLineColor;
+ oox::drawingml::Color maTextEffectColor;
+};
+
+typedef std::map<rtl::OUString,DiagramColor> DiagramColorMap;
+
+///////////////////////
+
+class Diagram
+{
+public:
+ void setData( const DiagramDataPtr & );
+ DiagramDataPtr getData() const
+ {
+ return mpData;
+ }
+ void setLayout( const DiagramLayoutPtr & );
+ DiagramLayoutPtr getLayout() const
+ {
+ return mpLayout;
+ }
+
+ DiagramQStyleMap& getStyles() { return maStyles; }
+ const DiagramQStyleMap& getStyles() const { return maStyles; }
+ DiagramColorMap& getColors() { return maColors; }
+ const DiagramColorMap& getColors() const { return maColors; }
+
+ void addTo( const ShapePtr & pShape );
+ ::rtl::OUString getLayoutId() const;
+private:
+ void build( );
+ DiagramDataPtr mpData;
+ DiagramLayoutPtr mpLayout;
+ DiagramQStyleMap maStyles;
+ DiagramColorMap maColors;
+ std::map< ::rtl::OUString, ShapePtr > maShapeMap;
+};
+
+
+typedef boost::shared_ptr< Diagram > DiagramPtr;
+
+} }
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/diagram/diagramfragmenthandler.hxx b/oox/source/drawingml/diagram/diagramfragmenthandler.hxx
new file mode 100644
index 0000000..169e142
--- /dev/null
+++ b/oox/source/drawingml/diagram/diagramfragmenthandler.hxx
@@ -0,0 +1,117 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: diagramfragmenthandler.hxx,v $
+ * $Revision: 1.4 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+
+#ifndef OOX_DRAWINGML_DIAGRAMFRAGMENTHANDLER
+#define OOX_DRAWINGML_DIAGRAMFRAGMENTHANDLER
+
+#include "oox/core/fragmenthandler.hxx"
+#include "oox/core/fragmenthandler2.hxx"
+#include "oox/drawingml/diagram/diagram.hxx"
+
+namespace oox { namespace drawingml {
+
+
+class DiagramDataFragmentHandler : public ::oox::core::FragmentHandler
+{
+public:
+ DiagramDataFragmentHandler( oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramDataPtr pDataPtr ) throw();
+ virtual ~DiagramDataFragmentHandler() throw();
+
+ virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ DiagramDataPtr mpDataPtr;
+};
+
+
+
+class DiagramLayoutFragmentHandler : public ::oox::core::FragmentHandler
+{
+public:
+ DiagramLayoutFragmentHandler( oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramLayoutPtr pDataPtr ) throw();
+ virtual ~DiagramLayoutFragmentHandler() throw();
+
+ virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+ virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
+
+private:
+
+ DiagramLayoutPtr mpDataPtr;
+};
+
+class DiagramQStylesFragmentHandler : public ::oox::core::FragmentHandler2
+{
+public:
+ DiagramQStylesFragmentHandler(
+ oox::core::XmlFilterBase& rFilter,
+ const ::rtl::OUString& rFragmentPath,
+ DiagramQStyleMap& rStylesMap );
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+ virtual void onStartElement( const AttributeList& rAttribs );
+ virtual void onEndElement( const ::rtl::OUString& rChars );
+
+private:
+ ::oox::core::ContextHandlerRef createStyleMatrixContext(sal_Int32 nElement,
+ const AttributeList& rAttribs,
+ ShapeStyleRef& o_rStyle);
+
+ ::rtl::OUString maStyleName;
+ DiagramStyle maStyleEntry;
+ DiagramQStyleMap& mrStylesMap;
+};
+
+class ColorFragmentHandler : public ::oox::core::FragmentHandler2
+{
+public:
+ ColorFragmentHandler(
+ ::oox::core::XmlFilterBase& rFilter,
+ const ::rtl::OUString& rFragmentPath,
+ DiagramColorMap& rColorMap );
+
+ virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
+
+ virtual void onStartElement( const AttributeList& rAttribs );
+ virtual void onEndElement( const ::rtl::OUString& rChars );
+
+private:
+ ::rtl::OUString maColorName;
+ DiagramColor maColorEntry;
+ DiagramColorMap& mrColorsMap;
+};
+
+} }
+
+
+#endif
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
new file mode 100644
index 0000000..5f7ab29
--- /dev/null
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
@@ -0,0 +1,318 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: diagramlayoutatoms.hxx,v $
+ * $Revision: 1.3 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#ifndef OOX_DRAWINGML_DIAGRAMLAYOUTATOMS_HXX
+#define OOX_DRAWINGML_DIAGRAMLAYOUTATOMS_HXX
+
+#include <map>
+#include <string>
+
+#include <boost/shared_ptr.hpp>
+#include <boost/array.hpp>
+
+#include <com/sun/star/uno/Any.hxx>
+#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
+
+#include "oox/drawingml/shape.hxx"
+#include "diagram.hxx"
+
+
+namespace oox { namespace drawingml {
+
+class DiagramLayout;
+typedef boost::shared_ptr< DiagramLayout > DiagramLayoutPtr;
+
+// AG_IteratorAttributes
+struct IteratorAttr
+{
+ IteratorAttr();
+
+ // not sure this belong here, but wth
+ void loadFromXAttr( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
+
+ sal_Int32 mnAxis;
+ sal_Int32 mnCnt;
+ sal_Bool mbHideLastTrans;
+ sal_Int32 mnPtType;
+ sal_Int32 mnSt;
+ sal_Int32 mnStep;
+};
+
+struct ConditionAttr
+{
+ ConditionAttr();
+
+ // not sure this belong here, but wth
+ void loadFromXAttr( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
+
+ sal_Int32 mnFunc;
+ sal_Int32 mnArg;
+ sal_Int32 mnOp;
+ ::rtl::OUString msVal;
+};
+
+struct LayoutAtomVisitor;
+class LayoutAtom;
+
+typedef boost::shared_ptr< LayoutAtom > LayoutAtomPtr;
+
+/** abstract Atom for the layout */
+class LayoutAtom
+{
+public:
+ /** visitor acceptance
+ */
+ virtual void accept( LayoutAtomVisitor& ) = 0;
+
+ void setName( const ::rtl::OUString& sName )
+ { msName = sName; }
+ const ::rtl::OUString& getName() const
+ { return msName; }
+
+ virtual void addChild( const LayoutAtomPtr & pNode )
+ { mpChildNodes.push_back( pNode ); }
+ virtual const std::vector<LayoutAtomPtr>& getChildren() const
+ { return mpChildNodes; }
+
+ // dump for debug
+ void dump(int level = 0);
+protected:
+ std::vector< LayoutAtomPtr > mpChildNodes;
+ ::rtl::OUString msName;
+};
+
+class ConstraintAtom
+ : public LayoutAtom
+{
+public:
+ ConstraintAtom() :
+ mnFor(-1), msForName(), mnPointType(-1), mnType(-1), mnRefFor(-1), msRefForName(),
+ mnRefType(-1), mnRefPointType(-1), mfFactor(1.0), mfValue(0.0), mnOperator(0)
+ {}
+
+ virtual void accept( LayoutAtomVisitor& );
+
+ void setFor( sal_Int32 nToken )
+ { mnFor = nToken; }
+ void setForName( const ::rtl::OUString & sName )
+ { msForName = sName; }
+ void setPointType( sal_Int32 nToken )
+ { mnPointType = nToken; }
+ void setType( sal_Int32 nToken )
+ { mnType = nToken; }
+ void setRefFor( sal_Int32 nToken )
+ { mnRefFor = nToken; }
+ void setRefForName( const ::rtl::OUString & sName )
+ { msRefForName = sName; }
+ void setRefType( sal_Int32 nToken )
+ { mnRefType = nToken; }
+ void setRefPointType( sal_Int32 nToken )
+ { mnRefPointType = nToken; }
+ void setFactor( const double& fVal )
+ { mfFactor = fVal; }
+ void setValue( const double& fVal )
+ { mfValue = fVal; }
+ void setOperator( sal_Int32 nToken )
+ { mnOperator = nToken; }
+private:
+ sal_Int32 mnFor;
+ ::rtl::OUString msForName;
+ sal_Int32 mnPointType;
+ sal_Int32 mnType;
+ sal_Int32 mnRefFor;
+ ::rtl::OUString msRefForName;
+ sal_Int32 mnRefType;
+ sal_Int32 mnRefPointType;
+ double mfFactor;
+ double mfValue;
+ sal_Int32 mnOperator;
+};
+
+typedef boost::shared_ptr< ConstraintAtom > ConstraintAtomPtr;
+
+class AlgAtom
+ : public LayoutAtom
+{
+public:
+ AlgAtom() : mnType(0), maMap() {}
+
+ typedef std::map<sal_Int32,sal_Int32> ParamMap;
+
+ virtual void accept( LayoutAtomVisitor& );
+
+ void setType( sal_Int32 nToken )
+ { mnType = nToken; }
+ void addParam( sal_Int32 nType, sal_Int32 nVal )
+ { maMap[nType]=nVal; }
+ void layoutShape( const ShapePtr& rShape,
+ const Diagram& rDgm,
+ const rtl::OUString& rName ) const;
+private:
+ sal_Int32 mnType;
+ ParamMap maMap;
+};
+
+typedef boost::shared_ptr< AlgAtom > AlgAtomPtr;
+
+class ForEachAtom
+ : public LayoutAtom
+{
+public:
+ explicit ForEachAtom(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes);
+
+ IteratorAttr & iterator()
+ { return maIter; }
+ virtual void accept( LayoutAtomVisitor& );
+
+private:
+ IteratorAttr maIter;
+};
+
+typedef boost::shared_ptr< ForEachAtom > ForEachAtomPtr;
+
+
+class ConditionAtom
+ : public LayoutAtom
+{
+public:
+ explicit ConditionAtom(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes);
+ bool test();
+ virtual void accept( LayoutAtomVisitor& );
+ IteratorAttr & iterator()
+ { return maIter; }
+ ConditionAttr & cond()
+ { return maCond; }
+ void readElseBranch()
+ { mbElse=true; }
+ virtual void addChild( const LayoutAtomPtr & pNode );
+ virtual const std::vector<LayoutAtomPtr>& getChildren() const;
+private:
+ bool mbElse;
+ IteratorAttr maIter;
+ ConditionAttr maCond;
+ std::vector< LayoutAtomPtr > mpElseChildNodes;
+};
+
+typedef boost::shared_ptr< ConditionAtom > ConditionAtomPtr;
+
+
+/** "choose" statements. Atoms will be tested in order. */
+class ChooseAtom
+ : public LayoutAtom
+{
+public:
+ virtual void accept( LayoutAtomVisitor& );
+};
+
+class LayoutNode
+ : public LayoutAtom
+{
+public:
+ enum {
+ VAR_animLvl = 0,
+ VAR_animOne,
+ VAR_bulletEnabled,
+ VAR_chMax,
+ VAR_chPref,
+ VAR_dir,
+ VAR_hierBranch,
+ VAR_orgChart,
+ VAR_resizeHandles
+ };
+ // we know that the array is of fixed size
+ // the use of Any allow having empty values
+ typedef boost::array< ::com::sun::star::uno::Any, 9 > VarMap;
+
+ LayoutNode() : mnChildOrder(0) {}
+ virtual void accept( LayoutAtomVisitor& );
+ VarMap & variables()
+ { return mVariables; }
+ void setMoveWith( const ::rtl::OUString & sName )
+ { msMoveWith = sName; }
+ void setStyleLabel( const ::rtl::OUString & sLabel )
+ { msStyleLabel = sLabel; }
+ void setChildOrder( sal_Int32 nOrder )
+ { mnChildOrder = nOrder; }
+ void setShape( const ShapePtr& pShape )
+ { mpShape = pShape; }
+ const ShapePtr& getShape() const
+ { return mpShape; }
+
+ bool setupShape( const ShapePtr& rShape,
+ const Diagram& rDgm,
+ sal_uInt32 nIdx ) const;
+
+private:
+ VarMap mVariables;
+ ::rtl::OUString msMoveWith;
+ ::rtl::OUString msStyleLabel;
+ ShapePtr mpShape;
+ sal_Int32 mnChildOrder;
+};
+
+typedef boost::shared_ptr< LayoutNode > LayoutNodePtr;
+
+struct LayoutAtomVisitor
+{
+ virtual ~LayoutAtomVisitor() {}
+ virtual void visit(ConstraintAtom& rAtom) = 0;
+ virtual void visit(AlgAtom& rAtom) = 0;
+ virtual void visit(ForEachAtom& rAtom) = 0;
+ virtual void visit(ConditionAtom& rAtom) = 0;
+ virtual void visit(ChooseAtom& rAtom) = 0;
+ virtual void visit(LayoutNode& rAtom) = 0;
+};
+
+class ShapeCreationVisitor : public LayoutAtomVisitor
+{
+ ShapePtr mpParentShape;
+ const Diagram& mrDgm;
+ sal_Int32 mnCurrIdx;
+
+ void defaultVisit(LayoutAtom& rAtom);
+ virtual void visit(ConstraintAtom& rAtom);
+ virtual void visit(AlgAtom& rAtom);
+ virtual void visit(ForEachAtom& rAtom);
+ virtual void visit(ConditionAtom& rAtom);
+ virtual void visit(ChooseAtom& rAtom);
+ virtual void visit(LayoutNode& rAtom);
+
+public:
+ ShapeCreationVisitor(const ShapePtr& rParentShape,
+ const Diagram& rDgm) :
+ mpParentShape(rParentShape),
+ mrDgm(rDgm),
+ mnCurrIdx(0)
+ {}
+};
+
+} }
+
+#endif
diff --git a/oox/source/drawingml/scene3dcontext.cxx b/oox/source/drawingml/scene3dcontext.cxx
new file mode 100644
index 0000000..4f629d8
--- /dev/null
+++ b/oox/source/drawingml/scene3dcontext.cxx
@@ -0,0 +1,189 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: fillpropertiesgroupcontext.cxx,v $
+ * $Revision: 1.8.6.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/drawingml/scene3dcontext.hxx"
+#include <com/sun/star/io/XInputStream.hpp>
+#include <com/sun/star/graphic/XGraphicProvider.hpp>
+#include <cppuhelper/exc_hlp.hxx>
+#include <comphelper/anytostring.hxx>
+#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 ::rtl::OUString;
+using ::oox::core::ContextHandler;
+using ::oox::core::XmlFilterBase;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+
+namespace oox { namespace drawingml {
+
+Scene3DContext::Scene3DContext( ContextHandler& rParent, Shape3DProperties& r3DProperties ) throw()
+: ContextHandler( rParent )
+, mr3DProperties( r3DProperties )
+{
+}
+
+Reference< XFastContextHandler > Scene3DContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs )
+ throw ( SAXException, RuntimeException )
+{
+ AttributeList aAttribs( xAttribs );
+ Reference< XFastContextHandler > xRet;
+
+ switch( aElementToken )
+ {
+ case NMSP_DRAWINGML|XML_camera:
+ mr3DProperties.mfFieldOfVision = aAttribs.getInteger( XML_fov, 0 ) / 36000000.0;
+ mr3DProperties.mfZoom = aAttribs.getInteger( XML_zoom, 100000 ) / 100000.0;
+ mr3DProperties.mnPreset = aAttribs.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:
+ mr3DProperties.mnLightRigDirection = aAttribs.getToken( XML_dir, XML_none );
+
+XML_tl
+XML_t
+XML_tr
+XML_l
+XML_r
+XML_bl
+XML_b
+XML_br
+
+
+ mr3DProperties.mnLightRigType = aAttribs.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:
+ return xRet; // TODO: later (backdrop is not supported by core anyway)
+ }
+ return xRet;
+}
+
+} }
diff --git a/oox/source/drawingml/shape3dproperties.cxx b/oox/source/drawingml/shape3dproperties.cxx
new file mode 100644
index 0000000..ea1e4f4
--- /dev/null
+++ b/oox/source/drawingml/shape3dproperties.cxx
@@ -0,0 +1,66 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: fillproperties.cxx,v $
+ * $Revision: 1.7.6.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/drawingml/shape3dproperties.hxx"
+#include <com/sun/star/lang/XMultiServiceFactory.hpp>
+#include <com/sun/star/frame/XFramesSupplier.hpp>
+#include <com/sun/star/beans/XPropertySet.hpp>
+#include <com/sun/star/awt/Gradient.hpp>
+#include <com/sun/star/awt/Size.hpp>
+#include <com/sun/star/awt/XBitmap.hpp>
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/drawing/BitmapMode.hpp>
+#include <com/sun/star/drawing/FillStyle.hpp>
+#include <com/sun/star/drawing/RectanglePoint.hpp>
+#include <com/sun/star/graphic/XGraphicTransformer.hpp>
+#include "oox/helper/propertymap.hxx"
+#include "oox/helper/propertyset.hxx"
+#include "tokens.hxx"
+
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::drawing;
+using namespace ::com::sun::star::graphic;
+
+using ::rtl::OUString;
+using ::com::sun::star::uno::Reference;
+using ::com::sun::star::uno::Exception;
+using ::com::sun::star::uno::UNO_QUERY;
+using ::com::sun::star::uno::UNO_QUERY_THROW;
+using ::oox::core::XmlFilterBase;
+
+namespace oox {
+namespace drawingml {
+
+// ============================================================================
+
+// ============================================================================
+
+} // namespace drawingml
+} // namespace oox
diff --git a/oox/source/ppt/dgmimport.cxx b/oox/source/ppt/dgmimport.cxx
new file mode 100644
index 0000000..2053f91
--- /dev/null
+++ b/oox/source/ppt/dgmimport.cxx
@@ -0,0 +1,135 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: pptimport.cxx,v $
+ * $Revision: 1.8.6.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/ppt/dgmimport.hxx"
+#include "oox/drawingml/theme.hxx"
+#include "oox/drawingml/diagram/diagram.hxx"
+#include "oox/dump/pptxdumper.hxx"
+
+#include <com/sun/star/drawing/XShape.hpp>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace oox::core;
+
+namespace oox { namespace ppt {
+
+OUString SAL_CALL QuickDiagrammingImport_getImplementationName() throw()
+{
+ return CREATE_OUSTRING( "com.sun.star.comp.Impress.oox.QuickDiagrammingImport" );
+}
+
+uno::Sequence< OUString > SAL_CALL QuickDiagrammingImport_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName = CREATE_OUSTRING( "com.sun.star.comp.ooxpptx.dgm.import" );
+ const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL QuickDiagrammingImport_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
+{
+ return (cppu::OWeakObject*)new QuickDiagrammingImport( rSMgr );
+}
+
+QuickDiagrammingImport::QuickDiagrammingImport( const uno::Reference< lang::XMultiServiceFactory > & rSMgr )
+ : XmlFilterBase( rSMgr )
+{}
+
+bool QuickDiagrammingImport::importDocument() throw()
+{
+ /* to activate the PPTX dumper, define the environment variable
+ OOO_PPTXDUMPER and insert the full path to the file
+ file:///<path-to-oox-module>/source/dump/pptxdumper.ini. */
+ OOX_DUMP_FILE( ::oox::dump::pptx::Dumper );
+
+ OUString aEmpty;
+ OUString aFragmentPath = getFragmentPathFromFirstType( CREATE_OFFICEDOC_RELATIONSTYPE( "diagramLayout" ) );
+
+ Reference<drawing::XShapes> xParentShape(getParentShape(),
+ UNO_QUERY_THROW);
+ oox::drawingml::ShapePtr pShape(
+ new oox::drawingml::Shape( "com.sun.star.drawing.DiagramShape" ) );
+ drawingml::loadDiagram(pShape,
+ *this,
+ aEmpty,
+ aFragmentPath,
+ aEmpty,
+ aEmpty);
+ oox::drawingml::ThemePtr pTheme(
+ new oox::drawingml::Theme());
+ pShape->addShape( *this,
+ pTheme.get(),
+ xParentShape,
+ NULL,
+ NULL );
+
+ return true;
+}
+
+bool QuickDiagrammingImport::exportDocument() throw()
+{
+ return false;
+}
+
+const ::oox::drawingml::Theme* QuickDiagrammingImport::getCurrentTheme() const
+{
+ // TODO
+ return 0;
+}
+
+sal_Int32 QuickDiagrammingImport::getSchemeClr( sal_Int32 /*nColorSchemeToken*/ ) const
+{
+ // TODO
+ return 0;
+}
+
+const oox::drawingml::table::TableStyleListPtr QuickDiagrammingImport::getTableStyles()
+{
+ return oox::drawingml::table::TableStyleListPtr();
+}
+
+oox::vml::Drawing* QuickDiagrammingImport::getVmlDrawing()
+{
+ return 0;
+}
+
+oox::drawingml::chart::ChartConverter* QuickDiagrammingImport::getChartConverter()
+{
+ return 0;
+}
+
+OUString QuickDiagrammingImport::implGetImplementationName() const
+{
+ return QuickDiagrammingImport_getImplementationName();
+}
+
+}}
diff --git a/oox/source/ppt/dgmlayout.cxx b/oox/source/ppt/dgmlayout.cxx
new file mode 100644
index 0000000..08854cd
--- /dev/null
+++ b/oox/source/ppt/dgmlayout.cxx
@@ -0,0 +1,193 @@
+/*************************************************************************
+ *
+ * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+ *
+ * Copyright 2008 by Sun Microsystems, Inc.
+ *
+ * OpenOffice.org - a multi-platform office productivity suite
+ *
+ * $RCSfile: pptimport.cxx,v $
+ * $Revision: 1.8.6.1 $
+ *
+ * This file is part of OpenOffice.org.
+ *
+ * OpenOffice.org is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Lesser General Public License version 3
+ * only, as published by the Free Software Foundation.
+ *
+ * OpenOffice.org is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Lesser General Public License version 3 for more details
+ * (a copy is included in the LICENSE file that accompanied this code).
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * version 3 along with OpenOffice.org. If not, see
+ * <http://www.openoffice.org/license.html>
+ * for a copy of the LGPLv3 License.
+ *
+ ************************************************************************/
+
+#include "oox/ppt/dgmlayout.hxx"
+#include "oox/drawingml/theme.hxx"
+#include "oox/drawingml/themefragmenthandler.hxx"
+#include "oox/drawingml/diagram/diagram.hxx"
+#include "oox/dump/pptxdumper.hxx"
+
+#include <com/sun/star/drawing/XShape.hpp>
+#include <com/sun/star/drawing/XMasterPageTarget.hpp>
+#include <com/sun/star/xml/dom/XDocument.hpp>
+#include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
+#include <com/sun/star/container/XChild.hpp>
+
+using ::rtl::OUString;
+using namespace ::com::sun::star;
+using namespace ::com::sun::star::uno;
+using namespace ::com::sun::star::xml::sax;
+using namespace oox::core;
+using namespace ::oox::drawingml;
+
+namespace oox { namespace ppt {
+
+OUString SAL_CALL QuickDiagrammingLayout_getImplementationName() throw()
+{
+ return CREATE_OUSTRING( "com.sun.star.comp.Impress.oox.QuickDiagrammingLayout" );
+}
+
+uno::Sequence< OUString > SAL_CALL QuickDiagrammingLayout_getSupportedServiceNames() throw()
+{
+ const OUString aServiceName = CREATE_OUSTRING( "com.sun.star.comp.ooxpptx.dgm.layout" );
+ const Sequence< OUString > aSeq( &aServiceName, 1 );
+ return aSeq;
+}
+
+uno::Reference< uno::XInterface > SAL_CALL QuickDiagrammingLayout_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
+{
+ return (cppu::OWeakObject*)new QuickDiagrammingLayout( rSMgr );
+}
+
+QuickDiagrammingLayout::QuickDiagrammingLayout( const uno::Reference< lang::XMultiServiceFactory > & rSMgr )
+ : XmlFilterBase( rSMgr ),
+ mpThemePtr(new drawingml::Theme())
+{}
+
+bool QuickDiagrammingLayout::importDocument() throw()
+{
+ Reference<drawing::XShape> xParentShape(getParentShape(),
+ UNO_QUERY_THROW);
+ Reference<drawing::XShapes> xParentShapes(xParentShape,
+ UNO_QUERY_THROW);
+ Reference<beans::XPropertySet> xPropSet(xParentShape,
+ UNO_QUERY_THROW);
+
+ // can we grab the theme from the master page?
+ Reference<container::XChild> xChild(xParentShape,
+ UNO_QUERY);
+ if( xChild.is() )
+ {
+ // TODO: cater for diagram shapes inside groups
+ Reference<drawing::XMasterPageTarget> xMasterPageTarget(xChild->getParent(),
+ UNO_QUERY);
+ if( xMasterPageTarget.is() )
+ {
+ uno::Reference<drawing::XDrawPage> xMasterPage(
+ xMasterPageTarget->getMasterPage());
+
+ Reference<beans::XPropertySet> xPropSet2(xMasterPage,
+ UNO_QUERY_THROW);
+ Reference<xml::dom::XDocument> xThemeFragment;
+ xPropSet2->getPropertyValue(
+ CREATE_OUSTRING("PPTTheme")) >>= xThemeFragment;
+
+ importFragment(
+ new ThemeFragmentHandler(
+ *this, OUString(), *mpThemePtr ),
+ Reference<xml::sax::XFastSAXSerializable>(
+ xThemeFragment,
+ UNO_QUERY_THROW));
+ }
+ }
+
+ Reference<xml::dom::XDocument> xDataModelDom;
+ Reference<xml::dom::XDocument> xLayoutDom;
+ Reference<xml::dom::XDocument> xQStyleDom;
+ Reference<xml::dom::XDocument> xColorStyleDom;
+
+ xPropSet->getPropertyValue(
+ CREATE_OUSTRING("DiagramData")) >>= xDataModelDom;
+ xPropSet->getPropertyValue(
+ CREATE_OUSTRING("DiagramLayout")) >>= xLayoutDom;
+ xPropSet->getPropertyValue(
+ CREATE_OUSTRING("DiagramQStyle")) >>= xQStyleDom;
+ xPropSet->getPropertyValue(
+ CREATE_OUSTRING("DiagramColorStyle")) >>= xColorStyleDom;
+
+ oox::drawingml::ShapePtr pShape(
+ new oox::drawingml::Shape( "com.sun.star.drawing.DiagramShape" ) );
+ drawingml::loadDiagram(pShape,
+ *this,
+ xDataModelDom,
+ xLayoutDom,
+ xQStyleDom,
+ xColorStyleDom);
+
+ // don't add pShape itself, but only its children
+ pShape->setXShape(getParentShape());
+
+ const awt::Size& rSize=xParentShape->getSize();
+ const awt::Point& rPoint=xParentShape->getPosition();
+ const long nScaleFactor=360;
+ const awt::Rectangle aRect(nScaleFactor*rPoint.X,
+ nScaleFactor*rPoint.Y,
+ nScaleFactor*rSize.Width,
+ nScaleFactor*rSize.Height);
+
+ pShape->addChildren( *this,
+ mpThemePtr.get(),
+ xParentShapes,
+ &aRect,
+ NULL );
+
+ return true;
+}
+
+bool QuickDiagrammingLayout::exportDocument() throw()
+{
+ return false;
+}
+
+const ::oox::drawingml::Theme* QuickDiagrammingLayout::getCurrentTheme() const
+{
+ return mpThemePtr.get();
+}
+
+sal_Int32 QuickDiagrammingLayout::getSchemeClr( sal_Int32 nColorSchemeToken ) const
+{
+ sal_Int32 nColor = 0;
+ if( mpThemePtr )
+ mpThemePtr->getClrScheme().getColor( nColorSchemeToken,
+ nColor );
+ return nColor;
+}
+
+const oox::drawingml::table::TableStyleListPtr QuickDiagrammingLayout::getTableStyles()
+{
+ return oox::drawingml::table::TableStyleListPtr();
+}
+
+::oox::vml::Drawing* QuickDiagrammingLayout::getVmlDrawing()
+{
+ return 0;
+}
+
+::oox::drawingml::chart::ChartConverter* QuickDiagrammingLayout::getChartConverter()
+{
+ return 0;
+}
+
+OUString QuickDiagrammingLayout::implGetImplementationName() const
+{
+ return QuickDiagrammingLayout_getImplementationName();
+}
+
+}}
commit 5cde95b32a59436f4e51d7ea9452dc9fd7a0c59c
Author: Katarina Machalkova <kmachalkova at suse.cz>
Date: Tue Oct 19 17:04:12 2010 +0200
Merged oox-smartart-import.diff from ooo-build
diff --git a/oox/inc/oox/core/filterbase.hxx b/oox/inc/oox/core/filterbase.hxx
index d54c534..3dc372a 100644
--- a/oox/inc/oox/core/filterbase.hxx
+++ b/oox/inc/oox/core/filterbase.hxx
@@ -50,6 +50,7 @@ namespace com { namespace sun { namespace star {
namespace task { class XStatusIndicator; }
namespace task { class XInteractionHandler; }
namespace frame { class XFrame; }
+ namespace drawing { class XShape; }
namespace io { class XInputStream; }
namespace io { class XOutputStream; }
namespace io { class XStream; }
@@ -133,6 +134,10 @@ public:
const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XFrame >&
getTargetFrame() const;
+ /// Returns the parent shape to load into (if any)
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >&
+ getParentShape() const;
+
/** Returns the status indicator (may be null). */
const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >&
getStatusIndicator() const;
diff --git a/oox/inc/oox/core/xmlfilterbase.hxx b/oox/inc/oox/core/xmlfilterbase.hxx
index 9b5e63d..a6e260f 100644
--- a/oox/inc/oox/core/xmlfilterbase.hxx
+++ b/oox/inc/oox/core/xmlfilterbase.hxx
@@ -1,7 +1,7 @@
/*************************************************************************
*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
+ *
* Copyright 2000, 2010 Oracle and/or its affiliates.
*
* OpenOffice.org - a multi-platform office productivity suite
@@ -42,8 +42,10 @@
namespace com { namespace sun { namespace star {
namespace container { class XNameContainer; }
namespace document { class XDocumentProperties; }
+ namespace xml { namespace dom { class XDocument; } }
namespace xml { namespace sax { class XLocator; } }
namespace xml { namespace sax { class XFastDocumentHandler; } }
+ namespace xml { namespace sax { class XFastSAXSerializable; } }
} } }
namespace oox { namespace drawingml { class Theme; } }
@@ -89,7 +91,7 @@ public:
/** Has to be implemented by each filter, returns a filter-specific chart
converter object, that should be global per imported document. */
- virtual ::oox::drawingml::chart::ChartConverter& getChartConverter() = 0;
+ virtual ::oox::drawingml::chart::ChartConverter* getChartConverter() = 0;
/** Has to be implemented by each filter to return the table style list. */
virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles() = 0;
@@ -107,6 +109,31 @@ public:
*/
bool importFragment( const ::rtl::Reference< FragmentHandler >& rxHandler );
+ /** Imports a fragment into an xml::dom::XDocument.
+
+ @param rFragmentPath path to fragment
+
+ @return a non-empty reference to the XDocument, if the
+ fragment could be imported.
+ */
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument> importFragment( const ::rtl::OUString& rFragmentPath );
+
+ /** Imports a fragment from an xml::dom::XDocument using the
+ passed fragment handler
+
+ @param rxHandler fragment handler; path to fragment is
+ ignored, input source is the rxSerializer
+
+ @param rxSerializer usually retrieved from a
+ xml::dom::XDocument, will get serialized into rxHandler
+
+ @return true, if the fragment could be imported.
+ */
+ bool importFragment( const ::rtl::Reference< FragmentHandler >& rxHandler,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::sax::XFastSAXSerializable >& rxSerializer );
+
/** Imports the relations fragment associated with the specified fragment.
@return The relations collection of the specified fragment.
diff --git a/oox/inc/oox/drawingml/chart/converterbase.hxx b/oox/inc/oox/drawingml/chart/converterbase.hxx
index 5c26d73..c1c8986 100644
--- a/oox/inc/oox/drawingml/chart/converterbase.hxx
+++ b/oox/inc/oox/drawingml/chart/converterbase.hxx
@@ -82,7 +82,7 @@ protected:
/** Returns the filter object of the imported/exported document. */
::oox::core::XmlFilterBase& getFilter() const;
/** Returns the chart converter. */
- ChartConverter& getChartConverter() const;
+ ChartConverter* getChartConverter() const;
/** Returns the API chart document model. */
::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >
getChartDocument() const;
diff --git a/oox/inc/oox/drawingml/customshapeproperties.hxx b/oox/inc/oox/drawingml/customshapeproperties.hxx
index d402cb9..6b63352 100644
--- a/oox/inc/oox/drawingml/customshapeproperties.hxx
+++ b/oox/inc/oox/drawingml/customshapeproperties.hxx
@@ -124,6 +124,7 @@ public:
const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet,
const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > & xShape) const;
+ const rtl::OUString& getShapePresetType() const { return maShapePresetType; }
void setShapePresetType( const rtl::OUString& rShapePresetType ){ maShapePresetType = rShapePresetType; };
std::vector< CustomShapeGuide >& getAdjustmentGuideList(){ return maAdjustmentGuideList; };
diff --git a/oox/inc/oox/drawingml/diagram/datamodelcontext.hxx b/oox/inc/oox/drawingml/diagram/datamodelcontext.hxx
deleted file mode 100644
index 6437482..0000000
--- a/oox/inc/oox/drawingml/diagram/datamodelcontext.hxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#ifndef OOX_DRAWINGML_SHAPECONTEXT_HXX
-#define OOX_DRAWINGML_SHAPECONTEXT_HXX
-
-#include <com/sun/star/drawing/XShapes.hpp>
-
-#include "oox/core/contexthandler.hxx"
-#include "oox/drawingml/diagram/diagram.hxx"
-
-namespace oox { namespace drawingml {
-
-// CT_DataModel
-class DataModelContext : public ::oox::core::ContextHandler
-{
-public:
- DataModelContext( ::oox::core::ContextHandler& rParent, const DiagramDataPtr & pDataModelPtr );
- virtual ~DataModelContext();
-
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
-
-protected:
- DiagramDataPtr mpDataModel;
-};
-
-} }
-
-#endif // OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX
diff --git a/oox/inc/oox/drawingml/diagram/diagram.hxx b/oox/inc/oox/drawingml/diagram/diagram.hxx
index ef60545..e81a216 100644
--- a/oox/inc/oox/drawingml/diagram/diagram.hxx
+++ b/oox/inc/oox/drawingml/diagram/diagram.hxx
@@ -25,232 +25,40 @@
*
************************************************************************/
-
-
#ifndef OOX_DRAWINGML_DIAGRAM_HXX
#define OOX_DRAWINGML_DIAGRAM_HXX
-#include <vector>
-#include <boost/shared_ptr.hpp>
-#include <boost/enable_shared_from_this.hpp>
+#include <rtl/ustring.hxx>
#include "oox/drawingml/shape.hxx"
-#include "oox/drawingml/diagram/diagramlayoutatoms.hxx"
-
-namespace oox { namespace drawingml {
-
-namespace dgm {
+#include "oox/core/xmlfilterbase.hxx"
-/** A Connection
- */
-class Connection
-{
-public:
- Connection()
- : mnType( 0 )
- , mnSourceOrder( 0 )
- , mnDestOrder( 0 )
- {
- }
+#include <com/sun/star/xml/dom/XDocument.hpp>
- void dump();
-
- sal_Int32 mnType;
- ::rtl::OUString msModelId;
- ::rtl::OUString msSourceId;
- ::rtl::OUString msDestId;
- ::rtl::OUString msParTransId;
- ::rtl::OUString msPresId;
- ::rtl::OUString msSibTransId;
- sal_Int32 mnSourceOrder;
- sal_Int32 mnDestOrder;
-
-};
-
-typedef boost::shared_ptr< Connection > ConnectionPtr;
-typedef std::vector< ConnectionPtr > Connections;
+namespace oox { namespace drawingml {
-class Point;
+/** load diagram data, and put resulting graphic into shape
-typedef boost::shared_ptr< Point > PointPtr;
-typedef std::vector< PointPtr > Points;
-/** A point
+ This method loads the diagram data fragments from the given paths,
+ generate and layout the shapes, and push it as children into the
+ referenced shape.
*/
-class Point
-{
-public:
- Point();
- ShapePtr & getShape( )
- { return mpShape; }
-
- void setCnxId( const ::rtl::OUString & sCnxId )
- { msCnxId = sCnxId; }
- void setModelId( const ::rtl::OUString & sModelId );
- const ::rtl::OUString & getModelId() const
- { return msModelId; }
- void setType( const sal_Int32 nType )
- { mnType = nType; }
- sal_Int32 getType() const
- { return mnType; }
-
- void dump();
-private:
- ShapePtr mpShape;
- ::rtl::OUString msCnxId;
- ::rtl::OUString msModelId;
- sal_Int32 mnType;
-};
-
-
-class PointsTree;
-typedef boost::shared_ptr< PointsTree > PointsTreePtr;
-
-/** a points tree node */
-class PointsTree
- : public boost::enable_shared_from_this< PointsTree >
-{
-public:
- typedef std::vector< PointsTreePtr > Childrens;
- PointsTree()
- {};
- PointsTree( const PointPtr & pPoint )
- : mpNode( pPoint )
- { }
- bool addChild( const PointsTreePtr & pChild );
- const PointPtr & getPoint() const
- { return mpNode; }
- PointsTreePtr getParent() const;
- Childrens::const_iterator beginChild() const
- { return maChildrens.begin(); }
- Childrens::const_iterator endChild() const
- { return maChildrens.end(); }
-private:
- PointPtr mpNode;
- boost::weak_ptr< PointsTree > mpParent;
- Childrens maChildrens;
-};
-
-}
-
-////////////////////
-
-class DiagramData
-{
-public:
-
- DiagramData();
- FillPropertiesPtr & getFillProperties()
- { return mpFillProperties; }
- dgm::Connections & getConnections()
- { return maConnections; }
- dgm::Points & getPoints()
- { return maPoints; }
- void dump();
-private:
- FillPropertiesPtr mpFillProperties;
- dgm::Connections maConnections;
- dgm::Points maPoints;
-};
-
-typedef boost::shared_ptr< DiagramData > DiagramDataPtr;
-
-
-
-////////////////////
-
-class DiagramLayout
-{
-public:
- void setDefStyle( const ::rtl::OUString & sDefStyle )
- { msDefStyle = sDefStyle; }
- void setMinVer( const ::rtl::OUString & sMinVer )
- { msMinVer = sMinVer; }
- void setUniqueId( const ::rtl::OUString & sUniqueId )
- { msUniqueId = sUniqueId; }
- const ::rtl::OUString & getUniqueId()
- { return msUniqueId; }
- void setTitle( const ::rtl::OUString & sTitle )
- { msTitle = sTitle; }
- void setDesc( const ::rtl::OUString & sDesc )
- { msDesc = sDesc; }
-
- LayoutNodePtr & getNode()
- { return mpNode; }
- const LayoutNodePtr & getNode() const
- { return mpNode; }
- DiagramDataPtr & getSampData()
- { return mpSampData; }
- const DiagramDataPtr & getSampData() const
- { return mpSampData; }
- DiagramDataPtr & getStyleData()
- { return mpStyleData; }
- const DiagramDataPtr & getStyleData() const
- { return mpStyleData; }
-
- void layout( const dgm::PointsTreePtr & pTree, const com::sun::star::awt::Point & pt );
-private:
- ::rtl::OUString msDefStyle;
- ::rtl::OUString msMinVer;
- ::rtl::OUString msUniqueId;
-
- ::rtl::OUString msTitle;
- ::rtl::OUString msDesc;
- LayoutNodePtr mpNode;
- DiagramDataPtr mpSampData;
- DiagramDataPtr mpStyleData;
- // TODO
- // catLst
- // clrData
-};
-
-typedef boost::shared_ptr< DiagramLayout > DiagramLayoutPtr;
-
-///////////////////////
-
-class DiagramQStyles
-{
-
-};
-
-typedef boost::shared_ptr< DiagramQStyles > DiagramQStylesPtr;
-
-///////////////////////
-
-class DiagramColors
-{
-
-};
-
-typedef boost::shared_ptr< DiagramColors > DiagramColorsPtr;
-
-///////////////////////
-
-class Diagram
-{
-public:
- void setData( const DiagramDataPtr & );
- void setLayout( const DiagramLayoutPtr & );
- DiagramLayoutPtr getLayout() const
- {
- return mpLayout;
- }
- void setQStyles( const DiagramQStylesPtr & );
- void setColors( const DiagramColorsPtr & );
-
- void addTo( const ShapePtr & pShape );
- ::rtl::OUString getLayoutId() const;
-private:
- void build( );
- DiagramDataPtr mpData;
- DiagramLayoutPtr mpLayout;
- DiagramQStylesPtr mpQStyles;
- DiagramColorsPtr mpColors;
- std::map< ::rtl::OUString, ShapePtr > maShapeMap;
- dgm::PointsTreePtr mpRoot;
-};
-
-
-typedef boost::shared_ptr< Diagram > DiagramPtr;
-
+void loadDiagram( const ShapePtr& pShape,
+ core::XmlFilterBase& rFilter,
+ const ::rtl::OUString& rDataModelPath,
+ const ::rtl::OUString& rLayoutPath,
+ const ::rtl::OUString& rQStylePath,
+ const ::rtl::OUString& rColorStylePath );
+
+void loadDiagram( const ShapePtr& pShape,
+ core::XmlFilterBase& rFilter,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& rXDataModelDom,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& rXLayoutDom,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& rXQStyleDom,
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& rXColorStyleDom );
} }
#endif
diff --git a/oox/inc/oox/drawingml/diagram/diagramfragmenthandler.hxx b/oox/inc/oox/drawingml/diagram/diagramfragmenthandler.hxx
deleted file mode 100644
index 5a42a46..0000000
--- a/oox/inc/oox/drawingml/diagram/diagramfragmenthandler.hxx
+++ /dev/null
@@ -1,100 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-#ifndef OOX_DRAWINGML_DIAGRAMFRAGMENTHANDLER
-#define OOX_DRAWINGML_DIAGRAMFRAGMENTHANDLER
-
-#include "oox/core/fragmenthandler.hxx"
-#include "oox/drawingml/diagram/diagram.hxx"
-
-namespace oox { namespace drawingml {
-
-
-class DiagramDataFragmentHandler : public ::oox::core::FragmentHandler
-{
-public:
- DiagramDataFragmentHandler( oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramDataPtr pDataPtr ) throw();
- virtual ~DiagramDataFragmentHandler() throw();
-
- virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
-
-private:
-
- DiagramDataPtr mpDataPtr;
-};
-
-
-
-class DiagramLayoutFragmentHandler : public ::oox::core::FragmentHandler
-{
-public:
- DiagramLayoutFragmentHandler( oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramLayoutPtr pDataPtr ) throw();
- virtual ~DiagramLayoutFragmentHandler() throw();
-
- virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
-
-private:
-
- DiagramLayoutPtr mpDataPtr;
-};
-
-class DiagramQStylesFragmentHandler : public ::oox::core::FragmentHandler
-{
-public:
- DiagramQStylesFragmentHandler( oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramQStylesPtr pDataPtr ) throw();
- virtual ~DiagramQStylesFragmentHandler() throw();
-
- virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
-
-private:
-
- DiagramQStylesPtr mpDataPtr;
-};
-
-
-class DiagramColorsFragmentHandler : public ::oox::core::FragmentHandler
-{
-public:
- DiagramColorsFragmentHandler( ::oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramColorsPtr pDataPtr ) throw();
- virtual ~DiagramColorsFragmentHandler() throw();
-
- virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
- virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
-
-private:
-
- DiagramColorsPtr mpDataPtr;
-};
-
-} }
-
-
-#endif
diff --git a/oox/inc/oox/drawingml/diagram/diagramlayoutatoms.hxx b/oox/inc/oox/drawingml/diagram/diagramlayoutatoms.hxx
deleted file mode 100644
index ae25085..0000000
--- a/oox/inc/oox/drawingml/diagram/diagramlayoutatoms.hxx
+++ /dev/null
@@ -1,209 +0,0 @@
-/*************************************************************************
- *
- * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
- *
- * Copyright 2000, 2010 Oracle and/or its affiliates.
- *
- * OpenOffice.org - a multi-platform office productivity suite
- *
- * This file is part of OpenOffice.org.
- *
- * OpenOffice.org is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Lesser General Public License version 3
- * only, as published by the Free Software Foundation.
- *
- * OpenOffice.org is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU Lesser General Public License version 3 for more details
- * (a copy is included in the LICENSE file that accompanied this code).
- *
- * You should have received a copy of the GNU Lesser General Public License
- * version 3 along with OpenOffice.org. If not, see
- * <http://www.openoffice.org/license.html>
- * for a copy of the LGPLv3 License.
- *
- ************************************************************************/
-
-
-
-
-
-#ifndef OOX_DRAWINGML_DIAGRAMLAYOUTATOMS_HXX
-#define OOX_DRAWINGML_DIAGRAMLAYOUTATOMS_HXX
-
-#include <map>
-#include <string>
-
-#include <boost/shared_ptr.hpp>
-#include <boost/array.hpp>
-
-#include <com/sun/star/uno/Any.hxx>
-#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
-
-#include "oox/drawingml/shape.hxx"
-
-
-namespace oox { namespace drawingml {
-
-
-// AG_IteratorAttributes
-class IteratorAttr
-{
-public:
- IteratorAttr();
-
- // not sure this belong here, but wth
- void loadFromXAttr( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
-
-private:
- sal_Int32 mnAxis;
- sal_Int32 mnCnt;
- sal_Bool mbHideLastTrans;
- sal_Int32 mnPtType;
- sal_Int32 mnSt;
- sal_Int32 mnStep;
-};
-
-class ConditionAttr
-{
-public:
- ConditionAttr();
-
- // not sure this belong here, but wth
- void loadFromXAttr( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
-
-private:
- sal_Int32 mnFunc;
- sal_Int32 mnArg;
- sal_Int32 mnOp;
- ::rtl::OUString msVal;
-};
-
-class LayoutAtom;
-
-typedef boost::shared_ptr< LayoutAtom > LayoutAtomPtr;
-
-/** abstract Atom for the layout */
-class LayoutAtom
-{
-public:
- virtual ~LayoutAtom()
- {}
- // TODO change signature to the proper one
- virtual void processAtom() = 0;
- void setName( const ::rtl::OUString & sName )
- { msName = sName; }
- void addChild( const LayoutAtomPtr & pNode )
- { mpChildNodes.push_back( pNode ); }
-
- // dump for debug
- virtual void dump(int level = 0);
-protected:
- std::vector< LayoutAtomPtr > mpChildNodes;
- ::rtl::OUString msName;
-};
-
-class AlgAtom
- : public LayoutAtom
-{
-public:
- virtual ~AlgAtom()
- {}
- typedef std::map< std::string, ::com::sun::star::uno::Any > ParamMap;
-
- virtual void processAtom()
- {}
-private:
- ParamMap mParams;
-};
-
-
-class ForEachAtom
- : public LayoutAtom
-{
-public:
- virtual ~ForEachAtom()
- {}
-
- IteratorAttr & iterator()
- { return maIter; }
- virtual void processAtom();
-private:
- IteratorAttr maIter;
-};
-
-typedef boost::shared_ptr< ForEachAtom > ForEachAtomPtr;
-
-
-class ConditionAtom
- : public LayoutAtom
-{
-public:
- ConditionAtom( bool bElse = false )
- : LayoutAtom( )
- , mbElse( bElse )
- {}
- virtual ~ConditionAtom()
- {}
- bool test();
- virtual void processAtom()
- {}
- IteratorAttr & iterator()
- { return maIter; }
- ConditionAttr & cond()
- { return maCond; }
-private:
- bool mbElse;
- IteratorAttr maIter;
- ConditionAttr maCond;
-};
-
-typedef boost::shared_ptr< ConditionAtom > ConditionAtomPtr;
-
-
-/** "choose" statements. Atoms will be tested in order. */
-class ChooseAtom
- : public LayoutAtom
-{
-public:
- virtual ~ChooseAtom()
- {}
- virtual void processAtom();
-};
-
-class LayoutNode
- : public LayoutAtom
-{
-public:
- enum {
- VAR_animLvl = 0,
- VAR_animOne,
- VAR_bulletEnabled,
- VAR_chMax,
- VAR_chPref,
- VAR_dir,
- VAR_hierBranch,
- VAR_orgChart,
- VAR_resizeHandles
- };
- // we know that the array is of fixed size
- // the use of Any allow having empty values
- typedef boost::array< ::com::sun::star::uno::Any, 9 > VarMap;
-
- virtual ~LayoutNode()
- {}
- virtual void processAtom()
- {}
- VarMap & variables()
- { return mVariables; }
-private:
- VarMap mVariables;
- std::vector< ShapePtr > mpShapes;
-};
-
-typedef boost::shared_ptr< LayoutNode > LayoutNodePtr;
-
-} }
-
-#endif
diff --git a/oox/inc/oox/drawingml/drawingmltypes.hxx b/oox/inc/oox/drawingml/drawingmltypes.hxx
index c513446..b18414f 100644
--- a/oox/inc/oox/drawingml/drawingmltypes.hxx
+++ b/oox/inc/oox/drawingml/drawingmltypes.hxx
@@ -58,6 +58,9 @@ typedef ::boost::shared_ptr< FillProperties > FillPropertiesPtr;
struct GraphicProperties;
typedef ::boost::shared_ptr< GraphicProperties > GraphicPropertiesPtr;
+struct Shape3DProperties;
+typedef ::boost::shared_ptr< Shape3DProperties > Shape3DPropertiesPtr;
+
struct TextCharacterProperties;
typedef ::boost::shared_ptr< TextCharacterProperties > TextCharacterPropertiesPtr;
diff --git a/oox/inc/oox/drawingml/graphicshapecontext.hxx b/oox/inc/oox/drawingml/graphicshapecontext.hxx
index c7239fc..ea49d47 100644
--- a/oox/inc/oox/drawingml/graphicshapecontext.hxx
+++ b/oox/inc/oox/drawingml/graphicshapecontext.hxx
@@ -30,7 +30,6 @@
#include "oox/drawingml/shape.hxx"
#include "oox/drawingml/shapecontext.hxx"
-#include "oox/drawingml/diagram/diagram.hxx"
namespace oox { namespace vml { struct OleObjectInfo; } }
@@ -73,6 +72,8 @@ private:
// ====================================================================
+class Diagram;
+
class DiagramGraphicDataContext
: public ShapeContext
{
@@ -82,8 +83,6 @@ public:
virtual ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext( ::sal_Int32 Element, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& Attribs ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
private:
- DiagramPtr loadDiagram();
-
::rtl::OUString msDm;
::rtl::OUString msLo;
::rtl::OUString msQs;
diff --git a/oox/inc/oox/drawingml/shape.hxx b/oox/inc/oox/drawingml/shape.hxx
index ccfb75f..e1ee451 100644
--- a/oox/inc/oox/drawingml/shape.hxx
+++ b/oox/inc/oox/drawingml/shape.hxx
@@ -32,6 +32,7 @@
#include "oox/drawingml/drawingmltypes.hxx"
#include "oox/drawingml/customshapeproperties.hxx"
#include "oox/drawingml/textliststyle.hxx"
+#include "oox/drawingml/shape3dproperties.hxx"
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp>
@@ -95,7 +96,8 @@ class Shape
{
public:
- Shape( const sal_Char* pServiceType = NULL );
+ explicit Shape( const sal_Char* pServiceType = NULL );
+ explicit Shape( const ShapePtr& pSourceShape );
virtual ~Shape();
rtl::OUString& getServiceName(){ return msServiceName; }
@@ -114,13 +116,20 @@ public:
CustomShapePropertiesPtr getCustomShapeProperties(){ return mpCustomShapePropertiesPtr; }
+ Shape3DProperties& get3DProperties() { return *mp3DPropertiesPtr; }
+ const Shape3DProperties& get3DProperties() const { return *mp3DPropertiesPtr; }
+
table::TablePropertiesPtr getTableProperties();
void setChildPosition( com::sun::star::awt::Point nPosition ){ maChPosition = nPosition; }
void setChildSize( com::sun::star::awt::Size aSize ){ maChSize = aSize; }
- void setPosition( com::sun::star::awt::Point nPosition ){ maPosition = nPosition; }
- void setSize( com::sun::star::awt::Size aSize ){ maSize = aSize; }
+ void setPosition( com::sun::star::awt::Point nPosition ){ maPosition = nPosition; }
+ const com::sun::star::awt::Point& getPosition() const { return maPosition; }
+
+ void setSize( com::sun::star::awt::Size aSize ){ maSize = aSize; }
+ const com::sun::star::awt::Size& getSize() const { return maSize; }
+
void setRotation( sal_Int32 nRotation ) { mnRotation = nRotation; }
void setFlip( sal_Bool bFlipH, sal_Bool bFlipV ) { mbFlipH = bFlipH; mbFlipV = bFlipV; }
void addChild( const ShapePtr pChildPtr ) { maChildren.push_back( pChildPtr ); }
@@ -158,6 +167,13 @@ public:
const ::com::sun::star::awt::Rectangle* pShapeRect = 0,
ShapeIdMap* pShapeMap = 0 );
+ void addChildren(
+ const ::oox::core::XmlFilterBase& rFilterBase,
+ const Theme* pTheme,
+ const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
+ const ::com::sun::star::awt::Rectangle* pShapeRect = 0,
+ ShapeIdMap* pShapeMap = 0 );
+
void setXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rXShape )
{ mxShape = rXShape; };
const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &
@@ -197,6 +213,7 @@ protected:
GraphicPropertiesPtr mpGraphicPropertiesPtr;
CustomShapePropertiesPtr mpCustomShapePropertiesPtr;
table::TablePropertiesPtr mpTablePropertiesPtr;
+ Shape3DPropertiesPtr mp3DPropertiesPtr;
PropertyMap maShapeProperties;
PropertyMap maDefaultShapeProperties;
TextListStylePtr mpMasterTextListStyle;
@@ -221,7 +238,11 @@ private:
sal_Bool mbHidden;
};
-::rtl::OUString GetShapeType( sal_Int32 nType );
+// ---------------------------------------------------------------------
+
+/** Get custom shape preset string from xml token id
+ */
+::rtl::OUString GetShapePresetType( sal_Int32 nType );
} }
diff --git a/oox/inc/oox/drawingml/theme.hxx b/oox/inc/oox/drawingml/theme.hxx
index 30a6aa1..903ff1d 100644
--- a/oox/inc/oox/drawingml/theme.hxx
+++ b/oox/inc/oox/drawingml/theme.hxx
@@ -32,6 +32,7 @@
#include "oox/drawingml/clrscheme.hxx"
#include "oox/drawingml/shape.hxx"
#include "oox/drawingml/textfont.hxx"
+#include <com/sun/star/xml/dom/XDocument.hpp>
namespace oox {
namespace drawingml {
@@ -94,6 +95,11 @@ public:
inline Shape& getTxDef() { return maTxDef; }
inline const Shape& getTxDef() const { return maTxDef; }
+ void setFragment( const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& xRef ) { mxFragment=xRef; }
+ const ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument>& getFragment() const { return mxFragment; }
+
private:
::rtl::OUString maStyleName;
ClrScheme maClrScheme;
@@ -105,6 +111,8 @@ private:
Shape maSpDef;
Shape maLnDef;
Shape maTxDef;
+ ::com::sun::star::uno::Reference<
+ ::com::sun::star::xml::dom::XDocument> mxFragment;
};
// ============================================================================
diff --git a/oox/inc/oox/ppt/pptimport.hxx b/oox/inc/oox/ppt/pptimport.hxx
index 0ac93dd..dadfa1e 100644
--- a/oox/inc/oox/ppt/pptimport.hxx
+++ b/oox/inc/oox/ppt/pptimport.hxx
@@ -56,7 +56,7 @@ public:
virtual const ::oox::drawingml::Theme* getCurrentTheme() const;
virtual ::oox::vml::Drawing* getVmlDrawing();
virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
- virtual ::oox::drawingml::chart::ChartConverter& getChartConverter();
+ virtual ::oox::drawingml::chart::ChartConverter* getChartConverter();
... etc. - the rest is truncated
More information about the Libreoffice-commits
mailing list