| 1 |
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ |
| 2 |
/* |
| 3 |
* This file is part of the LibreOffice project. |
| 4 |
* |
| 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/. |
| 8 |
* |
| 9 |
* This file incorporates work covered by the following license notice: |
| 10 |
* |
| 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 . |
| 18 |
*/ |
| 19 |
#pragma once |
| 20 |
|
| 21 |
#include <WrappedPropertySet.hxx> |
| 22 |
#include <com/sun/star/chart/XChartDocument.hpp> |
| 23 |
#include <com/sun/star/drawing/XDrawPageSupplier.hpp> |
| 24 |
#include <com/sun/star/lang/XMultiServiceFactory.hpp> |
| 25 |
#include <com/sun/star/uno/XAggregation.hpp> |
| 26 |
#include <com/sun/star/lang/XServiceInfo.hpp> |
| 27 |
#include <cppuhelper/implbase.hxx> |
| 28 |
#include <unotools/eventlisteneradapter.hxx> |
| 29 |
#include <rtl/ref.hxx> |
| 30 |
#include <svx/unopage.hxx> |
| 31 |
#include <memory> |
| 32 |
|
| 33 |
namespace com::sun::star::uno { class XComponentContext; } |
| 34 |
namespace com::sun::star::util { class XRefreshable; } |
| 35 |
namespace chart { class ChartView; } |
| 36 |
|
| 37 |
namespace chart::wrapper |
| 38 |
{ |
| 39 |
class DiagramWrapper; |
| 40 |
class LegendWrapper; |
| 41 |
class TitleWrapper; |
| 42 |
class Chart2ModelContact; |
| 43 |
|
| 44 |
class ChartDocumentWrapper_Base : public ::cppu::ImplInheritanceHelper |
| 45 |
< WrappedPropertySet |
| 46 |
, css::chart::XChartDocument |
| 47 |
, css::drawing::XDrawPageSupplier |
| 48 |
, css::lang::XMultiServiceFactory |
| 49 |
, css::lang::XServiceInfo |
| 50 |
, css::uno::XAggregation |
| 51 |
> |
| 52 |
{ |
| 53 |
}; |
| 54 |
|
| 55 |
class ChartDocumentWrapper final : public ChartDocumentWrapper_Base |
| 56 |
, public ::utl::OEventListenerAdapter |
| 57 |
{ |
| 58 |
public: |
| 59 |
explicit ChartDocumentWrapper( const css::uno::Reference< css::uno::XComponentContext > & xContext ); |
| 60 |
virtual ~ChartDocumentWrapper() override; |
| 61 |
|
| 62 |
/// XServiceInfo declarations |
| 63 |
virtual OUString SAL_CALL getImplementationName() override; |
| 64 |
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; |
| 65 |
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
| 66 |
|
| 67 |
void setAddIn( const css::uno::Reference< css::util::XRefreshable >& xAddIn ); |
| 68 |
const css::uno::Reference< css::util::XRefreshable >& getAddIn() const { return m_xAddIn;} |
| 69 |
|
| 70 |
void setUpdateAddIn( bool bUpdateAddIn ); |
| 71 |
bool getUpdateAddIn() const { return m_bUpdateAddIn;} |
| 72 |
|
| 73 |
void setBaseDiagram( const OUString& rBaseDiagram ); |
| 74 |
const OUString& getBaseDiagram() const { return m_aBaseDiagram;} |
| 75 |
|
| 76 |
css::uno::Reference< css::drawing::XShapes > getAdditionalShapes() const; |
| 77 |
|
| 78 |
/// @throws css::uno::RuntimeException |
| 79 |
rtl::Reference<SvxDrawPage> impl_getDrawPage() const; |
| 80 |
|
| 81 |
// ____ chart::XChartDocument ____ |
| 82 |
virtual css::uno::Reference< css::drawing::XShape > SAL_CALL getTitle() override; |
| 83 |
virtual css::uno::Reference< css::drawing::XShape > SAL_CALL getSubTitle() override; |
| 84 |
virtual css::uno::Reference< css::drawing::XShape > SAL_CALL getLegend() override; |
| 85 |
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getArea() override; |
| 86 |
virtual css::uno::Reference< css::chart::XDiagram > SAL_CALL getDiagram() override; |
| 87 |
virtual void SAL_CALL setDiagram( const css::uno::Reference< |
| 88 |
css::chart::XDiagram >& xDiagram ) override; |
| 89 |
virtual css::uno::Reference< css::chart::XChartData > SAL_CALL getData() override; |
| 90 |
virtual void SAL_CALL attachData( const css::uno::Reference< |
| 91 |
css::chart::XChartData >& xData ) override; |
| 92 |
|
| 93 |
// ____ XModel ____ |
| 94 |
virtual sal_Bool SAL_CALL attachResource( const OUString& URL, |
| 95 |
const css::uno::Sequence< css::beans::PropertyValue >& Arguments ) override; |
| 96 |
virtual OUString SAL_CALL getURL() override; |
| 97 |
virtual css::uno::Sequence< |
| 98 |
css::beans::PropertyValue > SAL_CALL getArgs() override; |
| 99 |
virtual void SAL_CALL connectController( const css::uno::Reference< |
| 100 |
css::frame::XController >& Controller ) override; |
| 101 |
virtual void SAL_CALL disconnectController( const css::uno::Reference< |
| 102 |
css::frame::XController >& Controller ) override; |
| 103 |
virtual void SAL_CALL lockControllers() override; |
| 104 |
virtual void SAL_CALL unlockControllers() override; |
| 105 |
virtual sal_Bool SAL_CALL hasControllersLocked() override; |
| 106 |
virtual css::uno::Reference< |
| 107 |
css::frame::XController > SAL_CALL getCurrentController() override; |
| 108 |
virtual void SAL_CALL setCurrentController( const css::uno::Reference< css::frame::XController >& Controller ) override; |
| 109 |
virtual css::uno::Reference<css::uno::XInterface > SAL_CALL getCurrentSelection() override; |
| 110 |
|
| 111 |
// ____ XComponent ____ |
| 112 |
virtual void SAL_CALL dispose() override; |
| 113 |
virtual void SAL_CALL addEventListener( const css::uno::Reference< css::lang::XEventListener >& xListener ) override; |
| 114 |
virtual void SAL_CALL removeEventListener( const css::uno::Reference< css::lang::XEventListener >& aListener ) override; |
| 115 |
|
| 116 |
// ____ XInterface (for new interfaces) ____ |
| 117 |
virtual css::uno::Any SAL_CALL queryInterface( const css::uno::Type& aType ) override; |
| 118 |
|
| 119 |
// ____ ::utl::OEventListenerAdapter ____ |
| 120 |
virtual void _disposing( const css::lang::EventObject& rSource ) override; |
| 121 |
|
| 122 |
// ____ XDrawPageSupplier ____ |
| 123 |
virtual css::uno::Reference< css::drawing::XDrawPage > SAL_CALL getDrawPage() override; |
| 124 |
|
| 125 |
// ____ XMultiServiceFactory ____ |
| 126 |
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstance( const OUString& aServiceSpecifier ) override; |
| 127 |
virtual css::uno::Reference< css::uno::XInterface > SAL_CALL createInstanceWithArguments( |
| 128 |
const OUString& ServiceSpecifier, |
| 129 |
const css::uno::Sequence< css::uno::Any >& Arguments ) override; |
| 130 |
virtual css::uno::Sequence< OUString > SAL_CALL getAvailableServiceNames() override; |
| 131 |
|
| 132 |
// ____ XAggregation ____ |
| 133 |
virtual void SAL_CALL setDelegator( |
| 134 |
const css::uno::Reference< css::uno::XInterface >& rDelegator ) override; |
| 135 |
virtual css::uno::Any SAL_CALL queryAggregation( const css::uno::Type& aType ) override; |
| 136 |
|
| 137 |
// ____ WrappedPropertySet ____ |
| 138 |
virtual const css::uno::Sequence< css::beans::Property >& getPropertySequence() override; |
| 139 |
virtual std::vector< std::unique_ptr<WrappedProperty> > createWrappedProperties() override; |
| 140 |
virtual css::uno::Reference< css::beans::XPropertySet > getInnerPropertySet() override; |
| 141 |
|
| 142 |
// ____ XPropertySet ____ |
| 143 |
virtual void SAL_CALL setPropertyValue(const OUString& rPropertyName, |
| 144 |
const css::uno::Any& rValue) override; |
| 145 |
|
| 146 |
private: //methods |
| 147 |
void impl_resetAddIn(); |
| 148 |
|
| 149 |
private: //member |
| 150 |
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; |
| 151 |
|
| 152 |
css::uno::Reference< css::uno::XInterface > m_xDelegator; |
| 153 |
|
| 154 |
rtl::Reference< TitleWrapper > m_xTitle; |
| 155 |
rtl::Reference< TitleWrapper > m_xSubTitle; |
| 156 |
rtl::Reference< LegendWrapper > m_xLegend; |
| 157 |
css::uno::Reference< css::chart::XChartData > m_xChartData; |
| 158 |
rtl::Reference< DiagramWrapper > m_xDiagram; |
| 159 |
css::uno::Reference< css::beans::XPropertySet > m_xArea; |
| 160 |
|
| 161 |
css::uno::Reference< css::util::XRefreshable > m_xAddIn; |
| 162 |
OUString m_aBaseDiagram; |
| 163 |
bool m_bUpdateAddIn; |
| 164 |
|
| 165 |
rtl::Reference< ChartView > m_xChartView; |
| 166 |
css::uno::Reference< css::lang::XMultiServiceFactory> |
| 167 |
m_xShapeFactory; |
| 168 |
|
| 169 |
bool m_bIsDisposed; |
| 170 |
}; |
| 171 |
|
| 172 |
} // namespace chart::wrapper |
| 173 |
|
| 174 |
// CHART_CHARTDOCUMENT_HXX |
| 175 |
|
| 176 |
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |