chart2/source/view/main/ChartView.cxx    |   14 ++++++++++++++
 sd/source/filter/eppt/pptx-epptooxml.cxx |    6 +++++-
 2 files changed, 19 insertions(+), 1 deletion(-)

New commits:
commit 64da52a94738aa73cbcf2411952914d4e8e0f9ef
Author:     Caolán McNamara <[email protected]>
AuthorDate: Fri Jun 14 15:52:08 2024 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Fri Jun 14 20:58:28 2024 +0200

    crashtesting: avoid eventual assert when double inf is cast to sal_Int32
    
    seen on loading forum-mso-en4-604220.xlsx and asserting on export to ods
    
    lets assume that an infinite Y position equates to ALIGN_BOTTOM which is
    the case seen in this example, and assume the same for infinite X and
    ALIGN_RIGHT if it arises
    
    Change-Id: I009a9cd94b7bd9ed66e18f8dbbb9eb91d37eaa65
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168892
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/chart2/source/view/main/ChartView.cxx 
b/chart2/source/view/main/ChartView.cxx
index 5d2c2bf6cc90..50264035e316 100644
--- a/chart2/source/view/main/ChartView.cxx
+++ b/chart2/source/view/main/ChartView.cxx
@@ -1119,6 +1119,20 @@ std::shared_ptr<VTitle> lcl_createTitle( 
TitleHelper::eTitleType eType
         aNewPosition = RelativePositionHelper::getCenterOfAnchoredObject(
                 
awt::Point(static_cast<sal_Int32>(fX),static_cast<sal_Int32>(fY))
                 , aTitleUnrotatedSize, aRelativePosition.Anchor, fAnglePi );
+
+        const bool bInfiniteY = std::isinf(aRelativePosition.Secondary);
+        if (bInfiniteY)
+        {
+            SAL_WARN("chart2", "infinite aRelativePosition.Secondary position, 
using ALIGN_BOTTOM");
+            aNewPosition.Y = rRemainingSpace.Y + rRemainingSpace.Height - 
aTitleSize.Height/2 - nYDistance;
+        }
+
+        const bool bInfiniteX = std::isinf(aRelativePosition.Primary);
+        if (bInfiniteX)
+        {
+            SAL_WARN("chart2", "infinite aRelativePosition.Primary position, 
using ALIGN_RIGHT");
+            aNewPosition.X = rRemainingSpace.X + rRemainingSpace.Width - 
aTitleSize.Width/2 - nXDistance;
+        }
     }
     else //auto position
     {
commit 4890e08519103b0252767e0dd8b810894293f815
Author:     Caolán McNamara <[email protected]>
AuthorDate: Fri Jun 14 09:07:16 2024 +0100
Commit:     Caolán McNamara <[email protected]>
CommitDate: Fri Jun 14 20:58:20 2024 +0200

    crashtesting: out of bounds on reexport of forum-mso-en4-290152.pptx to pptx
    
    probably since:
    
    commit 805fd61f8efaaac119bbe28ab51617c07f0d7058
    Date:   Thu Jun 6 19:47:45 2024 +0200
    
        tdf#160591 PPTX export: fix colormap mapping in slide master
    
        Change-Id: I154f0ff1769fbda361ec62f1dd589ca0d7686bd9
        Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168506
    
    Change-Id: I3ec45b2a0b78324e8512acbcc3a7544c196f670d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/168851
    Tested-by: Jenkins
    Reviewed-by: Caolán McNamara <[email protected]>

diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx 
b/sd/source/filter/eppt/pptx-epptooxml.cxx
index 5711d4192e7d..2d9e51e40fa5 100644
--- a/sd/source/filter/eppt/pptx-epptooxml.cxx
+++ b/sd/source/filter/eppt/pptx-epptooxml.cxx
@@ -1507,9 +1507,9 @@ void PowerPointExport::ImplWriteSlideMaster(sal_uInt32 
nPageNum, Reference< XPro
 
         std::vector<OUString> aClrMap;
         aClrMap.reserve(12);
+        uno::Sequence<beans::PropertyValue> aClrMapPropValue;
         if(aGrabBag.hasElements())
         {
-            uno::Sequence<beans::PropertyValue> aClrMapPropValue;
             for (const auto& rProp : aGrabBag)
             {
                 if (rProp.Name == "OOXColorMap")
@@ -1518,7 +1518,10 @@ void PowerPointExport::ImplWriteSlideMaster(sal_uInt32 
nPageNum, Reference< XPro
                     break;
                 }
             }
+        }
 
+        if (aClrMapPropValue.getLength())
+        {
             OUString sName;
             sal_Int32 nToken = XML_TOKEN_INVALID;
             for(const auto& item : aClrMapPropValue)
@@ -1541,6 +1544,7 @@ void PowerPointExport::ImplWriteSlideMaster(sal_uInt32 
nPageNum, Reference< XPro
                 }
                 aClrMap.push_back(sName);
             }
+            assert(aClrMap.size() == 12 && "missing entries for ClrMap");
         }
         else
         {

Reply via email to