incubator-ooo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From a.@apache.org
Subject svn commit: r1361109 - in /incubator/ooo/trunk/main/filter: inc/filter/msfilter/svdfppt.hxx source/msfilter/svdfppt.cxx
Date Fri, 13 Jul 2012 08:55:44 GMT
Author: af
Date: Fri Jul 13 08:55:43 2012
New Revision: 1361109

URL: http://svn.apache.org/viewvc?rev=1361109&view=rev
Log:
#i119874 Fixed text alignment in RTL layout.

         Reported by: Li Feng Wang
         Patch by: Jianyuan Li
         Review by: Andre Fischer

Modified:
    incubator/ooo/trunk/main/filter/inc/filter/msfilter/svdfppt.hxx
    incubator/ooo/trunk/main/filter/source/msfilter/svdfppt.cxx

Modified: incubator/ooo/trunk/main/filter/inc/filter/msfilter/svdfppt.hxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/inc/filter/msfilter/svdfppt.hxx?rev=1361109&r1=1361108&r2=1361109&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/inc/filter/msfilter/svdfppt.hxx (original)
+++ incubator/ooo/trunk/main/filter/inc/filter/msfilter/svdfppt.hxx Fri Jul 13 08:55:43 2012
@@ -580,7 +580,8 @@ protected:
     sal_uInt32     GetNotesPageId(sal_uInt16 nPageNum ) const;
 	SdrOutliner* GetDrawOutliner( SdrTextObj* pSdrText ) const;
 	void		SeekOle( SfxObjectShell* pShell, sal_uInt32 nFilterOptions );
-
+	void		ApplyTextAnchorAttributes( PPTTextObj& rTextObj, SfxItemSet& rSet ) const;
+	sal_Bool	IsVerticalText() const;
 public:
                 SdrPowerPointImport( PowerPointImportParam&, const String& rBaseURL
);
     virtual		~SdrPowerPointImport();

Modified: incubator/ooo/trunk/main/filter/source/msfilter/svdfppt.cxx
URL: http://svn.apache.org/viewvc/incubator/ooo/trunk/main/filter/source/msfilter/svdfppt.cxx?rev=1361109&r1=1361108&r2=1361109&view=diff
==============================================================================
--- incubator/ooo/trunk/main/filter/source/msfilter/svdfppt.cxx (original)
+++ incubator/ooo/trunk/main/filter/source/msfilter/svdfppt.cxx Fri Jul 13 08:55:43 2012
@@ -7865,4 +7865,134 @@ SdrObject* SdrPowerPointImport::CreateTa
 
 
 ////////////////////////////////////////////////////////////////////////////////////////////////////
+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;
+		}
+		// 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;
+		}
+		// 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 ) );
+}



Mime
View raw message