LCOV - code coverage report
Current view: top level - sd/source/ui/dlg - SpellDialogChildWindow.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 1 59 1.7 %
Date: 2012-08-25 Functions: 2 13 15.4 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 1 70 1.4 %

           Branch data     Line data    Source code
       1                 :            : /* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */
       2                 :            : /*************************************************************************
       3                 :            :  *
       4                 :            :  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
       5                 :            :  *
       6                 :            :  * Copyright 2000, 2010 Oracle and/or its affiliates.
       7                 :            :  *
       8                 :            :  * OpenOffice.org - a multi-platform office productivity suite
       9                 :            :  *
      10                 :            :  * This file is part of OpenOffice.org.
      11                 :            :  *
      12                 :            :  * OpenOffice.org is free software: you can redistribute it and/or modify
      13                 :            :  * it under the terms of the GNU Lesser General Public License version 3
      14                 :            :  * only, as published by the Free Software Foundation.
      15                 :            :  *
      16                 :            :  * OpenOffice.org is distributed in the hope that it will be useful,
      17                 :            :  * but WITHOUT ANY WARRANTY; without even the implied warranty of
      18                 :            :  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
      19                 :            :  * GNU Lesser General Public License version 3 for more details
      20                 :            :  * (a copy is included in the LICENSE file that accompanied this code).
      21                 :            :  *
      22                 :            :  * You should have received a copy of the GNU Lesser General Public License
      23                 :            :  * version 3 along with OpenOffice.org.  If not, see
      24                 :            :  * <http://www.openoffice.org/license.html>
      25                 :            :  * for a copy of the LGPLv3 License.
      26                 :            :  *
      27                 :            :  ************************************************************************/
      28                 :            : 
      29                 :            : 
      30                 :            : #include "SpellDialogChildWindow.hxx"
      31                 :            : #include <svx/svxids.hrc>
      32                 :            : #include <sfx2/app.hxx>
      33                 :            : #include <sfx2/bindings.hxx>
      34                 :            : #include <sfx2/dispatch.hxx>
      35                 :            : 
      36                 :            : namespace sd{
      37                 :            : 
      38 [ +  - ][ #  # ]:        386 : SFX_IMPL_CHILDWINDOW_WITHID(SpellDialogChildWindow, SID_SPELL_DIALOG)
      39                 :            : }
      40                 :            : 
      41                 :            : #include "ViewShell.hxx"
      42                 :            : #include "ViewShellBase.hxx"
      43                 :            : #include "DrawViewShell.hxx"
      44                 :            : #include "OutlineViewShell.hxx"
      45                 :            : #include <Outliner.hxx>
      46                 :            : #include "drawdoc.hxx"
      47                 :            : 
      48                 :            : 
      49                 :            : namespace sd {
      50                 :            : 
      51                 :          0 : SpellDialogChildWindow::SpellDialogChildWindow (
      52                 :            :     ::Window* _pParent,
      53                 :            :     sal_uInt16 nId,
      54                 :            :     SfxBindings* pBindings,
      55                 :            :     SfxChildWinInfo* pInfo)
      56                 :            :     : ::svx::SpellDialogChildWindow (_pParent, nId, pBindings, pInfo),
      57                 :            :       mpSdOutliner (NULL),
      58                 :          0 :       mbOwnOutliner (false)
      59                 :            : {
      60         [ #  # ]:          0 :     ProvideOutliner();
      61                 :          0 : }
      62                 :            : 
      63                 :            : 
      64                 :            : 
      65                 :            : 
      66                 :          0 : SpellDialogChildWindow::~SpellDialogChildWindow (void)
      67                 :            : {
      68         [ #  # ]:          0 :     if (mpSdOutliner != NULL)
      69         [ #  # ]:          0 :         mpSdOutliner->EndSpelling();
      70                 :            : 
      71         [ #  # ]:          0 :     if (mbOwnOutliner)
      72 [ #  # ][ #  # ]:          0 :         delete mpSdOutliner;
      73         [ #  # ]:          0 : }
      74                 :            : 
      75                 :            : 
      76                 :            : 
      77                 :            : 
      78                 :            : 
      79                 :            : 
      80                 :            : 
      81                 :            : 
      82                 :          0 : SfxChildWinInfo SpellDialogChildWindow::GetInfo (void) const
      83                 :            : {
      84                 :          0 :     return ::svx::SpellDialogChildWindow::GetInfo();
      85                 :            : }
      86                 :            : 
      87                 :            : 
      88                 :            : 
      89                 :            : 
      90                 :          0 : void SpellDialogChildWindow::InvalidateSpellDialog (void)
      91                 :            : {
      92                 :          0 :     ::svx::SpellDialogChildWindow::InvalidateSpellDialog();
      93                 :          0 : }
      94                 :            : 
      95                 :            : 
      96                 :            : 
      97                 :            : 
      98                 :          0 : ::svx::SpellPortions SpellDialogChildWindow::GetNextWrongSentence( bool /*bRecheck*/ )
      99                 :            : {
     100                 :          0 :     ::svx::SpellPortions aResult;
     101                 :            : 
     102         [ #  # ]:          0 :     if (mpSdOutliner != NULL)
     103                 :            :     {
     104         [ #  # ]:          0 :         ProvideOutliner();
     105         [ #  # ]:          0 :         aResult = mpSdOutliner->GetNextSpellSentence();
     106                 :            :     }
     107                 :            : 
     108                 :            :     // Close the spell check dialog when there are no more sentences to
     109                 :            :     // check.
     110         [ #  # ]:          0 :     if (aResult.empty())
     111                 :            :     {
     112         [ #  # ]:          0 :         SfxBoolItem aItem (SID_SPELL_DIALOG, sal_False);
     113         [ #  # ]:          0 :         GetBindings().GetDispatcher()->Execute(
     114                 :            :             SID_SPELL_DIALOG,
     115                 :            :             SFX_CALLMODE_ASYNCHRON,
     116                 :            :             &aItem,
     117 [ #  # ][ #  # ]:          0 :             0L);
     118                 :            :     }
     119                 :            : 
     120                 :          0 :     return aResult;
     121                 :            : }
     122                 :            : 
     123                 :            : 
     124                 :            : 
     125                 :            : 
     126                 :          0 : void SpellDialogChildWindow::ApplyChangedSentence (
     127                 :            :     const ::svx::SpellPortions& rChanged, bool bRecheck )
     128                 :            : {
     129         [ #  # ]:          0 :     if (mpSdOutliner != NULL)
     130                 :            :     {
     131                 :          0 :         OutlinerView* pOutlinerView = mpSdOutliner->GetView(0);
     132         [ #  # ]:          0 :         if (pOutlinerView != NULL)
     133                 :            :             mpSdOutliner->ApplyChangedSentence (
     134                 :          0 :                 pOutlinerView->GetEditView(),
     135                 :          0 :                 rChanged, bRecheck);
     136                 :            :     }
     137                 :          0 : }
     138                 :            : 
     139                 :            : 
     140                 :            : 
     141                 :            : 
     142                 :          0 : void SpellDialogChildWindow::GetFocus (void)
     143                 :            : {
     144                 :            :     // In order to detect a cursor movement we could compare the
     145                 :            :     // currently selected text shape with the one that was selected
     146                 :            :     // when LoseFocus() was called the last time.
     147                 :            :     // For the time being we instead rely on the DetectChange() method
     148                 :            :     // in the SdOutliner class.
     149                 :          0 : }
     150                 :            : 
     151                 :            : 
     152                 :            : 
     153                 :            : 
     154                 :          0 : void SpellDialogChildWindow::LoseFocus()
     155                 :            : {
     156                 :          0 : }
     157                 :            : 
     158                 :            : 
     159                 :            : 
     160                 :            : 
     161                 :          0 : void SpellDialogChildWindow::ProvideOutliner (void)
     162                 :            : {
     163 [ #  # ][ #  # ]:          0 :     ViewShellBase* pViewShellBase = PTR_CAST (ViewShellBase, SfxViewShell::Current());
     164                 :            : 
     165         [ #  # ]:          0 :     if (pViewShellBase != NULL)
     166                 :            :     {
     167                 :          0 :         ViewShell* pViewShell = pViewShellBase->GetMainViewShell().get();
     168                 :            :         // If there already exists an outliner that has been created
     169                 :            :         // for another view shell then destroy it first.
     170         [ #  # ]:          0 :         if (mpSdOutliner != NULL)
     171         [ #  # ]:          0 :             if ((pViewShell->ISA(DrawViewShell) && ! mbOwnOutliner)
           [ #  #  #  # ]
         [ #  # ][ #  # ]
     172                 :          0 :                 || (pViewShell->ISA(OutlineViewShell) && mbOwnOutliner))
     173                 :            :             {
     174                 :          0 :                 mpSdOutliner->EndSpelling();
     175         [ #  # ]:          0 :                 if (mbOwnOutliner)
     176         [ #  # ]:          0 :                     delete mpSdOutliner;
     177                 :          0 :                 mpSdOutliner = NULL;
     178                 :            :             }
     179                 :            : 
     180                 :            :         // Now create/get an outliner if none is present.
     181         [ #  # ]:          0 :         if (mpSdOutliner == NULL)
     182                 :            :         {
     183         [ #  # ]:          0 :             if (pViewShell->ISA(DrawViewShell))
     184                 :            :             {
     185                 :            :                 // We need an outliner for the spell check so we have
     186                 :            :                 // to create one.
     187                 :          0 :                 mbOwnOutliner = true;
     188                 :            :                 mpSdOutliner = new Outliner (
     189                 :            :                     pViewShell->GetDoc(),
     190         [ #  # ]:          0 :                     OUTLINERMODE_TEXTOBJECT);
     191                 :            :             }
     192         [ #  # ]:          0 :             else if (pViewShell->ISA(OutlineViewShell))
     193                 :            :             {
     194                 :            :                 // An outline view is already visible. The SdOutliner
     195                 :            :                 // will use it instead of creating its own.
     196                 :          0 :                 mbOwnOutliner = false;
     197                 :          0 :                 mpSdOutliner = pViewShell->GetDoc()->GetOutliner();
     198                 :            :             }
     199                 :            : 
     200                 :            :             // Initialize spelling.
     201         [ #  # ]:          0 :             if (mpSdOutliner != NULL)
     202                 :            :             {
     203                 :          0 :                 mpSdOutliner->PrepareSpelling();
     204                 :          0 :                 mpSdOutliner->StartSpelling();
     205                 :            :             }
     206                 :            :         }
     207                 :            :     }
     208                 :          0 : }
     209                 :            : 
     210                 :            : 
     211                 :            : 
     212                 :            : } // end of namespace ::sd
     213                 :            : 
     214                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10