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