summaryrefslogtreecommitdiff
path: root/filter
diff options
context:
space:
mode:
authorPiet van Oostrum <piet@vanoostrum.org>2015-11-26 18:37:56 +0400
committerAndras Timar <andras.timar@collabora.com>2020-05-20 16:06:50 +0200
commit8890b7c953c92a56b0f3a3a31115023252721aca (patch)
tree9d37e250c885641358b5adf860afbddf50be8327 /filter
parente77ed8957be12c37a9e0131b1478f808c23d41c6 (diff)
tdf#79082 Correctly import PPT tabs
Change-Id: I7ac5ccb356501983da645f0a6037b5292ce8b5b4 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/20207 Reviewed-by: Samuel Mehrbrodt <Samuel.Mehrbrodt@cib.de> Tested-by: Jenkins (cherry picked from commit 070f44e3b2d7dcf26de68ee46c50dad5c0cf2170) Reviewed-on: https://gerrit.libreoffice.org/c/core/+/94427 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'filter')
-rw-r--r--filter/source/msfilter/svdfppt.cxx79
1 files changed, 33 insertions, 46 deletions
diff --git a/filter/source/msfilter/svdfppt.cxx b/filter/source/msfilter/svdfppt.cxx
index a122e6aac203..de39c837fe3a 100644
--- a/filter/source/msfilter/svdfppt.cxx
+++ b/filter/source/msfilter/svdfppt.cxx
@@ -5827,7 +5827,6 @@ PPTParagraphObj::PPTParagraphObj( const PPTStyleSheet& rStyleSheet, TSS_Type nIn
PPTNumberFormatCreator ( nullptr ),
mrStyleSheet ( rStyleSheet ),
mnInstance ( nInstance ),
- mbTab ( true ), // style sheets always have to get the right tabulator setting
mnCurrentObject ( 0 )
{
mxParaSet->mnDepth = sanitizeForMaxPPTLevels(nDepth);
@@ -5842,7 +5841,6 @@ PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader,
PPTTextRulerInterpreter ( rRuler ),
mrStyleSheet ( rStyleSheet ),
mnInstance ( nInstance ),
- mbTab ( false ),
mnCurrentObject ( 0 )
{
if (rnCurCharPos < rPropReader.aCharPropList.size())
@@ -5857,10 +5855,6 @@ PPTParagraphObj::PPTParagraphObj( PPTStyleTextPropReader& rPropReader,
rPropReader.aCharPropList[rnCurCharPos].get();
std::unique_ptr<PPTPortionObj> pPPTPortion(new PPTPortionObj(
*pCharPropSet, rStyleSheet, nInstance, mxParaSet->mnDepth));
- if (!mbTab)
- {
- mbTab = pPPTPortion->HasTabulator();
- }
m_PortionList.push_back(std::move(pPPTPortion));
}
}
@@ -5874,10 +5868,6 @@ void PPTParagraphObj::AppendPortion( PPTPortionObj& rPPTPortion )
{
m_PortionList.push_back(
std::make_unique<PPTPortionObj>(rPPTPortion));
- if ( !mbTab )
- {
- mbTab = m_PortionList.back()->HasTabulator();
- }
}
void PPTParagraphObj::UpdateBulletRelSize( sal_uInt32& nBulletRelSize ) const
@@ -6322,50 +6312,47 @@ void PPTParagraphObj::ApplyTo( SfxItemSet& rSet, boost::optional< sal_Int16 >&
rSet.Put( aULSpaceItem );
}
- if ( mbTab ) // makes it sense to apply tabsettings
+ sal_uInt32 i, nDefaultTab, nTab, nTextOfs2 = 0;
+ sal_uInt32 nLatestManTab = 0;
+ GetAttrib( PPT_ParaAttr_TextOfs, nTextOfs2, nDestinationInstance );
+ GetAttrib( PPT_ParaAttr_BulletOfs, nTab, nDestinationInstance );
+ GetAttrib( PPT_ParaAttr_BulletOn, i, nDestinationInstance );
+ GetAttrib( PPT_ParaAttr_DefaultTab, nDefaultTab, nDestinationInstance );
+ SvxTabStopItem aTabItem( 0, 0, SvxTabAdjust::Default, EE_PARA_TABS );
+ if ( GetTabCount() )
{
- sal_uInt32 i, nDefaultTab, nTab, nTextOfs2 = 0;
- sal_uInt32 nLatestManTab = 0;
- GetAttrib( PPT_ParaAttr_TextOfs, nTextOfs2, nDestinationInstance );
- GetAttrib( PPT_ParaAttr_BulletOfs, nTab, nDestinationInstance );
- GetAttrib( PPT_ParaAttr_BulletOn, i, nDestinationInstance );
- GetAttrib( PPT_ParaAttr_DefaultTab, nDefaultTab, nDestinationInstance );
- SvxTabStopItem aTabItem( 0, 0, SvxTabAdjust::Default, EE_PARA_TABS );
- if ( GetTabCount() )
+ //paragraph offset = MIN(first_line_offset, hanging_offset)
+ sal_uInt32 nParaOffset = std::min(nTextOfs2, nTab);
+ for ( i = 0; i < GetTabCount(); i++ )
{
- //paragraph offset = MIN(first_line_offset, hanging_offset)
- sal_uInt32 nParaOffset = std::min(nTextOfs2, nTab);
- for ( i = 0; i < GetTabCount(); i++ )
+ SvxTabAdjust eTabAdjust;
+ nTab = GetTabOffsetByIndex( static_cast<sal_uInt16>(i) );
+ switch( GetTabStyleByIndex( static_cast<sal_uInt16>(i) ) )
{
- SvxTabAdjust eTabAdjust;
- nTab = GetTabOffsetByIndex( static_cast<sal_uInt16>(i) );
- switch( GetTabStyleByIndex( static_cast<sal_uInt16>(i) ) )
- {
- case 1 : eTabAdjust = SvxTabAdjust::Center; break;
- case 2 : eTabAdjust = SvxTabAdjust::Right; break;
- case 3 : eTabAdjust = SvxTabAdjust::Decimal; break;
- default : eTabAdjust = SvxTabAdjust::Left;
- }
- if ( nTab > nParaOffset )//If tab stop greater than paragraph offset
- aTabItem.Insert( SvxTabStop( ( ( (long( nTab - nTextOfs2 )) * 2540 ) / 576 ), eTabAdjust ) );
+ case 1 : eTabAdjust = SvxTabAdjust::Center; break;
+ case 2 : eTabAdjust = SvxTabAdjust::Right; break;
+ case 3 : eTabAdjust = SvxTabAdjust::Decimal; break;
+ default : eTabAdjust = SvxTabAdjust::Left;
}
- nLatestManTab = nTab;
+ if ( nTab > nParaOffset )//If tab stop greater than paragraph offset
+ aTabItem.Insert( SvxTabStop( ( ( (long( nTab - nTextOfs2 )) * 2540 ) / 576 ), eTabAdjust ) );
}
- if ( nIsBullet2 == 0 )
- aTabItem.Insert( SvxTabStop( sal_uInt16(0) ) );
- if ( nDefaultTab )
+ nLatestManTab = nTab;
+ }
+ if ( nIsBullet2 == 0 )
+ aTabItem.Insert( SvxTabStop( sal_uInt16(0) ) );
+ if ( nDefaultTab )
+ {
+ nTab = std::max( nTextOfs2, nLatestManTab );
+ nTab /= nDefaultTab;
+ nTab = nDefaultTab * ( 1 + nTab );
+ for ( i = 0; ( i < 20 ) && ( nTab < 0x1b00 ); i++ )
{
- nTab = std::max( nTextOfs2, nLatestManTab );
- nTab /= nDefaultTab;
- nTab = nDefaultTab * ( 1 + nTab );
- for ( i = 0; ( i < 20 ) && ( nTab < 0x1b00 ); i++ )
- {
- aTabItem.Insert( SvxTabStop( static_cast<sal_uInt16>( ( ( nTab - nTextOfs2 ) * 2540 ) / 576 ) ) );
- nTab += nDefaultTab;
- }
+ aTabItem.Insert( SvxTabStop( static_cast<sal_uInt16>( ( ( nTab - nTextOfs2 ) * 2540 ) / 576 ) ) );
+ nTab += nDefaultTab;
}
- rSet.Put( aTabItem );
}
+ rSet.Put( aTabItem );
}
sal_uInt32 PPTParagraphObj::GetTextSize()