1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
3 * This file is part of the LibreOffice project.
5 * This Source Code Form is subject to the terms of the Mozilla Public
6 * License, v. 2.0. If a copy of the MPL was not distributed with this
7 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 * This file incorporates work covered by the following license notice:
11 * Licensed to the Apache Software Foundation (ASF) under one or more
12 * contributor license agreements. See the NOTICE file distributed
13 * with this work for additional information regarding copyright
14 * ownership. The ASF licenses this file to you under the Apache
15 * License, Version 2.0 (the "License"); you may not use this file
16 * except in compliance with the License. You may obtain a copy of
17 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
20 #include"xmloff/xmlnmspe.hxx"
21 #include "ximpgrp.hxx"
22 #include <xmloff/xmltoken.hxx>
23 #include "ximpshap.hxx"
24 #include "eventimp.hxx"
25 #include "descriptionimp.hxx"
28 using namespace ::com::sun::star
;
29 using namespace ::xmloff::token
;
31 //////////////////////////////////////////////////////////////////////////////
33 TYPEINIT1( SdXMLGroupShapeContext
, SvXMLImportContext
);
35 SdXMLGroupShapeContext::SdXMLGroupShapeContext(
37 sal_uInt16 nPrfx
, const OUString
& rLocalName
,
38 const uno::Reference
< xml::sax::XAttributeList
>& xAttrList
,
39 uno::Reference
< drawing::XShapes
>& rShapes
,
40 sal_Bool bTemporaryShape
)
41 : SdXMLShapeContext( rImport
, nPrfx
, rLocalName
, xAttrList
, rShapes
, bTemporaryShape
)
45 //////////////////////////////////////////////////////////////////////////////
47 SdXMLGroupShapeContext::~SdXMLGroupShapeContext()
51 //////////////////////////////////////////////////////////////////////////////
53 SvXMLImportContext
* SdXMLGroupShapeContext::CreateChildContext( sal_uInt16 nPrefix
,
54 const OUString
& rLocalName
,
55 const uno::Reference
< xml::sax::XAttributeList
>& xAttrList
)
57 SvXMLImportContext
* pContext
= 0L;
60 if( nPrefix
== XML_NAMESPACE_SVG
&&
61 (IsXMLToken( rLocalName
, XML_TITLE
) || IsXMLToken( rLocalName
, XML_DESC
) ) )
63 pContext
= new SdXMLDescriptionContext( GetImport(), nPrefix
, rLocalName
, xAttrList
, mxShape
);
65 else if( nPrefix
== XML_NAMESPACE_OFFICE
&& IsXMLToken( rLocalName
, XML_EVENT_LISTENERS
) )
67 pContext
= new SdXMLEventsContext( GetImport(), nPrefix
, rLocalName
, xAttrList
, mxShape
);
69 else if( nPrefix
== XML_NAMESPACE_DRAW
&& IsXMLToken( rLocalName
, XML_GLUE_POINT
) )
71 addGluePoint( xAttrList
);
75 // call GroupChildContext function at common ShapeImport
76 pContext
= GetImport().GetShapeImport()->CreateGroupChildContext(
77 GetImport(), nPrefix
, rLocalName
, xAttrList
, mxChildren
);
80 // call parent when no own context was created
82 pContext
= SvXMLImportContext::CreateChildContext(
83 nPrefix
, rLocalName
, xAttrList
);
88 //////////////////////////////////////////////////////////////////////////////
90 void SdXMLGroupShapeContext::StartElement(const uno::Reference
< xml::sax::XAttributeList
>&)
92 // create new group shape and add it to rShapes, use it
93 // as base for the new group import
94 AddShape( "com.sun.star.drawing.GroupShape" );
100 mxChildren
= uno::Reference
< drawing::XShapes
>::query( mxShape
);
101 if( mxChildren
.is() )
102 GetImport().GetShapeImport()->pushGroupForSorting( mxChildren
);
105 GetImport().GetShapeImport()->finishShape( mxShape
, mxAttrList
, mxShapes
);
108 //////////////////////////////////////////////////////////////////////////////
110 void SdXMLGroupShapeContext::EndElement()
112 if( mxChildren
.is() )
113 GetImport().GetShapeImport()->popGroupAndSort();
115 SdXMLShapeContext::EndElement();
119 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */