| 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 "ReferenceSizePropertyProvider.hxx" |
| 23 |
#include <cppuhelper/implbase.hxx> |
| 24 |
#include <comphelper/interfacecontainer4.hxx> |
| 25 |
#include <com/sun/star/chart/XAxis.hpp> |
| 26 |
#include <com/sun/star/drawing/XShape.hpp> |
| 27 |
#include <com/sun/star/lang/XComponent.hpp> |
| 28 |
#include <com/sun/star/lang/XServiceInfo.hpp> |
| 29 |
#include <com/sun/star/util/XNumberFormatsSupplier.hpp> |
| 30 |
#include <rtl/ref.hxx> |
| 31 |
#include <memory> |
| 32 |
|
| 33 |
namespace com::sun::star::chart2 { class XAxis; } |
| 34 |
|
| 35 |
namespace chart::wrapper |
| 36 |
{ |
| 37 |
class Chart2ModelContact; |
| 38 |
class TitleWrapper; |
| 39 |
class GridWrapper; |
| 40 |
|
| 41 |
class AxisWrapper : public ::cppu::ImplInheritanceHelper< |
| 42 |
WrappedPropertySet |
| 43 |
, css::chart::XAxis |
| 44 |
, css::drawing::XShape |
| 45 |
, css::lang::XComponent |
| 46 |
, css::lang::XServiceInfo |
| 47 |
, css::util::XNumberFormatsSupplier |
| 48 |
> |
| 49 |
, public ReferenceSizePropertyProvider |
| 50 |
{ |
| 51 |
public: |
| 52 |
enum tAxisType |
| 53 |
{ |
| 54 |
X_AXIS, |
| 55 |
Y_AXIS, |
| 56 |
Z_AXIS, |
| 57 |
SECOND_X_AXIS, |
| 58 |
SECOND_Y_AXIS |
| 59 |
}; |
| 60 |
|
| 61 |
AxisWrapper(tAxisType eType, std::shared_ptr<Chart2ModelContact> spChart2ModelContact); |
| 62 |
virtual ~AxisWrapper() override; |
| 63 |
|
| 64 |
static void getDimensionAndMainAxisBool( tAxisType eType, sal_Int32& rnDimensionIndex, bool& rbMainAxis ); |
| 65 |
|
| 66 |
/// XServiceInfo declarations |
| 67 |
virtual OUString SAL_CALL getImplementationName() override; |
| 68 |
virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; |
| 69 |
virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; |
| 70 |
|
| 71 |
//ReferenceSizePropertyProvider |
| 72 |
virtual void updateReferenceSize() override; |
| 73 |
virtual css::uno::Any getReferenceSize() override; |
| 74 |
virtual css::awt::Size getCurrentSizeForReference() override; |
| 75 |
|
| 76 |
// ____ XComponent ____ |
| 77 |
virtual void SAL_CALL dispose() override; |
| 78 |
virtual void SAL_CALL addEventListener( const css::uno::Reference< |
| 79 |
css::lang::XEventListener >& xListener ) override; |
| 80 |
virtual void SAL_CALL removeEventListener( const css::uno::Reference< |
| 81 |
css::lang::XEventListener >& aListener ) override; |
| 82 |
|
| 83 |
// ____ chart::XAxis ____ |
| 84 |
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getAxisTitle( ) override; |
| 85 |
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getMajorGrid( ) override; |
| 86 |
virtual css::uno::Reference< css::beans::XPropertySet > SAL_CALL getMinorGrid( ) override; |
| 87 |
|
| 88 |
// ____ XShape ____ |
| 89 |
virtual css::awt::Point SAL_CALL getPosition() override; |
| 90 |
virtual void SAL_CALL setPosition( const css::awt::Point& aPosition ) override; |
| 91 |
virtual css::awt::Size SAL_CALL getSize() override; |
| 92 |
virtual void SAL_CALL setSize( const css::awt::Size& aSize ) override; |
| 93 |
|
| 94 |
// ____ XShapeDescriptor (base of XShape) ____ |
| 95 |
virtual OUString SAL_CALL getShapeType() override; |
| 96 |
|
| 97 |
// ____ XNumberFormatsSupplier ____ |
| 98 |
virtual css::uno::Reference< |
| 99 |
css::beans::XPropertySet > SAL_CALL getNumberFormatSettings() override; |
| 100 |
virtual css::uno::Reference< |
| 101 |
css::util::XNumberFormats > SAL_CALL getNumberFormats() override; |
| 102 |
|
| 103 |
protected: |
| 104 |
// ____ WrappedPropertySet ____ |
| 105 |
virtual const css::uno::Sequence< css::beans::Property >& getPropertySequence() override; |
| 106 |
virtual std::vector< std::unique_ptr<WrappedProperty> > createWrappedProperties() override; |
| 107 |
virtual css::uno::Reference< css::beans::XPropertySet > getInnerPropertySet() override; |
| 108 |
|
| 109 |
private: //methods |
| 110 |
css::uno::Reference< css::chart2::XAxis > getAxis(); |
| 111 |
|
| 112 |
private: //member |
| 113 |
std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; |
| 114 |
::comphelper::OInterfaceContainerHelper4<css::lang::XEventListener> m_aEventListenerContainer; |
| 115 |
|
| 116 |
tAxisType m_eType; |
| 117 |
|
| 118 |
rtl::Reference< TitleWrapper > m_xAxisTitle; |
| 119 |
rtl::Reference< GridWrapper > m_xMajorGrid; |
| 120 |
rtl::Reference< GridWrapper > m_xMinorGrid; |
| 121 |
}; |
| 122 |
|
| 123 |
} // namespace chart::wrapper |
| 124 |
|
| 125 |
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |