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
4a30e060
Commit
4a30e060
authored
Oct 20, 2020
by
Huw Davies
Committed by
Alexandre Julliard
Oct 20, 2020
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Pass paragraph ptrs to the paragraph property writers.
Signed-off-by:
Huw Davies
<
huw@codeweavers.com
>
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
00332537
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
67 additions
and
64 deletions
+67
-64
writer.c
dlls/riched20/writer.c
+67
-64
No files found.
dlls/riched20/writer.c
View file @
4a30e060
...
@@ -386,9 +386,8 @@ static BOOL stream_out_font_and_colour_tbls( ME_OutStream *pStream, ME_Run *firs
...
@@ -386,9 +386,8 @@ static BOOL stream_out_font_and_colour_tbls( ME_OutStream *pStream, ME_Run *firs
return
TRUE
;
return
TRUE
;
}
}
static
BOOL
static
BOOL
stream_out_table_props
(
ME_TextEditor
*
editor
,
ME_OutStream
*
pStream
,
ME_StreamOutRTFTableProps
(
ME_TextEditor
*
editor
,
ME_OutStream
*
pStream
,
ME_Paragraph
*
para
)
ME_DisplayItem
*
para
)
{
{
ME_DisplayItem
*
cell
;
ME_DisplayItem
*
cell
;
char
props
[
STREAMOUT_BUFFER_SIZE
]
=
""
;
char
props
[
STREAMOUT_BUFFER_SIZE
]
=
""
;
...
@@ -397,16 +396,18 @@ ME_StreamOutRTFTableProps(ME_TextEditor *editor, ME_OutStream *pStream,
...
@@ -397,16 +396,18 @@ ME_StreamOutRTFTableProps(ME_TextEditor *editor, ME_OutStream *pStream,
if
(
!
ME_StreamOutPrint
(
pStream
,
"
\\
trowd"
))
if
(
!
ME_StreamOutPrint
(
pStream
,
"
\\
trowd"
))
return
FALSE
;
return
FALSE
;
if
(
!
editor
->
bEmulateVersion10
)
{
/* v4.1 */
if
(
!
editor
->
bEmulateVersion10
)
/* v4.1 */
PARAFORMAT2
*
pFmt
=
&
table_row_end
(
&
para
->
member
.
para
)
->
fmt
;
{
para
=
para_get_di
(
table_row_start
(
&
para
->
member
.
para
)
);
PARAFORMAT2
*
pFmt
=
&
table_row_end
(
para
)
->
fmt
;
cell
=
para
->
member
.
para
.
next_para
->
member
.
para
.
pCell
;
para
=
table_row_start
(
para
);
cell
=
para
->
next_para
->
member
.
para
.
pCell
;
assert
(
cell
);
assert
(
cell
);
if
(
pFmt
->
dxOffset
)
if
(
pFmt
->
dxOffset
)
sprintf
(
props
+
strlen
(
props
),
"
\\
trgaph%d"
,
pFmt
->
dxOffset
);
sprintf
(
props
+
strlen
(
props
),
"
\\
trgaph%d"
,
pFmt
->
dxOffset
);
if
(
pFmt
->
dxStartIndent
)
if
(
pFmt
->
dxStartIndent
)
sprintf
(
props
+
strlen
(
props
),
"
\\
trleft%d"
,
pFmt
->
dxStartIndent
);
sprintf
(
props
+
strlen
(
props
),
"
\\
trleft%d"
,
pFmt
->
dxStartIndent
);
do
{
do
{
ME_Border
*
borders
[
4
]
=
{
&
cell
->
member
.
cell
.
border
.
top
,
ME_Border
*
borders
[
4
]
=
{
&
cell
->
member
.
cell
.
border
.
top
,
&
cell
->
member
.
cell
.
border
.
left
,
&
cell
->
member
.
cell
.
border
.
left
,
&
cell
->
member
.
cell
.
border
.
bottom
,
&
cell
->
member
.
cell
.
border
.
bottom
,
...
@@ -427,14 +428,16 @@ ME_StreamOutRTFTableProps(ME_TextEditor *editor, ME_OutStream *pStream,
...
@@ -427,14 +428,16 @@ ME_StreamOutRTFTableProps(ME_TextEditor *editor, ME_OutStream *pStream,
sprintf
(
props
+
strlen
(
props
),
"
\\
cellx%d"
,
cell
->
member
.
cell
.
nRightBoundary
);
sprintf
(
props
+
strlen
(
props
),
"
\\
cellx%d"
,
cell
->
member
.
cell
.
nRightBoundary
);
cell
=
cell
->
member
.
cell
.
next_cell
;
cell
=
cell
->
member
.
cell
.
next_cell
;
}
while
(
cell
->
member
.
cell
.
next_cell
);
}
while
(
cell
->
member
.
cell
.
next_cell
);
}
else
{
/* v1.0 - 3.0 */
}
const
ME_Border
*
borders
[
4
]
=
{
&
para
->
member
.
para
.
border
.
top
,
else
/* v1.0 - 3.0 */
&
para
->
member
.
para
.
border
.
left
,
{
&
para
->
member
.
para
.
border
.
bottom
,
const
ME_Border
*
borders
[
4
]
=
{
&
para
->
border
.
top
,
&
para
->
member
.
para
.
border
.
right
};
&
para
->
border
.
left
,
PARAFORMAT2
*
pFmt
=
&
para
->
member
.
para
.
fmt
;
&
para
->
border
.
bottom
,
&
para
->
border
.
right
};
assert
(
!
(
para
->
member
.
para
.
nFlags
&
(
MEPF_ROWSTART
|
MEPF_ROWEND
|
MEPF_CELL
)));
PARAFORMAT2
*
pFmt
=
&
para
->
fmt
;
assert
(
!
(
para
->
nFlags
&
(
MEPF_ROWSTART
|
MEPF_ROWEND
|
MEPF_CELL
))
);
if
(
pFmt
->
dxOffset
)
if
(
pFmt
->
dxOffset
)
sprintf
(
props
+
strlen
(
props
),
"
\\
trgaph%d"
,
pFmt
->
dxOffset
);
sprintf
(
props
+
strlen
(
props
),
"
\\
trgaph%d"
,
pFmt
->
dxOffset
);
if
(
pFmt
->
dxStartIndent
)
if
(
pFmt
->
dxStartIndent
)
...
@@ -533,54 +536,46 @@ static BOOL stream_out_para_num( ME_OutStream *stream, ME_Paragraph *para, BOOL
...
@@ -533,54 +536,46 @@ static BOOL stream_out_para_num( ME_OutStream *stream, ME_Paragraph *para, BOOL
return
TRUE
;
return
TRUE
;
}
}
static
BOOL
static
BOOL
stream_out_para_props
(
ME_TextEditor
*
editor
,
ME_OutStream
*
pStream
,
ME_StreamOutRTFParaProps
(
ME_TextEditor
*
editor
,
ME_OutStream
*
pStream
,
ME_Paragraph
*
para
)
ME_DisplayItem
*
para
)
{
{
PARAFORMAT2
*
fmt
=
&
para
->
member
.
para
.
fmt
;
PARAFORMAT2
*
fmt
=
&
para
->
fmt
;
char
props
[
STREAMOUT_BUFFER_SIZE
]
=
""
;
char
props
[
STREAMOUT_BUFFER_SIZE
]
=
""
;
int
i
;
int
i
;
ME_Paragraph
*
prev_para
=
NULL
;
ME_Paragraph
*
prev_para
=
para_prev
(
para
)
;
if
(
para
->
member
.
para
.
prev_para
->
type
==
diParagraph
)
if
(
!
editor
->
bEmulateVersion10
)
/* v4.1 */
prev_para
=
&
para
->
member
.
para
.
prev_para
->
member
.
para
;
{
if
(
para
->
nFlags
&
MEPF_ROWSTART
)
if
(
!
editor
->
bEmulateVersion10
)
{
/* v4.1 */
{
if
(
para
->
member
.
para
.
nFlags
&
MEPF_ROWSTART
)
{
pStream
->
nNestingLevel
++
;
pStream
->
nNestingLevel
++
;
if
(
pStream
->
nNestingLevel
==
1
)
{
if
(
pStream
->
nNestingLevel
==
1
)
if
(
!
ME_StreamOutRTFTableProps
(
editor
,
pStream
,
para
))
if
(
!
stream_out_table_props
(
editor
,
pStream
,
para
))
return
FALSE
;
return
FALSE
;
}
return
TRUE
;
return
TRUE
;
}
else
if
(
para
->
member
.
para
.
nFlags
&
MEPF_ROWEND
)
{
}
else
if
(
para
->
nFlags
&
MEPF_ROWEND
)
{
pStream
->
nNestingLevel
--
;
pStream
->
nNestingLevel
--
;
if
(
pStream
->
nNestingLevel
>=
1
)
{
if
(
pStream
->
nNestingLevel
>=
1
)
if
(
!
ME_StreamOutPrint
(
pStream
,
"{
\\
*
\\
nesttableprops"
))
{
return
FALSE
;
if
(
!
ME_StreamOutPrint
(
pStream
,
"{
\\
*
\\
nesttableprops"
))
return
FALSE
;
if
(
!
ME_StreamOutRTFTableProps
(
editor
,
pStream
,
para
))
if
(
!
stream_out_table_props
(
editor
,
pStream
,
para
))
return
FALSE
;
return
FALSE
;
if
(
!
ME_StreamOutPrint
(
pStream
,
"
\\
nestrow}{
\\
nonesttables
\\
par}
\r\n
"
))
return
FALSE
;
if
(
!
ME_StreamOutPrint
(
pStream
,
"
\\
nestrow}{
\\
nonesttables
\\
par}
\r\n
"
))
return
FALSE
;
}
else
{
if
(
!
ME_StreamOutPrint
(
pStream
,
"
\\
row
\r\n
"
))
return
FALSE
;
}
}
else
if
(
!
ME_StreamOutPrint
(
pStream
,
"
\\
row
\r\n
"
))
return
FALSE
;
return
TRUE
;
return
TRUE
;
}
}
}
else
{
/* v1.0 - 3.0 */
}
if
(
para
->
member
.
para
.
fmt
.
dwMask
&
PFM_TABLE
&&
else
/* v1.0 - 3.0 */
para
->
member
.
para
.
fmt
.
wEffects
&
PFE_TABLE
)
{
{
if
(
para
->
fmt
.
dwMask
&
PFM_TABLE
&&
para
->
fmt
.
wEffects
&
PFE_TABLE
)
if
(
!
ME_StreamOutRTFTableProps
(
editor
,
pStream
,
para
))
if
(
!
stream_out_table_props
(
editor
,
pStream
,
para
))
return
FALSE
;
return
FALSE
;
}
}
}
if
(
prev_para
&&
!
memcmp
(
fmt
,
&
prev_para
->
fmt
,
sizeof
(
*
fmt
)
))
if
(
prev_para
&&
!
memcmp
(
fmt
,
&
prev_para
->
fmt
,
sizeof
(
*
fmt
)
))
{
{
if
(
fmt
->
wNumbering
)
if
(
fmt
->
wNumbering
)
return
stream_out_para_num
(
pStream
,
&
para
->
member
.
para
,
FALSE
);
return
stream_out_para_num
(
pStream
,
para
,
FALSE
);
return
TRUE
;
return
TRUE
;
}
}
...
@@ -588,14 +583,15 @@ ME_StreamOutRTFParaProps(ME_TextEditor *editor, ME_OutStream *pStream,
...
@@ -588,14 +583,15 @@ ME_StreamOutRTFParaProps(ME_TextEditor *editor, ME_OutStream *pStream,
return
FALSE
;
return
FALSE
;
if
(
fmt
->
wNumbering
)
if
(
fmt
->
wNumbering
)
if
(
!
stream_out_para_num
(
pStream
,
&
para
->
member
.
para
,
TRUE
))
return
FALSE
;
if
(
!
stream_out_para_num
(
pStream
,
para
,
TRUE
))
return
FALSE
;
if
(
!
editor
->
bEmulateVersion10
)
{
/* v4.1 */
if
(
!
editor
->
bEmulateVersion10
)
/* v4.1 */
if
(
pStream
->
nNestingLevel
>
0
)
{
strcat
(
props
,
"
\\
intbl"
);
if
(
pStream
->
nNestingLevel
>
0
)
strcat
(
props
,
"
\\
intbl"
);
if
(
pStream
->
nNestingLevel
>
1
)
if
(
pStream
->
nNestingLevel
>
1
)
sprintf
(
props
+
strlen
(
props
),
"
\\
itap%d"
,
pStream
->
nNestingLevel
);
sprintf
(
props
+
strlen
(
props
),
"
\\
itap%d"
,
pStream
->
nNestingLevel
);
}
}
else
{
/* v1.0 - 3.0 */
else
/* v1.0 - 3.0 */
{
if
(
fmt
->
dwMask
&
PFM_TABLE
&&
fmt
->
wEffects
&
PFE_TABLE
)
if
(
fmt
->
dwMask
&
PFM_TABLE
&&
fmt
->
wEffects
&
PFE_TABLE
)
strcat
(
props
,
"
\\
intbl"
);
strcat
(
props
,
"
\\
intbl"
);
}
}
...
@@ -605,8 +601,10 @@ ME_StreamOutRTFParaProps(ME_TextEditor *editor, ME_OutStream *pStream,
...
@@ -605,8 +601,10 @@ ME_StreamOutRTFParaProps(ME_TextEditor *editor, ME_OutStream *pStream,
* set very different from the documentation.
* set very different from the documentation.
* (Tested with RichEdit 5.50.25.0601) */
* (Tested with RichEdit 5.50.25.0601) */
if
(
fmt
->
dwMask
&
PFM_ALIGNMENT
)
{
if
(
fmt
->
dwMask
&
PFM_ALIGNMENT
)
switch
(
fmt
->
wAlignment
)
{
{
switch
(
fmt
->
wAlignment
)
{
case
PFA_LEFT
:
case
PFA_LEFT
:
/* Default alignment: not emitted */
/* Default alignment: not emitted */
break
;
break
;
...
@@ -622,10 +620,12 @@ ME_StreamOutRTFParaProps(ME_TextEditor *editor, ME_OutStream *pStream,
...
@@ -622,10 +620,12 @@ ME_StreamOutRTFParaProps(ME_TextEditor *editor, ME_OutStream *pStream,
}
}
}
}
if
(
fmt
->
dwMask
&
PFM_LINESPACING
)
{
if
(
fmt
->
dwMask
&
PFM_LINESPACING
)
{
/* FIXME: MSDN says that the bLineSpacingRule field is controlled by the
/* FIXME: MSDN says that the bLineSpacingRule field is controlled by the
* PFM_SPACEAFTER flag. Is that true? I don't believe so. */
* PFM_SPACEAFTER flag. Is that true? I don't believe so. */
switch
(
fmt
->
bLineSpacingRule
)
{
switch
(
fmt
->
bLineSpacingRule
)
{
case
0
:
/* Single spacing */
case
0
:
/* Single spacing */
strcat
(
props
,
"
\\
sl-240
\\
slmult1"
);
strcat
(
props
,
"
\\
sl-240
\\
slmult1"
);
break
;
break
;
...
@@ -676,8 +676,10 @@ ME_StreamOutRTFParaProps(ME_TextEditor *editor, ME_OutStream *pStream,
...
@@ -676,8 +676,10 @@ ME_StreamOutRTFParaProps(ME_TextEditor *editor, ME_OutStream *pStream,
if
(
fmt
->
dwMask
&
PFM_TABSTOPS
)
{
if
(
fmt
->
dwMask
&
PFM_TABSTOPS
)
{
static
const
char
*
const
leader
[
6
]
=
{
""
,
"
\\
tldot"
,
"
\\
tlhyph"
,
"
\\
tlul"
,
"
\\
tlth"
,
"
\\
tleq"
};
static
const
char
*
const
leader
[
6
]
=
{
""
,
"
\\
tldot"
,
"
\\
tlhyph"
,
"
\\
tlul"
,
"
\\
tlth"
,
"
\\
tleq"
};
for
(
i
=
0
;
i
<
fmt
->
cTabCount
;
i
++
)
{
for
(
i
=
0
;
i
<
fmt
->
cTabCount
;
i
++
)
switch
((
fmt
->
rgxTabs
[
i
]
>>
24
)
&
0xF
)
{
{
switch
((
fmt
->
rgxTabs
[
i
]
>>
24
)
&
0xf
)
{
case
1
:
case
1
:
strcat
(
props
,
"
\\
tqc"
);
strcat
(
props
,
"
\\
tqc"
);
break
;
break
;
...
@@ -704,7 +706,8 @@ ME_StreamOutRTFParaProps(ME_TextEditor *editor, ME_OutStream *pStream,
...
@@ -704,7 +706,8 @@ ME_StreamOutRTFParaProps(ME_TextEditor *editor, ME_OutStream *pStream,
if
(
fmt
->
sStyle
!=
-
1
)
if
(
fmt
->
sStyle
!=
-
1
)
sprintf
(
props
+
strlen
(
props
),
"
\\
s%d"
,
fmt
->
sStyle
);
sprintf
(
props
+
strlen
(
props
),
"
\\
s%d"
,
fmt
->
sStyle
);
if
(
fmt
->
dwMask
&
PFM_SHADING
)
{
if
(
fmt
->
dwMask
&
PFM_SHADING
)
{
static
const
char
*
const
style
[
16
]
=
{
""
,
"
\\
bgdkhoriz"
,
"
\\
bgdkvert"
,
"
\\
bgdkfdiag"
,
static
const
char
*
const
style
[
16
]
=
{
""
,
"
\\
bgdkhoriz"
,
"
\\
bgdkvert"
,
"
\\
bgdkfdiag"
,
"
\\
bgdkbdiag"
,
"
\\
bgdkcross"
,
"
\\
bgdkdcross"
,
"
\\
bgdkbdiag"
,
"
\\
bgdkcross"
,
"
\\
bgdkdcross"
,
"
\\
bghoriz"
,
"
\\
bgvert"
,
"
\\
bgfdiag"
,
"
\\
bghoriz"
,
"
\\
bgvert"
,
"
\\
bgfdiag"
,
...
@@ -1025,7 +1028,7 @@ static BOOL ME_StreamOutRTF(ME_TextEditor *editor, ME_OutStream *pStream,
...
@@ -1025,7 +1028,7 @@ static BOOL ME_StreamOutRTF(ME_TextEditor *editor, ME_OutStream *pStream,
if
(
cursor
.
pPara
!=
prev_para
)
if
(
cursor
.
pPara
!=
prev_para
)
{
{
prev_para
=
cursor
.
pPara
;
prev_para
=
cursor
.
pPara
;
if
(
!
ME_StreamOutRTFParaProps
(
editor
,
pStream
,
cursor
.
pPara
))
if
(
!
stream_out_para_props
(
editor
,
pStream
,
&
cursor
.
pPara
->
member
.
para
))
return
FALSE
;
return
FALSE
;
}
}
...
...
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