1 /*************************************************************************
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
5 * Copyright 2008 by Sun Microsystems, Inc.
7 * OpenOffice.org - a multi-platform office productivity suite
9 * $RCSfile: docstdlg.cxx,v $
12 * This file is part of OpenOffice.org.
14 * OpenOffice.org is free software: you can redistribute it and/or modify
15 * it under the terms of the GNU Lesser General Public License version 3
16 * only, as published by the Free Software Foundation.
18 * OpenOffice.org is distributed in the hope that it will be useful,
19 * but WITHOUT ANY WARRANTY; without even the implied warranty of
20 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
21 * GNU Lesser General Public License version 3 for more details
22 * (a copy is included in the LICENSE file that accompanied this code).
24 * You should have received a copy of the GNU Lesser General Public License
25 * version 3 along with OpenOffice.org. If not, see
26 * <http://www.openoffice.org/license.html>
27 * for a copy of the LGPLv3 License.
29 ************************************************************************/
31 // MARKER(update_precomp.py): autogen include statement, do not remove
32 #include "precompiled_sw.hxx"
33 #ifdef SW_DLLIMPLEMENTATION
34 #undef SW_DLLIMPLEMENTATION
45 #include <swmodule.hxx>
47 #include <globals.hrc>
56 #include <docstdlg.hxx>
61 // fuer Statistikfelder
66 #include <docstdlg.hrc>
70 /*--------------------------------------------------------------------
72 --------------------------------------------------------------------*/
75 SfxTabPage
* SwDocStatPage::Create(Window
*pParent
, const SfxItemSet
&rSet
)
77 return new SwDocStatPage(pParent
, rSet
);
80 /*--------------------------------------------------------------------
82 --------------------------------------------------------------------*/
85 SwDocStatPage::SwDocStatPage(Window
*pParent
, const SfxItemSet
&rSet
) :
87 SfxTabPage (pParent
, SW_RES(TP_DOC_STAT
), rSet
),
89 aTableLbl (this, SW_RES( FT_TABLE
)),
90 aGrfLbl (this, SW_RES( FT_GRF
)),
91 aOLELbl (this, SW_RES( FT_OLE
)),
92 aPageLbl (this, SW_RES( FT_PAGE
)),
93 aParaLbl (this, SW_RES( FT_PARA
)),
94 aWordLbl (this, SW_RES( FT_WORD
)),
95 aCharLbl (this, SW_RES( FT_CHAR
)),
96 aLineLbl (this, SW_RES( FT_LINE
)),
98 aTableNo (this, SW_RES( FT_TABLE_COUNT
)),
99 aGrfNo (this, SW_RES( FT_GRF_COUNT
)),
100 aOLENo (this, SW_RES( FT_OLE_COUNT
)),
101 aPageNo (this, SW_RES( FT_PAGE_COUNT
)),
102 aParaNo (this, SW_RES( FT_PARA_COUNT
)),
103 aWordNo (this, SW_RES( FT_WORD_COUNT
)),
104 aCharNo (this, SW_RES( FT_CHAR_COUNT
)),
105 aLineNo (this, SW_RES( FT_LINE_COUNT
)),
106 aUpdatePB (this, SW_RES( PB_PDATE
))
110 aUpdatePB
.SetClickHdl(LINK(this, SwDocStatPage
, UpdateHdl
));
111 //#111684# is the current view a page preview no SwFEShell can be found -> hide the update button
112 SwDocShell
* pDocShell
= (SwDocShell
*) SfxObjectShell::Current();
113 SwFEShell
* pFEShell
= pDocShell
->GetFEShell();
116 aUpdatePB
.Show(FALSE
);
117 aLineLbl
.Show(FALSE
);
118 aLineNo
.Show(FALSE
);
124 SwDocStatPage::~SwDocStatPage()
128 /*--------------------------------------------------------------------
129 Beschreibung: ItemSet fuellen bei Aenderung
130 --------------------------------------------------------------------*/
133 BOOL
SwDocStatPage::FillItemSet(SfxItemSet
& /*rSet*/)
138 /*--------------------------------------------------------------------
140 --------------------------------------------------------------------*/
143 void SwDocStatPage::Reset(const SfxItemSet
&/*rSet*/)
146 /*------------------------------------------------------------------------
147 Beschreibung: Aktualisieren / Setzen der Daten
148 ------------------------------------------------------------------------*/
151 void SwDocStatPage::SetData(const SwDocStat
&rStat
)
153 aTableNo
.SetText(String::CreateFromInt32( rStat
.nTbl
));
154 aGrfNo
.SetText(String::CreateFromInt32( rStat
.nGrf
));
155 aOLENo
.SetText(String::CreateFromInt32( rStat
.nOLE
));
156 aPageNo
.SetText(String::CreateFromInt32( rStat
.nPage
));
157 aParaNo
.SetText(String::CreateFromInt32( rStat
.nPara
));
158 aWordNo
.SetText(String::CreateFromInt32( rStat
.nWord
));
159 aCharNo
.SetText(String::CreateFromInt32( rStat
.nChar
));
162 /*------------------------------------------------------------------------
163 Beschreibung: Aktualisieren der Statistik
164 ------------------------------------------------------------------------*/
167 void SwDocStatPage::Update()
169 SfxViewShell
*pVSh
= SfxViewShell::Current();
171 if ( pVSh
->ISA(SwView
) )
172 pSh
= ((SwView
*)pVSh
)->GetWrtShellPtr();
173 else if ( pVSh
->ISA(SwPagePreView
) )
174 pSh
= ((SwPagePreView
*)pVSh
)->GetViewShell();
176 ASSERT( pSh
, "Shell not found" );
178 SwWait
aWait( *pSh
->GetDoc()->GetDocShell(), TRUE
);
180 aDocStat
= pSh
->GetDoc()->GetDocStat();
181 pSh
->GetDoc()->UpdateDocStat( aDocStat
);
187 /*-----------------19.06.97 16.37-------------------
188 Zeilennummer aktualisieren
189 --------------------------------------------------*/
190 IMPL_LINK( SwDocStatPage
, UpdateHdl
, PushButton
*, EMPTYARG
)
193 SwDocShell
* pDocShell
= (SwDocShell
*) SfxObjectShell::Current();
194 SwFEShell
* pFEShell
= pDocShell
->GetFEShell();
196 aLineNo
.SetText( String::CreateFromInt32( pFEShell
->GetLineCount(FALSE
)));
197 //pButton->Disable();