summaryrefslogtreecommitdiff
path: root/sw
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2018-11-02 15:38:46 +0100
committerStephan Bergmann <sbergman@redhat.com>2018-11-02 16:51:29 +0100
commit4b0db40ab4a05a0940096654e8d60ed04f0cd2e6 (patch)
treeab91ce13fccbe99ceb96c75a4987e51d3e7ecd4a /sw
parentd562ee86414c8946c3b650d6e917db3f729325d3 (diff)
Revert "weld SwWordCountFloatDlg"
This reverts commit 26c375671aa362b2f59d84645784938677ae1719. Conflicts: vcl/qt5/Qt5Frame.cxx It caused null pointer dereference during UITest_writer_tests, as seen at <https://ci.libreoffice.org//job/lo_ubsan/1090/>: > /sfx2/source/appl/childwin.cxx:654:18: runtime error: member call on null pointer of type 'vcl::Window' > #0 0x2b97d4160fa3 in SfxChildWindow::SetWorkWindow_Impl(SfxWorkWindow*) /sfx2/source/appl/childwin.cxx:654:18 > #1 0x2b97d462ab86 in SfxWorkWindow::CreateChildWin_Impl(SfxChildWin_Impl*, bool) /sfx2/source/appl/workwin.cxx:1350:9 > #2 0x2b97d463e6bb in SfxWorkWindow::ToggleChildWindow_Impl(unsigned short, bool) /sfx2/source/appl/workwin.cxx:1837:21 > #3 0x2b97d6eae94d in SfxViewFrame::ToggleChildWindow(unsigned short) /sfx2/source/view/viewfrm.cxx:3080:9 > #4 0x2b987664316d in SwView::UpdateWordCount(SfxShell*, unsigned short) /sw/source/uibase/uiview/view1.cxx:212:9 > #5 0x2b9876126a5d in SwTextShell::Execute(SfxRequest&) /sw/source/uibase/shells/textsh1.cxx:1369:9 > #6 0x2b98760a2391 in SfxStubSwTextShellExecute(SfxShell*, SfxRequest&) /workdir/SdiTarget/sw/sdi/swslots.hxx:2974:1 > #7 0x2b97d49050f6 in SfxShell::CallExec(void (*)(SfxShell*, SfxRequest&), SfxRequest&) /include/sfx2/shell.hxx:207:35 > #8 0x2b97d48c27d0 in SfxDispatcher::Call_Impl(SfxShell&, SfxSlot const&, SfxRequest&, bool) /sfx2/source/control/dispatch.cxx:353:13 > #9 0x2b97d48de12d in SfxDispatcher::Execute_(SfxShell&, SfxSlot const&, SfxRequest&, SfxCallMode) /sfx2/source/control/dispatch.cxx:854:9 > #10 0x2b97d482ea34 in SfxBindings::Execute_Impl(SfxRequest&, SfxSlot const*, SfxShell*) /sfx2/source/control/bindings.cxx:1063:9 > #11 0x2b97d4e5cead in SfxDispatchController_Impl::dispatch(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /sfx2/source/control/unoctitm.cxx:754:29 > #12 0x2b97d4e60b5e in SfxOfficeDispatch::dispatchWithNotification(com::sun::star::util::URL const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /sfx2/source/control/unoctitm.cxx:239:9 > #13 0x2b97c6c10b19 in comphelper::dispatchCommand(rtl::OUString const&, com::sun::star::uno::Sequence<com::sun::star::beans::PropertyValue> const&, com::sun::star::uno::Reference<com::sun::star::frame::XDispatchResultListener> const&) /comphelper/source/misc/dispatchcommand.cxx:60:9 > #14 0x2b980472020c in UITest::executeCommand(rtl::OUString const&) /vcl/source/uitest/uitest.cxx:22:12 [...] Change-Id: I276684a5617bfec3803b195af59c51735bfa470a
Diffstat (limited to 'sw')
-rw-r--r--sw/inc/swabstdlg.hxx4
-rw-r--r--sw/inc/viewsh.hxx14
-rw-r--r--sw/source/core/view/viewsh.cxx30
-rw-r--r--sw/source/ui/dialog/swdlgfact.cxx19
-rw-r--r--sw/source/ui/dialog/swdlgfact.hxx17
-rw-r--r--sw/source/ui/dialog/wordcountdialog.cxx114
-rw-r--r--sw/source/uibase/dialog/wordcountwrapper.cxx10
-rw-r--r--sw/source/uibase/inc/wordcountdialog.hxx41
-rw-r--r--sw/source/uibase/uiview/viewport.cxx4
-rw-r--r--sw/uiconfig/swriter/ui/wordcount.ui8
10 files changed, 140 insertions, 121 deletions
diff --git a/sw/inc/swabstdlg.hxx b/sw/inc/swabstdlg.hxx
index 99d55a84dfb5..642218f530d8 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 std::shared_ptr<SfxModelessDialogController> GetController() = 0;
+ virtual vcl::Window * GetWindow() = 0; //this method is added for return a Window type pointer
};
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, weld::Window *pParent, SfxChildWinInfo* pInfo) = 0;
+ SfxChildWindow* pChild, vcl::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 fe904ffcd36e..db92346bc587 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::Window> > mpCareDialog; ///< Avoid this window.
+ static vcl::DeleteOnDeinit< std::shared_ptr<weld::Dialog> > 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()
- { 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); }
+ 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; }
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 4f38a4d4041e..23ef8f436318 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::Window>> SwViewShell::mpCareDialog(new std::shared_ptr<weld::Window>);
+vcl::DeleteOnDeinit<std::shared_ptr<weld::Dialog>> SwViewShell::mpCareDialog(new std::shared_ptr<weld::Dialog>);
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() || GetCareDialog(*this) )
+ if ( !VisArea().IsInside( rRect ) || IsScrollMDI( this, rRect ) || GetCareWin(*this) || GetCareDialog() )
{
if ( !IsViewLocked() )
{
@@ -609,23 +609,19 @@ void SwViewShell::MakeVisible( const SwRect &rRect )
}
}
-weld::Window* SwViewShell::CareChildWin(SwViewShell const & rVSh)
+vcl::Window* SwViewShell::CareChildWin(SwViewShell const & rVSh)
{
- if (!rVSh.mpSfxViewShell)
- return nullptr;
+ if(rVSh.mpSfxViewShell)
+ {
#if HAVE_FEATURE_DESKTOP
- 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;
+ 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;
#endif
+ }
return nullptr;
}
@@ -2507,7 +2503,7 @@ void SwViewShell::SetCareWin( vcl::Window* pNew )
(*mpCareWindow.get()) = pNew;
}
-void SwViewShell::SetCareDialog(const std::shared_ptr<weld::Window>& rNew)
+void SwViewShell::SetCareDialog(const std::shared_ptr<weld::Dialog>& rNew)
{
(*mpCareDialog.get()) = rNew;
}
diff --git a/sw/source/ui/dialog/swdlgfact.cxx b/sw/source/ui/dialog/swdlgfact.cxx
index b634d18970d2..c30b671d3b29 100644
--- a/sw/source/ui/dialog/swdlgfact.cxx
+++ b/sw/source/ui/dialog/swdlgfact.cxx
@@ -87,11 +87,7 @@ using namespace ::com::sun::star;
using namespace css::frame;
using namespace css::uno;
-short AbstractSwWordCountFloatDlg_Impl::Execute()
-{
- return m_xDlg->run();
-}
-
+IMPL_ABSTDLG_BASE(AbstractSwWordCountFloatDlg_Impl);
IMPL_ABSTDLG_BASE(AbstractSwInsertAbstractDlg_Impl);
IMPL_ABSTDLG_BASE(SwAbstractSfxDialog_Impl);
@@ -699,19 +695,19 @@ vcl::Window* AbstractAuthMarkFloatDlg_Impl::GetWindow()
return static_cast<vcl::Window*>(pDlg);
}
-std::shared_ptr<SfxModelessDialogController> AbstractSwWordCountFloatDlg_Impl::GetController()
+vcl::Window* AbstractSwWordCountFloatDlg_Impl::GetWindow()
{
- return m_xDlg;
+ return static_cast<vcl::Window*>(pDlg);
}
void AbstractSwWordCountFloatDlg_Impl::UpdateCounts()
{
- m_xDlg->UpdateCounts();
+ pDlg->UpdateCounts();
}
void AbstractSwWordCountFloatDlg_Impl::SetCounts(const SwDocStat &rCurrCnt, const SwDocStat &rDocStat)
{
- m_xDlg->SetCounts(rCurrCnt, rDocStat);
+ pDlg->SetCounts(rCurrCnt, rDocStat);
}
AbstractMailMergeWizard_Impl::~AbstractMailMergeWizard_Impl()
@@ -1113,10 +1109,11 @@ VclPtr<AbstractMarkFloatDlg> SwAbstractDialogFactory_Impl::CreateAuthMarkFloatDl
VclPtr<AbstractSwWordCountFloatDlg> SwAbstractDialogFactory_Impl::CreateSwWordCountDialog(
SfxBindings* pBindings,
SfxChildWindow* pChild,
- weld::Window *pParent,
+ vcl::Window *pParent,
SfxChildWinInfo* pInfo)
{
- return VclPtr<AbstractSwWordCountFloatDlg_Impl>::Create(o3tl::make_unique<SwWordCountFloatDlg>(pBindings, pChild, pParent, pInfo));
+ VclPtr<SwWordCountFloatDlg> pDlg = VclPtr<SwWordCountFloatDlg>::Create( pBindings, pChild, pParent, pInfo );
+ return VclPtr<AbstractSwWordCountFloatDlg_Impl>::Create( pDlg );
}
VclPtr<VclAbstractDialog> SwAbstractDialogFactory_Impl::CreateIndexMarkModalDlg(
diff --git a/sw/source/ui/dialog/swdlgfact.hxx b/sw/source/ui/dialog/swdlgfact.hxx
index 14b802ef7e2d..103b04b35a02 100644
--- a/sw/source/ui/dialog/swdlgfact.hxx
+++ b/sw/source/ui/dialog/swdlgfact.hxx
@@ -74,17 +74,10 @@ bool Class::StartExecuteAsync(VclAbstractDialog::AsyncContext &rCtx) \
class SwWordCountFloatDlg;
class AbstractSwWordCountFloatDlg_Impl : public AbstractSwWordCountFloatDlg
{
-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;
+ 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
};
class AbstractSwInsertAbstractDlg_Impl : public AbstractSwInsertAbstractDlg
@@ -603,7 +596,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, weld::Window *pParent, SfxChildWinInfo* pInfo) override;
+ SfxChildWindow* pChild, vcl::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 b24767823963..cc350e6fb9c8 100644
--- a/sw/source/ui/dialog/wordcountdialog.cxx
+++ b/sw/source/ui/dialog/wordcountdialog.cxx
@@ -31,92 +31,126 @@
#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(weld::Label& rWidget, sal_uLong nValue, const LocaleDataWrapper& rLocaleData)
+ void setValue(FixedText *pWidget, sal_uLong nValue, const LocaleDataWrapper& rLocaleData)
{
- rWidget.set_label(rLocaleData.getNum(nValue, 0));
+ pWidget->SetText(rLocaleData.getNum(nValue, 0));
}
- void setDoubleValue(weld::Label& rWidget, double fValue)
+ void setDoubleValue(FixedText *pWidget, double fValue)
{
OUString sValue(OUString::number(::rtl::math::round(fValue, 1)));
- rWidget.set_label(sValue);
+ pWidget->SetText(sValue);
}
}
void SwWordCountFloatDlg::SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc)
{
- 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())
+ 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())
{
sal_Int64 nCharsPerStandardizedPage = officecfg::Office::Writer::WordCount::StandardizedPageSize::get();
- setDoubleValue(*m_xCurrentStandardizedPagesFT,
+ setDoubleValue(m_pCurrentStandardizedPagesFT,
static_cast<double>(rCurrent.nChar) / nCharsPerStandardizedPage);
- setDoubleValue(*m_xDocStandardizedPagesFT,
+ setDoubleValue(m_pDocStandardizedPagesFT,
static_cast<double>(rDoc.nChar) / nCharsPerStandardizedPage);
}
bool bShowCJK = (SvtCJKOptions().IsAnyEnabled() || rDoc.nAsianWord);
- bool bToggleCJK = m_xCurrentCjkcharsFT->get_visible() != bShowCJK;
+ bool bToggleCJK = m_pCurrentCjkcharsFT->IsVisible() != bShowCJK;
if (bToggleCJK)
{
showCJK(bShowCJK);
- m_xDialog->resize_to_request(); //force resize of dialog
+ setOptimalLayoutSize(); //force resize of dialog
}
}
void SwWordCountFloatDlg::showCJK(bool bShowCJK)
{
- m_xCurrentCjkcharsFT->show(bShowCJK);
- m_xDocCjkcharsFT->show(bShowCJK);
- m_xCjkcharsLabelFT->show(bShowCJK);
+ m_pCurrentCjkcharsFT->Show(bShowCJK);
+ m_pDocCjkcharsFT->Show(bShowCJK);
+ m_pCjkcharsLabelFT->Show(bShowCJK);
}
void SwWordCountFloatDlg::showStandardizedPages(bool bShowStandardizedPages)
{
- m_xCurrentStandardizedPagesFT->show(bShowStandardizedPages);
- m_xDocStandardizedPagesFT->show(bShowStandardizedPages);
- m_xStandardizedPagesLabelFT->show(bShowStandardizedPages);
+ m_pCurrentStandardizedPagesFT->Show(bShowStandardizedPages);
+ m_pDocStandardizedPagesFT->Show(bShowStandardizedPages);
+ m_pStandardizedPagesLabelFT->Show(bShowStandardizedPages);
}
SwWordCountFloatDlg::SwWordCountFloatDlg(SfxBindings* _pBindings,
SfxChildWindow* pChild,
- weld::Window *pParent,
+ vcl::Window *pParent,
SfxChildWinInfo const * pInfo)
- : 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"))
+ : SfxModelessDialog(_pBindings, pChild, pParent, "WordCountDialog", "modules/swriter/ui/wordcount.ui")
{
+ 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 2a205fb3bf12..090410509a0d 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->GetFrameWeld(), pInfo));
- SetController(xAbstDlg->GetController());
+ xAbstDlg.reset(pFact->CreateSwWordCountDialog(pBindings, this, pParentWindow, pInfo));
+ SetWindow(xAbstDlg->GetWindow());
}
SwWordCountWrapper::~SwWordCountWrapper()
diff --git a/sw/source/uibase/inc/wordcountdialog.hxx b/sw/source/uibase/inc/wordcountdialog.hxx
index e63ef3c07c6b..ea95266a5cac 100644
--- a/sw/source/uibase/inc/wordcountdialog.hxx
+++ b/sw/source/uibase/inc/wordcountdialog.hxx
@@ -25,32 +25,37 @@ struct SwDocStat;
#include <sfx2/childwin.hxx>
#include <swabstdlg.hxx>
-class SwWordCountFloatDlg : public SfxModelessDialogController
+class SwWordCountFloatDlg : public SfxModelessDialog
{
void SetValues(const SwDocStat& rCurrent, const SwDocStat& rDoc);
void showCJK(bool bShowCJK);
void showStandardizedPages(bool bShowStandardizedPages);
- 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_pCurrentWordFT;
+ VclPtr<FixedText> m_pCurrentCharacterFT;
+ VclPtr<FixedText> m_pCurrentCharacterExcludingSpacesFT;
+ VclPtr<FixedText> m_pCurrentCjkcharsFT;
+ VclPtr<FixedText> m_pCurrentStandardizedPagesFT;
+ 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,
- weld::Window *pParent,
- SfxChildWinInfo const * pInfo);
+ SwWordCountFloatDlg( SfxBindings* pBindings,
+ SfxChildWindow* pChild,
+ vcl::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 331309ef025a..e52c3c778940 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();
- weld::Window* pCareDialog = SwViewShell::GetCareDialog(GetWrtShell());
+ vcl::Window* pCareWn = SwViewShell::GetCareWin(GetWrtShell());
+ weld::Dialog* pCareDialog = SwViewShell::GetCareDialog();
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 6da9a2c96b8e..86595e5125cf 100644
--- a/sw/uiconfig/swriter/ui/wordcount.ui
+++ b/sw/uiconfig/swriter/ui/wordcount.ui
@@ -1,18 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.22.1 -->
+<!-- Generated with glade 3.20.2 -->
<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>
@@ -324,7 +319,6 @@
</object>
</child>
<action-widgets>
- <action-widget response="-7">close</action-widget>
<action-widget response="-11">help</action-widget>
</action-widgets>
</object>