LCOV - code coverage report
Current view: top level - sw/source/ui/dialog - wordcountdialog.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 39 0.0 %
Date: 2012-08-25 Functions: 0 8 0.0 %
Legend: Lines: hit not hit | Branches: + taken - not taken # not executed Branches: 0 0 -

           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                 :            : #include <swtypes.hxx>
      30                 :            : #include <wordcountdialog.hxx>
      31                 :            : #include <docstat.hxx>
      32                 :            : #include <dialog.hrc>
      33                 :            : #include <wordcountdialog.hrc>
      34                 :            : #include <cmdid.h>
      35                 :            : #include "vcl/msgbox.hxx" // RET_CANCEL
      36                 :            : #include <swmodule.hxx>
      37                 :            : #include <wview.hxx>
      38                 :            : #include <sfx2/viewfrm.hxx>
      39                 :            : #include <swwait.hxx>
      40                 :            : #include <wrtsh.hxx>
      41                 :            : 
      42                 :            : //TODO, add asian/non-asian word count to UI when CJK mode is enabled.
      43                 :            : 
      44                 :          0 : SwWordCountDialog::SwWordCountDialog(Window* pParent) :
      45                 :            : #if defined _MSC_VER
      46                 :            : #pragma warning (disable : 4355)
      47                 :            : #endif
      48                 :            :     aCurrentFL( pParent, SW_RES(              FL_CURRENT            )),
      49                 :            :     aCurrentWordFT( pParent, SW_RES(          FT_CURRENTWORD        )),
      50                 :            :     aCurrentWordFI( pParent, SW_RES(          FI_CURRENTWORD        )),
      51                 :            :     aCurrentCharacterFT( pParent, SW_RES(     FT_CURRENTCHARACTER   )),
      52                 :            :     aCurrentCharacterFI( pParent, SW_RES(     FI_CURRENTCHARACTER   )),
      53                 :            :     aCurrentCharacterExcludingSpacesFT( pParent, SW_RES(     FT_CURRENTCHARACTEREXCLUDINGSPACES   )),
      54                 :            :     aCurrentCharacterExcludingSpacesFI( pParent, SW_RES(     FI_CURRENTCHARACTEREXCLUDINGSPACES   )),
      55                 :            : 
      56                 :            :     aDocFL( pParent, SW_RES(                  FL_DOC                )),
      57                 :            :     aDocWordFT( pParent, SW_RES(              FT_DOCWORD            )),
      58                 :            :     aDocWordFI( pParent, SW_RES(              FI_DOCWORD            )),
      59                 :            :     aDocCharacterFT( pParent, SW_RES(         FT_DOCCHARACTER       )),
      60                 :            :     aDocCharacterFI( pParent, SW_RES(         FI_DOCCHARACTER       )),
      61                 :            :     aDocCharacterExcludingSpacesFT( pParent, SW_RES(         FT_DOCCHARACTEREXCLUDINGSPACES       )),
      62                 :            :     aDocCharacterExcludingSpacesFI( pParent, SW_RES(         FI_DOCCHARACTEREXCLUDINGSPACES       )),
      63                 :            :     aBottomFL(pParent, SW_RES(                FL_BOTTOM             )),
      64                 :            :     aOK( pParent, SW_RES(                     PB_OK                 )),
      65                 :          0 :     aHelp( pParent, SW_RES(                   PB_HELP               ))
      66                 :            : #if defined _MSC_VER
      67                 :            : #pragma warning (default : 4355)
      68                 :            : #endif
      69                 :            : {
      70                 :          0 :     aOK.SetClickHdl(LINK(this,SwWordCountDialog,        OkHdl));
      71                 :          0 : }
      72                 :            : 
      73                 :          0 : IMPL_LINK_NOARG(SwWordCountDialog, OkHdl)
      74                 :            : {   
      75                 :          0 :     SfxViewFrame* pVFrame = ::GetActiveView()->GetViewFrame();
      76                 :          0 :     if (pVFrame != NULL)
      77                 :            :     {
      78                 :          0 :         pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG);
      79                 :            :     }
      80                 :          0 :     return 0;
      81                 :            : }
      82                 :            : 
      83                 :          0 : SwWordCountDialog::~SwWordCountDialog()
      84                 :            : {
      85                 :          0 :     ViewShell::SetCareWin( 0 );
      86                 :          0 : }
      87                 :            : 
      88                 :          0 : void  SwWordCountDialog::SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc)
      89                 :            : {
      90                 :          0 :     aCurrentWordFI.SetText(     String::CreateFromInt32(rCurrent.nWord ));
      91                 :          0 :     aCurrentCharacterFI.SetText(String::CreateFromInt32(rCurrent.nChar ));
      92                 :          0 :     aCurrentCharacterExcludingSpacesFI.SetText(String::CreateFromInt32(rCurrent.nCharExcludingSpaces ));
      93                 :          0 :     aDocWordFI.SetText(         String::CreateFromInt32(rDoc.nWord ));
      94                 :          0 :     aDocCharacterFI.SetText(    String::CreateFromInt32(rDoc.nChar ));
      95                 :          0 :     aDocCharacterExcludingSpacesFI.SetText(    String::CreateFromInt32(rDoc.nCharExcludingSpaces ));
      96                 :          0 : }
      97                 :            : 
      98                 :            : 
      99                 :          0 : SwWordCountFloatDlg::SwWordCountFloatDlg(SfxBindings* _pBindings,
     100                 :            :                                          SfxChildWindow* pChild,
     101                 :            :                                          Window *pParent,
     102                 :            :                                          SfxChildWinInfo* pInfo)
     103                 :            :     : SfxModelessDialog(_pBindings, pChild, pParent, SW_RES(DLG_WORDCOUNT)),
     104                 :            : #if defined _MSC_VER
     105                 :            : #pragma warning (disable : 4355)
     106                 :            : #endif
     107                 :          0 :       aDlg(this)
     108                 :            : #if defined _MSC_VER
     109                 :            : #pragma warning (default : 4355)
     110                 :            : #endif
     111                 :            : {
     112                 :          0 :     FreeResource();
     113                 :          0 :     Initialize(pInfo);
     114                 :          0 : }
     115                 :            : 
     116                 :          0 : void SwWordCountFloatDlg::Activate()
     117                 :            : {
     118                 :          0 :     SfxModelessDialog::Activate();
     119                 :          0 : }
     120                 :            : 
     121                 :          0 : void SwWordCountFloatDlg::UpdateCounts()
     122                 :            : {
     123                 :          0 :     SwWrtShell &rSh = ::GetActiveView()->GetWrtShell();
     124                 :          0 :     SwDocStat aCurrCnt;
     125                 :          0 :     SwDocStat aDocStat;
     126                 :            :     {
     127                 :          0 :         SwWait aWait( *::GetActiveView()->GetDocShell(), sal_True );
     128                 :          0 :         rSh.StartAction();
     129                 :          0 :         rSh.CountWords( aCurrCnt );
     130                 :          0 :         aDocStat = rSh.GetUpdatedDocStat();
     131                 :          0 :         rSh.EndAction();
     132                 :            :     }
     133                 :          0 :     aDlg.SetValues(aCurrCnt, aDocStat);
     134                 :          0 : }
     135                 :            : 
     136                 :            : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10