1 /************************************************************************* 2 * 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * Copyright 2000, 2010 Oracle and/or its affiliates. 6 * 7 * OpenOffice.org - a multi-platform office productivity suite 8 * 9 * This file is part of OpenOffice.org. 10 * 11 * OpenOffice.org is free software: you can redistribute it and/or modify 12 * it under the terms of the GNU Lesser General Public License version 3 13 * only, as published by the Free Software Foundation. 14 * 15 * OpenOffice.org is distributed in the hope that it will be useful, 16 * but WITHOUT ANY WARRANTY; without even the implied warranty of 17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18 * GNU Lesser General Public License version 3 for more details 19 * (a copy is included in the LICENSE file that accompanied this code). 20 * 21 * You should have received a copy of the GNU Lesser General Public License 22 * version 3 along with OpenOffice.org. If not, see 23 * <http://www.openoffice.org/license.html> 24 * for a copy of the LGPLv3 License. 25 * 26 ************************************************************************/ 27 28 // MARKER(update_precomp.py): autogen include statement, do not remove 29 #include "precompiled_xmloff.hxx" 30 #include"xmloff/xmlnmspe.hxx" 31 #include "ximpgrp.hxx" 32 #include <xmloff/xmltoken.hxx> 33 #include "ximpshap.hxx" 34 #include "eventimp.hxx" 35 #include "descriptionimp.hxx" 36 37 using ::rtl::OUString; 38 using ::rtl::OUStringBuffer; 39 40 using namespace ::com::sun::star; 41 using namespace ::xmloff::token; 42 43 ////////////////////////////////////////////////////////////////////////////// 44 45 TYPEINIT1( SdXMLGroupShapeContext, SvXMLImportContext ); 46 47 SdXMLGroupShapeContext::SdXMLGroupShapeContext( 48 SvXMLImport& rImport, 49 sal_uInt16 nPrfx, const OUString& rLocalName, 50 const uno::Reference< xml::sax::XAttributeList>& xAttrList, 51 uno::Reference< drawing::XShapes >& rShapes, 52 sal_Bool bTemporaryShape) 53 : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape ) 54 { 55 } 56 57 ////////////////////////////////////////////////////////////////////////////// 58 59 SdXMLGroupShapeContext::~SdXMLGroupShapeContext() 60 { 61 } 62 63 ////////////////////////////////////////////////////////////////////////////// 64 65 SvXMLImportContext* SdXMLGroupShapeContext::CreateChildContext( sal_uInt16 nPrefix, 66 const OUString& rLocalName, 67 const uno::Reference< xml::sax::XAttributeList>& xAttrList ) 68 { 69 SvXMLImportContext* pContext = 0L; 70 71 // #i68101# 72 if( nPrefix == XML_NAMESPACE_SVG && 73 (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) ) 74 { 75 pContext = new SdXMLDescriptionContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape ); 76 } 77 else if( nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) ) 78 { 79 pContext = new SdXMLEventsContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape ); 80 } 81 else if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_GLUE_POINT ) ) 82 { 83 addGluePoint( xAttrList ); 84 } 85 else 86 { 87 // call GroupChildContext function at common ShapeImport 88 pContext = GetImport().GetShapeImport()->CreateGroupChildContext( 89 GetImport(), nPrefix, rLocalName, xAttrList, mxChilds); 90 } 91 92 // call parent when no own context was created 93 if(!pContext) 94 pContext = SvXMLImportContext::CreateChildContext( 95 nPrefix, rLocalName, xAttrList); 96 97 return pContext; 98 } 99 100 ////////////////////////////////////////////////////////////////////////////// 101 102 void SdXMLGroupShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&) 103 { 104 // create new group shape and add it to rShapes, use it 105 // as base for the new group import 106 AddShape( "com.sun.star.drawing.GroupShape" ); 107 108 if(mxShape.is()) 109 { 110 SetStyle( false ); 111 112 mxChilds = uno::Reference< drawing::XShapes >::query( mxShape ); 113 if( mxChilds.is() ) 114 GetImport().GetShapeImport()->pushGroupForSorting( mxChilds ); 115 } 116 117 GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes ); 118 } 119 120 ////////////////////////////////////////////////////////////////////////////// 121 122 void SdXMLGroupShapeContext::EndElement() 123 { 124 if( mxChilds.is() ) 125 GetImport().GetShapeImport()->popGroupAndSort(); 126 127 SdXMLShapeContext::EndElement(); 128 } 129 130 131