File bsc1133534.patch of Package libreoffice.12309
From c3e0d46062c6b37dfa74b6b388767c61912145f4 Mon Sep 17 00:00:00 2001
From: Grzegorz Araminowicz <grzegorz.araminowicz@collabora.com>
Date: Tue, 04 Jun 2019 13:51:40 +0200
Subject: [PATCH] SmartArt: bullet list improvements
by default start bullet list at second level
use stBulletLvl parameter to change this behaviour
Change-Id: I5084e7bf1902fdca83bea6d57a8c1f37dd2e65be
Reviewed-on: https://gerrit.libreoffice.org/73440
Tested-by: Jenkins
Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Reviewed-on: https://gerrit.libreoffice.org/74086
Reviewed-by: Andras Timar <andras.timar@collabora.com>
Tested-by: Andras Timar <andras.timar@collabora.com>
---
diff --git a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
index d7d6fda..a4b8054 100644
--- a/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
+++ b/oox/source/drawingml/diagram/diagramlayoutatoms.cxx
@@ -1196,27 +1196,30 @@
nBaseLevel = aParagraph->getProperties().getLevel();
}
+ // Start bullets at:
+ // 1 - top level
+ // 2 - with children (default)
+ int nStartBulletsAtLevel = 2;
ParamMap::const_iterator aBulletLvl = maMap.find(XML_stBulletLvl);
- int nStartBulletsAtLevel = 0;
if (aBulletLvl != maMap.end())
- {
- nBaseLevel -= aBulletLvl->second;
nStartBulletsAtLevel = aBulletLvl->second;
- }
+ nStartBulletsAtLevel--;
+ bool isBulletList = false;
for (auto & aParagraph : pTextBody->getParagraphs())
{
- sal_Int32 nLevel = aParagraph->getProperties().getLevel();
- aParagraph->getProperties().setLevel(nLevel - nBaseLevel);
- if (nStartBulletsAtLevel > 0 && nLevel >= nStartBulletsAtLevel)
+ sal_Int32 nLevel = aParagraph->getProperties().getLevel() - nBaseLevel;
+ aParagraph->getProperties().setLevel(nLevel);
+ if (nLevel >= nStartBulletsAtLevel)
{
// It is not possible to change the bullet style for text.
- sal_Int32 nLeftMargin = 285750 * (nLevel - nStartBulletsAtLevel) / EMU_PER_HMM;
+ sal_Int32 nLeftMargin = 285750 * (nLevel - nStartBulletsAtLevel + 1) / EMU_PER_HMM;
aParagraph->getProperties().getParaLeftMargin() = nLeftMargin;
aParagraph->getProperties().getFirstLineIndentation() = -285750 / EMU_PER_HMM;
OUString aBulletChar = OUString::fromUtf8(u8"•");
aParagraph->getProperties().getBulletList().setBulletChar(aBulletChar);
aParagraph->getProperties().getBulletList().setSuffixNone();
+ isBulletList = true;
}
}
@@ -1229,8 +1232,7 @@
for (auto & aParagraph : pTextBody->getParagraphs())
aParagraph->getProperties().setParaAdjust(aAlignment);
}
- else if (std::all_of(pTextBody->getParagraphs().begin(), pTextBody->getParagraphs().end(),
- [](const std::shared_ptr<TextParagraph>& aParagraph) { return aParagraph->getProperties().getLevel() == 0; }))
+ else if (!isBulletList)
{
// if not list use default alignment - centered
for (auto & aParagraph : pTextBody->getParagraphs())
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 5a0cd76..930006f 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -534,7 +536,7 @@
uno::Reference<container::XIndexAccess> xRules(xPara->getPropertyValue("NumberingRules"),
uno::UNO_QUERY);
- comphelper::SequenceAsHashMap aRule(xRules->getByIndex(1));
+ comphelper::SequenceAsHashMap aRule(xRules->getByIndex(0));
CPPUNIT_ASSERT_EQUAL(OUString::fromUtf8(u8"•"), aRule["BulletChar"].get<OUString>());
}