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
bbd429a9
Commit
bbd429a9
authored
Feb 05, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OdfFormat - Reader/Writer - background page (image, pattern, gradient)
parent
f4d63653
Changes
28
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
28 changed files
with
763 additions
and
522 deletions
+763
-522
ASCOfficeOdfFile/OdfFileTest/OdfFileTest.cpp
ASCOfficeOdfFile/OdfFileTest/OdfFileTest.cpp
+1
-1
ASCOfficeOdfFile/src/docx/docx_drawing.cpp
ASCOfficeOdfFile/src/docx/docx_drawing.cpp
+2
-2
ASCOfficeOdfFile/src/docx/oox_drawing_fills.cpp
ASCOfficeOdfFile/src/docx/oox_drawing_fills.cpp
+135
-9
ASCOfficeOdfFile/src/docx/oox_drawing_fills.h
ASCOfficeOdfFile/src/docx/oox_drawing_fills.h
+4
-3
ASCOfficeOdfFile/src/odf/datatypes/common_attlists.cpp
ASCOfficeOdfFile/src/odf/datatypes/common_attlists.cpp
+4
-4
ASCOfficeOdfFile/src/odf/draw_common.cpp
ASCOfficeOdfFile/src/odf/draw_common.cpp
+46
-40
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
+4
-4
ASCOfficeOdfFile/src/odf/draw_frame_xlsx.cpp
ASCOfficeOdfFile/src/odf/draw_frame_xlsx.cpp
+4
-4
ASCOfficeOdfFile/src/odf/office_body.cpp
ASCOfficeOdfFile/src/odf/office_body.cpp
+20
-3
ASCOfficeOdfFile/src/odf/style_graphic_properties.h
ASCOfficeOdfFile/src/odf/style_graphic_properties.h
+4
-4
ASCOfficeOdfFile/src/odf/style_paragraph_properties.h
ASCOfficeOdfFile/src/odf/style_paragraph_properties.h
+9
-9
ASCOfficeOdfFile/src/odf/styles.cpp
ASCOfficeOdfFile/src/odf/styles.cpp
+20
-12
ASCOfficeOdfFile/src/odf/styles.h
ASCOfficeOdfFile/src/odf/styles.h
+23
-51
ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.cpp
ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.cpp
+77
-40
ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.h
ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.h
+7
-2
ASCOfficeOdfFileW/source/OdfFormat/odt_conversion_context.h
ASCOfficeOdfFileW/source/OdfFormat/odt_conversion_context.h
+1
-0
ASCOfficeOdfFileW/source/OdfFormat/style_page_layout_properties.cpp
...dfFileW/source/OdfFormat/style_page_layout_properties.cpp
+38
-33
ASCOfficeOdfFileW/source/OdfFormat/style_page_layout_properties.h
...eOdfFileW/source/OdfFormat/style_page_layout_properties.h
+1
-0
ASCOfficeOdfFileW/source/OdfFormat/styles.h
ASCOfficeOdfFileW/source/OdfFormat/styles.h
+6
-6
ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertDiagram.cpp
ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertDiagram.cpp
+0
-2
ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertVml.cpp
ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertVml.cpp
+70
-25
ASCOfficeOdfFileW/source/Oox2OdfConverter/Converter.cpp
ASCOfficeOdfFileW/source/Oox2OdfConverter/Converter.cpp
+5
-5
ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.cpp
ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.cpp
+6
-0
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp
+3
-3
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_drawing_context.cpp
...XlsFile2/source/XlsXlsxConverter/xlsx_drawing_context.cpp
+3
-35
Common/DocxFormat/Source/Common/SimpleTypes_Vml.h
Common/DocxFormat/Source/Common/SimpleTypes_Vml.h
+222
-222
DesktopEditor/raster/BgraFrame.cpp
DesktopEditor/raster/BgraFrame.cpp
+41
-2
DesktopEditor/raster/BgraFrame.h
DesktopEditor/raster/BgraFrame.h
+7
-1
No files found.
ASCOfficeOdfFile/OdfFileTest/OdfFileTest.cpp
View file @
bbd429a9
...
...
@@ -55,7 +55,7 @@ int _tmain(int argc, _TCHAR* argv[])
HRESULT
hr
=
S_OK
;
//////////////////////////////////////////////////////////////////////////
std
::
wstring
srcFileName
=
argv
[
1
];
std
::
wstring
dstPath
=
argc
>
2
?
argv
[
2
]
:
srcFileName
+
L"-my.
ppt
x"
;
//xlsx pptx
std
::
wstring
dstPath
=
argc
>
2
?
argv
[
2
]
:
srcFileName
+
L"-my.
doc
x"
;
//xlsx pptx
std
::
wstring
outputDir
=
NSDirectory
::
GetFolderPath
(
dstPath
);
...
...
ASCOfficeOdfFile/src/docx/docx_drawing.cpp
View file @
bbd429a9
...
...
@@ -531,8 +531,8 @@ mso-position-vertical-relative:text;";
strStyle
+=
L"height:"
+
boost
::
lexical_cast
<
std
::
wstring
>
(
val
.
cy
/
12700.
)
+
L"pt;"
;
strStyle
+=
L"z-index:"
+
boost
::
lexical_cast
<
std
::
wstring
>
(
0xF000800
-
val
.
id
);
CP_XML_ATTR
(
L"id"
,
L"Rect"
+
boost
::
lexical_cast
<
std
::
wstring
>
(
val
.
id
));
CP_XML_ATTR
(
L"o:spid"
,
L"_x0000_s"
+
boost
::
lexical_cast
<
std
::
wstring
>
(
1024
+
val
.
id
));
CP_XML_ATTR
(
L"id"
,
L"Rect"
+
std
::
to_wstring
(
val
.
id
));
CP_XML_ATTR
(
L"o:spid"
,
L"_x0000_s"
+
std
::
to_wstring
(
1024
+
val
.
id
));
CP_XML_ATTR
(
L"style"
,
strStyle
);
CP_XML_ATTR
(
L"fillcolor"
,
L"#4f81bd [3204]"
);
CP_XML_ATTR
(
L"strokecolor"
,
L"#243f60 [1604]"
);
...
...
ASCOfficeOdfFile/src/docx/oox_drawing_fills.cpp
View file @
bbd429a9
...
...
@@ -66,7 +66,7 @@ void oox_serialize_srgb(std::wostream & strm,std::wstring color,_CP_OPT(double)
{
CP_XML_NODE
(
L"a:srgbClr"
)
{
CP_XML_ATTR
(
L"val"
,
color
);
CP_XML_ATTR
(
L"val"
,
color
);
if
(
opacity
)
{
CP_XML_NODE
(
L"a:alpha"
)
...
...
@@ -101,11 +101,56 @@ void oox_serialize_solid_fill(std::wostream & strm, const _oox_fill & val)
{
CP_XML_NODE
(
L"a:solidFill"
)
{
oox_serialize_srgb
(
CP_XML_STREAM
(),
val
.
solid
->
color
,
val
.
opacity
);
oox_serialize_srgb
(
CP_XML_STREAM
(),
val
.
solid
->
color
,
val
.
opacity
);
}
}
}
void
vml_serialize_solid_fill
(
std
::
wostream
&
strm
,
const
_oox_fill
&
val
)
{
if
(
!
val
.
solid
)
return
;
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"v:fill"
)
{
oox_serialize_srgb
(
CP_XML_STREAM
(),
val
.
solid
->
color
,
val
.
opacity
);
CP_XML_ATTR
(
L"v:fill"
,
val
.
solid
->
color
);
if
(
val
.
opacity
)
{
CP_XML_ATTR
(
L"v:opacity"
,
*
val
.
opacity
);
}
}
}
}
void
vml_serialize_bitmap_fill
(
std
::
wostream
&
strm
,
const
_oox_fill
&
val
)
{
if
(
!
val
.
bitmap
)
return
;
if
(
!
val
.
bitmap
->
isInternal
)
return
;
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"v:fill"
)
{
CP_XML_ATTR
(
L"r:id"
,
val
.
bitmap
->
rId
);
if
(
val
.
opacity
)
{
CP_XML_ATTR
(
L"opacity"
,(
int
)(
*
val
.
opacity
));
}
if
(
val
.
bitmap
->
bTile
)
{
CP_XML_ATTR
(
L"type"
,
L"pattern"
);
}
else
{
CP_XML_ATTR
(
L"type"
,
L"frame"
);
}
CP_XML_ATTR
(
L"recolor"
,
L"t"
);
}
}
}
void
oox_serialize_bitmap_fill
(
std
::
wostream
&
strm
,
const
_oox_fill
&
val
)
{
if
(
!
val
.
bitmap
)
return
;
...
...
@@ -164,20 +209,69 @@ void oox_serialize_bitmap_fill(std::wostream & strm, const _oox_fill & val)
{
CP_XML_NODE
(
L"a:fillRect"
);
}
}
}
}
}
}
void
oox
_serialize_gradient_fill
(
std
::
wostream
&
strm
,
const
_oox_fill
&
val
)
void
vml
_serialize_gradient_fill
(
std
::
wostream
&
strm
,
const
_oox_fill
&
val
)
{
if
(
!
val
.
gradient
)
if
(
!
val
.
gradient
)
return
;
CP_XML_WRITER
(
strm
)
{
return
;
CP_XML_NODE
(
L"v:fill"
)
{
if
(
!
val
.
gradient
->
colors
.
empty
())
{
CP_XML_ATTR
(
L"color2"
,
val
.
gradient
->
colors
[
val
.
gradient
->
colors
.
size
()
-
1
].
color_ref
);
std
::
wstring
colors_value
;
for
(
size_t
i
=
0
;
i
<
val
.
gradient
->
colors
.
size
();
i
++
)
{
colors_value
+=
std
::
to_wstring
(
val
.
gradient
->
colors
[
i
].
pos
)
+
L"% #"
+
val
.
gradient
->
colors
[
i
].
color_ref
+
L","
;
}
if
(
!
colors_value
.
empty
())
{
CP_XML_ATTR
(
L"colors"
,
colors_value
.
substr
(
0
,
colors_value
.
length
()
-
1
));
}
}
double
angle
=
/*360 - */
val
.
gradient
->
angle
/* * 180./3.14159265358979323846*/
;
CP_XML_ATTR
(
L"focus"
,
L"100%"
);
switch
(
val
.
gradient
->
style
)
{
case
0
:
CP_XML_ATTR
(
L"type"
,
L"gradient"
);
CP_XML_ATTR
(
L"method"
,
L"linear"
);
CP_XML_ATTR
(
L"angle"
,
angle
);
break
;
case
1
:
//CP_XML_ATTR(L"type", L"gradientRadial");
//break;
case
2
:
//CP_XML_ATTR(L"type", L"gradientCenter");
//break;
case
3
:
//CP_XML_ATTR(L"type", L"gradientUnscaled");
//break;
CP_XML_ATTR
(
L"type"
,
L"gradientRadial"
);
}
if
(
val
.
gradient
->
style
>
0
)
{
double
focus_x
=
((
val
.
gradient
->
rect
[
2
]
-
val
.
gradient
->
rect
[
0
])
/
2.
+
val
.
gradient
->
rect
[
0
])
/
100.
;
double
focus_y
=
((
val
.
gradient
->
rect
[
3
]
-
val
.
gradient
->
rect
[
1
])
/
2.
+
val
.
gradient
->
rect
[
1
])
/
100.
;
CP_XML_ATTR
(
L"focusposition"
,
XmlUtils
::
DoubleToString
(
focus_x
,
L"%.2f"
)
+
L","
+
XmlUtils
::
DoubleToString
(
focus_y
,
L"%.2f"
));
}
}
}
}
void
oox_serialize_gradient_fill
(
std
::
wostream
&
strm
,
const
_oox_fill
&
val
)
{
if
(
!
val
.
gradient
)
return
;
CP_XML_WRITER
(
strm
)
{
...
...
@@ -233,6 +327,7 @@ void oox_serialize_gradient_fill(std::wostream & strm, const _oox_fill & val)
void
oox_serialize_hatch_fill
(
std
::
wostream
&
strm
,
const
_oox_fill
&
val
)
{
if
(
!
val
.
hatch
)
return
;
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"a:pattFill"
)
...
...
@@ -253,7 +348,38 @@ void oox_serialize_hatch_fill(std::wostream & strm, const _oox_fill & val)
}
}
}
void
oox_serialize_fill
(
std
::
wostream
&
strm
,
const
_oox_fill
&
val
)
void
vml_serialize_background
(
std
::
wostream
&
strm
,
const
_oox_fill
&
val
,
const
std
::
wstring
&
color
,
int
id
)
{
if
(
val
.
type
==
0
)
return
;
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"v:background"
)
{
CP_XML_ATTR
(
L"id"
,
L"_x0000_s"
+
std
::
to_wstring
(
1024
+
id
));
CP_XML_ATTR
(
L"o:bwmode"
,
L"white"
);
CP_XML_ATTR
(
L"fillcolor"
,
L"#"
+
color
);
CP_XML_ATTR
(
L"o:targetscreensize"
,
L"1024,768"
);
switch
(
val
.
type
)
{
case
1
:
vml_serialize_solid_fill
(
CP_XML_STREAM
(),
val
);
break
;
case
2
:
vml_serialize_bitmap_fill
(
CP_XML_STREAM
(),
val
);
break
;
case
3
:
vml_serialize_gradient_fill
(
CP_XML_STREAM
(),
val
);
break
;
case
4
:
//vml_serialize_hatch_fill(CP_XML_STREAM(), val);
break
;
}
}
}
}
void
oox_serialize_fill
(
std
::
wostream
&
strm
,
const
_oox_fill
&
val
)
{
switch
(
val
.
type
)
{
...
...
ASCOfficeOdfFile/src/docx/oox_drawing_fills.h
View file @
bbd429a9
...
...
@@ -143,9 +143,10 @@ namespace oox {
}
};
void
oox_serialize_fill
(
std
::
wostream
&
strm
,
const
_oox_fill
&
val
);
void
oox_serialize_srgb
(
std
::
wostream
&
strm
,
std
::
wstring
color
,
_CP_OPT
(
double
)
opacity
);
void
oox_serialize_srgb
(
std
::
wostream
&
strm
,
std
::
wstring
color
,
_CP_OPT
(
odf_types
::
percent
)
opacity
);
void
vml_serialize_background
(
std
::
wostream
&
strm
,
const
_oox_fill
&
val
,
const
std
::
wstring
&
color
,
int
id
);
void
oox_serialize_fill
(
std
::
wostream
&
strm
,
const
_oox_fill
&
val
);
void
oox_serialize_srgb
(
std
::
wostream
&
strm
,
std
::
wstring
color
,
_CP_OPT
(
double
)
opacity
);
void
oox_serialize_srgb
(
std
::
wostream
&
strm
,
std
::
wstring
color
,
_CP_OPT
(
odf_types
::
percent
)
opacity
);
}
}
ASCOfficeOdfFile/src/odf/datatypes/common_attlists.cpp
View file @
bbd429a9
...
...
@@ -109,11 +109,11 @@ void common_draw_fill_attlist::add_attributes( const xml::attributes_wc_ptr & At
}
void
common_draw_fill_attlist
::
serialize
(
CP_ATTR_NODE
)
{
CP_XML_ATTR_OPT
(
L"draw:fill-color"
,
draw_fill_color_
);
CP_XML_ATTR_OPT
(
L"draw:fill"
,
draw_fill_
);
CP_XML_ATTR_OPT
(
L"draw:fill-color"
,
draw_fill_color_
);
CP_XML_ATTR_OPT
(
L"draw:fill"
,
draw_fill_
);
CP_XML_ATTR_OPT
(
L"draw:opacity"
,
draw_opacity_
);
CP_XML_ATTR_OPT
(
L"draw:image-opacity"
,
draw_image_opacity_
);
CP_XML_ATTR_OPT
(
L"draw:opacity"
,
draw_opacity_
);
CP_XML_ATTR_OPT
(
L"draw:image-opacity"
,
draw_image_opacity_
);
CP_XML_ATTR_OPT
(
L"draw:fill-image-name"
,
draw_fill_image_name_
);
CP_XML_ATTR_OPT
(
L"draw:fill-gradient-name"
,
draw_fill_gradient_name_
);
...
...
ASCOfficeOdfFile/src/odf/draw_common.cpp
View file @
bbd429a9
...
...
@@ -216,10 +216,10 @@ int Compute_BorderWidth(const graphic_format_properties & graphicProperties, Bor
switch
(
borderSide
)
{
case
sideTop
:
borderValue
=
graphicProperties
.
common_border_attlist_
.
fo_border_top_
;
break
;
case
sideBottom
:
borderValue
=
graphicProperties
.
common_border_attlist_
.
fo_border_bottom_
;
break
;
case
sideLeft
:
borderValue
=
graphicProperties
.
common_border_attlist_
.
fo_border_left_
;
break
;
case
sideRight
:
borderValue
=
graphicProperties
.
common_border_attlist_
.
fo_border_right_
;
break
;
case
sideTop
:
borderValue
=
graphicProperties
.
common_border_attlist_
.
fo_border_top_
;
break
;
case
sideBottom
:
borderValue
=
graphicProperties
.
common_border_attlist_
.
fo_border_bottom_
;
break
;
case
sideLeft
:
borderValue
=
graphicProperties
.
common_border_attlist_
.
fo_border_left_
;
break
;
case
sideRight
:
borderValue
=
graphicProperties
.
common_border_attlist_
.
fo_border_right_
;
break
;
}
if
(
!
borderValue
)
...
...
@@ -281,14 +281,14 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
fill
->
style
=
0
;
point
.
pos
=
0
;
if
(
image_style
->
draw_start_color_
)
point
.
color_ref
=
image_style
->
draw_start_color_
->
get_hex_value
();
if
(
image_style
->
draw_start_intensity_
)
point
.
opacity
=
image_style
->
draw_start_intensity_
->
get_value
();
if
(
image_style
->
draw_start_color_
)
point
.
color_ref
=
image_style
->
draw_start_color_
->
get_hex_value
();
if
(
image_style
->
draw_start_intensity_
)
point
.
opacity
=
image_style
->
draw_start_intensity_
->
get_value
();
fill
->
colors
.
push_back
(
point
);
point
.
pos
=
100
;
if
(
image_style
->
draw_end_color_
)
point
.
color_ref
=
image_style
->
draw_end_color_
->
get_hex_value
();
if
(
image_style
->
draw_end_intensity_
)
point
.
opacity
=
image_style
->
draw_end_intensity_
->
get_value
();
if
(
image_style
->
draw_end_color_
)
point
.
color_ref
=
image_style
->
draw_end_color_
->
get_hex_value
();
if
(
image_style
->
draw_end_intensity_
)
point
.
opacity
=
image_style
->
draw_end_intensity_
->
get_value
();
fill
->
colors
.
push_back
(
point
);
}
break
;
...
...
@@ -297,20 +297,20 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
fill
->
style
=
0
;
point
.
pos
=
0
;
if
(
image_style
->
draw_end_color_
)
point
.
color_ref
=
image_style
->
draw_end_color_
->
get_hex_value
();
if
(
image_style
->
draw_end_intensity_
)
point
.
opacity
=
image_style
->
draw_end_intensity_
->
get_value
();
if
(
image_style
->
draw_end_color_
)
point
.
color_ref
=
image_style
->
draw_end_color_
->
get_hex_value
();
if
(
image_style
->
draw_end_intensity_
)
point
.
opacity
=
image_style
->
draw_end_intensity_
->
get_value
();
fill
->
colors
.
push_back
(
point
);
point
.
pos
=
50
;
if
(
image_style
->
draw_start_color_
)
point
.
color_ref
=
image_style
->
draw_start_color_
->
get_hex_value
();
if
(
image_style
->
draw_start_intensity_
)
point
.
opacity
=
image_style
->
draw_start_intensity_
->
get_value
();
if
(
image_style
->
draw_start_color_
)
point
.
color_ref
=
image_style
->
draw_start_color_
->
get_hex_value
();
if
(
image_style
->
draw_start_intensity_
)
point
.
opacity
=
image_style
->
draw_start_intensity_
->
get_value
();
fill
->
colors
.
push_back
(
point
);
point
.
pos
=
100
;
if
(
image_style
->
draw_end_color_
)
point
.
color_ref
=
image_style
->
draw_end_color_
->
get_hex_value
();
if
(
image_style
->
draw_end_intensity_
)
point
.
opacity
=
image_style
->
draw_end_intensity_
->
get_value
();
if
(
image_style
->
draw_end_color_
)
point
.
color_ref
=
image_style
->
draw_end_color_
->
get_hex_value
();
if
(
image_style
->
draw_end_intensity_
)
point
.
opacity
=
image_style
->
draw_end_intensity_
->
get_value
();
fill
->
colors
.
push_back
(
point
);
}
break
;
...
...
@@ -319,41 +319,35 @@ void Compute_GradientFill(draw_gradient * image_style,oox::oox_gradient_fill_ptr
case
gradient_style
:
:
square
:
case
gradient_style
:
:
rectangular
:
{
if
(
style
==
gradient_style
::
radial
||
style
==
gradient_style
::
ellipsoid
)
fill
->
style
=
2
;
if
(
style
==
gradient_style
::
radial
||
style
==
gradient_style
::
ellipsoid
)
fill
->
style
=
2
;
if
(
style
==
gradient_style
::
square
)
fill
->
style
=
1
;
if
(
style
==
gradient_style
::
rectangular
)
fill
->
style
=
3
;
point
.
pos
=
0
;
if
(
image_style
->
draw_
end_color_
)
point
.
color_ref
=
image_style
->
draw_end
_color_
->
get_hex_value
();
if
(
image_style
->
draw_
end_intensity_
)
point
.
opacity
=
image_style
->
draw_end
_intensity_
->
get_value
();
if
(
image_style
->
draw_
start_color_
)
point
.
color_ref
=
image_style
->
draw_start
_color_
->
get_hex_value
();
if
(
image_style
->
draw_
start_intensity_
)
point
.
opacity
=
image_style
->
draw_start
_intensity_
->
get_value
();
fill
->
colors
.
push_back
(
point
);
point
.
pos
=
100
;
if
(
image_style
->
draw_
start_color_
)
point
.
color_ref
=
image_style
->
draw_start
_color_
->
get_hex_value
();
if
(
image_style
->
draw_
start_intensity_
)
point
.
opacity
=
image_style
->
draw_start
_intensity_
->
get_value
();
if
(
image_style
->
draw_
end_color_
)
point
.
color_ref
=
image_style
->
draw_end
_color_
->
get_hex_value
();
if
(
image_style
->
draw_
end_intensity_
)
point
.
opacity
=
image_style
->
draw_end
_intensity_
->
get_value
();
fill
->
colors
.
push_back
(
point
);
if
(
image_style
->
draw_cx_
)
//хохма - у мс в конвертилке из open-office перепутаны l & r !!!
{
fill
->
rect
[
0
]
=
image_style
->
draw_cx_
->
get_value
();
fill
->
rect
[
2
]
=
100
-
image_style
->
draw_cx_
->
get_value
();
}
else
fill
->
rect
[
0
]
=
fill
->
rect
[
1
]
=
0
;
fill
->
rect
[
2
]
=
fill
->
rect
[
3
]
=
100
;
if
(
image_style
->
draw_cx_
)
{
fill
->
rect
[
0
]
=
0
;
fill
->
rect
[
2
]
=
100
;
fill
->
rect
[
0
]
=
100
-
image_style
->
draw_cx_
->
get_value
()
;
fill
->
rect
[
2
]
=
image_style
->
draw_cx_
->
get_value
()
;
}
if
(
image_style
->
draw_cy_
)
{
fill
->
rect
[
1
]
=
image_style
->
draw_cy_
->
get_value
();
fill
->
rect
[
3
]
=
100
-
image_style
->
draw_cy_
->
get_value
();
}
else
{
fill
->
rect
[
1
]
=
0
;
fill
->
rect
[
3
]
=
100
;
fill
->
rect
[
1
]
=
100
-
image_style
->
draw_cy_
->
get_value
();
fill
->
rect
[
3
]
=
image_style
->
draw_cy_
->
get_value
();
}
}
break
;
}
...
...
@@ -427,8 +421,14 @@ void Compute_GraphicFill(const common_draw_fill_attlist & props, const office_el
{
switch
(
image
->
style_repeat_
->
get_type
())
{
case
style_repeat
:
:
Repeat
:
fill
.
bitmap
->
bTile
=
true
;
break
;
case
style_repeat
:
:
Stretch
:
fill
.
bitmap
->
bStretch
=
true
;
break
;
case
style_repeat
:
:
Repeat
:
fill
.
bitmap
->
bTile
=
true
;
fill
.
bitmap
->
bStretch
=
false
;
break
;
case
style_repeat
:
:
Stretch
:
fill
.
bitmap
->
bStretch
=
true
;
fill
.
bitmap
->
bTile
=
false
;
//?? для background точно выключать
break
;
}
}
if
(
image
->
draw_opacity_
)
...
...
@@ -445,8 +445,14 @@ void Compute_GraphicFill(const common_draw_fill_attlist & props, const office_el
{
switch
(
props
.
style_repeat_
->
get_type
())
{
case
style_repeat
:
:
Repeat
:
fill
.
bitmap
->
bTile
=
true
;
break
;
case
style_repeat
:
:
Stretch
:
fill
.
bitmap
->
bStretch
=
true
;
break
;
case
style_repeat
:
:
Repeat
:
fill
.
bitmap
->
bTile
=
true
;
fill
.
bitmap
->
bStretch
=
false
;
break
;
case
style_repeat
:
:
Stretch
:
fill
.
bitmap
->
bStretch
=
true
;
fill
.
bitmap
->
bTile
=
false
;
break
;
}
}
else
...
...
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
View file @
bbd429a9
...
...
@@ -893,17 +893,17 @@ void common_draw_docx_convert(oox::docx_conversion_context & Context, const unio
Compute_GraphicFill
(
graphicProperties
.
common_draw_fill_attlist_
,
graphicProperties
.
style_background_image_
,
Context
.
root
()
->
odf_context
().
drawStyles
()
,
drawing
->
fill
,
bTxbx
);
if
((
drawing
->
fill
.
bitmap
)
&&
(
drawing
->
fill
.
bitmap
->
rId
.
length
()
<
1
))
if
((
drawing
->
fill
.
bitmap
)
&&
(
drawing
->
fill
.
bitmap
->
rId
.
empty
()
))
{
std
::
wstring
href
=
drawing
->
fill
.
bitmap
->
xlink_href_
;
drawing
->
fill
.
bitmap
->
rId
=
Context
.
add_mediaitem
(
href
,
oox
::
typeImage
,
drawing
->
fill
.
bitmap
->
isInternal
,
href
);
}
////////////////////////////////////////////////////
drawing
->
additional
.
push_back
(
odf_reader
::
_property
(
L"border_width_left"
,
Compute_BorderWidth
(
graphicProperties
,
sideLeft
)));
drawing
->
additional
.
push_back
(
odf_reader
::
_property
(
L"border_width_left"
,
Compute_BorderWidth
(
graphicProperties
,
sideLeft
)));
drawing
->
additional
.
push_back
(
odf_reader
::
_property
(
L"border_width_top"
,
Compute_BorderWidth
(
graphicProperties
,
sideTop
)));
drawing
->
additional
.
push_back
(
odf_reader
::
_property
(
L"border_width_right"
,
Compute_BorderWidth
(
graphicProperties
,
sideRight
)));
drawing
->
additional
.
push_back
(
odf_reader
::
_property
(
L"border_width_bottom"
,
Compute_BorderWidth
(
graphicProperties
,
sideBottom
)));
drawing
->
additional
.
push_back
(
odf_reader
::
_property
(
L"border_width_right"
,
Compute_BorderWidth
(
graphicProperties
,
sideRight
)));
drawing
->
additional
.
push_back
(
odf_reader
::
_property
(
L"border_width_bottom"
,
Compute_BorderWidth
(
graphicProperties
,
sideBottom
)));
if
(
graphicProperties
.
common_border_attlist_
.
fo_border_
)
{
...
...
ASCOfficeOdfFile/src/odf/draw_frame_xlsx.cpp
View file @
bbd429a9
...
...
@@ -178,10 +178,10 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
////////////////////////////////////////////////////////////////////
properties
.
apply_to
(
Context
.
get_drawing_context
().
get_properties
());
Context
.
get_drawing_context
().
set_property
(
odf_reader
::
_property
(
L"border_width_left"
,
Compute_BorderWidth
(
properties
,
sideLeft
)));
Context
.
get_drawing_context
().
set_property
(
odf_reader
::
_property
(
L"border_width_top"
,
Compute_BorderWidth
(
properties
,
sideTop
)));
Context
.
get_drawing_context
().
set_property
(
odf_reader
::
_property
(
L"border_width_right"
,
Compute_BorderWidth
(
properties
,
sideRight
)));
Context
.
get_drawing_context
().
set_property
(
odf_reader
::
_property
(
L"border_width_bottom"
,
Compute_BorderWidth
(
properties
,
sideBottom
)));
Context
.
get_drawing_context
().
set_property
(
odf_reader
::
_property
(
L"border_width_left"
,
Compute_BorderWidth
(
properties
,
sideLeft
)));
Context
.
get_drawing_context
().
set_property
(
odf_reader
::
_property
(
L"border_width_top"
,
Compute_BorderWidth
(
properties
,
sideTop
)));
Context
.
get_drawing_context
().
set_property
(
odf_reader
::
_property
(
L"border_width_right"
,
Compute_BorderWidth
(
properties
,
sideRight
)));
Context
.
get_drawing_context
().
set_property
(
odf_reader
::
_property
(
L"border_width_bottom"
,
Compute_BorderWidth
(
properties
,
sideBottom
)));
if
(
properties
.
fo_clip_
)
{
...
...
ASCOfficeOdfFile/src/odf/office_body.cpp
View file @
bbd429a9
...
...
@@ -41,7 +41,9 @@
#include <cpdoccore/xml/attributes.h>
#include <cpdoccore/odf/odf_document.h>
#include "odfcontext.h"
#include "draw_common.h"
namespace
cpdoccore
{
...
...
@@ -111,14 +113,29 @@ void office_body::docx_convert(oox::docx_conversion_context & Context)
Context
.
add_page_properties
(
L""
);
//
Context
.
add_page_properties
(
L""
);
}
//back
color
(for all pages)
//back
ground
(for all pages)
if
(
page_layout_instance
*
firtsPageLayout
=
Context
.
root
()
->
odf_context
().
pageLayoutContainer
().
page_layout_by_name
(
Context
.
get_page_properties
()))
{
if
(
style_page_layout_properties
*
prop
=
firtsPageLayout
->
properties
())
{
if
(
prop
->
docx_back_serialize
(
Context
.
output_stream
(),
Context
))
oox
::
_oox_fill
fill
;
Compute_GraphicFill
(
prop
->
style_page_layout_properties_attlist_
.
common_draw_fill_attlist_
,
prop
->
style_page_layout_properties_elements_
.
style_background_image_
,
Context
.
root
()
->
odf_context
().
drawStyles
(),
fill
);
if
(
prop
->
style_page_layout_properties_attlist_
.
common_background_color_attlist_
.
fo_background_color_
||
fill
.
type
!=
0
)
{
Context
.
set_settings_property
(
odf_reader
::
_property
(
L"displayBackgroundShape"
,
true
));
if
((
fill
.
bitmap
)
&&
(
fill
.
bitmap
->
rId
.
empty
()))
{
std
::
wstring
href
=
fill
.
bitmap
->
xlink_href_
;
fill
.
bitmap
->
rId
=
Context
.
add_mediaitem
(
href
,
oox
::
typeImage
,
fill
.
bitmap
->
isInternal
,
href
);
}
int
id
=
Context
.
get_drawing_context
().
get_current_shape_id
();
if
(
prop
->
docx_background_serialize
(
Context
.
output_stream
(),
Context
,
fill
,
id
))
{
Context
.
set_settings_property
(
odf_reader
::
_property
(
L"displayBackgroundShape"
,
true
));
}
}
}
}
...
...
ASCOfficeOdfFile/src/odf/style_graphic_properties.h
View file @
bbd429a9
...
...
@@ -73,11 +73,11 @@ public:
public:
_CP_OPT
(
odf_types
::
length_or_percent
)
fo_min_width_
;
_CP_OPT
(
odf_types
::
length_or_percent
)
fo_min_height_
;
_CP_OPT
(
odf_types
::
length_or_percent
)
fo_min_width_
;
_CP_OPT
(
odf_types
::
length_or_percent
)
fo_min_height_
;
_CP_OPT
(
odf_types
::
length_or_percent
)
fo_max_width_
;
_CP_OPT
(
odf_types
::
length_or_percent
)
fo_max_height_
;
_CP_OPT
(
odf_types
::
length_or_percent
)
fo_max_width_
;
_CP_OPT
(
odf_types
::
length_or_percent
)
fo_max_height_
;
///////////////////////////////
_CP_OPT
(
odf_types
::
color
)
svg_stroke_color_
;
...
...
ASCOfficeOdfFile/src/odf/style_paragraph_properties.h
View file @
bbd429a9
...
...
@@ -98,17 +98,17 @@ private:
virtual
void
add_text
(
const
std
::
wstring
&
Text
);
private:
odf_types
::
length
style_position_
;
_CP_OPT
(
odf_types
::
style_type
)
style_type_
;
_CP_OPT
(
wchar_t
)
style_char_
;
odf_types
::
length
style_position_
;
_CP_OPT
(
odf_types
::
style_type
)
style_type_
;
_CP_OPT
(
wchar_t
)
style_char_
;
_CP_OPT
(
odf_types
::
line_type
)
style_leader_type_
;
_CP_OPT
(
odf_types
::
line_style
)
style_leader_style_
;
_CP_OPT
(
odf_types
::
line_width
)
style_leader_width_
;
_CP_OPT
(
odf_types
::
style_leader_color
)
style_leader_color_
;
_CP_OPT
(
odf_types
::
line_type
)
style_leader_type_
;
_CP_OPT
(
odf_types
::
line_style
)
style_leader_style_
;
_CP_OPT
(
odf_types
::
line_width
)
style_leader_width_
;
_CP_OPT
(
odf_types
::
style_leader_color
)
style_leader_color_
;
_CP_OPT
(
std
::
wstring
)
style_leader_text_
;
_CP_OPT
(
odf_types
::
style_ref
)
style_leader_text_style_
;
_CP_OPT
(
std
::
wstring
)
style_leader_text_
;
_CP_OPT
(
odf_types
::
style_ref
)
style_leader_text_style_
;
};
...
...
ASCOfficeOdfFile/src/odf/styles.cpp
View file @
bbd429a9
...
...
@@ -54,7 +54,6 @@
#include "serialize_elements.h"
#include "odfcontext.h"
#include "draw_common.h"
namespace
cpdoccore
{
...
...
@@ -904,12 +903,12 @@ void style_page_layout::add_child_element( xml::sax * Reader, const std::wstring
// style-page-layout-properties-attlist
void
style_page_layout_properties_attlist
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
CP_APPLY_ATTR
(
L"fo:page-width"
,
fo_page_width_
);
CP_APPLY_ATTR
(
L"fo:page-height"
,
fo_page_height_
);
CP_APPLY_ATTR
(
L"fo:page-width"
,
fo_page_width_
);
CP_APPLY_ATTR
(
L"fo:page-height"
,
fo_page_height_
);
common_num_format_attlist_
.
add_attributes
(
Attributes
);
common_num_format_prefix_suffix_attlist_
.
add_attributes
(
Attributes
);
CP_APPLY_ATTR
(
L"style:paper-tray-name"
,
style_paper_tray_name_
);
CP_APPLY_ATTR
(
L"style:print-orientation"
,
style_print_orientation_
);
CP_APPLY_ATTR
(
L"style:paper-tray-name"
,
style_paper_tray_name_
);
CP_APPLY_ATTR
(
L"style:print-orientation"
,
style_print_orientation_
);
common_horizontal_margin_attlist_
.
add_attributes
(
Attributes
);
common_vertical_margin_attlist_
.
add_attributes
(
Attributes
);
...
...
@@ -919,7 +918,8 @@ void style_page_layout_properties_attlist::add_attributes( const xml::attributes
common_padding_attlist_
.
add_attributes
(
Attributes
);
common_shadow_attlist_
.
add_attributes
(
Attributes
);
common_background_color_attlist_
.
add_attributes
(
Attributes
);
common_draw_fill_attlist_
.
add_attributes
(
Attributes
);
CP_APPLY_ATTR
(
L"style:register-truth-ref-style-name"
,
style_register_truth_ref_style_name_
);
CP_APPLY_ATTR
(
L"style:print"
,
style_print_
);
CP_APPLY_ATTR
(
L"style:print-page-order"
,
style_print_page_order_
);
...
...
@@ -1260,18 +1260,26 @@ void style_page_layout_properties::add_child_element( xml::sax * Reader, const s
{
style_page_layout_properties_elements_
.
add_child_element
(
Reader
,
Ns
,
Name
,
getContext
());
}
bool
style_page_layout_properties
::
docx_back_serialize
(
std
::
wostream
&
strm
,
oox
::
docx_conversion_context
&
Context
)
{
if
(
!
style_page_layout_properties_attlist_
.
common_background_color_attlist_
.
fo_background_color_
)
return
false
;
if
(
style_page_layout_properties_attlist_
.
common_background_color_attlist_
.
fo_background_color_
->
get_type
()
==
background_color
::
Transparent
)
return
true
;
bool
style_page_layout_properties
::
docx_background_serialize
(
std
::
wostream
&
strm
,
oox
::
docx_conversion_context
&
Context
,
oox
::
_oox_fill
&
fill
,
int
id
)
{
if
(
style_page_layout_properties_attlist_
.
common_background_color_attlist_
.
fo_background_color_
&&
style_page_layout_properties_attlist_
.
common_background_color_attlist_
.
fo_background_color_
->
get_type
()
==
background_color
::
Transparent
)
return
true
;
//??
//прозрачный фон
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"w:background"
)
{
std
::
wstring
color
=
style_page_layout_properties_attlist_
.
common_background_color_attlist_
.
fo_background_color_
->
get_color
().
get_hex_value
();
CP_XML_ATTR
(
L"w:color"
,
color
);
std
::
wstring
color
=
L"ffffff"
;
if
(
style_page_layout_properties_attlist_
.
common_background_color_attlist_
.
fo_background_color_
)
color
=
style_page_layout_properties_attlist_
.
common_background_color_attlist_
.
fo_background_color_
->
get_color
().
get_hex_value
();
CP_XML_ATTR
(
L"w:color"
,
color
);
oox
::
vml_serialize_background
(
CP_XML_STREAM
(),
fill
,
color
,
id
);
}
}
return
true
;
...
...
ASCOfficeOdfFile/src/odf/styles.h
View file @
bbd429a9
...
...
@@ -892,54 +892,26 @@ public:
odf_types
::
common_padding_attlist
common_padding_attlist_
;
odf_types
::
common_shadow_attlist
common_shadow_attlist_
;
// 15.2.10
odf_types
::
common_background_color_attlist
common_background_color_attlist_
;
// 15.2.12
_CP_OPT
(
odf_types
::
style_ref
)
style_register_truth_ref_style_name_
;
// 15.2.13 TODO
_CP_OPT
(
std
::
wstring
)
style_print_
;
// 15.2.14
_CP_OPT
(
odf_types
::
direction
)
style_print_page_order_
;
// 15.2.15 TODO
_CP_OPT
(
std
::
wstring
)
style_first_page_number_
;
// 15.2.16
_CP_OPT
(
odf_types
::
percent
)
style_scale_to_
;
_CP_OPT
(
unsigned
int
)
style_scale_to_pages_
;
// 15.2.17
_CP_OPT
(
odf_types
::
table_centering
)
style_table_centering_
;
// 15.2.18
_CP_OPT
(
odf_types
::
length
)
style_footnote_max_height_
;
// 15.2.19
odf_types
::
common_writing_mode_attlist
common_writing_mode_attlist_
;
// 15.2.21
_CP_OPT
(
odf_types
::
layout_grid_mode
)
style_layout_grid_mode_
;
// 15.2.22
_CP_OPT
(
odf_types
::
length
)
style_layout_grid_base_height_
;
// 15.2.23
_CP_OPT
(
odf_types
::
length
)
style_layout_grid_ruby_height_
;
// 15.2.24
_CP_OPT
(
unsigned
int
)
style_layout_grid_lines_
;
// 15.2.25
_CP_OPT
(
odf_types
::
color
)
style_layout_grid_color_
;
// 15.2.26
_CP_OPT
(
bool
)
style_layout_grid_ruby_below_
;
// 15.2.27
_CP_OPT
(
bool
)
style_layout_grid_print_
;
// 15.2.28
_CP_OPT
(
bool
)
style_layout_grid_display_
;
odf_types
::
common_background_color_attlist
common_background_color_attlist_
;
odf_types
::
common_draw_fill_attlist
common_draw_fill_attlist_
;
_CP_OPT
(
odf_types
::
style_ref
)
style_register_truth_ref_style_name_
;
_CP_OPT
(
std
::
wstring
)
style_print_
;
_CP_OPT
(
odf_types
::
direction
)
style_print_page_order_
;
_CP_OPT
(
std
::
wstring
)
style_first_page_number_
;
_CP_OPT
(
odf_types
::
percent
)
style_scale_to_
;
_CP_OPT
(
unsigned
int
)
style_scale_to_pages_
;
_CP_OPT
(
odf_types
::
table_centering
)
style_table_centering_
;
_CP_OPT
(
odf_types
::
length
)
style_footnote_max_height_
;
odf_types
::
common_writing_mode_attlist
common_writing_mode_attlist_
;
_CP_OPT
(
odf_types
::
layout_grid_mode
)
style_layout_grid_mode_
;
_CP_OPT
(
odf_types
::
length
)
style_layout_grid_base_height_
;
_CP_OPT
(
odf_types
::
length
)
style_layout_grid_ruby_height_
;
_CP_OPT
(
unsigned
int
)
style_layout_grid_lines_
;
_CP_OPT
(
odf_types
::
color
)
style_layout_grid_color_
;
_CP_OPT
(
bool
)
style_layout_grid_ruby_below_
;
_CP_OPT
(
bool
)
style_layout_grid_print_
;
_CP_OPT
(
bool
)
style_layout_grid_display_
;
};
...
...
@@ -992,7 +964,7 @@ public:
};
//
style:page-layout-properties
// style:page-layout-properties
class
style_page_layout_properties
:
public
office_element_impl
<
style_page_layout_properties
>
{
public:
...
...
@@ -1005,7 +977,7 @@ public:
void
docx_convert_serialize
(
std
::
wostream
&
strm
,
oox
::
docx_conversion_context
&
Context
);
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
);
bool
docx_back
_serialize
(
std
::
wostream
&
strm
,
oox
::
docx_conversion_context
&
Context
);
bool
docx_back
ground_serialize
(
std
::
wostream
&
strm
,
oox
::
docx_conversion_context
&
Context
,
oox
::
_oox_fill
&
fill
,
int
id
);
style_page_layout_properties
()
{
}
...
...
@@ -1020,7 +992,7 @@ private:
CP_REGISTER_OFFICE_ELEMENT2
(
style_page_layout_properties
);
//
text:notes-configuration
// text:notes-configuration
class
text_notes_configuration
:
public
office_element_impl
<
text_notes_configuration
>
{
public:
...
...
ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.cpp
View file @
bbd429a9
This diff is collapsed.
Click to expand it.
ASCOfficeOdfFileW/source/OdfFormat/odf_drawing_context.h
View file @
bbd429a9
...
...
@@ -64,8 +64,10 @@ public:
void
clear
();
void
set_styles_context
(
odf_style_context
*
styles_context
);
//для embedded
void
set_header_state
(
bool
Val
);
void
set_footer_state
(
bool
Val
);
void
set_header_state
(
bool
Val
);
void
set_footer_state
(
bool
Val
);
void
set_background_state
(
bool
Val
);
void
check_anchor
();
void
set_margin_left
(
double
valPt
);
...
...
@@ -173,6 +175,7 @@ public:
void
set_type_fill
(
int
type
);
//for area - temp for objects
void
set_solid_fill
(
std
::
wstring
hexColor
);
void
set_opacity
(
double
percent
);
//////////////////////////////////////////////////////////////
void
start_area_properties
();
void
end_area_properties
();
...
...
@@ -187,6 +190,8 @@ public:
std
::
wstring
add_marker_style
(
int
type
);
void
end_line_properties
();
_CP_OPT
(
unsigned
int
)
get_fill_color
();
void
set_fill_color
(
unsigned
int
color
);
//void start_shadow_properties();
//void end_shadow_properties();
// пока одной функией ..
...
...
ASCOfficeOdfFileW/source/OdfFormat/odt_conversion_context.h
View file @
bbd429a9
...
...
@@ -170,6 +170,7 @@ private:
bool
is_header_
;
bool
is_footer_
;
bool
is_background_
;
std
::
vector
<
odf_drawing_context_ptr
>
drawing_context_
;
std
::
vector
<
odf_text_context_ptr
>
text_context_
;
//for embedded
...
...
ASCOfficeOdfFileW/source/OdfFormat/style_page_layout_properties.cpp
View file @
bbd429a9
...
...
@@ -122,42 +122,47 @@ void style_page_layout_properties_attlist::serialize(CP_ATTR_NODE)
}
}
CP_XML_ATTR_OPT
(
L"fo:page-width"
,
fo_page_width_
);
CP_XML_ATTR_OPT
(
L"fo:page-height"
,
fo_page_height_
);
common_num_format_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_num_format_prefix_suffix_attlist_
.
serialize
(
CP_GET_XML_NODE
());
CP_XML_ATTR_OPT
(
L"style:paper-tray-name"
,
style_paper_tray_name_
);
CP_XML_ATTR_OPT
(
L"style:print-orientation"
,
style_print_orientation_
);
CP_XML_ATTR_OPT
(
L"fo:page-width"
,
fo_page_width_
);
CP_XML_ATTR_OPT
(
L"fo:page-height"
,
fo_page_height_
);
common_horizontal_margin_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_vertical_margin_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_margin_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_border_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_border_line_width_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_padding_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_shadow_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_background_color_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_num_format_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_num_format_prefix_suffix_attlist_
.
serialize
(
CP_GET_XML_NODE
());
CP_XML_ATTR_OPT
(
L"style:register-truth-ref-style-name"
,
style_register_truth_ref_style_name_
);
CP_XML_ATTR_OPT
(
L"style:print"
,
style_print_
);
CP_XML_ATTR_OPT
(
L"style:print-page-order"
,
style_print_page_order_
);
CP_XML_ATTR_OPT
(
L"style:first-page-number"
,
style_first_page_number_
);
CP_XML_ATTR_OPT
(
L"style:scale-to"
,
style_scale_to_
);
CP_XML_ATTR_OPT
(
L"style:scale-to_pages"
,
style_scale_to_pages_
);
CP_XML_ATTR_OPT
(
L"style:table-centering"
,
style_table_centering_
);
CP_XML_ATTR_OPT
(
L"style:footnote-max-height"
,
style_footnote_max_height_
);
common_writing_mode_attlist_
.
serialize
(
CP_GET_XML_NODE
());
CP_XML_ATTR_OPT
(
L"style:layout-grid-mode"
,
style_layout_grid_mode_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-base-height"
,
style_layout_grid_base_height_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-ruby-height"
,
style_layout_grid_ruby_height_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-lines"
,
style_layout_grid_lines_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-color"
,
style_layout_grid_color_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-ruby-below"
,
style_layout_grid_ruby_below_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-print"
,
style_layout_grid_print_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-display"
,
style_layout_grid_display_
);
CP_XML_ATTR_OPT
(
L"style:paper-tray-name"
,
style_paper_tray_name_
);
CP_XML_ATTR_OPT
(
L"style:print-orientation"
,
style_print_orientation_
);
common_horizontal_margin_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_vertical_margin_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_margin_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_border_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_border_line_width_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_padding_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_shadow_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_background_color_attlist_
.
serialize
(
CP_GET_XML_NODE
());
common_draw_fill_attlist_
.
serialize
(
CP_GET_XML_NODE
());
CP_XML_ATTR_OPT
(
L"style:register-truth-ref-style-name"
,
style_register_truth_ref_style_name_
);
CP_XML_ATTR_OPT
(
L"style:print"
,
style_print_
);
CP_XML_ATTR_OPT
(
L"style:print-page-order"
,
style_print_page_order_
);
CP_XML_ATTR_OPT
(
L"style:first-page-number"
,
style_first_page_number_
);
CP_XML_ATTR_OPT
(
L"style:scale-to"
,
style_scale_to_
);
CP_XML_ATTR_OPT
(
L"style:scale-to_pages"
,
style_scale_to_pages_
);
CP_XML_ATTR_OPT
(
L"style:table-centering"
,
style_table_centering_
);
CP_XML_ATTR_OPT
(
L"style:footnote-max-height"
,
style_footnote_max_height_
);
common_writing_mode_attlist_
.
serialize
(
CP_GET_XML_NODE
());
CP_XML_ATTR_OPT
(
L"style:layout-grid-mode"
,
style_layout_grid_mode_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-base-height"
,
style_layout_grid_base_height_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-ruby-height"
,
style_layout_grid_ruby_height_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-lines"
,
style_layout_grid_lines_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-color"
,
style_layout_grid_color_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-ruby-below"
,
style_layout_grid_ruby_below_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-print"
,
style_layout_grid_print_
);
CP_XML_ATTR_OPT
(
L"style:layout-grid-display"
,
style_layout_grid_display_
);
}
const
wchar_t
*
style_page_layout_properties
::
ns
=
L"style"
;
const
wchar_t
*
style_page_layout_properties
::
name
=
L"page-layout-properties"
;
const
wchar_t
*
style_page_layout_properties
::
ns
=
L"style"
;
const
wchar_t
*
style_page_layout_properties
::
name
=
L"page-layout-properties"
;
void
style_page_layout_properties
::
create_child_element
(
const
std
::
wstring
&
Ns
,
const
std
::
wstring
&
Name
)
{
...
...
ASCOfficeOdfFileW/source/OdfFormat/style_page_layout_properties.h
View file @
bbd429a9
...
...
@@ -62,6 +62,7 @@ public:
_CP_OPT
(
odf_types
::
length
)
fo_page_width_
;
_CP_OPT
(
odf_types
::
length
)
fo_page_height_
;
odf_types
::
common_draw_fill_attlist
common_draw_fill_attlist_
;
odf_types
::
common_num_format_attlist
common_num_format_attlist_
;
odf_types
::
common_num_format_prefix_suffix_attlist
common_num_format_prefix_suffix_attlist_
;
...
...
ASCOfficeOdfFileW/source/OdfFormat/styles.h
View file @
bbd429a9
...
...
@@ -159,8 +159,8 @@ public:
std
::
wstring
get_style_name
(){
return
draw_name_
.
get_value_or
(
L""
);}
_CP_OPT
(
odf_types
::
color
)
draw_start_color_
;
_CP_OPT
(
odf_types
::
color
)
draw_end_color_
;
_CP_OPT
(
odf_types
::
color
)
draw_start_color_
;
_CP_OPT
(
odf_types
::
color
)
draw_end_color_
;
_CP_OPT
(
odf_types
::
percent
)
draw_end_intensity_
;
_CP_OPT
(
odf_types
::
percent
)
draw_start_intensity_
;
...
...
@@ -169,11 +169,11 @@ public:
_CP_OPT
(
odf_types
::
percent
)
draw_cx_
;
_CP_OPT
(
odf_types
::
percent
)
draw_border_
;
_CP_OPT
(
int
)
draw_angle_
;
_CP_OPT
(
odf_types
::
gradient_style
)
draw_style_
;
_CP_OPT
(
int
)
draw_angle_
;
_CP_OPT
(
odf_types
::
gradient_style
)
draw_style_
;
_CP_OPT
(
std
::
wstring
)
draw_name_
;
_CP_OPT
(
std
::
wstring
)
draw_display_name_
;
_CP_OPT
(
std
::
wstring
)
draw_name_
;
_CP_OPT
(
std
::
wstring
)
draw_display_name_
;
virtual
void
create_child_element
(
const
std
::
wstring
&
Ns
,
const
std
::
wstring
&
Name
);
virtual
void
serialize
(
std
::
wostream
&
strm
);
...
...
ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertDiagram.cpp
View file @
bbd429a9
...
...
@@ -48,8 +48,6 @@
#include "../OdfFormat/style_text_properties.h"
#include "../OdfFormat/style_paragraph_properties.h"
#define ARGB(a, r, g, b) ((unsigned int)( ( (unsigned char)(a) )| ( ( (unsigned char)(r) ) << 8 ) | ( ( (unsigned char)(g) ) << 16 ) | ( (unsigned char)(b) << 24 ) ) )
using
namespace
cpdoccore
;
namespace
Oox2Odf
...
...
ASCOfficeOdfFileW/source/Oox2OdfConverter/ConvertVml.cpp
View file @
bbd429a9
...
...
@@ -44,6 +44,7 @@
#include "../OdfFormat/style_paragraph_properties.h"
#include "../../../Common/DocxFormat/Source/DocxFormat/Logic/Vml.h"
#include "../../../DesktopEditor/raster/BgraFrame.h"
#include "VmlShapeTypes2Oox.h"
...
...
@@ -386,6 +387,9 @@ void OoxConverter::convert(OOX::Vml::CArc *vml_arc)
void
OoxConverter
::
convert
(
OOX
::
Vml
::
CBackground
*
vml_background
)
{
if
(
vml_background
==
NULL
)
return
;
OOX
::
Vml
::
CVmlCommonElements
*
vml_common
=
static_cast
<
OOX
::
Vml
::
CVmlCommonElements
*>
(
vml_background
);
convert
(
vml_common
);
}
void
OoxConverter
::
convert
(
OOX
::
Vml
::
CFill
*
vml_fill
)
...
...
@@ -394,6 +398,28 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
odf_context
()
->
drawing_context
()
->
start_area_properties
();
std
::
wstring
sImagePath
;
_CP_OPT
(
unsigned
int
)
nRgbColor1
,
nRgbColor2
;
_CP_OPT
(
std
::
wstring
)
sRgbColor1
,
sRgbColor2
;
if
(
vml_fill
->
m_oColor
.
IsInit
())
{
nRgbColor1
=
((
unsigned
int
)(((
BYTE
)(
vml_fill
->
m_oColor
->
Get_B
())
|
((
unsigned
int
)((
BYTE
)(
vml_fill
->
m_oColor
->
Get_G
()))
<<
8
))
|
(((
unsigned
int
)(
BYTE
)(
vml_fill
->
m_oColor
->
Get_R
()))
<<
16
)));
sRgbColor1
=
XmlUtils
::
IntToString
(
*
nRgbColor1
,
L"%06X"
);
}
if
(
vml_fill
->
m_oColor2
.
IsInit
())
{
nRgbColor2
=
((
unsigned
int
)(((
BYTE
)(
vml_fill
->
m_oColor2
->
Get_B
())
|
((
unsigned
int
)((
BYTE
)(
vml_fill
->
m_oColor2
->
Get_G
()))
<<
8
))
|
(((
unsigned
int
)(
BYTE
)(
vml_fill
->
m_oColor2
->
Get_R
()))
<<
16
)));
sRgbColor2
=
XmlUtils
::
IntToString
(
*
nRgbColor2
,
L"%06X"
);
}
if
(
vml_fill
->
m_rId
.
IsInit
())
{
//bitmap fill
...
...
@@ -401,37 +427,37 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
{
double
Width
=
0
,
Height
=
0
;
std
::
wstring
sID
=
vml_fill
->
m_rId
->
GetValue
();
std
::
wstring
pathImage
=
find_link_by_id
(
sID
,
1
);
sImagePath
=
find_link_by_id
(
sID
,
1
);
if
(
!
pathImage
.
empty
())
if
(
!
sImagePath
.
empty
())
{
odf_context
()
->
drawing_context
()
->
set_bitmap_link
(
pathImage
);
_graphics_utils_
::
GetResolution
(
pathImage
.
c_str
(),
Width
,
Height
);
odf_context
()
->
drawing_context
()
->
set_bitmap_link
(
sImagePath
);
_graphics_utils_
::
GetResolution
(
sImagePath
.
c_str
(),
Width
,
Height
);
}
odf_context
()
->
drawing_context
()
->
set_image_style_repeat
(
1
);
}
odf_context
()
->
drawing_context
()
->
end_bitmap_style
();
}
else
switch
(
vml_fill
->
m_oType
.
GetValue
())
{
switch
(
vml_fill
->
m_oType
.
GetValue
())
{
case
SimpleTypes
:
:
filltypeGradient
:
case
SimpleTypes
:
:
filltypeGradientCenter
:
case
SimpleTypes
:
:
filltypeGradientRadial
:
case
SimpleTypes
:
:
filltypeGradientUnscaled
:
{
odf_context
()
->
drawing_context
()
->
start_gradient_style
();
if
(
SimpleTypes
::
filltypeGradient
==
vml_fill
->
m_oType
.
GetValue
())
odf_context
()
->
drawing_context
()
->
set_gradient_type
(
odf_types
::
gradient_style
::
linear
);
if
(
SimpleTypes
::
filltypeGradientRadial
==
vml_fill
->
m_oType
.
GetValue
())
odf_context
()
->
drawing_context
()
->
set_gradient_type
(
odf_types
::
gradient_style
::
radial
);
if
(
SimpleTypes
::
filltypeGradientCenter
==
vml_fill
->
m_oType
.
GetValue
())
odf_context
()
->
drawing_context
()
->
set_gradient_type
(
odf_types
::
gradient_style
::
axial
);
if
(
SimpleTypes
::
filltypeGradientUnscaled
==
vml_fill
->
m_oType
.
GetValue
())
odf_context
()
->
drawing_context
()
->
set_gradient_type
(
odf_types
::
gradient_style
::
square
);
if
(
SimpleTypes
::
filltypeGradient
==
vml_fill
->
m_oType
.
GetValue
())
odf_context
()
->
drawing_context
()
->
set_gradient_type
(
odf_types
::
gradient_style
::
linear
);
if
(
SimpleTypes
::
filltypeGradientRadial
==
vml_fill
->
m_oType
.
GetValue
())
odf_context
()
->
drawing_context
()
->
set_gradient_type
(
odf_types
::
gradient_style
::
radial
);
if
(
SimpleTypes
::
filltypeGradientCenter
==
vml_fill
->
m_oType
.
GetValue
())
odf_context
()
->
drawing_context
()
->
set_gradient_type
(
odf_types
::
gradient_style
::
axial
);
if
(
SimpleTypes
::
filltypeGradientUnscaled
==
vml_fill
->
m_oType
.
GetValue
())
odf_context
()
->
drawing_context
()
->
set_gradient_type
(
odf_types
::
gradient_style
::
square
);
_CP_OPT
(
double
)
no_set
;
if
(
vml_fill
->
m_oColor
.
IsInit
()
)
odf_context
()
->
drawing_context
()
->
set_gradient_start
(
vml_fill
->
m_oColor
->
ToString
()
,
no_set
);
if
(
vml_fill
->
m_oColor2
.
IsInit
()
)
odf_context
()
->
drawing_context
()
->
set_gradient_end
(
vml_fill
->
m_oColor2
->
ToString
()
,
no_set
);
if
(
sRgbColor1
)
odf_context
()
->
drawing_context
()
->
set_gradient_start
(
*
sRgbColor1
,
no_set
);
if
(
sRgbColor2
)
odf_context
()
->
drawing_context
()
->
set_gradient_end
(
*
sRgbColor2
,
no_set
);
if
(
vml_fill
->
m_oFocusPosition
.
IsInit
())
odf_context
()
->
drawing_context
()
->
set_gradient_center
(
vml_fill
->
m_oFocusPosition
->
GetX
(),
vml_fill
->
m_oFocusPosition
->
GetY
());
...
...
@@ -440,23 +466,35 @@ void OoxConverter::convert(OOX::Vml::CFill *vml_fill)
}
break
;
case
SimpleTypes
:
:
filltypePattern
:
{
if
(
!
sImagePath
.
empty
())
{
odf_context
()
->
drawing_context
()
->
set_image_style_repeat
(
2
);
if
(
!
nRgbColor1
)
nRgbColor1
=
odf_context
()
->
drawing_context
()
->
get_fill_color
();
CBgraFrame
bgraFrame
;
bgraFrame
.
ReColorPatternImage
(
sImagePath
,
nRgbColor1
.
get_value_or
(
0xffffff
),
nRgbColor2
.
get_value_or
(
0x000000
));
}
else
{
odf_context
()
->
drawing_context
()
->
start_hatch_style
();
if
(
vml_fill
->
m_oColor2
.
IsInit
()
)
odf_context
()
->
drawing_context
()
->
set_hatch_line_color
(
vml_fill
->
m_oColor2
->
ToString
()
);
if
(
vml_fill
->
m_oColor
.
IsInit
()
)
odf_context
()
->
drawing_context
()
->
set_hatch_area_color
(
vml_fill
->
m_oColor
->
ToString
()
);
if
(
sRgbColor2
)
odf_context
()
->
drawing_context
()
->
set_hatch_line_color
(
*
sRgbColor2
);
if
(
sRgbColor1
)
odf_context
()
->
drawing_context
()
->
set_hatch_area_color
(
*
sRgbColor1
);
else
odf_context
()
->
drawing_context
()
->
set_hatch_area_color
(
L"#ffffff"
);
odf_context
()
->
drawing_context
()
->
end_hatch_style
();
}
}
break
;
case
SimpleTypes
:
:
filltypeSolid
:
default:
if
(
vml_fill
->
m_oColor
.
IsInit
()
)
odf_context
()
->
drawing_context
()
->
set_solid_fill
(
vml_fill
->
m_oColor
->
ToString
()
);
if
(
sImagePath
.
empty
()
&&
sRgbColor1
)
odf_context
()
->
drawing_context
()
->
set_solid_fill
(
*
sRgbColor1
);
break
;
}
}
//--------------------------------------------------------------------------------------------------------------------
if
(
vml_fill
->
m_oOpacity
.
IsInit
()
&&
vml_fill
->
m_oOpacity2
.
IsInit
()
)
...
...
@@ -588,7 +626,7 @@ void OoxConverter::convert(OOX::Vml::CStroke *vml_stroke)
if
(
vml_stroke
->
m_oColor
.
IsInit
())
{
std
::
wstring
hexColor
=
vml_stroke
->
m_oColor
->
ToString
();
if
(
hexColor
.
length
()
<
1
)
hexColor
=
L"000000"
;
if
(
hexColor
.
empty
())
hexColor
=
L"000000"
;
odf_context
()
->
drawing_context
()
->
set_solid_fill
(
hexColor
);
}
...
...
@@ -818,9 +856,16 @@ void OoxConverter::convert(OOX::Vml::CVmlCommonElements *vml_common)
if
(
oRgbColor
)
{
odf_context
()
->
drawing_context
()
->
start_area_properties
();
unsigned
int
nRgbColor
=
((
unsigned
int
)(((
BYTE
)(
oRgbColor
->
Get_B
())
|
((
unsigned
int
)((
BYTE
)(
oRgbColor
->
Get_G
()))
<<
8
))
|
(((
unsigned
int
)(
BYTE
)(
oRgbColor
->
Get_R
()))
<<
16
)));
odf_context
()
->
drawing_context
()
->
set_fill_color
(
nRgbColor
);
odf_context
()
->
drawing_context
()
->
start_area_properties
();
odf_context
()
->
drawing_context
()
->
set_solid_fill
(
oRgbColor
->
ToString
().
substr
(
2
));
//.Right(6));
odf_context
()
->
drawing_context
()
->
end_area_properties
();
delete
oRgbColor
;
}
}
...
...
ASCOfficeOdfFileW/source/Oox2OdfConverter/Converter.cpp
View file @
bbd429a9
...
...
@@ -215,11 +215,11 @@ void OoxConverter::convert(OOX::WritingElement *oox_unknown)
OOX
::
Vml
::
CTextbox
*
vml
=
static_cast
<
OOX
::
Vml
::
CTextbox
*>
(
oox_unknown
);
convert
(
vml
);
}
break
;
//
case OOX::et_v_background:
//
{
//
OOX::Vml::CBackground *vml = static_cast<OOX::Vml::CBackground*>(oox_unknown);
//
convert(vml);
//
}break;
case
OOX
:
:
et_v_background
:
{
OOX
::
Vml
::
CBackground
*
vml
=
static_cast
<
OOX
::
Vml
::
CBackground
*>
(
oox_unknown
);
convert
(
vml
);
}
break
;
case
OOX
:
:
et_v_path
:
{
OOX
::
Vml
::
CPath
*
vml
=
static_cast
<
OOX
::
Vml
::
CPath
*>
(
oox_unknown
);
...
...
ASCOfficeOdfFileW/source/Oox2OdfConverter/DocxConverter.cpp
View file @
bbd429a9
...
...
@@ -1684,6 +1684,10 @@ void DocxConverter::convert(OOX::Logic::CBackground *oox_background, int type)
odt_context
->
set_background
(
color
,
type
);
odt_context
->
start_drawings
();
odt_context
->
drawing_context
()
->
set_background_state
(
true
);
odt_context
->
drawing_context
()
->
start_drawing
();
if
(
oox_background
->
m_oDrawing
.
IsInit
())
{
convert
(
oox_background
->
m_oDrawing
.
GetPointer
());
...
...
@@ -1692,6 +1696,8 @@ void DocxConverter::convert(OOX::Logic::CBackground *oox_background, int type)
{
convert
(
oox_background
->
m_oBackground
.
GetPointer
());
}
odt_context
->
drawing_context
()
->
end_drawing
();
odt_context
->
end_drawings
();
}
void
DocxConverter
::
convert
(
ComplexTypes
::
Word
::
CFramePr
*
oox_frame_pr
,
odf_writer
::
style_paragraph_properties
*
paragraph_properties
)
...
...
ASCOfficeRtfFile/RtfFormatLib/source/DestinationCommand.cpp
View file @
bbd429a9
...
...
@@ -1930,13 +1930,13 @@ void RtfShapeReader::ShapePropertyReader::ShapePropertyValueReader::PopState( Rt
else
if
(
L"fLine"
==
m_sPropName
)
m_oShape
.
m_bLine
=
(
0
==
nValue
?
false
:
true
);
else
if
(
L"lineStartArrowhead"
==
m_sPropName
)
m_oShape
.
m_nLineStartArrow
=
nValue
;
else
if
(
L"lineColor"
==
m_sPropName
)
m_oShape
.
m_nLineColor
=
nValue
;
else
if
(
L"lineStartArrowWidth"
==
m_sPropName
)
m_oShape
.
m_nLineStartArrowWidth
=
nValue
;
else
if
(
L"lineStartArrowWidth"
==
m_sPropName
)
m_oShape
.
m_nLineStartArrowWidth
=
nValue
;
else
if
(
L"lineStartArrowLength"
==
m_sPropName
)
m_oShape
.
m_nLineStartArrowLength
=
nValue
;
else
if
(
L"lineEndArrowhead"
==
m_sPropName
)
m_oShape
.
m_nLineEndArrow
=
nValue
;
else
if
(
L"lineEndArrowhead"
==
m_sPropName
)
m_oShape
.
m_nLineEndArrow
=
nValue
;
else
if
(
L"lineEndArrowWidth"
==
m_sPropName
)
m_oShape
.
m_nLineEndArrowWidth
=
nValue
;
else
if
(
L"lineEndArrowLength"
==
m_sPropName
)
m_oShape
.
m_nLineEndArrowLength
=
nValue
;
else
if
(
L"lineWidth"
==
m_sPropName
)
m_oShape
.
m_nLineWidth
=
nValue
;
else
if
(
L"lineDashing"
==
m_sPropName
)
m_oShape
.
m_nLineDashing
=
nValue
;
else
if
(
L"lineDashing"
==
m_sPropName
)
m_oShape
.
m_nLineDashing
=
nValue
;
else
if
(
L"cxstyle"
==
m_sPropName
)
m_oShape
.
m_nConnectorStyle
=
nValue
;
else
if
(
L"cxk"
==
m_sPropName
)
m_oShape
.
m_nConnectionType
=
nValue
;
else
...
...
ASCOfficeXlsFile2/source/XlsXlsxConverter/xlsx_drawing_context.cpp
View file @
bbd429a9
...
...
@@ -2417,44 +2417,12 @@ bool xlsx_drawing_context::ChangeBlack2ColorImage(std::wstring sRgbColor1, std::
std
::
wstring
image_path
=
context_
.
get_mediaitems
().
media_path
()
+
drawing_state
->
fill
.
texture_target
.
substr
(
6
);
in
t
rgbColor1
=
STR
::
hex_str2int
(
sRgbColor1
);
in
t
rgbColor2
=
STR
::
hex_str2int
(
sRgbColor2
);
size_
t
rgbColor1
=
STR
::
hex_str2int
(
sRgbColor1
);
size_
t
rgbColor2
=
STR
::
hex_str2int
(
sRgbColor2
);
CBgraFrame
bgraFrame
;
if
(
bgraFrame
.
OpenFile
(
image_path
))
{
int
smpl
=
abs
(
bgraFrame
.
get_Stride
()
/
bgraFrame
.
get_Width
());
BYTE
*
rgb
=
bgraFrame
.
get_Data
();
BYTE
R1
=
(
BYTE
)(
rgbColor1
);
BYTE
G1
=
(
BYTE
)(
rgbColor1
>>
8
);
BYTE
B1
=
(
BYTE
)(
rgbColor1
>>
16
);
BYTE
R2
=
(
BYTE
)(
rgbColor2
);
BYTE
G2
=
(
BYTE
)(
rgbColor2
>>
8
);
BYTE
B2
=
(
BYTE
)(
rgbColor2
>>
16
);
for
(
int
i
=
0
;
i
<
bgraFrame
.
get_Width
()
*
bgraFrame
.
get_Height
();
i
++
)
{
if
(
rgb
[
i
*
smpl
+
0
]
==
0x00
&&
rgb
[
i
*
smpl
+
1
]
==
0x00
&&
rgb
[
i
*
smpl
+
2
]
==
0x00
)
{
rgb
[
i
*
smpl
+
0
]
=
R1
;
rgb
[
i
*
smpl
+
1
]
=
G1
;
rgb
[
i
*
smpl
+
2
]
=
B1
;
}
else
{
rgb
[
i
*
smpl
+
0
]
=
R2
;
rgb
[
i
*
smpl
+
1
]
=
G2
;
rgb
[
i
*
smpl
+
2
]
=
B2
;
}
}
bgraFrame
.
SaveFile
(
image_path
,
1
);
return
true
;
}
return
false
;
return
bgraFrame
.
ReColorPatternImage
(
image_path
,
rgbColor1
,
rgbColor2
);
}
void
xlsx_drawing_context
::
serialize_vml_HF
(
std
::
wostream
&
strm
)
...
...
Common/DocxFormat/Source/Common/SimpleTypes_Vml.h
View file @
bbd429a9
This diff is collapsed.
Click to expand it.
DesktopEditor/raster/BgraFrame.cpp
View file @
bbd429a9
...
...
@@ -39,6 +39,8 @@
bool
CBgraFrame
::
OpenFile
(
const
std
::
wstring
&
strFileName
,
unsigned
int
nFileType
)
{
m_nFileType
=
nFileType
;
if
(
CXIMAGE_FORMAT_JP2
==
nFileType
)
{
Jpeg2000
::
CJ2kFile
oJ2
;
...
...
@@ -49,7 +51,7 @@ bool CBgraFrame::OpenFile(const std::wstring& strFileName, unsigned int nFileTyp
if
(
nFileType
==
0
)
{
CImageFileFormatChecker
checker
(
strFileName
);
nFileType
=
checker
.
eFileType
;
m_
nFileType
=
checker
.
eFileType
;
}
NSFile
::
CFileBinary
oFile
;
if
(
!
oFile
.
OpenFile
(
strFileName
))
...
...
@@ -57,7 +59,7 @@ bool CBgraFrame::OpenFile(const std::wstring& strFileName, unsigned int nFileTyp
CxImage
img
;
if
(
!
img
.
Decode
(
oFile
.
GetFileNative
(),
nFileType
))
if
(
!
img
.
Decode
(
oFile
.
GetFileNative
(),
m_
nFileType
))
return
false
;
CxImageToMediaFrame
(
img
);
...
...
@@ -116,7 +118,44 @@ bool CBgraFrame::Resize(const long& nNewWidth, const long& nNewHeight, bool bDes
CxImageToMediaFrame
(
imgDst
);
return
true
;
}
bool
CBgraFrame
::
ReColorPatternImage
(
const
std
::
wstring
&
strFileName
,
unsigned
int
rgbColorBack
,
unsigned
int
rgbColorFore
)
{
if
(
OpenFile
(
strFileName
))
{
int
smpl
=
abs
(
get_Stride
()
/
get_Width
());
BYTE
*
rgb
=
get_Data
();
BYTE
R1
=
(
BYTE
)(
rgbColorBack
);
BYTE
G1
=
(
BYTE
)(
rgbColorBack
>>
8
);
BYTE
B1
=
(
BYTE
)(
rgbColorBack
>>
16
);
BYTE
R2
=
(
BYTE
)(
rgbColorFore
);
BYTE
G2
=
(
BYTE
)(
rgbColorFore
>>
8
);
BYTE
B2
=
(
BYTE
)(
rgbColorFore
>>
16
);
for
(
int
i
=
0
;
i
<
get_Width
()
*
get_Height
();
i
++
)
{
if
(
rgb
[
i
*
smpl
+
0
]
==
0x00
&&
rgb
[
i
*
smpl
+
1
]
==
0x00
&&
rgb
[
i
*
smpl
+
2
]
==
0x00
)
{
rgb
[
i
*
smpl
+
0
]
=
R1
;
rgb
[
i
*
smpl
+
1
]
=
G1
;
rgb
[
i
*
smpl
+
2
]
=
B1
;
}
else
{
rgb
[
i
*
smpl
+
0
]
=
R2
;
rgb
[
i
*
smpl
+
1
]
=
G2
;
rgb
[
i
*
smpl
+
2
]
=
B2
;
}
}
if
(
m_nFileType
==
0
)
m_nFileType
=
1
;
SaveFile
(
strFileName
,
m_nFileType
);
return
true
;
}
return
false
;
}
void
CBgraFrame
::
CxImageToMediaFrame
(
CxImage
&
img
)
{
if
(
!
img
.
IsValid
()
)
...
...
DesktopEditor/raster/BgraFrame.h
View file @
bbd429a9
...
...
@@ -39,6 +39,8 @@ class CxImage;
class
CBgraFrame
{
private:
int
m_nFileType
;
int
m_lWidth
;
int
m_lHeight
;
int
m_lStride
;
...
...
@@ -67,6 +69,7 @@ private:
}
inline
void
Clear
()
{
m_nFileType
=
0
;
m_lWidth
=
0
;
m_lHeight
=
0
;
m_lStride
=
0
;
...
...
@@ -120,7 +123,10 @@ public:
public:
bool
OpenFile
(
const
std
::
wstring
&
strFileName
,
unsigned
int
nFileType
=
0
);
//0 - detect
bool
SaveFile
(
const
std
::
wstring
&
strFileName
,
unsigned
int
nFileType
);
bool
Resize
(
const
long
&
nNewWidth
,
const
long
&
nNewHeight
,
bool
bDestroyData
=
true
);
bool
Resize
(
const
long
&
nNewWidth
,
const
long
&
nNewHeight
,
bool
bDestroyData
=
true
);
bool
ReColorPatternImage
(
const
std
::
wstring
&
strFileName
,
unsigned
int
rgbColorBack
,
unsigned
int
rgbColorFore
);
private:
void
CxImageToMediaFrame
(
CxImage
&
img
);
...
...
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