summaryrefslogtreecommitdiff
path: root/sc/source/ui/view/reffact.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-04-10 15:50:49 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-04-11 09:58:26 +0200
commit565a254a814a06086ac067d5c64b4557e73c9666 (patch)
treecc148ac4a4e15fa78f9861d762909895d86d7ec6 /sc/source/ui/view/reffact.cxx
parent92b25179973fce7cafa3364dc19693a5a22f4952 (diff)
weld ScNameDlg
Change-Id: I7a00dd386a1cb52e046d0f57c77fe3fdf8252bb7 Reviewed-on: https://gerrit.libreoffice.org/70548 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/ui/view/reffact.cxx')
-rw-r--r--sc/source/ui/view/reffact.cxx28
1 files changed, 26 insertions, 2 deletions
diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx
index 5b4a6044a217..483216905456 100644
--- a/sc/source/ui/view/reffact.cxx
+++ b/sc/source/ui/view/reffact.cxx
@@ -32,7 +32,7 @@
#include <scres.hrc>
#include <validate.hxx>
-SFX_IMPL_MODELESSDIALOG_WITHID(ScNameDlgWrapper, FID_DEFINE_NAME )
+SFX_IMPL_CHILDWINDOW_WITHID(ScNameDlgWrapper, FID_DEFINE_NAME)
SFX_IMPL_MODELESSDIALOG_WITHID(ScNameDefDlgWrapper, FID_ADD_NAME )
SFX_IMPL_MODELESSDIALOG_WITHID(ScSolverDlgWrapper, SID_OPENDLG_SOLVE )
SFX_IMPL_MODELESSDIALOG_WITHID(ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER )
@@ -97,7 +97,31 @@ namespace
pViewShell->GetViewFrame()->SetChildWindow( nId, false ); \
}
-IMPL_CHILD_CTOR( ScNameDlgWrapper, FID_DEFINE_NAME )
+#define IMPL_CONTROLLER_CHILD_CTOR(Class,sid) \
+ Class::Class( vcl::Window* pParentP, \
+ sal_uInt16 nId, \
+ SfxBindings* p, \
+ const SfxChildWinInfo* pInfo ) \
+ : SfxChildWindow(pParentP, nId) \
+ { \
+ /************************************************************************************/\
+ /* When a new document is creating, the SfxViewFrame may be ready, */\
+ /* But the ScTabViewShell may have not been activated yet. In this */\
+ /* situation, SfxViewShell::Current() does not get the correct shell, */\
+ /* and we should lcl_GetTabViewShell( p ) instead of SfxViewShell::Current() */\
+ /************************************************************************************/\
+ ScTabViewShell* pViewShell = lcl_GetTabViewShell( p ); \
+ if (!pViewShell) \
+ pViewShell = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); \
+ OSL_ENSURE( pViewShell, "missing view shell :-(" ); \
+ SetController( pViewShell ? \
+ pViewShell->CreateRefDialogController( p, this, pInfo, pParentP->GetFrameWeld(), sid ) : nullptr ); \
+ if (pViewShell && !GetController()) \
+ pViewShell->GetViewFrame()->SetChildWindow( nId, false ); \
+ }
+
+
+IMPL_CONTROLLER_CHILD_CTOR( ScNameDlgWrapper, FID_DEFINE_NAME )
IMPL_CHILD_CTOR( ScNameDefDlgWrapper, FID_ADD_NAME )