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
0c4b3b78
Commit
0c4b3b78
authored
Nov 15, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OdfFormatReader -fix strange image file name, fix smallCaps
parent
b782624f
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
45 additions
and
31 deletions
+45
-31
ASCOfficeOdfFile/src/docx/mediaitems.cpp
ASCOfficeOdfFile/src/docx/mediaitems.cpp
+38
-25
ASCOfficeOdfFile/src/docx/mediaitems.h
ASCOfficeOdfFile/src/docx/mediaitems.h
+5
-4
ASCOfficeOdfFile/src/odf/style_text_properties.cpp
ASCOfficeOdfFile/src/odf/style_text_properties.cpp
+2
-2
No files found.
ASCOfficeOdfFile/src/docx/mediaitems.cpp
View file @
0c4b3b78
...
...
@@ -91,39 +91,51 @@ std::wstring mediaitems::create_file_name(const std::wstring & uri, RelsType typ
if
(
uri
.
empty
())
return
L""
;
std
::
wstring
sExt
;
int
n
=
uri
.
rfind
(
L"."
);
if
(
n
>
0
)
sExt
=
uri
.
substr
(
n
);
else
if
(
n
==
0
)
std
::
wstring
f_name
=
odf_packet_
+
FILE_SEPARATOR_STR
+
uri
;
sExt
=
detectImageFileExtension
(
f_name
);
//4EA0AA6E-479D-4002-A6AA-6D6C88EC6D65.odt - image - "opentbs_added_1.phpxvkeg" = png
if
(
sExt
.
empty
())
{
//тута скорее всего OleReplacement
n
=
uri
.
find
(
L"ObjectReplacements"
);
if
(
n
>=
0
)
int
n
=
uri
.
find
(
L"ObjectReplacements"
);
if
(
n
>=
0
)
{
CFile
file
;
CString
f_name
=
std_string2string
(
odf_packet_
)
+
std_string2string
(
uri
.
substr
(
1
,
uri
.
length
()
-
1
));
if
(
file
.
OpenFile
(
f_name
)
==
S_OK
)
{
BYTE
buffer
[
128
];
int
buffer_size
=
128
;
file
.
ReadFile
(
buffer
,
buffer_size
);
file
.
CloseFile
();
CImageFileFormatChecker
image_checker
;
sExt
=
image_checker
.
DetectFormatByData
(
buffer
,
buffer_size
);
if
(
sExt
.
length
()
>
0
)
sExt
=
std
::
wstring
(
L"."
)
+
sExt
;
}
f_name
=
odf_packet_
+
uri
.
substr
(
1
,
uri
.
length
()
-
1
);
sExt
=
detectImageFileExtension
(
f_name
);
}
if
(
sExt
.
empty
())
{
//то что есть ..
int
n
=
uri
.
rfind
(
L"."
);
if
(
n
>
0
)
sExt
=
uri
.
substr
(
n
);
}
}
//todooo проверить
return
get_default_file_name
(
type
)
+
boost
::
lexical_cast
<
std
::
wstring
>
(
Num
)
+
sExt
;
}
std
::
wstring
mediaitems
::
detectImageFileExtension
(
std
::
wstring
&
fileName
)
{
CFile
file
;
std
::
wstring
sExt
;
if
(
file
.
OpenFile
(
std_string2string
(
fileName
))
==
S_OK
)
{
BYTE
buffer
[
128
];
int
buffer_size
=
128
;
file
.
ReadFile
(
buffer
,
buffer_size
);
file
.
CloseFile
();
CImageFileFormatChecker
image_checker
;
sExt
=
image_checker
.
DetectFormatByData
(
buffer
,
buffer_size
);
if
(
!
sExt
.
empty
())
sExt
=
std
::
wstring
(
L"."
)
+
sExt
;
}
return
sExt
;
}
std
::
wstring
mediaitems
::
add_or_find
(
const
std
::
wstring
&
href
,
RelsType
type
,
bool
&
isInternal
,
std
::
wstring
&
ref
)
{
...
...
@@ -149,6 +161,7 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
std
::
wstring
inputPath
=
isMediaInternal
?
odf_packet_
+
FILE_SEPARATOR_STR
+
href
:
href
;
std
::
wstring
outputPath
=
isMediaInternal
?
(
sub_path
+
inputFileName
)
:
href
;
if
(
type
==
typeChart
)
outputPath
=
outputPath
+
L".xml"
;
std
::
wstring
id
;
...
...
@@ -176,7 +189,7 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
{
outputPath
=
outputPath
.
substr
(
0
,
n_svm
)
+
L".png"
;
}
//------------------------------------------------
id
=
std
::
wstring
(
L"picId"
)
+
boost
::
lexical_cast
<
std
::
wstring
>
(
count_image
+
1
);
count_image
++
;
}
...
...
ASCOfficeOdfFile/src/docx/mediaitems.h
View file @
0c4b3b78
...
...
@@ -85,10 +85,11 @@ public:
items_array
&
items
()
{
return
items_
;
}
private:
std
::
wstring
create_file_name
(
const
std
::
wstring
&
uri
,
RelsType
type
,
size_t
Num
);
items_array
items_
;
std
::
wstring
odf_packet_
;
std
::
wstring
create_file_name
(
const
std
::
wstring
&
uri
,
RelsType
type
,
size_t
Num
);
std
::
wstring
detectImageFileExtension
(
std
::
wstring
&
fileName
);
items_array
items_
;
std
::
wstring
odf_packet_
;
};
...
...
ASCOfficeOdfFile/src/odf/style_text_properties.cpp
View file @
0c4b3b78
...
...
@@ -566,7 +566,7 @@ void text_format_properties_content::docx_convert(oox::docx_conversion_context &
}
if
(
fo_font_variant_
)
{
_rPr
<<
(
fo_font_variant_
->
get_type
()
==
font_variant
::
SmallCaps
?
L"<w:smallCaps w:val=
\"
true
\"
/>"
:
L"<w:smallCaps w:val=
\"
tru
e
\"
/>"
);
_rPr
<<
(
fo_font_variant_
->
get_type
()
==
font_variant
::
SmallCaps
?
L"<w:smallCaps w:val=
\"
true
\"
/>"
:
L"<w:smallCaps w:val=
\"
fals
e
\"
/>"
);
}
if
(
style_font_relief_
)
{
...
...
@@ -1057,7 +1057,7 @@ void text_format_properties_content::oox_convert (std::wostream & _rPr, bool gra
}
if
(
fo_font_variant_
)
{
_rPr
<<
(
fo_font_variant_
->
get_type
()
==
font_variant
::
SmallCaps
?
L"<w:smallCaps w:val=
\"
true
\"
/>"
:
L"<w:smallCaps w:val=
\"
tru
e
\"
/>"
);
_rPr
<<
(
fo_font_variant_
->
get_type
()
==
font_variant
::
SmallCaps
?
L"<w:smallCaps w:val=
\"
true
\"
/>"
:
L"<w:smallCaps w:val=
\"
fals
e
\"
/>"
);
}
if
(
style_font_relief_
)
{
...
...
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