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