sc/qa/unit/subsequent_export_test2.cxx | 2 +- sc/source/filter/xml/XMLTableShapeImportHelper.cxx | 3 +++ sc/source/ui/unoobj/shapeuno.cxx | 2 ++ 3 files changed, 6 insertions(+), 1 deletion(-)
New commits: commit 0ec3f11bb2b66fdefba4ce46d8af15a3a48ecde1 Author: Justin Luth <[email protected]> AuthorDate: Thu Dec 18 14:52:53 2025 -0500 Commit: Miklos Vajna <[email protected]> CommitDate: Fri Dec 19 16:45:10 2025 +0100 tdf#170012 sc: never SetCellAnchored without SetNonRotatedAnchored This allows cell-anchored form controls to be round-tripped in ODS. Before this patch, they were (always?) reverting to SCA_PAGE. Either call SetCellAnchoredFromPosition, or else also explicitly call NonRotatedAnchored. Of course, I could make the one call the other, but some places already do both separately, so just make a copy/pasta routine out if it. (Otherwise, pass a 'bool bWillSetNonRotatedAnchorSeparately'.) make CppunitTest_sc_subsequent_export_test2 \ CPPUNIT_TEST_NAME=testTdf170012_cellAnchor Change-Id: Ic68bb32f059400e1617953401a71d0068decd439 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195821 Reviewed-by: Justin Luth <[email protected]> Tested-by: Jenkins Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195907 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 6d851af5e777..5f4cb0dac9ce 100644 --- a/sc/qa/unit/subsequent_export_test2.cxx +++ b/sc/qa/unit/subsequent_export_test2.cxx @@ -114,7 +114,7 @@ CPPUNIT_TEST_FIXTURE(ScExportTest2, testTdf170012_cellAnchor) pPage = getScDoc()->GetDrawLayer()->GetPage(0); anchorType = ScDrawLayer::GetAnchorType(*pPage->GetObj(0)); - CPPUNIT_ASSERT_EQUAL(SCA_PAGE, anchorType); // fallback to page anchor when invalid cell anchor + CPPUNIT_ASSERT_EQUAL(SCA_CELL_RESIZE, anchorType); } CPPUNIT_TEST_FIXTURE(ScExportTest2, testFreezePaneStartCellXLSX) diff --git a/sc/source/filter/xml/XMLTableShapeImportHelper.cxx b/sc/source/filter/xml/XMLTableShapeImportHelper.cxx index 003b84a0e488..e3a891ca7c9c 100644 --- a/sc/source/filter/xml/XMLTableShapeImportHelper.cxx +++ b/sc/source/filter/xml/XMLTableShapeImportHelper.cxx @@ -139,7 +139,10 @@ void XMLTableShapeImportHelper::finishShape( if (SdrObject* pSdrObj = SdrObject::getSdrObjectFromXShape(rShape)) { if (!bOnTable) + { ScDrawLayer::SetCellAnchored(*pSdrObj, aAnchor); + ScDrawLayer::SetNonRotatedAnchor(*pSdrObj, aAnchor); + } else ScDrawLayer::SetPageAnchored(*pSdrObj); } diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx index 1b6f1184640f..32329c102892 100644 --- a/sc/source/ui/unoobj/shapeuno.cxx +++ b/sc/source/ui/unoobj/shapeuno.cxx @@ -473,6 +473,7 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const //Currently we've only got a start anchor, not an end-anchor, so generate that now ScDrawLayer::UpdateCellAnchorFromPositionEnd(*pObj, aAnchor, *pDoc, aAddress.Sheet); ScDrawLayer::SetCellAnchored(*pObj, aAnchor); + ScDrawLayer::SetNonRotatedAnchor(*pObj, aAnchor); } } } @@ -499,6 +500,7 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const aValue >>= pDrawObjData->mbResizeWithCell; ScDrawLayer::SetCellAnchored(*pObj, *pDrawObjData); + ScDrawLayer::SetNonRotatedAnchor(*pObj, *pDrawObjData); } else if ( aPropertyName == SC_UNONAME_IMAGEMAP ) {
