Avoid potential negative array index access to cached text.
[LibreOffice.git] / embedserv / source / inc / servprov.hxx
blobf2b30fb6ccaa2ff072255c9081083a8a03df48c3
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 "common.h"
23 #include <oleidl.h>
24 #include <com/sun/star/uno/Reference.h>
25 #include <com/sun/star/uno/Sequence.h>
26 #include <com/sun/star/uno/XInterface.hpp>
27 #include <com/sun/star/lang/XServiceInfo.hpp>
28 #include <cppuhelper/implbase.hxx>
31 class EmbedProviderFactory_Impl;
33 class EmbedServer_Impl: public cppu::WeakImplHelper<css::lang::XServiceInfo>
35 public:
36 EmbedServer_Impl( const css::uno::Reference< css::lang::XMultiServiceFactory > &xFactory );
37 virtual ~EmbedServer_Impl() override;
39 OUString SAL_CALL getImplementationName() override;
41 sal_Bool SAL_CALL supportsService(OUString const & ServiceName) override;
43 css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override;
45 protected:
47 CComPtr< EmbedProviderFactory_Impl > m_pOLEFactories[ SUPPORTED_FACTORIES_NUM ];
48 css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
51 class EmbedProviderFactory_Impl : public IClassFactory
53 public:
55 EmbedProviderFactory_Impl( const css::uno::Reference< css::lang::XMultiServiceFactory >& xFactory, const GUID* pGuid);
56 virtual ~EmbedProviderFactory_Impl();
58 bool registerClass();
59 bool deregisterClass();
61 /* IUnknown methods */
62 STDMETHOD(QueryInterface)(REFIID riid, LPVOID* ppvObj) override;
63 STDMETHOD_(ULONG, AddRef)() override;
64 STDMETHOD_(ULONG, Release)() override;
66 /* IClassFactory methods */
67 STDMETHOD(CreateInstance)(IUnknown* punkOuter, REFIID riid, void** ppv) override;
68 STDMETHOD(LockServer)(int fLock) override;
70 protected:
72 oslInterlockedCount m_refCount;
73 GUID m_guid;
74 DWORD m_factoryHandle;
76 css::uno::Reference< css::lang::XMultiServiceFactory > m_xFactory;
79 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */