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 <com/sun/star/chart2/XScaling.hpp> 22 #include <com/sun/star/lang/XServiceInfo.hpp> 23 #include <com/sun/star/lang/XServiceName.hpp> 24 #include <cppuhelper/implbase.hxx> 25 #include <tools/date.hxx> 26 27 namespace chart 28 { 29 30 class DateScaling : 31 public ::cppu::WeakImplHelper< 32 css::chart2::XScaling, 33 css::lang::XServiceName, 34 css::lang::XServiceInfo 35 > 36 { 37 public: 38 DateScaling( const Date& rNullDate, sal_Int32 nTimeUnit, bool bShifted ); 39 virtual ~DateScaling() override; 40 41 /// declare XServiceInfo methods 42 virtual OUString SAL_CALL getImplementationName() override; 43 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; 44 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; 45 46 // ____ XScaling ____ 47 virtual double SAL_CALL doScaling( double value ) override; 48 49 virtual css::uno::Reference< 50 css::chart2::XScaling > SAL_CALL 51 getInverseScaling() override; 52 53 // ____ XServiceName ____ 54 virtual OUString SAL_CALL getServiceName() override; 55 56 private: 57 const Date m_aNullDate; 58 const sal_Int32 m_nTimeUnit; 59 const bool m_bShifted; 60 }; 61 62 class InverseDateScaling : 63 public ::cppu::WeakImplHelper< 64 css::chart2::XScaling, 65 css::lang::XServiceName, 66 css::lang::XServiceInfo 67 > 68 { 69 public: 70 InverseDateScaling( const Date& rNullDate, sal_Int32 nTimeUnit, bool bShifted ); 71 virtual ~InverseDateScaling() override; 72 73 /// declare XServiceInfo methods 74 virtual OUString SAL_CALL getImplementationName() override; 75 virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; 76 virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; 77 78 // ____ XScaling ____ 79 virtual double SAL_CALL doScaling( double value ) override; 80 81 virtual css::uno::Reference< css::chart2::XScaling > SAL_CALL 82 getInverseScaling() override; 83 84 // ____ XServiceName ____ 85 virtual OUString SAL_CALL getServiceName() override; 86 87 private: 88 const Date m_aNullDate; 89 const sal_Int32 m_nTimeUnit; 90 const bool m_bShifted; 91 }; 92 93 } //namespace chart 94 95 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ 96