summaryrefslogtreecommitdiff
path: root/svx/source/svdraw/svdotext.cxx
diff options
context:
space:
mode:
authorMiklos Vajna <vmiklos@collabora.com>2020-09-09 15:49:16 +0200
committerMiklos Vajna <vmiklos@collabora.com>2020-09-15 14:38:47 +0200
commit618b12b768eaffd40fcd98eb0ed55d0e7850b64c (patch)
tree4d94f5d4ccf973e556fe142d0194c04b45b9035a /svx/source/svdraw/svdotext.cxx
parente62432c57f21df84885553a79cb765c9fcb35cc9 (diff)
svx UNO API for shapes: allow setting a max factor for autofit text scale
This allows getting the scale factor from multiple shapes (that have text), seeing what factors they use and then setting the factor to the minimum of the values. Towards allowing both "autofit" and "same font size for these shapes" at the same time for SmartArt purposes. (cherry picked from commit 81345de4858d6e72ecb8fc6621396570f4a4ee93) Conflicts: include/svx/unoshprp.hxx Change-Id: I31a5e097c62e6e65b32956a4a32137bc3339c64c Reviewed-on: https://gerrit.libreoffice.org/c/core/+/102710 Tested-by: Jenkins Reviewed-by: Gülşah Köse <gulsah.kose@collabora.com>
Diffstat (limited to 'svx/source/svdraw/svdotext.cxx')
-rw-r--r--svx/source/svdraw/svdotext.cxx10
1 files changed, 9 insertions, 1 deletions
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index e43fdedae0cf..3c2923c9cd25 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1260,7 +1260,8 @@ void SdrTextObj::ImpAutoFitText( SdrOutliner& rOutliner ) const
IsVerticalWriting() );
}
-void SdrTextObj::ImpAutoFitText( SdrOutliner& rOutliner, const Size& rTextSize, bool bIsVerticalWriting )
+void SdrTextObj::ImpAutoFitText(SdrOutliner& rOutliner, const Size& rTextSize,
+ bool bIsVerticalWriting) const
{
// EditEngine formatting is unstable enough for
// line-breaking text that we need some more samples
@@ -1316,6 +1317,13 @@ void SdrTextObj::ImpAutoFitText( SdrOutliner& rOutliner, const Size& rTextSize,
}
}
+ const SdrTextFitToSizeTypeItem& rItem = GetObjectItem(SDRATTR_TEXT_FITTOSIZE);
+ if (rItem.GetMaxScale() > 0)
+ {
+ nMinStretchX = std::min<sal_uInt16>(rItem.GetMaxScale(), nMinStretchX);
+ nMinStretchY = std::min<sal_uInt16>(rItem.GetMaxScale(), nMinStretchY);
+ }
+
SAL_INFO("svx", "final zoom is " << nMinStretchX);
rOutliner.SetGlobalCharStretching(std::min(sal_uInt16(100),nMinStretchX),
std::min(sal_uInt16(100),nMinStretchY));