Kaydet (Commit) 823c77a9 authored tarafından Samuel Mehrbrodt's avatar Samuel Mehrbrodt Kaydeden (comit) Eike Rathke

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: 's avatarEike Rathke <erack@redhat.com>
üst 68762b33
......@@ -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
......
......@@ -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"
......
......@@ -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;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment