LCOV - code coverage report
Current view: top level - sw/source/core/bastyp - proofreadingiterator.cxx (source / functions) Hit Total Coverage
Test: commit c8344322a7af75b84dd3ca8f78b05543a976dfd5 Lines: 14 24 58.3 %
Date: 2015-06-13 12:38:46 Functions: 4 5 80.0 %
Legend: Lines: hit not hit

          Line data    Source code
       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             : 
      10             : #include <sal/config.h>
      11             : 
      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 <sal/types.h>
      18             : #include <vcl/svapp.hxx>
      19             : 
      20             : #include <proofreadingiterator.hxx>
      21             : 
      22             : namespace {
      23             : 
      24          59 : css::uno::Reference<css::linguistic2::XProofreadingIterator> instance;
      25             : bool disposed = false;
      26             : 
      27          59 : void doDispose(
      28             :     css::uno::Reference<css::linguistic2::XProofreadingIterator> const &
      29             :         inst)
      30             : {
      31          59 :     css::uno::Reference<css::lang::XComponent> comp(inst, css::uno::UNO_QUERY);
      32          59 :     if (comp.is()) {
      33           0 :         SolarMutexReleaser r;
      34           0 :         comp->dispose();
      35          59 :     }
      36          59 : }
      37             : 
      38             : }
      39             : 
      40             : css::uno::Reference<css::linguistic2::XProofreadingIterator>
      41           0 : sw::proofreadingiterator::get(
      42             :     css::uno::Reference<css::uno::XComponentContext> const & context)
      43             : {
      44             :     css::uno::Reference<css::linguistic2::XProofreadingIterator> inst(
      45           0 :         css::linguistic2::ProofreadingIterator::create(context));
      46             :     bool disp;
      47             :     {
      48           0 :         SolarMutexGuard g;
      49           0 :         instance = inst;
      50           0 :         disp = disposed;
      51             :     }
      52           0 :     if (disp) {
      53           0 :         doDispose(inst);
      54             :     }
      55           0 :     return inst;
      56             : }
      57             : 
      58          59 : void sw::proofreadingiterator::dispose() {
      59          59 :     css::uno::Reference<css::linguistic2::XProofreadingIterator> inst;
      60             :     {
      61          59 :         SolarMutexGuard g;
      62          59 :         inst = instance;
      63          59 :         instance.clear();
      64          59 :         disposed = true;
      65             :     }
      66          59 :     doDispose(inst);
      67         236 : }
      68             : 
      69             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.11