update ooo310-m15
[ooovba.git] / applied_patches / 0861-oox-smartart-import.diff
blobb52b60e9ba5159784f91e4a15d8eec06055f8edd
1 Improving smartart import in oox
3 From: Thorsten Behrens <thb@openoffice.org>
6 ---
8 oox/inc/oox/core/filterbase.hxx | 5
9 oox/inc/oox/core/xmlfilterbase.hxx | 45 +
10 oox/inc/oox/drawingml/chart/converterbase.hxx | 2
11 oox/inc/oox/drawingml/customshapeproperties.hxx | 5
12 oox/inc/oox/drawingml/diagram/datamodelcontext.hxx | 57 --
13 oox/inc/oox/drawingml/diagram/diagram.hxx | 242 +------
14 .../drawingml/diagram/diagramfragmenthandler.hxx | 103 ---
15 .../oox/drawingml/diagram/diagramlayoutatoms.hxx | 212 ------
16 oox/inc/oox/drawingml/drawingmltypes.hxx | 3
17 oox/inc/oox/drawingml/graphicshapecontext.hxx | 5
18 oox/inc/oox/drawingml/scene3dcontext.hxx | 56 ++
19 oox/inc/oox/drawingml/shape.hxx | 29 +
20 oox/inc/oox/drawingml/shape3dproperties.hxx | 134 ++++
21 oox/inc/oox/drawingml/theme.hxx | 8
22 oox/inc/oox/ppt/dgmimport.hxx | 68 ++
23 oox/inc/oox/ppt/dgmlayout.hxx | 69 ++
24 oox/inc/oox/ppt/pptimport.hxx | 2
25 oox/inc/oox/xls/excelfilter.hxx | 2
26 oox/inc/oox/xls/workbookhelper.hxx | 2
27 oox/source/core/facreg.cxx | 6
28 oox/source/core/filterbase.cxx | 17
29 oox/source/core/xmlfilterbase.cxx | 163 ++++-
30 oox/source/drawingml/chart/chartspaceconverter.cxx | 5
31 oox/source/drawingml/chart/converterbase.cxx | 4
32 oox/source/drawingml/chart/datasourceconverter.cxx | 12
33 oox/source/drawingml/clrscheme.cxx | 2
34 oox/source/drawingml/color.cxx | 4
35 oox/source/drawingml/customshapegeometry.cxx | 6
36 .../drawingml/diagram/constraintlistcontext.cxx | 102 +++
37 .../drawingml/diagram/constraintlistcontext.hxx | 54 ++
38 oox/source/drawingml/diagram/datamodelcontext.cxx | 234 +++++--
39 oox/source/drawingml/diagram/datamodelcontext.hxx | 57 ++
40 oox/source/drawingml/diagram/diagram.cxx | 506 ++++++++++++--
41 oox/source/drawingml/diagram/diagram.hxx | 320 +++++++++
42 .../drawingml/diagram/diagramdefinitioncontext.cxx | 15
43 .../drawingml/diagram/diagramdefinitioncontext.hxx | 2
44 .../drawingml/diagram/diagramfragmenthandler.cxx | 193 +++--
45 .../drawingml/diagram/diagramfragmenthandler.hxx | 117 +++
46 .../drawingml/diagram/diagramlayoutatoms.cxx | 705 +++++++++++++++++++-
47 .../drawingml/diagram/diagramlayoutatoms.hxx | 318 +++++++++
48 oox/source/drawingml/diagram/layoutnodecontext.cxx | 146 +++-
49 oox/source/drawingml/diagram/layoutnodecontext.hxx | 3
50 oox/source/drawingml/diagram/makefile.mk | 1
51 oox/source/drawingml/drawingmltypes.cxx | 4
52 oox/source/drawingml/fillproperties.cxx | 3
53 oox/source/drawingml/graphicshapecontext.cxx | 59 --
54 oox/source/drawingml/lineproperties.cxx | 6
55 oox/source/drawingml/makefile.mk | 1
56 oox/source/drawingml/scene3dcontext.cxx | 189 +++++
57 oox/source/drawingml/shape.cxx | 39 +
58 oox/source/drawingml/shape3dproperties.cxx | 70 ++
59 oox/source/drawingml/shapepropertiescontext.cxx | 6
60 oox/source/drawingml/textparagraph.cxx | 9
61 oox/source/drawingml/textparagraphproperties.cxx | 1
62 oox/source/helper/storagebase.cxx | 20 -
63 oox/source/ppt/dgmimport.cxx | 124 ++++
64 oox/source/ppt/dgmlayout.cxx | 183 +++++
65 oox/source/ppt/makefile.mk | 2
66 oox/source/ppt/pptimport.cxx | 4
67 oox/source/ppt/presentationfragmenthandler.cxx | 13
68 oox/source/ppt/slidepersist.cxx | 11
69 oox/source/shape/ShapeFilterBase.cxx | 4
70 oox/source/shape/ShapeFilterBase.hxx | 2
71 oox/source/token/makefile.mk | 15
72 oox/source/xls/excelfilter.cxx | 2
73 oox/source/xls/workbookhelper.cxx | 4
74 sc/source/filter/excel/xestream.cxx | 5
75 sc/source/filter/inc/xestream.hxx | 2
76 sc/source/filter/xlsx/xestream.hxx | 2
77 sc/source/filter/xlsx/xlsx-xestream.cxx | 6
78 sd/source/filter/pptx/epptooxml.hxx | 2
79 sd/source/filter/pptx/pptx-epptooxml.cxx | 4
80 sw/source/filter/docx/docxexportfilter.hxx | 2
81 73 files changed, 3797 insertions(+), 1038 deletions(-)
82 delete mode 100644 oox/inc/oox/drawingml/diagram/datamodelcontext.hxx
83 delete mode 100644 oox/inc/oox/drawingml/diagram/diagramfragmenthandler.hxx
84 delete mode 100644 oox/inc/oox/drawingml/diagram/diagramlayoutatoms.hxx
85 create mode 100644 oox/inc/oox/drawingml/scene3dcontext.hxx
86 create mode 100644 oox/inc/oox/drawingml/shape3dproperties.hxx
87 create mode 100644 oox/inc/oox/ppt/dgmimport.hxx
88 create mode 100644 oox/inc/oox/ppt/dgmlayout.hxx
89 create mode 100644 oox/source/drawingml/diagram/constraintlistcontext.cxx
90 create mode 100644 oox/source/drawingml/diagram/constraintlistcontext.hxx
91 create mode 100644 oox/source/drawingml/diagram/datamodelcontext.hxx
92 create mode 100644 oox/source/drawingml/diagram/diagram.hxx
93 create mode 100644 oox/source/drawingml/diagram/diagramfragmenthandler.hxx
94 create mode 100644 oox/source/drawingml/diagram/diagramlayoutatoms.hxx
95 create mode 100644 oox/source/drawingml/scene3dcontext.cxx
96 create mode 100644 oox/source/drawingml/shape3dproperties.cxx
97 create mode 100644 oox/source/ppt/dgmimport.cxx
98 create mode 100644 oox/source/ppt/dgmlayout.cxx
101 diff --git oox/inc/oox/core/filterbase.hxx oox/inc/oox/core/filterbase.hxx
102 index 445123f..d9ac5ed 100644
103 --- oox/inc/oox/core/filterbase.hxx
104 +++ oox/inc/oox/core/filterbase.hxx
105 @@ -50,6 +50,7 @@ namespace com { namespace sun { namespace star {
106 namespace frame { class XModel; }
107 namespace task { class XStatusIndicator; }
108 namespace task { class XInteractionHandler; }
109 + namespace drawing { class XShape; }
110 namespace io { class XInputStream; }
111 namespace io { class XOutputStream; }
112 namespace io { class XStream; }
113 @@ -100,6 +101,10 @@ public:
114 const ::com::sun::star::uno::Reference< ::com::sun::star::frame::XModel >&
115 getModel() const;
117 + /// Returns the parent shape to load into (if any)
118 + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >&
119 + getParentShape() const;
121 /** Returns the status indicator. */
122 const ::com::sun::star::uno::Reference< ::com::sun::star::task::XStatusIndicator >&
123 getStatusIndicator() const;
124 diff --git oox/inc/oox/core/xmlfilterbase.hxx oox/inc/oox/core/xmlfilterbase.hxx
125 index 1f4edc3..4e37354 100644
126 --- oox/inc/oox/core/xmlfilterbase.hxx
127 +++ oox/inc/oox/core/xmlfilterbase.hxx
128 @@ -43,8 +43,10 @@
129 namespace com { namespace sun { namespace star {
130 namespace container { class XNameContainer; }
131 namespace document { class XDocumentProperties; }
132 + namespace xml { namespace dom { class XDocument; } }
133 namespace xml { namespace sax { class XLocator; } }
134 namespace xml { namespace sax { class XFastDocumentHandler; } }
135 + namespace xml { namespace sax { class XFastSAXSerializable; } }
136 } } }
138 namespace oox { namespace drawingml { class Theme; } }
139 @@ -81,17 +83,19 @@ public:
140 /** Has to be implemented by each filter to resolve scheme colors. */
141 virtual sal_Int32 getSchemeClr( sal_Int32 nColorSchemeToken ) const = 0;
143 - /** Has to be implemented by each filter to return drawings collection. */
144 + /** Has to be implemented by each filter to return the table style list. */
145 + virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles() = 0;
147 + // ------------------------------------------------------------------------
149 + /** Override to return drawings collection. */
150 virtual const ::oox::vml::DrawingPtr
151 - getDrawings() = 0;
152 + getDrawings();
154 - /** Has to be implemented by each filter, returns a filter-specific chart
155 + /** Override to return a filter-specific chart
156 converter object, that should be global per imported document. */
157 - virtual ::oox::drawingml::chart::ChartConverter&
158 - getChartConverter() = 0;
160 - /** Has to be implemented by each filter to return the table style list. */
161 - virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles() = 0;
162 + virtual ::oox::drawingml::chart::ChartConverter*
163 + getChartConverter();
165 // ------------------------------------------------------------------------
167 @@ -106,6 +110,31 @@ public:
169 bool importFragment( const ::rtl::Reference< FragmentHandler >& rxHandler );
171 + /** Imports a fragment into an xml::dom::XDocument.
173 + @param rFragmentPath path to fragment
175 + @return a non-empty reference to the XDocument, if the
176 + fragment could be imported.
177 + */
178 + ::com::sun::star::uno::Reference<
179 + ::com::sun::star::xml::dom::XDocument> importFragment( const ::rtl::OUString& rFragmentPath );
181 + /** Imports a fragment from an xml::dom::XDocument using the
182 + passed fragment handler
184 + @param rxHandler fragment handler; path to fragment is
185 + ignored, input source is the rxSerializer
187 + @param rxSerializer usually retrieved from a
188 + xml::dom::XDocument, will get serialized into rxHandler
190 + @return true, if the fragment could be imported.
191 + */
192 + bool importFragment( const ::rtl::Reference< FragmentHandler >& rxHandler,
193 + const ::com::sun::star::uno::Reference<
194 + ::com::sun::star::xml::sax::XFastSAXSerializable >& rxSerializer );
196 /** Imports the relations fragment associated with the specified fragment.
198 @return The relations collection of the specified fragment.
199 diff --git oox/inc/oox/drawingml/chart/converterbase.hxx oox/inc/oox/drawingml/chart/converterbase.hxx
200 index f456d95..35fa990 100644
201 --- oox/inc/oox/drawingml/chart/converterbase.hxx
202 +++ oox/inc/oox/drawingml/chart/converterbase.hxx
203 @@ -79,7 +79,7 @@ protected:
204 /** Returns the filter object of the imported/exported document. */
205 ::oox::core::XmlFilterBase& getFilter() const;
206 /** Returns the chart converter. */
207 - ChartConverter& getChartConverter() const;
208 + ChartConverter* getChartConverter() const;
209 /** Returns the API chart document model. */
210 ::com::sun::star::uno::Reference< ::com::sun::star::chart2::XChartDocument >
211 getChartDocument() const;
212 diff --git oox/inc/oox/drawingml/customshapeproperties.hxx oox/inc/oox/drawingml/customshapeproperties.hxx
213 index 53554d7..cb794cb 100644
214 --- oox/inc/oox/drawingml/customshapeproperties.hxx
215 +++ oox/inc/oox/drawingml/customshapeproperties.hxx
216 @@ -77,8 +77,9 @@ public:
217 const ::com::sun::star::uno::Reference < ::com::sun::star::beans::XPropertySet > & xPropSet,
218 const ::com::sun::star::uno::Reference < ::com::sun::star::drawing::XShape > & xShape) const;
220 - void setShapePresetType( const rtl::OUString& rShapePresetType ){ maShapePresetType = rShapePresetType; };
221 - std::vector< CustomShapeGuide >& getAdjustmentValues(){ return maAdjustmentValues; };
222 + void setShapePresetType( const rtl::OUString& rShapePresetType ){ maShapePresetType = rShapePresetType; }
223 + const rtl::OUString& getShapePresetType() const { return maShapePresetType; }
224 + std::vector< CustomShapeGuide >& getAdjustmentValues(){ return maAdjustmentValues; }
226 double getValue( const std::vector< CustomShapeGuide >&, sal_uInt32 nIndex ) const;
227 ::basegfx::B2DPolyPolygon& getPolygon() { return maPolygon; }
228 diff --git oox/inc/oox/drawingml/diagram/datamodelcontext.hxx oox/inc/oox/drawingml/diagram/datamodelcontext.hxx
229 deleted file mode 100644
230 index 9cbeb96..0000000
231 --- oox/inc/oox/drawingml/diagram/datamodelcontext.hxx
232 +++ /dev/null
233 @@ -1,57 +0,0 @@
234 -/*************************************************************************
236 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
237 - *
238 - * Copyright 2008 by Sun Microsystems, Inc.
240 - * OpenOffice.org - a multi-platform office productivity suite
242 - * $RCSfile: datamodelcontext.hxx,v $
243 - * $Revision: 1.4 $
245 - * This file is part of OpenOffice.org.
247 - * OpenOffice.org is free software: you can redistribute it and/or modify
248 - * it under the terms of the GNU Lesser General Public License version 3
249 - * only, as published by the Free Software Foundation.
251 - * OpenOffice.org is distributed in the hope that it will be useful,
252 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
253 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
254 - * GNU Lesser General Public License version 3 for more details
255 - * (a copy is included in the LICENSE file that accompanied this code).
257 - * You should have received a copy of the GNU Lesser General Public License
258 - * version 3 along with OpenOffice.org. If not, see
259 - * <http://www.openoffice.org/license.html>
260 - * for a copy of the LGPLv3 License.
262 - ************************************************************************/
265 -#ifndef OOX_DRAWINGML_SHAPECONTEXT_HXX
266 -#define OOX_DRAWINGML_SHAPECONTEXT_HXX
268 -#include <com/sun/star/drawing/XShapes.hpp>
270 -#include "oox/core/contexthandler.hxx"
271 -#include "oox/drawingml/diagram/diagram.hxx"
273 -namespace oox { namespace drawingml {
275 -// CT_DataModel
276 -class DataModelContext : public ::oox::core::ContextHandler
278 -public:
279 - DataModelContext( ::oox::core::ContextHandler& rParent, const DiagramDataPtr & pDataModelPtr );
280 - virtual ~DataModelContext();
282 - 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);
284 -protected:
285 - DiagramDataPtr mpDataModel;
288 -} }
290 -#endif // OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX
291 diff --git oox/inc/oox/drawingml/diagram/diagram.hxx oox/inc/oox/drawingml/diagram/diagram.hxx
292 index b1c2ddd..732959b 100644
293 --- oox/inc/oox/drawingml/diagram/diagram.hxx
294 +++ oox/inc/oox/drawingml/diagram/diagram.hxx
295 @@ -28,232 +28,40 @@
297 ************************************************************************/
301 #ifndef OOX_DRAWINGML_DIAGRAM_HXX
302 #define OOX_DRAWINGML_DIAGRAM_HXX
304 -#include <vector>
305 -#include <boost/shared_ptr.hpp>
306 -#include <boost/enable_shared_from_this.hpp>
307 +#include <rtl/ustring.hxx>
308 #include "oox/drawingml/shape.hxx"
309 -#include "oox/drawingml/diagram/diagramlayoutatoms.hxx"
311 -namespace oox { namespace drawingml {
313 -namespace dgm {
314 +#include "oox/core/xmlfilterbase.hxx"
316 -/** A Connection
317 - */
318 -class Connection
320 -public:
321 - Connection()
322 - : mnType( 0 )
323 - , mnSourceOrder( 0 )
324 - , mnDestOrder( 0 )
327 +#include <com/sun/star/xml/dom/XDocument.hpp>
329 - void dump();
331 - sal_Int32 mnType;
332 - ::rtl::OUString msModelId;
333 - ::rtl::OUString msSourceId;
334 - ::rtl::OUString msDestId;
335 - ::rtl::OUString msParTransId;
336 - ::rtl::OUString msPresId;
337 - ::rtl::OUString msSibTransId;
338 - sal_Int32 mnSourceOrder;
339 - sal_Int32 mnDestOrder;
343 -typedef boost::shared_ptr< Connection > ConnectionPtr;
344 -typedef std::vector< ConnectionPtr > Connections;
345 +namespace oox { namespace drawingml {
347 -class Point;
348 +/** load diagram data, and put resulting graphic into shape
350 -typedef boost::shared_ptr< Point > PointPtr;
351 -typedef std::vector< PointPtr > Points;
352 -/** A point
353 + This method loads the diagram data fragments from the given paths,
354 + generate and layout the shapes, and push it as children into the
355 + referenced shape.
357 -class Point
359 -public:
360 - Point();
361 - ShapePtr & getShape( )
362 - { return mpShape; }
364 - void setCnxId( const ::rtl::OUString & sCnxId )
365 - { msCnxId = sCnxId; }
366 - void setModelId( const ::rtl::OUString & sModelId );
367 - const ::rtl::OUString & getModelId() const
368 - { return msModelId; }
369 - void setType( const sal_Int32 nType )
370 - { mnType = nType; }
371 - sal_Int32 getType() const
372 - { return mnType; }
374 - void dump();
375 -private:
376 - ShapePtr mpShape;
377 - ::rtl::OUString msCnxId;
378 - ::rtl::OUString msModelId;
379 - sal_Int32 mnType;
383 -class PointsTree;
384 -typedef boost::shared_ptr< PointsTree > PointsTreePtr;
386 -/** a points tree node */
387 -class PointsTree
388 - : public boost::enable_shared_from_this< PointsTree >
390 -public:
391 - typedef std::vector< PointsTreePtr > Childrens;
392 - PointsTree()
393 - {};
394 - PointsTree( const PointPtr & pPoint )
395 - : mpNode( pPoint )
396 - { }
397 - bool addChild( const PointsTreePtr & pChild );
398 - const PointPtr & getPoint() const
399 - { return mpNode; }
400 - PointsTreePtr getParent() const;
401 - Childrens::const_iterator beginChild() const
402 - { return maChildrens.begin(); }
403 - Childrens::const_iterator endChild() const
404 - { return maChildrens.end(); }
405 -private:
406 - PointPtr mpNode;
407 - boost::weak_ptr< PointsTree > mpParent;
408 - Childrens maChildrens;
413 -////////////////////
415 -class DiagramData
417 -public:
419 - DiagramData();
420 - FillPropertiesPtr & getFillProperties()
421 - { return mpFillProperties; }
422 - dgm::Connections & getConnections()
423 - { return maConnections; }
424 - dgm::Points & getPoints()
425 - { return maPoints; }
426 - void dump();
427 -private:
428 - FillPropertiesPtr mpFillProperties;
429 - dgm::Connections maConnections;
430 - dgm::Points maPoints;
433 -typedef boost::shared_ptr< DiagramData > DiagramDataPtr;
437 -////////////////////
439 -class DiagramLayout
441 -public:
442 - void setDefStyle( const ::rtl::OUString & sDefStyle )
443 - { msDefStyle = sDefStyle; }
444 - void setMinVer( const ::rtl::OUString & sMinVer )
445 - { msMinVer = sMinVer; }
446 - void setUniqueId( const ::rtl::OUString & sUniqueId )
447 - { msUniqueId = sUniqueId; }
448 - const ::rtl::OUString & getUniqueId()
449 - { return msUniqueId; }
450 - void setTitle( const ::rtl::OUString & sTitle )
451 - { msTitle = sTitle; }
452 - void setDesc( const ::rtl::OUString & sDesc )
453 - { msDesc = sDesc; }
455 - LayoutNodePtr & getNode()
456 - { return mpNode; }
457 - const LayoutNodePtr & getNode() const
458 - { return mpNode; }
459 - DiagramDataPtr & getSampData()
460 - { return mpSampData; }
461 - const DiagramDataPtr & getSampData() const
462 - { return mpSampData; }
463 - DiagramDataPtr & getStyleData()
464 - { return mpStyleData; }
465 - const DiagramDataPtr & getStyleData() const
466 - { return mpStyleData; }
468 - void layout( const dgm::PointsTreePtr & pTree, const com::sun::star::awt::Point & pt );
469 -private:
470 - ::rtl::OUString msDefStyle;
471 - ::rtl::OUString msMinVer;
472 - ::rtl::OUString msUniqueId;
474 - ::rtl::OUString msTitle;
475 - ::rtl::OUString msDesc;
476 - LayoutNodePtr mpNode;
477 - DiagramDataPtr mpSampData;
478 - DiagramDataPtr mpStyleData;
479 - // TODO
480 - // catLst
481 - // clrData
484 -typedef boost::shared_ptr< DiagramLayout > DiagramLayoutPtr;
486 -///////////////////////
488 -class DiagramQStyles
493 -typedef boost::shared_ptr< DiagramQStyles > DiagramQStylesPtr;
495 -///////////////////////
497 -class DiagramColors
502 -typedef boost::shared_ptr< DiagramColors > DiagramColorsPtr;
504 -///////////////////////
506 -class Diagram
508 -public:
509 - void setData( const DiagramDataPtr & );
510 - void setLayout( const DiagramLayoutPtr & );
511 - DiagramLayoutPtr getLayout() const
513 - return mpLayout;
515 - void setQStyles( const DiagramQStylesPtr & );
516 - void setColors( const DiagramColorsPtr & );
518 - void addTo( const ShapePtr & pShape );
519 - ::rtl::OUString getLayoutId() const;
520 -private:
521 - void build( );
522 - DiagramDataPtr mpData;
523 - DiagramLayoutPtr mpLayout;
524 - DiagramQStylesPtr mpQStyles;
525 - DiagramColorsPtr mpColors;
526 - std::map< ::rtl::OUString, ShapePtr > maShapeMap;
527 - dgm::PointsTreePtr mpRoot;
531 -typedef boost::shared_ptr< Diagram > DiagramPtr;
533 +void loadDiagram( const ShapePtr& pShape,
534 + core::XmlFilterBase& rFilter,
535 + const ::rtl::OUString& rDataModelPath,
536 + const ::rtl::OUString& rLayoutPath,
537 + const ::rtl::OUString& rQStylePath,
538 + const ::rtl::OUString& rColorStylePath );
540 +void loadDiagram( const ShapePtr& pShape,
541 + core::XmlFilterBase& rFilter,
542 + const ::com::sun::star::uno::Reference<
543 + ::com::sun::star::xml::dom::XDocument>& rXDataModelDom,
544 + const ::com::sun::star::uno::Reference<
545 + ::com::sun::star::xml::dom::XDocument>& rXLayoutDom,
546 + const ::com::sun::star::uno::Reference<
547 + ::com::sun::star::xml::dom::XDocument>& rXQStyleDom,
548 + const ::com::sun::star::uno::Reference<
549 + ::com::sun::star::xml::dom::XDocument>& rXColorStyleDom );
552 #endif
553 diff --git oox/inc/oox/drawingml/diagram/diagramfragmenthandler.hxx oox/inc/oox/drawingml/diagram/diagramfragmenthandler.hxx
554 deleted file mode 100644
555 index 278dfe5..0000000
556 --- oox/inc/oox/drawingml/diagram/diagramfragmenthandler.hxx
557 +++ /dev/null
558 @@ -1,103 +0,0 @@
559 -/*************************************************************************
561 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
562 - *
563 - * Copyright 2008 by Sun Microsystems, Inc.
565 - * OpenOffice.org - a multi-platform office productivity suite
567 - * $RCSfile: diagramfragmenthandler.hxx,v $
568 - * $Revision: 1.4 $
570 - * This file is part of OpenOffice.org.
572 - * OpenOffice.org is free software: you can redistribute it and/or modify
573 - * it under the terms of the GNU Lesser General Public License version 3
574 - * only, as published by the Free Software Foundation.
576 - * OpenOffice.org is distributed in the hope that it will be useful,
577 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
578 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
579 - * GNU Lesser General Public License version 3 for more details
580 - * (a copy is included in the LICENSE file that accompanied this code).
582 - * You should have received a copy of the GNU Lesser General Public License
583 - * version 3 along with OpenOffice.org. If not, see
584 - * <http://www.openoffice.org/license.html>
585 - * for a copy of the LGPLv3 License.
587 - ************************************************************************/
590 -#ifndef OOX_DRAWINGML_DIAGRAMFRAGMENTHANDLER
591 -#define OOX_DRAWINGML_DIAGRAMFRAGMENTHANDLER
593 -#include "oox/core/fragmenthandler.hxx"
594 -#include "oox/drawingml/diagram/diagram.hxx"
596 -namespace oox { namespace drawingml {
599 -class DiagramDataFragmentHandler : public ::oox::core::FragmentHandler
601 -public:
602 - DiagramDataFragmentHandler( oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramDataPtr pDataPtr ) throw();
603 - virtual ~DiagramDataFragmentHandler() throw();
605 - virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
606 - 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);
608 -private:
610 - DiagramDataPtr mpDataPtr;
615 -class DiagramLayoutFragmentHandler : public ::oox::core::FragmentHandler
617 -public:
618 - DiagramLayoutFragmentHandler( oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramLayoutPtr pDataPtr ) throw();
619 - virtual ~DiagramLayoutFragmentHandler() throw();
621 - virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
622 - 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);
624 -private:
626 - DiagramLayoutPtr mpDataPtr;
629 -class DiagramQStylesFragmentHandler : public ::oox::core::FragmentHandler
631 -public:
632 - DiagramQStylesFragmentHandler( oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramQStylesPtr pDataPtr ) throw();
633 - virtual ~DiagramQStylesFragmentHandler() throw();
635 - virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
636 - 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);
638 -private:
640 - DiagramQStylesPtr mpDataPtr;
644 -class DiagramColorsFragmentHandler : public ::oox::core::FragmentHandler
646 -public:
647 - DiagramColorsFragmentHandler( ::oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramColorsPtr pDataPtr ) throw();
648 - virtual ~DiagramColorsFragmentHandler() throw();
650 - virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
651 - 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);
653 -private:
655 - DiagramColorsPtr mpDataPtr;
658 -} }
661 -#endif
662 diff --git oox/inc/oox/drawingml/diagram/diagramlayoutatoms.hxx oox/inc/oox/drawingml/diagram/diagramlayoutatoms.hxx
663 deleted file mode 100644
664 index 80c2dcd..0000000
665 --- oox/inc/oox/drawingml/diagram/diagramlayoutatoms.hxx
666 +++ /dev/null
667 @@ -1,212 +0,0 @@
668 -/*************************************************************************
670 - * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
671 - *
672 - * Copyright 2008 by Sun Microsystems, Inc.
674 - * OpenOffice.org - a multi-platform office productivity suite
676 - * $RCSfile: diagramlayoutatoms.hxx,v $
677 - * $Revision: 1.3 $
679 - * This file is part of OpenOffice.org.
681 - * OpenOffice.org is free software: you can redistribute it and/or modify
682 - * it under the terms of the GNU Lesser General Public License version 3
683 - * only, as published by the Free Software Foundation.
685 - * OpenOffice.org is distributed in the hope that it will be useful,
686 - * but WITHOUT ANY WARRANTY; without even the implied warranty of
687 - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
688 - * GNU Lesser General Public License version 3 for more details
689 - * (a copy is included in the LICENSE file that accompanied this code).
691 - * You should have received a copy of the GNU Lesser General Public License
692 - * version 3 along with OpenOffice.org. If not, see
693 - * <http://www.openoffice.org/license.html>
694 - * for a copy of the LGPLv3 License.
696 - ************************************************************************/
702 -#ifndef OOX_DRAWINGML_DIAGRAMLAYOUTATOMS_HXX
703 -#define OOX_DRAWINGML_DIAGRAMLAYOUTATOMS_HXX
705 -#include <map>
706 -#include <string>
708 -#include <boost/shared_ptr.hpp>
709 -#include <boost/array.hpp>
711 -#include <com/sun/star/uno/Any.hxx>
712 -#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
714 -#include "oox/drawingml/shape.hxx"
717 -namespace oox { namespace drawingml {
720 -// AG_IteratorAttributes
721 -class IteratorAttr
723 -public:
724 - IteratorAttr();
726 - // not sure this belong here, but wth
727 - void loadFromXAttr( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
729 -private:
730 - sal_Int32 mnAxis;
731 - sal_Int32 mnCnt;
732 - sal_Bool mbHideLastTrans;
733 - sal_Int32 mnPtType;
734 - sal_Int32 mnSt;
735 - sal_Int32 mnStep;
738 -class ConditionAttr
740 -public:
741 - ConditionAttr();
743 - // not sure this belong here, but wth
744 - void loadFromXAttr( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
746 -private:
747 - sal_Int32 mnFunc;
748 - sal_Int32 mnArg;
749 - sal_Int32 mnOp;
750 - ::rtl::OUString msVal;
753 -class LayoutAtom;
755 -typedef boost::shared_ptr< LayoutAtom > LayoutAtomPtr;
757 -/** abstract Atom for the layout */
758 -class LayoutAtom
760 -public:
761 - virtual ~LayoutAtom()
762 - {}
763 - // TODO change signature to the proper one
764 - virtual void processAtom() = 0;
765 - void setName( const ::rtl::OUString & sName )
766 - { msName = sName; }
767 - void addChild( const LayoutAtomPtr & pNode )
768 - { mpChildNodes.push_back( pNode ); }
770 - // dump for debug
771 - virtual void dump(int level = 0);
772 -protected:
773 - std::vector< LayoutAtomPtr > mpChildNodes;
774 - ::rtl::OUString msName;
777 -class AlgAtom
778 - : public LayoutAtom
780 -public:
781 - virtual ~AlgAtom()
782 - {}
783 - typedef std::map< std::string, ::com::sun::star::uno::Any > ParamMap;
785 - virtual void processAtom()
786 - {}
787 -private:
788 - ParamMap mParams;
792 -class ForEachAtom
793 - : public LayoutAtom
795 -public:
796 - virtual ~ForEachAtom()
797 - {}
799 - IteratorAttr & iterator()
800 - { return maIter; }
801 - virtual void processAtom();
802 -private:
803 - IteratorAttr maIter;
806 -typedef boost::shared_ptr< ForEachAtom > ForEachAtomPtr;
809 -class ConditionAtom
810 - : public LayoutAtom
812 -public:
813 - ConditionAtom( bool bElse = false )
814 - : LayoutAtom( )
815 - , mbElse( bElse )
816 - {}
817 - virtual ~ConditionAtom()
818 - {}
819 - bool test();
820 - virtual void processAtom()
821 - {}
822 - IteratorAttr & iterator()
823 - { return maIter; }
824 - ConditionAttr & cond()
825 - { return maCond; }
826 -private:
827 - bool mbElse;
828 - IteratorAttr maIter;
829 - ConditionAttr maCond;
832 -typedef boost::shared_ptr< ConditionAtom > ConditionAtomPtr;
835 -/** "choose" statements. Atoms will be tested in order. */
836 -class ChooseAtom
837 - : public LayoutAtom
839 -public:
840 - virtual ~ChooseAtom()
841 - {}
842 - virtual void processAtom();
845 -class LayoutNode
846 - : public LayoutAtom
848 -public:
849 - enum {
850 - VAR_animLvl = 0,
851 - VAR_animOne,
852 - VAR_bulletEnabled,
853 - VAR_chMax,
854 - VAR_chPref,
855 - VAR_dir,
856 - VAR_hierBranch,
857 - VAR_orgChart,
858 - VAR_resizeHandles
859 - };
860 - // we know that the array is of fixed size
861 - // the use of Any allow having empty values
862 - typedef boost::array< ::com::sun::star::uno::Any, 9 > VarMap;
864 - virtual ~LayoutNode()
865 - {}
866 - virtual void processAtom()
867 - {}
868 - VarMap & variables()
869 - { return mVariables; }
870 -private:
871 - VarMap mVariables;
872 - std::vector< ShapePtr > mpShapes;
875 -typedef boost::shared_ptr< LayoutNode > LayoutNodePtr;
877 -} }
879 -#endif
880 diff --git oox/inc/oox/drawingml/drawingmltypes.hxx oox/inc/oox/drawingml/drawingmltypes.hxx
881 index 7fb3f36..aa8c5d2 100644
882 --- oox/inc/oox/drawingml/drawingmltypes.hxx
883 +++ oox/inc/oox/drawingml/drawingmltypes.hxx
884 @@ -50,6 +50,9 @@ typedef ::boost::shared_ptr< LineProperties > LinePropertiesPtr;
885 struct FillProperties;
886 typedef ::boost::shared_ptr< FillProperties > FillPropertiesPtr;
888 +struct Shape3DProperties;
889 +typedef ::boost::shared_ptr< Shape3DProperties > Shape3DPropertiesPtr;
891 struct TextCharacterProperties;
892 typedef ::boost::shared_ptr< TextCharacterProperties > TextCharacterPropertiesPtr;
894 diff --git oox/inc/oox/drawingml/graphicshapecontext.hxx oox/inc/oox/drawingml/graphicshapecontext.hxx
895 index 74ef1a8..5ae1715 100644
896 --- oox/inc/oox/drawingml/graphicshapecontext.hxx
897 +++ oox/inc/oox/drawingml/graphicshapecontext.hxx
898 @@ -33,7 +33,6 @@
900 #include "oox/drawingml/shape.hxx"
901 #include "oox/drawingml/shapecontext.hxx"
902 -#include "oox/drawingml/diagram/diagram.hxx"
904 namespace oox { namespace drawingml {
906 @@ -78,6 +77,8 @@ private:
908 // ====================================================================
910 +class Diagram;
912 class DiagramGraphicDataContext
913 : public ShapeContext
915 @@ -87,8 +88,6 @@ public:
916 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);
918 private:
919 - DiagramPtr loadDiagram();
921 ::rtl::OUString msDm;
922 ::rtl::OUString msLo;
923 ::rtl::OUString msQs;
924 diff --git oox/inc/oox/drawingml/scene3dcontext.hxx oox/inc/oox/drawingml/scene3dcontext.hxx
925 new file mode 100644
926 index 0000000..840075a
927 --- /dev/null
928 +++ oox/inc/oox/drawingml/scene3dcontext.hxx
929 @@ -0,0 +1,56 @@
930 +/*************************************************************************
932 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
934 + * Copyright 2008 by Sun Microsystems, Inc.
936 + * OpenOffice.org - a multi-platform office productivity suite
938 + * $RCSfile: fillpropertiesgroupcontext.hxx,v $
939 + * $Revision: 1.6 $
941 + * This file is part of OpenOffice.org.
943 + * OpenOffice.org is free software: you can redistribute it and/or modify
944 + * it under the terms of the GNU Lesser General Public License version 3
945 + * only, as published by the Free Software Foundation.
947 + * OpenOffice.org is distributed in the hope that it will be useful,
948 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
949 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
950 + * GNU Lesser General Public License version 3 for more details
951 + * (a copy is included in the LICENSE file that accompanied this code).
953 + * You should have received a copy of the GNU Lesser General Public License
954 + * version 3 along with OpenOffice.org. If not, see
955 + * <http://www.openoffice.org/license.html>
956 + * for a copy of the LGPLv3 License.
958 + ************************************************************************/
960 +#ifndef OOX_DRAWINGML_SCENE3DPROPERTIESCONTEXT_HPP
961 +#define OOX_DRAWINGML_SCENE3DPROPERTIESCONTEXT_HPP
963 +#include "oox/core/contexthandler.hxx"
965 +namespace oox { namespace drawingml {
967 +struct Shape3DProperties;
969 +// ---------------------------------------------------------------------
971 +class Scene3DPropertiesContext : public ::oox::core::ContextHandler
973 +public:
974 + Scene3DPropertiesContext( ::oox::core::ContextHandler& rParent, Shape3DProperties& r3DProperties ) throw();
976 + ::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 )
977 + throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException );
979 +private:
980 + Shape3DProperties& mr3DProperties;
983 +} }
985 +#endif // OOX_DRAWINGML_SCENE3DPROPERTIESCONTEXT_HPP
986 diff --git oox/inc/oox/drawingml/shape.hxx oox/inc/oox/drawingml/shape.hxx
987 index c2f7a1c..e0dedae 100644
988 --- oox/inc/oox/drawingml/shape.hxx
989 +++ oox/inc/oox/drawingml/shape.hxx
990 @@ -35,6 +35,7 @@
991 #include "oox/drawingml/drawingmltypes.hxx"
992 //#include "oox/drawingml/customshapeproperties.hxx"
993 #include "oox/drawingml/textliststyle.hxx"
994 +#include "oox/drawingml/shape3dproperties.hxx"
996 #include <com/sun/star/frame/XModel.hpp>
997 #include <com/sun/star/drawing/XDrawPage.hpp>
998 @@ -83,7 +84,8 @@ class Shape
1000 public:
1002 - Shape( const sal_Char* pServiceType = NULL );
1003 + explicit Shape( const sal_Char* pServiceType = NULL );
1004 + explicit Shape( const ShapePtr& pSourceShape );
1005 virtual ~Shape();
1007 rtl::OUString& getServiceName(){ return msServiceName; }
1008 @@ -100,10 +102,17 @@ public:
1009 FillPropertiesPtr getGraphicProperties() { return mpGraphicPropertiesPtr; }
1010 CustomShapePropertiesPtr getCustomShapeProperties(){ return mpCustomShapePropertiesPtr; }
1012 + Shape3DProperties& get3DProperties() { return *mp3DPropertiesPtr; }
1013 + const Shape3DProperties& get3DProperties() const { return *mp3DPropertiesPtr; }
1015 table::TablePropertiesPtr getTableProperties();
1017 - void setPosition( com::sun::star::awt::Point nPosition ){ maPosition = nPosition; }
1018 - void setSize( com::sun::star::awt::Size aSize ){ maSize = aSize; }
1019 + void setPosition( com::sun::star::awt::Point nPosition ){ maPosition = nPosition; }
1020 + const com::sun::star::awt::Point& getPosition() const { return maPosition; }
1022 + void setSize( com::sun::star::awt::Size aSize ){ maSize = aSize; }
1023 + const com::sun::star::awt::Size& getSize() const { return maSize; }
1025 void setRotation( sal_Int32 nRotation ) { mnRotation = nRotation; }
1026 void setFlip( sal_Bool bFlipH, sal_Bool bFlipV ) { mbFlipH = bFlipH; mbFlipV = bFlipV; }
1027 void addChild( const ShapePtr pChildPtr ) { maChildren.push_back( pChildPtr ); }
1028 @@ -139,6 +148,13 @@ public:
1029 const ::com::sun::star::awt::Rectangle* pShapeRect = 0,
1030 ShapeIdMap* pShapeMap = 0 );
1032 + void addChildren(
1033 + const ::oox::core::XmlFilterBase& rFilterBase,
1034 + const ThemePtr& rxTheme,
1035 + const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShapes >& rxShapes,
1036 + const ::com::sun::star::awt::Rectangle* pShapeRect = 0,
1037 + ShapeIdMap* pShapeMap = 0 );
1039 void setXShape( const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape >& rXShape )
1040 { mxShape = rXShape; };
1041 const ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > &
1042 @@ -171,6 +187,7 @@ protected:
1043 FillPropertiesPtr mpGraphicPropertiesPtr;
1044 CustomShapePropertiesPtr mpCustomShapePropertiesPtr;
1045 table::TablePropertiesPtr mpTablePropertiesPtr;
1046 + Shape3DPropertiesPtr mp3DPropertiesPtr;
1047 PropertyMap maShapeProperties;
1048 TextListStylePtr mpMasterTextListStyle;
1049 ::com::sun::star::uno::Reference< ::com::sun::star::drawing::XShape > mxShape;
1050 @@ -193,7 +210,11 @@ private:
1051 sal_Bool mbFlipV;
1054 -::rtl::OUString GetShapeType( sal_Int32 nType );
1055 +// ---------------------------------------------------------------------
1057 +/** Get custom shape preset string from xml token id
1058 + */
1059 +::rtl::OUString GetShapePresetType( sal_Int32 nType );
1063 diff --git oox/inc/oox/drawingml/shape3dproperties.hxx oox/inc/oox/drawingml/shape3dproperties.hxx
1064 new file mode 100644
1065 index 0000000..a46ff19
1066 --- /dev/null
1067 +++ oox/inc/oox/drawingml/shape3dproperties.hxx
1068 @@ -0,0 +1,134 @@
1069 +/*************************************************************************
1071 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1073 + * Copyright 2008 by Sun Microsystems, Inc.
1075 + * OpenOffice.org - a multi-platform office productivity suite
1077 + * $RCSfile: fillproperties.hxx,v $
1078 + * $Revision: 1.7 $
1080 + * This file is part of OpenOffice.org.
1082 + * OpenOffice.org is free software: you can redistribute it and/or modify
1083 + * it under the terms of the GNU Lesser General Public License version 3
1084 + * only, as published by the Free Software Foundation.
1086 + * OpenOffice.org is distributed in the hope that it will be useful,
1087 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1088 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1089 + * GNU Lesser General Public License version 3 for more details
1090 + * (a copy is included in the LICENSE file that accompanied this code).
1092 + * You should have received a copy of the GNU Lesser General Public License
1093 + * version 3 along with OpenOffice.org. If not, see
1094 + * <http://www.openoffice.org/license.html>
1095 + * for a copy of the LGPLv3 License.
1097 + ************************************************************************/
1099 +#ifndef OOX_DRAWINGML_SHAPE3DPROPERTIES_HXX
1100 +#define OOX_DRAWINGML_SHAPE3DPROPERTIES_HXX
1102 +#include <map>
1103 +#include <com/sun/star/graphic/XGraphic.hpp>
1104 +#include <com/sun/star/geometry/IntegerRectangle2D.hpp>
1105 +#include "oox/drawingml/color.hxx"
1106 +#include "oox/helper/helper.hxx"
1108 +namespace oox { class PropertyMap; }
1109 +namespace oox { class PropertySet; }
1110 +namespace oox { namespace core { class ModelObjectContainer; } }
1112 +namespace oox {
1113 +namespace drawingml {
1115 +// ============================================================================
1117 +struct Shape3DPropertyNames
1119 + ::rtl::OUString maFillStyle;
1120 + ::rtl::OUString maFillColor;
1121 + ::rtl::OUString maFillTransparence;
1122 + ::rtl::OUString maFillGradient;
1123 + ::rtl::OUString maFillBitmap;
1124 + ::rtl::OUString maFillBitmapMode;
1125 + ::rtl::OUString maFillBitmapTile;
1126 + ::rtl::OUString maFillBitmapStretch;
1127 + ::rtl::OUString maFillBitmapLogicalSize;
1128 + ::rtl::OUString maFillBitmapSizeX;
1129 + ::rtl::OUString maFillBitmapSizeY;
1130 + ::rtl::OUString maFillBitmapOffsetX;
1131 + ::rtl::OUString maFillBitmapOffsetY;
1132 + ::rtl::OUString maFillBitmapRectanglePoint;
1133 + bool mbNamedFillGradient;
1134 + bool mbNamedFillBitmap;
1135 + bool mbTransformGraphic;
1137 + Shape3DPropertyNames();
1140 +// ============================================================================
1142 +struct Shape3DProperties
1144 + typedef ::std::map< double, Color > GradientStopMap;
1146 + OptValue< sal_Int32 > moFillType; /// Fill type (OOXML token).
1147 + OptValue< bool > moRotateWithShape; /// True = rotate gradient/bitmap with shape.
1148 + Color maFillColor; /// Solid fill color and transparence.
1149 + GradientStopMap maGradientStops; /// Gradient stops (colors/transparence).
1150 + OptValue< sal_Int32 > moGradientPath; /// If set, gradient follows rectangle, circle, or shape.
1151 + OptValue< sal_Int32 > moShadeAngle; /// Rotation angle of linear gradients.
1152 + OptValue< bool > moShadeScaled;
1153 + OptValue< sal_Int32 > moFlipModeToken;
1154 + OptValue< com::sun::star::geometry::IntegerRectangle2D > moFillToRect;
1155 + OptValue< com::sun::star::geometry::IntegerRectangle2D > moTileRect;
1156 + OptValue< sal_Int32 > moPattPreset; /// Preset pattern type.
1157 + Color maPattFgColor; /// Pattern foreground color.
1158 + Color maPattBgColor; /// Pattern background color.
1159 + ::com::sun::star::uno::Reference< ::com::sun::star::graphic::XGraphic > mxGraphic;
1160 + Color maColorChangeFrom; /// Start color of color transformation.
1161 + Color maColorChangeTo; /// Destination color of color transformation.
1162 + OptValue< sal_Int32 > moBitmapMode; /// Bitmap tile or stretch.
1163 + OptValue< sal_Int32 > moTileX; /// Width of bitmap tiles.
1164 + OptValue< sal_Int32 > moTileY; /// Height of bitmap tiles.
1165 + OptValue< sal_Int32 > moTileSX;
1166 + OptValue< sal_Int32 > moTileSY;
1167 + OptValue< sal_Int32 > moTileAlign; /// Anchor point inside bitmap.
1169 + static Shape3DPropertyNames DEFAULTNAMES; /// Default fill property names for shape fill.
1170 + static Shape3DPropertyNames DEFAULTPICNAMES; /// Default fill property names for pictures.
1172 + /** Overwrites all members that are explicitly set in rSourceProps. */
1173 + void assignUsed( const Shape3DProperties& rSourceProps );
1175 + /** Tries to resolve current settings to a solid color, e.g. returns the
1176 + start color of a gradient. */
1177 + Color getBestSolidColor() const;
1179 + /** Writes the properties to the passed property map. */
1180 + void pushToPropMap(
1181 + PropertyMap& rPropMap,
1182 + const Shape3DPropertyNames& rPropNames,
1183 + const ::oox::core::XmlFilterBase& rFilter,
1184 + ::oox::core::ModelObjectContainer& rObjContainer,
1185 + sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const;
1187 + /** Writes the properties to the passed property set. */
1188 + void pushToPropSet(
1189 + PropertySet& rPropSet,
1190 + const Shape3DPropertyNames& rPropNames,
1191 + const ::oox::core::XmlFilterBase& rFilter,
1192 + ::oox::core::ModelObjectContainer& rObjContainer,
1193 + sal_Int32 nShapeRotation, sal_Int32 nPhClr ) const;
1196 +// ============================================================================
1198 +} // namespace drawingml
1199 +} // namespace oox
1201 +#endif
1203 diff --git oox/inc/oox/drawingml/theme.hxx oox/inc/oox/drawingml/theme.hxx
1204 index 17f23e5..2f34a33 100644
1205 --- oox/inc/oox/drawingml/theme.hxx
1206 +++ oox/inc/oox/drawingml/theme.hxx
1207 @@ -35,6 +35,7 @@
1208 #include "oox/drawingml/clrscheme.hxx"
1209 #include "oox/drawingml/shape.hxx"
1210 #include "oox/drawingml/textfont.hxx"
1211 +#include <com/sun/star/xml/dom/XDocument.hpp>
1213 namespace oox {
1214 namespace drawingml {
1215 @@ -97,6 +98,11 @@ public:
1216 inline Shape& getTxDef() { return maTxDef; }
1217 inline const Shape& getTxDef() const { return maTxDef; }
1219 + void setFragment( const ::com::sun::star::uno::Reference<
1220 + ::com::sun::star::xml::dom::XDocument>& xRef ) { mxFragment=xRef; }
1221 + const ::com::sun::star::uno::Reference<
1222 + ::com::sun::star::xml::dom::XDocument>& getFragment() const { return mxFragment; }
1224 private:
1225 ::rtl::OUString maStyleName;
1226 ClrScheme maClrScheme;
1227 @@ -108,6 +114,8 @@ private:
1228 Shape maSpDef;
1229 Shape maLnDef;
1230 Shape maTxDef;
1231 + ::com::sun::star::uno::Reference<
1232 + ::com::sun::star::xml::dom::XDocument> mxFragment;
1235 // ============================================================================
1236 diff --git oox/inc/oox/ppt/dgmimport.hxx oox/inc/oox/ppt/dgmimport.hxx
1237 new file mode 100644
1238 index 0000000..bfb2f38
1239 --- /dev/null
1240 +++ oox/inc/oox/ppt/dgmimport.hxx
1241 @@ -0,0 +1,68 @@
1242 +/*************************************************************************
1244 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1246 + * Copyright 2008 by Sun Microsystems, Inc.
1248 + * OpenOffice.org - a multi-platform office productivity suite
1250 + * $RCSfile: pptimport.hxx,v $
1251 + * $Revision: 1.6 $
1253 + * This file is part of OpenOffice.org.
1255 + * OpenOffice.org is free software: you can redistribute it and/or modify
1256 + * it under the terms of the GNU Lesser General Public License version 3
1257 + * only, as published by the Free Software Foundation.
1259 + * OpenOffice.org is distributed in the hope that it will be useful,
1260 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1261 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1262 + * GNU Lesser General Public License version 3 for more details
1263 + * (a copy is included in the LICENSE file that accompanied this code).
1265 + * You should have received a copy of the GNU Lesser General Public License
1266 + * version 3 along with OpenOffice.org. If not, see
1267 + * <http://www.openoffice.org/license.html>
1268 + * for a copy of the LGPLv3 License.
1270 + ************************************************************************/
1272 +#ifndef OOX_POWERPOINT_QUICKDIAGRAMMINGIMPORT_HXX
1273 +#define OOX_POWERPOINT_QUICKDIAGRAMMINGIMPORT_HXX
1275 +#include "oox/core/xmlfilterbase.hxx"
1277 +#include <com/sun/star/animations/XAnimationNode.hpp>
1278 +#include <oox/drawingml/theme.hxx>
1279 +#include "oox/ppt/presentationfragmenthandler.hxx"
1280 +#include "oox/ppt/slidepersist.hxx"
1281 +#include "tokens.hxx"
1282 +#include <vector>
1283 +#include <map>
1285 +namespace oox { namespace ppt {
1287 +// ---------------------------------------------------------------------
1289 +class QuickDiagrammingImport : public oox::core::XmlFilterBase
1291 +public:
1293 + QuickDiagrammingImport( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr );
1295 + // from FilterBase
1296 + virtual bool importDocument() throw();
1297 + virtual bool exportDocument() throw();
1299 + virtual const ::oox::drawingml::Theme* getCurrentTheme() const;
1300 + virtual sal_Int32 getSchemeClr( sal_Int32 nColorSchemeToken ) const;
1301 + virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
1303 +private:
1304 + virtual ::rtl::OUString implGetImplementationName() const;
1307 +} }
1309 +#endif // OOX_POWERPOINT_QUICKDIAGRAMMINGIMPORT_HXX
1310 diff --git oox/inc/oox/ppt/dgmlayout.hxx oox/inc/oox/ppt/dgmlayout.hxx
1311 new file mode 100644
1312 index 0000000..d597ef4
1313 --- /dev/null
1314 +++ oox/inc/oox/ppt/dgmlayout.hxx
1315 @@ -0,0 +1,69 @@
1316 +/*************************************************************************
1318 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1320 + * Copyright 2008 by Sun Microsystems, Inc.
1322 + * OpenOffice.org - a multi-platform office productivity suite
1324 + * $RCSfile: pptimport.hxx,v $
1325 + * $Revision: 1.6 $
1327 + * This file is part of OpenOffice.org.
1329 + * OpenOffice.org is free software: you can redistribute it and/or modify
1330 + * it under the terms of the GNU Lesser General Public License version 3
1331 + * only, as published by the Free Software Foundation.
1333 + * OpenOffice.org is distributed in the hope that it will be useful,
1334 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1335 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1336 + * GNU Lesser General Public License version 3 for more details
1337 + * (a copy is included in the LICENSE file that accompanied this code).
1339 + * You should have received a copy of the GNU Lesser General Public License
1340 + * version 3 along with OpenOffice.org. If not, see
1341 + * <http://www.openoffice.org/license.html>
1342 + * for a copy of the LGPLv3 License.
1344 + ************************************************************************/
1346 +#ifndef OOX_POWERPOINT_QUICKDIAGRAMMINGLAYOUT_HXX
1347 +#define OOX_POWERPOINT_QUICKDIAGRAMMINGLAYOUT_HXX
1349 +#include "oox/core/xmlfilterbase.hxx"
1351 +#include <com/sun/star/animations/XAnimationNode.hpp>
1352 +#include <oox/drawingml/theme.hxx>
1353 +#include "oox/ppt/presentationfragmenthandler.hxx"
1354 +#include "oox/ppt/slidepersist.hxx"
1355 +#include "tokens.hxx"
1356 +#include <vector>
1357 +#include <map>
1359 +namespace oox { namespace ppt {
1361 +// ---------------------------------------------------------------------
1363 +class QuickDiagrammingLayout : public oox::core::XmlFilterBase
1365 +public:
1367 + QuickDiagrammingLayout( const com::sun::star::uno::Reference< com::sun::star::lang::XMultiServiceFactory > & rSMgr );
1369 + // from FilterBase
1370 + virtual bool importDocument() throw();
1371 + virtual bool exportDocument() throw();
1373 + virtual const ::oox::drawingml::Theme* getCurrentTheme() const;
1374 + virtual sal_Int32 getSchemeClr( sal_Int32 nColorSchemeToken ) const;
1375 + virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
1377 +private:
1378 + virtual ::rtl::OUString implGetImplementationName() const;
1379 + drawingml::ThemePtr mpThemePtr;
1382 +} }
1384 +#endif // OOX_POWERPOINT_QUICKDIAGRAMMINGLAYOUT_HXX
1385 diff --git oox/inc/oox/ppt/pptimport.hxx oox/inc/oox/ppt/pptimport.hxx
1386 index cbcfbcf..6fc51b4 100644
1387 --- oox/inc/oox/ppt/pptimport.hxx
1388 +++ oox/inc/oox/ppt/pptimport.hxx
1389 @@ -62,7 +62,7 @@ public:
1391 virtual const oox::vml::DrawingPtr getDrawings();
1392 virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
1393 - virtual ::oox::drawingml::chart::ChartConverter& getChartConverter();
1394 + virtual ::oox::drawingml::chart::ChartConverter* getChartConverter();
1396 void setActualSlidePersist( SlidePersistPtr pActualSlidePersist ){ mpActualSlidePersist = pActualSlidePersist; };
1397 std::map< rtl::OUString, oox::drawingml::ThemePtr >& getThemes(){ return maThemes; };
1398 diff --git oox/inc/oox/xls/excelfilter.hxx oox/inc/oox/xls/excelfilter.hxx
1399 index 01880fe..e8960e3 100644
1400 --- oox/inc/oox/xls/excelfilter.hxx
1401 +++ oox/inc/oox/xls/excelfilter.hxx
1402 @@ -56,7 +56,7 @@ public:
1404 virtual const ::oox::vml::DrawingPtr getDrawings();
1405 virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles();
1406 - virtual ::oox::drawingml::chart::ChartConverter& getChartConverter();
1407 + virtual ::oox::drawingml::chart::ChartConverter* getChartConverter();
1409 virtual sal_Bool SAL_CALL filter( const ::com::sun::star::uno::Sequence< ::com::sun::star::beans::PropertyValue >& rDescriptor ) throw( ::com::sun::star::uno::RuntimeException );
1411 diff --git oox/inc/oox/xls/workbookhelper.hxx oox/inc/oox/xls/workbookhelper.hxx
1412 index e9f5ed9..11120a9 100644
1413 --- oox/inc/oox/xls/workbookhelper.hxx
1414 +++ oox/inc/oox/xls/workbookhelper.hxx
1415 @@ -231,7 +231,7 @@ public:
1416 /** Returns the converter for string to cell address/range conversion. */
1417 AddressConverter& getAddressConverter() const;
1418 /** Returns the chart object converter. */
1419 - ExcelChartConverter& getChartConverter() const;
1420 + ExcelChartConverter* getChartConverter() const;
1422 // property helpers -------------------------------------------------------
1424 diff --git oox/source/core/facreg.cxx oox/source/core/facreg.cxx
1425 index 9ff1951..3dcb93c 100644
1426 --- oox/source/core/facreg.cxx
1427 +++ oox/source/core/facreg.cxx
1428 @@ -60,6 +60,8 @@ extern uno::Reference< uno::XInterface > SAL_CALL className##_createInstance(
1429 namespace oox {
1430 namespace core { SERVICE( FilterDetect ); }
1431 namespace ppt { SERVICE( PowerPointImport ); }
1432 + namespace ppt { SERVICE( QuickDiagrammingImport ); }
1433 + namespace ppt { SERVICE( QuickDiagrammingLayout ); }
1434 namespace xls { SERVICE( BiffDetector ); }
1435 namespace xls { SERVICE( ExcelFilter ); }
1436 namespace xls { SERVICE( ExcelBiffFilter ); }
1437 @@ -102,6 +104,8 @@ OOX_DLLPUBLIC sal_Bool SAL_CALL component_writeInfo( void * , void * pRegistryKe
1439 WRITEINFO( ::oox::core::FilterDetect );
1440 WRITEINFO( ::oox::ppt::PowerPointImport );
1441 + WRITEINFO( ::oox::ppt::QuickDiagrammingImport );
1442 + WRITEINFO( ::oox::ppt::QuickDiagrammingLayout );
1443 WRITEINFO( ::oox::xls::BiffDetector );
1444 WRITEINFO( ::oox::xls::ExcelFilter );
1445 WRITEINFO( ::oox::xls::ExcelBiffFilter );
1446 @@ -150,6 +154,8 @@ OOX_DLLPUBLIC void * SAL_CALL component_getFactory( const sal_Char * pImplName,
1447 // impress oasis import
1448 SINGLEFACTORY( ::oox::core::FilterDetect )
1449 else SINGLEFACTORY( oox::ppt::PowerPointImport )
1450 + else SINGLEFACTORY( oox::ppt::QuickDiagrammingImport )
1451 + else SINGLEFACTORY( oox::ppt::QuickDiagrammingLayout )
1452 else SINGLEFACTORY( ::oox::xls::BiffDetector )
1453 else SINGLEFACTORY( ::oox::xls::ExcelFilter )
1454 else SINGLEFACTORY( ::oox::xls::ExcelBiffFilter )
1455 diff --git oox/source/core/filterbase.cxx oox/source/core/filterbase.cxx
1456 index e3babee..37e7128 100644
1457 --- oox/source/core/filterbase.cxx
1458 +++ oox/source/core/filterbase.cxx
1459 @@ -32,6 +32,7 @@
1460 #include <com/sun/star/frame/XModel.hpp>
1461 #include <com/sun/star/task/XStatusIndicator.hpp>
1462 #include <com/sun/star/task/XInteractionHandler.hpp>
1463 +#include <com/sun/star/drawing/XShape.hpp>
1464 #include <rtl/uri.hxx>
1465 #include <comphelper/mediadescriptor.hxx>
1467 @@ -52,6 +53,7 @@ using ::com::sun::star::io::XOutputStream;
1468 using ::com::sun::star::io::XStream;
1469 using ::com::sun::star::task::XStatusIndicator;
1470 using ::com::sun::star::task::XInteractionHandler;
1471 +using ::com::sun::star::drawing::XShape;
1472 using ::comphelper::MediaDescriptor;
1474 namespace oox {
1475 @@ -72,6 +74,7 @@ struct FilterBaseImpl
1476 Reference< XStream > mxStream;
1477 Reference< XStatusIndicator > mxStatusIndicator;
1478 Reference< XInteractionHandler > mxInteractionHandler;
1479 + Reference< XShape > mxParentShape;
1481 explicit FilterBaseImpl( const Reference< XMultiServiceFactory >& rxFactory );
1482 void setMediaDescriptor( const Sequence< PropertyValue >& rDescriptor );
1483 @@ -89,14 +92,15 @@ void FilterBaseImpl::setMediaDescriptor( const Sequence< PropertyValue >& rDescr
1485 maDescriptor = rDescriptor;
1487 + mxStream = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_STREAMFOROUTPUT(), mxStream );
1488 + if( !mxStream.is() )
1489 + maDescriptor.addInputStream();
1491 maFileUrl = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_URL(), maFileUrl );
1492 mxInStream = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_INPUTSTREAM(), mxInStream );
1493 - mxStream = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_STREAMFOROUTPUT(), mxStream );
1494 mxStatusIndicator = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_STATUSINDICATOR(), mxStatusIndicator );
1495 mxInteractionHandler = maDescriptor.getUnpackedValueOrDefault( MediaDescriptor::PROP_INTERACTIONHANDLER(), mxInteractionHandler );
1497 - if( mxInStream.is() )
1498 - maDescriptor.addInputStream();
1499 + mxParentShape = maDescriptor.getUnpackedValueOrDefault( CREATE_OUSTRING( "ParentShape" ), mxParentShape );
1502 // ============================================================================
1503 @@ -137,6 +141,11 @@ const Reference< XModel >& FilterBase::getModel() const
1504 return mxImpl->mxModel;
1507 +const Reference< XShape >& FilterBase::getParentShape() const
1509 + return mxImpl->mxParentShape;
1512 const Reference< XStatusIndicator >& FilterBase::getStatusIndicator() const
1514 return mxImpl->mxStatusIndicator;
1515 diff --git oox/source/core/xmlfilterbase.cxx oox/source/core/xmlfilterbase.cxx
1516 index 545ef5c..cd7a91b 100644
1517 --- oox/source/core/xmlfilterbase.cxx
1518 +++ oox/source/core/xmlfilterbase.cxx
1519 @@ -43,15 +43,18 @@
1520 #include <cstdio>
1522 #include <rtl/ustrbuf.hxx>
1524 +#include <rtl/instance.hxx>
1525 #include <com/sun/star/beans/XPropertySet.hpp>
1526 #include <com/sun/star/container/XNameContainer.hpp>
1527 #include <com/sun/star/document/XDocumentSubStorageSupplier.hpp>
1528 #include <com/sun/star/embed/ElementModes.hpp>
1529 #include <com/sun/star/embed/XTransactedObject.hpp>
1530 #include <com/sun/star/embed/XRelationshipAccess.hpp>
1531 +#include <com/sun/star/xml/dom/XDocument.hpp>
1532 +#include <com/sun/star/xml/dom/XDocumentBuilder.hpp>
1533 #include <com/sun/star/xml/sax/InputSource.hpp>
1534 #include <com/sun/star/xml/sax/XFastParser.hpp>
1535 +#include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
1536 #include <com/sun/star/document/XDocumentProperties.hpp>
1537 #include <sax/fshelper.hxx>
1539 @@ -61,6 +64,7 @@ using ::rtl::OUString;
1540 using ::rtl::OUStringBuffer;
1541 using ::com::sun::star::beans::XPropertySet;
1542 using ::com::sun::star::beans::StringPair;
1543 +using ::com::sun::star::beans::Pair;
1544 using ::com::sun::star::uno::Reference;
1545 using ::com::sun::star::uno::Sequence;
1546 using ::com::sun::star::uno::Exception;
1547 @@ -78,6 +82,8 @@ using ::com::sun::star::io::XOutputStream;
1548 using ::com::sun::star::io::XStream;
1549 using ::com::sun::star::container::XNameContainer;
1550 using ::com::sun::star::document::XDocumentSubStorageSupplier;
1551 +using ::com::sun::star::xml::dom::XDocument;
1552 +using ::com::sun::star::xml::dom::XDocumentBuilder;
1553 using ::com::sun::star::xml::sax::XFastParser;
1554 using ::com::sun::star::xml::sax::XFastTokenHandler;
1555 using ::com::sun::star::xml::sax::XFastDocumentHandler;
1556 @@ -87,6 +93,7 @@ using ::com::sun::star::document::XDocumentProperties;
1557 using ::com::sun::star::util::DateTime;
1558 using ::sax_fastparser::FastSerializerHelper;
1559 using ::sax_fastparser::FSHelperPtr;
1560 +using namespace ::com::sun::star;
1562 namespace oox {
1563 namespace core {
1564 @@ -119,6 +126,64 @@ XmlFilterBaseImpl::XmlFilterBaseImpl() :
1566 // ============================================================================
1568 +namespace
1570 + struct NamespaceIds: public rtl::StaticWithInit<
1571 + Sequence< Pair< OUString, sal_Int32 > >,
1572 + NamespaceIds>
1574 + Sequence< Pair< OUString, sal_Int32 > > operator()()
1576 + static const char* const namespaceURIs[] = {
1577 + "http://www.w3.org/XML/1998/namespace",
1578 + "http://schemas.openxmlformats.org/package/2006/relationships",
1579 + "http://schemas.openxmlformats.org/officeDocument/2006/relationships",
1580 + "http://schemas.openxmlformats.org/drawingml/2006/main",
1581 + "http://schemas.openxmlformats.org/drawingml/2006/diagram",
1582 + "http://schemas.openxmlformats.org/drawingml/2006/chart",
1583 + "urn:schemas-microsoft-com:vml",
1584 + "urn:schemas-microsoft-com:office:office",
1585 + "urn:schemas-microsoft-com:office:word",
1586 + "urn:schemas-microsoft-com:office:excel",
1587 + "urn:schemas-microsoft-com:office:powerpoint",
1588 + "http://schemas.microsoft.com/office/2006/activeX",
1589 + "http://schemas.openxmlformats.org/spreadsheetml/2006/main",
1590 + "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing",
1591 + "http://schemas.microsoft.com/office/excel/2006/main",
1592 + "http://schemas.openxmlformats.org/presentationml/2006/main"
1593 + };
1595 + static const sal_Int32 namespaceIds[] = {
1596 + NMSP_XML,
1597 + NMSP_PACKAGE_RELATIONSHIPS,
1598 + NMSP_RELATIONSHIPS,
1599 + NMSP_DRAWINGML,
1600 + NMSP_DIAGRAM,
1601 + NMSP_CHART,
1602 + NMSP_VML,
1603 + NMSP_OFFICE,
1604 + NMSP_VML_DOC,
1605 + NMSP_VML_XLS,
1606 + NMSP_VML_PPT,
1607 + NMSP_AX,
1608 + NMSP_XLS,
1609 + NMSP_XDR,
1610 + NMSP_XM,
1611 + NMSP_PPT
1612 + };
1614 + Sequence< Pair< OUString, sal_Int32 > > aRet(STATIC_ARRAY_SIZE(namespaceIds));
1615 + for( sal_Int32 i=0; i<aRet.getLength(); ++i )
1616 + aRet[i] = beans::make_Pair(
1617 + ::rtl::OUString::createFromAscii(namespaceURIs[i]),
1618 + namespaceIds[i]);
1619 + return aRet;
1621 + };
1624 +// ============================================================================
1626 XmlFilterBase::XmlFilterBase( const Reference< XMultiServiceFactory >& rxFactory ) :
1627 FilterBase( rxFactory ),
1628 mxImpl( new XmlFilterBaseImpl ),
1629 @@ -133,6 +198,18 @@ XmlFilterBase::~XmlFilterBase()
1631 // ----------------------------------------------------------------------------
1633 +const ::oox::vml::DrawingPtr XmlFilterBase::getDrawings()
1635 + return ::oox::vml::DrawingPtr();
1638 +::oox::drawingml::chart::ChartConverter* XmlFilterBase::getChartConverter()
1640 + return 0;
1643 +// ----------------------------------------------------------------------------
1645 OUString XmlFilterBase::getFragmentPathFromType( const OUString& rType )
1647 return importRelations( OUString() )->getTargetFromType( rType );
1648 @@ -193,26 +270,10 @@ bool XmlFilterBase::importFragment( const ::rtl::Reference< FragmentHandler >& r
1649 xParser->setTokenHandler( mxImpl->mxTokenHandler );
1651 // register XML namespaces
1652 - xParser->registerNamespace( CREATE_OUSTRING( "http://www.w3.org/XML/1998/namespace" ), NMSP_XML );
1653 - xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/package/2006/relationships" ), NMSP_PACKAGE_RELATIONSHIPS );
1654 - xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/officeDocument/2006/relationships" ), NMSP_RELATIONSHIPS );
1656 - xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/main" ), NMSP_DRAWINGML );
1657 - xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/diagram" ), NMSP_DIAGRAM );
1658 - xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/chart" ), NMSP_CHART );
1660 - xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:vml" ), NMSP_VML );
1661 - xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:office" ), NMSP_OFFICE );
1662 - xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:word" ), NMSP_VML_DOC );
1663 - xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:excel" ), NMSP_VML_XLS );
1664 - xParser->registerNamespace( CREATE_OUSTRING( "urn:schemas-microsoft-com:office:powerpoint" ), NMSP_VML_PPT );
1665 - xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.microsoft.com/office/2006/activeX" ), NMSP_AX );
1667 - xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/spreadsheetml/2006/main"), NMSP_XLS );
1668 - xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing" ), NMSP_XDR );
1669 - xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.microsoft.com/office/excel/2006/main" ), NMSP_XM );
1671 - xParser->registerNamespace( CREATE_OUSTRING( "http://schemas.openxmlformats.org/presentationml/2006/main"), NMSP_PPT );
1672 + const Sequence< Pair< OUString, sal_Int32 > > ids=
1673 + NamespaceIds::get();
1674 + for( sal_Int32 i=0; i<ids.getLength(); ++i )
1675 + xParser->registerNamespace( ids[i].First, ids[i].Second );
1677 // create the input source and parse the stream
1678 InputSource aSource;
1679 @@ -227,6 +288,66 @@ bool XmlFilterBase::importFragment( const ::rtl::Reference< FragmentHandler >& r
1680 return false;
1683 +Reference<XDocument> XmlFilterBase::importFragment( const ::rtl::OUString& aFragmentPath )
1685 + Reference<XDocument> xRet;
1687 + // path to fragment stream valid?
1688 + OSL_ENSURE( aFragmentPath.getLength() > 0, "XmlFilterBase::importFragment - empty fragment path" );
1689 + if( aFragmentPath.getLength() == 0 )
1690 + return xRet;
1692 + // try to open the fragment stream (this may fail - do not assert)
1693 + Reference< XInputStream > xInStrm = openInputStream( aFragmentPath );
1694 + if( !xInStrm.is() )
1695 + return xRet;
1697 + // binary streams (fragment extension is '.bin') currently not supported
1698 + sal_Int32 nBinSuffixPos = aFragmentPath.getLength() - mxImpl->maBinSuffix.getLength();
1699 + if( (nBinSuffixPos >= 0) && aFragmentPath.match( mxImpl->maBinSuffix, nBinSuffixPos ) )
1700 + return xRet;
1702 + // try to import XML stream
1703 + try
1705 + // create the dom parser
1706 + Reference<XDocumentBuilder> xDomBuilder(
1707 + getGlobalFactory()->createInstance(
1708 + CREATE_OUSTRING( "com.sun.star.xml.dom.DocumentBuilder" ) ),
1709 + UNO_QUERY_THROW );
1711 + // create DOM from fragment
1712 + xRet = xDomBuilder->parse(xInStrm);
1714 + catch( Exception& )
1718 + return xRet;
1721 +bool XmlFilterBase::importFragment( const ::rtl::Reference< FragmentHandler >& rxHandler,
1722 + const Reference< xml::sax::XFastSAXSerializable >& rxSerializer )
1724 + Reference< XFastDocumentHandler > xDocHandler( rxHandler.get() );
1725 + if( !xDocHandler.is() )
1726 + return false;
1728 + // try to import XML stream
1729 + try
1731 + rxSerializer->fastSerialize( xDocHandler,
1732 + mxImpl->mxTokenHandler,
1733 + uno::Sequence< beans::StringPair >(),
1734 + NamespaceIds::get() );
1735 + return true;
1737 + catch( Exception& )
1738 + {}
1740 + return false;
1743 RelationsRef XmlFilterBase::importRelations( const OUString& rFragmentPath )
1745 // try to find cached relations
1746 diff --git oox/source/drawingml/chart/chartspaceconverter.cxx oox/source/drawingml/chart/chartspaceconverter.cxx
1747 index 22e4be7..1957245 100644
1748 --- oox/source/drawingml/chart/chartspaceconverter.cxx
1749 +++ oox/source/drawingml/chart/chartspaceconverter.cxx
1750 @@ -67,9 +67,12 @@ ChartSpaceConverter::~ChartSpaceConverter()
1752 void ChartSpaceConverter::convertFromModel()
1754 + if( !getChartConverter() )
1755 + return;
1757 /* create data provider (virtual function in the ChartConverter class,
1758 derived converters may create an external data provider) */
1759 - getChartConverter().createDataProvider( getChartDocument() );
1760 + getChartConverter()->createDataProvider( getChartDocument() );
1762 // attach number formatter of container document to data receiver
1764 diff --git oox/source/drawingml/chart/converterbase.cxx oox/source/drawingml/chart/converterbase.cxx
1765 index c9b91e3..c5509c2 100644
1766 --- oox/source/drawingml/chart/converterbase.cxx
1767 +++ oox/source/drawingml/chart/converterbase.cxx
1768 @@ -145,9 +145,9 @@ XmlFilterBase& ConverterRoot::getFilter() const
1769 return mxData->mrFilter;
1772 -ChartConverter& ConverterRoot::getChartConverter() const
1773 +ChartConverter* ConverterRoot::getChartConverter() const
1775 - return mxData->mrConverter;
1776 + return &mxData->mrConverter;
1779 Reference< XChartDocument > ConverterRoot::getChartDocument() const
1780 diff --git oox/source/drawingml/chart/datasourceconverter.cxx oox/source/drawingml/chart/datasourceconverter.cxx
1781 index be55030..ee880cc 100644
1782 --- oox/source/drawingml/chart/datasourceconverter.cxx
1783 +++ oox/source/drawingml/chart/datasourceconverter.cxx
1784 @@ -56,11 +56,15 @@ DataSequenceConverter::~DataSequenceConverter()
1785 Reference< XDataSequence > DataSequenceConverter::createDataSequence( const OUString& rRole )
1787 // create data sequence from data source model (virtual call at chart converter)
1788 - Reference< XDataSequence > xDataSeq = getChartConverter().createDataSequence( getChartDocument()->getDataProvider(), mrModel );
1789 + Reference< XDataSequence > xDataSeq;
1790 + if( getChartConverter() )
1792 + getChartConverter()->createDataSequence( getChartDocument()->getDataProvider(), mrModel );
1794 - // set sequence role
1795 - PropertySet aSeqProp( xDataSeq );
1796 - aSeqProp.setProperty( CREATE_OUSTRING( "Role" ), rRole );
1797 + // set sequence role
1798 + PropertySet aSeqProp( xDataSeq );
1799 + aSeqProp.setProperty( CREATE_OUSTRING( "Role" ), rRole );
1802 return xDataSeq;
1804 diff --git oox/source/drawingml/clrscheme.cxx oox/source/drawingml/clrscheme.cxx
1805 index 5aa23cd..e733649 100644
1806 --- oox/source/drawingml/clrscheme.cxx
1807 +++ oox/source/drawingml/clrscheme.cxx
1808 @@ -28,6 +28,7 @@
1810 ************************************************************************/
1812 +#include <osl/diagnose.h>
1813 #include "oox/drawingml/clrscheme.hxx"
1814 #include "tokens.hxx"
1816 @@ -64,6 +65,7 @@ ClrScheme::~ClrScheme()
1818 sal_Bool ClrScheme::getColor( sal_Int32 nSchemeClrToken, sal_Int32& rColor ) const
1820 + OSL_ASSERT((nSchemeClrToken & sal_Int32(0xFFFF0000))==0);
1821 switch( nSchemeClrToken )
1823 case XML_bg1 : nSchemeClrToken = XML_lt1; break;
1824 diff --git oox/source/drawingml/color.cxx oox/source/drawingml/color.cxx
1825 index b5b02cd..3931ea4 100644
1826 --- oox/source/drawingml/color.cxx
1827 +++ oox/source/drawingml/color.cxx
1828 @@ -116,6 +116,7 @@ Color::~Color()
1830 sal_Int32 Color::getPresetColor( sal_Int32 nToken )
1832 + OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
1833 switch( nToken )
1835 case XML_aliceBlue: return 0xF0F8FF;
1836 @@ -265,6 +266,8 @@ sal_Int32 Color::getPresetColor( sal_Int32 nToken )
1838 sal_Int32 Color::getSystemColor( sal_Int32 nToken, sal_Int32 nDefault )
1840 + OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
1842 //! TODO: get colors from system
1843 switch( nToken )
1845 @@ -381,6 +384,7 @@ sal_Int32 Color::getColor( const ::oox::core::XmlFilterBase& rFilter, sal_Int32
1847 for( TransformVec::const_iterator aIt = maTransforms.begin(), aEnd = maTransforms.end(); aIt != aEnd; ++aIt )
1849 + OSL_ASSERT((aIt->mnToken & sal_Int32(0xFFFF0000))==0);
1850 switch( aIt->mnToken )
1852 case XML_red: toCrgb(); lclSetValue( mnC1, aIt->mnValue ); break;
1853 diff --git oox/source/drawingml/customshapegeometry.cxx oox/source/drawingml/customshapegeometry.cxx
1854 index e4b99d6..b2a54e5 100644
1855 --- oox/source/drawingml/customshapegeometry.cxx
1856 +++ oox/source/drawingml/customshapegeometry.cxx
1857 @@ -269,8 +269,9 @@ void PathListContext::endFastElement( sal_Int32 aElementToken ) throw (SAXExcept
1859 // ---------------------------------------------------------------------
1861 -OUString GetShapeType( sal_Int32 nType )
1862 +OUString GetShapePresetType( sal_Int32 nType )
1864 + OSL_ASSERT((nType & sal_Int32(0xFFFF0000))==0);
1865 OUString sType;
1866 switch( nType )
1868 @@ -898,6 +899,7 @@ OUString GetShapeType( sal_Int32 nType )
1870 static OUString GetTextShapeType( sal_Int32 nType )
1872 + OSL_ASSERT((nType & sal_Int32(0xFFFF0000))==0);
1873 OUString sType;
1874 switch( nType )
1876 @@ -1104,7 +1106,7 @@ PresetShapeGeometryContext::PresetShapeGeometryContext( ContextHandler& rParent,
1877 OUString sShapeType;
1878 sal_Int32 nShapeType = xAttribs->getOptionalValueToken( XML_prst, FastToken::DONTKNOW );
1879 if ( nShapeType != FastToken::DONTKNOW )
1880 - sShapeType = GetShapeType( nShapeType );
1881 + sShapeType = GetShapePresetType( nShapeType );
1882 OSL_ENSURE( sShapeType.getLength(), "oox::drawingml::CustomShapeCustomGeometryContext::CustomShapeCustomGeometryContext(), unknown shape type" );
1883 mrCustomShapeProperties.setShapePresetType( sShapeType );
1885 diff --git oox/source/drawingml/diagram/constraintlistcontext.cxx oox/source/drawingml/diagram/constraintlistcontext.cxx
1886 new file mode 100644
1887 index 0000000..6ef7f18
1888 --- /dev/null
1889 +++ oox/source/drawingml/diagram/constraintlistcontext.cxx
1890 @@ -0,0 +1,102 @@
1891 +/*************************************************************************
1893 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
1894 + *
1895 + * Copyright 2008 by Sun Microsystems, Inc.
1897 + * OpenOffice.org - a multi-platform office productivity suite
1899 + * $RCSfile$
1900 + * $Revision$
1902 + * This file is part of OpenOffice.org.
1904 + * OpenOffice.org is free software: you can redistribute it and/or modify
1905 + * it under the terms of the GNU Lesser General Public License version 3
1906 + * only, as published by the Free Software Foundation.
1908 + * OpenOffice.org is distributed in the hope that it will be useful,
1909 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
1910 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1911 + * GNU Lesser General Public License version 3 for more details
1912 + * (a copy is included in the LICENSE file that accompanied this code).
1914 + * You should have received a copy of the GNU Lesser General Public License
1915 + * version 3 along with OpenOffice.org. If not, see
1916 + * <http://www.openoffice.org/license.html>
1917 + * for a copy of the LGPLv3 License.
1919 + ************************************************************************/
1921 +#include "constraintlistcontext.hxx"
1922 +#include "oox/helper/attributelist.hxx"
1923 +#include "oox/core/namespaces.hxx"
1925 +using namespace ::oox::core;
1926 +using namespace ::com::sun::star::uno;
1927 +using namespace ::com::sun::star::xml::sax;
1928 +using ::rtl::OUString;
1930 +namespace oox { namespace drawingml {
1932 +// CT_ConstraintLists
1933 +ConstraintListContext::ConstraintListContext( ContextHandler& rParent,
1934 + const Reference< XFastAttributeList >&,
1935 + const LayoutAtomPtr &pNode )
1936 + : ContextHandler( rParent )
1937 + , mpNode( pNode )
1939 + OSL_ENSURE( pNode, "Node must NOT be NULL" );
1943 +ConstraintListContext::~ConstraintListContext()
1947 +void SAL_CALL ConstraintListContext::endFastElement( ::sal_Int32 )
1948 + throw (SAXException, RuntimeException)
1952 +Reference< XFastContextHandler > SAL_CALL
1953 +ConstraintListContext::createFastChildContext( ::sal_Int32 aElement,
1954 + const Reference< XFastAttributeList >& xAttribs )
1955 + throw (SAXException, RuntimeException)
1957 + Reference< XFastContextHandler > xRet;
1959 + OUString aEmptyStr;
1961 + switch( aElement )
1963 + case NMSP_DIAGRAM|XML_constr:
1965 + ConstraintAtomPtr pNode( new ConstraintAtom() );
1966 + mpNode->addChild( pNode );
1968 + AttributeList aAttribs( xAttribs );
1969 + pNode->setFor( aAttribs.getToken( XML_for, XML_none ) );
1970 + pNode->setForName( aAttribs.getString( XML_forName, aEmptyStr ) );
1971 + pNode->setPointType( aAttribs.getToken( XML_ptType, XML_none ) );
1972 + pNode->setType( aAttribs.getToken( XML_type, XML_none ) );
1973 + pNode->setRefFor( aAttribs.getToken( XML_refFor, XML_none ) );
1974 + pNode->setRefForName( aAttribs.getString( XML_refForName, aEmptyStr ) );
1975 + pNode->setRefType( aAttribs.getToken( XML_refType, XML_none ) );
1976 + pNode->setRefPointType( aAttribs.getToken( XML_refPtType, XML_none ) );
1977 + pNode->setFactor( aAttribs.getDouble( XML_fact, 1.0 ) );
1978 + pNode->setValue( aAttribs.getDouble( XML_val, 0.0 ) );
1979 + pNode->setOperator( aAttribs.getToken( XML_op, XML_none ) );
1980 + break;
1982 + default:
1983 + break;
1985 + if( !xRet.is() )
1986 + xRet.set(this);
1988 + return xRet;
1992 +} }
1993 diff --git oox/source/drawingml/diagram/constraintlistcontext.hxx oox/source/drawingml/diagram/constraintlistcontext.hxx
1994 new file mode 100644
1995 index 0000000..7d48811
1996 --- /dev/null
1997 +++ oox/source/drawingml/diagram/constraintlistcontext.hxx
1998 @@ -0,0 +1,54 @@
1999 +/*************************************************************************
2001 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2002 + *
2003 + * Copyright 2008 by Sun Microsystems, Inc.
2005 + * OpenOffice.org - a multi-platform office productivity suite
2007 + * $RCSfile$
2008 + * $Revision$
2010 + * This file is part of OpenOffice.org.
2012 + * OpenOffice.org is free software: you can redistribute it and/or modify
2013 + * it under the terms of the GNU Lesser General Public License version 3
2014 + * only, as published by the Free Software Foundation.
2016 + * OpenOffice.org is distributed in the hope that it will be useful,
2017 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2018 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2019 + * GNU Lesser General Public License version 3 for more details
2020 + * (a copy is included in the LICENSE file that accompanied this code).
2022 + * You should have received a copy of the GNU Lesser General Public License
2023 + * version 3 along with OpenOffice.org. If not, see
2024 + * <http://www.openoffice.org/license.html>
2025 + * for a copy of the LGPLv3 License.
2027 + ************************************************************************/
2029 +#ifndef OOX_DRAWINGML_CONSTRAINTLISTCONTEXT_HXX
2030 +#define OOX_DRAWINGML_CONSTRAINTLISTCONTEXT_HXX
2032 +#include "oox/core/contexthandler.hxx"
2033 +#include "diagramlayoutatoms.hxx"
2034 +#include "diagram.hxx"
2036 +namespace oox { namespace drawingml {
2038 +class ConstraintListContext : public ::oox::core::ContextHandler
2040 +public:
2041 + ConstraintListContext( ContextHandler& rParent, const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes, const LayoutAtomPtr &pNode );
2042 + virtual ~ConstraintListContext();
2044 + virtual void SAL_CALL endFastElement( ::sal_Int32 Element ) throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
2045 + 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);
2046 +private:
2047 + LayoutAtomPtr mpNode;
2050 +} }
2052 +#endif
2053 diff --git oox/source/drawingml/diagram/datamodelcontext.cxx oox/source/drawingml/diagram/datamodelcontext.cxx
2054 index a3537bb..f9c0248 100644
2055 --- oox/source/drawingml/diagram/datamodelcontext.cxx
2056 +++ oox/source/drawingml/diagram/datamodelcontext.cxx
2057 @@ -28,7 +28,7 @@
2059 ************************************************************************/
2061 -#include "oox/drawingml/diagram/datamodelcontext.hxx"
2062 +#include "datamodelcontext.hxx"
2063 #include "oox/helper/attributelist.hxx"
2064 #include "oox/core/skipcontext.hxx"
2065 #include "oox/core/namespaces.hxx"
2066 @@ -43,43 +43,46 @@ using ::rtl::OUString;
2068 namespace oox { namespace drawingml {
2072 -// CL_Cxn
2073 -class CxnContext
2074 +// CT_CxnList
2075 +class CxnListContext
2076 : public ContextHandler
2078 public:
2079 - CxnContext( ContextHandler& rParent,
2080 - const Reference< XFastAttributeList >& xAttribs,
2081 - const dgm::ConnectionPtr & pConnection )
2082 + CxnListContext( ContextHandler& rParent, dgm::Connections & aConnections )
2083 : ContextHandler( rParent )
2084 - , mpConnection( pConnection )
2085 + , mrConnections( aConnections )
2087 - sal_Int32 nType = xAttribs->getOptionalValueToken( XML_type, XML_parOf );
2088 - pConnection->mnType = nType;
2089 - pConnection->msModelId = xAttribs->getOptionalValue( XML_modelId );
2090 - pConnection->msSourceId = xAttribs->getOptionalValue( XML_srcId );
2091 - pConnection->msDestId = xAttribs->getOptionalValue( XML_destId );
2092 - pConnection->msPresId = xAttribs->getOptionalValue( XML_presId );
2093 - pConnection->msSibTransId = xAttribs->getOptionalValue( XML_sibTransId );
2094 - AttributeList attribs( xAttribs );
2095 - pConnection->mnSourceOrder = attribs.getInteger( XML_srcOrd, 0 );
2096 - pConnection->mnDestOrder = attribs.getInteger( XML_destOrd, 0 );
2099 virtual Reference< XFastContextHandler > SAL_CALL
2100 createFastChildContext( sal_Int32 aElementToken,
2101 - const Reference< XFastAttributeList >& /*xAttribs*/ )
2102 + const Reference< XFastAttributeList >& xAttribs )
2103 throw (SAXException, RuntimeException)
2105 Reference< XFastContextHandler > xRet;
2107 switch( aElementToken )
2109 - case NMSP_DIAGRAM|XML_extLst:
2110 + case NMSP_DIAGRAM|XML_cxn:
2112 + mrConnections.push_back( dgm::Connection() );
2113 + dgm::Connection& rConnection=mrConnections.back();
2115 + const sal_Int32 nType = xAttribs->getOptionalValueToken( XML_type, XML_parOf );
2116 + rConnection.mnType = nType;
2117 + rConnection.msModelId = xAttribs->getOptionalValue( XML_modelId );
2118 + rConnection.msSourceId = xAttribs->getOptionalValue( XML_srcId );
2119 + rConnection.msDestId = xAttribs->getOptionalValue( XML_destId );
2120 + rConnection.msPresId = xAttribs->getOptionalValue( XML_presId );
2121 + rConnection.msSibTransId = xAttribs->getOptionalValue( XML_sibTransId );
2122 + rConnection.msParTransId = xAttribs->getOptionalValue( XML_parTransId );
2123 + const AttributeList attribs( xAttribs );
2124 + rConnection.mnSourceOrder = attribs.getInteger( XML_srcOrd, 0 );
2125 + rConnection.mnDestOrder = attribs.getInteger( XML_destOrd, 0 );
2127 + // skip CT_extLst
2128 xRet.set( new SkipContext( *this ) );
2129 break;
2131 default:
2132 break;
2134 @@ -87,35 +90,135 @@ public:
2135 xRet.set( this );
2136 return xRet;
2139 private:
2140 - dgm::ConnectionPtr mpConnection;
2141 + dgm::Connections& mrConnections;
2145 -// CT_CxnList
2146 -class CxnListContext
2147 +// CT_presLayoutVars
2148 +class PresLayoutVarsContext
2149 : public ContextHandler
2151 public:
2152 - CxnListContext( ContextHandler& rParent, dgm::Connections & aConnections )
2153 - : ContextHandler( rParent )
2154 - , maConnections( aConnections )
2155 + PresLayoutVarsContext( ContextHandler& rParent,
2156 + dgm::Point & rPoint ) :
2157 + ContextHandler( rParent ),
2158 + mrPoint( rPoint )
2161 + virtual Reference< XFastContextHandler > SAL_CALL
2162 + createFastChildContext( sal_Int32 aElementToken,
2163 + const Reference< XFastAttributeList >& xAttribs )
2164 + throw (SAXException, RuntimeException)
2166 + Reference< XFastContextHandler > xRet;
2167 + AttributeList aAttribs( xAttribs );
2169 + switch( aElementToken )
2171 + // TODO
2172 + case NMSP_DIAGRAM|XML_animLvl:
2173 + case NMSP_DIAGRAM|XML_animOne:
2174 + break;
2175 + case NMSP_DIAGRAM|XML_bulletEnabled:
2176 + mrPoint.mbBulletEnabled = aAttribs.getBool( XML_val, false );
2177 + break;
2178 + case NMSP_DIAGRAM|XML_chMax:
2179 + mrPoint.mnMaxChildren = aAttribs.getInteger( XML_val, -1 );
2180 + break;
2181 + case NMSP_DIAGRAM|XML_chPref:
2182 + mrPoint.mnPreferredChildren = aAttribs.getInteger( XML_val, -1 );
2183 + break;
2184 + case NMSP_DIAGRAM|XML_dir:
2185 + mrPoint.mnDirection = aAttribs.getToken( XML_val, XML_norm );
2186 + break;
2187 + case NMSP_DIAGRAM|XML_hierBranch:
2188 + mrPoint.mnHierarchyBranch = aAttribs.getToken( XML_val, XML_std );
2189 + break;
2190 + case NMSP_DIAGRAM|XML_orgChart:
2191 + mrPoint.mbOrgChartEnabled = aAttribs.getBool( XML_val, false );
2192 + break;
2193 + case NMSP_DIAGRAM|XML_resizeHandles:
2194 + mrPoint.mnResizeHandles = aAttribs.getToken( XML_val, XML_rel );
2195 + break;
2196 + default:
2197 + break;
2199 + if( !xRet.is() )
2200 + xRet.set( this );
2201 + return xRet;
2204 +private:
2205 + dgm::Point& mrPoint;
2209 +// CT_prSet
2210 +class PropertiesContext
2211 + : public ContextHandler
2213 +public:
2214 + PropertiesContext( ContextHandler& rParent,
2215 + dgm::Point & rPoint,
2216 + const Reference< XFastAttributeList >& xAttribs ) :
2217 + ContextHandler( rParent ),
2218 + mrPoint( rPoint )
2220 + OUString aEmptyStr;
2221 + AttributeList aAttribs( xAttribs );
2223 + mrPoint.msColorTransformCategoryId = aAttribs.getString( XML_csCatId, aEmptyStr );
2224 + mrPoint.msColorTransformTypeId = aAttribs.getString( XML_csTypeId, aEmptyStr );
2225 + mrPoint.msLayoutCategoryId = aAttribs.getString( XML_loCatId, aEmptyStr );
2226 + mrPoint.msLayoutTypeId = aAttribs.getString( XML_loTypeId, aEmptyStr );
2227 + mrPoint.msPlaceholderText = aAttribs.getString( XML_phldrT, aEmptyStr );
2228 + mrPoint.msPresentationAssociationId = aAttribs.getString( XML_presAssocID, aEmptyStr );
2229 + mrPoint.msPresentationLayoutName = aAttribs.getString( XML_presName, aEmptyStr );
2230 + mrPoint.msPresentationLayoutStyleLabel = aAttribs.getString( XML_presStyleLbl, aEmptyStr );
2231 + mrPoint.msQuickStyleCategoryId = aAttribs.getString( XML_qsCatId, aEmptyStr );
2232 + mrPoint.msQuickStyleTypeId = aAttribs.getString( XML_qsTypeId, aEmptyStr );
2234 + mrPoint.mnCustomAngle = aAttribs.getInteger( XML_custAng, -1 );
2235 + mrPoint.mnPercentageNeighbourWidth = aAttribs.getInteger( XML_custLinFactNeighborX, -1 );
2236 + mrPoint.mnPercentageNeighbourHeight = aAttribs.getInteger( XML_custLinFactNeighborY, -1 );
2237 + mrPoint.mnPercentageOwnWidth = aAttribs.getInteger( XML_custLinFactX, -1 );
2238 + mrPoint.mnPercentageOwnHeight = aAttribs.getInteger( XML_custLinFactY, -1 );
2239 + mrPoint.mnIncludeAngleScale = aAttribs.getInteger( XML_custRadScaleInc, -1 );
2240 + mrPoint.mnRadiusScale = aAttribs.getInteger( XML_custRadScaleRad, -1 );
2241 + mrPoint.mnWidthScale = aAttribs.getInteger( XML_custScaleX, -1 );
2242 + mrPoint.mnHeightScale = aAttribs.getInteger( XML_custScaleY, -1 );
2243 + mrPoint.mnWidthOverride = aAttribs.getInteger( XML_custSzX, -1 );
2244 + mrPoint.mnHeightOverride = aAttribs.getInteger( XML_custSzY, -1 );
2245 + mrPoint.mnLayoutStyleCount = aAttribs.getInteger( XML_presStyleCnt, -1 );
2246 + mrPoint.mnLayoutStyleIndex = aAttribs.getInteger( XML_presStyleIdx, -1 );
2248 + mrPoint.mbCoherent3DOffset = aAttribs.getBool( XML_coherent3DOff, false );
2249 + mrPoint.mbCustomHorizontalFlip = aAttribs.getBool( XML_custFlipHor, false );
2250 + mrPoint.mbCustomVerticalFlip = aAttribs.getBool( XML_custFlipVert, false );
2251 + mrPoint.mbCustomText = aAttribs.getBool( XML_custT, false );
2252 + mrPoint.mbIsPlaceholder = aAttribs.getBool( XML_phldr, false );
2254 virtual Reference< XFastContextHandler > SAL_CALL
2255 createFastChildContext( sal_Int32 aElementToken,
2256 - const Reference< XFastAttributeList >& xAttribs )
2257 + const Reference< XFastAttributeList >& )
2258 throw (SAXException, RuntimeException)
2260 Reference< XFastContextHandler > xRet;
2262 switch( aElementToken )
2264 - case NMSP_DIAGRAM|XML_cxn:
2265 + case NMSP_DIAGRAM|XML_presLayoutVars:
2267 + xRet.set( new PresLayoutVarsContext( *this, mrPoint ) );
2268 + break;
2270 + case NMSP_DIAGRAM|XML_style:
2272 - dgm::ConnectionPtr pConnection( new dgm::Connection() );
2273 - maConnections.push_back( pConnection );
2274 - xRet.set( new CxnContext( *this, xAttribs, pConnection ) );
2275 + // TODO
2276 + // skip CT_shapeStyle
2277 + xRet.set( new SkipContext( *this ) );
2278 break;
2280 default:
2281 @@ -127,11 +230,10 @@ public:
2284 private:
2285 - dgm::Connections & maConnections;
2286 + dgm::Point& mrPoint;
2291 // CL_Pt
2292 class PtContext
2293 : public ContextHandler
2294 @@ -139,27 +241,25 @@ class PtContext
2295 public:
2296 PtContext( ContextHandler& rParent,
2297 const Reference< XFastAttributeList >& xAttribs,
2298 - const dgm::PointPtr & pPoint)
2299 - : ContextHandler( rParent )
2300 - , mpPoint( pPoint )
2302 - mpPoint->setModelId( xAttribs->getOptionalValue( XML_modelId ) );
2303 - //
2304 - // the default type is XML_node
2305 - sal_Int32 nType = xAttribs->getOptionalValueToken( XML_type, XML_node );
2306 - mpPoint->setType( nType );
2308 - // ignore the cxnId unless it is this type. See 5.15.3.1.3 in Primer
2309 - if( ( nType == XML_parTrans ) || ( nType == XML_sibTrans ) )
2311 - mpPoint->setCnxId( xAttribs->getOptionalValue( XML_cxnId ) );
2314 + dgm::Point & rPoint):
2315 + ContextHandler( rParent ),
2316 + mrPoint( rPoint )
2318 + mrPoint.msModelId = xAttribs->getOptionalValue( XML_modelId );
2320 + // the default type is XML_node
2321 + const sal_Int32 nType = xAttribs->getOptionalValueToken( XML_type, XML_node );
2322 + mrPoint.mnType = nType;
2324 + // ignore the cxnId unless it is this type. See 5.15.3.1.3 in Primer
2325 + if( ( nType == XML_parTrans ) || ( nType == XML_sibTrans ) )
2326 + mrPoint.msCnxId = xAttribs->getOptionalValue( XML_cxnId );
2330 virtual Reference< XFastContextHandler > SAL_CALL
2331 createFastChildContext( sal_Int32 aElementToken,
2332 - const Reference< XFastAttributeList >& /*xAttribs*/ )
2333 + const Reference< XFastAttributeList >& xAttribs )
2334 throw (SAXException, RuntimeException)
2336 Reference< XFastContextHandler > xRet;
2337 @@ -170,18 +270,22 @@ public:
2338 xRet.set( new SkipContext( *this ) );
2339 break;
2340 case NMSP_DIAGRAM|XML_prSet:
2341 - // TODO
2342 - // CT_ElemPropSet
2343 + OSL_TRACE( "diagram property set for point");
2344 + xRet = new PropertiesContext( *this, mrPoint, xAttribs );
2345 break;
2346 case NMSP_DIAGRAM|XML_spPr:
2347 OSL_TRACE( "shape props for point");
2348 - xRet = new ShapePropertiesContext( *this, *mpPoint->getShape() );
2349 + if( !mrPoint.mpShape )
2350 + mrPoint.mpShape.reset( new Shape() );
2351 + xRet = new ShapePropertiesContext( *this, *(mrPoint.mpShape) );
2352 break;
2353 case NMSP_DIAGRAM|XML_t:
2355 OSL_TRACE( "shape text body for point");
2356 TextBodyPtr xTextBody( new TextBody );
2357 - mpPoint->getShape()->setTextBody( xTextBody );
2358 + if( !mrPoint.mpShape )
2359 + mrPoint.mpShape.reset( new Shape() );
2360 + mrPoint.mpShape->setTextBody( xTextBody );
2361 xRet = new TextBodyContext( *this, *xTextBody );
2362 break;
2364 @@ -194,7 +298,7 @@ public:
2367 private:
2368 - dgm::PointPtr mpPoint;
2369 + dgm::Point& mrPoint;
2373 @@ -204,11 +308,10 @@ class PtListContext
2374 : public ContextHandler
2376 public:
2377 - PtListContext( ContextHandler& rParent, dgm::Points & aPoints)
2378 - : ContextHandler( rParent )
2379 - , maPoints( aPoints )
2382 + PtListContext( ContextHandler& rParent, dgm::Points& rPoints) :
2383 + ContextHandler( rParent ),
2384 + mrPoints( rPoints )
2385 + {}
2386 virtual Reference< XFastContextHandler > SAL_CALL
2387 createFastChildContext( sal_Int32 aElementToken,
2388 const Reference< XFastAttributeList >& xAttribs )
2389 @@ -221,9 +324,8 @@ public:
2390 case NMSP_DIAGRAM|XML_pt:
2392 // CT_Pt
2393 - dgm::PointPtr pPoint( new dgm::Point() );
2394 - maPoints.push_back( pPoint );
2395 - xRet.set( new PtContext( *this, xAttribs, pPoint ) );
2396 + mrPoints.push_back( dgm::Point() );
2397 + xRet.set( new PtContext( *this, xAttribs, mrPoints.back() ) );
2398 break;
2400 default:
2401 @@ -235,7 +337,7 @@ public:
2404 private:
2405 - dgm::Points & maPoints;
2406 + dgm::Points& mrPoints;
2409 // CT_BackgroundFormatting
2410 diff --git oox/source/drawingml/diagram/datamodelcontext.hxx oox/source/drawingml/diagram/datamodelcontext.hxx
2411 new file mode 100644
2412 index 0000000..526385b
2413 --- /dev/null
2414 +++ oox/source/drawingml/diagram/datamodelcontext.hxx
2415 @@ -0,0 +1,57 @@
2416 +/*************************************************************************
2418 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
2419 + *
2420 + * Copyright 2008 by Sun Microsystems, Inc.
2422 + * OpenOffice.org - a multi-platform office productivity suite
2424 + * $RCSfile: datamodelcontext.hxx,v $
2425 + * $Revision: 1.4 $
2427 + * This file is part of OpenOffice.org.
2429 + * OpenOffice.org is free software: you can redistribute it and/or modify
2430 + * it under the terms of the GNU Lesser General Public License version 3
2431 + * only, as published by the Free Software Foundation.
2433 + * OpenOffice.org is distributed in the hope that it will be useful,
2434 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
2435 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
2436 + * GNU Lesser General Public License version 3 for more details
2437 + * (a copy is included in the LICENSE file that accompanied this code).
2439 + * You should have received a copy of the GNU Lesser General Public License
2440 + * version 3 along with OpenOffice.org. If not, see
2441 + * <http://www.openoffice.org/license.html>
2442 + * for a copy of the LGPLv3 License.
2444 + ************************************************************************/
2447 +#ifndef OOX_DRAWINGML_SHAPECONTEXT_HXX
2448 +#define OOX_DRAWINGML_SHAPECONTEXT_HXX
2450 +#include <com/sun/star/drawing/XShapes.hpp>
2452 +#include "oox/core/contexthandler.hxx"
2453 +#include "diagram.hxx"
2455 +namespace oox { namespace drawingml {
2457 +// CT_DataModel
2458 +class DataModelContext : public ::oox::core::ContextHandler
2460 +public:
2461 + DataModelContext( ::oox::core::ContextHandler& rParent, const DiagramDataPtr & pDataModelPtr );
2462 + virtual ~DataModelContext();
2464 + 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);
2466 +protected:
2467 + DiagramDataPtr mpDataModel;
2470 +} }
2472 +#endif // OOX_DRAWINGML_SHAPEGROUPCONTEXT_HXX
2473 diff --git oox/source/drawingml/diagram/diagram.cxx oox/source/drawingml/diagram/diagram.cxx
2474 index 3bb89a2..2045633 100644
2475 --- oox/source/drawingml/diagram/diagram.cxx
2476 +++ oox/source/drawingml/diagram/diagram.cxx
2477 @@ -34,10 +34,22 @@
2479 #include <com/sun/star/awt/Point.hpp>
2480 #include <com/sun/star/awt/Size.hpp>
2481 +#include <com/sun/star/xml/dom/XDocument.hpp>
2482 +#include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
2483 +#include <rtl/ustrbuf.hxx>
2484 +#include "oox/drawingml/textbody.hxx"
2485 +#include "oox/drawingml/textparagraph.hxx"
2486 +#include "oox/drawingml/textrun.hxx"
2487 #include "oox/drawingml/diagram/diagram.hxx"
2488 #include "oox/drawingml/fillproperties.hxx"
2489 #include "oox/core/namespaces.hxx"
2490 #include "tokens.hxx"
2491 +#include "diagram.hxx"
2492 +#include "diagramlayoutatoms.hxx"
2493 +#include "diagramfragmenthandler.hxx"
2495 +#include <iostream>
2496 +#include <fstream>
2498 using rtl::OUString;
2499 using namespace ::com::sun::star;
2500 @@ -49,58 +61,26 @@ namespace dgm {
2502 void Connection::dump()
2504 - OSL_TRACE("dgm: cnx modelId %s, srcId %s, dstId %s",
2505 - OUSTRING_TO_CSTR( msModelId ),
2506 + OSL_TRACE("dgm: cnx modelId %s, srcId %s, dstId %s, parTransId %s, presId %s, sibTransId %s, srcOrd %d, dstOrd %d",
2507 + OUSTRING_TO_CSTR( msModelId ),
2508 OUSTRING_TO_CSTR( msSourceId ),
2509 - OUSTRING_TO_CSTR( msDestId ) );
2512 -Point::Point()
2513 - : mpShape( new Shape( "com.sun.star.drawing.GraphicObjectShape" ) )
2514 - , mnType( 0 )
2516 + OUSTRING_TO_CSTR( msDestId ),
2517 + OUSTRING_TO_CSTR( msParTransId ),
2518 + OUSTRING_TO_CSTR( msPresId ),
2519 + OUSTRING_TO_CSTR( msSibTransId ),
2520 + mnSourceOrder,
2521 + mnDestOrder );
2524 void Point::dump()
2526 - OSL_TRACE( "dgm: pt cnxId %s, modelId %s",
2527 + OSL_TRACE( "dgm: pt text %x, cnxId %s, modelId %s, type %d",
2528 + mpShape.get(),
2529 OUSTRING_TO_CSTR( msCnxId ),
2530 - OUSTRING_TO_CSTR( msModelId ) );
2533 -void Point::setModelId( const ::rtl::OUString & sModelId )
2535 - msModelId = sModelId;
2536 - mpShape->setName( msModelId );
2540 -bool PointsTree::addChild( const PointsTreePtr & pChild )
2542 - bool added = false;
2544 - OSL_ENSURE( pChild->mpParent.expired(), "can't add, has already a parent" );
2545 - OSL_ENSURE( mpNode, "has no node" );
2546 - if( mpNode && pChild->mpParent.expired() )
2548 - pChild->mpParent = shared_from_this();
2549 - maChildrens.push_back( pChild );
2550 - added = true;
2553 - return added;
2556 -PointsTreePtr PointsTree::getParent() const
2558 - if( !mpParent.expired() )
2560 - return mpParent.lock() ;
2562 - return PointsTreePtr();
2563 + OUSTRING_TO_CSTR( msModelId ),
2564 + mnType );
2568 } // dgm namespace
2570 DiagramData::DiagramData()
2571 @@ -118,18 +98,10 @@ void DiagramData::dump()
2572 boost::bind( &dgm::Point::dump, _1 ) );
2575 -static void setPosition( const dgm::PointPtr & pPoint, const awt::Point & pt )
2577 - ShapePtr pShape = pPoint->getShape();
2578 - awt::Size sz;
2579 - sz.Width = 50;
2580 - sz.Height = 50;
2581 - pShape->setPosition( pt );
2582 - pShape->setSize( sz );
2585 -void DiagramLayout::layout( const dgm::PointsTreePtr & pTree, const awt::Point & pt )
2586 +void DiagramLayout::layout( const dgm::Points & pTree, const awt::Point & pt )
2588 + // TODO
2589 +#if 0
2590 setPosition( pTree->getPoint(), pt );
2591 awt::Point nextPt = pt;
2592 nextPt.Y += 50;
2593 @@ -139,6 +111,7 @@ void DiagramLayout::layout( const dgm::PointsTreePtr & pTree, const awt::Point &
2594 layout( *iter, nextPt );
2595 nextPt.X += 50;
2597 +#endif
2600 void Diagram::setData( const DiagramDataPtr & pData)
2601 @@ -152,19 +125,244 @@ void Diagram::setLayout( const DiagramLayoutPtr & pLayout)
2602 mpLayout = pLayout;
2605 -void Diagram::setQStyles( const DiagramQStylesPtr & pStyles)
2606 +#if OSL_DEBUG_LEVEL > 1
2607 +rtl::OString normalizeDotName( const rtl::OUString& rStr )
2609 - mpQStyles = pStyles;
2611 + rtl::OUStringBuffer aBuf;
2612 + aBuf.append((sal_Unicode)'N');
2614 + const sal_Int32 nLen(rStr.getLength());
2615 + sal_Int32 nCurrIndex(0);
2616 + while( nCurrIndex < nLen )
2618 + const sal_Int32 aChar=rStr.iterateCodePoints(&nCurrIndex);
2619 + if( aChar != '-' && aChar != '{' && aChar != '}' )
2620 + aBuf.append((sal_Unicode)aChar);
2623 + return rtl::OUStringToOString(aBuf.makeStringAndClear(),
2624 + RTL_TEXTENCODING_UTF8);
2626 +#endif
2628 -void Diagram::setColors( const DiagramColorsPtr & pColors)
2629 +static sal_Int32 calcDepth( const rtl::OUString& rNodeName,
2630 + const dgm::Connections& rCnx )
2632 - mpColors = pColors;
2633 + // find length of longest path in 'isChild' graph, ending with rNodeName
2634 + dgm::Connections::const_iterator aCurrCxn( rCnx.begin() );
2635 + const dgm::Connections::const_iterator aEndCxn( rCnx.end() );
2636 + while( aCurrCxn != aEndCxn )
2638 + if( aCurrCxn->msParTransId.getLength() &&
2639 + aCurrCxn->msSibTransId.getLength() &&
2640 + aCurrCxn->msSourceId.getLength() &&
2641 + aCurrCxn->msDestId.getLength() &&
2642 + aCurrCxn->mnType != XML_presOf &&
2643 + aCurrCxn->mnType != XML_presParOf &&
2644 + rNodeName == aCurrCxn->msDestId )
2646 + return calcDepth(aCurrCxn->msSourceId,
2647 + rCnx) + 1;
2649 + ++aCurrCxn;
2652 + return 0;
2656 void Diagram::build( )
2658 + // build name-object maps
2659 + // ======================
2661 +#if OSL_DEBUG_LEVEL > 1
2662 + std::ofstream output("/tmp/tree.dot");
2664 + output << "digraph datatree {" << std::endl;
2665 +#endif
2667 + dgm::Points::iterator aCurrPoint( getData()->getPoints( ).begin() );
2668 + const dgm::Points::iterator aEndPoint( getData()->getPoints( ).end() );
2669 + while( aCurrPoint != aEndPoint )
2671 +#if OSL_DEBUG_LEVEL > 1
2672 + output << "\t"
2673 + << normalizeDotName(aCurrPoint->msModelId).getStr()
2674 + << "[";
2676 + if( aCurrPoint->msPresentationLayoutName.getLength() )
2677 + output << "label=\""
2678 + << rtl::OUStringToOString(
2679 + aCurrPoint->msPresentationLayoutName,
2680 + RTL_TEXTENCODING_UTF8).getStr() << "\", ";
2681 + else
2682 + output << "label=\""
2683 + << rtl::OUStringToOString(
2684 + aCurrPoint->msModelId,
2685 + RTL_TEXTENCODING_UTF8).getStr() << "\", ";
2687 + switch( aCurrPoint->mnType )
2689 + case XML_doc: output << "style=filled, color=red"; break;
2690 + case XML_asst: output << "style=filled, color=green"; break;
2691 + default:
2692 + case XML_node: output << "style=filled, color=blue"; break;
2693 + case XML_pres: output << "style=filled, color=yellow"; break;
2694 + case XML_parTrans: output << "color=grey"; break;
2695 + case XML_sibTrans: output << " "; break;
2698 + output << "];" << std::endl;
2700 + // does currpoint have any text set?
2701 + if( aCurrPoint->mpShape &&
2702 + aCurrPoint->mpShape->getTextBody() &&
2703 + !aCurrPoint->mpShape->getTextBody()->getParagraphs().empty() &&
2704 + !aCurrPoint->mpShape->getTextBody()->getParagraphs().front()->getRuns().empty() )
2706 + static sal_Int32 nCount=0;
2708 + output << "\t"
2709 + << "textNode" << nCount
2710 + << " ["
2711 + << "label=\""
2712 + << rtl::OUStringToOString(
2713 + aCurrPoint->mpShape->getTextBody()->getParagraphs().front()->getRuns().front()->getText(),
2714 + RTL_TEXTENCODING_UTF8).getStr()
2715 + << "\"" << "];" << std::endl;
2716 + output << "\t"
2717 + << normalizeDotName(aCurrPoint->msModelId).getStr()
2718 + << " -> "
2719 + << "textNode" << nCount++
2720 + << ";" << std::endl;
2724 +#if 0
2725 + // msPresentationAssociationId does not appear to be
2726 + // valid/used, the relation this imposed for several examples
2727 + // was ~broken
2728 + if( aCurrPoint->msPresentationAssociationId.getLength() )
2729 + output << "\t"
2730 + << normalizeDotName(aCurrPoint->msModelId).getStr()
2731 + << " -> "
2732 + << normalizeDotName(aCurrPoint->msPresentationAssociationId).getStr()
2733 + << " [style=dotted, color=red, "
2734 + << "label=\"presAssocID\"];" << std::endl;
2735 +#endif
2737 +#endif
2739 + const bool bInserted1=getData()->getPointNameMap().insert(
2740 + std::make_pair(aCurrPoint->msModelId,&(*aCurrPoint))).second;
2741 + (void)bInserted1;
2743 + OSL_ENSURE(bInserted1,"Diagram::build(): non-unique point model id");
2745 + if( aCurrPoint->msPresentationLayoutName.getLength() )
2747 + DiagramData::PointsNameMap::value_type::second_type& rVec=
2748 + getData()->getPointsPresNameMap()[aCurrPoint->msPresentationLayoutName];
2749 + rVec.push_back(&(*aCurrPoint));
2751 + ++aCurrPoint;
2754 + dgm::Connections::const_iterator aCurrCxn( getData()->getConnections( ).begin() );
2755 + const dgm::Connections::const_iterator aEndCxn( getData()->getConnections( ).end() );
2756 + while( aCurrCxn != aEndCxn )
2758 +#if OSL_DEBUG_LEVEL > 1
2759 + if( aCurrCxn->msParTransId.getLength() ||
2760 + aCurrCxn->msSibTransId.getLength() )
2762 + if( aCurrCxn->msSourceId.getLength() ||
2763 + aCurrCxn->msDestId.getLength() )
2765 + output << "\t"
2766 + << normalizeDotName(aCurrCxn->msSourceId).getStr()
2767 + << " -> "
2768 + << normalizeDotName(aCurrCxn->msParTransId).getStr()
2769 + << " -> "
2770 + << normalizeDotName(aCurrCxn->msSibTransId).getStr()
2771 + << " -> "
2772 + << normalizeDotName(aCurrCxn->msDestId).getStr()
2773 + << " [style=dotted,"
2774 + << ((aCurrCxn->mnType == XML_presOf) ? " color=red, " : ((aCurrCxn->mnType == XML_presParOf) ? " color=green, " : " "))
2775 + << "label=\""
2776 + << rtl::OUStringToOString(aCurrCxn->msModelId,
2777 + RTL_TEXTENCODING_UTF8 ).getStr()
2778 + << "\"];" << std::endl;
2780 + else
2782 + output << "\t"
2783 + << normalizeDotName(aCurrCxn->msParTransId).getStr()
2784 + << " -> "
2785 + << normalizeDotName(aCurrCxn->msSibTransId).getStr()
2786 + << " ["
2787 + << ((aCurrCxn->mnType == XML_presOf) ? " color=red, " : ((aCurrCxn->mnType == XML_presParOf) ? " color=green, " : " "))
2788 + << "label=\""
2789 + << rtl::OUStringToOString(aCurrCxn->msModelId,
2790 + RTL_TEXTENCODING_UTF8 ).getStr()
2791 + << "\"];" << std::endl;
2794 + else if( aCurrCxn->msSourceId.getLength() ||
2795 + aCurrCxn->msDestId.getLength() )
2796 + output << "\t"
2797 + << normalizeDotName(aCurrCxn->msSourceId).getStr()
2798 + << " -> "
2799 + << normalizeDotName(aCurrCxn->msDestId).getStr()
2800 + << " [label=\""
2801 + << rtl::OUStringToOString(aCurrCxn->msModelId,
2802 + RTL_TEXTENCODING_UTF8 ).getStr()
2803 + << ((aCurrCxn->mnType == XML_presOf) ? "\", color=red]" : ((aCurrCxn->mnType == XML_presParOf) ? "\", color=green]" : "\"]"))
2804 + << ";" << std::endl;
2805 +#endif
2807 + const bool bInserted1=getData()->getConnectionNameMap().insert(
2808 + std::make_pair(aCurrCxn->msModelId,&(*aCurrCxn))).second;
2809 + (void)bInserted1;
2811 + OSL_ENSURE(bInserted1,"Diagram::build(): non-unique connection model id");
2813 + if( aCurrCxn->mnType == XML_presOf )
2815 + DiagramData::StringMap::value_type::second_type& rVec=getData()->getPresOfNameMap()[aCurrCxn->msDestId];
2816 + rVec.push_back(
2817 + std::make_pair(
2818 + aCurrCxn->msSourceId,sal_Int32(0)));
2821 + ++aCurrCxn;
2824 + // assign outline levels
2825 + DiagramData::StringMap::iterator aPresOfIter=getData()->getPresOfNameMap().begin();
2826 + const DiagramData::StringMap::iterator aPresOfEnd=getData()->getPresOfNameMap().end();
2827 + while( aPresOfIter != aPresOfEnd )
2829 + DiagramData::StringMap::value_type::second_type::iterator aPresOfNodeIterCalcLevel=aPresOfIter->second.begin();
2830 + const DiagramData::StringMap::value_type::second_type::iterator aPresOfNodeEnd=aPresOfIter->second.end();
2831 + while(aPresOfNodeIterCalcLevel != aPresOfNodeEnd)
2833 + const sal_Int32 nDepth=calcDepth(aPresOfNodeIterCalcLevel->first,
2834 + getData()->getConnections());
2835 + aPresOfNodeIterCalcLevel->second = nDepth != 0 ? nDepth : -1;
2836 + ++aPresOfNodeIterCalcLevel;
2839 + ++aPresOfIter;
2842 +#if OSL_DEBUG_LEVEL > 1
2843 + output << "}" << std::endl;
2844 +#endif
2846 + // TODO
2847 +#if 0
2848 OSL_TRACE( "building diagram" );
2849 typedef std::map< OUString, dgm::PointPtr > PointsMap;
2850 PointsMap aPointsMap;
2851 @@ -240,30 +438,33 @@ void Diagram::build( )
2853 // check bounds
2854 OSL_ENSURE( aRoots.size() == 1, "more than one root" );
2855 - // #i92239# roots may be empty
2856 - if( !aRoots.empty() )
2858 - mpRoot = aRoots.begin()->second;
2859 - OSL_TRACE( "root is %s", OUSTRING_TO_CSTR( mpRoot->getPoint()->getModelId() ) );
2860 - for( PointsTreeMap::iterator iter = aTreeMap.begin();
2861 - iter != aTreeMap.end(); iter++ )
2863 - if(! iter->second->getParent() )
2865 - OSL_TRACE("node without parent %s", OUSTRING_TO_CSTR( iter->first ) );
2869 + mpRoot = aRoots.begin()->second;
2870 + OSL_TRACE( "root is %s", OUSTRING_TO_CSTR( mpRoot->getPoint()->getModelId() ) );
2871 + for( PointsTreeMap::iterator iter = aTreeMap.begin();
2872 + iter != aTreeMap.end(); iter++ )
2874 + if(! iter->second->getParent() )
2876 + OSL_TRACE("node without parent %s", OUSTRING_TO_CSTR( iter->first ) );
2879 +#endif
2883 void Diagram::addTo( const ShapePtr & pParentShape )
2885 + // collect data, init maps
2886 + build( );
2888 + // create Shape hierarchy
2889 + ShapeCreationVisitor aCreationVisitor(pParentShape, *this);
2890 + mpLayout->getNode()->accept(aCreationVisitor);
2892 +#if 0
2893 dgm::Points & aPoints( mpData->getPoints( ) );
2894 dgm::Points::iterator aPointsIter;
2895 - build( );
2896 - if( mpRoot.get() )
2897 - mpLayout->layout( mpRoot, awt::Point( 0, 0 ) );
2898 + mpLayout->layout( mpRoot, awt::Point( 0, 0 ) );
2900 for( aPointsIter = aPoints.begin(); aPointsIter != aPoints.end(); ++aPointsIter )
2902 @@ -286,6 +487,7 @@ void Diagram::addTo( const ShapePtr & pParentShape )
2904 OSL_TRACE( "Dgm: shape name %s", OUSTRING_TO_CSTR( (*iter)->getName() ) );
2906 +#endif
2909 OUString Diagram::getLayoutId() const
2910 @@ -298,5 +500,155 @@ OUString Diagram::getLayoutId() const
2911 return sLayoutId;
2914 +uno::Reference<xml::dom::XDocument> loadFragment(
2915 + core::XmlFilterBase& rFilter,
2916 + const rtl::Reference< core::FragmentHandler >& rxHandler )
2918 + // load diagramming fragments into DOM representation, that later
2919 + // gets serialized back to SAX events and parsed
2920 + return rFilter.importFragment( rxHandler->getFragmentPath() );
2923 +void importFragment( core::XmlFilterBase& rFilter,
2924 + const uno::Reference<xml::dom::XDocument>& rXDom,
2925 + const char* pPropName,
2926 + const ShapePtr& pShape,
2927 + const rtl::Reference< core::FragmentHandler >& rxHandler )
2929 + uno::Reference<xml::sax::XFastSAXSerializable> xSerializer(
2930 + rXDom, uno::UNO_QUERY_THROW);
2932 + // now serialize DOM tree into internal data structures
2933 + rFilter.importFragment( rxHandler, xSerializer );
2935 + // not yet
2936 +#if 0
2937 + // tack XDocument onto shape
2938 + pShape->getShapeProperties().setProperty(
2939 + OUString::createFromAscii(pPropName),
2940 + rXDom);
2941 +#endif
2944 +void loadDiagram( const ShapePtr& pShape,
2945 + core::XmlFilterBase& rFilter,
2946 + const ::rtl::OUString& rDataModelPath,
2947 + const ::rtl::OUString& rLayoutPath,
2948 + const ::rtl::OUString& rQStylePath,
2949 + const ::rtl::OUString& rColorStylePath )
2951 + DiagramPtr pDiagram( new Diagram() );
2953 + DiagramDataPtr pData( new DiagramData() );
2954 + pDiagram->setData( pData );
2956 + DiagramLayoutPtr pLayout( new DiagramLayout() );
2957 + pDiagram->setLayout( pLayout );
2959 + // data
2960 + if( rDataModelPath.getLength() > 0 )
2962 + rtl::Reference< core::FragmentHandler > xRef(
2963 + new DiagramDataFragmentHandler( rFilter, rDataModelPath, pData ));
2965 + importFragment(rFilter,
2966 + loadFragment(rFilter,xRef),
2967 + "DiagramData",
2968 + pShape,
2969 + xRef);
2972 + // layout
2973 + if( rLayoutPath.getLength() > 0 )
2975 + rtl::Reference< core::FragmentHandler > xRef(
2976 + new DiagramLayoutFragmentHandler( rFilter, rLayoutPath, pLayout ));
2977 + importFragment(rFilter,
2978 + loadFragment(rFilter,xRef),
2979 + "DiagramLayout",
2980 + pShape,
2981 + xRef);
2984 + // style
2985 + if( rQStylePath.getLength() > 0 )
2987 + rtl::Reference< core::FragmentHandler > xRef(
2988 + new DiagramQStylesFragmentHandler( rFilter, rQStylePath, pDiagram->getStyles() ));
2989 + importFragment(rFilter,
2990 + loadFragment(rFilter,xRef),
2991 + "DiagramQStyle",
2992 + pShape,
2993 + xRef);
2996 + // colors
2997 + if( rColorStylePath.getLength() > 0 )
2999 + rtl::Reference< core::FragmentHandler > xRef(
3000 + new ColorFragmentHandler( rFilter, rColorStylePath, pDiagram->getColors() ));
3001 + importFragment(rFilter,
3002 + loadFragment(rFilter,xRef),
3003 + "DiagramColorStyle",
3004 + pShape,
3005 + xRef);
3008 + // diagram loaded. now lump together & attach to shape
3009 + pDiagram->addTo(pShape);
3012 +void loadDiagram( const ShapePtr& pShape,
3013 + core::XmlFilterBase& rFilter,
3014 + const uno::Reference<xml::dom::XDocument>& rXDataModelDom,
3015 + const uno::Reference<xml::dom::XDocument>& rXLayoutDom,
3016 + const uno::Reference<xml::dom::XDocument>& rXQStyleDom,
3017 + const uno::Reference<xml::dom::XDocument>& rXColorStyleDom )
3019 + DiagramPtr pDiagram( new Diagram() );
3021 + DiagramDataPtr pData( new DiagramData() );
3022 + pDiagram->setData( pData );
3024 + DiagramLayoutPtr pLayout( new DiagramLayout() );
3025 + pDiagram->setLayout( pLayout );
3027 + OUString aEmpty;
3029 + // data
3030 + if( rXDataModelDom.is() )
3031 + importFragment(rFilter,
3032 + rXDataModelDom,
3033 + "DiagramData",
3034 + pShape,
3035 + new DiagramDataFragmentHandler( rFilter, aEmpty, pData ));
3037 + // layout
3038 + if( rXLayoutDom.is() )
3039 + importFragment(rFilter,
3040 + rXLayoutDom,
3041 + "DiagramLayout",
3042 + pShape,
3043 + new DiagramLayoutFragmentHandler( rFilter, aEmpty, pLayout ));
3045 + // style
3046 + if( rXQStyleDom.is() )
3047 + importFragment(rFilter,
3048 + rXQStyleDom,
3049 + "DiagramQStyle",
3050 + pShape,
3051 + new DiagramQStylesFragmentHandler( rFilter, aEmpty, pDiagram->getStyles() ));
3053 + // colors
3054 + if( rXColorStyleDom.is() )
3055 + importFragment(rFilter,
3056 + rXColorStyleDom,
3057 + "DiagramColorStyle",
3058 + pShape,
3059 + new ColorFragmentHandler( rFilter, aEmpty, pDiagram->getColors() ));
3061 + // diagram loaded. now lump together & attach to shape
3062 + pDiagram->addTo(pShape);
3066 diff --git oox/source/drawingml/diagram/diagram.hxx oox/source/drawingml/diagram/diagram.hxx
3067 new file mode 100644
3068 index 0000000..c7518ac
3069 --- /dev/null
3070 +++ oox/source/drawingml/diagram/diagram.hxx
3071 @@ -0,0 +1,320 @@
3072 +/*************************************************************************
3074 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3075 + *
3076 + * Copyright 2008 by Sun Microsystems, Inc.
3078 + * OpenOffice.org - a multi-platform office productivity suite
3080 + * $RCSfile$
3081 + * $Revision$
3083 + * This file is part of OpenOffice.org.
3085 + * OpenOffice.org is free software: you can redistribute it and/or modify
3086 + * it under the terms of the GNU Lesser General Public License version 3
3087 + * only, as published by the Free Software Foundation.
3089 + * OpenOffice.org is distributed in the hope that it will be useful,
3090 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3091 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3092 + * GNU Lesser General Public License version 3 for more details
3093 + * (a copy is included in the LICENSE file that accompanied this code).
3095 + * You should have received a copy of the GNU Lesser General Public License
3096 + * version 3 along with OpenOffice.org. If not, see
3097 + * <http://www.openoffice.org/license.html>
3098 + * for a copy of the LGPLv3 License.
3100 + ************************************************************************/
3102 +#ifndef OOX_DRAWINGML_DIAGRAM_DIAGRAM_HXX
3103 +#define OOX_DRAWINGML_DIAGRAM_DIAGRAM_HXX
3105 +#include <map>
3106 +#include <vector>
3108 +#include <boost/shared_ptr.hpp>
3109 +#include <boost/enable_shared_from_this.hpp>
3111 +#include <rtl/ustring.hxx>
3113 +#include "tokens.hxx"
3114 +#include "oox/drawingml/shape.hxx"
3115 +#include "oox/drawingml/fillproperties.hxx"
3117 +namespace com { namespace sun { namespace star {
3118 + namespace xml { namespace dom { class XDocument; } }
3119 +} } }
3121 +namespace oox { namespace drawingml {
3123 +namespace dgm {
3125 +/** A Connection
3126 + */
3127 +struct Connection
3129 + Connection() :
3130 + mnType( 0 ),
3131 + mnSourceOrder( 0 ),
3132 + mnDestOrder( 0 )
3133 + {}
3135 + void dump();
3137 + sal_Int32 mnType;
3138 + ::rtl::OUString msModelId;
3139 + ::rtl::OUString msSourceId;
3140 + ::rtl::OUString msDestId;
3141 + ::rtl::OUString msParTransId;
3142 + ::rtl::OUString msPresId;
3143 + ::rtl::OUString msSibTransId;
3144 + sal_Int32 mnSourceOrder;
3145 + sal_Int32 mnDestOrder;
3149 +typedef std::vector< Connection > Connections;
3152 +/** A point
3153 + */
3154 +struct Point
3156 + Point() :
3157 + mnType(0),
3158 + mnMaxChildren(-1),
3159 + mnPreferredChildren(-1),
3160 + mnDirection(XML_norm),
3161 + mnHierarchyBranch(XML_std),
3162 + mnResizeHandles(XML_rel),
3163 + mnCustomAngle(-1),
3164 + mnPercentageNeighbourWidth(-1),
3165 + mnPercentageNeighbourHeight(-1),
3166 + mnPercentageOwnWidth(-1),
3167 + mnPercentageOwnHeight(-1),
3168 + mnIncludeAngleScale(-1),
3169 + mnRadiusScale(-1),
3170 + mnWidthScale(-1),
3171 + mnHeightScale(-1),
3172 + mnWidthOverride(-1),
3173 + mnHeightOverride(-1),
3174 + mnLayoutStyleCount(-1),
3175 + mnLayoutStyleIndex(-1),
3177 + mbOrgChartEnabled(false),
3178 + mbBulletEnabled(false),
3179 + mbCoherent3DOffset(false),
3180 + mbCustomHorizontalFlip(false),
3181 + mbCustomVerticalFlip(false),
3182 + mbCustomText(false),
3183 + mbIsPlaceholder(false)
3184 + {}
3185 + void dump();
3187 + ShapePtr mpShape;
3189 + rtl::OUString msCnxId;
3190 + rtl::OUString msModelId;
3191 + rtl::OUString msColorTransformCategoryId;
3192 + rtl::OUString msColorTransformTypeId;
3193 + rtl::OUString msLayoutCategoryId;
3194 + rtl::OUString msLayoutTypeId;
3195 + rtl::OUString msPlaceholderText;
3196 + rtl::OUString msPresentationAssociationId;
3197 + rtl::OUString msPresentationLayoutName;
3198 + rtl::OUString msPresentationLayoutStyleLabel;
3199 + rtl::OUString msQuickStyleCategoryId;
3200 + rtl::OUString msQuickStyleTypeId;
3202 + sal_Int32 mnType;
3203 + sal_Int32 mnMaxChildren;
3204 + sal_Int32 mnPreferredChildren;
3205 + sal_Int32 mnDirection;
3206 + sal_Int32 mnHierarchyBranch;
3207 + sal_Int32 mnResizeHandles;
3208 + sal_Int32 mnCustomAngle;
3209 + sal_Int32 mnPercentageNeighbourWidth;
3210 + sal_Int32 mnPercentageNeighbourHeight;
3211 + sal_Int32 mnPercentageOwnWidth;
3212 + sal_Int32 mnPercentageOwnHeight;
3213 + sal_Int32 mnIncludeAngleScale;
3214 + sal_Int32 mnRadiusScale;
3215 + sal_Int32 mnWidthScale;
3216 + sal_Int32 mnHeightScale;
3217 + sal_Int32 mnWidthOverride;
3218 + sal_Int32 mnHeightOverride;
3219 + sal_Int32 mnLayoutStyleCount;
3220 + sal_Int32 mnLayoutStyleIndex;
3222 + bool mbOrgChartEnabled;
3223 + bool mbBulletEnabled;
3224 + bool mbCoherent3DOffset;
3225 + bool mbCustomHorizontalFlip;
3226 + bool mbCustomVerticalFlip;
3227 + bool mbCustomText;
3228 + bool mbIsPlaceholder;
3231 +typedef std::vector< Point > Points;
3235 +class LayoutNode;
3236 +typedef boost::shared_ptr< LayoutNode > LayoutNodePtr;
3238 +////////////////////
3240 +class DiagramData
3242 +public:
3243 + typedef std::map< rtl::OUString, dgm::Point* > PointNameMap;
3244 + typedef std::map< rtl::OUString,
3245 + std::vector<dgm::Point*> > PointsNameMap;
3246 + typedef std::map< rtl::OUString, const dgm::Connection* > ConnectionNameMap;
3247 + typedef std::map< rtl::OUString,
3248 + std::vector<std::pair<rtl::OUString,sal_Int32> > > StringMap;
3250 + DiagramData();
3251 + FillPropertiesPtr & getFillProperties()
3252 + { return mpFillProperties; }
3253 + dgm::Connections & getConnections()
3254 + { return maConnections; }
3255 + dgm::Points & getPoints()
3256 + { return maPoints; }
3257 + ConnectionNameMap & getConnectionNameMap()
3258 + { return maConnectionNameMap; }
3259 + StringMap & getPresOfNameMap()
3260 + { return maPresOfNameMap; }
3261 + PointNameMap & getPointNameMap()
3262 + { return maPointNameMap; }
3263 + PointsNameMap & getPointsPresNameMap()
3264 + { return maPointsPresNameMap; }
3265 + void dump();
3266 +private:
3267 + FillPropertiesPtr mpFillProperties;
3268 + dgm::Connections maConnections;
3269 + dgm::Points maPoints;
3270 + PointNameMap maPointNameMap;
3271 + PointsNameMap maPointsPresNameMap;
3272 + ConnectionNameMap maConnectionNameMap;
3273 + StringMap maPresOfNameMap;
3276 +typedef boost::shared_ptr< DiagramData > DiagramDataPtr;
3280 +////////////////////
3282 +class DiagramLayout
3284 +public:
3285 + void setDefStyle( const ::rtl::OUString & sDefStyle )
3286 + { msDefStyle = sDefStyle; }
3287 + void setMinVer( const ::rtl::OUString & sMinVer )
3288 + { msMinVer = sMinVer; }
3289 + void setUniqueId( const ::rtl::OUString & sUniqueId )
3290 + { msUniqueId = sUniqueId; }
3291 + const ::rtl::OUString & getUniqueId()
3292 + { return msUniqueId; }
3293 + void setTitle( const ::rtl::OUString & sTitle )
3294 + { msTitle = sTitle; }
3295 + void setDesc( const ::rtl::OUString & sDesc )
3296 + { msDesc = sDesc; }
3298 + LayoutNodePtr & getNode()
3299 + { return mpNode; }
3300 + const LayoutNodePtr & getNode() const
3301 + { return mpNode; }
3302 + DiagramDataPtr & getSampData()
3303 + { return mpSampData; }
3304 + const DiagramDataPtr & getSampData() const
3305 + { return mpSampData; }
3306 + DiagramDataPtr & getStyleData()
3307 + { return mpStyleData; }
3308 + const DiagramDataPtr & getStyleData() const
3309 + { return mpStyleData; }
3311 + void layout( const dgm::Points & pTree, const com::sun::star::awt::Point & pt );
3313 +private:
3314 + ::rtl::OUString msDefStyle;
3315 + ::rtl::OUString msMinVer;
3316 + ::rtl::OUString msUniqueId;
3318 + ::rtl::OUString msTitle;
3319 + ::rtl::OUString msDesc;
3320 + LayoutNodePtr mpNode;
3321 + DiagramDataPtr mpSampData;
3322 + DiagramDataPtr mpStyleData;
3323 + // TODO
3324 + // catLst
3325 + // clrData
3328 +typedef boost::shared_ptr< DiagramLayout > DiagramLayoutPtr;
3330 +///////////////////////
3332 +struct DiagramStyle
3334 + ShapeStyleRef maFillStyle;
3335 + ShapeStyleRef maLineStyle;
3336 + ShapeStyleRef maEffectStyle;
3337 + ShapeStyleRef maTextStyle;
3340 +typedef std::map<rtl::OUString,DiagramStyle> DiagramQStyleMap;
3342 +struct DiagramColor
3344 + oox::drawingml::Color maFillColor;
3345 + oox::drawingml::Color maLineColor;
3346 + oox::drawingml::Color maEffectColor;
3347 + oox::drawingml::Color maTextFillColor;
3348 + oox::drawingml::Color maTextLineColor;
3349 + oox::drawingml::Color maTextEffectColor;
3352 +typedef std::map<rtl::OUString,DiagramColor> DiagramColorMap;
3354 +///////////////////////
3356 +class Diagram
3358 +public:
3359 + void setData( const DiagramDataPtr & );
3360 + DiagramDataPtr getData() const
3362 + return mpData;
3364 + void setLayout( const DiagramLayoutPtr & );
3365 + DiagramLayoutPtr getLayout() const
3367 + return mpLayout;
3370 + DiagramQStyleMap& getStyles() { return maStyles; }
3371 + const DiagramQStyleMap& getStyles() const { return maStyles; }
3372 + DiagramColorMap& getColors() { return maColors; }
3373 + const DiagramColorMap& getColors() const { return maColors; }
3375 + void addTo( const ShapePtr & pShape );
3376 + ::rtl::OUString getLayoutId() const;
3377 +private:
3378 + void build( );
3379 + DiagramDataPtr mpData;
3380 + DiagramLayoutPtr mpLayout;
3381 + DiagramQStyleMap maStyles;
3382 + DiagramColorMap maColors;
3383 + std::map< ::rtl::OUString, ShapePtr > maShapeMap;
3387 +typedef boost::shared_ptr< Diagram > DiagramPtr;
3389 +} }
3391 +#endif
3392 diff --git oox/source/drawingml/diagram/diagramdefinitioncontext.cxx oox/source/drawingml/diagram/diagramdefinitioncontext.cxx
3393 index 94441be..c778e57 100644
3394 --- oox/source/drawingml/diagram/diagramdefinitioncontext.cxx
3395 +++ oox/source/drawingml/diagram/diagramdefinitioncontext.cxx
3396 @@ -30,10 +30,9 @@
3398 #include "oox/core/skipcontext.hxx"
3399 #include "oox/core/namespaces.hxx"
3400 -#include "oox/helper/helper.hxx"
3401 -#include "layoutnodecontext.hxx"
3402 #include "diagramdefinitioncontext.hxx"
3403 -#include "oox/drawingml/diagram/datamodelcontext.hxx"
3404 +#include "layoutnodecontext.hxx"
3405 +#include "datamodelcontext.hxx"
3406 #include "tokens.hxx"
3408 using namespace ::oox::core;
3409 @@ -91,9 +90,15 @@ DiagramDefinitionContext::createFastChildContext( ::sal_Int32 aElement,
3410 mpLayout->setDesc( xAttribs->getOptionalValue( XML_val ) );
3411 break;
3412 case NMSP_DIAGRAM|XML_layoutNode:
3413 - mpLayout->getNode().reset( new LayoutNode() );
3414 - xRet.set( new LayoutNodeContext( *this, xAttribs, mpLayout->getNode() ) );
3416 + LayoutNodePtr pNode( new LayoutNode() );
3417 + mpLayout->getNode() = pNode;
3418 + pNode->setChildOrder( xAttribs->getOptionalValueToken( XML_chOrder, XML_b ) );
3419 + pNode->setMoveWith( xAttribs->getOptionalValue( XML_moveWith ) );
3420 + pNode->setStyleLabel( xAttribs->getOptionalValue( XML_styleLbl ) );
3421 + xRet.set( new LayoutNodeContext( *this, xAttribs, pNode ) );
3422 break;
3424 case NMSP_DIAGRAM|XML_clrData:
3425 // TODO, does not matter for the UI. skip.
3426 xRet.set( new SkipContext( *this ) );
3427 diff --git oox/source/drawingml/diagram/diagramdefinitioncontext.hxx oox/source/drawingml/diagram/diagramdefinitioncontext.hxx
3428 index c427967..408b8da 100644
3429 --- oox/source/drawingml/diagram/diagramdefinitioncontext.hxx
3430 +++ oox/source/drawingml/diagram/diagramdefinitioncontext.hxx
3431 @@ -32,7 +32,7 @@
3432 #define OOX_DRAWINGML_DIAGRAMDEFINITIONCONTEXT_HXX
3434 #include "oox/core/contexthandler.hxx"
3435 -#include "oox/drawingml/diagram/diagram.hxx"
3436 +#include "diagram.hxx"
3438 namespace oox { namespace drawingml {
3440 diff --git oox/source/drawingml/diagram/diagramfragmenthandler.cxx oox/source/drawingml/diagram/diagramfragmenthandler.cxx
3441 index f666fb8..03912cc 100644
3442 --- oox/source/drawingml/diagram/diagramfragmenthandler.cxx
3443 +++ oox/source/drawingml/diagram/diagramfragmenthandler.cxx
3444 @@ -30,11 +30,12 @@
3446 #include <osl/diagnose.h>
3448 -#include "oox/drawingml/diagram/diagramfragmenthandler.hxx"
3449 -#include "oox/drawingml/diagram/datamodelcontext.hxx"
3450 #include "oox/core/namespaces.hxx"
3451 +#include "oox/drawingml/colorchoicecontext.hxx"
3452 +#include "oox/drawingml/stylematrixreferencecontext.hxx"
3453 #include "diagramdefinitioncontext.hxx"
3454 -#include "tokens.hxx"
3455 +#include "diagramfragmenthandler.hxx"
3456 +#include "datamodelcontext.hxx"
3458 using namespace ::oox::core;
3459 using namespace ::com::sun::star::xml::sax;
3460 @@ -134,94 +135,144 @@ DiagramLayoutFragmentHandler::createFastChildContext( ::sal_Int32 aElement,
3461 ///////////////////////
3463 DiagramQStylesFragmentHandler::DiagramQStylesFragmentHandler( XmlFilterBase& rFilter,
3464 - const OUString& rFragmentPath,
3465 - const DiagramQStylesPtr pDataPtr )
3466 - throw( )
3467 - : FragmentHandler( rFilter, rFragmentPath )
3468 - , mpDataPtr( pDataPtr )
3469 + const OUString& rFragmentPath,
3470 + DiagramQStyleMap& rStylesMap ) :
3471 + FragmentHandler2( rFilter, rFragmentPath ),
3472 + maStyleName(),
3473 + maStyleEntry(),
3474 + mrStylesMap( rStylesMap )
3477 +::oox::core::ContextWrapper DiagramQStylesFragmentHandler::createStyleMatrixContext(
3478 + sal_Int32 nElement,
3479 + const AttributeList& rAttribs,
3480 + ShapeStyleRef& o_rStyle )
3482 + o_rStyle.mnThemedIdx = (nElement == (NMSP_DRAWINGML|XML_fontRef)) ?
3483 + rAttribs.getToken( XML_idx, XML_none ) : rAttribs.getInteger( XML_idx, 0 );
3484 + return new StyleMatrixReferenceContext( *this,
3485 + o_rStyle.maPhClr );
3488 -DiagramQStylesFragmentHandler::~DiagramQStylesFragmentHandler( ) throw ()
3489 +::oox::core::ContextWrapper DiagramQStylesFragmentHandler::onCreateContext( sal_Int32 nElement,
3490 + const AttributeList& rAttribs )
3493 + // state-table like way of navigating the color fragment. we
3494 + // currently ignore everything except styleLbl in the colorsDef
3495 + // element
3496 + switch( getCurrentElement() )
3498 + case XML_ROOT_CONTEXT:
3499 + return nElement == (NMSP_DIAGRAM|XML_styleDef);
3500 + case NMSP_DIAGRAM|XML_styleDef:
3501 + return nElement == (NMSP_DIAGRAM|XML_styleLbl);
3502 + case NMSP_DIAGRAM|XML_styleLbl:
3503 + return nElement == (NMSP_DIAGRAM|XML_style);
3504 + case NMSP_DIAGRAM|XML_style:
3506 + switch( nElement )
3508 + case NMSP_DRAWINGML|XML_lnRef : // CT_StyleMatrixReference
3509 + return createStyleMatrixContext(nElement,rAttribs,
3510 + maStyleEntry.maLineStyle);
3511 + case NMSP_DRAWINGML|XML_fillRef : // CT_StyleMatrixReference
3512 + return createStyleMatrixContext(nElement,rAttribs,
3513 + maStyleEntry.maFillStyle);
3514 + case NMSP_DRAWINGML|XML_effectRef : // CT_StyleMatrixReference
3515 + return createStyleMatrixContext(nElement,rAttribs,
3516 + maStyleEntry.maEffectStyle);
3517 + case NMSP_DRAWINGML|XML_fontRef : // CT_FontRe ference
3518 + return createStyleMatrixContext(nElement,rAttribs,
3519 + maStyleEntry.maTextStyle);
3521 + return false;
3525 + return false;
3528 -void SAL_CALL DiagramQStylesFragmentHandler::endDocument()
3529 - throw (SAXException, RuntimeException)
3530 +void DiagramQStylesFragmentHandler::onStartElement( const AttributeList& rAttribs )
3533 + if( getCurrentElement() == (NMSP_DIAGRAM|XML_styleLbl) )
3535 + maStyleName = rAttribs.getString( XML_name, OUString() );
3536 + maStyleEntry = mrStylesMap[maStyleName];
3541 -Reference< XFastContextHandler > SAL_CALL
3542 -DiagramQStylesFragmentHandler::createFastChildContext( ::sal_Int32 aElement,
3543 - const Reference< XFastAttributeList >& )
3544 - throw ( SAXException, RuntimeException)
3545 +void DiagramQStylesFragmentHandler::onEndElement( const ::rtl::OUString& )
3547 - Reference< XFastContextHandler > xRet;
3549 - switch( aElement )
3551 - case NMSP_DIAGRAM|XML_styleDef:
3552 - // TODO
3553 - break;
3554 - default:
3555 - break;
3558 - if( !xRet.is() )
3559 - xRet = getFastContextHandler();
3561 - return xRet;
3562 + if( getCurrentElement() == (NMSP_DIAGRAM|XML_styleLbl) )
3563 + mrStylesMap[maStyleName] = maStyleEntry;
3566 -/////////////////////
3568 -DiagramColorsFragmentHandler::DiagramColorsFragmentHandler( XmlFilterBase& rFilter,
3569 - const OUString& rFragmentPath,
3570 - const DiagramColorsPtr pDataPtr )
3571 - throw( )
3572 - : FragmentHandler( rFilter, rFragmentPath )
3573 - , mpDataPtr( pDataPtr )
3576 +///////////////////////
3578 -DiagramColorsFragmentHandler::~DiagramColorsFragmentHandler( ) throw ()
3579 +ColorFragmentHandler::ColorFragmentHandler( ::oox::core::XmlFilterBase& rFilter,
3580 + const ::rtl::OUString& rFragmentPath,
3581 + DiagramColorMap& rColorsMap ) :
3582 + FragmentHandler2(rFilter,rFragmentPath),
3583 + maColorName(),
3584 + maColorEntry(),
3585 + mrColorsMap(rColorsMap)
3588 +::oox::core::ContextWrapper ColorFragmentHandler::onCreateContext( sal_Int32 nElement,
3589 + const AttributeList& /*rAttribs*/ )
3592 + // state-table like way of navigating the color fragment. we
3593 + // currently ignore everything except styleLbl in the colorsDef
3594 + // element
3595 + switch( getCurrentElement() )
3597 + case XML_ROOT_CONTEXT:
3598 + return nElement == (NMSP_DIAGRAM|XML_colorsDef);
3599 + case NMSP_DIAGRAM|XML_colorsDef:
3600 + return nElement == (NMSP_DIAGRAM|XML_styleLbl);
3601 + case NMSP_DIAGRAM|XML_styleLbl:
3602 + return (nElement == (NMSP_DIAGRAM|XML_fillClrLst)) ||
3603 + (nElement == (NMSP_DIAGRAM|XML_linClrLst)) ||
3604 + (nElement == (NMSP_DIAGRAM|XML_effectClrLst)) ||
3605 + (nElement == (NMSP_DIAGRAM|XML_txLinClrLst)) ||
3606 + (nElement == (NMSP_DIAGRAM|XML_txFillClrLst)) ||
3607 + (nElement == (NMSP_DIAGRAM|XML_txEffectClrLst));
3609 + // the actual colors - defer to color fragment handlers.
3611 + // TODO(F1): well, actually, there might be *several* color
3612 + // definitions in it, after all it's called list. but
3613 + // apparently colorChoiceContext doesn't handle that anyway...
3614 + case NMSP_DIAGRAM|XML_fillClrLst:
3615 + return new colorChoiceContext( *this, maColorEntry.maFillColor );
3616 + case NMSP_DIAGRAM|XML_linClrLst:
3617 + return new colorChoiceContext( *this, maColorEntry.maLineColor );
3618 + case NMSP_DIAGRAM|XML_effectClrLst:
3619 + return new colorChoiceContext( *this, maColorEntry.maEffectColor );
3620 + case NMSP_DIAGRAM|XML_txFillClrLst:
3621 + return new colorChoiceContext( *this, maColorEntry.maTextFillColor );
3622 + case NMSP_DIAGRAM|XML_txLinClrLst:
3623 + return new colorChoiceContext( *this, maColorEntry.maTextLineColor );
3624 + case NMSP_DIAGRAM|XML_txEffectClrLst:
3625 + return new colorChoiceContext( *this, maColorEntry.maTextEffectColor );
3628 + return false;
3631 -void SAL_CALL DiagramColorsFragmentHandler::endDocument()
3632 - throw (SAXException, RuntimeException)
3633 +void ColorFragmentHandler::onStartElement( const AttributeList& rAttribs )
3636 + if( getCurrentElement() == (NMSP_DIAGRAM|XML_styleLbl) )
3638 + maColorName = rAttribs.getString( XML_name, OUString() );
3639 + maColorEntry = mrColorsMap[maColorName];
3644 -Reference< XFastContextHandler > SAL_CALL
3645 -DiagramColorsFragmentHandler::createFastChildContext( ::sal_Int32 aElement,
3646 - const Reference< XFastAttributeList >& )
3647 - throw ( SAXException, RuntimeException)
3648 +void ColorFragmentHandler::onEndElement( const ::rtl::OUString& )
3650 - Reference< XFastContextHandler > xRet;
3652 - switch( aElement )
3654 - case NMSP_DIAGRAM|XML_colorsDef:
3655 - // TODO
3656 - break;
3657 - default:
3658 - break;
3661 - if( !xRet.is() )
3662 - xRet = getFastContextHandler();
3664 - return xRet;
3665 + if( getCurrentElement() == (NMSP_DIAGRAM|XML_styleLbl) )
3666 + mrColorsMap[maColorName] = maColorEntry;
3673 diff --git oox/source/drawingml/diagram/diagramfragmenthandler.hxx oox/source/drawingml/diagram/diagramfragmenthandler.hxx
3674 new file mode 100644
3675 index 0000000..67bfbb2
3676 --- /dev/null
3677 +++ oox/source/drawingml/diagram/diagramfragmenthandler.hxx
3678 @@ -0,0 +1,117 @@
3679 +/*************************************************************************
3681 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
3682 + *
3683 + * Copyright 2008 by Sun Microsystems, Inc.
3685 + * OpenOffice.org - a multi-platform office productivity suite
3687 + * $RCSfile: diagramfragmenthandler.hxx,v $
3688 + * $Revision: 1.4 $
3690 + * This file is part of OpenOffice.org.
3692 + * OpenOffice.org is free software: you can redistribute it and/or modify
3693 + * it under the terms of the GNU Lesser General Public License version 3
3694 + * only, as published by the Free Software Foundation.
3696 + * OpenOffice.org is distributed in the hope that it will be useful,
3697 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
3698 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
3699 + * GNU Lesser General Public License version 3 for more details
3700 + * (a copy is included in the LICENSE file that accompanied this code).
3702 + * You should have received a copy of the GNU Lesser General Public License
3703 + * version 3 along with OpenOffice.org. If not, see
3704 + * <http://www.openoffice.org/license.html>
3705 + * for a copy of the LGPLv3 License.
3707 + ************************************************************************/
3710 +#ifndef OOX_DRAWINGML_DIAGRAMFRAGMENTHANDLER
3711 +#define OOX_DRAWINGML_DIAGRAMFRAGMENTHANDLER
3713 +#include "oox/core/fragmenthandler.hxx"
3714 +#include "oox/core/fragmenthandler2.hxx"
3715 +#include "oox/drawingml/diagram/diagram.hxx"
3717 +namespace oox { namespace drawingml {
3720 +class DiagramDataFragmentHandler : public ::oox::core::FragmentHandler
3722 +public:
3723 + DiagramDataFragmentHandler( oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramDataPtr pDataPtr ) throw();
3724 + virtual ~DiagramDataFragmentHandler() throw();
3726 + virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
3727 + 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);
3729 +private:
3731 + DiagramDataPtr mpDataPtr;
3736 +class DiagramLayoutFragmentHandler : public ::oox::core::FragmentHandler
3738 +public:
3739 + DiagramLayoutFragmentHandler( oox::core::XmlFilterBase& rFilter, const ::rtl::OUString& rFragmentPath, const DiagramLayoutPtr pDataPtr ) throw();
3740 + virtual ~DiagramLayoutFragmentHandler() throw();
3742 + virtual void SAL_CALL endDocument() throw (::com::sun::star::xml::sax::SAXException, ::com::sun::star::uno::RuntimeException);
3743 + 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);
3745 +private:
3747 + DiagramLayoutPtr mpDataPtr;
3750 +class DiagramQStylesFragmentHandler : public ::oox::core::FragmentHandler2
3752 +public:
3753 + DiagramQStylesFragmentHandler(
3754 + oox::core::XmlFilterBase& rFilter,
3755 + const ::rtl::OUString& rFragmentPath,
3756 + DiagramQStyleMap& rStylesMap );
3758 + virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
3760 + virtual void onStartElement( const AttributeList& rAttribs );
3761 + virtual void onEndElement( const ::rtl::OUString& rChars );
3763 +private:
3764 + ::oox::core::ContextWrapper createStyleMatrixContext(sal_Int32 nElement,
3765 + const AttributeList& rAttribs,
3766 + ShapeStyleRef& o_rStyle);
3768 + ::rtl::OUString maStyleName;
3769 + DiagramStyle maStyleEntry;
3770 + DiagramQStyleMap& mrStylesMap;
3773 +class ColorFragmentHandler : public ::oox::core::FragmentHandler2
3775 +public:
3776 + ColorFragmentHandler(
3777 + ::oox::core::XmlFilterBase& rFilter,
3778 + const ::rtl::OUString& rFragmentPath,
3779 + DiagramColorMap& rColorMap );
3781 + virtual ::oox::core::ContextWrapper onCreateContext( sal_Int32 nElement, const AttributeList& rAttribs );
3783 + virtual void onStartElement( const AttributeList& rAttribs );
3784 + virtual void onEndElement( const ::rtl::OUString& rChars );
3786 +private:
3787 + ::rtl::OUString maColorName;
3788 + DiagramColor maColorEntry;
3789 + DiagramColorMap& mrColorsMap;
3792 +} }
3795 +#endif
3796 diff --git oox/source/drawingml/diagram/diagramlayoutatoms.cxx oox/source/drawingml/diagram/diagramlayoutatoms.cxx
3797 index 8fad074..3b879c6 100644
3798 --- oox/source/drawingml/diagram/diagramlayoutatoms.cxx
3799 +++ oox/source/drawingml/diagram/diagramlayoutatoms.cxx
3800 @@ -28,14 +28,24 @@
3802 ************************************************************************/
3804 -#include "oox/drawingml/diagram/diagramlayoutatoms.hxx"
3805 +#include "diagramlayoutatoms.hxx"
3807 #include <functional>
3808 #include <boost/bind.hpp>
3810 +#include <basegfx/numeric/ftools.hxx>
3812 #include "oox/helper/attributelist.hxx"
3813 +#include "oox/drawingml/fillproperties.hxx"
3814 +#include "oox/drawingml/lineproperties.hxx"
3815 +#include "oox/drawingml/textbody.hxx"
3816 +#include "oox/drawingml/textparagraph.hxx"
3817 +#include "oox/drawingml/textrun.hxx"
3818 +#include "oox/drawingml/customshapeproperties.hxx"
3819 +#include "diagramlayoutatoms.hxx"
3820 #include "layoutnodecontext.hxx"
3822 +using namespace ::com::sun::star;
3823 using namespace ::com::sun::star::uno;
3824 using namespace ::com::sun::star::xml::sax;
3825 using namespace ::oox::core;
3826 @@ -45,7 +55,7 @@ namespace oox { namespace drawingml {
3828 IteratorAttr::IteratorAttr( )
3829 : mnAxis( 0 )
3830 - , mnCnt( 0 )
3831 + , mnCnt( -1 )
3832 , mbHideLastTrans( false )
3833 , mnPtType( 0 )
3834 , mnSt( 0 )
3835 @@ -57,7 +67,7 @@ void IteratorAttr::loadFromXAttr( const Reference< XFastAttributeList >& xAttr )
3837 AttributeList attr( xAttr );
3838 mnAxis = xAttr->getOptionalValueToken( XML_axis, 0 );
3839 - mnCnt = attr.getInteger( XML_cnt, 0 );
3840 + mnCnt = attr.getInteger( XML_cnt, -1 );
3841 mbHideLastTrans = attr.getBool( XML_hideLastTrans, false );
3842 mnPtType = xAttr->getOptionalValueToken( XML_ptType, 0 );
3843 mnSt = attr.getInteger( XML_st, 0 );
3844 @@ -90,55 +100,674 @@ void LayoutAtom::dump(int level)
3845 OSL_TRACE( "level = %d - %s of type %s", level,
3846 OUSTRING_TO_CSTR( msName ),
3847 typeid(*this).name() );
3848 - std::for_each( mpChildNodes.begin(), mpChildNodes.end(),
3849 - boost::bind( &LayoutAtom::dump, _1, level + 1 ) );
3850 + const std::vector<LayoutAtomPtr>& pChildren=getChildren();
3851 + std::for_each( pChildren.begin(), pChildren.end(),
3852 + boost::bind( &LayoutAtom::dump, _1, level + 1 ) );
3856 +ForEachAtom::ForEachAtom(const Reference< XFastAttributeList >& xAttributes)
3858 + maIter.loadFromXAttr(xAttributes);
3861 +void ForEachAtom::accept( LayoutAtomVisitor& rVisitor )
3863 + rVisitor.visit(*this);
3866 +void ChooseAtom::accept( LayoutAtomVisitor& rVisitor )
3868 + rVisitor.visit(*this);
3871 +ConditionAtom::ConditionAtom(const Reference< XFastAttributeList >& xAttributes) :
3872 + mbElse( false )
3874 + maIter.loadFromXAttr( xAttributes );
3875 + maCond.loadFromXAttr( xAttributes );
3878 +const std::vector<LayoutAtomPtr>& ConditionAtom::getChildren() const
3880 + bool bDecisionVar=true;
3881 + // HACK
3882 + if( maCond.mnFunc==XML_var && maCond.mnArg==XML_dir &&
3883 + maCond.mnOp==XML_equ && !maCond.msVal.equalsAscii("norm") )
3884 + bDecisionVar=false;
3886 + if( bDecisionVar )
3887 + return mpChildNodes;
3888 + else
3889 + return mpElseChildNodes;
3892 +void ConditionAtom::accept( LayoutAtomVisitor& rVisitor )
3894 + rVisitor.visit(*this);
3897 +void ConditionAtom::addChild( const LayoutAtomPtr & pNode )
3899 + if( mbElse )
3900 + mpElseChildNodes.push_back( pNode );
3901 + else
3902 + mpChildNodes.push_back( pNode );
3905 +void ConstraintAtom::accept( LayoutAtomVisitor& rVisitor )
3907 + rVisitor.visit(*this);
3910 +void AlgAtom::accept( LayoutAtomVisitor& rVisitor )
3912 + rVisitor.visit(*this);
3915 +void AlgAtom::layoutShape( const ShapePtr& rShape,
3916 + const Diagram& rDgm,
3917 + const rtl::OUString& rName ) const
3919 + switch(mnType)
3921 + case XML_composite:
3923 + if( rShape->getChildren().empty() )
3925 + rShape->setSize(awt::Size(50,50));
3926 + break;
3929 + // just put stuff below each other
3930 + const sal_Int32 nIncX=0;
3931 + const sal_Int32 nIncY=1;
3933 + std::vector<ShapePtr>::const_iterator aCurrShape=rShape->getChildren().begin();
3934 + const std::vector<ShapePtr>::const_iterator aLastShape=rShape->getChildren().end();
3936 + // find biggest shape
3937 + awt::Size aMaxSize;
3938 + while( aCurrShape != aLastShape )
3940 + const awt::Size& sz=(*aCurrShape)->getSize();
3942 + aMaxSize.Width = std::max(
3943 + aMaxSize.Width,
3944 + sz.Width);
3945 + aMaxSize.Height = std::max(
3946 + aMaxSize.Height,
3947 + sz.Height);
3949 + ++aCurrShape;
3952 + aCurrShape=rShape->getChildren().begin();
3953 + const awt::Point aStartPos=(*aCurrShape)->getPosition();
3954 + awt::Point aCurrPos=aStartPos;
3955 + awt::Size aTotalSize;
3956 + aTotalSize.Width = aMaxSize.Width;
3957 + while( aCurrShape != aLastShape )
3959 + const awt::Size& sz=(*aCurrShape)->getSize();
3960 + (*aCurrShape)->setPosition(aCurrPos);
3961 + (*aCurrShape)->setSize(
3962 + awt::Size(aMaxSize.Width,
3963 + sz.Height));
3965 + aTotalSize.Height = std::max(
3966 + aTotalSize.Height,
3967 + aCurrPos.Y + sz.Height);
3969 + aCurrPos.X += nIncX*sz.Width;
3970 + aCurrPos.Y += nIncY*sz.Height;
3972 + ++aCurrShape;
3975 + rShape->setSize(aTotalSize);
3976 + break;
3979 + case XML_conn:
3980 + break;
3982 + case XML_cycle:
3984 + if( rShape->getChildren().empty() )
3986 + rShape->setSize(awt::Size(50,50));
3987 + break;
3990 + const sal_Int32 nStartAngle=maMap.count(XML_stAng) ? maMap.find(XML_stAng)->second : 0;
3991 + const sal_Int32 nSpanAngle=maMap.count(XML_spanAng) ? maMap.find(XML_spanAng)->second : 360;
3993 + std::vector<ShapePtr>::const_iterator aCurrShape=rShape->getChildren().begin();
3994 + const std::vector<ShapePtr>::const_iterator aLastShape=rShape->getChildren().end();
3995 + const sal_Int32 nShapes=aLastShape-aCurrShape;
3997 + // find biggest shape
3998 + awt::Size aMaxSize;
3999 + while( aCurrShape != aLastShape )
4001 + const awt::Size& sz=(*aCurrShape)->getSize();
4003 + aMaxSize.Width = std::max(
4004 + aMaxSize.Width,
4005 + sz.Width);
4006 + aMaxSize.Height = std::max(
4007 + aMaxSize.Height,
4008 + sz.Height);
4010 + ++aCurrShape;
4013 + // layout shapes
4014 + const sal_Int32 nMaxDim=std::max(aMaxSize.Width,aMaxSize.Height);
4015 + awt::Size aTotalSize;
4016 + aCurrShape=rShape->getChildren().begin();
4017 + for( sal_Int32 i=0; i<nShapes; ++i, ++aCurrShape )
4019 + const awt::Size& sz=(*aCurrShape)->getSize();
4021 + const double r=nShapes*nMaxDim/F_2PI * 360.0/nSpanAngle;
4022 + const awt::Point aCurrPos(
4023 + r + r*sin( (double(i)*nSpanAngle/nShapes + nStartAngle)*F_PI180 ),
4024 + r - r*cos( (double(i)*nSpanAngle/nShapes + nStartAngle)*F_PI180 ) );
4025 + (*aCurrShape)->setPosition(aCurrPos);
4027 + aTotalSize.Width = std::max(
4028 + aTotalSize.Width,
4029 + aCurrPos.X + sz.Width);
4030 + aTotalSize.Height = std::max(
4031 + aTotalSize.Height,
4032 + aCurrPos.Y + sz.Height);
4035 + rShape->setSize(aTotalSize);
4036 + break;
4039 + case XML_hierChild:
4040 + case XML_hierRoot:
4041 + break;
4043 + case XML_lin:
4045 + if( rShape->getChildren().empty() )
4047 + rShape->setSize(awt::Size(50,50));
4048 + break;
4051 + const sal_Int32 nDir=maMap.count(XML_linDir) ? maMap.find(XML_linDir)->second : XML_fromL;
4052 + const sal_Int32 nIncX=nDir==XML_fromL ? 1 : (nDir==XML_fromR ? -1 : 0);
4053 + const sal_Int32 nIncY=nDir==XML_fromT ? 1 : (nDir==XML_fromB ? -1 : 0);
4055 + std::vector<ShapePtr>::const_iterator aCurrShape=rShape->getChildren().begin();
4056 + const std::vector<ShapePtr>::const_iterator aLastShape=rShape->getChildren().end();
4057 + const awt::Point aStartPos=(*aCurrShape)->getPosition();
4058 + awt::Point aCurrPos=aStartPos;
4059 + awt::Size aTotalSize;
4060 + while( aCurrShape != aLastShape )
4062 + const awt::Size& sz=(*aCurrShape)->getSize();
4063 + (*aCurrShape)->setPosition(aCurrPos);
4065 + aTotalSize.Width = std::max(
4066 + aTotalSize.Width,
4067 + aCurrPos.X + sz.Width);
4068 + aTotalSize.Height = std::max(
4069 + aTotalSize.Height,
4070 + aCurrPos.Y + sz.Height);
4072 + // HACK: the spacing is arbitrary
4073 + aCurrPos.X += nIncX*(sz.Width+5);
4074 + aCurrPos.Y += nIncY*(sz.Height+5);
4076 + ++aCurrShape;
4079 + rShape->setSize(aTotalSize);
4080 + break;
4083 + case XML_pyra:
4084 + case XML_snake:
4085 + break;
4087 + case XML_sp:
4088 + // HACK. Handled one level higher. Or rather, planned to
4089 + break;
4091 + case XML_tx:
4093 + TextBodyPtr pTextBody=rShape->getTextBody();
4094 + if( !pTextBody ||
4095 + pTextBody->getParagraphs().empty() ||
4096 + pTextBody->getParagraphs().front()->getRuns().empty() )
4098 + rShape->setSize(awt::Size(5,5));
4099 + break;
4102 + // HACK - count chars & paragraphs to come up with *some*
4103 + // notion of necessary size
4104 + const sal_Int32 nHackyFontHeight=50;
4105 + const sal_Int32 nHackyFontWidth=20;
4106 + awt::Size aTotalSize;
4107 + for( sal_Int32 nPara=0; nPara<pTextBody->getParagraphs().size(); ++nPara )
4109 + aTotalSize.Height += nHackyFontHeight;
4111 + sal_Int32 nLocalWidth=0;
4112 + for( sal_Int32 nRun=0; nRun<pTextBody->getParagraphs().at(nPara)->getRuns().size(); ++nRun )
4113 + nLocalWidth +=
4114 + pTextBody->getParagraphs().at(nPara)->getRuns().at(nRun)->getText().getLength()
4115 + * nHackyFontWidth;
4117 + aTotalSize.Width = std::max(
4118 + aTotalSize.Width,
4119 + nLocalWidth);
4122 + rShape->setSize(aTotalSize);
4125 + default:
4126 + break;
4129 + OSL_TRACE("Layouting shape %s: (%d,%d,%d,%d)",
4130 + OUSTRING_TO_CSTR( rName ),
4131 + rShape->getPosition().X,
4132 + rShape->getPosition().Y,
4133 + rShape->getSize().Width,
4134 + rShape->getSize().Height);
4137 +void LayoutNode::accept( LayoutAtomVisitor& rVisitor )
4139 + rVisitor.visit(*this);
4142 +bool LayoutNode::setupShape( const ShapePtr& rShape, const Diagram& rDgm, sal_Int32 nIdx ) const
4144 + // find the data node to grab text from
4145 + DiagramData::PointsNameMap::const_iterator aDataNode=rDgm.getData()->getPointsPresNameMap().find(msName);
4146 + if( aDataNode->second.size() > nIdx &&
4147 + aDataNode != rDgm.getData()->getPointsPresNameMap().end() )
4149 + OSL_TRACE( "Filling content from %d th layout node named \"%s\", modelId \"%s\"",
4150 + nIdx,
4151 + OUSTRING_TO_CSTR( msName ),
4152 + OUSTRING_TO_CSTR( aDataNode->second.at(nIdx)->msModelId ) );
4154 + // got the presentation node - now, need the actual data node:
4155 + const DiagramData::StringMap::const_iterator aNodeName=rDgm.getData()->getPresOfNameMap().find(
4156 + aDataNode->second.at(nIdx)->msModelId);
4157 + if( aNodeName != rDgm.getData()->getPresOfNameMap().end() )
4159 + DiagramData::StringMap::value_type::second_type::const_iterator aVecIter=aNodeName->second.begin();
4160 + const DiagramData::StringMap::value_type::second_type::const_iterator aVecEnd=aNodeName->second.end();
4161 + while( aVecIter != aVecEnd )
4163 + DiagramData::PointNameMap::const_iterator aDataNode2=rDgm.getData()->getPointNameMap().find(aVecIter->first);
4164 + if( aVecIter->second == 0 )
4166 + // grab shape attr from topmost element(s)
4167 + rShape->getShapeProperties() = aDataNode2->second->mpShape->getShapeProperties();
4168 + rShape->getLineProperties() = aDataNode2->second->mpShape->getLineProperties();
4169 + rShape->getFillProperties() = aDataNode2->second->mpShape->getFillProperties();
4170 + rShape->getCustomShapeProperties() = aDataNode2->second->mpShape->getCustomShapeProperties();
4171 + rShape->setMasterTextListStyle( aDataNode2->second->mpShape->getMasterTextListStyle() );
4173 + OSL_TRACE( "Custom shape with preset type %s added for layout node named \"%s\"",
4174 + OUSTRING_TO_CSTR(
4175 + rShape->getCustomShapeProperties()->getShapePresetType()),
4176 + OUSTRING_TO_CSTR( msName ) );
4179 + // append text with right outline level
4180 + if( aDataNode2->second->mpShape->getTextBody() &&
4181 + !aDataNode2->second->mpShape->getTextBody()->getParagraphs().empty() &&
4182 + !aDataNode2->second->mpShape->getTextBody()->getParagraphs().front()->getRuns().empty() )
4184 + TextBodyPtr pTextBody=rShape->getTextBody();
4185 + if( !pTextBody )
4187 + pTextBody.reset( new TextBody() );
4189 + // also copy text attrs
4190 + pTextBody->getTextListStyle() =
4191 + aDataNode2->second->mpShape->getTextBody()->getTextListStyle();
4192 + pTextBody->getTextProperties() =
4193 + aDataNode2->second->mpShape->getTextBody()->getTextProperties();
4195 + rShape->setTextBody(pTextBody);
4198 + TextParagraph& rPara=pTextBody->addParagraph();
4199 + if( aVecIter->second != -1 )
4200 + rPara.getProperties().setLevel(aVecIter->second);
4202 + rPara.addRun(
4203 + aDataNode2->second->mpShape->getTextBody()->getParagraphs().front()->getRuns().front());
4204 + rPara.getProperties().apply(
4205 + aDataNode2->second->mpShape->getTextBody()->getParagraphs().front()->getProperties());
4208 + ++aVecIter;
4211 + else
4213 + OSL_TRACE("ShapeCreationVisitor::visit: no data node name found while processing shape type %s for layout node named \"%s\"",
4214 + OUSTRING_TO_CSTR(
4215 + rShape->getCustomShapeProperties()->getShapePresetType()),
4216 + OUSTRING_TO_CSTR( msName ) );
4219 + // TODO(Q1): apply styling & coloring - taking
4220 + // layout node's styleLbl for both style & color
4221 + // now, but docs are a bit unclear on this
4222 + if( msStyleLabel.getLength() )
4224 + OSL_TRACE("setting style with label %s",
4225 + OUSTRING_TO_CSTR( msStyleLabel ) );
4227 + const DiagramQStyleMap::const_iterator aStyle=rDgm.getStyles().find(msStyleLabel);
4228 + if( aStyle != rDgm.getStyles().end() )
4230 + rShape->getShapeStyleRefs()[XML_fillRef] = aStyle->second.maFillStyle;
4231 + OSL_TRACE("added fill style with id %d", aStyle->second.maFillStyle.mnThemedIdx);
4232 + rShape->getShapeStyleRefs()[XML_lnRef] = aStyle->second.maLineStyle;
4233 + OSL_TRACE("added line style with id %d", aStyle->second.maLineStyle.mnThemedIdx);
4234 + rShape->getShapeStyleRefs()[XML_effectRef] = aStyle->second.maEffectStyle;
4235 + OSL_TRACE("added effect style with id %d", aStyle->second.maEffectStyle.mnThemedIdx);
4236 + rShape->getShapeStyleRefs()[XML_fontRef] = aStyle->second.maTextStyle;
4237 + OSL_TRACE("added fontref style with id %d", aStyle->second.maTextStyle.mnThemedIdx);
4238 + Color aColor=aStyle->second.maTextStyle.maPhClr;
4239 + OSL_TRACE("added fontref color with alpha %d", aColor.getTransparence() );
4242 + const DiagramColorMap::const_iterator aColor=rDgm.getColors().find(msStyleLabel);
4243 + if( aColor != rDgm.getColors().end() )
4245 + const DiagramColor& rColor=aColor->second;
4246 + if( rColor.maFillColor.isUsed() )
4247 + rShape->getShapeStyleRefs()[XML_fillRef].maPhClr = rColor.maFillColor;
4248 + if( rColor.maLineColor.isUsed() )
4249 + rShape->getShapeStyleRefs()[XML_lnRef].maPhClr = rColor.maLineColor;
4250 + if( rColor.maEffectColor.isUsed() )
4251 + rShape->getShapeStyleRefs()[XML_effectRef].maPhClr = rColor.maEffectColor;
4252 + if( rColor.maTextFillColor.isUsed() )
4253 + rShape->getShapeStyleRefs()[XML_fontRef].maPhClr = rColor.maTextFillColor;
4257 + // even if no data node found, successful anyway. it's
4258 + // contained at the layoutnode
4259 + return true;
4261 + else
4263 + OSL_TRACE("ShapeCreationVisitor::visit: no text found while processing shape type %s for layout node named \"%s\"",
4264 + OUSTRING_TO_CSTR(
4265 + rShape->getCustomShapeProperties()->getShapePresetType()),
4266 + OUSTRING_TO_CSTR( msName ) );
4269 + return false;
4272 +///////////////////////////////////////////////////////////////////////
4274 +// Visitation
4277 +class ShapeLayoutingVisitor : public LayoutAtomVisitor
4279 + ShapePtr mpParentShape;
4280 + const Diagram& mrDgm;
4281 + rtl::OUString maName;
4283 + virtual void visit(ConstraintAtom& rAtom);
4284 + virtual void visit(AlgAtom& rAtom);
4285 + virtual void visit(ForEachAtom& rAtom);
4286 + virtual void visit(ConditionAtom& rAtom);
4287 + virtual void visit(ChooseAtom& rAtom);
4288 + virtual void visit(LayoutNode& rAtom);
4290 +public:
4291 + ShapeLayoutingVisitor(const ShapePtr& rParentShape,
4292 + const Diagram& rDgm,
4293 + const rtl::OUString& rName) :
4294 + mpParentShape(rParentShape),
4295 + mrDgm(rDgm),
4296 + maName(rName)
4297 + {}
4299 + void defaultVisit(LayoutAtom& rAtom);
4302 +class ShallowPresNameVisitor : public LayoutAtomVisitor
4304 + const Diagram& mrDgm;
4305 + size_t mnCnt;
4307 + void defaultVisit(LayoutAtom& rAtom);
4308 + virtual void visit(ConstraintAtom& rAtom);
4309 + virtual void visit(AlgAtom& rAtom);
4310 + virtual void visit(ForEachAtom& rAtom);
4311 + virtual void visit(ConditionAtom& rAtom);
4312 + virtual void visit(ChooseAtom& rAtom);
4313 + virtual void visit(LayoutNode& rAtom);
4315 +public:
4316 + ShallowPresNameVisitor(const Diagram& rDgm) :
4317 + mrDgm(rDgm),
4318 + mnCnt(0)
4319 + {}
4321 + size_t getCount() const
4322 + { return mnCnt; }
4325 +void ShapeCreationVisitor::defaultVisit(LayoutAtom& rAtom)
4327 + const std::vector<LayoutAtomPtr>& pChildren=rAtom.getChildren();
4328 + std::for_each( pChildren.begin(), pChildren.end(),
4329 + boost::bind( &LayoutAtom::accept,
4330 + _1,
4331 + boost::ref(*this)) );
4334 +void ShapeCreationVisitor::visit(ConstraintAtom& /*rAtom*/)
4336 + // TODO: eval the constraints
4339 +void ShapeCreationVisitor::visit(AlgAtom& rAtom)
4341 + defaultVisit(rAtom);
4344 -void ForEachAtom::processAtom()
4345 +void ShapeCreationVisitor::visit(ForEachAtom& rAtom)
4347 - // TODO there is likely some conditions
4348 - std::for_each( mpChildNodes.begin(), mpChildNodes.end(),
4349 - boost::bind( &LayoutAtom::processAtom, _1 ) );
4350 + const std::vector<LayoutAtomPtr>& pChildren=rAtom.getChildren();
4352 + sal_Int32 nChildren=1;
4353 + if( rAtom.iterator().mnPtType == XML_node )
4355 + // cound child data nodes - check all child Atoms for "name"
4356 + // attribute that is contained in diagram's
4357 + // getPointsPresNameMap()
4358 + ShallowPresNameVisitor aVisitor(mrDgm);
4359 + std::for_each( pChildren.begin(), pChildren.end(),
4360 + boost::bind( &LayoutAtom::accept,
4361 + _1,
4362 + boost::ref(aVisitor)) );
4363 + nChildren = aVisitor.getCount();
4366 + const sal_Int32 nCnt = std::min(
4367 + nChildren,
4368 + rAtom.iterator().mnCnt==-1 ? nChildren : rAtom.iterator().mnCnt);
4370 + const sal_Int32 nOldIdx=mnCurrIdx;
4371 + const sal_Int32 nStep=rAtom.iterator().mnStep;
4372 + for( mnCurrIdx=0; mnCurrIdx<nCnt && nStep>0; mnCurrIdx+=nStep )
4374 + // TODO there is likely some conditions
4375 + std::for_each( pChildren.begin(), pChildren.end(),
4376 + boost::bind( &LayoutAtom::accept,
4377 + _1,
4378 + boost::ref(*this)) );
4381 + // and restore idx
4382 + mnCurrIdx = nOldIdx;
4385 -/** call ConditionAtom::test() if pAtom is one
4386 - * if it is not a ConditionAtom, then return false.
4387 - */
4388 -static bool _test_atom( const LayoutAtomPtr & pAtom)
4389 +void ShapeCreationVisitor::visit(ConditionAtom& rAtom)
4391 - try {
4392 - bool bResult = false;
4393 - const ConditionAtomPtr pCond = boost::dynamic_pointer_cast< ConditionAtom >(pAtom);
4394 - if( pCond )
4396 - bResult = pCond->test();
4398 - return bResult;
4400 - catch(...)
4403 - return false;
4404 + defaultVisit(rAtom);
4407 -void ChooseAtom::processAtom()
4408 +void ShapeCreationVisitor::visit(ChooseAtom& rAtom)
4410 - std::vector< LayoutAtomPtr >::iterator
4411 - iter = std::find_if( mpChildNodes.begin(), mpChildNodes.end(),
4412 - boost::bind( &_test_atom, _1 ) );
4413 - if( iter != mpChildNodes.end() )
4415 - // TODO do something
4416 - (*iter)->processAtom();
4418 + defaultVisit(rAtom);
4421 -bool ConditionAtom::test()
4422 +void ShapeCreationVisitor::visit(LayoutNode& rAtom)
4424 - // TODO
4425 - return false;
4426 + ShapePtr pCurrParent(mpParentShape);
4427 + ShapePtr pCurrShape(rAtom.getShape());
4428 + if( pCurrShape )
4430 + OSL_TRACE("ShapeCreationVisitor::visit: processing shape type %s",
4431 + OUSTRING_TO_CSTR(
4432 + pCurrShape->getCustomShapeProperties()->getShapePresetType()) );
4434 + // TODO(F3): cloned shape shares all properties by reference,
4435 + // don't change them!
4436 + ShapePtr pClonedShape(
4437 + new Shape( pCurrShape ));
4439 + if( rAtom.setupShape(pClonedShape, mrDgm, mnCurrIdx) )
4441 + pCurrParent->addChild(pClonedShape);
4442 + pCurrParent = pClonedShape;
4445 + else
4447 + OSL_TRACE("ShapeCreationVisitor::visit: no shape set while processing layoutnode named %s",
4448 + OUSTRING_TO_CSTR( rAtom.getName() ) );
4451 + // set new parent for children
4452 + ShapePtr pPreviousParent(mpParentShape);
4453 + mpParentShape=pCurrParent;
4455 + // process children
4456 + defaultVisit(rAtom);
4458 + // restore parent
4459 + mpParentShape=pPreviousParent;
4461 + // layout shapes - now all child shapes are created
4462 + ShapeLayoutingVisitor aLayoutingVisitor(pCurrParent,
4463 + mrDgm,
4464 + rAtom.getName());
4465 + aLayoutingVisitor.defaultVisit(rAtom);
4468 +void ShapeLayoutingVisitor::defaultVisit(LayoutAtom& rAtom)
4470 + // visit all children, one of them need to be the layout algoritm
4471 + const std::vector<LayoutAtomPtr>& pChildren=rAtom.getChildren();
4472 + std::for_each( pChildren.begin(), pChildren.end(),
4473 + boost::bind( &LayoutAtom::accept,
4474 + _1,
4475 + boost::ref(*this)) );
4478 +void ShapeLayoutingVisitor::visit(ConstraintAtom& rAtom)
4480 + // stop processing
4483 +void ShapeLayoutingVisitor::visit(AlgAtom& rAtom)
4485 + rAtom.layoutShape(mpParentShape,mrDgm,maName);
4488 +void ShapeLayoutingVisitor::visit(ForEachAtom& rAtom)
4490 + // stop processing
4493 +void ShapeLayoutingVisitor::visit(ConditionAtom& rAtom)
4495 + defaultVisit(rAtom);
4498 +void ShapeLayoutingVisitor::visit(ChooseAtom& rAtom)
4500 + defaultVisit(rAtom);
4503 +void ShapeLayoutingVisitor::visit(LayoutNode& rAtom)
4505 + // stop processing - only traverse Condition/Choose atoms
4508 +void ShallowPresNameVisitor::defaultVisit(LayoutAtom& rAtom)
4510 + // visit all children, at least one of them needs to have proper
4511 + // name set
4512 + const std::vector<LayoutAtomPtr>& pChildren=rAtom.getChildren();
4513 + std::for_each( pChildren.begin(), pChildren.end(),
4514 + boost::bind( &LayoutAtom::accept,
4515 + _1,
4516 + boost::ref(*this)) );
4519 +void ShallowPresNameVisitor::visit(ConstraintAtom& rAtom)
4521 + // stop processing
4524 +void ShallowPresNameVisitor::visit(AlgAtom& rAtom)
4526 + // stop processing
4529 +void ShallowPresNameVisitor::visit(ForEachAtom& rAtom)
4531 + defaultVisit(rAtom);
4534 +void ShallowPresNameVisitor::visit(ConditionAtom& rAtom)
4536 + defaultVisit(rAtom);
4539 +void ShallowPresNameVisitor::visit(ChooseAtom& rAtom)
4541 + defaultVisit(rAtom);
4544 +void ShallowPresNameVisitor::visit(LayoutNode& rAtom)
4546 + DiagramData::PointsNameMap::const_iterator aDataNode=
4547 + mrDgm.getData()->getPointsPresNameMap().find(rAtom.getName());
4548 + if( aDataNode != mrDgm.getData()->getPointsPresNameMap().end() )
4549 + mnCnt = std::max(mnCnt,
4550 + aDataNode->second.size());
4554 diff --git oox/source/drawingml/diagram/diagramlayoutatoms.hxx oox/source/drawingml/diagram/diagramlayoutatoms.hxx
4555 new file mode 100644
4556 index 0000000..ae9e7c3
4557 --- /dev/null
4558 +++ oox/source/drawingml/diagram/diagramlayoutatoms.hxx
4559 @@ -0,0 +1,318 @@
4560 +/*************************************************************************
4562 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4563 + *
4564 + * Copyright 2008 by Sun Microsystems, Inc.
4566 + * OpenOffice.org - a multi-platform office productivity suite
4568 + * $RCSfile: diagramlayoutatoms.hxx,v $
4569 + * $Revision: 1.3 $
4571 + * This file is part of OpenOffice.org.
4573 + * OpenOffice.org is free software: you can redistribute it and/or modify
4574 + * it under the terms of the GNU Lesser General Public License version 3
4575 + * only, as published by the Free Software Foundation.
4577 + * OpenOffice.org is distributed in the hope that it will be useful,
4578 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
4579 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
4580 + * GNU Lesser General Public License version 3 for more details
4581 + * (a copy is included in the LICENSE file that accompanied this code).
4583 + * You should have received a copy of the GNU Lesser General Public License
4584 + * version 3 along with OpenOffice.org. If not, see
4585 + * <http://www.openoffice.org/license.html>
4586 + * for a copy of the LGPLv3 License.
4588 + ************************************************************************/
4590 +#ifndef OOX_DRAWINGML_DIAGRAMLAYOUTATOMS_HXX
4591 +#define OOX_DRAWINGML_DIAGRAMLAYOUTATOMS_HXX
4593 +#include <map>
4594 +#include <string>
4596 +#include <boost/shared_ptr.hpp>
4597 +#include <boost/array.hpp>
4599 +#include <com/sun/star/uno/Any.hxx>
4600 +#include <com/sun/star/xml/sax/XFastAttributeList.hpp>
4602 +#include "oox/drawingml/shape.hxx"
4603 +#include "diagram.hxx"
4606 +namespace oox { namespace drawingml {
4608 +class DiagramLayout;
4609 +typedef boost::shared_ptr< DiagramLayout > DiagramLayoutPtr;
4611 +// AG_IteratorAttributes
4612 +struct IteratorAttr
4614 + IteratorAttr();
4616 + // not sure this belong here, but wth
4617 + void loadFromXAttr( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
4619 + sal_Int32 mnAxis;
4620 + sal_Int32 mnCnt;
4621 + sal_Bool mbHideLastTrans;
4622 + sal_Int32 mnPtType;
4623 + sal_Int32 mnSt;
4624 + sal_Int32 mnStep;
4627 +struct ConditionAttr
4629 + ConditionAttr();
4631 + // not sure this belong here, but wth
4632 + void loadFromXAttr( const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes );
4634 + sal_Int32 mnFunc;
4635 + sal_Int32 mnArg;
4636 + sal_Int32 mnOp;
4637 + ::rtl::OUString msVal;
4640 +struct LayoutAtomVisitor;
4641 +class LayoutAtom;
4643 +typedef boost::shared_ptr< LayoutAtom > LayoutAtomPtr;
4645 +/** abstract Atom for the layout */
4646 +class LayoutAtom
4648 +public:
4649 + /** visitor acceptance
4650 + */
4651 + virtual void accept( LayoutAtomVisitor& ) = 0;
4653 + void setName( const ::rtl::OUString& sName )
4654 + { msName = sName; }
4655 + const ::rtl::OUString& getName() const
4656 + { return msName; }
4658 + virtual void addChild( const LayoutAtomPtr & pNode )
4659 + { mpChildNodes.push_back( pNode ); }
4660 + virtual const std::vector<LayoutAtomPtr>& getChildren() const
4661 + { return mpChildNodes; }
4663 + // dump for debug
4664 + void dump(int level = 0);
4665 +protected:
4666 + std::vector< LayoutAtomPtr > mpChildNodes;
4667 + ::rtl::OUString msName;
4670 +class ConstraintAtom
4671 + : public LayoutAtom
4673 +public:
4674 + ConstraintAtom() :
4675 + mnFor(-1), msForName(), mnPointType(-1), mnType(-1), mnRefFor(-1), msRefForName(),
4676 + mnRefType(-1), mnRefPointType(-1), mfFactor(1.0), mfValue(0.0), mnOperator(0)
4677 + {}
4679 + virtual void accept( LayoutAtomVisitor& );
4681 + void setFor( sal_Int32 nToken )
4682 + { mnFor = nToken; }
4683 + void setForName( const ::rtl::OUString & sName )
4684 + { msForName = sName; }
4685 + void setPointType( sal_Int32 nToken )
4686 + { mnPointType = nToken; }
4687 + void setType( sal_Int32 nToken )
4688 + { mnType = nToken; }
4689 + void setRefFor( sal_Int32 nToken )
4690 + { mnRefFor = nToken; }
4691 + void setRefForName( const ::rtl::OUString & sName )
4692 + { msRefForName = sName; }
4693 + void setRefType( sal_Int32 nToken )
4694 + { mnRefType = nToken; }
4695 + void setRefPointType( sal_Int32 nToken )
4696 + { mnRefPointType = nToken; }
4697 + void setFactor( const double& fVal )
4698 + { mfFactor = fVal; }
4699 + void setValue( const double& fVal )
4700 + { mfValue = fVal; }
4701 + void setOperator( sal_Int32 nToken )
4702 + { mnOperator = nToken; }
4703 +private:
4704 + sal_Int32 mnFor;
4705 + ::rtl::OUString msForName;
4706 + sal_Int32 mnPointType;
4707 + sal_Int32 mnType;
4708 + sal_Int32 mnRefFor;
4709 + ::rtl::OUString msRefForName;
4710 + sal_Int32 mnRefType;
4711 + sal_Int32 mnRefPointType;
4712 + double mfFactor;
4713 + double mfValue;
4714 + sal_Int32 mnOperator;
4717 +typedef boost::shared_ptr< ConstraintAtom > ConstraintAtomPtr;
4719 +class AlgAtom
4720 + : public LayoutAtom
4722 +public:
4723 + AlgAtom() : mnType(0), maMap() {}
4725 + typedef std::map<sal_Int32,sal_Int32> ParamMap;
4727 + virtual void accept( LayoutAtomVisitor& );
4729 + void setType( sal_Int32 nToken )
4730 + { mnType = nToken; }
4731 + void addParam( sal_Int32 nType, sal_Int32 nVal )
4732 + { maMap[nType]=nVal; }
4733 + void layoutShape( const ShapePtr& rShape,
4734 + const Diagram& rDgm,
4735 + const rtl::OUString& rName ) const;
4736 +private:
4737 + sal_Int32 mnType;
4738 + ParamMap maMap;
4741 +typedef boost::shared_ptr< AlgAtom > AlgAtomPtr;
4743 +class ForEachAtom
4744 + : public LayoutAtom
4746 +public:
4747 + explicit ForEachAtom(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes);
4749 + IteratorAttr & iterator()
4750 + { return maIter; }
4751 + virtual void accept( LayoutAtomVisitor& );
4753 +private:
4754 + IteratorAttr maIter;
4757 +typedef boost::shared_ptr< ForEachAtom > ForEachAtomPtr;
4760 +class ConditionAtom
4761 + : public LayoutAtom
4763 +public:
4764 + explicit ConditionAtom(const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XFastAttributeList >& xAttributes);
4765 + bool test();
4766 + virtual void accept( LayoutAtomVisitor& );
4767 + IteratorAttr & iterator()
4768 + { return maIter; }
4769 + ConditionAttr & cond()
4770 + { return maCond; }
4771 + void readElseBranch()
4772 + { mbElse=true; }
4773 + virtual void addChild( const LayoutAtomPtr & pNode );
4774 + virtual const std::vector<LayoutAtomPtr>& getChildren() const;
4775 +private:
4776 + bool mbElse;
4777 + IteratorAttr maIter;
4778 + ConditionAttr maCond;
4779 + std::vector< LayoutAtomPtr > mpElseChildNodes;
4782 +typedef boost::shared_ptr< ConditionAtom > ConditionAtomPtr;
4785 +/** "choose" statements. Atoms will be tested in order. */
4786 +class ChooseAtom
4787 + : public LayoutAtom
4789 +public:
4790 + virtual void accept( LayoutAtomVisitor& );
4793 +class LayoutNode
4794 + : public LayoutAtom
4796 +public:
4797 + enum {
4798 + VAR_animLvl = 0,
4799 + VAR_animOne,
4800 + VAR_bulletEnabled,
4801 + VAR_chMax,
4802 + VAR_chPref,
4803 + VAR_dir,
4804 + VAR_hierBranch,
4805 + VAR_orgChart,
4806 + VAR_resizeHandles
4807 + };
4808 + // we know that the array is of fixed size
4809 + // the use of Any allow having empty values
4810 + typedef boost::array< ::com::sun::star::uno::Any, 9 > VarMap;
4812 + LayoutNode() : mnChildOrder(0) {}
4813 + virtual void accept( LayoutAtomVisitor& );
4814 + VarMap & variables()
4815 + { return mVariables; }
4816 + void setMoveWith( const ::rtl::OUString & sName )
4817 + { msMoveWith = sName; }
4818 + void setStyleLabel( const ::rtl::OUString & sLabel )
4819 + { msStyleLabel = sLabel; }
4820 + void setChildOrder( sal_Int32 nOrder )
4821 + { mnChildOrder = nOrder; }
4822 + void setShape( const ShapePtr& pShape )
4823 + { mpShape = pShape; }
4824 + const ShapePtr& getShape() const
4825 + { return mpShape; }
4827 + bool setupShape( const ShapePtr& rShape,
4828 + const Diagram& rDgm,
4829 + sal_Int32 nIdx ) const;
4831 +private:
4832 + VarMap mVariables;
4833 + ::rtl::OUString msMoveWith;
4834 + ::rtl::OUString msStyleLabel;
4835 + ShapePtr mpShape;
4836 + sal_Int32 mnChildOrder;
4839 +typedef boost::shared_ptr< LayoutNode > LayoutNodePtr;
4841 +struct LayoutAtomVisitor
4843 + virtual ~LayoutAtomVisitor() {}
4844 + virtual void visit(ConstraintAtom& rAtom) = 0;
4845 + virtual void visit(AlgAtom& rAtom) = 0;
4846 + virtual void visit(ForEachAtom& rAtom) = 0;
4847 + virtual void visit(ConditionAtom& rAtom) = 0;
4848 + virtual void visit(ChooseAtom& rAtom) = 0;
4849 + virtual void visit(LayoutNode& rAtom) = 0;
4852 +class ShapeCreationVisitor : public LayoutAtomVisitor
4854 + ShapePtr mpParentShape;
4855 + const Diagram& mrDgm;
4856 + sal_Int32 mnCurrIdx;
4858 + void defaultVisit(LayoutAtom& rAtom);
4859 + virtual void visit(ConstraintAtom& rAtom);
4860 + virtual void visit(AlgAtom& rAtom);
4861 + virtual void visit(ForEachAtom& rAtom);
4862 + virtual void visit(ConditionAtom& rAtom);
4863 + virtual void visit(ChooseAtom& rAtom);
4864 + virtual void visit(LayoutNode& rAtom);
4866 +public:
4867 + ShapeCreationVisitor(const ShapePtr& rParentShape,
4868 + const Diagram& rDgm) :
4869 + mpParentShape(rParentShape),
4870 + mrDgm(rDgm),
4871 + mnCurrIdx(0)
4872 + {}
4875 +} }
4877 +#endif
4878 diff --git oox/source/drawingml/diagram/layoutnodecontext.cxx oox/source/drawingml/diagram/layoutnodecontext.cxx
4879 index d1f96b2..826ee4f 100644
4880 --- oox/source/drawingml/diagram/layoutnodecontext.cxx
4881 +++ oox/source/drawingml/diagram/layoutnodecontext.cxx
4882 @@ -35,7 +35,9 @@
4883 #include "oox/core/namespaces.hxx"
4884 #include "oox/drawingml/diagram/diagram.hxx"
4885 #include "oox/drawingml/shapecontext.hxx"
4886 +#include "oox/drawingml/customshapeproperties.hxx"
4887 #include "diagramdefinitioncontext.hxx"
4888 +#include "constraintlistcontext.hxx"
4890 using namespace ::oox::core;
4891 using namespace ::com::sun::star::uno;
4892 @@ -50,15 +52,9 @@ class IfContext
4893 public:
4894 IfContext( ContextHandler& rParent,
4895 const Reference< XFastAttributeList >& xAttribs,
4896 - const LayoutAtomPtr & pNode )
4897 - : LayoutNodeContext( rParent, xAttribs, pNode )
4899 - ConditionAtomPtr pAtom( boost::dynamic_pointer_cast< ConditionAtom >(pNode) );
4900 - OSL_ENSURE( pAtom, "Must pass a ConditionAtom" );
4902 - pAtom->iterator().loadFromXAttr( xAttribs );
4903 - pAtom->cond().loadFromXAttr( xAttribs );
4905 + const ConditionAtomPtr& pAtom )
4906 + : LayoutNodeContext( rParent, xAttribs, pAtom )
4907 + {}
4911 @@ -67,21 +63,47 @@ class AlgorithmContext
4912 : public ContextHandler
4914 public:
4915 - AlgorithmContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, const LayoutAtomPtr & pNode )
4916 + AlgorithmContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, const AlgAtomPtr & pNode )
4917 : ContextHandler( rParent )
4918 , mnRevision( 0 )
4919 - , mnType( 0 )
4920 , mpNode( pNode )
4922 AttributeList aAttribs( xAttribs );
4923 mnRevision = aAttribs.getInteger( XML_rev, 0 );
4924 - mnType = xAttribs->getOptionalValueToken( XML_type, 0 );
4925 + pNode->setType(xAttribs->getOptionalValueToken(XML_type, 0));
4928 + virtual Reference< XFastContextHandler > SAL_CALL
4929 + createFastChildContext( ::sal_Int32 aElement,
4930 + const Reference< XFastAttributeList >& xAttribs )
4931 + throw (SAXException, RuntimeException)
4933 + Reference< XFastContextHandler > xRet;
4935 + switch( getToken(aElement) )
4937 + case XML_param:
4939 + AttributeList aAttribs( xAttribs );
4940 + const sal_Int32 nValTok=aAttribs.getToken( XML_val, 0 );
4941 + mpNode->addParam(
4942 + aAttribs.getToken( XML_type, 0 ),
4943 + nValTok>0 ? nValTok : aAttribs.getInteger( XML_val, 0 ) );
4944 + break;
4946 + default:
4947 + break;
4950 + if( !xRet.is() )
4951 + xRet.set(this);
4953 + return xRet;
4956 private:
4957 - sal_Int32 mnRevision;
4958 - sal_Int32 mnType;
4959 - LayoutAtomPtr mpNode;
4960 + sal_Int32 mnRevision;
4961 + AlgAtomPtr mpNode;
4965 @@ -91,7 +113,6 @@ class ChooseContext
4966 public:
4967 ChooseContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, const LayoutAtomPtr & pNode )
4968 : ContextHandler( rParent )
4969 - , mbHasElse( false )
4970 , mpNode( pNode )
4972 msName = xAttribs->getOptionalValue( XML_name );
4973 @@ -104,24 +125,23 @@ public:
4975 Reference< XFastContextHandler > xRet;
4977 - switch( aElement )
4978 + switch( getToken(aElement) )
4980 case XML_if:
4982 // CT_When
4983 - LayoutAtomPtr pAtom( new ConditionAtom( false ) );
4984 - mpNode->addChild( pAtom );
4985 - xRet.set( new IfContext( *this, xAttribs, pAtom ) );
4986 + mpConditionNode.reset( new ConditionAtom(xAttribs) );
4987 + mpNode->addChild( mpConditionNode );
4988 + xRet.set( new IfContext( *this, xAttribs, mpConditionNode ) );
4989 break;
4991 case XML_else:
4992 // CT_Otherwise
4993 - if( !mbHasElse )
4994 + if( mpConditionNode )
4996 - LayoutAtomPtr pAtom( new ConditionAtom( true ) );
4997 - mpNode->addChild( pAtom );
4998 - xRet.set( new IfContext( *this, xAttribs, pAtom ) );
4999 - mbHasElse = true;
5000 + mpConditionNode->readElseBranch();
5001 + xRet.set( new IfContext( *this, xAttribs, mpConditionNode ) );
5002 + mpConditionNode.reset();
5004 else
5006 @@ -138,9 +158,9 @@ public:
5007 return xRet;
5009 private:
5010 - bool mbHasElse;
5011 OUString msName;
5012 LayoutAtomPtr mpNode;
5013 + ConditionAtomPtr mpConditionNode;
5017 @@ -150,13 +170,10 @@ class ForEachContext
5018 : public LayoutNodeContext
5020 public:
5021 - ForEachContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, const LayoutAtomPtr & pNode )
5022 - : LayoutNodeContext( rParent, xAttribs, pNode )
5023 + ForEachContext( ContextHandler& rParent, const Reference< XFastAttributeList >& xAttribs, const ForEachAtomPtr& pAtom )
5024 + : LayoutNodeContext( rParent, xAttribs, pAtom )
5026 - ForEachAtomPtr pAtom( boost::dynamic_pointer_cast< ForEachAtom >(pNode) );
5027 - OSL_ENSURE( pAtom, "Must pass a ForEachAtom" );
5028 xAttribs->getOptionalValue( XML_ref );
5030 pAtom->iterator().loadFromXAttr( xAttribs );
5033 @@ -200,17 +217,12 @@ private:
5034 // CT_LayoutNode
5035 LayoutNodeContext::LayoutNodeContext( ContextHandler& rParent,
5036 const Reference< XFastAttributeList >& xAttribs,
5037 - const LayoutAtomPtr &pNode )
5038 + const LayoutAtomPtr& pAtom )
5039 : ContextHandler( rParent )
5040 - , mpNode( pNode )
5041 + , mpNode( pAtom )
5043 - OSL_ENSURE( pNode, "Node must NOT be NULL" );
5044 + OSL_ENSURE( pAtom, "Node must NOT be NULL" );
5045 mpNode->setName( xAttribs->getOptionalValue( XML_name ) );
5046 - // TODO shall we even bother?
5047 - // b or t
5048 -// sal_Int32 nChOrder = xAttributes->getOptionalValueToken( XML_chOrder, XML_b );
5049 -// OUString sMoveWith = xAttributes->getOptionalValue( XML_moveWith );
5050 -// OUString sStyleLbl = xAttributes->getOptionalValue( XML_styleLbl );
5054 @@ -231,33 +243,33 @@ void SAL_CALL LayoutNodeContext::endFastElement( ::sal_Int32 )
5055 sal_Int32 LayoutNodeContext::tagToVarIdx( sal_Int32 aTag )
5057 sal_Int32 nIdx = -1;
5058 - switch( aTag )
5059 + switch( aTag & ~NMSP_DIAGRAM )
5061 - case NMSP_DIAGRAM|XML_animLvl:
5062 + case XML_animLvl:
5063 nIdx = LayoutNode::VAR_animLvl;
5064 break;
5065 - case NMSP_DIAGRAM|XML_animOne:
5066 + case XML_animOne:
5067 nIdx = LayoutNode::VAR_animOne;
5068 break;
5069 - case NMSP_DIAGRAM|XML_bulletEnabled:
5070 + case XML_bulletEnabled:
5071 nIdx = LayoutNode::VAR_bulletEnabled;
5072 break;
5073 - case NMSP_DIAGRAM|XML_chMax:
5074 + case XML_chMax:
5075 nIdx = LayoutNode::VAR_chMax;
5076 break;
5077 - case NMSP_DIAGRAM|XML_chPref:
5078 + case XML_chPref:
5079 nIdx = LayoutNode::VAR_chPref;
5080 break;
5081 - case NMSP_DIAGRAM|XML_dir:
5082 + case XML_dir:
5083 nIdx = LayoutNode::VAR_dir;
5084 break;
5085 - case NMSP_DIAGRAM|XML_hierBranch:
5086 + case XML_hierBranch:
5087 nIdx = LayoutNode::VAR_hierBranch;
5088 break;
5089 - case NMSP_DIAGRAM|XML_orgChart:
5090 + case XML_orgChart:
5091 nIdx = LayoutNode::VAR_orgChart;
5092 break;
5093 - case NMSP_DIAGRAM|XML_resizeHandles:
5094 + case XML_resizeHandles:
5095 nIdx = LayoutNode::VAR_resizeHandles;
5096 break;
5097 default:
5098 @@ -280,13 +292,39 @@ LayoutNodeContext::createFastChildContext( ::sal_Int32 aElement,
5100 LayoutNodePtr pNode( new LayoutNode() );
5101 mpNode->addChild( pNode );
5102 + pNode->setChildOrder( xAttribs->getOptionalValueToken( XML_chOrder, XML_b ) );
5103 + pNode->setMoveWith( xAttribs->getOptionalValue( XML_moveWith ) );
5104 + pNode->setStyleLabel( xAttribs->getOptionalValue( XML_styleLbl ) );
5105 xRet.set( new LayoutNodeContext( *this, xAttribs, pNode ) );
5106 break;
5108 case NMSP_DIAGRAM|XML_shape:
5110 - ShapePtr pShape( new Shape() );
5111 - xRet.set( new ShapeContext( *this, ShapePtr(), pShape ) );
5112 + LayoutNodePtr pNode( boost::dynamic_pointer_cast< LayoutNode >( mpNode ) );
5113 + if( pNode )
5115 + ShapePtr pShape;
5117 + if( xAttribs->hasAttribute( XML_type ) )
5119 + pShape.reset( new Shape("com.sun.star.drawing.CustomShape") );
5120 + const sal_Int32 nType(xAttribs->getOptionalValueToken( XML_type, XML_obj ));
5121 + pShape->setSubType( nType );
5122 + pShape->getCustomShapeProperties()->setShapePresetType(
5123 + GetShapePresetType( nType ) );
5125 + else
5127 + pShape.reset( new Shape("com.sun.star.drawing.GroupShape") );
5130 + pNode->setShape( pShape );
5131 + xRet.set( new ShapeContext( *this, ShapePtr(), pShape ) );
5133 + else
5135 + OSL_TRACE( "OOX: encountered a shape in a non layoutNode context" );
5137 break;
5139 case NMSP_DIAGRAM|XML_extLst:
5140 @@ -295,7 +333,7 @@ LayoutNodeContext::createFastChildContext( ::sal_Int32 aElement,
5141 case NMSP_DIAGRAM|XML_alg:
5143 // CT_Algorithm
5144 - LayoutAtomPtr pAtom( new AlgAtom );
5145 + AlgAtomPtr pAtom( new AlgAtom );
5146 mpNode->addChild( pAtom );
5147 xRet.set( new AlgorithmContext( *this, xAttribs, pAtom ) );
5148 break;
5149 @@ -311,14 +349,14 @@ LayoutNodeContext::createFastChildContext( ::sal_Int32 aElement,
5150 case NMSP_DIAGRAM|XML_forEach:
5152 // CT_ForEach
5153 - LayoutAtomPtr pAtom( new ForEachAtom );
5154 + ForEachAtomPtr pAtom( new ForEachAtom(xAttribs) );
5155 mpNode->addChild( pAtom );
5156 xRet.set( new ForEachContext( *this, xAttribs, pAtom ) );
5157 break;
5159 case NMSP_DIAGRAM|XML_constrLst:
5160 // CT_Constraints
5161 - // TODO
5162 + xRet.set( new ConstraintListContext( *this, xAttribs, mpNode ) );
5163 break;
5164 case NMSP_DIAGRAM|XML_presOf:
5166 diff --git oox/source/drawingml/diagram/layoutnodecontext.hxx oox/source/drawingml/diagram/layoutnodecontext.hxx
5167 index 999993e..4efa66e 100644
5168 --- oox/source/drawingml/diagram/layoutnodecontext.hxx
5169 +++ oox/source/drawingml/diagram/layoutnodecontext.hxx
5170 @@ -32,7 +32,8 @@
5171 #define OOX_DRAWINGML_LAYOUTNODECONTEXT_HXX
5173 #include "oox/core/contexthandler.hxx"
5174 -#include "oox/drawingml/diagram/diagram.hxx"
5175 +#include "diagramlayoutatoms.hxx"
5176 +#include "diagram.hxx"
5178 namespace oox { namespace drawingml {
5180 diff --git oox/source/drawingml/diagram/makefile.mk oox/source/drawingml/diagram/makefile.mk
5181 index 11fca2a..3863d31 100644
5182 --- oox/source/drawingml/diagram/makefile.mk
5183 +++ oox/source/drawingml/diagram/makefile.mk
5184 @@ -45,6 +45,7 @@ ENABLE_EXCEPTIONS=TRUE
5185 # --- Files --------------------------------------------------------
5187 SLOFILES = \
5188 + $(SLO)$/constraintlistcontext.obj \
5189 $(SLO)$/diagram.obj \
5190 $(SLO)$/diagramfragmenthandler.obj \
5191 $(SLO)$/diagramdefinitioncontext.obj \
5192 diff --git oox/source/drawingml/drawingmltypes.cxx oox/source/drawingml/drawingmltypes.cxx
5193 index 7482bc6..aaa4788 100644
5194 --- oox/source/drawingml/drawingmltypes.cxx
5195 +++ oox/source/drawingml/drawingmltypes.cxx
5196 @@ -162,6 +162,7 @@ float GetFontHeight( sal_Int32 nHeight )
5198 sal_Int16 GetFontUnderline( sal_Int32 nToken )
5200 + OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
5201 switch( nToken )
5203 case XML_none: return FontUnderline::NONE;
5204 @@ -188,6 +189,7 @@ sal_Int16 GetFontUnderline( sal_Int32 nToken )
5206 sal_Int16 GetFontStrikeout( sal_Int32 nToken )
5208 + OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
5209 switch( nToken )
5211 case XML_dblStrike: return FontStrikeout::DOUBLE;
5212 @@ -210,6 +212,7 @@ sal_Int16 GetCaseMap( sal_Int32 nToken )
5213 /** converts a paragraph align to a ParaAdjust */
5214 sal_Int16 GetParaAdjust( sal_Int32 nAlign )
5216 + OSL_ASSERT((nAlign & sal_Int32(0xFFFF0000))==0);
5217 sal_Int16 nEnum;
5218 switch( nAlign )
5220 @@ -238,6 +241,7 @@ sal_Int16 GetParaAdjust( sal_Int32 nAlign )
5222 TabAlign GetTabAlign( sal_Int32 aToken )
5224 + OSL_ASSERT((aToken & sal_Int32(0xFFFF0000))==0);
5225 TabAlign nEnum;
5226 switch( aToken )
5228 diff --git oox/source/drawingml/fillproperties.cxx oox/source/drawingml/fillproperties.cxx
5229 index a9ac083..dc2050d 100644
5230 --- oox/source/drawingml/fillproperties.cxx
5231 +++ oox/source/drawingml/fillproperties.cxx
5232 @@ -83,6 +83,7 @@ static const sal_Char* const sppcDefaultPicNames[] =
5234 BitmapMode lclGetBitmapMode( sal_Int32 nToken )
5236 + OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
5237 switch( nToken )
5239 case XML_tile: return BitmapMode_REPEAT;
5240 @@ -93,6 +94,7 @@ BitmapMode lclGetBitmapMode( sal_Int32 nToken )
5242 RectanglePoint lclGetRectanglePoint( sal_Int32 nToken )
5244 + OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
5245 switch( nToken )
5247 case XML_tl: return RectanglePoint_LEFT_TOP;
5248 @@ -276,6 +278,7 @@ void FillProperties::pushToPropMap( PropertyMap& rPropMap, const FillPropertyNam
5249 nShapeRotation = 0;
5251 FillStyle eFillStyle = FillStyle_NONE;
5252 + OSL_ASSERT((moFillType.get() & sal_Int32(0xFFFF0000))==0);
5253 switch( moFillType.get() )
5255 case XML_noFill:
5256 diff --git oox/source/drawingml/graphicshapecontext.cxx oox/source/drawingml/graphicshapecontext.cxx
5257 index 722c74a..9520eef 100644
5258 --- oox/source/drawingml/graphicshapecontext.cxx
5259 +++ oox/source/drawingml/graphicshapecontext.cxx
5260 @@ -33,7 +33,7 @@
5261 #include "oox/drawingml/fillpropertiesgroupcontext.hxx"
5262 #include "oox/drawingml/graphicshapecontext.hxx"
5263 #include "oox/drawingml/customshapeproperties.hxx"
5264 -#include "oox/drawingml/diagram/diagramfragmenthandler.hxx"
5265 +#include "oox/drawingml/diagram/diagram.hxx"
5266 #include "oox/drawingml/table/tablecontext.hxx"
5267 #include "oox/core/namespaces.hxx"
5268 #include "oox/core/xmlfilterbase.hxx"
5269 @@ -92,7 +92,7 @@ Reference< XFastContextHandler > GraphicShapeContext::createFastChildContext( sa
5270 (mpShapePtr->getCustomShapeProperties());
5272 sal_uInt32 nType = aElementToken & (~ NMSP_MASK);
5273 - OUString sType(GetShapeType(nType));
5274 + OUString sType(GetShapePresetType(nType));
5276 if (sType.getLength() > 0)
5277 pCstmShpProps->setShapePresetType(sType);
5278 @@ -115,6 +115,7 @@ Reference< XFastContextHandler > GraphicalObjectFrameContext::createFastChildCon
5280 Reference< XFastContextHandler > xRet;
5282 + OSL_ASSERT(((aElementToken &(~NMSP_MASK)) & sal_Int32(0xFFFF0000))==0);
5283 switch( aElementToken &(~NMSP_MASK) )
5285 // CT_ShapeProperties
5286 @@ -236,6 +237,7 @@ Reference< XFastContextHandler > PresentationOle2006Context::createFastChildCont
5288 Reference< XFastContextHandler > xRet;
5290 + OSL_ASSERT(((aElementToken &(~NMSP_MASK)) & sal_Int32(0xFFFF0000))==0);
5291 switch( aElementToken &(~NMSP_MASK) )
5293 case XML_oleObj:
5294 @@ -277,48 +279,6 @@ DiagramGraphicDataContext::~DiagramGraphicDataContext()
5298 -DiagramPtr DiagramGraphicDataContext::loadDiagram()
5300 - DiagramPtr pDiagram( new Diagram() );
5301 - XmlFilterBase& rFilter = getFilter();
5303 - // data
5304 - OUString sDmPath = getFragmentPathFromRelId( msDm );
5305 - if( sDmPath.getLength() > 0 )
5307 - DiagramDataPtr pData( new DiagramData() );
5308 - pDiagram->setData( pData );
5309 - rFilter.importFragment( new DiagramDataFragmentHandler( rFilter, sDmPath, pData ) );
5311 - // layout
5312 - OUString sLoPath = getFragmentPathFromRelId( msLo );
5313 - if( sLoPath.getLength() > 0 )
5315 - DiagramLayoutPtr pLayout( new DiagramLayout() );
5316 - pDiagram->setLayout( pLayout );
5317 - rFilter.importFragment( new DiagramLayoutFragmentHandler( rFilter, sLoPath, pLayout ) );
5319 - // style
5320 - OUString sQsPath = getFragmentPathFromRelId( msQs );
5321 - if( sQsPath.getLength() > 0 )
5323 - DiagramQStylesPtr pStyles( new DiagramQStyles() );
5324 - pDiagram->setQStyles( pStyles );
5325 - rFilter.importFragment( new DiagramQStylesFragmentHandler( rFilter, sQsPath, pStyles ) );
5327 - // colors
5328 - OUString sCsPath = getFragmentPathFromRelId( msCs );
5329 - if( sCsPath.getLength() > 0 )
5331 - DiagramColorsPtr pColors( new DiagramColors() );
5332 - pDiagram->setColors( pColors );
5333 - rFilter.importFragment( new DiagramColorsFragmentHandler( rFilter, sCsPath, pColors ) ) ;
5336 - return pDiagram;
5340 Reference< XFastContextHandler > DiagramGraphicDataContext::createFastChildContext( ::sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs )
5341 throw (SAXException, RuntimeException)
5343 @@ -332,8 +292,12 @@ Reference< XFastContextHandler > DiagramGraphicDataContext::createFastChildConte
5344 msLo = xAttribs->getOptionalValue( NMSP_RELATIONSHIPS|XML_lo );
5345 msQs = xAttribs->getOptionalValue( NMSP_RELATIONSHIPS|XML_qs );
5346 msCs = xAttribs->getOptionalValue( NMSP_RELATIONSHIPS|XML_cs );
5347 - DiagramPtr pDiagram = loadDiagram();
5348 - pDiagram->addTo( mpShapePtr );
5349 + loadDiagram(mpShapePtr,
5350 + getFilter(),
5351 + getFragmentPathFromRelId( msDm ),
5352 + getFragmentPathFromRelId( msLo ),
5353 + getFragmentPathFromRelId( msQs ),
5354 + getFragmentPathFromRelId( msCs ));
5355 OSL_TRACE("diagram added shape %s of type %s", OUSTRING_TO_CSTR( mpShapePtr->getName() ),
5356 OUSTRING_TO_CSTR( mpShapePtr->getServiceName() ) );
5357 break;
5358 @@ -388,7 +352,8 @@ void CreateChartCallback::onCreateXShape( const Reference< drawing::XShape >& rx
5360 // convert imported chart model to chart document
5361 Reference< chart2::XChartDocument > xChartDoc( xDocModel, UNO_QUERY_THROW );
5362 - mrFilter.getChartConverter().convertFromModel( mrFilter, aModel, xChartDoc );
5363 + if( mrFilter.getChartConverter() )
5364 + mrFilter.getChartConverter()->convertFromModel( mrFilter, aModel, xChartDoc );
5366 catch( Exception& )
5368 diff --git oox/source/drawingml/lineproperties.cxx oox/source/drawingml/lineproperties.cxx
5369 index d46d46e..4e7a591 100644
5370 --- oox/source/drawingml/lineproperties.cxx
5371 +++ oox/source/drawingml/lineproperties.cxx
5372 @@ -76,6 +76,7 @@ static const sal_Char* const sppcDefaultLineNames[] =
5374 DashStyle lclGetDashStyle( sal_Int32 nToken )
5376 + OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
5377 switch( nToken )
5379 case XML_rnd: return DashStyle_ROUNDRELATIVE;
5380 @@ -87,6 +88,7 @@ DashStyle lclGetDashStyle( sal_Int32 nToken )
5382 LineJoint lclGetLineJoint( sal_Int32 nToken )
5384 + OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
5385 switch( nToken )
5387 case XML_round: return LineJoint_ROUND;
5388 @@ -102,6 +104,7 @@ const sal_Int32 OOX_ARROWSIZE_LARGE = 2;
5390 sal_Int32 lclGetArrowSize( sal_Int32 nToken )
5392 + OSL_ASSERT((nToken & sal_Int32(0xFFFF0000))==0);
5393 switch( nToken )
5395 case XML_sm: return OOX_ARROWSIZE_SMALL;
5396 @@ -123,6 +126,7 @@ void lclPushMarkerProperties( PropertyMap& rPropMap, const LineArrowProperties&
5398 OUStringBuffer aBuffer;
5399 sal_Int32 nArrowType = rArrowProps.moArrowType.get( XML_none );
5400 + OSL_ASSERT((nArrowType & sal_Int32(0xFFFF0000))==0);
5401 switch( nArrowType )
5403 case XML_triangle:
5404 @@ -179,6 +183,7 @@ void lclPushMarkerProperties( PropertyMap& rPropMap, const LineArrowProperties&
5405 #define OOX_ARROW_POINT( x, y ) Point( static_cast< sal_Int32 >( fArrowWidth * x ), static_cast< sal_Int32 >( fArrowLength * y ) )
5407 ::std::vector< Point > aPoints;
5408 + OSL_ASSERT((rArrowProps.moArrowType.get() & sal_Int32(0xFFFF0000))==0);
5409 switch( rArrowProps.moArrowType.get() )
5411 case XML_triangle:
5412 @@ -347,6 +352,7 @@ void LineProperties::pushToPropMap( PropertyMap& rPropMap, const LinePropertyNam
5413 aLineDash.DashLen = 8 * nLineWidth;
5414 aLineDash.Distance = 3 * nLineWidth;
5416 + OSL_ASSERT((moPresetDash.get() & sal_Int32(0xFFFF0000))==0);
5417 switch( moPresetDash.get() )
5419 default:
5420 diff --git oox/source/drawingml/makefile.mk oox/source/drawingml/makefile.mk
5421 index bc10fd0..9cd2c5c 100644
5422 --- oox/source/drawingml/makefile.mk
5423 +++ oox/source/drawingml/makefile.mk
5424 @@ -63,6 +63,7 @@ SLOFILES = \
5425 $(SLO)$/linepropertiescontext.obj\
5426 $(SLO)$/objectdefaultcontext.obj\
5427 $(SLO)$/shape.obj\
5428 + $(SLO)$/shape3dproperties.obj\
5429 $(SLO)$/shapecontext.obj\
5430 $(SLO)$/shapegroupcontext.obj\
5431 $(SLO)$/shapepropertiescontext.obj\
5432 diff --git oox/source/drawingml/scene3dcontext.cxx oox/source/drawingml/scene3dcontext.cxx
5433 new file mode 100644
5434 index 0000000..e7008eb
5435 --- /dev/null
5436 +++ oox/source/drawingml/scene3dcontext.cxx
5437 @@ -0,0 +1,189 @@
5438 +/*************************************************************************
5440 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5442 + * Copyright 2008 by Sun Microsystems, Inc.
5444 + * OpenOffice.org - a multi-platform office productivity suite
5446 + * $RCSfile: fillpropertiesgroupcontext.cxx,v $
5447 + * $Revision: 1.8.6.1 $
5449 + * This file is part of OpenOffice.org.
5451 + * OpenOffice.org is free software: you can redistribute it and/or modify
5452 + * it under the terms of the GNU Lesser General Public License version 3
5453 + * only, as published by the Free Software Foundation.
5455 + * OpenOffice.org is distributed in the hope that it will be useful,
5456 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5457 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5458 + * GNU Lesser General Public License version 3 for more details
5459 + * (a copy is included in the LICENSE file that accompanied this code).
5461 + * You should have received a copy of the GNU Lesser General Public License
5462 + * version 3 along with OpenOffice.org. If not, see
5463 + * <http://www.openoffice.org/license.html>
5464 + * for a copy of the LGPLv3 License.
5466 + ************************************************************************/
5468 +#include "oox/drawingml/scene3dcontext.hxx"
5469 +#include <com/sun/star/io/XInputStream.hpp>
5470 +#include <com/sun/star/graphic/XGraphicProvider.hpp>
5471 +#include <cppuhelper/exc_hlp.hxx>
5472 +#include <comphelper/anytostring.hxx>
5473 +#include "oox/drawingml/colorchoicecontext.hxx"
5474 +#include "oox/drawingml/drawingmltypes.hxx"
5475 +#include "oox/drawingml/fillproperties.hxx"
5476 +#include "oox/core/namespaces.hxx"
5477 +#include "oox/core/xmlfilterbase.hxx"
5478 +#include "oox/helper/attributelist.hxx"
5480 +using ::rtl::OUString;
5481 +using ::oox::core::ContextHandler;
5482 +using ::oox::core::XmlFilterBase;
5483 +using namespace ::com::sun::star;
5484 +using namespace ::com::sun::star::uno;
5485 +using namespace ::com::sun::star::xml::sax;
5487 +namespace oox { namespace drawingml {
5489 +Scene3DContext::Scene3DContext( ContextHandler& rParent, Shape3DProperties& r3DProperties ) throw()
5490 +: ContextHandler( rParent )
5491 +, mr3DProperties( r3DProperties )
5495 +Reference< XFastContextHandler > Scene3DContext::createFastChildContext( sal_Int32 aElementToken, const Reference< XFastAttributeList >& xAttribs )
5496 + throw ( SAXException, RuntimeException )
5498 + AttributeList aAttribs( xAttribs );
5499 + Reference< XFastContextHandler > xRet;
5501 + switch( aElementToken )
5503 + case NMSP_DRAWINGML|XML_camera:
5504 + mr3DProperties.mfFieldOfVision = aAttribs.getInteger( XML_fov, 0 ) / 36000000.0;
5505 + mr3DProperties.mfZoom = aAttribs.getInteger( XML_zoom, 100000 ) / 100000.0;
5506 + mr3DProperties.mnPreset = aAttribs.getToken( XML_prst, XML_none );
5508 +legacyObliqueTopLeft
5509 +legacyObliqueTop
5510 +legacyObliqueTopRight
5511 +legacyObliqueLeft
5512 +legacyObliqueFront
5513 +legacyObliqueRight
5514 +legacyObliqueBottomLeft
5515 +legacyObliqueBottom
5516 +legacyObliqueBottomRight
5517 +legacyPerspectiveTopLeft
5518 +legacyPerspectiveTop
5519 +legacyPerspectiveTopRight
5520 +legacyPerspectiveLeft
5521 +legacyPerspectiveFront
5522 +legacyPerspectiveRight
5523 +legacyPerspectiveBottomLeft
5524 +legacyPerspectiveBottom
5525 +legacyPerspectiveBottomRight
5526 +orthographicFront
5527 +isometricTopUp
5528 +isometricTopDown
5529 +isometricBottomUp
5530 +isometricBottomDown
5531 +isometricLeftUp
5532 +isometricLeftDown
5533 +isometricRightUp
5534 +isometricRightDown
5535 +isometricOffAxis1Left
5536 +isometricOffAxis1Right
5537 +isometricOffAxis1Top
5538 +isometricOffAxis2Left
5539 +isometricOffAxis2Right
5540 +isometricOffAxis2Top
5541 +isometricOffAxis3Left
5542 +isometricOffAxis3Right
5543 +isometricOffAxis3Bottom
5544 +isometricOffAxis4Left
5545 +isometricOffAxis4Right
5546 +isometricOffAxis4Bottom
5547 +obliqueTopLeft
5548 +obliqueTop
5549 +obliqueTopRight
5550 +obliqueLeft
5551 +obliqueRight
5552 +obliqueBottomLeft
5553 +obliqueBottom
5554 +obliqueBottomRight
5555 +perspectiveFront
5556 +perspectiveLeft
5557 +perspectiveRight
5558 +perspectiveAbove
5559 +perspectiveBelow
5560 +perspectiveAboveLeftFacing
5561 +perspectiveAboveRightFacing
5562 +perspectiveContrastingLeftFacing
5563 +perspectiveContrastingRightFacing
5564 +perspectiveHeroicLeftFacing
5565 +perspectiveHeroicRightFacing
5566 +perspectiveHeroicExtremeLeftFacing
5567 +perspectiveHeroicExtremeRightFacing
5568 +perspectiveRelaxed
5569 +perspectiveRelaxedModerately
5572 + // TODO: nested element XML_rot
5573 + break;
5574 + case NMSP_DRAWINGML|XML_lightRig:
5575 + mr3DProperties.mnLightRigDirection = aAttribs.getToken( XML_dir, XML_none );
5577 +XML_tl
5578 +XML_t
5579 +XML_tr
5580 +XML_l
5581 +XML_r
5582 +XML_bl
5583 +XML_b
5584 +XML_br
5587 + mr3DProperties.mnLightRigType = aAttribs.getToken( XML_rig, XML_none );
5589 +XML_legacyFlat1
5590 +XML_legacyFlat2
5591 +XML_legacyFlat3
5592 +XML_legacyFlat4
5593 +XML_legacyNormal1
5594 +XML_legacyNormal2
5595 +XML_legacyNormal3
5596 +XML_legacyNormal4
5597 +XML_legacyHarsh1
5598 +XML_legacyHarsh2
5599 +XML_legacyHarsh3
5600 +XML_legacyHarsh4
5601 +XML_threePt
5602 +XML_balanced
5603 +XML_soft
5604 +XML_harsh
5605 +XML_flood
5606 +XML_contrasting
5607 +XML_morning
5608 +XML_sunrise
5609 +XML_sunset
5610 +XML_chilly
5611 +XML_freezing
5612 +XML_flat
5613 +XML_twoPt
5614 +XML_glow
5615 +XML_brightRoom
5617 + // TODO: nested element XML_rot
5618 + break;
5619 + case NMSP_DRAWINGML|XML_backdrop:
5620 + case NMSP_DRAWINGML|XML_extLst:
5621 + return xRet; // TODO: later (backdrop is not supported by core anyway)
5623 + return xRet;
5626 +} }
5627 diff --git oox/source/drawingml/shape.cxx oox/source/drawingml/shape.cxx
5628 index 655083c..6cc15e6 100644
5629 --- oox/source/drawingml/shape.cxx
5630 +++ oox/source/drawingml/shape.cxx
5631 @@ -43,8 +43,10 @@
5632 #include <tools/solar.h> // for the F_PI180 define
5633 #include <com/sun/star/graphic/XGraphic.hpp>
5634 #include <com/sun/star/container/XNamed.hpp>
5635 +#include <com/sun/star/container/XNameContainer.hpp>
5636 #include <com/sun/star/beans/XMultiPropertySet.hpp>
5637 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
5638 +#include <com/sun/star/xml/AttributeData.hpp>
5639 #include <com/sun/star/drawing/HomogenMatrix3.hpp>
5640 #include <com/sun/star/text/XText.hpp>
5641 #include <basegfx/point/b2dpoint.hxx>
5642 @@ -87,6 +89,30 @@ Shape::Shape( const sal_Char* pServiceName )
5643 msServiceName = OUString::createFromAscii( pServiceName );
5644 setDefaults();
5647 +Shape::Shape( const ShapePtr& pSourceShape )
5648 +: maChildren()
5649 +, mpTextBody(pSourceShape->mpTextBody)
5650 +, mpLinePropertiesPtr( pSourceShape->mpLinePropertiesPtr )
5651 +, mpFillPropertiesPtr( pSourceShape->mpFillPropertiesPtr )
5652 +, mpGraphicPropertiesPtr( pSourceShape->mpGraphicPropertiesPtr )
5653 +, mpCustomShapePropertiesPtr( pSourceShape->mpCustomShapePropertiesPtr )
5654 +, maShapeProperties( pSourceShape->maShapeProperties )
5655 +, mpMasterTextListStyle( pSourceShape->mpMasterTextListStyle )
5656 +, mxShape()
5657 +, msServiceName( pSourceShape->msServiceName )
5658 +, msName( pSourceShape->msName )
5659 +, msId( pSourceShape->msId )
5660 +, mnSubType( pSourceShape->mnSubType )
5661 +, mnIndex( pSourceShape->mnIndex )
5662 +, maSize( pSourceShape->maSize )
5663 +, maPosition( pSourceShape->maPosition )
5664 +, mxCreateCallback( pSourceShape->mxCreateCallback )
5665 +, mnRotation( pSourceShape->mnRotation )
5666 +, mbFlipH( pSourceShape->mbFlipH )
5667 +, mbFlipV( pSourceShape->mbFlipV )
5670 Shape::~Shape()
5673 @@ -176,6 +202,19 @@ void Shape::applyShapeReference( const Shape& rReferencedShape )
5674 mbFlipV = rReferencedShape.mbFlipV;
5677 +void Shape::addChildren( const ::oox::core::XmlFilterBase& rFilterBase,
5678 + const ThemePtr& rxTheme,
5679 + const Reference< XShapes >& rxShapes,
5680 + const awt::Rectangle* pShapeRect,
5681 + ShapeIdMap* pShapeMap )
5683 + addChildren(rFilterBase, *this, rxTheme, rxShapes,
5684 + pShapeRect ?
5685 + *pShapeRect :
5686 + awt::Rectangle( maPosition.X, maPosition.Y, maSize.Width, maSize.Height ),
5687 + pShapeMap);
5690 // for group shapes, the following method is also adding each child
5691 void Shape::addChildren(
5692 const ::oox::core::XmlFilterBase& rFilterBase,
5693 diff --git oox/source/drawingml/shape3dproperties.cxx oox/source/drawingml/shape3dproperties.cxx
5694 new file mode 100644
5695 index 0000000..31c833e
5696 --- /dev/null
5697 +++ oox/source/drawingml/shape3dproperties.cxx
5698 @@ -0,0 +1,70 @@
5699 +/*************************************************************************
5701 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5703 + * Copyright 2008 by Sun Microsystems, Inc.
5705 + * OpenOffice.org - a multi-platform office productivity suite
5707 + * $RCSfile: fillproperties.cxx,v $
5708 + * $Revision: 1.7.6.1 $
5710 + * This file is part of OpenOffice.org.
5712 + * OpenOffice.org is free software: you can redistribute it and/or modify
5713 + * it under the terms of the GNU Lesser General Public License version 3
5714 + * only, as published by the Free Software Foundation.
5716 + * OpenOffice.org is distributed in the hope that it will be useful,
5717 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5718 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5719 + * GNU Lesser General Public License version 3 for more details
5720 + * (a copy is included in the LICENSE file that accompanied this code).
5722 + * You should have received a copy of the GNU Lesser General Public License
5723 + * version 3 along with OpenOffice.org. If not, see
5724 + * <http://www.openoffice.org/license.html>
5725 + * for a copy of the LGPLv3 License.
5727 + ************************************************************************/
5729 +#include "oox/drawingml/shape3dproperties.hxx"
5730 +#include <com/sun/star/lang/XMultiServiceFactory.hpp>
5731 +#include <com/sun/star/frame/XFramesSupplier.hpp>
5732 +#include <com/sun/star/beans/XPropertySet.hpp>
5733 +#include <com/sun/star/awt/Gradient.hpp>
5734 +#include <com/sun/star/awt/Size.hpp>
5735 +#include <com/sun/star/awt/XBitmap.hpp>
5736 +#include <com/sun/star/awt/XDevice.hpp>
5737 +#include <com/sun/star/drawing/BitmapMode.hpp>
5738 +#include <com/sun/star/drawing/FillStyle.hpp>
5739 +#include <com/sun/star/drawing/RectanglePoint.hpp>
5740 +#include <com/sun/star/graphic/XGraphicTransformer.hpp>
5741 +#include "oox/core/modelobjectcontainer.hxx"
5742 +#include "oox/core/xmlfilterbase.hxx"
5743 +#include "oox/helper/propertymap.hxx"
5744 +#include "oox/helper/propertyset.hxx"
5745 +#include "tokens.hxx"
5747 +using namespace ::com::sun::star;
5748 +using namespace ::com::sun::star::drawing;
5749 +using namespace ::com::sun::star::graphic;
5751 +using ::rtl::OUString;
5752 +using ::com::sun::star::uno::Reference;
5753 +using ::com::sun::star::uno::Exception;
5754 +using ::com::sun::star::uno::UNO_QUERY;
5755 +using ::com::sun::star::uno::UNO_QUERY_THROW;
5756 +using ::oox::core::ModelObjectContainer;
5757 +using ::oox::core::XmlFilterBase;
5759 +namespace oox {
5760 +namespace drawingml {
5762 +// ============================================================================
5764 +// ============================================================================
5766 +} // namespace drawingml
5767 +} // namespace oox
5769 diff --git oox/source/drawingml/shapepropertiescontext.cxx oox/source/drawingml/shapepropertiescontext.cxx
5770 index 479b706..d43a56c 100644
5771 --- oox/source/drawingml/shapepropertiescontext.cxx
5772 +++ oox/source/drawingml/shapepropertiescontext.cxx
5773 @@ -37,6 +37,7 @@
5774 #include <com/sun/star/container/XNamed.hpp>
5776 #include "oox/core/namespaces.hxx"
5777 +#include "oox/drawingml/scene3dcontext.hxx"
5778 #include "oox/drawingml/linepropertiescontext.hxx"
5779 #include "oox/drawingml/fillpropertiesgroupcontext.hxx"
5780 #include "oox/drawingml/transform2dcontext.hxx"
5781 @@ -108,8 +109,11 @@ Reference< XFastContextHandler > ShapePropertiesContext::createFastChildContext(
5782 case NMSP_DRAWINGML|XML_effectDag: // CT_EffectContainer
5783 break;
5785 - // todo
5786 case NMSP_DRAWINGML|XML_scene3d: // CT_Scene3D
5787 +// xRet.set( new Scene3DContext( *this, xAttribs, *(mrShape.get3DShapeProperties()) ) );
5788 + break;
5790 + // todo
5791 case NMSP_DRAWINGML|XML_sp3d: // CT_Shape3D
5792 break;
5794 diff --git oox/source/drawingml/textparagraph.cxx oox/source/drawingml/textparagraph.cxx
5795 index e59f59a..190511f 100644
5796 --- oox/source/drawingml/textparagraph.cxx
5797 +++ oox/source/drawingml/textparagraph.cxx
5798 @@ -64,6 +64,9 @@ void TextParagraph::insertAt(
5799 Reference< XTextRange > xStart( xAt, UNO_QUERY );
5801 sal_Int16 nLevel = maProperties.getLevel();
5803 + OSL_TRACE("TextParagraph::insertAt() - level %d", nLevel);
5805 const TextParagraphPropertiesVector& rListStyle = rTextListStyle.getListStyle();
5806 if ( nLevel >= static_cast< sal_Int16 >( rListStyle.size() ) )
5807 nLevel = 0;
5808 @@ -114,6 +117,12 @@ void TextParagraph::insertAt(
5809 const OUString sNumberingLevel( CREATE_OUSTRING( "NumberingLevel" ) );
5810 xProps->setPropertyValue( sNumberingLevel, Any( static_cast< sal_Int16 >( -1 ) ) );
5812 + else if ( nLevel > 1 )
5814 + // Even more UGLY HACK
5815 + const OUString sNumberingLevel( CREATE_OUSTRING( "NumberingLevel" ) );
5816 + xProps->setPropertyValue( sNumberingLevel, Any( static_cast< sal_Int16 >( nLevel-1 ) ) );
5819 // FIXME this is causing a lot of dispruption (ie does not work). I wonder what to do -- Hub
5820 // Reference< XTextRange > xEnd( xAt, UNO_QUERY );
5821 diff --git oox/source/drawingml/textparagraphproperties.cxx oox/source/drawingml/textparagraphproperties.cxx
5822 index b75aa08..7b78d6c 100644
5823 --- oox/source/drawingml/textparagraphproperties.cxx
5824 +++ oox/source/drawingml/textparagraphproperties.cxx
5825 @@ -113,6 +113,7 @@ void BulletList::setSuffixMinusRight()
5827 void BulletList::setType( sal_Int32 nType )
5829 + OSL_ASSERT((nType & sal_Int32(0xFFFF0000))==0);
5830 // OSL_TRACE( "OOX: set list numbering type %d", nType);
5831 switch( nType )
5833 diff --git oox/source/helper/storagebase.cxx oox/source/helper/storagebase.cxx
5834 index 9b853e0..1933257 100644
5835 --- oox/source/helper/storagebase.cxx
5836 +++ oox/source/helper/storagebase.cxx
5837 @@ -49,17 +49,25 @@ namespace oox {
5839 namespace {
5841 -void lclSplitFirstElement( OUString& orElement, OUString& orRemainder, const OUString& rFullName )
5842 +void lclSplitFirstElement( OUString& orElement, OUString& orRemainder, OUString aFullName )
5844 - sal_Int32 nSlashPos = rFullName.indexOf( '/' );
5845 - if( (0 <= nSlashPos) && (nSlashPos < rFullName.getLength()) )
5846 + sal_Int32 nSlashPos = aFullName.indexOf( '/' );
5848 + // strip leading slashes
5849 + while( nSlashPos == 0 )
5851 + aFullName = aFullName.copy(1);
5852 + nSlashPos = aFullName.indexOf( '/' );
5855 + if( (0 <= nSlashPos) && (nSlashPos < aFullName.getLength()) )
5857 - orElement = rFullName.copy( 0, nSlashPos );
5858 - orRemainder = rFullName.copy( nSlashPos + 1 );
5859 + orElement = aFullName.copy( 0, nSlashPos );
5860 + orRemainder = aFullName.copy( nSlashPos + 1 );
5862 else
5864 - orElement = rFullName;
5865 + orElement = aFullName;
5869 diff --git oox/source/ppt/dgmimport.cxx oox/source/ppt/dgmimport.cxx
5870 new file mode 100644
5871 index 0000000..a091212
5872 --- /dev/null
5873 +++ oox/source/ppt/dgmimport.cxx
5874 @@ -0,0 +1,124 @@
5875 +/*************************************************************************
5877 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5879 + * Copyright 2008 by Sun Microsystems, Inc.
5881 + * OpenOffice.org - a multi-platform office productivity suite
5883 + * $RCSfile: pptimport.cxx,v $
5884 + * $Revision: 1.8.6.1 $
5886 + * This file is part of OpenOffice.org.
5888 + * OpenOffice.org is free software: you can redistribute it and/or modify
5889 + * it under the terms of the GNU Lesser General Public License version 3
5890 + * only, as published by the Free Software Foundation.
5892 + * OpenOffice.org is distributed in the hope that it will be useful,
5893 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
5894 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
5895 + * GNU Lesser General Public License version 3 for more details
5896 + * (a copy is included in the LICENSE file that accompanied this code).
5898 + * You should have received a copy of the GNU Lesser General Public License
5899 + * version 3 along with OpenOffice.org. If not, see
5900 + * <http://www.openoffice.org/license.html>
5901 + * for a copy of the LGPLv3 License.
5903 + ************************************************************************/
5905 +#include "oox/ppt/dgmimport.hxx"
5906 +#include "oox/drawingml/theme.hxx"
5907 +#include "oox/drawingml/diagram/diagram.hxx"
5908 +#include "oox/dump/pptxdumper.hxx"
5910 +#include <com/sun/star/drawing/XShape.hpp>
5912 +using ::rtl::OUString;
5913 +using namespace ::com::sun::star;
5914 +using namespace ::com::sun::star::uno;
5915 +using namespace ::com::sun::star::xml::sax;
5916 +using namespace oox::core;
5918 +namespace oox { namespace ppt {
5920 +OUString SAL_CALL QuickDiagrammingImport_getImplementationName() throw()
5922 + return CREATE_OUSTRING( "com.sun.star.comp.Impress.oox.QuickDiagrammingImport" );
5925 +uno::Sequence< OUString > SAL_CALL QuickDiagrammingImport_getSupportedServiceNames() throw()
5927 + const OUString aServiceName = CREATE_OUSTRING( "com.sun.star.comp.ooxpptx.dgm.import" );
5928 + const Sequence< OUString > aSeq( &aServiceName, 1 );
5929 + return aSeq;
5932 +uno::Reference< uno::XInterface > SAL_CALL QuickDiagrammingImport_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
5934 + return (cppu::OWeakObject*)new QuickDiagrammingImport( rSMgr );
5937 +QuickDiagrammingImport::QuickDiagrammingImport( const uno::Reference< lang::XMultiServiceFactory > & rSMgr )
5938 + : XmlFilterBase( rSMgr )
5941 +bool QuickDiagrammingImport::importDocument() throw()
5943 + /* to activate the PPTX dumper, define the environment variable
5944 + OOO_PPTXDUMPER and insert the full path to the file
5945 + file:///<path-to-oox-module>/source/dump/pptxdumper.ini. */
5946 + OOX_DUMP_FILE( ::oox::dump::pptx::Dumper );
5948 + OUString aEmpty;
5949 + OUString aFragmentPath = getFragmentPathFromType( CREATE_OFFICEDOC_RELATIONSTYPE( "diagramLayout" ) );
5951 + Reference<drawing::XShapes> xParentShape(getParentShape(),
5952 + UNO_QUERY_THROW);
5953 + oox::drawingml::ShapePtr pShape(
5954 + new oox::drawingml::Shape( "com.sun.star.drawing.DiagramShape" ) );
5955 + drawingml::loadDiagram(pShape,
5956 + *this,
5957 + aEmpty,
5958 + aFragmentPath,
5959 + aEmpty,
5960 + aEmpty);
5961 + pShape->addShape( *this,
5962 + oox::drawingml::ThemePtr(
5963 + new oox::drawingml::Theme()),
5964 + xParentShape,
5965 + NULL,
5966 + NULL );
5968 + return true;
5971 +bool QuickDiagrammingImport::exportDocument() throw()
5973 + return false;
5976 +const ::oox::drawingml::Theme* QuickDiagrammingImport::getCurrentTheme() const
5978 + // TODO
5979 + return 0;
5982 +sal_Int32 QuickDiagrammingImport::getSchemeClr( sal_Int32 /*nColorSchemeToken*/ ) const
5984 + // TODO
5985 + return 0;
5988 +const oox::drawingml::table::TableStyleListPtr QuickDiagrammingImport::getTableStyles()
5990 + return oox::drawingml::table::TableStyleListPtr();
5993 +OUString QuickDiagrammingImport::implGetImplementationName() const
5995 + return QuickDiagrammingImport_getImplementationName();
5999 diff --git oox/source/ppt/dgmlayout.cxx oox/source/ppt/dgmlayout.cxx
6000 new file mode 100644
6001 index 0000000..f893b18
6002 --- /dev/null
6003 +++ oox/source/ppt/dgmlayout.cxx
6004 @@ -0,0 +1,183 @@
6005 +/*************************************************************************
6007 + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6009 + * Copyright 2008 by Sun Microsystems, Inc.
6011 + * OpenOffice.org - a multi-platform office productivity suite
6013 + * $RCSfile: pptimport.cxx,v $
6014 + * $Revision: 1.8.6.1 $
6016 + * This file is part of OpenOffice.org.
6018 + * OpenOffice.org is free software: you can redistribute it and/or modify
6019 + * it under the terms of the GNU Lesser General Public License version 3
6020 + * only, as published by the Free Software Foundation.
6022 + * OpenOffice.org is distributed in the hope that it will be useful,
6023 + * but WITHOUT ANY WARRANTY; without even the implied warranty of
6024 + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
6025 + * GNU Lesser General Public License version 3 for more details
6026 + * (a copy is included in the LICENSE file that accompanied this code).
6028 + * You should have received a copy of the GNU Lesser General Public License
6029 + * version 3 along with OpenOffice.org. If not, see
6030 + * <http://www.openoffice.org/license.html>
6031 + * for a copy of the LGPLv3 License.
6033 + ************************************************************************/
6035 +#include "oox/ppt/dgmlayout.hxx"
6036 +#include "oox/drawingml/theme.hxx"
6037 +#include "oox/drawingml/themefragmenthandler.hxx"
6038 +#include "oox/drawingml/diagram/diagram.hxx"
6039 +#include "oox/dump/pptxdumper.hxx"
6041 +#include <com/sun/star/drawing/XShape.hpp>
6042 +#include <com/sun/star/drawing/XMasterPageTarget.hpp>
6043 +#include <com/sun/star/xml/dom/XDocument.hpp>
6044 +#include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
6045 +#include <com/sun/star/container/XChild.hpp>
6047 +using ::rtl::OUString;
6048 +using namespace ::com::sun::star;
6049 +using namespace ::com::sun::star::uno;
6050 +using namespace ::com::sun::star::xml::sax;
6051 +using namespace oox::core;
6052 +using namespace ::oox::drawingml;
6054 +namespace oox { namespace ppt {
6056 +OUString SAL_CALL QuickDiagrammingLayout_getImplementationName() throw()
6058 + return CREATE_OUSTRING( "com.sun.star.comp.Impress.oox.QuickDiagrammingLayout" );
6061 +uno::Sequence< OUString > SAL_CALL QuickDiagrammingLayout_getSupportedServiceNames() throw()
6063 + const OUString aServiceName = CREATE_OUSTRING( "com.sun.star.comp.ooxpptx.dgm.layout" );
6064 + const Sequence< OUString > aSeq( &aServiceName, 1 );
6065 + return aSeq;
6068 +uno::Reference< uno::XInterface > SAL_CALL QuickDiagrammingLayout_createInstance(const uno::Reference< lang::XMultiServiceFactory > & rSMgr ) throw( uno::Exception )
6070 + return (cppu::OWeakObject*)new QuickDiagrammingLayout( rSMgr );
6073 +QuickDiagrammingLayout::QuickDiagrammingLayout( const uno::Reference< lang::XMultiServiceFactory > & rSMgr )
6074 + : XmlFilterBase( rSMgr ),
6075 + mpThemePtr(new drawingml::Theme())
6078 +bool QuickDiagrammingLayout::importDocument() throw()
6080 + Reference<drawing::XShape> xParentShape(getParentShape(),
6081 + UNO_QUERY_THROW);
6082 + Reference<drawing::XShapes> xParentShapes(xParentShape,
6083 + UNO_QUERY_THROW);
6084 + Reference<beans::XPropertySet> xPropSet(xParentShape,
6085 + UNO_QUERY_THROW);
6087 + // can we grab the theme from the master page?
6088 + Reference<container::XChild> xChild(xParentShape,
6089 + UNO_QUERY);
6090 + if( xChild.is() )
6092 + // TODO: cater for diagram shapes inside groups
6093 + Reference<drawing::XMasterPageTarget> xMasterPageTarget(xChild->getParent(),
6094 + UNO_QUERY);
6095 + if( xMasterPageTarget.is() )
6097 + uno::Reference<drawing::XDrawPage> xMasterPage(
6098 + xMasterPageTarget->getMasterPage());
6100 + Reference<beans::XPropertySet> xPropSet2(xMasterPage,
6101 + UNO_QUERY_THROW);
6102 + Reference<xml::dom::XDocument> xThemeFragment;
6103 + xPropSet2->getPropertyValue(
6104 + CREATE_OUSTRING("PPTTheme")) >>= xThemeFragment;
6106 + importFragment(
6107 + new ThemeFragmentHandler(
6108 + *this, OUString(), *mpThemePtr ),
6109 + Reference<xml::sax::XFastSAXSerializable>(
6110 + xThemeFragment,
6111 + UNO_QUERY_THROW));
6115 + Reference<xml::dom::XDocument> xDataModelDom;
6116 + Reference<xml::dom::XDocument> xLayoutDom;
6117 + Reference<xml::dom::XDocument> xQStyleDom;
6118 + Reference<xml::dom::XDocument> xColorStyleDom;
6120 + xPropSet->getPropertyValue(
6121 + CREATE_OUSTRING("DiagramData")) >>= xDataModelDom;
6122 + xPropSet->getPropertyValue(
6123 + CREATE_OUSTRING("DiagramLayout")) >>= xLayoutDom;
6124 + xPropSet->getPropertyValue(
6125 + CREATE_OUSTRING("DiagramQStyle")) >>= xQStyleDom;
6126 + xPropSet->getPropertyValue(
6127 + CREATE_OUSTRING("DiagramColorStyle")) >>= xColorStyleDom;
6129 + oox::drawingml::ShapePtr pShape(
6130 + new oox::drawingml::Shape( "com.sun.star.drawing.DiagramShape" ) );
6131 + drawingml::loadDiagram(pShape,
6132 + *this,
6133 + xDataModelDom,
6134 + xLayoutDom,
6135 + xQStyleDom,
6136 + xColorStyleDom);
6138 + // don't add pShape itself, but only its children
6139 + pShape->setXShape(getParentShape());
6141 + const awt::Size& rSize=xParentShape->getSize();
6142 + const awt::Point& rPoint=xParentShape->getPosition();
6143 + const long nScaleFactor=360;
6144 + const awt::Rectangle aRect(nScaleFactor*rPoint.X,
6145 + nScaleFactor*rPoint.Y,
6146 + nScaleFactor*rSize.Width,
6147 + nScaleFactor*rSize.Height);
6149 + pShape->addChildren( *this,
6150 + mpThemePtr,
6151 + xParentShapes,
6152 + &aRect,
6153 + NULL );
6155 + return true;
6158 +bool QuickDiagrammingLayout::exportDocument() throw()
6160 + return false;
6163 +const ::oox::drawingml::Theme* QuickDiagrammingLayout::getCurrentTheme() const
6165 + return mpThemePtr.get();
6168 +sal_Int32 QuickDiagrammingLayout::getSchemeClr( sal_Int32 nColorSchemeToken ) const
6170 + sal_Int32 nColor = 0;
6171 + if( mpThemePtr )
6172 + mpThemePtr->getClrScheme().getColor( nColorSchemeToken,
6173 + nColor );
6174 + return nColor;
6177 +const oox::drawingml::table::TableStyleListPtr QuickDiagrammingLayout::getTableStyles()
6179 + return oox::drawingml::table::TableStyleListPtr();
6182 +OUString QuickDiagrammingLayout::implGetImplementationName() const
6184 + return QuickDiagrammingLayout_getImplementationName();
6188 diff --git oox/source/ppt/makefile.mk oox/source/ppt/makefile.mk
6189 index 4deca6a..6290df4 100644
6190 --- oox/source/ppt/makefile.mk
6191 +++ oox/source/ppt/makefile.mk
6192 @@ -54,6 +54,8 @@ SLOFILES = \
6193 $(SLO)$/commontimenodecontext.obj \
6194 $(SLO)$/conditioncontext.obj \
6195 $(SLO)$/customshowlistcontext.obj \
6196 + $(SLO)$/dgmimport.obj\
6197 + $(SLO)$/dgmlayout.obj\
6198 $(SLO)$/layoutfragmenthandler.obj\
6199 $(SLO)$/pptfilterhelpers.obj\
6200 $(SLO)$/pptgraphicshapecontext.obj \
6201 diff --git oox/source/ppt/pptimport.cxx oox/source/ppt/pptimport.cxx
6202 index d360d8b..be659e2 100644
6203 --- oox/source/ppt/pptimport.cxx
6204 +++ oox/source/ppt/pptimport.cxx
6205 @@ -177,9 +177,9 @@ const oox::drawingml::table::TableStyleListPtr PowerPointImport::getTableStyles(
6206 return mpTableStyleList;;
6209 -::oox::drawingml::chart::ChartConverter& PowerPointImport::getChartConverter()
6210 +::oox::drawingml::chart::ChartConverter* PowerPointImport::getChartConverter()
6212 - return *mxChartConv;
6213 + return mxChartConv.get();
6216 OUString PowerPointImport::implGetImplementationName() const
6217 diff --git oox/source/ppt/presentationfragmenthandler.cxx oox/source/ppt/presentationfragmenthandler.cxx
6218 index 8176573..9a9c41d 100644
6219 --- oox/source/ppt/presentationfragmenthandler.cxx
6220 +++ oox/source/ppt/presentationfragmenthandler.cxx
6221 @@ -35,6 +35,8 @@
6222 #include <com/sun/star/drawing/XDrawPages.hpp>
6223 #include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
6224 #include <com/sun/star/drawing/XMasterPageTarget.hpp>
6225 +#include <com/sun/star/xml/dom/XDocument.hpp>
6226 +#include <com/sun/star/xml/sax/XFastSAXSerializable.hpp>
6227 #include <com/sun/star/style/XStyleFamiliesSupplier.hpp>
6228 #include <com/sun/star/style/XStyle.hpp>
6229 #include <com/sun/star/presentation/XPresentationPage.hpp>
6230 @@ -176,8 +178,17 @@ void PresentationFragmentHandler::endDocument() throw (SAXException, RuntimeExce
6232 oox::drawingml::ThemePtr pThemePtr( new oox::drawingml::Theme() );
6233 pMasterPersistPtr->setTheme( pThemePtr );
6234 - rFilter.importFragment( new ThemeFragmentHandler( rFilter, aThemeFragmentPath, *pThemePtr ) );
6235 + Reference<xml::dom::XDocument> xDoc=
6236 + rFilter.importFragment(aThemeFragmentPath);
6238 + rFilter.importFragment(
6239 + new ThemeFragmentHandler(
6240 + rFilter, aThemeFragmentPath, *pThemePtr ),
6241 + Reference<xml::sax::XFastSAXSerializable>(
6242 + xDoc,
6243 + UNO_QUERY_THROW));
6244 rThemes[ aThemeFragmentPath ] = pThemePtr;
6245 + pThemePtr->setFragment(xDoc);
6247 else
6249 diff --git oox/source/ppt/slidepersist.cxx oox/source/ppt/slidepersist.cxx
6250 index 00e4a6f..3e58ec5 100644
6251 --- oox/source/ppt/slidepersist.cxx
6252 +++ oox/source/ppt/slidepersist.cxx
6253 @@ -166,6 +166,17 @@ void SlidePersist::createXShapes( const XmlFilterBase& rFilterBase )
6254 pNode->setNode( rFilterBase, xNode, pSlidePtr );
6258 + // not yet
6259 +#if 0
6260 + if( getTheme() )
6261 + {
6262 + uno::Reference< beans::XPropertySet > xPagePropSet( mxPage, uno::UNO_QUERY_THROW );
6263 + xPagePropSet->setPropertyValue(
6264 + rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "PPTTheme" )),
6265 + uno::makeAny(getTheme()->getFragment()));
6267 +#endif
6270 void SlidePersist::createBackground( const XmlFilterBase& rFilterBase )
6271 diff --git oox/source/shape/ShapeFilterBase.cxx oox/source/shape/ShapeFilterBase.cxx
6272 index b8ebcd9..fb6e6eb 100644
6273 --- oox/source/shape/ShapeFilterBase.cxx
6274 +++ oox/source/shape/ShapeFilterBase.cxx
6275 @@ -68,9 +68,9 @@ const ::oox::drawingml::table::TableStyleListPtr ShapeFilterBase::getTableStyles
6276 return ::oox::drawingml::table::TableStyleListPtr();
6279 -::oox::drawingml::chart::ChartConverter& ShapeFilterBase::getChartConverter()
6280 +::oox::drawingml::chart::ChartConverter* ShapeFilterBase::getChartConverter()
6282 - return *mxChartConv;
6283 + return mxChartConv.get();
6286 ::rtl::OUString ShapeFilterBase::implGetImplementationName() const
6287 diff --git oox/source/shape/ShapeFilterBase.hxx oox/source/shape/ShapeFilterBase.hxx
6288 index b1ad56b..e9546b1 100644
6289 --- oox/source/shape/ShapeFilterBase.hxx
6290 +++ oox/source/shape/ShapeFilterBase.hxx
6291 @@ -64,7 +64,7 @@ public:
6292 /** Has to be implemented by each filter to return TableStyles. */
6293 virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles();
6295 - virtual ::oox::drawingml::chart::ChartConverter& getChartConverter();
6296 + virtual ::oox::drawingml::chart::ChartConverter* getChartConverter();
6298 virtual rtl::OUString implGetImplementationName() const;
6300 diff --git oox/source/token/makefile.mk oox/source/token/makefile.mk
6301 index 4174830..2a8c156 100644
6302 --- oox/source/token/makefile.mk
6303 +++ oox/source/token/makefile.mk
6304 @@ -54,20 +54,23 @@ $(MISC)$/tokens.gperf $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(INCCOM)$
6305 @@noop $(assign do_phony:=.PHONY)
6307 $(MISC)$/do_tokens $(do_phony) : tokens.txt gentoken.pl $(MISC)$/tokens.gperf $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx
6308 - $(PERL) gentoken.pl tokens.txt $(INCCOM)$/tokens.hxx $(INCCOM)$/tokenwords.inc $(MISC)$/tokens.gperf && $(TOUCH) $@
6309 + @echo "Making: " tokens.hxx
6310 + $(QUIET_BUILD) $(PERL) gentoken.pl tokens.txt $(INCCOM)$/tokens.hxx $(INCCOM)$/tokenwords.inc $(MISC)$/tokens.gperf && $(TOUCH) $@
6312 $(INCCOM)$/oox:
6313 - $(MKDIR) $(INCCOM)$/oox
6314 + @$(MKDIR) $(INCCOM)$/oox
6316 $(INCCOM)$/oox$/core: $(INCCOM)$/oox
6317 - $(MKDIR) $(INCCOM)$/oox$/core
6318 + @$(MKDIR) $(INCCOM)$/oox$/core
6320 $(MISC)$/do_namespaces $(do_phony) : namespaces.txt gennamespaces.pl
6321 - $(MKDIRHIER) $(INCCOM)$/oox$/core
6322 - $(PERL) gennamespaces.pl namespaces.txt $(INCCOM)$/oox$/core$/namespaces.hxx && $(TOUCH) $@
6323 + @echo "Making: " namespaces.hxx
6324 + @$(MKDIRHIER) $(INCCOM)$/oox$/core
6325 + $(QUIET_BUILD) $(PERL) gennamespaces.pl namespaces.txt $(INCCOM)$/oox$/core$/namespaces.hxx && $(TOUCH) $@
6327 $(INCCOM)$/tokens.inc : $(MISC)$/tokens.gperf $(MISC)$/do_tokens
6328 - gperf --compare-strncmp $(MISC)$/tokens.gperf | $(SED) -e "s/(char\*)0/(char\*)0, 0/g" | $(GREP) -v "^#line" >$(INCCOM)$/tokens.inc
6329 + @echo "Making: " tokens.gperf
6330 + $(QUIET_BUILD) gperf --compare-strncmp $(MISC)$/tokens.gperf | $(SED) -e "s/(char\*)0/(char\*)0, 0/g" | $(GREP) -v "^#line" >$(INCCOM)$/tokens.inc
6332 $(SLO)$/tokenmap.obj : $(INCCOM)$/tokens.inc $(INCCOM)$/tokenwords.inc $(INCCOM)$/tokens.hxx $(INCCOM)$/oox$/core$/namespaces.hxx $(MISC)$/do_tokens $(MISC)$/do_namespaces
6334 diff --git oox/source/xls/excelfilter.cxx oox/source/xls/excelfilter.cxx
6335 index b9dfbfd..b066fb8 100644
6336 --- oox/source/xls/excelfilter.cxx
6337 +++ oox/source/xls/excelfilter.cxx
6338 @@ -139,7 +139,7 @@ const TableStyleListPtr ExcelFilter::getTableStyles()
6339 return TableStyleListPtr();
6342 -::oox::drawingml::chart::ChartConverter& ExcelFilter::getChartConverter()
6343 +::oox::drawingml::chart::ChartConverter* ExcelFilter::getChartConverter()
6345 OSL_ENSURE( mpHelper, "ExcelFilter::getChartConverter - no workbook helper" );
6346 return mpHelper->getChartConverter();
6347 diff --git oox/source/xls/workbookhelper.cxx oox/source/xls/workbookhelper.cxx
6348 index 03a0cc8..49cb5b6 100644
6349 --- oox/source/xls/workbookhelper.cxx
6350 +++ oox/source/xls/workbookhelper.cxx
6351 @@ -230,7 +230,7 @@ public:
6352 /** Returns the converter for string to cell address/range conversion. */
6353 inline AddressConverter& getAddressConverter() const { return *mxAddrConverter; }
6354 /** Returns the chart object converter. */
6355 - inline ExcelChartConverter& getChartConverter() const { return *mxChartConverter; }
6356 + inline ExcelChartConverter* getChartConverter() const { return mxChartConverter.get(); }
6358 // property helpers -------------------------------------------------------
6360 @@ -846,7 +846,7 @@ AddressConverter& WorkbookHelper::getAddressConverter() const
6361 return mrBookData.getAddressConverter();
6364 -ExcelChartConverter& WorkbookHelper::getChartConverter() const
6365 +ExcelChartConverter* WorkbookHelper::getChartConverter() const
6367 return mrBookData.getChartConverter();
6369 diff --git sc/source/filter/excel/xestream.cxx sc/source/filter/excel/xestream.cxx
6370 index a279b9d..0f8262c 100644
6371 --- sc/source/filter/excel/xestream.cxx
6372 +++ sc/source/filter/excel/xestream.cxx
6373 @@ -1001,10 +1001,9 @@ const oox::drawingml::table::TableStyleListPtr XclExpXmlStream::getTableStyles()
6374 return oox::drawingml::table::TableStyleListPtr();
6377 -oox::drawingml::chart::ChartConverter& XclExpXmlStream::getChartConverter()
6378 +oox::drawingml::chart::ChartConverter* XclExpXmlStream::getChartConverter()
6380 - // DO NOT CALL
6381 - return * (oox::drawingml::chart::ChartConverter*) NULL;
6382 + return NULL;
6385 bool XclExpXmlStream::exportDocument() throw()
6386 diff --git sc/source/filter/inc/xestream.hxx sc/source/filter/inc/xestream.hxx
6387 index 3b49017..a7a7840 100644
6388 --- sc/source/filter/inc/xestream.hxx
6389 +++ sc/source/filter/inc/xestream.hxx
6390 @@ -341,7 +341,7 @@ public:
6391 virtual const oox::vml::DrawingPtr getDrawings();
6392 virtual const oox::drawingml::Theme* getCurrentTheme() const;
6393 virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
6394 - virtual oox::drawingml::chart::ChartConverter& getChartConverter();
6395 + virtual oox::drawingml::chart::ChartConverter* getChartConverter();
6397 void Trace( const char* format, ...);
6398 private:
6399 diff --git sc/source/filter/xlsx/xestream.hxx sc/source/filter/xlsx/xestream.hxx
6400 index fc986fb..e18fe72 100644
6401 --- sc/source/filter/xlsx/xestream.hxx
6402 +++ sc/source/filter/xlsx/xestream.hxx
6403 @@ -350,7 +350,7 @@ public:
6404 virtual const oox::vml::DrawingPtr getDrawings();
6405 virtual const oox::drawingml::Theme* getCurrentTheme() const;
6406 virtual const oox::drawingml::table::TableStyleListPtr getTableStyles();
6407 - virtual oox::drawingml::chart::ChartConverter& getChartConverter();
6408 + virtual oox::drawingml::chart::ChartConverter* getChartConverter();
6410 void Trace( const char* format, ...);
6411 private:
6412 diff --git sc/source/filter/xlsx/xlsx-xestream.cxx sc/source/filter/xlsx/xlsx-xestream.cxx
6413 index a147e13..714f5b6 100644
6414 --- sc/source/filter/xlsx/xlsx-xestream.cxx
6415 +++ sc/source/filter/xlsx/xlsx-xestream.cxx
6416 @@ -1094,10 +1094,10 @@ const oox::drawingml::table::TableStyleListPtr XclExpXmlStream::getTableStyles()
6417 return oox::drawingml::table::TableStyleListPtr();
6420 -oox::drawingml::chart::ChartConverter& XclExpXmlStream::getChartConverter()
6421 +oox::drawingml::chart::ChartConverter* XclExpXmlStream::getChartConverter()
6423 - // DO NOT CALL
6424 - return * (oox::drawingml::chart::ChartConverter*) NULL;
6425 + // just don't call...
6426 + return NULL;
6429 ScDocShell* XclExpXmlStream::getDocShell()
6430 diff --git sd/source/filter/pptx/epptooxml.hxx sd/source/filter/pptx/epptooxml.hxx
6431 index 2c850bd..729ad80 100644
6432 --- sd/source/filter/pptx/epptooxml.hxx
6433 +++ sd/source/filter/pptx/epptooxml.hxx
6434 @@ -57,7 +57,7 @@ public:
6435 virtual const oox::vml::DrawingPtr getDrawings() { return oox::vml::DrawingPtr(); }
6436 virtual const oox::drawingml::Theme* getCurrentTheme() const { return NULL; }
6437 virtual const oox::drawingml::table::TableStyleListPtr getTableStyles() { return oox::drawingml::table::TableStyleListPtr(); }
6438 - virtual oox::drawingml::chart::ChartConverter& getChartConverter();
6439 + virtual oox::drawingml::chart::ChartConverter* getChartConverter();
6441 static const char* GetSideDirection( sal_uInt8 nDirection );
6442 static const char* GetCornerDirection( sal_uInt8 nDirection );
6443 diff --git sd/source/filter/pptx/pptx-epptooxml.cxx sd/source/filter/pptx/pptx-epptooxml.cxx
6444 index 3f186ca..57a9fe9 100644
6445 --- sd/source/filter/pptx/pptx-epptooxml.cxx
6446 +++ sd/source/filter/pptx/pptx-epptooxml.cxx
6447 @@ -1885,9 +1885,9 @@ sal_Bool PowerPointExport::ImplCreateMainNotes()
6449 //------------------------------------------------------------------------------------------------------------------------------------------------------------------
6451 -drawingml::chart::ChartConverter& PowerPointExport::getChartConverter()
6452 +drawingml::chart::ChartConverter* PowerPointExport::getChartConverter()
6454 - return *mxChartConv;
6455 + return mxChartConv.get();
6458 #define IMPL_NAME "com.sun.star.comp.Impress.oox.PowerPointExport"
6459 diff --git sw/source/filter/docx/docxexportfilter.hxx sw/source/filter/docx/docxexportfilter.hxx
6460 index e1e6fde..55d6baf 100644
6461 --- sw/source/filter/docx/docxexportfilter.hxx
6462 +++ sw/source/filter/docx/docxexportfilter.hxx
6463 @@ -49,7 +49,7 @@ public:
6464 virtual const ::oox::drawingml::Theme* getCurrentTheme() const { return NULL; }
6465 virtual sal_Int32 getSchemeClr( sal_Int32 ) const { return 0; }
6466 virtual const ::oox::vml::DrawingPtr getDrawings() { return ::oox::vml::DrawingPtr(); }
6467 - virtual ::oox::drawingml::chart::ChartConverter& getChartConverter() { static ::oox::drawingml::chart::ChartConverter aConverter; return aConverter; }
6468 + virtual ::oox::drawingml::chart::ChartConverter* getChartConverter() { static ::oox::drawingml::chart::ChartConverter aConverter; return &aConverter; }
6469 virtual const ::oox::drawingml::table::TableStyleListPtr getTableStyles() { return ::oox::drawingml::table::TableStyleListPtr(); }
6471 // Actual export of the DOCX document