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