weld: Return std::unique_ptr in weld::ItemView::get_cursor
This is similar to
commit 82edaf048b
Author: Michael Weghorn <m.weghorn@posteo.de>
Date: Sun Dec 21 01:36:30 2025 +0100
weld: Return std::unique_ptr in weld::ItemView::get_selected
, but now for weld::ItemView::get_cursor.
See the above-mentioned commit for more background.
Change-Id: I6a8d8daa3dd3326c2716c0c0b4e4cb424f73ecb8
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/196389
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
This commit is contained in:
@@ -1850,13 +1850,11 @@ void WatchWindow::AddWatch( const OUString& rVName )
|
||||
|
||||
void WatchWindow::RemoveSelectedWatch()
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xEntry = m_xTreeListBox->make_iterator();
|
||||
bool bEntry = m_xTreeListBox->get_cursor(xEntry.get());
|
||||
if (bEntry)
|
||||
if (std::unique_ptr<weld::TreeIter> xEntry = m_xTreeListBox->get_cursor())
|
||||
{
|
||||
m_xTreeListBox->remove(*xEntry);
|
||||
bEntry = m_xTreeListBox->get_cursor(xEntry.get());
|
||||
if (bEntry)
|
||||
xEntry = m_xTreeListBox->get_cursor();
|
||||
if (xEntry)
|
||||
m_xEdit->set_text(weld::fromId<WatchItem*>(m_xTreeListBox->get_id(*xEntry))->maName);
|
||||
else
|
||||
m_xEdit->set_text(OUString());
|
||||
@@ -1873,9 +1871,8 @@ IMPL_STATIC_LINK_NOARG(WatchWindow, ButtonHdl, weld::Button&, void)
|
||||
|
||||
IMPL_LINK_NOARG(WatchWindow, TreeListHdl, weld::TreeView&, void)
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry = m_xTreeListBox->make_iterator();
|
||||
bool bCurEntry = m_xTreeListBox->get_cursor(xCurEntry.get());
|
||||
if (!bCurEntry)
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry = m_xTreeListBox->get_cursor();
|
||||
if (!xCurEntry)
|
||||
return;
|
||||
WatchItem* pItem = weld::fromId<WatchItem*>(m_xTreeListBox->get_id(*xCurEntry));
|
||||
if (!pItem)
|
||||
|
||||
@@ -889,15 +889,15 @@ void SbTreeListBox::SetCurrentEntry (EntryDescriptor const & rDesc)
|
||||
|
||||
IMPL_LINK_NOARG(SbTreeListBox, OpenCurrentHdl, weld::TreeView&, bool)
|
||||
{
|
||||
bool bValidIter = m_xControl->get_cursor(m_xScratchIter.get());
|
||||
if (!bValidIter)
|
||||
std::unique_ptr<weld::TreeIter> pCursor = m_xControl->get_cursor();
|
||||
if (!pCursor)
|
||||
return true;
|
||||
if (!m_xControl->get_row_expanded(*m_xScratchIter))
|
||||
m_xControl->expand_row(*m_xScratchIter);
|
||||
if (!m_xControl->get_row_expanded(*pCursor))
|
||||
m_xControl->expand_row(*pCursor);
|
||||
else
|
||||
m_xControl->collapse_row(*m_xScratchIter);
|
||||
m_xControl->collapse_row(*pCursor);
|
||||
|
||||
EntryDescriptor aDesc = GetEntryDescriptor(m_xScratchIter.get());
|
||||
EntryDescriptor aDesc = GetEntryDescriptor(pCursor.get());
|
||||
switch (aDesc.GetType())
|
||||
{
|
||||
case OBJ_TYPE_METHOD:
|
||||
|
||||
@@ -184,8 +184,8 @@ short MacroChooser::run()
|
||||
RestoreMacroDescription();
|
||||
|
||||
// #104198 Check if "wrong" document is active
|
||||
bool bSelectedEntry = m_xBasicBox->get_cursor(m_xBasicBoxIter.get());
|
||||
EntryDescriptor aDesc(m_xBasicBox->GetEntryDescriptor(bSelectedEntry ? m_xBasicBoxIter.get() : nullptr));
|
||||
std::unique_ptr<weld::TreeIter> pCursor = m_xBasicBox->get_cursor();
|
||||
EntryDescriptor aDesc(m_xBasicBox->GetEntryDescriptor(pCursor.get()));
|
||||
const ScriptDocument& rSelectedDoc(aDesc.GetDocument());
|
||||
|
||||
// App Basic is always ok, so only check if shell was found
|
||||
@@ -242,9 +242,10 @@ void MacroChooser::EnableButton(weld::Button& rButton, bool bEnable)
|
||||
|
||||
SbMethod* MacroChooser::GetMacro()
|
||||
{
|
||||
if (!m_xBasicBox->get_cursor(m_xBasicBoxIter.get()))
|
||||
std::unique_ptr<weld::TreeIter> pCursor = m_xBasicBox->get_cursor();
|
||||
if (!pCursor)
|
||||
return nullptr;
|
||||
SbModule* pModule = m_xBasicBox->FindModule(m_xBasicBoxIter.get());
|
||||
SbModule* pModule = m_xBasicBox->FindModule(pCursor.get());
|
||||
if (!pModule)
|
||||
return nullptr;
|
||||
std::unique_ptr<weld::TreeIter> pSelected = m_xMacroBox->get_selected();
|
||||
@@ -300,12 +301,17 @@ void MacroChooser::DeleteMacro()
|
||||
SbMethod* MacroChooser::CreateMacro()
|
||||
{
|
||||
SbMethod* pMethod = nullptr;
|
||||
if (!m_xBasicBox->get_cursor(m_xBasicBoxIter.get()) && !m_xBasicBox->get_iter_first(*m_xBasicBoxIter))
|
||||
std::unique_ptr<weld::TreeIter> pIter = m_xBasicBox->get_cursor();
|
||||
if (!pIter)
|
||||
{
|
||||
SAL_WARN("basctl.basicide", "neither cursor set nor root entry to use as fallback");
|
||||
return nullptr;
|
||||
pIter = m_xBasicBox->make_iterator();
|
||||
if (!m_xBasicBox->get_iter_first(*pIter))
|
||||
{
|
||||
SAL_WARN("basctl.basicide", "neither cursor set nor root entry to use as fallback");
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(m_xBasicBoxIter.get());
|
||||
EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(pIter.get());
|
||||
const ScriptDocument& aDocument( aDesc.GetDocument() );
|
||||
OSL_ENSURE( aDocument.isAlive(), "MacroChooser::CreateMacro: no document!" );
|
||||
if ( !aDocument.isAlive() )
|
||||
@@ -376,14 +382,14 @@ void MacroChooser::SaveSetCurEntry(weld::TreeView& rBox, const weld::TreeIter& r
|
||||
|
||||
void MacroChooser::CheckButtons()
|
||||
{
|
||||
const bool bCurEntry = m_xBasicBox->get_cursor(m_xBasicBoxIter.get());
|
||||
EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(bCurEntry ? m_xBasicBoxIter.get() : nullptr);
|
||||
std::unique_ptr<weld::TreeIter> pCursor = m_xBasicBox->get_cursor();
|
||||
EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(pCursor.get());
|
||||
const bool bMacroEntry = bool(m_xMacroBox->get_selected());
|
||||
SbMethod* pMethod = GetMacro();
|
||||
|
||||
// check, if corresponding libraries are readonly
|
||||
bool bReadOnly = false;
|
||||
sal_uInt16 nDepth = bCurEntry ? m_xBasicBox->get_iter_depth(*m_xBasicBoxIter) : 0;
|
||||
sal_uInt16 nDepth = pCursor ? m_xBasicBox->get_iter_depth(*pCursor) : 0;
|
||||
if ( nDepth == 1 || nDepth == 2 )
|
||||
{
|
||||
const ScriptDocument& aDocument( aDesc.GetDocument() );
|
||||
@@ -418,7 +424,7 @@ void MacroChooser::CheckButtons()
|
||||
EnableButton(*m_xOrganizeButton, !StarBASIC::IsRunning() && nMode == All);
|
||||
|
||||
// m_xDelButton/m_xNewButton ->...
|
||||
bool bProtected = bCurEntry && m_xBasicBox->IsEntryProtected(m_xBasicBoxIter.get());
|
||||
bool bProtected = pCursor && m_xBasicBox->IsEntryProtected(pCursor.get());
|
||||
bool bShare = ( aDesc.GetLocation() == LIBRARY_LOCATION_SHARE );
|
||||
bool bEnable = !StarBASIC::IsRunning() && nMode == All && !bProtected && !bReadOnly && !bShare;
|
||||
EnableButton(*m_xDelButton, bEnable);
|
||||
@@ -484,8 +490,8 @@ IMPL_LINK_NOARG(MacroChooser, MacroSelectHdl, weld::TreeView&, void)
|
||||
IMPL_LINK_NOARG(MacroChooser, BasicSelectHdl, weld::TreeView&, void)
|
||||
{
|
||||
SbModule* pModule = nullptr;
|
||||
if (m_xBasicBox->get_cursor(m_xBasicBoxIter.get()))
|
||||
pModule = m_xBasicBox->FindModule(m_xBasicBoxIter.get());
|
||||
if (std::unique_ptr<weld::TreeIter> pCursor = m_xBasicBox->get_cursor())
|
||||
pModule = m_xBasicBox->FindModule(pCursor.get());
|
||||
m_xMacroBox->clear();
|
||||
if (pModule)
|
||||
{
|
||||
@@ -517,27 +523,27 @@ IMPL_LINK_NOARG(MacroChooser, EditModifyHdl, weld::Entry&, void)
|
||||
{
|
||||
// select the module in which the macro is put at "new",
|
||||
// if BasicManager or Lib is selecting
|
||||
if (m_xBasicBox->get_cursor(m_xBasicBoxIter.get()))
|
||||
if (std::unique_ptr<weld::TreeIter> pIter = m_xBasicBox->get_cursor())
|
||||
{
|
||||
sal_uInt16 nDepth = m_xBasicBox->get_iter_depth(*m_xBasicBoxIter);
|
||||
if (nDepth == 1 && m_xBasicBox->IsEntryProtected(m_xBasicBoxIter.get()))
|
||||
sal_uInt16 nDepth = m_xBasicBox->get_iter_depth(*pIter);
|
||||
if (nDepth == 1 && m_xBasicBox->IsEntryProtected(pIter.get()))
|
||||
{
|
||||
// then put to the respective Std-Lib...
|
||||
m_xBasicBox->iter_parent(*m_xBasicBoxIter);
|
||||
m_xBasicBox->iter_children(*m_xBasicBoxIter);
|
||||
m_xBasicBox->iter_parent(*pIter);
|
||||
m_xBasicBox->iter_children(*pIter);
|
||||
}
|
||||
if (nDepth < 2)
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xNewEntry(m_xBasicBox->make_iterator());
|
||||
m_xBasicBox->copy_iterator(*m_xBasicBoxIter, *xNewEntry);
|
||||
m_xBasicBox->copy_iterator(*pIter, *xNewEntry);
|
||||
bool bCurEntry = true;
|
||||
do
|
||||
{
|
||||
bCurEntry = m_xBasicBox->iter_children(*m_xBasicBoxIter);
|
||||
bCurEntry = m_xBasicBox->iter_children(*pIter);
|
||||
if (bCurEntry)
|
||||
{
|
||||
m_xBasicBox->copy_iterator(*m_xBasicBoxIter, *xNewEntry);
|
||||
nDepth = m_xBasicBox->get_iter_depth(*m_xBasicBoxIter);
|
||||
m_xBasicBox->copy_iterator(*pIter, *xNewEntry);
|
||||
nDepth = m_xBasicBox->get_iter_depth(*pIter);
|
||||
}
|
||||
}
|
||||
while (bCurEntry && (nDepth < 2));
|
||||
@@ -624,12 +630,17 @@ IMPL_LINK(MacroChooser, ButtonHdl, weld::Button&, rButton, void)
|
||||
}
|
||||
else if (&rButton == m_xEditButton.get() || &rButton == m_xDelButton.get() || &rButton == m_xNewButton.get())
|
||||
{
|
||||
if (!m_xBasicBox->get_cursor(m_xBasicBoxIter.get()) && !m_xBasicBox->get_iter_first(*m_xBasicBoxIter))
|
||||
std::unique_ptr<weld::TreeIter> pIter = m_xBasicBox->get_cursor();
|
||||
if (!pIter)
|
||||
{
|
||||
SAL_WARN("basctl.basicide", "neither cursor set nor root entry to use as fallback");
|
||||
return;
|
||||
pIter = m_xBasicBox->make_iterator();
|
||||
if (!m_xBasicBox->get_iter_first(*pIter))
|
||||
{
|
||||
SAL_WARN("basctl.basicide", "neither cursor set nor root entry to use as fallback");
|
||||
return;
|
||||
}
|
||||
}
|
||||
EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(m_xBasicBoxIter.get());
|
||||
EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(pIter.get());
|
||||
const ScriptDocument& aDocument( aDesc.GetDocument() );
|
||||
DBG_ASSERT( aDocument.isAlive(), "MacroChooser::ButtonHdl: no document, or document is dead!" );
|
||||
if ( !aDocument.isAlive() )
|
||||
@@ -712,12 +723,17 @@ IMPL_LINK(MacroChooser, ButtonHdl, weld::Button&, rButton, void)
|
||||
}
|
||||
else if (&rButton == m_xAssignButton.get())
|
||||
{
|
||||
if (!m_xBasicBox->get_cursor(m_xBasicBoxIter.get()) && !m_xBasicBox->get_iter_first(*m_xBasicBoxIter))
|
||||
std::unique_ptr<weld::TreeIter> pIter = m_xBasicBox->get_cursor();
|
||||
if (!pIter)
|
||||
{
|
||||
SAL_WARN("basctl.basicide", "neither cursor set nor root entry to use as fallback");
|
||||
return;
|
||||
pIter = m_xBasicBox->make_iterator();
|
||||
if (!m_xBasicBox->get_iter_first(*pIter))
|
||||
{
|
||||
SAL_WARN("basctl.basicide", "neither cursor set nor root entry to use as fallback");
|
||||
return;
|
||||
}
|
||||
}
|
||||
EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(m_xBasicBoxIter.get());
|
||||
EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(pIter.get());
|
||||
const ScriptDocument& aDocument( aDesc.GetDocument() );
|
||||
DBG_ASSERT( aDocument.isAlive(), "MacroChooser::ButtonHdl: no document, or document is dead!" );
|
||||
if ( !aDocument.isAlive() )
|
||||
@@ -743,23 +759,33 @@ IMPL_LINK(MacroChooser, ButtonHdl, weld::Button&, rButton, void)
|
||||
}
|
||||
else if (&rButton == m_xNewLibButton.get())
|
||||
{
|
||||
if (!m_xBasicBox->get_cursor(m_xBasicBoxIter.get()) && !m_xBasicBox->get_iter_first(*m_xBasicBoxIter))
|
||||
std::unique_ptr<weld::TreeIter> pIter = m_xBasicBox->get_cursor();
|
||||
if (!pIter)
|
||||
{
|
||||
SAL_WARN("basctl.basicide", "neither cursor set nor root entry to use as fallback");
|
||||
return;
|
||||
pIter = m_xBasicBox->make_iterator();
|
||||
if (!m_xBasicBox->get_iter_first(*pIter))
|
||||
{
|
||||
SAL_WARN("basctl.basicide", "neither cursor set nor root entry to use as fallback");
|
||||
return;
|
||||
}
|
||||
}
|
||||
EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(m_xBasicBoxIter.get());
|
||||
EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(pIter.get());
|
||||
const ScriptDocument& aDocument( aDesc.GetDocument() );
|
||||
createLibImpl(m_xDialog.get(), aDocument, nullptr, m_xBasicBox.get());
|
||||
}
|
||||
else if (&rButton == m_xNewModButton.get())
|
||||
{
|
||||
if (!m_xBasicBox->get_cursor(m_xBasicBoxIter.get()) && !m_xBasicBox->get_iter_first(*m_xBasicBoxIter))
|
||||
std::unique_ptr<weld::TreeIter> pIter = m_xBasicBox->get_cursor();
|
||||
if (!pIter)
|
||||
{
|
||||
SAL_WARN("basctl.basicide", "neither cursor set nor root entry to use as fallback");
|
||||
return;
|
||||
pIter = m_xBasicBox->make_iterator();
|
||||
if (!m_xBasicBox->get_iter_first(*pIter))
|
||||
{
|
||||
SAL_WARN("basctl.basicide", "neither cursor set nor root entry to use as fallback");
|
||||
return;
|
||||
}
|
||||
}
|
||||
EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(m_xBasicBoxIter.get());
|
||||
EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(pIter.get());
|
||||
const ScriptDocument& aDocument( aDesc.GetDocument() );
|
||||
const OUString& aLibName( aDesc.GetLibName() );
|
||||
createModImpl(m_xDialog.get(), aDocument, *m_xBasicBox, aLibName, OUString(), true);
|
||||
|
||||
@@ -374,8 +374,8 @@ LibPage::~LibPage()
|
||||
|
||||
void LibPage::CheckButtons()
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xCur(m_xLibBox->make_iterator());
|
||||
if (!m_xLibBox->get_cursor(xCur.get()))
|
||||
std::unique_ptr<weld::TreeIter> xCur = m_xLibBox->get_cursor();
|
||||
if (!xCur)
|
||||
return;
|
||||
|
||||
OUString aLibName = m_xLibBox->get_text(*xCur, 0);
|
||||
@@ -449,8 +449,8 @@ IMPL_LINK( LibPage, ButtonHdl, weld::Button&, rButton, void )
|
||||
|
||||
SfxUnoAnyItem aDocItem( SID_BASICIDE_ARG_DOCUMENT_MODEL, Any( m_aCurDocument.getDocumentOrNull() ) );
|
||||
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry(m_xLibBox->make_iterator());
|
||||
if (!m_xLibBox->get_cursor(xCurEntry.get()))
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry = m_xLibBox->get_cursor();
|
||||
if (!xCurEntry)
|
||||
return;
|
||||
OUString aLibName(m_xLibBox->get_text(*xCurEntry, 0));
|
||||
SfxStringItem aLibNameItem( SID_BASICIDE_ARG_LIBNAME, aLibName );
|
||||
@@ -466,8 +466,8 @@ IMPL_LINK( LibPage, ButtonHdl, weld::Button&, rButton, void )
|
||||
InsertLib();
|
||||
else if (&rButton == m_xExportButton.get())
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry(m_xLibBox->make_iterator());
|
||||
if (!m_xLibBox->get_cursor(xCurEntry.get()))
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry = m_xLibBox->get_cursor();
|
||||
if (!xCurEntry)
|
||||
return;
|
||||
OUString aLibName(m_xLibBox->get_text(*xCurEntry, 0));
|
||||
Export(m_aCurDocument, aLibName, m_pDialog->getDialog());
|
||||
@@ -476,8 +476,8 @@ IMPL_LINK( LibPage, ButtonHdl, weld::Button&, rButton, void )
|
||||
DeleteCurrent();
|
||||
else if (&rButton == m_xPasswordButton.get())
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry(m_xLibBox->make_iterator());
|
||||
if (!m_xLibBox->get_cursor(xCurEntry.get()))
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry = m_xLibBox->get_cursor();
|
||||
if (!xCurEntry)
|
||||
return;
|
||||
OUString aLibName(m_xLibBox->get_text(*xCurEntry, 0));
|
||||
|
||||
@@ -541,8 +541,8 @@ IMPL_LINK( LibPage, CheckPasswordHdl, SvxPasswordDialog *, pDlg, bool )
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry(m_xLibBox->make_iterator());
|
||||
if (!m_xLibBox->get_cursor(xCurEntry.get()))
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry = m_xLibBox->get_cursor();
|
||||
if (!xCurEntry)
|
||||
return bRet;
|
||||
|
||||
OUString aLibName(m_xLibBox->get_text(*xCurEntry, 0));
|
||||
@@ -1183,8 +1183,8 @@ void ExportAsBasic(const ScriptDocument& rScriptDocument, const OUString& aLibNa
|
||||
|
||||
void LibPage::DeleteCurrent()
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry(m_xLibBox->make_iterator());
|
||||
if (!m_xLibBox->get_cursor(xCurEntry.get()))
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry = m_xLibBox->get_cursor();
|
||||
if (!xCurEntry)
|
||||
return;
|
||||
OUString aLibName(m_xLibBox->get_text(*xCurEntry, 0));
|
||||
|
||||
@@ -1393,8 +1393,8 @@ void createLibImpl(weld::Window* pWin, const ScriptDocument& rDocument,
|
||||
|
||||
if( pBasicBox )
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xIter(pBasicBox->make_iterator(nullptr));
|
||||
bool bValidIter = pBasicBox->get_cursor(xIter.get());
|
||||
std::unique_ptr<weld::TreeIter> xIter = pBasicBox->get_cursor();
|
||||
bool bValidIter = bool(xIter);
|
||||
std::unique_ptr<weld::TreeIter> xRootEntry(pBasicBox->make_iterator(xIter.get()));
|
||||
while (bValidIter)
|
||||
{
|
||||
|
||||
@@ -622,9 +622,7 @@ void ObjectPage::ActivatePage()
|
||||
void ObjectPage::CheckButtons()
|
||||
{
|
||||
// enable/disable edit button
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry(m_xBasicBox->make_iterator());
|
||||
if (!m_xBasicBox->get_cursor(xCurEntry.get()))
|
||||
xCurEntry.reset();
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry = m_xBasicBox->get_cursor();
|
||||
EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(xCurEntry.get());
|
||||
const ScriptDocument& aDocument( aDesc.GetDocument() );
|
||||
const OUString& aLibName( aDesc.GetLibName() );
|
||||
@@ -694,8 +692,8 @@ IMPL_LINK(ObjectPage, ButtonHdl, weld::Button&, rButton, void)
|
||||
|
||||
SfxDispatcher* pDispatcher = GetDispatcher();
|
||||
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry(m_xBasicBox->make_iterator());
|
||||
if (!m_xBasicBox->get_cursor(xCurEntry.get()))
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry = m_xBasicBox->get_cursor();
|
||||
if (!xCurEntry)
|
||||
return;
|
||||
if (m_xBasicBox->get_iter_depth(*xCurEntry) >= 2)
|
||||
{
|
||||
@@ -748,9 +746,7 @@ bool ObjectPage::GetSelection( ScriptDocument& rDocument, OUString& rLibName )
|
||||
{
|
||||
bool bRet = false;
|
||||
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry(m_xBasicBox->make_iterator());
|
||||
if (!m_xBasicBox->get_cursor(xCurEntry.get()))
|
||||
xCurEntry.reset();
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry = m_xBasicBox->get_cursor();
|
||||
EntryDescriptor aDesc = m_xBasicBox->GetEntryDescriptor(xCurEntry.get());
|
||||
rDocument = aDesc.GetDocument();
|
||||
rLibName = aDesc.GetLibName();
|
||||
@@ -875,9 +871,7 @@ void ObjectPage::NewDialog()
|
||||
|
||||
void ObjectPage::DeleteCurrent()
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry(m_xBasicBox->make_iterator());
|
||||
if (!m_xBasicBox->get_cursor(xCurEntry.get()))
|
||||
xCurEntry.reset();
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry = m_xBasicBox->get_cursor();
|
||||
DBG_ASSERT( xCurEntry, "No current entry!" );
|
||||
if (!xCurEntry)
|
||||
return;
|
||||
@@ -895,7 +889,8 @@ void ObjectPage::DeleteCurrent()
|
||||
return;
|
||||
|
||||
m_xBasicBox->remove(*xCurEntry);
|
||||
if (m_xBasicBox->get_cursor(xCurEntry.get()))
|
||||
xCurEntry = m_xBasicBox->get_cursor();
|
||||
if (xCurEntry)
|
||||
m_xBasicBox->select(*xCurEntry);
|
||||
if (SfxDispatcher* pDispatcher = GetDispatcher())
|
||||
{
|
||||
|
||||
@@ -253,7 +253,7 @@ public:
|
||||
void select(const weld::TreeIter& rIter) { m_xControl->select(rIter); }
|
||||
void unselect(const weld::TreeIter& rIter) { m_xControl->unselect(rIter); }
|
||||
void remove(const weld::TreeIter& rIter) { m_xControl->remove(rIter); }
|
||||
bool get_cursor(weld::TreeIter* pIter) const { return m_xControl->get_cursor(pIter); }
|
||||
std::unique_ptr<weld::TreeIter> get_cursor() const { return m_xControl->get_cursor(); }
|
||||
void set_cursor(const weld::TreeIter& rIter) { m_xControl->set_cursor(rIter); }
|
||||
OUString get_text(const weld::TreeIter& rIter) const { return m_xControl->get_text(rIter); }
|
||||
void set_text(const weld::TreeIter& rIter, const OUString& rText) { m_xControl->set_text(rIter, rText); }
|
||||
|
||||
@@ -475,9 +475,7 @@ IMPL_LINK_NOARG(SvxHlinkDlgMarkWnd, DoubleClickApplyHdl_Impl, weld::TreeView&, b
|
||||
|
||||
IMPL_LINK_NOARG(SvxHlinkDlgMarkWnd, ClickApplyHdl_Impl, weld::Button&, void)
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xEntry(mxLbTree->make_iterator());
|
||||
bool bEntry = mxLbTree->get_cursor(xEntry.get());
|
||||
if (bEntry)
|
||||
if (std::unique_ptr<weld::TreeIter> xEntry = mxLbTree->get_cursor())
|
||||
{
|
||||
TargetData* pData = weld::fromId<TargetData*>(mxLbTree->get_id(*xEntry));
|
||||
if (pData->bIsTarget)
|
||||
@@ -490,9 +488,7 @@ IMPL_LINK_NOARG(SvxHlinkDlgMarkWnd, ClickApplyHdl_Impl, weld::Button&, void)
|
||||
// Click on Close-Button
|
||||
IMPL_LINK_NOARG(SvxHlinkDlgMarkWnd, ClickCloseHdl_Impl, weld::Button&, void)
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xEntry(mxLbTree->make_iterator());
|
||||
bool bEntry = mxLbTree->get_cursor(xEntry.get());
|
||||
if (bEntry)
|
||||
if (std::unique_ptr<weld::TreeIter> xEntry = mxLbTree->get_cursor())
|
||||
{
|
||||
TargetData* pUserData = weld::fromId<TargetData*>(mxLbTree->get_id(*xEntry));
|
||||
OUString sLastSelectedMark = pUserData->aUStrLinkname;
|
||||
@@ -502,6 +498,7 @@ IMPL_LINK_NOARG(SvxHlinkDlgMarkWnd, ClickCloseHdl_Impl, weld::Button&, void)
|
||||
//underneath it is selected leave a dummy entry
|
||||
if (mxLbTree->get_row_expanded(*xEntry))
|
||||
aLastSelectedPath.push_front(OUString());
|
||||
bool bEntry = true;
|
||||
while (bEntry)
|
||||
{
|
||||
aLastSelectedPath.push_front(mxLbTree->get_text(*xEntry));
|
||||
|
||||
@@ -1255,9 +1255,8 @@ void OfaTreeOptionsDialog::initializeCurrentDialog(OptionsPageInfo*& pPageInfo,
|
||||
|
||||
void OfaTreeOptionsDialog::SelectHdl_Impl()
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xEntry(xTreeLB->make_iterator());
|
||||
|
||||
if (!xTreeLB->get_cursor(xEntry.get()))
|
||||
std::unique_ptr<weld::TreeIter> xEntry = xTreeLB->get_cursor();
|
||||
if (!xEntry)
|
||||
return;
|
||||
|
||||
if (xCurrentPageEntry && xCurrentPageEntry->equal(*xEntry))
|
||||
|
||||
@@ -1690,8 +1690,8 @@ bool OApplicationController::onEntryDoubleClick(const weld::TreeView& rTreeView)
|
||||
if (!pContainer)
|
||||
return false; // not handled
|
||||
|
||||
std::unique_ptr<weld::TreeIter> xHdlEntry = rTreeView.make_iterator();
|
||||
if (!rTreeView.get_cursor(xHdlEntry.get()))
|
||||
std::unique_ptr<weld::TreeIter> xHdlEntry = rTreeView.get_cursor();
|
||||
if (!xHdlEntry)
|
||||
return false;
|
||||
|
||||
if (!pContainer->isLeaf(rTreeView, *xHdlEntry))
|
||||
|
||||
@@ -1633,8 +1633,8 @@ FeatureState SbaTableQueryBrowser::GetState(sal_uInt16 nId) const
|
||||
case ID_TREE_EDIT_DATABASE:
|
||||
{
|
||||
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
|
||||
std::unique_ptr<weld::TreeIter> xCurrentEntry(rTreeView.make_iterator());
|
||||
if (!rTreeView.get_cursor(xCurrentEntry.get()))
|
||||
std::unique_ptr<weld::TreeIter> xCurrentEntry = rTreeView.get_cursor();
|
||||
if (!xCurrentEntry)
|
||||
return aReturn;
|
||||
|
||||
EntryType eType = getEntryType(*xCurrentEntry);
|
||||
@@ -1806,16 +1806,15 @@ void SbaTableQueryBrowser::Execute(sal_uInt16 nId, const Sequence< PropertyValue
|
||||
case ID_TREE_EDIT_DATABASE:
|
||||
{
|
||||
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
|
||||
std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
|
||||
if (rTreeView.get_cursor(xIter.get()))
|
||||
std::unique_ptr<weld::TreeIter> xIter = rTreeView.get_cursor();
|
||||
if (xIter)
|
||||
implAdministrate(*xIter);
|
||||
break;
|
||||
}
|
||||
case ID_TREE_CLOSE_CONN:
|
||||
{
|
||||
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
|
||||
std::unique_ptr<weld::TreeIter> xIter(rTreeView.make_iterator());
|
||||
if (rTreeView.get_cursor(xIter.get()))
|
||||
if (std::unique_ptr<weld::TreeIter> xIter = rTreeView.get_cursor())
|
||||
{
|
||||
xIter = m_pTreeView->GetRootLevelParent(xIter.get());
|
||||
closeConnection(*xIter);
|
||||
@@ -1982,8 +1981,7 @@ void SbaTableQueryBrowser::Execute(sal_uInt16 nId, const Sequence< PropertyValue
|
||||
if(m_pTreeView->HasChildPathFocus())
|
||||
{
|
||||
weld::TreeView& rTreeView = m_pTreeView->GetWidget();
|
||||
std::unique_ptr<weld::TreeIter> xCursor(rTreeView.make_iterator());
|
||||
if (rTreeView.get_cursor(xCursor.get()))
|
||||
if (std::unique_ptr<weld::TreeIter> xCursor = rTreeView.get_cursor())
|
||||
copyEntry(*xCursor);
|
||||
}
|
||||
else if (getBrowserView() && getBrowserView()->getVclControl() && !getBrowserView()->getVclControl()->IsEditing() && getBrowserView()->getVclControl()->GetSelectRowCount() < 1)
|
||||
|
||||
@@ -530,8 +530,7 @@ void OTableWindow::Command(const CommandEvent& rEvt)
|
||||
else
|
||||
{
|
||||
weld::TreeView& rTreeView = m_xListBox->get_widget();
|
||||
std::unique_ptr<weld::TreeIter> xCurrent = rTreeView.make_iterator();
|
||||
if (rTreeView.get_cursor(xCurrent.get()))
|
||||
if (std::unique_ptr<weld::TreeIter> xCurrent = rTreeView.get_cursor())
|
||||
ptWhere = rTreeView.get_row_area(*xCurrent).Center();
|
||||
else
|
||||
ptWhere = m_xTitle->GetPosPixel();
|
||||
|
||||
@@ -249,8 +249,7 @@ void OTableWindowListBox::GetFocus()
|
||||
|
||||
if (m_xTreeView)
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xCurrent = m_xTreeView->make_iterator();
|
||||
if (m_xTreeView->get_cursor(xCurrent.get()))
|
||||
if (std::unique_ptr<weld::TreeIter> xCurrent = m_xTreeView->get_cursor())
|
||||
{
|
||||
m_xTreeView->unselect_all();
|
||||
m_xTreeView->select(*xCurrent);
|
||||
@@ -266,8 +265,8 @@ IMPL_LINK_NOARG(OTableWindowListBox, OnDoubleClick, weld::TreeView&, bool)
|
||||
vcl::Window* pParent = Window::GetParent();
|
||||
OSL_ENSURE(pParent != nullptr, "OTableWindowListBox::OnDoubleClick : have no Parent !");
|
||||
|
||||
std::unique_ptr<weld::TreeIter> xCurrent = m_xTreeView->make_iterator();
|
||||
if (!m_xTreeView->get_cursor(xCurrent.get()))
|
||||
std::unique_ptr<weld::TreeIter> xCurrent = m_xTreeView->get_cursor();
|
||||
if (!xCurrent)
|
||||
return false;
|
||||
|
||||
static_cast<OTableWindow*>(pParent)->OnEntryDoubleClicked(*xCurrent);
|
||||
|
||||
@@ -131,8 +131,7 @@ IMPL_LINK(StructPage, SelectHdl, weld::TreeView&, rTlb, void)
|
||||
|
||||
if (&rTlb == m_xTlbStruct.get())
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry(m_xTlbStruct->make_iterator());
|
||||
if (m_xTlbStruct->get_cursor(xCurEntry.get()))
|
||||
if (std::unique_ptr<weld::TreeIter> xCurEntry = m_xTlbStruct->get_cursor())
|
||||
{
|
||||
pSelectedToken = weld::fromId<const FormulaToken*>(m_xTlbStruct->get_id(*xCurEntry));
|
||||
if (pSelectedToken)
|
||||
|
||||
@@ -160,7 +160,7 @@ public:
|
||||
void scroll_to_row(const weld::TreeIter& rIter) { mxTreeView->scroll_to_row(rIter); }
|
||||
void set_cursor(int nPos) { mxTreeView->set_cursor(nPos); }
|
||||
void set_cursor(const weld::TreeIter& rIter) { mxTreeView->set_cursor(rIter); }
|
||||
bool get_cursor(weld::TreeIter* pIter) const { return mxTreeView->get_cursor(pIter); }
|
||||
std::unique_ptr<weld::TreeIter> get_cursor() const { return mxTreeView->get_cursor(); }
|
||||
bool get_iter_first(weld::TreeIter& rIter) const { return mxTreeView->get_iter_first(rIter); }
|
||||
std::unique_ptr<weld::TreeIter> get_selected() const { return mxTreeView->get_selected(); }
|
||||
|
||||
@@ -1537,11 +1537,10 @@ void SvtFileView_Impl::Resort_Impl( sal_Int16 nColumn, bool bAscending )
|
||||
// reset the quick search index
|
||||
mxView->ResetQuickSearch_Impl( nullptr );
|
||||
|
||||
std::unique_ptr<weld::TreeIter> xEntry(mxView->make_iterator());
|
||||
bool bEntry = mxView->get_cursor(xEntry.get());
|
||||
std::unique_ptr<weld::TreeIter> xEntry = mxView->get_cursor();
|
||||
|
||||
OUString aEntryURL;
|
||||
if (bEntry && !mxView->get_id(*xEntry).isEmpty())
|
||||
if (xEntry && !mxView->get_id(*xEntry).isEmpty())
|
||||
aEntryURL = weld::fromId<SvtContentEntry*>(mxView->get_id(*xEntry))->maURL;
|
||||
|
||||
mnSortColumn = nColumn;
|
||||
|
||||
@@ -103,10 +103,9 @@ void FolderTree::FillTreeEntry( const OUString & rUrl, const ::std::vector< std:
|
||||
{
|
||||
SetTreePath(rUrl);
|
||||
|
||||
std::unique_ptr<weld::TreeIter> xParent(m_xTreeView->make_iterator());
|
||||
bool bParent = m_xTreeView->get_cursor(xParent.get());
|
||||
std::unique_ptr<weld::TreeIter> xParent = m_xTreeView->get_cursor();
|
||||
|
||||
if (!bParent || m_xTreeView->get_row_expanded(*xParent))
|
||||
if (!xParent || m_xTreeView->get_row_expanded(*xParent))
|
||||
return;
|
||||
|
||||
OUString sFolderImage(RID_BMP_FOLDER);
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
virtual std::unique_ptr<weld::TreeIter> get_selected() const = 0;
|
||||
|
||||
int get_cursor_index() const;
|
||||
virtual bool get_cursor(TreeIter* pIter) const = 0;
|
||||
virtual std::unique_ptr<TreeIter> get_cursor() const = 0;
|
||||
void set_cursor(const TreeIter& rIter);
|
||||
|
||||
// Don't select when frozen, select after thaw. Note selection doesn't survive a freeze.
|
||||
|
||||
@@ -328,10 +328,9 @@ IMPL_LINK_NOARG(NavigatorTree, OnEntrySelDesel, weld::TreeView&, void)
|
||||
if ( !m_pSelectionListener->locked() )
|
||||
{
|
||||
m_pSelectionListener->lock();
|
||||
std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->make_iterator();
|
||||
bool bEntry = m_xTreeView->get_cursor(xEntry.get());
|
||||
std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->get_cursor();
|
||||
uno::Any aSelection;
|
||||
if (bEntry && m_xTreeView->is_selected(*xEntry))
|
||||
if (xEntry && m_xTreeView->is_selected(*xEntry))
|
||||
aSelection <<= weld::fromId<UserData*>(m_xTreeView->get_id(*xEntry))->getContent();
|
||||
m_rController.select(aSelection);
|
||||
m_pSelectionListener->unlock();
|
||||
|
||||
@@ -755,8 +755,8 @@ void ScCheckListMenuControl::setAllMemberState(bool bSet)
|
||||
void ScCheckListMenuControl::selectCurrentMemberOnly(bool bSet)
|
||||
{
|
||||
setAllMemberState(!bSet);
|
||||
std::unique_ptr<weld::TreeIter> xEntry = mpChecks->make_iterator();
|
||||
if (!mpChecks->get_cursor(xEntry.get()))
|
||||
std::unique_ptr<weld::TreeIter> xEntry = mpChecks->get_cursor();
|
||||
if (!xEntry)
|
||||
return;
|
||||
mpChecks->set_toggle(*xEntry, bSet ? TRISTATE_TRUE : TRISTATE_FALSE);
|
||||
}
|
||||
@@ -798,11 +798,8 @@ IMPL_LINK(ScCheckListMenuControl, ButtonHdl, weld::Button&, rBtn, void)
|
||||
close(false);
|
||||
else if (&rBtn == mxBtnSelectSingle.get() || &rBtn == mxBtnUnselectSingle.get())
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xEntry = mpChecks->make_iterator();
|
||||
bool bEntry = mpChecks->get_cursor(xEntry.get());
|
||||
if (!bEntry)
|
||||
xEntry.reset();
|
||||
if (bEntry && mpChecks->get_sensitive(*xEntry, 0))
|
||||
std::unique_ptr<weld::TreeIter> xEntry = mpChecks->get_cursor();
|
||||
if (xEntry && mpChecks->get_sensitive(*xEntry, 0))
|
||||
{
|
||||
selectCurrentMemberOnly(&rBtn == mxBtnSelectSingle.get());
|
||||
Check(xEntry.get());
|
||||
@@ -1520,9 +1517,8 @@ IMPL_LINK(ScCheckListMenuControl, KeyInputHdl, const KeyEvent&, rKEvt, bool)
|
||||
|
||||
if ( rKey.GetCode() == KEY_RETURN || rKey.GetCode() == KEY_SPACE )
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xEntry = mpChecks->make_iterator();
|
||||
bool bEntry = mpChecks->get_cursor(xEntry.get());
|
||||
if (bEntry && mpChecks->get_sensitive(*xEntry, 0))
|
||||
std::unique_ptr<weld::TreeIter> xEntry = mpChecks->get_cursor();
|
||||
if (xEntry && mpChecks->get_sensitive(*xEntry, 0))
|
||||
{
|
||||
bool bOldCheck = mpChecks->get_toggle(*xEntry) == TRISTATE_TRUE;
|
||||
CheckEntry(*xEntry, !bOldCheck);
|
||||
|
||||
@@ -1375,10 +1375,10 @@ void ScAcceptChgDlg::RemoveEntries(sal_uLong nStartAction,sal_uLong nEndAction)
|
||||
weld::TreeView& rTreeView = pTheView->GetWidget();
|
||||
|
||||
ScRedlinData *pEntryData=nullptr;
|
||||
std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
|
||||
if (rTreeView.get_cursor(xEntry.get()))
|
||||
if (std::unique_ptr<weld::TreeIter> xEntry = rTreeView.get_cursor())
|
||||
pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
|
||||
|
||||
std::unique_ptr<weld::TreeIter> xEntry = rTreeView.make_iterator();
|
||||
if (!rTreeView.get_iter_first(*xEntry))
|
||||
return;
|
||||
|
||||
@@ -1580,9 +1580,8 @@ IMPL_LINK(ScAcceptChgDlg, CommandHdl, const CommandEvent&, rCEvt, bool)
|
||||
return false;
|
||||
|
||||
weld::TreeView& rTreeView = pTheView->GetWidget();
|
||||
std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
|
||||
bool bEntry = rTreeView.get_cursor(xEntry.get());
|
||||
if (bEntry)
|
||||
std::unique_ptr<weld::TreeIter> xEntry = rTreeView.get_cursor();
|
||||
if (xEntry)
|
||||
rTreeView.select(*xEntry);
|
||||
|
||||
int nSortedCol = rTreeView.get_sort_column();
|
||||
@@ -1591,7 +1590,7 @@ IMPL_LINK(ScAcceptChgDlg, CommandHdl, const CommandEvent&, rCEvt, bool)
|
||||
|
||||
m_xPopup->set_sensitive(u"calcedit"_ustr, false);
|
||||
|
||||
if (pDoc->IsDocEditable() && bEntry)
|
||||
if (pDoc->IsDocEditable() && xEntry)
|
||||
{
|
||||
ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
|
||||
if (pEntryData)
|
||||
@@ -1608,7 +1607,7 @@ IMPL_LINK(ScAcceptChgDlg, CommandHdl, const CommandEvent&, rCEvt, bool)
|
||||
{
|
||||
if (sCommand == "calcedit")
|
||||
{
|
||||
if (bEntry)
|
||||
if (xEntry)
|
||||
{
|
||||
ScRedlinData *pEntryData = weld::fromId<ScRedlinData*>(rTreeView.get_id(*xEntry));
|
||||
if (pEntryData)
|
||||
|
||||
@@ -407,9 +407,8 @@ void ScConflictsDlg::SetActionString(ScChangeAction& rAction, ScDocument& rDoc,
|
||||
void ScConflictsDlg::HandleListBoxSelection()
|
||||
{
|
||||
weld::TreeView& rTreeView = m_xLbConflicts->GetWidget();
|
||||
std::unique_ptr<weld::TreeIter> xEntry(rTreeView.make_iterator());
|
||||
bool bSelEntry = rTreeView.get_cursor(xEntry.get());
|
||||
if (!bSelEntry)
|
||||
std::unique_ptr<weld::TreeIter> xEntry = rTreeView.get_cursor();
|
||||
if (!xEntry)
|
||||
xEntry = rTreeView.get_selected();
|
||||
if (!xEntry)
|
||||
return;
|
||||
|
||||
@@ -23,8 +23,7 @@
|
||||
|
||||
void ScRangeManagerTable::GetCurrentLine(ScRangeNameLine& rLine)
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xCurrentEntry(m_xTreeView->make_iterator());
|
||||
if (m_xTreeView->get_cursor(xCurrentEntry.get()))
|
||||
if (std::unique_ptr<weld::TreeIter> xCurrentEntry = m_xTreeView->get_cursor())
|
||||
GetLine(rLine, *xCurrentEntry);
|
||||
}
|
||||
|
||||
|
||||
@@ -335,9 +335,7 @@ IMPL_LINK_NOARG(ScContentTree, ContentDoubleClickHdl, weld::TreeView&, bool)
|
||||
{
|
||||
ScContentId nType;
|
||||
sal_uLong nChild;
|
||||
std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
|
||||
if (!m_xTreeView->get_cursor(xEntry.get()))
|
||||
xEntry.reset();
|
||||
std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->get_cursor();
|
||||
GetEntryIndexes(nType, nChild, xEntry.get());
|
||||
|
||||
if (xEntry && (nType != ScContentId::ROOT) && (nChild != SC_CONTENT_NOCHILD))
|
||||
@@ -454,10 +452,7 @@ IMPL_LINK(ScContentTree, KeyInputHdl, const KeyEvent&, rKEvt, bool)
|
||||
break;
|
||||
case 0:
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
|
||||
if (!m_xTreeView->get_cursor(xEntry.get()))
|
||||
xEntry.reset();
|
||||
if (xEntry)
|
||||
if (std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->get_cursor())
|
||||
{
|
||||
ScContentId nType;
|
||||
sal_uLong nChild;
|
||||
@@ -488,9 +483,7 @@ IMPL_LINK(ScContentTree, KeyInputHdl, const KeyEvent&, rKEvt, bool)
|
||||
bUsed = true;
|
||||
ScContentId nType;
|
||||
sal_uLong nChild;
|
||||
std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
|
||||
if (!m_xTreeView->get_cursor(xEntry.get()))
|
||||
xEntry.reset();
|
||||
std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->get_cursor();
|
||||
GetEntryIndexes(nType, nChild, xEntry.get());
|
||||
|
||||
if (xEntry && (nType != ScContentId::ROOT) && (nChild != SC_CONTENT_NOCHILD))
|
||||
@@ -556,9 +549,7 @@ IMPL_LINK(ScContentTree, CommandHdl, const CommandEvent&, rCEvt, bool)
|
||||
|
||||
ScContentId nType;
|
||||
sal_uLong nChild;
|
||||
std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
|
||||
if (!m_xTreeView->get_cursor(xEntry.get()))
|
||||
xEntry.reset();
|
||||
std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->get_cursor();
|
||||
GetEntryIndexes(nType, nChild, xEntry.get());
|
||||
|
||||
switch ( rCEvt.GetCommand() )
|
||||
@@ -1247,10 +1238,7 @@ IMPL_LINK(ScContentTree, DragBeginHdl, bool&, rUnsetDragIcon, bool)
|
||||
ScContentId nType;
|
||||
sal_uLong nChild;
|
||||
|
||||
std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
|
||||
if (!m_xTreeView->get_cursor(xEntry.get()))
|
||||
xEntry.reset();
|
||||
|
||||
std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->get_cursor();
|
||||
GetEntryIndexes(nType, nChild, xEntry.get());
|
||||
|
||||
if( xEntry &&
|
||||
@@ -1388,8 +1376,7 @@ void ScContentTree::ToggleRoot() // after selection
|
||||
ScContentId nNew = ScContentId::ROOT;
|
||||
if ( nRootType == ScContentId::ROOT )
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
|
||||
if (m_xTreeView->get_cursor(xEntry.get()))
|
||||
if (std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->get_cursor())
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xParent(m_xTreeView->make_iterator(xEntry.get()));
|
||||
if (!m_xTreeView->iter_parent(*xParent))
|
||||
@@ -1638,9 +1625,7 @@ void ScContentTree::StoreNavigatorSettings()
|
||||
pSettings->SetExpanded( nEntry, bExp );
|
||||
}
|
||||
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry(m_xTreeView->make_iterator());
|
||||
if (!m_xTreeView->get_cursor(xCurEntry.get()))
|
||||
xCurEntry.reset();
|
||||
std::unique_ptr<weld::TreeIter> xCurEntry = m_xTreeView->get_cursor();
|
||||
|
||||
ScContentId nRoot;
|
||||
sal_uLong nChild;
|
||||
|
||||
@@ -235,8 +235,8 @@ std::unique_ptr<weld::TreeIter> getReferenceEntry(const weld::TreeView& rTree, c
|
||||
|
||||
void ScXMLSourceDlg::TreeItemSelected()
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xEntry(mxLbTree->make_iterator());
|
||||
if (!mxLbTree->get_cursor(xEntry.get()))
|
||||
std::unique_ptr<weld::TreeIter> xEntry = mxLbTree->get_cursor();
|
||||
if (!xEntry)
|
||||
return;
|
||||
|
||||
mxLbTree->unselect_all();
|
||||
|
||||
@@ -503,9 +503,7 @@ IMPL_LINK(CustomAnimationList, DragBeginHdl, bool&, rUnsetDragIcon, bool)
|
||||
});
|
||||
|
||||
// Note: pEntry is the effect with focus (if multiple effects are selected)
|
||||
mxDndEffectDragging = mxTreeView->make_iterator();
|
||||
if (!mxTreeView->get_cursor(mxDndEffectDragging.get()))
|
||||
mxDndEffectDragging.reset();
|
||||
mxDndEffectDragging = mxTreeView->get_cursor();
|
||||
|
||||
// Allow normal processing.
|
||||
return false;
|
||||
@@ -596,8 +594,7 @@ IMPL_LINK(CustomAnimationList, KeyInputHdl, const KeyEvent&, rKEvt, bool)
|
||||
return true;
|
||||
case KEY_SPACE:
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xEntry = mxTreeView->make_iterator();
|
||||
if (mxTreeView->get_cursor(xEntry.get()))
|
||||
if (std::unique_ptr<weld::TreeIter> xEntry = mxTreeView->get_cursor())
|
||||
{
|
||||
auto aRect = mxTreeView->get_row_area(*xEntry);
|
||||
const Point aPos(aRect.getOpenWidth() / 2, aRect.getOpenHeight() / 2);
|
||||
@@ -690,8 +687,6 @@ void CustomAnimationList::update()
|
||||
::tools::Long nFirstSelOld = -1;
|
||||
::tools::Long nLastSelOld = -1;
|
||||
|
||||
std::unique_ptr<weld::TreeIter> xEntry = mxTreeView->make_iterator();
|
||||
|
||||
if( mpMainSequence )
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xLastSelectedEntry;
|
||||
@@ -744,7 +739,7 @@ void CustomAnimationList::update()
|
||||
if (xLastVisibleEntry)
|
||||
nLastVis = weld::GetAbsPos(*mxTreeView, *xLastVisibleEntry);
|
||||
|
||||
if (mxTreeView->get_cursor(xEntry.get()))
|
||||
if (std::unique_ptr<weld::TreeIter> xEntry = mxTreeView->get_cursor())
|
||||
{
|
||||
CustomAnimationListEntryItem* pEntry = weld::fromId<CustomAnimationListEntryItem*>(mxTreeView->get_id(*xEntry));
|
||||
aCurrent = pEntry->getEffect();
|
||||
@@ -798,6 +793,7 @@ void CustomAnimationList::update()
|
||||
std::vector<std::unique_ptr<weld::TreeIter>> aNewSelection;
|
||||
|
||||
// restore selection state, expand state, and current-entry (under cursor)
|
||||
std::unique_ptr<weld::TreeIter> xEntry = mxTreeView->make_iterator();
|
||||
if (mxTreeView->get_iter_first(*xEntry))
|
||||
{
|
||||
do
|
||||
|
||||
@@ -362,8 +362,8 @@ IMPL_LINK(SdPageObjsTLV, KeyInputHdl, const KeyEvent&, rKEvt, bool)
|
||||
}
|
||||
if (rKeyCode.GetCode() == KEY_RETURN)
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xCursor(m_xTreeView->make_iterator());
|
||||
if (m_xTreeView->get_cursor(xCursor.get()) && m_xTreeView->iter_has_child(*xCursor))
|
||||
std::unique_ptr<weld::TreeIter> xCursor = m_xTreeView->get_cursor();
|
||||
if (xCursor && m_xTreeView->iter_has_child(*xCursor))
|
||||
{
|
||||
if (m_xTreeView->get_row_expanded(*xCursor))
|
||||
m_xTreeView->collapse_row(*xCursor);
|
||||
@@ -476,11 +476,10 @@ bool SdPageObjsTLV::DoDrag()
|
||||
m_xDropTargetHelper->SetDrawView(pViewShell->GetDrawView());
|
||||
m_xDropTargetHelper->SetOrderFrontToBack(m_bOrderFrontToBack);
|
||||
|
||||
std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->make_iterator();
|
||||
bool bUserData = m_xTreeView->get_cursor(xEntry.get());
|
||||
std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->get_cursor();
|
||||
|
||||
SdrObject* pObject = nullptr;
|
||||
sal_Int64 nUserData = bUserData ? m_xTreeView->get_id(*xEntry).toInt64() : 0;
|
||||
sal_Int64 nUserData = xEntry ? m_xTreeView->get_id(*xEntry).toInt64() : 0;
|
||||
if (nUserData != 1)
|
||||
pObject = reinterpret_cast<SdrObject*>(nUserData);
|
||||
if (pObject != nullptr)
|
||||
@@ -906,8 +905,8 @@ void SdPageObjsTLV::Select()
|
||||
{
|
||||
// Only for page/slide entry and only if page/slide entry dragging is re-enabled.
|
||||
// Commit 1b031eb1ba6c529ce67ff8f471afee414d64a098 disabled page/slide entry dragging.
|
||||
std::unique_ptr<weld::TreeIter> xIter(m_xTreeView->make_iterator());
|
||||
if (m_xTreeView->get_cursor(xIter.get()) && m_xTreeView->get_iter_depth(*xIter) == 0
|
||||
std::unique_ptr<weld::TreeIter> xIter = m_xTreeView->get_cursor();
|
||||
if (xIter && m_xTreeView->get_iter_depth(*xIter) == 0
|
||||
&& m_pDoc->GetSdPageCount(PageKind::Standard) == 1)
|
||||
{
|
||||
// Can not move away the last slide in a document.
|
||||
|
||||
@@ -293,16 +293,14 @@ public:
|
||||
|
||||
OUString get_cursor_text() const
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xIter(m_xTreeView->make_iterator());
|
||||
if (m_xTreeView->get_cursor(xIter.get()))
|
||||
if (std::unique_ptr<weld::TreeIter> xIter = m_xTreeView->get_cursor())
|
||||
return m_xTreeView->get_text(*xIter);
|
||||
return OUString();
|
||||
}
|
||||
|
||||
OUString get_cursor_id() const
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xIter(m_xTreeView->make_iterator());
|
||||
if (m_xTreeView->get_cursor(xIter.get()))
|
||||
if (std::unique_ptr<weld::TreeIter> xIter = m_xTreeView->get_cursor())
|
||||
return m_xTreeView->get_id(*xIter);
|
||||
return OUString();
|
||||
}
|
||||
|
||||
@@ -378,8 +378,9 @@ IMPL_LINK(SfxCharmapContainer, ItemViewFocusInHdl, weld::Widget&, rWidget, void)
|
||||
{
|
||||
weld::IconView& rIconView = dynamic_cast<weld::IconView&>(rWidget);
|
||||
std::unique_ptr<weld::TreeIter> pIter = rIconView.make_iterator();
|
||||
if (rIconView.get_cursor(pIter.get()))
|
||||
rIconView.select(*pIter);
|
||||
std::unique_ptr<weld::TreeIter> pCursor = rIconView.get_cursor();
|
||||
if (pCursor)
|
||||
rIconView.select(*pCursor);
|
||||
else if (rIconView.get_iter_first(*pIter))
|
||||
rIconView.select(*pIter);
|
||||
else
|
||||
|
||||
@@ -1829,8 +1829,8 @@ IMPL_LINK(StyleList, CustomRenderHdl, weld::TreeView::render_args, aPayload, voi
|
||||
// Selection of a template during the Watercan-Status
|
||||
IMPL_LINK(StyleList, FmtSelectHdl, weld::TreeView&, rListBox, void)
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xHdlEntry = rListBox.make_iterator();
|
||||
if (!rListBox.get_cursor(xHdlEntry.get()))
|
||||
std::unique_ptr<weld::TreeIter> xHdlEntry = rListBox.get_cursor();
|
||||
if (!xHdlEntry)
|
||||
return;
|
||||
|
||||
m_pParentDialog->SelectStyle(rListBox.get_text(*xHdlEntry), true, *this);
|
||||
|
||||
@@ -1453,9 +1453,10 @@ IMPL_LINK(FmFilterNavigator, PopupMenuHdl, const CommandEvent&, rEvt, bool)
|
||||
{
|
||||
// the place where it was clicked
|
||||
Point aWhere;
|
||||
std::unique_ptr<weld::TreeIter> xClicked(m_xTreeView->make_iterator());
|
||||
std::unique_ptr<weld::TreeIter> xClicked;
|
||||
if (rEvt.IsMouseEvent())
|
||||
{
|
||||
xClicked = m_xTreeView->make_iterator();
|
||||
aWhere = rEvt.GetMousePosPixel();
|
||||
if (!m_xTreeView->get_dest_row_at_pos(aWhere, xClicked.get(), false))
|
||||
break;
|
||||
@@ -1469,7 +1470,8 @@ IMPL_LINK(FmFilterNavigator, PopupMenuHdl, const CommandEvent&, rEvt, bool)
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!m_xTreeView->get_cursor(xClicked.get()))
|
||||
xClicked = m_xTreeView->get_cursor();
|
||||
if (!xClicked)
|
||||
break;
|
||||
aWhere = m_xTreeView->get_row_area(*xClicked).Center();
|
||||
}
|
||||
|
||||
@@ -227,8 +227,7 @@ namespace svxform
|
||||
|
||||
bool NavigatorTree::implAllowExchange( sal_Int8 _nAction, bool* _pHasNonHidden )
|
||||
{
|
||||
bool bCurEntry = m_xTreeView->get_cursor(nullptr);
|
||||
if (!bCurEntry)
|
||||
if (!m_xTreeView->get_cursor())
|
||||
return false;
|
||||
|
||||
// Information for AcceptDrop and Execute Drop
|
||||
@@ -262,7 +261,7 @@ namespace svxform
|
||||
return false;
|
||||
|
||||
m_aControlExchange.prepareDrag();
|
||||
m_aControlExchange->setFocusEntry(m_xTreeView->get_cursor(nullptr));
|
||||
m_aControlExchange->setFocusEntry(bool(m_xTreeView->get_cursor()));
|
||||
|
||||
for (const auto& rpEntry : m_arrCurrentSelection)
|
||||
m_aControlExchange->addSelectedEntry(m_xTreeView->make_iterator(rpEntry.get()));
|
||||
@@ -330,8 +329,8 @@ namespace svxform
|
||||
if (m_arrCurrentSelection.empty()) // only happens with context menu via keyboard
|
||||
break;
|
||||
|
||||
std::unique_ptr<weld::TreeIter> xCurrent(m_xTreeView->make_iterator());
|
||||
if (!m_xTreeView->get_cursor(xCurrent.get()))
|
||||
std::unique_ptr<weld::TreeIter> xCurrent = m_xTreeView->get_cursor();
|
||||
if (!xCurrent)
|
||||
break;
|
||||
ptWhere = m_xTreeView->get_row_area(*xCurrent).Center();
|
||||
}
|
||||
|
||||
@@ -428,8 +428,8 @@ IMPL_LINK(QuickFindPanel, SearchFindsListRender, weld::TreeView::render_args, aP
|
||||
|
||||
IMPL_LINK_NOARG(QuickFindPanel, SearchFindsListSelectionChangedHandler, weld::TreeView&, void)
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xEntry(m_xSearchFindsList->make_iterator());
|
||||
if (!m_xSearchFindsList->get_cursor(xEntry.get()))
|
||||
std::unique_ptr<weld::TreeIter> xEntry = m_xSearchFindsList->get_cursor();
|
||||
if (!xEntry)
|
||||
return;
|
||||
|
||||
OUString sId = m_xSearchFindsList->get_id(*xEntry);
|
||||
@@ -478,8 +478,8 @@ IMPL_LINK_NOARG(QuickFindPanel, SearchFindsListSelectionChangedHandler, weld::Tr
|
||||
|
||||
IMPL_LINK_NOARG(QuickFindPanel, SearchFindsListRowActivatedHandler, weld::TreeView&, bool)
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xEntry(m_xSearchFindsList->make_iterator());
|
||||
if (!m_xSearchFindsList->get_cursor(xEntry.get()))
|
||||
std::unique_ptr<weld::TreeIter> xEntry = m_xSearchFindsList->get_cursor();
|
||||
if (!xEntry)
|
||||
return false;
|
||||
|
||||
// check for page number entry
|
||||
|
||||
@@ -3194,9 +3194,8 @@ IMPL_LINK_NOARG(SwContentTree, ContentDoubleClickHdl, weld::TreeView&, bool)
|
||||
|
||||
bool bConsumed = false;
|
||||
|
||||
std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
|
||||
if (m_xTreeView->get_cursor(xEntry.get()) && lcl_IsContent(*xEntry, *m_xTreeView) &&
|
||||
(State::HIDDEN != m_eState))
|
||||
std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->get_cursor();
|
||||
if (xEntry && lcl_IsContent(*xEntry, *m_xTreeView) && (State::HIDDEN != m_eState))
|
||||
{
|
||||
SwContent* pCnt = weld::fromId<SwContent*>(m_xTreeView->get_id(*xEntry));
|
||||
assert(pCnt && "no UserData");
|
||||
@@ -3214,11 +3213,10 @@ IMPL_LINK_NOARG(SwContentTree, AsyncContentDoubleClickHdl, void*, void)
|
||||
{
|
||||
m_nRowActivateEventId = nullptr;
|
||||
|
||||
std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
|
||||
bool bEntry = m_xTreeView->get_cursor(xEntry.get());
|
||||
std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->get_cursor();
|
||||
// Is it a content type?
|
||||
OSL_ENSURE(bEntry, "no current entry!");
|
||||
if (bEntry)
|
||||
OSL_ENSURE(xEntry, "no current entry!");
|
||||
if (xEntry)
|
||||
{
|
||||
if (lcl_IsContentType(*xEntry, *m_xTreeView) && !m_xTreeView->iter_has_child(*xEntry))
|
||||
{
|
||||
@@ -3540,9 +3538,8 @@ bool SwContentTree::FillTransferData(TransferDataContainer& rTransfer)
|
||||
SwWrtShell* pWrtShell = GetWrtShell();
|
||||
OSL_ENSURE(pWrtShell, "no Shell!");
|
||||
|
||||
std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
|
||||
bool bEntry = m_xTreeView->get_cursor(xEntry.get());
|
||||
if (!bEntry || lcl_IsContentType(*xEntry, *m_xTreeView) || !pWrtShell)
|
||||
std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->get_cursor();
|
||||
if (!xEntry || lcl_IsContentType(*xEntry, *m_xTreeView) || !pWrtShell)
|
||||
return false;
|
||||
assert(dynamic_cast<SwContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*xEntry))));
|
||||
SwContent* pCnt = weld::fromId<SwContent*>(m_xTreeView->get_id(*xEntry));
|
||||
@@ -3746,9 +3743,8 @@ void SwContentTree::ToggleToRoot()
|
||||
{
|
||||
if(!m_bIsRoot)
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
|
||||
bool bEntry = m_xTreeView->get_cursor(xEntry.get());
|
||||
if (bEntry)
|
||||
std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->get_cursor();
|
||||
if (xEntry)
|
||||
{
|
||||
const SwContentType* pCntType;
|
||||
if (lcl_IsContentType(*xEntry, *m_xTreeView))
|
||||
@@ -4197,8 +4193,7 @@ void SwContentTree::Notify(SfxBroadcaster & rBC, SfxHint const& rHint)
|
||||
{
|
||||
m_bIsLastReadOnly = bReadOnly;
|
||||
|
||||
std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
|
||||
if (m_xTreeView->get_cursor(xEntry.get()))
|
||||
if (std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->get_cursor())
|
||||
{
|
||||
m_xTreeView->select(*xEntry);
|
||||
UpdateContentFunctionsToolbar();
|
||||
@@ -5647,8 +5642,7 @@ IMPL_LINK(SwContentTree, KeyInputHdl, const KeyEvent&, rEvent, bool)
|
||||
//multi-selection.
|
||||
else if (aCode.GetCode() == KEY_SPACE && 0 == aCode.GetModifier())
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
|
||||
if (m_xTreeView->get_cursor(xEntry.get()))
|
||||
if (std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->get_cursor())
|
||||
{
|
||||
if (State::HIDDEN != m_eState)
|
||||
{
|
||||
@@ -5734,8 +5728,7 @@ IMPL_LINK(SwContentTree, KeyInputHdl, const KeyEvent&, rEvent, bool)
|
||||
}
|
||||
else
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> xEntry(m_xTreeView->make_iterator());
|
||||
if (m_xTreeView->get_cursor(xEntry.get()))
|
||||
if (std::unique_ptr<weld::TreeIter> xEntry = m_xTreeView->get_cursor())
|
||||
{
|
||||
SwContent* pCnt = dynamic_cast<SwContent*>(weld::fromId<SwTypeNumber*>(m_xTreeView->get_id(*xEntry)));
|
||||
if (pCnt && pCnt->GetParent()->GetType() == ContentTypeId::OUTLINE)
|
||||
|
||||
@@ -62,7 +62,7 @@ public:
|
||||
|
||||
virtual std::unique_ptr<weld::TreeIter> get_selected() const override;
|
||||
|
||||
virtual bool get_cursor(weld::TreeIter* pIter) const override;
|
||||
virtual std::unique_ptr<weld::TreeIter> get_cursor() const override;
|
||||
|
||||
virtual void selected_foreach(const std::function<bool(weld::TreeIter&)>& func) override;
|
||||
|
||||
|
||||
@@ -1529,7 +1529,7 @@ public:
|
||||
|
||||
virtual std::unique_ptr<weld::TreeIter> get_selected() const override;
|
||||
|
||||
virtual bool get_cursor(weld::TreeIter* pIter) const override;
|
||||
virtual std::unique_ptr<weld::TreeIter> get_cursor() const override;
|
||||
|
||||
virtual int n_children() const override;
|
||||
|
||||
|
||||
@@ -132,20 +132,18 @@ std::unique_ptr<weld::TreeIter> QtInstanceItemView::get_selected() const
|
||||
return pSelectedItem;
|
||||
}
|
||||
|
||||
bool QtInstanceItemView::get_cursor(weld::TreeIter* pIter) const
|
||||
std::unique_ptr<weld::TreeIter> QtInstanceItemView::get_cursor() const
|
||||
{
|
||||
SolarMutexGuard g;
|
||||
|
||||
bool bRet = false;
|
||||
std::unique_ptr<weld::TreeIter> pCursor;
|
||||
GetQtInstance().RunInMainThread([&] {
|
||||
const QModelIndex aCurrentIndex = getItemView().currentIndex();
|
||||
QtInstanceTreeIter* pQtIter = static_cast<QtInstanceTreeIter*>(pIter);
|
||||
if (pQtIter)
|
||||
pQtIter->setModelIndex(aCurrentIndex);
|
||||
bRet = aCurrentIndex.isValid();
|
||||
if (aCurrentIndex.isValid())
|
||||
pCursor = std::make_unique<QtInstanceTreeIter>(aCurrentIndex);
|
||||
});
|
||||
|
||||
return bRet;
|
||||
return pCursor;
|
||||
}
|
||||
|
||||
void QtInstanceItemView::selected_foreach(const std::function<bool(weld::TreeIter&)>& func)
|
||||
|
||||
@@ -3602,13 +3602,13 @@ std::unique_ptr<weld::TreeIter> SalInstanceItemView::get_selected() const
|
||||
return {};
|
||||
}
|
||||
|
||||
bool SalInstanceItemView::get_cursor(weld::TreeIter* pIter) const
|
||||
std::unique_ptr<weld::TreeIter> SalInstanceItemView::get_cursor() const
|
||||
{
|
||||
SvTreeListEntry* pEntry = m_pTreeListBox->GetCurEntry();
|
||||
auto pVclIter = static_cast<SalInstanceTreeIter*>(pIter);
|
||||
if (pVclIter)
|
||||
pVclIter->iter = pEntry;
|
||||
return pEntry != nullptr;
|
||||
if (pEntry)
|
||||
return std::make_unique<SalInstanceTreeIter>(pEntry);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
void SalInstanceItemView::do_select_all()
|
||||
|
||||
@@ -27,8 +27,7 @@ void ItemView::set_id(int pos, const OUString& rId)
|
||||
|
||||
int ItemView::get_cursor_index() const
|
||||
{
|
||||
std::unique_ptr<weld::TreeIter> pIter = make_iterator();
|
||||
if (get_cursor(pIter.get()))
|
||||
if (std::unique_ptr<weld::TreeIter> pIter = get_cursor())
|
||||
return get_iter_index_in_parent(*pIter);
|
||||
|
||||
return -1;
|
||||
|
||||
+31
-27
@@ -14013,11 +14013,13 @@ private:
|
||||
{
|
||||
if (signal_row_activated())
|
||||
return;
|
||||
GtkInstanceTreeIter aIter(nullptr);
|
||||
if (!get_cursor(&aIter))
|
||||
std::unique_ptr<weld::TreeIter> pIter = get_cursor();
|
||||
if (!pIter)
|
||||
return;
|
||||
if (gtk_tree_model_iter_has_child(m_pTreeModel, &aIter.iter))
|
||||
get_row_expanded(aIter) ? collapse_row(aIter) : expand_row(aIter);
|
||||
|
||||
GtkInstanceTreeIter* pGtkIter = static_cast<GtkInstanceTreeIter*>(pIter.get());
|
||||
if (gtk_tree_model_iter_has_child(m_pTreeModel, &pGtkIter->iter))
|
||||
get_row_expanded(*pIter) ? collapse_row(*pIter) : expand_row(*pIter);
|
||||
}
|
||||
|
||||
static void signalRowActivated(GtkTreeView*, GtkTreePath*, GtkTreeViewColumn*, gpointer widget)
|
||||
@@ -14413,33 +14415,34 @@ private:
|
||||
if (pEvent->keyval != GDK_KEY_Left && pEvent->keyval != GDK_KEY_Right)
|
||||
return false;
|
||||
|
||||
GtkInstanceTreeIter aIter(nullptr);
|
||||
if (!get_cursor(&aIter))
|
||||
std::unique_ptr<weld::TreeIter> pIter = get_cursor();
|
||||
if (!pIter)
|
||||
return false;
|
||||
|
||||
bool bHasChild = gtk_tree_model_iter_has_child(m_pTreeModel, &aIter.iter);
|
||||
GtkInstanceTreeIter* pGtkIter = static_cast<GtkInstanceTreeIter*>(pIter.get());
|
||||
bool bHasChild = gtk_tree_model_iter_has_child(m_pTreeModel, &pGtkIter->iter);
|
||||
|
||||
if (pEvent->keyval == GDK_KEY_Right)
|
||||
{
|
||||
if (bHasChild && !get_row_expanded(aIter))
|
||||
if (bHasChild && !get_row_expanded(*pIter))
|
||||
{
|
||||
expand_row(aIter);
|
||||
expand_row(*pIter);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (bHasChild && get_row_expanded(aIter))
|
||||
if (bHasChild && get_row_expanded(*pIter))
|
||||
{
|
||||
collapse_row(aIter);
|
||||
collapse_row(*pIter);
|
||||
return true;
|
||||
}
|
||||
|
||||
if (iter_parent(aIter))
|
||||
if (iter_parent(*pIter))
|
||||
{
|
||||
unselect_all();
|
||||
set_cursor(aIter);
|
||||
select(aIter);
|
||||
set_cursor(*pIter);
|
||||
select(*pIter);
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -15551,19 +15554,17 @@ public:
|
||||
return {};
|
||||
}
|
||||
|
||||
virtual bool get_cursor(weld::TreeIter* pIter) const override
|
||||
virtual std::unique_ptr<weld::TreeIter> get_cursor() const override
|
||||
{
|
||||
GtkInstanceTreeIter* pGtkIter = static_cast<GtkInstanceTreeIter*>(pIter);
|
||||
GtkTreeIter iter;
|
||||
GtkTreePath* path;
|
||||
gtk_tree_view_get_cursor(m_pTreeView, &path, nullptr);
|
||||
if (pGtkIter && path)
|
||||
{
|
||||
gtk_tree_model_get_iter(m_pTreeModel, &pGtkIter->iter, path);
|
||||
}
|
||||
if (path)
|
||||
gtk_tree_model_get_iter(m_pTreeModel, &iter, path);
|
||||
if (!path)
|
||||
return false;
|
||||
return {};
|
||||
gtk_tree_path_free(path);
|
||||
return true;
|
||||
return std::make_unique<GtkInstanceTreeIter>(iter);
|
||||
}
|
||||
|
||||
virtual void do_set_cursor(const weld::TreeIter& rIter) override
|
||||
@@ -16917,17 +16918,20 @@ public:
|
||||
return {};
|
||||
}
|
||||
|
||||
virtual bool get_cursor(weld::TreeIter* pIter) const override
|
||||
virtual std::unique_ptr<weld::TreeIter> get_cursor() const override
|
||||
{
|
||||
GtkInstanceTreeIter* pGtkIter = static_cast<GtkInstanceTreeIter*>(pIter);
|
||||
GtkTreeIter iter;
|
||||
GtkTreePath* path;
|
||||
gtk_icon_view_get_cursor(m_pIconView, &path, nullptr);
|
||||
if (pGtkIter && path)
|
||||
if (path)
|
||||
{
|
||||
GtkTreeModel *pModel = GTK_TREE_MODEL(m_pTreeStore);
|
||||
gtk_tree_model_get_iter(pModel, &pGtkIter->iter, path);
|
||||
gtk_tree_model_get_iter(pModel, &iter, path);
|
||||
}
|
||||
return path != nullptr;
|
||||
if (path)
|
||||
return std::make_unique<GtkInstanceTreeIter>(iter);
|
||||
|
||||
return {};
|
||||
}
|
||||
|
||||
virtual void do_set_cursor(const weld::TreeIter& rIter) override
|
||||
|
||||
Reference in New Issue
Block a user