online.git: engine/svx

0 views
Skip to first unread message

"Tomaž Vajngerl (via cogerrit)"

unread,
May 13, 2026, 3:11:10 AM (13 days ago) May 13
to collaboraon...@googlegroups.com
engine/svx/qa/unit/table.cxx | 103 +++++++++++++++++++++++++++++++++++++++++++
1 file changed, 103 insertions(+)

New commits:
commit 40f1180ba4536c8df3d881e2eaa19b354085b00e
Author: Tomaž Vajngerl <tomaz.v...@collabora.co.uk>
AuthorDate: Sun Apr 19 20:05:22 2026 +0900
Commit: Miklos Vajna <vmi...@collabora.com>
CommitDate: Wed May 13 07:11:00 2026 +0000

Test to check the auto color in a table has been set as expected

Change-Id: If2a6668f0b6603f8ebbd40a03c3a8a7ba2f2f215
Signed-off-by: Tomaž Vajngerl <tomaz.v...@collabora.co.uk>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/2436
Tested-by: Jenkins CPCI <rel...@collaboraoffice.com>
Reviewed-by: Miklos Vajna <vmi...@collabora.com>

diff --git a/engine/svx/qa/unit/table.cxx b/engine/svx/qa/unit/table.cxx
index c0ad44243493..2ebc97e41c4f 100644
--- a/engine/svx/qa/unit/table.cxx
+++ b/engine/svx/qa/unit/table.cxx
@@ -9,8 +9,10 @@

#include <test/unoapixml_test.hxx>

+#include <com/sun/star/drawing/FillStyle.hpp>
#include <com/sun/star/drawing/XDrawPagesSupplier.hpp>
#include <com/sun/star/drawing/XDrawPage.hpp>
+#include <com/sun/star/table/XCellRange.hpp>

#include <extendedprimitive2dxmldump.hxx>
#include <rtl/ustring.hxx>
@@ -19,10 +21,14 @@
#include <svx/sdr/contact/viewobjectcontact.hxx>
#include <svx/svdpage.hxx>
#include <svx/unopage.hxx>
+#include <svx/xfillit0.hxx>
+#include <svx/xflclit.hxx>
#include <vcl/virdev.hxx>
#include <sdr/contact/objectcontactofobjlistpainter.hxx>
#include <comphelper/propertyvalue.hxx>
#include <sfx2/viewsh.hxx>
+#include <svx/svdmodel.hxx>
+#include <svx/svdoutl.hxx>
#include <svx/svdview.hxx>
#include <svx/sdr/table/tablecontroller.hxx>
#include <editeng/editobj.hxx>
@@ -42,6 +48,8 @@ public:

drawinglayer::primitive2d::Primitive2DContainer
renderPageToPrimitives(const uno::Reference<drawing::XDrawPage>& xDrawPage);
+
+ drawinglayer::primitive2d::Primitive2DContainer renderObjectToPrimitives(SdrObject* pObject);
};

drawinglayer::primitive2d::Primitive2DContainer
@@ -61,6 +69,19 @@ Test::renderPageToPrimitives(const uno::Reference<drawing::XDrawPage>& xDrawPage
return aContainer;
}

