summaryrefslogtreecommitdiff
path: root/oox/source
diff options
context:
space:
mode:
Diffstat (limited to 'oox/source')
-rw-r--r--oox/source/drawingml/diagram/diagram.cxx6
-rw-r--r--oox/source/drawingml/textbody.cxx4
-rw-r--r--oox/source/drawingml/textparagraph.cxx4
-rw-r--r--oox/source/drawingml/textparagraphproperties.cxx10
-rw-r--r--oox/source/export/drawingml.cxx45
5 files changed, 28 insertions, 41 deletions
diff --git a/oox/source/drawingml/diagram/diagram.cxx b/oox/source/drawingml/diagram/diagram.cxx
index efba958fa0e4..7927b7aa6945 100644
--- a/oox/source/drawingml/diagram/diagram.cxx
+++ b/oox/source/drawingml/diagram/diagram.cxx
@@ -186,13 +186,13 @@ void Diagram::syncDiagramFontHeights()
{
// Find out the minimum scale within this group.
const ShapePairs& rShapePairs = rNameAndPairs.second;
- sal_Int16 nMinScale = 100;
+ double nMinScale = 100.0;
for (const auto& rShapePair : rShapePairs)
{
uno::Reference<beans::XPropertySet> xPropertySet(rShapePair.second, uno::UNO_QUERY);
if (xPropertySet.is())
{
- sal_Int16 nTextFitToSizeScale = 0;
+ double nTextFitToSizeScale = 0.0;
xPropertySet->getPropertyValue("TextFitToSizeScale") >>= nTextFitToSizeScale;
if (nTextFitToSizeScale > 0 && nTextFitToSizeScale < nMinScale)
{
@@ -202,7 +202,7 @@ void Diagram::syncDiagramFontHeights()
}
// Set that minimum scale for all members of the group.
- if (nMinScale < 100)
+ if (nMinScale < 100.0)
{
for (const auto& rShapePair : rShapePairs)
{
diff --git a/oox/source/drawingml/textbody.cxx b/oox/source/drawingml/textbody.cxx
index 1be15c4f885d..266ff44b22f9 100644
--- a/oox/source/drawingml/textbody.cxx
+++ b/oox/source/drawingml/textbody.cxx
@@ -65,7 +65,7 @@ void TextBody::insertAt(
for (auto const& paragraph : maParagraphs)
{
paragraph->insertAt(rFilterBase, xText, xAt, rTextStyleProperties, aMasterTextStyle,
- maTextListStyle, (nIndex == 0), nCharHeight, getTextProperties().mnFontScale);
+ maTextListStyle, (nIndex == 0), nCharHeight);
++nIndex;
}
}
@@ -149,7 +149,7 @@ void TextBody::ApplyStyleEmpty(
TextParagraphProperties aParaProp;
aParaProp.apply(*pTextParagraphStyle);
aParaProp.pushToPropSet(&rFilterBase, xProps, aioBulletList, &pTextParagraphStyle->getBulletList(),
- true, nCharHeight, getTextProperties().mnFontScale, true);
+ true, nCharHeight, true);
}
}
diff --git a/oox/source/drawingml/textparagraph.cxx b/oox/source/drawingml/textparagraph.cxx
index f08efdbff3c3..e33cbb690ee9 100644
--- a/oox/source/drawingml/textparagraph.cxx
+++ b/oox/source/drawingml/textparagraph.cxx
@@ -88,7 +88,7 @@ void TextParagraph::insertAt(
const TextCharacterProperties& rTextStyleProperties,
const TextListStyle& rMasterTextListStyle,
const TextListStyle& rTextListStyle, bool bFirst,
- float nDefaultCharHeight, sal_Int32 nAutofitFontScale) const
+ float nDefaultCharHeight) const
{
try {
sal_Int32 nParagraphSize = 0;
@@ -176,7 +176,7 @@ void TextParagraph::insertAt(
}
float fCharacterSize = nCharHeight > 0 ? GetFontHeight ( nCharHeight ) : pTextParagraphStyle->getCharHeightPoints( 12 );
- aParaProp.pushToPropSet( &rFilterBase, xProps, aioBulletList, &pTextParagraphStyle->getBulletList(), true, fCharacterSize, nAutofitFontScale, true );
+ aParaProp.pushToPropSet( &rFilterBase, xProps, aioBulletList, &pTextParagraphStyle->getBulletList(), true, fCharacterSize, true );
}
// empty paragraphs do not have bullets in ppt
diff --git a/oox/source/drawingml/textparagraphproperties.cxx b/oox/source/drawingml/textparagraphproperties.cxx
index af65e0037d16..8122c4e53324 100644
--- a/oox/source/drawingml/textparagraphproperties.cxx
+++ b/oox/source/drawingml/textparagraphproperties.cxx
@@ -407,7 +407,7 @@ void TextParagraphProperties::apply( const TextParagraphProperties& rSourceProps
void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* pFilterBase,
const Reference < XPropertySet >& xPropSet, PropertyMap& rioBulletMap, const BulletList* pMasterBuList, bool bApplyBulletMap, float fCharacterSize,
- sal_Int32 nAutofitFontScale, bool bPushDefaultValues ) const
+ bool bPushDefaultValues ) const
{
PropertySet aPropSet( xPropSet );
aPropSet.setProperties( maTextParagraphPropertyMap );
@@ -433,14 +433,6 @@ void TextParagraphProperties::pushToPropSet( const ::oox::core::XmlFilterBase* p
std::optional< sal_Int32 > noParaLeftMargin( moParaLeftMargin );
std::optional< sal_Int32 > noFirstLineIndentation( moFirstLineIndentation );
- // tdf#149961 Impress scales the indents when text is autofitted while Powerpoint doesn't
- // Try to counteract this by multiplying indents by the inverse of the autofit font scale.
- if ( nAutofitFontScale )
- {
- if ( noParaLeftMargin ) noParaLeftMargin = *noParaLeftMargin * MAX_PERCENT / nAutofitFontScale;
- if ( noFirstLineIndentation ) noFirstLineIndentation = *noFirstLineIndentation * MAX_PERCENT / nAutofitFontScale;
- }
-
if ( nNumberingType != NumberingType::NUMBER_NONE )
{
if ( noParaLeftMargin )
diff --git a/oox/source/export/drawingml.cxx b/oox/source/export/drawingml.cxx
index 5335dca58486..d610435d0eb2 100644
--- a/oox/source/export/drawingml.cxx
+++ b/oox/source/export/drawingml.cxx
@@ -3200,7 +3200,7 @@ void DrawingML::WriteLinespacing(const LineSpacing& rSpacing, float fFirstCharHe
}
}
-bool DrawingML::WriteParagraphProperties(const Reference<XTextContent>& rParagraph, const Reference<XPropertySet>& rXShapePropSet, float fFirstCharHeight, sal_Int32 nElement)
+bool DrawingML::WriteParagraphProperties(const Reference<XTextContent>& rParagraph, float fFirstCharHeight, sal_Int32 nElement)
{
Reference< XPropertySet > rXPropSet( rParagraph, UNO_QUERY );
Reference< XPropertyState > rXPropState( rParagraph, UNO_QUERY );
@@ -3294,24 +3294,6 @@ bool DrawingML::WriteParagraphProperties(const Reference<XTextContent>& rParagra
if (GetProperty(rXPropSet, "ParaTabStopDefaultDistance"))
mAny >>= nParaDefaultTabSize;
- // for autofitted textboxes, scale the indents
- if (GetProperty(rXShapePropSet, "TextFitToSize") && mAny.get<TextFitToSizeType>() == TextFitToSizeType_AUTOFIT)
- {
- SvxShapeText* pTextShape = dynamic_cast<SvxShapeText*>(rXShapePropSet.get());
- if (pTextShape)
- {
- SdrTextObj* pTextObject = DynCastSdrTextObj(pTextShape->GetSdrObject());
- if (pTextObject)
- {
- const auto nFontScaleY = pTextObject->GetFontScaleY();
- nLeftMargin = nLeftMargin * nFontScaleY / 100;
- nLineIndentation = nLineIndentation * nFontScaleY / 100;
- nParaLeftMargin = nParaLeftMargin * nFontScaleY / 100;
- nParaFirstLineIndent = nParaFirstLineIndent * nFontScaleY / 100;
- }
- }
- }
-
if (nParaLeftMargin) // For Paragraph
mpFS->startElementNS( XML_a, nElement,
XML_lvl, sax_fastparser::UseIf(OString::number(nLevel), nLevel > 0),
@@ -3401,7 +3383,7 @@ void DrawingML::WriteLstStyles(const css::uno::Reference<css::text::XTextContent
fFirstCharHeight = xFirstRunPropSet->getPropertyValue("CharHeight").get<float>();
mpFS->startElementNS(XML_a, XML_lstStyle);
- if( !WriteParagraphProperties(rParagraph, rXShapePropSet, fFirstCharHeight, XML_lvl1pPr) )
+ if( !WriteParagraphProperties(rParagraph, fFirstCharHeight, XML_lvl1pPr) )
mpFS->startElementNS(XML_a, XML_lvl1pPr);
WriteRunProperties(xFirstRunPropSet, false, XML_defRPr, true, rbOverridingCharHeight,
rnCharHeight, GetScriptType(rRun->getString()), rXShapePropSet);
@@ -3443,7 +3425,7 @@ void DrawingML::WriteParagraph( const Reference< XTextContent >& rParagraph,
rnCharHeight = 100 * fFirstCharHeight;
rbOverridingCharHeight = true;
}
- WriteParagraphProperties(rParagraph, rXShapePropSet, fFirstCharHeight, XML_pPr);
+ WriteParagraphProperties(rParagraph, fFirstCharHeight, XML_pPr);
bPropertiesWritten = true;
}
WriteRun( run, rbOverridingCharHeight, rnCharHeight, rXShapePropSet);
@@ -3994,16 +3976,29 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo
{
const sal_Int32 MAX_SCALE_VAL = 100000;
sal_Int32 nFontScale = MAX_SCALE_VAL;
+ sal_Int32 nSpacingReduction = 0;
SvxShapeText* pTextShape = dynamic_cast<SvxShapeText*>(rXIface.get());
if (pTextShape)
{
SdrTextObj* pTextObject = DynCastSdrTextObj(pTextShape->GetSdrObject());
if (pTextObject)
- nFontScale = pTextObject->GetFontScaleY() * 1000;
+ {
+ nFontScale = sal_Int32(pTextObject->GetFontScale() * 1000.0);
+ nSpacingReduction = sal_Int32((100.0 - pTextObject->GetSpacingScale()) * 1000.0);
+ }
}
- mpFS->singleElementNS(XML_a, XML_normAutofit, XML_fontScale,
- sax_fastparser::UseIf(OString::number(nFontScale), nFontScale < MAX_SCALE_VAL && nFontScale > 0));
+ bool bExportFontScale = false;
+ if (nFontScale < MAX_SCALE_VAL && nFontScale > 0)
+ bExportFontScale = true;
+
+ bool bExportSpaceReduction = false;
+ if (nSpacingReduction < MAX_SCALE_VAL && nSpacingReduction > 0)
+ bExportSpaceReduction = true;
+
+ mpFS->singleElementNS(XML_a, XML_normAutofit,
+ XML_fontScale, sax_fastparser::UseIf(OString::number(nFontScale), bExportFontScale),
+ XML_lnSpcReduction, sax_fastparser::UseIf(OString::number(nSpacingReduction), bExportSpaceReduction));
}
else
{
@@ -4091,7 +4086,7 @@ void DrawingML::WriteText(const Reference<XInterface>& rXIface, bool bBodyPr, bo
if( aAny >>= xParagraph )
{
mpFS->startElementNS(XML_a, XML_p);
- WriteParagraphProperties(xParagraph, rXPropSet, nCharHeight, XML_pPr);
+ WriteParagraphProperties(xParagraph, nCharHeight, XML_pPr);
sal_Int16 nDummy = -1;
WriteRunProperties(rXPropSet, false, XML_endParaRPr, false,
bOverridingCharHeight, nCharHeight, nDummy, rXPropSet);