-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
This patch uses CSS for bold and italic, in addition to underline etc.
it assumes that you have not applied the previous css patch, which i
posted yesterday. if this is a problem, i can create another,
intermediate patch.
sam th
[EMAIL PROTECTED]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.0.1 (GNU/Linux)
Comment: For info see http://www.gnupg.org
iD8DBQE4p7K4t+kM0Mq9M/wRAu3YAKCF3sc0SqAbfkl04T+8JeEUtpzgkwCgo8ng
XecIxDgT0c0esob5KjK+9SY=
=l1Kx
-----END PGP SIGNATURE-----
diff -ru -x CVS abi/src/wp/impexp/xp/ie_exp_HTML.cpp
abi-mod/src/wp/impexp/xp/ie_exp_HTML.cpp
--- abi/src/wp/impexp/xp/ie_exp_HTML.cpp Sat Feb 12 22:48:00 2000
+++ abi-mod/src/wp/impexp/xp/ie_exp_HTML.cpp Mon Feb 14 01:35:05 2000
@@ -161,10 +161,10 @@
return;
}
- // if(m_iBlockType == BT_NORMAL)
- // m_pie->write("</p>\n");
+ if(m_iBlockType == BT_NORMAL)
+ m_pie->write("</p>\n");
- if(m_iBlockType == BT_HEADING1)
+ else if(m_iBlockType == BT_HEADING1)
m_pie->write("</h1>\n");
else if(m_iBlockType == BT_HEADING2)
@@ -182,7 +182,7 @@
// Add "catchall" for now
else
- m_pie->write("<br />\n");
+ m_pie->write("</p>\n");
m_bInBlock = UT_FALSE;
return;
@@ -259,8 +259,9 @@
// <p style="<anything else!>"> ...
- // m_iBlockType = BT_NORMAL;
- // m_pie->write("<p");
+ m_iBlockType = BT_NORMAL;
+ m_pie->write("<p class=\"norm\"");
+ wasWritten = UT_TRUE;
}
}
else
@@ -268,8 +269,9 @@
// <p> with no style attribute ...
- //m_iBlockType = BT_NORMAL;
- //m_pie->write("<p");
+ m_iBlockType = BT_NORMAL;
+ m_pie->write("<p class=\"norm\"");
+ wasWritten = UT_TRUE;
}
/* Assumption: never get property set with h1-h3, block text, plain
text. Probably true. */
@@ -278,7 +280,7 @@
m_iBlockType == BT_NORMAL && (pAP->getProperty("text-align",
szValue))
)
{
- m_pie->write(" ALIGN=\"");
+ m_pie->write(" align=\"");
m_pie->write(szValue);
m_pie->write("\"");
}
@@ -288,8 +290,9 @@
// <p> with no style attribute, and no properties either
- //m_iBlockType = BT_NORMAL;
- //m_pie->write("<p");
+ m_iBlockType = BT_NORMAL;
+ m_pie->write("<p class=\"norm\"");
+ wasWritten = UT_TRUE;
}
if (wasWritten)
m_pie->write(">");
@@ -374,6 +377,9 @@
const PP_AttrProp * pAP = NULL;
UT_Bool bHaveProp = m_pDocument->getAttrProp(api,&pAP);
+
+ bool span = UT_FALSE;
+ bool textD = UT_FALSE;
if (bHaveProp && pAP)
{
@@ -384,7 +390,15 @@
&& !UT_stricmp(szValue, "bold")
)
{
- m_pie->write("<b>");
+ if (!span)
+ {
+ m_pie->write("<span style=\"font-weight: bold");
+ span = UT_TRUE;
+ }
+ else
+ {
+ m_pie->write("; font-weight: bold");
+ }
}
if (
@@ -392,8 +406,17 @@
&& !UT_stricmp(szValue, "italic")
)
{
- m_pie->write("<i>");
+ if (!span)
+ {
+ m_pie->write("<span style=\"font-style: italic\"");
+ span = UT_TRUE;
+ }
+ else
+ {
+ m_pie->write("; font-style: italic");
+ }
}
+
if (
(pAP->getProperty("text-decoration", szValue))
@@ -414,7 +437,20 @@
{
if (0 == UT_stricmp(q, "underline"))
{
- m_pie->write("<u>");
+ if (!span)
+ {
+ m_pie->write("<span style=\"text-decoration:
+underline");
+ span = UT_TRUE;
+ }
+ else if (!textD)
+ {
+ m_pie->write("; text-decoration: underline");
+ textD = UT_TRUE;
+ }
+ else
+ {
+ m_pie->write(" underline");
+ }
}
q = strtok(NULL, " ");
@@ -442,7 +478,61 @@
{
if (0 == UT_stricmp(q, "line-through"))
{
- m_pie->write("<s>"); // is it <s> or
<strike> ? TODO
+ if (!span)
+ {
+ m_pie->write("<span style=\"text-decoration:
+line-through");
+ span = UT_TRUE;
+ }
+ else if (!textD)
+ {
+ m_pie->write("; text-decoration:
+line-through");
+ textD = UT_TRUE;
+ }
+ else
+ {
+ m_pie->write(" line-through");
+ }
+ }
+
+ q = strtok(NULL, " ");
+ }
+
+ free(p);
+ }
+
+ if (
+ (pAP->getProperty("text-decoration", szValue))
+ )
+ {
+ const XML_Char* pszDecor = szValue;
+
+ XML_Char* p;
+ if (!UT_cloneString((char *&)p, pszDecor))
+ {
+ // TODO outofmem
+ }
+
+ UT_ASSERT(p || !pszDecor);
+ XML_Char* q = strtok(p, " ");
+
+ while (q)
+ {
+ if (0 == UT_stricmp(q, "overline"))
+ {
+ if (!span)
+ {
+ m_pie->write("<span style=\"text-decoration:
+overline");
+ span = UT_TRUE;
+ }
+ else if (!textD)
+ {
+ m_pie->write("; text-decoration: overline");
+ textD = UT_TRUE;
+ }
+ else
+ {
+ m_pie->write(" overline");
+ }
}
q = strtok(NULL, " ");
@@ -451,6 +541,9 @@
free(p);
}
+ if (span)
+ m_pie->write("\">");
+
if (pAP->getProperty("text-position", szValue))
{
if (!UT_stricmp("superscript", szValue))
@@ -480,7 +573,7 @@
m_pie->write("<font");
if (pszColor)
{
- m_pie->write(" COLOR=\"");
+ m_pie->write(" color=\"");
char szColor[16];
_convertColor(szColor, pszColor);
m_pie->write(szColor);
@@ -489,14 +582,14 @@
if (pszFontFamily)
{
- m_pie->write(" FACE=\"");
+ m_pie->write(" face=\"");
m_pie->write(pszFontFamily);
m_pie->write("\"");
}
if (pszFontSize)
{
- m_pie->write(" SIZE=\"");
+ m_pie->write(" size=\"");
char szSize[16];
_convertFontSize(szSize, pszFontSize);
m_pie->write(szSize);
@@ -543,60 +636,14 @@
}
}
- if (
- (pAP->getProperty("text-decoration", szValue))
- )
- {
- const XML_Char* pszDecor = szValue;
-
- XML_Char* p;
- if (!UT_cloneString((char *&)p, pszDecor))
- {
- // TODO outofmem
- }
-
- UT_ASSERT(p || !pszDecor);
- XML_Char* q = strtok(p, " ");
-
- while (q)
- {
- if (0 == UT_stricmp(q, "line-through"))
- {
- m_pie->write("</s>"); // is it <s> or
<strike> ? TODO
- }
-
- q = strtok(NULL, " ");
- }
-
- free(p);
- }
+ UT_Bool closeSpan = UT_FALSE;
if (
(pAP->getProperty("text-decoration", szValue))
+ && UT_stricmp(szValue, "none")
)
{
- const XML_Char* pszDecor = szValue;
-
- XML_Char* p;
- if (!UT_cloneString((char *&)p, pszDecor))
- {
- // TODO outofmem
- }
-
- UT_ASSERT(p || !pszDecor);
- XML_Char* q = strtok(p, " ");
-
- while (q)
- {
- if (0 == UT_stricmp(q, "underline"))
- {
- m_pie->write("</u>");
- }
-
- q = strtok(NULL, " ");
- }
-
- free(p);
+ closeSpan = UT_TRUE;
}
if (
@@ -604,7 +651,7 @@
&& !UT_stricmp(szValue, "italic")
)
{
- m_pie->write("</i>");
+ closeSpan = UT_TRUE;
}
if (
@@ -612,9 +659,14 @@
&& !UT_stricmp(szValue, "bold")
)
{
- m_pie->write("</b>");
+ closeSpan = UT_TRUE;
}
+ if (closeSpan)
+ {
+ m_pie->write("</span>");
+ }
+
m_pAP_Span = NULL;
}
@@ -763,9 +815,13 @@
m_pie->write("\n");
+ m_pie->write("<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\"
+\"DTD/xhtml1-strict.dtd\">\n");
m_pie->write("<html>\n");
m_pie->write("<head>\n");
m_pie->write("<title>AbiWord Document</title>\n");
+ m_pie->write("<style type=\"text/css\">\n");
+ m_pie->write("<!-- \n P.norm { margin-top: 0pt; margin-bottom: 0pt } \n
+-->\n");
+ m_pie->write("</style>\n");
m_pie->write("</head>\n");
m_pie->write("<body>\n");
