Rebased ref, commits from common ancestor:
commit c839f073934eeadccf4bb598119c9dacebb48cc0
Author: Parth Raiyani <[email protected]>
AuthorDate: Wed Feb 4 19:03:06 2026 +0530
Commit: Andras Timar <[email protected]>
CommitDate: Mon Feb 23 20:11:46 2026 +0100
fix: update color palette handling by removing color name param in
insertions
Change-Id: I9c08a3d5b1ef744dc356d2a347c65dc61b6a329d
diff --git a/cui/source/tabpages/tpcolor.cxx b/cui/source/tabpages/tpcolor.cxx
index 1da93474a9d4..b62fab8afff8 100644
--- a/cui/source/tabpages/tpcolor.cxx
+++ b/cui/source/tabpages/tpcolor.cxx
@@ -374,7 +374,7 @@ IMPL_LINK_NOARG(SvxColorTabPage, ClickAddHdl_Impl,
weld::Button&, void)
sal_Int32 nId = !sLastColorItemId.isEmpty() ?
sLastColorItemId.toInt32() : -1;
auto pVDev =
SvxColorIconView::createColorVirtualDevice(m_aCurrentColor.m_aColor);
OUString sId = OUString::number(nId + 1);
- m_xIconViewColorList->insert( nId + 1, &aName, &sId, pVDev, nullptr);
+ m_xIconViewColorList->insert( nId + 1, nullptr, &sId, pVDev, nullptr);
m_xIconViewColorList->select( nId + 1 );
if (m_xIconViewRecentList)
m_xIconViewRecentList->unselect_all(); // needed if color is added
from recent colors
diff --git a/svx/source/tbxctrls/Palette.cxx b/svx/source/tbxctrls/Palette.cxx
index 1f080581de75..aa78db04216e 100644
--- a/svx/source/tbxctrls/Palette.cxx
+++ b/svx/source/tbxctrls/Palette.cxx
@@ -60,9 +60,8 @@ void PaletteASE::LoadColorSet(weld::IconView& pIconView)
for (const auto& rColor : maColors)
{
SvxColorIconView::drawColor(*pVDev, rColor.m_aColor);
- OUString sColorName = rColor.m_aName;
OUString sId = OUString::number(nIx);
- pIconView.insert(nIx, &sColorName, &sId, pVDev.get(), nullptr);
+ pIconView.insert(nIx, nullptr, &sId, pVDev.get(), nullptr);
++nIx;
}
}
@@ -343,9 +342,8 @@ void PaletteGPL::LoadColorSet(weld::IconView& pIconView)
for (const auto& rColor : maColors)
{
SvxColorIconView::drawColor(*pVDev, rColor.m_aColor);
- OUString sColorName = rColor.m_aName;
OUString sId = OUString::number(nIx);
- pIconView.insert(nIx, &sColorName, &sId, pVDev.get(), nullptr);
+ pIconView.insert(nIx, &sColorName, &sId, pColorVDev, nullptr);
++nIx;
}
}
diff --git a/svx/source/tbxctrls/PaletteManager.cxx
b/svx/source/tbxctrls/PaletteManager.cxx
index 1da6f0731817..2c903b225a88 100644
--- a/svx/source/tbxctrls/PaletteManager.cxx
+++ b/svx/source/tbxctrls/PaletteManager.cxx
@@ -269,15 +269,13 @@ void PaletteManager::ReloadColorSet(weld::IconView
&pIconView)
{
pIconView.clear();
css::uno::Sequence< sal_Int32 > CustomColorList(
officecfg::Office::Common::UserColors::CustomColor::get() );
- css::uno::Sequence< OUString > CustomColorNameList(
officecfg::Office::Common::UserColors::CustomColorName::get() );
ScopedVclPtr<VirtualDevice> pVDev =
SvxColorIconView::createColorDevice();
for (int i = 0; i < CustomColorList.getLength(); ++i)
{
Color aColor(ColorTransparency, CustomColorList[i]);
SvxColorIconView::drawColor(*pVDev, aColor);
OUString sId = OUString::number(i);
- OUString sColorName = CustomColorNameList[i];
- pIconView.insert(i, &sColorName, &sId, pVDev.get(), nullptr);
+ pIconView.insert(i, nullptr, &sId, pVDev.get(), nullptr);
}
}
else if (IsThemePaletteSelected())
@@ -305,9 +303,8 @@ void PaletteManager::ReloadColorSet(weld::IconView
&pIconView)
{
auto const& rEffect = rColorData.maEffects[nEffect];
SvxColorIconView::drawColor(*pVDev, rEffect.maColor);
- OUString sColorName = rEffect.maColorName;
OUString sId = OUString::number(nItemId);
- pIconView.insert(nItemId, &sColorName, &sId, pVDev.get(),
nullptr);
+ pIconView.insert(nItemId, nullptr, &sId, pVDev.get(),
nullptr);
nItemId++;
}
}
@@ -348,7 +345,7 @@ void PaletteManager::ReloadRecentColorSet(weld::IconView&
pIconView)
OUString sColorName = bHasColorNames ? ColorNamelist[i] : ("#" +
aColor.AsRGBHexString().toAsciiUpperCase());
maRecentColors.emplace_back(aColor, sColorName);
OUString sId = OUString::number(nIx);
- pIconView.insert(nIx, &sColorName, &sId, pVDev.get(), nullptr);
+ pIconView.insert(nIx, nullptr, &sId, pVDev.get(), nullptr);
++nIx;
}
}
diff --git a/svx/source/tbxctrls/SvxColorIconView.cxx
b/svx/source/tbxctrls/SvxColorIconView.cxx
index 43018ff9b084..85ab8c2726e9 100644
--- a/svx/source/tbxctrls/SvxColorIconView.cxx
+++ b/svx/source/tbxctrls/SvxColorIconView.cxx
@@ -50,9 +50,8 @@ void
SvxColorIconView::addEntriesForXColorList(weld::IconView& pIconView,
if (pEntry)
{
drawColor(*pVDev, pEntry->GetColor());
- OUString sColorName = pEntry->GetName();
OUString sId = OUString::number(nIndex);
- pIconView.insert(nIndex, &sColorName, &sId, pVDev.get(), nullptr);
+ pIconView.insert(nIndex, nullptr, &sId, pVDev.get(), nullptr);
}
else
{
@@ -73,9 +72,8 @@ void SvxColorIconView::addEntriesForColorSet(weld::IconView&
pIconView,
for (const auto& rColor : rColorSet)
{
drawColor(*pVDev, rColor);
- OUString sName = OUString::Concat(rNamePrefix) +
OUString::number(nStartIndex);
OUString sId = OUString::number(nStartIndex);
- pIconView.insert(nStartIndex, &sName, &sId, pVDev.get(), nullptr);
+ pIconView.insert(nStartIndex, nullptr, &sId, pVDev.get(), nullptr);
nStartIndex++;
}
}
@@ -85,8 +83,7 @@ void SvxColorIconView::addEntriesForColorSet(weld::IconView&
pIconView,
{
drawColor(*pVDev, rColor);
OUString sId = OUString::number(nStartIndex);
- OUString sName = u""_ustr;
- pIconView.insert(nStartIndex, &sName, &sId, pVDev.get(), nullptr);
+ pIconView.insert(nStartIndex, nullptr, &sId, pVDev.get(), nullptr);
nStartIndex++;
}
}
commit d9293d7fc33019744d3bc0ce3283532571ddb01d
Author: Michael Weghorn <[email protected]>
AuthorDate: Thu Aug 7 13:54:47 2025 +0200
Commit: Andras Timar <[email protected]>
CommitDate: Mon Feb 23 20:11:46 2026 +0100
tdf#167658 Reduce icon view size in "Borders" page to what's needed
Set the alignment properties for the IconViews in
ther "Borders" tab page used e.g. in Writer's
"Format" -> "Page Style" dialog to not take more space
than needed.
This prevents the vcl implementation (used e.g. with the
gen or qt6 vcl plugins) from taking more space than what
is needed to display their items, now that the corresponding
size is calculated with previous commit
Change-Id: I95e13d748c4c178b7492665bbc9e1a5980c7ef81
Author: Michael Weghorn <[email protected]>
Date: Thu Aug 7 09:45:15 2025 +0200
tdf#167658 vcl: Honor GtkIconView::columns + calc size
in place.
Change-Id: I03942fcfb086536a65e5b28c0abbe70375e29bcf
diff --git a/cui/uiconfig/ui/borderpage.ui b/cui/uiconfig/ui/borderpage.ui
index a6dce6bfe55e..83bc448cbb1a 100644
--- a/cui/uiconfig/ui/borderpage.ui
+++ b/cui/uiconfig/ui/borderpage.ui
@@ -139,6 +139,8 @@
<object class="GtkIconView" id="presets">
<property name="visible">True</property>
<property name="can-focus">True</property>
+ <property name="halign">start</property>
+ <property name="valign">start</property>
<property name="model">presets_liststore</property>
<property name="pixbuf-column">0</property>
<property name="columns">5</property>
@@ -547,6 +549,8 @@
<object class="GtkIconView" id="shadows">
<property name="visible">True</property>
<property name="can-focus">True</property>
+ <property name="halign">start</property>
+ <property name="valign">start</property>
<property name="model">shadows_liststore</property>
<property name="pixbuf-column">0</property>
<property name="columns">5</property>
commit 967e8d1f38e52c174ef53fdeef5b2c8919d28318
Author: Michael Weghorn <[email protected]>
AuthorDate: Thu Aug 7 09:45:15 2025 +0200
Commit: Andras Timar <[email protected]>
CommitDate: Mon Feb 23 20:11:46 2026 +0100
tdf#167658 vcl: Honor GtkIconView::columns + calc size
For SalInstanceIconView, i.e. the vcl implementation
of weld::IconView, using a vcl IconView control,
take the GtkIconView::columns [1] property into
account:
Introduce IconView::m_nFixedColumnCount as a new
member for which VclBuilder sets the value accordingly
when processing a .ui file.
Override the SvTreeListBox::GetOptimalSize base class
implementation for IconView to instead return the
size required when all icons are arranged using the
given amount of columns if one was explicitly set.
Otherwise, keep using the logic used so far.
This e.g. prevents the IconViews in Writer's "Format"
-> "Page Style" dialog, tab "Borders" from occupying a
lot of unused vertical space (as the "columns" property
is already set for those in the UI file,
cui/uiconfig/ui/borderpage.ui) and thus addresses
that aspect mentioned in previous commit
Change-Id: I6d8d8d5ac38d7ebb62c0d9963ec2125d417a3a49
Author: Michael Weghorn <[email protected]>
Date: Thu Aug 7 10:17:57 2025 +0200
tdf#167658 Update vcl IconView entry size when inserting item
When inserting a new entry into a SalInstanceIconView,
using SalInstanceIconView::insert, let the IconView
control recalculate an appropriate entry size, as
is already done when the image of an entry is updated
in SalInstanceIconView::set_image since
commit 9f2fc6fbf74cbc0643f380aa4b799e36997734aa
Date: Sat Mar 8 17:29:01 2025 +0530
tdf#165610 sd: master slide panel is broken with "show
large preview"
However, (in both cases) only do so if no custom entry
width was explicitly set using SalInstanceIconView::set_item_width.
This makes the presets in Writer's "Format" -> "Page Style" dialog,
tab "Borders" show again with the expected size and in one row
instead of one item per row.
The IconView still has a lot of unused space, which will be
addressed
in a separate commit.
Change-Id: I6d8d8d5ac38d7ebb62c0d9963ec2125d417a3a49
[1] https://docs.gtk.org/gtk3/property.IconView.columns.html
Change-Id: I95e13d748c4c178b7492665bbc9e1a5980c7ef81
diff --git a/vcl/inc/iconview.hxx b/vcl/inc/iconview.hxx
index 87c0b080eed2..ff5821cd09bd 100644
--- a/vcl/inc/iconview.hxx
+++ b/vcl/inc/iconview.hxx
@@ -26,11 +26,16 @@
class IconView final : public SvTreeListBox
{
+private:
+ short m_nFixedColumnCount = -1;
+
public:
IconView(vcl::Window* pParent, WinBits nBits);
Size GetEntrySize(const SvTreeListEntry&) const;
+ void SetFixedColumnCount(short nColumnCount);
+ virtual Size GetOptimalSize() const override;
virtual void Resize() override;
virtual tools::Rectangle GetFocusRect(const SvTreeListEntry*, tools::Long)
override;
@@ -70,6 +75,8 @@ private:
Link<SvTreeListEntry*, OUString> maEntryAccessibleDescriptionHdl;
Link<const encoded_image_query&, bool> maDumpImageHdl;
void DumpEntryAndSiblings(tools::JsonWriter& rJsonWriter, SvTreeListEntry*
pEntry);
+
+ bool HasSeparatorEntry() const;
};
#endif
diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx
index 5fc79797d477..b96dcb57a325 100644
--- a/vcl/source/treelist/iconview.cxx
+++ b/vcl/source/treelist/iconview.cxx
@@ -54,6 +54,12 @@ Size IconView::GetEntrySize(const SvTreeListEntry& entry)
const
return { GetEntryWidth(), GetEntryHeight() };
}
+void IconView::SetFixedColumnCount(short nColumnCount)
+{
+ m_nFixedColumnCount = nColumnCount;
+ nColumns = nColumnCount;
+}
+
void IconView::UpdateEntrySize(const Image& pImage)
{
int spacing = nSpacing * 2;
@@ -61,6 +67,18 @@ void IconView::UpdateEntrySize(const Image& pImage)
SetEntryWidth(pImage.GetSizePixel().getWidth() + spacing);
}
+bool IconView::HasSeparatorEntry() const
+{
+ for (sal_uInt32 i = 0; i < GetEntryCount(); i++)
+ {
+ SvTreeListEntry* pEntry = GetEntry(i);
+ if (pEntry && IsSeparator(*pEntry))
+ return true;
+ }
+
+ return false;
+}
+
bool IconView::IsSeparator(const SvTreeListEntry& rEntry)
{
return bool(rEntry.GetFlags() & SvTLEntryFlags::IS_SEPARATOR);
@@ -98,11 +116,29 @@ void IconView::Resize()
if (!aBoxSize.Width())
return;
- nColumns = nEntryWidth ? aBoxSize.Width() / nEntryWidth : 1;
+ if (m_nFixedColumnCount == -1)
+ nColumns = nEntryWidth ? aBoxSize.Width() / nEntryWidth : 1;
SvTreeListBox::Resize();
}
+Size IconView::GetOptimalSize() const
+{
+ if (m_nFixedColumnCount != -1 && !HasSeparatorEntry())
+ {
+ // if a fixed amount of columns has been set and only icons (no
separators) are used,
+ // calculate size needed for those
+ const short nRowCount = std::ceil(double(GetEntryCount()) /
GetColumnsCount());
+ Size aSize(GetColumnsCount() * nEntryWidth, nRowCount * nEntryHeight);
+ if (GetStyle() & WB_VSCROLL)
+
aSize.AdjustWidth(GetSettings().GetStyleSettings().GetScrollBarSize());
+
+ return aSize;
+ }
+
+ return SvTreeListBox::GetOptimalSize();
+}
+
tools::Rectangle IconView::GetFocusRect(const SvTreeListEntry* pEntry,
tools::Long)
{
return { GetEntryPosition(pEntry), GetEntrySize(*pEntry) };
diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx
index 2f74659aeffc..03eb35e453fb 100644
--- a/vcl/source/window/builder.cxx
+++ b/vcl/source/window/builder.cxx
@@ -1825,6 +1825,10 @@ VclPtr<vcl::Window> VclBuilder::makeObject(vcl::Window
*pParent, const OUString
if (pRealParent != pParent)
cleanupWidgetOwnScrolling(pParent, xWindowForPackingProps, rMap);
+
+ auto aColumnsIt = rMap.find(u"columns"_ustr);
+ if (aColumnsIt != rMap.end())
+ xBox->SetFixedColumnCount(aColumnsIt->second.toInt32());
}
else if (name == "GtkTreeView")
{
commit 4b4eabfcaf113e31fee856110f0952c78bd371fc
Author: Michael Weghorn <[email protected]>
AuthorDate: Thu Aug 7 11:16:42 2025 +0200
Commit: Andras Timar <[email protected]>
CommitDate: Mon Feb 23 20:11:46 2026 +0100
vcl: Use existing IconView::IsSeparator helper
Change-Id: I084cedb6e8d70460d31fc492f0d14ab7f04beff6
diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx
index 90955c50f050..5fc79797d477 100644
--- a/vcl/source/treelist/iconview.cxx
+++ b/vcl/source/treelist/iconview.cxx
@@ -49,7 +49,7 @@ IconView::IconView(vcl::Window* pParent, WinBits nBits)
Size IconView::GetEntrySize(const SvTreeListEntry& entry) const
{
- if (entry.GetFlags() & SvTLEntryFlags::IS_SEPARATOR)
+ if (IsSeparator(entry))
return { GetEntryWidth() * GetColumnsCount(), separatorHeight };
return { GetEntryWidth(), GetEntryHeight() };
}
@@ -344,7 +344,7 @@ void IconView::DumpEntryAndSiblings(tools::JsonWriter&
rJsonWriter, SvTreeListEn
if (IsSelected(pEntry))
rJsonWriter.put("selected", true);
- if (pEntry->GetFlags() & SvTLEntryFlags::IS_SEPARATOR)
+ if (IsSeparator(*pEntry))
rJsonWriter.put("separator", true);
rJsonWriter.put("row", GetModel()->GetAbsPos(pEntry));
commit e303a68bb9a726a276e5270cf40e78adff2d72a3
Author: Michael Weghorn <[email protected]>
AuthorDate: Thu Aug 7 11:11:44 2025 +0200
Commit: Andras Timar <[email protected]>
CommitDate: Mon Feb 23 20:11:46 2026 +0100
vcl: Make IsSeparator a static IconView method
This prepares for reusing the existing logic.
Change-Id: If8885adc80a240853f5529ac908eb5513994d0b8
diff --git a/vcl/inc/iconview.hxx b/vcl/inc/iconview.hxx
index c6b67df852ef..87c0b080eed2 100644
--- a/vcl/inc/iconview.hxx
+++ b/vcl/inc/iconview.hxx
@@ -61,6 +61,8 @@ public:
/// Update entry size based on image size
void UpdateEntrySize(const Image& pImage);
+ static bool IsSeparator(const SvTreeListEntry& rEntry);
+
protected:
virtual void CalcEntryHeight(SvTreeListEntry const* pEntry) override;
diff --git a/vcl/source/treelist/iconview.cxx b/vcl/source/treelist/iconview.cxx
index b7881f9f8f34..90955c50f050 100644
--- a/vcl/source/treelist/iconview.cxx
+++ b/vcl/source/treelist/iconview.cxx
@@ -61,6 +61,11 @@ void IconView::UpdateEntrySize(const Image& pImage)
SetEntryWidth(pImage.GetSizePixel().getWidth() + spacing);
}
+bool IconView::IsSeparator(const SvTreeListEntry& rEntry)
+{
+ return bool(rEntry.GetFlags() & SvTLEntryFlags::IS_SEPARATOR);
+}
+
void IconView::CalcEntryHeight(SvTreeListEntry const* pEntry)
{
int nHeight = nSpacing * 2;
diff --git a/vcl/source/treelist/iconviewimpl.cxx
b/vcl/source/treelist/iconviewimpl.cxx
index ca8e21211b49..5a384faa282b 100644
--- a/vcl/source/treelist/iconviewimpl.cxx
+++ b/vcl/source/treelist/iconviewimpl.cxx
@@ -28,11 +28,6 @@ IconViewImpl::IconViewImpl( SvTreeListBox* pTreeListBox,
SvTreeList* pTreeList,
{
}
-static bool IsSeparator(const SvTreeListEntry& rEntry)
-{
- return bool(rEntry.GetFlags() & SvTLEntryFlags::IS_SEPARATOR);
-}
-
Size IconViewImpl::GetEntrySize(const SvTreeListEntry& entry) const
{
return static_cast<const IconView*>(m_pView.get())->GetEntrySize(entry);
@@ -48,7 +43,7 @@ void IconViewImpl::IterateVisibleEntryAreas(const
IterateEntriesFunc& f, bool fr
entry = m_pView->NextVisible(entry))
{
const Size s = GetEntrySize(*entry);
- if (x >= rowWidth || IsSeparator(*entry))
+ if (x >= rowWidth || IconView::IsSeparator(*entry))
{
column = 0;
x = 0;
@@ -69,7 +64,7 @@ tools::Long IconViewImpl::GetEntryRow(const SvTreeListEntry*
entry) const
tools::Long nEntryRow = -1;
auto GetRow = [entry, &nEntryRow, row = -1](const EntryAreaInfo& info)
mutable
{
- if (info.column == 0 && !IsSeparator(info.entry))
+ if (info.column == 0 && !IconView::IsSeparator(info.entry))
++row;
if (&info.entry != entry)
return CallbackResult::Continue;
@@ -86,7 +81,7 @@ void IconViewImpl::SetStartEntry(SvTreeListEntry* entry)
tools::Long row = -1;
auto GetEntryAndRow = [&entry, &row, max, found = entry](const
EntryAreaInfo& info) mutable
{
- if (info.column == 0 && !IsSeparator(info.entry))
+ if (info.column == 0 && !IconView::IsSeparator(info.entry))
{
found = &info.entry;
++row;
@@ -125,7 +120,7 @@ SvTreeListEntry* IconViewImpl::GoToPrevRow(SvTreeListEntry*
pEntry, int nRows) c
auto FindPrev = [this, pEntry, nRows, &pPrev,
prevs = std::vector<SvTreeListEntry*>()](const
EntryAreaInfo& info) mutable
{
- if (info.column == 0 && !IsSeparator(info.entry))
+ if (info.column == 0 && !IconView::IsSeparator(info.entry))
prevs.push_back(&info.entry);
if (pEntry == &info.entry)
{
@@ -136,7 +131,7 @@ SvTreeListEntry* IconViewImpl::GoToPrevRow(SvTreeListEntry*
pEntry, int nRows) c
for (short column = info.column; column; --column)
{
SvTreeListEntry* pNext = m_pView->NextVisible(pPrev);
- if (!pNext || IsSeparator(*pNext))
+ if (!pNext || IconView::IsSeparator(*pNext))
break;
pPrev = pNext;
}
@@ -155,7 +150,7 @@ SvTreeListEntry* IconViewImpl::GoToNextRow(SvTreeListEntry*
pEntry, int nRows) c
SvTreeListEntry* pNext = pEntry;
auto FindNext = [pEntry, nRows, &pNext, column = -1](const EntryAreaInfo&
info) mutable
{
- if (info.column <= column && !IsSeparator(info.entry))
+ if (info.column <= column && !IconView::IsSeparator(info.entry))
{
if (info.column == 0 && --nRows < 0)
return CallbackResult::Stop;
@@ -375,7 +370,7 @@ void IconViewImpl::AdjustScrollBars( Size& rSize )
auto CountRowsAndHeight = [&nTotalRows, &totalHeight](const EntryAreaInfo&
info)
{
totalHeight = std::max(totalHeight, info.area.Bottom());
- if (info.column == 0 && !IsSeparator(info.entry))
+ if (info.column == 0 && !IconView::IsSeparator(info.entry))
++nTotalRows;
return CallbackResult::Continue;
};
commit d839461149cb05ff01e282d084626778cc9a5db4
Author: Michael Weghorn <[email protected]>
AuthorDate: Thu Aug 7 11:07:07 2025 +0200
Commit: Andras Timar <[email protected]>
CommitDate: Mon Feb 23 20:11:46 2026 +0100
vcl: Pass IsSeparator param by reference
That allows dropping the null check and also
prepares for reusing the existing helper function
elsewhere.
Change-Id: I056ad8f81dec68dff33a9817365e5166af41ee8c
diff --git a/vcl/source/treelist/iconviewimpl.cxx
b/vcl/source/treelist/iconviewimpl.cxx
index 894016e1106d..ca8e21211b49 100644
--- a/vcl/source/treelist/iconviewimpl.cxx
+++ b/vcl/source/treelist/iconviewimpl.cxx
@@ -28,9 +28,9 @@ IconViewImpl::IconViewImpl( SvTreeListBox* pTreeListBox,
SvTreeList* pTreeList,
{
}
-static bool IsSeparator(const SvTreeListEntry* entry)
+static bool IsSeparator(const SvTreeListEntry& rEntry)
{
- return entry && entry->GetFlags() & SvTLEntryFlags::IS_SEPARATOR;
+ return bool(rEntry.GetFlags() & SvTLEntryFlags::IS_SEPARATOR);
}
Size IconViewImpl::GetEntrySize(const SvTreeListEntry& entry) const
@@ -48,7 +48,7 @@ void IconViewImpl::IterateVisibleEntryAreas(const
IterateEntriesFunc& f, bool fr
entry = m_pView->NextVisible(entry))
{
const Size s = GetEntrySize(*entry);
- if (x >= rowWidth || IsSeparator(entry))
+ if (x >= rowWidth || IsSeparator(*entry))
{
column = 0;
x = 0;
@@ -69,7 +69,7 @@ tools::Long IconViewImpl::GetEntryRow(const SvTreeListEntry*
entry) const
tools::Long nEntryRow = -1;
auto GetRow = [entry, &nEntryRow, row = -1](const EntryAreaInfo& info)
mutable
{
- if (info.column == 0 && !IsSeparator(&info.entry))
+ if (info.column == 0 && !IsSeparator(info.entry))
++row;
if (&info.entry != entry)
return CallbackResult::Continue;
@@ -86,7 +86,7 @@ void IconViewImpl::SetStartEntry(SvTreeListEntry* entry)
tools::Long row = -1;
auto GetEntryAndRow = [&entry, &row, max, found = entry](const
EntryAreaInfo& info) mutable
{
- if (info.column == 0 && !IsSeparator(&info.entry))
+ if (info.column == 0 && !IsSeparator(info.entry))
{
found = &info.entry;
++row;
@@ -125,7 +125,7 @@ SvTreeListEntry* IconViewImpl::GoToPrevRow(SvTreeListEntry*
pEntry, int nRows) c
auto FindPrev = [this, pEntry, nRows, &pPrev,
prevs = std::vector<SvTreeListEntry*>()](const
EntryAreaInfo& info) mutable
{
- if (info.column == 0 && !IsSeparator(&info.entry))
+ if (info.column == 0 && !IsSeparator(info.entry))
prevs.push_back(&info.entry);
if (pEntry == &info.entry)
{
@@ -136,7 +136,7 @@ SvTreeListEntry* IconViewImpl::GoToPrevRow(SvTreeListEntry*
pEntry, int nRows) c
for (short column = info.column; column; --column)
{
SvTreeListEntry* pNext = m_pView->NextVisible(pPrev);
- if (!pNext || IsSeparator(pNext))
+ if (!pNext || IsSeparator(*pNext))
break;
pPrev = pNext;
}
@@ -155,7 +155,7 @@ SvTreeListEntry* IconViewImpl::GoToNextRow(SvTreeListEntry*
pEntry, int nRows) c
SvTreeListEntry* pNext = pEntry;
auto FindNext = [pEntry, nRows, &pNext, column = -1](const EntryAreaInfo&
info) mutable
{
- if (info.column <= column && !IsSeparator(&info.entry))
+ if (info.column <= column && !IsSeparator(info.entry))
{
if (info.column == 0 && --nRows < 0)
return CallbackResult::Stop;
@@ -375,7 +375,7 @@ void IconViewImpl::AdjustScrollBars( Size& rSize )
auto CountRowsAndHeight = [&nTotalRows, &totalHeight](const EntryAreaInfo&
info)
{
totalHeight = std::max(totalHeight, info.area.Bottom());
- if (info.column == 0 && !IsSeparator(&info.entry))
+ if (info.column == 0 && !IsSeparator(info.entry))
++nTotalRows;
return CallbackResult::Continue;
};
commit 0f53c78fa12b0d920a73ebae158949a6c091bb4c
Author: Michael Weghorn <[email protected]>
AuthorDate: Thu Aug 7 11:03:25 2025 +0200
Commit: Andras Timar <[email protected]>
CommitDate: Mon Feb 23 20:11:45 2026 +0100
vcl: Switch EntryAreaInfo::entry to ref
It's known to be non-null in IconViewImpl::IterateVisibleEntryAreas.
Change-Id: I24125e39733c9c8cddc002d7fdd624de25925377
diff --git a/vcl/source/treelist/iconviewimpl.cxx
b/vcl/source/treelist/iconviewimpl.cxx
index 5a5e1ddfff8b..894016e1106d 100644
--- a/vcl/source/treelist/iconviewimpl.cxx
+++ b/vcl/source/treelist/iconviewimpl.cxx
@@ -54,7 +54,7 @@ void IconViewImpl::IterateVisibleEntryAreas(const
IterateEntriesFunc& f, bool fr
x = 0;
y += nPrevHeight;
}
- EntryAreaInfo info{ entry, column, tools::Rectangle{ Point{ x, y }, s
} };
+ EntryAreaInfo info{ *entry, column, tools::Rectangle{ Point{ x, y }, s
} };
const auto result = f(info);
if (result == CallbackResult::Stop)
return;
@@ -69,9 +69,9 @@ tools::Long IconViewImpl::GetEntryRow(const SvTreeListEntry*
entry) const
tools::Long nEntryRow = -1;
auto GetRow = [entry, &nEntryRow, row = -1](const EntryAreaInfo& info)
mutable
{
- if (info.column == 0 && !IsSeparator(info.entry))
+ if (info.column == 0 && !IsSeparator(&info.entry))
++row;
- if (info.entry != entry)
+ if (&info.entry != entry)
return CallbackResult::Continue;
nEntryRow = row;
return CallbackResult::Stop;
@@ -86,12 +86,12 @@ void IconViewImpl::SetStartEntry(SvTreeListEntry* entry)
tools::Long row = -1;
auto GetEntryAndRow = [&entry, &row, max, found = entry](const
EntryAreaInfo& info) mutable
{
- if (info.column == 0 && !IsSeparator(info.entry))
+ if (info.column == 0 && !IsSeparator(&info.entry))
{
- found = info.entry;
+ found = &info.entry;
++row;
}
- if (row >= max || info.entry == entry)
+ if (row >= max || &info.entry == entry)
{
entry = found;
return CallbackResult::Stop;
@@ -125,9 +125,9 @@ SvTreeListEntry* IconViewImpl::GoToPrevRow(SvTreeListEntry*
pEntry, int nRows) c
auto FindPrev = [this, pEntry, nRows, &pPrev,
prevs = std::vector<SvTreeListEntry*>()](const
EntryAreaInfo& info) mutable
{
- if (info.column == 0 && !IsSeparator(info.entry))
- prevs.push_back(info.entry);
- if (pEntry == info.entry)
+ if (info.column == 0 && !IsSeparator(&info.entry))
+ prevs.push_back(&info.entry);
+ if (pEntry == &info.entry)
{
if (prevs.size() > 1)
{
@@ -153,18 +153,17 @@ SvTreeListEntry*
IconViewImpl::GoToPrevRow(SvTreeListEntry* pEntry, int nRows) c
SvTreeListEntry* IconViewImpl::GoToNextRow(SvTreeListEntry* pEntry, int nRows)
const
{
SvTreeListEntry* pNext = pEntry;
- auto FindNext
- = [pEntry, nRows, &pNext, column = -1](const EntryAreaInfo& info)
mutable
+ auto FindNext = [pEntry, nRows, &pNext, column = -1](const EntryAreaInfo&
info) mutable
{
- if (info.column <= column && !IsSeparator(info.entry))
+ if (info.column <= column && !IsSeparator(&info.entry))
{
if (info.column == 0 && --nRows < 0)
return CallbackResult::Stop;
- pNext = info.entry;
+ pNext = &info.entry;
if (info.column == column && nRows == 0)
return CallbackResult::Stop;
}
- else if (pEntry == info.entry)
+ else if (pEntry == &info.entry)
{
column = info.column;
}
@@ -293,7 +292,7 @@ Point IconViewImpl::GetEntryPosition(const SvTreeListEntry*
pEntry) const
Point result{ -m_pView->GetEntryWidth(), -m_pView->GetEntryHeight() }; //
invisible
auto FindEntryPos = [pEntry, &result](const EntryAreaInfo& info)
{
- if (pEntry == info.entry)
+ if (pEntry == &info.entry)
{
result = info.area.TopLeft();
return CallbackResult::Stop;
@@ -319,7 +318,7 @@ SvTreeListEntry* IconViewImpl::GetClickedEntry( const
Point& rPoint ) const
{
if (info.area.Contains(rPoint))
{
- pEntry = info.entry;
+ pEntry = &info.entry;
return CallbackResult::Stop;
}
else if (info.area.Top() > rPoint.Y())
@@ -328,7 +327,7 @@ SvTreeListEntry* IconViewImpl::GetClickedEntry( const
Point& rPoint ) const
}
else if (info.area.Bottom() > rPoint.Y())
{
- pEntry = info.entry; // Same row; store the entry in case the
click is past all entries
+ pEntry = &info.entry; // Same row; store the entry in case the
click is past all entries
}
return CallbackResult::Continue;
};
@@ -376,7 +375,7 @@ void IconViewImpl::AdjustScrollBars( Size& rSize )
auto CountRowsAndHeight = [&nTotalRows, &totalHeight](const EntryAreaInfo&
info)
{
totalHeight = std::max(totalHeight, info.area.Bottom());
- if (info.column == 0 && !IsSeparator(info.entry))
+ if (info.column == 0 && !IsSeparator(&info.entry))
++nTotalRows;
return CallbackResult::Continue;
};
@@ -445,7 +444,7 @@ SvTreeListEntry* IconViewImpl::GetEntry( const Point&
rPoint ) const
{
if (info.area.Contains(rPoint))
{
- pEntry = info.entry;
+ pEntry = &info.entry;
return CallbackResult::Stop;
}
else if (info.area.Top() > rPoint.Y())
@@ -517,7 +516,7 @@ void IconViewImpl::Paint(vcl::RenderContext&
rRenderContext, const tools::Rectan
{
if (!info.area.GetIntersection(rRect).IsEmpty())
{
- iconView->PaintEntry(*info.entry, info.area.Left(),
info.area.Top(), rRenderContext);
+ iconView->PaintEntry(info.entry, info.area.Left(),
info.area.Top(), rRenderContext);
}
else if (info.area.Top() > rRect.Bottom())
{
diff --git a/vcl/source/treelist/iconviewimpl.hxx
b/vcl/source/treelist/iconviewimpl.hxx
index 22a096307129..215642cac8dc 100644
--- a/vcl/source/treelist/iconviewimpl.hxx
+++ b/vcl/source/treelist/iconviewimpl.hxx
@@ -69,7 +69,7 @@ private:
};
struct EntryAreaInfo
{
- SvTreeListEntry* entry;
+ SvTreeListEntry& entry;
short column;
tools::Rectangle area; // The area for the entry
};
commit c54bfc7f7636c4f3a6bcb041d0a9e9f9fe3e990d
Author: Michael Weghorn <[email protected]>
AuthorDate: Thu Aug 7 10:48:04 2025 +0200
Commit: Andras Timar <[email protected]>
CommitDate: Mon Feb 23 20:11:45 2026 +0100
vcl: Pass IconViewImpl::ScrollTo param by ref
All callers check the pointer for being non-null, so
it's safe to dereference.
Change-Id: Ic456b009d2bc722f2b7af61b24a5a2f64101b408
diff --git a/vcl/source/treelist/iconviewimpl.cxx
b/vcl/source/treelist/iconviewimpl.cxx
index 35025d1c81f4..5a5e1ddfff8b 100644
--- a/vcl/source/treelist/iconviewimpl.cxx
+++ b/vcl/source/treelist/iconviewimpl.cxx
@@ -105,14 +105,14 @@ void IconViewImpl::SetStartEntry(SvTreeListEntry* entry)
m_pView->Invalidate(GetVisibleArea());
}
-void IconViewImpl::ScrollTo(SvTreeListEntry* entry)
+void IconViewImpl::ScrollTo(SvTreeListEntry& rEntry)
{
if (!m_aVerSBar->IsVisible())
return;
- const tools::Long entryRow = GetEntryRow(entry);
+ const tools::Long entryRow = GetEntryRow(&rEntry);
const tools::Long oldStartRow = m_aVerSBar->GetThumbPos();
if (entryRow < oldStartRow)
- IconViewImpl::SetStartEntry(entry);
+ IconViewImpl::SetStartEntry(&rEntry);
const tools::Long visibleRows = m_aVerSBar->GetVisibleSize();
const tools::Long posRelativeToBottom = entryRow - (oldStartRow +
visibleRows) + 1;
if (posRelativeToBottom > 0)
@@ -636,7 +636,7 @@ bool IconViewImpl::KeyInput( const KeyEvent& rKEvt )
{
m_aSelEng.CursorPosChanging( bShift, bMod1 );
SetCursor( pNewCursor, bMod1 ); // no selection, when Ctrl
is on
- ScrollTo(pNewCursor);
+ ScrollTo(*pNewCursor);
}
break;
}
@@ -648,7 +648,7 @@ bool IconViewImpl::KeyInput( const KeyEvent& rKEvt )
if( pNewCursor )
{
m_aSelEng.CursorPosChanging( bShift, bMod1 );
- ScrollTo(pNewCursor);
+ ScrollTo(*pNewCursor);
SetCursor(pNewCursor, bMod1); // no selection, when Ctrl is on
}
else
@@ -666,7 +666,7 @@ bool IconViewImpl::KeyInput( const KeyEvent& rKEvt )
if (pNewCursor)
{
m_aSelEng.CursorPosChanging(bShift, bMod1);
- ScrollTo(pNewCursor);
+ ScrollTo(*pNewCursor);
SetCursor(pNewCursor);
}
}
@@ -683,7 +683,7 @@ bool IconViewImpl::KeyInput( const KeyEvent& rKEvt )
if (pNewCursor)
{
m_aSelEng.CursorPosChanging(bShift, bMod1);
- ScrollTo(pNewCursor);
+ ScrollTo(*pNewCursor);
SetCursor(pNewCursor);
}
else
diff --git a/vcl/source/treelist/iconviewimpl.hxx
b/vcl/source/treelist/iconviewimpl.hxx
index d566e338bb02..22a096307129 100644
--- a/vcl/source/treelist/iconviewimpl.hxx
+++ b/vcl/source/treelist/iconviewimpl.hxx
@@ -85,7 +85,7 @@ private:
tools::Long GetEntryRow(const SvTreeListEntry* entry) const;
void SetStartEntry(SvTreeListEntry* entry);
- void ScrollTo(SvTreeListEntry* entry);
+ void ScrollTo(SvTreeListEntry& rEntry);
};
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
commit 9af4c275fc00ceab7e4217f54fb015d04a2217c1
Author: Michael Weghorn <[email protected]>
AuthorDate: Thu Aug 7 10:17:57 2025 +0200
Commit: Andras Timar <[email protected]>
CommitDate: Mon Feb 23 20:11:45 2026 +0100
tdf#167658 Update vcl IconView entry size when inserting item
When inserting a new entry into a SalInstanceIconView,
using SalInstanceIconView::insert, let the IconView
control recalculate an appropriate entry size, as
is already done when the image of an entry is updated
in SalInstanceIconView::set_image since
commit 9f2fc6fbf74cbc0643f380aa4b799e36997734aa
Date: Sat Mar 8 17:29:01 2025 +0530
tdf#165610 sd: master slide panel is broken with "show large
preview"
However, (in both cases) only do so if no custom entry
width was explicitly set using SalInstanceIconView::set_item_width.
This makes the presets in Writer's "Format" -> "Page Style" dialog,
tab "Borders" show again with the expected size and in one row
instead of one item per row.
The IconView still has a lot of unused space, which will be addressed
in a separate commit.
Change-Id: I6d8d8d5ac38d7ebb62c0d9963ec2125d417a3a49
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/189080
diff --git a/vcl/inc/salvtables.hxx b/vcl/inc/salvtables.hxx
index 850c3f85fdcb..bd751067c392 100644
--- a/vcl/inc/salvtables.hxx
+++ b/vcl/inc/salvtables.hxx
@@ -1928,6 +1928,8 @@ protected:
VclPtr<::IconView> m_xIconView;
private:
+ bool m_bFixedItemWidth = false;
+
// owner for UserData
std::vector<std::unique_ptr<OUString>> m_aUserData;
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx
index 78adf725cc76..a741b6e2ada3 100644
--- a/vcl/source/app/salvtables.cxx
+++ b/vcl/source/app/salvtables.cxx
@@ -5407,6 +5407,7 @@ int SalInstanceIconView::get_item_width() const { return
m_xIconView->GetEntryWi
void SalInstanceIconView::set_item_width(int width)
{
m_xIconView->SetEntryWidth(width);
+ m_bFixedItemWidth = true;
m_xIconView->Resize();
}
@@ -5441,20 +5442,22 @@ void SalInstanceIconView::insert(int pos, const
OUString* pStr, const OUString*
pUserData = nullptr;
SvTreeListEntry* pEntry = new SvTreeListEntry;
+ Image aImage;
if (pIconName)
{
- Image aImage(createImage(*pIconName));
+ aImage = createImage(*pIconName);
pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aImage, aImage,
false));
}
else
{
- Image aDummy;
- pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aDummy, aDummy,
false));
+ pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aImage, aImage,
false));
}
if (pStr)
pEntry->AddItem(std::make_unique<SvLBoxString>(*pStr));
pEntry->SetUserData(pUserData);
m_xIconView->Insert(pEntry, nullptr, nInsertPos);
+ if (!m_bFixedItemWidth)
+ m_xIconView->UpdateEntrySize(aImage);
if (pRet)
{
@@ -5480,22 +5483,24 @@ void SalInstanceIconView::insert(int pos, const
OUString* pStr, const OUString*
pUserData = nullptr;
SvTreeListEntry* pEntry = new SvTreeListEntry;
+ Image aImage;
if (pIcon)
{
const Point aNull(0, 0);
const Size aSize = pIcon->GetOutputSize();
- Image aImage(pIcon->GetBitmapEx(aNull, aSize));
+ aImage = Image(pIcon->GetBitmapEx(aNull, aSize));
pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aImage, aImage,
false));
}
else
{
- Image aDummy;
- pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aDummy, aDummy,
false));
+ pEntry->AddItem(std::make_unique<SvLBoxContextBmp>(aImage, aImage,
false));
}
if (pStr)
pEntry->AddItem(std::make_unique<SvLBoxString>(*pStr));
pEntry->SetUserData(pUserData);
m_xIconView->Insert(pEntry, nullptr, nInsertPos);
+ if (!m_bFixedItemWidth)
+ m_xIconView->UpdateEntrySize(aImage);
if (pRet)
{
@@ -5722,7 +5727,8 @@ void SalInstanceIconView::set_image(int pos,
VirtualDevice* pIcon)
{
aItem->SetBitmap1(aImage);
aItem->SetBitmap2(aImage);
- m_xIconView->UpdateEntrySize(aImage);
+ if (!m_bFixedItemWidth)
+ m_xIconView->UpdateEntrySize(aImage);
m_xIconView->ModelHasEntryInvalidated(aEntry);
}
}
commit 88d2ef3f3b55808d8836bfbbad5a987febdad78f
Author: Andras Timar <[email protected]>
AuthorDate: Mon Feb 23 18:47:10 2026 +0100
Commit: Andras Timar <[email protected]>
CommitDate: Mon Feb 23 20:11:45 2026 +0100
cui: fix crash in Hyperlink dialog mark tree with unexpected outline levels
The while loop in FillTree could pop all entries from the stack,
including the sentinel, if a heading had an outline level <= -1.
Subsequent top() calls on the empty stack triggered a SIGABRT.
Keep the sentinel entry by checking stack size before popping.
Change-Id: I647b0de4d39dea4cdad44cc844db4a0788ab91db
diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx
index f35be2db2aea..ebb50ac4dd89 100644
--- a/cui/source/dialogs/hlmarkwn.cxx
+++ b/cui/source/dialogs/hlmarkwn.cxx
@@ -361,8 +361,9 @@ int SvxHlinkDlgMarkWnd::FillTree( const uno::Reference<
container::XNameAccess >
sal_Int32 nOutlineLevel =
*o3tl::doAccess<sal_Int32>(aAny);
// pop until the top of stack entry has an outline
level less than
- // the to be inserted heading outline level
- while (nOutlineLevel <=
aHeadingsParentEntryStack.top().second)
+ // the to be inserted heading outline level, but keep
the sentinel
+ while (aHeadingsParentEntryStack.size() > 1
+ && nOutlineLevel <=
aHeadingsParentEntryStack.top().second)
aHeadingsParentEntryStack.pop();
mxLbTree->insert(aHeadingsParentEntryStack.top().first.get(), -1,