Branch data Line data Source code
1 : : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 : : /*************************************************************************
3 : : *
4 : : * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 : : *
6 : : * Copyright 2000, 2010 Oracle and/or its affiliates.
7 : : *
8 : : * OpenOffice.org - a multi-platform office productivity suite
9 : : *
10 : : * This file is part of OpenOffice.org.
11 : : *
12 : : * OpenOffice.org is free software: you can redistribute it and/or modify
13 : : * it under the terms of the GNU Lesser General Public License version 3
14 : : * only, as published by the Free Software Foundation.
15 : : *
16 : : * OpenOffice.org is distributed in the hope that it will be useful,
17 : : * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 : : * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 : : * GNU Lesser General Public License version 3 for more details
20 : : * (a copy is included in the LICENSE file that accompanied this code).
21 : : *
22 : : * You should have received a copy of the GNU Lesser General Public License
23 : : * version 3 along with OpenOffice.org. If not, see
24 : : * <http://www.openoffice.org/license.html>
25 : : * for a copy of the LGPLv3 License.
26 : : *
27 : : ************************************************************************/
28 : : #include "vbapivottables.hxx"
29 : : #include "vbapivottable.hxx"
30 : : #include <com/sun/star/sheet/XDataPilotTable.hpp>
31 : : #include <ooo/vba/excel/XPivotTable.hpp>
32 : :
33 : :
34 : : using namespace ::com::sun::star;
35 : : using namespace ::ooo::vba;
36 : :
37 : 0 : uno::Any DataPilotToPivotTable( const uno::Any& aSource, uno::Reference< uno::XComponentContext > & xContext )
38 : : {
39 [ # # ]: 0 : uno::Reference< sheet::XDataPilotTable > xTable( aSource, uno::UNO_QUERY_THROW );
40 [ # # ][ # # ]: 0 : return uno::makeAny( uno::Reference< excel::XPivotTable > ( new ScVbaPivotTable( xContext, xTable ) ) );
[ # # ][ # # ]
41 : : }
42 : :
43 [ # # ]: 0 : class PivotTableEnumeration : public EnumerationHelperImpl
44 : : {
45 : : public:
46 : 0 : PivotTableEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration ) throw ( uno::RuntimeException ) : EnumerationHelperImpl( xParent, xContext, xEnumeration ) {}
47 : :
48 : 0 : virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
49 : : {
50 [ # # ]: 0 : return DataPilotToPivotTable( m_xEnumeration->nextElement(), m_xContext );
51 : : }
52 : :
53 : : };
54 : :
55 : 0 : ScVbaPivotTables::ScVbaPivotTables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ): ScVbaPivotTables_BASE( xParent, xContext, xIndexAccess )
56 : : {
57 : 0 : }
58 : :
59 : : uno::Reference< container::XEnumeration >
60 : 0 : ScVbaPivotTables::createEnumeration() throw (uno::RuntimeException)
61 : : {
62 [ # # ]: 0 : uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
63 [ # # ][ # # ]: 0 : return new PivotTableEnumeration( mxParent, mxContext, xEnumAccess->createEnumeration() );
[ # # ][ # # ]
[ # # ][ # # ]
64 : : }
65 : :
66 : : uno::Any
67 : 0 : ScVbaPivotTables::createCollectionObject( const css::uno::Any& aSource )
68 : : {
69 : 0 : return DataPilotToPivotTable( aSource, mxContext );
70 : : }
71 : :
72 : : uno::Type
73 : 0 : ScVbaPivotTables::getElementType() throw (uno::RuntimeException)
74 : : {
75 : 0 : return excel::XPivotTable::static_type(0);
76 : : }
77 : :
78 : : rtl::OUString
79 : 0 : ScVbaPivotTables::getServiceImplName()
80 : : {
81 : 0 : return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScVbaPivotTables"));
82 : : }
83 : :
84 : : css::uno::Sequence<rtl::OUString>
85 : 0 : ScVbaPivotTables::getServiceNames()
86 : : {
87 [ # # ][ # # ]: 0 : static uno::Sequence< rtl::OUString > sNames;
[ # # ][ # # ]
88 [ # # ]: 0 : if ( sNames.getLength() == 0 )
89 : : {
90 : 0 : sNames.realloc( 1 );
91 [ # # ]: 0 : sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.PivotTables") );
92 : : }
93 : 0 : return sNames;
94 : : }
95 : :
96 : : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|