1*cdf0e10cSrcweir /************************************************************************* 2*cdf0e10cSrcweir * 3*cdf0e10cSrcweir * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4*cdf0e10cSrcweir * 5*cdf0e10cSrcweir * Copyright 2000, 2010 Oracle and/or its affiliates. 6*cdf0e10cSrcweir * 7*cdf0e10cSrcweir * OpenOffice.org - a multi-platform office productivity suite 8*cdf0e10cSrcweir * 9*cdf0e10cSrcweir * This file is part of OpenOffice.org. 10*cdf0e10cSrcweir * 11*cdf0e10cSrcweir * OpenOffice.org is free software: you can redistribute it and/or modify 12*cdf0e10cSrcweir * it under the terms of the GNU Lesser General Public License version 3 13*cdf0e10cSrcweir * only, as published by the Free Software Foundation. 14*cdf0e10cSrcweir * 15*cdf0e10cSrcweir * OpenOffice.org is distributed in the hope that it will be useful, 16*cdf0e10cSrcweir * but WITHOUT ANY WARRANTY; without even the implied warranty of 17*cdf0e10cSrcweir * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 18*cdf0e10cSrcweir * GNU Lesser General Public License version 3 for more details 19*cdf0e10cSrcweir * (a copy is included in the LICENSE file that accompanied this code). 20*cdf0e10cSrcweir * 21*cdf0e10cSrcweir * You should have received a copy of the GNU Lesser General Public License 22*cdf0e10cSrcweir * version 3 along with OpenOffice.org. If not, see 23*cdf0e10cSrcweir * <http://www.openoffice.org/license.html> 24*cdf0e10cSrcweir * for a copy of the LGPLv3 License. 25*cdf0e10cSrcweir * 26*cdf0e10cSrcweir ************************************************************************/ 27*cdf0e10cSrcweir 28*cdf0e10cSrcweir // MARKER(update_precomp.py): autogen include statement, do not remove 29*cdf0e10cSrcweir #include "precompiled_sw.hxx" 30*cdf0e10cSrcweir #ifdef SW_DLLIMPLEMENTATION 31*cdf0e10cSrcweir #undef SW_DLLIMPLEMENTATION 32*cdf0e10cSrcweir #endif 33*cdf0e10cSrcweir 34*cdf0e10cSrcweir 35*cdf0e10cSrcweir #include <stdio.h> 36*cdf0e10cSrcweir #include <ctype.h> 37*cdf0e10cSrcweir #include <swwait.hxx> 38*cdf0e10cSrcweir #include <wrtsh.hxx> 39*cdf0e10cSrcweir #ifndef _VIEW_HXX 40*cdf0e10cSrcweir #include <view.hxx> 41*cdf0e10cSrcweir #endif 42*cdf0e10cSrcweir #include <swmodule.hxx> 43*cdf0e10cSrcweir #ifndef _GLOBALS_HRC 44*cdf0e10cSrcweir #include <globals.hrc> 45*cdf0e10cSrcweir #endif 46*cdf0e10cSrcweir #ifndef _DOCSH_HXX 47*cdf0e10cSrcweir #include <docsh.hxx> 48*cdf0e10cSrcweir #endif 49*cdf0e10cSrcweir #ifndef _PVIEW_HXX 50*cdf0e10cSrcweir #include <pview.hxx> 51*cdf0e10cSrcweir #endif 52*cdf0e10cSrcweir #include <doc.hxx> 53*cdf0e10cSrcweir #include <docstdlg.hxx> 54*cdf0e10cSrcweir #ifndef _MODCFG_HXX 55*cdf0e10cSrcweir #include <modcfg.hxx> 56*cdf0e10cSrcweir #endif 57*cdf0e10cSrcweir 58*cdf0e10cSrcweir // fuer Statistikfelder 59*cdf0e10cSrcweir #include <fldmgr.hxx> 60*cdf0e10cSrcweir #include <fldbas.hxx> 61*cdf0e10cSrcweir 62*cdf0e10cSrcweir #ifndef _DOCSTDLG_HRC 63*cdf0e10cSrcweir #include <docstdlg.hrc> 64*cdf0e10cSrcweir #endif 65*cdf0e10cSrcweir 66*cdf0e10cSrcweir 67*cdf0e10cSrcweir /*-------------------------------------------------------------------- 68*cdf0e10cSrcweir Beschreibung: Create 69*cdf0e10cSrcweir --------------------------------------------------------------------*/ 70*cdf0e10cSrcweir 71*cdf0e10cSrcweir 72*cdf0e10cSrcweir SfxTabPage * SwDocStatPage::Create(Window *pParent, const SfxItemSet &rSet) 73*cdf0e10cSrcweir { 74*cdf0e10cSrcweir return new SwDocStatPage(pParent, rSet); 75*cdf0e10cSrcweir } 76*cdf0e10cSrcweir 77*cdf0e10cSrcweir /*-------------------------------------------------------------------- 78*cdf0e10cSrcweir Beschreibung: Ctor 79*cdf0e10cSrcweir --------------------------------------------------------------------*/ 80*cdf0e10cSrcweir 81*cdf0e10cSrcweir 82*cdf0e10cSrcweir SwDocStatPage::SwDocStatPage(Window *pParent, const SfxItemSet &rSet) : 83*cdf0e10cSrcweir 84*cdf0e10cSrcweir SfxTabPage (pParent, SW_RES(TP_DOC_STAT), rSet), 85*cdf0e10cSrcweir aPageLbl (this, SW_RES( FT_PAGE )), 86*cdf0e10cSrcweir aPageNo (this, SW_RES( FT_PAGE_COUNT )), 87*cdf0e10cSrcweir aTableLbl (this, SW_RES( FT_TABLE )), 88*cdf0e10cSrcweir aTableNo (this, SW_RES( FT_TABLE_COUNT)), 89*cdf0e10cSrcweir aGrfLbl (this, SW_RES( FT_GRF )), 90*cdf0e10cSrcweir aGrfNo (this, SW_RES( FT_GRF_COUNT )), 91*cdf0e10cSrcweir aOLELbl (this, SW_RES( FT_OLE )), 92*cdf0e10cSrcweir aOLENo (this, SW_RES( FT_OLE_COUNT )), 93*cdf0e10cSrcweir aParaLbl (this, SW_RES( FT_PARA )), 94*cdf0e10cSrcweir aParaNo (this, SW_RES( FT_PARA_COUNT )), 95*cdf0e10cSrcweir aWordLbl (this, SW_RES( FT_WORD )), 96*cdf0e10cSrcweir aWordNo (this, SW_RES( FT_WORD_COUNT )), 97*cdf0e10cSrcweir aCharLbl (this, SW_RES( FT_CHAR )), 98*cdf0e10cSrcweir aCharNo (this, SW_RES( FT_CHAR_COUNT )), 99*cdf0e10cSrcweir aLineLbl (this, SW_RES( FT_LINE )), 100*cdf0e10cSrcweir aLineNo (this, SW_RES( FT_LINE_COUNT )), 101*cdf0e10cSrcweir aUpdatePB (this, SW_RES( PB_PDATE )) 102*cdf0e10cSrcweir { 103*cdf0e10cSrcweir Update(); 104*cdf0e10cSrcweir FreeResource(); 105*cdf0e10cSrcweir aUpdatePB.SetClickHdl(LINK(this, SwDocStatPage, UpdateHdl)); 106*cdf0e10cSrcweir //#111684# is the current view a page preview no SwFEShell can be found -> hide the update button 107*cdf0e10cSrcweir SwDocShell* pDocShell = (SwDocShell*) SfxObjectShell::Current(); 108*cdf0e10cSrcweir SwFEShell* pFEShell = pDocShell->GetFEShell(); 109*cdf0e10cSrcweir if(!pFEShell) 110*cdf0e10cSrcweir { 111*cdf0e10cSrcweir aUpdatePB.Show(sal_False); 112*cdf0e10cSrcweir aLineLbl.Show(sal_False); 113*cdf0e10cSrcweir aLineNo .Show(sal_False); 114*cdf0e10cSrcweir } 115*cdf0e10cSrcweir 116*cdf0e10cSrcweir } 117*cdf0e10cSrcweir 118*cdf0e10cSrcweir 119*cdf0e10cSrcweir SwDocStatPage::~SwDocStatPage() 120*cdf0e10cSrcweir { 121*cdf0e10cSrcweir } 122*cdf0e10cSrcweir 123*cdf0e10cSrcweir /*-------------------------------------------------------------------- 124*cdf0e10cSrcweir Beschreibung: ItemSet fuellen bei Aenderung 125*cdf0e10cSrcweir --------------------------------------------------------------------*/ 126*cdf0e10cSrcweir 127*cdf0e10cSrcweir 128*cdf0e10cSrcweir sal_Bool SwDocStatPage::FillItemSet(SfxItemSet & /*rSet*/) 129*cdf0e10cSrcweir { 130*cdf0e10cSrcweir return sal_False; 131*cdf0e10cSrcweir } 132*cdf0e10cSrcweir 133*cdf0e10cSrcweir /*-------------------------------------------------------------------- 134*cdf0e10cSrcweir Beschreibung: 135*cdf0e10cSrcweir --------------------------------------------------------------------*/ 136*cdf0e10cSrcweir 137*cdf0e10cSrcweir 138*cdf0e10cSrcweir void SwDocStatPage::Reset(const SfxItemSet &/*rSet*/) 139*cdf0e10cSrcweir { 140*cdf0e10cSrcweir } 141*cdf0e10cSrcweir /*------------------------------------------------------------------------ 142*cdf0e10cSrcweir Beschreibung: Aktualisieren / Setzen der Daten 143*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 144*cdf0e10cSrcweir 145*cdf0e10cSrcweir 146*cdf0e10cSrcweir void SwDocStatPage::SetData(const SwDocStat &rStat) 147*cdf0e10cSrcweir { 148*cdf0e10cSrcweir aTableNo.SetText(String::CreateFromInt32( rStat.nTbl )); 149*cdf0e10cSrcweir aGrfNo.SetText(String::CreateFromInt32( rStat.nGrf )); 150*cdf0e10cSrcweir aOLENo.SetText(String::CreateFromInt32( rStat.nOLE )); 151*cdf0e10cSrcweir aPageNo.SetText(String::CreateFromInt32( rStat.nPage )); 152*cdf0e10cSrcweir aParaNo.SetText(String::CreateFromInt32( rStat.nPara )); 153*cdf0e10cSrcweir aWordNo.SetText(String::CreateFromInt32( rStat.nWord )); 154*cdf0e10cSrcweir aCharNo.SetText(String::CreateFromInt32( rStat.nChar )); 155*cdf0e10cSrcweir } 156*cdf0e10cSrcweir 157*cdf0e10cSrcweir /*------------------------------------------------------------------------ 158*cdf0e10cSrcweir Beschreibung: Aktualisieren der Statistik 159*cdf0e10cSrcweir ------------------------------------------------------------------------*/ 160*cdf0e10cSrcweir 161*cdf0e10cSrcweir 162*cdf0e10cSrcweir void SwDocStatPage::Update() 163*cdf0e10cSrcweir { 164*cdf0e10cSrcweir SfxViewShell *pVSh = SfxViewShell::Current(); 165*cdf0e10cSrcweir ViewShell *pSh = 0; 166*cdf0e10cSrcweir if ( pVSh->ISA(SwView) ) 167*cdf0e10cSrcweir pSh = ((SwView*)pVSh)->GetWrtShellPtr(); 168*cdf0e10cSrcweir else if ( pVSh->ISA(SwPagePreView) ) 169*cdf0e10cSrcweir pSh = ((SwPagePreView*)pVSh)->GetViewShell(); 170*cdf0e10cSrcweir 171*cdf0e10cSrcweir ASSERT( pSh, "Shell not found" ); 172*cdf0e10cSrcweir 173*cdf0e10cSrcweir SwWait aWait( *pSh->GetDoc()->GetDocShell(), sal_True ); 174*cdf0e10cSrcweir pSh->StartAction(); 175*cdf0e10cSrcweir aDocStat = pSh->GetDoc()->GetDocStat(); 176*cdf0e10cSrcweir pSh->GetDoc()->UpdateDocStat( aDocStat ); 177*cdf0e10cSrcweir pSh->EndAction(); 178*cdf0e10cSrcweir 179*cdf0e10cSrcweir SetData(aDocStat); 180*cdf0e10cSrcweir } 181*cdf0e10cSrcweir 182*cdf0e10cSrcweir /*-----------------19.06.97 16.37------------------- 183*cdf0e10cSrcweir Zeilennummer aktualisieren 184*cdf0e10cSrcweir --------------------------------------------------*/ 185*cdf0e10cSrcweir IMPL_LINK( SwDocStatPage, UpdateHdl, PushButton*, EMPTYARG) 186*cdf0e10cSrcweir { 187*cdf0e10cSrcweir Update(); 188*cdf0e10cSrcweir SwDocShell* pDocShell = (SwDocShell*) SfxObjectShell::Current(); 189*cdf0e10cSrcweir SwFEShell* pFEShell = pDocShell->GetFEShell(); 190*cdf0e10cSrcweir if(pFEShell) 191*cdf0e10cSrcweir aLineNo.SetText( String::CreateFromInt32( pFEShell->GetLineCount(sal_False))); 192*cdf0e10cSrcweir //pButton->Disable(); 193*cdf0e10cSrcweir return 0; 194*cdf0e10cSrcweir } 195*cdf0e10cSrcweir 196