+drawinglayer::primitive2d::Primitive2DContainer Test::renderObjectToPrimitives(SdrObject* pObject)
+{
+ ScopedVclPtrInstance<VirtualDevice> aVirtualDevice;
+ sdr::contact::ObjectContactOfObjListPainter aObjectContact(*aVirtualDevice, { pObject },
+ nullptr);
+ const sdr::contact::ViewObjectContact& rVOContact
+ = pObject->GetViewContact().GetViewObjectContact(aObjectContact);
+ sdr::contact::DisplayInfo aDisplayInfo;
+ drawinglayer::primitive2d::Primitive2DContainer aContainer;
+ rVOContact.getPrimitive2DSequenceHierarchy(aDisplayInfo, aContainer);
+ return aContainer;
+}
+
CPPUNIT_TEST_FIXTURE(Test, testTableShadowBlur)
{
// Given a document containing a table with a blurry shadow:
@@ -187,6 +208,88 @@ CPPUNIT_TEST_FIXTURE(Test, testSvxTableControllerSetAttrToSelectedShape)
// Then make sure the text edit is not ended:
CPPUNIT_ASSERT(pSdrView->IsTextEdit());
}
+
+CPPUNIT_TEST_FIXTURE(Test, testAutoColorOnDarkBackground)
+{
+ // Create new presentation with a table and black page background
+ loadFromURL(u"private:factory/simpress"_ustr);
+ uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(mxComponent, uno::UNO_QUERY);
+ uno::Reference<drawing::XDrawPage> xDrawPage(xDrawPagesSupplier->getDrawPages()->getByIndex(0),
+ uno::UNO_QUERY);
+ auto pDrawPage = dynamic_cast<SvxDrawPage*>(xDrawPage.get());
+ CPPUNIT_ASSERT(pDrawPage);
+ SdrPage* pSdrPage = pDrawPage->GetSdrPage();
+
+ // Set the page background to black.
+ SfxItemSet aPageItems(pSdrPage->getSdrPageProperties().GetItemSet());
+ aPageItems.Put(XFillStyleItem(css::drawing::FillStyle_SOLID));
+ aPageItems.Put(XFillColorItem(OUString(), COL_BLACK));
+ pSdrPage->getSdrPageProperties().PutItemSet(aPageItems);
+
+ // Insert a 3x1 table.
+ uno::Sequence<beans::PropertyValue> aArgs
+ = { comphelper::makePropertyValue(u"Rows"_ustr, sal_Int32(3)),
+ comphelper::makePropertyValue(u"Columns"_ustr, sal_Int32(1)) };
+ dispatchCommand(mxComponent, u".uno:InsertTable"_ustr, aArgs);
+
+ // End text edit so that rendering goes through the primitive path.
+ SfxViewShell* pViewShell = SfxViewShell::Current();
+ CPPUNIT_ASSERT(pViewShell);
+ SdrView* pSdrView = pViewShell->GetDrawView();
+ if (pSdrView->IsTextEdit())
+ pSdrView->SdrEndTextEdit();
+
+ SdrObject* pLastObject = pSdrPage->GetObj(pSdrPage->GetObjCount() - 1);
+ CPPUNIT_ASSERT(pLastObject);
+
+ auto pTableObject = dynamic_cast<sdr::table::SdrTableObj*>(pLastObject);
+ CPPUNIT_ASSERT(pTableObject);
+
+ SdrOutliner& rOutliner = pSdrPage->getSdrModelFromSdrPage().GetDrawOutliner();
+
+ // Cell 0: no cell fill
+ rOutliner.Clear();
+ rOutliner.Insert(u"Test"_ustr);
+ pTableObject->getText(0)->SetOutlinerParaObject(rOutliner.CreateParaObject());
+
+ // Cell 1: explicit white fill
+ uno::Reference<beans::XPropertySet> xCell1(pTableObject->getTable()->getCellByPosition(0, 1),
+ uno::UNO_QUERY_THROW);
+ xCell1->setPropertyValue(u"FillStyle"_ustr, uno::Any(css::drawing::FillStyle_SOLID));
+ xCell1->setPropertyValue(u"FillColor"_ustr, uno::Any(sal_Int32(COL_WHITE)));
+ rOutliner.Clear();
+ rOutliner.Insert(u"Test"_ustr);
+ pTableObject->getText(1)->SetOutlinerParaObject(rOutliner.CreateParaObject());
+
+ // Cell 2: explicit black fill
+ uno::Reference<beans::XPropertySet> xCell2(pTableObject->getTable()->getCellByPosition(0, 2),
+ uno::UNO_QUERY_THROW);
+ xCell2->setPropertyValue(u"FillStyle"_ustr, uno::Any(css::drawing::FillStyle_SOLID));
+ xCell2->setPropertyValue(u"FillColor"_ustr, uno::Any(sal_Int32(COL_BLACK)));
+ rOutliner.Clear();
+ rOutliner.Insert(u"Test"_ustr);
+ pTableObject->getText(2)->SetOutlinerParaObject(rOutliner.CreateParaObject());
+
+ // When rendering the table to primitives:
+ drawinglayer::primitive2d::Primitive2DContainer xPrimitiveSequence
+ = renderObjectToPrimitives(pTableObject);
+ svx::ExtendedPrimitive2dXmlDump aDumper;
+ xmlDocUniquePtr pDocument = aDumper.dumpAndParse(xPrimitiveSequence);
+
+ const char sCell1[] = "(//sdrCell[1]/group/sdrblocktext/texthierarchyblock/"
+ "texthierarchyparagraph/texthierarchyline/textsimpleportion)[1]";
+ const char sCell2[] = "(//sdrCell[2]/group/sdrblocktext/texthierarchyblock/"
+ "texthierarchyparagraph/texthierarchyline/textsimpleportion)[1]";
+ const char sCell3[] = "(//sdrCell[3]/group/sdrblocktext/texthierarchyblock/"
+ "texthierarchyparagraph/texthierarchyline/textsimpleportion)[1]";
+
+ // Cell 0: no fill, dark page, expect white text
+ assertXPath(pDocument, sCell1, "fontcolor", u"#ffffff");
+ // Cell 1: white fill, expect black text
+ assertXPath(pDocument, sCell2, "fontcolor", u"#000000");
+ // Cell 2: black fill, expect white text
+ assertXPath(pDocument, sCell3, "fontcolor", u"#ffffff");
+}
}

