Kaydet (Commit) 4b6d1715 authored tarafından Caolán McNamara's avatar Caolán McNamara

weld SwDocStatPage

Change-Id: I6ea55b01179f72ca54f86c90788b297a4dd79b9c
Reviewed-on: https://gerrit.libreoffice.org/55987
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 0dc71c7c
...@@ -36,60 +36,38 @@ ...@@ -36,60 +36,38 @@
VclPtr<SfxTabPage> SwDocStatPage::Create(TabPageParent pParent, const SfxItemSet *rSet) VclPtr<SfxTabPage> SwDocStatPage::Create(TabPageParent pParent, const SfxItemSet *rSet)
{ {
return VclPtr<SwDocStatPage>::Create(pParent.pParent, *rSet); return VclPtr<SwDocStatPage>::Create(pParent, *rSet);
} }
SwDocStatPage::SwDocStatPage(vcl::Window *pParent, const SfxItemSet &rSet) SwDocStatPage::SwDocStatPage(TabPageParent pParent, const SfxItemSet &rSet)
: SfxTabPage(pParent, "modules/swriter/ui/statisticsinfopage.ui", "StatisticsInfoPage", &rSet)
: SfxTabPage(pParent, "StatisticsInfoPage", "modules/swriter/ui/statisticsinfopage.ui", &rSet) , m_xPageNo(m_xBuilder->weld_label("nopages"))
, m_xTableNo(m_xBuilder->weld_label("notables"))
, m_xGrfNo(m_xBuilder->weld_label("nogrfs"))
, m_xOLENo(m_xBuilder->weld_label("nooles"))
, m_xParaNo(m_xBuilder->weld_label("noparas"))
, m_xWordNo(m_xBuilder->weld_label("nowords"))
, m_xCharNo(m_xBuilder->weld_label("nochars"))
, m_xCharExclSpacesNo(m_xBuilder->weld_label("nocharsexspaces"))
, m_xLineLbl(m_xBuilder->weld_label("lineft"))
, m_xLineNo(m_xBuilder->weld_label("nolines"))
, m_xUpdatePB(m_xBuilder->weld_button("update"))
{ {
get(m_pPageNo, "nopages");
get(m_pTableNo, "notables");
get(m_pGrfNo, "nogrfs");
get(m_pOLENo, "nooles");
get(m_pParaNo, "noparas");
get(m_pWordNo, "nowords");
get(m_pCharNo, "nochars");
get(m_pCharExclSpacesNo, "nocharsexspaces");
get(m_pLineLbl, "lineft");
get(m_pLineNo, "nolines");
get(m_pUpdatePB, "update");
Update(); Update();
m_pUpdatePB->SetClickHdl(LINK(this, SwDocStatPage, UpdateHdl)); m_xUpdatePB->connect_clicked(LINK(this, SwDocStatPage, UpdateHdl));
//#111684# is the current view a page preview no SwFEShell can be found -> hide the update button //#111684# is the current view a page preview no SwFEShell can be found -> hide the update button
SwDocShell* pDocShell = static_cast<SwDocShell*>( SfxObjectShell::Current() ); SwDocShell* pDocShell = static_cast<SwDocShell*>( SfxObjectShell::Current() );
SwFEShell* pFEShell = pDocShell->GetFEShell(); SwFEShell* pFEShell = pDocShell->GetFEShell();
if(!pFEShell) if(!pFEShell)
{ {
m_pUpdatePB->Show(false); m_xUpdatePB->show(false);
m_pLineLbl->Show(false); m_xLineLbl->show(false);
m_pLineNo->Show(false); m_xLineNo->show(false);
} }
} }
SwDocStatPage::~SwDocStatPage() SwDocStatPage::~SwDocStatPage()
{ {
disposeOnce();
}
void SwDocStatPage::dispose()
{
m_pPageNo.clear();
m_pTableNo.clear();
m_pGrfNo.clear();
m_pOLENo.clear();
m_pParaNo.clear();
m_pWordNo.clear();
m_pCharNo.clear();
m_pCharExclSpacesNo.clear();
m_pLineLbl.clear();
m_pLineNo.clear();
m_pUpdatePB.clear();
SfxTabPage::dispose();
} }
// Description: fill ItemSet when changed // Description: fill ItemSet when changed
...@@ -106,14 +84,14 @@ void SwDocStatPage::Reset(const SfxItemSet *) ...@@ -106,14 +84,14 @@ void SwDocStatPage::Reset(const SfxItemSet *)
void SwDocStatPage::SetData(const SwDocStat &rStat) void SwDocStatPage::SetData(const SwDocStat &rStat)
{ {
const LocaleDataWrapper& rLocaleData = GetSettings().GetUILocaleDataWrapper(); const LocaleDataWrapper& rLocaleData = GetSettings().GetUILocaleDataWrapper();
m_pTableNo->SetText(rLocaleData.getNum(rStat.nTable, 0)); m_xTableNo->set_label(rLocaleData.getNum(rStat.nTable, 0));
m_pGrfNo->SetText(rLocaleData.getNum(rStat.nGrf, 0)); m_xGrfNo->set_label(rLocaleData.getNum(rStat.nGrf, 0));
m_pOLENo->SetText(rLocaleData.getNum(rStat.nOLE, 0)); m_xOLENo->set_label(rLocaleData.getNum(rStat.nOLE, 0));
m_pPageNo->SetText(rLocaleData.getNum(rStat.nPage, 0)); m_xPageNo->set_label(rLocaleData.getNum(rStat.nPage, 0));
m_pParaNo->SetText(rLocaleData.getNum(rStat.nPara, 0)); m_xParaNo->set_label(rLocaleData.getNum(rStat.nPara, 0));
m_pWordNo->SetText(rLocaleData.getNum(rStat.nWord, 0)); m_xWordNo->set_label(rLocaleData.getNum(rStat.nWord, 0));
m_pCharNo->SetText(rLocaleData.getNum(rStat.nChar, 0)); m_xCharNo->set_label(rLocaleData.getNum(rStat.nChar, 0));
m_pCharExclSpacesNo->SetText(rLocaleData.getNum(rStat.nCharExcludingSpaces, 0)); m_xCharExclSpacesNo->set_label(rLocaleData.getNum(rStat.nCharExcludingSpaces, 0));
} }
// Description: update statistics // Description: update statistics
...@@ -139,14 +117,13 @@ void SwDocStatPage::Update() ...@@ -139,14 +117,13 @@ void SwDocStatPage::Update()
SetData(aDocStat); SetData(aDocStat);
} }
IMPL_LINK_NOARG(SwDocStatPage, UpdateHdl, Button*, void) IMPL_LINK_NOARG(SwDocStatPage, UpdateHdl, weld::Button&, void)
{ {
Update(); Update();
SwDocShell* pDocShell = static_cast<SwDocShell*>( SfxObjectShell::Current()); SwDocShell* pDocShell = static_cast<SwDocShell*>( SfxObjectShell::Current());
SwFEShell* pFEShell = pDocShell->GetFEShell(); SwFEShell* pFEShell = pDocShell->GetFEShell();
if(pFEShell) if (pFEShell)
m_pLineNo->SetText( OUString::number( pFEShell->GetLineCount())); m_xLineNo->set_label(OUString::number(pFEShell->GetLineCount()));
//pButton->Disable();
} }
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -20,18 +20,14 @@ ...@@ -20,18 +20,14 @@
#define INCLUDED_SW_SOURCE_UIBASE_INC_DOCSTDLG_HXX #define INCLUDED_SW_SOURCE_UIBASE_INC_DOCSTDLG_HXX
#include <sfx2/tabdlg.hxx> #include <sfx2/tabdlg.hxx>
#include <vcl/fixed.hxx>
#include <docstat.hxx> #include <docstat.hxx>
// DocInfo now as page // DocInfo now as page
class SwDocStatPage final : public SfxTabPage class SwDocStatPage final : public SfxTabPage
{ {
public: public:
SwDocStatPage(vcl::Window *pParent, const SfxItemSet &rSet); SwDocStatPage(TabPageParent pParent, const SfxItemSet &rSet);
virtual ~SwDocStatPage() override; virtual ~SwDocStatPage() override;
virtual void dispose() override;
static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet *rSet); static VclPtr<SfxTabPage> Create(TabPageParent pParent, const SfxItemSet *rSet);
...@@ -39,20 +35,19 @@ private: ...@@ -39,20 +35,19 @@ private:
virtual bool FillItemSet( SfxItemSet *rSet) override; virtual bool FillItemSet( SfxItemSet *rSet) override;
virtual void Reset (const SfxItemSet *rSet) override; virtual void Reset (const SfxItemSet *rSet) override;
DECL_LINK(UpdateHdl, Button*, void); DECL_LINK(UpdateHdl, weld::Button&, void);
VclPtr<FixedText> m_pPageNo; std::unique_ptr<weld::Label> m_xPageNo;
VclPtr<FixedText> m_pTableNo; std::unique_ptr<weld::Label> m_xTableNo;
VclPtr<FixedText> m_pGrfNo; std::unique_ptr<weld::Label> m_xGrfNo;
VclPtr<FixedText> m_pOLENo; std::unique_ptr<weld::Label> m_xOLENo;
VclPtr<FixedText> m_pParaNo; std::unique_ptr<weld::Label> m_xParaNo;
VclPtr<FixedText> m_pWordNo; std::unique_ptr<weld::Label> m_xWordNo;
VclPtr<FixedText> m_pCharNo; std::unique_ptr<weld::Label> m_xCharNo;
VclPtr<FixedText> m_pCharExclSpacesNo; std::unique_ptr<weld::Label> m_xCharExclSpacesNo;
std::unique_ptr<weld::Label> m_xLineLbl;
VclPtr<FixedText> m_pLineLbl; std::unique_ptr<weld::Label> m_xLineNo;
VclPtr<FixedText> m_pLineNo; std::unique_ptr<weld::Button> m_xUpdatePB;
VclPtr<PushButton> m_pUpdatePB;
SwDocStat aDocStat; SwDocStat aDocStat;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment