LCOV - code coverage report
Current view: top level - libreoffice/sw/source/ui/dialog - docstdlg.cxx (source / functions) Hit Total Coverage
Test: libreoffice_filtered.info Lines: 0 51 0.0 %
Date: 2012-12-17 Functions: 0 12 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 <stdio.h>
      21             : #include <ctype.h>
      22             : #include <swwait.hxx>
      23             : #include <wrtsh.hxx>
      24             : #include <view.hxx>
      25             : #include <swmodule.hxx>
      26             : #include <globals.hrc>
      27             : #include <docsh.hxx>
      28             : #include <pview.hxx>
      29             : #include <doc.hxx>
      30             : #include <docstdlg.hxx>
      31             : #include <modcfg.hxx>
      32             : 
      33             : // for statistics fields
      34             : #include <fldmgr.hxx>
      35             : #include <fldbas.hxx>
      36             : 
      37             : #include <docstdlg.hrc>
      38             : 
      39             : 
      40           0 : SfxTabPage *  SwDocStatPage::Create(Window *pParent, const SfxItemSet &rSet)
      41             : {
      42           0 :     return new SwDocStatPage(pParent, rSet);
      43             : }
      44             : 
      45           0 : SwDocStatPage::SwDocStatPage(Window *pParent, const SfxItemSet &rSet) :
      46             : 
      47             :     SfxTabPage  (pParent, SW_RES(TP_DOC_STAT), rSet),
      48             :     aPageLbl    (this, SW_RES( FT_PAGE       )),
      49             :     aPageNo     (this, SW_RES( FT_PAGE_COUNT )),
      50             :     aTableLbl   (this, SW_RES( FT_TABLE      )),
      51             :     aTableNo    (this, SW_RES( FT_TABLE_COUNT)),
      52             :     aGrfLbl     (this, SW_RES( FT_GRF        )),
      53             :     aGrfNo      (this, SW_RES( FT_GRF_COUNT  )),
      54             :     aOLELbl     (this, SW_RES( FT_OLE        )),
      55             :     aOLENo      (this, SW_RES( FT_OLE_COUNT  )),
      56             :     aParaLbl    (this, SW_RES( FT_PARA       )),
      57             :     aParaNo     (this, SW_RES( FT_PARA_COUNT )),
      58             :     aWordLbl    (this, SW_RES( FT_WORD       )),
      59             :     aWordNo     (this, SW_RES( FT_WORD_COUNT )),
      60             :     aCharLbl    (this, SW_RES( FT_CHAR       )),
      61             :     aCharNo     (this, SW_RES( FT_CHAR_COUNT )),
      62             :     aCharExclSpacesLbl (this, SW_RES( FT_CHAR_EXCL_SPACES )),
      63             :     aCharExclSpacesNo (this, SW_RES( FT_CHAR_COUNT_EXCL_SPACES )),
      64             :     aLineLbl    (this, SW_RES( FT_LINE       )),
      65             :     aLineNo     (this, SW_RES( FT_LINE_COUNT )),
      66           0 :     aUpdatePB   (this, SW_RES( PB_PDATE      ))
      67             : {
      68           0 :     Update();
      69           0 :     FreeResource();
      70           0 :     aUpdatePB.SetClickHdl(LINK(this, SwDocStatPage, UpdateHdl));
      71             :     //#111684# is the current view a page preview no SwFEShell can be found -> hide the update button
      72           0 :     SwDocShell* pDocShell = (SwDocShell*) SfxObjectShell::Current();
      73           0 :     SwFEShell* pFEShell = pDocShell->GetFEShell();
      74           0 :     if(!pFEShell)
      75             :     {
      76           0 :         aUpdatePB.Show(sal_False);
      77           0 :         aLineLbl.Show(sal_False);
      78           0 :         aLineNo .Show(sal_False);
      79             :     }
      80             : 
      81           0 : }
      82             : 
      83             : 
      84           0 :  SwDocStatPage::~SwDocStatPage()
      85             : {
      86           0 : }
      87             : 
      88             : /*--------------------------------------------------------------------
      89             :     Description:    fill ItemSet when changed
      90             :  --------------------------------------------------------------------*/
      91             : 
      92             : 
      93           0 : sal_Bool  SwDocStatPage::FillItemSet(SfxItemSet & /*rSet*/)
      94             : {
      95           0 :     return sal_False;
      96             : }
      97             : 
      98           0 : void  SwDocStatPage::Reset(const SfxItemSet &/*rSet*/)
      99             : {
     100           0 : }
     101             : /*------------------------------------------------------------------------
     102             :  Description:   update / set data
     103             : ------------------------------------------------------------------------*/
     104             : 
     105             : 
     106           0 : void SwDocStatPage::SetData(const SwDocStat &rStat)
     107             : {
     108           0 :     aTableNo.SetText(String::CreateFromInt32( rStat.nTbl ));
     109           0 :     aGrfNo.SetText(String::CreateFromInt32( rStat.nGrf ));
     110           0 :     aOLENo.SetText(String::CreateFromInt32( rStat.nOLE ));
     111           0 :     aPageNo.SetText(String::CreateFromInt32( rStat.nPage ));
     112           0 :     aParaNo.SetText(String::CreateFromInt32( rStat.nPara ));
     113           0 :     aWordNo.SetText(String::CreateFromInt32( rStat.nWord ));
     114           0 :     aCharNo.SetText(String::CreateFromInt32( rStat.nChar ));
     115           0 :     aCharExclSpacesNo.SetText(String::CreateFromInt32( rStat.nCharExcludingSpaces ));
     116           0 : }
     117             : 
     118             : /*------------------------------------------------------------------------
     119             :  Description:   update statistics
     120             : ------------------------------------------------------------------------*/
     121             : 
     122             : 
     123           0 : void SwDocStatPage::Update()
     124             : {
     125           0 :     SfxViewShell *pVSh = SfxViewShell::Current();
     126           0 :     ViewShell *pSh = 0;
     127           0 :     if ( pVSh->ISA(SwView) )
     128           0 :         pSh = ((SwView*)pVSh)->GetWrtShellPtr();
     129           0 :     else if ( pVSh->ISA(SwPagePreView) )
     130           0 :         pSh = ((SwPagePreView*)pVSh)->GetViewShell();
     131             : 
     132             :     OSL_ENSURE( pSh, "Shell not found" );
     133             : 
     134           0 :     SwWait aWait( *pSh->GetDoc()->GetDocShell(), sal_True );
     135           0 :     pSh->StartAction();
     136           0 :     aDocStat = pSh->GetDoc()->GetUpdatedDocStat();
     137           0 :     pSh->EndAction();
     138             : 
     139           0 :     SetData(aDocStat);
     140           0 : }
     141             : 
     142           0 : IMPL_LINK_NOARG(SwDocStatPage, UpdateHdl)
     143             : {
     144           0 :     Update();
     145           0 :     SwDocShell* pDocShell = (SwDocShell*) SfxObjectShell::Current();
     146           0 :     SwFEShell* pFEShell = pDocShell->GetFEShell();
     147           0 :     if(pFEShell)
     148           0 :         aLineNo.SetText( String::CreateFromInt32( pFEShell->GetLineCount(sal_False)));
     149             :     //pButton->Disable();
     150           0 :     return 0;
     151           0 : }
     152             : 
     153             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10