/* vim:set shiftwidth=4 softtabstop=4 expandtab: */

"Armin Le Grand (collabora) (via cogerrit)"

unread,
May 13, 2026, 6:59:07 AM (12 days ago) May 13
to collaboraon...@googlegroups.com
engine/svx/source/svdraw/svdedtv2.cxx | 38 +++++++++++++++++-----------------
1 file changed, 20 insertions(+), 18 deletions(-)

New commits:
commit eeda9d461c35c367b9c21e80715a92c53f499c29
Author: Armin Le Grand (collabora) <Armin....@collabora.com>
AuthorDate: Mon May 11 16:04:05 2026 +0200
Commit: Armin Le Grand <armin....@collabora.com>
CommitDate: Wed May 13 10:58:05 2026 +0000

cool#15723 UnGroup of Diagrams needs some extra care

This did crash. Basic reason is that SdrEditView::UnGroupMarked()
does not work. This is because pSrcLst->RemoveObject(0) for
historical reasons does nothing and returns NULLPTR when
DeleteProtect is set for the SdrObject.

Thus use DiagramHelper::disconnectFromSdrObjGroup which does
the somewhat preparing job of removing all Diagram stuff from
the hosting GroupObject. This also already supports Undo/Redo
of all that Diagram data.

Also needed to clear DeleteProtect for BackgroundObject
early if not needed.

It is better to keep 'UnGroup' also for selected Diagrams,
instead of adding a new command (and name). This is the
logical command for the User to also 'end' the Diagram
aspect. Doing this including Undo/Redo will not need another
command as the mentioned 'Convert Diagram to Group Object'.
That slot is internally useful, but we then do not need it
at the UI with another Name we would need to come up with.

Signed-off-by: Armin Le Grand (collabora) <Armin....@collabora.com>
Change-Id: I84e1c0888a33ccc0eb1e6eee7350acafc97adccf
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/2375
Tested-by: Jenkins CPCI <rel...@collaboraoffice.com>
Reviewed-by: Armin Le Grand <armin....@collabora.com>

diff --git a/engine/svx/source/svdraw/svdedtv2.cxx b/engine/svx/source/svdraw/svdedtv2.cxx
index bdae2d4b09d1..572b2dc51d53 100644
--- a/engine/svx/source/svdraw/svdedtv2.cxx
+++ b/engine/svx/source/svdraw/svdedtv2.cxx
@@ -42,6 +42,7 @@
#include <basegfx/polygon/b2dpolypolygontools.hxx>
#include <svx/strings.hrc>
#include <svx/svdoashp.hxx>
+#include <svx/diagram/DiagramHelper_svx.hxx>
#include <basegfx/polygon/b2dpolypolygoncutter.hxx>
#include <i18nutil/unicode.hxx>
#include <sal/log.hxx>
@@ -1936,36 +1937,37 @@ void SdrEditView::UnGroupMarked()
{
SdrObject* pObj(pSrcLst->GetObj(0));

- if(nullptr != pObj && !pObj->IsGroupObject() &&
- !pObj->HasLineStyle() &&
- pObj->IsMoveProtect() && pObj->IsResizeProtect())
+ if(nullptr != pObj && !pObj->IsGroupObject() && pObj->IsMoveProtect() && pObj->IsResizeProtect())
{
- if(pObj->HasFillStyle())
+ if(pObj->HasFillStyle() || pObj->HasLineStyle())
{
- // If it has FillStyle it is a useful object representing that possible
- // defined fill from oox import. In this case, we should remove the
- // Move/Resize protection to allow seamless further processing.
-
- // Undo of these is handled by SdrUndoGeoObj which holds a SdrObjGeoData,
- // create one
- if( bUndo )
- AddUndo(GetModel().GetSdrUndoFactory().CreateUndoGeoObject(*pObj));
-
- pObj->SetMoveProtect(false);
- pObj->SetResizeProtect(false);
+ // If it has FillStyle or LineStyle it is a useful object representing
+ // that possible defined fill from oox import. In this case, we should
+ // keep the shape
}
else
{
- // If it has no FillStyle it is not useful for any further processing
- // but only was used as a placeholder, get directly rid of it
+ // If it has no FillStyle or LineStyle it is not useful for any further processing
+ // but only was used as a placeholder, directly get rid of it
if( bUndo )
AddUndo(GetModel().GetSdrUndoFactory().CreateUndoDeleteObject(*pObj));

- pSrcLst->RemoveObject(0);
+ // necessary to reset, else pSrcLst->RemoveObject below will just
+ // do nothing
+ pObj->SetDeleteProtect(false);

+ pSrcLst->RemoveObject(0);
nObjCount = pSrcLst->GetObjCount();
}
}
+
+ // clear diagram information, create UNDO fir it.
+ // That also uses applyLocksToDiagramObjects which removes the
+ // Move/Resize/DeleteProtect flags. Especially DeleteProtect is
+ // necessary, else the call below to pSrcLst->RemoveObject will fail
+ const std::shared_ptr< svx::diagram::DiagramHelper_svx >& rDiagramHelper(pGrp->getDiagramHelper());
+ assert(rDiagramHelper); // pGrp->isDiagram() is already true, so should not happen
+ rDiagramHelper->disconnectFromSdrObjGroup(bUndo);
}

