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