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