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 "xmlFormatCondition.hxx"
29 : : #include "xmlfilter.hxx"
30 : : #include <xmloff/xmltoken.hxx>
31 : : #include <xmloff/xmlnmspe.hxx>
32 : : #include <xmloff/nmspmap.hxx>
33 : : #include <xmloff/xmluconv.hxx>
34 : : #include "xmlEnums.hxx"
35 : : #include "xmlHelper.hxx"
36 : : #include <com/sun/star/report/XReportControlFormat.hpp>
37 : : #include <comphelper/genericpropertyset.hxx>
38 : : #include <com/sun/star/awt/FontDescriptor.hpp>
39 : : #include <com/sun/star/beans/PropertyAttribute.hpp>
40 : : #include "xmlstrings.hrc"
41 : : #include "xmlStyleImport.hxx"
42 : : #include <tools/debug.hxx>
43 : :
44 : : namespace rptxml
45 : : {
46 : : using namespace ::comphelper;
47 : : using namespace ::com::sun::star;
48 : : using namespace ::com::sun::star::report;
49 : : using namespace ::com::sun::star::uno;
50 : : using namespace ::com::sun::star::xml::sax;
51 : : using namespace ::com::sun::star::beans;
52 : :
53 : : DBG_NAME( rpt_OXMLFormatCondition )
54 : :
55 : 0 : OXMLFormatCondition::OXMLFormatCondition( ORptFilter& rImport,
56 : : sal_uInt16 nPrfx, const ::rtl::OUString& rLName,
57 : : const Reference< XAttributeList > & _xAttrList
58 : : ,const Reference< XFormatCondition > & _xComponent ) :
59 : : SvXMLImportContext( rImport, nPrfx, rLName )
60 : : ,m_rImport(rImport)
61 : 0 : ,m_xComponent(_xComponent)
62 : : {
63 : : DBG_CTOR( rpt_OXMLFormatCondition,NULL);
64 : :
65 : : OSL_ENSURE(m_xComponent.is(),"Component is NULL!");
66 : 0 : const SvXMLNamespaceMap& rMap = rImport.GetNamespaceMap();
67 [ # # ]: 0 : const SvXMLTokenMap& rTokenMap = rImport.GetFormatElemTokenMap();
68 [ # # ][ # # ]: 0 : static const ::rtl::OUString s_sTRUE = ::xmloff::token::GetXMLToken(XML_TRUE);
[ # # ][ # # ]
69 [ # # ][ # # ]: 0 : const sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0;
[ # # ]
70 : : try
71 : : {
72 [ # # ]: 0 : for(sal_Int16 i = 0; i < nLength; ++i)
73 : : {
74 : 0 : ::rtl::OUString sLocalName;
75 [ # # ][ # # ]: 0 : const rtl::OUString sAttrName = _xAttrList->getNameByIndex( i );
76 [ # # ]: 0 : const sal_uInt16 nPrefix = rMap.GetKeyByAttrName( sAttrName,&sLocalName );
77 [ # # ][ # # ]: 0 : const rtl::OUString sValue = _xAttrList->getValueByIndex( i );
78 : :
79 [ # # ]: 0 : switch( rTokenMap.Get( nPrefix, sLocalName ) )
[ # # # # ]
80 : : {
81 : : case XML_TOK_ENABLED:
82 [ # # ][ # # ]: 0 : m_xComponent->setEnabled(sValue == s_sTRUE);
83 : 0 : break;
84 : : case XML_TOK_FORMULA:
85 [ # # ][ # # ]: 0 : m_xComponent->setFormula(ORptFilter::convertFormula(sValue));
[ # # ]
86 : 0 : break;
87 : : case XML_TOK_FORMAT_STYLE_NAME:
88 : 0 : m_sStyleName = sValue;
89 : 0 : break;
90 : : default:
91 : 0 : break;
92 : : }
93 [ # # ]: 0 : }
94 : : }
95 [ # # ]: 0 : catch(Exception&)
96 : : {
97 : : OSL_FAIL("Exception catched while filling the report definition props");
98 : : }
99 : 0 : }
100 : : // -----------------------------------------------------------------------------
101 : :
102 : 0 : OXMLFormatCondition::~OXMLFormatCondition()
103 : : {
104 : :
105 : : DBG_DTOR( rpt_OXMLFormatCondition,NULL);
106 [ # # ]: 0 : }
107 : : // -----------------------------------------------------------------------------
108 : 0 : void OXMLFormatCondition::EndElement()
109 : : {
110 [ # # ][ # # ]: 0 : OXMLHelper::copyStyleElements(m_rImport.isOldFormat(),m_sStyleName,GetImport().GetAutoStyles(),m_xComponent.get());
[ # # ][ # # ]
111 : 0 : }
112 : : //----------------------------------------------------------------------------
113 : : } // namespace rptxml
114 : : // -----------------------------------------------------------------------------
115 : :
116 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|