diff options
author | Caolán McNamara <caolan.mcnamara@collabora.com> | 2024-12-02 11:03:47 +0000 |
---|---|---|
committer | Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> | 2024-12-10 15:22:58 +0100 |
commit | 54bcba0e561092d1f3033dfe00d11f065fbbd276 (patch) | |
tree | 3686e0c1e6526215cb5eaae38ddc75aede725d49 | |
parent | 0d5edbcf79e2f0a3e3f0133e961bd98df4313e81 (diff) |
crashtesting: further failure to reload forum-de3-6592.docx
git show -w
Change-Id: I2963833726779d784bcdfa772e152e65dfde3af5
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177676
Reviewed-by: Xisco Fauli <xiscofauli@libreoffice.org>
Tested-by: Jenkins
(cherry picked from commit a4b9ff56e6141848d3289431f537254e28254bb5)
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/177687
Reviewed-by: Michael Stahl <michael.stahl@allotropia.de>
Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r-- | oox/source/shape/WpsContext.cxx | 95 |
1 files changed, 49 insertions, 46 deletions
diff --git a/oox/source/shape/WpsContext.cxx b/oox/source/shape/WpsContext.cxx index 4734505302bb..83934745d946 100644 --- a/oox/source/shape/WpsContext.cxx +++ b/oox/source/shape/WpsContext.cxx @@ -715,60 +715,63 @@ oox::core::ContextHandlerRef WpsContext::onCreateContext(sal_Int32 nElementToken // Apply character color of the shape to the shape's textbox. uno::Reference<text::XText> xText(mxShape, uno::UNO_QUERY); - uno::Any xCharColor = xPropertySet->getPropertyValue(u"CharColor"_ustr); - Color aColor = COL_AUTO; - if ((xCharColor >>= aColor) && aColor != COL_AUTO) + if (xText) { - // tdf#135923 Apply character color of the shape to the textrun - // when the character color of the textrun is default. - // tdf#153791 But only if the run has no background color (shd element in OOXML) - if (uno::Reference<container::XEnumerationAccess> paraEnumAccess{ - xText, uno::UNO_QUERY }) + uno::Any xCharColor = xPropertySet->getPropertyValue(u"CharColor"_ustr); + Color aColor = COL_AUTO; + if ((xCharColor >>= aColor) && aColor != COL_AUTO) { - uno::Reference<container::XEnumeration> paraEnum( - paraEnumAccess->createEnumeration()); - - while (paraEnum->hasMoreElements()) + // tdf#135923 Apply character color of the shape to the textrun + // when the character color of the textrun is default. + // tdf#153791 But only if the run has no background color (shd element in OOXML) + if (uno::Reference<container::XEnumerationAccess> paraEnumAccess{ + xText, uno::UNO_QUERY }) { - uno::Reference<text::XTextRange> xParagraph(paraEnum->nextElement(), - uno::UNO_QUERY); - uno::Reference<container::XEnumerationAccess> runEnumAccess( - xParagraph, uno::UNO_QUERY); - if (!runEnumAccess.is()) - continue; - if (uno::Reference<beans::XPropertySet> xParaPropSet{ xParagraph, - uno::UNO_QUERY }) - if ((xParaPropSet->getPropertyValue(u"ParaBackColor"_ustr) - >>= aColor) - && aColor != COL_AUTO) - continue; - - uno::Reference<container::XEnumeration> runEnum - = runEnumAccess->createEnumeration(); + uno::Reference<container::XEnumeration> paraEnum( + paraEnumAccess->createEnumeration()); - while (runEnum->hasMoreElements()) + while (paraEnum->hasMoreElements()) { - uno::Reference<text::XTextRange> xRun(runEnum->nextElement(), - uno::UNO_QUERY); - const uno::Reference<beans::XPropertyState> xRunState( - xRun, uno::UNO_QUERY); - if (!xRunState - || xRunState->getPropertyState(u"CharColor"_ustr) - == beans::PropertyState_DEFAULT_VALUE) - { - uno::Reference<beans::XPropertySet> xRunPropSet(xRun, - uno::UNO_QUERY); - if (!xRunPropSet) - continue; - if ((xRunPropSet->getPropertyValue(u"CharBackColor"_ustr) + uno::Reference<text::XTextRange> xParagraph(paraEnum->nextElement(), + uno::UNO_QUERY); + uno::Reference<container::XEnumerationAccess> runEnumAccess( + xParagraph, uno::UNO_QUERY); + if (!runEnumAccess.is()) + continue; + if (uno::Reference<beans::XPropertySet> xParaPropSet{ + xParagraph, uno::UNO_QUERY }) + if ((xParaPropSet->getPropertyValue(u"ParaBackColor"_ustr) >>= aColor) && aColor != COL_AUTO) continue; - if (!(xRunPropSet->getPropertyValue(u"CharColor"_ustr) - >>= aColor) - || aColor == COL_AUTO) - xRunPropSet->setPropertyValue(u"CharColor"_ustr, - xCharColor); + + uno::Reference<container::XEnumeration> runEnum + = runEnumAccess->createEnumeration(); + + while (runEnum->hasMoreElements()) + { + uno::Reference<text::XTextRange> xRun(runEnum->nextElement(), + uno::UNO_QUERY); + const uno::Reference<beans::XPropertyState> xRunState( + xRun, uno::UNO_QUERY); + if (!xRunState + || xRunState->getPropertyState(u"CharColor"_ustr) + == beans::PropertyState_DEFAULT_VALUE) + { + uno::Reference<beans::XPropertySet> xRunPropSet( + xRun, uno::UNO_QUERY); + if (!xRunPropSet) + continue; + if ((xRunPropSet->getPropertyValue(u"CharBackColor"_ustr) + >>= aColor) + && aColor != COL_AUTO) + continue; + if (!(xRunPropSet->getPropertyValue(u"CharColor"_ustr) + >>= aColor) + || aColor == COL_AUTO) + xRunPropSet->setPropertyValue(u"CharColor"_ustr, + xCharColor); + } } } } |