summaryrefslogtreecommitdiff
path: root/sc/source/ui/view
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-05-07 12:27:43 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-05-11 18:34:23 +0200
commit492b0d5d076d38234fea4e4e7c5dbec578296fd2 (patch)
tree47b4a17120d7d3c71bf7674b45768f38b761e360 /sc/source/ui/view
parentacd290431fd39ed0602e057e036326b46a99f7a8 (diff)
weld conditional formatting
Change-Id: Ia9c99a17d5a95d67a412cfde959192c99caa70be Reviewed-on: https://gerrit.libreoffice.org/71956 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')
-rw-r--r--sc/source/ui/view/formatsh.cxx10
-rw-r--r--sc/source/ui/view/reffact.cxx43
-rw-r--r--sc/source/ui/view/tabvwshc.cxx91
3 files changed, 42 insertions, 102 deletions
diff --git a/sc/source/ui/view/formatsh.cxx b/sc/source/ui/view/formatsh.cxx
index 03fb29f44555..f718589e0768 100644
--- a/sc/source/ui/view/formatsh.cxx
+++ b/sc/source/ui/view/formatsh.cxx
@@ -434,7 +434,10 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
aStyleName = static_cast<const SfxStringItem*>(pNameItem)->GetValue();
else if ( nSlotId == SID_STYLE_NEW_BY_EXAMPLE )
{
- SfxNewStyleDlg aDlg(pTabViewShell->GetFrameWeld(), *pStylePool);
+ weld::Window* pDialogParent = rReq.GetFrameWeld();
+ if (!pDialogParent)
+ pDialogParent = pTabViewShell->GetFrameWeld();
+ SfxNewStyleDlg aDlg(pDialogParent, *pStylePool);
if (aDlg.run() != RET_OK)
return;
aStyleName = aDlg.GetName();
@@ -848,7 +851,10 @@ void ScFormatShell::ExecuteStyle( SfxRequest& rReq )
ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
- pDlg.disposeAndReset(pFact->CreateScStyleDlg(pTabViewShell->GetFrameWeld(), *pStyleSheet, bPage));
+ weld::Window* pDialogParent = rReq.GetFrameWeld();
+ if (!pDialogParent)
+ pDialogParent = pTabViewShell->GetFrameWeld();
+ pDlg.disposeAndReset(pFact->CreateScStyleDlg(pDialogParent, *pStyleSheet, bPage));
short nResult = pDlg->Execute();
pTabViewShell->SetInFormatDialog(false);
diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx
index b26ad4a95143..2583a31e4eae 100644
--- a/sc/source/ui/view/reffact.cxx
+++ b/sc/source/ui/view/reffact.cxx
@@ -38,18 +38,18 @@ SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScSolverDlgWrapper, SID_OPENDLG_SOLVE)
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScOptSolverDlgWrapper, SID_OPENDLG_OPTSOLVER)
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScXMLSourceDlgWrapper, SID_MANAGE_XML_SOURCE)
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScPivotLayoutWrapper, SID_OPENDLG_PIVOTTABLE)
-SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScTabOpDlgWrapper, SID_OPENDLG_TABOP )
-SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScFilterDlgWrapper, SID_FILTER )
-SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScSpecialFilterDlgWrapper, SID_SPECIAL_FILTER )
-SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScDbNameDlgWrapper, SID_DEFINE_DBNAME )
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScTabOpDlgWrapper, SID_OPENDLG_TABOP)
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScFilterDlgWrapper, SID_FILTER)
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScSpecialFilterDlgWrapper, SID_SPECIAL_FILTER)
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScDbNameDlgWrapper, SID_DEFINE_DBNAME)
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScConsolidateDlgWrapper, SID_OPENDLG_CONSOLIDATE)
-SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScPrintAreasDlgWrapper, SID_OPENDLG_EDIT_PRINTAREA )
-SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScColRowNameRangesDlgWrapper, SID_DEFINE_COLROWNAMERANGES )
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScPrintAreasDlgWrapper, SID_OPENDLG_EDIT_PRINTAREA)
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScColRowNameRangesDlgWrapper, SID_DEFINE_COLROWNAMERANGES)
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScFormulaDlgWrapper, SID_OPENDLG_FUNCTION)
SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScAcceptChgDlgWrapper, FID_CHG_ACCEPT)
-SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScHighlightChgDlgWrapper, FID_CHG_SHOW )
-SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScSimpleRefDlgWrapper, WID_SIMPLE_REF )
-SFX_IMPL_MODELESSDIALOG_WITHID(ScCondFormatDlgWrapper, WID_CONDFRMT_REF )
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScHighlightChgDlgWrapper, FID_CHG_SHOW)
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScSimpleRefDlgWrapper, WID_SIMPLE_REF)
+SFX_IMPL_MODELESSDIALOGCONTOLLER_WITHID(ScCondFormatDlgWrapper, WID_CONDFRMT_REF)
SFX_IMPL_CHILDWINDOW_WITHID(ScValidityRefChildWin, SID_VALIDITY_REFERENCE)
@@ -64,29 +64,6 @@ namespace
ScTabViewShell* lcl_GetTabViewShell( const SfxBindings* pBindings );
}
-#define IMPL_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 :-(" ); \
- SetWindow( pViewShell ? \
- pViewShell->CreateRefDialog( p, this, pInfo, pParentP, sid ) : nullptr ); \
- if (pViewShell && !GetWindow()) \
- pViewShell->GetViewFrame()->SetChildWindow( nId, false ); \
- }
-
#define IMPL_CONTROLLER_CHILD_CTOR(Class,sid) \
Class::Class( vcl::Window* pParentP, \
sal_uInt16 nId, \
@@ -316,6 +293,6 @@ ScValidityRefChildWin::~ScValidityRefChildWin()
SetController(nullptr);
}
-IMPL_CHILD_CTOR( ScCondFormatDlgWrapper, WID_CONDFRMT_REF )
+IMPL_CONTROLLER_CHILD_CTOR( ScCondFormatDlgWrapper, WID_CONDFRMT_REF )
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/view/tabvwshc.cxx b/sc/source/ui/view/tabvwshc.cxx
index 3ff4ff52d4e4..939a7224615d 100644
--- a/sc/source/ui/view/tabvwshc.cxx
+++ b/sc/source/ui/view/tabvwshc.cxx
@@ -115,73 +115,6 @@ void ScTabViewShell::SwitchBetweenRefDialogs(SfxModelessDialogController* pDialo
}
}
-VclPtr<SfxModelessDialog> ScTabViewShell::CreateRefDialog(
- SfxBindings* pB, SfxChildWindow* pCW,
- const SfxChildWinInfo* pInfo,
- vcl::Window* pParent, sal_uInt16 nSlotId )
-{
- // only open dialog when called through ScModule::SetRefDialog,
- // so that it does not re appear for instance after a crash (#42341#).
-
- if ( SC_MOD()->GetCurRefDlgId() != nSlotId )
- return nullptr;
-
- if ( nCurRefDlgId != nSlotId )
- {
- // the dialog has been opened in a different view
- // -> lock the dispatcher for this view (modal mode)
-
- GetViewData().GetDispatcher().Lock( true ); // lock is reset when closing dialog
- return nullptr;
- }
-
- VclPtr<SfxModelessDialog> pResult;
-
- if(pCW)
- pCW->SetHideNotDelete(true);
-
- switch( nSlotId )
- {
- case WID_CONDFRMT_REF:
- {
- bool bFound = false;
- const ScCondFormatDlgItem* pDlgItem = nullptr;
- // Get the pool item stored by Conditional Format Manager Dialog.
- const SfxPoolItem* pItem = nullptr;
- auto itemsRange = GetPool().GetItemSurrogates(SCITEM_CONDFORMATDLGDATA);
- if (itemsRange.begin() != itemsRange.end())
- {
- pItem = *itemsRange.begin();
- pDlgItem = static_cast<const ScCondFormatDlgItem*>(pItem);
- bFound = true;
- }
-
- ScViewData& rViewData = GetViewData();
- rViewData.SetRefTabNo( rViewData.GetTabNo() );
-
- pResult = VclPtr<ScCondFormatDlg>::Create( pB, pCW, pParent, &rViewData, pDlgItem );
-
- // Remove the pool item stored by Conditional Format Manager Dialog.
- if ( bFound && pItem )
- GetPool().Remove( *pItem );
- }
- break;
- }
-
- if (pResult)
- {
- // the dialogs are always displayed with the option button collapsed,
- // the size has to be carried over initialize
- // (or store the option status !!!)
-
- Size aSize = pResult->GetSizePixel();
- pResult->Initialize( pInfo );
- pResult->SetSizePixel(aSize);
- }
-
- return pResult;
-}
-
std::unique_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogController(
SfxBindings* pB, SfxChildWindow* pCW,
const SfxChildWinInfo* pInfo,
@@ -473,6 +406,30 @@ std::unique_ptr<SfxModelessDialogController> ScTabViewShell::CreateRefDialogCont
xResult.reset(new ScFormulaDlg(pB, pCW, pParent, &GetViewData(),ScGlobal::GetStarCalcFunctionMgr()));
break;
}
+ case WID_CONDFRMT_REF:
+ {
+ bool bFound = false;
+ const ScCondFormatDlgItem* pDlgItem = nullptr;
+ // Get the pool item stored by Conditional Format Manager Dialog.
+ const SfxPoolItem* pItem = nullptr;
+ auto itemsRange = GetPool().GetItemSurrogates(SCITEM_CONDFORMATDLGDATA);
+ if (itemsRange.begin() != itemsRange.end())
+ {
+ pItem = *itemsRange.begin();
+ pDlgItem = static_cast<const ScCondFormatDlgItem*>(pItem);
+ bFound = true;
+ }
+
+ ScViewData& rViewData = GetViewData();
+ rViewData.SetRefTabNo( rViewData.GetTabNo() );
+
+ xResult.reset(new ScCondFormatDlg(pB, pCW, pParent, &rViewData, pDlgItem));
+
+ // Remove the pool item stored by Conditional Format Manager Dialog.
+ if ( bFound && pItem )
+ GetPool().Remove( *pItem );
+ break;
+ }
}
if (xResult)