sc/source/ui/unoobj/shapeuno.cxx |    3 +++
 test/source/sheet/shape.cxx      |    7 +++++++
 2 files changed, 10 insertions(+)

New commits:
commit c8e1f2fb1e5576dd85a1172d064480734e21d96e
Author:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
AuthorDate: Tue Apr 2 09:14:32 2019 +0200
Commit:     Samuel Mehrbrodt <samuel.mehrbr...@cib.de>
CommitDate: Tue Apr 2 15:04:20 2019 +0200

    tdf#124329 Keep ResizeWithCell value when anchoring to a different cell
    
    Change-Id: I62010b4882268aae135a406eb27634c3335d72cf
    Reviewed-on: https://gerrit.libreoffice.org/70118
    Tested-by: Jenkins
    Reviewed-by: Samuel Mehrbrodt <samuel.mehrbr...@cib.de>

diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx
index af0d19eef1d1..592f612608fa 100644
--- a/sc/source/ui/unoobj/shapeuno.cxx
+++ b/sc/source/ui/unoobj/shapeuno.cxx
@@ -403,6 +403,9 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& 
aPropertyName, const
                                     ScDrawObjData aAnchor;
                                     aAnchor.maStart = 
ScAddress(aAddress.StartColumn, aAddress.StartRow, aAddress.Sheet);
                                     aAnchor.maStartOffset = Point(aRelPoint.X, 
aRelPoint.Y);
+                                    ScDrawObjData* pDrawObjData = 
ScDrawLayer::GetObjData(pObj);
+                                    if (pDrawObjData)
+                                        aAnchor.mbResizeWithCell = 
pDrawObjData->mbResizeWithCell;
                                     //Uno sets the Anchor in terms of the 
unrotated shape, not much we can do
                                     //about that since uno also displays the 
shape geometry in terms of the unrotated
                                     //shape. #TODO think about changing the 
anchoring behaviour here too
diff --git a/test/source/sheet/shape.cxx b/test/source/sheet/shape.cxx
index f1422f5b857a..4e1505bcf602 100644
--- a/test/source/sheet/shape.cxx
+++ b/test/source/sheet/shape.cxx
@@ -57,6 +57,13 @@ void Shape::testShapePropertiesAnchor()
     xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell;
     CPPUNIT_ASSERT_MESSAGE("Shape should resize with the cell", 
bIsResizeWithCell);
 
+    // Anchoring to a different cell should keep the "ResizeWithCell" attribute
+    uno::Reference<table::XCell> xCell2(xSheet->getCellByPosition(1, 2), 
UNO_QUERY_THROW);
+    aNewValue <<= xCell2;
+    xShape->setPropertyValue("Anchor", aNewValue);
+    xShape->getPropertyValue("ResizeWithCell") >>= bIsResizeWithCell;
+    CPPUNIT_ASSERT_MESSAGE("ResizeWithCell should still be set", 
bIsResizeWithCell);
+
     // Now anchor to sheet again
     aNewValue <<= xSheet;
     xShape->setPropertyValue("Anchor", aNewValue);
_______________________________________________
Libreoffice-commits mailing list
libreoffice-comm...@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits

Reply via email to