PATCH: fix for overline in clipboard bug.


Subject: PATCH: fix for overline in clipboard bug.
From: Martin Sevior (msevior@mccubbin.ph.unimelb.edu.au)
Date: Mon Jan 17 2000 - 12:49:48 CST


HI,
        the overline feature had a bug that caused the overline
information to be lost when copying to the clipboard. If you copy text to
the clipboard all overline information was lost.

This bug was caused because abi converts all text to RTF when copying to
the clipboard, pastes convert RTF back to native format. The overline code
had no support for RTF conversion so naturally copying to and from the
clipboard lost all overline information.

I include a patch for overline RTF import and export. This not only fixes
the clipboard bug, it also provides overline support in RTF files.....

HOWEVER I have no idea what the correct tag for overline in RTF is! I just
made up "overline" as an RTF tag! Could someone please either tell me what
the correct tag for overline in RTF is or direct me to some documentation
containing the RTF format?

Finally I have had some mail server problems recently. I have changed back
to my mail server at my home institution which is much more reliable.
Sorry if anyone got bounced messages from me.

Martin Sevior
=========================================================================
diff -Naur src/wp/impexp/xp/ie_exp_RTF_listenerWriteDoc.cpp src-clip-bug/wp/impexp/xp/ie_exp_RTF_listenerWriteDoc.cpp
--- src/wp/impexp/xp/ie_exp_RTF_listenerWriteDoc.cpp Thu Jan 13 16:36:45 2000
+++ src-clip-bug/wp/impexp/xp/ie_exp_RTF_listenerWriteDoc.cpp Fri Jan 14 07:11:49 2000
@@ -110,6 +110,8 @@
         {
                 if (strstr(szFontDecoration,"underline") != 0)
                         m_pie->_rtf_keyword("ul");
+ if (strstr(szFontDecoration,"overline") != 0)
+ m_pie->_rtf_keyword("overline");
                 if (strstr(szFontDecoration,"line-through") != 0)
                         m_pie->_rtf_keyword("strike");
         }
diff -Naur src/wp/impexp/xp/ie_imp_RTF.cpp src-clip-bug/wp/impexp/xp/ie_imp_RTF.cpp
--- src/wp/impexp/xp/ie_imp_RTF.cpp Thu Jan 13 16:36:45 2000
+++ src-clip-bug/wp/impexp/xp/ie_imp_RTF.cpp Fri Jan 14 06:36:47 2000
@@ -67,6 +67,7 @@
         m_bold = UT_FALSE;
         m_italic = UT_FALSE;
         m_underline = UT_FALSE;
+ m_overline = UT_FALSE;
         m_strikeout = UT_FALSE;
         m_superscript = UT_FALSE;
         m_subscript = UT_FALSE;
@@ -757,6 +758,13 @@
                         m_currentRTFState.m_paraProps.m_indentLeft = param;
                 }
                 break;
+ case 'o':
+ if (strcmp((char*)pKeyword,"overline") == 0 || strcmp((char*)pKeyword,"over") == 0 || strcmp((char*)pKeyword,"ov") == 0)
+ {
+ // Sevior: I have no idea what the RTF sequence for overline is!
+ return HandleOverline(fParam ? param : 1);
+ }
+ break;
 
         case 'p':
                 if (strcmp((char*)pKeyword, "par") == 0)
@@ -956,20 +964,36 @@
         // italic
         strcat(propBuffer, "; font-style:");
         strcat(propBuffer, m_currentRTFState.m_charProps.m_italic ? "italic" : "normal");
- // underline & strike-out
+ // underline & overline & strike-out
         strcat(propBuffer, "; text-decoration:");
- if (m_currentRTFState.m_charProps.m_underline && m_currentRTFState.m_charProps.m_strikeout)
+ if (m_currentRTFState.m_charProps.m_underline && m_currentRTFState.m_charProps.m_strikeout && !m_currentRTFState.m_charProps.m_overline)
         {
                 strcat(propBuffer, "underline line-through");
         }
- else if (m_currentRTFState.m_charProps.m_underline && !m_currentRTFState.m_charProps.m_strikeout)
+ else if (m_currentRTFState.m_charProps.m_underline && !m_currentRTFState.m_charProps.m_strikeout && !m_currentRTFState.m_charProps.m_overline)
         {
                 strcat(propBuffer, "underline");
         }
- else if (!m_currentRTFState.m_charProps.m_underline && m_currentRTFState.m_charProps.m_strikeout)
+ else if (!m_currentRTFState.m_charProps.m_underline && m_currentRTFState.m_charProps.m_strikeout && !m_currentRTFState.m_charProps.m_overline)
         {
                 strcat(propBuffer, "line-through");
         }
+ else if(m_currentRTFState.m_charProps.m_underline && m_currentRTFState.m_charProps.m_strikeout && m_currentRTFState.m_charProps.m_overline)
+ {
+ strcat(propBuffer, "underline overline line-through");
+ }
+ else if(!m_currentRTFState.m_charProps.m_underline && m_currentRTFState.m_charProps.m_strikeout && m_currentRTFState.m_charProps.m_overline)
+ {
+ strcat(propBuffer, "overline line-through");
+ }
+ else if(m_currentRTFState.m_charProps.m_underline && !m_currentRTFState.m_charProps.m_strikeout && m_currentRTFState.m_charProps.m_overline)
+ {
+ strcat(propBuffer, "underline overline");
+ }
+ else if(!m_currentRTFState.m_charProps.m_underline && !m_currentRTFState.m_charProps.m_strikeout && m_currentRTFState.m_charProps.m_overline)
+ {
+ strcat(propBuffer, "overline");
+ }
         else
         {
                 strcat(propBuffer, "none");
@@ -1531,6 +1555,11 @@
 UT_Bool IE_Imp_RTF::HandleUnderline(UT_Bool state)
 {
         return HandleBoolCharacterProp(state, &m_currentRTFState.m_charProps.m_underline);
+}
+
+UT_Bool IE_Imp_RTF::HandleOverline(UT_Bool state)
+{
+ return HandleBoolCharacterProp(state, &m_currentRTFState.m_charProps.m_overline);
 }
 
 UT_Bool IE_Imp_RTF::HandleStrikeout(UT_Bool state)
diff -Naur src/wp/impexp/xp/ie_imp_RTF.h src-clip-bug/wp/impexp/xp/ie_imp_RTF.h
--- src/wp/impexp/xp/ie_imp_RTF.h Thu Jan 13 16:36:45 2000
+++ src-clip-bug/wp/impexp/xp/ie_imp_RTF.h Fri Jan 14 06:37:50 2000
@@ -65,6 +65,7 @@
         UT_Bool m_bold;
         UT_Bool m_italic;
         UT_Bool m_underline;
+ UT_Bool m_overline;
         UT_Bool m_strikeout;
         UT_Bool m_superscript;
         UT_Bool m_subscript;
@@ -216,6 +217,7 @@
                 UT_Bool HandleBold(UT_Bool state);
                 UT_Bool HandleItalic(UT_Bool state);
                 UT_Bool HandleUnderline(UT_Bool state);
+ UT_Bool HandleOverline(UT_Bool state);
                 UT_Bool HandleStrikeout(UT_Bool state);
                 UT_Bool HandleSuperscript(UT_Bool state);
                 UT_Bool HandleSubscript(UT_Bool state);




This archive was generated by hypermail 2b25 : Mon Jan 17 2000 - 12:49:55 CST