1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
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"
26
27 using namespace ::com::sun::star;
28 using namespace ::xmloff::token;
29
30
SdXMLGroupShapeContext(SvXMLImport & rImport,sal_uInt16 nPrfx,const OUString & rLocalName,const uno::Reference<xml::sax::XAttributeList> & xAttrList,uno::Reference<drawing::XShapes> const & rShapes,bool bTemporaryShape)31 SdXMLGroupShapeContext::SdXMLGroupShapeContext(
32 SvXMLImport& rImport,
33 sal_uInt16 nPrfx, const OUString& rLocalName,
34 const uno::Reference< xml::sax::XAttributeList>& xAttrList,
35 uno::Reference< drawing::XShapes > const & rShapes,
36 bool bTemporaryShape)
37 : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
38 {
39 }
40
~SdXMLGroupShapeContext()41 SdXMLGroupShapeContext::~SdXMLGroupShapeContext()
42 {
43 }
44
CreateChildContext(sal_uInt16 nPrefix,const OUString & rLocalName,const uno::Reference<xml::sax::XAttributeList> & xAttrList)45 SvXMLImportContextRef SdXMLGroupShapeContext::CreateChildContext( sal_uInt16 nPrefix,
46 const OUString& rLocalName,
47 const uno::Reference< xml::sax::XAttributeList>& xAttrList )
48 {
49 SvXMLImportContextRef xContext;
50
51 // #i68101#
52 if( nPrefix == XML_NAMESPACE_SVG &&
53 (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) )
54 {
55 xContext = new SdXMLDescriptionContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
56 }
57 else if( nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
58 {
59 xContext = new SdXMLEventsContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
60 }
61 else if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_GLUE_POINT ) )
62 {
63 addGluePoint( xAttrList );
64 }
65 else
66 {
67 // call GroupChildContext function at common ShapeImport
68 xContext = GetImport().GetShapeImport()->CreateGroupChildContext(
69 GetImport(), nPrefix, rLocalName, xAttrList, mxChildren);
70 }
71
72 // call parent when no own context was created
73 if (!xContext)
74 xContext = SvXMLImportContext::CreateChildContext(
75 nPrefix, rLocalName, xAttrList);
76
77 return xContext;
78 }
79
StartElement(const uno::Reference<xml::sax::XAttributeList> &)80 void SdXMLGroupShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&)
81 {
82 // create new group shape and add it to rShapes, use it
83 // as base for the new group import
84 AddShape( "com.sun.star.drawing.GroupShape" );
85
86 if(mxShape.is())
87 {
88 SetStyle( false );
89
90 mxChildren.set( mxShape, uno::UNO_QUERY );
91 if( mxChildren.is() )
92 GetImport().GetShapeImport()->pushGroupForPostProcessing( mxChildren );
93 }
94
95 GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
96 }
97
EndElement()98 void SdXMLGroupShapeContext::EndElement()
99 {
100 if( mxChildren.is() )
101 GetImport().GetShapeImport()->popGroupAndPostProcess();
102
103 SdXMLShapeContext::EndElement();
104 }
105
106 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
107