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