summaryrefslogtreecommitdiff
path: root/sc/source/ui/dbgui/dbnamdlg.cxx
diff options
context:
space:
mode:
authorCaolán McNamara <caolanm@redhat.com>2019-04-11 12:05:07 +0100
committerCaolán McNamara <caolanm@redhat.com>2019-04-11 22:18:01 +0200
commit5dfc4fd2af11322dfbface30fd66c1ce553a0703 (patch)
treec3fad34763839cabf487a8e432ede52641737700 /sc/source/ui/dbgui/dbnamdlg.cxx
parent86c1b5ff8f66747a3d4cebe6e2e0d1892db9ba9a (diff)
weld ScDbNameDlg
Change-Id: I676909cbb4067ce69d5327403dd25cc80c4cbc4b Reviewed-on: https://gerrit.libreoffice.org/70593 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sc/source/ui/dbgui/dbnamdlg.cxx')
-rw-r--r--sc/source/ui/dbgui/dbnamdlg.cxx408
1 files changed, 192 insertions, 216 deletions
diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx
index 067666be2152..0299367a240f 100644
--- a/sc/source/ui/dbgui/dbnamdlg.cxx
+++ b/sc/source/ui/dbgui/dbnamdlg.cxx
@@ -56,8 +56,8 @@ namespace
class DBSaveData
{
public:
- DBSaveData( Edit& rEd, CheckBox& rHdr, CheckBox& rTot, CheckBox& rSize, CheckBox& rFmt,
- CheckBox& rStrip, ScRange& rArea )
+ DBSaveData( formula::WeldRefEdit& rEd, weld::CheckButton& rHdr, weld::CheckButton& rTot, weld::CheckButton& rSize, weld::CheckButton& rFmt,
+ weld::CheckButton& rStrip, ScRange& rArea )
: rEdAssign(rEd)
, rBtnHeader(rHdr)
, rBtnTotals(rTot)
@@ -77,12 +77,12 @@ public:
void Restore();
private:
- Edit& rEdAssign;
- CheckBox& rBtnHeader;
- CheckBox& rBtnTotals;
- CheckBox& rBtnSize;
- CheckBox& rBtnFormat;
- CheckBox& rBtnStrip;
+ formula::WeldRefEdit& rEdAssign;
+ weld::CheckButton& rBtnHeader;
+ weld::CheckButton& rBtnTotals;
+ weld::CheckButton& rBtnSize;
+ weld::CheckButton& rBtnFormat;
+ weld::CheckButton& rBtnStrip;
ScRange& rCurArea;
OUString aStr;
ScRange aArea;
@@ -98,11 +98,11 @@ void DBSaveData::Save()
{
aArea = rCurArea;
aStr = rEdAssign.GetText();
- bHeader = rBtnHeader.IsChecked();
- bTotals = rBtnTotals.IsChecked();
- bSize = rBtnSize.IsChecked();
- bFormat = rBtnFormat.IsChecked();
- bStrip = rBtnStrip.IsChecked();
+ bHeader = rBtnHeader.get_active();
+ bTotals = rBtnTotals.get_active();
+ bSize = rBtnSize.get_active();
+ bFormat = rBtnFormat.get_active();
+ bStrip = rBtnStrip.get_active();
bDirty = true;
}
@@ -112,103 +112,81 @@ void DBSaveData::Restore()
{
rCurArea = aArea;
rEdAssign.SetText( aStr );
- rBtnHeader.Check ( bHeader );
- rBtnTotals.Check ( bTotals );
- rBtnSize.Check ( bSize );
- rBtnFormat.Check ( bFormat );
- rBtnStrip.Check ( bStrip );
+ rBtnHeader.set_active ( bHeader );
+ rBtnTotals.set_active ( bTotals );
+ rBtnSize.set_active ( bSize );
+ rBtnFormat.set_active ( bFormat );
+ rBtnStrip.set_active ( bStrip );
bDirty = false;
}
}
// class ScDbNameDlg
-ScDbNameDlg::ScDbNameDlg(SfxBindings* pB, SfxChildWindow* pCW, vcl::Window* pParent,
+ScDbNameDlg::ScDbNameDlg(SfxBindings* pB, SfxChildWindow* pCW, weld::Window* pParent,
ScViewData* ptrViewData)
- : ScAnyRefDlg(pB, pCW, pParent,
- "DefineDatabaseRangeDialog",
- "modules/scalc/ui/definedatabaserangedialog.ui")
+ : ScAnyRefDlgController(pB, pCW, pParent,
+ "modules/scalc/ui/definedatabaserangedialog.ui", "DefineDatabaseRangeDialog")
, pViewData(ptrViewData)
, pDoc(ptrViewData->GetDocument())
, bRefInputMode(false)
, aAddrDetails(pDoc->GetAddressConvention(), 0, 0)
, aLocalDbCol(*(pDoc->GetDBCollection()))
+ , m_xEdName(m_xBuilder->weld_entry_tree_view("entrygrid", "entry", "entry-list"))
+ , m_xAssignFrame(m_xBuilder->weld_frame("RangeFrame"))
+ , m_xEdAssign(new formula::WeldRefEdit(m_xBuilder->weld_entry("assign")))
+ , m_xRbAssign(new formula::WeldRefButton(m_xBuilder->weld_button("assignrb")))
+ , m_xOptions(m_xBuilder->weld_widget("Options"))
+ , m_xBtnHeader(m_xBuilder->weld_check_button("ContainsColumnLabels"))
+ , m_xBtnTotals(m_xBuilder->weld_check_button("ContainsTotalsRow"))
+ , m_xBtnDoSize(m_xBuilder->weld_check_button("InsertOrDeleteCells"))
+ , m_xBtnKeepFmt(m_xBuilder->weld_check_button("KeepFormatting"))
+ , m_xBtnStripData(m_xBuilder->weld_check_button("DontSaveImportedData"))
+ , m_xFTSource(m_xBuilder->weld_label("Source"))
+ , m_xFTOperations(m_xBuilder->weld_label("Operations"))
+ , m_xBtnOk(m_xBuilder->weld_button("ok"))
+ , m_xBtnCancel(m_xBuilder->weld_button("cancel"))
+ , m_xBtnAdd(m_xBuilder->weld_button("add"))
+ , m_xBtnRemove(m_xBuilder->weld_button("delete"))
+ , m_xModifyPB(m_xBuilder->weld_button("modify"))
+ , m_xInvalidFT(m_xBuilder->weld_label("invalid"))
+ , m_xFrameLabel(m_xAssignFrame->weld_label_widget())
+ , m_xExpander(m_xBuilder->weld_expander("more"))
{
- get(m_pEdName, "entry");
- m_pEdName->set_height_request(m_pEdName->GetOptimalSize().Height() + m_pEdName->GetTextHeight() * 8);
- get(m_pEdAssign, "assign");
- get(m_pAssignFrame, "RangeFrame");
- m_pEdAssign->SetReferences(this, m_pAssignFrame->get_label_widget());
- get(m_pRbAssign, "assignrb");
- m_pRbAssign->SetReferences(this, m_pEdAssign);
- get(m_pOptions, "Options");
- get(m_pBtnHeader, "ContainsColumnLabels");
- get(m_pBtnTotals, "ContainsTotalsRow");
- get(m_pBtnDoSize, "InsertOrDeleteCells");
- get(m_pBtnKeepFmt, "KeepFormatting");
- get(m_pBtnStripData, "DontSaveImportedData");
- get(m_pFTSource, "Source");
- get(m_pFTOperations, "Operations");
- get(m_pBtnOk, "ok");
- get(m_pBtnCancel, "cancel");
- get(m_pBtnAdd, "add");
- aStrAdd = m_pBtnAdd->GetText();
- aStrModify = get<vcl::Window>("modify")->GetText();
- get(m_pBtnRemove, "delete");
- aStrInvalid = get<vcl::Window>("invalid")->GetText();
-
- m_pFTSource->SetStyle(m_pFTSource->GetStyle() | WB_NOLABEL);
- m_pFTOperations->SetStyle(m_pFTOperations->GetStyle() | WB_NOLABEL);
+ m_xEdName->set_height_request_by_rows(8);
+ m_xEdAssign->SetReferences(this, m_xFrameLabel.get());
+ m_xRbAssign->SetReferences(this, m_xEdAssign.get());
+ aStrAdd = m_xBtnAdd->get_label();
+ aStrModify = m_xModifyPB->get_label();
+ aStrInvalid = m_xInvalidFT->get_label();
// so that the strings in the resource can stay with fixed texts:
- aStrSource = m_pFTSource->GetText();
- aStrOperations = m_pFTOperations->GetText();
+ aStrSource = m_xFTSource->get_label();
+ aStrOperations = m_xFTOperations->get_label();
- pSaveObj = new DBSaveData( *m_pEdAssign, *m_pBtnHeader, *m_pBtnTotals,
- *m_pBtnDoSize, *m_pBtnKeepFmt, *m_pBtnStripData, theCurArea );
+ pSaveObj = new DBSaveData( *m_xEdAssign, *m_xBtnHeader, *m_xBtnTotals,
+ *m_xBtnDoSize, *m_xBtnKeepFmt, *m_xBtnStripData, theCurArea );
Init();
}
ScDbNameDlg::~ScDbNameDlg()
{
- disposeOnce();
-}
-
-void ScDbNameDlg::dispose()
-{
DELETEZ( pSaveObj );
- m_pEdName.clear();
- m_pAssignFrame.clear();
- m_pEdAssign.clear();
- m_pRbAssign.clear();
- m_pOptions.clear();
- m_pBtnHeader.clear();
- m_pBtnTotals.clear();
- m_pBtnDoSize.clear();
- m_pBtnKeepFmt.clear();
- m_pBtnStripData.clear();
- m_pFTSource.clear();
- m_pFTOperations.clear();
- m_pBtnOk.clear();
- m_pBtnCancel.clear();
- m_pBtnAdd.clear();
- m_pBtnRemove.clear();
- ScAnyRefDlg::dispose();
}
void ScDbNameDlg::Init()
{
- m_pBtnHeader->Check(); // Default: with column headers
- m_pBtnTotals->Check( false ); // Default: without totals row
- m_pBtnDoSize->Check();
- m_pBtnKeepFmt->Check();
-
- m_pBtnOk->SetClickHdl ( LINK( this, ScDbNameDlg, OkBtnHdl ) );
- m_pBtnCancel->SetClickHdl ( LINK( this, ScDbNameDlg, CancelBtnHdl ) );
- m_pBtnAdd->SetClickHdl ( LINK( this, ScDbNameDlg, AddBtnHdl ) );
- m_pBtnRemove->SetClickHdl ( LINK( this, ScDbNameDlg, RemoveBtnHdl ) );
- m_pEdName->SetModifyHdl ( LINK( this, ScDbNameDlg, NameModifyHdl ) );
- m_pEdAssign->SetModifyHdl ( LINK( this, ScDbNameDlg, AssModifyHdl ) );
+ m_xBtnHeader->set_active(true); // Default: with column headers
+ m_xBtnTotals->set_active( false ); // Default: without totals row
+ m_xBtnDoSize->set_active(true);
+ m_xBtnKeepFmt->set_active(true);
+
+ m_xBtnOk->connect_clicked ( LINK( this, ScDbNameDlg, OkBtnHdl ) );
+ m_xBtnCancel->connect_clicked ( LINK( this, ScDbNameDlg, CancelBtnHdl ) );
+ m_xBtnAdd->connect_clicked ( LINK( this, ScDbNameDlg, AddBtnHdl ) );
+ m_xBtnRemove->connect_clicked ( LINK( this, ScDbNameDlg, RemoveBtnHdl ) );
+ m_xEdName->connect_changed( LINK( this, ScDbNameDlg, NameModifyHdl ) );
+ m_xEdAssign->SetModifyHdl ( LINK( this, ScDbNameDlg, AssModifyHdl ) );
UpdateNames();
OUString theAreaStr;
@@ -254,24 +232,24 @@ void ScDbNameDlg::Init()
{
OUString aDBName = pDBData->GetName();
if ( aDBName != STR_DB_LOCAL_NONAME )
- m_pEdName->SetText(aDBName);
+ m_xEdName->set_entry_text(aDBName);
- m_pBtnHeader->Check( pDBData->HasHeader() );
- m_pBtnTotals->Check( pDBData->HasTotals() );
- m_pBtnDoSize->Check( pDBData->IsDoSize() );
- m_pBtnKeepFmt->Check( pDBData->IsKeepFmt() );
- m_pBtnStripData->Check( pDBData->IsStripData() );
+ m_xBtnHeader->set_active( pDBData->HasHeader() );
+ m_xBtnTotals->set_active( pDBData->HasTotals() );
+ m_xBtnDoSize->set_active( pDBData->IsDoSize() );
+ m_xBtnKeepFmt->set_active( pDBData->IsKeepFmt() );
+ m_xBtnStripData->set_active( pDBData->IsStripData() );
SetInfoStrings( pDBData );
}
}
}
}
- m_pEdAssign->SetText( theAreaStr );
- m_pEdName->GrabFocus();
+ m_xEdAssign->SetText( theAreaStr );
+ m_xEdName->grab_focus();
bSaved = true;
pSaveObj->Save();
- NameModifyHdl( *m_pEdName );
+ NameModifyHdl( *m_xEdName );
}
void ScDbNameDlg::SetInfoStrings( const ScDBData* pDBData )
@@ -283,7 +261,7 @@ void ScDbNameDlg::SetInfoStrings( const ScDBData* pDBData )
aBuf.append(' ');
aBuf.append(pDBData->GetSourceString());
}
- m_pFTSource->SetText(aBuf.makeStringAndClear());
+ m_xFTSource->set_label(aBuf.makeStringAndClear());
aBuf.append(aStrOperations);
if (pDBData)
@@ -291,7 +269,7 @@ void ScDbNameDlg::SetInfoStrings( const ScDBData* pDBData )
aBuf.append(' ');
aBuf.append(pDBData->GetOperations());
}
- m_pFTOperations->SetText(aBuf.makeStringAndClear());
+ m_xFTOperations->set_label(aBuf.makeStringAndClear());
}
// Transfer of a table area selected with the mouse, which is then displayed
@@ -299,30 +277,30 @@ void ScDbNameDlg::SetInfoStrings( const ScDBData* pDBData )
void ScDbNameDlg::SetReference( const ScRange& rRef, ScDocument* pDocP )
{
- if ( m_pEdAssign->IsEnabled() )
+ if (m_xEdAssign->GetWidget()->get_sensitive())
{
if ( rRef.aStart != rRef.aEnd )
- RefInputStart(m_pEdAssign);
+ RefInputStart(m_xEdAssign.get());
theCurArea = rRef;
OUString aRefStr(theCurArea.Format(ScRefFlags::RANGE_ABS_3D, pDocP, aAddrDetails));
- m_pEdAssign->SetRefString( aRefStr );
- m_pOptions->Enable();
- m_pBtnAdd->Enable();
+ m_xEdAssign->SetRefString( aRefStr );
+ m_xOptions->set_sensitive(true);
+ m_xBtnAdd->set_sensitive(true);
bSaved = true;
pSaveObj->Save();
}
}
-bool ScDbNameDlg::Close()
+void ScDbNameDlg::Close()
{
- return DoClose( ScDbNameDlgWrapper::GetChildWindowId() );
+ DoClose( ScDbNameDlgWrapper::GetChildWindowId() );
}
void ScDbNameDlg::SetActive()
{
- m_pEdAssign->GrabFocus();
+ m_xEdAssign->GrabFocus();
// No NameModifyHdl, because otherwise areas can not be changed
// (the old content would be displayed again after the reference selection is pulled)
@@ -337,25 +315,24 @@ void ScDbNameDlg::UpdateNames()
const DBsType& rDBs = aLocalDbCol.getNamedDBs();
- m_pEdName->SetUpdateMode( false );
+ m_xEdName->freeze();
- m_pEdName->Clear();
- m_pEdAssign->SetText( EMPTY_OUSTRING );
+ m_xEdName->clear();
+ m_xEdAssign->SetText( EMPTY_OUSTRING );
if (!rDBs.empty())
{
for (const auto& rxDB : rDBs)
- m_pEdName->InsertEntry(rxDB->GetName());
+ m_xEdName->append_text(rxDB->GetName());
}
else
{
- m_pBtnAdd->SetText( aStrAdd );
- m_pBtnAdd->Disable();
- m_pBtnRemove->Disable();
+ m_xBtnAdd->set_label( aStrAdd );
+ m_xBtnAdd->set_sensitive(false);
+ m_xBtnRemove->set_sensitive(false);
}
- m_pEdName->SetUpdateMode( true );
- m_pEdName->Invalidate();
+ m_xEdName->thaw();
}
void ScDbNameDlg::UpdateDBData( const OUString& rStrName )
@@ -375,20 +352,20 @@ void ScDbNameDlg::UpdateDBData( const OUString& rStrName )
theCurArea = ScRange( ScAddress( nColStart, nRowStart, nTab ),
ScAddress( nColEnd, nRowEnd, nTab ) );
OUString theArea(theCurArea.Format(ScRefFlags::RANGE_ABS_3D, pDoc, aAddrDetails));
- m_pEdAssign->SetText( theArea );
- m_pBtnAdd->SetText( aStrModify );
- m_pBtnHeader->Check( pData->HasHeader() );
- m_pBtnTotals->Check( pData->HasTotals() );
- m_pBtnDoSize->Check( pData->IsDoSize() );
- m_pBtnKeepFmt->Check( pData->IsKeepFmt() );
- m_pBtnStripData->Check( pData->IsStripData() );
+ m_xEdAssign->SetText( theArea );
+ m_xBtnAdd->set_label( aStrModify );
+ m_xBtnHeader->set_active( pData->HasHeader() );
+ m_xBtnTotals->set_active( pData->HasTotals() );
+ m_xBtnDoSize->set_active( pData->IsDoSize() );
+ m_xBtnKeepFmt->set_active( pData->IsKeepFmt() );
+ m_xBtnStripData->set_active( pData->IsStripData() );
SetInfoStrings( pData );
}
- m_pBtnAdd->SetText( aStrModify );
- m_pBtnAdd->Enable();
- m_pBtnRemove->Enable();
- m_pOptions->Enable();
+ m_xBtnAdd->set_label( aStrModify );
+ m_xBtnAdd->set_sensitive(true);
+ m_xBtnRemove->set_sensitive(true);
+ m_xOptions->set_sensitive(true);
}
bool ScDbNameDlg::IsRefInputMode() const
@@ -398,9 +375,9 @@ bool ScDbNameDlg::IsRefInputMode() const
// Handler:
-IMPL_LINK_NOARG(ScDbNameDlg, OkBtnHdl, Button*, void)
+IMPL_LINK_NOARG(ScDbNameDlg, OkBtnHdl, weld::Button&, void)
{
- AddBtnHdl( nullptr );
+ AddBtnHdl(*m_xBtnAdd);
// Pass the changes and the remove list to the view: both are
// transferred as a reference only, so that no dead memory can
@@ -411,18 +388,18 @@ IMPL_LINK_NOARG(ScDbNameDlg, OkBtnHdl, Button*, void)
aFunc.ModifyAllDBData(aLocalDbCol, aRemoveList);
}
- Close();
+ response(RET_OK);
}
-IMPL_LINK_NOARG(ScDbNameDlg, CancelBtnHdl, Button*, void)
+IMPL_LINK_NOARG(ScDbNameDlg, CancelBtnHdl, weld::Button&, void)
{
- Close();
+ response(RET_CANCEL);
}
-IMPL_LINK_NOARG(ScDbNameDlg, AddBtnHdl, Button*, void)
+IMPL_LINK_NOARG(ScDbNameDlg, AddBtnHdl, weld::Button&, void)
{
- OUString aNewName = comphelper::string::strip(m_pEdName->GetText(), ' ');
- OUString aNewArea = m_pEdAssign->GetText();
+ OUString aNewName = comphelper::string::strip(m_xEdName->get_active_text(), ' ');
+ OUString aNewArea = m_xEdAssign->GetText();
if ( !aNewName.isEmpty() && !aNewArea.isEmpty() )
{
@@ -430,7 +407,7 @@ IMPL_LINK_NOARG(ScDbNameDlg, AddBtnHdl, Button*, void)
{
// because editing can be done now, parsing is needed first
ScRange aTmpRange;
- OUString aText = m_pEdAssign->GetText();
+ OUString aText = m_xEdAssign->GetText();
if ( aTmpRange.ParseAny( aText, pDoc, aAddrDetails ) & ScRefFlags::VALID )
{
theCurArea = aTmpRange;
@@ -445,11 +422,11 @@ IMPL_LINK_NOARG(ScDbNameDlg, AddBtnHdl, Button*, void)
pOldEntry->MoveTo( aStart.Tab(), aStart.Col(), aStart.Row(),
aEnd.Col(), aEnd.Row() );
pOldEntry->SetByRow( true );
- pOldEntry->SetHeader( m_pBtnHeader->IsChecked() );
- pOldEntry->SetTotals( m_pBtnTotals->IsChecked() );
- pOldEntry->SetDoSize( m_pBtnDoSize->IsChecked() );
- pOldEntry->SetKeepFmt( m_pBtnKeepFmt->IsChecked() );
- pOldEntry->SetStripData( m_pBtnStripData->IsChecked() );
+ pOldEntry->SetHeader( m_xBtnHeader->get_active() );
+ pOldEntry->SetTotals( m_xBtnTotals->get_active() );
+ pOldEntry->SetDoSize( m_xBtnDoSize->get_active() );
+ pOldEntry->SetKeepFmt( m_xBtnKeepFmt->get_active() );
+ pOldEntry->SetStripData( m_xBtnStripData->get_active() );
}
else
{
@@ -458,11 +435,11 @@ IMPL_LINK_NOARG(ScDbNameDlg, AddBtnHdl, Button*, void)
std::unique_ptr<ScDBData> pNewEntry(new ScDBData( aNewName, aStart.Tab(),
aStart.Col(), aStart.Row(),
aEnd.Col(), aEnd.Row(),
- true, m_pBtnHeader->IsChecked(),
- m_pBtnTotals->IsChecked() ));
- pNewEntry->SetDoSize( m_pBtnDoSize->IsChecked() );
- pNewEntry->SetKeepFmt( m_pBtnKeepFmt->IsChecked() );
- pNewEntry->SetStripData( m_pBtnStripData->IsChecked() );
+ true, m_xBtnHeader->get_active(),
+ m_xBtnTotals->get_active() ));
+ pNewEntry->SetDoSize( m_xBtnDoSize->get_active() );
+ pNewEntry->SetKeepFmt( m_xBtnKeepFmt->get_active() );
+ pNewEntry->SetStripData( m_xBtnStripData->get_active() );
bool ins = aLocalDbCol.getNamedDBs().insert(std::move(pNewEntry));
assert(ins); (void)ins;
@@ -470,35 +447,35 @@ IMPL_LINK_NOARG(ScDbNameDlg, AddBtnHdl, Button*, void)
UpdateNames();
- m_pEdName->SetText( EMPTY_OUSTRING );
- m_pEdName->GrabFocus();
- m_pBtnAdd->SetText( aStrAdd );
- m_pBtnAdd->Disable();
- m_pBtnRemove->Disable();
- m_pEdAssign->SetText( EMPTY_OUSTRING );
- m_pBtnHeader->Check(); // Default: with column headers
- m_pBtnTotals->Check( false ); // Default: without totals row
- m_pBtnDoSize->Check( false );
- m_pBtnKeepFmt->Check( false );
- m_pBtnStripData->Check( false );
+ m_xEdName->set_entry_text( EMPTY_OUSTRING );
+ m_xEdName->grab_focus();
+ m_xBtnAdd->set_label( aStrAdd );
+ m_xBtnAdd->set_sensitive(false);
+ m_xBtnRemove->set_sensitive(false);
+ m_xEdAssign->SetText( EMPTY_OUSTRING );
+ m_xBtnHeader->set_active(true); // Default: with column headers
+ m_xBtnTotals->set_active( false ); // Default: without totals row
+ m_xBtnDoSize->set_active( false );
+ m_xBtnKeepFmt->set_active( false );
+ m_xBtnStripData->set_active( false );
SetInfoStrings( nullptr ); // empty
theCurArea = ScRange();
bSaved = true;
pSaveObj->Save();
- NameModifyHdl( *m_pEdName );
+ NameModifyHdl( *m_xEdName );
}
else
{
- ERRORBOX(GetFrameWeld(), aStrInvalid);
- m_pEdAssign->SetSelection( Selection( 0, SELECTION_MAX ) );
- m_pEdAssign->GrabFocus();
+ ERRORBOX(m_xDialog.get(), aStrInvalid);
+ m_xEdAssign->SelectAll();
+ m_xEdAssign->GrabFocus();
}
}
else
{
- ERRORBOX(GetFrameWeld(), ScResId(STR_INVALIDNAME));
- m_pEdName->SetSelection( Selection( 0, SELECTION_MAX ) );
- m_pEdName->GrabFocus();
+ ERRORBOX(m_xDialog.get(), ScResId(STR_INVALIDNAME));
+ m_xEdName->select_entry_region(0, -1);
+ m_xEdName->grab_focus();
}
}
}
@@ -518,9 +495,9 @@ public:
}
-IMPL_LINK_NOARG(ScDbNameDlg, RemoveBtnHdl, Button*, void)
+IMPL_LINK_NOARG(ScDbNameDlg, RemoveBtnHdl, weld::Button&, void)
{
- OUString aStrEntry = m_pEdName->GetText();
+ OUString aStrEntry = m_xEdName->get_active_text();
ScDBCollection::NamedDBs& rDBs = aLocalDbCol.getNamedDBs();
ScDBCollection::NamedDBs::iterator itr =
::std::find_if(rDBs.begin(), rDBs.end(), FindByName(aStrEntry));
@@ -529,7 +506,7 @@ IMPL_LINK_NOARG(ScDbNameDlg, RemoveBtnHdl, Button*, void)
{
OUString aStrDelMsg = ScResId( STR_QUERY_DELENTRY );
OUString sMsg{ aStrDelMsg.getToken(0, '#') + aStrEntry + aStrDelMsg.getToken(1, '#') };
- std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(GetFrameWeld(),
+ std::unique_ptr<weld::MessageDialog> xQueryBox(Application::CreateMessageDialog(m_xDialog.get(),
VclMessageType::Question, VclButtonsType::YesNo,
sMsg));
xQueryBox->set_default_response(RET_YES);
@@ -546,40 +523,39 @@ IMPL_LINK_NOARG(ScDbNameDlg, RemoveBtnHdl, Button*, void)
UpdateNames();
- m_pEdName->SetText( EMPTY_OUSTRING );
- m_pEdName->GrabFocus();
- m_pBtnAdd->SetText( aStrAdd );
- m_pBtnAdd->Disable();
- m_pBtnRemove->Disable();
- m_pEdAssign->SetText( EMPTY_OUSTRING );
+ m_xEdName->set_entry_text( EMPTY_OUSTRING );
+ m_xEdName->grab_focus();
+ m_xBtnAdd->set_label( aStrAdd );
+ m_xBtnAdd->set_sensitive(false);
+ m_xBtnRemove->set_sensitive(false);
+ m_xEdAssign->SetText( EMPTY_OUSTRING );
theCurArea = ScRange();
- m_pBtnHeader->Check(); // Default: with column headers
- m_pBtnTotals->Check( false ); // Default: without totals row
- m_pBtnDoSize->Check( false );
- m_pBtnKeepFmt->Check( false );
- m_pBtnStripData->Check( false );
+ m_xBtnHeader->set_active(true); // Default: with column headers
+ m_xBtnTotals->set_active( false ); // Default: without totals row
+ m_xBtnDoSize->set_active( false );
+ m_xBtnKeepFmt->set_active( false );
+ m_xBtnStripData->set_active( false );
SetInfoStrings( nullptr ); // empty
bSaved=false;
pSaveObj->Restore();
- NameModifyHdl( *m_pEdName );
+ NameModifyHdl( *m_xEdName );
}
}
}
-IMPL_LINK_NOARG(ScDbNameDlg, NameModifyHdl, Edit&, void)
+IMPL_LINK_NOARG(ScDbNameDlg, NameModifyHdl, weld::ComboBox&, void)
{
- OUString theName = m_pEdName->GetText();
- bool bNameFound = (COMBOBOX_ENTRY_NOTFOUND
- != m_pEdName->GetEntryPos( theName ));
+ OUString theName = m_xEdName->get_active_text();
+ bool bNameFound = m_xEdName->find_text(theName) != -1;
if ( theName.isEmpty() )
{
- if (m_pBtnAdd->GetText() != aStrAdd)
- m_pBtnAdd->SetText( aStrAdd );
- m_pBtnAdd->Disable();
- m_pBtnRemove->Disable();
- m_pAssignFrame->Disable();
- m_pOptions->Disable();
+ if (m_xBtnAdd->get_label() != aStrAdd)
+ m_xBtnAdd->set_label( aStrAdd );
+ m_xBtnAdd->set_sensitive(false);
+ m_xBtnRemove->set_sensitive(false);
+ m_xAssignFrame->set_sensitive(false);
+ m_xOptions->set_sensitive(false);
//bSaved=sal_False;
//pSaveObj->Restore();
//@BugID 54702 enable/disable in the base class only
@@ -590,8 +566,8 @@ IMPL_LINK_NOARG(ScDbNameDlg, NameModifyHdl, Edit&, void)
{
if ( bNameFound )
{
- if (m_pBtnAdd->GetText() != aStrModify)
- m_pBtnAdd->SetText( aStrModify );
+ if (m_xBtnAdd->get_label() != aStrModify)
+ m_xBtnAdd->set_label( aStrModify );
if(!bSaved)
{
@@ -602,63 +578,63 @@ IMPL_LINK_NOARG(ScDbNameDlg, NameModifyHdl, Edit&, void)
}
else
{
- if (m_pBtnAdd->GetText() != aStrAdd)
- m_pBtnAdd->SetText( aStrAdd );
+ if (m_xBtnAdd->get_label() != aStrAdd)
+ m_xBtnAdd->set_label( aStrAdd );
bSaved=false;
pSaveObj->Restore();
- if ( !m_pEdAssign->GetText().isEmpty() )
+ if ( !m_xEdAssign->GetText().isEmpty() )
{
- m_pBtnAdd->Enable();
- m_pOptions->Enable();
+ m_xBtnAdd->set_sensitive(true);
+ m_xOptions->set_sensitive(true);
}
else
{
- m_pBtnAdd->Disable();
- m_pOptions->Disable();
+ m_xBtnAdd->set_sensitive(false);
+ m_xOptions->set_sensitive(false);
}
- m_pBtnRemove->Disable();
+ m_xBtnRemove->set_sensitive(false);
}
- m_pAssignFrame->Enable();
+ m_xAssignFrame->set_sensitive(true);
//@BugID 54702 enable/disable in the base class only
- //SFX_APPWINDOW->Enable();
+ //SFX_APPWINDOW->set_sensitive(true);
bRefInputMode = true;
}
}
-IMPL_LINK_NOARG(ScDbNameDlg, AssModifyHdl, Edit&, void)
+IMPL_LINK_NOARG(ScDbNameDlg, AssModifyHdl, formula::WeldRefEdit&, void)
{
// parse here for Save(), etc.
ScRange aTmpRange;
- OUString aText = m_pEdAssign->GetText();
+ OUString aText = m_xEdAssign->GetText();
if ( aTmpRange.ParseAny( aText, pDoc, aAddrDetails ) & ScRefFlags::VALID )
theCurArea = aTmpRange;
- if (!aText.isEmpty() && !m_pEdName->GetText().isEmpty())
+ if (!aText.isEmpty() && !m_xEdName->get_active_text().isEmpty())
{
- m_pBtnAdd->Enable();
- m_pBtnHeader->Enable();
- m_pBtnTotals->Enable();
- m_pBtnDoSize->Enable();
- m_pBtnKeepFmt->Enable();
- m_pBtnStripData->Enable();
- m_pFTSource->Enable();
- m_pFTOperations->Enable();
+ m_xBtnAdd->set_sensitive(true);
+ m_xBtnHeader->set_sensitive(true);
+ m_xBtnTotals->set_sensitive(true);
+ m_xBtnDoSize->set_sensitive(true);
+ m_xBtnKeepFmt->set_sensitive(true);
+ m_xBtnStripData->set_sensitive(true);
+ m_xFTSource->set_sensitive(true);
+ m_xFTOperations->set_sensitive(true);
}
else
{
- m_pBtnAdd->Disable();
- m_pBtnHeader->Disable();
- m_pBtnTotals->Disable();
- m_pBtnDoSize->Disable();
- m_pBtnKeepFmt->Disable();
- m_pBtnStripData->Disable();
- m_pFTSource->Disable();
- m_pFTOperations->Disable();
+ m_xBtnAdd->set_sensitive(false);
+ m_xBtnHeader->set_sensitive(false);
+ m_xBtnTotals->set_sensitive(false);
+ m_xBtnDoSize->set_sensitive(false);
+ m_xBtnKeepFmt->set_sensitive(false);
+ m_xBtnStripData->set_sensitive(false);
+ m_xFTSource->set_sensitive(false);
+ m_xFTOperations->set_sensitive(false);
}
}