Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : :
29 : : #include <SchXMLCalculationSettingsContext.hxx>
30 : : #include <com/sun/star/beans/XPropertySet.hpp>
31 : : #include <com/sun/star/util/DateTime.hpp>
32 : :
33 : : #include <sax/tools/converter.hxx>
34 : :
35 : : #include <xmloff/xmlimp.hxx>
36 : : #include <xmloff/nmspmap.hxx>
37 : : #include "xmloff/xmlnmspe.hxx"
38 : : #include <xmloff/xmltoken.hxx>
39 : :
40 : :
41 : : using ::rtl::OUString;
42 : : using ::rtl::OUStringBuffer;
43 : :
44 : : using namespace ::com::sun::star::uno;
45 : : using namespace ::com::sun::star::beans;
46 : : using namespace ::com::sun::star;
47 : : using namespace ::xmloff::token;
48 : :
49 : 0 : SchXMLCalculationSettingsContext::SchXMLCalculationSettingsContext( SvXMLImport& rImport,
50 : : sal_uInt16 p_nPrefix,
51 : : const ::rtl::OUString& rLocalName,
52 : : const ::com::sun::star::uno::Reference<
53 : : ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
54 : 0 : : SvXMLImportContext ( rImport, p_nPrefix, rLocalName )
55 : : {
56 : 0 : const SvXMLNamespaceMap& rMap = GetImport().GetNamespaceMap();
57 [ # # ][ # # ]: 0 : const sal_Int16 nAttrCount = xAttrList.is() ? xAttrList->getLength() : 0;
[ # # ]
58 [ # # ]: 0 : for( sal_Int16 i=0; i < nAttrCount; i++ )
59 : : {
60 [ # # ][ # # ]: 0 : const rtl::OUString sAttrName = xAttrList->getNameByIndex( i );
61 : 0 : rtl::OUString aLocalName;
62 [ # # ]: 0 : const sal_uInt16 nPrefix = rMap.GetKeyByAttrName(sAttrName, &aLocalName );
63 [ # # ][ # # ]: 0 : if ( nPrefix == XML_NAMESPACE_TABLE && IsXMLToken( aLocalName, XML_DATE_VALUE ) )
[ # # ][ # # ]
64 : : {
65 : 0 : util::DateTime aNullDate;
66 [ # # ][ # # ]: 0 : const rtl::OUString sValue = xAttrList->getValueByIndex( i );
67 [ # # ]: 0 : ::sax::Converter::convertDateTime(aNullDate, sValue);
68 [ # # ]: 0 : m_aNullDate <<= aNullDate;
69 : : }
70 : 0 : }
71 : 0 : }
72 : 0 : SvXMLImportContext* SchXMLCalculationSettingsContext::CreateChildContext( sal_uInt16 nPrefix,
73 : : const ::rtl::OUString& rLocalName,
74 : : const ::com::sun::star::uno::Reference< ::com::sun::star::xml::sax::XAttributeList >& xAttrList )
75 : : {
76 [ # # ]: 0 : return new SchXMLCalculationSettingsContext(GetImport(),nPrefix,rLocalName,xAttrList);
77 : : }
78 : :
79 : 0 : void SchXMLCalculationSettingsContext::EndElement()
80 : : {
81 [ # # ]: 0 : if ( m_aNullDate.hasValue() )
82 : : {
83 [ # # ]: 0 : Reference < XPropertySet > xPropSet ( GetImport().GetModel(), UNO_QUERY );
84 [ # # ]: 0 : ::rtl::OUString sNullDate( RTL_CONSTASCII_USTRINGPARAM ( "NullDate" ) );
85 [ # # ][ # # ]: 0 : xPropSet->setPropertyValue ( sNullDate, m_aNullDate );
86 : : }
87 : 0 : }
88 : :
89 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|