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 
27 #include <tools/debug.hxx>
28 #include <com/sun/star/beans/XPropertySet.hpp>
29 #include <com/sun/star/xml/sax/XAttributeList.hpp>
30 #include <xmloff/xmltoken.hxx>
31 #include <xmloff/xmlimp.hxx>
32 #include "xmloff/xmlnmspe.hxx"
33 #include <xmloff/nmspmap.hxx>
34 
35 #include "descriptionimp.hxx"
36 
37 using ::rtl::OUString;
38 using ::rtl::OUStringBuffer;
39 
40 using namespace ::std;
41 using namespace ::cppu;
42 using namespace ::com::sun::star;
43 using namespace ::com::sun::star::xml;
44 using namespace ::com::sun::star::xml::sax;
45 using namespace ::com::sun::star::uno;
46 using namespace ::com::sun::star::drawing;
47 using namespace ::com::sun::star::beans;
48 using namespace ::xmloff::token;
49 
50 ///////////////////////////////////////////////////////////////////////
51 
52 TYPEINIT1( SdXMLDescriptionContext, SvXMLImportContext );
53 
SdXMLDescriptionContext(SvXMLImport & rImport,sal_uInt16 nPrfx,const OUString & rLocalName,const Reference<XAttributeList> &,const Reference<XShape> & rxShape)54 SdXMLDescriptionContext::SdXMLDescriptionContext( SvXMLImport& rImport, sal_uInt16 nPrfx,	const OUString& rLocalName,
55 		const Reference< XAttributeList>&, const Reference< XShape >& rxShape)
56 : SvXMLImportContext(rImport, nPrfx, rLocalName), mxShape( rxShape )
57 {
58 }
59 
~SdXMLDescriptionContext()60 SdXMLDescriptionContext::~SdXMLDescriptionContext()
61 {
62 }
63 
EndElement()64 void SdXMLDescriptionContext::EndElement()
65 {
66 	if( msText.getLength() ) try
67 	{
68 		uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY_THROW);
69 		if(IsXMLToken(GetLocalName(),XML_TITLE))
70 		{
71 			xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Title")), Any(msText));
72 		}
73 		else
74 		{
75 			xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Description")), Any(msText));
76 		}
77 	}
78 	catch( uno::Exception& )
79 	{
80 	}
81 }
82 
83 // This method is called for all characters that are contained in the
84 // current element. The default is to ignore them.
Characters(const::rtl::OUString & rChars)85 void SdXMLDescriptionContext::Characters( const ::rtl::OUString& rChars )
86 {
87 	msText += rChars;
88 }
89 
90