summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKatarina Machalkova <kmachalkova@suse.cz>2010-10-20 18:31:49 +0200
committerKatarina Machalkova <kmachalkova@suse.cz>2010-10-21 09:37:15 +0200
commit09ffe373368a83098b4cddd0ff22d8b7e1c961df (patch)
treefdcd9ea0d614b1dc1075ef521bd78da99a10fe0c
parent22ebfb78e5814fdcf2c783b944c2937c29549c3f (diff)
Undoing pptx filter as a separate lib ( + related changes)
Shared ppt + pptx filter will be merged from cws later
-rw-r--r--filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu2
-rw-r--r--filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_Template.xcu2
-rw-r--r--filter/source/config/fragments/types/MS_PowerPoint_2007_XML.xcu2
-rw-r--r--oox/inc/oox/core/filterbase.hxx5
-rw-r--r--oox/inc/oox/core/xmlfilterbase.hxx29
-rw-r--r--oox/inc/oox/drawingml/chart/converterbase.hxx2
-rw-r--r--oox/inc/oox/drawingml/customshapeproperties.hxx1
-rw-r--r--oox/inc/oox/drawingml/diagram/diagram.hxx242
-rw-r--r--oox/inc/oox/drawingml/drawingmltypes.hxx3
-rw-r--r--oox/inc/oox/drawingml/graphicshapecontext.hxx5
-rw-r--r--oox/inc/oox/drawingml/scene3dcontext.hxx56
-rw-r--r--oox/inc/oox/drawingml/shape.hxx29
-rw-r--r--oox/inc/oox/drawingml/shape3dproperties.hxx134
-rw-r--r--oox/inc/oox/drawingml/theme.hxx8
-rw-r--r--oox/inc/oox/export/drawingml.hxx13
-rw-r--r--oox/inc/oox/export/shapes.hxx26
-rw-r--r--oox/inc/oox/ppt/dgmimport.hxx71
-rw-r--r--oox/inc/oox/ppt/dgmlayout.hxx72
-rw-r--r--oox/inc/oox/ppt/pptimport.hxx5
-rw-r--r--oox/inc/oox/xls/excelfilter.hxx2
-rw-r--r--oox/inc/oox/xls/workbookhelper.hxx2
-rw-r--r--oox/source/core/facreg.cxx6
-rw-r--r--oox/source/core/filterbase.cxx9
-rw-r--r--oox/source/core/xmlfilterbase.cxx165
-rw-r--r--oox/source/drawingml/chart/chartspaceconverter.cxx5
-rw-r--r--oox/source/drawingml/chart/converterbase.cxx4
-rw-r--r--oox/source/drawingml/chart/datasourceconverter.cxx13
-rw-r--r--oox/source/drawingml/clrscheme.cxx2
-rw-r--r--oox/source/drawingml/color.cxx1
-rw-r--r--oox/source/drawingml/customshapegeometry.cxx6
-rw-r--r--oox/source/drawingml/diagram/constraintlistcontext.cxx102
-rw-r--r--oox/source/drawingml/diagram/constraintlistcontext.hxx54
-rw-r--r--oox/source/drawingml/diagram/datamodelcontext.cxx232
-rw-r--r--oox/source/drawingml/diagram/datamodelcontext.hxx57
-rw-r--r--oox/source/drawingml/diagram/diagram.cxx496
-rw-r--r--oox/source/drawingml/diagram/diagram.hxx323
-rw-r--r--oox/source/drawingml/diagram/diagramdefinitioncontext.cxx13
-rw-r--r--oox/source/drawingml/diagram/diagramdefinitioncontext.hxx2
-rw-r--r--oox/source/drawingml/diagram/diagramfragmenthandler.cxx183
-rw-r--r--oox/source/drawingml/diagram/diagramfragmenthandler.hxx117
-rw-r--r--oox/source/drawingml/diagram/diagramlayoutatoms.cxx689
-rw-r--r--oox/source/drawingml/diagram/diagramlayoutatoms.hxx318
-rw-r--r--oox/source/drawingml/diagram/layoutnodecontext.cxx146
-rw-r--r--oox/source/drawingml/diagram/layoutnodecontext.hxx3
-rw-r--r--oox/source/drawingml/diagram/makefile.mk1
-rw-r--r--oox/source/drawingml/drawingmltypes.cxx4
-rw-r--r--oox/source/drawingml/fillproperties.cxx3
-rw-r--r--oox/source/drawingml/graphicshapecontext.cxx58
-rw-r--r--oox/source/drawingml/lineproperties.cxx5
-rw-r--r--oox/source/drawingml/makefile.mk1
-rw-r--r--oox/source/drawingml/scene3dcontext.cxx189
-rw-r--r--oox/source/drawingml/shape.cxx44
-rw-r--r--oox/source/drawingml/shape3dproperties.cxx66
-rw-r--r--oox/source/drawingml/shapepropertiescontext.cxx6
-rw-r--r--oox/source/drawingml/textparagraph.cxx9
-rw-r--r--oox/source/drawingml/textparagraphproperties.cxx1
-rw-r--r--oox/source/export/drawingml.cxx138
-rw-r--r--oox/source/export/shapes.cxx31
-rw-r--r--oox/source/helper/storagebase.cxx20
-rw-r--r--oox/source/ppt/dgmimport.cxx135
-rw-r--r--oox/source/ppt/dgmlayout.cxx193
-rw-r--r--oox/source/ppt/makefile.mk2
-rw-r--r--oox/source/ppt/pptimport.cxx30
-rw-r--r--oox/source/ppt/presentationfragmenthandler.cxx13
-rw-r--r--oox/source/ppt/slidepersist.cxx11
-rw-r--r--oox/source/shape/ShapeFilterBase.cxx4
-rw-r--r--oox/source/shape/ShapeFilterBase.hxx2
-rw-r--r--oox/source/xls/excelfilter.cxx2
-rw-r--r--oox/source/xls/workbookhelper.cxx4
69 files changed, 656 insertions, 3973 deletions
diff --git a/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu
index 138d449fc..7fdcbd702 100644
--- a/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu
+++ b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML.xcu
@@ -1,5 +1,5 @@
<node oor:name="Impress MS PowerPoint 2007 XML" oor:op="replace">
- <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER PREFERRED</value></prop>
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER PREFERRED</value></prop>
<prop oor:name="UIComponent"/>
<prop oor:name="FilterService"><value>com.sun.star.comp.Impress.oox.PowerPointImport</value></prop>
<prop oor:name="UserData"/>
diff --git a/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_Template.xcu b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_Template.xcu
index eb9fea608..28b9ea8b0 100644
--- a/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_Template.xcu
+++ b/filter/source/config/fragments/filters/impress_MS_PowerPoint_2007_XML_Template.xcu
@@ -1,5 +1,5 @@
<node oor:name="Impress MS PowerPoint 2007 XML Template" oor:op="replace">
- <prop oor:name="Flags"><value>IMPORT EXPORT ALIEN 3RDPARTYFILTER TEMPLATE TEMPLATEPATH PREFERRED</value></prop>
+ <prop oor:name="Flags"><value>IMPORT ALIEN 3RDPARTYFILTER TEMPLATE TEMPLATEPATH PREFERRED</value></prop>
<prop oor:name="UIComponent"/>
<prop oor:name="FilterService"><value>com.sun.star.comp.Impress.oox.PowerPointImport</value></prop>
<prop oor:name="UserData"/>
diff --git a/filter/source/config/fragments/types/MS_PowerPoint_2007_XML.xcu b/filter/source/config/fragments/types/MS_PowerPoint_2007_XML.xcu
index 1cc12bf44..99f22ee47 100644
--- a/filter/source/config/fragments/types/MS_PowerPoint_2007_XML.xcu
+++ b/filter/source/config/fragments/types/MS_PowerPoint_2007_XML.xcu
@@ -1,7 +1,7 @@
<node oor:name="MS PowerPoint 2007 XML" oor:op="replace" >
<prop oor:name="DetectService"><value>com.sun.star.comp.oox.FormatDetector</value></prop>
<prop oor:name="URLPattern"/>
- <prop oor:name="Extensions"><value>pptx pptm</value></prop>
+ <prop oor:name="Extensions"><value>pptm pptx</value></prop>
<prop oor:name="MediaType"/>
<prop oor:name="Preferred"><value>true</value></prop>
<prop oor:name="PreferredFilter"><value>Impress MS PowerPoint 2007 XML</value></prop>
diff --git a/oox/inc/oox/core/filterbase.hxx b/oox/inc/oox/core/filterbase.hxx
index 3dc372a10..d54c534b9 100644
--- a/oox/inc/oox/core/filterbase.hxx
+++ b/oox/inc/oox/core/filterbase.hxx
@@ -50,7 +50,6 @@ 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; }
@@ -134,10 +133,6 @@ 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 a6e260fcd..4cfccca02 100644
--- a/oox/inc/oox/core/xmlfilterbase.hxx
+++ b/oox/inc/oox/core/xmlfilterbase.hxx
@@ -42,10 +42,8 @@
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; } }
@@ -91,7 +89,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;
@@ -109,31 +107,6 @@ 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 c1c898631..5c26d7353 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 6b6335217..d402cb955 100644
--- a/oox/inc/oox/drawingml/customshapeproperties.hxx
+++ b/oox/inc/oox/drawingml/customshapeproperties.hxx
@@ -124,7 +124,6 @@ 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/diagram.hxx b/oox/inc/oox/drawingml/diagram/diagram.hxx
index e81a2167f..ef60545a9 100644
--- a/oox/inc/oox/drawingml/diagram/diagram.hxx
+++ b/oox/inc/oox/drawingml/diagram/diagram.hxx
@@ -25,40 +25,232 @@
*
************************************************************************/
+
+
#ifndef OOX_DRAWINGML_DIAGRAM_HXX
#define OOX_DRAWINGML_DIAGRAM_HXX
-#include <rtl/ustring.hxx>
+#include <vector>
+#include <boost/shared_ptr.hpp>
+#include <boost/enable_shared_from_this.hpp>
#include "oox/drawingml/shape.hxx"
-#include "oox/core/xmlfilterbase.hxx"
-
-#include <com/sun/star/xml/dom/XDocument.hpp>
+#include "oox/drawingml/diagram/diagramlayoutatoms.hxx"
namespace oox { namespace drawingml {
-/** load diagram data, and put resulting graphic into shape
+namespace dgm {
- 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.
+/** A Connection
*/
-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 );
+class Connection
+{
+public:
+ 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 boost::shared_ptr< Connection > ConnectionPtr;
+typedef std::vector< ConnectionPtr > Connections;
+
+class Point;
+
+typedef boost::shared_ptr< Point > PointPtr;
+typedef std::vector< PointPtr > Points;
+/** A point
+ */
+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;
+
} }
#endif
diff --git a/oox/inc/oox/drawingml/drawingmltypes.hxx b/oox/inc/oox/drawingml/drawingmltypes.hxx
index b18414f6b..c513446e9 100644
--- a/oox/inc/oox/drawingml/drawingmltypes.hxx
+++ b/oox/inc/oox/drawingml/drawingmltypes.hxx
@@ -58,9 +58,6 @@ 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 ea49d4730..c7239fc96 100644
--- a/oox/inc/oox/drawingml/graphicshapecontext.hxx
+++ b/oox/inc/oox/drawingml/graphicshapecontext.hxx
@@ -30,6 +30,7 @@
#include "oox/drawingml/shape.hxx"
#include "oox/drawingml/shapecontext.hxx"
+#include "oox/drawingml/diagram/diagram.hxx"
namespace oox { namespace vml { struct OleObjectInfo; } }
@@ -72,8 +73,6 @@ private:
// ====================================================================
-class Diagram;
-
class DiagramGraphicDataContext
: public ShapeContext
{
@@ -83,6 +82,8 @@ 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/scene3dcontext.hxx b/oox/inc/oox/drawingml/scene3dcontext.hxx
deleted file mode 100644
index c64bbf335..000000000
--- a/oox/inc/oox/drawingml/scene3dcontext.hxx
+++ /dev/null
@@ -1,56 +0,0 @@
-/*************************************************************************
- *
- * 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/shape.hxx b/oox/inc/oox/drawingml/shape.hxx
index e1ee45193..ccfb75f09 100644
--- a/oox/inc/oox/drawingml/shape.hxx
+++ b/oox/inc/oox/drawingml/shape.hxx
@@ -32,7 +32,6 @@
#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>
@@ -96,8 +95,7 @@ class Shape
{
public:
- explicit Shape( const sal_Char* pServiceType = NULL );
- explicit Shape( const ShapePtr& pSourceShape );
+ Shape( const sal_Char* pServiceType = NULL );
virtual ~Shape();
rtl::OUString& getServiceName(){ return msServiceName; }
@@ -116,20 +114,13 @@ 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; }
- 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 setPosition( com::sun::star::awt::Point nPosition ){ maPosition = nPosition; }
+ void setSize( com::sun::star::awt::Size aSize ){ maSize = aSize; }
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 ); }
@@ -167,13 +158,6 @@ 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 > &
@@ -213,7 +197,6 @@ protected:
GraphicPropertiesPtr mpGraphicPropertiesPtr;
CustomShapePropertiesPtr mpCustomShapePropertiesPtr;
table::TablePropertiesPtr mpTablePropertiesPtr;
- Shape3DPropertiesPtr mp3DPropertiesPtr;
PropertyMap maShapeProperties;
PropertyMap maDefaultShapeProperties;
TextListStylePtr mpMasterTextListStyle;
@@ -238,11 +221,7 @@ private:
sal_Bool mbHidden;
};
-// ---------------------------------------------------------------------
-
-/** Get custom shape preset string from xml token id
- */
-::rtl::OUString GetShapePresetType( sal_Int32 nType );
+::rtl::OUString GetShapeType( sal_Int32 nType );
} }
diff --git a/oox/inc/oox/drawingml/shape3dproperties.hxx b/oox/inc/oox/drawingml/shape3dproperties.hxx
deleted file mode 100644
index 1ebee3043..000000000
--- a/oox/inc/oox/drawingml/shape3dproperties.hxx
+++ /dev/null
@@ -1,134 +0,0 @@
-/*************************************************************************
- *
- * 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/drawingml/theme.hxx b/oox/inc/oox/drawingml/theme.hxx
index 903ff1dca..30a6aa1c4 100644
--- a/oox/inc/oox/drawingml/theme.hxx
+++ b/oox/inc/oox/drawingml/theme.hxx
@@ -32,7 +32,6 @@
#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 {
@@ -95,11 +94,6 @@ 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;
@@ -111,8 +105,6 @@ 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/export/drawingml.hxx b/oox/inc/oox/export/drawingml.hxx
index 10397a54c..5d19c42d8 100644
--- a/oox/inc/oox/export/drawingml.hxx
+++ b/oox/inc/oox/export/drawingml.hxx
@@ -20,9 +20,6 @@ namespace beans {
namespace drawing {
class XShape;
}
-namespace style {
- struct LineSpacing;
-}
namespace text {
class XTextContent;
class XTextRange;
@@ -41,6 +38,9 @@ public:
enum DocumentType { DOCUMENT_DOCX, DOCUMENT_PPTX, DOCUMENT_XLSX };
private:
+ ::sax_fastparser::FSHelperPtr mpFS;
+ ::oox::core::XmlFilterBase* mpFB;
+
static int mnImageCounter;
/// To specify where write eg. the images to (like 'ppt', or 'word' - according to the OPC).
@@ -48,8 +48,6 @@ private:
protected:
::com::sun::star::uno::Any mAny;
- ::sax_fastparser::FSHelperPtr mpFS;
- ::oox::core::XmlFilterBase* mpFB;
bool GetProperty( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, String aName );
bool GetPropertyAndState( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet,
@@ -60,7 +58,7 @@ protected:
rtl::OUString WriteImage( const rtl::OUString& rURL );
public:
- DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX ) : meDocumentType( eDocumentType ), mpFS( pFS ), mpFB( pFB ) {}
+ DrawingML( ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX ) : mpFS( pFS ), mpFB( pFB ), meDocumentType( eDocumentType ) {}
void SetFS( ::sax_fastparser::FSHelperPtr pFS ) { mpFS = pFS; }
::sax_fastparser::FSHelperPtr GetFS() { return mpFS; }
::oox::core::XmlFilterBase* GetFB() { return mpFB; }
@@ -79,9 +77,8 @@ public:
void WriteBlipFill( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, String sURLPropName );
void WriteOutline( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
void WriteStretch();
- void WriteLinespacing( ::com::sun::star::style::LineSpacing& rLineSpacing );
- ::rtl::OUString WriteBlip( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet, ::rtl::OUString& rURL );
+ ::rtl::OUString WriteBlip( ::rtl::OUString& rURL );
void WriteBlipMode( ::com::sun::star::uno::Reference< ::com::sun::star::beans::XPropertySet > rXPropSet );
void WriteShapeTransformation( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rXShape,
diff --git a/oox/inc/oox/export/shapes.hxx b/oox/inc/oox/export/shapes.hxx
index 74d9a5400..47f50d797 100644
--- a/oox/inc/oox/export/shapes.hxx
+++ b/oox/inc/oox/export/shapes.hxx
@@ -48,8 +48,14 @@ namespace drawing {
namespace oox { namespace drawingml {
class OOX_DLLPUBLIC ShapeExport : public DrawingML {
-
private:
+ sal_Int32 mnXmlNamespace;
+ sal_Int32 mnShapeIdMax, mnPictureIdMax;
+ Fraction maFraction;
+ MapMode maMapModeSrc, maMapModeDest;
+
+ ::com::sun::star::awt::Size MapSize( const ::com::sun::star::awt::Size& ) const;
+
struct ShapeCheck
{
bool operator()( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> s1, const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape> s2 ) const
@@ -65,25 +71,11 @@ private:
size_t operator()( const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > ) const;
};
-public:
typedef std::hash_map< const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape>, sal_Int32, ShapeHash, ShapeCheck> ShapeHashMap;
-
-protected:
- sal_Int32 mnShapeIdMax, mnPictureIdMax;
-
-private:
- sal_Int32 mnXmlNamespace;
- Fraction maFraction;
- MapMode maMapModeSrc, maMapModeDest;
-
- ::com::sun::star::awt::Size MapSize( const ::com::sun::star::awt::Size& ) const;
-
ShapeHashMap maShapeMap;
- ShapeHashMap* mpShapeMap;
public:
-
- ShapeExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ShapeHashMap* pShapeMap = NULL, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX );
+ ShapeExport( sal_Int32 nXmlNamespace, ::sax_fastparser::FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB = NULL, DocumentType eDocumentType = DOCUMENT_PPTX );
virtual ~ShapeExport() {}
sal_Int32 GetXmlNamespace() const;
@@ -162,9 +154,7 @@ public:
WriteUnknownShape( ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > xShape );
sal_Int32 GetNewShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape );
- sal_Int32 GetNewShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape, ::oox::core::XmlFilterBase* pFB );
sal_Int32 GetShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape );
- static sal_Int32 GetShapeID( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > rShape, ShapeHashMap* pShapeMap );
};
}}
diff --git a/oox/inc/oox/ppt/dgmimport.hxx b/oox/inc/oox/ppt/dgmimport.hxx
deleted file mode 100644
index 955b1fac5..000000000
--- a/oox/inc/oox/ppt/dgmimport.hxx
+++ /dev/null
@@ -1,71 +0,0 @@
-/*************************************************************************
- *
- * 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
deleted file mode 100644
index 8e3847bc4..000000000
--- a/oox/inc/oox/ppt/dgmlayout.hxx
+++ /dev/null
@@ -1,72 +0,0 @@
-/*************************************************************************
- *
- * 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/inc/oox/ppt/pptimport.hxx b/oox/inc/oox/ppt/pptimport.hxx
index dadfa1e1e..31ea88555 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();
void setActualSlidePersist( SlidePersistPtr pActualSlidePersist ){ mpActualSlidePersist = pActualSlidePersist; };
std::map< rtl::OUString, oox::drawingml::ThemePtr >& getThemes(){ return maThemes; };
@@ -66,9 +66,6 @@ public:
sal_Int32 getSchemeColor( sal_Int32 nToken ) const;
- virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rDescriptor )
- throw( ::com::sun::star::uno::RuntimeException );
-
private:
virtual GraphicHelper* implCreateGraphicHelper() const;
virtual ::rtl::OUString implGetImplementationName() const;
diff --git a/oox/inc/oox/xls/excelfilter.hxx b/oox/inc/oox/xls/excelfilter.hxx
index 3f72d7ae3..49a0c8575 100644
--- a/oox/inc/oox/xls/excelfilter.hxx
+++ b/oox/inc/oox/xls/excelfilter.hxx
@@ -68,7 +68,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();
virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rDescriptor ) throw( ::com::sun::star::uno::RuntimeException );
diff --git a/oox/inc/oox/xls/workbookhelper.hxx b/oox/inc/oox/xls/workbookhelper.hxx
index 65d89a274..99857ea8a 100644
--- a/oox/inc/oox/xls/workbookhelper.hxx
+++ b/oox/inc/oox/xls/workbookhelper.hxx
@@ -253,7 +253,7 @@ public:
/** Returns the converter for string to cell address/range conversion. */
AddressConverter& getAddressConverter() const;
/** Returns the chart object converter. */
- ExcelChartConverter* getChartConverter() const;
+ ExcelChartConverter& getChartConverter() const;
/** Returns the page and print settings converter. */
PageSettingsConverter& getPageSettingsConverter() const;
diff --git a/oox/source/core/facreg.cxx b/oox/source/core/facreg.cxx
index c54eb39c3..7233692ce 100644
--- a/oox/source/core/facreg.cxx
+++ b/oox/source/core/facreg.cxx
@@ -58,8 +58,6 @@ extern uno::Reference< uno::XInterface > SAL_CALL className##_createInstance(
namespace oox {
namespace core { SERVICE( FilterDetect ); }
namespace ppt { SERVICE( PowerPointImport ); }
- namespace ppt { SERVICE( QuickDiagrammingImport ); }
- namespace ppt { SERVICE( QuickDiagrammingLayout ); }
namespace xls { SERVICE( BiffDetector ); }
namespace xls { SERVICE( ExcelFilter ); }
namespace xls { SERVICE( ExcelBiffFilter ); }
@@ -103,8 +101,6 @@ OOX_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void * , void * pRegistryKe
WRITEINFO( ::oox::core::FilterDetect );
WRITEINFO( ::oox::ppt::PowerPointImport );
- WRITEINFO( ::oox::ppt::QuickDiagrammingImport );
- WRITEINFO( ::oox::ppt::QuickDiagrammingLayout );
WRITEINFO( ::oox::xls::BiffDetector );
WRITEINFO( ::oox::xls::ExcelFilter );
WRITEINFO( ::oox::xls::ExcelBiffFilter );
@@ -153,8 +149,6 @@ OOX_DLLPUBLIC void * SAL_CALL component_getFactory( const sal_Char * pImplName,
SINGLEFACTORY( ::oox::core::FilterDetect )
else SINGLEFACTORY( oox::ppt::PowerPointImport )
- else SINGLEFACTORY( oox::ppt::QuickDiagrammingImport )
- else SINGLEFACTORY( oox::ppt::QuickDiagrammingLayout )
else SINGLEFACTORY( ::oox::xls::BiffDetector )
else SINGLEFACTORY( ::oox::xls::ExcelFilter )
else SINGLEFACTORY( ::oox::xls::ExcelBiffFilter )
diff --git a/oox/source/core/filterbase.cxx b/oox/source/core/filterbase.cxx
index 8b4423697..6890ad460 100644
--- a/oox/source/core/filterbase.cxx
+++ b/oox/source/core/filterbase.cxx
@@ -32,7 +32,6 @@
#include <com/sun/star/frame/XModel.hpp>
#include <com/sun/star/task/XStatusIndicator.hpp>
#include <com/sun/star/task/XInteractionHandler.hpp>
-#include <com/sun/star/drawing/XShape.hpp>
#include <osl/mutex.hxx>
#include <rtl/instance.hxx>
#include <rtl/uri.hxx>
@@ -64,7 +63,6 @@ using ::com::sun::star::io::XInputStream;
using ::com::sun::star::io::XOutputStream;
using ::com::sun::star::io::XStream;
using ::com::sun::star::task::XStatusIndicator;
-using ::com::sun::star::drawing::XShape;
using ::com::sun::star::task::XInteractionHandler;
using ::com::sun::star::graphic::XGraphic;
using ::com::sun::star::container::XNameAccess;
@@ -165,7 +163,6 @@ struct FilterBaseImpl
Reference< XStream > mxOutStream;
Reference< XStatusIndicator > mxStatusIndicator;
Reference< XInteractionHandler > mxInteractionHandler;
- Reference< XShape > mxParentShape;
explicit FilterBaseImpl( const Reference< XMultiServiceFactory >& rxGlobalFactory );
@@ -277,11 +274,6 @@ const Reference< XFrame >& FilterBase::getTargetFrame() const
return mxImpl->mxTargetFrame;
}
-const Reference< XShape >& FilterBase::getParentShape() const
-{
- return mxImpl->mxParentShape;
-}
-
const Reference< XStatusIndicator >& FilterBase::getStatusIndicator() const
{
return mxImpl->mxStatusIndicator;
@@ -576,7 +568,6 @@ void FilterBase::setMediaDescriptor( const Sequence< PropertyValue >& rMediaDesc
mxImpl->mxTargetFrame = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_FRAME(), Reference< XFrame >() );
mxImpl->mxStatusIndicator = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_STATUSINDICATOR(), Reference< XStatusIndicator >() );
mxImpl->mxInteractionHandler = mxImpl->maMediaDesc.getUnpackedValueOrDefault( MediaDescriptor::PROP_INTERACTIONHANDLER(), Reference< XInteractionHandler >() );
- mxImpl->mxParentShape = mxImpl->maMediaDesc.getUnpackedValueOrDefault( CREATE_OUSTRING( "ParentShape" ), mxImpl->mxParentShape );
// Check for ISO OOXML
OUString sFilterName = mxImpl->maMediaDesc.getUnpackedValueOrDefault( CREATE_OUSTRING( "FilterName" ), OUString() );
diff --git a/oox/source/core/xmlfilterbase.cxx b/oox/source/core/xmlfilterbase.cxx
index 673acfe6b..37e26f415 100644
--- a/oox/source/core/xmlfilterbase.cxx
+++ b/oox/source/core/xmlfilterbase.cxx
@@ -32,14 +32,10 @@
#include <rtl/strbuf.hxx>
#include <rtl/ustrbuf.hxx>
-#include <rtl/instance.hxx>
#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/embed/XRelationshipAccess.hpp>
-#include <com/sun/star/xml/dom/XDocument.hpp>
-#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
#include <com/sun/star/xml/sax/InputSource.hpp>
#include <com/sun/star/xml/sax/XFastParser.hpp>
-#include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
#include <com/sun/star/document/XDocumentProperties.hpp>
#include <comphelper/mediadescriptor.hxx>
#include <sax/fshelper.hxx>
@@ -59,7 +55,6 @@ using ::rtl::OStringBuffer;
using ::rtl::OUString;
using ::rtl::OUStringBuffer;
using ::com::sun::star::beans::StringPair;
-using ::com::sun::star::beans::Pair;
using ::com::sun::star::uno::Reference;
using ::com::sun::star::uno::Sequence;
using ::com::sun::star::uno::Exception;
@@ -80,14 +75,11 @@ using ::com::sun::star::xml::sax::XFastTokenHandler;
using ::com::sun::star::xml::sax::XFastDocumentHandler;
using ::com::sun::star::xml::sax::InputSource;
using ::com::sun::star::xml::sax::SAXException;
-using ::com::sun::star::xml::dom::XDocument;
-using ::com::sun::star::xml::dom::XDocumentBuilder;
using ::com::sun::star::document::XDocumentProperties;
using ::com::sun::star::util::DateTime;
using ::comphelper::MediaDescriptor;
using ::sax_fastparser::FastSerializerHelper;
using ::sax_fastparser::FSHelperPtr;
-using namespace ::com::sun::star;
#include <com/sun/star/document/XDocumentPropertiesSupplier.hpp>
@@ -127,8 +119,6 @@ struct XmlFilterBaseImpl
typedef RefMap< OUString, Relations > RelationsMap;
Reference< XFastParser > mxFastParser;
- Reference< XFastTokenHandler >
- mxTokenHandler;
OUString maBinSuffix;
OUString maVmlSuffix;
RelationsMap maRelationsMap;
@@ -162,66 +152,6 @@ static Reference< XComponentContext > lcl_getComponentContext(Reference< XMultiS
// ============================================================================
-namespace
-{
- struct NamespaceIds: public rtl::StaticWithInit<
- Sequence< Pair< OUString, sal_Int32 > >,
- NamespaceIds>
- {
- Sequence< Pair< OUString, sal_Int32 > > operator()()
- {
- static const char* const namespaceURIs[] = {
- "http://www.w3.org/XML/1998/namespace",
- "http://schemas.openxmlformats.org/package/2006/relationships",
- "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
- "http://schemas.openxmlformats.org/drawingml/2006/main",
- "http://schemas.openxmlformats.org/drawingml/2006/diagram",
- "http://schemas.openxmlformats.org/drawingml/2006/chart",
- "http://schemas.openxmlformats.org/drawingml/2006/chartDrawing",
- "urn:schemas-microsoft-com:vml",
- "urn:schemas-microsoft-com:office:office",
- "urn:schemas-microsoft-com:office:word",
- "urn:schemas-microsoft-com:office:excel",
- "urn:schemas-microsoft-com:office:powerpoint",
- "http://schemas.microsoft.com/office/2006/activeX",
- "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
- "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing",
- "http://schemas.microsoft.com/office/excel/2006/main",
- "http://schemas.openxmlformats.org/presentationml/2006/main"
- };
-
- static const sal_Int32 namespaceIds[] = {
- NMSP_XML,
- NMSP_PACKAGE_RELATIONSHIPS,
- NMSP_RELATIONSHIPS,
- NMSP_DRAWINGML,
- NMSP_DIAGRAM,
- NMSP_CHART,
- NMSP_CDR,
- NMSP_VML,
- NMSP_OFFICE,
- NMSP_VML_DOC,
- NMSP_VML_XLS,
- NMSP_VML_PPT,
- NMSP_AX,
- NMSP_XLS,
- NMSP_XDR,
- NMSP_XM,
- NMSP_PPT
- };
-
- Sequence< Pair< OUString, sal_Int32 > > aRet(STATIC_ARRAY_SIZE(namespaceIds));
- for( sal_Int32 i=0; i<aRet.getLength(); ++i )
- aRet[i] = beans::make_Pair(
- ::rtl::OUString::createFromAscii(namespaceURIs[i]),
- namespaceIds[i]);
- return aRet;
- }
- };
-}
-
-// ============================================================================
-
XmlFilterBase::XmlFilterBase( const Reference< XMultiServiceFactory >& rxGlobalFactory ) :
FilterBase( rxGlobalFactory ),
mxImpl( new XmlFilterBaseImpl ),
@@ -230,18 +160,32 @@ XmlFilterBase::XmlFilterBase( const Reference< XMultiServiceFactory >& rxGlobalF
{
try
{
- // create the fast tokenhandler
- mxImpl->mxTokenHandler.set( new FastTokenHandler );
-
// create the fast parser
mxImpl->mxFastParser.set( rxGlobalFactory->createInstance( CREATE_OUSTRING( "com.sun.star.xml.sax.FastParser" ) ), UNO_QUERY_THROW );
- mxImpl->mxFastParser->setTokenHandler( mxImpl->mxTokenHandler );
+ mxImpl->mxFastParser->setTokenHandler( new FastTokenHandler );
// register XML namespaces
- const Sequence< Pair< OUString, sal_Int32 > > ids=
- NamespaceIds::get();
- for( sal_Int32 i=0; i<ids.getLength(); ++i )
- mxImpl->mxFastParser->registerNamespace( ids[i].First, ids[i].Second );
+ mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://www.w3.org/XML/1998/namespace" ), NMSP_XML );
+ mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/package/2006/relationships" ), NMSP_PACKAGE_RELATIONSHIPS );
+ mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/officeDocument/2006/relationships" ), NMSP_RELATIONSHIPS );
+
+ mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/main" ), NMSP_DRAWINGML );
+ mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/diagram" ), NMSP_DIAGRAM );
+ mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/chart" ), NMSP_CHART );
+ mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/chartDrawing" ), NMSP_CDR );
+
+ mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:vml" ), NMSP_VML );
+ mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:office" ), NMSP_OFFICE );
+ mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:word" ), NMSP_VML_DOC );
+ mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:excel" ), NMSP_VML_XLS );
+ mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:powerpoint" ), NMSP_VML_PPT );
+ mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.microsoft.com/office/2006/activeX" ), NMSP_AX );
+
+ mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/spreadsheetml/2006/main"), NMSP_XLS );
+ mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing" ), NMSP_XDR );
+ mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.microsoft.com/office/excel/2006/main" ), NMSP_XM );
+
+ mxImpl->mxFastParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/presentationml/2006/main"), NMSP_PPT );
}
catch( Exception& )
{
@@ -354,66 +298,6 @@ bool XmlFilterBase::importFragment( const ::rtl::Reference< FragmentHandler >& r
return false;
}
-Reference<XDocument> XmlFilterBase::importFragment( const ::rtl::OUString& aFragmentPath )
-{
- Reference<XDocument> xRet;
-
- // path to fragment stream valid?
- OSL_ENSURE( aFragmentPath.getLength() > 0, "XmlFilterBase::importFragment - empty fragment path" );
- if( aFragmentPath.getLength() == 0 )
- return xRet;
-
- // try to open the fragment stream (this may fail - do not assert)
- Reference< XInputStream > xInStrm = openInputStream( aFragmentPath );
- if( !xInStrm.is() )
- return xRet;
-
- // binary streams (fragment extension is '.bin') currently not supported
- sal_Int32 nBinSuffixPos = aFragmentPath.getLength() - mxImpl->maBinSuffix.getLength();
- if( (nBinSuffixPos >= 0) && aFragmentPath.match( mxImpl->maBinSuffix, nBinSuffixPos ) )
- return xRet;
-
- // try to import XML stream
- try
- {
- // create the dom parser
- Reference<XDocumentBuilder> xDomBuilder(
- getGlobalFactory()->createInstance(
- CREATE_OUSTRING( "com.sun.star.xml.dom.DocumentBuilder" ) ),
- UNO_QUERY_THROW );
-
- // create DOM from fragment
- xRet = xDomBuilder->parse(xInStrm);
- }
- catch( Exception& )
- {
- }
-
- return xRet;
-}
-
-bool XmlFilterBase::importFragment( const ::rtl::Reference< FragmentHandler >& rxHandler,
- const Reference< xml::sax::XFastSAXSerializable >& rxSerializer )
-{
- Reference< XFastDocumentHandler > xDocHandler( rxHandler.get() );
- if( !xDocHandler.is() )
- return false;
-
- // try to import XML stream
- try
- {
- rxSerializer->fastSerialize( xDocHandler,
- mxImpl->mxTokenHandler,
- uno::Sequence< beans::StringPair >(),
- NamespaceIds::get() );
- return true;
- }
- catch( Exception& )
- {}
-
- return false;
-}
-
RelationsRef XmlFilterBase::importRelations( const OUString& rFragmentPath )
{
// try to find cached relations
@@ -681,11 +565,6 @@ XmlFilterBase& XmlFilterBase::exportDocumentProperties( Reference< XDocumentProp
return *this;
}
-::oox::drawingml::chart::ChartConverter* XmlFilterBase::getChartConverter()
-{
- return 0;
-}
-
// protected ------------------------------------------------------------------
Reference< XInputStream > XmlFilterBase::implGetInputStream( MediaDescriptor& rMediaDesc ) const
diff --git a/oox/source/drawingml/chart/chartspaceconverter.cxx b/oox/source/drawingml/chart/chartspaceconverter.cxx
index 50a92dc26..175bfc05b 100644
--- a/oox/source/drawingml/chart/chartspaceconverter.cxx
+++ b/oox/source/drawingml/chart/chartspaceconverter.cxx
@@ -71,12 +71,9 @@ ChartSpaceConverter::~ChartSpaceConverter()
void ChartSpaceConverter::convertFromModel( const Reference< XShapes >& rxExternalPage, const Point& rChartPos )
{
- if( !getChartConverter() )
- return;
-
/* create data provider (virtual function in the ChartConverter class,
derived converters may create an external data provider) */
- getChartConverter()->createDataProvider( getChartDocument() );
+ getChartConverter().createDataProvider( getChartDocument() );
// attach number formatter of container document to data receiver
try
diff --git a/oox/source/drawingml/chart/converterbase.cxx b/oox/source/drawingml/chart/converterbase.cxx
index 49414ed25..7a49a4607 100644
--- a/oox/source/drawingml/chart/converterbase.cxx
+++ b/oox/source/drawingml/chart/converterbase.cxx
@@ -262,9 +262,9 @@ XmlFilterBase& ConverterRoot::getFilter() const
return mxData->mrFilter;
}
-ChartConverter* ConverterRoot::getChartConverter() const
+ChartConverter& ConverterRoot::getChartConverter() const
{
- return &mxData->mrConverter;
+ return mxData->mrConverter;
}
Reference< XChartDocument > ConverterRoot::getChartDocument() const
diff --git a/oox/source/drawingml/chart/datasourceconverter.cxx b/oox/source/drawingml/chart/datasourceconverter.cxx
index 426599058..6fde74bc5 100644
--- a/oox/source/drawingml/chart/datasourceconverter.cxx
+++ b/oox/source/drawingml/chart/datasourceconverter.cxx
@@ -54,15 +54,12 @@ DataSequenceConverter::~DataSequenceConverter()
Reference< XDataSequence > DataSequenceConverter::createDataSequence( const OUString& rRole )
{
// create data sequence from data source model (virtual call at chart converter)
- Reference< XDataSequence > xDataSeq;
- if( getChartConverter() )
- {
- xDataSeq = getChartConverter()->createDataSequence( getChartDocument()->getDataProvider(), mrModel );
+ Reference< XDataSequence > xDataSeq = getChartConverter().createDataSequence( getChartDocument()->getDataProvider(), mrModel );
+
+ // set sequence role
+ PropertySet aSeqProp( xDataSeq );
+ aSeqProp.setProperty( PROP_Role, rRole );
- // set sequen ce role
- PropertySet aSeqProp( xDataSeq );
- aSeqProp.setProperty( PROP_Role, rRole );
- }
return xDataSeq;
}
diff --git a/oox/source/drawingml/clrscheme.cxx b/oox/source/drawingml/clrscheme.cxx
index fc20caf2d..80cac1b27 100644
--- a/oox/source/drawingml/clrscheme.cxx
+++ b/oox/source/drawingml/clrscheme.cxx
@@ -26,7 +26,6 @@
*
************************************************************************/
-#include <osl/diagnose.h>
#include "oox/drawingml/clrscheme.hxx"
#include "tokens.hxx"
@@ -63,7 +62,6 @@ ClrScheme::~ClrScheme()
sal_Bool ClrScheme::getColor( sal_Int32 nSchemeClrToken, sal_Int32& rColor ) const
{
- OSL_ASSERT((nSchemeClrToken & sal_Int32(0xFFFF0000))==0);
switch( nSchemeClrToken )
{
case XML_bg1 : nSchemeClrToken = XML_lt1; break;
diff --git a/oox/source/drawingml/color.cxx b/oox/source/drawingml/color.cxx
index d2713e94f..618e711e4 100644
--- a/oox/source/drawingml/color.cxx
+++ b/oox/source/drawingml/color.cxx
@@ -382,7 +382,6 @@ sal_Int32 Color::getColor( const GraphicHelper& rGraphicHelper, sal_Int32 nPhClr
{
for( TransformVec::const_iterator aIt = maTransforms.begin(), aEnd = maTransforms.end(); aIt != aEnd; ++aIt )
{
- OSL_ASSERT((aIt->mnToken & sal_Int32(0xFFFF0000))==0);
switch( aIt->mnToken )
{
case XML_red: toCrgb(); lclSetValue( mnC1, aIt->mnValue ); break;
diff --git a/oox/source/drawingml/customshapegeometry.cxx b/oox/source/drawingml/customshapegeometry.cxx
index c948899df..07fb33653 100644
--- a/oox/source/drawingml/customshapegeometry.cxx
+++ b/oox/source/drawingml/customshapegeometry.cxx
@@ -1172,9 +1172,8 @@ Path2DListContext::Path2DListContext( ContextHandler& rParent, CustomShapeProper
// ---------------------------------------------------------------------
-OUString GetShapePresetType( sal_Int32 nType )
+OUString GetShapeType( sal_Int32 nType )
{
- OSL_ASSERT((nType & sal_Int32(0xFFFF0000))==0);
OUString sType;
switch( nType )
{
@@ -1802,7 +1801,6 @@ OUString GetShapePresetType( sal_Int32 nType )
static OUString GetTextShapeType( sal_Int32 nType )
{
- OSL_ASSERT((nType & sal_Int32(0xFFFF0000))==0);
OUString sType;
switch( nType )
{
@@ -2033,7 +2031,7 @@ PresetShapeGeometryContext::PresetShapeGeometryContext( ContextHandler& rParent,
OUString sShapeType;
sal_Int32 nShapeType = xAttribs->getOptionalValueToken( XML_prst, FastToken::DONTKNOW );
if ( nShapeType != FastToken::DONTKNOW )
- sShapeType = GetShapePresetType( nShapeType );
+ sShapeType = GetShapeType( nShapeType );
OSL_ENSURE( sShapeType.getLength(), "oox::drawingml::CustomShapeCustomGeometryContext::CustomShapeCustomGeometryContext(), unknown shape type" );
mrCustomShapeProperties.setShapePresetType( sShapeType );
}
diff --git a/oox/source/drawingml/diagram/constraintlistcontext.cxx b/oox/source/drawingml/diagram/constraintlistcontext.cxx
deleted file mode 100644
index 53519772a..000000000
--- a/oox/source/drawingml/diagram/constraintlistcontext.cxx
+++ /dev/null
@@ -1,102 +0,0 @@
-/*************************************************************************
- *
- * 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
deleted file mode 100644
index ecbb04cf7..000000000
--- a/oox/source/drawingml/diagram/constraintlistcontext.hxx
+++ /dev/null
@@ -1,54 +0,0 @@
-/*************************************************************************
- *
- * 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.cxx b/oox/source/drawingml/diagram/datamodelcontext.cxx
index 26da02281..d7c88b69a 100644
--- a/oox/source/drawingml/diagram/datamodelcontext.cxx
+++ b/oox/source/drawingml/diagram/datamodelcontext.cxx
@@ -26,7 +26,7 @@
*
************************************************************************/
-#include "datamodelcontext.hxx"
+#include "oox/drawingml/diagram/datamodelcontext.hxx"
#include "oox/helper/attributelist.hxx"
#include "oox/core/namespaces.hxx"
#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
@@ -42,46 +42,40 @@ namespace oox { namespace drawingml {
-// CT_CxnList
-class CxnListContext
+// CL_Cxn
+class CxnContext
: public ContextHandler
{
public:
- CxnListContext( ContextHandler& rParent,
- dgm::Connections & aConnections )
+ CxnContext( ContextHandler& rParent,
+ const Reference< XFastAttributeList >& xAttribs,
+ const dgm::ConnectionPtr & pConnection )
: ContextHandler( rParent )
- , mrConnections( aConnections )
+ , mpConnection( pConnection )
{
+ sal_Int32 nType = xAttribs->getOptionalValueToken( XML_type, XML_parOf );
+ pConnection->mnType = nType;
+ pConnection->msModelId = xAttribs->getOptionalValue( XML_modelId );
+ pConnection->msSourceId = xAttribs->getOptionalValue( XML_srcId );
+ pConnection->msDestId = xAttribs->getOptionalValue( XML_destId );
+ pConnection->msPresId = xAttribs->getOptionalValue( XML_presId );
+ pConnection->msSibTransId = xAttribs->getOptionalValue( XML_sibTransId );
+ AttributeList attribs( xAttribs );
+ pConnection->mnSourceOrder = attribs.getInteger( XML_srcOrd, 0 );
+ pConnection->mnDestOrder = attribs.getInteger( XML_destOrd, 0 );
}
+
virtual Reference< XFastContextHandler > SAL_CALL
createFastChildContext( sal_Int32 aElementToken,
- const Reference< XFastAttributeList >& xAttribs )
+ const Reference< XFastAttributeList >& /*xAttribs*/ )
throw (SAXException, RuntimeException)
{
Reference< XFastContextHandler > xRet;
switch( aElementToken )
{
- case NMSP_DIAGRAM|XML_cxn:
- {
- mrConnections.push_back( dgm::Connection() );
- dgm::Connection& rConnection=mrConnections.back();
-
- const sal_Int32 nType = xAttribs->getOptionalValueToken( XML_type, XML_parOf );
- rConnection.mnType = nType;
- rConnection.msModelId = xAttribs->getOptionalValue( XML_modelId );
- rConnection.msSourceId = xAttribs->getOptionalValue( XML_srcId );
- rConnection.msDestId = xAttribs->getOptionalValue( XML_destId );
- rConnection.msPresId = xAttribs->getOptionalValue( XML_presId );
- rConnection.msSibTransId = xAttribs->getOptionalValue( XML_sibTransId );
- rConnection.msParTransId = xAttribs->getOptionalValue( XML_parTransId );
- const AttributeList attribs( xAttribs );
- rConnection.mnSourceOrder = attribs.getInteger( XML_srcOrd, 0 );
- rConnection.mnDestOrder = attribs.getInteger( XML_destOrd, 0 );
-
- // skip CT_extLst
+ case NMSP_DIAGRAM|XML_extLst:
return xRet;
- }
default:
break;
}
@@ -89,136 +83,37 @@ public:
xRet.set( this );
return xRet;
}
-
private:
- dgm::Connections& mrConnections;
+ dgm::ConnectionPtr mpConnection;
};
-// CT_presLayoutVars
-class PresLayoutVarsContext
+// CT_CxnList
+class CxnListContext
: public ContextHandler
{
public:
- PresLayoutVarsContext( ContextHandler& rParent,
- dgm::Point & rPoint ) :
- ContextHandler( rParent ),
- mrPoint( rPoint )
- {
- }
- virtual Reference< XFastContextHandler > SAL_CALL
- createFastChildContext( sal_Int32 aElementToken,
- const Reference< XFastAttributeList >& xAttribs )
- throw (SAXException, RuntimeException)
+ CxnListContext( ContextHandler& rParent, dgm::Connections & aConnections )
+ : ContextHandler( rParent )
+ , maConnections( aConnections )
{
- Reference< XFastContextHandler > xRet;
- AttributeList aAttribs( xAttribs );
-
- switch( aElementToken )
- {
- // TODO
- case NMSP_DIAGRAM|XML_animLvl:
- case NMSP_DIAGRAM|XML_animOne:
- break;
- case NMSP_DIAGRAM|XML_bulletEnabled:
- mrPoint.mbBulletEnabled = aAttribs.getBool( XML_val, false );
- break;
- case NMSP_DIAGRAM|XML_chMax:
- mrPoint.mnMaxChildren = aAttribs.getInteger( XML_val, -1 );
- break;
- case NMSP_DIAGRAM|XML_chPref:
- mrPoint.mnPreferredChildren = aAttribs.getInteger( XML_val, -1 );
- break;
- case NMSP_DIAGRAM|XML_dir:
- mrPoint.mnDirection = aAttribs.getToken( XML_val, XML_norm );
- break;
- case NMSP_DIAGRAM|XML_hierBranch:
- mrPoint.mnHierarchyBranch = aAttribs.getToken( XML_val, XML_std );
- break;
- case NMSP_DIAGRAM|XML_orgChart:
- mrPoint.mbOrgChartEnabled = aAttribs.getBool( XML_val, false );
- break;
- case NMSP_DIAGRAM|XML_resizeHandles:
- mrPoint.mnResizeHandles = aAttribs.getToken( XML_val, XML_rel );
- break;
- default:
- break;
- }
- if( !xRet.is() )
- xRet.set( this );
- return xRet;
}
-
-private:
- dgm::Point& mrPoint;
-};
-
-
-// CT_prSet
-class PropertiesContext
- : public ContextHandler
-{
-public:
- PropertiesContext( ContextHandler& rParent,
- dgm::Point & rPoint,
- const Reference< XFastAttributeList >& xAttribs ) :
- ContextHandler( rParent ),
- mrPoint( rPoint )
- {
- OUString aEmptyStr;
- AttributeList aAttribs( xAttribs );
-
- mrPoint.msColorTransformCategoryId = aAttribs.getString( XML_csCatId, aEmptyStr );
- mrPoint.msColorTransformTypeId = aAttribs.getString( XML_csTypeId, aEmptyStr );
- mrPoint.msLayoutCategoryId = aAttribs.getString( XML_loCatId, aEmptyStr );
- mrPoint.msLayoutTypeId = aAttribs.getString( XML_loTypeId, aEmptyStr );
- mrPoint.msPlaceholderText = aAttribs.getString( XML_phldrT, aEmptyStr );
- mrPoint.msPresentationAssociationId = aAttribs.getString( XML_presAssocID, aEmptyStr );
- mrPoint.msPresentationLayoutName = aAttribs.getString( XML_presName, aEmptyStr );
- mrPoint.msPresentationLayoutStyleLabel = aAttribs.getString( XML_presStyleLbl, aEmptyStr );
- mrPoint.msQuickStyleCategoryId = aAttribs.getString( XML_qsCatId, aEmptyStr );
- mrPoint.msQuickStyleTypeId = aAttribs.getString( XML_qsTypeId, aEmptyStr );
-
- mrPoint.mnCustomAngle = aAttribs.getInteger( XML_custAng, -1 );
- mrPoint.mnPercentageNeighbourWidth = aAttribs.getInteger( XML_custLinFactNeighborX, -1 );
- mrPoint.mnPercentageNeighbourHeight = aAttribs.getInteger( XML_custLinFactNeighborY, -1 );
- mrPoint.mnPercentageOwnWidth = aAttribs.getInteger( XML_custLinFactX, -1 );
- mrPoint.mnPercentageOwnHeight = aAttribs.getInteger( XML_custLinFactY, -1 );
- mrPoint.mnIncludeAngleScale = aAttribs.getInteger( XML_custRadScaleInc, -1 );
- mrPoint.mnRadiusScale = aAttribs.getInteger( XML_custRadScaleRad, -1 );
- mrPoint.mnWidthScale = aAttribs.getInteger( XML_custScaleX, -1 );
- mrPoint.mnHeightScale = aAttribs.getInteger( XML_custScaleY, -1 );
- mrPoint.mnWidthOverride = aAttribs.getInteger( XML_custSzX, -1 );
- mrPoint.mnHeightOverride = aAttribs.getInteger( XML_custSzY, -1 );
- mrPoint.mnLayoutStyleCount = aAttribs.getInteger( XML_presStyleCnt, -1 );
- mrPoint.mnLayoutStyleIndex = aAttribs.getInteger( XML_presStyleIdx, -1 );
-
- mrPoint.mbCoherent3DOffset = aAttribs.getBool( XML_coherent3DOff, false );
- mrPoint.mbCustomHorizontalFlip = aAttribs.getBool( XML_custFlipHor, false );
- mrPoint.mbCustomVerticalFlip = aAttribs.getBool( XML_custFlipVert, false );
- mrPoint.mbCustomText = aAttribs.getBool( XML_custT, false );
- mrPoint.mbIsPlaceholder = aAttribs.getBool( XML_phldr, false );
- }
virtual Reference< XFastContextHandler > SAL_CALL
createFastChildContext( sal_Int32 aElementToken,
- const Reference< XFastAttributeList >& )
+ const Reference< XFastAttributeList >& xAttribs )
throw (SAXException, RuntimeException)
{
Reference< XFastContextHandler > xRet;
switch( aElementToken )
{
- case NMSP_DIAGRAM|XML_presLayoutVars:
+ case NMSP_DIAGRAM|XML_cxn:
{
- xRet.set( new PresLayoutVarsContext( *this, mrPoint ) );
+ dgm::ConnectionPtr pConnection( new dgm::Connection() );
+ maConnections.push_back( pConnection );
+ xRet.set( new CxnContext( *this, xAttribs, pConnection ) );
break;
}
- case NMSP_DIAGRAM|XML_style:
- {
- // TODO
- // skip CT_shapeStyle
- return xRet;
- }
default:
break;
}
@@ -228,10 +123,11 @@ public:
}
private:
- dgm::Point& mrPoint;
+ dgm::Connections & maConnections;
};
+
// CL_Pt
class PtContext
: public ContextHandler
@@ -239,25 +135,27 @@ class PtContext
public:
PtContext( ContextHandler& rParent,
const Reference< XFastAttributeList >& xAttribs,
- dgm::Point & rPoint):
- ContextHandler( rParent ),
- mrPoint( rPoint )
- {
- mrPoint.msModelId = xAttribs->getOptionalValue( XML_modelId );
-
- // the default type is XML_node
- const sal_Int32 nType = xAttribs->getOptionalValueToken( XML_type, XML_node );
- mrPoint.mnType = nType;
-
- // ignore the cxnId unless it is this type. See 5.15.3.1.3 in Primer
- if( ( nType == XML_parTrans ) || ( nType == XML_sibTrans ) )
- mrPoint.msCnxId = xAttribs->getOptionalValue( XML_cxnId );
- }
+ const dgm::PointPtr & pPoint)
+ : ContextHandler( rParent )
+ , mpPoint( pPoint )
+ {
+ mpPoint->setModelId( xAttribs->getOptionalValue( XML_modelId ) );
+ //
+ // the default type is XML_node
+ sal_Int32 nType = xAttribs->getOptionalValueToken( XML_type, XML_node );
+ mpPoint->setType( nType );
+
+ // ignore the cxnId unless it is this type. See 5.15.3.1.3 in Primer
+ if( ( nType == XML_parTrans ) || ( nType == XML_sibTrans ) )
+ {
+ mpPoint->setCnxId( xAttribs->getOptionalValue( XML_cxnId ) );
+ }
+ }
virtual Reference< XFastContextHandler > SAL_CALL
createFastChildContext( sal_Int32 aElementToken,
- const Reference< XFastAttributeList >& xAttribs )
+ const Reference< XFastAttributeList >& /*xAttribs*/ )
throw (SAXException, RuntimeException)
{
Reference< XFastContextHandler > xRet;
@@ -267,22 +165,18 @@ public:
case NMSP_DIAGRAM|XML_extLst:
return xRet;
case NMSP_DIAGRAM|XML_prSet:
- OSL_TRACE( "diagram property set for point");
- xRet = new PropertiesContext( *this, mrPoint, xAttribs );
+ // TODO
+ // CT_ElemPropSet
break;
case NMSP_DIAGRAM|XML_spPr:
OSL_TRACE( "shape props for point");
- if( !mrPoint.mpShape )
- mrPoint.mpShape.reset( new Shape() );
- xRet = new ShapePropertiesContext( *this, *(mrPoint.mpShape) );
+ xRet = new ShapePropertiesContext( *this, *mpPoint->getShape() );
break;
case NMSP_DIAGRAM|XML_t:
{
OSL_TRACE( "shape text body for point");
TextBodyPtr xTextBody( new TextBody );
- if( !mrPoint.mpShape )
- mrPoint.mpShape.reset( new Shape() );
- mrPoint.mpShape->setTextBody( xTextBody );
+ mpPoint->getShape()->setTextBody( xTextBody );
xRet = new TextBodyContext( *this, *xTextBody );
break;
}
@@ -295,7 +189,7 @@ public:
}
private:
- dgm::Point& mrPoint;
+ dgm::PointPtr mpPoint;
};
@@ -305,10 +199,11 @@ class PtListContext
: public ContextHandler
{
public:
- PtListContext( ContextHandler& rParent, dgm::Points& rPoints) :
- ContextHandler( rParent ),
- mrPoints( rPoints )
- {}
+ PtListContext( ContextHandler& rParent, dgm::Points & aPoints)
+ : ContextHandler( rParent )
+ , maPoints( aPoints )
+ {
+ }
virtual Reference< XFastContextHandler > SAL_CALL
createFastChildContext( sal_Int32 aElementToken,
const Reference< XFastAttributeList >& xAttribs )
@@ -321,8 +216,9 @@ public:
case NMSP_DIAGRAM|XML_pt:
{
// CT_Pt
- mrPoints.push_back( dgm::Point() );
- xRet.set( new PtContext( *this, xAttribs, mrPoints.back() ) );
+ dgm::PointPtr pPoint( new dgm::Point() );
+ maPoints.push_back( pPoint );
+ xRet.set( new PtContext( *this, xAttribs, pPoint ) );
break;
}
default:
@@ -334,7 +230,7 @@ public:
}
private:
- dgm::Points& mrPoints;
+ dgm::Points & maPoints;
};
// CT_BackgroundFormatting
diff --git a/oox/source/drawingml/diagram/datamodelcontext.hxx b/oox/source/drawingml/diagram/datamodelcontext.hxx
deleted file mode 100644
index be79609a3..000000000
--- a/oox/source/drawingml/diagram/datamodelcontext.hxx
+++ /dev/null
@@ -1,57 +0,0 @@
-/*************************************************************************
- *
- * 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.cxx b/oox/source/drawingml/diagram/diagram.cxx
index 11c4ef094..baa025031 100644
--- a/oox/source/drawingml/diagram/diagram.cxx
+++ b/oox/source/drawingml/diagram/diagram.cxx
@@ -32,22 +32,10 @@
#include <com/sun/star/awt/Point.hpp>
#include <com/sun/star/awt/Size.hpp>
-#include <com/sun/star/xml/dom/XDocument.hpp>
-#include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
-#include <rtl/ustrbuf.hxx>
-#include "oox/drawingml/textbody.hxx"
-#include "oox/drawingml/textparagraph.hxx"
-#include "oox/drawingml/textrun.hxx"
#include "oox/drawingml/diagram/diagram.hxx"
#include "oox/drawingml/fillproperties.hxx"
#include "oox/core/namespaces.hxx"
#include "tokens.hxx"
-#include "diagram.hxx"
-#include "diagramlayoutatoms.hxx"
-#include "diagramfragmenthandler.hxx"
-
-#include <iostream>
-#include <fstream>
using rtl::OUString;
using namespace ::com::sun::star;
@@ -59,26 +47,58 @@ namespace dgm {
void Connection::dump()
{
- OSL_TRACE("dgm: cnx modelId %s, srcId %s, dstId %s, parTransId %s, presId %s, sibTransId %s, srcOrd %d, dstOrd %d",
+ OSL_TRACE("dgm: cnx modelId %s, srcId %s, dstId %s",
OUSTRING_TO_CSTR( msModelId ),
OUSTRING_TO_CSTR( msSourceId ),
- OUSTRING_TO_CSTR( msDestId ),
- OUSTRING_TO_CSTR( msParTransId ),
- OUSTRING_TO_CSTR( msPresId ),
- OUSTRING_TO_CSTR( msSibTransId ),
- mnSourceOrder,
- mnDestOrder );
+ OUSTRING_TO_CSTR( msDestId ) );
+}
+
+Point::Point()
+ : mpShape( new Shape( "com.sun.star.drawing.GraphicObjectShape" ) )
+ , mnType( 0 )
+{
}
void Point::dump()
{
- OSL_TRACE( "dgm: pt text %x, cnxId %s, modelId %s, type %d",
- mpShape.get(),
+ OSL_TRACE( "dgm: pt cnxId %s, modelId %s",
OUSTRING_TO_CSTR( msCnxId ),
- OUSTRING_TO_CSTR( msModelId ),
- mnType );
+ OUSTRING_TO_CSTR( msModelId ) );
+}
+
+void Point::setModelId( const ::rtl::OUString & sModelId )
+{
+ msModelId = sModelId;
+ mpShape->setName( msModelId );
+}
+
+
+bool PointsTree::addChild( const PointsTreePtr & pChild )
+{
+ bool added = false;
+
+ OSL_ENSURE( pChild->mpParent.expired(), "can't add, has already a parent" );
+ OSL_ENSURE( mpNode, "has no node" );
+ if( mpNode && pChild->mpParent.expired() )
+ {
+ pChild->mpParent = shared_from_this();
+ maChildrens.push_back( pChild );
+ added = true;
+ }
+
+ return added;
}
+PointsTreePtr PointsTree::getParent() const
+{
+ if( !mpParent.expired() )
+ {
+ return mpParent.lock() ;
+ }
+ return PointsTreePtr();
+}
+
+
} // dgm namespace
DiagramData::DiagramData()
@@ -96,10 +116,18 @@ void DiagramData::dump()
boost::bind( &dgm::Point::dump, _1 ) );
}
-void DiagramLayout::layout( const dgm::Points & /*pTree*/, const awt::Point & /*pt*/ )
+static void setPosition( const dgm::PointPtr & pPoint, const awt::Point & pt )
+{
+ ShapePtr pShape = pPoint->getShape();
+ awt::Size sz;
+ sz.Width = 50;
+ sz.Height = 50;
+ pShape->setPosition( pt );
+ pShape->setSize( sz );
+}
+
+void DiagramLayout::layout( const dgm::PointsTreePtr & pTree, const awt::Point & pt )
{
- // TODO
-#if 0
setPosition( pTree->getPoint(), pt );
awt::Point nextPt = pt;
nextPt.Y += 50;
@@ -109,7 +137,6 @@ void DiagramLayout::layout( const dgm::Points & /*pTree*/, const awt::Point & /*
layout( *iter, nextPt );
nextPt.X += 50;
}
-#endif
}
void Diagram::setData( const DiagramDataPtr & pData)
@@ -123,244 +150,19 @@ void Diagram::setLayout( const DiagramLayoutPtr & pLayout)
mpLayout = pLayout;
}
-#if OSL_DEBUG_LEVEL > 1
-rtl::OString normalizeDotName( const rtl::OUString& rStr )
+void Diagram::setQStyles( const DiagramQStylesPtr & pStyles)
{
- rtl::OUStringBuffer aBuf;
- aBuf.append((sal_Unicode)'N');
-
- const sal_Int32 nLen(rStr.getLength());
- sal_Int32 nCurrIndex(0);
- while( nCurrIndex < nLen )
- {
- const sal_Int32 aChar=rStr.iterateCodePoints(&nCurrIndex);
- if( aChar != '-' && aChar != '{' && aChar != '}' )
- aBuf.append((sal_Unicode)aChar);
- }
-
- return rtl::OUStringToOString(aBuf.makeStringAndClear(),
- RTL_TEXTENCODING_UTF8);
+ mpQStyles = pStyles;
}
-#endif
-static sal_Int32 calcDepth( const rtl::OUString& rNodeName,
- const dgm::Connections& rCnx )
-{
- // find length of longest path in 'isChild' graph, ending with rNodeName
- dgm::Connections::const_iterator aCurrCxn( rCnx.begin() );
- const dgm::Connections::const_iterator aEndCxn( rCnx.end() );
- while( aCurrCxn != aEndCxn )
- {
- if( aCurrCxn->msParTransId.getLength() &&
- aCurrCxn->msSibTransId.getLength() &&
- aCurrCxn->msSourceId.getLength() &&
- aCurrCxn->msDestId.getLength() &&
- aCurrCxn->mnType != XML_presOf &&
- aCurrCxn->mnType != XML_presParOf &&
- rNodeName == aCurrCxn->msDestId )
- {
- return calcDepth(aCurrCxn->msSourceId,
- rCnx) + 1;
- }
- ++aCurrCxn;
- }
- return 0;
+void Diagram::setColors( const DiagramColorsPtr & pColors)
+{
+ mpColors = pColors;
}
-
void Diagram::build( )
{
- // build name-object maps
- // ======================
-
-#if OSL_DEBUG_LEVEL > 1
- std::ofstream output("/tmp/tree.dot");
-
- output << "digraph datatree {" << std::endl;
-#endif
-
- dgm::Points::iterator aCurrPoint( getData()->getPoints( ).begin() );
- const dgm::Points::iterator aEndPoint( getData()->getPoints( ).end() );
- while( aCurrPoint != aEndPoint )
- {
-#if OSL_DEBUG_LEVEL > 1
- output << "\t"
- << normalizeDotName(aCurrPoint->msModelId).getStr()
- << "[";
-
- if( aCurrPoint->msPresentationLayoutName.getLength() )
- output << "label=\""
- << rtl::OUStringToOString(
- aCurrPoint->msPresentationLayoutName,
- RTL_TEXTENCODING_UTF8).getStr() << "\", ";
- else
- output << "label=\""
- << rtl::OUStringToOString(
- aCurrPoint->msModelId,
- RTL_TEXTENCODING_UTF8).getStr() << "\", ";
-
- switch( aCurrPoint->mnType )
- {
- case XML_doc: output << "style=filled, color=red"; break;
- case XML_asst: output << "style=filled, color=green"; break;
- default:
- case XML_node: output << "style=filled, color=blue"; break;
- case XML_pres: output << "style=filled, color=yellow"; break;
- case XML_parTrans: output << "color=grey"; break;
- case XML_sibTrans: output << " "; break;
- }
-
- output << "];" << std::endl;
-
- // does currpoint have any text set?
- if( aCurrPoint->mpShape &&
- aCurrPoint->mpShape->getTextBody() &&
- !aCurrPoint->mpShape->getTextBody()->getParagraphs().empty() &&
- !aCurrPoint->mpShape->getTextBody()->getParagraphs().front()->getRuns().empty() )
- {
- static sal_Int32 nCount=0;
-
- output << "\t"
- << "textNode" << nCount
- << " ["
- << "label=\""
- << rtl::OUStringToOString(
- aCurrPoint->mpShape->getTextBody()->getParagraphs().front()->getRuns().front()->getText(),
- RTL_TEXTENCODING_UTF8).getStr()
- << "\"" << "];" << std::endl;
- output << "\t"
- << normalizeDotName(aCurrPoint->msModelId).getStr()
- << " -> "
- << "textNode" << nCount++
- << ";" << std::endl;
- }
-
-
-#if 0
- // msPresentationAssociationId does not appear to be
- // valid/used, the relation this imposed for several examples
- // was ~broken
- if( aCurrPoint->msPresentationAssociationId.getLength() )
- output << "\t"
- << normalizeDotName(aCurrPoint->msModelId).getStr()
- << " -> "
- << normalizeDotName(aCurrPoint->msPresentationAssociationId).getStr()
- << " [style=dotted, color=red, "
- << "label=\"presAssocID\"];" << std::endl;
-#endif
-
-#endif
-
- const bool bInserted1=getData()->getPointNameMap().insert(
- std::make_pair(aCurrPoint->msModelId,&(*aCurrPoint))).second;
- (void)bInserted1;
-
- OSL_ENSURE(bInserted1,"Diagram::build(): non-unique point model id");
-
- if( aCurrPoint->msPresentationLayoutName.getLength() )
- {
- DiagramData::PointsNameMap::value_type::second_type& rVec=
- getData()->getPointsPresNameMap()[aCurrPoint->msPresentationLayoutName];
- rVec.push_back(&(*aCurrPoint));
- }
- ++aCurrPoint;
- }
-
- dgm::Connections::const_iterator aCurrCxn( getData()->getConnections( ).begin() );
- const dgm::Connections::const_iterator aEndCxn( getData()->getConnections( ).end() );
- while( aCurrCxn != aEndCxn )
- {
-#if OSL_DEBUG_LEVEL > 1
- if( aCurrCxn->msParTransId.getLength() ||
- aCurrCxn->msSibTransId.getLength() )
- {
- if( aCurrCxn->msSourceId.getLength() ||
- aCurrCxn->msDestId.getLength() )
- {
- output << "\t"
- << normalizeDotName(aCurrCxn->msSourceId).getStr()
- << " -> "
- << normalizeDotName(aCurrCxn->msParTransId).getStr()
- << " -> "
- << normalizeDotName(aCurrCxn->msSibTransId).getStr()
- << " -> "
- << normalizeDotName(aCurrCxn->msDestId).getStr()
- << " [style=dotted,"
- << ((aCurrCxn->mnType == XML_presOf) ? " color=red, " : ((aCurrCxn->mnType == XML_presParOf) ? " color=green, " : " "))
- << "label=\""
- << rtl::OUStringToOString(aCurrCxn->msModelId,
- RTL_TEXTENCODING_UTF8 ).getStr()
- << "\"];" << std::endl;
- }
- else
- {
- output << "\t"
- << normalizeDotName(aCurrCxn->msParTransId).getStr()
- << " -> "
- << normalizeDotName(aCurrCxn->msSibTransId).getStr()
- << " ["
- << ((aCurrCxn->mnType == XML_presOf) ? " color=red, " : ((aCurrCxn->mnType == XML_presParOf) ? " color=green, " : " "))
- << "label=\""
- << rtl::OUStringToOString(aCurrCxn->msModelId,
- RTL_TEXTENCODING_UTF8 ).getStr()
- << "\"];" << std::endl;
- }
- }
- else if( aCurrCxn->msSourceId.getLength() ||
- aCurrCxn->msDestId.getLength() )
- output << "\t"
- << normalizeDotName(aCurrCxn->msSourceId).getStr()
- << " -> "
- << normalizeDotName(aCurrCxn->msDestId).getStr()
- << " [label=\""
- << rtl::OUStringToOString(aCurrCxn->msModelId,
- RTL_TEXTENCODING_UTF8 ).getStr()
- << ((aCurrCxn->mnType == XML_presOf) ? "\", color=red]" : ((aCurrCxn->mnType == XML_presParOf) ? "\", color=green]" : "\"]"))
- << ";" << std::endl;
-#endif
-
- const bool bInserted1=getData()->getConnectionNameMap().insert(
- std::make_pair(aCurrCxn->msModelId,&(*aCurrCxn))).second;
- (void)bInserted1;
-
- OSL_ENSURE(bInserted1,"Diagram::build(): non-unique connection model id");
-
- if( aCurrCxn->mnType == XML_presOf )
- {
- DiagramData::StringMap::value_type::second_type& rVec=getData()->getPresOfNameMap()[aCurrCxn->msDestId];
- rVec.push_back(
- std::make_pair(
- aCurrCxn->msSourceId,sal_Int32(0)));
- }
-
- ++aCurrCxn;
- }
-
- // assign outline levels
- DiagramData::StringMap::iterator aPresOfIter=getData()->getPresOfNameMap().begin();
- const DiagramData::StringMap::iterator aPresOfEnd=getData()->getPresOfNameMap().end();
- while( aPresOfIter != aPresOfEnd )
- {
- DiagramData::StringMap::value_type::second_type::iterator aPresOfNodeIterCalcLevel=aPresOfIter->second.begin();
- const DiagramData::StringMap::value_type::second_type::iterator aPresOfNodeEnd=aPresOfIter->second.end();
- while(aPresOfNodeIterCalcLevel != aPresOfNodeEnd)
- {
- const sal_Int32 nDepth=calcDepth(aPresOfNodeIterCalcLevel->first,
- getData()->getConnections());
- aPresOfNodeIterCalcLevel->second = nDepth != 0 ? nDepth : -1;
- ++aPresOfNodeIterCalcLevel;
- }
-
- ++aPresOfIter;
- }
-
-#if OSL_DEBUG_LEVEL > 1
- output << "}" << std::endl;
-#endif
-
- // TODO
-#if 0
OSL_TRACE( "building diagram" );
typedef std::map< OUString, dgm::PointPtr > PointsMap;
PointsMap aPointsMap;
@@ -436,33 +238,30 @@ void Diagram::build( )
}
// check bounds
OSL_ENSURE( aRoots.size() == 1, "more than one root" );
- mpRoot = aRoots.begin()->second;
- OSL_TRACE( "root is %s", OUSTRING_TO_CSTR( mpRoot->getPoint()->getModelId() ) );
- for( PointsTreeMap::iterator iter = aTreeMap.begin();
- iter != aTreeMap.end(); iter++ )
+ // #i92239# roots may be empty
+ if( !aRoots.empty() )
{
- if(! iter->second->getParent() )
+ mpRoot = aRoots.begin()->second;
+ OSL_TRACE( "root is %s", OUSTRING_TO_CSTR( mpRoot->getPoint()->getModelId() ) );
+ for( PointsTreeMap::iterator iter = aTreeMap.begin();
+ iter != aTreeMap.end(); iter++ )
{
- OSL_TRACE("node without parent %s", OUSTRING_TO_CSTR( iter->first ) );
+ if(! iter->second->getParent() )
+ {
+ OSL_TRACE("node without parent %s", OUSTRING_TO_CSTR( iter->first ) );
+ }
}
}
-#endif
}
void Diagram::addTo( const ShapePtr & pParentShape )
{
- // collect data, init maps
- build( );
-
- // create Shape hierarchy
- ShapeCreationVisitor aCreationVisitor(pParentShape, *this);
- mpLayout->getNode()->accept(aCreationVisitor);
-
-#if 0
dgm::Points & aPoints( mpData->getPoints( ) );
dgm::Points::iterator aPointsIter;
- mpLayout->layout( mpRoot, awt::Point( 0, 0 ) );
+ build( );
+ if( mpRoot.get() )
+ mpLayout->layout( mpRoot, awt::Point( 0, 0 ) );
for( aPointsIter = aPoints.begin(); aPointsIter != aPoints.end(); ++aPointsIter )
{
@@ -485,7 +284,6 @@ void Diagram::addTo( const ShapePtr & pParentShape )
{
OSL_TRACE( "Dgm: shape name %s", OUSTRING_TO_CSTR( (*iter)->getName() ) );
}
-#endif
}
OUString Diagram::getLayoutId() const
@@ -498,156 +296,6 @@ OUString Diagram::getLayoutId() const
return sLayoutId;
}
-uno::Reference<xml::dom::XDocument> loadFragment(
- core::XmlFilterBase& rFilter,
- const rtl::Reference< core::FragmentHandler >& rxHandler )
-{
- // load diagramming fragments into DOM representation, that later
- // gets serialized back to SAX events and parsed
- return rFilter.importFragment( rxHandler->getFragmentPath() );
-}
-
-void importFragment( core::XmlFilterBase& rFilter,
- const uno::Reference<xml::dom::XDocument>& rXDom,
- const char* /*pPropName*/,
- const ShapePtr& /*pShape*/,
- const rtl::Reference< core::FragmentHandler >& rxHandler )
-{
- uno::Reference<xml::sax::XFastSAXSerializable> xSerializer(
- rXDom, uno::UNO_QUERY_THROW);
-
- // now serialize DOM tree into internal data structures
- rFilter.importFragment( rxHandler, xSerializer );
-
- // not yet
-#if 0
- // tack XDocument onto shape
- pShape->getShapeProperties().setProperty(
- OUString::createFromAscii(pPropName),
- rXDom);
-#endif
-}
-
-void loadDiagram( const ShapePtr& pShape,
- core::XmlFilterBase& rFilter,
- const ::rtl::OUString& rDataModelPath,
- const ::rtl::OUString& rLayoutPath,
- const ::rtl::OUString& rQStylePath,
- const ::rtl::OUString& rColorStylePath )
-{
- DiagramPtr pDiagram( new Diagram() );
-
- DiagramDataPtr pData( new DiagramData() );
- pDiagram->setData( pData );
-
- DiagramLayoutPtr pLayout( new DiagramLayout() );
- pDiagram->setLayout( pLayout );
-
- // data
- if( rDataModelPath.getLength() > 0 )
- {
- rtl::Reference< core::FragmentHandler > xRef(
- new DiagramDataFragmentHandler( rFilter, rDataModelPath, pData ));
-
- importFragment(rFilter,
- loadFragment(rFilter,xRef),
- "DiagramData",
- pShape,
- xRef);
- }
-
- // layout
- if( rLayoutPath.getLength() > 0 )
- {
- rtl::Reference< core::FragmentHandler > xRef(
- new DiagramLayoutFragmentHandler( rFilter, rLayoutPath, pLayout ));
- importFragment(rFilter,
- loadFragment(rFilter,xRef),
- "DiagramLayout",
- pShape,
- xRef);
- }
-
- // style
- if( rQStylePath.getLength() > 0 )
- {
- rtl::Reference< core::FragmentHandler > xRef(
- new DiagramQStylesFragmentHandler( rFilter, rQStylePath, pDiagram->getStyles() ));
- importFragment(rFilter,
- loadFragment(rFilter,xRef),
- "DiagramQStyle",
- pShape,
- xRef);
- }
-
- // colors
- if( rColorStylePath.getLength() > 0 )
- {
- rtl::Reference< core::FragmentHandler > xRef(
- new ColorFragmentHandler( rFilter, rColorStylePath, pDiagram->getColors() ));
- importFragment(rFilter,
- loadFragment(rFilter,xRef),
- "DiagramColorStyle",
- pShape,
- xRef);
- }
-
- // diagram loaded. now lump together & attach to shape
- pDiagram->addTo(pShape);
-}
-
-void loadDiagram( const ShapePtr& pShape,
- core::XmlFilterBase& rFilter,
- const uno::Reference<xml::dom::XDocument>& rXDataModelDom,
- const uno::Reference<xml::dom::XDocument>& rXLayoutDom,
- const uno::Reference<xml::dom::XDocument>& rXQStyleDom,
- const uno::Reference<xml::dom::XDocument>& rXColorStyleDom )
-{
- DiagramPtr pDiagram( new Diagram() );
-
- DiagramDataPtr pData( new DiagramData() );
- pDiagram->setData( pData );
-
- DiagramLayoutPtr pLayout( new DiagramLayout() );
- pDiagram->setLayout( pLayout );
-
- OUString aEmpty;
-
- // data
- if( rXDataModelDom.is() )
- importFragment(rFilter,
- rXDataModelDom,
- "DiagramData",
- pShape,
- new DiagramDataFragmentHandler( rFilter, aEmpty, pData ));
-
- // layout
- if( rXLayoutDom.is() )
- importFragment(rFilter,
- rXLayoutDom,
- "DiagramLayout",
- pShape,
- new DiagramLayoutFragmentHandler( rFilter, aEmpty, pLayout ));
-
- // style
- if( rXQStyleDom.is() )
- importFragment(rFilter,
- rXQStyleDom,
- "DiagramQStyle",
- pShape,
- new DiagramQStylesFragmentHandler( rFilter, aEmpty, pDiagram->getStyles() ));
-
- // colors
- if( rXColorStyleDom.is() )
- importFragment(rFilter,
- rXColorStyleDom,
- "DiagramColorStyle",
- pShape,
- new ColorFragmentHandler( rFilter, aEmpty, pDiagram->getColors() ));
-
- // diagram loaded. now lump together & attach to shape
- pDiagram->addTo(pShape);
-}
} }
diff --git a/oox/source/drawingml/diagram/diagram.hxx b/oox/source/drawingml/diagram/diagram.hxx
deleted file mode 100644
index 6c8075c26..000000000
--- a/oox/source/drawingml/diagram/diagram.hxx
+++ /dev/null
@@ -1,323 +0,0 @@
-/* -*- 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/diagramdefinitioncontext.cxx b/oox/source/drawingml/diagram/diagramdefinitioncontext.cxx
index c52b82cde..14351d9a9 100644
--- a/oox/source/drawingml/diagram/diagramdefinitioncontext.cxx
+++ b/oox/source/drawingml/diagram/diagramdefinitioncontext.cxx
@@ -28,8 +28,9 @@
#include "diagramdefinitioncontext.hxx"
#include "oox/core/namespaces.hxx"
+#include "oox/helper/helper.hxx"
#include "layoutnodecontext.hxx"
-#include "datamodelcontext.hxx"
+#include "oox/drawingml/diagram/datamodelcontext.hxx"
#include "tokens.hxx"
using namespace ::oox::core;
@@ -87,15 +88,9 @@ DiagramDefinitionContext::createFastChildContext( ::sal_Int32 aElement,
mpLayout->setDesc( xAttribs->getOptionalValue( XML_val ) );
break;
case NMSP_DIAGRAM|XML_layoutNode:
- {
- LayoutNodePtr pNode( new LayoutNode() );
- mpLayout->getNode() = pNode;
- pNode->setChildOrder( xAttribs->getOptionalValueToken( XML_chOrder, XML_b ) );
- pNode->setMoveWith( xAttribs->getOptionalValue( XML_moveWith ) );
- pNode->setStyleLabel( xAttribs->getOptionalValue( XML_styleLbl ) );
- xRet.set( new LayoutNodeContext( *this, xAttribs, pNode ) );
+ mpLayout->getNode().reset( new LayoutNode() );
+ xRet.set( new LayoutNodeContext( *this, xAttribs, mpLayout->getNode() ) );
break;
- }
case NMSP_DIAGRAM|XML_clrData:
// TODO, does not matter for the UI. skip.
return xRet;
diff --git a/oox/source/drawingml/diagram/diagramdefinitioncontext.hxx b/oox/source/drawingml/diagram/diagramdefinitioncontext.hxx
index 8f32f6401..147c2d8bf 100644
--- a/oox/source/drawingml/diagram/diagramdefinitioncontext.hxx
+++ b/oox/source/drawingml/diagram/diagramdefinitioncontext.hxx
@@ -29,7 +29,7 @@
#define OOX_DRAWINGML_DIAGRAMDEFINITIONCONTEXT_HXX
#include "oox/core/contexthandler.hxx"
-#include "diagram.hxx"
+#include "oox/drawingml/diagram/diagram.hxx"
namespace oox { namespace drawingml {
diff --git a/oox/source/drawingml/diagram/diagramfragmenthandler.cxx b/oox/source/drawingml/diagram/diagramfragmenthandler.cxx
index 17091ae2f..a739a0095 100644
--- a/oox/source/drawingml/diagram/diagramfragmenthandler.cxx
+++ b/oox/source/drawingml/diagram/diagramfragmenthandler.cxx
@@ -28,11 +28,11 @@
#include <osl/diagnose.h>
+#include "oox/drawingml/diagram/diagramfragmenthandler.hxx"
+#include "oox/drawingml/diagram/datamodelcontext.hxx"
#include "oox/core/namespaces.hxx"
-#include "oox/drawingml/colorchoicecontext.hxx"
#include "diagramdefinitioncontext.hxx"
-#include "diagramfragmenthandler.hxx"
-#include "datamodelcontext.hxx"
+#include "tokens.hxx"
using namespace ::oox::core;
using namespace ::com::sun::star::xml::sax;
@@ -132,145 +132,96 @@ DiagramLayoutFragmentHandler::createFastChildContext( ::sal_Int32 aElement,
///////////////////////
DiagramQStylesFragmentHandler::DiagramQStylesFragmentHandler( XmlFilterBase& rFilter,
- const OUString& rFragmentPath,
- DiagramQStyleMap& rStylesMap ) :
- FragmentHandler2( rFilter, rFragmentPath ),
- maStyleName(),
- maStyleEntry(),
- mrStylesMap( rStylesMap )
-{}
-
-::oox::core::ContextHandlerRef DiagramQStylesFragmentHandler::createStyleMatrixContext(
- sal_Int32 nElement,
- const AttributeList& rAttribs,
- ShapeStyleRef& o_rStyle )
+ const OUString& rFragmentPath,
+ const DiagramQStylesPtr pDataPtr )
+ throw( )
+ : FragmentHandler( rFilter, rFragmentPath )
+ , mpDataPtr( pDataPtr )
{
- o_rStyle.mnThemedIdx = (nElement == (NMSP_DRAWINGML|XML_fontRef)) ?
- rAttribs.getToken( XML_idx, XML_none ) : rAttribs.getInteger( XML_idx, 0 );
- return new ColorContext( *this, o_rStyle.maPhClr );
}
-::oox::core::ContextHandlerRef DiagramQStylesFragmentHandler::onCreateContext( sal_Int32 nElement,
- const AttributeList& rAttribs )
+DiagramQStylesFragmentHandler::~DiagramQStylesFragmentHandler( ) throw ()
{
- // state-table like way of navigating the color fragment. we
- // currently ignore everything except styleLbl in the colorsDef
- // element
- switch( getCurrentElement() )
- {
- case XML_ROOT_CONTEXT:
- return nElement == (NMSP_DIAGRAM|XML_styleDef) ? this : NULL;
- case NMSP_DIAGRAM|XML_styleDef:
- return nElement == (NMSP_DIAGRAM|XML_styleLbl) ? this : NULL;
- case NMSP_DIAGRAM|XML_styleLbl:
- return nElement == (NMSP_DIAGRAM|XML_style) ? this : NULL;
- case NMSP_DIAGRAM|XML_style:
- {
- switch( nElement )
- {
- case NMSP_DRAWINGML|XML_lnRef : // CT_StyleMatrixReference
- return createStyleMatrixContext(nElement,rAttribs,
- maStyleEntry.maLineStyle);
- case NMSP_DRAWINGML|XML_fillRef : // CT_StyleMatrixReference
- return createStyleMatrixContext(nElement,rAttribs,
- maStyleEntry.maFillStyle);
- case NMSP_DRAWINGML|XML_effectRef : // CT_StyleMatrixReference
- return createStyleMatrixContext(nElement,rAttribs,
- maStyleEntry.maEffectStyle);
- case NMSP_DRAWINGML|XML_fontRef : // CT_FontRe ference
- return createStyleMatrixContext(nElement,rAttribs,
- maStyleEntry.maTextStyle);
- }
- return 0;
- }
- }
- return 0;
}
-void DiagramQStylesFragmentHandler::onStartElement( const AttributeList& rAttribs )
+void SAL_CALL DiagramQStylesFragmentHandler::endDocument()
+ throw (SAXException, RuntimeException)
+{
+
+}
+
+
+Reference< XFastContextHandler > SAL_CALL
+DiagramQStylesFragmentHandler::createFastChildContext( ::sal_Int32 aElement,
+ const Reference< XFastAttributeList >& )
+ throw ( SAXException, RuntimeException)
{
- if( getCurrentElement() == (NMSP_DIAGRAM|XML_styleLbl) )
+ Reference< XFastContextHandler > xRet;
+
+ switch( aElement )
{
- maStyleName = rAttribs.getString( XML_name, OUString() );
- maStyleEntry = mrStylesMap[maStyleName];
+ case NMSP_DIAGRAM|XML_styleDef:
+ // TODO
+ break;
+ default:
+ break;
}
+
+ if( !xRet.is() )
+ xRet = getFastContextHandler();
+
+ return xRet;
}
-void DiagramQStylesFragmentHandler::onEndElement( const ::rtl::OUString& )
+/////////////////////
+
+DiagramColorsFragmentHandler::DiagramColorsFragmentHandler( XmlFilterBase& rFilter,
+ const OUString& rFragmentPath,
+ const DiagramColorsPtr pDataPtr )
+ throw( )
+ : FragmentHandler( rFilter, rFragmentPath )
+ , mpDataPtr( pDataPtr )
{
- if( getCurrentElement() == (NMSP_DIAGRAM|XML_styleLbl) )
- mrStylesMap[maStyleName] = maStyleEntry;
}
-///////////////////////
+DiagramColorsFragmentHandler::~DiagramColorsFragmentHandler( ) throw ()
+{
-ColorFragmentHandler::ColorFragmentHandler( ::oox::core::XmlFilterBase& rFilter,
- const ::rtl::OUString& rFragmentPath,
- DiagramColorMap& rColorsMap ) :
- FragmentHandler2(rFilter,rFragmentPath),
- maColorName(),
- maColorEntry(),
- mrColorsMap(rColorsMap)
-{}
-
-::oox::core::ContextHandlerRef ColorFragmentHandler::onCreateContext( sal_Int32 nElement,
- const AttributeList& /*rAttribs*/ )
+}
+
+void SAL_CALL DiagramColorsFragmentHandler::endDocument()
+ throw (SAXException, RuntimeException)
{
- // state-table like way of navigating the color fragment. we
- // currently ignore everything except styleLbl in the colorsDef
- // element
- switch( getCurrentElement() )
- {
- case XML_ROOT_CONTEXT:
- return nElement == (NMSP_DIAGRAM|XML_colorsDef) ? this : NULL;;
- case NMSP_DIAGRAM|XML_colorsDef:
- return nElement == (NMSP_DIAGRAM|XML_styleLbl) ? this : NULL;;
- case NMSP_DIAGRAM|XML_styleLbl:
- return ((nElement == (NMSP_DIAGRAM|XML_fillClrLst)) ||
- (nElement == (NMSP_DIAGRAM|XML_linClrLst)) ||
- (nElement == (NMSP_DIAGRAM|XML_effectClrLst)) ||
- (nElement == (NMSP_DIAGRAM|XML_txLinClrLst)) ||
- (nElement == (NMSP_DIAGRAM|XML_txFillClrLst)) ||
- (nElement == (NMSP_DIAGRAM|XML_txEffectClrLst))) ? this : NULL;;
-
- // the actual colors - defer to color fragment handlers.
-
- // TODO(F1): well, actually, there might be *several* color
- // definitions in it, after all it's called list. but
- // apparently colorChoiceContext doesn't handle that anyway...
- case NMSP_DIAGRAM|XML_fillClrLst:
- return new ColorContext( *this, maColorEntry.maFillColor );
- case NMSP_DIAGRAM|XML_linClrLst:
- return new ColorContext( *this, maColorEntry.maLineColor );
- case NMSP_DIAGRAM|XML_effectClrLst:
- return new ColorContext( *this, maColorEntry.maEffectColor );
- case NMSP_DIAGRAM|XML_txFillClrLst:
- return new ColorContext( *this, maColorEntry.maTextFillColor );
- case NMSP_DIAGRAM|XML_txLinClrLst:
- return new ColorContext( *this, maColorEntry.maTextLineColor );
- case NMSP_DIAGRAM|XML_txEffectClrLst:
- return new ColorContext( *this, maColorEntry.maTextEffectColor );
- }
- return 0;
}
-void ColorFragmentHandler::onStartElement( const AttributeList& rAttribs )
+
+Reference< XFastContextHandler > SAL_CALL
+DiagramColorsFragmentHandler::createFastChildContext( ::sal_Int32 aElement,
+ const Reference< XFastAttributeList >& )
+ throw ( SAXException, RuntimeException)
{
- if( getCurrentElement() == (NMSP_DIAGRAM|XML_styleLbl) )
+ Reference< XFastContextHandler > xRet;
+
+ switch( aElement )
{
- maColorName = rAttribs.getString( XML_name, OUString() );
- maColorEntry = mrColorsMap[maColorName];
+ case NMSP_DIAGRAM|XML_colorsDef:
+ // TODO
+ break;
+ default:
+ break;
}
-}
-void ColorFragmentHandler::onEndElement( const ::rtl::OUString& )
-{
- if( getCurrentElement() == (NMSP_DIAGRAM|XML_styleLbl) )
- mrColorsMap[maColorName] = maColorEntry;
+ if( !xRet.is() )
+ xRet = getFastContextHandler();
+
+ return xRet;
}
+
+
+
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/oox/source/drawingml/diagram/diagramfragmenthandler.hxx b/oox/source/drawingml/diagram/diagramfragmenthandler.hxx
deleted file mode 100644
index 169e14222..000000000
--- a/oox/source/drawingml/diagram/diagramfragmenthandler.hxx
+++ /dev/null
@@ -1,117 +0,0 @@
-/*************************************************************************
- *
- * 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.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index a0c2d6eb1..dd213fda6 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -26,24 +26,14 @@
*
************************************************************************/
-#include "diagramlayoutatoms.hxx"
+#include "oox/drawingml/diagram/diagramlayoutatoms.hxx"
#include <functional>
#include <boost/bind.hpp>
-#include <basegfx/numeric/ftools.hxx>
-
#include "oox/helper/attributelist.hxx"
-#include "oox/drawingml/fillproperties.hxx"
-#include "oox/drawingml/lineproperties.hxx"
-#include "oox/drawingml/textbody.hxx"
-#include "oox/drawingml/textparagraph.hxx"
-#include "oox/drawingml/textrun.hxx"
-#include "oox/drawingml/customshapeproperties.hxx"
-#include "diagramlayoutatoms.hxx"
#include "layoutnodecontext.hxx"
-using namespace ::com::sun::star;
using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::xml::sax;
using namespace ::oox::core;
@@ -53,7 +43,7 @@ namespace oox { namespace drawingml {
IteratorAttr::IteratorAttr( )
: mnAxis( 0 )
- , mnCnt( -1 )
+ , mnCnt( 0 )
, mbHideLastTrans( false )
, mnPtType( 0 )
, mnSt( 0 )
@@ -65,7 +55,7 @@ void IteratorAttr::loadFromXAttr( const Reference< XFastAttributeList >& xAttr )
{
AttributeList attr( xAttr );
mnAxis = xAttr->getOptionalValueToken( XML_axis, 0 );
- mnCnt = attr.getInteger( XML_cnt, -1 );
+ mnCnt = attr.getInteger( XML_cnt, 0 );
mbHideLastTrans = attr.getBool( XML_hideLastTrans, false );
mnPtType = xAttr->getOptionalValueToken( XML_ptType, 0 );
mnSt = attr.getInteger( XML_st, 0 );
@@ -98,675 +88,56 @@ void LayoutAtom::dump(int level)
OSL_TRACE( "level = %d - %s of type %s", level,
OUSTRING_TO_CSTR( msName ),
typeid(*this).name() );
- const std::vector<LayoutAtomPtr>& pChildren=getChildren();
- std::for_each( pChildren.begin(), pChildren.end(),
- boost::bind( &LayoutAtom::dump, _1, level + 1 ) );
-}
-
-
-ForEachAtom::ForEachAtom(const Reference< XFastAttributeList >& xAttributes)
-{
- maIter.loadFromXAttr(xAttributes);
-}
-
-void ForEachAtom::accept( LayoutAtomVisitor& rVisitor )
-{
- rVisitor.visit(*this);
-}
-
-void ChooseAtom::accept( LayoutAtomVisitor& rVisitor )
-{
- rVisitor.visit(*this);
-}
-
-ConditionAtom::ConditionAtom(const Reference< XFastAttributeList >& xAttributes) :
- mbElse( false )
-{
- maIter.loadFromXAttr( xAttributes );
- maCond.loadFromXAttr( xAttributes );
-}
-
-const std::vector<LayoutAtomPtr>& ConditionAtom::getChildren() const
-{
- bool bDecisionVar=true;
- // HACK
- if( maCond.mnFunc==XML_var && maCond.mnArg==XML_dir &&
- maCond.mnOp==XML_equ && !maCond.msVal.equalsAscii("norm") )
- bDecisionVar=false;
-
- if( bDecisionVar )
- return mpChildNodes;
- else
- return mpElseChildNodes;
-}
-
-void ConditionAtom::accept( LayoutAtomVisitor& rVisitor )
-{
- rVisitor.visit(*this);
-}
-
-void ConditionAtom::addChild( const LayoutAtomPtr & pNode )
-{
- if( mbElse )
- mpElseChildNodes.push_back( pNode );
- else
- mpChildNodes.push_back( pNode );
-}
-
-void ConstraintAtom::accept( LayoutAtomVisitor& rVisitor )
-{
- rVisitor.visit(*this);
-}
-
-void AlgAtom::accept( LayoutAtomVisitor& rVisitor )
-{
- rVisitor.visit(*this);
+ std::for_each( mpChildNodes.begin(), mpChildNodes.end(),
+ boost::bind( &LayoutAtom::dump, _1, level + 1 ) );
}
-void AlgAtom::layoutShape( const ShapePtr& rShape,
- const Diagram& /*rDgm*/,
- const rtl::OUString& rName ) const
-{
- switch(mnType)
- {
- case XML_composite:
- {
- if( rShape->getChildren().empty() )
- {
- rShape->setSize(awt::Size(50,50));
- break;
- }
-
- // just put stuff below each other
- const sal_Int32 nIncX=0;
- const sal_Int32 nIncY=1;
-
- std::vector<ShapePtr>::const_iterator aCurrShape=rShape->getChildren().begin();
- const std::vector<ShapePtr>::const_iterator aLastShape=rShape->getChildren().end();
-
- // find biggest shape
- awt::Size aMaxSize;
- while( aCurrShape != aLastShape )
- {
- const awt::Size& sz=(*aCurrShape)->getSize();
-
- aMaxSize.Width = std::max(
- aMaxSize.Width,
- sz.Width);
- aMaxSize.Height = std::max(
- aMaxSize.Height,
- sz.Height);
-
- ++aCurrShape;
- }
-
- aCurrShape=rShape->getChildren().begin();
- const awt::Point aStartPos=(*aCurrShape)->getPosition();
- awt::Point aCurrPos=aStartPos;
- awt::Size aTotalSize;
- aTotalSize.Width = aMaxSize.Width;
- while( aCurrShape != aLastShape )
- {
- const awt::Size& sz=(*aCurrShape)->getSize();
- (*aCurrShape)->setPosition(aCurrPos);
- (*aCurrShape)->setSize(
- awt::Size(aMaxSize.Width,
- sz.Height));
-
- aTotalSize.Height = std::max(
- aTotalSize.Height,
- aCurrPos.Y + sz.Height);
-
- aCurrPos.X += nIncX*sz.Width;
- aCurrPos.Y += nIncY*sz.Height;
-
- ++aCurrShape;
- }
-
- rShape->setSize(aTotalSize);
- break;
- }
-
- case XML_conn:
- break;
-
- case XML_cycle:
- {
- if( rShape->getChildren().empty() )
- {
- rShape->setSize(awt::Size(50,50));
- break;
- }
-
- const sal_Int32 nStartAngle=maMap.count(XML_stAng) ? maMap.find(XML_stAng)->second : 0;
- const sal_Int32 nSpanAngle=maMap.count(XML_spanAng) ? maMap.find(XML_spanAng)->second : 360;
-
- std::vector<ShapePtr>::const_iterator aCurrShape=rShape->getChildren().begin();
- const std::vector<ShapePtr>::const_iterator aLastShape=rShape->getChildren().end();
- const sal_Int32 nShapes=aLastShape-aCurrShape;
-
- // find biggest shape
- awt::Size aMaxSize;
- while( aCurrShape != aLastShape )
- {
- const awt::Size& sz=(*aCurrShape)->getSize();
-
- aMaxSize.Width = std::max(
- aMaxSize.Width,
- sz.Width);
- aMaxSize.Height = std::max(
- aMaxSize.Height,
- sz.Height);
-
- ++aCurrShape;
- }
-
- // layout shapes
- const sal_Int32 nMaxDim=std::max(aMaxSize.Width,aMaxSize.Height);
- awt::Size aTotalSize;
- aCurrShape=rShape->getChildren().begin();
- for( sal_Int32 i=0; i<nShapes; ++i, ++aCurrShape )
- {
- const awt::Size& sz=(*aCurrShape)->getSize();
-
- const double r=nShapes*nMaxDim/F_2PI * 360.0/nSpanAngle;
- const awt::Point aCurrPos(
- r + r*sin( (double(i)*nSpanAngle/nShapes + nStartAngle)*F_PI180 ),
- r - r*cos( (double(i)*nSpanAngle/nShapes + nStartAngle)*F_PI180 ) );
- (*aCurrShape)->setPosition(aCurrPos);
-
- aTotalSize.Width = std::max(
- aTotalSize.Width,
- aCurrPos.X + sz.Width);
- aTotalSize.Height = std::max(
- aTotalSize.Height,
- aCurrPos.Y + sz.Height);
- }
-
- rShape->setSize(aTotalSize);
- break;
- }
-
- case XML_hierChild:
- case XML_hierRoot:
- break;
-
- case XML_lin:
- {
- if( rShape->getChildren().empty() )
- {
- rShape->setSize(awt::Size(50,50));
- break;
- }
-
- const sal_Int32 nDir=maMap.count(XML_linDir) ? maMap.find(XML_linDir)->second : XML_fromL;
- const sal_Int32 nIncX=nDir==XML_fromL ? 1 : (nDir==XML_fromR ? -1 : 0);
- const sal_Int32 nIncY=nDir==XML_fromT ? 1 : (nDir==XML_fromB ? -1 : 0);
-
- std::vector<ShapePtr>::const_iterator aCurrShape=rShape->getChildren().begin();
- const std::vector<ShapePtr>::const_iterator aLastShape=rShape->getChildren().end();
- const awt::Point aStartPos=(*aCurrShape)->getPosition();
- awt::Point aCurrPos=aStartPos;
- awt::Size aTotalSize;
- while( aCurrShape != aLastShape )
- {
- const awt::Size& sz=(*aCurrShape)->getSize();
- (*aCurrShape)->setPosition(aCurrPos);
-
- aTotalSize.Width = std::max(
- aTotalSize.Width,
- aCurrPos.X + sz.Width);
- aTotalSize.Height = std::max(
- aTotalSize.Height,
- aCurrPos.Y + sz.Height);
-
- // HACK: the spacing is arbitrary
- aCurrPos.X += nIncX*(sz.Width+5);
- aCurrPos.Y += nIncY*(sz.Height+5);
-
- ++aCurrShape;
- }
-
- rShape->setSize(aTotalSize);
- break;
- }
-
- case XML_pyra:
- case XML_snake:
- break;
-
- case XML_sp:
- // HACK. Handled one level higher. Or rather, planned to
- break;
- case XML_tx:
- {
- TextBodyPtr pTextBody=rShape->getTextBody();
- if( !pTextBody ||
- pTextBody->getParagraphs().empty() ||
- pTextBody->getParagraphs().front()->getRuns().empty() )
- {
- rShape->setSize(awt::Size(5,5));
- break;
- }
-
- // HACK - count chars & paragraphs to come up with *some*
- // notion of necessary size
- const sal_Int32 nHackyFontHeight=50;
- const sal_Int32 nHackyFontWidth=20;
- awt::Size aTotalSize;
- for( sal_uInt32 nPara=0; nPara<pTextBody->getParagraphs().size(); ++nPara )
- {
- aTotalSize.Height += nHackyFontHeight;
-
- sal_Int32 nLocalWidth=0;
- for( sal_uInt32 nRun=0; nRun<pTextBody->getParagraphs().at(nPara)->getRuns().size(); ++nRun )
- nLocalWidth +=
- pTextBody->getParagraphs().at(nPara)->getRuns().at(nRun)->getText().getLength()
- * nHackyFontWidth;
-
- aTotalSize.Width = std::max(
- aTotalSize.Width,
- nLocalWidth);
- }
-
- rShape->setSize(aTotalSize);
- }
-
- default:
- break;
- }
-
- OSL_TRACE("Layouting shape %s: (%d,%d,%d,%d)",
- OUSTRING_TO_CSTR( rName ),
- rShape->getPosition().X,
- rShape->getPosition().Y,
- rShape->getSize().Width,
- rShape->getSize().Height);
-}
-
-void LayoutNode::accept( LayoutAtomVisitor& rVisitor )
+void ForEachAtom::processAtom()
{
- rVisitor.visit(*this);
+ // TODO there is likely some conditions
+ std::for_each( mpChildNodes.begin(), mpChildNodes.end(),
+ boost::bind( &LayoutAtom::processAtom, _1 ) );
}
-bool LayoutNode::setupShape( const ShapePtr& rShape, const Diagram& rDgm, sal_uInt32 nIdx ) const
+/** call ConditionAtom::test() if pAtom is one
+ * if it is not a ConditionAtom, then return false.
+ */
+static bool _test_atom( const LayoutAtomPtr & pAtom)
{
- // find the data node to grab text from
- DiagramData::PointsNameMap::const_iterator aDataNode=rDgm.getData()->getPointsPresNameMap().find(msName);
- if( aDataNode->second.size() > nIdx &&
- aDataNode != rDgm.getData()->getPointsPresNameMap().end() )
- {
- OSL_TRACE( "Filling content from %d th layout node named \"%s\", modelId \"%s\"",
- nIdx,
- OUSTRING_TO_CSTR( msName ),
- OUSTRING_TO_CSTR( aDataNode->second.at(nIdx)->msModelId ) );
-
- // got the presentation node - now, need the actual data node:
- const DiagramData::StringMap::const_iterator aNodeName=rDgm.getData()->getPresOfNameMap().find(
- aDataNode->second.at(nIdx)->msModelId);
- if( aNodeName != rDgm.getData()->getPresOfNameMap().end() )
- {
- DiagramData::StringMap::value_type::second_type::const_iterator aVecIter=aNodeName->second.begin();
- const DiagramData::StringMap::value_type::second_type::const_iterator aVecEnd=aNodeName->second.end();
- while( aVecIter != aVecEnd )
- {
- DiagramData::PointNameMap::const_iterator aDataNode2=rDgm.getData()->getPointNameMap().find(aVecIter->first);
- if( aVecIter->second == 0 )
- {
- // grab shape attr from topmost element(s)
- rShape->getShapeProperties() = aDataNode2->second->mpShape->getShapeProperties();
- rShape->getLineProperties() = aDataNode2->second->mpShape->getLineProperties();
- rShape->getFillProperties() = aDataNode2->second->mpShape->getFillProperties();
- rShape->getCustomShapeProperties() = aDataNode2->second->mpShape->getCustomShapeProperties();
- rShape->setMasterTextListStyle( aDataNode2->second->mpShape->getMasterTextListStyle() );
-
- OSL_TRACE( "Custom shape with preset type %s added for layout node named \"%s\"",
- OUSTRING_TO_CSTR(
- rShape->getCustomShapeProperties()->getShapePresetType()),
- OUSTRING_TO_CSTR( msName ) );
- }
-
- // append text with right outline level
- if( aDataNode2->second->mpShape->getTextBody() &&
- !aDataNode2->second->mpShape->getTextBody()->getParagraphs().empty() &&
- !aDataNode2->second->mpShape->getTextBody()->getParagraphs().front()->getRuns().empty() )
- {
- TextBodyPtr pTextBody=rShape->getTextBody();
- if( !pTextBody )
- {
- pTextBody.reset( new TextBody() );
-
- // also copy text attrs
- pTextBody->getTextListStyle() =
- aDataNode2->second->mpShape->getTextBody()->getTextListStyle();
- pTextBody->getTextProperties() =
- aDataNode2->second->mpShape->getTextBody()->getTextProperties();
-
- rShape->setTextBody(pTextBody);
- }
-
- TextParagraph& rPara=pTextBody->addParagraph();
- if( aVecIter->second != -1 )
- rPara.getProperties().setLevel(aVecIter->second);
-
- rPara.addRun(
- aDataNode2->second->mpShape->getTextBody()->getParagraphs().front()->getRuns().front());
- rPara.getProperties().apply(
- aDataNode2->second->mpShape->getTextBody()->getParagraphs().front()->getProperties());
- }
-
- ++aVecIter;
- }
- }
- else
- {
- OSL_TRACE("ShapeCreationVisitor::visit: no data node name found while processing shape type %s for layout node named \"%s\"",
- OUSTRING_TO_CSTR(
- rShape->getCustomShapeProperties()->getShapePresetType()),
- OUSTRING_TO_CSTR( msName ) );
- }
-
- // TODO(Q1): apply styling & coloring - taking
- // layout node's styleLbl for both style & color
- // now, but docs are a bit unclear on this
- if( msStyleLabel.getLength() )
+ try {
+ bool bResult = false;
+ const ConditionAtomPtr pCond = boost::dynamic_pointer_cast< ConditionAtom >(pAtom);
+ if( pCond )
{
- OSL_TRACE("setting style with label %s",
- OUSTRING_TO_CSTR( msStyleLabel ) );
-
- const DiagramQStyleMap::const_iterator aStyle=rDgm.getStyles().find(msStyleLabel);
- if( aStyle != rDgm.getStyles().end() )
- {
- rShape->getShapeStyleRefs()[XML_fillRef] = aStyle->second.maFillStyle;
- OSL_TRACE("added fill style with id %d", aStyle->second.maFillStyle.mnThemedIdx);
- rShape->getShapeStyleRefs()[XML_lnRef] = aStyle->second.maLineStyle;
- OSL_TRACE("added line style with id %d", aStyle->second.maLineStyle.mnThemedIdx);
- rShape->getShapeStyleRefs()[XML_effectRef] = aStyle->second.maEffectStyle;
- OSL_TRACE("added effect style with id %d", aStyle->second.maEffectStyle.mnThemedIdx);
- rShape->getShapeStyleRefs()[XML_fontRef] = aStyle->second.maTextStyle;
- OSL_TRACE("added fontref style with id %d", aStyle->second.maTextStyle.mnThemedIdx);
- Color aColor=aStyle->second.maTextStyle.maPhClr;
- OSL_TRACE("added fontref color with alpha %d", aColor.getTransparence() );
- }
-
- const DiagramColorMap::const_iterator aColor=rDgm.getColors().find(msStyleLabel);
- if( aColor != rDgm.getColors().end() )
- {
- const DiagramColor& rColor=aColor->second;
- if( rColor.maFillColor.isUsed() )
- rShape->getShapeStyleRefs()[XML_fillRef].maPhClr = rColor.maFillColor;
- if( rColor.maLineColor.isUsed() )
- rShape->getShapeStyleRefs()[XML_lnRef].maPhClr = rColor.maLineColor;
- if( rColor.maEffectColor.isUsed() )
- rShape->getShapeStyleRefs()[XML_effectRef].maPhClr = rColor.maEffectColor;
- if( rColor.maTextFillColor.isUsed() )
- rShape->getShapeStyleRefs()[XML_fontRef].maPhClr = rColor.maTextFillColor;
- }
+ bResult = pCond->test();
}
-
- // even if no data node found, successful anyway. it's
- // contained at the layoutnode
- return true;
+ return bResult;
}
- else
+ catch(...)
{
- OSL_TRACE("ShapeCreationVisitor::visit: no text found while processing shape type %s for layout node named \"%s\"",
- OUSTRING_TO_CSTR(
- rShape->getCustomShapeProperties()->getShapePresetType()),
- OUSTRING_TO_CSTR( msName ) );
}
-
return false;
}
-///////////////////////////////////////////////////////////////////////
-//
-// Visitation
-//
-
-class ShapeLayoutingVisitor : public LayoutAtomVisitor
-{
- ShapePtr mpParentShape;
- const Diagram& mrDgm;
- rtl::OUString maName;
-
- 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:
- ShapeLayoutingVisitor(const ShapePtr& rParentShape,
- const Diagram& rDgm,
- const rtl::OUString& rName) :
- mpParentShape(rParentShape),
- mrDgm(rDgm),
- maName(rName)
- {}
-
- void defaultVisit(LayoutAtom& rAtom);
-};
-
-class ShallowPresNameVisitor : public LayoutAtomVisitor
-{
- const Diagram& mrDgm;
- size_t mnCnt;
-
- 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:
- ShallowPresNameVisitor(const Diagram& rDgm) :
- mrDgm(rDgm),
- mnCnt(0)
- {}
-
- size_t getCount() const
- { return mnCnt; }
-};
-
-void ShapeCreationVisitor::defaultVisit(LayoutAtom& rAtom)
-{
- const std::vector<LayoutAtomPtr>& pChildren=rAtom.getChildren();
- std::for_each( pChildren.begin(), pChildren.end(),
- boost::bind( &LayoutAtom::accept,
- _1,
- boost::ref(*this)) );
-}
-
-void ShapeCreationVisitor::visit(ConstraintAtom& /*rAtom*/)
-{
- // TODO: eval the constraints
-}
-
-void ShapeCreationVisitor::visit(AlgAtom& rAtom)
+void ChooseAtom::processAtom()
{
- defaultVisit(rAtom);
-}
-
-void ShapeCreationVisitor::visit(ForEachAtom& rAtom)
-{
- const std::vector<LayoutAtomPtr>& pChildren=rAtom.getChildren();
-
- sal_Int32 nChildren=1;
- if( rAtom.iterator().mnPtType == XML_node )
- {
- // cound child data nodes - check all child Atoms for "name"
- // attribute that is contained in diagram's
- // getPointsPresNameMap()
- ShallowPresNameVisitor aVisitor(mrDgm);
- std::for_each( pChildren.begin(), pChildren.end(),
- boost::bind( &LayoutAtom::accept,
- _1,
- boost::ref(aVisitor)) );
- nChildren = aVisitor.getCount();
- }
-
- const sal_Int32 nCnt = std::min(
- nChildren,
- rAtom.iterator().mnCnt==-1 ? nChildren : rAtom.iterator().mnCnt);
-
- const sal_Int32 nOldIdx=mnCurrIdx;
- const sal_Int32 nStep=rAtom.iterator().mnStep;
- for( mnCurrIdx=0; mnCurrIdx<nCnt && nStep>0; mnCurrIdx+=nStep )
- {
- // TODO there is likely some conditions
- std::for_each( pChildren.begin(), pChildren.end(),
- boost::bind( &LayoutAtom::accept,
- _1,
- boost::ref(*this)) );
- }
-
- // and restore idx
- mnCurrIdx = nOldIdx;
-}
-
-void ShapeCreationVisitor::visit(ConditionAtom& rAtom)
-{
- defaultVisit(rAtom);
-}
-
-void ShapeCreationVisitor::visit(ChooseAtom& rAtom)
-{
- defaultVisit(rAtom);
-}
-
-void ShapeCreationVisitor::visit(LayoutNode& rAtom)
-{
- ShapePtr pCurrParent(mpParentShape);
- ShapePtr pCurrShape(rAtom.getShape());
- if( pCurrShape )
- {
- OSL_TRACE("ShapeCreationVisitor::visit: processing shape type %s",
- OUSTRING_TO_CSTR(
- pCurrShape->getCustomShapeProperties()->getShapePresetType()) );
-
- // TODO(F3): cloned shape shares all properties by reference,
- // don't change them!
- ShapePtr pClonedShape(
- new Shape( pCurrShape ));
-
- if( rAtom.setupShape(pClonedShape, mrDgm, mnCurrIdx) )
- {
- pCurrParent->addChild(pClonedShape);
- pCurrParent = pClonedShape;
- }
- }
- else
+ std::vector< LayoutAtomPtr >::iterator
+ iter = std::find_if( mpChildNodes.begin(), mpChildNodes.end(),
+ boost::bind( &_test_atom, _1 ) );
+ if( iter != mpChildNodes.end() )
{
- OSL_TRACE("ShapeCreationVisitor::visit: no shape set while processing layoutnode named %s",
- OUSTRING_TO_CSTR( rAtom.getName() ) );
+ // TODO do something
+ (*iter)->processAtom();
}
-
- // set new parent for children
- ShapePtr pPreviousParent(mpParentShape);
- mpParentShape=pCurrParent;
-
- // process children
- defaultVisit(rAtom);
-
- // restore parent
- mpParentShape=pPreviousParent;
-
- // layout shapes - now all child shapes are created
- ShapeLayoutingVisitor aLayoutingVisitor(pCurrParent,
- mrDgm,
- rAtom.getName());
- aLayoutingVisitor.defaultVisit(rAtom);
-}
-
-void ShapeLayoutingVisitor::defaultVisit(LayoutAtom& rAtom)
-{
- // visit all children, one of them need to be the layout algoritm
- const std::vector<LayoutAtomPtr>& pChildren=rAtom.getChildren();
- std::for_each( pChildren.begin(), pChildren.end(),
- boost::bind( &LayoutAtom::accept,
- _1,
- boost::ref(*this)) );
-}
-
-void ShapeLayoutingVisitor::visit(ConstraintAtom& /*rAtom*/)
-{
- // stop processing
-}
-
-void ShapeLayoutingVisitor::visit(AlgAtom& rAtom)
-{
- rAtom.layoutShape(mpParentShape,mrDgm,maName);
-}
-
-void ShapeLayoutingVisitor::visit(ForEachAtom& /*rAtom*/)
-{
- // stop processing
-}
-
-void ShapeLayoutingVisitor::visit(ConditionAtom& rAtom)
-{
- defaultVisit(rAtom);
-}
-
-void ShapeLayoutingVisitor::visit(ChooseAtom& rAtom)
-{
- defaultVisit(rAtom);
-}
-
-void ShapeLayoutingVisitor::visit(LayoutNode& /*rAtom*/)
-{
- // stop processing - only traverse Condition/Choose atoms
-}
-
-void ShallowPresNameVisitor::defaultVisit(LayoutAtom& rAtom)
-{
- // visit all children, at least one of them needs to have proper
- // name set
- const std::vector<LayoutAtomPtr>& pChildren=rAtom.getChildren();
- std::for_each( pChildren.begin(), pChildren.end(),
- boost::bind( &LayoutAtom::accept,
- _1,
- boost::ref(*this)) );
-}
-
-void ShallowPresNameVisitor::visit(ConstraintAtom& /*rAtom*/)
-{
- // stop processing
}
-void ShallowPresNameVisitor::visit(AlgAtom& /*rAtom*/)
+bool ConditionAtom::test()
{
- // stop processing
-}
-
-void ShallowPresNameVisitor::visit(ForEachAtom& rAtom)
-{
- defaultVisit(rAtom);
-}
-
-void ShallowPresNameVisitor::visit(ConditionAtom& rAtom)
-{
- defaultVisit(rAtom);
-}
-
-void ShallowPresNameVisitor::visit(ChooseAtom& rAtom)
-{
- defaultVisit(rAtom);
+ // TODO
+ return false;
}
-void ShallowPresNameVisitor::visit(LayoutNode& rAtom)
-{
- DiagramData::PointsNameMap::const_iterator aDataNode=
- mrDgm.getData()->getPointsPresNameMap().find(rAtom.getName());
- if( aDataNode != mrDgm.getData()->getPointsPresNameMap().end() )
- mnCnt = std::max(mnCnt,
- aDataNode->second.size());
-}
} }
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx b/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
deleted file mode 100644
index 5f7ab2974..000000000
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.hxx
+++ /dev/null
@@ -1,318 +0,0 @@
-/*************************************************************************
- *
- * 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/diagram/layoutnodecontext.cxx b/oox/source/drawingml/diagram/layoutnodecontext.cxx
index ad7e4ae3a..a0003bd3e 100644
--- a/oox/source/drawingml/diagram/layoutnodecontext.cxx
+++ b/oox/source/drawingml/diagram/layoutnodecontext.cxx
@@ -32,9 +32,7 @@
#include "oox/core/namespaces.hxx"
#include "oox/drawingml/diagram/diagram.hxx"
#include "oox/drawingml/shapecontext.hxx"
-#include "oox/drawingml/customshapeproperties.hxx"
#include "diagramdefinitioncontext.hxx"
-#include "constraintlistcontext.hxx"
using namespace ::oox::core;
using namespace ::com::sun::star::uno;
@@ -49,9 +47,15 @@ class IfContext
public:
IfContext( ContextHandler& rParent,
const Reference< XFastAttributeList >& xAttribs,
- const ConditionAtomPtr& pAtom )
- : LayoutNodeContext( rParent, xAttribs, pAtom )
- {}
+ const LayoutAtomPtr & pNode )
+ : LayoutNodeContext( rParent, xAttribs, pNode )
+ {
+ ConditionAtomPtr pAtom( boost::dynamic_pointer_cast< ConditionAtom >(pNode) );
+ OSL_ENSURE( pAtom, "Must pass a ConditionAtom" );
+
+ pAtom->iterator().loadFromXAttr( xAttribs );
+ pAtom->cond().loadFromXAttr( xAttribs );
+ }
};
@@ -60,47 +64,21 @@ class AlgorithmContext
: public ContextHandler
{
public:
- AlgorithmContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, const AlgAtomPtr & pNode )
+ AlgorithmContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, const LayoutAtomPtr & pNode )
: ContextHandler( rParent )
, mnRevision( 0 )
+ , mnType( 0 )
, mpNode( pNode )
{
AttributeList aAttribs( xAttribs );
mnRevision = aAttribs.getInteger( XML_rev, 0 );
- pNode->setType(xAttribs->getOptionalValueToken(XML_type, 0));
- }
-
- virtual Reference< XFastContextHandler > SAL_CALL
- createFastChildContext( ::sal_Int32 aElement,
- const Reference< XFastAttributeList >& xAttribs )
- throw (SAXException, RuntimeException)
- {
- Reference< XFastContextHandler > xRet;
-
- switch( getToken(aElement) )
- {
- case XML_param:
- {
- AttributeList aAttribs( xAttribs );
- const sal_Int32 nValTok=aAttribs.getToken( XML_val, 0 );
- mpNode->addParam(
- aAttribs.getToken( XML_type, 0 ),
- nValTok>0 ? nValTok : aAttribs.getInteger( XML_val, 0 ) );
- break;
- }
- default:
- break;
- }
-
- if( !xRet.is() )
- xRet.set(this);
-
- return xRet;
+ mnType = xAttribs->getOptionalValueToken( XML_type, 0 );
}
private:
- sal_Int32 mnRevision;
- AlgAtomPtr mpNode;
+ sal_Int32 mnRevision;
+ sal_Int32 mnType;
+ LayoutAtomPtr mpNode;
};
@@ -110,6 +88,7 @@ class ChooseContext
public:
ChooseContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, const LayoutAtomPtr & pNode )
: ContextHandler( rParent )
+ , mbHasElse( false )
, mpNode( pNode )
{
msName = xAttribs->getOptionalValue( XML_name );
@@ -122,23 +101,24 @@ public:
{
Reference< XFastContextHandler > xRet;
- switch( getToken(aElement) )
+ switch( aElement )
{
case XML_if:
{
// CT_When
- mpConditionNode.reset( new ConditionAtom(xAttribs) );
- mpNode->addChild( mpConditionNode );
- xRet.set( new IfContext( *this, xAttribs, mpConditionNode ) );
+ LayoutAtomPtr pAtom( new ConditionAtom( false ) );
+ mpNode->addChild( pAtom );
+ xRet.set( new IfContext( *this, xAttribs, pAtom ) );
break;
}
case XML_else:
// CT_Otherwise
- if( mpConditionNode )
+ if( !mbHasElse )
{
- mpConditionNode->readElseBranch();
- xRet.set( new IfContext( *this, xAttribs, mpConditionNode ) );
- mpConditionNode.reset();
+ LayoutAtomPtr pAtom( new ConditionAtom( true ) );
+ mpNode->addChild( pAtom );
+ xRet.set( new IfContext( *this, xAttribs, pAtom ) );
+ mbHasElse = true;
}
else
{
@@ -155,9 +135,9 @@ public:
return xRet;
}
private:
+ bool mbHasElse;
OUString msName;
LayoutAtomPtr mpNode;
- ConditionAtomPtr mpConditionNode;
};
@@ -167,10 +147,13 @@ class ForEachContext
: public LayoutNodeContext
{
public:
- ForEachContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, const ForEachAtomPtr& pAtom )
- : LayoutNodeContext( rParent, xAttribs, pAtom )
+ ForEachContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, const LayoutAtomPtr & pNode )
+ : LayoutNodeContext( rParent, xAttribs, pNode )
{
+ ForEachAtomPtr pAtom( boost::dynamic_pointer_cast< ForEachAtom >(pNode) );
+ OSL_ENSURE( pAtom, "Must pass a ForEachAtom" );
xAttribs->getOptionalValue( XML_ref );
+
pAtom->iterator().loadFromXAttr( xAttribs );
}
};
@@ -214,12 +197,17 @@ private:
// CT_LayoutNode
LayoutNodeContext::LayoutNodeContext( ContextHandler& rParent,
const Reference< XFastAttributeList >& xAttribs,
- const LayoutAtomPtr& pAtom )
+ const LayoutAtomPtr &pNode )
: ContextHandler( rParent )
- , mpNode( pAtom )
+ , mpNode( pNode )
{
- OSL_ENSURE( pAtom, "Node must NOT be NULL" );
+ OSL_ENSURE( pNode, "Node must NOT be NULL" );
mpNode->setName( xAttribs->getOptionalValue( XML_name ) );
+ // TODO shall we even bother?
+ // b or t
+// sal_Int32 nChOrder = xAttributes->getOptionalValueToken( XML_chOrder, XML_b );
+// OUString sMoveWith = xAttributes->getOptionalValue( XML_moveWith );
+// OUString sStyleLbl = xAttributes->getOptionalValue( XML_styleLbl );
}
@@ -240,33 +228,33 @@ void SAL_CALL LayoutNodeContext::endFastElement( ::sal_Int32 )
sal_Int32 LayoutNodeContext::tagToVarIdx( sal_Int32 aTag )
{
sal_Int32 nIdx = -1;
- switch( aTag & ~NMSP_DIAGRAM )
+ switch( aTag )
{
- case XML_animLvl:
+ case NMSP_DIAGRAM|XML_animLvl:
nIdx = LayoutNode::VAR_animLvl;
break;
- case XML_animOne:
+ case NMSP_DIAGRAM|XML_animOne:
nIdx = LayoutNode::VAR_animOne;
break;
- case XML_bulletEnabled:
+ case NMSP_DIAGRAM|XML_bulletEnabled:
nIdx = LayoutNode::VAR_bulletEnabled;
break;
- case XML_chMax:
+ case NMSP_DIAGRAM|XML_chMax:
nIdx = LayoutNode::VAR_chMax;
break;
- case XML_chPref:
+ case NMSP_DIAGRAM|XML_chPref:
nIdx = LayoutNode::VAR_chPref;
break;
- case XML_dir:
+ case NMSP_DIAGRAM|XML_dir:
nIdx = LayoutNode::VAR_dir;
break;
- case XML_hierBranch:
+ case NMSP_DIAGRAM|XML_hierBranch:
nIdx = LayoutNode::VAR_hierBranch;
break;
- case XML_orgChart:
+ case NMSP_DIAGRAM|XML_orgChart:
nIdx = LayoutNode::VAR_orgChart;
break;
- case XML_resizeHandles:
+ case NMSP_DIAGRAM|XML_resizeHandles:
nIdx = LayoutNode::VAR_resizeHandles;
break;
default:
@@ -289,39 +277,13 @@ LayoutNodeContext::createFastChildContext( ::sal_Int32 aElement,
{
LayoutNodePtr pNode( new LayoutNode() );
mpNode->addChild( pNode );
- pNode->setChildOrder( xAttribs->getOptionalValueToken( XML_chOrder, XML_b ) );
- pNode->setMoveWith( xAttribs->getOptionalValue( XML_moveWith ) );
- pNode->setStyleLabel( xAttribs->getOptionalValue( XML_styleLbl ) );
xRet.set( new LayoutNodeContext( *this, xAttribs, pNode ) );
break;
}
case NMSP_DIAGRAM|XML_shape:
{
- LayoutNodePtr pNode( boost::dynamic_pointer_cast< LayoutNode >( mpNode ) );
- if( pNode )
- {
- ShapePtr pShape;
-
- if( xAttribs->hasAttribute( XML_type ) )
- {
- pShape.reset( new Shape("com.sun.star.drawing.CustomShape") );
- const sal_Int32 nType(xAttribs->getOptionalValueToken( XML_type, XML_obj ));
- pShape->setSubType( nType );
- pShape->getCustomShapeProperties()->setShapePresetType(
- GetShapePresetType( nType ) );
- }
- else
- {
- pShape.reset( new Shape("com.sun.star.drawing.GroupShape") );
- }
-
- pNode->setShape( pShape );
- xRet.set( new ShapeContext( *this, ShapePtr(), pShape ) );
- }
- else
- {
- OSL_TRACE( "OOX: encountered a shape in a non layoutNode context" );
- }
+ ShapePtr pShape( new Shape() );
+ xRet.set( new ShapeContext( *this, ShapePtr(), pShape ) );
break;
}
case NMSP_DIAGRAM|XML_extLst:
@@ -329,7 +291,7 @@ LayoutNodeContext::createFastChildContext( ::sal_Int32 aElement,
case NMSP_DIAGRAM|XML_alg:
{
// CT_Algorithm
- AlgAtomPtr pAtom( new AlgAtom );
+ LayoutAtomPtr pAtom( new AlgAtom );
mpNode->addChild( pAtom );
xRet.set( new AlgorithmContext( *this, xAttribs, pAtom ) );
break;
@@ -345,14 +307,14 @@ LayoutNodeContext::createFastChildContext( ::sal_Int32 aElement,
case NMSP_DIAGRAM|XML_forEach:
{
// CT_ForEach
- ForEachAtomPtr pAtom( new ForEachAtom(xAttribs) );
+ LayoutAtomPtr pAtom( new ForEachAtom );
mpNode->addChild( pAtom );
xRet.set( new ForEachContext( *this, xAttribs, pAtom ) );
break;
}
case NMSP_DIAGRAM|XML_constrLst:
// CT_Constraints
- xRet.set( new ConstraintListContext( *this, xAttribs, mpNode ) );
+ // TODO
break;
case NMSP_DIAGRAM|XML_presOf:
{
diff --git a/oox/source/drawingml/diagram/layoutnodecontext.hxx b/oox/source/drawingml/diagram/layoutnodecontext.hxx
index 697f0f5da..6ded8e9c5 100644
--- a/oox/source/drawingml/diagram/layoutnodecontext.hxx
+++ b/oox/source/drawingml/diagram/layoutnodecontext.hxx
@@ -29,8 +29,7 @@
#define OOX_DRAWINGML_LAYOUTNODECONTEXT_HXX
#include "oox/core/contexthandler.hxx"
-#include "diagramlayoutatoms.hxx"
-#include "diagram.hxx"
+#include "oox/drawingml/diagram/diagram.hxx"
namespace oox { namespace drawingml {
diff --git a/oox/source/drawingml/diagram/makefile.mk b/oox/source/drawingml/diagram/makefile.mk
index 1d438c21f..9d526ed3d 100644
--- a/oox/source/drawingml/diagram/makefile.mk
+++ b/oox/source/drawingml/diagram/makefile.mk
@@ -41,7 +41,6 @@ ENABLE_EXCEPTIONS=TRUE
# --- Files --------------------------------------------------------
SLOFILES = \
- $(SLO)$/constraintlistcontext.obj \
$(SLO)$/diagram.obj \
$(SLO)$/diagramfragmenthandler.obj \
$(SLO)$/diagramdefinitioncontext.obj \
diff --git a/oox/source/drawingml/drawingmltypes.cxx b/oox/source/drawingml/drawingmltypes.cxx
index 1ea1b5f0c..a449853fa 100644
--- a/oox/source/drawingml/drawingmltypes.cxx
+++ b/oox/source/drawingml/drawingmltypes.cxx
@@ -160,7 +160,6 @@ float GetFontHeight( sal_Int32 nHeight )
sal_Int16 GetFontUnderline( sal_Int32 nToken )
{
- OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
switch( nToken )
{
case XML_none: return FontUnderline::NONE;
@@ -187,7 +186,6 @@ sal_Int16 GetFontUnderline( sal_Int32 nToken )
sal_Int16 GetFontStrikeout( sal_Int32 nToken )
{
- OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
switch( nToken )
{
case XML_dblStrike: return FontStrikeout::DOUBLE;
@@ -210,7 +208,6 @@ sal_Int16 GetCaseMap( sal_Int32 nToken )
/** converts a paragraph align to a ParaAdjust */
sal_Int16 GetParaAdjust( sal_Int32 nAlign )
{
- OSL_ASSERT((nAlign & sal_Int32(0xFFFF0000))==0);
sal_Int16 nEnum;
switch( nAlign )
{
@@ -239,7 +236,6 @@ sal_Int16 GetParaAdjust( sal_Int32 nAlign )
TabAlign GetTabAlign( sal_Int32 aToken )
{
- OSL_ASSERT((aToken & sal_Int32(0xFFFF0000))==0);
TabAlign nEnum;
switch( aToken )
{
diff --git a/oox/source/drawingml/fillproperties.cxx b/oox/source/drawingml/fillproperties.cxx
index 9e0349773..4729d9e9d 100644
--- a/oox/source/drawingml/fillproperties.cxx
+++ b/oox/source/drawingml/fillproperties.cxx
@@ -79,7 +79,6 @@ static const sal_Int32 spnDefaultFillIds[ FillId_END ] =
BitmapMode lclGetBitmapMode( sal_Int32 nToken )
{
- OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
switch( nToken )
{
case XML_tile: return BitmapMode_REPEAT;
@@ -90,7 +89,6 @@ BitmapMode lclGetBitmapMode( sal_Int32 nToken )
RectanglePoint lclGetRectanglePoint( sal_Int32 nToken )
{
- OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
switch( nToken )
{
case XML_tl: return RectanglePoint_LEFT_TOP;
@@ -225,7 +223,6 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, ModelObjectHelper& rM
if( moFillType.has() )
{
FillStyle eFillStyle = FillStyle_NONE;
- OSL_ASSERT((moFillType.get() & sal_Int32(0xFFFF0000))==0);
switch( moFillType.get() )
{
case XML_noFill:
diff --git a/oox/source/drawingml/graphicshapecontext.cxx b/oox/source/drawingml/graphicshapecontext.cxx
index 6c229f384..95e89b852 100644
--- a/oox/source/drawingml/graphicshapecontext.cxx
+++ b/oox/source/drawingml/graphicshapecontext.cxx
@@ -32,7 +32,7 @@
#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
#include "oox/drawingml/customshapeproperties.hxx"
-#include "oox/drawingml/diagram/diagram.hxx"
+#include "oox/drawingml/diagram/diagramfragmenthandler.hxx"
#include "oox/drawingml/table/tablecontext.hxx"
#include "oox/core/namespaces.hxx"
#include "oox/core/xmlfilterbase.hxx"
@@ -94,7 +94,7 @@ Reference< XFastContextHandler > GraphicShapeContext::createFastChildContext( sa
(mpShapePtr->getCustomShapeProperties());
sal_uInt32 nType = aElementToken & (~ NMSP_MASK);
- OUString sType(GetShapePresetType(nType));
+ OUString sType(GetShapeType(nType));
if (sType.getLength() > 0)
pCstmShpProps->setShapePresetType(sType);
@@ -119,7 +119,6 @@ Reference< XFastContextHandler > GraphicalObjectFrameContext::createFastChildCon
{
Reference< XFastContextHandler > xRet;
- OSL_ASSERT(((aElementToken &(~NMSP_MASK)) & sal_Int32(0xFFFF0000))==0);
switch( aElementToken &(~NMSP_MASK) )
{
// CT_ShapeProperties
@@ -278,6 +277,48 @@ DiagramGraphicDataContext::~DiagramGraphicDataContext()
{
}
+DiagramPtr DiagramGraphicDataContext::loadDiagram()
+{
+ DiagramPtr pDiagram( new Diagram() );
+ XmlFilterBase& rFilter = getFilter();
+
+ // data
+ OUString sDmPath = getFragmentPathFromRelId( msDm );
+ if( sDmPath.getLength() > 0 )
+ {
+ DiagramDataPtr pData( new DiagramData() );
+ pDiagram->setData( pData );
+ rFilter.importFragment( new DiagramDataFragmentHandler( rFilter, sDmPath, pData ) );
+ }
+ // layout
+ OUString sLoPath = getFragmentPathFromRelId( msLo );
+ if( sLoPath.getLength() > 0 )
+ {
+ DiagramLayoutPtr pLayout( new DiagramLayout() );
+ pDiagram->setLayout( pLayout );
+ rFilter.importFragment( new DiagramLayoutFragmentHandler( rFilter, sLoPath, pLayout ) );
+ }
+ // style
+ OUString sQsPath = getFragmentPathFromRelId( msQs );
+ if( sQsPath.getLength() > 0 )
+ {
+ DiagramQStylesPtr pStyles( new DiagramQStyles() );
+ pDiagram->setQStyles( pStyles );
+ rFilter.importFragment( new DiagramQStylesFragmentHandler( rFilter, sQsPath, pStyles ) );
+ }
+ // colors
+ OUString sCsPath = getFragmentPathFromRelId( msCs );
+ if( sCsPath.getLength() > 0 )
+ {
+ DiagramColorsPtr pColors( new DiagramColors() );
+ pDiagram->setColors( pColors );
+ rFilter.importFragment( new DiagramColorsFragmentHandler( rFilter, sCsPath, pColors ) ) ;
+ }
+
+ return pDiagram;
+}
+
+
Reference< XFastContextHandler > DiagramGraphicDataContext::createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs )
throw (SAXException, RuntimeException)
{
@@ -291,12 +332,8 @@ Reference< XFastContextHandler > DiagramGraphicDataContext::createFastChildConte
msLo = xAttribs->getOptionalValue( NMSP_RELATIONSHIPS|XML_lo );
msQs = xAttribs->getOptionalValue( NMSP_RELATIONSHIPS|XML_qs );
msCs = xAttribs->getOptionalValue( NMSP_RELATIONSHIPS|XML_cs );
- loadDiagram(mpShapePtr,
- getFilter(),
- getFragmentPathFromRelId( msDm ),
- getFragmentPathFromRelId( msLo ),
- getFragmentPathFromRelId( msQs ),
- getFragmentPathFromRelId( msCs ));
+ DiagramPtr pDiagram = loadDiagram();
+ pDiagram->addTo( mpShapePtr );
OSL_TRACE("diagram added shape %s of type %s", OUSTRING_TO_CSTR( mpShapePtr->getName() ),
OUSTRING_TO_CSTR( mpShapePtr->getServiceName() ) );
break;
@@ -355,8 +392,7 @@ void CreateChartCallback::onXShapeCreated( const Reference< drawing::XShape >& r
Reference< drawing::XShapes > xExternalPage;
if( !mbEmbedShapes )
xExternalPage = rxShapes;
- if( mrFilter.getChartConverter() )
- mrFilter.getChartConverter()->convertFromModel( mrFilter, aModel, xChartDoc, xExternalPage, rxShape->getPosition(), rxShape->getSize() );
+ mrFilter.getChartConverter().convertFromModel( mrFilter, aModel, xChartDoc, xExternalPage, rxShape->getPosition(), rxShape->getSize() );
}
catch( Exception& )
{
diff --git a/oox/source/drawingml/lineproperties.cxx b/oox/source/drawingml/lineproperties.cxx
index 3f98c9975..69e5ac8e1 100644
--- a/oox/source/drawingml/lineproperties.cxx
+++ b/oox/source/drawingml/lineproperties.cxx
@@ -160,7 +160,6 @@ void lclConvertCustomDash( LineDash& orLineDash, const LineProperties::DashStopV
DashStyle lclGetDashStyle( sal_Int32 nToken )
{
- OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
switch( nToken )
{
case XML_rnd: return DashStyle_ROUNDRELATIVE;
@@ -172,7 +171,6 @@ DashStyle lclGetDashStyle( sal_Int32 nToken )
LineJoint lclGetLineJoint( sal_Int32 nToken )
{
- OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
switch( nToken )
{
case XML_round: return LineJoint_ROUND;
@@ -188,7 +186,6 @@ const sal_Int32 OOX_ARROWSIZE_LARGE = 2;
sal_Int32 lclGetArrowSize( sal_Int32 nToken )
{
- OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
switch( nToken )
{
case XML_sm: return OOX_ARROWSIZE_SMALL;
@@ -210,7 +207,6 @@ void lclPushMarkerProperties( PropertyMap& rPropMap, const LineArrowProperties&
OUStringBuffer aBuffer;
sal_Int32 nArrowType = rArrowProps.moArrowType.get( XML_none );
- OSL_ASSERT((nArrowType & sal_Int32(0xFFFF0000))==0);
switch( nArrowType )
{
case XML_triangle:
@@ -267,7 +263,6 @@ void lclPushMarkerProperties( PropertyMap& rPropMap, const LineArrowProperties&
#define OOX_ARROW_POINT( x, y ) Point( static_cast< sal_Int32 >( fArrowWidth * x ), static_cast< sal_Int32 >( fArrowLength * y ) )
::std::vector< Point > aPoints;
- OSL_ASSERT((rArrowProps.moArrowType.get() & sal_Int32(0xFFFF0000))==0);
switch( rArrowProps.moArrowType.get() )
{
case XML_triangle:
diff --git a/oox/source/drawingml/makefile.mk b/oox/source/drawingml/makefile.mk
index 5079b02c1..e2d4ea6b8 100644
--- a/oox/source/drawingml/makefile.mk
+++ b/oox/source/drawingml/makefile.mk
@@ -59,7 +59,6 @@ SLOFILES = \
$(SLO)$/linepropertiescontext.obj\
$(SLO)$/objectdefaultcontext.obj\
$(SLO)$/shape.obj\
- $(SLO)$/shape3dproperties.obj\
$(SLO)$/shapecontext.obj\
$(SLO)$/shapegroupcontext.obj\
$(SLO)$/shapepropertiescontext.obj\
diff --git a/oox/source/drawingml/scene3dcontext.cxx b/oox/source/drawingml/scene3dcontext.cxx
deleted file mode 100644
index 4f629d846..000000000
--- a/oox/source/drawingml/scene3dcontext.cxx
+++ /dev/null
@@ -1,189 +0,0 @@
-/*************************************************************************
- *
- * 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/shape.cxx b/oox/source/drawingml/shape.cxx
index 8153702d8..2d2d1c402 100644
--- a/oox/source/drawingml/shape.cxx
+++ b/oox/source/drawingml/shape.cxx
@@ -42,10 +42,8 @@
#include <tools/solar.h> // for the F_PI180 define
#include <com/sun/star/graphic/XGraphic.hpp>
#include <com/sun/star/container/XNamed.hpp>
-#include <com/sun/star/container/XNameContainer.hpp>
#include <com/sun/star/beans/XMultiPropertySet.hpp>
#include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/xml/AttributeData.hpp>
#include <com/sun/star/drawing/HomogenMatrix3.hpp>
#include <com/sun/star/drawing/TextVerticalAdjust.hpp>
#include <com/sun/star/text/XText.hpp>
@@ -108,34 +106,6 @@ Shape::Shape( const sal_Char* pServiceName )
msServiceName = OUString::createFromAscii( pServiceName );
setDefaults();
}
-
-Shape::Shape( const ShapePtr& pSourceShape )
-: maChildren()
-, mbIsChild( pSourceShape->mbIsChild )
-, mpTextBody(pSourceShape->mpTextBody)
-, mpLinePropertiesPtr( pSourceShape->mpLinePropertiesPtr )
-, mpFillPropertiesPtr( pSourceShape->mpFillPropertiesPtr )
-, mpGraphicPropertiesPtr( pSourceShape->mpGraphicPropertiesPtr )
-, mpCustomShapePropertiesPtr( pSourceShape->mpCustomShapePropertiesPtr )
-, mpTablePropertiesPtr( pSourceShape->mpTablePropertiesPtr )
-, mp3DPropertiesPtr( pSourceShape->mp3DPropertiesPtr )
-, maShapeProperties( pSourceShape->maShapeProperties )
-, mpMasterTextListStyle( pSourceShape->mpMasterTextListStyle )
-, mxShape()
-, msServiceName( pSourceShape->msServiceName )
-, msName( pSourceShape->msName )
-, msId( pSourceShape->msId )
-, mnSubType( pSourceShape->mnSubType )
-, mnSubTypeIndex( pSourceShape->mnSubTypeIndex )
-, maShapeStyleRefs( pSourceShape->maShapeStyleRefs )
-, maSize( pSourceShape->maSize )
-, maPosition( pSourceShape->maPosition )
-, mxCreateCallback( pSourceShape->mxCreateCallback )
-, mnRotation( pSourceShape->mnRotation )
-, mbFlipH( pSourceShape->mbFlipH )
-, mbFlipV( pSourceShape->mbFlipV )
-{}
-
Shape::~Shape()
{
}
@@ -208,7 +178,6 @@ void Shape::addShape(
void Shape::applyShapeReference( const Shape& rReferencedShape )
{
- if( rReferencedShape.mpTextBody.get() )
mpTextBody = TextBodyPtr( new TextBody( *rReferencedShape.mpTextBody.get() ) );
maShapeProperties = rReferencedShape.maShapeProperties;
mpLinePropertiesPtr = LinePropertiesPtr( new LineProperties( *rReferencedShape.mpLinePropertiesPtr.get() ) );
@@ -225,19 +194,6 @@ void Shape::applyShapeReference( const Shape& rReferencedShape )
mbHidden = rReferencedShape.mbHidden;
}
-void Shape::addChildren( const ::oox::core::XmlFilterBase& rFilterBase,
- const Theme* pTheme,
- const Reference< XShapes >& rxShapes,
- const awt::Rectangle* pShapeRect,
- ShapeIdMap* pShapeMap )
-{
- addChildren(rFilterBase, *this, pTheme, rxShapes,
- pShapeRect ?
- *pShapeRect :
- awt::Rectangle( maPosition.X, maPosition.Y, maSize.Width, maSize.Height ),
- pShapeMap);
-}
-
// for group shapes, the following method is also adding each child
void Shape::addChildren(
const ::oox::core::XmlFilterBase& rFilterBase,
diff --git a/oox/source/drawingml/shape3dproperties.cxx b/oox/source/drawingml/shape3dproperties.cxx
deleted file mode 100644
index ea1e4f4bc..000000000
--- a/oox/source/drawingml/shape3dproperties.cxx
+++ /dev/null
@@ -1,66 +0,0 @@
-/*************************************************************************
- *
- * 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/drawingml/shapepropertiescontext.cxx b/oox/source/drawingml/shapepropertiescontext.cxx
index 51458ed70..e3aad56ef 100644
--- a/oox/source/drawingml/shapepropertiescontext.cxx
+++ b/oox/source/drawingml/shapepropertiescontext.cxx
@@ -35,7 +35,6 @@
#include <com/sun/star/container/XNamed.hpp>
#include "oox/core/namespaces.hxx"
-#include "oox/drawingml/scene3dcontext.hxx"
#include "oox/drawingml/linepropertiescontext.hxx"
#include "oox/drawingml/fillpropertiesgroupcontext.hxx"
#include "oox/drawingml/transform2dcontext.hxx"
@@ -107,11 +106,8 @@ Reference< XFastContextHandler > ShapePropertiesContext::createFastChildContext(
case NMSP_DRAWINGML|XML_effectDag: // CT_EffectContainer
break;
- case NMSP_DRAWINGML|XML_scene3d: // CT_Scene3D
-// xRet.set( new Scene3DContext( *this, xAttribs, *(mrShape.get3DShapeProperties()) ) );
- break;
-
// todo
+ case NMSP_DRAWINGML|XML_scene3d: // CT_Scene3D
case NMSP_DRAWINGML|XML_sp3d: // CT_Shape3D
break;
}
diff --git a/oox/source/drawingml/textparagraph.cxx b/oox/source/drawingml/textparagraph.cxx
index 91f88d109..fe535f919 100644
--- a/oox/source/drawingml/textparagraph.cxx
+++ b/oox/source/drawingml/textparagraph.cxx
@@ -63,9 +63,6 @@ void TextParagraph::insertAt(
Reference< XTextRange > xStart( xAt, UNO_QUERY );
sal_Int16 nLevel = maProperties.getLevel();
-
- OSL_TRACE("TextParagraph::insertAt() - level %d", nLevel);
-
const TextParagraphPropertiesVector& rListStyle = rTextListStyle.getListStyle();
if ( nLevel >= static_cast< sal_Int16 >( rListStyle.size() ) )
nLevel = 0;
@@ -117,12 +114,6 @@ void TextParagraph::insertAt(
const OUString sNumberingLevel( CREATE_OUSTRING( "NumberingLevel" ) );
xProps->setPropertyValue( sNumberingLevel, Any( static_cast< sal_Int16 >( -1 ) ) );
}
- else if ( nLevel > 1 )
- {
- // Even more UGLY HACK
- const OUString sNumberingLevel( CREATE_OUSTRING( "NumberingLevel" ) );
- xProps->setPropertyValue( sNumberingLevel, Any( static_cast< sal_Int16 >( nLevel-1 ) ) );
- }
// FIXME this is causing a lot of dispruption (ie does not work). I wonder what to do -- Hub
// Reference< XTextRange > xEnd( xAt, UNO_QUERY );
diff --git a/oox/source/drawingml/textparagraphproperties.cxx b/oox/source/drawingml/textparagraphproperties.cxx
index 52679371a..eed5b4a5a 100644
--- a/oox/source/drawingml/textparagraphproperties.cxx
+++ b/oox/source/drawingml/textparagraphproperties.cxx
@@ -114,7 +114,6 @@ void BulletList::setSuffixMinusRight()
void BulletList::setType( sal_Int32 nType )
{
- OSL_ASSERT((nType & sal_Int32(0xFFFF0000))==0);
// OSL_TRACE( "OOX: set list numbering type %d", nType);
switch( nType )
{
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index ed96c7db7..b542174bf 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -40,8 +40,6 @@
#include <com/sun/star/awt/Gradient.hpp>
#include <com/sun/star/beans/XPropertySet.hpp>
#include <com/sun/star/beans/XPropertyState.hpp>
-#include <com/sun/star/beans/Property.hpp>
-#include <com/sun/star/beans/XPropertySetInfo.hpp>
#include <com/sun/star/container/XEnumerationAccess.hpp>
#include <com/sun/star/container/XIndexAccess.hpp>
#include <com/sun/star/drawing/BitmapMode.hpp>
@@ -54,10 +52,7 @@
#include <com/sun/star/drawing/XShape.hpp>
#include <com/sun/star/i18n/ScriptType.hpp>
#include <com/sun/star/io/XOutputStream.hpp>
-#include <com/sun/star/style/LineSpacing.hpp>
-#include <com/sun/star/style/LineSpacingMode.hpp>
#include <com/sun/star/style/ParagraphAdjust.hpp>
-#include <com/sun/star/text/WritingMode.hpp>
#include <com/sun/star/text/XText.hpp>
#include <com/sun/star/text/XTextContent.hpp>
#include <com/sun/star/text/XTextField.hpp>
@@ -76,12 +71,9 @@
#include <editeng/svxenum.hxx>
using namespace ::com::sun::star;
-using namespace ::com::sun::star::beans;
+using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::drawing;
using namespace ::com::sun::star::i18n;
-using namespace ::com::sun::star::text;
-using namespace ::com::sun::star::style;
-using namespace ::com::sun::star::uno;
using ::com::sun::star::beans::PropertyState;
using ::com::sun::star::beans::PropertyValue;
using ::com::sun::star::beans::XPropertySet;
@@ -90,7 +82,6 @@ using ::com::sun::star::container::XEnumeration;
using ::com::sun::star::container::XEnumerationAccess;
using ::com::sun::star::container::XIndexAccess;
using ::com::sun::star::io::XOutputStream;
-using ::com::sun::star::style::LineSpacing;
using ::com::sun::star::text::XText;
using ::com::sun::star::text::XTextContent;
using ::com::sun::star::text::XTextField;
@@ -115,44 +106,6 @@ namespace drawingml {
#define GET(variable, propName) \
if ( GETA(propName) ) \
mAny >>= variable;
-DBG(
-void lcl_dump_pset(Reference< XPropertySet > rXPropSet)
-{
- Reference< XPropertySetInfo > info = rXPropSet->getPropertySetInfo ();
- Sequence< beans::Property > props = info->getProperties ();
-
- for (int i=0; i < props.getLength (); i++) {
- OString name = OUStringToOString( props [i].Name, RTL_TEXTENCODING_UTF8);
- fprintf (stderr,"%30s = ", name.getStr() );
-
- try {
- Any value = rXPropSet->getPropertyValue( props [i].Name );
-
- OUString strValue;
- sal_Int32 intValue;
- bool boolValue;
- LineSpacing spacing;
-// RectanglePoint pointValue;
-
- if( value >>= strValue )
- fprintf (stderr,"\"%s\"\n", USS( strValue ) );
- else if( value >>= intValue )
- fprintf (stderr,"%d (hex: %x)\n", intValue, intValue);
- else if( value >>= boolValue )
- fprintf (stderr,"%d (bool)\n", boolValue);
- else if( value >>= spacing ) {
- fprintf (stderr, "mode: %d value: %d\n", spacing.Mode, spacing.Height);
- }
-// else if( value >>= pointValue )
-// fprintf (stderr,"%d (RectanglePoint)\n", pointValue);
- else
- fprintf (stderr,"??? <unhandled type>\n");
- } catch(Exception e) {
- fprintf (stderr,"unable to get '%s' value\n", USS(props [i].Name));
- }
- }
-}
-);
// not thread safe
int DrawingML::mnImageCounter = 1;
@@ -568,25 +521,13 @@ OUString DrawingML::WriteImage( const Graphic& rGraphic )
return sRelId;
}
-OUString DrawingML::WriteBlip( Reference< XPropertySet > rXPropSet, OUString& rURL )
+OUString DrawingML::WriteBlip( OUString& rURL )
{
OUString sRelId = WriteImage( rURL );
- sal_Int16 nBright = 0;
- sal_Int32 nContrast = 0;
-
- GET( nBright, AdjustLuminance );
- GET( nContrast, AdjustContrast );
-
- mpFS->startElementNS( XML_a, XML_blip,
- FSNS( XML_r, XML_embed), OUStringToOString( sRelId, RTL_TEXTENCODING_UTF8 ).getStr(),
- FSEND );
- if( nBright || nContrast )
- mpFS->singleElementNS( XML_a, XML_lum,
- XML_bright, nBright ? I32S( nBright*1000 ) : NULL,
- XML_contrast, nContrast ? I32S( nContrast*1000 ) : NULL,
- FSEND );
- mpFS->endElementNS( XML_a, XML_blip );
+ mpFS->singleElementNS( XML_a, XML_blip,
+ FSNS( XML_r, XML_embed), OUStringToOString( sRelId, RTL_TEXTENCODING_UTF8 ).getStr(),
+ FSEND );
return sRelId;
}
@@ -626,7 +567,7 @@ void DrawingML::WriteBlipFill( Reference< XPropertySet > rXPropSet, String sURLP
mpFS->startElementNS( nXmlNamespace , XML_blipFill, FSEND );
- WriteBlip( rXPropSet, aURL );
+ WriteBlip( aURL );
if( sURLPropName == S( "FillBitmapURL" ) )
WriteBlipMode( rXPropSet );
@@ -1142,30 +1083,14 @@ const char* DrawingML::GetAlignment( sal_Int32 nAlignment )
return sAlignment;
}
-void DrawingML::WriteLinespacing( LineSpacing& rSpacing )
-{
- if( rSpacing.Mode == LineSpacingMode::PROP )
- mpFS->singleElementNS( XML_a, XML_spcPct,
- XML_val, I32S( ((sal_Int32)rSpacing.Height)*1000 ),
- FSEND );
- else
- mpFS->singleElementNS( XML_a, XML_spcPts,
- XML_val, I32S( rSpacing.Height ),
- FSEND );
-}
-
void DrawingML::WriteParagraphProperties( Reference< XTextContent > rParagraph )
{
Reference< XPropertySet > rXPropSet( rParagraph, UNO_QUERY );
Reference< XPropertyState > rXPropState( rParagraph, UNO_QUERY );
- PropertyState eState;
if( !rXPropSet.is() || !rXPropState.is() )
return;
- //OSL_TRACE("write paragraph properties pset");
- //DBG(lcl_dump_pset(rXPropSet));
-
sal_Int16 nLevel = -1;
GET( nLevel, NumberingLevel );
@@ -1176,27 +1101,15 @@ void DrawingML::WriteParagraphProperties( Reference< XTextContent > rParagraph )
sal_Int16 nAlignment( style::ParagraphAdjust_LEFT );
GET( nAlignment, ParaAdjust );
- sal_Bool bHasLinespacing = sal_False;
- LineSpacing aLineSpacing;
- if( GETAD( ParaLineSpacing ) )
- bHasLinespacing = ( mAny >>= aLineSpacing );
-
if( nLevel != -1
|| nLeftMargin > 0
- || nAlignment != style::ParagraphAdjust_LEFT
- || bHasLinespacing ) {
+ || nAlignment != style::ParagraphAdjust_LEFT ) {
mpFS->startElementNS( XML_a, XML_pPr,
XML_lvl, nLevel > 0 ? I32S( nLevel ) : NULL,
XML_marL, nLeftMargin > 0 ? IS( nLeftMargin ) : NULL,
XML_algn, GetAlignment( nAlignment ),
FSEND );
- if( bHasLinespacing ) {
- mpFS->startElementNS( XML_a, XML_lnSpc, FSEND );
- WriteLinespacing( aLineSpacing );
- mpFS->endElementNS( XML_a, XML_lnSpc );
- }
-
WriteParagraphNumbering( rXPropSet, nLevel );
mpFS->endElementNS( XML_a, XML_pPr );
@@ -1269,24 +1182,11 @@ void DrawingML::WriteText( Reference< XShape > rXShape )
;
}
- const char* sWritingMode = NULL;
- sal_Bool bVertical = sal_False;
- if( GETA( TextWritingMode ) ) {
- WritingMode eMode;
-
- if( ( mAny >>= eMode ) && eMode == WritingMode_TB_RL ) {
- sWritingMode = "vert";
- bVertical = sal_True;
- }
- }
-
TextHorizontalAdjust eHorizontalAlignment( TextHorizontalAdjust_CENTER );
bool bHorizontalCenter = false;
GET( eHorizontalAlignment, TextHorizontalAdjust );
if( eHorizontalAlignment == TextHorizontalAdjust_CENTER )
bHorizontalCenter = true;
- else if( bVertical && eHorizontalAlignment == TextHorizontalAdjust_LEFT )
- sVerticalAlignment = "b";
sal_Bool bHasWrap = FALSE;
sal_Bool bWrap = FALSE;
@@ -1304,7 +1204,6 @@ void DrawingML::WriteText( Reference< XShape > rXShape )
XML_bIns, (nBottom != DEFTBINS) ? IS( MM100toEMU( nBottom ) ) : NULL,
XML_anchor, sVerticalAlignment,
XML_anchorCtr, bHorizontalCenter ? "1" : NULL,
- XML_vert, sWritingMode,
FSEND );
Reference< XEnumerationAccess > access( xXText, UNO_QUERY );
@@ -1342,10 +1241,7 @@ void DrawingML::WritePresetShape( const char* pShape, MSO_SPT eShapeType, sal_Bo
mpFS->startElementNS( XML_a, XML_avLst, FSEND );
Sequence< drawing::EnhancedCustomShapeAdjustmentValue > aAdjustmentSeq;
- if ( ( rProp.Value >>= aAdjustmentSeq )
- && eShapeType != mso_sptActionButtonForwardNext // we have adjustments values for these type of shape, but MSO doesn't like them
- && eShapeType != mso_sptActionButtonBackPrevious // so they are now disabled
- ) {
+ if ( rProp.Value >>= aAdjustmentSeq ) {
DBG(printf("adj seq len: %d\n", int( aAdjustmentSeq.getLength() )));
if ( bPredefinedHandlesUsed )
EscherPropertyContainer::LookForPolarHandles( eShapeType, nAdjustmentsWhichNeedsToBeConverted );
@@ -1461,16 +1357,14 @@ void DrawingML::WritePolyPolygon( const PolyPolygon& rPolyPolygon )
void DrawingML::WriteConnectorConnections( EscherConnectorListEntry& rConnectorEntry, sal_Int32 nStartID, sal_Int32 nEndID )
{
- if( nStartID != -1 )
- mpFS->singleElementNS( XML_a, XML_stCxn,
- XML_id, I32S( nStartID ),
- XML_idx, I64S( rConnectorEntry.GetConnectorRule( TRUE ) ),
- FSEND );
- if( nEndID != -1 )
- mpFS->singleElementNS( XML_a, XML_endCxn,
- XML_id, I32S( nEndID ),
- XML_idx, I64S( rConnectorEntry.GetConnectorRule( FALSE ) ),
- FSEND );
+ mpFS->singleElementNS( XML_a, XML_stCxn,
+ XML_id, I32S( nStartID ),
+ XML_idx, I64S( rConnectorEntry.GetConnectorRule( TRUE ) ),
+ FSEND );
+ mpFS->singleElementNS( XML_a, XML_endCxn,
+ XML_id, I32S( nEndID ),
+ XML_idx, I64S( rConnectorEntry.GetConnectorRule( FALSE ) ),
+ FSEND );
}
// from sw/source/filter/ww8/wrtw8num.cxx for default bullets to export to MS intact
diff --git a/oox/source/export/shapes.cxx b/oox/source/export/shapes.cxx
index 5ef37d697..27a2c53e7 100644
--- a/oox/source/export/shapes.cxx
+++ b/oox/source/export/shapes.cxx
@@ -359,15 +359,14 @@ namespace oox { namespace drawingml {
if ( GETA(propName) ) \
mAny >>= variable;
-ShapeExport::ShapeExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, ShapeHashMap* pShapeMap, XmlFilterBase* pFB, DocumentType eDocumentType )
+ShapeExport::ShapeExport( sal_Int32 nXmlNamespace, FSHelperPtr pFS, ::oox::core::XmlFilterBase* pFB, DocumentType eDocumentType )
: DrawingML( pFS, pFB, eDocumentType )
+ , mnXmlNamespace( nXmlNamespace )
, mnShapeIdMax( 1 )
, mnPictureIdMax( 1 )
- , mnXmlNamespace( nXmlNamespace )
, maFraction( 1, 576 )
, maMapModeSrc( MAP_100TH_MM )
, maMapModeDest( MAP_INCH, Point(), maFraction, maFraction )
- , mpShapeMap( pShapeMap ? pShapeMap : &maShapeMap )
{
}
@@ -650,7 +649,7 @@ ShapeExport& ShapeExport::WriteGraphicObjectShape( Reference< XShape > xShape )
pFS->startElementNS( mnXmlNamespace, XML_blipFill, FSEND );
- WriteBlip( xShapeProps, sGraphicURL );
+ WriteBlip( sGraphicURL );
bool bStretch = false;
if( ( xShapeProps->getPropertyValue( S( "FillBitmapStretch" ) ) >>= bStretch ) && bStretch )
@@ -978,34 +977,18 @@ size_t ShapeExport::ShapeHash::operator()( const ::com::sun::star::uno::Referenc
sal_Int32 ShapeExport::GetNewShapeID( const Reference< XShape > rXShape )
{
- return GetNewShapeID( rXShape, GetFB() );
-}
-
-sal_Int32 ShapeExport::GetNewShapeID( const Reference< XShape > rXShape, XmlFilterBase* pFB )
-{
- if( !rXShape.is() )
- return -1;
+ sal_Int32 nID = GetFB()->GetUniqueId();
- sal_Int32 nID = pFB->GetUniqueId();
-
- (*mpShapeMap)[ rXShape ] = nID;
+ maShapeMap[ rXShape ] = nID;
return nID;
}
sal_Int32 ShapeExport::GetShapeID( const Reference< XShape > rXShape )
{
- return GetShapeID( rXShape, mpShapeMap );
-}
-
-sal_Int32 ShapeExport::GetShapeID( const Reference< XShape > rXShape, ShapeHashMap* pShapeMap )
-{
- if( !rXShape.is() )
- return -1;
-
- ShapeHashMap::const_iterator aIter = pShapeMap->find( rXShape );
+ ShapeHashMap::const_iterator aIter = maShapeMap.find( rXShape );
- if( aIter == pShapeMap->end() )
+ if( aIter == maShapeMap.end() )
return -1;
return aIter->second;
diff --git a/oox/source/helper/storagebase.cxx b/oox/source/helper/storagebase.cxx
index 507a2e636..bab9b93ff 100644
--- a/oox/source/helper/storagebase.cxx
+++ b/oox/source/helper/storagebase.cxx
@@ -50,25 +50,17 @@ namespace oox {
namespace {
-void lclSplitFirstElement( OUString& orElement, OUString& orRemainder, OUString aFullName )
+void lclSplitFirstElement( OUString& orElement, OUString& orRemainder, const OUString& rFullName )
{
- sal_Int32 nSlashPos = aFullName.indexOf( '/' );
-
- // strip leading slashes
- while( nSlashPos == 0 )
- {
- aFullName = aFullName.copy(1);
- nSlashPos = aFullName.indexOf( '/' );
- }
-
- if( (0 <= nSlashPos) && (nSlashPos < aFullName.getLength()) )
+ sal_Int32 nSlashPos = rFullName.indexOf( '/' );
+ if( (0 <= nSlashPos) && (nSlashPos < rFullName.getLength()) )
{
- orElement = aFullName.copy( 0, nSlashPos );
- orRemainder = aFullName.copy( nSlashPos + 1 );
+ orElement = rFullName.copy( 0, nSlashPos );
+ orRemainder = rFullName.copy( nSlashPos + 1 );
}
else
{
- orElement = aFullName;
+ orElement = rFullName;
}
}
diff --git a/oox/source/ppt/dgmimport.cxx b/oox/source/ppt/dgmimport.cxx
deleted file mode 100644
index 2053f91ec..000000000
--- a/oox/source/ppt/dgmimport.cxx
+++ /dev/null
@@ -1,135 +0,0 @@
-/*************************************************************************
- *
- * 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
deleted file mode 100644
index 08854cd32..000000000
--- a/oox/source/ppt/dgmlayout.cxx
+++ /dev/null
@@ -1,193 +0,0 @@
-/*************************************************************************
- *
- * 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();
-}
-
-}}
diff --git a/oox/source/ppt/makefile.mk b/oox/source/ppt/makefile.mk
index 46cfd4ffd..7ee7e0c46 100644
--- a/oox/source/ppt/makefile.mk
+++ b/oox/source/ppt/makefile.mk
@@ -50,8 +50,6 @@ SLOFILES = \
$(SLO)$/commontimenodecontext.obj \
$(SLO)$/conditioncontext.obj \
$(SLO)$/customshowlistcontext.obj \
- $(SLO)$/dgmimport.obj\
- $(SLO)$/dgmlayout.obj\
$(SLO)$/headerfootercontext.obj \
$(SLO)$/layoutfragmenthandler.obj\
$(SLO)$/pptfilterhelpers.obj\
diff --git a/oox/source/ppt/pptimport.cxx b/oox/source/ppt/pptimport.cxx
index 0e127201a..1a09667b9 100644
--- a/oox/source/ppt/pptimport.cxx
+++ b/oox/source/ppt/pptimport.cxx
@@ -38,9 +38,6 @@ using namespace ::com::sun::star::uno;
using namespace ::com::sun::star::xml::sax;
using namespace oox::core;
-using ::com::sun::star::beans::PropertyValue;
-using ::com::sun::star::lang::XComponent;
-
namespace oox { namespace ppt {
OUString SAL_CALL PowerPointImport_getImplementationName() throw()
@@ -134,29 +131,6 @@ const ::oox::drawingml::Theme* PowerPointImport::getCurrentTheme() const
return mpActualSlidePersist ? mpActualSlidePersist->getTheme().get() : 0;
}
-sal_Bool SAL_CALL PowerPointImport::filter( const Sequence< PropertyValue >& rDescriptor ) throw( RuntimeException )
-{
- if( XmlFilterBase::filter( rDescriptor ) )
- return true;
-
- if( isExportFilter() ) {
- Reference< XExporter > xExporter( getGlobalFactory()->createInstance( CREATE_OUSTRING( "com.sun.star.comp.Impress.oox.PowerPointExport" ) ), UNO_QUERY );
-
- if( xExporter.is() ) {
- Reference< XComponent > xDocument( getModel(), UNO_QUERY );
- Reference< XFilter > xFilter( xExporter, UNO_QUERY );
-
- if( xFilter.is() ) {
- xExporter->setSourceDocument( xDocument );
- if( xFilter->filter( rDescriptor ) )
- return true;
- }
- }
- }
-
- return false;
-}
-
::oox::vml::Drawing* PowerPointImport::getVmlDrawing()
{
return mpActualSlidePersist ? mpActualSlidePersist->getDrawing() : 0;
@@ -173,9 +147,9 @@ const oox::drawingml::table::TableStyleListPtr PowerPointImport::getTableStyles(
return mpTableStyleList;;
}
-::oox::drawingml::chart::ChartConverter* PowerPointImport::getChartConverter()
+::oox::drawingml::chart::ChartConverter& PowerPointImport::getChartConverter()
{
- return mxChartConv.get();
+ return *mxChartConv;
}
namespace {
diff --git a/oox/source/ppt/presentationfragmenthandler.cxx b/oox/source/ppt/presentationfragmenthandler.cxx
index 5368a6ca2..302e811e1 100644
--- a/oox/source/ppt/presentationfragmenthandler.cxx
+++ b/oox/source/ppt/presentationfragmenthandler.cxx
@@ -33,8 +33,6 @@
#include <com/sun/star/drawing/XDrawPages.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.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/style/XStyleFamiliesSupplier.hpp>
#include <com/sun/star/style/XStyle.hpp>
#include <com/sun/star/presentation/XPresentationPage.hpp>
@@ -233,17 +231,8 @@ void PresentationFragmentHandler::endDocument() throw (SAXException, RuntimeExce
{
oox::drawingml::ThemePtr pThemePtr( new oox::drawingml::Theme() );
pMasterPersistPtr->setTheme( pThemePtr );
- Reference<xml::dom::XDocument> xDoc=
- rFilter.importFragment(aThemeFragmentPath);
-
- rFilter.importFragment(
- new ThemeFragmentHandler(
- rFilter, aThemeFragmentPath, *pThemePtr ),
- Reference<xml::sax::XFastSAXSerializable>(
- xDoc,
- UNO_QUERY_THROW));
+ rFilter.importFragment( new ThemeFragmentHandler( rFilter, aThemeFragmentPath, *pThemePtr ) );
rThemes[ aThemeFragmentPath ] = pThemePtr;
- pThemePtr->setFragment(xDoc);
}
else
{
diff --git a/oox/source/ppt/slidepersist.cxx b/oox/source/ppt/slidepersist.cxx
index ba34f8180..8c582953d 100644
--- a/oox/source/ppt/slidepersist.cxx
+++ b/oox/source/ppt/slidepersist.cxx
@@ -166,17 +166,6 @@ void SlidePersist::createXShapes( const XmlFilterBase& rFilterBase )
pNode->setNode( rFilterBase, xNode, pSlidePtr );
}
}
-
- // not yet
-#if 0
- if( getTheme() )
- {
- uno::Reference< beans::XPropertySet > xPagePropSet( mxPage, uno::UNO_QUERY_THROW );
- xPagePropSet->setPropertyValue(
- rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PPTTheme" )),
- uno::makeAny(getTheme()->getFragment()));
- }
-#endif
}
void SlidePersist::createBackground( const XmlFilterBase& rFilterBase )
diff --git a/oox/source/shape/ShapeFilterBase.cxx b/oox/source/shape/ShapeFilterBase.cxx
index 4890e9a81..66961e6a7 100644
--- a/oox/source/shape/ShapeFilterBase.cxx
+++ b/oox/source/shape/ShapeFilterBase.cxx
@@ -61,9 +61,9 @@ const ::oox::drawingml::table::TableStyleListPtr ShapeFilterBase::getTableStyles
return ::oox::drawingml::table::TableStyleListPtr();
}
-::oox::drawingml::chart::ChartConverter* ShapeFilterBase::getChartConverter()
+::oox::drawingml::chart::ChartConverter& ShapeFilterBase::getChartConverter()
{
- return mxChartConv.get();
+ return *mxChartConv;
}
::rtl::OUString ShapeFilterBase::implGetImplementationName() const
diff --git a/oox/source/shape/ShapeFilterBase.hxx b/oox/source/shape/ShapeFilterBase.hxx
index d247254d2..1e00eb6b5 100644
--- a/oox/source/shape/ShapeFilterBase.hxx
+++ b/oox/source/shape/ShapeFilterBase.hxx
@@ -58,7 +58,7 @@ public:
/** Has to be implemented by each filter to return TableStyles. */
virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles();
- virtual ::oox::drawingml::chart::ChartConverter* getChartConverter();
+ virtual ::oox::drawingml::chart::ChartConverter& getChartConverter();
virtual rtl::OUString implGetImplementationName() const;
diff --git a/oox/source/xls/excelfilter.cxx b/oox/source/xls/excelfilter.cxx
index e6e1a753f..b5b3dc648 100644
--- a/oox/source/xls/excelfilter.cxx
+++ b/oox/source/xls/excelfilter.cxx
@@ -152,7 +152,7 @@ const TableStyleListPtr ExcelFilter::getTableStyles()
return TableStyleListPtr();
}
-::oox::drawingml::chart::ChartConverter* ExcelFilter::getChartConverter()
+::oox::drawingml::chart::ChartConverter& ExcelFilter::getChartConverter()
{
return WorkbookHelper( getWorkbookData() ).getChartConverter();
}
diff --git a/oox/source/xls/workbookhelper.cxx b/oox/source/xls/workbookhelper.cxx
index 983c9c553..bbf46c9e9 100644
--- a/oox/source/xls/workbookhelper.cxx
+++ b/oox/source/xls/workbookhelper.cxx
@@ -203,7 +203,7 @@ public:
/** Returns the converter for string to cell address/range conversion. */
inline AddressConverter& getAddressConverter() const { return *mxAddrConverter; }
/** Returns the chart object converter. */
- inline ExcelChartConverter* getChartConverter() const { return mxChartConverter.get(); }
+ inline ExcelChartConverter& getChartConverter() const { return *mxChartConverter; }
/** Returns the page/print settings converter. */
inline PageSettingsConverter& getPageSettingsConverter() const { return *mxPageSettConverter; }
@@ -894,7 +894,7 @@ AddressConverter& WorkbookHelper::getAddressConverter() const
return mrBookData.getAddressConverter();
}
-ExcelChartConverter* WorkbookHelper::getChartConverter() const
+ExcelChartConverter& WorkbookHelper::getChartConverter() const
{
return mrBookData.getChartConverter();
}