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
d95c93ab
Commit
d95c93ab
authored
Dec 08, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OdfFormatReader - spreadsheets - support convert ole objects (and other embedded)
parent
a9076beb
Changes
40
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
40 changed files
with
1045 additions
and
834 deletions
+1045
-834
ASCOfficeOdfFile/Test/ASCOfficeOdfFileTest/ASCOfficeOdfFileTest.vcproj
...ile/Test/ASCOfficeOdfFileTest/ASCOfficeOdfFileTest.vcproj
+12
-0
ASCOfficeOdfFile/linux/OdfFileReaderLib.pro
ASCOfficeOdfFile/linux/OdfFileReaderLib.pro
+0
-2
ASCOfficeOdfFile/src/docx/docx_drawing.cpp
ASCOfficeOdfFile/src/docx/docx_drawing.cpp
+2
-1
ASCOfficeOdfFile/src/docx/docx_package.cpp
ASCOfficeOdfFile/src/docx/docx_package.cpp
+1
-1
ASCOfficeOdfFile/src/docx/drawing_object_description.h
ASCOfficeOdfFile/src/docx/drawing_object_description.h
+2
-1
ASCOfficeOdfFile/src/docx/mediaitems.cpp
ASCOfficeOdfFile/src/docx/mediaitems.cpp
+43
-27
ASCOfficeOdfFile/src/docx/mediaitems.h
ASCOfficeOdfFile/src/docx/mediaitems.h
+14
-1
ASCOfficeOdfFile/src/docx/mediaitems_utils.cpp
ASCOfficeOdfFile/src/docx/mediaitems_utils.cpp
+0
-99
ASCOfficeOdfFile/src/docx/mediaitems_utils.h
ASCOfficeOdfFile/src/docx/mediaitems_utils.h
+0
-52
ASCOfficeOdfFile/src/docx/oox_chart_context.cpp
ASCOfficeOdfFile/src/docx/oox_chart_context.cpp
+3
-4
ASCOfficeOdfFile/src/docx/oox_package.cpp
ASCOfficeOdfFile/src/docx/oox_package.cpp
+23
-12
ASCOfficeOdfFile/src/docx/oox_rels.h
ASCOfficeOdfFile/src/docx/oox_rels.h
+14
-1
ASCOfficeOdfFile/src/docx/pptx_drawings.cpp
ASCOfficeOdfFile/src/docx/pptx_drawings.cpp
+23
-42
ASCOfficeOdfFile/src/docx/pptx_slide_context.cpp
ASCOfficeOdfFile/src/docx/pptx_slide_context.cpp
+177
-162
ASCOfficeOdfFile/src/docx/pptx_slide_context.h
ASCOfficeOdfFile/src/docx/pptx_slide_context.h
+29
-31
ASCOfficeOdfFile/src/docx/xlsx_drawing.cpp
ASCOfficeOdfFile/src/docx/xlsx_drawing.cpp
+79
-18
ASCOfficeOdfFile/src/docx/xlsx_drawing.h
ASCOfficeOdfFile/src/docx/xlsx_drawing.h
+3
-2
ASCOfficeOdfFile/src/docx/xlsx_drawing_context.cpp
ASCOfficeOdfFile/src/docx/xlsx_drawing_context.cpp
+60
-26
ASCOfficeOdfFile/src/docx/xlsx_drawing_context.h
ASCOfficeOdfFile/src/docx/xlsx_drawing_context.h
+17
-18
ASCOfficeOdfFile/src/docx/xlsx_drawings.cpp
ASCOfficeOdfFile/src/docx/xlsx_drawings.cpp
+73
-58
ASCOfficeOdfFile/src/docx/xlsx_drawings.h
ASCOfficeOdfFile/src/docx/xlsx_drawings.h
+8
-7
ASCOfficeOdfFile/src/docx/xlsx_output_xml.cpp
ASCOfficeOdfFile/src/docx/xlsx_output_xml.cpp
+24
-43
ASCOfficeOdfFile/src/docx/xlsx_output_xml.h
ASCOfficeOdfFile/src/docx/xlsx_output_xml.h
+2
-0
ASCOfficeOdfFile/src/docx/xlsx_package.cpp
ASCOfficeOdfFile/src/docx/xlsx_package.cpp
+15
-7
ASCOfficeOdfFile/src/docx/xlsx_package.h
ASCOfficeOdfFile/src/docx/xlsx_package.h
+13
-11
ASCOfficeOdfFile/src/docx/xlsx_table_state.cpp
ASCOfficeOdfFile/src/docx/xlsx_table_state.cpp
+8
-1
ASCOfficeOdfFile/src/docx/xlsx_table_state.h
ASCOfficeOdfFile/src/docx/xlsx_table_state.h
+4
-1
ASCOfficeOdfFile/src/docx/xlsx_tablecontext.cpp
ASCOfficeOdfFile/src/docx/xlsx_tablecontext.cpp
+8
-0
ASCOfficeOdfFile/src/docx/xlsx_tablecontext.h
ASCOfficeOdfFile/src/docx/xlsx_tablecontext.h
+5
-4
ASCOfficeOdfFile/src/docx/xlsxconversioncontext.cpp
ASCOfficeOdfFile/src/docx/xlsxconversioncontext.cpp
+20
-18
ASCOfficeOdfFile/src/odf/datatypes/common_attlists.h
ASCOfficeOdfFile/src/odf/datatypes/common_attlists.h
+10
-60
ASCOfficeOdfFile/src/odf/draw_frame.cpp
ASCOfficeOdfFile/src/odf/draw_frame.cpp
+0
-5
ASCOfficeOdfFile/src/odf/draw_frame.h
ASCOfficeOdfFile/src/odf/draw_frame.h
+30
-38
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
+67
-22
ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp
ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp
+20
-25
ASCOfficeOdfFile/src/odf/draw_frame_xlsx.cpp
ASCOfficeOdfFile/src/odf/draw_frame_xlsx.cpp
+28
-20
ASCOfficeOdfFile/src/odf/office_elements_type.h
ASCOfficeOdfFile/src/odf/office_elements_type.h
+11
-1
ASCOfficeOdfFile/src/odf/text_elements.cpp
ASCOfficeOdfFile/src/odf/text_elements.cpp
+115
-0
ASCOfficeOdfFile/src/odf/text_elements.h
ASCOfficeOdfFile/src/odf/text_elements.h
+82
-5
ASCOfficeOdfFile/win32/cpodf.vcproj
ASCOfficeOdfFile/win32/cpodf.vcproj
+0
-8
No files found.
ASCOfficeOdfFile/Test/ASCOfficeOdfFileTest/ASCOfficeOdfFileTest.vcproj
View file @
d95c93ab
...
...
@@ -345,6 +345,18 @@
/>
</FileConfiguration>
</File>
<File
RelativePath=
"..\..\..\Common\3dParty\pole\pole.cpp"
>
<FileConfiguration
Name=
"Debug|Win32"
>
<Tool
Name=
"VCCLCompilerTool"
UsePrecompiledHeader=
"0"
/>
</FileConfiguration>
</File>
</Filter>
</Files>
<Globals>
...
...
ASCOfficeOdfFile/linux/OdfFileReaderLib.pro
View file @
d95c93ab
...
...
@@ -213,7 +213,6 @@ SOURCES += \
..
/
src
/
docx
/
hyperlinks
.
cpp
\
..
/
src
/
docx
/
measuredigits
.
cpp
\
..
/
src
/
docx
/
mediaitems
.
cpp
\
..
/
src
/
docx
/
mediaitems_utils
.
cpp
\
..
/
src
/
docx
/
namespaces
.
cpp
\
..
/
src
/
docx
/
oox_chart_axis
.
cpp
\
..
/
src
/
docx
/
oox_chart_context
.
cpp
\
...
...
@@ -462,7 +461,6 @@ HEADERS += \
..
/
src
/
docx
/
hyperlinks
.
h
\
..
/
src
/
docx
/
measuredigits
.
h
\
..
/
src
/
docx
/
mediaitems
.
h
\
..
/
src
/
docx
/
mediaitems_utils
.
h
\
..
/
src
/
docx
/
namespaces
.
h
\
..
/
src
/
docx
/
oox_chart_axis
.
h
\
..
/
src
/
docx
/
oox_chart_context
.
h
\
...
...
ASCOfficeOdfFile/src/docx/docx_drawing.cpp
View file @
d95c93ab
...
...
@@ -622,7 +622,8 @@ void _docx_drawing::serialize(std::wostream & strm/*, bool insideOtherDrawing*/)
if
(
inGroup
)
return
docx_serialize_child
(
strm
,
*
this
);
if
(
type
==
typeObject
)
if
(
type
==
typeMsObject
||
type
==
typeOleObject
)
{
docx_serialize_object
(
strm
,
*
this
);
}
...
...
ASCOfficeOdfFile/src/docx/docx_package.cpp
View file @
d95c93ab
...
...
@@ -141,7 +141,7 @@ void word_files::update_rels(docx_conversion_context & Context)
void
word_files
::
set_media
(
mediaitems
&
_Mediaitems
,
CApplicationFonts
*
pAppFonts
)
{
if
(
_Mediaitems
.
count_image
>
0
)
if
(
_Mediaitems
.
count_image
+
_Mediaitems
.
count_media
>
0
)
{
media_
=
element_ptr
(
new
media
(
_Mediaitems
,
pAppFonts
)
);
}
...
...
ASCOfficeOdfFile/src/docx/drawing_object_description.h
View file @
d95c93ab
...
...
@@ -52,6 +52,8 @@ struct drawing_object_description
oox
::
RelsType
type_
;
std
::
wstring
name_
;
std
::
wstring
descriptor_
;
_CP_OPT
(
_rect
)
svg_rect_
;
std
::
wstring
anchor_
;
...
...
@@ -66,7 +68,6 @@ struct drawing_object_description
_oox_fill
fill_
;
bool
use_image_replace_
;
bool
in_group_
;
int
shape_type_
;
//default - frame
...
...
ASCOfficeOdfFile/src/docx/mediaitems.cpp
View file @
d95c93ab
...
...
@@ -39,15 +39,27 @@
#include <cpdoccore/xml/utils.h>
#include "mediaitems_utils.h"
#include "../../Common/DocxFormat/Source/Base/Base.h"
#include "../../Common/DocxFormat/Source/SystemUtility/File.h"
#include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
#include "../../DesktopEditor/raster/ImageFileFormatChecker.h"
namespace
cpdoccore
{
namespace
oox
{
bool
is_internal
(
const
std
::
wstring
&
uri
,
const
std
::
wstring
&
packetRoot
)
{
if
(
uri
.
empty
())
return
false
;
std
::
wstring
mediaPath
=
boost
::
regex_search
(
uri
.
begin
(),
uri
.
end
(),
boost
::
wregex
(
L"^/[A-Za-z]:"
))
?
std
::
wstring
(
uri
.
begin
()
+
1
,
uri
.
end
())
:
uri
;
std
::
wstring
resultPath
=
packetRoot
+
FILE_SEPARATOR_STR
+
mediaPath
;
return
FileSystem
::
Directory
::
IsExist
(
resultPath
)
||
FileSystem
::
Directory
::
IsExist
(
mediaPath
);
}
mediaitems
::
item
::
item
(
std
::
wstring
const
&
_href
,
RelsType
_type
,
...
...
@@ -55,12 +67,12 @@ mediaitems::item::item( std::wstring const & _href,
bool
_mediaInternal
,
std
::
wstring
const
&
_Id
)
:
href
(
_href
),
type
(
_type
),
outputName
(
_outputName
),
mediaInternal
(
_mediaInternal
),
Id
(
_Id
),
valid
(
true
)
//вообще говоря даже если файл покоцанный то мы все равно обязаны перенести "объект"
:
href
(
_href
),
type
(
_type
),
outputName
(
_outputName
),
mediaInternal
(
_mediaInternal
),
Id
(
_Id
),
valid
(
true
)
//вообще говоря даже если файл покоцанный то мы все равно обязаны перенести "объект"
{
count_add
=
1
;
count_used
=
0
;
...
...
@@ -82,8 +94,10 @@ std::wstring static get_default_file_name(RelsType type)
return
L"chart"
;
case
typeMedia
:
return
L"media"
;
case
typeObject
:
return
L"oleObject"
;
case
typeMsObject
:
return
L"msObject"
;
case
typeOleObject
:
return
L"oleObject"
;
default:
return
L""
;
}
...
...
@@ -123,7 +137,7 @@ std::wstring mediaitems::create_file_name(const std::wstring & uri, RelsType typ
}
}
if
(
type
==
typeObject
&&
sExt
.
empty
())
if
(
type
==
typeO
leO
bject
&&
sExt
.
empty
())
sExt
=
L".bin"
;
return
get_default_file_name
(
type
)
+
std
::
to_wstring
(
Num
)
+
sExt
;
...
...
@@ -152,7 +166,7 @@ std::wstring mediaitems::detectImageFileExtension(std::wstring &fileName)
std
::
wstring
mediaitems
::
add_or_find
(
const
std
::
wstring
&
href
,
RelsType
type
,
bool
&
isInternal
,
std
::
wstring
&
ref
)
{
bool
isMediaInternal
=
utils
::
media
::
is_internal
(
href
,
odf_packet_
);
bool
isMediaInternal
=
is_internal
(
href
,
odf_packet_
);
std
::
wstring
sub_path
=
L"media/"
;
...
...
@@ -161,17 +175,18 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
{
sub_path
=
L"charts/"
;
}
if
(
type
==
typeObject
)
if
(
type
==
type
MsObject
||
type
==
typeOle
Object
)
{
sub_path
=
L"embeddings/"
;
}
int
number
=
0
;
if
(
type
==
typeChart
)
number
=
count_charts
+
1
;
else
if
(
type
==
typeImage
)
number
=
count_image
+
1
;
else
if
(
type
==
typeShape
)
number
=
count_shape
+
1
;
else
if
(
type
==
typeMedia
)
number
=
count_media
+
1
;
else
if
(
type
==
typeObject
)
number
=
count_object
+
1
;
if
(
type
==
typeChart
)
number
=
count_charts
+
1
;
else
if
(
type
==
typeImage
)
number
=
count_image
+
1
;
else
if
(
type
==
typeShape
)
number
=
count_shape
+
1
;
else
if
(
type
==
typeMedia
)
number
=
count_media
+
1
;
else
if
(
type
==
typeMsObject
||
type
==
typeOleObject
)
number
=
count_object
+
1
;
else
number
=
items_
.
size
()
+
1
;
...
...
@@ -218,7 +233,7 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
id
=
std
::
wstring
(
L"picId"
)
+
std
::
to_wstring
(
count_image
+
1
);
count_image
++
;
}
else
if
(
type
==
typeObject
)
else
if
(
type
==
type
MsObject
||
type
==
typeOle
Object
)
{
id
=
std
::
wstring
(
L"objId"
)
+
std
::
to_wstring
(
count_object
+
1
);
count_object
++
;
...
...
@@ -240,16 +255,17 @@ std::wstring mediaitems::add_or_find(const std::wstring & href, RelsType type, b
void
mediaitems
::
dump_rels
(
rels
&
Rels
)
{
size_t
i
=
0
;
BOOST_FOREACH
(
item
&
elm
,
items_
)
for
(
int
i
=
0
;
i
<
items_
.
size
();
i
++
)
{
if
(
elm
.
count_used
>
elm
.
count_add
)
continue
;
// уже использовали этот релс выше(колонтитул ....)
Rels
.
add
(
relationship
(
elm
.
Id
,
utils
::
media
::
get_rel_type
(
elm
.
type
),
elm
.
valid
?
elm
.
outputName
:
L"NULL"
,
elm
.
mediaInternal
?
L""
:
L"External"
)
if
(
items_
[
i
].
count_used
>
items_
[
i
].
count_add
)
continue
;
// уже использовали этот релс выше(колонтитул ....)
Rels
.
add
(
relationship
(
items_
[
i
].
Id
,
get_rel_type
(
items_
[
i
].
type
),
items_
[
i
].
valid
?
items_
[
i
].
outputName
:
L"NULL"
,
items_
[
i
].
mediaInternal
?
L""
:
L"External"
)
);
elm
.
count_used
++
;
items_
[
i
]
.
count_used
++
;
}
}
...
...
ASCOfficeOdfFile/src/docx/mediaitems.h
View file @
d95c93ab
...
...
@@ -39,7 +39,6 @@
namespace
cpdoccore
{
namespace
oox
{
class
mediaitems
{
public:
...
...
@@ -85,6 +84,20 @@ public:
void
dump_rels
(
rels
&
Rels
);
items_array
&
items
()
{
return
items_
;
}
static
std
::
wstring
get_rel_type
(
RelsType
type
)
{
switch
(
type
)
{
case
typeImage
:
return
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
;
case
typeChart
:
return
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"
;
case
typeMsObject
:
return
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"
;
case
typeOleObject
:
return
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject"
;
case
typeHyperlink
:
return
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"
;
default:
return
L""
;
}
}
private:
std
::
wstring
create_file_name
(
const
std
::
wstring
&
uri
,
RelsType
type
,
bool
&
isInternal
,
size_t
Num
);
std
::
wstring
detectImageFileExtension
(
std
::
wstring
&
fileName
);
...
...
ASCOfficeOdfFile/src/docx/mediaitems_utils.cpp
deleted
100644 → 0
View file @
a9076beb
/*
* (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 "mediaitems_utils.h"
#include <boost/foreach.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/regex.hpp>
#include "../../Common/DocxFormat/Source/Base/Base.h"
#include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
namespace
cpdoccore
{
namespace
oox
{
namespace
utils
{
namespace
media
{
bool
is_internal
(
const
std
::
wstring
&
uri
,
const
std
::
wstring
&
packetRoot
)
{
if
(
uri
.
empty
())
return
false
;
std
::
wstring
mediaPath
=
boost
::
regex_search
(
uri
.
begin
(),
uri
.
end
(),
boost
::
wregex
(
L"^/[A-Za-z]:"
))
?
std
::
wstring
(
uri
.
begin
()
+
1
,
uri
.
end
())
:
uri
;
std
::
wstring
resultPath
=
packetRoot
+
FILE_SEPARATOR_STR
+
mediaPath
;
return
FileSystem
::
Directory
::
IsExist
(
resultPath
)
||
FileSystem
::
Directory
::
IsExist
(
mediaPath
);
}
std
::
wstring
get_rel_type
(
RelsType
type
)
{
switch
(
type
)
{
case
typeImage
:
{
return
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
;
}
case
typeChart
:
{
return
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart"
;
}
case
typeObject
:
{
return
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/package"
;
}
break
;
default:
return
L""
;
}
}
std
::
wstring
replace_extension
(
const
std
::
wstring
&
ext
)
{
// TODO
if
(
ext
==
L"jpg"
)
return
L"jpeg"
;
else
return
ext
;
}
}
}
}
}
ASCOfficeOdfFile/src/docx/mediaitems_utils.h
deleted
100644 → 0
View file @
a9076beb
/*
* (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
*
*/
#ifndef CPDOCCORE_MEDIAITEMS_UTILS_H_
#define CPDOCCORE_MEDIAITEMS_UTILS_H_
#include <string>
#include "mediaitems.h"
namespace
cpdoccore
{
namespace
oox
{
namespace
utils
{
namespace
media
{
bool
is_internal
(
const
std
::
wstring
&
uri
,
const
std
::
wstring
&
packetRoot
);
std
::
wstring
get_rel_type
(
RelsType
type
);
}
}
}
}
#endif
ASCOfficeOdfFile/src/docx/oox_chart_context.cpp
View file @
d95c93ab
...
...
@@ -31,13 +31,12 @@
*/
#include <boost/foreach.hpp>
#include <vector>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "mediaitems_utils.h"
#include "oox_rels.h"
#include "oox_rels.h"
#include "oox_chart_context.h"
#include "mediaitems.h"
namespace
cpdoccore
{
namespace
oox
{
...
...
@@ -87,7 +86,7 @@ void oox_chart_context::dump_rels(rels & Rels)
{
Rels
.
add
(
relationship
(
r
.
rid
,
utils
::
media
::
get_rel_type
(
r
.
type
)
,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image"
,
r
.
is_internal
?
std
::
wstring
(
L"../"
)
+
r
.
ref
:
r
.
ref
,
(
r
.
is_internal
?
L""
:
L"External"
)
)
...
...
ASCOfficeOdfFile/src/docx/oox_package.cpp
View file @
d95c93ab
...
...
@@ -140,10 +140,18 @@ bool content_types_file::add_or_find_override(const std::wstring & fileName)
std
::
wstring
extension
=
pos
>=
0
?
fileName
.
substr
(
pos
+
1
)
:
L""
;
if
(
extension
==
L"xlsx"
)
{
content_type
=
L"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"
;
content_type_content_
.
add_override
(
fileName
,
content_type
);
}
if
(
extension
==
L"bin"
)
{
//content_type = L"application/vnd.openxmlformats-officedocument.oleObject";
content_type_content_
.
add_override
(
fileName
,
content_type
);
//add_or_find_default(extension);
add_or_find_default
(
extension
);
}
return
true
;
}
void
content_types_file
::
set_media
(
mediaitems
&
_Mediaitems
)
...
...
@@ -309,12 +317,13 @@ void media::write(const std::wstring & RootPath)
std
::
wstring
path
=
RootPath
+
FILE_SEPARATOR_STR
+
L"media"
;
FileSystem
::
Directory
::
CreateDirectory
(
path
.
c_str
());
BOOST_FOREACH
(
mediaitems
::
item
&
item
,
mediaitems_
.
items
()
)
mediaitems
::
items_array
&
items
=
mediaitems_
.
items
();
for
(
int
i
=
0
;
i
<
items
.
size
();
i
++
)
{
if
(
item
.
mediaInternal
&&
item
.
valid
&&
(
item
.
type
==
typeImage
||
item
.
type
==
typeMedia
))
if
(
item
s
[
i
].
mediaInternal
&&
items
[
i
].
valid
&&
(
items
[
i
].
type
==
typeImage
||
items
[
i
]
.
type
==
typeMedia
))
{
std
::
wstring
&
file_name
=
item
.
href
;
std
::
wstring
file_name_out
=
RootPath
+
FILE_SEPARATOR_STR
+
item
.
outputName
;
std
::
wstring
&
file_name
=
items
[
i
]
.
href
;
std
::
wstring
file_name_out
=
RootPath
+
FILE_SEPARATOR_STR
+
items
[
i
]
.
outputName
;
CImageFileFormatChecker
svmFileChecker
;
if
(
svmFileChecker
.
isSvmFile
(
file_name
))
...
...
@@ -322,7 +331,7 @@ void media::write(const std::wstring & RootPath)
ConvertSvmToImage
(
file_name
,
file_name_out
,
appFonts_
);
}
else
NSFile
::
CFileBinary
::
Copy
(
item
.
href
,
file_name_out
);
NSFile
::
CFileBinary
::
Copy
(
item
s
[
i
]
.
href
,
file_name_out
);
}
}
...
...
@@ -347,15 +356,17 @@ void embeddings::write(const std::wstring & RootPath)
content_types_file
&
content_types
=
get_main_document
()
->
get_content_types_file
();
BOOST_FOREACH
(
mediaitems
::
item
&
item
,
embeddingsitems_
.
items
()
)
mediaitems
::
items_array
&
items
=
embeddingsitems_
.
items
();
for
(
int
i
=
0
;
i
<
items
.
size
();
i
++
)
{
if
(
item
.
mediaInternal
&&
item
.
valid
&&
item
.
type
==
typeObject
)
if
(
items
[
i
].
mediaInternal
&&
items
[
i
].
valid
&&
(
items
[
i
].
type
==
typeMsObject
||
items
[
i
].
type
==
typeOleObject
))
{
content_types
.
add_or_find_override
(
std
::
wstring
(
L"/word/"
)
+
item
.
outputName
);
content_types
.
add_or_find_override
(
std
::
wstring
(
L"/word/"
)
+
item
s
[
i
]
.
outputName
);
std
::
wstring
file_name_out
=
RootPath
+
FILE_SEPARATOR_STR
+
item
.
outputName
;
std
::
wstring
file_name_out
=
RootPath
+
FILE_SEPARATOR_STR
+
item
s
[
i
]
.
outputName
;
NSFile
::
CFileBinary
::
Copy
(
item
.
href
,
file_name_out
);
NSFile
::
CFileBinary
::
Copy
(
item
s
[
i
]
.
href
,
file_name_out
);
}
}
}
...
...
ASCOfficeOdfFile/src/docx/oox_rels.h
View file @
d95c93ab
...
...
@@ -40,7 +40,20 @@
namespace
cpdoccore
{
namespace
oox
{
enum
RelsType
{
typeUnknown
=
0
,
typeImage
,
typeChart
,
typeShape
,
typeTable
,
typeHyperlink
,
typeComment
,
typeMedia
,
typeGroupShape
,
typeObject
};
enum
RelsType
{
typeUnknown
=
0
,
typeImage
,
typeChart
,
typeShape
,
typeTable
,
typeHyperlink
,
typeComment
,
typeMedia
,
typeGroupShape
,
typeMsObject
,
typeOleObject
};
struct
_rel
{
...
...
ASCOfficeOdfFile/src/docx/pptx_drawings.cpp
View file @
d95c93ab
...
...
@@ -34,7 +34,6 @@
#include <vector>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "mediaitems_utils.h"
#include "oox_rels.h"
#include "pptx_drawings.h"
...
...
@@ -57,18 +56,18 @@ public:
pptx_drawings_
.
push_back
(
d
);
bool
present
=
false
;
BOOST_FOREACH
(
_rel
const
&
r
,
pptx_drawing_rels_
)
for
(
int
i
=
0
;
i
<
pptx_drawing_rels_
.
size
();
i
++
)
{
if
(
r
.
rid
==
rid
&&
r
.
ref
==
ref
)
if
(
pptx_drawing_rels_
[
i
].
rid
==
rid
&&
pptx_drawing_rels_
[
i
]
.
ref
==
ref
)
present
=
true
;
}
if
(
!
present
)
{
pptx_drawing_rels_
.
push_back
(
_rel
(
isInternal
,
rid
,
ref
,
type
));
}
BOOST_FOREACH
(
_hlink_desc
h
,
d
.
hlinks
)
for
(
int
i
=
0
;
i
<
d
.
hlinks
.
size
();
i
++
)
{
pptx_drawing_rels_
.
push_back
(
_rel
(
false
,
h
.
hId
,
h
.
hRef
,
typeHyperlink
));
pptx_drawing_rels_
.
push_back
(
_rel
(
false
,
d
.
hlinks
[
i
].
hId
,
d
.
hlinks
[
i
]
.
hRef
,
typeHyperlink
));
}
}
...
...
@@ -80,13 +79,14 @@ public:
{
bool
present
=
false
;
BOOST_FOREACH
(
_rel
const
&
r
,
pptx_drawing_rels_
)
for
(
int
i
=
0
;
i
<
pptx_drawing_rels_
.
size
();
i
++
)
{
if
(
r
.
rid
==
rid
&&
r
.
ref
==
ref
)
if
(
pptx_drawing_rels_
[
i
].
rid
==
rid
&&
pptx_drawing_rels_
[
i
]
.
ref
==
ref
)
present
=
true
;
}
if
(
!
present
)
{
if
(
type
==
typeHyperlink
)
isInternal
=
false
;
pptx_drawing_rels_
.
push_back
(
_rel
(
isInternal
,
rid
,
ref
,
type
));
}
}
...
...
@@ -105,47 +105,28 @@ public:
void
dump_rels
(
rels
&
Rels
)
{
BOOST_FOREACH
(
_rel
const
&
r
,
pptx_drawing_rels_
)
for
(
int
i
=
0
;
i
<
pptx_drawing_rels_
.
size
();
i
++
)
{
if
(
r
.
type
==
typeChart
)
//временно - нужно потом все загнать в релс
{
Rels
.
add
(
relationship
(
r
.
rid
,
utils
::
media
::
get_rel_type
(
r
.
type
),
(
r
.
is_internal
?
std
::
wstring
(
L"../"
)
+
r
.
ref
:
r
.
ref
),
(
r
.
is_internal
?
L""
:
L"External"
)
)
);
}
else
if
(
r
.
type
==
typeImage
)
{
Rels
.
add
(
relationship
(
r
.
rid
,
utils
::
media
::
get_rel_type
(
r
.
type
),
r
.
is_internal
?
std
::
wstring
(
L"../"
)
+
r
.
ref
:
r
.
ref
,
(
r
.
is_internal
?
L""
:
L"External"
)
)
);
}
else
if
(
r
.
type
==
typeHyperlink
)
if
(
pptx_drawing_rels_
[
i
].
type
==
typeUnknown
||
pptx_drawing_rels_
[
i
].
type
==
typeTable
||
pptx_drawing_rels_
[
i
].
type
==
typeShape
||
pptx_drawing_rels_
[
i
].
type
==
typeGroupShape
)
continue
;
if
(
pptx_drawing_rels_
[
i
].
type
==
typeComment
)
{
Rels
.
add
(
relationship
(
r
.
rid
,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"
,
r
.
ref
,
L"External"
)
);
Rels
.
add
(
relationship
(
pptx_drawing_rels_
[
i
].
rid
,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"
,
pptx_drawing_rels_
[
i
].
ref
)
);
}
else
if
(
r
.
type
==
typeComment
)
else
{
Rels
.
add
(
relationship
(
r
.
rid
,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments"
,
r
.
ref
)
);
Rels
.
add
(
relationship
(
pptx_drawing_rels_
[
i
].
rid
,
mediaitems
::
get_rel_type
(
pptx_drawing_rels_
[
i
].
type
),
(
pptx_drawing_rels_
[
i
].
is_internal
?
std
::
wstring
(
L"../"
)
+
pptx_drawing_rels_
[
i
].
ref
:
pptx_drawing_rels_
[
i
].
ref
),
(
pptx_drawing_rels_
[
i
].
is_internal
?
L""
:
L"External"
))
);
}
}
}
}
private:
...
...
ASCOfficeOdfFile/src/docx/pptx_slide_context.cpp
View file @
d95c93ab
This diff is collapsed.
Click to expand it.
ASCOfficeOdfFile/src/docx/pptx_slide_context.h
View file @
d95c93ab
...
...
@@ -50,38 +50,39 @@ public:
pptx_slide_context
(
pptx_conversion_context
&
Context
);
void
start_slide
();
void
end_slide
(){}
void
end_slide
(){}
////////////////////////////////////////////////////////////////////////////////////////
void
start_slide_animation
();
void
end_slide_animation
(){}
void
start_slide_animation
();
void
end_slide_animation
(){}
void
set_transitionFilter
(
std
::
wstring
&
type
,
_CP_OPT
(
std
::
wstring
)
&
dir
,
_CP_OPT
(
std
::
wstring
)
&
dop
,
_CP_OPT
(
int
)
&
time
);
void
set_transitionAction
(
bool
val
);
void
set_transitionSpeed
(
std
::
wstring
val
);
void
set_transitionFilter
(
std
::
wstring
&
type
,
_CP_OPT
(
std
::
wstring
)
&
dir
,
_CP_OPT
(
std
::
wstring
)
&
dop
,
_CP_OPT
(
int
)
&
time
);
void
set_transitionAction
(
bool
val
);
void
set_transitionSpeed
(
std
::
wstring
val
);
///////////////////////////////////////////////////////////////////////////////////////////
void
set_rect
(
double
width_pt
,
double
height_pt
,
double
x_pt
,
double
y_pt
);
void
set_rect
(
double
width_pt
,
double
height_pt
,
double
x_pt
,
double
y_pt
);
void
set_translate
(
double
x_pt
,
double
y_pt
);
void
set_scale
(
double
cx_pt
,
double
cy_pt
);
void
set_rotate
(
double
angle
);
void
set_translate
(
double
x_pt
,
double
y_pt
);
void
set_scale
(
double
cx_pt
,
double
cy_pt
);
void
set_rotate
(
double
angle
);
void
set_name
(
std
::
wstring
const
&
name
);
void
set_anchor
(
std
::
wstring
anchor
,
double
x_pt
,
double
y_pt
);
void
set_property
(
odf_reader
::
_property
p
);
void
set_name
(
std
::
wstring
const
&
name
);
void
set_anchor
(
std
::
wstring
anchor
,
double
x_pt
,
double
y_pt
);
void
set_property
(
odf_reader
::
_property
p
);
std
::
vector
<
odf_reader
::
_property
>
&
get_properties
();
void
set_clipping
(
const
std
::
wstring
&
str
);
void
set_fill
(
_oox_fill
&
fill
);
void
set_clipping
(
const
std
::
wstring
&
str
);
void
set_fill
(
_oox_fill
&
fill
);
void
set_placeHolder_type
(
std
::
wstring
typeHolder
);
void
set_placeHolder_idx
(
int
idx
);
void
set_placeHolder_type
(
std
::
wstring
typeHolder
);
void
set_placeHolder_idx
(
int
idx
);
std
::
wstring
add_hyperlink
(
std
::
wstring
const
&
ref
,
bool
object
);
void
start_image
(
std
::
wstring
const
&
path
);
void
end_image
();
void
start_chart
(
std
::
wstring
const
&
path
);
void
end_chart
();
void
start_frame
();
void
set_image
(
std
::
wstring
const
&
path
);
void
set_chart
(
std
::
wstring
const
&
path
);
void
set_ole_object
(
const
std
::
wstring
&
path
,
const
std
::
wstring
&
progId
);
void
set_text_box
();
void
end_frame
();
void
start_table
();
void
end_table
();
...
...
@@ -89,9 +90,6 @@ public:
void
start_shape
(
int
type
);
void
end_shape
();
void
start_object_ole
();
void
end_object_ole
();
void
set_use_image_replacement
();
bool
empty
()
const
;
...
...
@@ -109,7 +107,6 @@ public:
void
add_background
(
_oox_fill
&
fill
);
void
add_rels
(
bool
isInternal
,
std
::
wstring
const
&
rid
,
std
::
wstring
const
&
ref
,
...
...
@@ -121,13 +118,14 @@ public:
void
set_page_number
();
void
set_date_time
();
private:
void
process_common_properties
(
drawing_object_description
&
pic
,
_pptx_drawing
&
drawing
);
void
process_common_properties
(
drawing_object_description
&
obj
,
_pptx_drawing
&
drawing
);
void
default_set
();
void
process_shapes
();
void
process_images
();
void
process_charts
();
void
process_tables
();
void
process_shape
(
drawing_object_description
&
obj
);
void
process_image
(
drawing_object_description
&
obj
);
void
process_chart
(
drawing_object_description
&
obj
);
void
process_table
(
drawing_object_description
&
obj
);
void
process_object
(
drawing_object_description
&
obj
);
int
hlinks_size_
;
...
...
ASCOfficeOdfFile/src/docx/xlsx_drawing.cpp
View file @
d95c93ab
...
...
@@ -71,11 +71,11 @@ void xlsx_serialize_text(std::wostream & strm, _xlsx_drawing & val)
}
}
void
xlsx_drawing_position
::
serialize
(
std
::
wostream
&
strm
)
void
xlsx_drawing_position
::
serialize
(
std
::
wostream
&
strm
,
std
::
wstring
ns
)
{
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
std
::
wstring
(
L"xdr:"
)
+
(
type
==
xlsx_drawing_position
::
from
?
L"from"
:
L"to"
)
)
CP_XML_NODE
(
ns
+
(
type
==
xlsx_drawing_position
::
from
?
L"from"
:
L"to"
)
)
{
CP_XML_NODE
(
L"xdr:col"
)
{
...
...
@@ -182,6 +182,34 @@ void xlsx_serialize_shape(std::wostream & strm, _xlsx_drawing & val)
}
}
// CP_XML_WRITER
}
void
xlsx_serialize_object
(
std
::
wostream
&
strm
,
_xlsx_drawing
&
val
)
{
//отображательная часть
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"xdr:sp"
)
{
CP_XML_NODE
(
L"xdr:nvSpPr"
)
{
CP_XML_NODE
(
L"xdr:cNvPr"
)
{
CP_XML_ATTR
(
L"id"
,
val
.
id
);
//числовое значение val.rId
CP_XML_ATTR
(
L"name"
,
val
.
name
);
}
CP_XML_NODE
(
L"xdr:cNvSpPr"
);
}
CP_XML_NODE
(
L"xdr:spPr"
)
{
val
.
serialize_xfrm
(
CP_XML_STREAM
());
CP_XML_NODE
(
L"a:prstGeom"
)
{
CP_XML_ATTR
(
L"prst"
,
L"rect"
);
}
}
}
}
}
void
xlsx_serialize_group
(
std
::
wostream
&
strm
,
_xlsx_drawing
&
val
)
{
CP_XML_WRITER
(
strm
)
...
...
@@ -192,8 +220,8 @@ void xlsx_serialize_group(std::wostream & strm, _xlsx_drawing & val)
{
CP_XML_NODE
(
L"xdr:cNvPr"
)
{
CP_XML_ATTR
(
L"id"
,
val
.
id
);
CP_XML_ATTR
(
L"name"
,
val
.
name
);
CP_XML_ATTR
(
L"id"
,
val
.
id
);
CP_XML_ATTR
(
L"name"
,
val
.
name
);
}
CP_XML_NODE
(
L"xdr:cNvGrpSpPr"
);
}
...
...
@@ -208,7 +236,7 @@ void xlsx_serialize_group(std::wostream & strm, _xlsx_drawing & val)
}
void
xlsx_serialize_chart
(
std
::
wostream
&
strm
,
_xlsx_drawing
&
val
)
{
{
//отображательная часть
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"xdr:graphicFrame"
)
...
...
@@ -217,14 +245,13 @@ void xlsx_serialize_chart(std::wostream & strm, _xlsx_drawing & val)
{
CP_XML_NODE
(
L"xdr:cNvPr"
)
{
CP_XML_ATTR
(
L"id"
,
val
.
id
);
CP_XML_ATTR
(
L"name"
,
val
.
name
);
CP_XML_ATTR
(
L"id"
,
val
.
id
);
CP_XML_ATTR
(
L"name"
,
val
.
name
);
}
CP_XML_NODE
(
L"xdr:cNvGraphicFramePr"
);
}
val
.
serialize_xfrm
(
CP_XML_STREAM
(),
L"xdr"
);
//oox_serialize_ln(CP_XML_STREAM(),val.additional);
CP_XML_NODE
(
L"a:graphic"
)
...
...
@@ -240,10 +267,10 @@ void xlsx_serialize_chart(std::wostream & strm, _xlsx_drawing & val)
}
}
}
}
// xdr:graphicFrame
}
// CP_XML_WRITER
}
}
}
void
xlsx_serialize
_object
(
std
::
wostream
&
strm
,
_xlsx_drawing
&
val
)
void
xlsx_serialize
(
std
::
wostream
&
strm
,
_xlsx_drawing
&
val
)
{
if
(
val
.
type
==
typeShape
)
{
...
...
@@ -261,12 +288,17 @@ void xlsx_serialize_object(std::wostream & strm, _xlsx_drawing & val)
{
xlsx_serialize_group
(
strm
,
val
);
}
else
if
(
val
.
type
==
typeOleObject
||
val
.
type
==
typeMsObject
)
{
xlsx_serialize_object
(
strm
,
val
);
}
}
void
_xlsx_drawing
::
serialize
(
std
::
wostream
&
strm
)
{
if
(
inGroup
)
return
xlsx_serialize
_object
(
strm
,
*
this
);
return
xlsx_serialize
(
strm
,
*
this
);
CP_XML_WRITER
(
strm
)
{
...
...
@@ -279,8 +311,7 @@ void _xlsx_drawing::serialize(std::wostream & strm)
from_
.
serialize
(
CP_XML_STREAM
());
to_
.
serialize
(
CP_XML_STREAM
());
xlsx_serialize_object
(
CP_XML_STREAM
(),
*
this
);
xlsx_serialize
(
CP_XML_STREAM
(),
*
this
);
CP_XML_NODE
(
L"xdr:clientData"
);
}
}
...
...
@@ -293,15 +324,12 @@ void _xlsx_drawing::serialize(std::wostream & strm)
CP_XML_ATTR
(
L"x"
,
x
);
CP_XML_ATTR
(
L"y"
,
y
);
}
CP_XML_NODE
(
L"xdr:ext"
)
{
CP_XML_ATTR
(
L"cx"
,
cx
);
CP_XML_ATTR
(
L"cy"
,
cy
);
}
xlsx_serialize_object
(
CP_XML_STREAM
(),
*
this
);
xlsx_serialize
(
CP_XML_STREAM
(),
*
this
);
CP_XML_NODE
(
L"xdr:clientData"
);
}
}
...
...
@@ -310,5 +338,38 @@ void _xlsx_drawing::serialize(std::wostream & strm)
}
void
_xlsx_drawing
::
serialize_object
(
std
::
wostream
&
strm
)
{
if
(
type
!=
typeOleObject
)
return
;
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"oleObject"
)
{
CP_XML_ATTR
(
L"r:id"
,
objectId
);
CP_XML_ATTR
(
L"shapeId"
,
id
);
CP_XML_ATTR
(
L"progId"
,
objectProgId
);
CP_XML_NODE
(
L"objectPr"
)
{
CP_XML_ATTR
(
L"defaultSize"
,
0
);
if
(
fill
.
bitmap
)
{
CP_XML_ATTR
(
L"r:id"
,
fill
.
bitmap
->
rId
);
}
CP_XML_NODE
(
L"anchor"
)
{
CP_XML_ATTR
(
L"moveWithCells"
,
1
);
from_
.
serialize
(
CP_XML_STREAM
(),
L""
);
to_
.
serialize
(
CP_XML_STREAM
(),
L""
);
}
}
}
}
}
}
}
ASCOfficeOdfFile/src/docx/xlsx_drawing.h
View file @
d95c93ab
...
...
@@ -49,7 +49,7 @@ struct xlsx_drawing_position
enum
type_t
{
from
,
to
}
type
;
xlsx_table_position
position
;
void
serialize
(
std
::
wostream
&
_Wostream
);
void
serialize
(
std
::
wostream
&
_Wostream
,
std
::
wstring
ns
=
L"xdr:"
);
};
...
...
@@ -65,7 +65,8 @@ public:
std
::
wstring
content_group_
;
void
serialize
(
std
::
wostream
&
_Wostream
);
void
serialize
(
std
::
wostream
&
strm
);
void
serialize_object
(
std
::
wostream
&
strm
);
};
}
}
ASCOfficeOdfFile/src/docx/xlsx_drawing_context.cpp
View file @
d95c93ab
...
...
@@ -34,8 +34,6 @@
#include <iostream>
#include <cpdoccore/xml/utils.h>
#include "mediaitems_utils.h"
#include "xlsx_drawing.h"
#include "xlsx_drawings.h"
#include "xlsx_utils.h"
...
...
@@ -111,7 +109,8 @@ class xlsx_drawing_context::Impl
public:
Impl
(
xlsx_drawing_context_handle
&
handle
)
:
xlsx_drawings_
(
xlsx_drawings
::
create
(
false
)),
handle_
(
handle
)
{
current_level_
=
&
objects_
;
current_level_
=
&
objects_
;
use_image_replacement_
=
false
;
}
xlsx_drawing_context_handle
&
handle_
;
...
...
@@ -121,13 +120,14 @@ public:
std
::
vector
<
drawing_object_description
*>
groups_
;
std
::
vector
<
drawing_object_description
>
*
current_level_
;
bool
use_image_replacement_
;
//-----------------------------------------------------------------------------------
mediaitems
&
get_mediaitems
()
{
return
handle_
.
impl_
->
get_mediaitems
();
}
void
serialize
(
std
::
wostream
&
strm
)
{
xlsx_
serialize
(
strm
,
*
xlsx_drawings_
);
xlsx_
drawings_
->
serialize
(
strm
);
}
bool
empty
()
const
...
...
@@ -167,12 +167,12 @@ void xlsx_drawing_context::clear()
impl_
->
object_description_
.
anchor_y_
=
0
;
impl_
->
object_description_
.
clipping_string_
=
L""
;
impl_
->
object_description_
.
svg_rect_
=
boost
::
none
;
impl_
->
object_description_
.
use_image_replace_
=
false
;
impl_
->
object_description_
.
additional_
.
clear
();
impl_
->
object_description_
.
hlinks_
.
clear
();
impl_
->
object_description_
.
additional_
.
clear
();
impl_
->
use_image_replacement_
=
false
;
}
xlsx_drawing_context
::~
xlsx_drawing_context
()
...
...
@@ -272,37 +272,57 @@ void xlsx_drawing_context::end_shape()
impl_
->
current_level_
->
push_back
(
impl_
->
object_description_
);
}
void
xlsx_drawing_context
::
s
tart_object_ole
()
void
xlsx_drawing_context
::
s
et_use_image_replacement
()
{
impl_
->
use_image_replacement_
=
true
;
}
void
xlsx_drawing_context
::
end_object_ole
()
void
xlsx_drawing_context
::
set_text_box
()
{
impl_
->
object_description_
.
type_
=
typeShape
;
impl_
->
object_description_
.
shape_type_
=
2
;
//2,3...
}
void
xlsx_drawing_context
::
s
tart_image
(
std
::
wstring
const
&
path
)
void
xlsx_drawing_context
::
s
et_ole_object
(
const
std
::
wstring
&
path
,
const
std
::
wstring
&
progId
)
{
impl_
->
object_description_
.
type_
=
type
Image
;
impl_
->
object_description_
.
type_
=
type
OleObject
;
impl_
->
object_description_
.
xlink_href_
=
path
;
impl_
->
object_description_
.
descriptor_
=
progId
;
}
void
xlsx_drawing_context
::
end_image
()
void
xlsx_drawing_context
::
set_image
(
std
::
wstring
const
&
path
)
{
impl_
->
current_level_
->
push_back
(
impl_
->
object_description_
);
if
(
impl_
->
object_description_
.
type_
==
typeUnknown
)
{
impl_
->
object_description_
.
type_
=
typeImage
;
impl_
->
object_description_
.
xlink_href_
=
path
;
}
else
if
(
impl_
->
use_image_replacement_
)
{
impl_
->
object_description_
.
fill_
.
type
=
2
;
impl_
->
object_description_
.
fill_
.
bitmap
=
oox
::
oox_bitmap_fill
::
create
();
impl_
->
object_description_
.
fill_
.
bitmap
->
xlink_href_
=
path
;
}
}
void
xlsx_drawing_context
::
start_
chart
(
std
::
wstring
const
&
path
)
void
xlsx_drawing_context
::
start_
frame
(
)
{
impl_
->
object_description_
.
type_
=
typeChart
;
impl_
->
object_description_
.
xlink_href_
=
path
;
impl_
->
object_description_
.
type_
=
typeUnknown
;
}
void
xlsx_drawing_context
::
end_
chart
()
void
xlsx_drawing_context
::
end_
frame
()
{
impl_
->
current_level_
->
push_back
(
impl_
->
object_description_
);
}
void
xlsx_drawing_context
::
set_chart
(
std
::
wstring
const
&
path
)
{
impl_
->
object_description_
.
type_
=
typeChart
;
impl_
->
object_description_
.
xlink_href_
=
path
;
}
void
xlsx_drawing_context
::
set_rect
(
double
width_pt
,
double
height_pt
,
double
x_pt
,
double
y_pt
)
{
impl_
->
object_description_
.
svg_rect_
=
_rect
(
width_pt
,
height_pt
,
x_pt
,
y_pt
);
}
void
xlsx_drawing_context
::
set_translate
(
double
x_pt
,
double
y_pt
)
{
if
(
impl_
->
object_description_
.
svg_rect_
)
...
...
@@ -313,6 +333,7 @@ void xlsx_drawing_context::set_translate(double x_pt, double y_pt)
r
.
y
+=
y_pt
;
}
}
void
xlsx_drawing_context
::
set_rotate
(
double
angle
)
{
set_property
(
odf_reader
::
_property
(
L"svg:rotate"
,
angle
));
...
...
@@ -369,6 +390,7 @@ void xlsx_drawing_context::set_fill(_oox_fill & fill)
{
impl_
->
object_description_
.
fill_
=
fill
;
}
std
::
wstring
xlsx_drawing_context
::
add_hyperlink
(
std
::
wstring
const
&
href
,
bool
object
)
{
++
hlinks_size_
;
...
...
@@ -384,11 +406,6 @@ std::wstring xlsx_drawing_context::add_hyperlink(std::wstring const & href,bool
return
hId
;
}
void
xlsx_drawing_context
::
set_use_image_replacement
()
{
impl_
->
object_description_
.
use_image_replace_
=
true
;
}
bool
xlsx_drawing_context
::
empty
()
const
{
return
impl_
->
empty
();
...
...
@@ -542,6 +559,19 @@ void xlsx_drawing_context::process_chart(drawing_object_description & obj,_xlsx_
impl_
->
get_drawings
()
->
add
(
isMediaInternal
,
drawing
.
objectId
,
ref
,
obj
.
type_
);
// не объект
}
void
xlsx_drawing_context
::
process_object
(
drawing_object_description
&
obj
,
_xlsx_drawing
&
drawing
,
xlsx_drawings_ptr
xlsx_drawings_
)
{
std
::
wstring
ref
;
bool
isMediaInternal
=
true
;
drawing
.
objectId
=
impl_
->
get_mediaitems
().
add_or_find
(
obj
.
xlink_href_
,
obj
.
type_
,
isMediaInternal
,
ref
);
drawing
.
objectProgId
=
obj
.
descriptor_
;
xlsx_drawings_
->
add
(
drawing
,
isMediaInternal
,
drawing
.
objectId
,
ref
,
obj
.
type_
,
true
);
if
(
drawing
.
inGroup
)
impl_
->
get_drawings
()
->
add
(
isMediaInternal
,
drawing
.
objectId
,
ref
,
obj
.
type_
);
// не объект
}
void
xlsx_drawing_context
::
process_shape
(
drawing_object_description
&
obj
,
_xlsx_drawing
&
drawing
,
xlsx_drawings_ptr
xlsx_drawings_
)
{
std
::
wstring
ref
;
...
...
@@ -559,7 +589,7 @@ void xlsx_drawing_context::process_group(drawing_object_description & obj, xlsx_
std
::
wstringstream
strm
;
xlsx_
serialize
(
strm
,
*
xlsx_drawings_child
);
xlsx_
drawings_child
->
serialize
(
strm
);
drawing
.
content_group_
=
strm
.
str
();
...
...
@@ -581,9 +611,6 @@ void xlsx_drawing_context::process_objects(std::vector<drawing_object_descriptio
{
drawing_object_description
&
obj
=
objects
[
i
];
int
pos_replaicement
=
obj
.
xlink_href_
.
find
(
L"ObjectReplacements"
);
if
(
pos_replaicement
>=
0
&&
!
obj
.
use_image_replace_
)
continue
;
//объект
_xlsx_drawing
drawing
=
_xlsx_drawing
();
drawing
.
type
=
obj
.
type_
;
...
...
@@ -600,7 +627,11 @@ void xlsx_drawing_context::process_objects(std::vector<drawing_object_descriptio
bool
isMediaInternal
=
true
;
drawing
.
fill
.
bitmap
->
rId
=
impl_
->
get_mediaitems
().
add_or_find
(
drawing
.
fill
.
bitmap
->
xlink_href_
,
typeImage
,
isMediaInternal
,
ref
);
impl_
->
get_drawings
()
->
add
(
isMediaInternal
,
drawing
.
fill
.
bitmap
->
rId
,
ref
,
typeImage
);
//собственно это не объект, а доп рел и ref объекта
bool
in_sheet
=
(
obj
.
type_
==
typeOleObject
||
obj
.
type_
==
typeMsObject
)
?
true
:
false
;
impl_
->
get_drawings
()
->
add
(
isMediaInternal
,
drawing
.
fill
.
bitmap
->
rId
,
ref
,
typeImage
,
in_sheet
);
//собственно это не объект, а доп рел и ref объекта
//object dumps in sheet rels !!
}
process_common_properties
(
obj
,
drawing
,
table_metrics
);
...
...
@@ -611,6 +642,9 @@ void xlsx_drawing_context::process_objects(std::vector<drawing_object_descriptio
case
typeImage
:
process_image
(
obj
,
drawing
,
xlsx_drawings_
);
break
;
case
typeShape
:
process_shape
(
obj
,
drawing
,
xlsx_drawings_
);
break
;
case
typeGroupShape
:
process_group
(
obj
,
table_metrics
,
drawing
,
xlsx_drawings_
);
break
;
case
typeMsObject
:
case
typeOleObject
:
process_object
(
obj
,
drawing
,
xlsx_drawings_
);
break
;
}
}
}
...
...
ASCOfficeOdfFile/src/docx/xlsx_drawing_context.h
View file @
d95c93ab
...
...
@@ -80,35 +80,33 @@ public:
void
set_odf_packet_path
(
std
::
wstring
path
){
odf_packet_path_
=
path
;}
//для анализа картинок
void
start_drawing
(
std
::
wstring
const
&
name
);
void
end_drawing
();
void
start_drawing
(
std
::
wstring
const
&
name
);
void
end_drawing
();
void
start_group
(
std
::
wstring
const
&
name
);
void
end_group
();
void
start_image
(
std
::
wstring
const
&
path
);
void
end_image
();
void
start_chart
(
std
::
wstring
const
&
path
);
void
end_chart
();
void
end_group
();
void
start_shape
(
int
type
);
//...пока тока общие свойства ... частные для каждого объекта пооозже
void
end_shape
();
void
start_object_ole
();
void
end_object_ole
();
void
start_frame
();
void
set_image
(
std
::
wstring
const
&
path
);
void
set_chart
(
std
::
wstring
const
&
path
);
void
set_ole_object
(
const
std
::
wstring
&
path
,
const
std
::
wstring
&
progId
);
void
set_text_box
();
void
end_frame
();
void
set_rect
(
double
width_pt
,
double
height_pt
,
double
x_pt
,
double
y_pt
);
void
set_translate
(
double
x_pt
,
double
y_pt
);
void
set_scale
(
double
cx_pt
,
double
cy_pt
);
void
set_rotate
(
double
angle
);
void
set_translate
(
double
x_pt
,
double
y_pt
);
void
set_scale
(
double
cx_pt
,
double
cy_pt
);
void
set_rotate
(
double
angle
);
void
set_anchor
(
std
::
wstring
anchor
,
double
x_pt
,
double
y_pt
,
bool
group
=
false
);
void
set_property
(
odf_reader
::
_property
p
);
void
set_clipping
(
const
std
::
wstring
&
str
);
void
set_fill
(
_oox_fill
&
fill
);
void
set_anchor
(
std
::
wstring
anchor
,
double
x_pt
,
double
y_pt
,
bool
group
=
false
);
void
set_property
(
odf_reader
::
_property
p
);
void
set_clipping
(
const
std
::
wstring
&
str
);
void
set_fill
(
_oox_fill
&
fill
);
std
::
vector
<
odf_reader
::
_property
>
&
get_properties
();
...
...
@@ -136,6 +134,7 @@ private:
void
process_image
(
drawing_object_description
&
obj
,
_xlsx_drawing
&
drawing
,
xlsx_drawings_ptr
xlsx_drawings_
);
void
process_chart
(
drawing_object_description
&
obj
,
_xlsx_drawing
&
drawing
,
xlsx_drawings_ptr
xlsx_drawings_
);
void
process_shape
(
drawing_object_description
&
obj
,
_xlsx_drawing
&
drawing
,
xlsx_drawings_ptr
xlsx_drawings_
);
void
process_object
(
drawing_object_description
&
obj
,
_xlsx_drawing
&
drawing
,
xlsx_drawings_ptr
xlsx_drawings_
);
void
process_common_properties
(
drawing_object_description
&
obj
,
_xlsx_drawing
&
drawing
,
xlsx_table_metrics
&
table_metrics
);
...
...
ASCOfficeOdfFile/src/docx/xlsx_drawings.cpp
View file @
d95c93ab
...
...
@@ -36,7 +36,6 @@
#include <vector>
#include <cpdoccore/xml/simple_xml_writer.h>
#include "mediaitems_utils.h"
#include "oox_rels.h"
namespace
cpdoccore
{
...
...
@@ -45,40 +44,44 @@ namespace oox {
class
xlsx_drawings
::
Impl
{
public:
void
add
(
_xlsx_drawing
const
&
d
,
bool
isInternal
,
std
::
wstring
const
&
rid
,
std
::
wstring
const
&
ref
,
RelsType
type
)
void
add
(
_xlsx_drawing
const
&
d
,
bool
isInternal
,
std
::
wstring
const
&
rid
,
std
::
wstring
const
&
ref
,
RelsType
type
,
bool
sheet_rel
)
//объект
{
xlsx_drawings_
.
push_back
(
d
);
bool
present
=
false
;
for
(
int
i
=
0
;
i
<
xlsx_drawing_rels_
.
size
();
i
++
)
{
if
(
xlsx_drawing_rels_
[
i
].
rid
==
rid
&&
xlsx_drawing_rels_
[
i
].
ref
==
ref
)
present
=
true
;
}
if
(
!
present
)
{
xlsx_drawing_rels_
.
push_back
(
_rel
(
isInternal
,
rid
,
ref
,
type
));
}
for
(
int
i
=
0
;
i
<
d
.
hlinks
.
size
();
i
++
)
add
(
isInternal
,
rid
,
ref
,
type
,
sheet_rel
);
for
(
int
i
=
0
;
i
<
d
.
hlinks
.
size
();
i
++
)
{
xlsx_drawing_rels_
.
push_back
(
_rel
(
false
,
d
.
hlinks
[
i
].
hId
,
d
.
hlinks
[
i
].
hRef
,
typeHyperlink
));
}
}
void
add
(
bool
isInternal
,
std
::
wstring
const
&
rid
,
std
::
wstring
const
&
ref
,
RelsType
type
)
void
add
(
bool
isInternal
,
std
::
wstring
const
&
rid
,
std
::
wstring
const
&
ref
,
RelsType
type
,
bool
sheet_rel
)
//не объект
{
bool
present
=
false
;
for
(
int
i
=
0
;
i
<
xlsx_drawing_rels_
.
size
();
i
++
)
{
if
(
xlsx_drawing_rels_
[
i
].
rid
==
rid
&&
xlsx_drawing_rels_
[
i
].
ref
==
ref
)
present
=
true
;
if
(
type
==
typeHyperlink
)
isInternal
=
false
;
if
(
sheet_rel
)
{
for
(
int
i
=
0
;
i
<
xlsx_sheet_rels_
.
size
();
i
++
)
{
if
(
xlsx_sheet_rels_
[
i
].
rid
==
rid
&&
xlsx_sheet_rels_
[
i
].
ref
==
ref
)
present
=
true
;
}
if
(
!
present
)
xlsx_sheet_rels_
.
push_back
(
_rel
(
isInternal
,
rid
,
ref
,
type
));
}
if
(
!
present
)
else
{
xlsx_drawing_rels_
.
push_back
(
_rel
(
isInternal
,
rid
,
ref
,
type
));
for
(
int
i
=
0
;
i
<
xlsx_drawing_rels_
.
size
();
i
++
)
{
if
(
xlsx_drawing_rels_
[
i
].
rid
==
rid
&&
xlsx_drawing_rels_
[
i
].
ref
==
ref
)
present
=
true
;
}
if
(
!
present
)
xlsx_drawing_rels_
.
push_back
(
_rel
(
isInternal
,
rid
,
ref
,
type
));
}
}
void
serialize
(
std
::
wostream
&
strm
)
{
...
...
@@ -107,54 +110,56 @@ public:
}
}
}
void
serialize_objects
(
std
::
wostream
&
strm
)
{
for
(
int
i
=
0
;
i
<
xlsx_drawings_
.
size
();
i
++
)
{
if
(
xlsx_drawings_
[
i
].
type
!=
typeOleObject
)
continue
;
xlsx_drawings_
[
i
].
serialize_object
(
strm
);
}
}
bool
empty
()
const
{
return
(
xlsx_drawings_
.
empty
());
}
void
dump_rels
(
rels
&
Rels
)
void
dump_rels
_drawing
(
rels
&
Rels
)
{
for
(
int
i
=
0
;
i
<
xlsx_drawing_rels_
.
size
();
i
++
)
{
if
(
xlsx_drawing_rels_
[
i
].
type
==
typeChart
)
if
(
xlsx_drawing_rels_
[
i
].
type
==
typeImage
||
xlsx_drawing_rels_
[
i
].
type
==
typeMedia
||
xlsx_drawing_rels_
[
i
].
type
==
typeChart
||
xlsx_drawing_rels_
[
i
].
type
==
typeHyperlink
)
{
Rels
.
add
(
relationship
(
xlsx_drawing_rels_
[
i
].
rid
,
utils
::
media
::
get_rel_type
(
xlsx_drawing_rels_
[
i
].
type
),
Rels
.
add
(
relationship
(
xlsx_drawing_rels_
[
i
].
rid
,
mediaitems
::
get_rel_type
(
xlsx_drawing_rels_
[
i
].
type
),
(
xlsx_drawing_rels_
[
i
].
is_internal
?
std
::
wstring
(
L"../"
)
+
xlsx_drawing_rels_
[
i
].
ref
:
xlsx_drawing_rels_
[
i
].
ref
),
(
xlsx_drawing_rels_
[
i
].
is_internal
?
L""
:
L"External"
)
)
);
}
else
if
(
xlsx_drawing_rels_
[
i
].
type
==
typeImage
)
{
Rels
.
add
(
relationship
(
xlsx_drawing_rels_
[
i
].
rid
,
utils
::
media
::
get_rel_type
(
xlsx_drawing_rels_
[
i
].
type
),
xlsx_drawing_rels_
[
i
].
is_internal
?
std
::
wstring
(
L"../"
)
+
xlsx_drawing_rels_
[
i
].
ref
:
xlsx_drawing_rels_
[
i
].
ref
,
(
xlsx_drawing_rels_
[
i
].
is_internal
?
L""
:
L"External"
)
)
);
}
else
if
(
xlsx_drawing_rels_
[
i
].
type
==
typeHyperlink
)
{
Rels
.
add
(
relationship
(
xlsx_drawing_rels_
[
i
].
rid
,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"
,
xlsx_drawing_rels_
[
i
].
ref
,
L"External"
)
);
(
xlsx_drawing_rels_
[
i
].
is_internal
?
L""
:
L"External"
))
);
}
}
}
void
dump_rels_sheet
(
rels
&
Rels
)
{
for
(
int
i
=
0
;
i
<
xlsx_sheet_rels_
.
size
();
i
++
)
{
Rels
.
add
(
relationship
(
xlsx_sheet_rels_
[
i
].
rid
,
mediaitems
::
get_rel_type
(
xlsx_sheet_rels_
[
i
].
type
),
(
xlsx_sheet_rels_
[
i
].
is_internal
?
std
::
wstring
(
L"../"
)
+
xlsx_sheet_rels_
[
i
].
ref
:
xlsx_sheet_rels_
[
i
].
ref
),
(
xlsx_sheet_rels_
[
i
].
is_internal
?
L""
:
L"External"
))
);
}
}
bool
inGroup
;
private:
std
::
vector
<
_xlsx_drawing
>
xlsx_drawings_
;
std
::
vector
<
_rel
>
xlsx_drawing_rels_
;
std
::
vector
<
_rel
>
xlsx_sheet_rels_
;
};
xlsx_drawings
::
xlsx_drawings
(
bool
inGroup_
)
:
impl_
(
new
xlsx_drawings
::
Impl
()
)
...
...
@@ -167,19 +172,24 @@ xlsx_drawings::~xlsx_drawings()
}
void
xlsx_drawings
::
add
(
_xlsx_drawing
const
&
d
,
bool
isInternal
,
std
::
wstring
const
&
rid
,
std
::
wstring
const
&
ref
,
RelsType
type
)
std
::
wstring
const
&
ref
,
RelsType
type
,
bool
sheet_rel
)
{
impl_
->
add
(
d
,
isInternal
,
rid
,
ref
,
type
,
sheet_rel
);
}
void
xlsx_drawings
::
add
(
bool
isInternal
,
std
::
wstring
const
&
rid
,
std
::
wstring
const
&
ref
,
RelsType
type
,
bool
sheet_rel
)
{
impl_
->
add
(
d
,
isInternal
,
rid
,
ref
,
type
);
impl_
->
add
(
isInternal
,
rid
,
ref
,
type
,
sheet_rel
);
}
void
xlsx_drawings
::
add
(
bool
isInternal
,
std
::
wstring
const
&
rid
,
std
::
wstring
const
&
ref
,
RelsType
type
)
void
xlsx_drawings
::
serialize
(
std
::
wostream
&
strm
)
{
impl_
->
add
(
isInternal
,
rid
,
ref
,
type
);
impl_
->
serialize
(
strm
);
}
void
xlsx_
serialize
(
std
::
wostream
&
_Wostream
,
xlsx_drawings
const
&
val
)
void
xlsx_
drawings
::
serialize_objects
(
std
::
wostream
&
strm
)
{
val
.
impl_
->
serialize
(
_Wostrea
m
);
impl_
->
serialize_objects
(
str
m
);
}
bool
xlsx_drawings
::
empty
()
const
...
...
@@ -187,9 +197,14 @@ bool xlsx_drawings::empty() const
return
impl_
->
empty
();
}
void
xlsx_drawings
::
dump_rels
(
rels
&
Rels
)
void
xlsx_drawings
::
dump_rels_drawing
(
rels
&
Rels
)
{
return
impl_
->
dump_rels_drawing
(
Rels
);
}
void
xlsx_drawings
::
dump_rels_sheet
(
rels
&
Rels
)
{
return
impl_
->
dump_rels
(
Rels
);
return
impl_
->
dump_rels_sheet
(
Rels
);
}
xlsx_drawings_ptr
xlsx_drawings
::
create
(
bool
inGroup
)
...
...
ASCOfficeOdfFile/src/docx/xlsx_drawings.h
View file @
d95c93ab
...
...
@@ -55,7 +55,7 @@ struct drawing_elm
xlsx_drawings_ptr
drawings
;
};
struct
_xlsx_drawing
;
class
_xlsx_drawing
;
class
xlsx_drawings
{
...
...
@@ -64,14 +64,15 @@ public:
~
xlsx_drawings
();
static
xlsx_drawings_ptr
create
(
bool
inGroup
);
public:
void
add
(
_xlsx_drawing
const
&
d
,
bool
isInternal
,
std
::
wstring
const
&
rid
,
std
::
wstring
const
&
ref
,
RelsType
type
);
void
add
(
bool
isInternal
,
std
::
wstring
const
&
rid
,
std
::
wstring
const
&
ref
,
RelsType
type
);
void
add
(
_xlsx_drawing
const
&
d
,
bool
isInternal
,
std
::
wstring
const
&
rid
,
std
::
wstring
const
&
ref
,
RelsType
type
,
bool
sheet_rel
=
false
);
void
add
(
bool
isInternal
,
std
::
wstring
const
&
rid
,
std
::
wstring
const
&
ref
,
RelsType
type
,
bool
sheet_rel
=
false
);
bool
empty
()
const
;
void
dump_rels
(
rels
&
Rels
);
bool
empty
()
const
;
void
dump_rels_sheet
(
rels
&
Rels
);
void
dump_rels_drawing
(
rels
&
Rels
);
friend
void
xlsx_serialize
(
std
::
wostream
&
_Wostream
,
xlsx_drawings
const
&
val
);
void
serialize
(
std
::
wostream
&
_Wostream
);
void
serialize_objects
(
std
::
wostream
&
_Wostream
);
private:
class
Impl
;
_CP_SCOPED_PTR
(
Impl
)
impl_
;
...
...
ASCOfficeOdfFile/src/docx/xlsx_output_xml.cpp
View file @
d95c93ab
...
...
@@ -54,8 +54,10 @@ public:
std
::
wstringstream
sort_
;
std
::
wstringstream
autofilter_
;
std
::
wstringstream
conditionalFormatting_
;
std
::
wstringstream
ole_objects_
;
rels
hyperlinks_rels_
;
rels
ole_objects_rels_
;
std
::
wstring
drawingName_
;
std
::
wstring
drawingId_
;
...
...
@@ -128,20 +130,31 @@ std::wostream & xlsx_xml_worksheet::hyperlinks()
{
return
impl_
->
hyperlinks_
;
}
std
::
wostream
&
xlsx_xml_worksheet
::
ole_objects
()
{
return
impl_
->
ole_objects_
;
}
//---------------------------------------------------------------------------------------
rels
&
xlsx_xml_worksheet
::
hyperlinks_rels
()
{
return
impl_
->
hyperlinks_rels_
;
}
rels
&
xlsx_xml_worksheet
::
ole_objects_rels
()
{
return
impl_
->
ole_objects_rels_
;
}
void
xlsx_xml_worksheet
::
write_to
(
std
::
wostream
&
strm
)
{
CP_XML_WRITER
(
strm
)
{
CP_XML_NODE
(
L"worksheet"
)
{
CP_XML_ATTR
(
L"xmlns"
,
L"http://schemas.openxmlformats.org/spreadsheetml/2006/main"
);
CP_XML_ATTR
(
L"xmlns:r"
,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"
);
CP_XML_ATTR
(
L"xmlns:mc"
,
L"http://schemas.openxmlformats.org/markup-compatibility/2006"
);
CP_XML_ATTR
(
L"mc:Ignorable"
,
L"x14ac"
);
CP_XML_ATTR
(
L"xmlns"
,
L"http://schemas.openxmlformats.org/spreadsheetml/2006/main"
);
CP_XML_ATTR
(
L"xmlns:r"
,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships"
);
CP_XML_ATTR
(
L"xmlns:xdr"
,
L"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
);
CP_XML_ATTR
(
L"xmlns:x14"
,
L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"
);
CP_XML_ATTR
(
L"xmlns:mc"
,
L"http://schemas.openxmlformats.org/markup-compatibility/2006"
);
CP_XML_ATTR
(
L"mc:Ignorable"
,
L"x14ac"
);
CP_XML_ATTR
(
L"xmlns:x14ac"
,
L"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac"
);
CP_XML_STREAM
()
<<
impl_
->
sheetFormat_
.
str
();
...
...
@@ -179,7 +192,13 @@ void xlsx_xml_worksheet::write_to(std::wostream & strm)
CP_XML_ATTR
(
L"r:id"
,
impl_
->
vml_drawingId_
);
}
}
if
(
!
impl_
->
ole_objects_
.
str
().
empty
())
{
CP_XML_NODE
(
L"oleObjects"
)
{
CP_XML_STREAM
()
<<
impl_
->
ole_objects_
.
str
();
}
}
//CP_XML_NODE(L"headerFooter){}
//CP_XML_NODE(L"rowBreaks){}
...
...
@@ -217,43 +236,5 @@ std::pair<std::wstring, std::wstring> xlsx_xml_worksheet::get_vml_drawing_link()
return
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
(
impl_
->
vml_drawingName_
,
impl_
->
vml_drawingId_
);
}
//class xlsx_xml_workbook::Impl: noncopyable
//{
//public:
// std::wstringstream sheets_;
//};
//
//xlsx_xml_workbook::xlsx_xml_workbook() : impl_(new xlsx_xml_workbook::Impl)
//{
//}
//
//xlsx_xml_workbook::~xlsx_xml_workbook()
//{
//}
//
//std::wostream & xlsx_xml_workbook::sheets()
//{
// return impl_->sheets_;
//}
//
//void xlsx_xml_workbook::write_to(std::wostream & strm)
//{
// CP_XML_WRITER(strm)
// {
// CP_XML_NODE(L"workbook")
// {
// CP_XML_ATTR(L"xmlns", L"http://schemas.openxmlformats.org/spreadsheetml/2006/main");
// CP_XML_ATTR(L"xmlns:r", L"http://schemas.openxmlformats.org/officeDocument/2006/relationships");
//
// CP_XML_NODE(L"sheets")
// {
// CP_XML_STREAM() << impl_->sheets_.str();
// }
// }
// }
//}
//
}
}
ASCOfficeOdfFile/src/docx/xlsx_output_xml.h
View file @
d95c93ab
...
...
@@ -62,8 +62,10 @@ public:
std
::
wostream
&
autofilter
();
std
::
wostream
&
conditionalFormatting
();
std
::
wostream
&
sort
();
std
::
wostream
&
ole_objects
();
rels
&
hyperlinks_rels
();
rels
&
ole_objects_rels
();
void
write_to
(
std
::
wostream
&
strm
);
...
...
ASCOfficeOdfFile/src/docx/xlsx_package.cpp
View file @
d95c93ab
...
...
@@ -181,30 +181,30 @@ void xl_files::write(const std::wstring & RootPath)
sharedStrings_
->
write
(
path
);
rels_files_
.
add
(
relationship
(
L"shId1"
,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings"
,
L"sharedStrings.xml"
)
);
}
if
(
styles_
)
{
styles_
->
write
(
path
);
rels_files_
.
add
(
relationship
(
L"stId1"
,
L"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles"
,
L"styles.xml"
)
);
}
if
(
workbook_
)
{
workbook_
->
write
(
path
);
}
if
(
theme_
)
{
theme_
->
write
(
path
);
}
if
(
media_
)
{
media_
->
set_main_document
(
get_main_document
());
media_
->
write
(
path
);
}
if
(
embeddings_
)
{
embeddings_
->
set_main_document
(
get_main_document
());
embeddings_
->
write
(
path
);
}
{
charts_files_
.
set_main_document
(
get_main_document
());
charts_files_
.
write
(
path
);
}
...
...
@@ -243,7 +243,15 @@ void xl_files::add_sheet(sheet_content_ptr sheet)
void
xl_files
::
set_media
(
mediaitems
&
_Mediaitems
,
CApplicationFonts
*
pAppFonts
)
{
media_
=
element_ptr
(
new
media
(
_Mediaitems
,
pAppFonts
)
);
if
(
_Mediaitems
.
count_image
+
_Mediaitems
.
count_media
>
0
)
{
media_
=
element_ptr
(
new
media
(
_Mediaitems
,
pAppFonts
)
);
}
if
(
_Mediaitems
.
count_object
>
0
)
{
embeddings_
=
element_ptr
(
new
embeddings
(
_Mediaitems
)
);
}
}
void
xl_files
::
set_comments
(
element_ptr
Element
)
{
...
...
@@ -313,7 +321,7 @@ void xl_drawings::write(const std::wstring & RootPath)
rels_files
relFiles
;
rels_file_ptr
r
=
rels_file
::
create
(
e
.
filename
+
L".rels"
);
e
.
drawings
->
dump_rels
(
r
->
get_rels
());
e
.
drawings
->
dump_rels
_drawing
(
r
->
get_rels
());
relFiles
.
add_rel_file
(
r
);
relFiles
.
write
(
path
);
...
...
ASCOfficeOdfFile/src/docx/xlsx_package.h
View file @
d95c93ab
...
...
@@ -169,18 +169,20 @@ public:
void
add_charts
(
chart_content_ptr
chart
);
private:
rels_files
rels_files_
;
sheets_files
sheets_files_
;
rels_files
rels_files_
;
sheets_files
sheets_files_
;
xl_charts_files
charts_files_
;
element_ptr
theme_
;
element_ptr
workbook_
;
element_ptr
theme_
;
element_ptr
workbook_
;
element_ptr
styles_
;
element_ptr
sharedStrings_
;
element_ptr
media_
;
element_ptr
drawings_
;
element_ptr
vml_drawings_
;
element_ptr
comments_
;
element_ptr
styles_
;
element_ptr
sharedStrings_
;
element_ptr
media_
;
element_ptr
embeddings_
;
element_ptr
drawings_
;
element_ptr
vml_drawings_
;
element_ptr
comments_
;
};
...
...
@@ -191,7 +193,7 @@ public:
xlsx_document
();
public:
virtual
void
write
(
const
std
::
wstring
&
RootPath
);
virtual
void
write
(
const
std
::
wstring
&
RootPath
);
virtual
content_types_file
&
get_content_types_file
()
{
return
content_type_file_
;
}
xl_files
&
get_xl_files
()
{
return
xl_files_
;
}
...
...
ASCOfficeOdfFile/src/docx/xlsx_table_state.cpp
View file @
d95c93ab
...
...
@@ -403,7 +403,10 @@ void xlsx_table_state::serialize_merge_cells(std::wostream & _Wostream)
{
return
xlsx_merge_cells_
.
xlsx_serialize
(
_Wostream
);
}
void
xlsx_table_state
::
serialize_ole_objects
(
std
::
wostream
&
_Wostream
)
{
return
xlsx_drawing_context_
.
get_drawings
()
->
serialize_objects
(
_Wostream
);
}
void
xlsx_table_state
::
serialize_hyperlinks
(
std
::
wostream
&
_Wostream
)
{
return
xlsx_hyperlinks_
.
xlsx_serialize
(
_Wostream
);
...
...
@@ -416,6 +419,10 @@ void xlsx_table_state::dump_rels_hyperlinks(rels & Rels)
{
return
xlsx_hyperlinks_
.
dump_rels
(
Rels
);
}
void
xlsx_table_state
::
dump_rels_ole_objects
(
rels
&
Rels
)
{
return
get_drawing_context
().
get_drawings
()
->
dump_rels_sheet
(
Rels
);
}
void
xlsx_table_state
::
start_hyperlink
()
{
...
...
ASCOfficeOdfFile/src/docx/xlsx_table_state.h
View file @
d95c93ab
...
...
@@ -127,7 +127,10 @@ public:
void
serialize_table_format
(
std
::
wostream
&
_Wostream
);
void
serialize_merge_cells
(
std
::
wostream
&
_Wostream
);
void
serialize_hyperlinks
(
std
::
wostream
&
_Wostream
);
void
dump_rels_hyperlinks
(
rels
&
Rels
);
void
serialize_ole_objects
(
std
::
wostream
&
_Wostream
);
void
dump_rels_hyperlinks
(
rels
&
Rels
);
void
dump_rels_ole_objects
(
rels
&
Rels
);
std
::
wstring
get_table_name
()
const
{
return
tableName_
;
}
int
get_table_id
()
const
{
return
tableId_
;
}
...
...
ASCOfficeOdfFile/src/docx/xlsx_tablecontext.cpp
View file @
d95c93ab
...
...
@@ -320,10 +320,18 @@ void xlsx_table_context::serialize_hyperlinks(std::wostream & _Wostream)
{
return
state
()
->
serialize_hyperlinks
(
_Wostream
);
}
void
xlsx_table_context
::
serialize_ole_objects
(
std
::
wostream
&
_Wostream
)
{
return
state
()
->
serialize_ole_objects
(
_Wostream
);
}
void
xlsx_table_context
::
dump_rels_hyperlinks
(
rels
&
Rels
)
{
return
state
()
->
dump_rels_hyperlinks
(
Rels
);
}
void
xlsx_table_context
::
dump_rels_ole_objects
(
rels
&
Rels
)
{
return
state
()
->
dump_rels_ole_objects
(
Rels
);
}
xlsx_table_metrics
&
xlsx_table_context
::
get_table_metrics
()
{
...
...
ASCOfficeOdfFile/src/docx/xlsx_tablecontext.h
View file @
d95c93ab
...
...
@@ -88,6 +88,8 @@ public:
void
serialize_merge_cells
(
std
::
wostream
&
_Wostream
);
void
serialize_table_format
(
std
::
wostream
&
_Wostream
);
void
serialize_conditionalFormatting
(
std
::
wostream
&
_Wostream
);
void
serialize_hyperlinks
(
std
::
wostream
&
_Wostream
);
void
serialize_ole_objects
(
std
::
wostream
&
_Wostream
);
xlsx_table_metrics
&
get_table_metrics
();
...
...
@@ -103,10 +105,9 @@ public:
void
start_hyperlink
();
std
::
wstring
end_hyperlink
(
std
::
wstring
const
&
ref
,
std
::
wstring
const
&
href
,
std
::
wstring
const
&
display
);
void
dump_rels_hyperlinks
(
rels
&
Rels
);
void
serialize_hyperlinks
(
std
::
wostream
&
_Wostream
);
void
dump_rels_hyperlinks
(
rels
&
Rels
);
void
dump_rels_ole_objects
(
rels
&
Rels
);
void
start_database_range
(
std
::
wstring
table_name
,
std
::
wstring
ref
);
void
set_database_orientation
(
bool
val
);
void
set_database_header
(
bool
val
);
...
...
ASCOfficeOdfFile/src/docx/xlsxconversioncontext.cpp
View file @
d95c93ab
...
...
@@ -132,12 +132,11 @@ void xlsx_conversion_context::end_document()
{
std
::
wstringstream
workbook_content
;
unsigned
int
count
=
0
;
// добавляем таблицы
BOOST_FOREACH
(
const
xlsx_xml_worksheet_ptr
&
sheet
,
sheets_
)
for
(
int
i
=
0
;
i
<
sheets_
.
size
();
i
++
)
{
count
++
;
const
std
::
wstring
id
=
std
::
wstring
(
L"sId"
)
+
boost
::
lexical_cast
<
std
::
wstring
>
(
count
);
xlsx_xml_worksheet_ptr
&
sheet
=
sheets_
[
i
];
const
std
::
wstring
id
=
std
::
wstring
(
L"sId"
)
+
std
::
to_wstring
(
i
+
1
);
package
::
sheet_content_ptr
content
=
package
::
sheet_content
::
create
();
////////////////////////////////////////////////////////////////////////////////////////////
...
...
@@ -152,6 +151,7 @@ void xlsx_conversion_context::end_document()
}
//////////////////////////////////////////////////////////////////////////////////////////////////
content
->
add_rels
(
sheet
->
hyperlinks_rels
());
content
->
add_rels
(
sheet
->
ole_objects_rels
());
/////////////////////////////////////////////////////////////////////////////////////////////////
const
std
::
pair
<
std
::
wstring
,
std
::
wstring
>
p2
=
sheet
->
get_comments_link
();
if
(
!
p2
.
first
.
empty
())
...
...
@@ -179,24 +179,22 @@ void xlsx_conversion_context::end_document()
{
CP_XML_NODE
(
L"sheet"
)
{
CP_XML_ATTR
(
L"name"
,
sheet
->
name
());
// office 2010 ! ограничение на длину имени !!!
CP_XML_ATTR
(
L"sheetId"
,
count
);
CP_XML_ATTR
(
L"state"
,
L"visible"
);
CP_XML_ATTR
(
L"r:id"
,
id
);
CP_XML_ATTR
(
L"name"
,
sheet
->
name
());
// office 2010 ! ограничение на длину имени !!!
CP_XML_ATTR
(
L"sheetId"
,
i
+
1
);
CP_XML_ATTR
(
L"state"
,
L"visible"
);
CP_XML_ATTR
(
L"r:id"
,
id
);
}
}
}
//добавляем диаграммы
count
=
0
;
BOOST_FOREACH
(
const
oox_chart_context_ptr
&
chart
,
charts_
)
for
(
int
i
=
0
;
i
<
charts_
.
size
();
i
++
)
{
count
++
;
package
::
chart_content_ptr
content
=
package
::
chart_content
::
create
();
chart
->
serialize
(
content
->
content
());
chart
->
dump_rels
(
content
->
get_rel_file
()
->
get_rels
());
chart
s_
[
i
]
->
serialize
(
content
->
content
());
chart
s_
[
i
]
->
dump_rels
(
content
->
get_rel_file
()
->
get_rels
());
output_document_
->
get_xl_files
().
add_charts
(
content
);
}
...
...
@@ -322,12 +320,16 @@ void xlsx_conversion_context::end_table()
get_table_context
().
serialize_autofilter
(
current_sheet
().
autofilter
());
get_table_context
().
serialize_sort
(
current_sheet
().
sort
());
get_table_context
().
serialize_merge_cells
(
current_sheet
().
mergeCells
());
get_table_context
().
serialize_hyperlinks
(
current_sheet
().
hyperlinks
());
get_drawing_context
().
set_odf_packet_path
(
root
()
->
get_folder
());
get_drawing_context
().
process_objects
(
get_table_metrics
());
get_table_context
().
serialize_hyperlinks
(
current_sheet
().
hyperlinks
());
get_table_context
().
serialize_ole_objects
(
current_sheet
().
ole_objects
());
get_table_context
().
dump_rels_hyperlinks
(
current_sheet
().
hyperlinks_rels
());
get_table_context
().
dump_rels_ole_objects
(
current_sheet
().
ole_objects_rels
());
get_drawing_context
().
set_odf_packet_path
(
root
()
->
get_folder
());
get_drawing_context
().
process_objects
(
get_table_metrics
());
if
(
!
get_drawing_context
().
empty
())
{
...
...
ASCOfficeOdfFile/src/odf/datatypes/common_attlists.h
View file @
d95c93ab
This diff is collapsed.
Click to expand it.
ASCOfficeOdfFile/src/odf/draw_frame.cpp
View file @
d95c93ab
...
...
@@ -85,11 +85,6 @@ void draw_chart_attlist::add_attributes( const xml::attributes_wc_ptr & Attribut
const
wchar_t
*
draw_image
::
ns
=
L"draw"
;
const
wchar_t
*
draw_image
::
name
=
L"image"
;
std
::
wostream
&
draw_image
::
text_to_stream
(
std
::
wostream
&
_Wostream
)
const
{
return
_Wostream
;
}
void
draw_image
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
draw_image_attlist_
.
add_attributes
(
Attributes
);
...
...
ASCOfficeOdfFile/src/odf/draw_frame.h
View file @
d95c93ab
...
...
@@ -40,8 +40,6 @@
#include "office_elements_create.h"
#include "datatypes/common_attlists.h"
//#include "../docx/xlsxconversioncontext.h"
namespace
cpdoccore
{
namespace
oox
{
...
...
@@ -75,22 +73,18 @@ public:
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
);
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
);
public:
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
);
private:
draw_image_attlist
draw_image_attlist_
;
odf_types
::
common_xlink_attlist
common_xlink_attlist_
;
office_element_ptr
office_binary_data_
;
office_element_ptr_array
content_
;
friend
class
odf_document
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
draw_image
);
//////////////////////////////////////////////////////////////////////////////////////////////////////////
//draw-chart-attlist
class
draw_chart_attlist
...
...
@@ -98,12 +92,10 @@ class draw_chart_attlist
public:
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
public:
//_CP_OPT(std::wstring) draw_filter_name_;
};
//объект рисования не нужен .. нужно только место для фрэйма - сам чарт в другом месте
class
draw_chart
:
public
office_element_impl
<
draw_chart
>
{
public:
...
...
@@ -113,7 +105,7 @@ public:
static
const
ElementType
type
=
typeDrawChart
;
CPDOCCORE_DEFINE_VISITABLE
();
//virtual void docx_convert(oox::docx_conversion_context & Context);
virtual
void
docx_convert
(
oox
::
docx_conversion_context
&
Context
){}
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
);
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
);
...
...
@@ -124,18 +116,19 @@ private:
virtual
void
add_child_element
(
xml
::
sax
*
Reader
,
const
std
::
wstring
&
Ns
,
const
std
::
wstring
&
Name
);
private:
draw_chart_attlist
draw_chart_attlist_
;
draw_chart_attlist
draw_chart_attlist_
;
odf_types
::
common_xlink_attlist
common_xlink_attlist_
;
office_element_ptr_array
content_
;
//office_element_ptr title_;
office_element_ptr_array
content_
;
//office_element_ptr title_;
friend
class
odf_document
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
draw_chart
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////
//draw-frame-attlist
//draw-frame-attlist
class
draw_frame_attlist
{
public:
...
...
@@ -178,7 +171,7 @@ public:
office_element_ptr_array
content_
;
office_element_ptr
office_event_listeners_
;
// в content перенести нельзя - иначе событи будет добавляться не к этому объекту а следующему
// в content перенести нельзя - иначе событи будет добавляться не к этому объекту а следующему
office_element_ptr
draw_glue_point_
;
office_element_ptr
draw_image_map_
;
//office_element_ptr draw_chart_map_;
...
...
@@ -198,9 +191,9 @@ private:
};
CP_REGISTER_OFFICE_ELEMENT2
(
draw_frame
);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//
/////////////////////////////////////////////////////////////////////////////////////////////////////////////
//draw-frame-attlist
//
-------------------------------------------------------------------------------------------------------------
//draw-frame-attlist
class
draw_g_attlist
{
public:
...
...
@@ -222,19 +215,19 @@ public:
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
);
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
);
public:
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:
odf_types
::
union_common_draw_attlists
common_draw_attlists_
;
draw_g_attlist
draw_g_attlist_
;
office_element_ptr_array
content_
;
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
);
};
CP_REGISTER_OFFICE_ELEMENT2
(
draw_g
);
//-------------------------------------------------------------------------------------------------------------
// draw-text-box-attlist
class
draw_text_box_attlist
{
...
...
@@ -250,7 +243,6 @@ public:
};
class
draw_text_box
:
public
office_element_impl
<
draw_text_box
>
{
public:
...
...
@@ -264,20 +256,20 @@ public:
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
);
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
);
public:
virtual
std
::
wostream
&
text_to_stream
(
std
::
wostream
&
_Wostream
)
const
;
draw_text_box_attlist
draw_text_box_attlist_
;
office_element_ptr_array
content_
;
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
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
);
public:
draw_text_box_attlist
draw_text_box_attlist_
;
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
draw_text_box
);
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//-------------------------------------------------------------------------------------------------------------
/// draw-object-attlist
class
draw_object_attlist
{
...
...
@@ -304,13 +296,12 @@ public:
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
);
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
);
draw_object_attlist
draw_object_attlist_
;
odf_types
::
common_xlink_attlist
common_xlink_attlist_
;
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:
draw_object_attlist
draw_object_attlist_
;
odf_types
::
common_xlink_attlist
common_xlink_attlist_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
draw_object
);
...
...
@@ -329,13 +320,14 @@ public:
virtual
void
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
);
virtual
void
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
);
odf_types
::
common_xlink_attlist
common_xlink_attlist_
;
_CP_OPT
(
std
::
wstring
)
draw_class_id_
;
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:
odf_types
::
common_xlink_attlist
common_xlink_attlist_
;
_CP_OPT
(
std
::
wstring
)
draw_class_id_
;
std
::
wstring
detectObject
(
const
std
::
wstring
&
fileName
);
};
CP_REGISTER_OFFICE_ELEMENT2
(
draw_object_ole
);
...
...
ASCOfficeOdfFile/src/odf/draw_frame_docx.cpp
View file @
d95c93ab
...
...
@@ -58,6 +58,7 @@
#include "datatypes/borderstyle.h"
#include "../../../OfficeUtils/src/OfficeUtils.h"
#include "../../../Common/3dParty/pole/pole.h"
namespace
cpdoccore
{
...
...
@@ -1429,24 +1430,17 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
{
std
::
wstring
href
=
common_xlink_attlist_
.
href_
.
get_value_or
(
L""
);
odf_reader
::
odf_document
*
odf_reader
=
Context
.
root
();
std
::
wstring
folderPath
=
odf_reader
->
get_folder
();
std
::
wstring
objectPath
=
folderPath
+
FILE_SEPARATOR_STR
+
href
;
std
::
wstring
folderPath
=
Context
.
root
()
->
get_folder
();
std
::
wstring
objectPath
=
folderPath
+
FILE_SEPARATOR_STR
+
href
;
//normalize path ??? todooo
boost
::
algorithm
::
replace_all
(
objectPath
,
FILE_SEPARATOR_STR
+
std
::
wstring
(
L"./"
),
FILE_SEPARATOR_STR
);
cpdoccore
::
odf_reader
::
odf_document
objectSubDoc
(
objectPath
,
NULL
);
////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
//функциональная часть
office_element
*
contentSubDoc
=
objectSubDoc
.
get_impl
()
->
get_content
();
draw_frame
*
frame
=
NULL
;
oox
::
_docx_drawing
*
drawing
=
NULL
;
//if (!contentSubDoc)//Diagramma.odt - кривые ссылки на объекты
// return;
office_element
*
contentSubDoc
=
objectSubDoc
.
get_impl
()
->
get_content
();
object_odf_context
objectBuild
(
href
);
if
(
contentSubDoc
)
...
...
@@ -1456,9 +1450,9 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
objectBuild
.
docx_convert
(
Context
);
frame
=
Context
.
get_drawing_context
().
get_current_frame
();
//owner
drawing
=
dynamic_cast
<
oox
::
_docx_drawing
*>
(
frame
->
oox_drawing_
.
get
());
frame
=
Context
.
get_drawing_context
().
get_current_frame
();
//owner
if
(
frame
)
drawing
=
dynamic_cast
<
oox
::
_docx_drawing
*>
(
frame
->
oox_drawing_
.
get
());
}
//------------------------------------------------------------------------------------------------------------
...
...
@@ -1474,10 +1468,12 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
bool
isMediaInternal
=
true
;
drawing
->
objectId
=
Context
.
add_mediaitem
(
href
,
drawing
->
type
,
isMediaInternal
,
href
);
}
else
if
(
objectBuild
.
object_type_
==
2
)
//embedded text
{
//text in text not support
}
else
if
(
objectBuild
.
object_type_
==
3
)
//мат формулы
{
//skip replacement image !!!
const
std
::
wstring
&
content
=
Context
.
get_drawing_context
().
get_text_stream_frame
();
bool
in_frame
=
!
drawing
->
isInline
;
...
...
@@ -1497,7 +1493,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
}
else
{
//in text
drawing
->
type
=
oox
::
typeUnknown
;
drawing
->
type
=
oox
::
typeUnknown
;
//not drawing
if
(
runState
)
Context
.
finish_run
();
//if (pState == false)
...
...
@@ -1528,7 +1524,7 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
if
(
objectSubDoc
.
xlsx_convert
(
conversionXlsxContext
))
{
drawing
->
type
=
oox
::
typeObject
;
drawing
->
type
=
oox
::
type
Ms
Object
;
std
::
wstring
objectXlsxPath
=
FileSystem
::
Directory
::
CreateDirectoryWithUniqueName
(
folderPath
);
outputXlsx
.
write
(
objectXlsxPath
);
...
...
@@ -1568,12 +1564,14 @@ void draw_object::docx_convert(oox::docx_conversion_context & Context)
void
draw_object_ole
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
//временно - замещающая картинка(если она конечно присутствует)
bool
&
use_image_replace
=
Context
.
get_drawing_context
().
get_use_image_replace
();
use_image_replace
=
true
;
std
::
wstring
href
=
common_xlink_attlist_
.
href_
.
get_value_or
(
L""
);
//------------------------------------------------
std
::
wstring
href
=
common_xlink_attlist_
.
href_
.
get_value_or
(
L""
);
std
::
wstring
folderPath
=
Context
.
root
()
->
get_folder
();
std
::
wstring
objectPath
=
folderPath
+
FILE_SEPARATOR_STR
+
href
;
if
(
href
.
empty
())
return
;
draw_frame
*
frame
=
Context
.
get_drawing_context
().
get_current_frame
();
//owner
...
...
@@ -1582,11 +1580,58 @@ void draw_object_ole::docx_convert(oox::docx_conversion_context & Context)
oox
::
_docx_drawing
*
drawing
=
dynamic_cast
<
oox
::
_docx_drawing
*>
(
frame
->
oox_drawing_
.
get
());
if
(
!
drawing
)
return
;
drawing
->
type
=
oox
::
typeObject
;
drawing
->
type
=
oox
::
typeO
leO
bject
;
bool
isMediaInternal
=
true
;
drawing
->
objectId
=
Context
.
add_mediaitem
(
href
,
drawing
->
type
,
isMediaInternal
,
href
);
drawing
->
objectProgId
=
L""
;
//detect ???
drawing
->
objectProgId
=
detectObject
(
objectPath
);
}
std
::
wstring
draw_object_ole
::
detectObject
(
const
std
::
wstring
&
fileName
)
{
POLE
::
Storage
*
storage
=
new
POLE
::
Storage
(
fileName
.
c_str
());
if
(
storage
==
NULL
)
return
L""
;
if
(
storage
->
open
(
false
,
false
)
==
false
)
{
delete
storage
;
return
L""
;
}
std
::
wstring
prog
;
POLE
::
Stream
*
pStream
=
new
POLE
::
Stream
(
storage
,
"CompObj"
);
if
((
pStream
)
&&
(
pStream
->
size
()
>
28
))
{
//skip the CompObjHeader
pStream
->
seek
(
28
);
int
sz_obj
=
pStream
->
size
()
-
28
;
std
::
vector
<
std
::
string
>
str
;
while
(
sz_obj
>
0
)
{
_UINT32
sz
=
0
;
pStream
->
read
((
unsigned
char
*
)
&
sz
,
4
);
sz_obj
-=
4
;
if
(
sz
>
sz_obj
)
break
;
unsigned
char
*
data
=
new
unsigned
char
[
sz
];
pStream
->
read
(
data
,
sz
);
str
.
push_back
(
std
::
string
((
char
*
)
data
,
sz
));
delete
[]
data
;
sz_obj
-=
sz
;
}
if
(
!
str
.
empty
())
{
prog
=
std
::
wstring
(
str
.
back
().
begin
(),
str
.
back
().
end
());
}
delete
pStream
;
}
delete
storage
;
return
prog
;
}
}
...
...
ASCOfficeOdfFile/src/odf/draw_frame_pptx.cpp
View file @
d95c93ab
...
...
@@ -86,6 +86,8 @@ void draw_frame::pptx_convert_placeHolder(oox::pptx_conversion_context & Context
}
void
draw_frame
::
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
{
Context
.
get_slide_context
().
start_frame
();
common_draw_shape_with_styles_attlist
common_draw_attlist_
=
common_draw_attlists_
.
shape_with_text_and_styles_
.
common_draw_shape_with_styles_attlist_
;
const
int
z_index
=
common_draw_attlist_
.
common_draw_z_index_attlist_
.
draw_z_index_
.
get_value_or
(
0
);
...
...
@@ -206,13 +208,15 @@ void draw_frame::pptx_convert(oox::pptx_conversion_context & Context)
}
Context
.
get_text_context
().
end_base_style
();
Context
.
get_slide_context
().
end_frame
();
}
void
draw_image
::
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
{
const
std
::
wstring
href
=
common_xlink_attlist_
.
href_
.
get_value_or
(
L""
);
Context
.
get_slide_context
().
s
tar
t_image
(
href
);
Context
.
get_slide_context
().
s
e
t_image
(
href
);
////////////////////////////////////в принципе достаточно общая часть ...
Context
.
get_text_context
().
start_object
();
...
...
@@ -224,25 +228,23 @@ void draw_image::pptx_convert(oox::pptx_conversion_context & Context)
if
(
text_content_
.
length
()
>
0
)
{
Context
.
get_slide_context
().
set_property
(
_property
(
L"text-content"
,
text_content_
));
Context
.
get_slide_context
().
set_property
(
_property
(
L"text-content"
,
text_content_
));
}
////////////////////////////////////////////////////////////////////////////3 раза уже повторилась Content -> Context
Context
.
get_slide_context
().
end_image
();
}
void
draw_chart
::
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
{
const
std
::
wstring
href
=
common_xlink_attlist_
.
href_
.
get_value_or
(
L""
);
Context
.
get_slide_context
().
star
t_chart
(
href
);
Context
.
get_slide_context
().
se
t_chart
(
href
);
for
(
int
i
=
0
;
i
<
content_
.
size
();
i
++
)
{
content_
[
i
]
->
pptx_convert
(
Context
);
}
Context
.
get_slide_context
().
end_chart
();
}
void
draw_text_box
::
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
{
Context
.
get_slide_context
().
s
tart_shape
(
2
);
//rect с наваротами
Context
.
get_slide_context
().
s
et_text_box
();
//rect с наваротами
Context
.
get_text_context
().
start_object
();
for
(
int
i
=
0
;
i
<
content_
.
size
();
i
++
)
...
...
@@ -256,7 +258,6 @@ void draw_text_box::pptx_convert(oox::pptx_conversion_context & Context)
{
Context
.
get_slide_context
().
set_property
(
_property
(
L"text-content"
,
text_content_
));
}
Context
.
get_slide_context
().
end_shape
();
}
void
draw_object
::
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
{
...
...
@@ -282,11 +283,8 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
{
//здесь другой формат xml (не Open Office)
//временно - замещающая картинка(если она конечно присутствует)
Context
.
get_slide_context
().
start_object_ole
();
return
;
}
object_odf_context
objectBuild
(
href
);
process_build_object
process_build_object_
(
objectBuild
,
objectSubDoc
.
odf_context
());
...
...
@@ -300,12 +298,11 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
const
std
::
wstring
href_draw
=
common_xlink_attlist_
.
href_
.
get_value_or
(
L""
);
objectBuild
.
pptx_convert
(
Context
);
Context
.
get_slide_context
().
start_chart
(
href_draw
);
// в рисовательной части только место объекта, рамочки ... и релсы
Context
.
get_slide_context
().
end_chart
();
Context
.
get_slide_context
().
set_chart
(
href_draw
);
// в рисовательной части только место объекта, рамочки ... и релсы
}
else
if
(
objectBuild
.
object_type_
==
2
)
//odt текст
{
Context
.
get_slide_context
().
s
tart_shape
(
2
);
Context
.
get_slide_context
().
s
et_text_box
(
);
Context
.
get_text_context
().
start_object
();
//сменить контекст с главного на другой ... проблема со стилями!!
...
...
@@ -320,11 +317,10 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
{
Context
.
get_slide_context
().
set_property
(
_property
(
L"text-content"
,
text_content_
));
}
Context
.
get_slide_context
().
end_shape
();
}
else
if
(
objectBuild
.
object_type_
==
3
)
//мат формулы
{
Context
.
get_slide_context
().
s
tart_shape
(
2
);
Context
.
get_slide_context
().
s
et_text_box
(
);
objectBuild
.
pptx_convert
(
Context
);
...
...
@@ -342,11 +338,10 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
Context
.
get_slide_context
().
set_property
(
_property
(
L"fit-to-size"
,
true
));
Context
.
get_slide_context
().
set_property
(
_property
(
L"text-content"
,
text_content
));
}
Context
.
get_slide_context
().
end_shape
();
}
else
{
//
временно -
замещающая картинка(если она конечно присутствует)
//замещающая картинка(если она конечно присутствует)
Context
.
get_slide_context
().
set_use_image_replacement
();
}
...
...
@@ -359,14 +354,14 @@ void draw_object::pptx_convert(oox::pptx_conversion_context & Context)
void
draw_object_ole
::
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
{
//объект бин в embeddings
//Context.get_slide_context().start_object_ole();
//распознать тип по guid???
//временно - замещающая картинка(если она конечно присутствует)
Context
.
get_slide_context
().
set_use_image_replacement
();
Context
.
get_slide_context
().
set_use_image_replacement
();
std
::
wstring
href
=
common_xlink_attlist_
.
href_
.
get_value_or
(
L""
);
std
::
wstring
folderPath
=
Context
.
root
()
->
get_folder
();
std
::
wstring
objectPath
=
folderPath
+
FILE_SEPARATOR_STR
+
href
;
//Context.get_slide_context().end_object_ole();
if
(
!
href
.
empty
())
Context
.
get_slide_context
().
set_ole_object
(
href
,
detectObject
(
objectPath
));
}
}
...
...
ASCOfficeOdfFile/src/odf/draw_frame_xlsx.cpp
View file @
d95c93ab
...
...
@@ -128,6 +128,7 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
//////////////////////////////////////////////////////////////////////////
Context
.
get_drawing_context
().
start_drawing
(
name
);
Context
.
get_drawing_context
().
start_frame
();
const
_CP_OPT
(
length
)
svg_widthVal
=
common_draw_attlists_
.
rel_size_
.
common_draw_size_attlist_
.
svg_width_
;
const
_CP_OPT
(
length
)
svg_heightVal
=
common_draw_attlists_
.
rel_size_
.
common_draw_size_attlist_
.
svg_height_
;
...
...
@@ -199,6 +200,7 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
office_element_ptr
const
&
elm
=
content_
[
i
];
elm
->
xlsx_convert
(
Context
);
}
Context
.
get_drawing_context
().
end_frame
();
Context
.
get_drawing_context
().
end_drawing
();
Context
.
get_drawing_context
().
clear
();
...
...
@@ -207,7 +209,8 @@ void draw_frame::xlsx_convert(oox::xlsx_conversion_context & Context)
void
draw_image
::
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
{
const
std
::
wstring
href
=
common_xlink_attlist_
.
href_
.
get_value_or
(
L""
);
Context
.
get_drawing_context
().
start_image
(
href
);
Context
.
get_drawing_context
().
set_image
(
href
);
////////////////////////////////////в принципе достаточно общая часть ...
Context
.
get_text_context
().
start_drawing_content
();
//... если в объекте есть текст он привяжется к объекту - иначе к ячейке
...
...
@@ -219,25 +222,24 @@ void draw_image::xlsx_convert(oox::xlsx_conversion_context & Context)
if
(
text_content_
.
length
()
>
0
)
{
Context
.
get_drawing_context
().
set_property
(
_property
(
L"text-content"
,
text_content_
));
Context
.
get_drawing_context
().
set_property
(
_property
(
L"text-content"
,
text_content_
));
}
////////////////////////////////////////////////////////////////////////////3 раза уже повторилась Content -> Context
Context
.
get_drawing_context
().
end_image
();
}
void
draw_chart
::
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
{
const
std
::
wstring
href
=
common_xlink_attlist_
.
href_
.
get_value_or
(
L""
);
Context
.
get_drawing_context
().
s
tar
t_chart
(
href
);
Context
.
get_drawing_context
().
s
e
t_chart
(
href
);
for
(
int
i
=
0
;
i
<
content_
.
size
();
i
++
)
{
content_
[
i
]
->
xlsx_convert
(
Context
);
}
Context
.
get_drawing_context
().
end_chart
();
}
void
draw_text_box
::
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
{
Context
.
get_drawing_context
().
start_shape
(
2
);
//rect с наваротами
Context
.
get_drawing_context
().
set_text_box
();
Context
.
get_text_context
().
start_drawing_content
();
for
(
int
i
=
0
;
i
<
content_
.
size
();
i
++
)
...
...
@@ -251,7 +253,6 @@ void draw_text_box::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context
.
get_drawing_context
().
set_property
(
_property
(
L"text-content"
,
text_content_
));
}
Context
.
get_drawing_context
().
end_shape
();
}
void
draw_object
::
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
{
...
...
@@ -287,12 +288,11 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
const
std
::
wstring
href_draw
=
common_xlink_attlist_
.
href_
.
get_value_or
(
L""
);
objectBuild
.
xlsx_convert
(
Context
);
Context
.
get_drawing_context
().
start_chart
(
href_draw
);
// в рисовательной части только место объекта, рамочки ... и релсы
Context
.
get_drawing_context
().
end_chart
();
Context
.
get_drawing_context
().
set_chart
(
href_draw
);
// в рисовательной части только место объекта, рамочки ... и релсы
}
else
if
(
objectBuild
.
object_type_
==
2
)
//текст (odt text)
{
Context
.
get_drawing_context
().
s
tart_shape
(
2
);
Context
.
get_drawing_context
().
s
et_text_box
(
);
Context
.
get_text_context
().
start_drawing_content
();
//сменить контекст с главного на другой ... проблема со стилями!!
...
...
@@ -307,11 +307,10 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
{
Context
.
get_drawing_context
().
set_property
(
_property
(
L"text-content"
,
text_content
));
}
Context
.
get_drawing_context
().
end_shape
();
}
else
if
(
objectBuild
.
object_type_
==
3
)
//мат формулы
{
Context
.
get_drawing_context
().
s
tart_shape
(
2
);
Context
.
get_drawing_context
().
s
et_text_box
(
);
objectBuild
.
xlsx_convert
(
Context
);
...
...
@@ -329,11 +328,15 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
Context
.
get_drawing_context
().
set_property
(
_property
(
L"fit-to-size"
,
true
));
Context
.
get_drawing_context
().
set_property
(
_property
(
L"text-content"
,
text_content
));
}
Context
.
get_drawing_context
().
end_shape
();
}
else
if
(
objectBuild
.
object_type_
==
4
)
// embedded sheet
{
Context
.
get_drawing_context
().
set_use_image_replacement
();
//???
}
else
{
//
временно -
замещающая картинка(если она конечно присутствует)
//замещающая картинка(если она конечно присутствует)
Context
.
get_drawing_context
().
set_use_image_replacement
();
}
...
...
@@ -343,15 +346,20 @@ void draw_object::xlsx_convert(oox::xlsx_conversion_context & Context)
_CP_LOG
<<
"[error] : convert draw::object error"
<<
std
::
endl
;
}
}
void
draw_object_ole
::
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
{
//временно - замещающая картинка(если она конечно присутствует)
//Context.get_drawing_context().start_object_ole();
void
draw_object_ole
::
xlsx_convert
(
oox
::
xlsx_conversion_context
&
Context
)
{
Context
.
get_drawing_context
().
set_use_image_replacement
();
//Context.get_drawing_context().end_object_ole();
std
::
wstring
href
=
common_xlink_attlist_
.
href_
.
get_value_or
(
L""
);
std
::
wstring
folderPath
=
Context
.
root
()
->
get_folder
();
std
::
wstring
objectPath
=
folderPath
+
FILE_SEPARATOR_STR
+
href
;
if
(
!
href
.
empty
())
Context
.
get_drawing_context
().
set_ole_object
(
href
,
detectObject
(
objectPath
));
}
}
}
ASCOfficeOdfFile/src/odf/office_elements_type.h
View file @
d95c93ab
...
...
@@ -102,7 +102,17 @@ enum ElementType
typeTextUserIndex
,
typeTextAlphabeticalIndex
,
typeTextBibliography
,
typeTextBibliographyMark
,
typeTextTableOfContentSource
,
typeTextIllustrationIndexSource
,
typeTextTableIndexSource
,
typeTextObjectIndexSource
,
typeTextUserIndexSource
,
typeTextAlphabeticalIndexSource
,
typeTextBibliographySource
,
typeTextTrackedChanges
,
typeTextChangedRegion
,
typeTextChangeStart
,
...
...
ASCOfficeOdfFile/src/odf/text_elements.cpp
View file @
d95c93ab
...
...
@@ -1105,6 +1105,121 @@ void text_alphabetical_index::add_child_element( xml::sax * Reader, const std::w
}
// todooo text-alphabetical-index-source
}
// text:bibliography
//////////////////////////////////////////////////////////////////////////////////////////////////
const
wchar_t
*
text_bibliography
::
ns
=
L"text"
;
const
wchar_t
*
text_bibliography
::
name
=
L"bibliography"
;
void
text_bibliography
::
afterCreate
()
{
if
(
document_context
*
context
=
getContext
())
{
if
(
paragraph
*
lastPar
=
context
->
get_last_paragraph
())
{
lastPar
->
set_next_section
(
true
);
}
}
}
void
text_bibliography
::
afterReadContent
()
{
if
(
document_context
*
context
=
getContext
())
{
if
(
paragraph
*
lastPar
=
context
->
get_last_paragraph
())
{
lastPar
->
set_next_end_section
(
true
);
}
}
}
void
text_bibliography
::
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_bibliography
::
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
{
if
(
text_index_body_
)
text_index_body_
->
pptx_convert
(
Context
);
}
std
::
wostream
&
text_bibliography
::
text_to_stream
(
std
::
wostream
&
_Wostream
)
const
{
CP_SERIALIZE_TEXT
(
text_index_body_
);
return
_Wostream
;
}
void
text_bibliography
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
text_section_attr_
.
add_attributes
(
Attributes
);
}
void
text_bibliography
::
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-bibliography-source
}
// text:bibliography
//////////////////////////////////////////////////////////////////////////////////////////////////
const
wchar_t
*
text_bibliography_mark
::
ns
=
L"text"
;
const
wchar_t
*
text_bibliography_mark
::
name
=
L"bibliography-mark"
;
void
text_bibliography_attr
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
CP_APPLY_ATTR
(
L"text:identifier"
,
text_identifier_
,
std
::
wstring
(
L""
));
CP_APPLY_ATTR
(
L"text:bibliography-type"
,
text_bibliography_type_
,
std
::
wstring
(
L""
));
CP_APPLY_ATTR
(
L"text:author"
,
text_author_
);
CP_APPLY_ATTR
(
L"text:url"
,
text_url_
);
CP_APPLY_ATTR
(
L"text:title"
,
text_title_
);
CP_APPLY_ATTR
(
L"text:year"
,
text_year_
);
///
}
void
text_bibliography_mark
::
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
)
{
text_bibliography_attr_
.
add_attributes
(
Attributes
);
}
void
text_bibliography_mark
::
add_child_element
(
xml
::
sax
*
Reader
,
const
std
::
wstring
&
Ns
,
const
std
::
wstring
&
Name
)
{
}
void
text_bibliography_mark
::
add_text
(
const
std
::
wstring
&
Text
)
{
office_element_ptr
elm
=
text
::
create
(
Text
)
;
content_
=
elm
;
}
std
::
wostream
&
text_bibliography_mark
::
text_to_stream
(
std
::
wostream
&
_Wostream
)
const
{
CP_SERIALIZE_TEXT
(
content_
);
return
_Wostream
;
}
void
text_bibliography_mark
::
docx_convert
(
oox
::
docx_conversion_context
&
Context
)
{
if
(
content_
)
content_
->
docx_convert
(
Context
);
}
void
text_bibliography_mark
::
pptx_convert
(
oox
::
pptx_conversion_context
&
Context
)
{
if
(
content_
)
content_
->
pptx_convert
(
Context
);
}
//--------------------------------------------------------------------------------------------------------
// text:tracked-changes
...
...
ASCOfficeOdfFile/src/odf/text_elements.h
View file @
d95c93ab
...
...
@@ -234,7 +234,6 @@ public:
};
//---------------------------------------------------------------------------------------------------
class
text_section
:
public
text_content_impl
<
text_section
>
{
public:
...
...
@@ -410,7 +409,84 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2
(
text_alphabetical_index
);
//------------------------------------------------------------------------------------------------------------
class
text_bibliography
:
public
text_content_impl
<
text_bibliography
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeTextBibliography
;
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_bibliography_source_
;
office_element_ptr
text_index_body_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
text_bibliography
);
//---------------------------------------------------------------------------------------------------
//typeTextTableIndex,
//typeTextObjectIndex,
//typeTextUserIndex,
//---------------------------------------------------------------------------------------------------
//text:bibliography-mark
class
text_bibliography_attr
{
public:
void
add_attributes
(
const
xml
::
attributes_wc_ptr
&
Attributes
);
std
::
wstring
text_identifier_
;
std
::
wstring
text_bibliography_type_
;
// todoooo in datatype
_CP_OPT
(
std
::
wstring
)
text_url_
;
_CP_OPT
(
std
::
wstring
)
text_author_
;
_CP_OPT
(
std
::
wstring
)
text_title_
;
_CP_OPT
(
std
::
wstring
)
text_year_
;
_CP_OPT
(
std
::
wstring
)
text_isbn_
;
_CP_OPT
(
std
::
wstring
)
text_chapter_
;
//todooo to map or list
};
class
text_bibliography_mark
:
public
text_content_impl
<
text_bibliography_mark
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeTextBibliographyMark
;
CPDOCCORE_DEFINE_VISITABLE
();
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
;
text_bibliography_attr
text_bibliography_attr_
;
office_element_ptr
content_
;
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
);
virtual
void
add_text
(
const
std
::
wstring
&
Text
);
};
CP_REGISTER_OFFICE_ELEMENT2
(
text_bibliography_mark
);
//---------------------------------------------------------------------------------------------------
class
text_index_body
:
public
text_content_impl
<
text_index_body
>
{
...
...
@@ -426,13 +502,11 @@ public:
virtual
std
::
wostream
&
text_to_stream
(
std
::
wostream
&
_Wostream
)
const
;
office_element_ptr_array
index_content_main_
;
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:
office_element_ptr_array
index_content_main_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
text_index_body
);
...
...
@@ -461,6 +535,9 @@ public:
};
CP_REGISTER_OFFICE_ELEMENT2
(
text_index_title
);
//---------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------
//---------------------------------------------------------------------------------------------------
class
text_unknown_base_change
:
public
office_element_impl
<
text_unknown_base_change
>
{
...
...
ASCOfficeOdfFile/win32/cpodf.vcproj
View file @
d95c93ab
...
...
@@ -922,14 +922,6 @@
RelativePath=
"..\src\docx\mediaitems.h"
>
</File>
<File
RelativePath=
"..\src\docx\mediaitems_utils.cpp"
>
</File>
<File
RelativePath=
"..\src\docx\mediaitems_utils.h"
>
</File>
<File
RelativePath=
"..\src\docx\oox_conversion_context.cpp"
>
...
...
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