tdf#88443: set relative width to objects with captions except formulas
a fix to aoo issue 51453 switched off relative with to all objects
with captions to solve a problem related to formulas
now all objects with captions get relative width except math formulas
Change-Id: I39ccc292ff156c4c94a7a898a6a0602c72bbdd26
Reviewed-on: https://gerrit.libreoffice.org/20320
Reviewed-by: Oliver Specht <oliver.specht@cib.de>
Tested-by: Oliver Specht <oliver.specht@cib.de>
diff --git a/sw/source/core/doc/doclay.cxx b/sw/source/core/doc/doclay.cxx
index e05b5b63..9aa4b4a 100644
--- a/sw/source/core/doc/doclay.cxx
+++ b/sw/source/core/doc/doclay.cxx
@@ -825,7 +825,19 @@ lcl_InsertLabel(SwDoc & rDoc, SwTextFormatColls *const pTextFormatCollTable,
pNewSet->Put( SwFormatHoriOrient( 0, text::HoriOrientation::CENTER ) );
aFrameSize = pOldFormat->GetFrameSize();
aFrameSize.SetWidthPercent(0);
SwOLENode* pOleNode = rDoc.GetNodes()[nNdIdx + 1]->GetOLENode();
bool isMath = false;
if(pOleNode)
{
svt::EmbeddedObjectRef& xRef = pOleNode->GetOLEObj().GetObject();
if(xRef.is())
{
SvGlobalName aCLSID( xRef->getClassID() );
isMath = ( SotExchange::IsMath( aCLSID ) != 0 );
}
}
aFrameSize.SetWidthPercent(isMath ? 0 : 1000);
aFrameSize.SetHeightPercent(SwFormatFrameSize::SYNCED);
pNewSet->Put( aFrameSize );