Kaydet (Commit) a977098f authored tarafından Caolán McNamara's avatar Caolán McNamara

map GtkTreeView to SvTreeViewBox now it is in vcl

Change-Id: I8ab8421354a296cb6382f28fd3bd40372e0665df
Reviewed-on: https://gerrit.libreoffice.org/62908
Tested-by: Jenkins
Reviewed-by: 's avatarCaolán McNamara <caolanm@redhat.com>
Tested-by: 's avatarCaolán McNamara <caolanm@redhat.com>
üst 6311f7ff
......@@ -29,10 +29,11 @@ class Test(UITestCase):
self.ui_test.execute_dialog_through_command(".uno:PasteSpecial")
pasteSpecial = self.xUITest.getTopFocusWindow()
formats = pasteSpecial.getChild("list")
entryCount = int(get_state_as_dict(formats)["EntryCount"])
entryCount = int(get_state_as_dict(formats)["Children"])
items = []
for index in range(entryCount):
formats.executeAction("SELECT", mkPropertyValues({"POS": str(index)}))
entry = formats.getChild(str(index))
entry.executeAction("SELECT", tuple())
items.append(get_state_as_dict(formats)["SelectEntryText"])
# Make sure there is no RTF vs Richtext duplication.
......
......@@ -43,6 +43,7 @@ class PopupMenu;
class SalInstanceBuilder;
class ScreenshotTest;
class ScrollBar;
class SvTreeListBox;
class Slider;
class DateField;
class TimeField;
......@@ -220,6 +221,7 @@ private:
const ListStore* get_model_by_name(const OString& sID) const;
void mungeModel(ListBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId);
void mungeModel(ComboBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId);
void mungeModel(SvTreeListBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId);
typedef stringmap TextBuffer;
const TextBuffer* get_buffer_by_name(const OString& sID) const;
......
......@@ -69,12 +69,10 @@ class ImplListBoxFloatingWindow;
class ImplBtn;
class ImplWin;
class ImplListBoxWindow;
class SalInstanceEntryTreeView;
class VCL_DLLPUBLIC ListBox : public Control
{
private:
friend SalInstanceEntryTreeView;
VclPtr<ImplListBox> mpImplLB;
VclPtr<ImplListBoxFloatingWindow> mpFloatWin;
VclPtr<ImplWin> mpImplWin;
......@@ -178,8 +176,6 @@ public:
void* GetEntryData( sal_Int32 nPos ) const;
void* GetSelectedEntryData() const { return GetEntryData(GetSelectedEntryPos()); }
void SetEntryTextColor(sal_Int32 nPos, const Color* pTextColor);
/** this methods stores a combination of flags from the
ListBoxEntryFlags::* defines at the given entry.
See description of the possible ListBoxEntryFlags::* flags
......
......@@ -192,6 +192,7 @@ namespace o3tl
struct SvTreeListBoxImpl;
class SalInstanceTreeView;
class SalInstanceEntryTreeView;
class VCL_DLLPUBLIC SvTreeListBox
:public Control
......@@ -205,6 +206,7 @@ class VCL_DLLPUBLIC SvTreeListBox
friend class IconViewImpl;
friend class TreeControlPeer;
friend class SalInstanceTreeView;
friend class SalInstanceEntryTreeView;
std::unique_ptr<SvTreeListBoxImpl> mpImpl;
Link<SvTreeListBox*,void> aCheckButtonHdl;
......
......@@ -63,6 +63,7 @@ class VCL_DLLPUBLIC SvTreeListEntry
void* pUserData;
SvTLEntryFlags nEntryFlags;
Color maBackColor;
std::unique_ptr<Color> mxTextColor;
private:
void ClearChildren();
......@@ -108,8 +109,12 @@ public:
SvTLEntryFlags GetFlags() const { return nEntryFlags;}
void SetFlags( SvTLEntryFlags nFlags );
void SetBackColor( const Color& aColor ) { maBackColor = aColor; }
void SetBackColor( const Color& rColor ) { maBackColor = rColor; }
const Color& GetBackColor() const { return maBackColor; }
void SetTextColor( const Color* pColor ) { mxTextColor.reset(pColor ? new Color(*pColor) : nullptr); }
const Color* GetTextColor() const { return mxTextColor.get(); }
SvTreeListEntry* GetParent() const { return pParent; }
SvTreeListEntry* NextSibling() const;
......
......@@ -25,9 +25,8 @@ class tdf116737(UITestCase):
xDialog = self.xUITest.getTopFocusWindow()
formatlbinstable = xDialog.getChild("formatlbinstable")
props = {"TEXT": "Simple List Shaded"}
actionProps = mkPropertyValues(props)
formatlbinstable.executeAction("SELECT", actionProps)
entry = formatlbinstable.getChild("11") #Simple List Shaded
entry.executeAction("SELECT", tuple())
xOkBtn = xDialog.getChild("ok")
self.ui_test.close_dialog_through_button(xOkBtn)
......
......@@ -51,7 +51,7 @@ class ManualCalcTests(UITestCase):
xListBox = xSelectNameDlg.getChild("treeview")
xListBoxState = get_state_as_dict(xListBox)
self.assertEqual(xListBoxState["SelectEntryCount"], "1")
self.assertEqual(xListBoxState["SelectionCount"], "1")
self.assertEqual(xListBoxState["SelectEntryText"], "my_database")
xOkBtn = xSelectNameDlg.getChild("ok")
......
......@@ -48,7 +48,6 @@ struct ImplEntryType
{
OUString const maStr;
SalLayoutGlyphs maStrGlyphs;
std::unique_ptr<Color> mxTextColor;
Image const maImage;
void* mpUserData;
bool mbIsSelected;
......@@ -135,9 +134,6 @@ public:
void SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags );
ListBoxEntryFlags GetEntryFlags( sal_Int32 nPos ) const;
void SetEntryTextColor(sal_Int32 nPos, const Color* pColor);
const Color* GetEntryTextColor(sal_Int32 nPos) const;
void SelectEntry( sal_Int32 nPos, bool bSelect );
sal_Int32 GetSelectedEntryCount() const;
......@@ -428,8 +424,6 @@ public:
void SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags );
void SetEntryTextColor(sal_Int32 nPos, const Color* pTextColor) { maLBWindow->GetEntryList()->SetEntryTextColor(nPos, pTextColor); }
void SelectEntry( sal_Int32 nPos, bool bSelect );
void SetNoSelection();
void ResetCurrentPos() { maLBWindow->ResetCurrentPos(); }
......
......@@ -43,8 +43,11 @@
#include <vcl/prgsbar.hxx>
#include <vcl/slider.hxx>
#include <vcl/sysdata.hxx>
#include <vcl/svlbitm.hxx>
#include <vcl/tabctrl.hxx>
#include <vcl/tabpage.hxx>
#include <vcl/treelistbox.hxx>
#include <vcl/treelistentry.hxx>
#include <vcl/toolkit/unowrap.hxx>
#include <vcl/weld.hxx>
#include <bitmaps.hlst>
......@@ -1749,13 +1752,13 @@ IMPL_LINK(SalInstanceEntry, CursorListener, VclWindowEvent&, rEvent, void)
class SalInstanceTreeView : public SalInstanceContainer, public virtual weld::TreeView
{
private:
VclPtr<ListBox> m_xTreeView;
VclPtr<SvTreeListBox> m_xTreeView;
DECL_LINK(SelectHdl, ListBox&, void);
DECL_LINK(DoubleClickHdl, ListBox&, void);
DECL_LINK(SelectHdl, SvTreeListBox*, void);
DECL_LINK(DoubleClickHdl, SvTreeListBox*, bool);
public:
SalInstanceTreeView(ListBox* pTreeView, bool bTakeOwnership)
SalInstanceTreeView(SvTreeListBox* pTreeView, bool bTakeOwnership)
: SalInstanceContainer(pTreeView, bTakeOwnership)
, m_xTreeView(pTreeView)
{
......@@ -1766,52 +1769,61 @@ public:
virtual void insert(int pos, const OUString& rStr, const OUString* pId, const OUString* pIconName, VirtualDevice* pImageSurface) override
{
auto nInsertPos = pos == -1 ? COMBOBOX_APPEND : pos;
sal_Int32 nInsertedAt;
void* pUserData = pId ? new OUString(*pId) : nullptr;
if (!pIconName && !pImageSurface)
nInsertedAt = m_xTreeView->InsertEntry(rStr, nInsertPos);
else if (pIconName)
nInsertedAt = m_xTreeView->InsertEntry(rStr, createImage(*pIconName), nInsertPos);
m_xTreeView->InsertEntry(rStr, nullptr, false, nInsertPos, pUserData);
else
nInsertedAt = m_xTreeView->InsertEntry(rStr, createImage(*pImageSurface), nInsertPos);
if (pId)
m_xTreeView->SetEntryData(nInsertedAt, new OUString(*pId));
{
SvTreeListEntry* pEntry = new SvTreeListEntry;
Image aImage(pIconName ? createImage(*pIconName) : createImage(*pImageSurface));
pEntry->AddItem(o3tl::make_unique<SvLBoxContextBmp>(aImage, aImage, false));
pEntry->AddItem(o3tl::make_unique<SvLBoxString>(rStr));
pEntry->SetUserData(pUserData);
m_xTreeView->Insert(pEntry, nInsertPos);
}
}
virtual void set_font_color(int pos, const Color& rColor) const override
{
m_xTreeView->SetEntryTextColor(pos, &rColor);
SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
pEntry->SetTextColor(&rColor);
}
virtual void remove(int pos) override
{
m_xTreeView->RemoveEntry(pos);
SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
m_xTreeView->RemoveEntry(pEntry);
}
virtual int find_text(const OUString& rText) const override
{
sal_Int32 nRet = m_xTreeView->GetEntryPos(rText);
if (nRet == LISTBOX_ENTRY_NOTFOUND)
return -1;
return nRet;
for (SvTreeListEntry* pEntry = m_xTreeView->First(); pEntry; pEntry = m_xTreeView->Next(pEntry))
{
if (m_xTreeView->GetEntryText(pEntry) == rText)
return m_xTreeView->GetAbsPos(pEntry);
}
return -1;
}
virtual int find_id(const OUString& rId) const override
{
sal_Int32 nCount = m_xTreeView->GetEntryCount();
for (sal_Int32 nPos = 0; nPos < nCount; ++nPos)
for (SvTreeListEntry* pEntry = m_xTreeView->First(); pEntry; pEntry = m_xTreeView->Next(pEntry))
{
OUString* pId = static_cast<OUString*>(m_xTreeView->GetEntryData(nPos));
const OUString* pId = static_cast<const OUString*>(pEntry->GetUserData());
if (!pId)
continue;
if (rId == *pId)
return nPos;
return m_xTreeView->GetAbsPos(pEntry);
}
return -1;
}
virtual void set_top_entry(int pos) override
{
m_xTreeView->SetTopEntry(pos);
SvTreeList* pModel = m_xTreeView->GetModel();
SvTreeListEntry* pEntry = pModel->GetEntry(nullptr, pos);
pModel->Move(pEntry, nullptr, 0);
}
virtual void clear() override
......@@ -1827,44 +1839,52 @@ public:
virtual void select(int pos) override
{
assert(m_xTreeView->IsUpdateMode() && "don't select when frozen");
disable_notify_events();
if (pos == -1)
m_xTreeView->SetNoSelection();
m_xTreeView->SelectAll(false);
else
m_xTreeView->SelectEntryPos(pos);
{
SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
m_xTreeView->Select(pEntry, true);
}
enable_notify_events();
}
virtual void unselect(int pos) override
{
assert(m_xTreeView->IsUpdateMode() && "don't select when frozen");
disable_notify_events();
if (pos == -1)
m_xTreeView->SelectAll(true);
else
{
for (sal_Int32 i = 0; i < m_xTreeView->GetEntryCount(); ++i)
m_xTreeView->SelectEntryPos(i);
SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
m_xTreeView->Select(pEntry, false);
}
else
m_xTreeView->SelectEntryPos(pos, false);
enable_notify_events();
}
virtual std::vector<int> get_selected_rows() const override
{
std::vector<int> aRows;
sal_Int32 nCount = m_xTreeView->GetSelectedEntryCount();
aRows.reserve(nCount);
for (sal_Int32 i = 0; i < nCount; ++i)
aRows.push_back(m_xTreeView->GetSelectedEntryPos(i));
aRows.reserve(m_xTreeView->GetSelectionCount());
for (SvTreeListEntry* pEntry = m_xTreeView->FirstSelected(); pEntry; pEntry = m_xTreeView->NextSelected(pEntry))
aRows.push_back(m_xTreeView->GetAbsPos(pEntry));
return aRows;
}
virtual OUString get_text(int pos) const override
{
return m_xTreeView->GetEntry(pos);
SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, pos);
return m_xTreeView->GetEntryText(pEntry);
}
const OUString* getEntryData(int index) const
{
return static_cast<const OUString*>(m_xTreeView->GetEntryData(index));
SvTreeListEntry* pEntry = m_xTreeView->GetEntry(nullptr, index);
return static_cast<const OUString*>(pEntry->GetUserData());
}
virtual OUString get_id(int pos) const override
......@@ -1877,25 +1897,25 @@ public:
virtual int get_selected_index() const override
{
const sal_Int32 nRet = m_xTreeView->GetSelectedEntryPos();
if (nRet == LISTBOX_ENTRY_NOTFOUND)
SvTreeListEntry* pEntry = m_xTreeView->FirstSelected();
if (!pEntry)
return -1;
return nRet;
return m_xTreeView->GetAbsPos(pEntry);
}
virtual void set_selection_mode(bool bMultiple) override
{
m_xTreeView->EnableMultiSelection(bMultiple);
m_xTreeView->SetSelectionMode(bMultiple ? SelectionMode::Multiple : SelectionMode::Single);
}
virtual int count_selected_rows() const override
{
return m_xTreeView->GetSelectedEntryCount();
return m_xTreeView->GetSelectionCount();
}
virtual int get_height_rows(int nRows) const override
{
return m_xTreeView->CalcWindowSizePixel(nRows);
return m_xTreeView->GetEntryHeight() * nRows;
}
virtual void make_sorted() override
......@@ -1903,30 +1923,31 @@ public:
m_xTreeView->SetStyle(m_xTreeView->GetStyle() | WB_SORT);
}
ListBox& getTreeView()
SvTreeListBox& getTreeView()
{
return *m_xTreeView;
}
virtual ~SalInstanceTreeView() override
{
m_xTreeView->SetDoubleClickHdl(Link<ListBox&, void>());
m_xTreeView->SetSelectHdl(Link<ListBox&, void>());
m_xTreeView->SetDoubleClickHdl(Link<SvTreeListBox*, bool>());
m_xTreeView->SetSelectHdl(Link<SvTreeListBox*, void>());
}
};
IMPL_LINK_NOARG(SalInstanceTreeView, SelectHdl, ListBox&, void)
IMPL_LINK_NOARG(SalInstanceTreeView, SelectHdl, SvTreeListBox*, void)
{
if (notify_events_disabled())
return;
signal_changed();
}
IMPL_LINK_NOARG(SalInstanceTreeView, DoubleClickHdl, ListBox&, void)
IMPL_LINK_NOARG(SalInstanceTreeView, DoubleClickHdl, SvTreeListBox*, bool)
{
if (notify_events_disabled())
return;
return false;
signal_row_activated();
return false;
}
class SalInstanceSpinButton : public SalInstanceEntry, public virtual weld::SpinButton
......@@ -2710,9 +2731,11 @@ IMPL_LINK(SalInstanceEntryTreeView, KeyPressListener, VclWindowEvent&, rEvent, v
if (nKeyCode == KEY_UP || nKeyCode == KEY_DOWN || nKeyCode == KEY_PAGEUP || nKeyCode == KEY_PAGEDOWN)
{
m_pTreeView->disable_notify_events();
ListBox& rListBox = m_pTreeView->getTreeView();
NotifyEvent aNotifyEvt(MouseNotifyEvent::KEYINPUT, reinterpret_cast<vcl::Window*>(rListBox.mpImplWin.get()), &rKeyEvent);
rListBox.PreNotify(aNotifyEvt);
auto& rListBox = m_pTreeView->getTreeView();
if (!rListBox.FirstSelected())
rListBox.Select(rListBox.First(), true);
else
rListBox.KeyInput(rKeyEvent);
m_xEntry->set_text(m_xTreeView->get_selected_text());
m_xEntry->select_region(0, -1);
m_pTreeView->enable_notify_events();
......@@ -2927,7 +2950,7 @@ public:
virtual std::unique_ptr<weld::TreeView> weld_tree_view(const OString &id, bool bTakeOwnership) override
{
ListBox* pTreeView = m_xBuilder->get<ListBox>(id);
SvTreeListBox* pTreeView = m_xBuilder->get<SvTreeListBox>(id);
return pTreeView ? o3tl::make_unique<SalInstanceTreeView>(pTreeView, bTakeOwnership) : nullptr;
}
......
......@@ -370,19 +370,6 @@ void* ImplEntryList::GetEntryData( sal_Int32 nPos ) const
return pImplEntry ? pImplEntry->mpUserData : nullptr;
}
void ImplEntryList::SetEntryTextColor(sal_Int32 nPos, const Color* pColor)
{
ImplEntryType* pImplEntry = GetEntry(nPos);
if (pImplEntry)
pImplEntry->mxTextColor.reset(pColor ? new Color(*pColor) : nullptr);
}
const Color* ImplEntryList::GetEntryTextColor(sal_Int32 nPos) const
{
ImplEntryType* pImplEntry = GetEntry(nPos);
return pImplEntry ? pImplEntry->mxTextColor.get() : nullptr;
}
void ImplEntryList::SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags )
{
ImplEntryType* pImplEntry = GetEntry( nPos );
......@@ -1743,8 +1730,6 @@ void ImplListBoxWindow::ImplPaint(vcl::RenderContext& rRenderContext, sal_Int32
ApplySettings(rRenderContext);
if (!IsEnabled())
rRenderContext.SetTextColor(rStyleSettings.GetDisableColor());
else if (const Color* pTextColor = mpEntryList->GetEntryTextColor(nPos))
rRenderContext.SetTextColor(*pTextColor);
}
rRenderContext.SetTextFillColor();
......
......@@ -1090,11 +1090,6 @@ void* ListBox::GetEntryData( sal_Int32 nPos ) const
return mpImplLB->GetEntryList()->GetEntryData( nPos + mpImplLB->GetEntryList()->GetMRUCount() );
}
void ListBox::SetEntryTextColor(sal_Int32 nPos, const Color* pTextColor)
{
mpImplLB->SetEntryTextColor(nPos + mpImplLB->GetEntryList()->GetMRUCount(), pTextColor);
}
void ListBox::SetEntryFlags( sal_Int32 nPos, ListBoxEntryFlags nFlags )
{
mpImplLB->SetEntryFlags( nPos + mpImplLB->GetEntryList()->GetMRUCount(), nFlags );
......
......@@ -2745,10 +2745,13 @@ void SvTreeListBox::PaintEntry1(SvTreeListEntry& rEntry, long nLine, vcl::Render
{
aWallpaper.SetColor(rSettings.GetFieldColor());
}
else if (bCurFontIsSel)
else if (bCurFontIsSel || rEntry.GetTextColor())
{
bCurFontIsSel = false;
rRenderContext.SetTextColor(aBackupTextColor);
if (const auto* pCustomTextColor = rEntry.GetTextColor())
rRenderContext.SetTextColor(*pCustomTextColor);
else
rRenderContext.SetTextColor(aBackupTextColor);
rRenderContext.SetFont(aBackupFont);
}
else
......@@ -2825,7 +2828,7 @@ void SvTreeListBox::PaintEntry1(SvTreeListEntry& rEntry, long nLine, vcl::Render
nCurTab++;
}
if (bCurFontIsSel)
if (bCurFontIsSel || rEntry.GetTextColor())
{
rRenderContext.SetTextColor(aBackupTextColor);
rRenderContext.SetFont(aBackupFont);
......
......@@ -35,6 +35,9 @@ StringMap TreeListUIObject::get_state()
aMap["Children"] = OUString::number(mxTreeList->GetChildCount(nullptr));
aMap["LevelChildren"] = OUString::number(mxTreeList->GetLevelChildCount(nullptr));
aMap["CheckBoxList"] = OUString::boolean(isCheckBoxList(mxTreeList));
SvTreeListEntry* pEntry = mxTreeList->FirstSelected();
aMap["SelectEntryText"] = pEntry ? mxTreeList->GetEntryText(pEntry) : OUString();
return aMap;
}
......
......@@ -39,6 +39,8 @@
#include <vcl/tabpage.hxx>
#include <vcl/throbber.hxx>
#include <vcl/toolbox.hxx>
#include <vcl/treelistbox.hxx>
#include <vcl/treelistentry.hxx>
#include <vcl/vclmedit.hxx>
#include <vcl/settings.hxx>
#include <vcl/slider.hxx>
......@@ -491,13 +493,16 @@ VclBuilder::VclBuilder(vcl::Window *pParent, const OUString& sUIDir, const OUStr
vcl::Window* pTarget = get<vcl::Window>(elem.m_sID);
ListBox *pListBoxTarget = dynamic_cast<ListBox*>(pTarget);
ComboBox *pComboBoxTarget = dynamic_cast<ComboBox*>(pTarget);
SvTreeListBox *pTreeBoxTarget = dynamic_cast<SvTreeListBox*>(pTarget);
// pStore may be empty
const ListStore *pStore = get_model_by_name(elem.m_sValue.toUtf8());
SAL_WARN_IF(!pListBoxTarget && !pComboBoxTarget, "vcl", "missing elements of combobox");
SAL_WARN_IF(!pListBoxTarget && !pComboBoxTarget && !pTreeBoxTarget, "vcl", "missing elements of combobox");
if (pListBoxTarget && pStore)
mungeModel(*pListBoxTarget, *pStore, elem.m_nActiveId);
else if (pComboBoxTarget && pStore)
mungeModel(*pComboBoxTarget, *pStore, elem.m_nActiveId);
else if (pTreeBoxTarget && pStore)
mungeModel(*pTreeBoxTarget, *pStore, elem.m_nActiveId);
}
//Set TextView buffers when everything has been imported
......@@ -1809,10 +1814,10 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
else if (name == "GtkTreeView")
{
//To-Do
//a) make SvTreeViewBox the default target for GtkTreeView
//a) make SvTreeListBox the default target for GtkTreeView
//b) remove the non-drop down mode of ListBox and convert
// everything over to SvTreeViewBox
//c) remove the users of makeSvTreeViewBox
// everything over to SvTreeListBox
//c) remove the users of makeSvTreeListBox
extractModel(id, rMap);
WinBits nWinStyle = WB_CLIPCHILDREN|WB_LEFT|WB_VCENTER|WB_3DLOOK|WB_SIMPLEMODE;
if (m_bLegacy)
......@@ -1821,11 +1826,18 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window *pParent, const OString &
if (!sBorder.isEmpty())
nWinStyle |= WB_BORDER;
}
//ListBox manages its own scrolling,
//ListBox/SvTreeListBox manages its own scrolling,
vcl::Window *pRealParent = prepareWidgetOwnScrolling(pParent, nWinStyle);
if (pRealParent != pParent)
nWinStyle |= WB_BORDER;
xWindow = VclPtr<ListBox>::Create(pRealParent, nWinStyle);
if (m_bLegacy)
xWindow = VclPtr<ListBox>::Create(pRealParent, nWinStyle);
else
{
VclPtrInstance<SvTreeListBox> xBox(pRealParent, nWinStyle);
xBox->SetNoAutoCurEntry(true);
xWindow = xBox;
}
if (pRealParent != pParent)
cleanupWidgetOwnScrolling(pParent, xWindow, rMap);
}
......@@ -3998,6 +4010,34 @@ void VclBuilder::mungeModel(ListBox &rTarget, const ListStore &rStore, sal_uInt1
rTarget.SelectEntryPos(nActiveId);
}
void VclBuilder::mungeModel(SvTreeListBox &rTarget, const ListStore &rStore, sal_uInt16 nActiveId)
{
for (auto const& entry : rStore.m_aEntries)
{
const ListStore::row &rRow = entry;
auto pEntry = rTarget.InsertEntry(rRow[0]);
if (rRow.size() > 1)
{
if (m_bLegacy)
{
sal_IntPtr nValue = rRow[1].toInt32();
pEntry->SetUserData(reinterpret_cast<void*>(nValue));
}
else
{
if (!rRow[1].isEmpty())
pEntry->SetUserData(new OUString(rRow[1]));
}
}
}
if (nActiveId < rStore.m_aEntries.size())
{
SvTreeListEntry* pEntry = rTarget.GetEntry(nullptr, nActiveId);
rTarget.Select(pEntry);
}
}
void VclBuilder::mungeAdjustment(NumericFormatter &rTarget, const Adjustment &rAdjustment)
{
int nMul = rtl_math_pow10Exp(1, rTarget.GetDecimalDigits());
......
......@@ -5620,10 +5620,18 @@ private:
gboolean ret;
m_pTreeView->disable_notify_events();
GtkWidget* pWidget = m_pTreeView->getWidget();
gtk_widget_grab_focus(pWidget);
g_signal_emit_by_name(pWidget, "key-press-event", pEvent, &ret);
m_xEntry->set_text(m_xTreeView->get_selected_text());
gtk_widget_grab_focus(m_pEntry->getWidget());
if (m_pTreeView->get_selected_index() == -1)
{
m_pTreeView->select(0);
m_xEntry->set_text(m_xTreeView->get_selected_text());
}
else
{
gtk_widget_grab_focus(pWidget);
g_signal_emit_by_name(pWidget, "key-press-event", pEvent, &ret);
m_xEntry->set_text(m_xTreeView->get_selected_text());
gtk_widget_grab_focus(m_pEntry->getWidget());
}
m_xEntry->select_region(0, -1);
m_pTreeView->enable_notify_events();
m_pEntry->fire_signal_changed();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment