You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@openoffice.apache.org by af...@apache.org on 2012/07/13 10:55:44 UTC

svn commit: r1361109 - in /incubator/ooo/trunk/main/filter: inc/filter/msfilter/svdfppt.hxx source/msfilter/svdfppt.cxx

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 ) );
+}



Re: svn commit: r1361109 - in /incubator/ooo/trunk/main/filter: inc/filter/msfilter/svdfppt.hxx source/msfilter/svdfppt.cxx

Posted by Andre Fischer <aw...@gmail.com>.
On 10.08.2012 22:16, Pavel Janík wrote:
> Hi,
>
> On Jul 13, 2012, at 10:55 AM, af@apache.org wrote:
>
>> 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/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
> In WaE mode, it prints this. Can you please add "default: break;" there?
>
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/filter/source/msfilter/svdfppt.cxx: In member function ‘void SdrPowerPointImport::ApplyTextAnchorAttributes(PPTTextObj&, SfxItemSet&) const’:
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/filter/source/msfilter/svdfppt.cxx:7927: warning: enumeration value ‘mso_anchorTopBaseline’ not handled in switch
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/filter/source/msfilter/svdfppt.cxx:7927: warning: enumeration value ‘mso_anchorBottomBaseline’ not handled in switch
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/filter/source/msfilter/svdfppt.cxx:7927: warning: enumeration value ‘mso_anchorTopCenteredBaseline’ not handled in switch
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/filter/source/msfilter/svdfppt.cxx:7927: warning: enumeration value ‘mso_anchorBottomCenteredBaseline’ not handled in switch
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/filter/source/msfilter/svdfppt.cxx:7976: warning: enumeration value ‘mso_anchorTopBaseline’ not handled in switch
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/filter/source/msfilter/svdfppt.cxx:7976: warning: enumeration value ‘mso_anchorBottomBaseline’ not handled in switch
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/filter/source/msfilter/svdfppt.cxx:7976: warning: enumeration value ‘mso_anchorTopCenteredBaseline’ not handled in switch
> /Users/pavel/BUILD/BuildDir/ooo_trunk_src/filter/source/msfilter/svdfppt.cxx:7976: warning: enumeration value ‘mso_anchorBottomCenteredBaseline’ not handled in switch
>

Done in revision 1372306.  I took the liberty to name you in the "patch 
by:" section of the commit message.

Thanks,
Andre


Re: svn commit: r1361109 - in /incubator/ooo/trunk/main/filter: inc/filter/msfilter/svdfppt.hxx source/msfilter/svdfppt.cxx

Posted by Pavel Janík <Pa...@Janik.cz>.
Hi,

On Jul 13, 2012, at 10:55 AM, af@apache.org wrote:

> 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/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

In WaE mode, it prints this. Can you please add "default: break;" there?

/Users/pavel/BUILD/BuildDir/ooo_trunk_src/filter/source/msfilter/svdfppt.cxx: In member function ‘void SdrPowerPointImport::ApplyTextAnchorAttributes(PPTTextObj&, SfxItemSet&) const’:
/Users/pavel/BUILD/BuildDir/ooo_trunk_src/filter/source/msfilter/svdfppt.cxx:7927: warning: enumeration value ‘mso_anchorTopBaseline’ not handled in switch
/Users/pavel/BUILD/BuildDir/ooo_trunk_src/filter/source/msfilter/svdfppt.cxx:7927: warning: enumeration value ‘mso_anchorBottomBaseline’ not handled in switch
/Users/pavel/BUILD/BuildDir/ooo_trunk_src/filter/source/msfilter/svdfppt.cxx:7927: warning: enumeration value ‘mso_anchorTopCenteredBaseline’ not handled in switch
/Users/pavel/BUILD/BuildDir/ooo_trunk_src/filter/source/msfilter/svdfppt.cxx:7927: warning: enumeration value ‘mso_anchorBottomCenteredBaseline’ not handled in switch
/Users/pavel/BUILD/BuildDir/ooo_trunk_src/filter/source/msfilter/svdfppt.cxx:7976: warning: enumeration value ‘mso_anchorTopBaseline’ not handled in switch
/Users/pavel/BUILD/BuildDir/ooo_trunk_src/filter/source/msfilter/svdfppt.cxx:7976: warning: enumeration value ‘mso_anchorBottomBaseline’ not handled in switch
/Users/pavel/BUILD/BuildDir/ooo_trunk_src/filter/source/msfilter/svdfppt.cxx:7976: warning: enumeration value ‘mso_anchorTopCenteredBaseline’ not handled in switch
/Users/pavel/BUILD/BuildDir/ooo_trunk_src/filter/source/msfilter/svdfppt.cxx:7976: warning: enumeration value ‘mso_anchorBottomCenteredBaseline’ not handled in switch

-- 
Pavel Janík