Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
O
onlyoffice_core
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Boris Kocherov
onlyoffice_core
Commits
bb830744
Commit
bb830744
authored
Nov 08, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
ac0450ac
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
75 additions
and
58 deletions
+75
-58
ASCOfficeRtfFile/RtfFormatLib/source/RtfChar.cpp
ASCOfficeRtfFile/RtfFormatLib/source/RtfChar.cpp
+73
-0
ASCOfficeRtfFile/RtfFormatLib/source/RtfChar.h
ASCOfficeRtfFile/RtfFormatLib/source/RtfChar.h
+2
-58
No files found.
ASCOfficeRtfFile/RtfFormatLib/source/RtfChar.cpp
View file @
bb830744
...
...
@@ -32,6 +32,79 @@
#include "RtfChar.h"
#include "RtfDocument.h"
CString
RtfChar
::
RenderToOOX
(
RenderParameter
oRenderParameter
)
{
CString
sResult
;
if
(
RENDER_TO_OOX_PARAM_RUN
==
oRenderParameter
.
nType
)
{
bool
bInsert
=
false
;
bool
bDelete
=
false
;
if
(
m_oProperty
.
m_nDeleted
!=
PROP_DEF
)
{
bDelete
=
true
;
sResult
+=
L"<w:del>"
;
m_oProperty
.
m_nDeleted
=
PROP_DEF
;
}
if
(
m_oProperty
.
m_nRevised
!=
PROP_DEF
)
{
bInsert
=
true
;
sResult
+=
L"<w:ins>"
;
m_oProperty
.
m_nRevised
=
PROP_DEF
;
}
sResult
+=
L"<w:r>"
;
sResult
+=
L"<w:rPr>"
;
sResult
+=
m_oProperty
.
RenderToOOX
(
oRenderParameter
);
sResult
+=
L"</w:rPr>"
;
sResult
+=
renderTextToXML
(
L"Text"
,
bDelete
);
sResult
+=
L"</w:r>"
;
if
(
bDelete
)
sResult
+=
L"</w:del>"
;
if
(
bInsert
)
sResult
+=
L"</w:ins>"
;
}
else
if
(
RENDER_TO_OOX_PARAM_TEXT
==
oRenderParameter
.
nType
)
{
sResult
=
renderTextToXML
(
L"Text"
);
}
else
if
(
RENDER_TO_OOX_PARAM_MATH
==
oRenderParameter
.
nType
)
{
sResult
+=
L"<m:r>"
;
sResult
+=
m_oProperty
.
RenderToOOX
(
oRenderParameter
);
//w:rPr внутри
sResult
+=
renderTextToXML
(
L"Math"
);
sResult
+=
L"</m:r>"
;
}
else
if
(
RENDER_TO_OOX_PARAM_PLAIN
==
oRenderParameter
.
nType
)
sResult
=
m_sChars
;
return
sResult
;
}
CString
renderTextToXML
(
CString
sParam
,
bool
bDelete
)
{
CString
sResult
;
if
(
L"Text"
==
sParam
)
{
if
(
bDelete
)
{
sResult
+=
L"<w:t xml:space=
\"
preserve
\"
>"
;
sResult
+=
Utils
::
PrepareToXML
(
m_sChars
);
sResult
+=
L"</w:t>"
;
}
else
{
sResult
+=
L"<w:delText>"
;
sResult
+=
Utils
::
PrepareToXML
(
m_sChars
);
sResult
+=
L"</w:delText>"
;
}
}
else
if
(
L"Math"
==
sParam
&&
!
m_sChars
.
IsEmpty
())
{
sResult
+=
L"<m:t>"
;
sResult
+=
Utils
::
PrepareToXML
(
m_sChars
);
sResult
+=
L"</m:t>"
;
}
return
sResult
;
}
CString
RtfChar
::
renderRtfText
(
CString
&
sText
,
void
*
poDocument
,
RtfCharProperty
*
oCharProperty
)
{
RtfDocument
*
oDocument
=
static_cast
<
RtfDocument
*>
(
poDocument
);
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfChar.h
View file @
bb830744
...
...
@@ -314,38 +314,7 @@ public:
{
return
m_sChars
;
}
CString
RenderToOOX
(
RenderParameter
oRenderParameter
)
{
CString
sResult
;
if
(
RENDER_TO_OOX_PARAM_RUN
==
oRenderParameter
.
nType
)
{
if
(
m_oProperty
.
m_nDeleted
!=
PROP_DEF
)
sResult
+=
L"<w:del>"
;
if
(
m_oProperty
.
m_nRevised
!=
PROP_DEF
)
sResult
+=
L"<w:ins>"
;
sResult
+=
L"<w:r>"
;
sResult
+=
L"<w:rPr>"
;
sResult
+=
m_oProperty
.
RenderToOOX
(
oRenderParameter
);
sResult
+=
L"</w:rPr>"
;
sResult
+=
renderTextToXML
(
L"Text"
);
sResult
+=
L"</w:r>"
;
if
(
m_oProperty
.
m_nDeleted
!=
PROP_DEF
)
sResult
+=
L"</w:del>"
;
if
(
m_oProperty
.
m_nRevised
!=
PROP_DEF
)
sResult
+=
L"</w:ins>"
;
}
else
if
(
RENDER_TO_OOX_PARAM_TEXT
==
oRenderParameter
.
nType
)
sResult
=
renderTextToXML
(
L"Text"
);
else
if
(
RENDER_TO_OOX_PARAM_MATH
==
oRenderParameter
.
nType
)
{
sResult
+=
L"<m:r>"
;
sResult
+=
m_oProperty
.
RenderToOOX
(
oRenderParameter
);
//w:rPr внутри
sResult
+=
renderTextToXML
(
L"Math"
);
sResult
+=
L"</m:r>"
;
}
else
if
(
RENDER_TO_OOX_PARAM_PLAIN
==
oRenderParameter
.
nType
)
sResult
=
m_sChars
;
return
sResult
;
}
CString
RenderToOOX
(
RenderParameter
oRenderParameter
);
static
CString
renderRtfText
(
CString
&
sText
,
void
*
poDocument
,
RtfCharProperty
*
oCharProperty
=
NULL
);
CString
RenderToRtf
(
RenderParameter
oRenderParameter
)
...
...
@@ -384,32 +353,7 @@ public:
return
result
;
}
private:
CString
renderTextToXML
(
CString
sParam
)
{
CString
sResult
;
if
(
L"Text"
==
sParam
)
{
if
(
m_oProperty
.
m_nDeleted
==
PROP_DEF
)
{
sResult
+=
L"<w:t xml:space=
\"
preserve
\"
>"
;
sResult
+=
Utils
::
PrepareToXML
(
m_sChars
);
sResult
+=
L"</w:t>"
;
}
else
{
sResult
+=
L"<w:delText>"
;
sResult
+=
Utils
::
PrepareToXML
(
m_sChars
);
sResult
+=
L"</w:delText>"
;
}
}
else
if
(
L"Math"
==
sParam
&&
!
m_sChars
.
IsEmpty
())
{
sResult
+=
L"<m:t>"
;
sResult
+=
Utils
::
PrepareToXML
(
m_sChars
);
sResult
+=
L"</m:t>"
;
}
return
sResult
;
}
CString
renderTextToXML
(
CString
sParam
,
bool
bDelete
=
false
);
};
class
RtfCharNative
:
public
RtfChar
{
...
...
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