1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: ReportVisitor.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
30 #include "ReportVisitor.hxx"
31 namespace reportdesign
33 using namespace com::sun::star
;
35 OReportVisitor::OReportVisitor(ITraverseReport
* _pTraverseReport
)
36 :m_pTraverseReport(_pTraverseReport
)
38 OSL_ENSURE(m_pTraverseReport
,"ReportDefintion must be not NULL!");
40 // -----------------------------------------------------------------------------
41 void OReportVisitor::start(const uno::Reference
< report::XReportDefinition
>& _xReportDefinition
)
43 OSL_ENSURE(_xReportDefinition
.is(),"ReportDefinition is NULL!");
44 if ( !_xReportDefinition
.is() )
47 m_pTraverseReport
->traverseReport(_xReportDefinition
);
48 m_pTraverseReport
->traverseReportFunctions(_xReportDefinition
->getFunctions());
49 if ( _xReportDefinition
->getPageHeaderOn() )
50 m_pTraverseReport
->traversePageHeader(_xReportDefinition
->getPageHeader());
51 if ( _xReportDefinition
->getReportHeaderOn() )
52 m_pTraverseReport
->traverseReportHeader(_xReportDefinition
->getReportHeader());
54 uno::Reference
< report::XGroups
> xGroups
= _xReportDefinition
->getGroups();
55 m_pTraverseReport
->traverseGroups(xGroups
);
56 const sal_Int32 nCount
= xGroups
->getCount();
60 uno::Reference
< report::XGroup
> xGroup(xGroups
->getByIndex(i
),uno::UNO_QUERY
);
61 m_pTraverseReport
->traverseGroup(xGroup
);
62 m_pTraverseReport
->traverseGroupFunctions(xGroup
->getFunctions());
63 if ( xGroup
->getHeaderOn() )
64 m_pTraverseReport
->traverseGroupHeader(xGroup
->getHeader());
67 m_pTraverseReport
->traverseDetail(_xReportDefinition
->getDetail());
69 for (i
= 0;i
<nCount
; ++i
)
71 uno::Reference
< report::XGroup
> xGroup(xGroups
->getByIndex(i
),uno::UNO_QUERY
);
72 if ( xGroup
->getFooterOn() )
73 m_pTraverseReport
->traverseGroupFooter(xGroup
->getFooter());
76 if ( _xReportDefinition
->getPageFooterOn() )
77 m_pTraverseReport
->traversePageFooter(_xReportDefinition
->getPageFooter());
78 if ( _xReportDefinition
->getReportFooterOn() )
79 m_pTraverseReport
->traverseReportFooter(_xReportDefinition
->getReportFooter());
81 // -----------------------------------------------------------------------------
82 void OReportVisitor::start(const uno::Reference
< report::XGroup
>& _xGroup
)
84 OSL_ENSURE(_xGroup
.is(),"Group is NULL!");
87 m_pTraverseReport
->traverseGroup(_xGroup
);
88 m_pTraverseReport
->traverseGroupFunctions(_xGroup
->getFunctions());
89 if ( _xGroup
->getHeaderOn() )
90 m_pTraverseReport
->traverseGroupHeader(_xGroup
->getHeader());
91 if ( _xGroup
->getFooterOn() )
92 m_pTraverseReport
->traverseGroupFooter(_xGroup
->getFooter());
94 // =============================================================================
95 } // namespace reportdesign
96 // =============================================================================