/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ /* * This file is part of the LibreOffice project. * * This Source Code Form is subject to the terms of the Mozilla Public * License, v. 2.0. If a copy of the MPL was not distributed with this * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #ifndef INCLUDED_SC_INC_PIVOTTABLEDATAPROVIDER_HXX #define INCLUDED_SC_INC_PIVOTTABLEDATAPROVIDER_HXX #include #include #include #include #include #include #include #include #include #include #include #include namespace com::sun::star::chart2::data { class XDataSequence; } namespace com::sun::star::chart2::data { class XDataSource; } namespace com::sun::star::chart2::data { class XLabeledDataSequence; } namespace com::sun::star::uno { class XComponentContext; } class ScDocument; namespace sc { struct ValueAndFormat; typedef cppu::WeakImplHelper PivotTableDataProvider_Base; class PivotTableDataProvider final : public PivotTableDataProvider_Base, public SfxListener { public: explicit PivotTableDataProvider(ScDocument* pDoc); virtual ~PivotTableDataProvider() override; virtual void Notify(SfxBroadcaster& rBC, const SfxHint& rHint) override; // XDataProvider virtual sal_Bool SAL_CALL createDataSourcePossible(const css::uno::Sequence& aArguments) override; virtual css::uno::Reference SAL_CALL createDataSource(const css::uno::Sequence& aArguments) override; virtual css::uno::Sequence SAL_CALL detectArguments(const css::uno::Reference& xDataSource) override; virtual sal_Bool SAL_CALL createDataSequenceByRangeRepresentationPossible(const OUString& aRangeRepresentation) override; virtual css::uno::Reference SAL_CALL createDataSequenceByRangeRepresentation(const OUString& aRangeRepresentation) override; virtual css::uno::Reference SAL_CALL createDataSequenceByValueArray(const OUString& aRole, const OUString& aRangeRepresentation) override; virtual css::uno::Reference SAL_CALL getRangeSelection() override; // XPivotTableDataProvider virtual css::uno::Sequence SAL_CALL getColumnFields() override; virtual css::uno::Sequence SAL_CALL getRowFields() override; virtual css::uno::Sequence SAL_CALL getPageFields() override; virtual css::uno::Sequence SAL_CALL getDataFields() override; virtual OUString SAL_CALL getPivotTableName() override; virtual void SAL_CALL setPivotTableName(const OUString& sPivotTableName) override; virtual sal_Bool SAL_CALL hasPivotTable() override; virtual css::uno::Reference SAL_CALL createDataSequenceOfValuesByIndex(sal_Int32 nIndex) override; virtual css::uno::Reference SAL_CALL createDataSequenceOfLabelsByIndex(sal_Int32 nIndex) override; virtual css::uno::Reference SAL_CALL createDataSequenceOfCategories() override; virtual OUString SAL_CALL getFieldOutputDescription(sal_Int32 nPageFieldIndex) override; // XPropertySet virtual css::uno::Reference SAL_CALL getPropertySetInfo() override; virtual void SAL_CALL setPropertyValue(const OUString& rPropertyName, const css::uno::Any& rValue) override; virtual css::uno::Any SAL_CALL getPropertyValue(const OUString& rPropertyName) override; virtual void SAL_CALL addPropertyChangeListener( const OUString& rPropertyName, const css::uno::Reference& xListener) override; virtual void SAL_CALL removePropertyChangeListener( const OUString& rPropertyName, const css::uno::Reference& rListener) override; virtual void SAL_CALL addVetoableChangeListener( const OUString& rPropertyName, const css::uno::Reference& rListener) override; virtual void SAL_CALL removeVetoableChangeListener( const OUString& rPropertyName, const css::uno::Reference& rListener) override; // XModifyBroadcaster virtual void SAL_CALL addModifyListener(const css::uno::Reference& aListener) override; virtual void SAL_CALL removeModifyListener(const css::uno::Reference& aListener) override; // XServiceInfo virtual OUString SAL_CALL getImplementationName() override; virtual sal_Bool SAL_CALL supportsService(const OUString& rServiceName) override; virtual css::uno::Sequence SAL_CALL getSupportedServiceNames() override; private: css::uno::Reference createValuesDataSource(); css::uno::Reference createCategoriesDataSource(bool bOrientationIsColumn); css::uno::Reference newLabeledDataSequence(); css::uno::Reference assignLabelsToDataSequence(size_t nIndex); css::uno::Reference assignValuesToDataSequence(size_t nIndex); css::uno::Reference assignFirstCategoriesToDataSequence(); void collectPivotTableData(); ScDocument* m_pDocument; OUString m_sPivotTableName; SfxItemPropertySet m_aPropSet; bool m_bIncludeHiddenCells; std::vector> m_aCategoriesColumnOrientation; std::vector> m_aCategoriesRowOrientation; std::vector> m_aLabels; std::vector> m_aDataRowVector; std::vector m_aColumnFields; std::vector m_aRowFields; std::vector m_aPageFields; std::vector m_aDataFields; std::unordered_map m_aFieldOutputDescriptionMap; bool m_bNeedsUpdate; css::uno::Reference m_xContext; std::vector> m_aValueListeners; }; } #endif // INCLUDED_SC_INC_PIVOTTABLEDATAPROVIDER_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */