LibreOffice Module reportdesign (master) 1
xmlReportElementBase.cxx
Go to the documentation of this file.
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 */
21#include <xmloff/xmltoken.hxx>
23#include "xmlfilter.hxx"
25#include "xmlReportElement.hxx"
26#include "xmlEnums.hxx"
27#include "xmlTable.hxx"
29
30namespace rptxml
31{
32 using namespace ::com::sun::star;
33 using namespace ::com::sun::star::report;
34 using namespace ::com::sun::star::uno;
35 using namespace ::com::sun::star::xml::sax;
36
38 ,const Reference< XReportComponent > & _xComponent
39 ,OXMLTable* _pContainer) :
40 SvXMLImportContext( rImport )
41,m_rImport(rImport)
42,m_pContainer(_pContainer)
43,m_xReportComponent(_xComponent)
44{
45}
46
47
48OXMLReportElementBase::~OXMLReportElementBase()
49{
50}
51
52css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLReportElementBase::createFastChildContext(
53 sal_Int32 nElement,
54 const Reference< XFastAttributeList > & xAttrList )
55{
56 css::uno::Reference< css::xml::sax::XFastContextHandler > xContext;
57
58 switch( nElement )
59 {
61 {
62 uno::Reference<report::XReportControlModel> xReportModel(m_xReportComponent,uno::UNO_QUERY);
63 if ( xReportModel.is() )
64 {
65 m_rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
66 xContext = new OXMLReportElement( m_rImport,xAttrList,xReportModel);
67 }
68 }
69 break;
71 m_rImport.GetProgressBarHelper()->Increment( PROGRESS_BAR_STEP );
72 xContext = new OXMLControlProperty( m_rImport,xAttrList,m_xReportComponent);
73 break;
74 default:
75 break;
76 }
77
78 return xContext;
79}
80
81void OXMLReportElementBase::endFastElement(sal_Int32 )
82{
83 try
84 {
85 if ( m_pContainer && m_pContainer->getSection().is() && m_xReportComponent.is() )
86 m_pContainer->getSection()->add(m_xReportComponent);
87 }
88 catch(Exception&)
89 {
90 TOOLS_WARN_EXCEPTION( "reportdesign", "Exception caught while inserting a new control!");
91 }
92}
93
94} // namespace rptxml
95
96
97/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
const SvXMLImport & m_rImport
OXMLReportElementBase(const OXMLReportElementBase &)=delete
#define TOOLS_WARN_EXCEPTION(area, stream)
@ Exception
REPORT
FORM
XML_PROPERTIES
XML_REPORT_ELEMENT
#define PROGRESS_BAR_STEP
Definition: xmlEnums.hxx:22
#define XML_ELEMENT(prefix, name)