Line data Source code
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 0 : TYPEINIT1( SdXMLGroupShapeContext, SvXMLImportContext );
31 :
32 680 : SdXMLGroupShapeContext::SdXMLGroupShapeContext(
33 : SvXMLImport& rImport,
34 : sal_uInt16 nPrfx, const OUString& rLocalName,
35 : const uno::Reference< xml::sax::XAttributeList>& xAttrList,
36 : uno::Reference< drawing::XShapes >& rShapes,
37 : bool bTemporaryShape)
38 680 : : SdXMLShapeContext( rImport, nPrfx, rLocalName, xAttrList, rShapes, bTemporaryShape )
39 : {
40 680 : }
41 :
42 1360 : SdXMLGroupShapeContext::~SdXMLGroupShapeContext()
43 : {
44 1360 : }
45 :
46 1662 : SvXMLImportContext* SdXMLGroupShapeContext::CreateChildContext( sal_uInt16 nPrefix,
47 : const OUString& rLocalName,
48 : const uno::Reference< xml::sax::XAttributeList>& xAttrList )
49 : {
50 1662 : SvXMLImportContext* pContext = 0L;
51 :
52 : // #i68101#
53 1662 : if( nPrefix == XML_NAMESPACE_SVG &&
54 0 : (IsXMLToken( rLocalName, XML_TITLE ) || IsXMLToken( rLocalName, XML_DESC ) ) )
55 : {
56 0 : pContext = new SdXMLDescriptionContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
57 : }
58 1662 : else if( nPrefix == XML_NAMESPACE_OFFICE && IsXMLToken( rLocalName, XML_EVENT_LISTENERS ) )
59 : {
60 0 : pContext = new SdXMLEventsContext( GetImport(), nPrefix, rLocalName, xAttrList, mxShape );
61 : }
62 1662 : else if( nPrefix == XML_NAMESPACE_DRAW && IsXMLToken( rLocalName, XML_GLUE_POINT ) )
63 : {
64 0 : addGluePoint( xAttrList );
65 : }
66 : else
67 : {
68 : // call GroupChildContext function at common ShapeImport
69 1662 : pContext = GetImport().GetShapeImport()->CreateGroupChildContext(
70 3324 : GetImport(), nPrefix, rLocalName, xAttrList, mxChildren);
71 : }
72 :
73 : // call parent when no own context was created
74 1662 : if(!pContext)
75 : pContext = SvXMLImportContext::CreateChildContext(
76 0 : nPrefix, rLocalName, xAttrList);
77 :
78 1662 : return pContext;
79 : }
80 :
81 680 : void SdXMLGroupShapeContext::StartElement(const uno::Reference< xml::sax::XAttributeList>&)
82 : {
83 : // create new group shape and add it to rShapes, use it
84 : // as base for the new group import
85 680 : AddShape( "com.sun.star.drawing.GroupShape" );
86 :
87 680 : if(mxShape.is())
88 : {
89 680 : SetStyle( false );
90 :
91 680 : mxChildren = uno::Reference< drawing::XShapes >::query( mxShape );
92 680 : if( mxChildren.is() )
93 680 : GetImport().GetShapeImport()->pushGroupForSorting( mxChildren );
94 : }
95 :
96 680 : GetImport().GetShapeImport()->finishShape( mxShape, mxAttrList, mxShapes );
97 680 : }
98 :
99 680 : void SdXMLGroupShapeContext::EndElement()
100 : {
101 680 : if( mxChildren.is() )
102 680 : GetImport().GetShapeImport()->popGroupAndSort();
103 :
104 680 : SdXMLShapeContext::EndElement();
105 680 : }
106 :
107 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|