xref: /aoo42x/main/xmloff/source/draw/ximplink.cxx (revision 63bba73c)
1 /**************************************************************
2  *
3  * Licensed to the Apache Software Foundation (ASF) under one
4  * or more contributor license agreements.  See the NOTICE file
5  * distributed with this work for additional information
6  * regarding copyright ownership.  The ASF licenses this file
7  * to you under the Apache License, Version 2.0 (the
8  * "License"); you may not use this file except in compliance
9  * with the License.  You may obtain a copy of the License at
10  *
11  *   http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing,
14  * software distributed under the License is distributed on an
15  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
16  * KIND, either express or implied.  See the License for the
17  * specific language governing permissions and limitations
18  * under the License.
19  *
20  *************************************************************/
21 
22 
23 
24 // MARKER(update_precomp.py): autogen include statement, do not remove
25 #include "precompiled_xmloff.hxx"
26 #include"xmloff/xmlnmspe.hxx"
27 #include "ximplink.hxx"
28 #include <xmloff/xmltoken.hxx>
29 
30 using ::rtl::OUString;
31 using ::rtl::OUStringBuffer;
32 
33 using namespace ::com::sun::star;
34 using namespace ::xmloff::token;
35 
36 //////////////////////////////////////////////////////////////////////////////
37 
38 TYPEINIT1( SdXMLShapeLinkContext, SvXMLImportContext );
39 
SdXMLShapeLinkContext(SvXMLImport & rImport,sal_uInt16 nPrfx,const OUString & rLocalName,const uno::Reference<xml::sax::XAttributeList> & xAttrList,uno::Reference<drawing::XShapes> & rShapes)40 SdXMLShapeLinkContext::SdXMLShapeLinkContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList>& xAttrList, uno::Reference< drawing::XShapes >& rShapes)
41 : SvXMLShapeContext( rImport, nPrfx, rLocalName, false )
42 , mxParent( rShapes )
43 {
44 	sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
45 
46 	for(sal_Int16 i=0; i < nAttrCount; i++)
47 	{
48 		OUString sAttrName = xAttrList->getNameByIndex( i );
49 		OUString aLocalName;
50 		sal_uInt16 nPrefix = rImport.GetNamespaceMap().GetKeyByAttrName( sAttrName, &aLocalName );
51 		if( (nPrefix == XML_NAMESPACE_XLINK) && IsXMLToken( aLocalName, XML_HREF ) )
52 		{
53 			msHyperlink = xAttrList->getValueByIndex( i );
54 			break;
55 		}
56 	}
57 }
58 
59 //////////////////////////////////////////////////////////////////////////////
60 
~SdXMLShapeLinkContext()61 SdXMLShapeLinkContext::~SdXMLShapeLinkContext()
62 {
63 }
64 
65 //////////////////////////////////////////////////////////////////////////////
66 
CreateChildContext(sal_uInt16 nPrefix,const OUString & rLocalName,const uno::Reference<xml::sax::XAttributeList> & xAttrList)67 SvXMLImportContext* SdXMLShapeLinkContext::CreateChildContext( sal_uInt16 nPrefix,
68 	const OUString& rLocalName,
69 	const uno::Reference< xml::sax::XAttributeList>& xAttrList )
70 {
71 	SvXMLShapeContext* pContext = GetImport().GetShapeImport()->CreateGroupChildContext( GetImport(), nPrefix, rLocalName, xAttrList, mxParent);
72 
73 	if( pContext )
74 	{
75 		pContext->setHyperlink( msHyperlink );
76 		return pContext;
77 	}
78 
79 	// call parent when no own context was created
80 	return SvXMLImportContext::CreateChildContext( nPrefix, rLocalName, xAttrList);
81 
82 }
83 
84 //////////////////////////////////////////////////////////////////////////////
85 
StartElement(const uno::Reference<xml::sax::XAttributeList> & xAttr)86 void SdXMLShapeLinkContext::StartElement(const uno::Reference< xml::sax::XAttributeList>& xAttr )
87 {
88 	SvXMLImportContext::StartElement( xAttr );
89 }
90 
91 //////////////////////////////////////////////////////////////////////////////
92 
EndElement()93 void SdXMLShapeLinkContext::EndElement()
94 {
95 	SvXMLImportContext::EndElement();
96 }
97 
98 
99