LCOV - code coverage report
Current view: top level - sd/source/ui/func - fusearch.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 50 0.0 %
Date: 2012-08-25 Functions: 0 11 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 72 0.0 %

           Branch data     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 "app.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                 :            : /*************************************************************************
      54                 :            : |*
      55                 :            : |* Konstruktor
      56                 :            : |*
      57                 :            : \************************************************************************/
      58                 :            : 
      59                 :          0 : FuSearch::FuSearch (
      60                 :            :     ViewShell* pViewSh,
      61                 :            :     ::sd::Window* pWin,
      62                 :            :     ::sd::View* pView,
      63                 :            :     SdDrawDocument* pDoc,
      64                 :            :     SfxRequest& rReq )
      65                 :            :     : FuPoor(pViewSh, pWin, pView, pDoc, rReq),
      66                 :            :       pSdOutliner(NULL),
      67                 :          0 :       bOwnOutliner(sal_False)
      68                 :            : {
      69                 :          0 : }
      70                 :            : 
      71                 :          0 : FunctionReference FuSearch::Create( ViewShell* pViewSh, ::sd::Window* pWin, ::sd::View* pView, SdDrawDocument* pDoc, SfxRequest& rReq )
      72                 :            : {
      73 [ #  # ][ #  # ]:          0 :     FunctionReference xFunc( new FuSearch( pViewSh, pWin, pView, pDoc, rReq ) );
      74         [ #  # ]:          0 :     xFunc->DoExecute(rReq);
      75                 :          0 :     return xFunc;
      76                 :            : }
      77                 :            : 
      78                 :          0 : void FuSearch::DoExecute( SfxRequest& )
      79                 :            : {
      80                 :          0 :     mpViewShell->GetViewFrame()->GetBindings().Invalidate( SidArraySpell );
      81                 :            : 
      82         [ #  # ]:          0 :     if ( mpViewShell->ISA(DrawViewShell) )
      83                 :            :     {
      84                 :          0 :         bOwnOutliner = sal_True;
      85         [ #  # ]:          0 :         pSdOutliner = new ::sd::Outliner( mpDoc, OUTLINERMODE_TEXTOBJECT );
      86                 :            :     }
      87         [ #  # ]:          0 :     else if ( mpViewShell->ISA(OutlineViewShell) )
      88                 :            :     {
      89                 :          0 :         bOwnOutliner = sal_False;
      90                 :          0 :         pSdOutliner = mpDoc->GetOutliner();
      91                 :            :     }
      92                 :            : 
      93         [ #  # ]:          0 :     if (pSdOutliner)
      94                 :          0 :        pSdOutliner->PrepareSpelling();
      95                 :          0 : }
      96                 :            : 
      97                 :            : /*************************************************************************
      98                 :            : |*
      99                 :            : |* Destruktor
     100                 :            : |*
     101                 :            : \************************************************************************/
     102                 :            : 
     103                 :          0 : FuSearch::~FuSearch()
     104                 :            : {
     105 [ #  # ][ #  # ]:          0 :     if ( ! mpDocSh->IsInDestruction() && mpDocSh->GetViewShell()!=NULL)
                 [ #  # ]
     106 [ #  # ][ #  # ]:          0 :         mpDocSh->GetViewShell()->GetViewFrame()->GetBindings().Invalidate( SidArraySpell );
     107                 :            : 
     108         [ #  # ]:          0 :     if (pSdOutliner)
     109         [ #  # ]:          0 :         pSdOutliner->EndSpelling();
     110                 :            : 
     111         [ #  # ]:          0 :     if (bOwnOutliner)
     112 [ #  # ][ #  # ]:          0 :         delete pSdOutliner;
     113         [ #  # ]:          0 : }
     114                 :            : 
     115                 :            : 
     116                 :            : /*************************************************************************
     117                 :            : |*
     118                 :            : |* Suchen&Ersetzen
     119                 :            : |*
     120                 :            : \************************************************************************/
     121                 :            : 
     122                 :          0 : void FuSearch::SearchAndReplace( const SvxSearchItem* pSearchItem )
     123                 :            : {
     124 [ #  # ][ #  # ]:          0 :     ViewShellBase* pBase = PTR_CAST(ViewShellBase, SfxViewShell::Current());
     125                 :          0 :     ViewShell* pViewShell = NULL;
     126         [ #  # ]:          0 :     if (pBase != NULL)
     127                 :          0 :         pViewShell = pBase->GetMainViewShell().get();
     128                 :            : 
     129         [ #  # ]:          0 :     if (pViewShell != NULL)
     130                 :            :     {
     131 [ #  # ][ #  # ]:          0 :         if ( pSdOutliner && pViewShell->ISA(DrawViewShell) && !bOwnOutliner )
         [ #  # ][ #  # ]
     132                 :            :         {
     133                 :          0 :             pSdOutliner->EndSpelling();
     134                 :            : 
     135                 :          0 :             bOwnOutliner = sal_True;
     136         [ #  # ]:          0 :             pSdOutliner = new ::sd::Outliner( mpDoc, OUTLINERMODE_TEXTOBJECT );
     137                 :          0 :             pSdOutliner->PrepareSpelling();
     138                 :            :         }
     139 [ #  # ][ #  # ]:          0 :         else if ( pSdOutliner && pViewShell->ISA(OutlineViewShell) && bOwnOutliner )
         [ #  # ][ #  # ]
     140                 :            :         {
     141                 :          0 :             pSdOutliner->EndSpelling();
     142         [ #  # ]:          0 :             delete pSdOutliner;
     143                 :            : 
     144                 :          0 :             bOwnOutliner = sal_False;
     145                 :          0 :             pSdOutliner = mpDoc->GetOutliner();
     146                 :          0 :             pSdOutliner->PrepareSpelling();
     147                 :            :         }
     148                 :            : 
     149         [ #  # ]:          0 :         if (pSdOutliner)
     150                 :            :         {
     151                 :          0 :             sal_Bool bEndSpelling = pSdOutliner->StartSearchAndReplace(pSearchItem);
     152                 :            : 
     153         [ #  # ]:          0 :             if (bEndSpelling)
     154                 :            :             {
     155                 :          0 :                 pSdOutliner->EndSpelling();
     156                 :          0 :                 pSdOutliner->PrepareSpelling();
     157                 :            :             }
     158                 :            :         }
     159                 :            :     }
     160                 :          0 : }
     161                 :            : 
     162                 :            : 
     163                 :            : 
     164                 :            : } // end of namespace sd
     165                 :            : 
     166                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10