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
22473e7f
Commit
22473e7f
authored
Nov 15, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
88f85259
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
183 additions
and
0 deletions
+183
-0
ASCOfficeRtfFile/RtfFormatLib/source/RtfParagraph .cpp
ASCOfficeRtfFile/RtfFormatLib/source/RtfParagraph .cpp
+183
-0
No files found.
ASCOfficeRtfFile/RtfFormatLib/source/RtfParagraph .cpp
0 → 100644
View file @
22473e7f
/*
* (c) Copyright Ascensio System SIA 2010-2016
*
* This program is a free software product. You can redistribute it and/or
* modify it under the terms of the GNU Affero General Public License (AGPL)
* version 3 as published by the Free Software Foundation. In accordance with
* Section 7(a) of the GNU AGPL its Section 15 shall be amended to the effect
* that Ascensio System SIA expressly excludes the warranty of non-infringement
* of any third-party rights.
*
* This program is distributed WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. For
* details, see the GNU AGPL at: http://www.gnu.org/licenses/agpl-3.0.html
*
* You can contact Ascensio System SIA at Lubanas st. 125a-25, Riga, Latvia,
* EU, LV-1021.
*
* The interactive user interfaces in modified source and object code versions
* of the Program must display Appropriate Legal Notices, as required under
* Section 5 of the GNU AGPL version 3.
*
* Pursuant to Section 7(b) of the License you must retain the original Product
* logo when distributing the program. Pursuant to Section 7(e) we decline to
* grant you any rights under trademark law for use of our trademarks.
*
* All the Product's GUI elements, including illustrations and icon sets, as
* well as technical writing content are licensed under the terms of the
* Creative Commons Attribution-ShareAlike 4.0 International. See the License
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
#include "RtfParagraph.h"
#include "RtfWriter.h"
int
RtfParagraph
::
AddItem
(
IDocumentElementPtr
piRend
)
{
if
(
TYPE_RTF_CHAR
==
piRend
->
GetType
()
)
{
if
(
m_aArray
.
size
()
>
0
&&
TYPE_RTF_CHAR
==
m_aArray
[
m_aArray
.
size
()
-
1
]
->
GetType
()
)
//соединяем два текста с одинаковыми свойствами
{
RtfCharPtr
oCurChar
=
boost
::
static_pointer_cast
<
RtfChar
,
IDocumentElement
>
(
piRend
);
RtfCharPtr
oPrevChar
=
boost
::
static_pointer_cast
<
RtfChar
,
IDocumentElement
>
(
m_aArray
[
m_aArray
.
size
()
-
1
]
);
if
(
oCurChar
->
m_oProperty
==
oPrevChar
->
m_oProperty
)
{
oPrevChar
->
AddText
(
oCurChar
->
GetText
()
);
return
(
int
)
m_aArray
.
size
()
-
1
;
}
}
}
ItemContainer
<
IDocumentElementPtr
>::
AddItem
(
piRend
);
return
(
int
)
m_aArray
.
size
()
-
1
;
}
CString
RtfParagraph
::
RenderToRtf
(
RenderParameter
oRenderParameter
)
{
CString
sResult
;
if
(
RENDER_TO_RTF_PARAM_CHAR
==
oRenderParameter
.
nType
)
{
for
(
int
i
=
0
;
i
<
(
int
)
m_aArray
.
size
();
i
++
)
{
sResult
+=
m_aArray
[
i
]
->
RenderToRtf
(
oRenderParameter
);
}
}
else
{
sResult
+=
L"
\\
pard
\\
plain"
;
sResult
+=
m_oProperty
.
RenderToRtf
(
oRenderParameter
)
;
if
(
NULL
!=
m_oOldList
)
sResult
+=
m_oOldList
->
RenderToRtf
(
oRenderParameter
)
;
for
(
int
i
=
0
;
i
<
(
int
)
m_aArray
.
size
();
i
++
)
{
sResult
+=
m_aArray
[
i
]
->
RenderToRtf
(
oRenderParameter
);
}
sResult
+=
m_oProperty
.
m_oCharProperty
.
RenderToRtf
(
oRenderParameter
);
//if( RENDER_TO_RTF_PARAM_NO_PAR != oRenderParameter.nValue )
// sResult += T("\\par";
}
return
sResult
;
}
CString
RtfParagraph
::
RenderToOOX
(
RenderParameter
oRenderParameter
)
{
CString
sResult
;
if
(
RENDER_TO_OOX_PARAM_PLAIN
==
oRenderParameter
.
nType
)
{
for
(
int
i
=
0
;
i
<
(
int
)
m_aArray
.
size
();
i
++
)
{
sResult
+=
m_aArray
[
i
]
->
RenderToOOX
(
oRenderParameter
);
}
}
else
if
(
RENDER_TO_OOX_PARAM_RUN
==
oRenderParameter
.
nType
)
{
for
(
int
i
=
0
;
i
<
(
int
)
m_aArray
.
size
();
i
++
)
{
sResult
+=
m_aArray
[
i
]
->
RenderToOOX
(
oRenderParameter
);
}
}
else
if
(
RENDER_TO_OOX_PARAM_MATH
==
oRenderParameter
.
nType
)
{
if
(
m_aArray
.
size
()
<
1
)
{
sResult
+=
L"<w:rPr>"
;
sResult
+=
m_oProperty
.
m_oCharProperty
.
RenderToOOX
(
oRenderParameter
);
sResult
+=
L"</w:rPr>"
;
}
else
{
for
(
int
i
=
0
;
i
<
(
int
)
m_aArray
.
size
();
i
++
)
{
sResult
+=
m_aArray
[
i
]
->
RenderToOOX
(
oRenderParameter
);
}
}
}
else
{
RenderParameter
oNewParam
=
oRenderParameter
;
oNewParam
.
nType
=
RENDER_TO_OOX_PARAM_RUN
;
bool
bCanConvertToNumbering
=
false
;
if
(
NULL
!=
m_oOldList
)
bCanConvertToNumbering
=
m_oOldList
->
CanConvertToNumbering
();
sResult
+=
L"<w:p>"
;
sResult
+=
L"<w:pPr>"
;
m_oProperty
.
m_bOldList
=
(
NULL
!=
m_oOldList
);
sResult
+=
m_oProperty
.
RenderToOOX
(
oRenderParameter
);
if
(
NULL
!=
m_oOldList
)
{
//для OldList
if
(
true
==
bCanConvertToNumbering
)
sResult
+=
m_oOldList
->
RenderToOOX
(
oRenderParameter
);
}
sResult
+=
L"</w:pPr>"
;
if
(
NULL
!=
m_oOldList
)
{
//для OldList
if
(
false
==
bCanConvertToNumbering
&&
NULL
!=
m_oOldList
->
m_oText
)
{
RtfCharProperty
oCharProp
=
m_oProperty
.
m_oCharProperty
;
if
(
NULL
!=
m_oOldList
->
m_oText
)
oCharProp
.
m_nFont
=
m_oOldList
->
m_oText
->
m_oProperty
.
m_oCharProperty
.
m_nFont
;
oNewParam
=
oRenderParameter
;
oNewParam
.
nType
=
RENDER_TO_OOX_PARAM_TEXT
;
for
(
int
i
=
0
;
i
<
m_oOldList
->
m_oText
->
GetCount
();
i
++
)
{
sResult
+=
L"<w:r>"
;
sResult
+=
L"<w:rPr>"
;
sResult
+=
oCharProp
.
RenderToOOX
(
oRenderParameter
);
sResult
+=
L"</w:rPr>"
;
sResult
+=
m_oOldList
->
m_oText
->
m_aArray
[
i
]
->
RenderToOOX
(
oNewParam
);
sResult
+=
L"</w:r>"
;
}
}
}
oNewParam
.
nType
=
RENDER_TO_OOX_PARAM_RUN
;
CString
ParagraphContent
;
for
(
int
i
=
0
;
i
<
m_aArray
.
size
();
i
++
)
{
ParagraphContent
+=
m_aArray
[
i
]
->
RenderToOOX
(
oNewParam
);
}
if
(
!
ParagraphContent
.
IsEmpty
())
sResult
+=
ParagraphContent
;
sResult
+=
L"</w:p>"
;
}
return
sResult
;
}
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