2010-10-12 15:59:00 +02:00
|
|
|
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
|
2007-04-25 15:10:18 +00:00
|
|
|
/*************************************************************************
|
|
|
|
*
|
2008-04-11 00:12:01 +00:00
|
|
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
2007-04-25 15:10:18 +00:00
|
|
|
*
|
2010-02-12 15:01:35 +01:00
|
|
|
* Copyright 2000, 2010 Oracle and/or its affiliates.
|
2007-04-25 15:10:18 +00:00
|
|
|
*
|
2008-04-11 00:12:01 +00:00
|
|
|
* OpenOffice.org - a multi-platform office productivity suite
|
2007-04-25 15:10:18 +00:00
|
|
|
*
|
2008-04-11 00:12:01 +00:00
|
|
|
* This file is part of OpenOffice.org.
|
2007-04-25 15:10:18 +00:00
|
|
|
*
|
2008-04-11 00:12:01 +00:00
|
|
|
* OpenOffice.org is free software: you can redistribute it and/or modify
|
|
|
|
* it under the terms of the GNU Lesser General Public License version 3
|
|
|
|
* only, as published by the Free Software Foundation.
|
2007-04-25 15:10:18 +00:00
|
|
|
*
|
2008-04-11 00:12:01 +00:00
|
|
|
* OpenOffice.org is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU Lesser General Public License version 3 for more details
|
|
|
|
* (a copy is included in the LICENSE file that accompanied this code).
|
2007-04-25 15:10:18 +00:00
|
|
|
*
|
2008-04-11 00:12:01 +00:00
|
|
|
* You should have received a copy of the GNU Lesser General Public License
|
|
|
|
* version 3 along with OpenOffice.org. If not, see
|
|
|
|
* <http://www.openoffice.org/license.html>
|
|
|
|
* for a copy of the LGPLv3 License.
|
2007-04-25 15:10:18 +00:00
|
|
|
*
|
|
|
|
************************************************************************/
|
|
|
|
#include "vbapivottables.hxx"
|
|
|
|
#include "vbapivottable.hxx"
|
|
|
|
#include <com/sun/star/sheet/XDataPilotTable.hpp>
|
2009-02-13 13:03:24 +00:00
|
|
|
#include <ooo/vba/excel/XPivotTable.hpp>
|
2007-04-25 15:10:18 +00:00
|
|
|
|
|
|
|
|
|
|
|
using namespace ::com::sun::star;
|
2009-02-13 13:03:24 +00:00
|
|
|
using namespace ::ooo::vba;
|
2007-04-25 15:10:18 +00:00
|
|
|
|
|
|
|
uno::Any DataPilotToPivotTable( const uno::Any& aSource, uno::Reference< uno::XComponentContext > & xContext )
|
|
|
|
{
|
|
|
|
uno::Reference< sheet::XDataPilotTable > xTable( aSource, uno::UNO_QUERY_THROW );
|
|
|
|
return uno::makeAny( uno::Reference< excel::XPivotTable > ( new ScVbaPivotTable( xContext, xTable ) ) );
|
|
|
|
}
|
|
|
|
|
|
|
|
class PivotTableEnumeration : public EnumerationHelperImpl
|
|
|
|
{
|
|
|
|
public:
|
2010-07-01 16:23:26 +02:00
|
|
|
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 ) {}
|
2007-04-25 15:10:18 +00:00
|
|
|
|
|
|
|
virtual uno::Any SAL_CALL nextElement( ) throw (container::NoSuchElementException, lang::WrappedTargetException, uno::RuntimeException)
|
|
|
|
{
|
|
|
|
return DataPilotToPivotTable( m_xEnumeration->nextElement(), m_xContext );
|
|
|
|
}
|
|
|
|
|
|
|
|
};
|
|
|
|
|
2009-02-13 13:03:24 +00:00
|
|
|
ScVbaPivotTables::ScVbaPivotTables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ): ScVbaPivotTables_BASE( xParent, xContext, xIndexAccess )
|
2007-04-25 15:10:18 +00:00
|
|
|
{
|
|
|
|
}
|
|
|
|
|
|
|
|
uno::Reference< container::XEnumeration >
|
|
|
|
ScVbaPivotTables::createEnumeration() throw (uno::RuntimeException)
|
|
|
|
{
|
|
|
|
uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
|
2010-07-01 16:23:26 +02:00
|
|
|
return new PivotTableEnumeration( mxParent, mxContext, xEnumAccess->createEnumeration() );
|
2007-04-25 15:10:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uno::Any
|
|
|
|
ScVbaPivotTables::createCollectionObject( const css::uno::Any& aSource )
|
|
|
|
{
|
2007-12-07 09:59:39 +00:00
|
|
|
return DataPilotToPivotTable( aSource, mxContext );
|
2007-04-25 15:10:18 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
uno::Type
|
|
|
|
ScVbaPivotTables::getElementType() throw (uno::RuntimeException)
|
|
|
|
{
|
2007-12-07 09:59:39 +00:00
|
|
|
return excel::XPivotTable::static_type(0);
|
|
|
|
}
|
|
|
|
|
2012-03-24 14:00:06 +00:00
|
|
|
rtl::OUString
|
2007-12-07 09:59:39 +00:00
|
|
|
ScVbaPivotTables::getServiceImplName()
|
|
|
|
{
|
2012-03-24 14:00:06 +00:00
|
|
|
return rtl::OUString(RTL_CONSTASCII_USTRINGPARAM("ScVbaPivotTables"));
|
2007-12-07 09:59:39 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
css::uno::Sequence<rtl::OUString>
|
|
|
|
ScVbaPivotTables::getServiceNames()
|
|
|
|
{
|
|
|
|
static uno::Sequence< rtl::OUString > sNames;
|
|
|
|
if ( sNames.getLength() == 0 )
|
|
|
|
{
|
|
|
|
sNames.realloc( 1 );
|
2009-02-13 13:03:24 +00:00
|
|
|
sNames[0] = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM("ooo.vba.excel.PivotTables") );
|
2007-12-07 09:59:39 +00:00
|
|
|
}
|
|
|
|
return sNames;
|
2007-04-25 15:10:18 +00:00
|
|
|
}
|
2010-10-12 15:59:00 +02:00
|
|
|
|
|
|
|
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|