LibreOffice Module reportdesign (master)  1
ReportVisitor.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 
20 #include <ReportVisitor.hxx>
21 
22 #include <osl/diagnose.h>
23 
24 namespace reportdesign
25 {
26 using namespace com::sun::star;
27 
29  : m_pTraverseReport(_pTraverseReport)
30 {
31  OSL_ENSURE(m_pTraverseReport, "ReportDefinition must be not NULL!");
32 }
33 
34 void OReportVisitor::start(const uno::Reference<report::XReportDefinition>& _xReportDefinition)
35 {
36  OSL_ENSURE(_xReportDefinition.is(), "ReportDefinition is NULL!");
37  if (!_xReportDefinition.is())
38  return;
39 
40  m_pTraverseReport->traverseReport(_xReportDefinition);
41  m_pTraverseReport->traverseReportFunctions(_xReportDefinition->getFunctions());
42  if (_xReportDefinition->getPageHeaderOn())
43  m_pTraverseReport->traversePageHeader(_xReportDefinition->getPageHeader());
44  if (_xReportDefinition->getReportHeaderOn())
45  m_pTraverseReport->traverseReportHeader(_xReportDefinition->getReportHeader());
46 
47  uno::Reference<report::XGroups> xGroups = _xReportDefinition->getGroups();
49  const sal_Int32 nCount = xGroups->getCount();
50  sal_Int32 i = 0;
51  for (; i < nCount; ++i)
52  {
53  uno::Reference<report::XGroup> xGroup(xGroups->getByIndex(i), uno::UNO_QUERY);
55  m_pTraverseReport->traverseGroupFunctions(xGroup->getFunctions());
56  if (xGroup->getHeaderOn())
57  m_pTraverseReport->traverseGroupHeader(xGroup->getHeader());
58  }
59 
60  m_pTraverseReport->traverseDetail(_xReportDefinition->getDetail());
61 
62  for (i = 0; i < nCount; ++i)
63  {
64  uno::Reference<report::XGroup> xGroup(xGroups->getByIndex(i), uno::UNO_QUERY);
65  if (xGroup->getFooterOn())
66  m_pTraverseReport->traverseGroupFooter(xGroup->getFooter());
67  }
68 
69  if (_xReportDefinition->getPageFooterOn())
70  m_pTraverseReport->traversePageFooter(_xReportDefinition->getPageFooter());
71  if (_xReportDefinition->getReportFooterOn())
72  m_pTraverseReport->traverseReportFooter(_xReportDefinition->getReportFooter());
73 }
74 
75 void OReportVisitor::start(const uno::Reference<report::XGroup>& _xGroup)
76 {
77  OSL_ENSURE(_xGroup.is(), "Group is NULL!");
78  if (!_xGroup.is())
79  return;
81  m_pTraverseReport->traverseGroupFunctions(_xGroup->getFunctions());
82  if (_xGroup->getHeaderOn())
83  m_pTraverseReport->traverseGroupHeader(_xGroup->getHeader());
84  if (_xGroup->getFooterOn())
85  m_pTraverseReport->traverseGroupFooter(_xGroup->getFooter());
86 }
87 
88 } // namespace reportdesign
89 
90 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
virtual void traverseGroupHeader(const css::uno::Reference< css::report::XSection > &_xSection)=0
ITraverseReport * m_pTraverseReport
virtual void traverseGroupFooter(const css::uno::Reference< css::report::XSection > &_xSection)=0
virtual void traverseGroupFunctions(const css::uno::Reference< css::report::XFunctions > &_xFunctions)=0
int nCount
virtual void traverseGroups(const css::uno::Reference< css::report::XGroups > &_xGroups)=0
virtual void traverseDetail(const css::uno::Reference< css::report::XSection > &_xSection)=0
int i
virtual void traversePageHeader(const css::uno::Reference< css::report::XSection > &_xSection)=0
virtual void traversePageFooter(const css::uno::Reference< css::report::XSection > &_xSection)=0
virtual void traverseGroup(const css::uno::Reference< css::report::XGroup > &_xGroup)=0
virtual void traverseReportFooter(const css::uno::Reference< css::report::XSection > &_xSection)=0
void start(const css::uno::Reference< css::report::XReportDefinition > &_xReportDefinition)
virtual void traverseReportHeader(const css::uno::Reference< css::report::XSection > &_xSection)=0
virtual void traverseReport(const css::uno::Reference< css::report::XReportDefinition > &_xReport)=0
OReportVisitor(ITraverseReport *_pTraverseReport)
virtual void traverseReportFunctions(const css::uno::Reference< css::report::XFunctions > &_xFunctions)=0