update dev300-m58
[ooovba.git] / xmloff / source / draw / viewcontext.cxx
blobf8e057d53bbbf06174a85f2de8a91a9508438d2a
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: viewcontext.cxx,v $
10 * $Revision: 1.7 $
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"
33 #include "viewcontext.hxx"
34 #include "sdxmlimp_impl.hxx"
35 #include <xmloff/xmltoken.hxx>
36 #include "xmlnmspe.hxx"
37 #include <xmloff/nmspmap.hxx>
38 #include "VisAreaContext.hxx"
40 using namespace com::sun::star;
41 using namespace rtl;
42 using ::xmloff::token::IsXMLToken;
44 using ::xmloff::token::XML_EMBEDDED_VISIBLE_AREA;
46 //------------------------------------------------------------------
48 SdXMLViewSettingsContext::SdXMLViewSettingsContext( SdXMLImport& rImport, USHORT nPrfx, const OUString& rLName, const uno::Reference<xml::sax::XAttributeList>& ) :
49 SvXMLImportContext( rImport, nPrfx, rLName )
53 SdXMLViewSettingsContext::~SdXMLViewSettingsContext()
57 SvXMLImportContext *SdXMLViewSettingsContext::CreateChildContext( USHORT nPrefix,
58 const OUString& rLocalName,
59 const ::com::sun::star::uno::Reference<
60 ::com::sun::star::xml::sax::XAttributeList>& xAttrList )
62 SvXMLImportContext *pContext = 0;
64 if (nPrefix == XML_NAMESPACE_OFFICE)
66 if ( IsXMLToken( rLocalName, XML_EMBEDDED_VISIBLE_AREA ) )
68 sal_Int16 nMeasureUnit = 0;
70 uno::Reference< beans::XPropertySet > xProps( GetImport().GetModel(), uno::UNO_QUERY );
71 if( xProps.is() )
72 xProps->getPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "MapUnit" ) ) ) >>= nMeasureUnit;
74 pContext = new XMLVisAreaContext(GetImport(), nPrefix, rLocalName, xAttrList, maVisArea, nMeasureUnit);
78 if( !pContext )
79 pContext = new SvXMLImportContext( GetImport(), nPrefix, rLocalName );
81 return pContext;
84 void SdXMLViewSettingsContext::EndElement()
86 uno::Reference< beans::XPropertySet > xProps( GetImport().GetModel(), uno::UNO_QUERY );
87 if( xProps.is() )
89 uno::Any aAny;
90 aAny <<= maVisArea;
92 xProps->setPropertyValue( OUString( RTL_CONSTASCII_USTRINGPARAM( "VisibleArea" ) ), aAny );