android: Update app-specific/MIME type icons
[LibreOffice.git] / sw / source / core / bastyp / proofreadingiterator.cxx
blob64c0ac2b1d0976c28f6f306097ccf8459d18f1df
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/.
8 */
10 #include <sal/config.h>
12 #include <com/sun/star/lang/XComponent.hpp>
13 #include <com/sun/star/linguistic2/ProofreadingIterator.hpp>
14 #include <com/sun/star/linguistic2/XProofreadingIterator.hpp>
15 #include <com/sun/star/uno/Reference.hxx>
16 #include <com/sun/star/uno/XComponentContext.hpp>
17 #include <vcl/svapp.hxx>
19 #include <proofreadingiterator.hxx>
21 namespace
23 css::uno::Reference<css::linguistic2::XProofreadingIterator> instance;
24 bool disposed = false;
26 void doDispose(css::uno::Reference<css::linguistic2::XProofreadingIterator> const& inst)
28 css::uno::Reference<css::lang::XComponent> comp(inst, css::uno::UNO_QUERY);
29 if (comp.is())
31 SolarMutexReleaser r;
32 comp->dispose();
37 css::uno::Reference<css::linguistic2::XProofreadingIterator>
38 sw::proofreadingiterator::get(css::uno::Reference<css::uno::XComponentContext> const& context)
40 css::uno::Reference<css::linguistic2::XProofreadingIterator> inst(
41 css::linguistic2::ProofreadingIterator::create(context));
42 bool disp;
44 SolarMutexGuard g;
45 instance = inst;
46 disp = disposed;
48 if (disp)
50 doDispose(inst);
52 return inst;
55 void sw::proofreadingiterator::dispose()
57 css::uno::Reference<css::linguistic2::XProofreadingIterator> inst;
59 SolarMutexGuard g;
60 inst = instance;
61 instance.clear();
62 disposed = true;
64 doDispose(inst);
67 /* vim:set shiftwidth=4 softtabstop=4 expandtab: */