Commit Graph

50 Commits

Author SHA1 Message Date
Maarten Lankhorst 1e758c5e8c riched20: Do not call callback when no data needs to be flushed. 2011-02-09 13:49:03 -06:00
Dylan Smith be3073fce1 richedit: Fix streaming rtf with table at the start of the text.
The first paragraph was being handled just by ME_StreamOutParaProps,
but subsequent paragraphs would check if the paragraph was starting or
ending a table. So I moved the code to check for tables into
ME_StreamOutParaProps.
2010-07-19 14:38:16 +02:00
Dylan Smith e2f6b1d83d richedit: Don't break when streaming out a table, just continue.
This is a regression caused by commit
54b53b6018 which change the code to use
if statements instead of a switch, so the break statement should have
been changed to a continue statement.
2010-07-19 14:38:16 +02:00
Dylan Smith 54b53b6018 richedit: Use ME_Cursor instead of offsets for stream out functions. 2009-08-13 15:35:28 +02:00
Dylan Smith 32dcd3bbe1 richedit: Created functions to move between runs and track paragraphs.
Plenty of places in the code find following or preceding runs, then
afterwards find the paragraph from the run.  This is inefficient because
the same linked list is used for both runs and paragraphs, so changes in
paragraphs can be detected while returning the next or previous run.
2009-08-12 17:35:24 +02:00
Dylan Smith 46b84aed4a richedit: Added function to get selection cursors in order.
Previously the only convenient way to get the start and end of the
selection was through offsets, which eventually need to get converted
back into items in the linked list storing the text.  The new function
will help with eliminating these inefficiencies.
2009-08-12 17:29:30 +02:00
Massimo Del Fedele 6f17327728 riched20: Fix placement of crlf on font table streamout. 2009-04-27 13:24:09 +02:00
Dylan Smith 234f167d9d richedit: Null terminate streamed out rich text. 2009-04-24 11:52:15 +02:00
Dylan Smith 5f15de0690 richedit: Removed ME_StrLen and ME_StrVLen field access functions.
These functions were probably previously needed because of some wierd
special handling of backspace characters, but currently there is no
reason why the nLen field can't be accessed directly.

Having to functions that just access the string length field just causes
slightly more effort for someone to look at the code, because they need
to enter the function to find out what it actually is doing.
2009-02-09 13:05:13 +01:00
Dylan Smith 12ca50db7a richedit: Get the paragraph with ME_RunOfsFromCharOfs.
The ME_RunOfsFromCharOfs function finds the paragraph before finding the
run and offset within the run, so the function may as well be able to
return this paragraph to the caller.  Many callers to the function
instead find the paragraph from the run, which ends up unnecessarily
traversing a linked list of runs within the paragraph.
2009-02-06 14:50:27 +01:00
Dylan Smith 5d74f58382 richedit: Actually store end of line string for end paragraph runs.
Previously a count of the carraige returns and line feeds were stored
for end of paragraph runs, and a paragraph sign was stored as the actual
string.  This was causing many special cases where the length of the
run needed to be determined differently if the run was or wasn't an
end of paragraph run.

There wasn't any use for storing the paragraph sign unless some drawing
code gets commented out to allow the end paragraphs to be shown,
therefore I changed the code to store the actual string that gets
retrieved by WM_GETTEXT.
2009-01-28 12:11:36 +01:00
Dylan Smith 61308257f2 richedit: Removed redundant ME_FindItemAtOffset using ME_RunOfsFromCharOfs.
The two functions ME_FindItemAtOffset and ME_RunOfsFromCharOfs were almost
identically used, since ME_FindItemAtOffset was always used to find a run.
The only difference was how they returned the offset within the run for an
end of paragraph run.

For ME_FindItemAtOffset it would return the next run if it was in between \r
and \n. ME_RunOfsFromCharOfs would instead return an nOffset of 0 for end
paragraph runs.  This subtle difference introduced bugs, so I decided to
avoid having special case in this function when creating this patch, and
instead let the caller handle this case.
2009-01-27 11:21:33 +01:00
Andrew Talbot affc6e029c riched20: Sign-compare warnings fix. 2008-11-06 11:09:41 +01:00
Dylan Smith a3ac5ef094 richedit: Fixed a bug preventing streaming out nested table properties. 2008-10-01 11:40:52 -05:00
Dylan Smith 3af4419688 richedit: Added code to stream out table border properties.
This code was simply missing, since the table border properties are
already stored and displayed.
2008-10-01 11:40:34 -05:00
Dylan Smith ee5342e432 richedit: Prevent assertion failure when streaming out nested tables.
The table properties are streamed out at the start of the table for
non-nested tables, and at the end of the table for nested tables.  The
assertion caught the fact that I didn't get the start of the table row
for nested tables before trying to stream out the properties.

The call to ME_GetTableRowStart will handle both of these cases by
getting the table row start paragraph and asserting that it is found.
This call was also the reason for removing the const qualifier on one
of the parameters.
2008-10-01 11:40:20 -05:00
Dylan Smith fac8e957c5 richedit: Prevent font or colour buffer overflow on stream out.
Static sized buffers are used for storing the colours and fonts, so
there needs to be a check to prevent these buffer from overflowing.
2008-10-01 11:40:04 -05:00
Dylan Smith a47d4a4c3a richedit: Adjust table spacing with horizontal gap and left edge. 2008-08-18 17:15:57 +02:00
Dylan Smith 59195ed2ec richedit: Added in support for streaming in and out nested tables. 2008-08-18 14:34:35 +02:00
Dylan Smith 300db3765f richedit: Each cell can contain multiple paragraphs in msftedit. 2008-08-18 14:34:11 +02:00
Dylan Smith 11c8039699 richedit: Use tabstops to store cell positions. 2008-08-05 14:09:37 +02:00
Dylan Smith aba425eb70 richedit: PFE_TABLE flag is now used instead of private bTable value.
The PARAFORMAT structure has a bit in wEffects to indicate whether the
paragraph is a table or not, so this should be used instead of a private
bTable value, since this structure can be retrieved with EM_GETPARAFORMAT.
2008-07-09 11:31:21 +02:00
Alex Villacís Lasso 8d37388fe7 richedit: Fixups to move over to reliance on CR and LF counters.
Text streamout now honors CR and LF counters.
Tests to pin down required EM_STREAMOUT behavior.
2008-04-29 14:54:05 +02:00
Eric Pouech a64c22c8b1 richedit: Store shift-enter (keyboard) and \line (rtf) as end of row (and emit \line while saving in RTF). 2008-03-17 14:34:44 +01:00
Bang Jun-young 8e57a41913 riched20: Include wine/port.h for vsnprintf(). 2008-02-04 14:18:20 +01:00
Alex Villacís Lasso 157a0199e9 riched20: Prevent overflow on richedit debug channel. 2007-09-17 13:46:15 +02:00
Andrew Talbot b150ea67a9 riched20: Constify some variables. 2007-08-17 12:01:37 +02:00
Dmitry Timoshkov a5992939d4 riched20: Make some data const. 2006-11-29 12:44:34 +01:00
Hans Leidekker 177350d087 riched20: Win64 printf format warning fixes. 2006-10-14 20:16:56 +02:00
Jonathan Ernst 360a3f9142 Update the address of the Free Software Foundation. 2006-05-23 14:11:13 +02:00
Michael Stefaniuc a87520036f janitorial: Remove redundant NULL pointer checks before HeapFree'ing them.
Some HeapFree's are hidden behind macros. Found by smatch.
2006-05-10 11:31:41 +02:00
Kevin Koltzau 58b308db6a riched20: Separate stream state from editor state.
Somewhat improves thread safety.
2006-02-05 13:05:45 +01:00
Kevin Koltzau 4d74e1dbfb riched20: Add method to stream data based on a range. 2006-02-05 13:05:06 +01:00
Phil Krylov 08bf7180f3 riched20: Initial support for simple tables. 2006-02-04 17:01:01 +01:00
Phil Krylov be2525b440 Fixed encoding of non-ASCII chars. 2005-10-11 19:56:03 +00:00
Alexandre Julliard d559fbd803 Fixed gcc 4.0 warnings. 2005-09-12 20:30:37 +00:00
Phil Krylov f78ce2f41b Fixed a bug in EM_STREAMOUT RichEdit message handler which truncated
some streamed text.
2005-08-11 10:30:41 +00:00
Phil Krylov 2b6b09f591 Generate ending \par in RTF output of RichEdit when streaming out a
whole document.
2005-07-26 10:32:46 +00:00
Phil Krylov 42f3e22740 Fixed an off-by-one error in EM_STREAMOUT handler for non-Unicode
plain text output.
2005-07-22 18:27:15 +00:00
Stefan Huehner b8585b8d0c Change some char* to const char* to fix warnigns. 2005-07-21 11:59:11 +00:00
Phil Krylov 84bb372239 Added emulation of RichEdit 1.0 behaviour when the 1.0 window class is
being used. This emulation (introduced in M$ RichEdit 3.0) counts
paragraph endings as 2 characters (CR+LF) instead of 1 (CR).
2005-07-21 10:33:32 +00:00
Phil Krylov 69a27f457a Fixed another couple of EM_STREAMOUT bugs. 2005-07-05 20:56:07 +00:00
Phil Krylov d291f3cd77 Removed junk from UTF-8 RTF output. 2005-07-05 16:18:33 +00:00
Krzysztof Foltman cb836344cd - Fix a warning caused by the TAB patch.
- Initialize *pcb to a large value before calling the stream-out
  callback (to make applications that don't set *pcb at all happy).
- Don't flush the output stream when error condition is set.
2005-06-20 10:31:38 +00:00
Krzysztof Foltman ab214a05c8 Emit \tx for user-defined TABs. 2005-06-12 11:08:29 +00:00
Phil Krylov 6b379fb29f Fixed \u keyword to output signed 16-bit values. Also fixed CP_SYMBOL
conversion and the detection of the default font's codepage.
2005-03-24 15:09:05 +00:00
Phil Krylov 0fdbec319b Made RTF reader and writer handle codepages mostly similar to the
original riched20.dll.
2005-03-22 16:41:36 +00:00
Phil Krylov 48061e6899 Improved RTF export. 2005-03-16 20:18:11 +00:00
Krzysztof Foltman d4cf45e3f1 - WM_COPY (and WM_CUT) can now put both Unicode and RTF format (thanks
to Phil Krylov's RTF generator code).
- New message implemented - WM_PASTE.
- RTF reader: rtfPlain implemented (kind of).
- RTF writer: rewritten main loop (the old one crashed in some
  circumstances when SFF_SELECTION was used).
2005-03-15 15:40:52 +00:00
Phil Krylov c6ea6caecb Initial implementation of EM_STREAMOUT and RTF writer. 2005-03-14 21:41:16 +00:00