// FIRST move contained objects to parent of group, so that

"Nistor Mario Peter (via cogerrit)"

unread,
May 14, 2026, 10:42:10 AM (11 days ago) May 14
to collaboraon...@googlegroups.com
engine/svx/source/items/numfmtsh.cxx | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

New commits:
commit adb1995e0eb1661f358eef183a34c220ae99b797
Author: Nistor Mario Peter <nistorp...@gmail.com>
AuthorDate: Sat May 9 01:03:36 2026 +0300
Commit: Caolán McNamara <caolan....@collabora.com>
CommitDate: Thu May 14 14:41:29 2026 +0000

tdf#163738 - Use insert() to add multiple values in containers instead of a loop

Change-Id: I202c731ee44baf804a0dd7a1c41566dcde1e5be5
Signed-off-by: Nistor Mario Peter <nistorp...@gmail.com>
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/2304
Reviewed-by: Caolán McNamara <caolan....@collabora.com>
Tested-by: Jenkins CPCI <rel...@collaboraoffice.com>
Tested-by: Caolán McNamara <caolan....@collabora.com>

diff --git a/engine/svx/source/items/numfmtsh.cxx b/engine/svx/source/items/numfmtsh.cxx
index 3ba7e53c5869..8472f844c84f 100644
--- a/engine/svx/source/items/numfmtsh.cxx
+++ b/engine/svx/source/items/numfmtsh.cxx
@@ -1016,12 +1016,13 @@ short SvxNumberFormatShell::FillEListWithUserCurrencys(std::vector<OUString>& rL
}
}

