sc/qa/unit/subsequent_export_test2.cxx |    6 +++---
 sc/source/core/data/table1.cxx         |    3 +++
 2 files changed, 6 insertions(+), 3 deletions(-)

New commits:
commit bd4d0d68d4127a1323336a31ba7396713df243de
Author:     Justin Luth <[email protected]>
AuthorDate: Wed Nov 26 09:26:42 2025 -0500
Commit:     Miklos Vajna <[email protected]>
CommitDate: Mon Dec 1 09:00:37 2025 +0100

    tdf#166724 sc: update cell anchored objects if recalc optimal height
    
    The row height has changed.
    That means that any cell-anchored things needs to move
    relative to the page.
    
    SetOptimalHeightOnly is also used in conjunction with SetDrawPageSize
    commit 1e305422e1a7b23895ef964e56b36bd65812b370
    Author: Kohei Yoshida on Tue Oct 5 14:06:55 2010 -0400
        Ported calc-perf-ods-import-row-heights.diff from ooo-build.
    
        Avoid re-calculating cell note positions on every single row height
        change during import.  That makes file load take forever.
    
    That suggests this patch might have a rather negative impact
    on load times if the document has lots of anchored objects,
    although it is obviously critically necessary for cell-anchors.
    
    make CppunitTest_sc_subsequent_export_test2 \
        CPPUNIT_TEST_NAME=testTdf166724_cellAnchor
    
    Change-Id: I42d9132e76f77828637ff6563a0ad4ee7b00624d
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194370
    Reviewed-by: Justin Luth <[email protected]>
    Code-Style: Justin Luth <[email protected]>
    Tested-by: Jenkins
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/194710
    Tested-by: Jenkins CollaboraOffice <[email protected]>
    Reviewed-by: Miklos Vajna <[email protected]>

diff --git a/sc/qa/unit/subsequent_export_test2.cxx 
b/sc/qa/unit/subsequent_export_test2.cxx
index 99720149f067..096ab9e26b69 100644
--- a/sc/qa/unit/subsequent_export_test2.cxx
+++ b/sc/qa/unit/subsequent_export_test2.cxx
@@ -77,7 +77,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf166724_cellAnchor)
     // 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(3462), aRect.Top()); // really should be 
1058 (bottom of row 2)
+    CPPUNIT_ASSERT_EQUAL(tools::Long(1058), aRect.Top());
     CPPUNIT_ASSERT_EQUAL(tools::Long(4192), aRect.GetWidth());
     CPPUNIT_ASSERT_EQUAL(tools::Long(560), aRect.GetHeight());
 
@@ -93,9 +93,9 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf166724_cellAnchor)
 
     aRect = pPage->GetObj(0)->GetSnapRect();
     CPPUNIT_ASSERT_EQUAL(tools::Long(1990), aRect.Left());
-    CPPUNIT_ASSERT_EQUAL(tools::Long(3466), aRect.Top());
+    CPPUNIT_ASSERT_EQUAL(tools::Long(1058), aRect.Top());
     CPPUNIT_ASSERT_EQUAL(tools::Long(4192), aRect.GetWidth());
-    CPPUNIT_ASSERT_EQUAL(tools::Long(556), aRect.GetHeight());
+    CPPUNIT_ASSERT_EQUAL(tools::Long(557), aRect.GetHeight());
 };
 
 CPPUNIT_TEST_FIXTURE(ScExportTest2, testFreezePaneStartCellXLSX)
diff --git a/sc/source/core/data/table1.cxx b/sc/source/core/data/table1.cxx
index 2a783606dcf6..3af545fcc3a1 100644
--- a/sc/source/core/data/table1.cxx
+++ b/sc/source/core/data/table1.cxx
@@ -512,6 +512,9 @@ bool ScTable::SetOptimalHeight(
 
     if (bChanged)
     {
+        // reposition (cell) anchored items with setDrawPageSize 
ScObjectHandling::RecalcPosMode
+        SetDrawPageSize(/*ResetStreamValid=*/true, 
/*UpdateNoteCaptionPos=*/false);
+
         if (ScViewData* pViewData = ScDocShell::GetViewData())
         {
             ScTabViewShell::notifyAllViewsSheetGeomInvalidation(

Reply via email to