summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/svl/solar.hrc2
-rw-r--r--include/svx/sdtfsitm.hxx13
-rw-r--r--include/svx/unoshprp.hxx16
-rw-r--r--oox/inc/drawingml/textbodyproperties.hxx1
-rw-r--r--oox/source/drawingml/diagram/diagram.cxx21
-rw-r--r--oox/source/drawingml/textbodypropertiescontext.cxx5
-rw-r--r--oox/source/token/properties.txt2
-rw-r--r--sd/qa/unit/export-tests-ooxml2.cxx16
-rw-r--r--sd/qa/unit/import-tests-smartart.cxx15
-rw-r--r--sd/qa/unit/import-tests2.cxx6
-rw-r--r--svx/source/svdraw/svdattr.cxx5
-rw-r--r--svx/source/svdraw/svdotext.cxx2
-rw-r--r--svx/source/unodraw/unoshape.cxx48
13 files changed, 101 insertions, 51 deletions
diff --git a/include/svl/solar.hrc b/include/svl/solar.hrc
index f1ec1a456829..288c3073caa0 100644
--- a/include/svl/solar.hrc
+++ b/include/svl/solar.hrc
@@ -23,7 +23,7 @@
// defines ------------------------------------------------------------------
#define OWN_ATTR_VALUE_START 3900
-#define OWN_ATTR_VALUE_END 4008
+#define OWN_ATTR_VALUE_END 4020
#define RID_LIB_START 10000
#define RID_LIB_END 19999
diff --git a/include/svx/sdtfsitm.hxx b/include/svx/sdtfsitm.hxx
index ccdcb7c4dbe9..55fe48a5fc61 100644
--- a/include/svx/sdtfsitm.hxx
+++ b/include/svx/sdtfsitm.hxx
@@ -42,7 +42,8 @@ public:
SdrTextFitToSizeTypeItem(const SdrTextFitToSizeTypeItem& rItem)
: SfxEnumItem(rItem)
- , m_nMaxScale(rItem.GetMaxScale())
+ , mfFontScale(rItem.getFontScale())
+ , mfSpacingScale(rItem.getSpacingScale())
{
}
@@ -59,10 +60,14 @@ public:
virtual bool GetBoolValue() const override;
virtual void SetBoolValue(bool bVal) override;
- void SetMaxScale(double nMaxScale) { m_nMaxScale = nMaxScale; }
- double GetMaxScale() const { return m_nMaxScale; }
+ void setFontScale(double fScale) { mfFontScale = fScale; }
+ double getFontScale() const { return mfFontScale; }
+
+ void setSpacingScale(double fScale) { mfSpacingScale = fScale; }
+ double getSpacingScale() const { return mfSpacingScale; }
private:
- double m_nMaxScale = 0.0;
+ double mfFontScale = 0.0;
+ double mfSpacingScale = 0.0;
};
#endif
diff --git a/include/svx/unoshprp.hxx b/include/svx/unoshprp.hxx
index 53561015804b..b5e37ede384d 100644
--- a/include/svx/unoshprp.hxx
+++ b/include/svx/unoshprp.hxx
@@ -193,11 +193,14 @@
#define OWN_ATTR_SIGNATURELINE_UNSIGNED_IMAGE (OWN_ATTR_VALUE_START+102)
#define OWN_ATTR_SIGNATURELINE_IS_SIGNED (OWN_ATTR_VALUE_START+103)
#define OWN_ATTR_QRCODE (OWN_ATTR_VALUE_START+104)
-#define OWN_ATTR_TEXTFITTOSIZESCALE (OWN_ATTR_VALUE_START+105)
-#define OWN_ATTR_TEXTCOLUMNS (OWN_ATTR_VALUE_START+106)
-#define OWN_ATTR_HYPERLINK (OWN_ATTR_VALUE_START+107)
-#define OWN_ATTR_MISC_OBJ_DECORATIVE (OWN_ATTR_VALUE_START+108)
-// ATTENTION: current maximum is OWN_ATTR_VALUE_START+108 svx; when adding values, update
+#define OWN_ATTR_TEXTFITTOSIZE_FONT_SCALE (OWN_ATTR_VALUE_START+105)
+#define OWN_ATTR_TEXTFITTOSIZE_SPACING_SCALE (OWN_ATTR_VALUE_START+106)
+#define OWN_ATTR_TEXTCOLUMNS (OWN_ATTR_VALUE_START+107)
+#define OWN_ATTR_HYPERLINK (OWN_ATTR_VALUE_START+108)
+#define OWN_ATTR_MISC_OBJ_DECORATIVE (OWN_ATTR_VALUE_START+109)
+
+// ATTENTION: current maximum is OWN_ATTR_VALUE_START+120 svx; when adding values, update
+
// OWN_ATTR_VALUE_END in include/svl/solar.hrc accordingly
// #FontWork#
@@ -366,7 +369,8 @@
{ UNO_NAME_MISC_OBJ_SIZEPROTECT, SDRATTR_OBJSIZEPROTECT , cppu::UnoType<bool>::get(), 0, 0},\
{ u"UINameSingular"_ustr, OWN_ATTR_UINAME_SINGULAR , ::cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY, 0}, \
{ u"UINamePlural"_ustr, OWN_ATTR_UINAME_PLURAL , ::cppu::UnoType<OUString>::get(), css::beans::PropertyAttribute::READONLY, 0}, \
- { u"TextFitToSizeScale"_ustr, OWN_ATTR_TEXTFITTOSIZESCALE, ::cppu::UnoType<double>::get(), 0, 0}, \
+ { u"TextFitToSizeFontScale"_ustr, OWN_ATTR_TEXTFITTOSIZE_FONT_SCALE, ::cppu::UnoType<double>::get(), 0, 0}, \
+ { u"TextFitToSizeSpacingScale"_ustr, OWN_ATTR_TEXTFITTOSIZE_SPACING_SCALE, ::cppu::UnoType<double>::get(), 0, 0}, \
/* #i68101# */ \
{ UNO_NAME_MISC_OBJ_TITLE, OWN_ATTR_MISC_OBJ_TITLE , ::cppu::UnoType<OUString>::get(), 0, 0}, \
{ UNO_NAME_MISC_OBJ_DESCRIPTION, OWN_ATTR_MISC_OBJ_DESCRIPTION , ::cppu::UnoType<OUString>::get(), 0, 0}, \
diff --git a/oox/inc/drawingml/textbodyproperties.hxx b/oox/inc/drawingml/textbodyproperties.hxx
index d935f940638d..46cf99614c56 100644
--- a/oox/inc/drawingml/textbodyproperties.hxx
+++ b/oox/inc/drawingml/textbodyproperties.hxx
@@ -50,6 +50,7 @@ struct TextBodyProperties
OUString msPrst;
/// Normal autofit: font scale (default: 100%).
sal_Int32 mnFontScale = 100000;
+ sal_Int32 mnSpacingScale = 100000;
OUString msHorzOverflow;
std::optional< sal_Int32 > moVertOverflow{};
diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx
index 029c2c56e962..f63185549c23 100644
--- a/oox/source/drawingml/diagram/diagram.cxx
+++ b/oox/source/drawingml/diagram/diagram.cxx
@@ -185,30 +185,37 @@ void Diagram::syncDiagramFontHeights()
{
// Find out the minimum scale within this group.
const ShapePairs& rShapePairs = rNameAndPairs.second;
- double nMinScale = 100.0;
+ double fMinFontScale = 100.0;
+ double fMinSpacingScale = 100.0;
for (const auto& rShapePair : rShapePairs)
{
uno::Reference<beans::XPropertySet> xPropertySet(rShapePair.second, uno::UNO_QUERY);
if (xPropertySet.is())
{
- double nTextFitToSizeScale = 0.0;
- xPropertySet->getPropertyValue("TextFitToSizeScale") >>= nTextFitToSizeScale;
- if (nTextFitToSizeScale > 0 && nTextFitToSizeScale < nMinScale)
+ double fFontScale = 0.0;
+ double fSpacingScale = 0.0;
+ xPropertySet->getPropertyValue("TextFitToSizeFontScale") >>= fFontScale;
+ xPropertySet->getPropertyValue("TextFitToSizeSpacingScale") >>= fSpacingScale;
+
+ if (fFontScale > 0 && fSpacingScale > 0
+ && (fFontScale < fMinFontScale || (fFontScale == fMinFontScale && fSpacingScale < fMinSpacingScale)))
{
- nMinScale = nTextFitToSizeScale;
+ fMinFontScale = fFontScale;
+ fMinSpacingScale = fSpacingScale;
}
}
}
// Set that minimum scale for all members of the group.
- if (nMinScale < 100.0)
+ if (fMinFontScale < 100.0 || fMinSpacingScale < 100.0)
{
for (const auto& rShapePair : rShapePairs)
{
uno::Reference<beans::XPropertySet> xPropertySet(rShapePair.second, uno::UNO_QUERY);
if (xPropertySet.is())
{
- xPropertySet->setPropertyValue("TextFitToSizeScale", uno::Any(nMinScale));
+ xPropertySet->setPropertyValue("TextFitToSizeFontScale", uno::Any(fMinFontScale));
+ xPropertySet->setPropertyValue("TextFitToSizeSpacingScale", uno::Any(fMinSpacingScale));
}
}
}
diff --git a/oox/source/drawingml/textbodypropertiescontext.cxx b/oox/source/drawingml/textbodypropertiescontext.cxx
index 46576c069c8e..8109e814b513 100644
--- a/oox/source/drawingml/textbodypropertiescontext.cxx
+++ b/oox/source/drawingml/textbodypropertiescontext.cxx
@@ -232,8 +232,11 @@ ContextHandlerRef TextBodyPropertiesContext::onCreateContext( sal_Int32 aElement
case A_TOKEN( normAutofit ): // CT_TextNormalAutofit
{
mrTextBodyProp.maPropertyMap.setProperty( PROP_TextFitToSize, TextFitToSizeType_AUTOFIT);
- mrTextBodyProp.maPropertyMap.setProperty( PROP_TextAutoGrowHeight, false);
+ mrTextBodyProp.maPropertyMap.setProperty(PROP_TextAutoGrowHeight, false);
mrTextBodyProp.mnFontScale = rAttribs.getInteger(XML_fontScale, 100000);
+ mrTextBodyProp.mnSpacingScale = rAttribs.getInteger(XML_lnSpcReduction, 100000);
+ mrTextBodyProp.maPropertyMap.setProperty(PROP_TextFitToSizeFontScale, double(mrTextBodyProp.mnFontScale) / 1000.0);
+ mrTextBodyProp.maPropertyMap.setProperty(PROP_TextFitToSizeSpacingScale, 100.0 - double(mrTextBodyProp.mnSpacingScale) / 1000.0);
break;
}
case A_TOKEN( spAutoFit ):
diff --git a/oox/source/token/properties.txt b/oox/source/token/properties.txt
index b6fa29c090fe..722d6e75e7cf 100644
--- a/oox/source/token/properties.txt
+++ b/oox/source/token/properties.txt
@@ -561,6 +561,8 @@ TextColor
TextColumns
TextContourFrame
TextFitToSize
+TextFitToSizeFontScale
+TextFitToSizeSpacingScale
TextFrames
TextHorizontalAdjust
TextLeftDistance
diff --git a/sd/qa/unit/export-tests-ooxml2.cxx b/sd/qa/unit/export-tests-ooxml2.cxx
index 4498f66bf03a..de274bacb1c5 100644
--- a/sd/qa/unit/export-tests-ooxml2.cxx
+++ b/sd/qa/unit/export-tests-ooxml2.cxx
@@ -1884,10 +1884,10 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTextColumns_3columns)
CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(300)),
xColProps->getPropertyValue("AutomaticDistance"));
// Scale value may be unstable; just test that the text is actually scaled
- double fScale;
- CPPUNIT_ASSERT(xProps->getPropertyValue("TextFitToSizeScale") >>= fScale);
- CPPUNIT_ASSERT_GREATER(0.0, fScale);
- CPPUNIT_ASSERT_LESS(100.0, fScale);
+ double fFontScale;
+ CPPUNIT_ASSERT(xProps->getPropertyValue("TextFitToSizeFontScale") >>= fFontScale);
+ CPPUNIT_ASSERT_GREATER(0.0, fFontScale);
+ CPPUNIT_ASSERT_LESS(100.0, fFontScale);
}
save("Impress Office Open XML");
@@ -1904,10 +1904,10 @@ CPPUNIT_TEST_FIXTURE(SdOOXMLExportTest2, testTextColumns_3columns)
CPPUNIT_ASSERT_EQUAL(uno::Any(sal_Int32(300)),
xColProps->getPropertyValue("AutomaticDistance"));
// Scale value may be unstable; just test that the text is actually scaled
- double fScale;
- CPPUNIT_ASSERT(xProps->getPropertyValue("TextFitToSizeScale") >>= fScale);
- CPPUNIT_ASSERT_GREATER(0.0, fScale);
- CPPUNIT_ASSERT_LESS(100.0, fScale);
+ double fFontScale;
+ CPPUNIT_ASSERT(xProps->getPropertyValue("TextFitToSizeFontScale") >>= fFontScale);
+ CPPUNIT_ASSERT_GREATER(0.0, fFontScale);
+ CPPUNIT_ASSERT_LESS(100.0, fFontScale);
}
xmlDocUniquePtr pXmlDocRels = parseExport("ppt/slides/slide1.xml");
diff --git a/sd/qa/unit/import-tests-smartart.cxx b/sd/qa/unit/import-tests-smartart.cxx
index 2382ed4a9f22..f83d28a7922b 100644
--- a/sd/qa/unit/import-tests-smartart.cxx
+++ b/sd/qa/unit/import-tests-smartart.cxx
@@ -1527,21 +1527,22 @@ CPPUNIT_TEST_FIXTURE(SdImportTestSmartArt, testAutofitSync)
uno::Reference<drawing::XShape> xMiddle = getChildShape(xDiagram, 2);
uno::Reference<beans::XPropertySet> xFirstInner(getChildShape(getChildShape(xMiddle, 0), 0),
uno::UNO_QUERY);
- double nFirstScale = 0;
- CPPUNIT_ASSERT(xFirstInner->getPropertyValue("TextFitToSizeScale") >>= nFirstScale);
- CPPUNIT_ASSERT_GREATER(0.0, nFirstScale);
- CPPUNIT_ASSERT_LESS(100.0, nFirstScale);
+ double fFirstScale = 0;
+ CPPUNIT_ASSERT(xFirstInner->getPropertyValue("TextFitToSizeFontScale") >>= fFirstScale);
+ CPPUNIT_ASSERT_GREATER(0.0, fFirstScale);
+ CPPUNIT_ASSERT_LESS(100.0, fFirstScale);
+
uno::Reference<beans::XPropertySet> xSecondInner(getChildShape(getChildShape(xMiddle, 2), 0),
uno::UNO_QUERY);
- double nSecondScale = 0;
- CPPUNIT_ASSERT(xSecondInner->getPropertyValue("TextFitToSizeScale") >>= nSecondScale);
+ double fSecondScale = 0;
+ CPPUNIT_ASSERT(xSecondInner->getPropertyValue("TextFitToSizeFontScale") >>= fSecondScale);
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 56
// - Actual : 100
// i.e. the left shape had no scale-down and the right shape was scaled down, even if it was
// requested that their scaling matches.
- CPPUNIT_ASSERT_EQUAL(nSecondScale, nFirstScale);
+ CPPUNIT_ASSERT_EQUAL(fSecondScale, fFirstScale);
// Without the accompanying fix in place, this test would have failed with:
// - Expected: 0 (drawing::TextFitToSizeType_NONE)
diff --git a/sd/qa/unit/import-tests2.cxx b/sd/qa/unit/import-tests2.cxx
index ac730a24d6bf..0224d01032be 100644
--- a/sd/qa/unit/import-tests2.cxx
+++ b/sd/qa/unit/import-tests2.cxx
@@ -1344,9 +1344,9 @@ CPPUNIT_TEST_FIXTURE(SdImportTest2, testTdf120028)
xPropSet->getPropertyValue("CharHeight") >>= fCharHeight;
CPPUNIT_ASSERT_DOUBLES_EQUAL(13.5, fCharHeight, 1E-12);
- double fTextSclale = 0.0;
- xShape->getPropertyValue("TextFitToSizeScale") >>= fTextSclale;
- CPPUNIT_ASSERT_DOUBLES_EQUAL(92.0, fTextSclale, 1E1);
+ double fFontScale = 0.0;
+ xShape->getPropertyValue("TextFitToSizeFontScale") >>= fFontScale;
+ CPPUNIT_ASSERT_DOUBLES_EQUAL(92.0, fFontScale, 1E1);
}
CPPUNIT_TEST_FIXTURE(SdImportTest2, testDescriptionImport)
diff --git a/svx/source/svdraw/svdattr.cxx b/svx/source/svdraw/svdattr.cxx
index c518900e6f03..14d5acb356ea 100644
--- a/svx/source/svdraw/svdattr.cxx
+++ b/svx/source/svdraw/svdattr.cxx
@@ -1021,8 +1021,9 @@ bool SdrTextFitToSizeTypeItem::operator==(const SfxPoolItem& rItem) const
{
return false;
}
-
- return m_nMaxScale == static_cast<const SdrTextFitToSizeTypeItem&>(rItem).m_nMaxScale;
+ auto& rTextFitToSizeTypeItem = static_cast<const SdrTextFitToSizeTypeItem&>(rItem);
+ return mfFontScale == rTextFitToSizeTypeItem.mfFontScale
+ && mfSpacingScale == rTextFitToSizeTypeItem.mfSpacingScale;
}
sal_uInt16 SdrTextFitToSizeTypeItem::GetValueCount() const { return 4; }
diff --git a/svx/source/svdraw/svdotext.cxx b/svx/source/svdraw/svdotext.cxx
index 2193369fac82..0f25ce9095a1 100644
--- a/svx/source/svdraw/svdotext.cxx
+++ b/svx/source/svdraw/svdotext.cxx
@@ -1276,7 +1276,7 @@ void SdrTextObj::autoFitTextForCompatibility(SdrOutliner& rOutliner, const Size&
rOutliner.setRoundFontSizeToPt(true);
const SdrTextFitToSizeTypeItem& rItem = GetObjectItem(SDRATTR_TEXT_FITTOSIZE);
- double fMaxScale = rItem.GetMaxScale();
+ double fMaxScale = rItem.getFontScale();
if (fMaxScale > 0.0)
{
rOutliner.setScalingParameters({ fMaxScale, fMaxScale, 100.0, 100.0 });
diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx
index b6ef17b86616..6ed78fd17fe5 100644
--- a/svx/source/unodraw/unoshape.cxx
+++ b/svx/source/unodraw/unoshape.cxx
@@ -139,22 +139,22 @@ namespace {
/// Calculates what scaling factor will be used for autofit text scaling of this shape.
-double GetTextFitToSizeScale(SdrObject* pObject)
+SdrTextObj* getTextObjectWithFitToSize(SdrObject* pObject)
{
SdrTextObj* pTextObj = DynCastSdrTextObj(pObject);
if (!pTextObj)
{
- return 0;
+ return nullptr;
}
const SfxItemSet& rTextObjSet = pTextObj->GetMergedItemSet();
if (rTextObjSet.GetItem<SdrTextFitToSizeTypeItem>(SDRATTR_TEXT_FITTOSIZE)->GetValue()
!= drawing::TextFitToSizeType_AUTOFIT)
{
- return 0;
+ return nullptr;
}
- return pTextObj->GetFontScale();
+ return pTextObj;
}
}
@@ -2332,13 +2332,26 @@ bool SvxShape::setPropertyValueImpl( const OUString&, const SfxItemPropertyMapEn
break;
}
- case OWN_ATTR_TEXTFITTOSIZESCALE:
+ case OWN_ATTR_TEXTFITTOSIZE_FONT_SCALE:
{
- double nMaxScale = 0.0;
- if (rValue >>= nMaxScale)
+ double fScale = 0.0;
+ if (rValue >>= fScale)
{
SdrTextFitToSizeTypeItem aItem(pSdrObject->GetMergedItem(SDRATTR_TEXT_FITTOSIZE));
- aItem.SetMaxScale(nMaxScale);
+ aItem.setFontScale(fScale);
+ pSdrObject->SetMergedItem(aItem);
+ return true;
+ }
+ break;
+ }
+
+ case OWN_ATTR_TEXTFITTOSIZE_SPACING_SCALE:
+ {
+ double fScale = 0.0;
+ if (rValue >>= fScale)
+ {
+ SdrTextFitToSizeTypeItem aItem(pSdrObject->GetMergedItem(SDRATTR_TEXT_FITTOSIZE));
+ aItem.setSpacingScale(fScale);
pSdrObject->SetMergedItem(aItem);
return true;
}
@@ -2859,10 +2872,23 @@ bool SvxShape::getPropertyValueImpl( const OUString&, const SfxItemPropertyMapEn
break;
}
- case OWN_ATTR_TEXTFITTOSIZESCALE:
+ case OWN_ATTR_TEXTFITTOSIZE_FONT_SCALE:
{
- double nScale = GetTextFitToSizeScale(GetSdrObject());
- rValue <<= nScale;
+ auto* pTextObject = getTextObjectWithFitToSize(GetSdrObject());
+ if (pTextObject)
+ {
+ rValue <<= pTextObject->GetFontScale();
+ }
+ break;
+ }
+
+ case OWN_ATTR_TEXTFITTOSIZE_SPACING_SCALE:
+ {
+ auto* pTextObject = getTextObjectWithFitToSize(GetSdrObject());
+ if (pTextObject)
+ {
+ rValue <<= pTextObject->GetSpacingScale();
+ }
break;
}