- for (size_t i = nOldListCount; i < rList.size(); ++i)
- {
- aCurrencyFormatList.push_back(rList[i]);
+ aCurrencyFormatList.insert(aCurrencyFormatList.end(), rList.begin() + nOldListCount, rList.end());

- if (nSelPos == SELPOS_NONE && bAdaptSelPos && aCurEntryList[i] == nCurFormatKey)
- nSelPos = i;
+ if (nSelPos == SELPOS_NONE && bAdaptSelPos)
+ {
+ auto it = std::find(aCurEntryList.begin() + nOldListCount, aCurEntryList.end(), nCurFormatKey);
+ if (it != aCurEntryList.end())
+ nSelPos = static_cast<short>(std::distance(aCurEntryList.begin(), it));
}

if (nSelPos == SELPOS_NONE && nCurCategory != SvNumFormatType::ALL)

"Andras Timar (via cogerrit)"

unread,
May 21, 2026, 3:13:40 AM (5 days ago) May 21
to collaboraon...@googlegroups.com
engine/svx/source/dialog/ThemeColorsPaneBase.cxx | 46 ++++++++++++++++++++---
1 file changed, 41 insertions(+), 5 deletions(-)

New commits:
commit 02575bcc1d2fdae60db8f366b47f8e21979c7e54
Author: Andras Timar <andras...@collabora.com>
AuthorDate: Tue May 19 13:56:10 2026 +0200
Commit: Miklos Vajna <vmi...@collabora.com>
CommitDate: Thu May 21 07:13:19 2026 +0000

svx: hide the legacy "LibreOffice" theme from the Theme dialog

The "LibreOffice" theme name appears in older documents and shows up
first in the Format > Theme dialog as if it were the default choice,
which is not what we want to offer. Filter it out of the icon view so
it cannot be picked, while keeping it in the underlying color-set list
so existing documents that reference it still load and save correctly.
When the document's current theme is the hidden one, preselect "Office"
in its place.

The change lives in the shared svx pane, so Writer, Impress and Calc
are all covered.

Signed-off-by: Andras Timar <andras...@collabora.com>
Change-Id: I7579ce9ead2b4431aa0aec3ea1e8f1df3a2fdc6c
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/2939
Reviewed-by: Miklos Vajna <vmi...@collabora.com>

diff --git a/engine/svx/source/dialog/ThemeColorsPaneBase.cxx b/engine/svx/source/dialog/ThemeColorsPaneBase.cxx
index a59855e19e7b..92fe8d6c5c0c 100644
--- a/engine/svx/source/dialog/ThemeColorsPaneBase.cxx
+++ b/engine/svx/source/dialog/ThemeColorsPaneBase.cxx
@@ -45,23 +45,59 @@ void ThemeColorsPaneBase::initColorSets(const model::Theme* pTheme)
mxIconViewThemeColors->freeze();
mxIconViewThemeColors->clear();

+ // The legacy "LibreOffice" theme is kept in the model so documents that
+ // already reference it keep working, but it is not offered as a choice
+ // in the UI. "Office" is the fallback selection in its place.
+ static constexpr std::u16string_view aHiddenThemeName = u"LibreOffice";
+ static constexpr std::u16string_view aFallbackDefaultName = u"Office";
+
+ int nVisiblePos = 0;
+ int nFirstVisiblePos = -1;
+ size_t nFirstVisibleIndex = 0;
+ int nFallbackPos = -1;
+ size_t nFallbackIndex = 0;
for (size_t i = 0; i < maColorSets.size(); ++i)
{
- auto const& rColorSet = maColorSets[i];
- auto pVirDev = CreateColorSetPreview(rColorSet);
+ model::ColorSet const& rColorSet = maColorSets[i];
+ if (rColorSet.getName() == aHiddenThemeName)
+ continue;
+
+ ScopedVclPtr<VirtualDevice> pVirDev = CreateColorSetPreview(rColorSet);

Bitmap aBitmap(pVirDev->GetBitmap(Point(0, 0), pVirDev->GetOutputSizePixel()));
OUString sId = OUString::number(i);
OUString sName = rColorSet.getName();
mxIconViewThemeColors->insert(-1, &sName, &sId, &aBitmap, nullptr);
+
+ if (nFirstVisiblePos < 0)
+ {
+ nFirstVisiblePos = nVisiblePos;
+ nFirstVisibleIndex = i;
+ }
+ if (nFallbackPos < 0 && rColorSet.getName() == aFallbackDefaultName)
+ {
+ nFallbackPos = nVisiblePos;
+ nFallbackIndex = i;
+ }
+ ++nVisiblePos;
}

mxIconViewThemeColors->thaw();

- if (!maColorSets.empty())
+ if (nFirstVisiblePos >= 0)
{
- mxIconViewThemeColors->select(0);
- mpCurrentColorSet = std::make_shared<model::ColorSet>(maColorSets[0]);
+ // If the document's current theme was hidden, fall back to "Office".
+ const bool bDocumentThemeHidden
+ = pTheme && !maColorSets.empty() && maColorSets[0].getName() == aHiddenThemeName;
+ int nSelectedPos = nFirstVisiblePos;
+ size_t nSelectedIndex = nFirstVisibleIndex;
+ if (bDocumentThemeHidden && nFallbackPos >= 0)
+ {
+ nSelectedPos = nFallbackPos;
+ nSelectedIndex = nFallbackIndex;
+ }
+ mxIconViewThemeColors->select(nSelectedPos);
+ mpCurrentColorSet = std::make_shared<model::ColorSet>(maColorSets[nSelectedIndex]);
}
}
}

"Caolán McNamara (via cogerrit)"

unread,
May 21, 2026, 2:25:50 PM (4 days ago) May 21
to collaboraon...@googlegroups.com
engine/svx/source/svdraw/svdotxtr.cxx | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

New commits:
commit a7f20642f1f5355577a691ae27aff70154997a81
Author: Caolán McNamara <caolan....@collabora.com>
AuthorDate: Wed May 20 08:54:28 2026 +0000
Commit: Caolán McNamara <caolan....@collabora.com>
CommitDate: Thu May 21 18:24:42 2026 +0000

