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 61 0.0 %
Date: 2012-12-27 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           0 : SfxTabPage *  SwDocStatPage::Create(Window *pParent, const SfxItemSet &rSet)
      38             : {
      39           0 :     return new SwDocStatPage(pParent, rSet);
      40             : }
      41             : 
      42           0 : SwDocStatPage::SwDocStatPage(Window *pParent, const SfxItemSet &rSet)
      43             : 
      44           0 :     : SfxTabPage(pParent, "StatisticsInfoPage", "modules/swriter/ui/statisticsinfopage.ui", rSet)
      45             : 
      46             : {
      47           0 :     get(m_pPageNo, "nopages");
      48           0 :     get(m_pTableNo, "notables");
      49           0 :     get(m_pGrfNo, "nogrfs");
      50           0 :     get(m_pOLENo, "nooles");
      51           0 :     get(m_pParaNo, "noparas");
      52           0 :     get(m_pWordNo, "nowords");
      53           0 :     get(m_pCharNo, "nochars");
      54           0 :     get(m_pCharExclSpacesNo, "nocharsexspaces");
      55             : 
      56           0 :     get(m_pLineLbl, "lineft");
      57           0 :     get(m_pLineNo, "nolines");
      58           0 :     get(m_pUpdatePB, "update");
      59             : 
      60           0 :     Update();
      61           0 :     m_pUpdatePB->SetClickHdl(LINK(this, SwDocStatPage, UpdateHdl));
      62             :     //#111684# is the current view a page preview no SwFEShell can be found -> hide the update button
      63           0 :     SwDocShell* pDocShell = (SwDocShell*) SfxObjectShell::Current();
      64           0 :     SwFEShell* pFEShell = pDocShell->GetFEShell();
      65           0 :     if(!pFEShell)
      66             :     {
      67           0 :         m_pUpdatePB->Show(sal_False);
      68           0 :         m_pLineLbl->Show(sal_False);
      69           0 :         m_pLineNo->Show(sal_False);
      70             :     }
      71             : 
      72           0 : }
      73             : 
      74             : 
      75           0 :  SwDocStatPage::~SwDocStatPage()
      76             : {
      77           0 : }
      78             : 
      79             : /*--------------------------------------------------------------------
      80             :     Description:    fill ItemSet when changed
      81             :  --------------------------------------------------------------------*/
      82             : 
      83             : 
      84           0 : sal_Bool  SwDocStatPage::FillItemSet(SfxItemSet & /*rSet*/)
      85             : {
      86           0 :     return sal_False;
      87             : }
      88             : 
      89           0 : void  SwDocStatPage::Reset(const SfxItemSet &/*rSet*/)
      90             : {
      91           0 : }
      92             : /*------------------------------------------------------------------------
      93             :  Description:   update / set data
      94             : ------------------------------------------------------------------------*/
      95             : 
      96             : 
      97           0 : void SwDocStatPage::SetData(const SwDocStat &rStat)
      98             : {
      99           0 :     m_pTableNo->SetText(String::CreateFromInt32( rStat.nTbl ));
     100           0 :     m_pGrfNo->SetText(String::CreateFromInt32( rStat.nGrf ));
     101           0 :     m_pOLENo->SetText(String::CreateFromInt32( rStat.nOLE ));
     102           0 :     m_pPageNo->SetText(String::CreateFromInt32( rStat.nPage ));
     103           0 :     m_pParaNo->SetText(String::CreateFromInt32( rStat.nPara ));
     104           0 :     m_pWordNo->SetText(String::CreateFromInt32( rStat.nWord ));
     105           0 :     m_pCharNo->SetText(String::CreateFromInt32( rStat.nChar ));
     106           0 :     m_pCharExclSpacesNo->SetText(String::CreateFromInt32( rStat.nCharExcludingSpaces ));
     107           0 : }
     108             : 
     109             : /*------------------------------------------------------------------------
     110             :  Description:   update statistics
     111             : ------------------------------------------------------------------------*/
     112             : 
     113             : 
     114           0 : void SwDocStatPage::Update()
     115             : {
     116           0 :     SfxViewShell *pVSh = SfxViewShell::Current();
     117           0 :     ViewShell *pSh = 0;
     118           0 :     if ( pVSh->ISA(SwView) )
     119           0 :         pSh = ((SwView*)pVSh)->GetWrtShellPtr();
     120           0 :     else if ( pVSh->ISA(SwPagePreView) )
     121           0 :         pSh = ((SwPagePreView*)pVSh)->GetViewShell();
     122             : 
     123             :     OSL_ENSURE( pSh, "Shell not found" );
     124             : 
     125           0 :     SwWait aWait( *pSh->GetDoc()->GetDocShell(), sal_True );
     126           0 :     pSh->StartAction();
     127           0 :     aDocStat = pSh->GetDoc()->GetUpdatedDocStat();
     128           0 :     pSh->EndAction();
     129             : 
     130           0 :     SetData(aDocStat);
     131           0 : }
     132             : 
     133           0 : IMPL_LINK_NOARG(SwDocStatPage, UpdateHdl)
     134             : {
     135           0 :     Update();
     136           0 :     SwDocShell* pDocShell = (SwDocShell*) SfxObjectShell::Current();
     137           0 :     SwFEShell* pFEShell = pDocShell->GetFEShell();
     138           0 :     if(pFEShell)
     139           0 :         m_pLineNo->SetText( String::CreateFromInt32( pFEShell->GetLineCount(sal_False)));
     140             :     //pButton->Disable();
     141           0 :     return 0;
     142           0 : }
     143             : 
     144             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10