summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorSamuel Mehrbrodt <Samuel.Mehrbrodt@cib.de>2019-04-01 15:00:00 +0200
committerEike Rathke <erack@redhat.com>2019-04-02 14:57:44 +0200
commit823c77a98ffbc1c819a81687ca7e13d91277bca5 (patch)
treed01a4325311316bfbc8aaaa77f3001e695a51aa4 /sc
parent68762b3364fed9f0f4df66d9fc65e9b1e1507228 (diff)
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 <erack@redhat.com>
Diffstat (limited to 'sc')
-rw-r--r--sc/inc/unonames.hxx1
-rw-r--r--sc/source/ui/unoobj/shapeuno.cxx30
2 files changed, 31 insertions, 0 deletions
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;