crashtesting: fix divide-by-zero on rotated zero-width/height shape

crash on converting forums/xlsx/forum-mso-en4-719{400,422,450}.xlsx to .ods

#0 0x00007fb8a598aeec in raise () at /lib/x86_64-linux-gnu/libc.so.6
...
#21 0x00007fb87cce0b52 in o3tl::detail::MulDiv<long> (n=-9223372036854773760, m=72, d=127) at engine/include/o3tl/unit_conversion.hxx:75
#25 0x00007fb87cec1c53 in ScDrawLayer::GetPrintArea (...) at engine/sc/source/core/data/drwlayer.cxx:1439
#30 0x00007fb87d320577 in ScXMLExport::GetViewSettings (...) at engine/sc/source/filter/xml/xmlexprt.cxx:5337

Where the problem rectangle was produced (not where it crashed) at:

#2 0x0000000000000000 in SdrTextObj::NbcSetSnapRect (...) at engine/svx/source/svdraw/svdotxtr.cxx:53
#6 0x0000000000000000 in SdrObject::SetSnapRect (...) at engine/svx/source/svdraw/svdobj.cxx:1853
#7 0x0000000000000000 in ScDrawLayer::RecalcPos (...) at engine/sc/source/core/data/drwlayer.cxx:1305
#8 0x0000000000000000 in ScDrawLayer::SetPageSize (...) at engine/sc/source/core/data/drwlayer.cxx:683
#9 0x0000000000000000 in ScTable::SetDrawPageSize (...) at engine/sc/source/core/data/table2.cxx:4287
#10 0x0000000000000000 in ScTable::SetOptimalHeight (...) at engine/sc/source/core/data/table1.cxx:523
#12 0x0000000000000000 in ScDocShell::UpdateAllRowHeights (...) at engine/sc/source/ui/docshell/docsh5.cxx:451
#13 0x0000000000000000 in oox::xls::WorkbookGlobals::finalize () at engine/sc/source/filter/oox/workbookhelper.cxx:667

Each of the three xlsx files has a zero-width rectangle rotated -90 degrees.

WorkbookGlobals::finalize eventually calls SdrTextObj::NbcSetSnapRect
and scales the shape by:

double(nWdt1) / nWdt0, double(nHgt1) / nHgt0

so the X scale becomes +inf. Eventually this bad value ends up in
ScDrawLayer::GetPrintArea and overflows.

presumably since:

commit 282cb403cd5cf8660b36a410c0370d51fb1efc96
Date: Sun Mar 15 15:15:54 2026 +0200

Fraction->double in SdrObject::Resize

Signed-off-by: Caolán McNamara <caolan....@collabora.com>
Change-Id: I087c5d10ad1fbc20d2735cf4a1b940c26e159350
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/3016

diff --git a/engine/svx/source/svdraw/svdotxtr.cxx b/engine/svx/source/svdraw/svdotxtr.cxx
index 3726abf3f294..708b859d25af 100644
--- a/engine/svx/source/svdraw/svdotxtr.cxx
+++ b/engine/svx/source/svdraw/svdotxtr.cxx
@@ -50,7 +50,9 @@ void SdrTextObj::NbcSetSnapRect(const tools::Rectangle& rRect)
tools::Long nHgt0=aSR0.Bottom()-aSR0.Top();
tools::Long nWdt1=rRect.Right()-rRect.Left();
tools::Long nHgt1=rRect.Bottom()-rRect.Top();
- SdrTextObj::NbcResize(maSnapRect.TopLeft(), double(nWdt1) / nWdt0, double(nHgt1) / nHgt0);
+ double xFact = nWdt0 ? double(nWdt1) / nWdt0 : 1.0;
+ double yFact = nHgt0 ? double(nHgt1) / nHgt0 : 1.0;
+ SdrTextObj::NbcResize(maSnapRect.TopLeft(), xFact, yFact);
SdrTextObj::NbcMove(Size(rRect.Left()-aSR0.Left(),rRect.Top()-aSR0.Top()));
}
else

"Andras Timar (via cogerrit)"

unread,
May 22, 2026, 10:36:35 AM (3 days ago) May 22
to collaboraon...@googlegroups.com
engine/svx/source/styles/ColorSets.cxx | 7 +++++++
1 file changed, 7 insertions(+)

