LibreOffice Module reportdesign (master)  1
xmlMasterFields.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 "xmlMasterFields.hxx"
20 #include "xmlReportElementBase.hxx"
21 #include "xmlfilter.hxx"
22 #include <xmloff/xmltoken.hxx>
23 #include <xmloff/xmlnamespace.hxx>
25 #include "xmlEnums.hxx"
26 #include <sal/log.hxx>
27 
28 
29 namespace rptxml
30 {
31  using namespace ::com::sun::star;
32  using namespace ::com::sun::star::uno;
33  using namespace ::com::sun::star::xml::sax;
34 
35 OXMLMasterFields::OXMLMasterFields( ORptFilter& rImport,
36  const Reference< XFastAttributeList > & _xAttrList
37  ,IMasterDetailFieds* _pReport
38  ) :
39  SvXMLImportContext( rImport )
40 ,m_pReport(_pReport)
41 {
42  OUString sMasterField,sDetailField;
43  for (auto &aIter : sax_fastparser::castToFastAttributeList( _xAttrList ))
44  {
45  OUString sValue = aIter.toString();
46 
47  switch( aIter.getToken() )
48  {
49  case XML_ELEMENT(REPORT, XML_MASTER):
50  sMasterField = sValue;
51  break;
52  case XML_ELEMENT(REPORT, XML_DETAIL):
53  sDetailField = sValue;
54  break;
55  default:
56  XMLOFF_WARN_UNKNOWN("reportdesign", aIter);
57  break;
58  }
59  }
60  if ( sDetailField.isEmpty() )
61  sDetailField = sMasterField;
62  if ( !sMasterField.isEmpty() )
63  m_pReport->addMasterDetailPair(::std::pair< OUString,OUString >(sMasterField,sDetailField));
64 }
65 
66 
68 {
69 }
70 
71 css::uno::Reference< css::xml::sax::XFastContextHandler > OXMLMasterFields::createFastChildContext(
72  sal_Int32 nElement,
73  const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList )
74 {
75  css::uno::Reference< css::xml::sax::XFastContextHandler > xContext;
76 
77  switch( nElement )
78  {
80  {
82  xContext = new OXMLMasterFields(static_cast<ORptFilter&>(GetImport()),xAttrList ,m_pReport);
83  }
84  break;
85  default:
86  break;
87  }
88 
89  return xContext;
90 }
91 
92 
93 } // namespace rptxml
94 
95 
96 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
XML_MASTER_DETAIL_FIELD
SvXMLImport & GetImport()
virtual css::uno::Reference< css::xml::sax::XFastContextHandler > SAL_CALL createFastChildContext(sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList) override
FastAttributeList & castToFastAttributeList(const css::uno::Reference< css::xml::sax::XFastAttributeList > &xAttrList)
#define XMLOFF_WARN_UNKNOWN(area, rIter)
virtual ~OXMLMasterFields() override
void Increment(sal_Int32 nInc=1)
ProgressBarHelper * GetProgressBarHelper()
IMasterDetailFieds * m_pReport
OXMLMasterFields(const OXMLMasterFields &)=delete
#define XML_ELEMENT(prefix, name)
#define PROGRESS_BAR_STEP
Definition: xmlEnums.hxx:22
REPORT