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 "xmlCondPrtExpr.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 "xmlComponent.hxx"
36 : : #include "xmlstrings.hrc"
37 : : #include <tools/debug.hxx>
38 : :
39 : : namespace rptxml
40 : : {
41 : : using namespace ::com::sun::star;
42 : : using namespace report;
43 : : using namespace uno;
44 : : using namespace xml::sax;
45 : : DBG_NAME( rpt_OXMLCondPrtExpr )
46 : :
47 : 0 : OXMLCondPrtExpr::OXMLCondPrtExpr( ORptFilter& _rImport,
48 : : sal_uInt16 nPrfx
49 : : ,const ::rtl::OUString& rLName
50 : : ,const uno::Reference< xml::sax::XAttributeList > & _xAttrList
51 : : ,const Reference< XPropertySet > & _xComponent ) :
52 : : SvXMLImportContext( _rImport, nPrfx, rLName )
53 : 0 : ,m_xComponent(_xComponent)
54 : : {
55 : : DBG_CTOR( rpt_OXMLCondPrtExpr,NULL);
56 : :
57 : : OSL_ENSURE(m_xComponent.is(),"Component is NULL!");
58 : 0 : const SvXMLNamespaceMap& rMap = _rImport.GetNamespaceMap();
59 [ # # ]: 0 : const SvXMLTokenMap& rTokenMap = _rImport.GetFunctionElemTokenMap();
60 [ # # ][ # # ]: 0 : const sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0;
[ # # ]
61 : : try
62 : : {
63 [ # # ]: 0 : for(sal_Int16 i = 0; i < nLength; ++i)
64 : : {
65 : 0 : ::rtl::OUString sLocalName;
66 [ # # ][ # # ]: 0 : const rtl::OUString sAttrName = _xAttrList->getNameByIndex( i );
67 [ # # ]: 0 : const sal_uInt16 nPrefix = rMap.GetKeyByAttrName( sAttrName,&sLocalName );
68 [ # # ][ # # ]: 0 : const rtl::OUString sValue = _xAttrList->getValueByIndex( i );
69 : :
70 [ # # ][ # # ]: 0 : switch( rTokenMap.Get( nPrefix, sLocalName ) )
71 : : {
72 : : case XML_TOK_FUNCTION_FORMULA:
73 [ # # ][ # # ]: 0 : m_xComponent->setPropertyValue(PROPERTY_CONDITIONALPRINTEXPRESSION,uno::makeAny(ORptFilter::convertFormula(sValue)));
[ # # ][ # # ]
[ # # ]
74 : 0 : break;
75 : : default:
76 : 0 : break;
77 : : }
78 : :
79 [ # # ]: 0 : }
80 : : }
81 [ # # ]: 0 : catch(const Exception&)
82 : : {
83 : : OSL_FAIL("Exception catched while putting Function props!");
84 : : }
85 : 0 : }
86 : : // -----------------------------------------------------------------------------
87 : :
88 : 0 : OXMLCondPrtExpr::~OXMLCondPrtExpr()
89 : : {
90 : :
91 : : DBG_DTOR( rpt_OXMLCondPrtExpr,NULL);
92 [ # # ]: 0 : }
93 : : // -----------------------------------------------------------------------------
94 : : // -----------------------------------------------------------------------------
95 : 0 : void OXMLCondPrtExpr::Characters( const ::rtl::OUString& rChars )
96 : : {
97 [ # # ][ # # ]: 0 : m_xComponent->setPropertyValue(PROPERTY_CONDITIONALPRINTEXPRESSION,makeAny(rChars));
98 : 0 : }
99 : : //----------------------------------------------------------------------------
100 : : } // namespace rptxml
101 : : // -----------------------------------------------------------------------------
102 : :
103 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|