LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/lingu - hyp.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 47 0.0 %
Date: 2012-12-27 Functions: 0 8 0.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             :  * 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             : 
      21             : #include "initui.hxx"
      22             : #include "view.hxx"
      23             : #include "edtwin.hxx"
      24             : #include "wrtsh.hxx"
      25             : #include "globals.hrc"
      26             : #include <vcl/msgbox.hxx>
      27             : #include <vcl/wrkwin.hxx>
      28             : #include <linguistic/lngprops.hxx>
      29             : #include <com/sun/star/beans/XPropertySet.hpp>
      30             : #include <swwait.hxx>
      31             : 
      32             : #include "hyp.hxx"
      33             : #include "mdiexp.hxx"
      34             : #include "olmenu.hrc"
      35             : 
      36             : #include <unomid.h>
      37             : 
      38             : #define PSH         (&pView->GetWrtShell())
      39             : 
      40             : using namespace ::com::sun::star;
      41             : using ::rtl::OUString;
      42             : 
      43             : /*--------------------------------------------------------------------
      44             :      Description: interactive separation
      45             :  --------------------------------------------------------------------*/
      46             : 
      47           0 : SwHyphWrapper::SwHyphWrapper( SwView* pVw,
      48             :             uno::Reference< linguistic2::XHyphenator >  &rxHyph,
      49             :             sal_Bool bStart, sal_Bool bOther, sal_Bool bSelect ) :
      50           0 :     SvxSpellWrapper( &pVw->GetEditWin(), rxHyph, bStart, bOther ),
      51             :     pView( pVw ),
      52             :     xHyph( rxHyph ),
      53             :     nPageCount( 0 ),
      54             :     nPageStart( 0 ),
      55             :     bInSelection( bSelect ),
      56           0 :     bInfoBox( sal_False )
      57             : {
      58           0 :     uno::Reference< beans::XPropertySet >  xProp( GetLinguPropertySet() );
      59           0 :     bAutomatic = xProp.is() ?
      60           0 :             *(sal_Bool*)xProp->getPropertyValue(UPN_IS_HYPH_AUTO).getValue() : sal_False;
      61           0 :     SetHyphen();
      62           0 : }
      63             : 
      64             : // -----------------------------------------------------------------------
      65           0 : void SwHyphWrapper::SpellStart( SvxSpellArea eSpell )
      66             : {
      67           0 :     if( SVX_SPELL_OTHER == eSpell && nPageCount )
      68             :     {
      69           0 :         ::EndProgress( pView->GetDocShell() );
      70           0 :         nPageCount = 0;
      71           0 :         nPageStart = 0;
      72             :     }
      73           0 :     pView->HyphStart( eSpell );
      74           0 : }
      75             : 
      76             : // -----------------------------------------------------------------------
      77             : 
      78           0 : sal_Bool SwHyphWrapper::SpellContinue()
      79             : {
      80             :     // for automatic separation, make actions visible only at the end
      81           0 :     SwWait *pWait = 0;
      82           0 :     if( bAutomatic )
      83             :     {
      84           0 :         PSH->StartAllAction();
      85           0 :         pWait = new SwWait( *pView->GetDocShell(), sal_True );
      86             :     }
      87             : 
      88             :         uno::Reference< uno::XInterface >  xHyphWord = bInSelection ?
      89           0 :                 PSH->HyphContinue( NULL, NULL ) :
      90           0 :                 PSH->HyphContinue( &nPageCount, &nPageStart );
      91           0 :         SetLast( xHyphWord );
      92             : 
      93             :     // for automatic separation, make actions visible only at the end
      94           0 :     if( bAutomatic )
      95             :     {
      96           0 :         PSH->EndAllAction();
      97           0 :         delete pWait;
      98             :     }
      99             : 
     100           0 :     return GetLast().is();
     101             : }
     102             : 
     103             : // -----------------------------------------------------------------------
     104           0 : void SwHyphWrapper::SpellEnd()
     105             : {
     106           0 :     PSH->HyphEnd();
     107           0 :     SvxSpellWrapper::SpellEnd();
     108           0 : }
     109             : 
     110             : // -----------------------------------------------------------------------
     111           0 : sal_Bool SwHyphWrapper::SpellMore()
     112             : {
     113           0 :     PSH->Push();
     114           0 :     bInfoBox = sal_True;
     115           0 :     PSH->Combine();
     116           0 :     return sal_False;
     117             : }
     118             : 
     119             : // -----------------------------------------------------------------------
     120             : 
     121           0 : void SwHyphWrapper::InsertHyphen( const sal_uInt16 nPos )
     122             : {
     123           0 :     if( nPos)
     124           0 :         PSH->InsertSoftHyph( nPos + 1); // does nPos == 1 really mean
     125             :                                         // insert hyphen after first char?
     126             :                                         // (instead of nPos == 0)
     127             :     else
     128           0 :         PSH->HyphIgnore();
     129           0 : }
     130             : 
     131             : // -----------------------------------------------------------------------
     132           0 : SwHyphWrapper::~SwHyphWrapper()
     133             : {
     134           0 :     if( nPageCount )
     135           0 :         ::EndProgress( pView->GetDocShell() );
     136           0 :     if( bInfoBox )
     137           0 :         InfoBox( &pView->GetEditWin(), SW_RESSTR(STR_HYP_OK) ).Execute();
     138           0 : }
     139             : 
     140             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10