New commits:
commit 5821541ded713f1c356b64a625d2a8114d16394e
Author: Andras Timar <andras...@collabora.com>
AuthorDate: Thu May 21 12:09:52 2026 +0200
Commit: Miklos Vajna <vmi...@collabora.com>
CommitDate: Fri May 22 14:36:15 2026 +0000

svx: create the user theme folder before writing a new ColorSet

ColorSets::writeToUserFolder() opens an SvFileStream at
$(userurl)/themes/<name>.theme without ensuring the parent directory
exists. On a fresh user profile (and in the COOL jail when the host
advertised no existing themes) that open fails silently, the new
.theme file is never written to disk, and Format > Theme > Add looks
like it worked while leaving nothing behind.

Call osl::Directory::createPath(maUserFolder) before opening the
stream, matching the pattern in ClassificationDialog::writeRecentlyUsed()
(svx/source/dialog/ClassificationDialog.cxx).

Signed-off-by: Andras Timar <andras...@collabora.com>
Change-Id: I3cd73dc5d5e146920e7ef1776e7e9bead68d80e4
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/3046
Reviewed-by: Miklos Vajna <vmi...@collabora.com>

diff --git a/engine/svx/source/styles/ColorSets.cxx b/engine/svx/source/styles/ColorSets.cxx
index c153dd56326b..b23ef940ae0c 100644
--- a/engine/svx/source/styles/ColorSets.cxx
+++ b/engine/svx/source/styles/ColorSets.cxx
@@ -19,6 +19,7 @@
#include <docmodel/theme/ColorSet.hxx>
#include <docmodel/theme/ThemeColorType.hxx>
#include <o3tl/numeric.hxx>
+#include <osl/file.hxx>
#include <tools/stream.hxx>
#include <tools/XmlWalker.hxx>
#include <tools/XmlWriter.hxx>
@@ -262,6 +263,12 @@ void ColorSets::writeToUserFolder(model::ColorSet const& rNewColorSet)
{ model::ThemeColorType::FollowedHyperlink, "followed-hyperlink" }
});

+ // Create the user theme folder if it does not yet exist. On a fresh
+ // user profile (and in the COOL jail when the host advertised no
+ // existing themes) the SvFileStream open below would otherwise fail
+ // silently.
+ osl::Directory::createPath(maUserFolder);
+
SvFileStream aFileStream(maUserFolder + "/" + rNewColorSet.getName() + ".theme", StreamMode::WRITE | StreamMode::TRUNC);

tools::XmlWriter aWriter(&aFileStream);

"Szymon Kłos (via cogerrit)"

unread,
6:35 AM (11 hours ago) 6:35 AM
to collaboraon...@googlegroups.com
engine/svx/source/tbxctrls/tbcontrl.cxx | 20 ++++++++------------
engine/svx/source/tbxctrls/tbunocontroller.cxx | 10 ++++------
2 files changed, 12 insertions(+), 18 deletions(-)

New commits:
commit 0c8494994a41ad39765a669a9c614278fbc3df98
Author: Szymon Kłos <szymo...@collabora.com>
AuthorDate: Fri May 15 13:49:15 2026 +0000
Commit: Tomaž Vajngerl <tomaz.v...@collabora.com>
CommitDate: Mon May 25 10:34:48 2026 +0000

vcl: emit listbox/combobox entries as JSON arrays

The font name, font size and style apply boxes emitted "entries"
and "selectedEntries" as JSON nodes with duplicate empty-string
keys. JSON.parse keeps only the last duplicate, so all but one
entry was lost on the browser side - visible after a style change
when an incremental sidebar update arrived and the mobile listbox
ended up with a single garbled entry.

Use startArray / putSimpleValue so the same array form already
used by ComboBox::DumpAsPropertyTree is emitted here too.

Signed-off-by: Szymon Kłos <szymo...@collabora.com>
Change-Id: Ieef6562b50f42305277a9dd7d46454d043008c38
Reviewed-on: https://gerrit.collaboraoffice.com/c/online/+/2930
Tested-by: Jenkins CPCI <rel...@collaboraoffice.com>
Reviewed-by: Tomaž Vajngerl <tomaz.v...@collabora.com>

