Update ooo320-m1
[ooovba.git] / xmloff / source / draw / ximpgrp.cxx
blob89e2a4e3a68e941f59bd9137f4b12e56ac9a48c8
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ximpgrp.cxx,v $
10 * $Revision: 1.20 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmloff.hxx"
33 #include"xmlnmspe.hxx"
34 #include "ximpgrp.hxx"
35 #include <xmloff/xmltoken.hxx>
36 #include "ximpshap.hxx"
37 #include "eventimp.hxx"
38 #include "descriptionimp.hxx"
40 using ::rtl::OUString;
41 using ::rtl::OUStringBuffer;
43 using namespace ::com::sun::star;
44 using namespace ::xmloff::token;
46 //////////////////////////////////////////////////////////////////////////////
48 TYPEINIT1( SdXMLGroupShapeContext, SvXMLImportContext );
50 SdXMLGroupShapeContext::SdXMLGroupShapeContext(
51 SvXMLImport& rImport,
52 USHORT nPrfx, const OUString& rLocalName,
53 const uno::Reference< xml::sax::XAttributeList>& xAttrList,
54 uno::Reference< drawing::XShapes >& rShapes,
55 sal_Bool bTemporaryShape)
56 : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
60 //////////////////////////////////////////////////////////////////////////////
62 SdXMLGroupShapeContext::~SdXMLGroupShapeContext()
66 //////////////////////////////////////////////////////////////////////////////
68 SvXMLImportContext* SdXMLGroupShapeContext::CreateChildContext( USHORT nPrefix,
69 const OUString& rLocalName,
70 const uno::Reference< xml::sax::XAttributeList>& xAttrList )
72 SvXMLImportContext* pContext = 0L;
74 // #i68101#
75 if( nPrefix == XML_NAMESPACE_SVG &&
76 (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) )
78 pContext = new SdXMLDescriptionContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
80 else if( nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
82 pContext = new SdXMLEventsContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
84 else if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_GLUE_POINT ) )
86 addGluePoint( xAttrList );
88 else
90 // call GroupChildContext function at common ShapeImport
91 pContext = GetImport().GetShapeImport()->CreateGroupChildContext(
92 GetImport(), nPrefix, rLocalName, xAttrList, mxChilds);
95 // call parent when no own context was created
96 if(!pContext)
97 pContext = SvXMLImportContext::CreateChildContext(
98 nPrefix, rLocalName, xAttrList);
100 return pContext;
103 //////////////////////////////////////////////////////////////////////////////
105 void SdXMLGroupShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&)
107 // create new group shape and add it to rShapes, use it
108 // as base for the new group import
109 AddShape( "com.sun.star.drawing.GroupShape" );
111 if(mxShape.is())
113 SetStyle( false );
115 mxChilds = uno::Reference< drawing::XShapes >::query( mxShape );
116 if( mxChilds.is() )
117 GetImport().GetShapeImport()->pushGroupForSorting( mxChilds );
120 GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
123 //////////////////////////////////////////////////////////////////////////////
125 void SdXMLGroupShapeContext::EndElement()
127 if( mxChilds.is() )
128 GetImport().GetShapeImport()->popGroupAndSort();
130 SdXMLShapeContext::EndElement();