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
0890776e
Commit
0890776e
authored
Jun 22, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
OdfFormatWriter - конвертация настроек документов и таблиц
parent
02049b28
Changes
14
Hide whitespace changes
Inline
Side-by-side
Showing
14 changed files
with
625 additions
and
54 deletions
+625
-54
ASCOfficeOdfFileW/source/OdfFormat/object_package.cpp
ASCOfficeOdfFileW/source/OdfFormat/object_package.cpp
+29
-0
ASCOfficeOdfFileW/source/OdfFormat/object_package.h
ASCOfficeOdfFileW/source/OdfFormat/object_package.h
+13
-3
ASCOfficeOdfFileW/source/OdfFormat/odf_conversion_context.cpp
...fficeOdfFileW/source/OdfFormat/odf_conversion_context.cpp
+33
-13
ASCOfficeOdfFileW/source/OdfFormat/odf_conversion_context.h
ASCOfficeOdfFileW/source/OdfFormat/odf_conversion_context.h
+15
-10
ASCOfficeOdfFileW/source/OdfFormat/odf_number_styles_context.h
...ficeOdfFileW/source/OdfFormat/odf_number_styles_context.h
+6
-6
ASCOfficeOdfFileW/source/OdfFormat/odf_settings_context.cpp
ASCOfficeOdfFileW/source/OdfFormat/odf_settings_context.cpp
+102
-0
ASCOfficeOdfFileW/source/OdfFormat/odf_settings_context.h
ASCOfficeOdfFileW/source/OdfFormat/odf_settings_context.h
+43
-0
ASCOfficeOdfFileW/source/OdfFormat/ods_conversion_context.cpp
...fficeOdfFileW/source/OdfFormat/ods_conversion_context.cpp
+12
-2
ASCOfficeOdfFileW/source/OdfFormat/ods_conversion_context.h
ASCOfficeOdfFileW/source/OdfFormat/ods_conversion_context.h
+4
-1
ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.h
ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.h
+5
-5
ASCOfficeOdfFileW/source/OdfFormat/office_settings.cpp
ASCOfficeOdfFileW/source/OdfFormat/office_settings.cpp
+191
-0
ASCOfficeOdfFileW/source/OdfFormat/office_settings.h
ASCOfficeOdfFileW/source/OdfFormat/office_settings.h
+137
-0
ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp
ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp
+19
-14
ASCOfficeOdfFileW/source/win32/OdfFormat.vcproj
ASCOfficeOdfFileW/source/win32/OdfFormat.vcproj
+16
-0
No files found.
ASCOfficeOdfFileW/source/OdfFormat/object_package.cpp
View file @
0890776e
...
...
@@ -216,10 +216,15 @@ namespace odf_writer
{
styles_
.
set_content
(
_content
);
}
void
object_files
::
set_settings
(
content_simple_ptr
&
_content
)
{
settings_
.
set_content
(
_content
);
}
void
object_files
::
write
(
const
std
::
wstring
&
RootPath
)
{
content_
.
write
(
RootPath
);
styles_
.
write
(
RootPath
);
settings_
.
write
(
RootPath
);
if
(
meta_
)
meta_
->
write
(
RootPath
);
...
...
@@ -391,6 +396,30 @@ namespace odf_writer
simple_element
elm
(
L"styles.xml"
,
resStream
.
str
());
elm
.
write
(
RootPath
);
}
void
settings_file
::
write
(
const
std
::
wstring
&
RootPath
)
{
std
::
wstringstream
resStream
;
CP_XML_WRITER
(
resStream
)
{
CP_XML_NODE
(
L"office:document-settings"
)
{
//CP_XML_ATTR(L"office:version", L"1.2" );
CP_XML_ATTR
(
L"xmlns:ooo"
,
L"http://openoffice.org/2004/office"
);
CP_XML_ATTR
(
L"xmlns:config"
,
L"urn:oasis:names:tc:opendocument:xmlns:config:1.0"
);
CP_XML_ATTR
(
L"xmlns:xlink"
,
L"http://www.w3.org/1999/xlink"
);
CP_XML_ATTR
(
L"xmlns:office"
,
L"urn:oasis:names:tc:opendocument:xmlns:office:1.0"
);
if
(
content_
)
{
CP_XML_STREAM
()
<<
content_
->
str
();
}
}
}
simple_element
elm
(
L"settings.xml"
,
resStream
.
str
());
elm
.
write
(
RootPath
);
}
}
}
...
...
ASCOfficeOdfFileW/source/OdfFormat/object_package.h
View file @
0890776e
...
...
@@ -107,7 +107,15 @@ namespace odf_writer
virtual
void
write
(
const
std
::
wstring
&
RootPath
);
content_simple_ptr
content_
;
};
class
settings_file
:
public
element
{
public:
void
set_content
(
content_simple_ptr
&
c
)
{
content_
=
c
;}
virtual
void
write
(
const
std
::
wstring
&
RootPath
);
content_simple_ptr
content_
;
};
class
manifect_file
:
public
element
{
public:
...
...
@@ -157,9 +165,10 @@ namespace odf_writer
public:
object_files
(){}
void
set_content
(
content_content_ptr
&
_C
ontent
);
void
set_content
(
content_content_ptr
&
_c
ontent
);
void
set_styles
(
content_simple_ptr
&
_Styles
);
void
set_styles
(
content_simple_ptr
&
_styles
);
void
set_settings
(
content_simple_ptr
&
_settings
);
void
set_media
(
_mediaitems
&
mediaitems
);
void
set_pictures
(
_mediaitems
&
mediaitems
);
...
...
@@ -168,6 +177,7 @@ namespace odf_writer
private:
content_file
content_
;
settings_file
settings_
;
styles_file
styles_
;
element_ptr
meta_
;
...
...
ASCOfficeOdfFileW/source/OdfFormat/odf_conversion_context.cpp
View file @
0890776e
...
...
@@ -80,14 +80,15 @@ void odf_conversion_context::end_document()
for
(
long
i
=
0
;
i
<
objects_
.
size
();
i
++
)
{
_object
&
object
=
objects_
[
i
];
bool
isRoot
=
(
i
==
0
?
true
:
false
);
bool
isRoot
=
(
i
==
0
?
true
:
false
);
if
(
object
.
content
==
NULL
)
continue
;
process_styles
(
object
,
isRoot
);
process_styles
(
object
,
isRoot
);
process_settings
(
object
,
isRoot
);
package
::
content_content_ptr
content_root_
=
package
::
content_content
::
create
();
object
.
content
->
serialize
(
content_root_
->
content
());
object
.
content
->
serialize
(
content_root_
->
content
());
BOOST_FOREACH
(
const
office_element_ptr
&
elm
,
object
.
content_styles
)
{
elm
->
serialize
(
content_root_
->
styles
());
...
...
@@ -99,6 +100,8 @@ void odf_conversion_context::end_document()
elm
->
serialize
(
content_style_
->
content
());
}
package
::
content_simple_ptr
content_settings_
=
package
::
content_simple
::
create
();
object
.
settings
->
serialize
(
content_settings_
->
content
());
////////////////////////////
package
::
object_files
*
object_files
=
new
package
::
object_files
();
if
(
object_files
)
...
...
@@ -107,7 +110,8 @@ void odf_conversion_context::end_document()
object_files
->
set_styles
(
content_style_
);
object_files
->
set_media
(
object
.
mediaitems
);
object_files
->
set_pictures
(
object
.
mediaitems
);
object_files
->
set_settings
(
content_settings_
);
if
(
!
isRoot
)
object_files
->
local_path
=
object
.
name
+
L"/"
;
object
.
mediaitems
.
dump_rels
(
rels_
,
object_files
->
local_path
);
...
...
@@ -115,6 +119,7 @@ void odf_conversion_context::end_document()
rels_
.
add
(
relationship
(
std
::
wstring
(
L"text/xml"
),
object_files
->
local_path
+
L"styles.xml"
));
rels_
.
add
(
relationship
(
std
::
wstring
(
L"text/xml"
),
object_files
->
local_path
+
L"content.xml"
));
rels_
.
add
(
relationship
(
std
::
wstring
(
L"text/xml"
),
object_files
->
local_path
+
L"meta.xml"
));
rels_
.
add
(
relationship
(
std
::
wstring
(
L"text/xml"
),
object_files
->
local_path
+
L"settings.xml"
));
if
(
isRoot
)
object_files
->
local_path
=
L"/"
;
rels_
.
add
(
relationship
(
std
::
wstring
(
L"application/vnd.oasis.opendocument."
)
+
object
.
content
->
get_name
(),
object_files
->
local_path
));
...
...
@@ -148,10 +153,14 @@ void odf_conversion_context::create_object()
{
_object
obj
;
obj
.
style_context
=
boost
::
make_shared
<
odf_style_context
>
();
obj
.
style_context
->
set_odf_context
(
this
);
obj
.
style_context
=
boost
::
make_shared
<
odf_style_context
>
();
obj
.
settings_context
=
boost
::
make_shared
<
odf_settings_context
>
();
obj
.
name
=
get_next_name_object
();
obj
.
style_context
->
set_odf_context
(
this
);
obj
.
settings_context
->
set_odf_context
(
this
);
objects_
.
push_back
(
obj
);
current_object_
=
objects_
.
size
()
-
1
;
...
...
@@ -185,31 +194,42 @@ std::wstring odf_conversion_context::get_next_name_object()
{
return
std
::
wstring
(
L"Object "
)
+
boost
::
lexical_cast
<
std
::
wstring
>
(
objects_
.
size
());
}
void
odf_conversion_context
::
process_settings
(
_object
&
object
,
bool
isRoot
)
{
create_element
(
L"office"
,
L"settings"
,
object
.
settings
,
this
,
true
);
object
.
settings_context
->
process_office_settings
(
object
.
settings
);
if
(
isRoot
)
{
}
}
void
odf_conversion_context
::
process_styles
(
_object
&
object
,
bool
isRoot
)
{
create_element
(
L"office"
,
L"styles"
,
object
.
styles
,
this
,
true
);
//îáùèå ñòèëè
create_element
(
L"office"
,
L"styles"
,
object
.
styles
,
this
,
true
);
//îáùèå ñòèëè
object
.
style_context
->
process_office_styles
(
object
.
styles
.
back
());
page_layout_context
()
->
process_office_styles
(
object
.
styles
.
back
());
if
(
isRoot
)
{
create_element
(
L"office"
,
L"font-face-decls"
,
object
.
styles
,
this
,
true
);
create_element
(
L"office"
,
L"font-face-decls"
,
object
.
styles
,
this
,
true
);
create_element
(
L"office"
,
L"automatic-styles"
,
object
.
styles
,
this
,
true
);
create_element
(
L"office"
,
L"automatic-styles"
,
object
.
styles
,
this
,
true
);
object
.
style_context
->
process_automatic_for_styles
(
object
.
styles
.
back
());
page_layout_context
()
->
process_automatic_for_styles
(
object
.
styles
.
back
());
create_element
(
L"office"
,
L"master-styles"
,
object
.
styles
,
this
,
true
);
create_element
(
L"office"
,
L"master-styles"
,
object
.
styles
,
this
,
true
);
page_layout_context
()
->
process_master_styles
(
object
.
styles
.
back
());
create_element
(
L"office"
,
L"font-face-decls"
,
object
.
content_styles
,
this
,
true
);
create_element
(
L"office"
,
L"font-face-decls"
,
object
.
content_styles
,
this
,
true
);
}
create_element
(
L"office"
,
L"automatic-styles"
,
object
.
content_styles
,
this
,
true
);
create_element
(
L"office"
,
L"automatic-styles"
,
object
.
content_styles
,
this
,
true
);
object
.
style_context
->
process_automatic_styles
(
object
.
content_styles
.
back
());
}
office_element_ptr
odf_conversion_context
::
start_tabs
()
{
create_element
(
L"style"
,
L"tab-stops"
,
temporary_
.
elm
,
this
,
true
);
...
...
ASCOfficeOdfFileW/source/OdfFormat/odf_conversion_context.h
View file @
0890776e
...
...
@@ -3,6 +3,8 @@
#include "object_package.h"
#include "odf_style_context.h"
#include "odf_settings_context.h"
#include "odf_page_layout_context.h"
#include "odf_drawing_context.h"
...
...
@@ -24,14 +26,16 @@ class odf_conversion_context : boost::noncopyable
{
struct
_object
{
std
::
wstring
name
;
std
::
wstring
name
;
office_element_ptr
content
;
std
::
vector
<
office_element_ptr
>
content_styles
;
std
::
vector
<
office_element_ptr
>
styles
;
office_element_ptr
content
;
std
::
vector
<
office_element_ptr
>
content_styles
;
std
::
vector
<
office_element_ptr
>
styles
;
office_element_ptr
settings
;
odf_style_context_ptr
style_context
;
_mediaitems
mediaitems
;
odf_style_context_ptr
style_context
;
odf_settings_context_ptr
settings_context
;
_mediaitems
mediaitems
;
};
public:
...
...
@@ -85,12 +89,13 @@ public:
private:
odf_element_state
temporary_
;
std
::
vector
<
_object
>
objects_
;
//"0" = root
std
::
vector
<
_object
>
objects_
;
//"0" = root
odf_chart_context
chart_context_
;
odf_page_layout_context
page_layout_context_
;
odf_chart_context
chart_context_
;
odf_page_layout_context
page_layout_context_
;
void
process_styles
(
_object
&
object
,
bool
isRoot
);
void
process_styles
(
_object
&
object
,
bool
isRoot
);
void
process_settings
(
_object
&
object
,
bool
isRoot
);
int
current_object_
;
...
...
ASCOfficeOdfFileW/source/OdfFormat/odf_number_styles_context.h
View file @
0890776e
...
...
@@ -54,12 +54,12 @@ private:
std
::
vector
<
office_element_ptr
>
styles_elments
;
//////////////////
void
create_number_style
(
number_format_state
&
state
,
office_element_ptr
&
root_elm
);
void
create_currency_style
(
number_format_state
&
state
,
office_element_ptr
&
root_elm
);
void
create_date_style
(
number_format_state
&
state
,
office_element_ptr
&
root_elm
);
void
create_time_style
(
number_format_state
&
state
,
office_element_ptr
&
root_elm
);
void
create_boolean_style
(
number_format_state
&
state
,
office_element_ptr
&
root_elm
);
void
create_text_style
(
number_format_state
&
state
,
office_element_ptr
&
root_elm
);
void
create_number_style
(
number_format_state
&
state
,
office_element_ptr
&
root_elm
);
void
create_currency_style
(
number_format_state
&
state
,
office_element_ptr
&
root_elm
);
void
create_date_style
(
number_format_state
&
state
,
office_element_ptr
&
root_elm
);
void
create_time_style
(
number_format_state
&
state
,
office_element_ptr
&
root_elm
);
void
create_boolean_style
(
number_format_state
&
state
,
office_element_ptr
&
root_elm
);
void
create_text_style
(
number_format_state
&
state
,
office_element_ptr
&
root_elm
);
void
create_percentage_style
(
number_format_state
&
state
,
office_element_ptr
&
root_elm
);
void
create_numbers
(
number_format_state
&
state
,
office_element_ptr
&
elm
);
...
...
ASCOfficeOdfFileW/source/OdfFormat/odf_settings_context.cpp
0 → 100644
View file @
0890776e
#include "odf_settings_context.h"
#include "ods_conversion_context.h"
#include "logging.h"
#include "office_settings.h"
#include <iostream>
namespace
cpdoccore
{
using
namespace
odf_types
;
namespace
odf_writer
{
odf_settings_context
::
odf_settings_context
()
{
}
void
odf_settings_context
::
set_odf_context
(
odf_conversion_context
*
Context
)
{
odf_context_
=
Context
;
}
void
odf_settings_context
::
process_office_settings
(
office_element_ptr
root
)
{
settings_config_item_set
*
item_set
=
NULL
;
settings_config_item_map_named
*
item_map_named
=
NULL
;
settings_config_item_map_indexed
*
item_map_indexed
=
NULL
;
settings_config_item_map_entry
*
item_map_entry
=
NULL
;
if
(
!
views_
.
content
.
empty
()
||
!
views_
.
tables
.
empty
())
{
office_element_ptr
ooo_view_elm
;
{
create_element
(
L"config"
,
L"config-item-set"
,
ooo_view_elm
,
odf_context_
);
root
->
add_child_element
(
ooo_view_elm
);
item_set
=
dynamic_cast
<
settings_config_item_set
*>
(
ooo_view_elm
.
get
());
if
(
item_set
)
item_set
->
config_name_
=
L"ooo:view-settings"
;
}
office_element_ptr
views_elm
;
{
create_element
(
L"config"
,
L"config-item-map-indexed"
,
views_elm
,
odf_context_
);
ooo_view_elm
->
add_child_element
(
views_elm
);
item_map_indexed
=
dynamic_cast
<
settings_config_item_map_indexed
*>
(
views_elm
.
get
());
if
(
item_map_indexed
)
item_map_indexed
->
config_name_
=
L"Views"
;
}
office_element_ptr
views_entry_elm
;
{
create_element
(
L"config"
,
L"config-item-map-entry"
,
views_entry_elm
,
odf_context_
);
views_elm
->
add_child_element
(
views_entry_elm
);
}
for
(
int
i
=
0
;
i
<
views_
.
content
.
size
();
i
++
)
{
views_entry_elm
->
add_child_element
(
views_
.
content
[
i
]);
}
if
(
!
views_
.
tables
.
empty
())
{
office_element_ptr
tables_elm
;
create_element
(
L"config"
,
L"config-item-map-named"
,
tables_elm
,
odf_context_
);
views_entry_elm
->
add_child_element
(
tables_elm
);
item_map_named
=
dynamic_cast
<
settings_config_item_map_named
*>
(
tables_elm
.
get
());
if
(
item_map_named
)
item_map_indexed
->
config_name_
=
L"Tables"
;
for
(
std
::
map
<
std
::
wstring
,
std
::
vector
<
office_element_ptr
>>::
iterator
it
=
views_
.
tables
.
begin
();
it
!=
views_
.
tables
.
end
();
it
++
)
{
office_element_ptr
table_elm
;
create_element
(
L"config"
,
L"config-item-map-entry"
,
table_elm
,
odf_context_
);
tables_elm
->
add_child_element
(
table_elm
);
item_map_entry
=
dynamic_cast
<
settings_config_item_map_entry
*>
(
table_elm
.
get
());
if
(
item_map_entry
)
item_map_indexed
->
config_name_
=
it
->
first
;
for
(
int
j
=
0
;
j
<
it
->
second
.
size
();
j
++
)
{
table_elm
->
add_child_element
(
it
->
second
[
j
]);
}
}
}
}
if
(
!
config_content_
.
empty
())
{
office_element_ptr
ooo_config_elm
;
create_element
(
L"config"
,
L"config-item-set"
,
ooo_config_elm
,
odf_context_
);
root
->
add_child_element
(
ooo_config_elm
);
item_set
=
dynamic_cast
<
settings_config_item_set
*>
(
ooo_config_elm
.
get
());
if
(
item_set
)
item_set
->
config_name_
=
L"ooo:configuration-settings"
;
for
(
int
j
=
0
;
j
<
config_content_
.
size
();
j
++
)
{
ooo_config_elm
->
add_child_element
(
config_content_
[
j
]);
}
}
}
}
}
\ No newline at end of file
ASCOfficeOdfFileW/source/OdfFormat/odf_settings_context.h
0 → 100644
View file @
0890776e
#pragma once
#include <string>
#include <vector>
#include <map>
#include <cpdoccore/CPSharedPtr.h>
namespace
cpdoccore
{
namespace
odf_writer
{
class
odf_conversion_context
;
class
office_element
;
typedef
shared_ptr
<
office_element
>::
Type
office_element_ptr
;
class
odf_settings_context
;
typedef
shared_ptr
<
odf_settings_context
>::
Type
odf_settings_context_ptr
;
class
odf_settings_context
{
public:
odf_settings_context
();
void
set_odf_context
(
odf_conversion_context
*
Context
);
void
process_office_settings
(
office_element_ptr
root
);
private:
struct
views
{
std
::
map
<
std
::
wstring
,
std
::
vector
<
office_element_ptr
>>
tables
;
std
::
vector
<
office_element_ptr
>
content
;
}
views_
;
std
::
vector
<
office_element_ptr
>
config_content_
;
odf_conversion_context
*
odf_context_
;
};
}
}
ASCOfficeOdfFileW/source/OdfFormat/ods_conversion_context.cpp
View file @
0890776e
...
...
@@ -11,6 +11,7 @@
#include "odf_text_context.h"
#include "paragraph_elements.h"
#include "odf_settings_context.h"
namespace
cpdoccore
{
...
...
@@ -44,7 +45,7 @@ void calculate_size_font_symbols(_font_metrix & metrix, CApplicationFonts *appFo
ods_conversion_context
::
ods_conversion_context
(
package
::
odf_document
*
outputDocument
)
:
odf_conversion_context
(
outputDocument
),
table_context_
(
*
this
),
current_text_context_
(
NULL
)
{
font_metrix_
=
_font_metrix
();
font_metrix_
=
_font_metrix
();
}
...
...
@@ -473,7 +474,7 @@ void ods_conversion_context::start_image(const std::wstring & image_file_name)
current_table
().
drawing_context
()
->
start_image
(
odf_ref_name
);
}
double
ods_conversion_context
::
convert_symbol_width
(
double
val
)
double
ods_conversion_context
::
convert_symbol_width
(
double
val
)
{
//width = ((int)((column_width * Digit_Width + 5) / Digit_Width * 256 )) / 256.;
//width = (int)(((256. * width + ((int)(128. / Digit_Width ))) / 256. ) * Digit_Width ); //in pixels
...
...
@@ -487,5 +488,14 @@ double ods_conversion_context:: convert_symbol_width(double val)
return
pixels
*
0.75
;
//* 9525. * 72.0 / (360000.0 * 2.54);
}
void
ods_conversion_context
::
start_table_view
(
std
::
wstring
table_name
,
int
view_id
)
{
}
void
ods_conversion_context
::
end_table_view
()
{
}
}
}
ASCOfficeOdfFileW/source/OdfFormat/ods_conversion_context.h
View file @
0890776e
...
...
@@ -81,8 +81,11 @@ public:
void
end_autofilter
(){}
void
start_conditional_formats
();
void
end_conditional_formats
(){}
void
start_table_view
(
std
::
wstring
table_name
,
int
view_id
);
void
end_table_view
();
private:
_font_metrix
font_metrix_
;
ods_table_context
table_context_
;
...
...
ASCOfficeOdfFileW/source/OdfFormat/ods_table_state.h
View file @
0890776e
...
...
@@ -256,10 +256,10 @@ public:
office_element_ptr
&
current_row_element
();
office_element_ptr
&
current_cell_element
();
bool
is_cell_hyperlink
();
int
is_cell_hyperlink
(
int
col
,
int
row
);
bool
is_cell_comment
();
int
is_cell_comment
(
int
col
,
int
row
,
short
repeate_col
=
1
);
bool
is_cell_hyperlink
();
int
is_cell_hyperlink
(
int
col
,
int
row
);
bool
is_cell_comment
();
int
is_cell_comment
(
int
col
,
int
row
,
short
repeate_col
=
1
);
ods_hyperlink_state
&
current_hyperlink
();
...
...
@@ -276,11 +276,11 @@ public:
odf_drawing_context
*
drawing_context
(){
return
&
drawing_context_
;}
std
::
wstring
office_table_name_
;
private:
odf_conversion_context
*
context_
;
std
::
wstring
office_table_name_
;
office_element_ptr
office_table_
;
style
*
office_table_style_
;
//??? office_element_ptr ???
office_element_ptr
table_defined_expressions_
;
...
...
ASCOfficeOdfFileW/source/OdfFormat/office_settings.cpp
0 → 100644
View file @
0890776e
#include "office_settings.h"
#include <boost/foreach.hpp>
#include <cpdoccore/xml/xmlchar.h>
#include <cpdoccore/xml/attributes.h>
namespace
cpdoccore
{
namespace
odf_writer
{
// office:scripts
//////////////////////////////////////////////////////////////////////////////////////////////////
const
wchar_t
*
office_settings
::
ns
=
L"office"
;
const
wchar_t
*
office_settings
::
name
=
L"settings"
;
void
office_settings
::
create_child_element
(
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
office_settings
::
serialize
(
std
::
wostream
&
_Wostream
)
{
CP_XML_WRITER
(
_Wostream
)
{
CP_XML_NODE_SIMPLE
()
{
BOOST_FOREACH
(
const
office_element_ptr
&
elm
,
content_
)
{
elm
->
serialize
(
CP_XML_STREAM
());
}
}
}
}
void
office_settings
::
add_child_element
(
const
office_element_ptr
&
child_element
)
{
content_
.
push_back
(
child_element
);
}
// config_item_set
//////////////////////////////////////////////////////////////////////////////////////////////////
const
wchar_t
*
settings_config_item_set
::
ns
=
L"config"
;
const
wchar_t
*
settings_config_item_set
::
name
=
L"config-item-set"
;
void
settings_config_item_set
::
create_child_element
(
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
settings_config_item_set
::
serialize
(
std
::
wostream
&
_Wostream
)
{
if
(
config_name_
.
empty
())
return
;
CP_XML_WRITER
(
_Wostream
)
{
CP_XML_NODE_SIMPLE
()
{
CP_XML_ATTR
(
L"config:name"
,
config_name_
);
BOOST_FOREACH
(
const
office_element_ptr
&
elm
,
content_
)
{
elm
->
serialize
(
CP_XML_STREAM
());
}
}
}
}
void
settings_config_item_set
::
add_child_element
(
const
office_element_ptr
&
child_element
)
{
content_
.
push_back
(
child_element
);
}
// config_item
//////////////////////////////////////////////////////////////////////////////////////////////////
const
wchar_t
*
settings_config_item
::
ns
=
L"config"
;
const
wchar_t
*
settings_config_item
::
name
=
L"config-item"
;
void
settings_config_item
::
create_child_element
(
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
}
void
settings_config_item
::
serialize
(
std
::
wostream
&
_Wostream
)
{
if
(
config_name_
.
empty
()
||
config_type_
.
empty
())
return
;
CP_XML_WRITER
(
_Wostream
)
{
CP_XML_NODE_SIMPLE
()
{
CP_XML_ATTR
(
L"config:name"
,
config_name_
);
CP_XML_ATTR
(
L"config:type"
,
config_type_
);
CP_XML_STREAM
()
<<
content_
;
}
}
}
void
settings_config_item
::
add_child_element
(
const
office_element_ptr
&
child_element
)
{
}
// config_item_map_indexed
//////////////////////////////////////////////////////////////////////////////////////////////////
const
wchar_t
*
settings_config_item_map_indexed
::
ns
=
L"config"
;
const
wchar_t
*
settings_config_item_map_indexed
::
name
=
L"config-item-map-indexed"
;
void
settings_config_item_map_indexed
::
create_child_element
(
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
settings_config_item_map_indexed
::
serialize
(
std
::
wostream
&
_Wostream
)
{
CP_XML_WRITER
(
_Wostream
)
{
CP_XML_NODE_SIMPLE
()
{
if
(
!
config_name_
.
empty
())
{
CP_XML_ATTR
(
L"config:name"
,
config_name_
);
}
BOOST_FOREACH
(
const
office_element_ptr
&
elm
,
content_
)
{
elm
->
serialize
(
CP_XML_STREAM
());
}
}
}
}
void
settings_config_item_map_indexed
::
add_child_element
(
const
office_element_ptr
&
child_element
)
{
content_
.
push_back
(
child_element
);
}
// config_item_map_named
//////////////////////////////////////////////////////////////////////////////////////////////////
const
wchar_t
*
settings_config_item_map_named
::
ns
=
L"config"
;
const
wchar_t
*
settings_config_item_map_named
::
name
=
L"config-item-map-named"
;
void
settings_config_item_map_named
::
create_child_element
(
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
settings_config_item_map_named
::
serialize
(
std
::
wostream
&
_Wostream
)
{
CP_XML_WRITER
(
_Wostream
)
{
CP_XML_NODE_SIMPLE
()
{
if
(
!
config_name_
.
empty
())
{
CP_XML_ATTR
(
L"config:name"
,
config_name_
);
}
BOOST_FOREACH
(
const
office_element_ptr
&
elm
,
content_
)
{
elm
->
serialize
(
CP_XML_STREAM
());
}
}
}
}
void
settings_config_item_map_named
::
add_child_element
(
const
office_element_ptr
&
child_element
)
{
content_
.
push_back
(
child_element
);
}
// config_item_map_entry
//////////////////////////////////////////////////////////////////////////////////////////////////
const
wchar_t
*
settings_config_item_map_entry
::
ns
=
L"config"
;
const
wchar_t
*
settings_config_item_map_entry
::
name
=
L"config-item-map-entry"
;
void
settings_config_item_map_entry
::
create_child_element
(
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
)
{
CP_CREATE_ELEMENT
(
content_
);
}
void
settings_config_item_map_entry
::
serialize
(
std
::
wostream
&
_Wostream
)
{
CP_XML_WRITER
(
_Wostream
)
{
CP_XML_NODE_SIMPLE
()
{
BOOST_FOREACH
(
const
office_element_ptr
&
elm
,
content_
)
{
elm
->
serialize
(
CP_XML_STREAM
());
}
}
}
}
void
settings_config_item_map_entry
::
add_child_element
(
const
office_element_ptr
&
child_element
)
{
content_
.
push_back
(
child_element
);
}
}
}
ASCOfficeOdfFileW/source/OdfFormat/office_settings.h
0 → 100644
View file @
0890776e
#pragma once
#include <iosfwd>
#include <cpdoccore/CPOptional.h>
#include <cpdoccore/xml/xmlelement.h>
#include <cpdoccore/xml/nodetype.h>
#include "office_elements_create.h"
#include "common_attlists.h"
namespace
cpdoccore
{
namespace
odf_writer
{
// office:settings
class
office_settings
:
public
office_element_impl
<
office_settings
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeOfficeSettings
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
create_child_element
(
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_child_element
(
const
office_element_ptr
&
child_element
);
virtual
void
serialize
(
std
::
wostream
&
_Wostream
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
office_settings
);
// config:config-item-set
class
settings_config_item_set
:
public
office_element_impl
<
settings_config_item_set
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeOfficeSettingsConfigItemSet
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
create_child_element
(
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_child_element
(
const
office_element_ptr
&
child_element
);
virtual
void
serialize
(
std
::
wostream
&
_Wostream
);
std
::
wstring
config_name_
;
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
settings_config_item_set
);
// config:config-item
class
settings_config_item
:
public
office_element_impl
<
settings_config_item
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeOfficeSettingsConfigItem
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
create_child_element
(
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_child_element
(
const
office_element_ptr
&
child_element
);
virtual
void
serialize
(
std
::
wostream
&
_Wostream
);
std
::
wstring
config_name_
;
std
::
wstring
config_type_
;
std
::
wstring
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
settings_config_item
);
// config:config-item_map_indexed
class
settings_config_item_map_indexed
:
public
office_element_impl
<
settings_config_item_map_indexed
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeOfficeSettingsConfigItemMapIndexed
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
create_child_element
(
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_child_element
(
const
office_element_ptr
&
child_element
);
virtual
void
serialize
(
std
::
wostream
&
_Wostream
);
std
::
wstring
config_name_
;
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
settings_config_item_map_indexed
);
// config:config-item_map_named
class
settings_config_item_map_named
:
public
office_element_impl
<
settings_config_item_map_named
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeOfficeSettingsConfigItemMapNamed
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
create_child_element
(
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_child_element
(
const
office_element_ptr
&
child_element
);
virtual
void
serialize
(
std
::
wostream
&
_Wostream
);
std
::
wstring
config_name_
;
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
settings_config_item_map_named
);
// config:config-item
class
settings_config_item_map_entry
:
public
office_element_impl
<
settings_config_item_map_entry
>
{
public:
static
const
wchar_t
*
ns
;
static
const
wchar_t
*
name
;
static
const
xml
::
NodeType
xml_type
=
xml
::
typeElement
;
static
const
ElementType
type
=
typeOfficeSettingsConfigItemMapEntry
;
CPDOCCORE_DEFINE_VISITABLE
();
virtual
void
create_child_element
(
const
::
std
::
wstring
&
Ns
,
const
::
std
::
wstring
&
Name
);
virtual
void
add_child_element
(
const
office_element_ptr
&
child_element
);
virtual
void
serialize
(
std
::
wostream
&
_Wostream
);
office_element_ptr_array
content_
;
};
CP_REGISTER_OFFICE_ELEMENT2
(
settings_config_item_map_entry
);
}
}
\ No newline at end of file
ASCOfficeOdfFileW/source/Oox2OdfConverter/XlsxConverter.cpp
View file @
0890776e
...
...
@@ -777,25 +777,30 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views)
{
if
(
!
oox_sheet_views
)
return
;
for
(
unsigned
long
i
=
0
;
i
<
oox_sheet_views
->
m_arrItems
.
size
();
i
++
)
{
if
(
oox_sheet_views
->
m_arrItems
[
i
])
{
if
(
oox_sheet_views
->
m_arrItems
[
i
]
->
m_oWorkbookViewId
.
IsInit
())
{}
if
(
!
oox_sheet_views
->
m_arrItems
[
i
])
continue
;
int
view_id
=
-
1
;
if
(
oox_sheet_views
->
m_arrItems
[
i
]
->
m_oWorkbookViewId
.
IsInit
())
view_id
=
oox_sheet_views
->
m_arrItems
[
i
]
->
m_oWorkbookViewId
->
GetValue
();
ods_context
->
start_table_view
(
ods_context
->
current_table
().
office_table_name_
,
view_id
);
if
(
oox_sheet_views
->
m_arrItems
[
i
]
->
m_oRightToLeft
.
IsInit
()
&&
oox_sheet_views
->
m_arrItems
[
i
]
->
m_oRightToLeft
->
GetValue
()
==
1
)
ods_context
->
current_table
().
set_table_rtl
(
true
);
if
(
oox_sheet_views
->
m_arrItems
[
i
]
->
m_oShowGridLines
.
IsInit
()
&&
oox_sheet_views
->
m_arrItems
[
i
]
->
m_oShowGridLines
->
GetValue
()
==
0
)
{
//ods_context->set_settings_show_gridlines(false);
}
if
(
oox_sheet_views
->
m_arrItems
[
i
]
->
m_oShowGridLines
.
IsInit
()
&&
oox_sheet_views
->
m_arrItems
[
i
]
->
m_oShowGridLines
->
GetValue
()
==
0
)
{
//ods_context->set_settings_show_gridlines(false);
}
if
(
oox_sheet_views
->
m_arrItems
[
i
]
->
m_oView
.
IsInit
())
{
// ..
//ods_context->set_settings_table_viewtype(oox_sheet_views->m_arrItems[i]->m_oView->GetValue());
}
if
(
oox_sheet_views
->
m_arrItems
[
i
]
->
m_oView
.
IsInit
())
{
//ods_context->set_settings_table_viewtype(oox_sheet_views->m_arrItems[i]->m_oView->GetValue());
}
//nullable<CPane> m_oPane;
...
...
@@ -817,7 +822,7 @@ void XlsxConverter::convert(OOX::Spreadsheet::CSheetViews *oox_sheet_views)
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oZoomScaleNormal;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oZoomScalePageLayoutView;
//nullable<SimpleTypes::CUnsignedDecimalNumber<>> m_oZoomScaleSheetLayoutView;
}
ods_context
->
end_table_view
();
}
}
...
...
ASCOfficeOdfFileW/source/win32/OdfFormat.vcproj
View file @
0890776e
...
...
@@ -385,6 +385,14 @@
RelativePath=
"..\OdfFormat\office_chart.h"
>
</File>
<File
RelativePath=
"..\OdfFormat\office_settings.cpp"
>
</File>
<File
RelativePath=
"..\OdfFormat\office_settings.h"
>
</File>
<File
RelativePath=
"..\OdfFormat\office_spreadsheet.cpp"
>
...
...
@@ -729,6 +737,14 @@
RelativePath=
"..\OdfFormat\odf_drawing_context.h"
>
</File>
<File
RelativePath=
"..\OdfFormat\odf_settings_context.cpp"
>
</File>
<File
RelativePath=
"..\OdfFormat\odf_settings_context.h"
>
</File>
<File
RelativePath=
"..\OdfFormat\odf_table_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