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
e12f544b
Commit
e12f544b
authored
Apr 21, 2016
by
ElenaSubbotina
Committed by
Alexander Trofimov
May 21, 2016
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OdfFormatWriter, RtfFormatReader - правка багов по результатам тестирования
parent
3590487f
Changes
9
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
197 additions
and
159 deletions
+197
-159
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
+9
-4
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h
+1
-1
ASCOfficeDocFile/DocDocxConverter/MainDocumentMapping.cpp
ASCOfficeDocFile/DocDocxConverter/MainDocumentMapping.cpp
+11
-6
ASCOfficeOdfFileW/ASCOfficeOdfFileWTest/ASCOfficeOdfFileWTest.cpp
...eOdfFileW/ASCOfficeOdfFileWTest/ASCOfficeOdfFileWTest.cpp
+2
-0
ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.cpp
ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.cpp
+5
-2
ASCOfficeRtfFile/RtfFormatLib/source/RtfMath.h
ASCOfficeRtfFile/RtfFormatLib/source/RtfMath.h
+18
-11
ASCOfficeRtfFile/RtfFormatLib/source/RtfParagraph.h
ASCOfficeRtfFile/RtfFormatLib/source/RtfParagraph.h
+14
-0
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp
+136
-135
ASCOfficeRtfFile/RtfFormatLib/source/UniversalConverterUtils.h
...ficeRtfFile/RtfFormatLib/source/UniversalConverterUtils.h
+1
-0
No files found.
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
View file @
e12f544b
...
...
@@ -785,7 +785,9 @@ namespace DocFileFormat
if
(
!
text
.
empty
())
{
writeTextStart
(
textType
);
//bool preserve_space = (text.find(_T("\x20")) != text.npos) ? true : false;
writeTextStart
(
textType
,
true
/*preserve_space*/
);
m_pXmlWriter
->
WriteString
(
text
.
c_str
());
...
...
@@ -802,7 +804,9 @@ namespace DocFileFormat
{
if
(
!
text
.
empty
()
)
{
writeTextStart
(
textType
);
//bool preserve_space = (text.find(_T("\x20")) != text.npos) ? true : false;
writeTextStart
(
textType
,
true
/*preserve_space*/
);
m_pXmlWriter
->
WriteString
(
text
.
c_str
()
);
...
...
@@ -810,12 +814,13 @@ namespace DocFileFormat
}
}
void
DocumentMapping
::
writeTextStart
(
const
std
::
wstring
&
textType
)
void
DocumentMapping
::
writeTextStart
(
const
std
::
wstring
&
textType
,
bool
preserve_space
)
{
std
::
wstring
str
=
(
std
::
wstring
(
_T
(
"w:"
)
)
+
textType
);
m_pXmlWriter
->
WriteNodeBegin
(
str
.
c_str
(),
TRUE
);
{
if
(
preserve_space
)
{
m_pXmlWriter
->
WriteAttribute
(
_T
(
"xml:space"
),
_T
(
"preserve"
)
);
}
m_pXmlWriter
->
WriteNodeEnd
(
_T
(
""
),
TRUE
,
FALSE
);
...
...
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h
View file @
e12f544b
...
...
@@ -61,7 +61,7 @@ namespace DocFileFormat
/// Writes the given text to the document
void
writeText
(
vector
<
wchar_t
>*
chars
,
int
initialCp
,
CharacterPropertyExceptions
*
chpx
,
bool
writeDeletedText
);
void
writeTextElement
(
const
wstring
&
text
,
const
wstring
&
textType
);
void
writeTextStart
(
const
wstring
&
textType
);
void
writeTextStart
(
const
wstring
&
textType
,
bool
preserve_space
);
void
writeTextEnd
(
const
wstring
&
textType
);
/// Searches for bookmarks in the list of characters.
vector
<
int
>
searchBookmarks
(
vector
<
wchar_t
>*
chars
,
int
initialCp
);
...
...
ASCOfficeDocFile/DocDocxConverter/MainDocumentMapping.cpp
View file @
e12f544b
...
...
@@ -93,12 +93,6 @@ namespace DocFileFormat
m_pXmlWriter
->
WriteNodeBegin
(
_T
(
"w:p"
)
);
//start run
m_pXmlWriter
->
WriteNodeBegin
(
_T
(
"w:r"
)
);
//open a new w:t element
m_pXmlWriter
->
WriteNodeBegin
(
_T
(
"w:t"
),
TRUE
);
m_pXmlWriter
->
WriteAttribute
(
_T
(
"xml:space"
),
_T
(
"preserve"
)
);
m_pXmlWriter
->
WriteNodeEnd
(
_T
(
""
),
TRUE
,
FALSE
);
// Write text
int
fc
=
m_document
->
FindFileCharPos
(
0
);
int
fcEnd
=
m_document
->
FindFileCharPos
(
countTextRel
);
...
...
@@ -106,7 +100,18 @@ namespace DocFileFormat
// Read the chars
vector
<
wchar_t
>*
chpxChars
=
m_document
->
m_PieceTable
->
GetEncodingChars
(
fc
,
fcEnd
,
m_document
->
WordDocumentStream
);
//<! NEED OPTIMIZE
wstring
text
(
chpxChars
->
begin
(),
chpxChars
->
end
());
//open a new w:t element
m_pXmlWriter
->
WriteNodeBegin
(
_T
(
"w:t"
),
TRUE
);
//if (text.find(_T("\x20")) != text.npos)
{
m_pXmlWriter
->
WriteAttribute
(
_T
(
"xml:space"
),
_T
(
"preserve"
)
);
}
m_pXmlWriter
->
WriteNodeEnd
(
_T
(
""
),
TRUE
,
FALSE
);
// Write text
m_pXmlWriter
->
WriteString
(
text
.
c_str
());
RELEASEOBJECT
(
chpxChars
);
//close previous w:t ...
...
...
ASCOfficeOdfFileW/ASCOfficeOdfFileWTest/ASCOfficeOdfFileWTest.cpp
View file @
e12f544b
...
...
@@ -84,6 +84,8 @@ std::wstring DetectTypeDocument(const std::wstring & pathOOX)
int
_tmain
(
int
argc
,
_TCHAR
*
argv
[])
{
if
(
argc
<
3
)
return
0
;
HRESULT
hr
=
S_OK
;
boost
::
timer
t1
;
//////////////////////////////////////////////////////////////////////////
...
...
ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.cpp
View file @
e12f544b
...
...
@@ -972,7 +972,7 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
//oox_section_pr = last_section_properties;
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
if
(
!
continuous
/* || root*/
)
if
(
!
continuous
||
(
root
&&
odt_context
->
page_layout_context
()
->
last_master
()
==
NULL
)
)
{
odt_context
->
page_layout_context
()
->
start_master_page
(
root
?
L"Standard"
:
L""
);
}
...
...
@@ -1194,7 +1194,10 @@ void DocxConverter::convert(OOX::Logic::CSectionProperty *oox_section_pr, bool r
}
if
(
!
continuous
)
odt_context
->
page_layout_context
()
->
end_master_page
();
//
if
(
root
)
odt_context
->
page_layout_context
()
->
set_current_master_page_base
();
if
(
root
)
{
odt_context
->
page_layout_context
()
->
set_current_master_page_base
();
}
last_section_properties
=
oox_section_pr
;
}
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfMath.h
View file @
e12f544b
...
...
@@ -117,24 +117,31 @@ public:
RenderParameter
oNewParam
=
oRenderParameter
;
sResult
.
Append
(
_T
(
"<"
)
);
sResult
+=
m_sOOXName
;
oNewParam
.
nType
=
RENDER_TO_OOX_PARAM_TEXT
;
CString
sProp
=
oProperty
.
RenderToOOX
(
oNewParam
);
oNewParam
.
nType
=
RENDER_TO_OOX_PARAM_MATH
;
CString
sVal
=
m_oVal
.
RenderToOOX
(
oNewParam
);
//CString sVal
= m_oVal.RenderToOOX( oNewParam );
if
(
false
==
sVal
.
IsEmpty
()
)
{
sResult
.
Append
(
_T
(
" w:val=
\"
"
)
);
sResult
+=
sVal
;
sResult
.
Append
(
_T
(
"
\"
"
)
);
}
//
if( false == sVal.IsEmpty() )
//
{
//
sResult.Append( _T(" w:val=\"") );
//
sResult += sVal;
//
sResult.Append( _T("\"") );
//
}
sResult
.
Append
(
_T
(
">"
)
);
oNewParam
.
nType
=
RENDER_TO_OOX_PARAM_TEXT
;
sResult
.
Append
(
oProperty
.
RenderToOOX
(
oNewParam
)
);
sResult
.
Append
(
sProp
);
for
(
int
i
=
0
;
i
<
(
int
)
m_aArray
.
size
();
i
++
)
if
(
m_aArray
.
size
()
==
1
)
sResult
.
Append
(
m_aArray
[
0
]
->
RenderToOOX
(
oNewParam
));
else
{
sResult
.
Append
(
m_aArray
[
i
]
->
RenderToOOX
(
oNewParam
));
for
(
int
i
=
1
;
i
<
(
int
)
m_aArray
.
size
();
i
++
)
{
sResult
.
Append
(
m_aArray
[
i
]
->
RenderToOOX
(
oNewParam
));
}
}
sResult
.
Append
(
_T
(
"</"
)
);
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfParagraph.h
View file @
e12f544b
...
...
@@ -102,6 +102,20 @@ public:
for
(
int
i
=
0
;
i
<
(
int
)
m_aArray
.
size
();
i
++
)
sResult
.
Append
(
m_aArray
[
i
]
->
RenderToOOX
(
oRenderParameter
)
);
}
else
if
(
RENDER_TO_OOX_PARAM_MATH
==
oRenderParameter
.
nType
)
{
if
(
m_aArray
.
size
()
<
1
)
{
sResult
.
Append
(
_T
(
"<w:rPr>"
)
);
sResult
.
Append
(
m_oProperty
.
m_oCharProperty
.
RenderToOOX
(
oRenderParameter
)
);
sResult
.
Append
(
_T
(
"</w:rPr>"
)
);
}
else
{
for
(
int
i
=
0
;
i
<
(
int
)
m_aArray
.
size
();
i
++
)
sResult
.
Append
(
m_aArray
[
i
]
->
RenderToOOX
(
oRenderParameter
)
);
}
}
else
{
bool
bCanConvertToNumbering
=
false
;
...
...
ASCOfficeRtfFile/RtfFormatLib/source/RtfProperty.cpp
View file @
e12f544b
This diff is collapsed.
Click to expand it.
ASCOfficeRtfFile/RtfFormatLib/source/UniversalConverterUtils.h
View file @
e12f544b
...
...
@@ -58,6 +58,7 @@ public:
{
CString
sResult
=
sInput
;
//& («&»), < («<»), > («>»), ' («'»), и " («"»)
sResult
.
Replace
(
_T
(
"
\x06
"
),
_T
(
""
));
//ЗБ·О±Ч·Ґјіён.rtf
sResult
.
Replace
(
_T
(
"&"
),
_T
(
"&"
));
sResult
.
Replace
(
_T
(
"<"
),
_T
(
"<"
));
sResult
.
Replace
(
_T
(
">"
),
_T
(
">"
));
...
...
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