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
16386f4b
Commit
16386f4b
authored
Dec 05, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DocFormatReaer - users file fix
OdfFormatReader - fix alphabetic text index
parent
149c0ae7
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
147 additions
and
16 deletions
+147
-16
ASCOfficeDocFile/DocDocxConverter/TablePropertiesMapping.cpp
ASCOfficeDocFile/DocDocxConverter/TablePropertiesMapping.cpp
+2
-2
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
+1
-0
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
+6
-4
ASCOfficeOdfFile/src/odf/style_table_properties.cpp
ASCOfficeOdfFile/src/odf/style_table_properties.cpp
+3
-7
ASCOfficeOdfFile/src/odf/text_elements.cpp
ASCOfficeOdfFile/src/odf/text_elements.cpp
+102
-3
ASCOfficeOdfFile/src/odf/text_elements.h
ASCOfficeOdfFile/src/odf/text_elements.h
+33
-0
No files found.
ASCOfficeDocFile/DocDocxConverter/TablePropertiesMapping.cpp
View file @
16386f4b
...
...
@@ -94,12 +94,12 @@ namespace DocFileFormat
//In some files there is a indent but no sprmTWidthIndent is set.
//For this cases we can calculate the indent of the table by getting the
//first boundary of the TDef and adding the padding of the cells
tblIndent
=
FormatUtils
::
BytesToInt16
(
iter
->
Arguments
,
1
,
iter
->
argumentsSize
);
//add the gabHalf
tblIndent
+=
gabHalf
;
//If there follows a real sprmTWidthIndent, this value will be overwritten
tblIndent
=
(
std
::
max
)((
int
)
tblIndent
,
0
);
//tblIndent = (std::max)((int)tblIndent,0); //cerere.doc
}
break
;
...
...
ASCOfficeOdfFile/src/docx/docx_conversion_context.cpp
View file @
16386f4b
...
...
@@ -845,6 +845,7 @@ void docx_conversion_context::docx_serialize_paragraph_style(std::wostream & str
CP_XML_WRITER
(
strm
)
{
//Tutor_Charlotte_Tutor_the_Entire_World_.odt
if
(
get_section_context
().
dump_
.
empty
()
==
false
&&
(
!
ParentId
.
empty
()
||
get_section_context
().
get
().
is_dump_
||
in_header_
)
&&
!
get_table_context
().
in_table
()
&&
!
in_drawing
)
{
//две подряд секции или если стиль определен и в заголовки нельзя пихать !!!
...
...
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
View file @
16386f4b
...
...
@@ -865,13 +865,15 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
if
(
attlists_
.
rel_size_
.
style_rel_width_
)
{
int
type
=
attlists_
.
rel_size_
.
style_rel_width_
->
get_type
();
drawing
.
pctWidth
=
attlists_
.
rel_size_
.
style_rel_width_
->
get_percent
().
get_value
();
int
type
=
attlists_
.
rel_size_
.
style_rel_width_
->
get_type
();
if
(
type
==
odf_types
::
percent_or_scale
::
Percent
)
drawing
.
pctWidth
=
attlists_
.
rel_size_
.
style_rel_width_
->
get_percent
().
get_value
();
}
if
(
attlists_
.
rel_size_
.
style_rel_height_
)
{
int
type
=
attlists_
.
rel_size_
.
style_rel_height_
->
get_type
();
drawing
.
pctHeight
=
attlists_
.
rel_size_
.
style_rel_height_
->
get_percent
().
get_value
();
int
type
=
attlists_
.
rel_size_
.
style_rel_height_
->
get_type
();
if
(
type
==
odf_types
::
percent_or_scale
::
Percent
)
drawing
.
pctHeight
=
attlists_
.
rel_size_
.
style_rel_height_
->
get_percent
().
get_value
();
}
}
...
...
ASCOfficeOdfFile/src/odf/style_table_properties.cpp
View file @
16386f4b
...
...
@@ -137,7 +137,7 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
if
(
table_align_
)
{
std
::
wstring
w_val
=
L"left"
;
if
(
table_align_
->
get_type
()
==
table_align
::
Margins
)
if
(
table_align_
->
get_type
()
==
table_align
::
Margins
||
table_align_
->
get_type
()
==
table_align
::
Left
)
{
if
(
common_horizontal_margin_attlist_
.
fo_margin_left_
&&
common_horizontal_margin_attlist_
.
fo_margin_right_
)
{
...
...
@@ -147,19 +147,15 @@ void table_format_properties::docx_convert(oox::docx_conversion_context & Contex
if
(
w_val
!=
L"center"
&&
common_horizontal_margin_attlist_
.
fo_margin_left_
)
{
odf_types
::
length
indent
=
common_horizontal_margin_attlist_
.
fo_margin_left_
->
get_length
();
_tblPr
<<
L"<w:tblInd w:w=
\"
"
<<
indent
.
get_value_unit
(
odf_types
::
length
::
pt
)
*
20
<<
"
\"
w:type=
\"
dxa
\"
/>"
;
_tblPr
<<
L"<w:tblInd w:w=
\"
"
<<
indent
.
get_value_unit
(
odf_types
::
length
::
pt
)
*
20
<<
"
\"
w:type=
\"
dxa
\"
/>"
;
}
}
else
else
//if (table_align_->get_type() == table_align::Center)
w_val
=
boost
::
lexical_cast
<
std
::
wstring
>
(
*
table_align_
);
_tblPr
<<
L"<w:jc w:val=
\"
"
<<
w_val
<<
"
\"
/>"
;
}
if
(
table_align_
&&
table_align_
->
get_type
()
==
table_align
::
Center
)
{
// TODO ()
}
_tblPr
<<
"<w:tblLayout w:type=
\"
fixed
\"
/>"
;
if
(
common_background_color_attlist_
.
fo_background_color_
)
...
...
ASCOfficeOdfFile/src/odf/text_elements.cpp
View file @
16386f4b
...
...
@@ -187,7 +187,7 @@ int process_paragraph_attr(const paragraph_attrs & Attr, oox::docx_conversion_co
Context
.
end_automatic_style
();
Context
.
push_text_properties
(
styleContent
->
get_style_text_properties
());
return
1
;
return
1
;
}
}
else
...
...
@@ -975,9 +975,39 @@ void text_table_index::add_child_element( xml::sax * Reader, const std::wstring
const
wchar_t
*
text_illustration_index
::
ns
=
L"text"
;
const
wchar_t
*
text_illustration_index
::
name
=
L"illustration-index"
;
void
text_illustration_index
::
afterCreate
()
{
if
(
document_context
*
context
=
getContext
())
{
if
(
paragraph
*
lastPar
=
context
->
get_last_paragraph
())
{
lastPar
->
set_next_section
(
true
);
}
}
}
void
text_illustration_index
::
afterReadContent
()
{
if
(
document_context
*
context
=
getContext
())
{
if
(
paragraph
*
lastPar
=
context
->
get_last_paragraph
())
{
lastPar
->
set_next_end_section
(
true
);
}
}
}
void
text_illustration_index
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
text_index_body_
)
std
::
wstring
current_page_properties
=
Context
.
get_page_properties
();
Context
.
get_section_context
().
add_section
(
text_section_attr_
.
text_name_
,
text_section_attr_
.
text_style_name_
.
get_value_or
(
style_ref
()).
style_name
(),
current_page_properties
);
Context
.
add_page_properties
(
current_page_properties
);
if
(
text_index_body_
)
text_index_body_
->
docx_convert
(
Context
);
}
...
...
@@ -1005,8 +1035,77 @@ void text_illustration_index::add_child_element( xml::sax * Reader, const std::w
{
CP_CREATE_ELEMENT
(
text_index_body_
);
}
// TODO text-illustration-index-source
// todooo text-illustration-index-source
}
// text:alphabetical-index
//////////////////////////////////////////////////////////////////////////////////////////////////
const
wchar_t
*
text_alphabetical_index
::
ns
=
L"text"
;
const
wchar_t
*
text_alphabetical_index
::
name
=
L"alphabetical-index"
;
void
text_alphabetical_index
::
afterCreate
()
{
if
(
document_context
*
context
=
getContext
())
{
if
(
paragraph
*
lastPar
=
context
->
get_last_paragraph
())
{
lastPar
->
set_next_section
(
true
);
}
}
}
void
text_alphabetical_index
::
afterReadContent
()
{
if
(
document_context
*
context
=
getContext
())
{
if
(
paragraph
*
lastPar
=
context
->
get_last_paragraph
())
{
lastPar
->
set_next_end_section
(
true
);
}
}
}
void
text_alphabetical_index
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
std
::
wstring
current_page_properties
=
Context
.
get_page_properties
();
Context
.
get_section_context
().
add_section
(
text_section_attr_
.
text_name_
,
text_section_attr_
.
text_style_name_
.
get_value_or
(
style_ref
()).
style_name
(),
current_page_properties
);
Context
.
add_page_properties
(
current_page_properties
);
if
(
text_index_body_
)
text_index_body_
->
docx_convert
(
Context
);
}
void
text_alphabetical_index
::
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
{
if
(
text_index_body_
)
text_index_body_
->
pptx_convert
(
Context
);
}
std
::
wostream
&
text_alphabetical_index
::
text_to_stream
(
std
::
wostream
&
_Wostream
)
const
{
CP_SERIALIZE_TEXT
(
text_index_body_
);
return
_Wostream
;
}
void
text_alphabetical_index
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
text_section_attr_
.
add_attributes
(
Attributes
);
}
void
text_alphabetical_index
::
add_child_element
(
xml
::
sax
*
Reader
,
const
std
::
wstring
&
Ns
,
const
std
::
wstring
&
Name
)
{
if
CP_CHECK_NAME
(
L"text"
,
L"index-body"
)
{
CP_CREATE_ELEMENT
(
text_index_body_
);
}
// todooo text-alphabetical-index-source
}
//--------------------------------------------------------------------------------------------------------
// text:tracked-changes
const
wchar_t
*
text_tracked_changes
::
ns
=
L"text"
;
...
...
ASCOfficeOdfFile/src/odf/text_elements.h
View file @
16386f4b
...
...
@@ -360,6 +360,9 @@ public:
static
const
ElementType
type
=
typeTextIllustrationIndex
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
afterCreate
();
virtual
void
afterReadContent
();
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
;
...
...
@@ -377,6 +380,36 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2
(
text_illustration_index
);
//---------------------------------------------------------------------------------------------------
class
text_alphabetical_index
:
public
text_content_impl
<
text_alphabetical_index
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeTextAlphabeticalIndex
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
afterCreate
();
virtual
void
afterReadContent
();
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
);
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
;
virtual
std
::
wostream
&
text_to_stream
(
std
::
wostream
&
_Wostream
)
const
;
private:
virtual
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
std
::
wstring
&
Ns
,
const
std
::
wstring
&
Name
);
public:
text_section_attr
text_section_attr_
;
office_element_ptr
text_alphabetical_index_source_
;
office_element_ptr
text_index_body_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
text_alphabetical_index
);
//---------------------------------------------------------------------------------------------------
class
text_index_body
:
public
text_content_impl
<
text_index_body
>
...
...
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