Dylan Smith : richedit: Avoid acting on control words in skipped RTF groups .

Alexandre Julliard julliard at winehq.org
Thu Sep 11 08:01:06 CDT 2008


Module: wine
Branch: master
Commit: 9a7d475db8f86af8dcc8b5bbcca26d332bf228e0
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=9a7d475db8f86af8dcc8b5bbcca26d332bf228e0

Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date:   Wed Sep 10 22:54:12 2008 -0400

richedit: Avoid acting on control words in skipped RTF groups.

Previously the control words in skipped groups were being processed by
the read hook on the RTF parser.  By moving this code into the class
callbacks for the parser, the skipped groups actually remain skipped.

---

 dlls/riched20/editor.c |   28 ++++++----------------------
 dlls/riched20/editor.h |    6 ++++++
 dlls/riched20/reader.c |    8 ++++++++
 3 files changed, 20 insertions(+), 22 deletions(-)

diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index adc9362..7b1a0b0 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -346,7 +346,7 @@ static void ME_ApplyBorderProperties(RTF_Info *info,
   }
 }
 
-static void ME_RTFCharAttrHook(RTF_Info *info)
+void ME_RTFCharAttrHook(RTF_Info *info)
 {
   CHARFORMAT2W fmt;
   fmt.cbSize = sizeof(fmt);
@@ -468,7 +468,7 @@ static void ME_RTFCharAttrHook(RTF_Info *info)
 
 /* FIXME this function doesn't get any information about context of the RTF tag, which is very bad,
    the same tags mean different things in different contexts */
-static void ME_RTFParAttrHook(RTF_Info *info)
+void ME_RTFParAttrHook(RTF_Info *info)
 {
   PARAFORMAT2 fmt;
   fmt.cbSize = sizeof(fmt);
@@ -825,7 +825,7 @@ static void ME_RTFParAttrHook(RTF_Info *info)
   }
 }
 
-static void ME_RTFTblAttrHook(RTF_Info *info)
+void ME_RTFTblAttrHook(RTF_Info *info)
 {
   switch (info->rtfMinor)
   {
@@ -896,7 +896,7 @@ static void ME_RTFTblAttrHook(RTF_Info *info)
   }
 }
 
-static void ME_RTFSpecialCharHook(RTF_Info *info)
+void ME_RTFSpecialCharHook(RTF_Info *info)
 {
   RTFTable *tableDef = info->tableDef;
   switch (info->rtfMinor)
@@ -1325,7 +1325,8 @@ static void ME_RTFReadObjectGroup(RTF_Info *info)
   RTFRouteToken(info);	/* feed "}" back to router */
 }
 
-static void ME_RTFReadHook(RTF_Info *info) {
+static void ME_RTFReadHook(RTF_Info *info)
+{
   switch(info->rtfClass)
   {
     case rtfGroup:
@@ -1363,23 +1364,6 @@ static void ME_RTFReadHook(RTF_Info *info) {
         }
       }
       break;
-    case rtfControl:
-      switch(info->rtfMajor)
-      {
-        case rtfCharAttr:
-          ME_RTFCharAttrHook(info);
-          break;
-        case rtfParAttr:
-          ME_RTFParAttrHook(info);
-          break;
-        case rtfTblAttr:
-          ME_RTFTblAttrHook(info);
-          break;
-        case rtfSpecialChar:
-          ME_RTFSpecialCharHook(info);
-          break;
-      }
-      break;
   }
 }
 
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index b9c01b7..6ec4c1f 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -21,6 +21,8 @@
 #include "editstr.h"
 #include "wine/unicode.h"
 
+struct _RTF_Info;
+
 extern HANDLE me_heap;
 
 static inline void __WINE_ALLOC_SIZE(1) *heap_alloc( size_t len )
@@ -275,6 +277,10 @@ void ME_SendOldNotify(ME_TextEditor *editor, int nCode);
 void ME_LinkNotify(ME_TextEditor *editor, UINT msg, WPARAM wParam, LPARAM lParam);
 int ME_GetTextW(ME_TextEditor *editor, WCHAR *buffer, int nStart, int nChars, BOOL bCRLF);
 ME_DisplayItem *ME_FindItemAtOffset(ME_TextEditor *editor, ME_DIType nItemType, int nOffset, int *nItemOffset);
+void ME_RTFCharAttrHook(struct _RTF_Info *info);
+void ME_RTFParAttrHook(struct _RTF_Info *info);
+void ME_RTFTblAttrHook(struct _RTF_Info *info);
+void ME_RTFSpecialCharHook(struct _RTF_Info *info);
 void ME_StreamInFill(ME_InStream *stream);
 int ME_AutoURLDetect(ME_TextEditor *editor, WCHAR curChar);
 extern int me_debug;
diff --git a/dlls/riched20/reader.c b/dlls/riched20/reader.c
index 8801137..95d88f7 100644
--- a/dlls/riched20/reader.c
+++ b/dlls/riched20/reader.c
@@ -2477,6 +2477,13 @@ ControlClass (RTF_Info *info)
 	{
         case rtfCharAttr:
                 CharAttr(info);
+                ME_RTFCharAttrHook(info);
+                break;
+        case rtfParAttr:
+                ME_RTFParAttrHook(info);
+                break;
+        case rtfTblAttr:
+                ME_RTFTblAttrHook(info);
                 break;
         case rtfCharSet:
                 CharSet(info);
@@ -2492,6 +2499,7 @@ ControlClass (RTF_Info *info)
                 break;
 	case rtfSpecialChar:
                 SpecialChar (info);
+                ME_RTFSpecialCharHook(info);
 		break;
 	}
 }




More information about the wine-cvs mailing list