summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCaolán McNamara <caolan.mcnamara@collabora.com>2024-11-24 14:16:46 +0000
committerCaolán McNamara <caolan.mcnamara@collabora.com>2024-11-24 17:25:26 +0100
commitd3c2fcc3f33f09d655904abdfbad62c1db005288 (patch)
tree3d759318a75b42a1554979ddc08d48710005a419
parentc568149596fe58adcba00641368f5da7c64b3590 (diff)
Resolves: tdf#163772 move margin into ValueSet itself
instead of using margin property in .ui where size_request doesn't take such margins into account, while pref_size does. Change-Id: I7c557fd63c438515814ad32b9627895c27c13b81 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177213 Tested-by: Jenkins Reviewed-by: Caolán McNamara <caolan.mcnamara@collabora.com>
-rw-r--r--cui/source/customize/cfg.cxx1
-rw-r--r--cui/uiconfig/ui/iconselectordialog.ui4
-rw-r--r--include/svtools/valueset.hxx2
-rw-r--r--svtools/source/control/valueset.cxx24
4 files changed, 27 insertions, 4 deletions
diff --git a/cui/source/customize/cfg.cxx b/cui/source/customize/cfg.cxx
index 9b79a931163f..3aaa07d6bb15 100644
--- a/cui/source/customize/cfg.cxx
+++ b/cui/source/customize/cfg.cxx
@@ -2739,6 +2739,7 @@ SvxIconSelectorDialog::SvxIconSelectorDialog(weld::Window *pWindow,
m_xTbSymbol->SetItemWidth(m_nExpectedSize);
m_xTbSymbol->SetItemHeight(m_nExpectedSize);
m_xTbSymbol->SetExtraSpacing(6);
+ m_xTbSymbol->SetMargin(4);
Size aSize(m_xTbSymbol->CalcWindowSizePixel(Size(m_nExpectedSize, m_nExpectedSize), 11, 5));
m_xTbSymbol->set_size_request(aSize.Width(), aSize.Height());
diff --git a/cui/uiconfig/ui/iconselectordialog.ui b/cui/uiconfig/ui/iconselectordialog.ui
index 9ee6ee8847cb..1d07337f1cbb 100644
--- a/cui/uiconfig/ui/iconselectordialog.ui
+++ b/cui/uiconfig/ui/iconselectordialog.ui
@@ -119,10 +119,6 @@
<property name="visible">True</property>
<property name="can_focus">True</property>
<property name="events">GDK_BUTTON_MOTION_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK | GDK_STRUCTURE_MASK</property>
- <property name="margin-start">3</property>
- <property name="margin-end">3</property>
- <property name="margin_top">3</property>
- <property name="margin_bottom">3</property>
<property name="hexpand">True</property>
<property name="vexpand">True</property>
</object>
diff --git a/include/svtools/valueset.hxx b/include/svtools/valueset.hxx
index 03dea4c03749..2244dfc805af 100644
--- a/include/svtools/valueset.hxx
+++ b/include/svtools/valueset.hxx
@@ -209,6 +209,7 @@ private:
sal_uInt16 mnUserVisLines;
sal_uInt16 mnFirstLine;
sal_uInt16 mnSpacing;
+ sal_uInt16 mnMargin;
DrawFrameStyle mnFrameStyle;
Color maColor;
OUString maText;
@@ -369,6 +370,7 @@ public:
}
void SetExtraSpacing( sal_uInt16 nNewSpacing );
+ void SetMargin( sal_uInt16 nNewMargin );
void Format(vcl::RenderContext const & rRenderContext);
void SetFormat();
diff --git a/svtools/source/control/valueset.cxx b/svtools/source/control/valueset.cxx
index 03666c97688b..5a056751b105 100644
--- a/svtools/source/control/valueset.cxx
+++ b/svtools/source/control/valueset.cxx
@@ -96,6 +96,7 @@ ValueSet::ValueSet(std::unique_ptr<weld::ScrolledWindow> pScrolledWindow)
mnUserCols = 0;
mnUserVisLines = 0;
mnSpacing = 0;
+ mnMargin = 0;
mnFrameStyle = DrawFrameStyle::NONE;
mbNoSelection = true;
mbDoubleSel = false;
@@ -861,6 +862,12 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext)
else
nOff = 0;
+ if ( mnMargin )
+ {
+ aWinSize.AdjustWidth(-mnMargin * 2);
+ aWinSize.AdjustHeight(-mnMargin * 2);
+ }
+
// consider size, if NameField does exist
if (nStyle & WB_NAMEFIELD)
{
@@ -876,6 +883,8 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext)
else
mnTextOffset = 0;
+ mnTextOffset += mnMargin;
+
// consider offset and size, if NoneField does exist
if (nStyle & WB_NONEFIELD)
{
@@ -1038,6 +1047,9 @@ void ValueSet::Format(vcl::RenderContext const & rRenderContext)
nStartY = 0;
}
+ nStartX += mnMargin;
+ nStartY += mnMargin;
+
// calculate and draw items
maVirDev->SetLineColor();
tools::Long x = nStartX;
@@ -1648,6 +1660,12 @@ Size ValueSet::CalcWindowSizePixel( const Size& rItemSize, sal_uInt16 nDesireCol
aSize.AdjustHeight(nTxtHeight + n + mnSpacing );
}
+ if ( mnMargin )
+ {
+ aSize.AdjustWidth(mnMargin * 2);
+ aSize.AdjustHeight(mnMargin * 2);
+ }
+
return aSize;
}
@@ -1820,6 +1838,12 @@ void ValueSet::SetExtraSpacing( sal_uInt16 nNewSpacing )
}
}
+void ValueSet::SetMargin( sal_uInt16 nNewMargin )
+{
+ mnMargin = nNewMargin;
+ QueueReformat();
+}
+
void ValueSet::SetFormat()
{
mbFormat = true;