summaryrefslogtreecommitdiff
path: root/svx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2022-01-10 14:36:02 +0100
committerMiklos Vajna <vmiklos@collabora.com>2022-06-30 15:57:19 +0200
commit3d329c2fa04e1a75ff1a5950d85a7ce1ea27a38e (patch)
treee7de1b5d45667c1a4906c5535b645d79469da8e0 /svx
parentc6f09675e991be0b596600fdd5d7f177149dacc6 (diff)
sd theme: fix applying new colors after theme change for group shapes
UpdateSdrObject() is called for both group and non-group shapes, so don't assume that they always have text, otherwise we would crash. (cherry picked from commit 952b3b227e02ae4eedce3138fcb39613bf12486d) Change-Id: I3672673176f0cb462a8b8d61a68466f541e9ce06 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136668 Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Miklos Vajna <vmiklos@collabora.com>
Diffstat (limited to 'svx')
-rw-r--r--svx/qa/unit/data/theme.pptxbin27231 -> 28788 bytes
-rw-r--r--svx/qa/unit/styles.cxx1
-rw-r--r--svx/source/styles/ColorSets.cxx6
3 files changed, 7 insertions, 0 deletions
diff --git a/svx/qa/unit/data/theme.pptx b/svx/qa/unit/data/theme.pptx
index 652a9fc29e06..74397b3ea67a 100644
--- a/svx/qa/unit/data/theme.pptx
+++ b/svx/qa/unit/data/theme.pptx
Binary files differ
diff --git a/svx/qa/unit/styles.cxx b/svx/qa/unit/styles.cxx
index 1e7151edf359..565d981e6e2e 100644
--- a/svx/qa/unit/styles.cxx
+++ b/svx/qa/unit/styles.cxx
@@ -68,6 +68,7 @@ CPPUNIT_TEST_FIXTURE(Test, testThemeChange)
OUString aURL = m_directories.getURLFromSrc(DATA_DIRECTORY) + "theme.pptx";
getComponent() = loadFromDesktop(aURL);
uno::Reference<drawing::XDrawPagesSupplier> xDrawPagesSupplier(getComponent(), uno::UNO_QUERY);
+ // The draw page also contains a group shape to make sure we don't crash on group shapes.
uno::Reference<drawing::XMasterPageTarget> xDrawPage(
xDrawPagesSupplier->getDrawPages()->getByIndex(0), uno::UNO_QUERY);
uno::Reference<drawing::XShapes> xDrawPageShapes(xDrawPage, uno::UNO_QUERY);
diff --git a/svx/source/styles/ColorSets.cxx b/svx/source/styles/ColorSets.cxx
index c77e6ccf2d76..97c79b58bcc6 100644
--- a/svx/source/styles/ColorSets.cxx
+++ b/svx/source/styles/ColorSets.cxx
@@ -74,6 +74,12 @@ void UpdateSdrObject(svx::Theme* pTheme, SdrObject* pObject)
}
uno::Reference<text::XTextRange> xShape(pObject->getUnoShape(), uno::UNO_QUERY);
+ if (!xShape.is())
+ {
+ // E.g. group shapes have no text.
+ return;
+ }
+
uno::Reference<container::XEnumerationAccess> xText(xShape->getText(), uno::UNO_QUERY);
uno::Reference<container::XEnumeration> xParagraphs = xText->createEnumeration();
while (xParagraphs->hasMoreElements())