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 : : #include "xmlFormattedField.hxx"
29 : : #include "xmlfilter.hxx"
30 : : #include <xmloff/xmltoken.hxx>
31 : : #include <xmloff/xmlnmspe.hxx>
32 : : #include <xmloff/nmspmap.hxx>
33 : : #include "xmlEnums.hxx"
34 : : #include "xmlControlProperty.hxx"
35 : : #include "xmlHelper.hxx"
36 : : #include <xmloff/xmluconv.hxx>
37 : : #include "xmlReportElement.hxx"
38 : : #include "xmlComponent.hxx"
39 : : #include <tools/debug.hxx>
40 : :
41 : :
42 : : namespace rptxml
43 : : {
44 : : using namespace ::com::sun::star;
45 : : using namespace xml::sax;
46 : : DBG_NAME( rpt_OXMLFormattedField )
47 : :
48 : 0 : OXMLFormattedField::OXMLFormattedField( ORptFilter& rImport,
49 : : sal_uInt16 nPrfx, const ::rtl::OUString& rLName
50 : : ,const uno::Reference< xml::sax::XAttributeList > & _xAttrList
51 : : ,const uno::Reference< XFormattedField > & _xComponent
52 : : ,OXMLTable* _pContainer
53 : : ,bool _bPageCount) :
54 [ # # ]: 0 : OXMLReportElementBase( rImport, nPrfx, rLName,_xComponent.get(),_pContainer)
55 : : {
56 : : DBG_CTOR( rpt_OXMLFormattedField,NULL);
57 : : OSL_ENSURE(m_xComponent.is(),"Component is NULL!");
58 : 0 : const SvXMLNamespaceMap& rMap = rImport.GetNamespaceMap();
59 [ # # ]: 0 : const SvXMLTokenMap& rTokenMap = rImport.GetControlElemTokenMap();
60 : :
61 [ # # ][ # # ]: 0 : const sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0;
[ # # ]
62 : : try
63 : : {
64 [ # # ]: 0 : for(sal_Int16 i = 0; i < nLength; ++i)
65 : : {
66 : 0 : ::rtl::OUString sLocalName;
67 [ # # ][ # # ]: 0 : const rtl::OUString sAttrName = _xAttrList->getNameByIndex( i );
68 [ # # ]: 0 : const sal_uInt16 nPrefix = rMap.GetKeyByAttrName( sAttrName,&sLocalName );
69 [ # # ][ # # ]: 0 : const rtl::OUString sValue = _xAttrList->getValueByIndex( i );
70 : :
71 [ # # ]: 0 : switch( rTokenMap.Get( nPrefix, sLocalName ) )
[ # # # ]
72 : : {
73 : : case XML_TOK_DATA_FORMULA:
74 [ # # ][ # # ]: 0 : _xComponent->setDataField(ORptFilter::convertFormula(sValue));
[ # # ]
75 : 0 : break;
76 : : case XML_TOK_SELECT_PAGE:
77 : : {
78 [ # # ][ # # ]: 0 : static const ::rtl::OUString s_sPageNumber(RTL_CONSTASCII_USTRINGPARAM("rpt:PageNumber()"));
[ # # ][ # # ]
79 [ # # ][ # # ]: 0 : _xComponent->setDataField(s_sPageNumber);
80 : : }
81 : 0 : break;
82 : : default:
83 : 0 : break;
84 : : }
85 : 0 : }
86 [ # # ]: 0 : if ( _bPageCount )
87 : : {
88 [ # # ][ # # ]: 0 : static const ::rtl::OUString s_sPageNumber(RTL_CONSTASCII_USTRINGPARAM("rpt:PageCount()"));
[ # # ]
[ # # # # ]
89 [ # # ][ # # ]: 0 : _xComponent->setDataField(s_sPageNumber);
90 : : }
91 : : }
92 [ # # ]: 0 : catch(Exception&)
93 : : {
94 : : OSL_FAIL("Exception catched while filling the report definition props");
95 : : }
96 : 0 : }
97 : : // -----------------------------------------------------------------------------
98 : 0 : OXMLFormattedField::~OXMLFormattedField()
99 : : {
100 : : DBG_DTOR( rpt_OXMLFormattedField,NULL);
101 [ # # ]: 0 : }
102 : : // -----------------------------------------------------------------------------
103 : : //----------------------------------------------------------------------------
104 : : } // namespace rptxml
105 : : // -----------------------------------------------------------------------------
106 : :
107 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|