Update ooo320-m1
[ooovba.git] / xmloff / source / draw / descriptionimp.cxx
blobb6770014ea1e5fbe579379acc8e2a507ff67efd7
1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: descriptionimp.cxx,v $
10 * $Revision: 1.5 $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_xmloff.hxx"
34 #include <tools/debug.hxx>
35 #include <com/sun/star/beans/XPropertySet.hpp>
36 #include <com/sun/star/xml/sax/XAttributeList.hpp>
37 #include <xmloff/xmltoken.hxx>
38 #include <xmloff/xmlimp.hxx>
39 #include "xmlnmspe.hxx"
40 #include <xmloff/nmspmap.hxx>
42 #include "descriptionimp.hxx"
44 using ::rtl::OUString;
45 using ::rtl::OUStringBuffer;
47 using namespace ::std;
48 using namespace ::cppu;
49 using namespace ::com::sun::star;
50 using namespace ::com::sun::star::xml;
51 using namespace ::com::sun::star::xml::sax;
52 using namespace ::com::sun::star::uno;
53 using namespace ::com::sun::star::drawing;
54 using namespace ::com::sun::star::beans;
55 using namespace ::xmloff::token;
57 ///////////////////////////////////////////////////////////////////////
59 TYPEINIT1( SdXMLDescriptionContext, SvXMLImportContext );
61 SdXMLDescriptionContext::SdXMLDescriptionContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName,
62 const Reference< XAttributeList>&, const Reference< XShape >& rxShape)
63 : SvXMLImportContext(rImport, nPrfx, rLocalName), mxShape( rxShape )
67 SdXMLDescriptionContext::~SdXMLDescriptionContext()
71 void SdXMLDescriptionContext::EndElement()
73 if( msText.getLength() ) try
75 uno::Reference< beans::XPropertySet > xPropSet(mxShape, uno::UNO_QUERY_THROW);
76 if(IsXMLToken(GetLocalName(),XML_TITLE))
78 xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Title")), Any(msText));
80 else
82 xPropSet->setPropertyValue(OUString(RTL_CONSTASCII_USTRINGPARAM("Description")), Any(msText));
85 catch( uno::Exception& )
90 // This method is called for all characters that are contained in the
91 // current element. The default is to ignore them.
92 void SdXMLDescriptionContext::Characters( const ::rtl::OUString& rChars )
94 msText += rChars;