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 :
37 : namespace rptxml
38 : {
39 : using namespace ::comphelper;
40 : using namespace ::com::sun::star;
41 : using namespace ::com::sun::star::uno;
42 : using namespace ::com::sun::star::beans;
43 : using namespace ::com::sun::star::report;
44 : using namespace ::com::sun::star::xml::sax;
45 : DBG_NAME( rpt_OXMLComponent )
46 0 : OXMLComponent::OXMLComponent( ORptFilter& _rImport
47 : ,sal_uInt16 nPrfx
48 : ,const OUString& _sLocalName
49 : ,const Reference< XAttributeList > & _xAttrList
50 : ,const Reference< XReportComponent > & _xComponent
51 : ) :
52 : SvXMLImportContext( _rImport, nPrfx, _sLocalName )
53 0 : ,m_xComponent(_xComponent)
54 : {
55 : DBG_CTOR( rpt_OXMLComponent,NULL);
56 : OSL_ENSURE(_xAttrList.is(),"Attribute list is NULL!");
57 : OSL_ENSURE(m_xComponent.is(),"Component is NULL!");
58 :
59 0 : const SvXMLNamespaceMap& rMap = _rImport.GetNamespaceMap();
60 0 : const SvXMLTokenMap& rTokenMap = _rImport.GetComponentElemTokenMap();
61 :
62 0 : const sal_Int16 nLength = (_xAttrList.is()) ? _xAttrList->getLength() : 0;
63 :
64 0 : for(sal_Int16 i = 0; i < nLength; ++i)
65 : {
66 : try
67 : {
68 0 : OUString sLocalName;
69 0 : const OUString sAttrName = _xAttrList->getNameByIndex( i );
70 0 : const sal_uInt16 nPrefix = rMap.GetKeyByAttrName( sAttrName,&sLocalName );
71 0 : const OUString sValue = _xAttrList->getValueByIndex( i );
72 :
73 0 : switch( rTokenMap.Get( nPrefix, sLocalName ) )
74 : {
75 : case XML_TOK_NAME:
76 0 : m_xComponent->setName(sValue);
77 0 : break;
78 : case XML_TOK_TEXT_STYLE_NAME:
79 0 : m_sTextStyleName = sValue;
80 0 : break;
81 : case XML_TOK_TRANSFORM:
82 0 : break;
83 : default:
84 0 : break;
85 0 : }
86 : }
87 0 : catch(const Exception&)
88 : {
89 : OSL_FAIL("Exception catched while putting props into report component!");
90 : }
91 : }
92 0 : }
93 : // -----------------------------------------------------------------------------
94 :
95 0 : OXMLComponent::~OXMLComponent()
96 : {
97 : DBG_DTOR( rpt_OXMLComponent,NULL);
98 0 : }
99 : // -----------------------------------------------------------------------------
100 : //----------------------------------------------------------------------------
101 : } // namespace rptxml
102 : // -----------------------------------------------------------------------------
103 :
104 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|