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