Kaydet (Commit) 54c679f4 authored tarafından Andre Fischer's avatar Andre Fischer Kaydeden (comit) Caolán McNamara

Resolves: #i119874 Fixed text alignment in RTL layout.

Reported by: Li Feng Wang
Patch by: Jianyuan Li
Review by: Andre Fischer
(cherry picked from commit 57fdcdd7)

Conflicts:
	filter/inc/filter/msfilter/svdfppt.hxx
	filter/source/msfilter/svdfppt.cxx

Change-Id: I6adae6d40ff106caeea2b9310a57228257d79404

Related: #i119874# Missing part of patch.

Patch by: Jianyuan Li
(cherry picked from commit a7dc3e8b)

Change-Id: Icff3e1167ab780612ad47775aaa39c9baa99c70f
üst f31e6deb
...@@ -7627,4 +7627,143 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTab ...@@ -7627,4 +7627,143 @@ SdrObject* SdrPowerPointImport::CreateTable( SdrObject* pGroup, sal_uInt32* pTab
return pRet; return pRet;
} }
sal_Bool SdrPowerPointImport::IsVerticalText() const
{
sal_Bool bVerticalText = sal_False;
if ( IsProperty( DFF_Prop_txflTextFlow ) )
{
MSO_TextFlow eTextFlow = (MSO_TextFlow)( GetPropertyValue( DFF_Prop_txflTextFlow ) & 0xFFFF );
switch( eTextFlow )
{
case mso_txflTtoBA : // Top to Bottom @-font, above -> below
case mso_txflTtoBN : // Top to Bottom non-@, above -> below
case mso_txflVertN : // Vertical, non-@, above -> below
bVerticalText = !bVerticalText;
break;
default: break;
}
}
return bVerticalText;
}
void SdrPowerPointImport::ApplyTextAnchorAttributes( PPTTextObj& rTextObj, SfxItemSet& rSet ) const
{
SdrTextVertAdjust eTVA;
SdrTextHorzAdjust eTHA;
sal_uInt32 nTextFlags = rTextObj.GetTextFlags();
nTextFlags &= PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_LEFT | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_RIGHT
| PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_CENTER | PPT_TEXTOBJ_FLAGS_PARA_ALIGNMENT_USED_BLOCK;
if ( IsVerticalText() )
{
eTVA = SDRTEXTVERTADJUST_BLOCK;
eTHA = SDRTEXTHORZADJUST_CENTER;
// Textverankerung lesen
MSO_Anchor eTextAnchor = (MSO_Anchor)GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop );
switch( eTextAnchor )
{
case mso_anchorTop:
case mso_anchorTopCentered:
eTHA = SDRTEXTHORZADJUST_RIGHT;
break;
case mso_anchorMiddle :
case mso_anchorMiddleCentered:
eTHA = SDRTEXTHORZADJUST_CENTER;
break;
case mso_anchorBottom:
case mso_anchorBottomCentered:
eTHA = SDRTEXTHORZADJUST_LEFT;
break;
default:
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 :
{
// 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 or 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;
}
}
else
{
eTVA = SDRTEXTVERTADJUST_CENTER;
eTHA = SDRTEXTHORZADJUST_BLOCK;
// Textverankerung lesen
MSO_Anchor eTextAnchor = (MSO_Anchor)GetPropertyValue( DFF_Prop_anchorText, mso_anchorTop );
switch( eTextAnchor )
{
case mso_anchorTop:
case mso_anchorTopCentered:
eTVA = SDRTEXTVERTADJUST_TOP;
break;
case mso_anchorMiddle :
case mso_anchorMiddleCentered:
eTVA = SDRTEXTVERTADJUST_CENTER;
break;
case mso_anchorBottom:
case mso_anchorBottomCentered:
eTVA = SDRTEXTVERTADJUST_BOTTOM;
break;
default:
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 :
{
// 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 or 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;
}
}
rSet.Put( SdrTextVertAdjustItem( eTVA ) );
rSet.Put( SdrTextHorzAdjustItem( eTHA ) );
}
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ /* vim:set shiftwidth=4 softtabstop=4 expandtab: */
...@@ -573,6 +573,9 @@ protected: ...@@ -573,6 +573,9 @@ protected:
SdrOutliner* GetDrawOutliner( SdrTextObj* pSdrText ) const; SdrOutliner* GetDrawOutliner( SdrTextObj* pSdrText ) const;
void SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOptions ); void SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOptions );
void ApplyTextAnchorAttributes( PPTTextObj& rTextObj, SfxItemSet& rSet ) const;
sal_Bool IsVerticalText() const;
public: public:
SdrPowerPointImport( PowerPointImportParam&, const OUString& rBaseURL ); SdrPowerPointImport( PowerPointImportParam&, const OUString& rBaseURL );
virtual ~SdrPowerPointImport(); virtual ~SdrPowerPointImport();
......
...@@ -2391,6 +2391,8 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj ...@@ -2391,6 +2391,8 @@ SdrObject* ImplSdPPTImport::ApplyTextObj( PPTTextObj* pTextObj, SdrTextObj* pObj
SfxItemSet aSet( pSdrModel->GetItemPool() ); SfxItemSet aSet( pSdrModel->GetItemPool() );
ApplyAttributes( rStCtrl, aSet ); ApplyAttributes( rStCtrl, aSet );
pPresObj->SetLogicRect(pText->GetLogicRect());
ApplyTextAnchorAttributes( *pTextObj, aSet );
pPresObj->SetMergedItemSet(aSet); pPresObj->SetMergedItemSet(aSet);
if ( ( eAktPageKind != PPT_NOTEPAGE ) && ( nPlacementId != 0xffffffff ) ) if ( ( eAktPageKind != PPT_NOTEPAGE ) && ( nPlacementId != 0xffffffff ) )
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment