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

Generated by: LCOV version 1.10