bump product version to 5.0.4.1
[LibreOffice.git] / reportdesign / source / core / api / ReportVisitor.cxx
blob28906d82f19bae30f7f8cf47f2891f0b920c4919
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #include "ReportVisitor.hxx"
22 #include <osl/diagnose.h>
24 namespace reportdesign
26 using namespace com::sun::star;
28 OReportVisitor::OReportVisitor(ITraverseReport* _pTraverseReport)
29 :m_pTraverseReport(_pTraverseReport)
31 OSL_ENSURE(m_pTraverseReport,"ReportDefintion must be not NULL!");
34 void OReportVisitor::start(const uno::Reference< report::XReportDefinition>& _xReportDefinition)
36 OSL_ENSURE(_xReportDefinition.is(),"ReportDefinition is NULL!");
37 if ( !_xReportDefinition.is() )
38 return;
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());
47 uno::Reference< report::XGroups > xGroups = _xReportDefinition->getGroups();
48 m_pTraverseReport->traverseGroups(xGroups);
49 const sal_Int32 nCount = xGroups->getCount();
50 sal_Int32 i = 0;
51 for (;i<nCount ; ++i)
53 uno::Reference< report::XGroup > xGroup(xGroups->getByIndex(i),uno::UNO_QUERY);
54 m_pTraverseReport->traverseGroup(xGroup);
55 m_pTraverseReport->traverseGroupFunctions(xGroup->getFunctions());
56 if ( xGroup->getHeaderOn() )
57 m_pTraverseReport->traverseGroupHeader(xGroup->getHeader());
60 m_pTraverseReport->traverseDetail(_xReportDefinition->getDetail());
62 for (i = 0;i<nCount ; ++i)
64 uno::Reference< report::XGroup > xGroup(xGroups->getByIndex(i),uno::UNO_QUERY);
65 if ( xGroup->getFooterOn() )
66 m_pTraverseReport->traverseGroupFooter(xGroup->getFooter());
69 if ( _xReportDefinition->getPageFooterOn() )
70 m_pTraverseReport->traversePageFooter(_xReportDefinition->getPageFooter());
71 if ( _xReportDefinition->getReportFooterOn() )
72 m_pTraverseReport->traverseReportFooter(_xReportDefinition->getReportFooter());
75 void OReportVisitor::start(const uno::Reference< report::XGroup>& _xGroup)
77 OSL_ENSURE(_xGroup.is(),"Group is NULL!");
78 if ( !_xGroup.is() )
79 return;
80 m_pTraverseReport->traverseGroup(_xGroup);
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());
88 } // namespace reportdesign
91 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */