LCOV - code coverage report
Current view: top level - sd/source/ui/func - fusearch.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 51 0.0 %
Date: 2014-04-14 Functions: 0 13 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 "fusearch.hxx"
      21             : 
      22             : #include <sfx2/viewfrm.hxx>
      23             : 
      24             : #include <svx/svxids.hrc>
      25             : #include <svl/srchitem.hxx>
      26             : #include <svx/srchdlg.hxx>
      27             : #include <sfx2/bindings.hxx>
      28             : #include "fupoor.hxx"
      29             : #include "Window.hxx"
      30             : #include "drawdoc.hxx"
      31             : #include "app.hrc"
      32             : #include "sdmod.hxx"
      33             : #include "View.hxx"
      34             : #include "Outliner.hxx"
      35             : #include "DrawViewShell.hxx"
      36             : #include "OutlineViewShell.hxx"
      37             : #include "ViewShellBase.hxx"
      38             : 
      39             : class SfxRequest;
      40             : 
      41             : namespace sd {
      42             : 
      43             : static sal_uInt16 SidArraySpell[] = {
      44             :             SID_DRAWINGMODE,
      45             :             SID_OUTLINEMODE,
      46             :             SID_DIAMODE,
      47             :             SID_NOTESMODE,
      48             :             SID_HANDOUTMODE,
      49             :             0 };
      50             : 
      51           0 : TYPEINIT1( FuSearch, FuPoor );
      52             : 
      53           0 : FuSearch::FuSearch (
      54             :     ViewShell* pViewSh,
      55             :     ::sd::Window* pWin,
      56             :     ::sd::View* pView,
      57             :     SdDrawDocument* pDoc,
      58             :     SfxRequest& rReq )
      59             :     : FuPoor(pViewSh, pWin, pView, pDoc, rReq),
      60             :       pSdOutliner(NULL),
      61           0 :       bOwnOutliner(sal_False)
      62             : {
      63           0 : }
      64             : 
      65           0 : rtl::Reference<FuPoor> FuSearch::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
      66             : {
      67           0 :     rtl::Reference<FuPoor> xFunc( new FuSearch( pViewSh, pWin, pView, pDoc, rReq ) );
      68           0 :     xFunc->DoExecute(rReq);
      69           0 :     return xFunc;
      70             : }
      71             : 
      72           0 : void FuSearch::DoExecute( SfxRequest& )
      73             : {
      74           0 :     mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArraySpell );
      75             : 
      76           0 :     if ( mpViewShell->ISA(DrawViewShell) )
      77             :     {
      78           0 :         bOwnOutliner = sal_True;
      79           0 :         pSdOutliner = new ::sd::Outliner( mpDoc, OUTLINERMODE_TEXTOBJECT );
      80             :     }
      81           0 :     else if ( mpViewShell->ISA(OutlineViewShell) )
      82             :     {
      83           0 :         bOwnOutliner = sal_False;
      84           0 :         pSdOutliner = mpDoc->GetOutliner();
      85             :     }
      86             : 
      87           0 :     if (pSdOutliner)
      88           0 :        pSdOutliner->PrepareSpelling();
      89           0 : }
      90             : 
      91           0 : FuSearch::~FuSearch()
      92             : {
      93           0 :     if ( ! mpDocSh->IsInDestruction() && mpDocSh->GetViewShell()!=NULL)
      94           0 :         mpDocSh->GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SidArraySpell );
      95             : 
      96           0 :     if (pSdOutliner)
      97           0 :         pSdOutliner->EndSpelling();
      98             : 
      99           0 :     if (bOwnOutliner)
     100           0 :         delete pSdOutliner;
     101           0 : }
     102             : 
     103             : 
     104           0 : void FuSearch::SearchAndReplace( const SvxSearchItem* pSearchItem )
     105             : {
     106           0 :     ViewShellBase* pBase = PTR_CAST(ViewShellBase, SfxViewShell::Current());
     107           0 :     ViewShell* pViewShell = NULL;
     108           0 :     if (pBase != NULL)
     109           0 :         pViewShell = pBase->GetMainViewShell().get();
     110             : 
     111           0 :     if (pViewShell != NULL)
     112             :     {
     113           0 :         if ( pSdOutliner && pViewShell->ISA(DrawViewShell) && !bOwnOutliner )
     114             :         {
     115           0 :             pSdOutliner->EndSpelling();
     116             : 
     117           0 :             bOwnOutliner = sal_True;
     118           0 :             pSdOutliner = new ::sd::Outliner( mpDoc, OUTLINERMODE_TEXTOBJECT );
     119           0 :             pSdOutliner->PrepareSpelling();
     120             :         }
     121           0 :         else if ( pSdOutliner && pViewShell->ISA(OutlineViewShell) && bOwnOutliner )
     122             :         {
     123           0 :             pSdOutliner->EndSpelling();
     124           0 :             delete pSdOutliner;
     125             : 
     126           0 :             bOwnOutliner = sal_False;
     127           0 :             pSdOutliner = mpDoc->GetOutliner();
     128           0 :             pSdOutliner->PrepareSpelling();
     129             :         }
     130             : 
     131           0 :         if (pSdOutliner)
     132             :         {
     133           0 :             sal_Bool bEndSpelling = pSdOutliner->StartSearchAndReplace(pSearchItem);
     134             : 
     135           0 :             if (bEndSpelling)
     136             :             {
     137           0 :                 pSdOutliner->EndSpelling();
     138           0 :                 pSdOutliner->PrepareSpelling();
     139             :             }
     140             :         }
     141             :     }
     142           0 : }
     143             : 
     144             : 
     145             : 
     146           0 : } // end of namespace sd
     147             : 
     148             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10