sc/qa/unit/subsequent_export_test2.cxx   |    6 +++---
 sc/source/filter/oox/drawingfragment.cxx |    5 ++++-
 2 files changed, 7 insertions(+), 4 deletions(-)

New commits:
commit 6cfb7e63cac72fda3f353dd316e36a8609081fe1
Author:     Justin Luth <[email protected]>
AuthorDate: Wed Nov 26 12:03:00 2025 -0500
Commit:     Miklos Vajna <[email protected]>
CommitDate: Mon Dec 1 09:24:02 2025 +0100

    tdf#166724 sc: vml x:anchor provides end anchor: so ResizeWithCells
    
      <x:Anchor>  1, 80, 1, 104, 3, 41, 6, 18</x:Anchor>
    which means:
    -starting in column B offset by 80 pixels
    -            row 2 offset by 104 pixels
    -ending in column D offset by 41 pixels
    -          row 7 offset by 18 pixels.
    
    Since an ending cell position has been specified,
    that means that the size should be adjusted
    if the row or column size changes.
    
    make CppunitTest_sc_subsequent_export_test2 \
        CPPUNIT_TEST_NAME=testTdf166724_cellAnchor
    
    Change-Id: I1d2ab3162e954a6bebdcb3d40e722b2b8f322f72
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194657
    Reviewed-by: Justin Luth <[email protected]>
    Code-Style: Justin Luth <[email protected]>
    Tested-by: Jenkins
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194711
    Reviewed-by: Miklos Vajna <[email protected]>
    Tested-by: Jenkins CollaboraOffice <[email protected]>

diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index 096ab9e26b69..f88861a2e8df 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -71,15 +71,15 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, 
testTdf166724_cellAnchor)
 
     ScAnchorType anchorType = ScDrawLayer::GetAnchorType(*pPage->GetObj(0));
     // VML's x:anchor indicates cell-anchor
-    CPPUNIT_ASSERT_EQUAL(SCA_CELL, anchorType); // probably should be 
SCA_CELL_RESIZE
+    CPPUNIT_ASSERT_EQUAL(SCA_CELL_RESIZE, anchorType);
 
-    // VML's x:anchor has too large Offsets: limit to cell B3's edges.
+    // VML's x:anchor has too large Offsets: limit to cell B2's edges.
     // Without the fixes, this was X[9040] Y[10257] W[2823] H[742]
     tools::Rectangle aRect = pPage->GetObj(0)->GetSnapRect();
     CPPUNIT_ASSERT_EQUAL(tools::Long(1990), aRect.Left());
     CPPUNIT_ASSERT_EQUAL(tools::Long(1058), aRect.Top());
     CPPUNIT_ASSERT_EQUAL(tools::Long(4192), aRect.GetWidth());
-    CPPUNIT_ASSERT_EQUAL(tools::Long(560), aRect.GetHeight());
+    CPPUNIT_ASSERT_EQUAL(tools::Long(557), aRect.GetHeight());
 
     // I did not focus on (minor) round-trip concerns. Just documenting the 
current results...
     saveAndReload(TestFilter::XLSX);
diff --git a/sc/source/filter/oox/drawingfragment.cxx 
b/sc/source/filter/oox/drawingfragment.cxx
index eb9c20451560..258c87fe71a2 100644
--- a/sc/source/filter/oox/drawingfragment.cxx
+++ b/sc/source/filter/oox/drawingfragment.cxx
@@ -774,6 +774,7 @@ void VmlDrawing::notifyXShapeInserted( const Reference< 
XShape >& rxShape,
         {
             sal_Int32 nCol = -1;
             sal_Int32 nRow = -1;
+            bool bResizeWithCell = pClientData->mbSizeWithCells;
 
             if ( pClientData->mnCol >= 0 && pClientData->mnRow >= 0 )
             {
@@ -788,6 +789,8 @@ void VmlDrawing::notifyXShapeInserted( const Reference< 
XShape >& rxShape,
                 // skip LeftOffset
                 o3tl::getToken(pClientData->maAnchor, 0, ',', nIndex);
                 nRow = o3tl::toInt32(o3tl::getToken(pClientData->maAnchor, 0, 
',', nIndex));
+
+                bResizeWithCell = true;
             }
 
             if ( nCol >= 0 && nRow >= 0 )
@@ -797,7 +800,7 @@ void VmlDrawing::notifyXShapeInserted( const Reference< 
XShape >& rxShape,
                 {
                     Reference< XPropertySet > aPropertySet( rxShape, 
UNO_QUERY_THROW );
                     aPropertySet->setPropertyValue( "Anchor", Any( xCell ) );
-                    if (pClientData->mbSizeWithCells)
+                    if (bResizeWithCell)
                         aPropertySet->setPropertyValue( "ResizeWithCell", Any( 
true ) );
                 }
             }

Reply via email to