#i10000# Bring module to HEAD.
[LibreOffice.git] / oox / source / drawingml / diagram / diagram.cxx
blob04394b331f4b2146314c0405630235d20a975fab
1 /*************************************************************************
3 * OpenOffice.org - a multi-platform office productivity suite
5 * $RCSfile: diagram.cxx,v $
7 * $Revision: 1.2 $
9 * last change: $Author: rt $ $Date: 2008-01-17 08:05:57 $
11 * The Contents of this file are made available subject to
12 * the terms of GNU Lesser General Public License Version 2.1.
15 * GNU Lesser General Public License Version 2.1
16 * =============================================
17 * Copyright 2005 by Sun Microsystems, Inc.
18 * 901 San Antonio Road, Palo Alto, CA 94303, USA
20 * This library is free software; you can redistribute it and/or
21 * modify it under the terms of the GNU Lesser General Public
22 * License version 2.1, as published by the Free Software Foundation.
24 * This library is distributed in the hope that it will be useful,
25 * but WITHOUT ANY WARRANTY; without even the implied warranty of
26 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
27 * Lesser General Public License for more details.
29 * You should have received a copy of the GNU Lesser General Public
30 * License along with this library; if not, write to the Free Software
31 * Foundation, Inc., 59 Temple Place, Suite 330, Boston,
32 * MA 02111-1307 USA
34 ************************************************************************/
37 #include <functional>
38 #include <boost/bind.hpp>
40 #include "oox/drawingml/diagram/diagram.hxx"
41 #include "oox/core/namespaces.hxx"
42 #include "tokens.hxx"
45 namespace oox { namespace drawingml {
47 namespace dgm {
50 void Connection::dump()
52 OSL_TRACE("dgm: cnx modelId %s, srcId %s, dstId %s",
53 OUSTRING_TO_CSTR( msModelId ),
54 OUSTRING_TO_CSTR( msSourceId ),
55 OUSTRING_TO_CSTR( msDestId ) );
58 Point::Point()
59 : mpShape( new Shape( "com.sun.star.drawing.GroupShape" ) )
60 , mnType( 0 )
64 void Point::dump()
66 OSL_TRACE( "dgm: pt cnxId %s, modelId %s",
67 OUSTRING_TO_CSTR( msCnxId ),
68 OUSTRING_TO_CSTR( msModelId ) );
75 DiagramData::DiagramData()
76 : mpFillProperties( new FillProperties( ) )
80 void DiagramData::dump()
82 OSL_TRACE("Dgm: DiagramData # of cnx: %d", maConnections.size() );
83 std::for_each( maConnections.begin(), maConnections.end(),
84 boost::bind( &dgm::Connection::dump, _1 ) );
85 OSL_TRACE("Dgm: DiagramData # of pt: %d", maPoints.size() );
86 std::for_each( maPoints.begin(), maPoints.end(),
87 boost::bind( &dgm::Point::dump, _1 ) );
91 void Diagram::setData( const DiagramDataPtr & pData)
93 mpData = pData;
97 void Diagram::setLayout( const DiagramLayoutPtr & pLayout)
99 mpLayout = pLayout;
102 void Diagram::setQStyles( const DiagramQStylesPtr & pStyles)
104 mpQStyles = pStyles;
108 void Diagram::setColors( const DiagramColorsPtr & pColors)
110 mpColors = pColors;
114 void Diagram::addTo( const ShapePtr & pShape )
116 dgm::Points & aPoints( mpData->getPoints( ) );
117 std::for_each( aPoints.begin(), aPoints.end(),
118 boost::bind( &Shape::addChild, boost::ref( pShape ),
119 boost::bind( &dgm::Point::getShape, _1 ) ) );
121 OSL_TRACE( "Dgm: addTo() # of childs %d", pShape->getChilds().size() );
122 for( std::vector< ShapePtr >::iterator iter = pShape->getChilds().begin();
123 iter != pShape->getChilds().end(); ++iter)
125 OSL_TRACE( "Dgm: shape name %s", OUSTRING_TO_CSTR( (*iter)->getName() ) );