1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
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 .
19 #include "ReportVisitor.hxx"
20 namespace reportdesign
22 using namespace com::sun::star
;
24 OReportVisitor::OReportVisitor(ITraverseReport
* _pTraverseReport
)
25 :m_pTraverseReport(_pTraverseReport
)
27 OSL_ENSURE(m_pTraverseReport
,"ReportDefintion must be not NULL!");
29 // -----------------------------------------------------------------------------
30 void OReportVisitor::start(const uno::Reference
< report::XReportDefinition
>& _xReportDefinition
)
32 OSL_ENSURE(_xReportDefinition
.is(),"ReportDefinition is NULL!");
33 if ( !_xReportDefinition
.is() )
36 m_pTraverseReport
->traverseReport(_xReportDefinition
);
37 m_pTraverseReport
->traverseReportFunctions(_xReportDefinition
->getFunctions());
38 if ( _xReportDefinition
->getPageHeaderOn() )
39 m_pTraverseReport
->traversePageHeader(_xReportDefinition
->getPageHeader());
40 if ( _xReportDefinition
->getReportHeaderOn() )
41 m_pTraverseReport
->traverseReportHeader(_xReportDefinition
->getReportHeader());
43 uno::Reference
< report::XGroups
> xGroups
= _xReportDefinition
->getGroups();
44 m_pTraverseReport
->traverseGroups(xGroups
);
45 const sal_Int32 nCount
= xGroups
->getCount();
49 uno::Reference
< report::XGroup
> xGroup(xGroups
->getByIndex(i
),uno::UNO_QUERY
);
50 m_pTraverseReport
->traverseGroup(xGroup
);
51 m_pTraverseReport
->traverseGroupFunctions(xGroup
->getFunctions());
52 if ( xGroup
->getHeaderOn() )
53 m_pTraverseReport
->traverseGroupHeader(xGroup
->getHeader());
56 m_pTraverseReport
->traverseDetail(_xReportDefinition
->getDetail());
58 for (i
= 0;i
<nCount
; ++i
)
60 uno::Reference
< report::XGroup
> xGroup(xGroups
->getByIndex(i
),uno::UNO_QUERY
);
61 if ( xGroup
->getFooterOn() )
62 m_pTraverseReport
->traverseGroupFooter(xGroup
->getFooter());
65 if ( _xReportDefinition
->getPageFooterOn() )
66 m_pTraverseReport
->traversePageFooter(_xReportDefinition
->getPageFooter());
67 if ( _xReportDefinition
->getReportFooterOn() )
68 m_pTraverseReport
->traverseReportFooter(_xReportDefinition
->getReportFooter());
70 // -----------------------------------------------------------------------------
71 void OReportVisitor::start(const uno::Reference
< report::XGroup
>& _xGroup
)
73 OSL_ENSURE(_xGroup
.is(),"Group is NULL!");
76 m_pTraverseReport
->traverseGroup(_xGroup
);
77 m_pTraverseReport
->traverseGroupFunctions(_xGroup
->getFunctions());
78 if ( _xGroup
->getHeaderOn() )
79 m_pTraverseReport
->traverseGroupHeader(_xGroup
->getHeader());
80 if ( _xGroup
->getFooterOn() )
81 m_pTraverseReport
->traverseGroupFooter(_xGroup
->getFooter());
83 // =============================================================================
84 } // namespace reportdesign
85 // =============================================================================
87 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */