Line data Source code
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 : #ifndef INCLUDED_VBAHELPER_VBARETURNTYPES_HXX
20 : #define INCLUDED_VBAHELPER_VBARETURNTYPES_HXX
21 :
22 : #include <cppuhelper/implbase1.hxx>
23 : #include <com/sun/star/script/XDefaultProperty.hpp>
24 : #include <ooo/vba/msforms/XReturnInteger.hpp>
25 : #include <ooo/vba/msforms/XReturnBoolean.hpp>
26 : #include <ooo/vba/msforms/XReturnSingle.hpp>
27 : #include <ooo/vba/msforms/XReturnEffect.hpp>
28 :
29 : #include <vbahelper/vbahelper.hxx>
30 : #include <vbahelper/vbahelperinterface.hxx>
31 :
32 : namespace ooo
33 : {
34 : namespace vba
35 : {
36 : template< typename T1, typename T2 >
37 1 : class DefaultReturnHelper : public ::cppu::WeakImplHelper2< T2, css::script::XDefaultProperty >
38 : {
39 : T1 mnValue;
40 : public:
41 1 : DefaultReturnHelper( const T1& nValue ) : mnValue( nValue ) {}
42 0 : virtual void SAL_CALL setValue( T1 nValue ) throw (::com::sun::star::uno::RuntimeException) { mnValue = nValue; }
43 1 : virtual T1 SAL_CALL getValue() throw (::com::sun::star::uno::RuntimeException) { return mnValue; }
44 1 : OUString SAL_CALL getDefaultPropertyName( ) throw (css::uno::RuntimeException) { return OUString("Value"); }
45 : };
46 :
47 : typedef DefaultReturnHelper< sal_Int32, ov::msforms::XReturnInteger > ReturnInteger_BASE;
48 2 : class ReturnInteger : public ReturnInteger_BASE
49 : {
50 : public:
51 1 : ReturnInteger( sal_Int32 nValue ) : ReturnInteger_BASE( nValue ){}
52 : };
53 :
54 : typedef DefaultReturnHelper< sal_Bool, ov::msforms::XReturnBoolean > ReturnBoolean_BASE;
55 : class ReturnBoolean : public ReturnBoolean_BASE
56 : {
57 : public:
58 : ReturnBoolean( bool nValue ) : ReturnBoolean_BASE( nValue ){}
59 : };
60 : typedef DefaultReturnHelper< float, ov::msforms::XReturnSingle > ReturnSingle_BASE;
61 : class ReturnSingle : public ReturnSingle_BASE
62 : {
63 : public:
64 : ReturnSingle( float nValue ) : ReturnSingle_BASE( nValue ){}
65 : };
66 : typedef DefaultReturnHelper< short, ov::msforms::XReturnEffect > ReturnEffect_BASE;
67 : class ReturnEffect : public ReturnEffect_BASE
68 : {
69 : public:
70 : ReturnEffect( short nValue ) : ReturnEffect_BASE( nValue ){}
71 : };
72 : } // vba
73 : } // ooo
74 :
75 : #endif
76 :
77 : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
|