LibreOffice Module comphelper (master) 1
accessiblecontexthelper.hxx
Go to the documentation of this file.
1/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
2/*
3 * This file is part of the LibreOffice project.
4 *
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/.
8 *
9 * This file incorporates work covered by the following license notice:
10 *
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 .
18 */
19
20#ifndef INCLUDED_COMPHELPER_ACCESSIBLECONTEXTHELPER_HXX
21#define INCLUDED_COMPHELPER_ACCESSIBLECONTEXTHELPER_HXX
22
25
26
27namespace comphelper
28{
29
30
31 //= OContextEntryGuard
32
45 class OContextEntryGuard : public ::osl::ClearableMutexGuard
46 {
47 public:
58 };
59
60
62 : ::osl::ClearableMutexGuard( _pContext->GetMutex() )
63 {
64 _pContext->ensureAlive();
65 }
66
67
68 //= OExternalLockGuard
69
71 :public osl::Guard<SolarMutex>
72 ,public OContextEntryGuard
73 {
74 public:
76 };
77
78
80 :osl::Guard<SolarMutex>( SolarMutex::get() )
81 ,OContextEntryGuard( _pContext )
82 {
83 // Only lock the external mutex,
84 // release the ::osl::Mutex of the OCommonAccessibleComponent instance.
85 // If you call into another UNO object with locked ::osl::Mutex,
86 // this may lead to dead locks.
87 clear();
88 }
89
90
91} // namespace comphelper
92
93
94#endif // INCLUDED_COMPHELPER_ACCESSIBLECONTEXTHELPER_HXX
95
96
97/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
base class encapsulating common functionality for the helper classes implementing the XAccessibleComp...
void ensureAlive() const
checks for being alive. If the object is already disposed (i.e. not alive), an exception is thrown.
helper class for guarding the entry into OCommonAccessibleComponent methods.
OContextEntryGuard(OCommonAccessibleComponent *_pContext)
constructs the guard
OExternalLockGuard(OCommonAccessibleComponent *_pContext)
SolarMutex, needed for VCL's Application::GetSolarMutex().
Definition: solarmutex.hxx:46
css::uno::Reference< css::linguistic2::XProofreadingIterator > get(css::uno::Reference< css::uno::XComponentContext > const &context)