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
a2c22962
Commit
a2c22962
authored
Oct 16, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
XlsFormatReader - fix dublicate styles
parent
a3274076
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
77 additions
and
17 deletions
+77
-17
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FORMATTING.cpp
...lsFile2/source/XlsFormat/Logic/Biff_unions/FORMATTING.cpp
+27
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FORMATTING.h
...eXlsFile2/source/XlsFormat/Logic/Biff_unions/FORMATTING.h
+2
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/STYLES.cpp
...iceXlsFile2/source/XlsFormat/Logic/Biff_unions/STYLES.cpp
+20
-10
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/XFS.cpp
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/XFS.cpp
+10
-4
ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalsSubstream.cpp
...fficeXlsFile2/source/XlsFormat/Logic/GlobalsSubstream.cpp
+18
-3
No files found.
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FORMATTING.cpp
View file @
a2c22962
...
@@ -144,6 +144,33 @@ const bool FORMATTING::loadContent(BinProcessor& proc)
...
@@ -144,6 +144,33 @@ const bool FORMATTING::loadContent(BinProcessor& proc)
return
true
;
return
true
;
}
}
void
FORMATTING
::
concatinate
(
FORMATTING
*
ext
)
{
if
(
ext
->
m_XFS
)
{
if
(
!
m_XFS
)
m_XFS
=
ext
->
m_XFS
;
else
{
XFS
*
xf
=
dynamic_cast
<
XFS
*>
(
m_XFS
.
get
());
XFS
*
xf_ext
=
dynamic_cast
<
XFS
*>
(
ext
->
m_XFS
.
get
());
}
}
if
(
ext
->
m_Styles
)
{
if
(
!
m_Styles
)
m_Styles
=
ext
->
m_Styles
;
else
{
STYLES
*
st
=
dynamic_cast
<
STYLES
*>
(
m_Styles
.
get
());
STYLES
*
st_ext
=
dynamic_cast
<
STYLES
*>
(
ext
->
m_Styles
.
get
());
if
(
st
&&
st_ext
)
st
->
elements_
.
insert
(
st
->
elements_
.
end
(),
st_ext
->
elements_
.
begin
(),
st_ext
->
elements_
.
end
());
}
}
}
int
FORMATTING
::
serialize1
(
std
::
wostream
&
stream
)
int
FORMATTING
::
serialize1
(
std
::
wostream
&
stream
)
{
{
CP_XML_WRITER
(
stream
)
CP_XML_WRITER
(
stream
)
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/FORMATTING.h
View file @
a2c22962
...
@@ -52,6 +52,8 @@ public:
...
@@ -52,6 +52,8 @@ public:
int
serialize1
(
std
::
wostream
&
stream
);
int
serialize1
(
std
::
wostream
&
stream
);
int
serialize2
(
std
::
wostream
&
stream
);
int
serialize2
(
std
::
wostream
&
stream
);
void
concatinate
(
FORMATTING
*
ext
);
static
const
ElementType
type
=
typeFORMATTING
;
static
const
ElementType
type
=
typeFORMATTING
;
BaseObjectPtr
m_Styles
;
BaseObjectPtr
m_Styles
;
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/STYLES.cpp
View file @
a2c22962
...
@@ -48,19 +48,24 @@ public:
...
@@ -48,19 +48,24 @@ public:
const
bool
loadContent
(
BinProcessor
&
proc
)
const
bool
loadContent
(
BinProcessor
&
proc
)
{
{
if
(
proc
.
mandatory
<
Style
>
())
bool
res
=
false
;
if
(
proc
.
optional
<
Style
>
())
{
{
m_Style
=
elements_
.
back
();
m_Style
=
elements_
.
back
();
elements_
.
pop_back
();
elements_
.
pop_back
();
}
else
return
false
;
res
=
true
;
}
if
(
proc
.
optional
<
StyleExt
>
())
if
(
proc
.
optional
<
StyleExt
>
())
{
{
m_StyleEx
=
elements_
.
back
();
m_StyleEx
=
elements_
.
back
();
elements_
.
pop_back
();
elements_
.
pop_back
();
res
=
true
;
}
}
return
true
;
return
res
;
};
};
BaseObjectPtr
m_StyleEx
;
BaseObjectPtr
m_StyleEx
;
...
@@ -79,7 +84,8 @@ const bool STYLES::loadContent(BinProcessor& proc)
...
@@ -79,7 +84,8 @@ const bool STYLES::loadContent(BinProcessor& proc)
{
{
styles_count
=
proc
.
repeated
<
Parenthesis_STYLES_1
>
(
0
,
0
);
styles_count
=
proc
.
repeated
<
Parenthesis_STYLES_1
>
(
0
,
0
);
return
true
;
if
(
styles_count
>
0
)
return
true
;
else
return
false
;
}
}
int
STYLES
::
serialize
(
std
::
wostream
&
stream
)
int
STYLES
::
serialize
(
std
::
wostream
&
stream
)
...
@@ -121,7 +127,7 @@ int STYLES::serialize(std::wostream & stream)
...
@@ -121,7 +127,7 @@ int STYLES::serialize(std::wostream & stream)
//{
//{
//}
//}
}
}
else
else
if
(
style
)
{
{
CP_XML_ATTR
(
L"name"
,
style
->
user
.
value
());
CP_XML_ATTR
(
L"name"
,
style
->
user
.
value
());
...
@@ -134,6 +140,9 @@ int STYLES::serialize(std::wostream & stream)
...
@@ -134,6 +140,9 @@ int STYLES::serialize(std::wostream & stream)
}
}
}
}
}
}
if
(
style
)
{
int
xfId
=
style
->
ixfe
-
1
;
int
xfId
=
style
->
ixfe
-
1
;
if
(
xfId
<
0
)
xfId
=
0
;
if
(
xfId
<
0
)
xfId
=
0
;
...
@@ -142,6 +151,7 @@ int STYLES::serialize(std::wostream & stream)
...
@@ -142,6 +151,7 @@ int STYLES::serialize(std::wostream & stream)
}
}
}
}
}
}
}
else
else
{
{
CP_XML_ATTR
(
L"count"
,
1
);
CP_XML_ATTR
(
L"count"
,
1
);
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_unions/XFS.cpp
View file @
a2c22962
...
@@ -63,8 +63,8 @@ const bool XFS::loadContent(BinProcessor& proc)
...
@@ -63,8 +63,8 @@ const bool XFS::loadContent(BinProcessor& proc)
{
{
GlobalWorkbookInfoPtr
global_info
=
proc
.
getGlobalWorkbookInfo
();
GlobalWorkbookInfoPtr
global_info
=
proc
.
getGlobalWorkbookInfo
();
global_info
->
cellStyleXfs_count
=
0
;
int
cellStyleXfs_count
=
0
;
global_info
->
cellXfs_count
=
0
;
int
cellXfs_count
=
0
;
XF
xf
(
cell_xf_current_id
,
style_xf_current_id
);
XF
xf
(
cell_xf_current_id
,
style_xf_current_id
);
int
count
=
proc
.
repeated
(
xf
,
16
,
0
);
int
count
=
proc
.
repeated
(
xf
,
16
,
0
);
...
@@ -80,18 +80,24 @@ const bool XFS::loadContent(BinProcessor& proc)
...
@@ -80,18 +80,24 @@ const bool XFS::loadContent(BinProcessor& proc)
if
(
xfs
->
fStyle
)
if
(
xfs
->
fStyle
)
{
{
m_arCellStyles
.
push_back
(
elements_
.
front
());
m_arCellStyles
.
push_back
(
elements_
.
front
());
global_info
->
cellStyleXfs_count
++
;
cellStyleXfs_count
++
;
}
}
else
else
{
{
m_arCellXFs
.
push_back
(
elements_
.
front
());
m_arCellXFs
.
push_back
(
elements_
.
front
());
global_info
->
cellXfs_count
++
;
cellXfs_count
++
;
}
}
elements_
.
pop_front
();
elements_
.
pop_front
();
count
--
;
count
--
;
}
}
if
(
cellXfs_count
>
0
)
global_info
->
cellXfs_count
=
cellXfs_count
;
if
(
cellStyleXfs_count
>
0
)
global_info
->
cellStyleXfs_count
=
cellStyleXfs_count
;
if
(
proc
.
optional
<
XFCRC
>
())
if
(
proc
.
optional
<
XFCRC
>
())
{
{
elements_
.
pop_back
();
// Crc не нужен
elements_
.
pop_back
();
// Crc не нужен
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalsSubstream.cpp
View file @
a2c22962
...
@@ -318,17 +318,32 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc)
...
@@ -318,17 +318,32 @@ const bool GlobalsSubstream::loadContent(BinProcessor& proc)
{
{
if
(
proc
.
mandatory
<
FORMATTING
>
())
if
(
proc
.
mandatory
<
FORMATTING
>
())
{
{
if
(
!
m_Formating
)
//todooo concatinate?
if
(
!
m_Formating
)
{
{
m_Formating
=
elements_
.
back
();
m_Formating
=
elements_
.
back
();
elements_
.
pop_back
();
elements_
.
pop_back
();
FORMATTING
*
fmts
=
dynamic_cast
<
FORMATTING
*>
(
m_Formating
.
get
());
FORMATTING
*
fmts
=
dynamic_cast
<
FORMATTING
*>
(
m_Formating
.
get
());
if
(
fmts
)
if
(
fmts
)
{
{
proc
.
getGlobalWorkbookInfo
()
->
cellStyleDxfs_count
=
fmts
->
m_arDXF
.
size
();
// + будут юзерские
proc
.
getGlobalWorkbookInfo
()
->
cellStyleDxfs_count
=
fmts
->
m_arDXF
.
size
();
proc
.
getGlobalWorkbookInfo
()
->
m_arFonts
=
&
fmts
->
m_arFonts
;
proc
.
getGlobalWorkbookInfo
()
->
m_arFonts
=
&
fmts
->
m_arFonts
;
}
}
}
}
//else
//{
// FORMATTING* fmts = dynamic_cast<FORMATTING*>(m_Formating.get());
// FORMATTING* fmts_add = dynamic_cast<FORMATTING*>(elements_.back().get());
// if (fmts && fmts_add)
// {
// fmts->concatinate(fmts_add);
// elements_.pop_back();
// proc.getGlobalWorkbookInfo()->cellStyleDxfs_count = fmts->m_arDXF.size();
// proc.getGlobalWorkbookInfo()->m_arFonts = &fmts->m_arFonts;
// }
//}
}
}
}
break
;
}
break
;
case
rt_SXStreamID
:
proc
.
repeated
<
PIVOTCACHEDEFINITION
>
(
0
,
0
);
break
;
case
rt_SXStreamID
:
proc
.
repeated
<
PIVOTCACHEDEFINITION
>
(
0
,
0
);
break
;
...
...
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