diff --git a/engine/svx/source/tbxctrls/tbcontrl.cxx b/engine/svx/source/tbxctrls/tbcontrl.cxx
index 743c7664b304..1fdbaea2f871 100644
--- a/engine/svx/source/tbxctrls/tbcontrl.cxx
+++ b/engine/svx/source/tbxctrls/tbcontrl.cxx
@@ -1632,11 +1632,10 @@ IMPL_LINK(SvxStyleBox_Base, DumpAsPropertyTreeHdl, tools::JsonWriter&, rJsonWrit
return;

{
- auto entriesNode = rJsonWriter.startNode("entries");
+ auto entriesNode = rJsonWriter.startArray("entries");
for (int i = 0, nEntryCount = m_xWidget->get_count(); i < nEntryCount; ++i)
{
- auto entryNode = rJsonWriter.startNode("");
- rJsonWriter.put("", m_xWidget->get_text(i));
+ rJsonWriter.putSimpleValue(m_xWidget->get_text(i));
}
}

@@ -1644,11 +1643,10 @@ IMPL_LINK(SvxStyleBox_Base, DumpAsPropertyTreeHdl, tools::JsonWriter&, rJsonWrit
rJsonWriter.put("selectedCount", static_cast<sal_Int32>(nActive == -1 ? 0 : 1));

{
- auto selectedNode = rJsonWriter.startNode("selectedEntries");
+ auto selectedNode = rJsonWriter.startArray("selectedEntries");
if (nActive != -1)
{
- auto node = rJsonWriter.startNode("");
- rJsonWriter.put("", static_cast<sal_Int32>(nActive));
+ rJsonWriter.putSimpleValue(OUString::number(nActive));
}
}

@@ -2032,11 +2030,10 @@ void SvxFontNameBox_Base::Select(bool bNonTravelSelect)
IMPL_LINK(SvxFontNameBox_Base, DumpAsPropertyTreeHdl, tools::JsonWriter&, rJsonWriter, void)
{
{
- auto entriesNode = rJsonWriter.startNode("entries");
+ auto entriesNode = rJsonWriter.startArray("entries");
for (int i = 0, nEntryCount = m_xWidget->get_count(); i < nEntryCount; ++i)
{
- auto entryNode = rJsonWriter.startNode("");
- rJsonWriter.put("", m_xWidget->get_text(i));
+ rJsonWriter.putSimpleValue(m_xWidget->get_text(i));
}
}

@@ -2044,11 +2041,10 @@ IMPL_LINK(SvxFontNameBox_Base, DumpAsPropertyTreeHdl, tools::JsonWriter&, rJsonW
rJsonWriter.put("selectedCount", static_cast<sal_Int32>(nSelectedEntry == -1 ? 0 : 1));

{
- auto selectedNode = rJsonWriter.startNode("selectedEntries");
+ auto selectedNode = rJsonWriter.startArray("selectedEntries");
if (nSelectedEntry != -1)
{
- auto entryNode = rJsonWriter.startNode("");
- rJsonWriter.put("", m_xWidget->get_text(nSelectedEntry));
+ rJsonWriter.putSimpleValue(m_xWidget->get_text(nSelectedEntry));
}
}

diff --git a/engine/svx/source/tbxctrls/tbunocontroller.cxx b/engine/svx/source/tbxctrls/tbunocontroller.cxx
index 4eb9d26786bd..1bd023c08cde 100644
--- a/engine/svx/source/tbxctrls/tbunocontroller.cxx
+++ b/engine/svx/source/tbxctrls/tbunocontroller.cxx
@@ -328,22 +328,20 @@ void SvxFontSizeBox_Impl::DataChanged( const DataChangedEvent& rDCEvt )
IMPL_LINK(SvxFontSizeBox_Base, DumpAsPropertyTreeHdl, tools::JsonWriter&, rJsonWriter, void)
{
{
- auto entriesNode = rJsonWriter.startNode("entries");
+ auto entriesNode = rJsonWriter.startArray("entries");
for (int i = 0, nCount = m_xWidget->get_count(); i < nCount; ++i)
{
- auto entryNode = rJsonWriter.startNode("");
- rJsonWriter.put("", m_xWidget->get_text(i));
+ rJsonWriter.putSimpleValue(m_xWidget->get_text(i));
}
}

int nActive = m_xWidget->get_active();
rJsonWriter.put("selectedCount", static_cast<sal_Int32>(nActive == -1 ? 0 : 1));
{
- auto selectedNode = rJsonWriter.startNode("selectedEntries");
+ auto selectedNode = rJsonWriter.startArray("selectedEntries");
if (nActive != -1)
{
- auto node = rJsonWriter.startNode("");
- rJsonWriter.put("", static_cast<sal_Int32>(nActive));
+ rJsonWriter.putSimpleValue(OUString::number(nActive));
}
}


Reply all
Reply to author
Forward
0 new messages