diff options
-rw-r--r-- | extras/source/glade/libreoffice-catalog.xml.in | 4 | ||||
-rw-r--r-- | formula/source/ui/dlg/funcutl.cxx | 1 | ||||
-rw-r--r-- | include/formula/funcutl.hxx | 2 | ||||
-rw-r--r-- | sc/inc/scmod.hxx | 11 | ||||
-rw-r--r-- | sc/source/ui/app/scmod.cxx | 36 | ||||
-rw-r--r-- | sc/source/ui/dbgui/validate.cxx | 397 | ||||
-rw-r--r-- | sc/source/ui/inc/anyrefdg.hxx | 70 | ||||
-rw-r--r-- | sc/source/ui/inc/reffact.hxx | 1 | ||||
-rw-r--r-- | sc/source/ui/inc/validate.hxx | 133 | ||||
-rw-r--r-- | sc/source/ui/miscdlgs/anyrefdg.cxx | 6 | ||||
-rw-r--r-- | sc/source/ui/view/cellsh2.cxx | 29 | ||||
-rw-r--r-- | sc/source/ui/view/reffact.cxx | 31 | ||||
-rw-r--r-- | sc/uiconfig/scalc/ui/validationcriteriapage.ui | 140 | ||||
-rw-r--r-- | sc/uiconfig/scalc/ui/validationdialog.ui | 104 | ||||
-rwxr-xr-x | solenv/bin/native-code.py | 1 | ||||
-rw-r--r-- | solenv/sanitizers/ui/modules/scalc.suppr | 7 | ||||
-rw-r--r-- | vcl/unx/gtk3/gtk3gtkinst.cxx | 36 |
17 files changed, 502 insertions, 507 deletions
diff --git a/extras/source/glade/libreoffice-catalog.xml.in b/extras/source/glade/libreoffice-catalog.xml.in index 0c2957caa44b..797dcfc4a753 100644 --- a/extras/source/glade/libreoffice-catalog.xml.in +++ b/extras/source/glade/libreoffice-catalog.xml.in @@ -290,10 +290,6 @@ generic-name="Reference Button" parent="GtkButton" icon-name="widget-gtk-button"/> - <glade-widget-class title="Extended Reference Button" name="scuilo-ScRefButtonEx" - generic-name="Extended Reference Button" parent="foruilo-RefButton" - icon-name="widget-gtk-button"/> - <glade-widget-class title="Reference Edit" name="foruilo-RefEdit" generic-name="Reference Edit" parent="GtkEntry" icon-name="widget-gtk-textentry"/> diff --git a/formula/source/ui/dlg/funcutl.cxx b/formula/source/ui/dlg/funcutl.cxx index 47c3d408d63e..698afeab405c 100644 --- a/formula/source/ui/dlg/funcutl.cxx +++ b/formula/source/ui/dlg/funcutl.cxx @@ -733,6 +733,7 @@ void WeldRefButton::SetReferences( IControlReferenceHandler* pDlg, WeldRefEdit* IMPL_LINK_NOARG(WeldRefButton, Click, weld::Button&, void) { + maClickHdl.Call(*this); if( pAnyRefDlg ) pAnyRefDlg->ToggleCollapsed( pRefEdit, this ); } diff --git a/include/formula/funcutl.hxx b/include/formula/funcutl.hxx index 3654d9ebd966..df1d8cb25897 100644 --- a/include/formula/funcutl.hxx +++ b/include/formula/funcutl.hxx @@ -219,6 +219,7 @@ private: Link<WeldRefButton&,void> maGetFocusHdl; Link<WeldRefButton&,void> maLoseFocusHdl; Link<weld::Widget&,bool> maActivateHdl; + Link<WeldRefButton&,void> maClickHdl; protected: DECL_LINK(Click, weld::Button&, void); @@ -240,6 +241,7 @@ public: void SetGetFocusHdl(const Link<WeldRefButton&,void>& rLink) { maGetFocusHdl = rLink; } void SetLoseFocusHdl(const Link<WeldRefButton&,void>& rLink) { maLoseFocusHdl = rLink; } void SetActivateHdl(const Link<weld::Widget&,bool>& rLink) { maActivateHdl = rLink; } + void SetClickHdl(const Link<WeldRefButton&,void>& rLink) { maClickHdl = rLink; } }; diff --git a/sc/inc/scmod.hxx b/sc/inc/scmod.hxx index 2a3fbc04b748..5b4e519fd693 100644 --- a/sc/inc/scmod.hxx +++ b/sc/inc/scmod.hxx @@ -75,7 +75,7 @@ class ScSelectionTransferObj; class ScFormEditData; class ScMarkData; struct ScDragData; -class SfxModelessDialogController; +class SfxDialogController; class ScModule: public SfxModule, public SfxListener, public utl::ConfigurationListener { @@ -109,7 +109,8 @@ class ScModule: public SfxModule, public SfxListener, public utl::ConfigurationL bool m_bIsInSharedDocSaving:1; std::map<sal_uInt16, std::vector<VclPtr<vcl::Window> > > m_mapRefWindow; - std::map<sal_uInt16, std::vector<SfxModelessDialogController*>> m_mapRefController; + // a way to find existing Dialogs for a given parent Window of the slot type + std::map<sal_uInt16, std::vector<std::pair<std::shared_ptr<SfxDialogController>, weld::Window*>>> m_mapRefController; css::uno::Reference< ooo::vba::XSinkCaller > mxAutomationApplicationEventsCaller; @@ -250,10 +251,10 @@ public: SC_DLLPUBLIC void RegisterRefWindow( sal_uInt16 nSlotId, vcl::Window *pWnd ); SC_DLLPUBLIC void UnregisterRefWindow( sal_uInt16 nSlotId, vcl::Window *pWnd ); - SC_DLLPUBLIC vcl::Window * Find1RefWindow( sal_uInt16 nSlotId, vcl::Window *pWndAncestor ); - SC_DLLPUBLIC void RegisterRefController( sal_uInt16 nSlotId, SfxModelessDialogController *pWnd ); - SC_DLLPUBLIC void UnregisterRefController( sal_uInt16 nSlotId, SfxModelessDialogController *pWnd ); + SC_DLLPUBLIC void RegisterRefController(sal_uInt16 nSlotId, std::shared_ptr<SfxDialogController>& rWnd, weld::Window* pWndAncestor); + SC_DLLPUBLIC void UnregisterRefController(sal_uInt16 nSlotId, std::shared_ptr<SfxDialogController>& rWnd); + SC_DLLPUBLIC std::shared_ptr<SfxDialogController> Find1RefWindow(sal_uInt16 nSlotId, weld::Window *pWndAncestor); SC_DLLPUBLIC void RegisterAutomationApplicationEventsCaller(css::uno::Reference< ooo::vba::XSinkCaller > const& xCaller); SC_DLLPUBLIC void CallAutomationApplicationEventSinks(const OUString& Method, css::uno::Sequence< css::uno::Any >& Arguments); diff --git a/sc/source/ui/app/scmod.cxx b/sc/source/ui/app/scmod.cxx index 381c27501d07..c701866a66d4 100644 --- a/sc/source/ui/app/scmod.cxx +++ b/sc/source/ui/app/scmod.cxx @@ -2228,26 +2228,34 @@ void ScModule::UnregisterRefWindow( sal_uInt16 nSlotId, vcl::Window *pWnd ) m_mapRefWindow.erase( nSlotId ); } -void ScModule::RegisterRefController( sal_uInt16 nSlotId, SfxModelessDialogController *pWnd ) +void ScModule::RegisterRefController(sal_uInt16 nSlotId, std::shared_ptr<SfxDialogController>& rWnd, weld::Window* pWndAncestor) { - std::vector<SfxModelessDialogController*> & rlRefWindow = m_mapRefController[nSlotId]; + std::vector<std::pair<std::shared_ptr<SfxDialogController>, weld::Window*>> & rlRefWindow = m_mapRefController[nSlotId]; - if( std::find( rlRefWindow.begin(), rlRefWindow.end(), pWnd ) == rlRefWindow.end() ) + if (std::find_if(rlRefWindow.begin(), rlRefWindow.end(), + [rWnd](const std::pair<std::shared_ptr<SfxDialogController>, weld::Window*>& rCandidate) + { + return rCandidate.first.get() == rWnd.get(); + }) == rlRefWindow.end()) { - rlRefWindow.emplace_back(pWnd ); + rlRefWindow.emplace_back(rWnd, pWndAncestor); } } -void ScModule::UnregisterRefController( sal_uInt16 nSlotId, SfxModelessDialogController *pWnd ) +void ScModule::UnregisterRefController(sal_uInt16 nSlotId, std::shared_ptr<SfxDialogController>& rWnd) { auto iSlot = m_mapRefController.find( nSlotId ); if( iSlot == m_mapRefController.end() ) return; - std::vector<SfxModelessDialogController* > & rlRefWindow = iSlot->second; + std::vector<std::pair<std::shared_ptr<SfxDialogController>, weld::Window*>> & rlRefWindow = iSlot->second; - auto i = std::find( rlRefWindow.begin(), rlRefWindow.end(), pWnd ); + auto i = std::find_if(rlRefWindow.begin(), rlRefWindow.end(), + [rWnd](const std::pair<std::shared_ptr<SfxDialogController>, weld::Window*>& rCandidate) + { + return rCandidate.first.get() == rWnd.get(); + }); if( i == rlRefWindow.end() ) return; @@ -2258,23 +2266,21 @@ void ScModule::UnregisterRefController( sal_uInt16 nSlotId, SfxModelessDialogCo m_mapRefController.erase( nSlotId ); } -vcl::Window * ScModule::Find1RefWindow( sal_uInt16 nSlotId, vcl::Window *pWndAncestor ) +std::shared_ptr<SfxDialogController> ScModule::Find1RefWindow(sal_uInt16 nSlotId, weld::Window *pWndAncestor) { if (!pWndAncestor) return nullptr; - auto iSlot = m_mapRefWindow.find( nSlotId ); + auto iSlot = m_mapRefController.find( nSlotId ); - if( iSlot == m_mapRefWindow.end() ) + if( iSlot == m_mapRefController.end() ) return nullptr; - std::vector<VclPtr<vcl::Window> > & rlRefWindow = iSlot->second; - - while( vcl::Window *pParent = pWndAncestor->GetParent() ) pWndAncestor = pParent; + std::vector<std::pair<std::shared_ptr<SfxDialogController>, weld::Window*>> & rlRefWindow = iSlot->second; for (auto const& refWindow : rlRefWindow) - if ( pWndAncestor->IsWindowOrChild( refWindow, refWindow->IsSystemWindow() ) ) - return refWindow; + if ( refWindow.second == pWndAncestor ) + return refWindow.first; return nullptr; } diff --git a/sc/source/ui/dbgui/validate.cxx b/sc/source/ui/dbgui/validate.cxx index 94a40ecf9d7e..c9c8bbc84be9 100644 --- a/sc/source/ui/dbgui/validate.cxx +++ b/sc/source/ui/dbgui/validate.cxx @@ -80,24 +80,25 @@ const sal_uInt16 ScTPValidationValue::pValueRanges[] = 0 }; -ScValidationDlg::ScValidationDlg(vcl::Window* pParent, const SfxItemSet* pArgSet, +ScValidationDlg::ScValidationDlg(weld::Window* pParent, const SfxItemSet* pArgSet, ScTabViewShell *pTabViewSh) - : ScValidationDlgBase(pParent ? pParent : SfxGetpApp()->GetTopWindow(), - "ValidationDialog", "modules/scalc/ui/validationdialog.ui", pArgSet, nullptr) + : ScValidationDlgBase(pParent, + "modules/scalc/ui/validationdialog.ui", "ValidationDialog", pArgSet, nullptr) , m_pTabVwSh(pTabViewSh) - , m_nValuePageId(0) + , m_sValuePageId("criteria") , m_bOwnRefHdlr(false) , m_bRefInputting(false) + , m_xHBox(m_xBuilder->weld_container("refinputbox")) { - m_nValuePageId = AddTabPage("criteria", ScTPValidationValue::Create); - AddTabPage("inputhelp", ScTPValidationHelp::Create); - AddTabPage("erroralert", ScTPValidationError::Create); - get(m_pHBox, "refinputbox"); + AddTabPage(m_sValuePageId, ScTPValidationValue::Create, nullptr); + AddTabPage("inputhelp", ScTPValidationHelp::Create, nullptr); + AddTabPage("erroralert", ScTPValidationError::Create, nullptr); } ScValidationDlg::~ScValidationDlg() { - disposeOnce(); + if (m_bOwnRefHdlr) + RemoveRefDlg(false); } void ScTPValidationValue::SetReferenceHdl( const ScRange&rRange , const ScDocument* pDoc ) @@ -125,39 +126,52 @@ void ScTPValidationValue:: SetActiveHdl() } } -void ScTPValidationValue::RefInputStartPreHdl( formula::RefEdit* pEdit, const formula::RefButton* pButton ) +void ScTPValidationValue::RefInputStartPreHdl( formula::WeldRefEdit* pEdit, const formula::WeldRefButton* pButton ) { - if ( ScValidationDlg *pValidationDlg = GetValidationDlg() ) + if (ScValidationDlg *pValidationDlg = GetValidationDlg()) { - vcl::Window *pNewParent = pValidationDlg->get_refinput_shrink_parent(); - if( pEdit == m_pRefEdit && m_pRefEdit->GetParent() != pNewParent ) + weld::Container* pNewParent = pValidationDlg->get_refinput_shrink_parent(); + if (pEdit == m_pRefEdit && pNewParent != m_pRefEditParent) { - m_pRefEdit->SetParent(pNewParent); + m_xRefGrid->move(m_pRefEdit->GetWidget(), pNewParent); + m_pRefEditParent = pNewParent; } - if( pButton == m_pBtnRef && m_pBtnRef->GetParent() != pNewParent ) + if (pNewParent != m_pBtnRefParent) { - m_pBtnRef->SetParent(pNewParent); + // if Edit SetParent but button not, the tab order will be + // incorrect, so move button anyway, and restore + // parent later in order to restore the tab order. But + // hide it if its moved but unwanted + m_xRefGrid->move(m_xBtnRef->GetWidget(), pNewParent); + m_xBtnRef->GetWidget()->set_visible(pButton == m_xBtnRef.get()); + m_pBtnRefParent = pNewParent; } - pNewParent->Show(); + pNewParent->show(); } } void ScTPValidationValue::RefInputDonePostHdl() { - if( m_pRefEdit && m_pRefEdit->GetParent() != m_pRefGrid ) + if (ScValidationDlg *pValidationDlg = GetValidationDlg()) { - m_pRefEdit->SetParent( m_pRefGrid ); - m_pBtnRef->SetParent( m_pRefEdit ); //if Edit SetParent but button not, the tab order will be incorrect, need button to setparent to another window and restore parent later in order to restore the tab order - } + weld::Container* pOldParent = pValidationDlg->get_refinput_shrink_parent(); - if( m_pBtnRef->GetParent() != m_pRefGrid ) - m_pBtnRef->SetParent( m_pRefGrid ); + if (m_pRefEdit && m_pRefEditParent != m_xRefGrid.get()) + { + pOldParent->move(m_pRefEdit->GetWidget(), m_xRefGrid.get()); + m_pRefEditParent = m_xRefGrid.get(); + } - if ( ScValidationDlg *pValidationDlg = GetValidationDlg() ) - { - pValidationDlg->get_refinput_shrink_parent()->Hide(); + if (m_pBtnRefParent != m_xRefGrid.get()) + { + pOldParent->move(m_xBtnRef->GetWidget(), m_xRefGrid.get()); + m_xBtnRef->GetWidget()->show(); + m_pBtnRefParent = m_xRefGrid.get(); + } + + pOldParent->hide(); ScViewData& rViewData = pValidationDlg->GetTabViewShell()->GetViewData(); SCTAB nCurTab = rViewData.GetTabNo(); SCTAB nRefTab = rViewData.GetRefTabNo(); @@ -169,21 +183,10 @@ void ScTPValidationValue::RefInputDonePostHdl() } } - if( m_pRefEdit && !m_pRefEdit->HasFocus() ) + if (m_pRefEdit && !m_pRefEdit->GetWidget()->has_focus()) m_pRefEdit->GrabFocus(); } -ScTPValidationValue::ScRefButtonEx::~ScRefButtonEx() -{ - disposeOnce(); -} - -void ScTPValidationValue::ScRefButtonEx::dispose() -{ - m_pPage.clear(); - ::formula::RefButton::dispose(); -} - namespace { /** Converts the passed ScValidationMode to the position in the list box. */ @@ -322,9 +325,9 @@ bool lclGetStringListFromFormula( OUString& rStringList, const OUString& rFmlaSt } // namespace -ScTPValidationValue::ScTPValidationValue( vcl::Window* pParent, const SfxItemSet& rArgSet ) - : SfxTabPage( pParent, "ValidationCriteriaPage", - "modules/scalc/ui/validationcriteriapage.ui", &rArgSet) +ScTPValidationValue::ScTPValidationValue(TabPageParent pParent, const SfxItemSet& rArgSet) + : SfxTabPage(pParent, "modules/scalc/ui/validationcriteriapage.ui", + "ValidationCriteriaPage", &rArgSet) , maStrMin(ScResId(SCSTR_VALID_MINIMUM)) , maStrMax(ScResId(SCSTR_VALID_MAXIMUM)) , maStrValue(ScResId(SCSTR_VALID_VALUE)) @@ -332,33 +335,34 @@ ScTPValidationValue::ScTPValidationValue( vcl::Window* pParent, const SfxItemSet , maStrRange(ScResId(SCSTR_VALID_RANGE)) , maStrList(ScResId(SCSTR_VALID_LIST)) , m_pRefEdit(nullptr) -{ - get(m_pLbAllow, "allow"); - get(m_pCbAllow, "allowempty"); - get(m_pCbShow, "showlist"); - get(m_pCbSort, "sortascend"); - get(m_pFtValue, "valueft"); - get(m_pLbValue, "data"); - get(m_pFtMin, "minft"); - get(m_pMinGrid, "mingrid"); - get(m_pEdMin, "min"); - m_pEdMin->SetReferences(nullptr, m_pFtMin); - get(m_pEdList, "minlist"); + , m_xLbAllow(m_xBuilder->weld_combo_box("allow")) + , m_xCbAllow(m_xBuilder->weld_check_button("allowempty")) + , m_xCbShow(m_xBuilder->weld_check_button("showlist")) + , m_xCbSort(m_xBuilder->weld_check_button("sortascend")) + , m_xFtValue(m_xBuilder->weld_label("valueft")) + , m_xLbValue(m_xBuilder->weld_combo_box("data")) + , m_xFtMin(m_xBuilder->weld_label("minft")) + , m_xMinGrid(m_xBuilder->weld_widget("mingrid")) + , m_xEdMin(new formula::WeldRefEdit(m_xBuilder->weld_entry("min"))) + , m_xEdList(m_xBuilder->weld_text_view("minlist")) + , m_xFtMax(m_xBuilder->weld_label("maxft")) + , m_xEdMax(new formula::WeldRefEdit(m_xBuilder->weld_entry("max"))) + , m_xFtHint(m_xBuilder->weld_label("hintft")) + , m_xBtnRef(new formula::WeldRefButton(m_xBuilder->weld_button("validref"))) + , m_xRefGrid(m_xBuilder->weld_container("refgrid")) + , m_pRefEditParent(m_xRefGrid.get()) + , m_pBtnRefParent(m_xRefGrid.get()) +{ + m_xEdMin->SetReferences(nullptr, m_xFtMin.get()); Size aSize(LogicToPixel(Size(174, 105), MapMode(MapUnit::MapAppFont))); - m_pEdList->set_width_request(aSize.Width()); - m_pEdList->set_height_request(aSize.Height()); - get(m_pFtMax, "maxft"); - get(m_pEdMax, "max"); - m_pEdMax->SetReferences(nullptr, m_pFtMax); - get(m_pFtHint, "hintft"); - get(m_pBtnRef, "validref"); - m_pBtnRef->SetParentPage(this); - get(m_pRefGrid, "refgrid"); + m_xEdList->set_size_request(aSize.Width(), aSize.Height()); + m_xEdMax->SetReferences(nullptr, m_xFtMax.get()); + + m_xBtnRef->SetClickHdl(LINK(this, ScTPValidationValue, ClickHdl)); //lock in the max size initial config - aSize = get_preferred_size(); - set_width_request(aSize.Width()); - set_height_request(aSize.Height()); + aSize = m_xContainer->get_preferred_size(); + m_xContainer->set_size_request(aSize.Width(), aSize.Height()); Init(); @@ -366,7 +370,7 @@ ScTPValidationValue::ScTPValidationValue( vcl::Window* pParent, const SfxItemSet OUString aListSep = ::ScCompiler::GetNativeSymbol( ocSep ); OSL_ENSURE( aListSep.getLength() == 1, "ScTPValidationValue::ScTPValidationValue - list separator error" ); mcFmlaSep = aListSep.getLength() ? aListSep[0] : ';'; - m_pBtnRef->Hide(); // cell range picker + m_xBtnRef->GetWidget()->hide(); // cell range picker } ScTPValidationValue::~ScTPValidationValue() @@ -376,49 +380,37 @@ ScTPValidationValue::~ScTPValidationValue() void ScTPValidationValue::dispose() { - m_pLbAllow.clear(); - m_pCbAllow.clear(); - m_pCbShow.clear(); - m_pCbSort.clear(); - m_pFtValue.clear(); - m_pLbValue.clear(); - m_pFtMin.clear(); - m_pMinGrid.clear(); - m_pEdMin.clear(); - m_pEdList.clear(); - m_pFtMax.clear(); - m_pEdMax.clear(); - m_pFtHint.clear(); - m_pRefEdit.clear(); - m_pBtnRef.clear(); - m_pRefGrid.clear(); + m_xEdMin.reset(); + m_xEdMin.reset(); + m_xEdMax.reset(); + m_xBtnRef.reset(); + m_xEdMax.reset(); SfxTabPage::dispose(); } - void ScTPValidationValue::Init() { - m_pLbAllow->SetSelectHdl( LINK( this, ScTPValidationValue, SelectHdl ) ); - m_pLbValue->SetSelectHdl( LINK( this, ScTPValidationValue, SelectHdl ) ); - m_pCbShow->SetClickHdl( LINK( this, ScTPValidationValue, CheckHdl ) ); + m_xLbAllow->connect_changed( LINK( this, ScTPValidationValue, SelectHdl ) ); + m_xLbValue->connect_changed( LINK( this, ScTPValidationValue, SelectHdl ) ); + m_xCbShow->connect_clicked( LINK( this, ScTPValidationValue, CheckHdl ) ); // cell range picker - m_pEdMin->SetGetFocusHdl( LINK( this, ScTPValidationValue, EditSetFocusHdl ) ); - m_pEdMin->SetLoseFocusHdl( LINK( this, ScTPValidationValue, KillFocusHdl ) ); - m_pEdMax->SetGetFocusHdl( LINK( this, ScTPValidationValue, EditSetFocusHdl ) ); - m_pBtnRef->SetLoseFocusHdl( LINK( this, ScTPValidationValue, KillFocusHdl ) ); - m_pEdMax->SetLoseFocusHdl( LINK( this, ScTPValidationValue, KillFocusHdl ) ); + m_xEdMin->SetGetFocusHdl( LINK( this, ScTPValidationValue, EditSetFocusHdl ) ); + m_xEdMin->SetLoseFocusHdl( LINK( this, ScTPValidationValue, KillEditFocusHdl ) ); + m_xEdMax->SetGetFocusHdl( LINK( this, ScTPValidationValue, EditSetFocusHdl ) ); + m_xBtnRef->SetLoseFocusHdl( LINK( this, ScTPValidationValue, KillButtonFocusHdl ) ); + m_xEdMax->SetLoseFocusHdl( LINK( this, ScTPValidationValue, KillEditFocusHdl ) ); - m_pLbAllow->SelectEntryPos( SC_VALIDDLG_ALLOW_ANY ); - m_pLbValue->SelectEntryPos( SC_VALIDDLG_DATA_EQUAL ); + m_xLbAllow->set_active( SC_VALIDDLG_ALLOW_ANY ); + m_xLbValue->set_active( SC_VALIDDLG_DATA_EQUAL ); - SelectHdl( *m_pLbAllow.get() ); - CheckHdl( nullptr ); + SelectHdl( *m_xLbAllow.get() ); + CheckHdl( *m_xCbShow ); } -VclPtr<SfxTabPage> ScTPValidationValue::Create( TabPageParent pParent, const SfxItemSet* rArgSet ) +VclPtr<SfxTabPage> ScTPValidationValue::Create(TabPageParent pParent, const SfxItemSet* rArgSet) { - return VclPtr<ScTPValidationValue>::Create( pParent.pParent, *rArgSet ); + return VclPtr<ScTPValidationValue>::Create(pParent, *rArgSet); } void ScTPValidationValue::Reset( const SfxItemSet* rArgSet ) @@ -429,25 +421,25 @@ void ScTPValidationValue::Reset( const SfxItemSet* rArgSet ) if( rArgSet->GetItemState( FID_VALID_MODE, true, &pItem ) == SfxItemState::SET ) nLbPos = lclGetPosFromValMode( static_cast< ScValidationMode >( static_cast< const SfxAllEnumItem* >( pItem )->GetValue() ) ); - m_pLbAllow->SelectEntryPos( nLbPos ); + m_xLbAllow->set_active( nLbPos ); nLbPos = SC_VALIDDLG_DATA_EQUAL; if( rArgSet->GetItemState( FID_VALID_CONDMODE, true, &pItem ) == SfxItemState::SET ) nLbPos = lclGetPosFromCondMode( static_cast< ScConditionMode >( static_cast< const SfxAllEnumItem* >( pItem )->GetValue() ) ); - m_pLbValue->SelectEntryPos( nLbPos ); + m_xLbValue->set_active( nLbPos ); // *** check boxes *** bool bCheck = true; if( rArgSet->GetItemState( FID_VALID_BLANK, true, &pItem ) == SfxItemState::SET ) bCheck = static_cast< const SfxBoolItem* >( pItem )->GetValue(); - m_pCbAllow->Check( bCheck ); + m_xCbAllow->set_active( bCheck ); sal_Int32 nListType = ValidListType::UNSORTED; if( rArgSet->GetItemState( FID_VALID_LISTTYPE, true, &pItem ) == SfxItemState::SET ) nListType = static_cast< const SfxInt16Item* >( pItem )->GetValue(); - m_pCbShow->Check( nListType != ValidListType::INVISIBLE ); - m_pCbSort->Check( nListType == ValidListType::SORTEDASCENDING ); + m_xCbShow->set_active( nListType != ValidListType::INVISIBLE ); + m_xCbSort->set_active( nListType == ValidListType::SORTEDASCENDING ); // *** formulas *** OUString aFmlaStr; @@ -460,27 +452,27 @@ void ScTPValidationValue::Reset( const SfxItemSet* rArgSet ) aFmlaStr = static_cast< const SfxStringItem* >( pItem )->GetValue(); SetSecondFormula( aFmlaStr ); - SelectHdl( *m_pLbAllow.get() ); - CheckHdl( nullptr ); + SelectHdl( *m_xLbAllow.get() ); + CheckHdl( *m_xCbShow ); } bool ScTPValidationValue::FillItemSet( SfxItemSet* rArgSet ) { - sal_Int16 nListType = m_pCbShow->IsChecked() ? - (m_pCbSort->IsChecked() ? ValidListType::SORTEDASCENDING : ValidListType::UNSORTED) : + sal_Int16 nListType = m_xCbShow->get_active() ? + (m_xCbSort->get_active() ? ValidListType::SORTEDASCENDING : ValidListType::UNSORTED) : ValidListType::INVISIBLE; - const sal_Int32 nLbPos = m_pLbAllow->GetSelectedEntryPos(); + const sal_Int32 nLbPos = m_xLbAllow->get_active(); bool bCustom = (nLbPos == SC_VALIDDLG_ALLOW_CUSTOM); ScConditionMode eCondMode = bCustom ? - ScConditionMode::Direct : lclGetCondModeFromPos( m_pLbValue->GetSelectedEntryPos() ); + ScConditionMode::Direct : lclGetCondModeFromPos( m_xLbValue->get_active() ); rArgSet->Put( SfxAllEnumItem( FID_VALID_MODE, sal::static_int_cast<sal_uInt16>( lclGetValModeFromPos( nLbPos ) ) ) ); rArgSet->Put( SfxAllEnumItem( FID_VALID_CONDMODE, sal::static_int_cast<sal_uInt16>( eCondMode ) ) ); rArgSet->Put( SfxStringItem( FID_VALID_VALUE1, GetFirstFormula() ) ); rArgSet->Put( SfxStringItem( FID_VALID_VALUE2, GetSecondFormula() ) ); - rArgSet->Put( SfxBoolItem( FID_VALID_BLANK, m_pCbAllow->IsChecked() ) ); + rArgSet->Put( SfxBoolItem( FID_VALID_BLANK, m_xCbAllow->get_active() ) ); rArgSet->Put( SfxInt16Item( FID_VALID_LISTTYPE, nListType ) ); return true; } @@ -488,50 +480,45 @@ bool ScTPValidationValue::FillItemSet( SfxItemSet* rArgSet ) OUString ScTPValidationValue::GetFirstFormula() const { OUString aFmlaStr; - if( m_pLbAllow->GetSelectedEntryPos() == SC_VALIDDLG_ALLOW_LIST ) - lclGetFormulaFromStringList( aFmlaStr, m_pEdList->GetText(), mcFmlaSep ); + if( m_xLbAllow->get_active() == SC_VALIDDLG_ALLOW_LIST ) + lclGetFormulaFromStringList( aFmlaStr, m_xEdList->get_text(), mcFmlaSep ); else - aFmlaStr = m_pEdMin->GetText(); + aFmlaStr = m_xEdMin->GetText(); return aFmlaStr; } OUString ScTPValidationValue::GetSecondFormula() const { - return m_pEdMax->GetText(); + return m_xEdMax->GetText(); } void ScTPValidationValue::SetFirstFormula( const OUString& rFmlaStr ) { // try if formula is a string list, validation mode must already be set OUString aStringList; - if( (m_pLbAllow->GetSelectedEntryPos() == SC_VALIDDLG_ALLOW_RANGE) && + if( (m_xLbAllow->get_active() == SC_VALIDDLG_ALLOW_RANGE) && lclGetStringListFromFormula( aStringList, rFmlaStr, mcFmlaSep ) ) { - m_pEdList->SetText( aStringList ); - m_pEdMin->SetText( EMPTY_OUSTRING ); + m_xEdList->set_text( aStringList ); + m_xEdMin->SetText( EMPTY_OUSTRING ); // change validation mode to string list - m_pLbAllow->SelectEntryPos( SC_VALIDDLG_ALLOW_LIST ); + m_xLbAllow->set_active( SC_VALIDDLG_ALLOW_LIST ); } else { - m_pEdMin->SetText( rFmlaStr ); - m_pEdList->SetText( EMPTY_OUSTRING ); + m_xEdMin->SetText( rFmlaStr ); + m_xEdList->set_text( EMPTY_OUSTRING ); } } void ScTPValidationValue::SetSecondFormula( const OUString& rFmlaStr ) { - m_pEdMax->SetText( rFmlaStr ); + m_xEdMax->SetText( rFmlaStr ); } ScValidationDlg * ScTPValidationValue::GetValidationDlg() { - if( vcl::Window *pParent = GetParent() ) - do{ - if ( auto pValidationDlg = dynamic_cast<ScValidationDlg*>( pParent ) ) - return pValidationDlg; - }while ( nullptr != ( pParent = pParent->GetParent() ) ); - return nullptr; + return dynamic_cast<ScValidationDlg*>(GetDialogController()); } void ScTPValidationValue::SetupRefDlg() @@ -546,35 +533,35 @@ void ScTPValidationValue::SetupRefDlg() pValidationDlg->SetRefInputStartPreHdl( static_cast<ScRefHandlerHelper::PINPUTSTARTDLTYPE>( &ScTPValidationValue::RefInputStartPreHdl ) ); pValidationDlg->SetRefInputDonePostHdl( static_cast<ScRefHandlerHelper::PCOMMONHDLTYPE>( &ScTPValidationValue::RefInputDonePostHdl ) ); - vcl::Window *pLabel = nullptr; + weld::Label* pLabel = nullptr; - if ( m_pEdMax->IsVisible() ) + if (m_xEdMax->GetWidget()->get_visible()) { - m_pRefEdit = m_pEdMax; - pLabel = m_pFtMax; + m_pRefEdit = m_xEdMax.get(); + pLabel = m_xFtMax.get(); } - else if ( m_pEdMin->IsVisible() ) + else if (m_xEdMin->GetWidget()->get_visible()) { - m_pRefEdit = m_pEdMin; - pLabel = m_pFtMin; + m_pRefEdit = m_xEdMin.get(); + pLabel = m_xFtMin.get(); } - if( m_pRefEdit && !m_pRefEdit->HasFocus() ) + if (m_pRefEdit && !m_pRefEdit->GetWidget()->has_focus()) m_pRefEdit->GrabFocus(); if( m_pRefEdit ) m_pRefEdit->SetReferences( pValidationDlg, pLabel ); - m_pBtnRef->SetReferences( pValidationDlg, m_pRefEdit ); + m_xBtnRef->SetReferences( pValidationDlg, m_pRefEdit ); } } } -void ScTPValidationValue::RemoveRefDlg() +void ScTPValidationValue::RemoveRefDlg(bool bRestoreModal) { if( ScValidationDlg *pValidationDlg = GetValidationDlg() ) { - if( pValidationDlg->RemoveRefDlg(true) ) + if( pValidationDlg->RemoveRefDlg(bRestoreModal) ) { pValidationDlg->SetHandler( nullptr ); pValidationDlg->SetSetRefHdl( nullptr ); @@ -586,14 +573,14 @@ void ScTPValidationValue::RemoveRefDlg() m_pRefEdit->SetReferences( nullptr, nullptr ); m_pRefEdit = nullptr; - m_pBtnRef->SetReferences( nullptr, nullptr ); + m_xBtnRef->SetReferences( nullptr, nullptr ); } } } -IMPL_LINK_NOARG(ScTPValidationValue, EditSetFocusHdl, Control&, void) +IMPL_LINK_NOARG(ScTPValidationValue, EditSetFocusHdl, formula::WeldRefEdit&, void) { - const sal_Int32 nPos = m_pLbAllow->GetSelectedEntryPos(); + const sal_Int32 nPos = m_xLbAllow->get_active(); if ( nPos == SC_VALIDDLG_ALLOW_RANGE ) { @@ -601,87 +588,96 @@ IMPL_LINK_NOARG(ScTPValidationValue, EditSetFocusHdl, Control&, void) } } -IMPL_LINK( ScTPValidationValue, KillFocusHdl, Control&, rControl, void ) +IMPL_LINK( ScTPValidationValue, KillEditFocusHdl, formula::WeldRefEdit&, rWnd, void ) +{ + if (&rWnd != m_pRefEdit) + return; + if( ScValidationDlg *pValidationDlg = GetValidationDlg() ) + { + if (pValidationDlg->IsChildFocus() && !pValidationDlg->IsRefInputting()) + { + if( ( !m_pRefEdit || !m_pRefEdit->GetWidget()->has_focus()) && !m_xBtnRef->GetWidget()->has_focus() ) + { + RemoveRefDlg(true); + } + } + } +} + +IMPL_LINK( ScTPValidationValue, KillButtonFocusHdl, formula::WeldRefButton&, rWnd, void ) { - vcl::Window* pWnd = static_cast<vcl::Window*>(&rControl); - if( pWnd == m_pRefEdit || pWnd == m_pBtnRef ) - if( ScValidationDlg *pValidationDlg = GetValidationDlg() ) - if ( (pValidationDlg->IsActive() || pValidationDlg->IsChildFocus() ) && !pValidationDlg->IsRefInputting() ) - if( ( !m_pRefEdit || !m_pRefEdit->HasFocus()) && !m_pBtnRef->HasFocus() ) - { - RemoveRefDlg(); - } + if( &rWnd != m_xBtnRef.get()) + return; + if( ScValidationDlg *pValidationDlg = GetValidationDlg() ) + if (pValidationDlg->IsChildFocus() && !pValidationDlg->IsRefInputting()) + if( ( !m_pRefEdit || !m_pRefEdit->GetWidget()->has_focus()) && !m_xBtnRef->GetWidget()->has_focus() ) + { + RemoveRefDlg(true); + } } -IMPL_LINK_NOARG(ScTPValidationValue, SelectHdl, ListBox&, void) +IMPL_LINK_NOARG(ScTPValidationValue, SelectHdl, weld::ComboBox&, void) { - const sal_Int32 nLbPos = m_pLbAllow->GetSelectedEntryPos(); + const sal_Int32 nLbPos = m_xLbAllow->get_active(); bool bEnable = (nLbPos != SC_VALIDDLG_ALLOW_ANY); bool bRange = (nLbPos == SC_VALIDDLG_ALLOW_RANGE); bool bList = (nLbPos == SC_VALIDDLG_ALLOW_LIST); bool bCustom = (nLbPos == SC_VALIDDLG_ALLOW_CUSTOM); - m_pCbAllow->Enable( bEnable ); // Empty cell - m_pFtValue->Enable( bEnable ); - m_pLbValue->Enable( bEnable ); - m_pFtMin->Enable( bEnable ); - m_pEdMin->Enable( bEnable ); - m_pEdList->Enable( bEnable ); - m_pFtMax->Enable( bEnable ); - m_pEdMax->Enable( bEnable ); + m_xCbAllow->set_sensitive( bEnable ); // Empty cell + m_xFtValue->set_sensitive( bEnable ); + m_xLbValue->set_sensitive( bEnable ); + m_xFtMin->set_sensitive( bEnable ); + m_xEdMin->GetWidget()->set_sensitive( bEnable ); + m_xEdList->set_sensitive( bEnable ); + m_xFtMax->set_sensitive( bEnable ); + m_xEdMax->GetWidget()->set_sensitive( bEnable ); bool bShowMax = false; if( bRange ) - m_pFtMin->SetText( maStrRange ); + m_xFtMin->set_label( maStrRange ); else if( bList ) - m_pFtMin->SetText( maStrList ); + m_xFtMin->set_label( maStrList ); else if( bCustom ) - m_pFtMin->SetText( maStrFormula ); + m_xFtMin->set_label( maStrFormula ); else { - switch( m_pLbValue->GetSelectedEntryPos() ) + switch( m_xLbValue->get_active() ) { case SC_VALIDDLG_DATA_EQUAL: - case SC_VALIDDLG_DATA_NOTEQUAL: m_pFtMin->SetText( maStrValue ); break; + case SC_VALIDDLG_DATA_NOTEQUAL: m_xFtMin->set_label( maStrValue ); break; case SC_VALIDDLG_DATA_LESS: - case SC_VALIDDLG_DATA_EQLESS: m_pFtMin->SetText( maStrMax ); break; + case SC_VALIDDLG_DATA_EQLESS: m_xFtMin->set_label( maStrMax ); break; case SC_VALIDDLG_DATA_VALIDRANGE: case SC_VALIDDLG_DATA_INVALIDRANGE: bShowMax = true; [[fallthrough]]; case SC_VALIDDLG_DATA_GREATER: - case SC_VALIDDLG_DATA_EQGREATER: m_pFtMin->SetText( maStrMin ); break; + case SC_VALIDDLG_DATA_EQGREATER: m_xFtMin->set_label( maStrMin ); break; default: OSL_FAIL( "ScTPValidationValue::SelectHdl - unknown condition mode" ); } } - m_pCbShow->Show( bRange || bList ); - m_pCbSort->Show( bRange || bList ); - m_pFtValue->Show( !bRange && !bList && !bCustom); - m_pLbValue->Show( !bRange && !bList && !bCustom ); - m_pEdMin->Show( !bList ); - m_pEdList->Show( bList ); - m_pMinGrid->set_vexpand( bList ); - WinBits nBits = m_pFtMin->GetStyle(); - nBits &= ~(WB_TOP | WB_VCENTER | WB_BOTTOM); - if (bList) - nBits |= WB_TOP; - else - nBits |= WB_VCENTER; - m_pFtMin->SetStyle( nBits ); - m_pFtMax->Show( bShowMax ); - m_pEdMax->Show( bShowMax ); - m_pFtHint->Show( bRange ); - m_pBtnRef->Show( bRange ); // cell range picker + m_xCbShow->set_visible( bRange || bList ); + m_xCbSort->set_visible( bRange || bList ); + m_xFtValue->set_visible( !bRange && !bList && !bCustom); + m_xLbValue->set_visible( !bRange && !bList && !bCustom ); + m_xEdMin->GetWidget()->set_visible( !bList ); + m_xEdList->set_visible( bList ); + m_xMinGrid->set_vexpand( bList ); + m_xFtMax->set_visible( bShowMax ); + m_xEdMax->GetWidget()->set_visible( bShowMax ); + m_xFtHint->set_visible( bRange ); + m_xBtnRef->GetWidget()->set_visible( bRange ); // cell range picker } -IMPL_LINK_NOARG(ScTPValidationValue, CheckHdl, Button*, void) +IMPL_LINK_NOARG(ScTPValidationValue, CheckHdl, weld::Button&, void) { - m_pCbSort->Enable( m_pCbShow->IsChecked() ); + m_xCbSort->set_sensitive( m_xCbShow->get_active() ); } // Input Help Page @@ -844,7 +840,7 @@ bool ScValidationDlg::EnterRefStatus() SfxViewFrame* pViewFrm = pTabViewShell->GetViewFrame(); SfxChildWindow* pWnd = pViewFrm->GetChildWindow( nId ); - if ( pWnd && pWnd->GetWindow()!= this ) pWnd = nullptr; + if (pWnd && pWnd->GetController().get() != this) pWnd = nullptr; SC_MOD()->SetRefDialog( nId, pWnd == nullptr ); @@ -899,7 +895,9 @@ bool ScValidationDlg::RemoveRefDlg( bool bRestoreModal /* = true */ ) m_bOwnRefHdlr = false; if( bRestoreModal ) + { SetModal( true ); + } } if ( SfxChildWindow* pWnd = pTabVwSh->GetViewFrame()->GetChildWindow( SID_VALIDITY_REFERENCE ) ) @@ -911,33 +909,14 @@ bool ScValidationDlg::RemoveRefDlg( bool bRestoreModal /* = true */ ) return true; } -extern "C" SAL_DLLPUBLIC_EXPORT void makeScRefButtonEx(VclPtr<vcl::Window> & rRet, VclPtr<vcl::Window> & pParent, VclBuilder::stringmap &) -{ - rRet = VclPtr<ScTPValidationValue::ScRefButtonEx>::Create(pParent, 0); -} - -void ScTPValidationValue::ScRefButtonEx::Click() +IMPL_LINK_NOARG(ScTPValidationValue, ClickHdl, formula::WeldRefButton&, void) { - if( ScTPValidationValue *pParent = GetParentPage() ) - pParent->OnClick( this ); - - formula::RefButton::Click(); -} - -void ScTPValidationValue::OnClick( const Button *pBtn ) -{ - if( pBtn == m_pBtnRef ) - SetupRefDlg(); + SetupRefDlg(); } bool ScValidationDlg::IsChildFocus() { - if ( const vcl::Window *pWin = Application::GetFocusWindow() ) - while( nullptr != ( pWin = pWin->GetParent() ) ) - if( pWin == this ) - return true; - - return false; + return m_xDialog->has_toplevel_focus(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/inc/anyrefdg.hxx b/sc/source/ui/inc/anyrefdg.hxx index 3a5726123654..99c57edf5320 100644 --- a/sc/source/ui/inc/anyrefdg.hxx +++ b/sc/source/ui/inc/anyrefdg.hxx @@ -98,7 +98,7 @@ public: static void enableInput(bool _bInput); public: - static bool CanInputStart( const formula::RefEdit *pEdit ){ return !!pEdit; } + static bool CanInputStart( const formula::WeldRefEdit *pEdit ){ return !!pEdit; } bool CanInputDone( bool bForced ){ return (m_pRefEdit || m_pWeldRefEdit) && (bForced || !(m_pRefBtn || m_pWeldRefBtn)); } }; @@ -134,7 +134,7 @@ protected: public: ScRefHandler( vcl::Window &rWindow, SfxBindings* pB, bool bBindRef ); - ScRefHandler( SfxModelessDialogController &rController, SfxBindings* pB, bool bBindRef ); + ScRefHandler( SfxDialogController &rController, SfxBindings* pB, bool bBindRef ); virtual ~ScRefHandler() override; virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) override = 0; @@ -160,7 +160,7 @@ public: public: bool EnterRefMode(); bool LeaveRefMode(); - static inline bool CanInputStart( const formula::RefEdit *pEdit ); + static inline bool CanInputStart( const formula::WeldRefEdit *pEdit ); inline bool CanInputDone( bool bForced ); }; @@ -245,74 +245,50 @@ template< class TWindow, bool bBindRef = true > class ScRefHdlrControllerImplBase: public TWindow, public ScRefHandler { private: - template<class TBindings, class TChildWindow, class TParentWindow > - ScRefHdlrControllerImplBase( TBindings* pB, TChildWindow* pCW, - TParentWindow* pParent, const OUString& rUIXMLDescription, const OString& rID ); + ScRefHdlrControllerImplBase(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent, const OUString& rUIXMLDescription, const OString& rID) + : TWindow(pB, pCW, pParent, rUIXMLDescription, rID) + , ScRefHandler(*static_cast<TWindow*>(this), pB, bBindRef) + { + } - template<class TParentWindow, class TArg> - ScRefHdlrControllerImplBase(TParentWindow* pParent, const OUString& rUIXMLDescription, const OString& rID, const TArg &rArg, SfxBindings *pB); + ScRefHdlrControllerImplBase(weld::Window* pParent, const OUString& rUIXMLDescription, const OString& rID, const SfxItemSet* pArg, SfxBindings *pB) + : TWindow(pParent, rUIXMLDescription, rID, pArg) + , ScRefHandler(*static_cast<TWindow*>(this), pB, bBindRef) + { + } - virtual ~ScRefHdlrControllerImplBase() override; + virtual ~ScRefHdlrControllerImplBase() override + { + } template<class, class, bool> friend struct ScRefHdlrControllerImpl; }; -template<class TWindow, bool bBindRef > -ScRefHdlrControllerImplBase<TWindow,bBindRef>::~ScRefHdlrControllerImplBase(){} - -template<class TWindow, bool bBindRef> -template<class TBindings, class TChildWindow, class TParentWindow> -ScRefHdlrControllerImplBase<TWindow, bBindRef>::ScRefHdlrControllerImplBase(TBindings* pB, TChildWindow* pCW, - TParentWindow* pParent, const OUString& rUIXMLDescription, const OString& rID) - : TWindow(pB, pCW, pParent, rUIXMLDescription, rID) - , ScRefHandler( *static_cast<TWindow*>(this), pB, bBindRef ) -{ -} - -template<class TWindow, bool bBindRef > -template<class TParentWindow, class TArg> -ScRefHdlrControllerImplBase<TWindow,bBindRef>::ScRefHdlrControllerImplBase(TParentWindow* pParent, const OUString& rUIXMLDescription, const OString& rID, - const TArg &rArg, SfxBindings *pB) - : TWindow(pParent, rUIXMLDescription, rID, rArg) - , ScRefHandler( *static_cast<TWindow*>(this), pB, bBindRef ) -{ -} - template<class TDerived, class TBase, bool bBindRef = true> -struct ScRefHdlrControllerImpl: ScRefHdlrControllerImplBase< TBase, bBindRef > +struct ScRefHdlrControllerImpl : ScRefHdlrControllerImplBase<TBase, bBindRef> { enum { UNKNOWN_SLOTID = 0U, SLOTID = UNKNOWN_SLOTID }; - template<class T1, class T2, class T3, class T4> - ScRefHdlrControllerImpl( const T1 & rt1, const T2 & rt2, const T3& rt3, const T4& rt4 ) - : ScRefHdlrControllerImplBase<TBase, bBindRef >(rt1, rt2, rt3, rt4) - { - SC_MOD()->RegisterRefController( static_cast<sal_uInt16>( TDerived::SLOTID ), this ); - } - - template<class T1, class T2, class T3, class T4, class T5> - ScRefHdlrControllerImpl( const T1 & rt1, const T2 & rt2, const T3& rt3, const T4& rt4, const T5& rt5 ) + ScRefHdlrControllerImpl(weld::Window* rt1, const OUString& rt2, const OString& rt3, const SfxItemSet* rt4, SfxBindings *rt5) : ScRefHdlrControllerImplBase<TBase, bBindRef >(rt1, rt2, rt3, rt4, rt5) { - SC_MOD()->RegisterRefController( static_cast<sal_uInt16>( TDerived::SLOTID ), this ); } - ~ScRefHdlrControllerImpl() + ScRefHdlrControllerImpl(SfxBindings* rt1, SfxChildWindow* rt2, weld::Window* rt3, const OUString& rt4, const OString& rt5) + : ScRefHdlrControllerImplBase<TBase, bBindRef >(rt1, rt2, rt3, rt4, rt5) { - SC_MOD()->UnregisterRefController( static_cast<sal_uInt16>( TDerived::SLOTID ), this ); } }; -struct ScAnyRefDlgController : ::ScRefHdlrControllerImpl<ScAnyRefDlgController, SfxModelessDialogController> +struct ScAnyRefDlgController : ScRefHdlrControllerImpl<ScAnyRefDlgController, SfxModelessDialogController> { - template<class T1, class T2, class T3, class T4, class T5> - ScAnyRefDlgController( const T1 & rt1, const T2 & rt2, const T3& rt3, const T4& rt4, const T5& rt5 ) + ScAnyRefDlgController(SfxBindings* rt1, SfxChildWindow* rt2, weld::Window* rt3, const OUString& rt4, const OString& rt5) : ScRefHdlrControllerImpl<ScAnyRefDlgController, SfxModelessDialogController>(rt1, rt2, rt3, rt4, rt5) { } }; -inline bool ScRefHandler::CanInputStart( const formula::RefEdit *pEdit ) +inline bool ScRefHandler::CanInputStart( const formula::WeldRefEdit *pEdit ) { return ScFormulaReferenceHelper::CanInputStart( pEdit ); } diff --git a/sc/source/ui/inc/reffact.hxx b/sc/source/ui/inc/reffact.hxx index 09c83aaf5632..45dd4f6a9db0 100644 --- a/sc/source/ui/inc/reffact.hxx +++ b/sc/source/ui/inc/reffact.hxx @@ -200,7 +200,6 @@ class SC_DLLPUBLIC ScValidityRefChildWin : public SfxChildWindow { bool m_bVisibleLock:1; bool m_bFreeWindowLock:1; - VclPtr<vcl::Window> m_pSavedWndParent; public: ScValidityRefChildWin( vcl::Window*, sal_uInt16, const SfxBindings*, SfxChildWinInfo* ); SFX_DECL_CHILDWINDOW_WITHID(ScValidityRefChildWin); diff --git a/sc/source/ui/inc/validate.hxx b/sc/source/ui/inc/validate.hxx index c29d8b6c7335..d28ee58192cd 100644 --- a/sc/source/ui/inc/validate.hxx +++ b/sc/source/ui/inc/validate.hxx @@ -41,7 +41,7 @@ protected: #endif void (ScRefHandlerCaller::*m_pSetReferenceHdl)( const ScRange& , const ScDocument* ); void (ScRefHandlerCaller::*m_pSetActiveHdl)(); - void (ScRefHandlerCaller::*m_pRefInputStartPreHdl)( formula::RefEdit* pEdit, const formula::RefButton* pButton ); + void (ScRefHandlerCaller::*m_pRefInputStartPreHdl)( formula::WeldRefEdit* pEdit, const formula::WeldRefButton* pButton ); void (ScRefHandlerCaller::*m_pRefInputDonePostHdl)(); #if defined( _WIN32) #pragma pack(pop) @@ -50,7 +50,7 @@ protected: public: typedef void (ScRefHandlerCaller::*PFUNCSETREFHDLTYPE)( const ScRange& , const ScDocument* ); typedef void (ScRefHandlerCaller::*PCOMMONHDLTYPE)(); - typedef void (ScRefHandlerCaller::*PINPUTSTARTDLTYPE)( formula::RefEdit* pEdit, const formula::RefButton* pButton ); + typedef void (ScRefHandlerCaller::*PINPUTSTARTDLTYPE)( formula::WeldRefEdit* pEdit, const formula::WeldRefButton* pButton ); void SetSetRefHdl( PFUNCSETREFHDLTYPE pNewHdl ) { @@ -79,10 +79,10 @@ class ScTPValidationValue : public ScRefHandlerCaller, public SfxTabPage { static const sal_uInt16 pValueRanges[]; public: - explicit ScTPValidationValue( vcl::Window* pParent, const SfxItemSet& rArgSet ); - virtual ~ScTPValidationValue() override; + explicit ScTPValidationValue(TabPageParent pParent, const SfxItemSet& rArgSet); virtual void dispose() override; - static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* rArgSet ); + virtual ~ScTPValidationValue() override; + static VclPtr<SfxTabPage> Create( TabPageParent pParent, const SfxItemSet* rArgSet ); static const sal_uInt16* GetRanges() { return pValueRanges; } virtual bool FillItemSet( SfxItemSet* rArgSet ) override; @@ -97,22 +97,8 @@ private: void SetFirstFormula( const OUString& rFmlaStr ); void SetSecondFormula( const OUString& rFmlaStr ); - DECL_LINK(SelectHdl, ListBox&, void); - DECL_LINK(CheckHdl, Button*, void); - - VclPtr<ListBox> m_pLbAllow; - VclPtr<CheckBox> m_pCbAllow; /// Allow blank cells. - VclPtr<CheckBox> m_pCbShow; /// Show selection list in cell. - VclPtr<CheckBox> m_pCbSort; /// Sort selection list in cell. - VclPtr<FixedText> m_pFtValue; - VclPtr<ListBox> m_pLbValue; - VclPtr<FixedText> m_pFtMin; - VclPtr<VclContainer> m_pMinGrid; - VclPtr<formula::RefEdit> m_pEdMin; - VclPtr<VclMultiLineEdit> m_pEdList; /// Entries for explicit list - VclPtr<FixedText> m_pFtMax; - VclPtr<formula::RefEdit> m_pEdMax; - VclPtr<FixedText> m_pFtHint; /// Hint text for cell range validity. + DECL_LINK(SelectHdl, weld::ComboBox&, void); + DECL_LINK(CheckHdl, weld::Button&, void); OUString const maStrMin; OUString const maStrMax; @@ -122,75 +108,65 @@ private: OUString const maStrList; sal_Unicode mcFmlaSep; /// List separator in formulas. - DECL_LINK( EditSetFocusHdl, Control&, void ); - DECL_LINK( KillFocusHdl, Control&, void ); - void OnClick( const Button *pBtn ); - VclPtr<formula::RefEdit> m_pRefEdit; -public: - class ScRefButtonEx : public ::formula::RefButton - { - VclPtr<ScTPValidationValue> m_pPage; - virtual void Click() override; - public: - ScRefButtonEx(vcl::Window* pParent, WinBits nStyle) - : ::formula::RefButton(pParent, nStyle) - , m_pPage(nullptr) - { - } - virtual ~ScRefButtonEx() override; - virtual void dispose() override; - void SetParentPage(ScTPValidationValue *pPage) - { - m_pPage = pPage; - } - ScTPValidationValue* GetParentPage() - { - return m_pPage; - } - }; -private: - VclPtr<ScRefButtonEx> m_pBtnRef; - VclPtr<VclContainer> m_pRefGrid; - friend class ScRefButtonEx; + DECL_LINK( EditSetFocusHdl, formula::WeldRefEdit&, void ); + DECL_LINK( KillEditFocusHdl, formula::WeldRefEdit&, void ); + DECL_LINK( KillButtonFocusHdl, formula::WeldRefButton&, void ); + DECL_LINK( ClickHdl, formula::WeldRefButton&, void ); + + formula::WeldRefEdit* m_pRefEdit; + + std::unique_ptr<weld::ComboBox> m_xLbAllow; + std::unique_ptr<weld::CheckButton> m_xCbAllow; /// Allow blank cells. + std::unique_ptr<weld::CheckButton> m_xCbShow; /// Show selection list in cell. + std::unique_ptr<weld::CheckButton> m_xCbSort; /// Sort selection list in cell. + std::unique_ptr<weld::Label> m_xFtValue; + std::unique_ptr<weld::ComboBox> m_xLbValue; + std::unique_ptr<weld::Label> m_xFtMin; + std::unique_ptr<weld::Widget> m_xMinGrid; + std::unique_ptr<formula::WeldRefEdit> m_xEdMin; + std::unique_ptr<weld::TextView> m_xEdList; /// Entries for explicit list + std::unique_ptr<weld::Label> m_xFtMax; + std::unique_ptr<formula::WeldRefEdit> m_xEdMax; + std::unique_ptr<weld::Label> m_xFtHint; /// Hint text for cell range validity. + std::unique_ptr<formula::WeldRefButton> m_xBtnRef; + std::unique_ptr<weld::Container> m_xRefGrid; + + weld::Container* m_pRefEditParent; + weld::Container* m_pBtnRefParent; + void SetReferenceHdl( const ScRange& , const ScDocument* ); void SetActiveHdl(); - void RefInputStartPreHdl( formula::RefEdit* pEdit, const formula::RefButton* pButton ); + void RefInputStartPreHdl(formula::WeldRefEdit* pEdit, const formula::WeldRefButton* pButton); void RefInputDonePostHdl(); ScValidationDlg * GetValidationDlg(); public: void SetupRefDlg(); - void RemoveRefDlg(); + void RemoveRefDlg(bool bRestoreModal); }; /** The "Validity" tab dialog. */ class ScValidationDlg - : public ScRefHdlrImpl<ScValidationDlg, SfxTabDialog, false> + : public ScRefHdlrControllerImpl<ScValidationDlg, SfxTabDialogController, false> , public ScRefHandlerHelper { - typedef ScRefHdlrImpl<ScValidationDlg, SfxTabDialog, false> ScValidationDlgBase; + typedef ScRefHdlrControllerImpl<ScValidationDlg, SfxTabDialogController, false> ScValidationDlgBase; ScTabViewShell * const m_pTabVwSh; - VclPtr<VclHBox> m_pHBox; - sal_uInt16 m_nValuePageId; + OString m_sValuePageId; bool m_bOwnRefHdlr:1; bool m_bRefInputting:1; + std::unique_ptr<weld::Container> m_xHBox; + bool EnterRefStatus(); bool LeaveRefStatus(); public: - explicit ScValidationDlg( vcl::Window* pParent, const SfxItemSet* pArgSet, ScTabViewShell * pTabViewSh ); - virtual ~ScValidationDlg() override; - virtual void dispose() override - { - if( m_bOwnRefHdlr ) - RemoveRefDlg( false ); - m_pHBox.clear(); - ScRefHdlrImpl<ScValidationDlg, SfxTabDialog, false>::dispose(); - } - static ScValidationDlg * Find1AliveObject( vcl::Window *pAncestor ) + explicit ScValidationDlg(weld::Window* pParent, const SfxItemSet* pArgSet, ScTabViewShell* pTabViewSh); + virtual ~ScValidationDlg() override; + static std::shared_ptr<SfxDialogController> Find1AliveObject(weld::Window *pAncestor) { - return static_cast<ScValidationDlg *>( SC_MOD()->Find1RefWindow( SLOTID, pAncestor ) ); + return SC_MOD()->Find1RefWindow(SLOTID, pAncestor); } ScTabViewShell *GetTabViewShell() { @@ -198,9 +174,9 @@ public: } bool SetupRefDlg(); - bool RemoveRefDlg( bool bRestoreModal ); + bool RemoveRefDlg(bool bRestoreModal); - void SetModal( bool bModal ){ ScValidationDlgBase::SetModalInputMode( bModal ); } + void SetModal(bool bModal) { m_xDialog->set_modal(bModal); } virtual void SetReference( const ScRange& rRef, ScDocument* pDoc ) override { @@ -215,9 +191,9 @@ public: } bool IsRefInputting(){ return m_bRefInputting; } - vcl::Window* get_refinput_shrink_parent() { return m_pHBox; } + weld::Container* get_refinput_shrink_parent() { return m_xHBox.get(); } - virtual void RefInputStart( formula::RefEdit* pEdit, formula::RefButton* pButton = nullptr ) override + virtual void RefInputStart( formula::WeldRefEdit* pEdit, formula::WeldRefButton* pButton = nullptr ) override { if( !CanInputStart( pEdit ) ) return; @@ -228,7 +204,7 @@ public: ScValidationDlgBase::RefInputStart( pEdit, pButton ); } - virtual void RefInputStart( formula::WeldRefEdit* /*pEdit*/, formula::WeldRefButton* /*pButton*/ = nullptr ) override + virtual void RefInputStart( formula::RefEdit* /*pEdit*/, formula::RefButton* /*pButton*/ = nullptr ) override { assert(false); } @@ -249,15 +225,14 @@ public: enum { SLOTID = SID_VALIDITY_REFERENCE }; - bool Close() override + virtual void Close() override { - if( m_bOwnRefHdlr ) + if (m_bOwnRefHdlr) { - if (SfxTabPage* pPage = GetTabPage(m_nValuePageId)) - static_cast<ScTPValidationValue*>(pPage)->RemoveRefDlg(); + if (SfxTabPage* pPage = GetTabPage(m_sValuePageId)) + static_cast<ScTPValidationValue*>(pPage)->RemoveRefDlg(false); } - - return ScValidationDlgBase::Close(); + ScValidationDlgBase::Close(); } }; diff --git a/sc/source/ui/miscdlgs/anyrefdg.cxx b/sc/source/ui/miscdlgs/anyrefdg.cxx index 29c05945b30c..44eec39037c8 100644 --- a/sc/source/ui/miscdlgs/anyrefdg.cxx +++ b/sc/source/ui/miscdlgs/anyrefdg.cxx @@ -879,7 +879,7 @@ ScRefHandler::ScRefHandler( vcl::Window &rWindow, SfxBindings* pB, bool bBindRef if( bBindRef ) EnterRefMode(); } -ScRefHandler::ScRefHandler(SfxModelessDialogController& rController, SfxBindings* pB, bool bBindRef) +ScRefHandler::ScRefHandler(SfxDialogController& rController, SfxBindings* pB, bool bBindRef) : m_pController(&rController) , m_bInRefMode(false) , m_aHelper(this, pB) @@ -959,10 +959,6 @@ bool ScRefHandler::LeaveRefMode() lcl_HideAllReferences(); - if( Dialog *pDlg = dynamic_cast<Dialog*>( m_rWindow.get() ) ) - pDlg->SetModalInputMode(false); - if (m_pController) - m_pController->getDialog()->set_modal(false); SetDispatcherLock( false ); //! here and in DoClose ? ScTabViewShell* pScViewShell = ScTabViewShell::GetActiveViewShell(); diff --git a/sc/source/ui/view/cellsh2.cxx b/sc/source/ui/view/cellsh2.cxx index f827a032e1c2..9043bd3a4ba9 100644 --- a/sc/source/ui/view/cellsh2.cxx +++ b/sc/source/ui/view/cellsh2.cxx @@ -210,6 +210,26 @@ static bool lcl_GetSortParam( const ScViewData* pData, const ScSortParam& rSortP return bSort; } +namespace +{ + // this registers the dialog which Find1RefWindow search for + class ScValidationRegisteredDlg + { + std::shared_ptr<SfxDialogController> m_xDlg; + public: + ScValidationRegisteredDlg(weld::Window* pParent, std::shared_ptr<SfxDialogController>& rDlg) + : m_xDlg(rDlg) + { + SC_MOD()->RegisterRefController(static_cast<sal_uInt16>(ScValidationDlg::SLOTID), m_xDlg, pParent); + } + ~ScValidationRegisteredDlg() + { + m_xDlg->Close(); + SC_MOD()->UnregisterRefController(static_cast<sal_uInt16>(ScValidationDlg::SLOTID), m_xDlg); + } + }; +} + void ScCellShell::ExecuteDB( SfxRequest& rReq ) { ScTabViewShell* pTabViewShell = GetViewData()->GetViewShell(); @@ -870,12 +890,15 @@ void ScCellShell::ExecuteDB( SfxRequest& rReq ) } // cell range picker - ScopedVclPtrInstance<ScValidationDlg> pDlg(GetViewData()->GetActiveWin(), &aArgSet, pTabViewShell); + vcl::Window* pWin = GetViewData()->GetActiveWin(); + weld::Window* pParentWin = pWin ? pWin->GetFrameWeld() : nullptr; + std::shared_ptr<SfxDialogController> xDlg(new ScValidationDlg(pParentWin, &aArgSet, pTabViewShell)); + ScValidationRegisteredDlg aRegisterThatDlgExists(pParentWin, xDlg); - short nResult = pDlg->Execute(); + short nResult = xDlg->run(); if ( nResult == RET_OK ) { - const SfxItemSet* pOutSet = pDlg->GetOutputItemSet(); + const SfxItemSet* pOutSet = static_cast<ScValidationDlg*>(xDlg.get())->GetOutputItemSet(); if ( pOutSet->GetItemState( FID_VALID_MODE, true, &pItem ) == SfxItemState::SET ) eMode = static_cast<ScValidationMode>(static_cast<const SfxAllEnumItem*>(pItem)->GetValue()); diff --git a/sc/source/ui/view/reffact.cxx b/sc/source/ui/view/reffact.cxx index 02c89d153321..4ccce3e9f575 100644 --- a/sc/source/ui/view/reffact.cxx +++ b/sc/source/ui/view/reffact.cxx @@ -306,38 +306,33 @@ namespace } } -ScValidityRefChildWin::ScValidityRefChildWin( vcl::Window* pParentP, - sal_uInt16 nId, - const SfxBindings* p, +ScValidityRefChildWin::ScValidityRefChildWin(vcl::Window* pParentP, + sal_uInt16 nId, + const SfxBindings* p, SAL_UNUSED_PARAMETER SfxChildWinInfo* /*pInfo*/ ) - : SfxChildWindow(pParentP, nId), - m_bVisibleLock( false ), - m_bFreeWindowLock( false ), - m_pSavedWndParent( nullptr ) + : SfxChildWindow(pParentP, nId) + , m_bVisibleLock(false) + , m_bFreeWindowLock(false) { SetWantsFocus( false ); - VclPtr<ScValidationDlg> pDlg = ScValidationDlg::Find1AliveObject( pParentP ); - SetWindow(pDlg); + std::shared_ptr<SfxDialogController> xDlg(ScValidationDlg::Find1AliveObject(pParentP->GetFrameWeld())); + SetController(xDlg); ScTabViewShell* pViewShell; - if (pDlg) - pViewShell = static_cast<ScValidationDlg*>(GetWindow())->GetTabViewShell(); + if (xDlg) + pViewShell = static_cast<ScValidationDlg*>(xDlg.get())->GetTabViewShell(); else pViewShell = lcl_GetTabViewShell( p ); if (!pViewShell) pViewShell = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() ); OSL_ENSURE( pViewShell, "missing view shell :-(" ); - if (pViewShell && !GetWindow()) + if (pViewShell && !xDlg) pViewShell->GetViewFrame()->SetChildWindow( nId, false ); - - if( GetWindow() ) m_pSavedWndParent = GetWindow()->GetParent(); } ScValidityRefChildWin::~ScValidityRefChildWin() { - if( GetWindow() ) GetWindow()->SetParent( m_pSavedWndParent ); - - if( m_bFreeWindowLock ) - SetWindow(nullptr); + if (m_bFreeWindowLock) + SetController(nullptr); } IMPL_CHILD_CTOR( ScCondFormatDlgWrapper, WID_CONDFRMT_REF ) diff --git a/sc/uiconfig/scalc/ui/validationcriteriapage.ui b/sc/uiconfig/scalc/ui/validationcriteriapage.ui index 2bf0bab17955..00897a20510e 100644 --- a/sc/uiconfig/scalc/ui/validationcriteriapage.ui +++ b/sc/uiconfig/scalc/ui/validationcriteriapage.ui @@ -1,96 +1,7 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.18.3 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> - <requires lib="LibreOffice" version="1.0"/> - <object class="GtkListStore" id="liststore1"> - <columns> - <!-- column-name gchararray1 --> - <column type="gchararray"/> - <!-- column-name gint1 --> - <column type="gint"/> - </columns> - <data> - <row> - <col id="0" translatable="yes" context="validationcriteriapage|liststore1">All values</col> - <col id="1">0</col> - </row> - <row> - <col id="0" translatable="yes" context="validationcriteriapage|liststore1">Whole Numbers</col> - <col id="1">1</col> - </row> - <row> - <col id="0" translatable="yes" context="validationcriteriapage|liststore1">Decimal</col> - <col id="1">2</col> - </row> - <row> - <col id="0" translatable="yes" context="validationcriteriapage|liststore1">Date</col> - <col id="1">3</col> - </row> - <row> - <col id="0" translatable="yes" context="validationcriteriapage|liststore1">Time</col> - <col id="1">4</col> - </row> - <row> - <col id="0" translatable="yes" context="validationcriteriapage|liststore1">Cell range</col> - <col id="1">5</col> - </row> - <row> - <col id="0" translatable="yes" context="validationcriteriapage|liststore1">List</col> - <col id="1">6</col> - </row> - <row> - <col id="0" translatable="yes" context="validationcriteriapage|liststore1">Text length</col> - <col id="1">7</col> - </row> - <row> - <col id="0" translatable="yes" context="validationcriteriapage|liststore1">Custom</col> - <col id="1">8</col> - </row> - </data> - </object> - <object class="GtkListStore" id="liststore2"> - <columns> - <!-- column-name gchararray1 --> - <column type="gchararray"/> - <!-- column-name gint1 --> - <column type="gint"/> - </columns> - <data> - <row> - <col id="0" translatable="yes" context="validationcriteriapage|liststore2">equal</col> - <col id="1">0</col> - </row> - <row> - <col id="0" translatable="yes" context="validationcriteriapage|liststore2">less than</col> - <col id="1">1</col> - </row> - <row> - <col id="0" translatable="yes" context="validationcriteriapage|liststore2">greater than</col> - <col id="1">2</col> - </row> - <row> - <col id="0" translatable="yes" context="validationcriteriapage|liststore2">less than or equal</col> - <col id="1">3</col> - </row> - <row> - <col id="0" translatable="yes" context="validationcriteriapage|liststore2">greater than or equal to</col> - <col id="1">4</col> - </row> - <row> - <col id="0" translatable="yes" context="validationcriteriapage|liststore2">not equal</col> - <col id="1">5</col> - </row> - <row> - <col id="0" translatable="yes" context="validationcriteriapage|liststore2">valid range</col> - <col id="1">6</col> - </row> - <row> - <col id="0" translatable="yes" context="validationcriteriapage|liststore2">invalid range</col> - <col id="1">7</col> - </row> - </data> - </object> <object class="GtkGrid" id="ValidationCriteriaPage"> <property name="visible">True</property> <property name="can_focus">False</property> @@ -103,10 +14,10 @@ <object class="GtkLabel" id="label1"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="validationcriteriapage|label1">_Allow:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">allow</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -117,10 +28,10 @@ <object class="GtkLabel" id="valueft"> <property name="can_focus">False</property> <property name="no_show_all">True</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="validationcriteriapage|valueft">_Data:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">data</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -128,10 +39,20 @@ </packing> </child> <child> - <object class="GtkComboBox" id="allow"> + <object class="GtkComboBoxText" id="allow"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="model">liststore1</property> + <items> + <item id="0" translatable="yes" context="validationcriteriapage|liststore1">All values</item> + <item id="1" translatable="yes" context="validationcriteriapage|liststore1">Whole Numbers</item> + <item id="2" translatable="yes" context="validationcriteriapage|liststore1">Decimal</item> + <item id="3" translatable="yes" context="validationcriteriapage|liststore1">Date</item> + <item id="4" translatable="yes" context="validationcriteriapage|liststore1">Time</item> + <item id="5" translatable="yes" context="validationcriteriapage|liststore1">Cell range</item> + <item id="6" translatable="yes" context="validationcriteriapage|liststore1">List</item> + <item id="7" translatable="yes" context="validationcriteriapage|liststore1">Text length</item> + <item id="8" translatable="yes" context="validationcriteriapage|liststore1">Custom</item> + </items> </object> <packing> <property name="left_attach">1</property> @@ -139,10 +60,19 @@ </packing> </child> <child> - <object class="GtkComboBox" id="data"> + <object class="GtkComboBoxText" id="data"> <property name="can_focus">False</property> <property name="no_show_all">True</property> - <property name="model">liststore2</property> + <items> + <item id="0" translatable="yes" context="validationcriteriapage|liststore2">equal</item> + <item id="1" translatable="yes" context="validationcriteriapage|liststore2">less than</item> + <item id="2" translatable="yes" context="validationcriteriapage|liststore2">greater than</item> + <item id="3" translatable="yes" context="validationcriteriapage|liststore2">less than or equal</item> + <item id="4" translatable="yes" context="validationcriteriapage|liststore2">greater than or equal to</item> + <item id="5" translatable="yes" context="validationcriteriapage|liststore2">not equal</item> + <item id="6" translatable="yes" context="validationcriteriapage|liststore2">valid range</item> + <item id="7" translatable="yes" context="validationcriteriapage|liststore2">invalid range</item> + </items> </object> <packing> <property name="left_attach">1</property> @@ -153,10 +83,10 @@ <object class="GtkLabel" id="minft"> <property name="visible">True</property> <property name="can_focus">False</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="validationcriteriapage|minft">_Minimum:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">mingrid</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -175,10 +105,11 @@ <property name="hexpand">True</property> <property name="column_spacing">12</property> <child> - <object class="foruilo-RefEdit" id="min"> + <object class="GtkEntry" id="min"> <property name="can_focus">True</property> <property name="no_show_all">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> </object> <packing> <property name="left_attach">0</property> @@ -186,7 +117,7 @@ </packing> </child> <child> - <object class="sclo-ScRefButtonEx" id="validref"> + <object class="GtkButton" id="validref"> <property name="can_focus">True</property> <property name="receives_default">True</property> <property name="no_show_all">True</property> @@ -212,7 +143,7 @@ <property name="vexpand">True</property> <property name="shadow_type">in</property> <child> - <object class="GtkTextView" id="minlist:border"> + <object class="GtkTextView" id="minlist"> <property name="visible">True</property> <property name="can_focus">True</property> <property name="hexpand">True</property> @@ -235,10 +166,10 @@ <object class="GtkLabel" id="maxft"> <property name="can_focus">False</property> <property name="no_show_all">True</property> - <property name="xalign">0</property> <property name="label" translatable="yes" context="validationcriteriapage|maxft">Ma_ximum:</property> <property name="use_underline">True</property> <property name="mnemonic_widget">max</property> + <property name="xalign">0</property> </object> <packing> <property name="left_attach">0</property> @@ -296,11 +227,11 @@ <object class="GtkLabel" id="hintft"> <property name="can_focus">False</property> <property name="no_show_all">True</property> - <property name="xalign">0</property> - <property name="yalign">0</property> <property name="label" translatable="yes" context="validationcriteriapage|hintft">A valid source can only consist of a contiguous selection of rows and columns, or a formula that results in an area or array.</property> <property name="wrap">True</property> <property name="max_width_chars">50</property> + <property name="xalign">0</property> + <property name="yalign">0</property> </object> <packing> <property name="left_attach">1</property> @@ -308,10 +239,11 @@ </packing> </child> <child> - <object class="foruilo-RefEdit" id="max"> + <object class="GtkEntry" id="max"> <property name="can_focus">True</property> <property name="no_show_all">True</property> <property name="hexpand">True</property> + <property name="activates_default">True</property> </object> <packing> <property name="left_attach">1</property> diff --git a/sc/uiconfig/scalc/ui/validationdialog.ui b/sc/uiconfig/scalc/ui/validationdialog.ui index f3a7b0ebefae..84441ca5b2c6 100644 --- a/sc/uiconfig/scalc/ui/validationdialog.ui +++ b/sc/uiconfig/scalc/ui/validationdialog.ui @@ -1,5 +1,5 @@ <?xml version="1.0" encoding="UTF-8"?> -<!-- Generated with glade 3.20.0 --> +<!-- Generated with glade 3.22.1 --> <interface domain="sc"> <requires lib="gtk+" version="3.18"/> <object class="GtkDialog" id="ValidationDialog"> @@ -7,7 +7,13 @@ <property name="border_width">6</property> <property name="title" translatable="yes" context="validationdialog|ValidationDialog">Validity</property> <property name="resizable">False</property> + <property name="modal">True</property> + <property name="default_width">0</property> + <property name="default_height">0</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> @@ -18,12 +24,10 @@ <property name="can_focus">False</property> <property name="layout_style">end</property> <child> - <object class="GtkButton" id="ok"> - <property name="label">gtk-ok</property> + <object class="GtkButton" id="reset"> + <property name="label">gtk-revert-to-saved</property> <property name="visible">True</property> <property name="can_focus">True</property> - <property name="can_default">True</property> - <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> @@ -34,10 +38,12 @@ </packing> </child> <child> - <object class="GtkButton" id="cancel"> - <property name="label">gtk-cancel</property> + <object class="GtkButton" id="ok"> + <property name="label">gtk-ok</property> <property name="visible">True</property> <property name="can_focus">True</property> + <property name="can_default">True</property> + <property name="has_default">True</property> <property name="receives_default">True</property> <property name="use_stock">True</property> </object> @@ -48,8 +54,8 @@ </packing> </child> <child> - <object class="GtkButton" id="help"> - <property name="label">gtk-help</property> + <object class="GtkButton" id="cancel"> + <property name="label">gtk-cancel</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -59,12 +65,11 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="position">2</property> - <property name="secondary">True</property> </packing> </child> <child> - <object class="GtkButton" id="reset"> - <property name="label">gtk-revert-to-saved</property> + <object class="GtkButton" id="help"> + <property name="label">gtk-help</property> <property name="visible">True</property> <property name="can_focus">True</property> <property name="receives_default">True</property> @@ -74,6 +79,7 @@ <property name="expand">False</property> <property name="fill">True</property> <property name="position">3</property> + <property name="secondary">True</property> </packing> </child> </object> @@ -104,6 +110,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> </child> <child type="tab"> @@ -123,6 +153,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">1</property> @@ -146,6 +200,30 @@ <child> <placeholder/> </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> + <child> + <placeholder/> + </child> </object> <packing> <property name="position">2</property> @@ -193,10 +271,10 @@ </object> </child> <action-widgets> + <action-widget response="101">reset</action-widget> <action-widget response="-5">ok</action-widget> <action-widget response="-6">cancel</action-widget> <action-widget response="-11">help</action-widget> - <action-widget response="0">reset</action-widget> </action-widgets> </object> </interface> diff --git a/solenv/bin/native-code.py b/solenv/bin/native-code.py index 4992863879e1..417dcfd57c3d 100755 --- a/solenv/bin/native-code.py +++ b/solenv/bin/native-code.py @@ -474,7 +474,6 @@ custom_widgets = [ 'ScPivotLayoutTreeList', 'ScPivotLayoutTreeListData', 'ScPivotLayoutTreeListLabel', - 'ScRefButtonEx', 'SdPageObjsTLB', 'SearchBox', 'SearchResultsBox', diff --git a/solenv/sanitizers/ui/modules/scalc.suppr b/solenv/sanitizers/ui/modules/scalc.suppr index 6eecccc9cd70..80af63f13573 100644 --- a/solenv/sanitizers/ui/modules/scalc.suppr +++ b/solenv/sanitizers/ui/modules/scalc.suppr @@ -271,10 +271,11 @@ sc/uiconfig/scalc/ui/ttestdialog.ui://GtkButton[@id='output-range-button'] butto sc/uiconfig/scalc/ui/textimportcsv.ui://sclo-ScCsvTableBox[@id='scrolledwindowcolumntype'] no-labelled-by sc/uiconfig/scalc/ui/textimportcsv.ui://GtkLabel[@id='textalttitle'] orphan-label sc/uiconfig/scalc/ui/texttransformationentry.ui:GtkGrid[@id='grid']/GtkBox/GtkLabel orphan-label -sc/uiconfig/scalc/ui/validationcriteriapage.ui://foruilo-RefEdit[@id='min'] no-labelled-by -sc/uiconfig/scalc/ui/validationcriteriapage.ui://sclo-ScRefButtonEx[@id='validref'] no-labelled-by -sc/uiconfig/scalc/ui/validationcriteriapage.ui://GtkTextView[@id='minlist:border'] no-labelled-by +sc/uiconfig/scalc/ui/validationcriteriapage.ui://GtkEntry[@id='min'] no-labelled-by +sc/uiconfig/scalc/ui/validationcriteriapage.ui://GtkButton[@id='validref'] no-labelled-by +sc/uiconfig/scalc/ui/validationcriteriapage.ui://GtkTextView[@id='minlist'] no-labelled-by sc/uiconfig/scalc/ui/validationcriteriapage.ui://GtkLabel[@id='hintft'] orphan-label +sc/uiconfig/scalc/ui/validationcriteriapage.ui://GtkButton[@id='validref'] button-no-label sc/uiconfig/scalc/ui/xmlsourcedialog.ui://GtkLabel[@id='sourcefile'] orphan-label sc/uiconfig/scalc/ui/xmlsourcedialog.ui://vcllo-SvTreeListBox[@id='tree:border'] no-labelled-by sc/uiconfig/scalc/ui/xmlsourcedialog.ui://GtkLabel[@id='label5'] orphan-label diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index cb816b751cd9..0f09eb6e0877 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -2666,11 +2666,13 @@ struct DialogRunner gint m_nResponseId; GMainLoop *m_pLoop; VclPtr<vcl::Window> m_xFrameWindow; + int m_nModalDepth; DialogRunner(GtkDialog* pDialog) : m_pDialog(pDialog) , m_nResponseId(GTK_RESPONSE_NONE) , m_pLoop(nullptr) + , m_nModalDepth(0) { GtkWindow* pParent = gtk_window_get_transient_for(GTK_WINDOW(m_pDialog)); GtkSalFrame* pFrame = pParent ? GtkSalFrame::getFromWindow(pParent) : nullptr; @@ -2711,13 +2713,19 @@ struct DialogRunner void inc_modal_count() { if (m_xFrameWindow) + { m_xFrameWindow->IncModalCount(); + ++m_nModalDepth; + } } void dec_modal_count() { if (m_xFrameWindow) + { m_xFrameWindow->DecModalCount(); + --m_nModalDepth; + } } // same as gtk_dialog_run except that unmap doesn't auto-respond @@ -2764,6 +2772,18 @@ struct DialogRunner return m_nResponseId; } + + ~DialogRunner() + { + if (m_xFrameWindow) + { + // if, like the calc validation dialog does, the modality was + // toggled off during execution ensure that on cleanup the parent + // is left in the state it was found + while (m_nModalDepth++ < 0) + m_xFrameWindow->IncModalCount(); + } + } }; typedef std::set<GtkWidget*> winset; @@ -2954,6 +2974,22 @@ public: m_aDialogRun.inc_modal_count(); } + virtual void set_modal(bool bModal) override + { + if (get_modal() == bModal) + return; + GtkInstanceWindow::set_modal(bModal); + // see hide comment, but the modality-change example + // is the validity dialog in calc + if (m_aDialogRun.loop_is_running()) + { + if (bModal) + m_aDialogRun.inc_modal_count(); + else + m_aDialogRun.dec_modal_count(); + } + } + static int VclToGtk(int nResponse) { if (nResponse == RET_OK) |