Line data Source code
1 : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : /*
3 : * This file is part of the LibreOffice project.
4 : *
5 : * This Source Code Form is subject to the terms of the Mozilla Public
6 : * License, v. 2.0. If a copy of the MPL was not distributed with this
7 : * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 : *
9 : * This file incorporates work covered by the following license notice:
10 : *
11 : * Licensed to the Apache Software Foundation (ASF) under one or more
12 : * contributor license agreements. See the NOTICE file distributed
13 : * with this work for additional information regarding copyright
14 : * ownership. The ASF licenses this file to you under the Apache
15 : * License, Version 2.0 (the "License"); you may not use this file
16 : * except in compliance with the License. You may obtain a copy of
17 : * the License at http://www.apache.org/licenses/LICENSE-2.0 .
18 : */
19 : #include "xmlFormattedField.hxx"
20 : #include "xmlfilter.hxx"
21 : #include <xmloff/xmltoken.hxx>
22 : #include <xmloff/xmlnmspe.hxx>
23 : #include <xmloff/nmspmap.hxx>
24 : #include "xmlEnums.hxx"
25 : #include "xmlControlProperty.hxx"
26 : #include "xmlHelper.hxx"
27 : #include <xmloff/xmluconv.hxx>
28 : #include "xmlReportElement.hxx"
29 : #include "xmlComponent.hxx"
30 : #include <tools/debug.hxx>
31 :
32 :
33 : namespace rptxml
34 : {
35 : using namespace ::com::sun::star;
36 : using namespace xml::sax;
37 :
38 0 : OXMLFormattedField::OXMLFormattedField( ORptFilter& rImport,
39 : sal_uInt16 nPrfx, const OUString& rLName
40 : ,const uno::Reference< xml::sax::XAttributeList > & _xAttrList
41 : ,const uno::Reference< XFormattedField > & _xComponent
42 : ,OXMLTable* _pContainer
43 : ,bool _bPageCount) :
44 0 : OXMLReportElementBase( rImport, nPrfx, rLName,_xComponent.get(),_pContainer)
45 : {
46 : OSL_ENSURE(m_xComponent.is(),"Component is NULL!");
47 0 : const SvXMLNamespaceMap& rMap = rImport.GetNamespaceMap();
48 0 : const SvXMLTokenMap& rTokenMap = rImport.GetControlElemTokenMap();
49 :
50 0 : const sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0;
51 : try
52 : {
53 0 : for(sal_Int16 i = 0; i < nLength; ++i)
54 : {
55 0 : OUString sLocalName;
56 0 : const OUString sAttrName = _xAttrList->getNameByIndex( i );
57 0 : const sal_uInt16 nPrefix = rMap.GetKeyByAttrName( sAttrName,&sLocalName );
58 0 : const OUString sValue = _xAttrList->getValueByIndex( i );
59 :
60 0 : switch( rTokenMap.Get( nPrefix, sLocalName ) )
61 : {
62 : case XML_TOK_DATA_FORMULA:
63 0 : _xComponent->setDataField(ORptFilter::convertFormula(sValue));
64 0 : break;
65 : case XML_TOK_SELECT_PAGE:
66 : {
67 0 : static const OUString s_sPageNumber("rpt:PageNumber()");
68 0 : _xComponent->setDataField(s_sPageNumber);
69 : }
70 0 : break;
71 : default:
72 0 : break;
73 : }
74 0 : }
75 0 : if ( _bPageCount )
76 : {
77 0 : static const OUString s_sPageNumber("rpt:PageCount()");
78 0 : _xComponent->setDataField(s_sPageNumber);
79 : }
80 : }
81 0 : catch(Exception&)
82 : {
83 : OSL_FAIL("Exception catched while filling the report definition props");
84 : }
85 0 : }
86 :
87 0 : OXMLFormattedField::~OXMLFormattedField()
88 : {
89 0 : }
90 :
91 :
92 : } // namespace rptxml
93 :
94 :
95 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|