tdf#104816 sw: if non-section content, let all sections hide.
[LibreOffice.git] / bridges / inc / cppinterfaceproxy.hxx
blobf4966d5a2eaead2bb96f51a1f76e398fc45dc077
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 #ifndef INCLUDED_BRIDGES_INC_CPPINTERFACEPROXY_HXX
21 #define INCLUDED_BRIDGES_INC_CPPINTERFACEPROXY_HXX
23 #include <sal/config.h>
25 #include <atomic>
26 #include <cstddef>
28 #include <rtl/ustring.hxx>
29 #include <sal/types.h>
30 #include <typelib/typedescription.h>
31 #include <uno/dispatcher.h>
32 #include <uno/environment.h>
33 #include "vtablefactory.hxx"
35 namespace com { namespace sun { namespace star { namespace uno {
36 class XInterface;
37 } } } }
39 #if !defined __GNUG__
40 void dso_init();
41 void dso_exit();
42 #endif
44 namespace bridges { namespace cpp_uno { namespace shared {
46 class Bridge;
48 extern "C" void freeCppInterfaceProxy(
49 uno_ExtEnvironment * pEnv, void * pInterface);
51 /**
52 * A cpp proxy wrapping a uno interface.
54 class CppInterfaceProxy {
55 public:
56 // Interface for Bridge:
58 static com::sun::star::uno::XInterface * create(
59 Bridge * pBridge, uno_Interface * pUnoI,
60 typelib_InterfaceTypeDescription * pTypeDescr,
61 OUString const & rOId);
63 // Interface for individual CPP--UNO bridges:
65 Bridge * getBridge() { return pBridge; }
66 uno_Interface * getUnoI() { return pUnoI; }
67 typelib_InterfaceTypeDescription * getTypeDescr() { return pTypeDescr; }
68 const OUString& getOid() const { return oid; }
70 // non virtual methods called on incoming vtable calls #1, #2
71 void acquireProxy();
72 void releaseProxy();
74 static CppInterfaceProxy * castInterfaceToProxy(void * pInterface);
76 private:
77 CppInterfaceProxy(CppInterfaceProxy const &) = delete;
78 CppInterfaceProxy& operator =(const CppInterfaceProxy&) = delete;
80 CppInterfaceProxy(
81 Bridge * pBridge_, uno_Interface * pUnoI_,
82 typelib_InterfaceTypeDescription * pTypeDescr_,
83 OUString const & rOId_);
85 ~CppInterfaceProxy();
87 static com::sun::star::uno::XInterface * castProxyToInterface(
88 CppInterfaceProxy * pProxy);
90 std::atomic<std::size_t> nRef;
91 Bridge * pBridge;
93 // mapping information
94 uno_Interface * pUnoI; // wrapped interface
95 typelib_InterfaceTypeDescription * pTypeDescr;
96 OUString oid;
98 VtableFactory::Slot * vtables[1];
100 friend void freeCppInterfaceProxy(
101 uno_ExtEnvironment * pEnv, void * pInterface);
104 } } }
106 #endif
108 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */