summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2018-05-01 16:03:24 +0100
committerCaolán McNamara <caolanm@redhat.com>2018-05-01 21:23:32 +0200
commitab4609c8f9756e4fe6959a10e54ebee9105edbf7 (patch)
treeaf85710d0826cba013b52f72b9033dc5ad0dc1ba
parent43af818557904450b13839350c65ad865b9ee9d2 (diff)
weld ScMoveTableDlg
Change-Id: I4d5601d0fb02a20bf6c83fc10411f610bdb5ce32 Reviewed-on: https://gerrit.libreoffice.org/53698 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
-rw-r--r--cui/source/dialogs/multipat.cxx2
-rw-r--r--cui/source/dialogs/pastedlg.cxx2
-rw-r--r--include/vcl/weld.hxx15
-rw-r--r--sc/inc/scabstdlg.hxx2
-rw-r--r--sc/qa/unit/screenshots/screenshots.cxx2
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.cxx24
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.hxx10
-rw-r--r--sc/source/ui/inc/mvtabdlg.hxx38
-rw-r--r--sc/source/ui/miscdlgs/mvtabdlg.cxx242
-rw-r--r--sc/source/ui/miscdlgs/shtabdlg.cxx2
-rw-r--r--sc/source/ui/view/tabvwshf.cxx2
-rw-r--r--sc/uiconfig/scalc/ui/movecopysheet.ui48
-rw-r--r--vcl/source/app/salvtables.cxx14
-rw-r--r--vcl/unx/gtk3/gtk3gtkinst.cxx14
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<sal_uInt32>(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<ComboBoxText&, void>& rLink)
{
m_aEntryActivateHdl = rLink;
@@ -299,18 +302,18 @@ public:
virtual std::vector<int> 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<OUString> get_selected_rows_text() const
{
std::vector<int> aRows(get_selected_rows());
std::vector<OUString> 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<AbstractScMoveTableDlg> CreateScMoveTableDlg(vcl::Window * pParent,
+ virtual VclPtr<AbstractScMoveTableDlg> CreateScMoveTableDlg(weld::Window * pParent,
const OUString& rDefault) = 0;
virtual VclPtr<AbstractScNameCreateDlg> 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<VclAbstractDialog> 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<AbstractScMetricInputDlg> ScAbstractDialogFactory_Impl::CreateScMetricInp
nDecimals, nMaximum , nMinimum));
}
-VclPtr<AbstractScMoveTableDlg> ScAbstractDialogFactory_Impl::CreateScMoveTableDlg(vcl::Window* pParent,
+VclPtr<AbstractScMoveTableDlg> ScAbstractDialogFactory_Impl::CreateScMoveTableDlg(weld::Window* pParent,
const OUString& rDefault)
{
- VclPtr<ScMoveTableDlg> pDlg = VclPtr<ScMoveTableDlg>::Create( pParent, rDefault );
- return VclPtr<AbstractScMoveTableDlg_Impl>::Create( pDlg );
+ return VclPtr<AbstractScMoveTableDlg_Impl>::Create(new ScMoveTableDlg(pParent, rDefault));
}
VclPtr<AbstractScNameCreateDlg> 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<ScMoveTableDlg> 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<AbstractScMoveTableDlg> CreateScMoveTableDlg(vcl::Window * pParent,
+ virtual VclPtr<AbstractScMoveTableDlg> CreateScMoveTableDlg(weld::Window * pParent,
const OUString& rDefault) override;
virtual VclPtr<AbstractScNameCreateDlg> 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 <address.hxx>
-#include <vcl/dialog.hxx>
-#include <vcl/button.hxx>
-#include <vcl/lstbox.hxx>
-#include <vcl/fixed.hxx>
-#include <vcl/edit.hxx>
+#include <vcl/weld.hxx>
-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<RadioButton> pBtnMove;
- VclPtr<RadioButton> pBtnCopy;
- VclPtr<ListBox> pLbDoc;
- VclPtr<ListBox> pLbTable;
- VclPtr<Edit> pEdTabName;
- VclPtr<FixedText> pFtWarn;
- VclPtr<OKButton> pBtnOk;
-
OUString msCurrentDoc;
OUString msNewDoc;
@@ -72,12 +59,23 @@ private:
bool bRenameTable:1;
bool mbEverEdited:1;
+ std::unique_ptr<weld::RadioButton> m_xBtnMove;
+ std::unique_ptr<weld::RadioButton> m_xBtnCopy;
+ std::unique_ptr<weld::ComboBoxText> m_xLbDoc;
+ std::unique_ptr<weld::TreeView> m_xLbTable;
+ std::unique_ptr<weld::Entry> m_xEdTabName;
+ std::unique_ptr<weld::Label> m_xFtWarn;
+ std::unique_ptr<weld::Button> m_xBtnOk;
+ std::unique_ptr<weld::Label> m_xUnusedLabel;
+ std::unique_ptr<weld::Label> m_xEmptyLabel;
+ std::unique_ptr<weld::Label> 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 <global.hxx>
#include <globstr.hrc>
-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<FixedText>("warnunused")->GetText();
- msStrTabNameEmpty = get<FixedText>("warnempty")->GetText();
- msStrTabNameInvalid = get<FixedText>("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; i<nLast && !bFound; ++i )
+ const int nLast = m_xLbTable->n_children();
+ for (int i = 0; i<nLast && !bFound; ++i)
{
- if ( aNewName == pLbTable->GetEntry(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<ScDocument*>(pLbDoc->GetEntryData(nPos));
+ return reinterpret_cast<ScDocument*>(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<void*>(&pScSh->GetDocument()) );
+ m_xLbDoc->insert(i, OUString::number(reinterpret_cast<sal_uInt64>(&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<SCTAB>(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<sal_uInt16>(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<sal_Int32> 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<AbstractScMoveTableDlg> pDlg(pFact->CreateScMoveTableDlg(GetDialogParent(),
+ ScopedVclPtr<AbstractScMoveTableDlg> 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 @@
<?xml version="1.0" encoding="UTF-8"?>
-<!-- Generated with glade 3.18.3 -->
+<!-- Generated with glade 3.20.4 -->
<interface domain="sc">
<requires lib="gtk+" version="3.18"/>
+ <object class="GtkListStore" id="liststore1">
+ <columns>
+ <!-- column-name text -->
+ <column type="gchararray"/>
+ <!-- column-name id -->
+ <column type="gchararray"/>
+ </columns>
+ </object>
<object class="GtkDialog" id="MoveCopySheetDialog">
<property name="can_focus">False</property>
<property name="border_width">6</property>
@@ -96,7 +104,6 @@
<property name="xalign">0</property>
<property name="active">True</property>
<property name="draw_indicator">True</property>
- <property name="group">copy</property>
</object>
<packing>
<property name="expand">False</property>
@@ -179,11 +186,11 @@
<object class="GtkLabel" id="toDocumentLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
- <property name="yalign">0</property>
<property name="label" translatable="yes" context="movecopysheet|toDocumentLabel">To _document</property>
<property name="use_underline">True</property>
<property name="mnemonic_widget">toDocument</property>
+ <property name="xalign">0</property>
+ <property name="yalign">0</property>
</object>
<packing>
<property name="expand">False</property>
@@ -225,10 +232,10 @@
<object class="GtkLabel" id="insertBeforeLabel">
<property name="visible">True</property>
<property name="can_focus">False</property>
- <property name="xalign">0</property>
<property name="label" translatable="yes" context="movecopysheet|insertBeforeLabel">_Insert before</property>
<property name="use_underline">True</property>
- <property name="mnemonic_widget">insertBefore:before</property>
+ <property name="mnemonic_widget">insertBefore</property>
+ <property name="xalign">0</property>
</object>
<packing>
<property name="expand">False</property>
@@ -244,13 +251,28 @@
<property name="vexpand">True</property>
<property name="shadow_type">in</property>
<child>
- <object class="GtkTreeView" id="insertBefore:before">
+ <object class="GtkTreeView" id="insertBefore">
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
+ <property name="model">liststore1</property>
+ <property name="headers_visible">False</property>
+ <property name="headers_clickable">False</property>
+ <property name="search_column">0</property>
+ <property name="show_expanders">False</property>
<child internal-child="selection">
- <object class="GtkTreeSelection" id="treeview-selection"/>
+ <object class="GtkTreeSelection" id="treeview-selection1"/>
+ </child>
+ <child>
+ <object class="GtkTreeViewColumn" id="treeviewcolumn1">
+ <child>
+ <object class="GtkCellRendererText" id="cellrenderertext1"/>
+ <attributes>
+ <attribute name="text">0</attribute>
+ </attributes>
+ </child>
+ </object>
</child>
</object>
</child>
@@ -316,6 +338,7 @@
<object class="GtkEntry" id="newName">
<property name="visible">True</property>
<property name="can_focus">True</property>
+ <property name="activates_default">True</property>
</object>
<packing>
<property name="expand">False</property>
@@ -342,9 +365,9 @@
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="valign">start</property>
+ <property name="label" translatable="yes" context="movecopysheet|warnunused">This name is already used.</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
- <property name="label" translatable="yes" context="movecopysheet|warnunused">This name is already used.</property>
</object>
<packing>
<property name="expand">False</property>
@@ -357,9 +380,9 @@
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="valign">start</property>
+ <property name="label" translatable="yes" context="movecopysheet|warnempty">Name is empty.</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
- <property name="label" translatable="yes" context="movecopysheet|warnempty">Name is empty.</property>
</object>
<packing>
<property name="expand">False</property>
@@ -372,9 +395,9 @@
<property name="can_focus">False</property>
<property name="no_show_all">True</property>
<property name="valign">start</property>
+ <property name="label" translatable="yes" context="movecopysheet|warninvalid">Name contains one or more invalid characters.</property>
<property name="xalign">0</property>
<property name="yalign">0</property>
- <property name="label" translatable="yes" context="movecopysheet|warninvalid">Name contains one or more invalid characters.</property>
</object>
<packing>
<property name="expand">False</property>
@@ -420,5 +443,8 @@
<action-widget response="-5">ok</action-widget>
<action-widget response="-6">cancel</action-widget>
</action-widgets>
+ <child>
+ <placeholder/>
+ </child>
</object>
</interface>
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())