calc: on editing invalidation of view with different zoom is wrong
[LibreOffice.git] / bridges / inc / cppinterfaceproxy.hxx
blob5b5c85dc7dd5357377c258ce31801625f8e02fda
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 <sal/config.h>
24 #include <atomic>
25 #include <cstddef>
27 #include <rtl/ustring.hxx>
28 #include <sal/types.h>
29 #include <typelib/typedescription.h>
30 #include <uno/dispatcher.h>
31 #include <uno/environment.h>
32 #include "vtablefactory.hxx"
34 namespace com::sun::star::uno { class XInterface; }
36 namespace bridges::cpp_uno::shared {
38 class Bridge;
40 extern "C" void freeCppInterfaceProxy(
41 uno_ExtEnvironment * pEnv, void * pInterface);
43 /**
44 * A cpp proxy wrapping a uno interface.
46 class CppInterfaceProxy {
47 public:
48 // Interface for Bridge:
50 static com::sun::star::uno::XInterface * create(
51 Bridge * pBridge, uno_Interface * pUnoI,
52 typelib_InterfaceTypeDescription * pTypeDescr,
53 OUString const & rOId);
55 // Interface for individual CPP--UNO bridges:
57 Bridge * getBridge() { return pBridge; }
58 uno_Interface * getUnoI() { return pUnoI; }
59 typelib_InterfaceTypeDescription * getTypeDescr() { return pTypeDescr; }
60 const OUString& getOid() const { return oid; }
62 // non virtual methods called on incoming vtable calls #1, #2
63 void acquireProxy();
64 void releaseProxy();
66 static CppInterfaceProxy * castInterfaceToProxy(void * pInterface);
68 private:
69 CppInterfaceProxy(CppInterfaceProxy const &) = delete;
70 CppInterfaceProxy& operator =(const CppInterfaceProxy&) = delete;
72 CppInterfaceProxy(
73 Bridge * pBridge_, uno_Interface * pUnoI_,
74 typelib_InterfaceTypeDescription * pTypeDescr_,
75 OUString aOId_);
77 ~CppInterfaceProxy();
79 static com::sun::star::uno::XInterface * castProxyToInterface(
80 CppInterfaceProxy * pProxy);
82 std::atomic<std::size_t> nRef;
83 Bridge * pBridge;
85 // mapping information
86 uno_Interface * pUnoI; // wrapped interface
87 typelib_InterfaceTypeDescription * pTypeDescr;
88 OUString oid;
90 VtableFactory::Slot * vtables[1] = {};
92 friend void freeCppInterfaceProxy(
93 uno_ExtEnvironment * pEnv, void * pInterface);
98 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */