From ab4609c8f9756e4fe6959a10e54ebee9105edbf7 Mon Sep 17 00:00:00 2001 From: Caolán McNamara Date: Tue, 1 May 2018 16:03:24 +0100 Subject: weld ScMoveTableDlg MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Change-Id: I4d5601d0fb02a20bf6c83fc10411f610bdb5ce32 Reviewed-on: https://gerrit.libreoffice.org/53698 Tested-by: Jenkins Reviewed-by: Caolán McNamara Tested-by: Caolán McNamara --- cui/source/dialogs/multipat.cxx | 2 +- cui/source/dialogs/pastedlg.cxx | 2 +- include/vcl/weld.hxx | 15 +- sc/inc/scabstdlg.hxx | 2 +- sc/qa/unit/screenshots/screenshots.cxx | 2 +- sc/source/ui/attrdlg/scdlgfact.cxx | 24 ++-- sc/source/ui/attrdlg/scdlgfact.hxx | 10 +- sc/source/ui/inc/mvtabdlg.hxx | 38 +++--- sc/source/ui/miscdlgs/mvtabdlg.cxx | 242 +++++++++++++++------------------ sc/source/ui/miscdlgs/shtabdlg.cxx | 2 +- sc/source/ui/view/tabvwshf.cxx | 2 +- sc/uiconfig/scalc/ui/movecopysheet.ui | 48 +++++-- vcl/source/app/salvtables.cxx | 14 +- vcl/unx/gtk3/gtk3gtkinst.cxx | 14 +- 14 files changed, 227 insertions(+), 190 deletions(-) diff --git a/cui/source/dialogs/multipat.cxx b/cui/source/dialogs/multipat.cxx index d703b914acf7..ec1ecffa957f 100644 --- a/cui/source/dialogs/multipat.cxx +++ b/cui/source/dialogs/multipat.cxx @@ -115,7 +115,7 @@ IMPL_LINK_NOARG(SvxPathSelectDialog, AddHdl_Impl, weld::Button&, void) OUString sInsPath; osl::FileBase::getSystemPathFromFileURL(aURL, sInsPath); - if (m_xPathLB->find(sInsPath) != -1) + if (m_xPathLB->find_text(sInsPath) != -1) { OUString sMsg( CuiResId( RID_MULTIPATH_DBL_ERR ) ); sMsg = sMsg.replaceFirst( "%1", sInsPath ); diff --git a/cui/source/dialogs/pastedlg.cxx b/cui/source/dialogs/pastedlg.cxx index 36964d485153..27297eaf903e 100644 --- a/cui/source/dialogs/pastedlg.cxx +++ b/cui/source/dialogs/pastedlg.cxx @@ -153,7 +153,7 @@ SotClipboardFormatId SvPasteObjectDialog::GetFormat( const TransferableDataHelpe continue; } - if (ObjectLB().find(aName) == -1) + if (ObjectLB().find_text(aName) == -1) { ObjectLB().append(OUString::number(static_cast(nFormat)), aName, ""); } diff --git a/include/vcl/weld.hxx b/include/vcl/weld.hxx index 702b0cf415c7..9d3ab732984a 100644 --- a/include/vcl/weld.hxx +++ b/include/vcl/weld.hxx @@ -249,6 +249,9 @@ public: virtual bool get_entry_selection_bounds(int& rStartPos, int& rEndPos) = 0; virtual void set_entry_completion(bool bEnable) = 0; + virtual void freeze() = 0; + virtual void thaw() = 0; + void connect_entry_activate(const Link& rLink) { m_aEntryActivateHdl = rLink; @@ -299,18 +302,18 @@ public: virtual std::vector get_selected_rows() const = 0; //by text - virtual OUString get(int pos) const = 0; - virtual int find(const OUString& rText) const = 0; - OUString get_selected_text() const { return get(get_selected_index()); } - void select_text(const OUString& rText) { select(find(rText)); } - void remove_text(const OUString& rText) { remove(find(rText)); } + virtual OUString get_text(int pos) const = 0; + virtual int find_text(const OUString& rText) const = 0; + OUString get_selected_text() const { return get_text(get_selected_index()); } + void select_text(const OUString& rText) { select(find_text(rText)); } + void remove_text(const OUString& rText) { remove(find_text(rText)); } std::vector get_selected_rows_text() const { std::vector aRows(get_selected_rows()); std::vector aRet; aRet.reserve(aRows.size()); for (auto a : aRows) - aRet.push_back(get(a)); + aRet.push_back(get_text(a)); return aRet; } diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx index 247cf444e813..77c3410f0aee 100644 --- a/sc/inc/scabstdlg.hxx +++ b/sc/inc/scabstdlg.hxx @@ -463,7 +463,7 @@ public: long nMaximum, long nMinimum = 0 ) = 0; - virtual VclPtr CreateScMoveTableDlg(vcl::Window * pParent, + virtual VclPtr CreateScMoveTableDlg(weld::Window * pParent, const OUString& rDefault) = 0; virtual VclPtr CreateScNameCreateDlg(weld::Window * pParent, diff --git a/sc/qa/unit/screenshots/screenshots.cxx b/sc/qa/unit/screenshots/screenshots.cxx index 5db47d1baa3b..b1aadf398899 100644 --- a/sc/qa/unit/screenshots/screenshots.cxx +++ b/sc/qa/unit/screenshots/screenshots.cxx @@ -236,7 +236,7 @@ VclPtr ScScreenshotTest::createDialogByID(sal_uInt32 nID) case 12: // "modules/scalc/ui/movecopysheet.ui" { - pReturnDialog = mpFact->CreateScMoveTableDlg(mpViewShell->GetDialogParent(), aDefaultSheetName); + pReturnDialog = mpFact->CreateScMoveTableDlg(mpViewShell->GetFrameWeld(), aDefaultSheetName); break; } diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx index 956bde11296d..35279d838fc8 100644 --- a/sc/source/ui/attrdlg/scdlgfact.cxx +++ b/sc/source/ui/attrdlg/scdlgfact.cxx @@ -117,7 +117,10 @@ short AbstractScMetricInputDlg_Impl::Execute() return m_xDlg->run(); } -IMPL_ABSTDLG_BASE(AbstractScMoveTableDlg_Impl); +short AbstractScMoveTableDlg_Impl::Execute() +{ + return m_xDlg->run(); +} short AbstractScNameCreateDlg_Impl::Execute() { @@ -483,37 +486,37 @@ int AbstractScMetricInputDlg_Impl::GetInputValue() const sal_uInt16 AbstractScMoveTableDlg_Impl::GetSelectedDocument() const { - return pDlg->GetSelectedDocument(); + return m_xDlg->GetSelectedDocument(); } sal_uInt16 AbstractScMoveTableDlg_Impl::GetSelectedTable() const { - return pDlg->GetSelectedTable(); + return m_xDlg->GetSelectedTable(); } bool AbstractScMoveTableDlg_Impl::GetCopyTable() const { - return pDlg->GetCopyTable(); + return m_xDlg->GetCopyTable(); } bool AbstractScMoveTableDlg_Impl::GetRenameTable() const { - return pDlg->GetRenameTable(); + return m_xDlg->GetRenameTable(); } void AbstractScMoveTableDlg_Impl::GetTabNameString( OUString& rString ) const { - pDlg->GetTabNameString( rString ); + m_xDlg->GetTabNameString( rString ); } void AbstractScMoveTableDlg_Impl::SetForceCopyTable() { - return pDlg->SetForceCopyTable(); + return m_xDlg->SetForceCopyTable(); } void AbstractScMoveTableDlg_Impl::EnableRenameTable(bool bFlag) { - return pDlg->EnableRenameTable( bFlag); + return m_xDlg->EnableRenameTable( bFlag); } CreateNameFlags AbstractScNameCreateDlg_Impl::GetFlags() const @@ -785,11 +788,10 @@ VclPtr ScAbstractDialogFactory_Impl::CreateScMetricInp nDecimals, nMaximum , nMinimum)); } -VclPtr ScAbstractDialogFactory_Impl::CreateScMoveTableDlg(vcl::Window* pParent, +VclPtr ScAbstractDialogFactory_Impl::CreateScMoveTableDlg(weld::Window* pParent, const OUString& rDefault) { - VclPtr pDlg = VclPtr::Create( pParent, rDefault ); - return VclPtr::Create( pDlg ); + return VclPtr::Create(new ScMoveTableDlg(pParent, rDefault)); } VclPtr ScAbstractDialogFactory_Impl::CreateScNameCreateDlg(weld::Window * pParent, CreateNameFlags nFlags) diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx index 37fbb79a6034..3da1d5a9767d 100644 --- a/sc/source/ui/attrdlg/scdlgfact.hxx +++ b/sc/source/ui/attrdlg/scdlgfact.hxx @@ -296,7 +296,13 @@ public: class AbstractScMoveTableDlg_Impl : public AbstractScMoveTableDlg { - DECL_ABSTDLG_BASE( AbstractScMoveTableDlg_Impl, ScMoveTableDlg) + std::unique_ptr m_xDlg; +public: + explicit AbstractScMoveTableDlg_Impl(ScMoveTableDlg* p) + : m_xDlg(p) + { + } + virtual short Execute() override; virtual sal_uInt16 GetSelectedDocument () const override; virtual sal_uInt16 GetSelectedTable () const override; virtual bool GetCopyTable () const override; @@ -513,7 +519,7 @@ public: long nMaximum, long nMinimum = 0 ) override; - virtual VclPtr CreateScMoveTableDlg(vcl::Window * pParent, + virtual VclPtr CreateScMoveTableDlg(weld::Window * pParent, const OUString& rDefault) override; virtual VclPtr CreateScNameCreateDlg(weld::Window * pParent, diff --git a/sc/source/ui/inc/mvtabdlg.hxx b/sc/source/ui/inc/mvtabdlg.hxx index 5a31e88dfc77..8f1acc65f6d3 100644 --- a/sc/source/ui/inc/mvtabdlg.hxx +++ b/sc/source/ui/inc/mvtabdlg.hxx @@ -21,18 +21,13 @@ #define INCLUDED_SC_SOURCE_UI_INC_MVTABDLG_HXX #include -#include -#include -#include -#include -#include +#include -class ScMoveTableDlg : public ModalDialog +class ScMoveTableDlg : public weld::GenericDialogController { public: - ScMoveTableDlg(vcl::Window* pParent, const OUString& rDefault); + ScMoveTableDlg(weld::Window* pParent, const OUString& rDefault); virtual ~ScMoveTableDlg() override; - virtual void dispose() override; sal_uInt16 GetSelectedDocument () const { return nDocument; } SCTAB GetSelectedTable () const { return nTable; } @@ -48,14 +43,6 @@ private: ScDocument* GetSelectedDoc(); private: - VclPtr pBtnMove; - VclPtr pBtnCopy; - VclPtr pLbDoc; - VclPtr pLbTable; - VclPtr pEdTabName; - VclPtr pFtWarn; - VclPtr pBtnOk; - OUString msCurrentDoc; OUString msNewDoc; @@ -72,12 +59,23 @@ private: bool bRenameTable:1; bool mbEverEdited:1; + std::unique_ptr m_xBtnMove; + std::unique_ptr m_xBtnCopy; + std::unique_ptr m_xLbDoc; + std::unique_ptr m_xLbTable; + std::unique_ptr m_xEdTabName; + std::unique_ptr m_xFtWarn; + std::unique_ptr m_xBtnOk; + std::unique_ptr m_xUnusedLabel; + std::unique_ptr m_xEmptyLabel; + std::unique_ptr m_xInvalidLabel; + void Init (); void InitDocListBox (); - DECL_LINK( OkHdl, Button*, void ); - DECL_LINK( SelHdl, ListBox&, void ); - DECL_LINK( CheckBtnHdl, RadioButton&, void ); - DECL_LINK( CheckNameHdl, Edit&, void ); + DECL_LINK(OkHdl, weld::Button&, void); + DECL_LINK(SelHdl, weld::ComboBoxText&, void); + DECL_LINK(CheckBtnHdl, weld::ToggleButton&, void); + DECL_LINK(CheckNameHdl, weld::Entry&, void); }; #endif // INCLUDED_SC_SOURCE_UI_INC_MVTABDLG_HXX diff --git a/sc/source/ui/miscdlgs/mvtabdlg.cxx b/sc/source/ui/miscdlgs/mvtabdlg.cxx index 9c099d6c5536..fb7926441522 100644 --- a/sc/source/ui/miscdlgs/mvtabdlg.cxx +++ b/sc/source/ui/miscdlgs/mvtabdlg.cxx @@ -25,73 +25,61 @@ #include #include -ScMoveTableDlg::ScMoveTableDlg(vcl::Window* pParent, const OUString& rDefault) - - : ModalDialog ( pParent, "MoveCopySheetDialog", "modules/scalc/ui/movecopysheet.ui" ), - maDefaultName( rDefault ), - mnCurrentDocPos( 0 ), - nDocument ( 0 ), - nTable ( 0 ), - bCopyTable ( false ), - bRenameTable( false ), - mbEverEdited( false ) +ScMoveTableDlg::ScMoveTableDlg(weld::Window* pParent, const OUString& rDefault) + : GenericDialogController(pParent, "modules/scalc/ui/movecopysheet.ui", "MoveCopySheetDialog") + , maDefaultName(rDefault) + , mnCurrentDocPos(0) + , nDocument(0) + , nTable(0) + , bCopyTable(false) + , bRenameTable(false) + , mbEverEdited(false) + , m_xBtnMove(m_xBuilder->weld_radio_button("move")) + , m_xBtnCopy(m_xBuilder->weld_radio_button("copy")) + , m_xLbDoc(m_xBuilder->weld_combo_box_text("toDocument")) + , m_xLbTable(m_xBuilder->weld_tree_view("insertBefore")) + , m_xEdTabName(m_xBuilder->weld_entry("newName")) + , m_xFtWarn(m_xBuilder->weld_label("newNameWarn")) + , m_xBtnOk(m_xBuilder->weld_button("ok")) + , m_xUnusedLabel(m_xBuilder->weld_label("warnunused")) + , m_xEmptyLabel(m_xBuilder->weld_label("warnempty")) + , m_xInvalidLabel(m_xBuilder->weld_label("warninvalid")) { - get(pBtnMove, "move"); - get(pBtnCopy, "copy"); - get(pLbDoc, "toDocument"); - - assert(pLbDoc->GetEntryCount() == 2); - msCurrentDoc = pLbDoc->GetEntry(0); - msNewDoc = pLbDoc->GetEntry(1); - pLbDoc->Clear(); - assert(pLbDoc->GetEntryCount() == 0); - - get(pLbTable, "insertBefore"); - pLbTable->set_height_request(pLbTable->GetTextHeight() * 8); - get(pEdTabName, "newName"); - get(pFtWarn, "newNameWarn"); - get(pBtnOk, "ok"); - - msStrTabNameUsed = get("warnunused")->GetText(); - msStrTabNameEmpty = get("warnempty")->GetText(); - msStrTabNameInvalid = get("warninvalid")->GetText(); + assert(m_xLbDoc->get_count() == 2); + msCurrentDoc = m_xLbDoc->get_text(0); + msNewDoc = m_xLbDoc->get_text(1); + m_xLbDoc->clear(); + assert(m_xLbDoc->get_count() == 0); + + m_xLbTable->set_size_request(-1, m_xLbTable->get_height_rows(8)); + + msStrTabNameUsed = m_xUnusedLabel->get_label(); + msStrTabNameEmpty = m_xEmptyLabel->get_label(); + msStrTabNameInvalid = m_xInvalidLabel->get_label(); Init(); } ScMoveTableDlg::~ScMoveTableDlg() { - disposeOnce(); -} - -void ScMoveTableDlg::dispose() -{ - pBtnMove.clear(); - pBtnCopy.clear(); - pLbDoc.clear(); - pLbTable.clear(); - pEdTabName.clear(); - pFtWarn.clear(); - pBtnOk.clear(); - ModalDialog::dispose(); } void ScMoveTableDlg::GetTabNameString( OUString& rString ) const { - rString = pEdTabName->GetText(); + rString = m_xEdTabName->get_text(); } void ScMoveTableDlg::SetForceCopyTable() { - pBtnCopy->Check(); - pBtnMove->Disable(); - pBtnCopy->Disable(); + m_xBtnCopy->set_active(true); + m_xBtnMove->set_sensitive(false); + m_xBtnCopy->set_sensitive(false); } void ScMoveTableDlg::EnableRenameTable(bool bFlag) { bRenameTable = bFlag; - pEdTabName->Enable(bFlag); + m_xEdTabName->set_sensitive(bFlag); ResetRenameInput(); } @@ -106,13 +94,13 @@ void ScMoveTableDlg::ResetRenameInput() return; } - if (!pEdTabName->IsEnabled()) + if (!m_xEdTabName->get_sensitive()) { - pEdTabName->SetText(OUString()); + m_xEdTabName->set_text(OUString()); return; } - bool bVal = pBtnCopy->IsChecked(); + bool bVal = m_xBtnCopy->get_active(); if (bVal) { // copy @@ -121,88 +109,89 @@ void ScMoveTableDlg::ResetRenameInput() { OUString aStr = maDefaultName; pDoc->CreateValidTabName(aStr); - pEdTabName->SetText(aStr); + m_xEdTabName->set_text(aStr); } else - pEdTabName->SetText(maDefaultName); + m_xEdTabName->set_text(maDefaultName); } else + { // move - pEdTabName->SetText(maDefaultName); + m_xEdTabName->set_text(maDefaultName); + } CheckNewTabName(); } void ScMoveTableDlg::CheckNewTabName() { - const OUString aNewName = pEdTabName->GetText(); + const OUString aNewName = m_xEdTabName->get_text(); if (aNewName.isEmpty()) { // New sheet name is empty. This is not good. - pFtWarn->Show(); - pFtWarn->SetControlBackground(COL_YELLOW); - pFtWarn->SetText(msStrTabNameEmpty); - pBtnOk->Disable(); + m_xFtWarn->show(); +//TODO m_xFtWarn->SetControlBackground(COL_YELLOW); + m_xFtWarn->set_label(msStrTabNameEmpty); + m_xBtnOk->set_sensitive(false); return; } if (!ScDocument::ValidTabName(aNewName)) { // New sheet name contains invalid characters. - pFtWarn->Show(); - pFtWarn->SetControlBackground(COL_YELLOW); - pFtWarn->SetText(msStrTabNameInvalid); - pBtnOk->Disable(); + m_xFtWarn->show(); +//TODO m_xFtWarn->SetControlBackground(COL_YELLOW); + m_xFtWarn->set_label(msStrTabNameInvalid); + m_xBtnOk->set_sensitive(false); return; } - bool bMoveInCurrentDoc = pBtnMove->IsChecked() && pLbDoc->GetSelectedEntryPos() == mnCurrentDocPos; + bool bMoveInCurrentDoc = m_xBtnMove->get_active() && m_xLbDoc->get_active() == mnCurrentDocPos; bool bFound = false; - const sal_Int32 nLast = pLbTable->GetEntryCount(); - for ( sal_Int32 i=0; in_children(); + for (int i = 0; iGetEntry(i) ) + if (aNewName == m_xLbTable->get_text(i)) { // Only for move within same document the same name is allowed. - if (!bMoveInCurrentDoc || maDefaultName != pEdTabName->GetText()) + if (!bMoveInCurrentDoc || maDefaultName != m_xEdTabName->get_text()) bFound = true; } } if ( bFound ) { - pFtWarn->Show(); - pFtWarn->SetControlBackground(COL_YELLOW); - pFtWarn->SetText(msStrTabNameUsed); - pBtnOk->Disable(); + m_xFtWarn->show(); +//TODO m_xFtWarn->SetControlBackground(COL_YELLOW); + m_xFtWarn->set_label(msStrTabNameUsed); + m_xBtnOk->set_sensitive(false); } else { - pFtWarn->Hide(); - pFtWarn->SetControlBackground(); - pFtWarn->SetText(OUString()); - pBtnOk->Enable(); + m_xFtWarn->hide(); +//TODO m_xFtWarn->SetControlBackground(); + m_xFtWarn->set_label(OUString()); + m_xBtnOk->set_sensitive(true); } } ScDocument* ScMoveTableDlg::GetSelectedDoc() { - sal_Int32 nPos = pLbDoc->GetSelectedEntryPos(); - return static_cast(pLbDoc->GetEntryData(nPos)); + return reinterpret_cast(m_xLbDoc->get_active_id().toUInt64()); } void ScMoveTableDlg::Init() { - pBtnOk->SetClickHdl ( LINK( this, ScMoveTableDlg, OkHdl ) ); - pLbDoc->SetSelectHdl ( LINK( this, ScMoveTableDlg, SelHdl ) ); - pBtnCopy->SetToggleHdl( LINK( this, ScMoveTableDlg, CheckBtnHdl ) ); - pEdTabName->SetModifyHdl( LINK( this, ScMoveTableDlg, CheckNameHdl ) ); - pBtnMove->Check(); - pBtnCopy->Check( false ); - pEdTabName->Enable(false); - pFtWarn->Hide(); + m_xBtnOk->connect_clicked(LINK(this, ScMoveTableDlg, OkHdl)); + m_xLbDoc->connect_changed(LINK(this, ScMoveTableDlg, SelHdl)); + m_xBtnCopy->connect_toggled(LINK( this, ScMoveTableDlg, CheckBtnHdl)); + m_xEdTabName->connect_changed(LINK( this, ScMoveTableDlg, CheckNameHdl)); + m_xBtnMove->set_active(true); + m_xBtnCopy->set_active(false); + m_xEdTabName->set_sensitive(false); + m_xFtWarn->hide(); InitDocListBox(); - SelHdl( *pLbDoc.get() ); + SelHdl(*m_xLbDoc); } void ScMoveTableDlg::InitDocListBox() @@ -213,8 +202,8 @@ void ScMoveTableDlg::InitDocListBox() sal_uInt16 i = 0; OUString aEntryName; - pLbDoc->Clear(); - pLbDoc->SetUpdateMode( false ); + m_xLbDoc->clear(); + m_xLbDoc->freeze(); while ( pSh ) { @@ -231,37 +220,36 @@ void ScMoveTableDlg::InitDocListBox() aEntryName += msCurrentDoc; } - pLbDoc->InsertEntry( aEntryName, i ); - pLbDoc->SetEntryData( i, static_cast(&pScSh->GetDocument()) ); + m_xLbDoc->insert(i, OUString::number(reinterpret_cast(&pScSh->GetDocument())), aEntryName); i++; } pSh = SfxObjectShell::GetNext( *pSh ); } - pLbDoc->SetUpdateMode( true ); - pLbDoc->InsertEntry(msNewDoc); - pLbDoc->SelectEntryPos( nSelPos ); + m_xLbDoc->thaw(); + m_xLbDoc->append_text(msNewDoc); + m_xLbDoc->set_active(nSelPos); } // Handler: -IMPL_LINK( ScMoveTableDlg, CheckBtnHdl, RadioButton&, rBtn, void ) +IMPL_LINK( ScMoveTableDlg, CheckBtnHdl, weld::ToggleButton&, rBtn, void ) { - if (&rBtn == pBtnCopy) + if (&rBtn == m_xBtnCopy.get()) ResetRenameInput(); } -IMPL_LINK_NOARG(ScMoveTableDlg, OkHdl, Button*, void) +IMPL_LINK_NOARG(ScMoveTableDlg, OkHdl, weld::Button&, void) { - const sal_Int32 nDocSel = pLbDoc->GetSelectedEntryPos(); - const sal_Int32 nDocLast = pLbDoc->GetEntryCount()-1; - const sal_Int32 nTabSel = pLbTable->GetSelectedEntryPos(); - const sal_Int32 nTabLast = pLbTable->GetEntryCount()-1; + const sal_Int32 nDocSel = m_xLbDoc->get_active(); + const sal_Int32 nDocLast = m_xLbDoc->get_count() - 1; + const sal_Int32 nTabSel = m_xLbTable->get_selected_index(); + const sal_Int32 nTabLast = m_xLbTable->n_children() - 1; nDocument = (nDocSel != nDocLast) ? nDocSel : SC_DOC_NEW; nTable = (nTabSel != nTabLast) ? static_cast(nTabSel) : SC_TAB_APPEND; - bCopyTable = pBtnCopy->IsChecked(); + bCopyTable = m_xBtnCopy->get_active(); if (bCopyTable) { @@ -271,52 +259,46 @@ IMPL_LINK_NOARG(ScMoveTableDlg, OkHdl, Button*, void) ScDocument* pDoc = GetSelectedDoc(); if (pDoc) pDoc->CreateValidTabName(aCopyName); - if (aCopyName == pEdTabName->GetText()) - pEdTabName->SetText( OUString() ); + if (aCopyName == m_xEdTabName->get_text()) + m_xEdTabName->set_text(OUString()); } else { // Return an empty string, when the new name is the same as the // original name. - if (maDefaultName == pEdTabName->GetText()) - pEdTabName->SetText(OUString()); + if (maDefaultName == m_xEdTabName->get_text()) + m_xEdTabName->set_text(OUString()); } - EndDialog( RET_OK ); + m_xDialog->response(RET_OK); } -IMPL_LINK( ScMoveTableDlg, SelHdl, ListBox&, rLb, void ) +IMPL_LINK_NOARG(ScMoveTableDlg, SelHdl, weld::ComboBoxText&, void) { - if ( &rLb == pLbDoc ) - { - ScDocument* pDoc = GetSelectedDoc(); - OUString aName; + ScDocument* pDoc = GetSelectedDoc(); + OUString aName; - pLbTable->Clear(); - pLbTable->SetUpdateMode( false ); - if ( pDoc ) + m_xLbTable->clear(); + m_xLbTable->freeze(); + if ( pDoc ) + { + SCTAB nLast = pDoc->GetTableCount()-1; + for (SCTAB i = 0; i <= nLast; ++i) { - SCTAB nLast = pDoc->GetTableCount()-1; - for ( SCTAB i=0; i<=nLast; i++ ) - { - pDoc->GetName( i, aName ); - pLbTable->InsertEntry( aName, static_cast(i) ); - } + pDoc->GetName(i, aName); + m_xLbTable->append_text(aName); } - pLbTable->InsertEntry( ScGlobal::GetRscString(STR_MOVE_TO_END) ); - pLbTable->SetUpdateMode( true ); - pLbTable->SelectEntryPos( 0 ); - ResetRenameInput(); } + m_xLbTable->append_text(ScGlobal::GetRscString(STR_MOVE_TO_END)); + m_xLbTable->thaw(); + m_xLbTable->select(0); + ResetRenameInput(); } -IMPL_LINK( ScMoveTableDlg, CheckNameHdl, Edit&, rEdt, void ) +IMPL_LINK_NOARG(ScMoveTableDlg, CheckNameHdl, weld::Entry&, void) { - if ( &rEdt == pEdTabName ) - { - mbEverEdited = true; - CheckNewTabName(); - } + mbEverEdited = true; + CheckNewTabName(); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sc/source/ui/miscdlgs/shtabdlg.cxx b/sc/source/ui/miscdlgs/shtabdlg.cxx index 31877686bb0a..b3d65e596ea7 100644 --- a/sc/source/ui/miscdlgs/shtabdlg.cxx +++ b/sc/source/ui/miscdlgs/shtabdlg.cxx @@ -60,7 +60,7 @@ std::vector ScShowTabDlg::GetSelectedRows() const OUString ScShowTabDlg::GetEntry(sal_Int32 nIndex) const { - return m_xLb->get(nIndex); + return m_xLb->get_text(nIndex); } IMPL_LINK_NOARG(ScShowTabDlg, DblClkHdl, weld::TreeView&, void) diff --git a/sc/source/ui/view/tabvwshf.cxx b/sc/source/ui/view/tabvwshf.cxx index 9d1af77fa0f2..aa6e6fe4b705 100644 --- a/sc/source/ui/view/tabvwshf.cxx +++ b/sc/source/ui/view/tabvwshf.cxx @@ -522,7 +522,7 @@ void ScTabViewShell::ExecuteTable( SfxRequest& rReq ) ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create(); OSL_ENSURE(pFact, "ScAbstractFactory create fail!"); - ScopedVclPtr pDlg(pFact->CreateScMoveTableDlg(GetDialogParent(), + ScopedVclPtr pDlg(pFact->CreateScMoveTableDlg(GetFrameWeld(), aDefaultName)); OSL_ENSURE(pDlg, "Dialog create fail!"); diff --git a/sc/uiconfig/scalc/ui/movecopysheet.ui b/sc/uiconfig/scalc/ui/movecopysheet.ui index b9f7a7e54e7c..f3e21cc5b03e 100644 --- a/sc/uiconfig/scalc/ui/movecopysheet.ui +++ b/sc/uiconfig/scalc/ui/movecopysheet.ui @@ -1,7 +1,15 @@ - + + + + + + + + + False 6 @@ -96,7 +104,6 @@ 0 True True - copy False @@ -179,11 +186,11 @@ True False - 0 - 0 To _document True toDocument + 0 + 0 False @@ -225,10 +232,10 @@ True False - 0 _Insert before True - insertBefore:before + insertBefore + 0 False @@ -244,13 +251,28 @@ True in - + True True True True + liststore1 + False + False + 0 + False - + + + + + + + + 0 + + + @@ -316,6 +338,7 @@ True True + True False @@ -342,9 +365,9 @@ False True start + This name is already used. 0 0 - This name is already used. False @@ -357,9 +380,9 @@ False True start + Name is empty. 0 0 - Name is empty. False @@ -372,9 +395,9 @@ False True start + Name contains one or more invalid characters. 0 0 - Name contains one or more invalid characters. False @@ -420,5 +443,8 @@ ok cancel + + + diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index 1805559ee3ad..aecefcffbd88 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -1214,7 +1214,7 @@ public: m_xTreeView->RemoveEntry(pos); } - virtual int find(const OUString& rText) const override + virtual int find_text(const OUString& rText) const override { sal_Int32 nRet = m_xTreeView->GetEntryPos(rText); if (nRet == LISTBOX_ENTRY_NOTFOUND) @@ -1272,7 +1272,7 @@ public: return aRows; } - virtual OUString get(int pos) const override + virtual OUString get_text(int pos) const override { return m_xTreeView->GetEntry(pos); } @@ -1758,6 +1758,16 @@ public: m_xComboBoxText->SetStyle(m_xComboBoxText->GetStyle() | WB_SORT); } + virtual void freeze() override + { + m_xComboBoxText->SetUpdateMode(false); + } + + virtual void thaw() override + { + m_xComboBoxText->SetUpdateMode(true); + } + virtual ~SalInstanceComboBoxText() override { clear(); diff --git a/vcl/unx/gtk3/gtk3gtkinst.cxx b/vcl/unx/gtk3/gtk3gtkinst.cxx index 62ba6f6590f6..bb8b1d862e07 100644 --- a/vcl/unx/gtk3/gtk3gtkinst.cxx +++ b/vcl/unx/gtk3/gtk3gtkinst.cxx @@ -3037,7 +3037,7 @@ public: enable_notify_events(); } - virtual int find(const OUString& rText) const override + virtual int find_text(const OUString& rText) const override { Search aSearch(rText, 0); gtk_tree_model_foreach(GTK_TREE_MODEL(m_pListStore), foreach_find, &aSearch); @@ -3120,7 +3120,7 @@ public: return aRows; } - virtual OUString get(int pos) const override + virtual OUString get_text(int pos) const override { return get(pos, 0); } @@ -4042,6 +4042,16 @@ public: g_signal_handler_unblock(pEntry, m_nEntryActivateSignalId); } + virtual void freeze() override + { + //do nothing for now + } + + virtual void thaw() override + { + //do nothing for now + } + virtual ~GtkInstanceComboBoxText() override { if (GtkEntry* pEntry = get_entry()) -- cgit