offapi/com/sun/star/sheet/Shape.idl | 8 ++++++++ sc/inc/unonames.hxx | 1 + sc/source/ui/unoobj/shapeuno.cxx | 30 ++++++++++++++++++++++++++++++ 3 files changed, 39 insertions(+)
New commits: commit 823c77a98ffbc1c819a81687ca7e13d91277bca5 Author: Samuel Mehrbrodt <samuel.mehrbr...@cib.de> AuthorDate: Mon Apr 1 15:00:00 2019 +0200 Commit: Eike Rathke <er...@redhat.com> CommitDate: Tue Apr 2 14:57:44 2019 +0200 tdf#124329 Add API to make cell anchored graphic resize with cell Change-Id: Ib2335b1eb26e55fcfcfb964d0f3fe3dd267bdd0d Reviewed-on: https://gerrit.libreoffice.org/70067 Tested-by: Jenkins Reviewed-by: Eike Rathke <er...@redhat.com> diff --git a/offapi/com/sun/star/sheet/Shape.idl b/offapi/com/sun/star/sheet/Shape.idl index d23a004b074e..9904a49ef163 100644 --- a/offapi/com/sun/star/sheet/Shape.idl +++ b/offapi/com/sun/star/sheet/Shape.idl @@ -35,6 +35,14 @@ service Shape <p> Possible objects are XSpreadsheet and XCell.</p> */ [property] com::sun::star::uno::XInterface Anchor; + + /** If set, the shape will resize with the cell. + Only works when shape is anchored to a cell. + + @since LibreOffice 6.3 + */ + [optional, property] boolean ResizeWithCell; + /** contains the horizontal position of the object (1/100 mm). <p> The position is relative to the anchor object.</p> <p> If the underlying table layout direction is left to right diff --git a/sc/inc/unonames.hxx b/sc/inc/unonames.hxx index 1a89feb1d6ac..6fb5051ec249 100644 --- a/sc/inc/unonames.hxx +++ b/sc/inc/unonames.hxx @@ -192,6 +192,7 @@ // drawing objects #define SC_UNONAME_IMAGEMAP "ImageMap" #define SC_UNONAME_ANCHOR "Anchor" +#define SC_UNONAME_RESIZE_WITH_CELL "ResizeWithCell" #define SC_UNONAME_HORIPOS "HoriOrientPosition" #define SC_UNONAME_VERTPOS "VertOrientPosition" #define SC_UNONAME_HYPERLINK "Hyperlink" diff --git a/sc/source/ui/unoobj/shapeuno.cxx b/sc/source/ui/unoobj/shapeuno.cxx index 8c2b504964f1..af0d19eef1d1 100644 --- a/sc/source/ui/unoobj/shapeuno.cxx +++ b/sc/source/ui/unoobj/shapeuno.cxx @@ -53,6 +53,7 @@ static const SfxItemPropertyMapEntry* lcl_GetShapeMap() static const SfxItemPropertyMapEntry aShapeMap_Impl[] = { {OUString(SC_UNONAME_ANCHOR), 0, cppu::UnoType<uno::XInterface>::get(), 0, 0 }, + {OUString(SC_UNONAME_RESIZE_WITH_CELL), 0, cppu::UnoType<sal_Bool>::get(), 0, 0 }, {OUString(SC_UNONAME_HORIPOS), 0, cppu::UnoType<sal_Int32>::get(), 0, 0 }, {OUString(SC_UNONAME_IMAGEMAP), 0, cppu::UnoType<container::XIndexContainer>::get(), 0, 0 }, {OUString(SC_UNONAME_VERTPOS), 0, cppu::UnoType<sal_Int32>::get(), 0, 0 }, @@ -417,6 +418,24 @@ void SAL_CALL ScShapeObj::setPropertyValue(const OUString& aPropertyName, const } } + else if ( aPropertyName == SC_UNONAME_RESIZE_WITH_CELL ) + { + SdrObject* pObj = GetSdrObject(); + if (!pObj) + return; + ScAnchorType aAnchorType = ScDrawLayer::GetAnchorType(*pObj); + + // Nothing to do if anchored to page + if (aAnchorType == SCA_PAGE) + return; + + ScDrawObjData* pDrawObjData = ScDrawLayer::GetObjData(pObj); + if (!pDrawObjData) + return; + + aValue >>= pDrawObjData->mbResizeWithCell; + ScDrawLayer::SetCellAnchored(*pObj, *pDrawObjData); + } else if ( aPropertyName == SC_UNONAME_IMAGEMAP ) { SdrObject* pObj = GetSdrObject(); @@ -673,6 +692,17 @@ uno::Any SAL_CALL ScShapeObj::getPropertyValue( const OUString& aPropertyName ) } } } + else if (aPropertyName == SC_UNONAME_RESIZE_WITH_CELL) + { + bool bIsResizeWithCell = false; + SdrObject* pObj = GetSdrObject(); + if (pObj) + { + ScAnchorType anchorType = ScDrawLayer::GetAnchorType(*pObj); + bIsResizeWithCell = (anchorType == SCA_CELL_RESIZE); + } + aAny <<= bIsResizeWithCell; + } else if ( aPropertyName == SC_UNONAME_IMAGEMAP ) { uno::Reference< uno::XInterface > xImageMap; _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits