LCOV - code coverage report
Current view: top level - sw/source/ui/dialog - docstdlg.cxx (source / functions) Hit Total Coverage
Test: commit e02a6cb2c3e2b23b203b422e4e0680877f232636 Lines: 0 63 0.0 %
Date: 2014-04-14 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 <unotools/localedatawrapper.hxx>
      38             : #include <vcl/settings.hxx>
      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           0 :     : SfxTabPage(pParent, "StatisticsInfoPage", "modules/swriter/ui/statisticsinfopage.ui", rSet)
      48             : 
      49             : {
      50           0 :     get(m_pPageNo, "nopages");
      51           0 :     get(m_pTableNo, "notables");
      52           0 :     get(m_pGrfNo, "nogrfs");
      53           0 :     get(m_pOLENo, "nooles");
      54           0 :     get(m_pParaNo, "noparas");
      55           0 :     get(m_pWordNo, "nowords");
      56           0 :     get(m_pCharNo, "nochars");
      57           0 :     get(m_pCharExclSpacesNo, "nocharsexspaces");
      58             : 
      59           0 :     get(m_pLineLbl, "lineft");
      60           0 :     get(m_pLineNo, "nolines");
      61           0 :     get(m_pUpdatePB, "update");
      62             : 
      63           0 :     Update();
      64           0 :     m_pUpdatePB->SetClickHdl(LINK(this, SwDocStatPage, UpdateHdl));
      65             :     //#111684# is the current view a page preview no SwFEShell can be found -> hide the update button
      66           0 :     SwDocShell* pDocShell = (SwDocShell*) SfxObjectShell::Current();
      67           0 :     SwFEShell* pFEShell = pDocShell->GetFEShell();
      68           0 :     if(!pFEShell)
      69             :     {
      70           0 :         m_pUpdatePB->Show(false);
      71           0 :         m_pLineLbl->Show(false);
      72           0 :         m_pLineNo->Show(false);
      73             :     }
      74             : 
      75           0 : }
      76             : 
      77           0 :  SwDocStatPage::~SwDocStatPage()
      78             : {
      79           0 : }
      80             : 
      81             : // Description: fill ItemSet when changed
      82           0 : bool  SwDocStatPage::FillItemSet(SfxItemSet & /*rSet*/)
      83             : {
      84           0 :     return false;
      85             : }
      86             : 
      87           0 : void  SwDocStatPage::Reset(const SfxItemSet &/*rSet*/)
      88             : {
      89           0 : }
      90             : 
      91             : // Description: update / set data
      92           0 : void SwDocStatPage::SetData(const SwDocStat &rStat)
      93             : {
      94           0 :     const LocaleDataWrapper& rLocaleData = GetSettings().GetUILocaleDataWrapper();
      95           0 :     m_pTableNo->SetText(rLocaleData.getNum(rStat.nTbl, 0));
      96           0 :     m_pGrfNo->SetText(rLocaleData.getNum(rStat.nGrf, 0));
      97           0 :     m_pOLENo->SetText(rLocaleData.getNum(rStat.nOLE, 0));
      98           0 :     m_pPageNo->SetText(rLocaleData.getNum(rStat.nPage, 0));
      99           0 :     m_pParaNo->SetText(rLocaleData.getNum(rStat.nPara, 0));
     100           0 :     m_pWordNo->SetText(rLocaleData.getNum(rStat.nWord, 0));
     101           0 :     m_pCharNo->SetText(rLocaleData.getNum(rStat.nChar, 0));
     102           0 :     m_pCharExclSpacesNo->SetText(rLocaleData.getNum(rStat.nCharExcludingSpaces, 0));
     103           0 : }
     104             : 
     105             : // Description: update statistics
     106           0 : void SwDocStatPage::Update()
     107             : {
     108           0 :     SfxViewShell *pVSh = SfxViewShell::Current();
     109           0 :     SwViewShell *pSh = 0;
     110           0 :     if ( pVSh->ISA(SwView) )
     111           0 :         pSh = ((SwView*)pVSh)->GetWrtShellPtr();
     112           0 :     else if ( pVSh->ISA(SwPagePreview) )
     113           0 :         pSh = ((SwPagePreview*)pVSh)->GetViewShell();
     114             : 
     115             :     OSL_ENSURE( pSh, "Shell not found" );
     116             : 
     117           0 :     if (!pSh)
     118           0 :         return;
     119             : 
     120           0 :     SwWait aWait( *pSh->GetDoc()->GetDocShell(), true );
     121           0 :     pSh->StartAction();
     122           0 :     aDocStat = pSh->GetDoc()->GetUpdatedDocStat();
     123           0 :     pSh->EndAction();
     124             : 
     125           0 :     SetData(aDocStat);
     126             : }
     127             : 
     128           0 : IMPL_LINK_NOARG(SwDocStatPage, UpdateHdl)
     129             : {
     130           0 :     Update();
     131           0 :     SwDocShell* pDocShell = (SwDocShell*) SfxObjectShell::Current();
     132           0 :     SwFEShell* pFEShell = pDocShell->GetFEShell();
     133           0 :     if(pFEShell)
     134           0 :         m_pLineNo->SetText( OUString::number( pFEShell->GetLineCount(sal_False)));
     135             :     //pButton->Disable();
     136           0 :     return 0;
     137           0 : }
     138             : 
     139             : /* vim:set shiftwidth=4 softtabstop=4 expandtab: */

Generated by: LCOV version 1.10