summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-06-14 21:56:44 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-06-22 19:28:38 +0200
commit243b5b392906042ab03800e0b5765e6f3513372c (patch)
treed82300c65829578bddbb34e37e0fb08ac544d9aa /sc
parent01cd1d68d96057624db38b9baaa6c6795353758d (diff)
weld SpellDialog
a) use EditEngine instead of TextEngine as the former can be hosted in a foreign widget b) use a SfxGrabBagItem to hold the custom spellchecking info inside the EditEngine c) in longer paragraphs the current word is now auto-scrolled into view d) rename Invalidate to InvalidateDialog Change-Id: Ic6db019c32cdfd5f354c58ee7394fdaa040b86e1 Reviewed-on: https://gerrit.libreoffice.org/74535 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/source/ui/inc/spelleng.hxx4
-rw-r--r--sc/source/ui/view/cellsh.cxx4
-rw-r--r--sc/source/ui/view/spelleng.cxx33
3 files changed, 27 insertions, 14 deletions
diff --git a/sc/source/ui/inc/spelleng.hxx b/sc/source/ui/inc/spelleng.hxx
index cec0676459a2..2add81559567 100644
--- a/sc/source/ui/inc/spelleng.hxx
+++ b/sc/source/ui/inc/spelleng.hxx
@@ -28,6 +28,8 @@ class ScDocShell;
class ScDocument;
class SfxItemPool;
+namespace weld { class Window; }
+
/** Base class for special type of edit engines, i.e. for spell checker and text conversion. */
class ScConversionEngineBase : public ScEditEngineDefaulter
{
@@ -119,7 +121,7 @@ protected:
private:
/** Returns the spelling dialog if it is open. */
- vcl::Window* GetDialogParent();
+ weld::Window* GetDialogParent();
};
/** Edit engine for text conversion. */
diff --git a/sc/source/ui/view/cellsh.cxx b/sc/source/ui/view/cellsh.cxx
index 26020a86ef4f..3d21cd96d3c3 100644
--- a/sc/source/ui/view/cellsh.cxx
+++ b/sc/source/ui/view/cellsh.cxx
@@ -1209,8 +1209,8 @@ void ScCellShell::GetState(SfxItemSet &rSet)
if ( pViewFrame && pViewFrame->HasChildWindow( nWhich ) )
{
SfxChildWindow* pChild = pViewFrame->GetChildWindow( nWhich );
- vcl::Window* pWin = ( pChild ? pChild->GetWindow() : nullptr );
- if ( pWin && pWin->IsVisible() )
+ std::shared_ptr<SfxDialogController> xController = pChild ? pChild->GetController() : nullptr;
+ if (xController && xController->getDialog()->get_visible())
{
bVisible = true;
}
diff --git a/sc/source/ui/view/spelleng.cxx b/sc/source/ui/view/spelleng.cxx
index 49c076cd420e..af1ea81d735b 100644
--- a/sc/source/ui/view/spelleng.cxx
+++ b/sc/source/ui/view/spelleng.cxx
@@ -305,10 +305,10 @@ bool ScSpellingEngine::NeedsConversion()
bool ScSpellingEngine::ShowTableWrapDialog()
{
- vcl::Window* pParent = GetDialogParent();
- ScWaitCursorOff aWaitOff( pParent );
+ weld::Window* pParent = GetDialogParent();
+ weld::WaitObject aWaitOff(pParent);
- std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr,
+ std::unique_ptr<weld::MessageDialog> xBox(Application::CreateMessageDialog(pParent,
VclMessageType::Question, VclButtonsType::YesNo,
ScResId(STR_SPELLING_BEGIN_TAB))); // "delete data?"
xBox->set_title(ScResId(STR_MSSG_DOSUBTOTALS_0));
@@ -318,26 +318,37 @@ bool ScSpellingEngine::ShowTableWrapDialog()
void ScSpellingEngine::ShowFinishDialog()
{
- vcl::Window* pParent = GetDialogParent();
- ScWaitCursorOff aWaitOff( pParent );
- std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pParent ? pParent->GetFrameWeld() : nullptr,
+ weld::Window* pParent = GetDialogParent();
+ weld::WaitObject aWaitOff(pParent);
+ std::unique_ptr<weld::MessageDialog> xInfoBox(Application::CreateMessageDialog(pParent,
VclMessageType::Info, VclButtonsType::Ok,
ScResId(STR_SPELLING_STOP_OK)));
xInfoBox->run();
}
-vcl::Window* ScSpellingEngine::GetDialogParent()
+weld::Window* ScSpellingEngine::GetDialogParent()
{
sal_uInt16 nWinId = ScSpellDialogChildWindow::GetChildWindowId();
SfxViewFrame* pViewFrm = mrViewData.GetViewShell()->GetViewFrame();
if( pViewFrm->HasChildWindow( nWinId ) )
+ {
if( SfxChildWindow* pChild = pViewFrm->GetChildWindow( nWinId ) )
- if( vcl::Window* pWin = pChild->GetWindow() )
- if( pWin->IsVisible() )
- return pWin;
+ {
+ auto xController = pChild->GetController();
+ if (xController)
+ {
+ if (weld::Window *pRet = xController->getDialog())
+ {
+ if (pRet->get_visible())
+ return pRet;
+ }
+ }
+ }
+ }
// fall back to standard dialog parent
- return ScDocShell::GetActiveDialogParent();
+ vcl::Window* pWin = ScDocShell::GetActiveDialogParent();
+ return pWin ? pWin->GetFrameWeld() : nullptr;
}
ScConversionParam::ScConversionParam( ScConversionType eConvType ) :