diff options
author | Caolán McNamara <caolanm@redhat.com> | 2018-10-04 12:41:22 +0100 |
---|---|---|
committer | Caolán McNamara <caolanm@redhat.com> | 2018-11-01 22:12:33 +0100 |
commit | 26c375671aa362b2f59d84645784938677ae1719 (patch) | |
tree | 5ea3214bf75b3d612a6760597e16ab2cc041ce29 /sw | |
parent | d611d5535b818854f9c6c6d4c144c2e5a9155a1a (diff) |
weld SwWordCountFloatDlg
enable modeless dialogs to emit a response so runAsync can be used with
them and get something called when the dialog is dismissed
Change-Id: Ie9603bcc063cefabbae635949671baf06620785d
Reviewed-on: https://gerrit.libreoffice.org/61383
Tested-by: Jenkins
Reviewed-by: Caolán McNamara <caolanm@redhat.com>
Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sw')
-rw-r--r-- | sw/inc/swabstdlg.hxx | 4 | ||||
-rw-r--r-- | sw/inc/viewsh.hxx | 14 | ||||
-rw-r--r-- | sw/source/core/view/viewsh.cxx | 30 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.cxx | 19 | ||||
-rw-r--r-- | sw/source/ui/dialog/swdlgfact.hxx | 17 | ||||
-rw-r--r-- | sw/source/ui/dialog/wordcountdialog.cxx | 114 | ||||
-rw-r--r-- | sw/source/uibase/dialog/wordcountwrapper.cxx | 10 | ||||
-rw-r--r-- | sw/source/uibase/inc/wordcountdialog.hxx | 41 | ||||
-rw-r--r-- | sw/source/uibase/uiview/viewport.cxx | 4 | ||||
-rw-r--r-- | sw/uiconfig/swriter/ui/wordcount.ui | 8 |
10 files changed, 121 insertions, 140 deletions
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx index 642218f530d8..99d55a84dfb5 100644 --- a/sw/inc/swabstdlg.hxx +++ b/sw/inc/swabstdlg.hxx @@ -200,7 +200,7 @@ protected: public: virtual void UpdateCounts() = 0; virtual void SetCounts(const SwDocStat &rCurrCnt, const SwDocStat &rDocStat) = 0; - virtual vcl::Window * GetWindow() = 0; //this method is added for return a Window type pointer + virtual std::shared_ptr<SfxModelessDialogController> GetController() = 0; }; class AbstractSwInsertAbstractDlg : public VclAbstractDialog @@ -364,7 +364,7 @@ public: virtual VclPtr<SfxAbstractDialog> CreateSwBackgroundDialog(weld::Window* pParent, const SfxItemSet& rSet) = 0; virtual VclPtr<AbstractSwWordCountFloatDlg> CreateSwWordCountDialog(SfxBindings* pBindings, - SfxChildWindow* pChild, vcl::Window *pParent, SfxChildWinInfo* pInfo) = 0; + SfxChildWindow* pChild, weld::Window *pParent, SfxChildWinInfo* pInfo) = 0; virtual VclPtr<AbstractSwInsertAbstractDlg> CreateSwInsertAbstractDlg() = 0; virtual VclPtr<SfxAbstractDialog> CreateSwAddressAbstractDlg(vcl::Window* pParent, const SfxItemSet& rSet) = 0; diff --git a/sw/inc/viewsh.hxx b/sw/inc/viewsh.hxx index db92346bc587..fe904ffcd36e 100644 --- a/sw/inc/viewsh.hxx +++ b/sw/inc/viewsh.hxx @@ -170,7 +170,7 @@ class SW_DLLPUBLIC SwViewShell : public sw::Ring<SwViewShell> protected: static ShellResource* mpShellRes; ///< Resources for the Shell. static vcl::DeleteOnDeinit< VclPtr<vcl::Window> > mpCareWindow; ///< Avoid this window. - static vcl::DeleteOnDeinit< std::shared_ptr<weld::Dialog> > mpCareDialog; ///< Avoid this window. + static vcl::DeleteOnDeinit< std::shared_ptr<weld::Window> > mpCareDialog; ///< Avoid this window. SwRect maVisArea; ///< The modern version of VisArea. rtl::Reference<SwDoc> mxDoc; ///< The document; never 0. @@ -432,12 +432,12 @@ public: static ShellResource* GetShellRes(); static void SetCareWin( vcl::Window* pNew ); - static vcl::Window* GetCareWin(SwViewShell const & rVSh) - { return (*mpCareWindow.get()) ? mpCareWindow.get()->get() : CareChildWin(rVSh); } - static vcl::Window* CareChildWin(SwViewShell const & rVSh); - static void SetCareDialog(const std::shared_ptr<weld::Dialog>& rNew); - static weld::Dialog* GetCareDialog() - { return (*mpCareDialog.get()) ? mpCareDialog.get()->get() : nullptr; } + static vcl::Window* GetCareWin() + { return (*mpCareWindow.get()) ? mpCareWindow.get()->get() : nullptr; } + static weld::Window* CareChildWin(SwViewShell const & rVSh); + static void SetCareDialog(const std::shared_ptr<weld::Window>& rNew); + static weld::Window* GetCareDialog(SwViewShell const & rVSh) + { return (*mpCareDialog.get()) ? mpCareDialog.get()->get() : CareChildWin(rVSh); } SfxViewShell *GetSfxViewShell() const { return mpSfxViewShell; } void SetSfxViewShell(SfxViewShell *pNew) { mpSfxViewShell = pNew; } diff --git a/sw/source/core/view/viewsh.cxx b/sw/source/core/view/viewsh.cxx index 23ef8f436318..4f38a4d4041e 100644 --- a/sw/source/core/view/viewsh.cxx +++ b/sw/source/core/view/viewsh.cxx @@ -93,7 +93,7 @@ bool SwViewShell::mbLstAct = false; ShellResource *SwViewShell::mpShellRes = nullptr; vcl::DeleteOnDeinit< VclPtr<vcl::Window> > SwViewShell::mpCareWindow(new VclPtr<vcl::Window>); -vcl::DeleteOnDeinit<std::shared_ptr<weld::Dialog>> SwViewShell::mpCareDialog(new std::shared_ptr<weld::Dialog>); +vcl::DeleteOnDeinit<std::shared_ptr<weld::Window>> SwViewShell::mpCareDialog(new std::shared_ptr<weld::Window>); static bool bInSizeNotify = false; @@ -581,7 +581,7 @@ const SwRect& SwViewShell::VisArea() const void SwViewShell::MakeVisible( const SwRect &rRect ) { - if ( !VisArea().IsInside( rRect ) || IsScrollMDI( this, rRect ) || GetCareWin(*this) || GetCareDialog() ) + if ( !VisArea().IsInside( rRect ) || IsScrollMDI( this, rRect ) || GetCareWin() || GetCareDialog(*this) ) { if ( !IsViewLocked() ) { @@ -609,19 +609,23 @@ void SwViewShell::MakeVisible( const SwRect &rRect ) } } -vcl::Window* SwViewShell::CareChildWin(SwViewShell const & rVSh) +weld::Window* SwViewShell::CareChildWin(SwViewShell const & rVSh) { - if(rVSh.mpSfxViewShell) - { + if (!rVSh.mpSfxViewShell) + return nullptr; #if HAVE_FEATURE_DESKTOP - const sal_uInt16 nId = SvxSearchDialogWrapper::GetChildWindowId(); - SfxViewFrame* pVFrame = rVSh.mpSfxViewShell->GetViewFrame(); - const SfxChildWindow* pChWin = pVFrame->GetChildWindow( nId ); - vcl::Window *pWin = pChWin ? pChWin->GetWindow() : nullptr; - if ( pWin && pWin->IsVisible() ) - return pWin; + const sal_uInt16 nId = SvxSearchDialogWrapper::GetChildWindowId(); + SfxViewFrame* pVFrame = rVSh.mpSfxViewShell->GetViewFrame(); + SfxChildWindow* pChWin = pVFrame->GetChildWindow( nId ); + if (!pChWin) + return nullptr; + weld::DialogController* pController = pChWin->GetController().get(); + if (!pController) + return nullptr; + weld::Window* pWin = pController->getDialog(); + if (pWin && pWin->get_visible()) + return pWin; #endif - } return nullptr; } @@ -2503,7 +2507,7 @@ void SwViewShell::SetCareWin( vcl::Window* pNew ) (*mpCareWindow.get()) = pNew; } -void SwViewShell::SetCareDialog(const std::shared_ptr<weld::Dialog>& rNew) +void SwViewShell::SetCareDialog(const std::shared_ptr<weld::Window>& rNew) { (*mpCareDialog.get()) = rNew; } diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx index c30b671d3b29..b634d18970d2 100644 --- a/sw/source/ui/dialog/swdlgfact.cxx +++ b/sw/source/ui/dialog/swdlgfact.cxx @@ -87,7 +87,11 @@ using namespace ::com::sun::star; using namespace css::frame; using namespace css::uno; -IMPL_ABSTDLG_BASE(AbstractSwWordCountFloatDlg_Impl); +short AbstractSwWordCountFloatDlg_Impl::Execute() +{ + return m_xDlg->run(); +} + IMPL_ABSTDLG_BASE(AbstractSwInsertAbstractDlg_Impl); IMPL_ABSTDLG_BASE(SwAbstractSfxDialog_Impl); @@ -695,19 +699,19 @@ vcl::Window* AbstractAuthMarkFloatDlg_Impl::GetWindow() return static_cast<vcl::Window*>(pDlg); } -vcl::Window* AbstractSwWordCountFloatDlg_Impl::GetWindow() +std::shared_ptr<SfxModelessDialogController> AbstractSwWordCountFloatDlg_Impl::GetController() { - return static_cast<vcl::Window*>(pDlg); + return m_xDlg; } void AbstractSwWordCountFloatDlg_Impl::UpdateCounts() { - pDlg->UpdateCounts(); + m_xDlg->UpdateCounts(); } void AbstractSwWordCountFloatDlg_Impl::SetCounts(const SwDocStat &rCurrCnt, const SwDocStat &rDocStat) { - pDlg->SetCounts(rCurrCnt, rDocStat); + m_xDlg->SetCounts(rCurrCnt, rDocStat); } AbstractMailMergeWizard_Impl::~AbstractMailMergeWizard_Impl() @@ -1109,11 +1113,10 @@ VclPtr<AbstractMarkFloatDlg> SwAbstractDialogFactory_Impl::CreateAuthMarkFloatDl VclPtr<AbstractSwWordCountFloatDlg> SwAbstractDialogFactory_Impl::CreateSwWordCountDialog( SfxBindings* pBindings, SfxChildWindow* pChild, - vcl::Window *pParent, + weld::Window *pParent, SfxChildWinInfo* pInfo) { - VclPtr<SwWordCountFloatDlg> pDlg = VclPtr<SwWordCountFloatDlg>::Create( pBindings, pChild, pParent, pInfo ); - return VclPtr<AbstractSwWordCountFloatDlg_Impl>::Create( pDlg ); + return VclPtr<AbstractSwWordCountFloatDlg_Impl>::Create(o3tl::make_unique<SwWordCountFloatDlg>(pBindings, pChild, pParent, pInfo)); } VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateIndexMarkModalDlg( diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx index 103b04b35a02..14b802ef7e2d 100644 --- a/sw/source/ui/dialog/swdlgfact.hxx +++ b/sw/source/ui/dialog/swdlgfact.hxx @@ -74,10 +74,17 @@ bool Class::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) \ class SwWordCountFloatDlg; class AbstractSwWordCountFloatDlg_Impl : public AbstractSwWordCountFloatDlg { - DECL_ABSTDLG_BASE(AbstractSwWordCountFloatDlg_Impl,SwWordCountFloatDlg) - virtual void UpdateCounts() override; - virtual void SetCounts(const SwDocStat &rCurrCnt, const SwDocStat &rDocStat) override; - virtual vcl::Window * GetWindow() override; //this method is added for return a Window type pointer +protected: + std::shared_ptr<SwWordCountFloatDlg> m_xDlg; +public: + explicit AbstractSwWordCountFloatDlg_Impl(std::unique_ptr<SwWordCountFloatDlg> p) + : m_xDlg(std::move(p)) + { + } + virtual short Execute() override; + virtual void UpdateCounts() override; + virtual void SetCounts(const SwDocStat &rCurrCnt, const SwDocStat &rDocStat) override; + virtual std::shared_ptr<SfxModelessDialogController> GetController() override; }; class AbstractSwInsertAbstractDlg_Impl : public AbstractSwInsertAbstractDlg @@ -596,7 +603,7 @@ public: virtual VclPtr<SfxAbstractDialog> CreateSwDropCapsDialog(weld::Window* pParent, const SfxItemSet& rSet) override; virtual VclPtr<SfxAbstractDialog> CreateSwBackgroundDialog(weld::Window* pParent, const SfxItemSet& rSet) override; virtual VclPtr<AbstractSwWordCountFloatDlg> CreateSwWordCountDialog(SfxBindings* pBindings, - SfxChildWindow* pChild, vcl::Window *pParent, SfxChildWinInfo* pInfo) override; + SfxChildWindow* pChild, weld::Window *pParent, SfxChildWinInfo* pInfo) override; virtual VclPtr<AbstractSwInsertAbstractDlg> CreateSwInsertAbstractDlg() override; virtual VclPtr<SfxAbstractDialog> CreateSwAddressAbstractDlg(vcl::Window* pParent, const SfxItemSet& rSet) override; virtual VclPtr<AbstractSwAsciiFilterDlg> CreateSwAsciiFilterDlg(weld::Window* pParent, SwDocShell& rDocSh, diff --git a/sw/source/ui/dialog/wordcountdialog.cxx b/sw/source/ui/dialog/wordcountdialog.cxx index cc350e6fb9c8..b24767823963 100644 --- a/sw/source/ui/dialog/wordcountdialog.cxx +++ b/sw/source/ui/dialog/wordcountdialog.cxx @@ -31,126 +31,92 @@ #include <unotools/localedatawrapper.hxx> #include <vcl/settings.hxx> -IMPL_STATIC_LINK_NOARG(SwWordCountFloatDlg, CloseHdl, Button*, void) -{ - SfxViewFrame* pVFrame = ::GetActiveView()->GetViewFrame(); - if (pVFrame != nullptr) - { - pVFrame->ToggleChildWindow(FN_WORDCOUNT_DIALOG); - } -} - SwWordCountFloatDlg::~SwWordCountFloatDlg() { - disposeOnce(); -} - -void SwWordCountFloatDlg::dispose() -{ SwViewShell::SetCareWin( nullptr ); - m_pCurrentWordFT.clear(); - m_pCurrentCharacterFT.clear(); - m_pCurrentCharacterExcludingSpacesFT.clear(); - m_pCurrentCjkcharsFT.clear(); - m_pCurrentStandardizedPagesFT.clear(); - m_pDocWordFT.clear(); - m_pDocCharacterFT.clear(); - m_pDocCharacterExcludingSpacesFT.clear(); - m_pDocCjkcharsFT.clear(); - m_pDocStandardizedPagesFT.clear(); - m_pCjkcharsLabelFT.clear(); - m_pStandardizedPagesLabelFT.clear(); - m_pClosePB.clear(); - SfxModelessDialog::dispose(); } namespace { - void setValue(FixedText *pWidget, sal_uLong nValue, const LocaleDataWrapper& rLocaleData) + void setValue(weld::Label& rWidget, sal_uLong nValue, const LocaleDataWrapper& rLocaleData) { - pWidget->SetText(rLocaleData.getNum(nValue, 0)); + rWidget.set_label(rLocaleData.getNum(nValue, 0)); } - void setDoubleValue(FixedText *pWidget, double fValue) + void setDoubleValue(weld::Label& rWidget, double fValue) { OUString sValue(OUString::number(::rtl::math::round(fValue, 1))); - pWidget->SetText(sValue); + rWidget.set_label(sValue); } } void SwWordCountFloatDlg::SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc) { - const LocaleDataWrapper& rLocaleData = GetSettings().GetUILocaleDataWrapper(); - setValue(m_pCurrentWordFT, rCurrent.nWord, rLocaleData); - setValue(m_pCurrentCharacterFT, rCurrent.nChar, rLocaleData); - setValue(m_pCurrentCharacterExcludingSpacesFT, rCurrent.nCharExcludingSpaces, rLocaleData); - setValue(m_pCurrentCjkcharsFT, rCurrent.nAsianWord, rLocaleData); - setValue(m_pDocWordFT, rDoc.nWord, rLocaleData); - setValue(m_pDocCharacterFT, rDoc.nChar, rLocaleData); - setValue(m_pDocCharacterExcludingSpacesFT, rDoc.nCharExcludingSpaces, rLocaleData); - setValue(m_pDocCjkcharsFT, rDoc.nAsianWord, rLocaleData); - - if (m_pStandardizedPagesLabelFT->IsVisible()) + const LocaleDataWrapper& rLocaleData = Application::GetSettings().GetUILocaleDataWrapper(); + setValue(*m_xCurrentWordFT, rCurrent.nWord, rLocaleData); + setValue(*m_xCurrentCharacterFT, rCurrent.nChar, rLocaleData); + setValue(*m_xCurrentCharacterExcludingSpacesFT, rCurrent.nCharExcludingSpaces, rLocaleData); + setValue(*m_xCurrentCjkcharsFT, rCurrent.nAsianWord, rLocaleData); + setValue(*m_xDocWordFT, rDoc.nWord, rLocaleData); + setValue(*m_xDocCharacterFT, rDoc.nChar, rLocaleData); + setValue(*m_xDocCharacterExcludingSpacesFT, rDoc.nCharExcludingSpaces, rLocaleData); + setValue(*m_xDocCjkcharsFT, rDoc.nAsianWord, rLocaleData); + + if (m_xStandardizedPagesLabelFT->get_visible()) { sal_Int64 nCharsPerStandardizedPage = officecfg::Office::Writer::WordCount::StandardizedPageSize::get(); - setDoubleValue(m_pCurrentStandardizedPagesFT, + setDoubleValue(*m_xCurrentStandardizedPagesFT, static_cast<double>(rCurrent.nChar) / nCharsPerStandardizedPage); - setDoubleValue(m_pDocStandardizedPagesFT, + setDoubleValue(*m_xDocStandardizedPagesFT, static_cast<double>(rDoc.nChar) / nCharsPerStandardizedPage); } bool bShowCJK = (SvtCJKOptions().IsAnyEnabled() || rDoc.nAsianWord); - bool bToggleCJK = m_pCurrentCjkcharsFT->IsVisible() != bShowCJK; + bool bToggleCJK = m_xCurrentCjkcharsFT->get_visible() != bShowCJK; if (bToggleCJK) { showCJK(bShowCJK); - setOptimalLayoutSize(); //force resize of dialog + m_xDialog->resize_to_request(); //force resize of dialog } } void SwWordCountFloatDlg::showCJK(bool bShowCJK) { - m_pCurrentCjkcharsFT->Show(bShowCJK); - m_pDocCjkcharsFT->Show(bShowCJK); - m_pCjkcharsLabelFT->Show(bShowCJK); + m_xCurrentCjkcharsFT->show(bShowCJK); + m_xDocCjkcharsFT->show(bShowCJK); + m_xCjkcharsLabelFT->show(bShowCJK); } void SwWordCountFloatDlg::showStandardizedPages(bool bShowStandardizedPages) { - m_pCurrentStandardizedPagesFT->Show(bShowStandardizedPages); - m_pDocStandardizedPagesFT->Show(bShowStandardizedPages); - m_pStandardizedPagesLabelFT->Show(bShowStandardizedPages); + m_xCurrentStandardizedPagesFT->show(bShowStandardizedPages); + m_xDocStandardizedPagesFT->show(bShowStandardizedPages); + m_xStandardizedPagesLabelFT->show(bShowStandardizedPages); } SwWordCountFloatDlg::SwWordCountFloatDlg(SfxBindings* _pBindings, SfxChildWindow* pChild, - vcl::Window *pParent, + weld::Window *pParent, SfxChildWinInfo const * pInfo) - : SfxModelessDialog(_pBindings, pChild, pParent, "WordCountDialog", "modules/swriter/ui/wordcount.ui") + : SfxModelessDialogController(_pBindings, pChild, pParent, "modules/swriter/ui/wordcount.ui", "WordCountDialog") + , m_xCurrentWordFT(m_xBuilder->weld_label("selectwords")) + , m_xCurrentCharacterFT(m_xBuilder->weld_label("selectchars")) + , m_xCurrentCharacterExcludingSpacesFT(m_xBuilder->weld_label("selectcharsnospaces")) + , m_xCurrentCjkcharsFT(m_xBuilder->weld_label("selectcjkchars")) + , m_xCurrentStandardizedPagesFT(m_xBuilder->weld_label("selectstandardizedpages")) + , m_xDocWordFT(m_xBuilder->weld_label("docwords")) + , m_xDocCharacterFT(m_xBuilder->weld_label("docchars")) + , m_xDocCharacterExcludingSpacesFT(m_xBuilder->weld_label("doccharsnospaces")) + , m_xDocCjkcharsFT(m_xBuilder->weld_label("doccjkchars")) + , m_xDocStandardizedPagesFT(m_xBuilder->weld_label("docstandardizedpages")) + , m_xCjkcharsLabelFT(m_xBuilder->weld_label("cjkcharsft")) + , m_xStandardizedPagesLabelFT(m_xBuilder->weld_label("standardizedpages")) + , m_xClosePB(m_xBuilder->weld_button("close")) { - get(m_pCurrentWordFT, "selectwords"); - get(m_pCurrentCharacterFT, "selectchars"); - get(m_pCurrentCharacterExcludingSpacesFT, "selectcharsnospaces"); - get(m_pCurrentCjkcharsFT, "selectcjkchars"); - get(m_pCurrentStandardizedPagesFT, "selectstandardizedpages"); - - get(m_pDocWordFT, "docwords"); - get(m_pDocCharacterFT, "docchars"); - get(m_pDocCharacterExcludingSpacesFT, "doccharsnospaces"); - get(m_pDocCjkcharsFT, "doccjkchars"); - get(m_pDocStandardizedPagesFT, "docstandardizedpages"); - - get(m_pCjkcharsLabelFT, "cjkcharsft"); - get(m_pStandardizedPagesLabelFT, "standardizedpages"); - - get(m_pClosePB, "close"); - showCJK(SvtCJKOptions().IsAnyEnabled()); showStandardizedPages(officecfg::Office::Writer::WordCount::ShowStandardizedPageCount::get()); Initialize(pInfo); - - m_pClosePB->SetClickHdl(LINK(this, SwWordCountFloatDlg, CloseHdl)); } void SwWordCountFloatDlg::UpdateCounts() diff --git a/sw/source/uibase/dialog/wordcountwrapper.cxx b/sw/source/uibase/dialog/wordcountwrapper.cxx index 090410509a0d..2a205fb3bf12 100644 --- a/sw/source/uibase/dialog/wordcountwrapper.cxx +++ b/sw/source/uibase/dialog/wordcountwrapper.cxx @@ -14,15 +14,15 @@ SFX_IMPL_CHILDWINDOW_WITHID(SwWordCountWrapper, FN_WORDCOUNT_DIALOG) -SwWordCountWrapper::SwWordCountWrapper( vcl::Window *pParentWindow, +SwWordCountWrapper::SwWordCountWrapper(vcl::Window *pParentWindow, sal_uInt16 nId, SfxBindings* pBindings, - SfxChildWinInfo* pInfo ) : - SfxChildWindow(pParentWindow, nId) + SfxChildWinInfo* pInfo ) + : SfxChildWindow(pParentWindow, nId) { SwAbstractDialogFactory* pFact = SwAbstractDialogFactory::Create(); - xAbstDlg.reset(pFact->CreateSwWordCountDialog(pBindings, this, pParentWindow, pInfo)); - SetWindow(xAbstDlg->GetWindow()); + xAbstDlg.reset(pFact->CreateSwWordCountDialog(pBindings, this, pParentWindow->GetFrameWeld(), pInfo)); + SetController(xAbstDlg->GetController()); } SwWordCountWrapper::~SwWordCountWrapper() diff --git a/sw/source/uibase/inc/wordcountdialog.hxx b/sw/source/uibase/inc/wordcountdialog.hxx index ea95266a5cac..e63ef3c07c6b 100644 --- a/sw/source/uibase/inc/wordcountdialog.hxx +++ b/sw/source/uibase/inc/wordcountdialog.hxx @@ -25,37 +25,32 @@ struct SwDocStat; #include <sfx2/childwin.hxx> #include <swabstdlg.hxx> -class SwWordCountFloatDlg : public SfxModelessDialog +class SwWordCountFloatDlg : public SfxModelessDialogController { void SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc); void showCJK(bool bShowCJK); void showStandardizedPages(bool bShowStandardizedPages); - VclPtr<FixedText> m_pCurrentWordFT; - VclPtr<FixedText> m_pCurrentCharacterFT; - VclPtr<FixedText> m_pCurrentCharacterExcludingSpacesFT; - VclPtr<FixedText> m_pCurrentCjkcharsFT; - VclPtr<FixedText> m_pCurrentStandardizedPagesFT; + std::unique_ptr<weld::Label> m_xCurrentWordFT; + std::unique_ptr<weld::Label> m_xCurrentCharacterFT; + std::unique_ptr<weld::Label> m_xCurrentCharacterExcludingSpacesFT; + std::unique_ptr<weld::Label> m_xCurrentCjkcharsFT; + std::unique_ptr<weld::Label> m_xCurrentStandardizedPagesFT; + std::unique_ptr<weld::Label> m_xDocWordFT; + std::unique_ptr<weld::Label> m_xDocCharacterFT; + std::unique_ptr<weld::Label> m_xDocCharacterExcludingSpacesFT; + std::unique_ptr<weld::Label> m_xDocCjkcharsFT; + std::unique_ptr<weld::Label> m_xDocStandardizedPagesFT; + std::unique_ptr<weld::Label> m_xCjkcharsLabelFT; + std::unique_ptr<weld::Label> m_xStandardizedPagesLabelFT; + std::unique_ptr<weld::Button> m_xClosePB; - VclPtr<FixedText> m_pDocWordFT; - VclPtr<FixedText> m_pDocCharacterFT; - VclPtr<FixedText> m_pDocCharacterExcludingSpacesFT; - VclPtr<FixedText> m_pDocCjkcharsFT; - VclPtr<FixedText> m_pDocStandardizedPagesFT; - - VclPtr<FixedText> m_pCjkcharsLabelFT; - VclPtr<FixedText> m_pStandardizedPagesLabelFT; - - VclPtr<CloseButton> m_pClosePB; - - DECL_STATIC_LINK( SwWordCountFloatDlg, CloseHdl, Button*, void ); public: - SwWordCountFloatDlg( SfxBindings* pBindings, - SfxChildWindow* pChild, - vcl::Window *pParent, - SfxChildWinInfo const * pInfo); + SwWordCountFloatDlg(SfxBindings* pBindings, + SfxChildWindow* pChild, + weld::Window *pParent, + SfxChildWinInfo const * pInfo); virtual ~SwWordCountFloatDlg() override; - virtual void dispose() override; void UpdateCounts(); void SetCounts(const SwDocStat &rCurrCnt, const SwDocStat &rDocStat); diff --git a/sw/source/uibase/uiview/viewport.cxx b/sw/source/uibase/uiview/viewport.cxx index e52c3c778940..331309ef025a 100644 --- a/sw/source/uibase/uiview/viewport.cxx +++ b/sw/source/uibase/uiview/viewport.cxx @@ -403,8 +403,8 @@ void SwView::Scroll( const tools::Rectangle &rRect, sal_uInt16 nRangeX, sal_uInt tools::Rectangle aOldVisArea( m_aVisArea ); long nDiffY = 0; - vcl::Window* pCareWn = SwViewShell::GetCareWin(GetWrtShell()); - weld::Dialog* pCareDialog = SwViewShell::GetCareDialog(); + vcl::Window* pCareWn = SwViewShell::GetCareWin(); + weld::Window* pCareDialog = SwViewShell::GetCareDialog(GetWrtShell()); if (pCareWn || pCareDialog) { int x, y, width, height; diff --git a/sw/uiconfig/swriter/ui/wordcount.ui b/sw/uiconfig/swriter/ui/wordcount.ui index 86595e5125cf..6da9a2c96b8e 100644 --- a/sw/uiconfig/swriter/ui/wordcount.ui +++ b/sw/uiconfig/swriter/ui/wordcount.ui @@ -1,13 +1,18 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.2 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sw"> <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="WordCountDialog"> <property name="can_focus">False</property> <property name="border_width">6</property> <property name="title" translatable="yes" context="wordcount|WordCountDialog">Word Count</property> + <property name="default_width">0</property> + <property name="default_height">0</property> <property name="destroy_with_parent">True</property> <property name="type_hint">dialog</property> + <child> + <placeholder/> + </child> <child internal-child="vbox"> <object class="GtkBox" id="dialog-vbox1"> <property name="can_focus">False</property> @@ -319,6 +324,7 @@ </object> </child> <action-widgets> + <action-widget response="-7">close</action-widget> <action-widget response="-11">help</action-widget> </action-widgets> </object> |