LCOV - code coverage report
Current view: top level - sd/source/ui/func - futhes.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 49 0.0 %
Date: 2014-04-14 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 "futhes.hxx"
      21             : 
      22             : #include <editeng/outliner.hxx>
      23             : #include <vcl/msgbox.hxx>
      24             : #include <svx/svdobj.hxx>
      25             : #include <svx/svdotext.hxx>
      26             : #include <editeng/eeitem.hxx>
      27             : 
      28             : #include <svx/dialogs.hrc>
      29             : #include <svx/svxerr.hxx>
      30             : #include <svx/dialmgr.hxx>
      31             : #include <editeng/unolingu.hxx>
      32             : #include <comphelper/processfactory.hxx>
      33             : #include "app.hrc"
      34             : #include "strings.hrc"
      35             : #include "drawdoc.hxx"
      36             : #include "sdmod.hxx"
      37             : #include "View.hxx"
      38             : #include "Outliner.hxx"
      39             : #include "DrawViewShell.hxx"
      40             : #include "OutlineViewShell.hxx"
      41             : #include "Window.hxx"
      42             : #include "sdresid.hxx"
      43             : 
      44             : using namespace ::com::sun::star;
      45             : using namespace ::com::sun::star::uno;
      46             : using namespace ::com::sun::star::lang;
      47             : using namespace ::com::sun::star::linguistic2;
      48             : 
      49             : class SfxRequest;
      50             : 
      51             : namespace sd {
      52             : 
      53           0 : TYPEINIT1( FuThesaurus, FuPoor );
      54             : 
      55           0 : FuThesaurus::FuThesaurus( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView,
      56             :                   SdDrawDocument* pDoc, SfxRequest& rReq )
      57           0 :        : FuPoor(pViewSh, pWin, pView, pDoc, rReq)
      58             : {
      59           0 : }
      60             : 
      61           0 : rtl::Reference<FuPoor> FuThesaurus::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
      62             : {
      63           0 :     rtl::Reference<FuPoor> xFunc( new FuThesaurus( pViewSh, pWin, pView, pDoc, rReq ) );
      64           0 :     xFunc->DoExecute(rReq);
      65           0 :     return xFunc;
      66             : }
      67             : 
      68           0 : void FuThesaurus::DoExecute( SfxRequest& )
      69             : {
      70             :     SfxErrorContext aContext(ERRCTX_SVX_LINGU_THESAURUS, OUString(),
      71           0 :                              mpWindow, RID_SVXERRCTX, &DIALOG_MGR() );
      72             : 
      73           0 :     if( mpViewShell && mpViewShell->ISA(DrawViewShell) )
      74             :     {
      75           0 :         SdrTextObj* pTextObj = NULL;
      76             : 
      77           0 :         if ( mpView->AreObjectsMarked() )
      78             :         {
      79           0 :             const SdrMarkList& rMarkList = mpView->GetMarkedObjectList();
      80             : 
      81           0 :             if ( rMarkList.GetMarkCount() == 1 )
      82             :             {
      83           0 :                 SdrMark* pMark = rMarkList.GetMark(0);
      84           0 :                 SdrObject* pObj = pMark->GetMarkedSdrObj();
      85             : 
      86           0 :                 if ( pObj->ISA(SdrTextObj) )
      87             :                 {
      88           0 :                     pTextObj = (SdrTextObj*) pObj;
      89             :                 }
      90             :             }
      91             :         }
      92             : 
      93           0 :         ::Outliner* pOutliner = mpView->GetTextEditOutliner();
      94           0 :         const OutlinerView* pOutlView = mpView->GetTextEditOutlinerView();
      95             : 
      96           0 :         if ( pTextObj && pOutliner && pOutlView )
      97             :         {
      98           0 :             if ( !pOutliner->GetSpeller().is() )
      99             :             {
     100           0 :                 Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
     101           0 :                 if ( xSpellChecker.is() )
     102           0 :                     pOutliner->SetSpeller( xSpellChecker );
     103             : 
     104           0 :                 Reference< XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
     105           0 :                 if( xHyphenator.is() )
     106           0 :                     pOutliner->SetHyphenator( xHyphenator );
     107             : 
     108           0 :                 pOutliner->SetDefaultLanguage( mpDoc->GetLanguage( EE_CHAR_LANGUAGE ) );
     109             :             }
     110             : 
     111           0 :             EESpellState eState = ( (OutlinerView*) pOutlView)->StartThesaurus();
     112             :             DBG_ASSERT(eState != EE_SPELL_NOSPELLER, "No SpellChecker");
     113             : 
     114           0 :             if (eState == EE_SPELL_NOLANGUAGE)
     115             :             {
     116           0 :                 ErrorBox(mpWindow, WB_OK, SD_RESSTR(STR_NOLANGUAGE)).Execute();
     117             :             }
     118             :         }
     119             :     }
     120           0 :     else if ( mpViewShell->ISA(OutlineViewShell) )
     121             :     {
     122           0 :         Outliner* pOutliner = mpDoc->GetOutliner();
     123           0 :         OutlinerView* pOutlView = pOutliner->GetView(0);
     124             : 
     125           0 :         if ( !pOutliner->GetSpeller().is() )
     126             :         {
     127           0 :             Reference< XSpellChecker1 > xSpellChecker( LinguMgr::GetSpellChecker() );
     128           0 :             if ( xSpellChecker.is() )
     129           0 :                 pOutliner->SetSpeller( xSpellChecker );
     130             : 
     131           0 :             Reference< XHyphenator > xHyphenator( LinguMgr::GetHyphenator() );
     132           0 :             if( xHyphenator.is() )
     133           0 :                 pOutliner->SetHyphenator( xHyphenator );
     134             : 
     135           0 :             pOutliner->SetDefaultLanguage( mpDoc->GetLanguage( EE_CHAR_LANGUAGE ) );
     136             :         }
     137             : 
     138           0 :         EESpellState eState = pOutlView->StartThesaurus();
     139             :         DBG_ASSERT(eState != EE_SPELL_NOSPELLER, "No SpellChecker");
     140             : 
     141           0 :         if (eState == EE_SPELL_NOLANGUAGE)
     142             :         {
     143           0 :             ErrorBox(mpWindow, WB_OK, SD_RESSTR(STR_NOLANGUAGE)).Execute();
     144             :         }
     145           0 :     }
     146           0 : }
     147             : 
     148             : } // end of namespace sd
     149             : 
     150             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10