Avoid potential negative array index access to cached text.
[LibreOffice.git] / scripting / source / basprov / basmethnode.hxx
blobd1b08d837a90893226898a5d1fe8eb16c5719ea8
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/beans/XPropertySetInfo.hpp>
24 #include <com/sun/star/script/XInvocation.hpp>
25 #include <com/sun/star/script/browse/XBrowseNode.hpp>
26 #include <com/sun/star/uno/XComponentContext.hpp>
27 #include <comphelper/proparrhlp.hxx>
28 #include <comphelper/propertycontainer.hxx>
29 #include <comphelper/uno3.hxx>
30 #include <cppuhelper/basemutex.hxx>
31 #include <cppuhelper/implbase.hxx>
34 class SbMethod;
37 namespace basprov
43 typedef ::cppu::WeakImplHelper<
44 css::script::browse::XBrowseNode,
45 css::script::XInvocation > BasicMethodNodeImpl_BASE;
47 class BasicMethodNodeImpl : public BasicMethodNodeImpl_BASE,
48 public cppu::BaseMutex,
49 public ::scripting_helper::OBroadcastHelperHolder,
50 public ::comphelper::OPropertyContainer,
51 public ::comphelper::OPropertyArrayUsageHelper< BasicMethodNodeImpl >
53 private:
54 css::uno::Reference< css::uno::XComponentContext > m_xContext;
55 OUString m_sScriptingContext;
56 SbMethod* m_pMethod;
57 bool m_bIsAppScript;
59 // properties
60 OUString m_sURI;
61 bool m_bEditable;
63 protected:
64 // OPropertySetHelper
65 virtual ::cppu::IPropertyArrayHelper& SAL_CALL getInfoHelper( ) override;
67 // OPropertyArrayUsageHelper
68 virtual ::cppu::IPropertyArrayHelper* createArrayHelper( ) const override;
70 public:
71 BasicMethodNodeImpl( const css::uno::Reference< css::uno::XComponentContext >& rxContext,
72 OUString sScriptingContext,
73 SbMethod* pMethod, bool isAppScript );
74 virtual ~BasicMethodNodeImpl() override;
76 // XInterface
77 DECLARE_XINTERFACE()
79 // XTypeProvider
80 DECLARE_XTYPEPROVIDER()
82 // XBrowseNode
83 virtual OUString SAL_CALL getName( ) override;
84 virtual css::uno::Sequence< css::uno::Reference< css::script::browse::XBrowseNode > > SAL_CALL getChildNodes( ) override;
85 virtual sal_Bool SAL_CALL hasChildNodes( ) override;
86 virtual sal_Int16 SAL_CALL getType( ) override;
88 // XPropertySet
89 virtual css::uno::Reference< css::beans::XPropertySetInfo > SAL_CALL getPropertySetInfo( ) override;
91 // XInvocation
92 virtual css::uno::Reference< css::beans::XIntrospectionAccess > SAL_CALL getIntrospection( ) override;
93 virtual css::uno::Any SAL_CALL invoke(
94 const OUString& aFunctionName,
95 const css::uno::Sequence< css::uno::Any >& aParams,
96 css::uno::Sequence< sal_Int16 >& aOutParamIndex,
97 css::uno::Sequence< css::uno::Any >& aOutParam ) override;
98 virtual void SAL_CALL setValue( const OUString& aPropertyName, const css::uno::Any& aValue ) override;
99 virtual css::uno::Any SAL_CALL getValue( const OUString& aPropertyName ) override;
100 virtual sal_Bool SAL_CALL hasMethod( const OUString& aName ) override;
101 virtual sal_Bool SAL_CALL hasProperty( const OUString& aName ) override;
105 } // namespace basprov
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */