Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-winehq
Commits
431ee508
Commit
431ee508
authored
Oct 22, 2020
by
Huw Davies
Committed by
Alexandre Julliard
Oct 22, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Use cell ptrs in the rtf parsing code.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
670dadf7
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
55 additions
and
19 deletions
+55
-19
editor.c
dlls/riched20/editor.c
+20
-19
editor.h
dlls/riched20/editor.h
+9
-0
para.c
dlls/riched20/para.c
+6
-0
table.c
dlls/riched20/table.c
+20
-0
No files found.
dlls/riched20/editor.c
View file @
431ee508
...
...
@@ -987,8 +987,9 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
/* else fall through since v4.1 treats rtfNestRow and rtfRow the same */
case
rtfRow
:
{
ME_DisplayItem
*
cell
,
*
run
;
ME_DisplayItem
*
run
;
ME_Paragraph
*
para
;
ME_Cell
*
cell
;
int
i
;
if
(
!
tableDef
)
...
...
@@ -1004,44 +1005,44 @@ void ME_RTFSpecialCharHook(RTF_Info *info)
info
->
nestingLevel
++
;
}
para
=
tableDef
->
row_start
;
cell
=
ME_FindItemFwd
(
para_get_di
(
para
),
diCell
);
assert
(
cell
&&
!
cell
->
member
.
cell
.
prev_cell
);
cell
=
table_row_first_cell
(
para
);
assert
(
cell
&&
!
cell_prev
(
cell
)
);
if
(
tableDef
->
numCellsDefined
<
1
)
{
/* 2000 twips appears to be the cell size that native richedit uses
* when no cell sizes are specified. */
const
int
defaultCellSize
=
2000
;
int
nRightBoundary
=
defaultCellSize
;
cell
->
member
.
cell
.
nRightBoundary
=
nRightBoundary
;
while
(
cell
->
member
.
cell
.
next_cell
)
{
cell
=
cell
->
member
.
cell
.
next_cell
;
nRightBoundary
+=
defaultCellSize
;
cell
->
member
.
cell
.
nRightBoundary
=
nRightBoundary
;
const
int
default_size
=
2000
;
int
right_boundary
=
default_size
;
cell
->
nRightBoundary
=
right_boundary
;
while
(
cell_next
(
cell
))
{
cell
=
cell_next
(
cell
);
right_boundary
+=
default_size
;
cell
->
nRightBoundary
=
right_boundary
;
}
para
=
table_insert_cell
(
info
->
editor
,
info
->
editor
->
pCursors
);
cell
=
para
->
pCell
;
cell
->
member
.
cell
.
nRightBoundary
=
nRightB
oundary
;
cell
=
para
_cell
(
para
)
;
cell
->
nRightBoundary
=
right_b
oundary
;
}
else
{
for
(
i
=
0
;
i
<
tableDef
->
numCellsDefined
;
i
++
)
{
RTFCell
*
cellDef
=
&
tableDef
->
cells
[
i
];
cell
->
member
.
cell
.
nRightBoundary
=
cellDef
->
rightBoundary
;
ME_ApplyBorderProperties
(
info
,
&
cell
->
member
.
cell
.
border
,
cellDef
->
border
);
cell
=
cell
->
member
.
cell
.
next_cell
;
cell
->
nRightBoundary
=
cellDef
->
rightBoundary
;
ME_ApplyBorderProperties
(
info
,
&
cell
->
border
,
cellDef
->
border
);
cell
=
cell_next
(
cell
);
if
(
!
cell
)
{
para
=
table_insert_cell
(
info
->
editor
,
info
->
editor
->
pCursors
);
cell
=
para
->
pCell
;
cell
=
para
_cell
(
para
)
;
}
}
/* Cell for table row delimiter is empty */
cell
->
member
.
cell
.
nRightBoundary
=
tableDef
->
cells
[
i
-
1
].
rightBoundary
;
cell
->
nRightBoundary
=
tableDef
->
cells
[
i
-
1
].
rightBoundary
;
}
run
=
ME_FindItemFwd
(
cell
,
diRun
);
run
=
ME_FindItemFwd
(
cell_get_di
(
cell
)
,
diRun
);
if
(
info
->
editor
->
pCursors
[
0
].
pRun
!=
run
||
info
->
editor
->
pCursors
[
0
].
nOffset
)
{
...
...
dlls/riched20/editor.h
View file @
431ee508
...
...
@@ -204,6 +204,7 @@ void ME_GetSelectionParaFormat(ME_TextEditor *editor, PARAFORMAT2 *pFmt) DECLSPE
void
ME_MarkAllForWrapping
(
ME_TextEditor
*
editor
)
DECLSPEC_HIDDEN
;
void
ME_SetDefaultParaFormat
(
ME_TextEditor
*
editor
,
PARAFORMAT2
*
pFmt
)
DECLSPEC_HIDDEN
;
int
get_total_width
(
ME_TextEditor
*
editor
)
DECLSPEC_HIDDEN
;
ME_Cell
*
para_cell
(
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
void
para_destroy
(
ME_TextEditor
*
editor
,
ME_Paragraph
*
item
)
DECLSPEC_HIDDEN
;
ME_Run
*
para_end_run
(
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
ME_Run
*
para_first_run
(
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
...
...
@@ -279,6 +280,8 @@ ME_Paragraph *editor_first_para( ME_TextEditor *editor ) DECLSPEC_HIDDEN;
/* table.c */
BOOL
ME_IsInTable
(
ME_DisplayItem
*
pItem
)
DECLSPEC_HIDDEN
;
ME_Cell
*
cell_next
(
ME_Cell
*
cell
)
DECLSPEC_HIDDEN
;
ME_Cell
*
cell_prev
(
ME_Cell
*
cell
)
DECLSPEC_HIDDEN
;
ME_Paragraph
*
table_append_row
(
ME_TextEditor
*
editor
,
ME_Paragraph
*
table_row
)
DECLSPEC_HIDDEN
;
ME_Paragraph
*
table_insert_cell
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
)
DECLSPEC_HIDDEN
;
ME_Paragraph
*
table_insert_row_end
(
ME_TextEditor
*
editor
,
ME_Cursor
*
cursor
)
DECLSPEC_HIDDEN
;
...
...
@@ -286,6 +289,7 @@ ME_Paragraph *table_insert_row_start( ME_TextEditor *editor, ME_Cursor *cursor )
ME_Paragraph
*
table_insert_row_start_at_para
(
ME_TextEditor
*
editor
,
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
ME_Paragraph
*
table_outer_para
(
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
ME_Paragraph
*
table_row_end
(
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
ME_Cell
*
table_row_first_cell
(
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
ME_Paragraph
*
table_row_start
(
ME_Paragraph
*
para
)
DECLSPEC_HIDDEN
;
void
ME_CheckTablesForCorruption
(
ME_TextEditor
*
editor
)
DECLSPEC_HIDDEN
;
void
ME_ProtectPartialTableDeletion
(
ME_TextEditor
*
editor
,
ME_Cursor
*
c
,
int
*
nChars
)
DECLSPEC_HIDDEN
;
...
...
@@ -293,6 +297,11 @@ void ME_TabPressedInTable(ME_TextEditor *editor, BOOL bSelectedRow) DECLSPEC_HID
void
ME_MoveCursorFromTableRowStartParagraph
(
ME_TextEditor
*
editor
)
DECLSPEC_HIDDEN
;
struct
RTFTable
*
ME_MakeTableDef
(
ME_TextEditor
*
editor
)
DECLSPEC_HIDDEN
;
void
ME_InitTableDef
(
ME_TextEditor
*
editor
,
struct
RTFTable
*
tableDef
)
DECLSPEC_HIDDEN
;
static
inline
ME_DisplayItem
*
cell_get_di
(
ME_Cell
*
cell
)
{
return
(
ME_DisplayItem
*
)((
ptrdiff_t
)
cell
-
offsetof
(
ME_DisplayItem
,
member
));
}
/* txthost.c */
ITextHost
*
ME_CreateTextHost
(
HWND
hwnd
,
CREATESTRUCTW
*
cs
,
BOOL
bEmulateVersion10
)
DECLSPEC_HIDDEN
;
...
...
dlls/riched20/para.c
View file @
431ee508
...
...
@@ -124,6 +124,12 @@ BOOL para_in_table( ME_Paragraph *para )
return
para
->
fmt
.
wEffects
&
PFE_TABLE
;
}
ME_Cell
*
para_cell
(
ME_Paragraph
*
para
)
{
if
(
!
para
->
pCell
)
return
NULL
;
return
&
para
->
pCell
->
member
.
cell
;
}
void
ME_MakeFirstParagraph
(
ME_TextEditor
*
editor
)
{
static
const
WCHAR
cr_lf
[]
=
{
'\r'
,
'\n'
,
0
};
...
...
dlls/riched20/table.c
View file @
431ee508
...
...
@@ -172,6 +172,26 @@ ME_Paragraph* table_outer_para( ME_Paragraph *para )
return
para
;
}
ME_Cell
*
table_row_first_cell
(
ME_Paragraph
*
para
)
{
if
(
!
para_in_table
(
para
))
return
NULL
;
para
=
para_next
(
table_row_start
(
para
)
);
return
para_cell
(
para
);
}
ME_Cell
*
cell_next
(
ME_Cell
*
cell
)
{
if
(
!
cell
->
next_cell
)
return
NULL
;
return
&
cell
->
next_cell
->
member
.
cell
;
}
ME_Cell
*
cell_prev
(
ME_Cell
*
cell
)
{
if
(
!
cell
->
prev_cell
)
return
NULL
;
return
&
cell
->
prev_cell
->
member
.
cell
;
}
/* Make a bunch of assertions to make sure tables haven't been corrupted.
*
* These invariants may not hold true in the middle of streaming in rich text
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment