summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorMike Kaganski <mike.kaganski@collabora.com>2015-09-27 22:46:11 +1000
committerMichael Meeks <michael.meeks@collabora.com>2016-03-19 11:51:06 +0000
commit5ca1f04976930c6fd656ebf89d667c80e2466897 (patch)
treeaf2c86dda10482a3e3bcc679090c09f38dbbf395 /filter
parent0eea1465a06119903fca5f5b6dfe5b05a80546ba (diff)
tdf#93124: Fix incorrect text fit in imported PPT
To make text adjustment to full width, the alignment optimizations had to be removed, and bAutoFit was removed, too. Allso, to fix tdf#41245 again, the SDRTEXTFIT_AUTOFIT that is set in SdStyleSheetPool::CreateLayoutStyleSheets had to be overridden. I touch the following commits: http://cgit.freedesktop.org/libreoffice/core/commit/?id=d2000efb31f864e912c6cf52760eea0e602b6893 http://cgit.freedesktop.org/libreoffice/core/commit/?id=3550256daa5451c1d51d220d5489c1b20150c374 http://cgit.freedesktop.org/libreoffice/core/commit/?id=812aff65ad0661fed9687a429c763dc8f2144a0c Change-Id: I7f7934e2982baf0240c740e09fcb9bd348079064 Reviewed-on: https://gerrit.libreoffice.org/18895 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Michael Meeks <michael.meeks@collabora.com> Tested-by: Michael Meeks <michael.meeks@collabora.com>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/msfilter/svdfppt.cxx126
1 files changed, 36 insertions, 90 deletions
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index ebea1c297280..7765dac96aeb 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -893,31 +893,6 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
eTHA = SDRTEXTHORZADJUST_LEFT;
break;
}
- // if there is a 100% use of following attributes, the textbox can been aligned also in vertical direction
- switch ( eTextAnchor )
- {
- case mso_anchorTopCentered :
- case mso_anchorMiddleCentered :
- case mso_anchorBottomCentered :
- case mso_anchorTopCenteredBaseline:
- case mso_anchorBottomCenteredBaseline:
- {
- // check if it is sensible to use the centered alignment
- sal_uInt32 nMask = PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT;
- if ( ( nTextFlags & nMask ) != nMask ) // if the textobject has left and also right aligned pararagraphs
- eTVA = SDRTEXTVERTADJUST_CENTER; // the text has to be displayed using the full width;
- }
- break;
-
- default :
- {
- if ( nTextFlags == PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT )
- eTVA = SDRTEXTVERTADJUST_TOP;
- else if ( nTextFlags == PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT )
- eTVA = SDRTEXTVERTADJUST_BOTTOM;
- }
- break;
- }
nMinFrameWidth = rTextRect.GetWidth() - ( nTextLeft + nTextRight );
}
else
@@ -949,31 +924,6 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
eTVA = SDRTEXTVERTADJUST_BOTTOM;
break;
}
- // if there is a 100% usage of following attributes, the textbox can be aligned also in horizontal direction
- switch ( eTextAnchor )
- {
- case mso_anchorTopCentered :
- case mso_anchorMiddleCentered :
- case mso_anchorBottomCentered :
- case mso_anchorTopCenteredBaseline:
- case mso_anchorBottomCenteredBaseline:
- {
- // check if it is sensible to use the centered alignment
- sal_uInt32 nMask = PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT;
- if ( ( nTextFlags & nMask ) != nMask ) // if the textobject has left and also right aligned pararagraphs
- eTHA = SDRTEXTHORZADJUST_CENTER; // the text has to be displayed using the full width;
- }
- break;
-
- default :
- {
- if ( nTextFlags == PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT )
- eTHA = SDRTEXTHORZADJUST_LEFT;
- else if ( nTextFlags == PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT )
- eTHA = SDRTEXTHORZADJUST_RIGHT;
- }
- break;
- }
nMinFrameHeight = rTextRect.GetHeight() - ( nTextTop + nTextBottom );
}
@@ -1021,7 +971,6 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
}
aTextObj.SetDestinationInstance( (sal_uInt16)nDestinationInstance );
- bool bAutoFit = false; // auto-scale text into shape box
switch ( aTextObj.GetInstance() )
{
case TSS_TYPE_PAGETITLE :
@@ -1029,7 +978,7 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
case TSS_TYPE_SUBTITLE : eTextKind = OBJ_TEXT; break;
case TSS_TYPE_BODY :
case TSS_TYPE_HALFBODY :
- case TSS_TYPE_QUARTERBODY : eTextKind = OBJ_OUTLINETEXT; bAutoFit = true; break;
+ case TSS_TYPE_QUARTERBODY : eTextKind = OBJ_OUTLINETEXT; break;
}
if ( aTextObj.GetDestinationInstance() != TSS_TYPE_TEXT_IN_SHAPE )
{
@@ -1088,47 +1037,44 @@ SdrObject* SdrEscherImport::ProcessObj( SvStream& rSt, DffObjData& rObjData, voi
}
pTObj->SetMergedItem( SvxFrameDirectionItem( bVerticalText ? FRMDIR_VERT_TOP_RIGHT : FRMDIR_HORI_LEFT_TOP, EE_PARA_WRITINGDIR ) );
- //Autofit text only if there is no auto grow height and width
- //See fdo#41245
- if (bAutoFit && !bAutoGrowHeight && !bAutoGrowWidth)
+ // SdStyleSheetPool::CreateLayoutStyleSheets in stlpool.cxx applies SDRTEXTFIT_AUTOFIT by default,
+ // so need to override here
+ pTObj->SetMergedItem(SdrTextFitToSizeTypeItem(SDRTEXTFIT_NONE));
+
+ if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr )
{
- pTObj->SetMergedItem( SdrTextFitToSizeTypeItem(SDRTEXTFIT_AUTOFIT) );
+ pTObj->SetMergedItem( makeSdrTextAutoGrowWidthItem( bAutoGrowWidth ) );
+ pTObj->SetMergedItem( makeSdrTextAutoGrowHeightItem( bAutoGrowHeight ) );
+ }
+ else
+ {
+ pTObj->SetMergedItem( makeSdrTextWordWrapItem( bWordWrap ) );
+ pTObj->SetMergedItem( makeSdrTextAutoGrowHeightItem( bFitShapeToText ) );
}
- if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr )
- {
- pTObj->SetMergedItem( makeSdrTextAutoGrowWidthItem( bAutoGrowWidth ) );
- pTObj->SetMergedItem( makeSdrTextAutoGrowHeightItem( bAutoGrowHeight ) );
- }
- else
- {
- pTObj->SetMergedItem( makeSdrTextWordWrapItem( bWordWrap ) );
- pTObj->SetMergedItem( makeSdrTextAutoGrowHeightItem( bFitShapeToText ) );
- }
-
- pTObj->SetMergedItem( SdrTextVertAdjustItem( eTVA ) );
- pTObj->SetMergedItem( SdrTextHorzAdjustItem( eTHA ) );
+ pTObj->SetMergedItem( SdrTextVertAdjustItem( eTVA ) );
+ pTObj->SetMergedItem( SdrTextHorzAdjustItem( eTHA ) );
- if ( nMinFrameHeight < 0 )
- nMinFrameHeight = 0;
- if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr )
- pTObj->SetMergedItem( makeSdrTextMinFrameHeightItem( nMinFrameHeight ) );
+ if ( nMinFrameHeight < 0 )
+ nMinFrameHeight = 0;
+ if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr )
+ pTObj->SetMergedItem( makeSdrTextMinFrameHeightItem( nMinFrameHeight ) );
- if ( nMinFrameWidth < 0 )
- nMinFrameWidth = 0;
- if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr )
- pTObj->SetMergedItem( makeSdrTextMinFrameWidthItem( nMinFrameWidth ) );
+ if ( nMinFrameWidth < 0 )
+ nMinFrameWidth = 0;
+ if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr )
+ pTObj->SetMergedItem( makeSdrTextMinFrameWidthItem( nMinFrameWidth ) );
- // set margins at the borders of the textbox
- pTObj->SetMergedItem( makeSdrTextLeftDistItem( nTextLeft ) );
- pTObj->SetMergedItem( makeSdrTextRightDistItem( nTextRight ) );
- pTObj->SetMergedItem( makeSdrTextUpperDistItem( nTextTop ) );
- pTObj->SetMergedItem( makeSdrTextLowerDistItem( nTextBottom ) );
- pTObj->SetMergedItem( SdrTextFixedCellHeightItem( true ) );
+ // set margins at the borders of the textbox
+ pTObj->SetMergedItem( makeSdrTextLeftDistItem( nTextLeft ) );
+ pTObj->SetMergedItem( makeSdrTextRightDistItem( nTextRight ) );
+ pTObj->SetMergedItem( makeSdrTextUpperDistItem( nTextTop ) );
+ pTObj->SetMergedItem( makeSdrTextLowerDistItem( nTextBottom ) );
+ pTObj->SetMergedItem( SdrTextFixedCellHeightItem( true ) );
- if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr )
- pTObj->SetSnapRect( rTextRect );
- pTObj = ReadObjText( &aTextObj, pTObj, rData.pPage );
+ if ( dynamic_cast<const SdrObjCustomShape* >(pTObj) == nullptr )
+ pTObj->SetSnapRect( rTextRect );
+ pTObj = ReadObjText( &aTextObj, pTObj, rData.pPage );
if ( pTObj )
{
@@ -1393,7 +1339,7 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
if ( pPersistPtr[ nOfs ] > nStreamLen )
{
bOk = false;
- OSL_FAIL("SdrPowerPointImport::Ctor(): Ungueltiger Eintrag im Persist-Directory!");
+ OSL_FAIL("SdrPowerPointImport::Ctor(): Invalid entry in Persist-Directory!");
}
}
nAnz--;
@@ -1401,7 +1347,7 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
}
if ( bOk && nAnz > 0 )
{
- OSL_FAIL("SdrPowerPointImport::Ctor(): Nicht alle Persist-Directory Entraege gelesen!");
+ OSL_FAIL("SdrPowerPointImport::Ctor(): Not all Persist-Directory entries read!");
bOk = false;
}
}
@@ -1423,7 +1369,7 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
nDocStreamPos = aUserEditAtom.nDocumentRef;
if ( nDocStreamPos > nPersistPtrAnz )
{
- OSL_FAIL("SdrPowerPointImport::Ctor(): aUserEditAtom.nDocumentRef ungueltig!");
+ OSL_FAIL("SdrPowerPointImport::Ctor(): aUserEditAtom.nDocumentRef is invalid!");
bOk = false;
}
}
@@ -1615,7 +1561,7 @@ SdrPowerPointImport::SdrPowerPointImport( PowerPointImportParam& rParam, const O
}
else
{
- OSL_FAIL("SdrPowerPointImport::Ctor(): Persist-Eintrag fehlerhaft! (SJ)");
+ OSL_FAIL("SdrPowerPointImport::Ctor(): Persist-Entry is faulty! (SJ)");
}
}
}