tdf#130857 qt weld: Implement QtInstanceWidget::strip_mnemonic
[LibreOffice.git] / sc / source / ui / vba / vbapivottables.cxx
blobc62ac5f990b075dbf93bcb65119270663743d109
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
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 "vbapivottables.hxx"
20 #include "vbapivottable.hxx"
21 #include <com/sun/star/sheet/XDataPilotTable.hpp>
22 #include <ooo/vba/excel/XPivotTable.hpp>
24 using namespace ::com::sun::star;
25 using namespace ::ooo::vba;
27 static uno::Any DataPilotToPivotTable( const uno::Any& aSource, const uno::Reference< uno::XComponentContext > & xContext )
29 uno::Reference< sheet::XDataPilotTable > xTable( aSource, uno::UNO_QUERY_THROW );
30 return uno::Any( uno::Reference< excel::XPivotTable > ( new ScVbaPivotTable( xContext, xTable ) ) );
33 namespace {
35 class PivotTableEnumeration : public EnumerationHelperImpl
37 public:
38 /// @throws uno::RuntimeException
39 PivotTableEnumeration( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XEnumeration >& xEnumeration ) : EnumerationHelperImpl( xParent, xContext, xEnumeration ) {}
41 virtual uno::Any SAL_CALL nextElement( ) override
43 return DataPilotToPivotTable( m_xEnumeration->nextElement(), m_xContext );
50 ScVbaPivotTables::ScVbaPivotTables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ): ScVbaPivotTables_BASE( xParent, xContext, xIndexAccess )
54 uno::Reference< container::XEnumeration >
55 ScVbaPivotTables::createEnumeration()
57 uno::Reference< container::XEnumerationAccess > xEnumAccess( m_xIndexAccess, uno::UNO_QUERY_THROW );
58 return new PivotTableEnumeration( mxParent, mxContext, xEnumAccess->createEnumeration() );
61 uno::Any
62 ScVbaPivotTables::createCollectionObject( const css::uno::Any& aSource )
64 return DataPilotToPivotTable( aSource, mxContext );
67 uno::Type
68 ScVbaPivotTables::getElementType()
70 return cppu::UnoType<excel::XPivotTable>::get();
73 OUString
74 ScVbaPivotTables::getServiceImplName()
76 return u"ScVbaPivotTables"_ustr;
79 css::uno::Sequence<OUString>
80 ScVbaPivotTables::getServiceNames()
82 static uno::Sequence< OUString > const sNames
84 u"ooo.vba.excel.PivotTables"_ustr
86 return sNames;
89 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */