Add hanging indents, paragraph spacing, font colour and highlight colour
to the WordPerfect importer (Fridrich Strba)
CVS:
----------------------------------------------------------------------
CVS: Enter Log.  Lines beginning with `CVS:' are removed automatically
CVS:
CVS: Committing in .
CVS:
CVS: Modified Files:
CVS:  Tag: ABI-2-2-0-STABLE
CVS:    wp/impexp/wordperfect/xp/ie_imp_WordPerfect.cpp
CVS:    wp/impexp/wordperfect/xp/ie_imp_WordPerfect.h
CVS:
----------------------------------------------------------------------
Op do, 17-02-2005 te 17:38 +0100, schreef Fridrich Strba:
>Hello, Marc,
>
>Here is a patch to add hanging indents, paragraph spacing, font colour 
>and highlight colour to the WordPerfect importer. It would be cool to 
>have even the page form/orientation sorted out, but it is non trivial 
>for me, since it requires creating a whole new tag. Trained monkies are 
>simply like that :-)
>
>Cheers
>
>Fridrich
>>plain text document bijlage (AbiWord.diff)
>Index: wp/impexp/wordperfect/xp/ie_imp_WordPerfect.cpp
>===================================================================
>RCS file: /cvsroot/abiword-plugins/wp/impexp/wordperfect/xp/ie_imp_WordPerfect.cpp,v
>retrieving revision 1.46
>diff -u -r1.46 ie_imp_WordPerfect.cpp
>--- wp/impexp/wordperfect/xp/ie_imp_WordPerfect.cpp	8 Feb 2005 21:48:53 -0000	1.46
>+++ wp/impexp/wordperfect/xp/ie_imp_WordPerfect.cpp	17 Feb 2005 16:03:47 -0000
>@@ -337,14 +337,24 @@
> 	if (m_bHdrFtrOpenCount) return; // HACK
> 	UT_DEBUGMSG(("AbiWordPerfect: openParagraph()\n"));
> 	// for now, we always append these options
>-	float marginLeft = 0.0f, marginRight = 0.0f;
>+	float marginTop = 0.0f, marginBottom = 0.0f;
>+	float marginLeft = 0.0f, marginRight = 0.0f, textIndent = 0.0f;
>+	if (propList["fo:margin-top"])
>+	    marginTop = propList["fo:margin-top"]->getFloat();
>+	if (propList["fo:margin-bottom"])
>+	    marginBottom = propList["fo:margin-bottom"]->getFloat();
> 	if (propList["fo:margin-left"])
> 	    marginLeft = propList["fo:margin-left"]->getFloat();
> 	if (propList["fo:margin-right"])
> 	    marginRight = propList["fo:margin-right"]->getFloat();
>+	if (propList["fo:text-indent"])
>+	    textIndent = propList["fo:text-indent"]->getFloat();
> 
>+	m_topMargin = marginTop;
>+	m_bottomMargin = marginBottom;
> 	m_leftMarginOffset = marginLeft;
> 	m_rightMarginOffset = marginRight;
>+	m_textIndent = textIndent;
> 
> 	UT_String propBuffer;
> 	propBuffer += "text-align:";
>@@ -364,7 +374,8 @@
> 		lineSpacing = propList["fo:line-height"]->getFloat();
> 	
> 	UT_String tmpBuffer;
>-	UT_String_sprintf(tmpBuffer, "; margin-left:%.4fin; margin-right:%.4fin; line-height:%.4f", m_leftMarginOffset, m_rightMarginOffset, lineSpacing);
>+	UT_String_sprintf(tmpBuffer, "; margin-top:%.4fin; margin-bottom:%.4fin; margin-left:%.4fin; margin-right:%.4fin; text-indent:%.4fin; line-height:%.4f",
>+		m_topMargin, m_bottomMargin, m_leftMarginOffset, m_rightMarginOffset, m_textIndent, lineSpacing);
> 	propBuffer += tmpBuffer;
> 
> 	UT_DEBUGMSG(("AbiWordPerfect: Appending paragraph properties: %s\n", propBuffer.c_str()));
>@@ -439,6 +450,18 @@
> 		propBuffer += propList["fo:font-size"]->getStr().cstr();
> 	}
> 
>+	if (propList["fo:color"])
>+	{
>+		propBuffer += "; color:";
>+		propBuffer += propList["fo:color"]->getStr().cstr();
>+	}
>+
>+	if (propList["style:text-background-color"])
>+	{
>+		propBuffer += "; bgcolor:";
>+		propBuffer += propList["style:text-background-color"]->getStr().cstr();
>+	}
>+
> 	UT_DEBUGMSG(("AbiWordPerfect: Appending span format: %s\n", propBuffer.c_str()));
> 	const XML_Char* propsArray[5];
> 	
>Index: wp/impexp/wordperfect/xp/ie_imp_WordPerfect.h
>===================================================================
>RCS file: /cvsroot/abiword-plugins/wp/impexp/wordperfect/xp/ie_imp_WordPerfect.h,v
>retrieving revision 1.27
>diff -u -r1.27 ie_imp_WordPerfect.h
>--- wp/impexp/wordperfect/xp/ie_imp_WordPerfect.h	7 Feb 2005 14:55:55 -0000	1.27
>+++ wp/impexp/wordperfect/xp/ie_imp_WordPerfect.h	17 Feb 2005 16:03:47 -0000
>@@ -169,8 +169,11 @@
> 	UT_uint32							m_nextFreeId;
> 
> 	// paragraph props
>+    float								m_topMargin;
>+    float								m_bottomMargin;
>     float								m_leftMarginOffset;
>     float								m_rightMarginOffset;
>+    float								m_textIndent;
> 
>     // state handling that libwpd can't account for
>     //UT_StringPtrMap						m_listStylesHash;
Received on Sun Feb 20 21:48:05 2005
This archive was generated by hypermail 2.1.8 : Sun Feb 20 2005 - 21:48:05 CET