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