Avoid potential negative array index access to cached text.
[LibreOffice.git] / scripting / source / basprov / basscript.hxx
blobe7a94d706ee7ffceffa132cdaa622179eb041514
1 /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2 /*
3 * This file is part of the LibreOffice project.
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/.
9 * This file incorporates work covered by the following license notice:
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 .
20 #pragma once
22 #include <bcholder.hxx>
23 #include <com/sun/star/script/provider/XScript.hpp>
24 #include <com/sun/star/document/XScriptInvocationContext.hpp>
25 #include <cppuhelper/basemutex.hxx>
26 #include <cppuhelper/implbase.hxx>
27 #include <comphelper/proparrhlp.hxx>
28 #include <comphelper/propertycontainer.hxx>
29 #include <basic/sbmeth.hxx>
30 #include <svl/lstner.hxx>
32 class BasicManager;
35 namespace basprov
41 typedef ::cppu::WeakImplHelper<
42 css::script::provider::XScript > BasicScriptImpl_BASE;
45 class BasicScriptImpl : public BasicScriptImpl_BASE, public SfxListener,
46 public cppu::BaseMutex,
47 public ::scripting_helper::OBroadcastHelperHolder,
48 public ::comphelper::OPropertyContainer,
49 public ::comphelper::OPropertyArrayUsageHelper< BasicScriptImpl >
51 private:
52 SbMethodRef m_xMethod;
53 OUString m_funcName;
54 BasicManager* m_documentBasicManager;
55 css::uno::Reference< css::document::XScriptInvocationContext >
56 m_xDocumentScriptContext;
57 // hack, OPropertyContainer doesn't allow you to define a property of unknown
58 // type ( I guess because an Any can't contain an Any... I've always wondered why?
59 // as it's not unusual to do that in corba )
60 css::uno::Sequence< css::uno::Any > m_caller;
61 protected:
62 // OPropertySetHelper
63 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper( ) override;
65 // OPropertyArrayUsageHelper
66 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
68 public:
69 BasicScriptImpl(
70 OUString funcName,
71 SbMethodRef xMethod
73 BasicScriptImpl(
74 OUString funcName,
75 SbMethodRef xMethod,
76 BasicManager& documentBasicManager,
77 const css::uno::Reference< css::document::XScriptInvocationContext >& documentScriptContext
79 virtual ~BasicScriptImpl() override;
81 // XInterface
82 DECLARE_XINTERFACE()
84 // XTypeProvider
85 DECLARE_XTYPEPROVIDER()
87 // XScript
88 virtual css::uno::Any SAL_CALL invoke(
89 const css::uno::Sequence< css::uno::Any >& aParams,
90 css::uno::Sequence< sal_Int16 >& aOutParamIndex,
91 css::uno::Sequence< css::uno::Any >& aOutParam ) override;
92 // XPropertySet
93 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
95 // SfxListener
96 virtual void Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) override;
100 } // namespace basprov
103 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */