LibreOffice Module reportdesign (master) 1
xmlFormattedField.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 */
19#include "xmlFormattedField.hxx"
20#include "xmlfilter.hxx"
21#include <xmloff/xmltoken.hxx>
23#include <osl/diagnose.h>
25
26
27namespace rptxml
28{
29 using namespace ::com::sun::star;
30 using namespace xml::sax;
31
33 ,const uno::Reference< xml::sax::XFastAttributeList > & _xAttrList
34 ,const uno::Reference< XFormattedField > & _xComponent
35 ,OXMLTable* _pContainer
36 ,bool _bPageCount) :
37 OXMLReportElementBase( rImport,_xComponent,_pContainer)
38{
39 OSL_ENSURE(m_xReportComponent.is(),"Component is NULL!");
40
41 try
42 {
43 for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
44 {
45 switch( aIter.getToken() )
46 {
47 case XML_ELEMENT(REPORT, XML_FORMULA):
48 _xComponent->setDataField(ORptFilter::convertFormula(aIter.toString()));
49 break;
50 case XML_ELEMENT(REPORT, XML_SELECT_PAGE):
51 _xComponent->setDataField("rpt:PageNumber()");
52 break;
53 default:
54 XMLOFF_WARN_UNKNOWN("reportdesign", aIter);
55 break;
56 }
57 }
58 if ( _bPageCount )
59 {
60 _xComponent->setDataField("rpt:PageCount()");
61 }
62 }
63 catch(Exception&)
64 {
65 TOOLS_WARN_EXCEPTION( "reportdesign", "Exception caught while filling the report definition props");
66 }
67}
68
69OXMLFormattedField::~OXMLFormattedField()
70{
71}
72
73
74} // namespace rptxml
75
76
77/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
OXMLFormattedField(const OXMLFormattedField &)=delete
#define TOOLS_WARN_EXCEPTION(area, stream)
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
OUString toString(OptionInfo const *info)
#define XMLOFF_WARN_UNKNOWN(area, rIter)
#define XML_ELEMENT(prefix, name)