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
5b48a7a3
Commit
5b48a7a3
authored
Dec 12, 2017
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DocFormat - fix users file, add data form field
parent
1496aece
Changes
21
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
21 changed files
with
574 additions
and
180 deletions
+574
-180
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
+74
-76
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h
+5
-3
ASCOfficeDocFile/DocDocxConverter/FormFieldData.cpp
ASCOfficeDocFile/DocDocxConverter/FormFieldData.cpp
+198
-0
ASCOfficeDocFile/DocDocxConverter/FormFieldData.h
ASCOfficeDocFile/DocDocxConverter/FormFieldData.h
+126
-0
ASCOfficeDocFile/DocDocxConverter/FormFieldDataMapping.h
ASCOfficeDocFile/DocDocxConverter/FormFieldDataMapping.h
+87
-0
ASCOfficeDocFile/DocDocxConverter/IVisitable.h
ASCOfficeDocFile/DocDocxConverter/IVisitable.h
+1
-0
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/PathParser.h
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/PathParser.h
+27
-54
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/ShapeOptions.h
...ficeDocFile/DocDocxConverter/OfficeDrawing/ShapeOptions.h
+1
-7
ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.cpp
ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.cpp
+3
-2
ASCOfficeDocFile/DocDocxConverter/RevisionData.cpp
ASCOfficeDocFile/DocDocxConverter/RevisionData.cpp
+1
-7
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
+4
-2
ASCOfficeDocFile/DocFormatLib/Linux/DocFormatLib.pro
ASCOfficeDocFile/DocFormatLib/Linux/DocFormatLib.pro
+1
-0
ASCOfficeDocFile/DocFormatLib/Linux/docformatlib_converter.cpp
...ficeDocFile/DocFormatLib/Linux/docformatlib_converter.cpp
+1
-0
ASCOfficeDocFile/DocFormatLib/Win32/DocFormatLib.vcproj
ASCOfficeDocFile/DocFormatLib/Win32/DocFormatLib.vcproj
+13
-1
ASCOfficeDocFile/DocFormatTest/DocFormatTest.cpp
ASCOfficeDocFile/DocFormatTest/DocFormatTest.cpp
+14
-18
ASCOfficeDocFile/DocFormatTest/DocFormatTest.vcproj
ASCOfficeDocFile/DocFormatTest/DocFormatTest.vcproj
+4
-0
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AxisLine.h
...ceXlsFile2/source/XlsFormat/Logic/Biff_records/AxisLine.h
+0
-2
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ExternSheet.cpp
...File2/source/XlsFormat/Logic/Biff_records/ExternSheet.cpp
+2
-2
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/InterfaceEnd.h
...sFile2/source/XlsFormat/Logic/Biff_records/InterfaceEnd.h
+1
-1
ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalsSubstream.cpp
...fficeXlsFile2/source/XlsFormat/Logic/GlobalsSubstream.cpp
+10
-4
X2tConverter/build/Qt/X2tConverter.pri
X2tConverter/build/Qt/X2tConverter.pri
+1
-1
No files found.
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
View file @
5b48a7a3
This diff is collapsed.
Click to expand it.
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h
View file @
5b48a7a3
...
...
@@ -48,6 +48,8 @@
#include "OleObjectMapping.h"
#include "ConversionContext.h"
#include "IMapping.h"
#include "FormFieldData.h"
#include "FormFieldDataMapping.h"
namespace
DocFileFormat
{
...
...
@@ -108,15 +110,15 @@ namespace DocFileFormat
// Writes the table starts at the given cp value
int
writeTable
(
int
initialCp
,
unsigned
int
nestingLevel
);
// Builds a list that contains the width of the several columns of the table.
bool
buildTableGrid
(
int
initialCp
,
unsigned
int
nestingLevel
,
std
::
vector
<
short
>&
grid
,
std
::
vector
<
short
>&
grid_write
);
std
::
vector
<
short
>*
buildTableGrid
(
int
initialCp
,
unsigned
int
nestingLevel
);
// Finds the FC of the next row end mark.
int
findRowEndFc
(
int
initialCp
,
int
&
rowEndCp
,
unsigned
int
nestingLevel
);
// Finds the FC of the next row end mark.
int
findRowEndFc
(
int
initialCp
,
unsigned
int
nestingLevel
);
// Writes the table row that starts at the given cp value and ends at the next row end mark
int
writeTableRow
(
int
initialCp
,
std
::
vector
<
short
>*
grid
,
std
::
vector
<
short
>*
grid_write
,
unsigned
int
nestingLevel
);
int
writeTableRow
(
int
initialCp
,
std
::
vector
<
short
>*
grid
,
unsigned
int
nestingLevel
);
// Writes the table cell that starts at the given cp value and ends at the next cell end mark
int
writeTableCell
(
int
initialCp
,
TablePropertyExceptions
*
tapx
,
std
::
vector
<
short
>*
grid
,
std
::
vector
<
short
>*
grid_write
,
int
&
gridIndex
,
int
cellIndex
,
unsigned
int
nestingLevel
);
int
writeTableCell
(
int
initialCp
,
TablePropertyExceptions
*
tapx
,
std
::
vector
<
short
>*
grid
,
int
&
gridIndex
,
int
cellIndex
,
unsigned
int
nestingLevel
);
int
findCellEndCp
(
int
initialCp
,
unsigned
int
nestingLevel
);
bool
writeBookmarks
(
int
cp
);
...
...
ASCOfficeDocFile/DocDocxConverter/FormFieldData.cpp
0 → 100644
View file @
5b48a7a3
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* 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
*
*/
#pragma once
#include "FormFieldData.h"
#include "../../Common/DocxFormat/Source/Base/unicode_util.h"
static
std
::
wstring
convertUtf16ToWString
(
const
UTF16
*
Data
,
int
nLength
)
{
UTF32
*
pStrUtf32
=
new
UTF32
[
nLength
+
1
];
memset
((
void
*
)
pStrUtf32
,
0
,
sizeof
(
UTF32
)
*
(
nLength
+
1
));
// this values will be modificated
const
UTF16
*
pStrUtf16_Conv
=
Data
;
UTF32
*
pStrUtf32_Conv
=
pStrUtf32
;
ConversionResult
eUnicodeConversionResult
=
ConvertUTF16toUTF32
(
&
pStrUtf16_Conv
,
&
Data
[
nLength
]
,
&
pStrUtf32_Conv
,
&
pStrUtf32
[
nLength
]
,
strictConversion
);
if
(
conversionOK
!=
eUnicodeConversionResult
)
{
delete
[]
pStrUtf32
;
return
std
::
wstring
();
}
std
::
wstring
wstr
((
wchar_t
*
)
pStrUtf32
);
delete
[]
pStrUtf32
;
return
wstr
;
}
namespace
DocFileFormat
{
std
::
wstring
readXstz
(
VirtualStreamReader
*
reader
)
{
if
(
!
reader
)
return
L""
;
unsigned
short
flags
,
cch
,
chTerm
;
cch
=
reader
->
ReadUInt16
();
std
::
wstring
ret
;
if
(
cch
>
0
)
{
std
::
shared_ptr
<
unsigned
char
>
data
=
std
::
shared_ptr
<
unsigned
char
>
(
reader
->
ReadBytes
(
cch
*
2
,
true
));
#if defined(_WIN32) || defined(_WIN64)
ret
=
std
::
wstring
((
wchar_t
*
)
data
.
get
(),
cch
);
#else
ret
=
convertUtf16ToWString
((
UTF16
*
)
data
.
get
(),
cch
);
#endif
}
chTerm
=
reader
->
ReadUInt16
();
return
ret
;
};
void
FormFieldData
::
_HFD
::
read
(
VirtualStreamReader
*
reader
)
{
if
(
!
reader
)
return
;
}
void
FormFieldData
::
_FFData
::
read
(
VirtualStreamReader
*
reader
)
{
if
(
!
reader
)
return
;
bExist
=
true
;
unsigned
short
flags
;
version
=
reader
->
ReadUInt32
();
flags
=
reader
->
ReadUInt16
();
iType
=
GETBITS
(
flags
,
0
,
1
);
iRes
=
GETBITS
(
flags
,
2
,
6
);
fOwnHelp
=
GETBIT
(
flags
,
7
);
fOwnStat
=
GETBIT
(
flags
,
8
);
fProt
=
GETBIT
(
flags
,
9
);
iSize
=
GETBIT
(
flags
,
10
);
iTypeTxt
=
GETBITS
(
flags
,
11
,
13
);
fRecalc
=
GETBIT
(
flags
,
14
);
fHasListBox
=
GETBIT
(
flags
,
15
);
cch_field
=
reader
->
ReadUInt16
();
hps
=
reader
->
ReadUInt16
();
xstzName
=
readXstz
(
reader
);
xstzTextDef
=
readXstz
(
reader
);
wDef
=
reader
->
ReadUInt16
();
xstzTextFormat
=
readXstz
(
reader
);
xstzHelpText
=
readXstz
(
reader
);
xstzStatText
=
readXstz
(
reader
);
xstzEntryMcr
=
readXstz
(
reader
);
xstzExitMcr
=
readXstz
(
reader
);
}
FormFieldData
::
FormFieldData
(
int
type
,
const
CharacterPropertyExceptions
*
chpx
,
POLE
::
Stream
*
stream
,
bool
bOlderVersion_
)
{
binary_data_size
=
0
;
if
(
!
chpx
)
return
;
int
fc
=
-
1
;
bool
bNilPICFAndBinData
=
false
;
for
(
std
::
list
<
SinglePropertyModifier
>::
iterator
iter
=
chpx
->
grpprl
->
begin
();
iter
!=
chpx
->
grpprl
->
end
();
iter
++
)
{
switch
(
iter
->
OpCode
)
{
case
sprmCFSpec
:
{
}
break
;
case
sprmCFFldVanish
:
{
}
break
;
case
sprmCPicLocation
:
{
fc
=
FormatUtils
::
BytesToInt32
(
iter
->
Arguments
,
0
,
iter
->
argumentsSize
);
}
break
;
case
sprmCRsidText
:
{
rsid
=
FormatUtils
::
IntToFormattedWideString
(
FormatUtils
::
BytesToInt32
(
iter
->
Arguments
,
0
,
iter
->
argumentsSize
),
L"%08x"
);
}
break
;
case
sprmCFData
:
{
bNilPICFAndBinData
=
true
;
// or bPICFAndOfficeArtData - shape, pic, ole
}
break
;
}
}
if
(
fc
>=
0
&&
bNilPICFAndBinData
)
{
VirtualStreamReader
reader
(
stream
,
fc
,
bOlderVersion_
);
int
sz_stream
=
reader
.
GetSize
();
int
lcb
=
reader
.
ReadUInt32
();
int
cbHeader
=
reader
.
ReadUInt16
();
if
(
cbHeader
!=
0x44
)
return
;
//ignored
reader
.
ReadBytes
(
62
,
false
);
switch
(
type
)
{
case
1
:
HFD
.
read
(
&
reader
);
case
2
:
FFData
.
read
(
&
reader
);
break
;
default:
binary_data_size
=
lcb
-
cbHeader
;
binary_data
=
std
::
shared_ptr
<
unsigned
char
>
(
reader
.
ReadBytes
(
binary_data_size
,
true
));
break
;
}
}
}
}
ASCOfficeDocFile/DocDocxConverter/FormFieldData.h
0 → 100644
View file @
5b48a7a3
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* 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
*
*/
#pragma once
#include "IVisitable.h"
#include "CharacterPropertyExceptions.h"
#include "StructuredStorageReader.h"
#include "VirtualStreamReader.h"
namespace
DocFileFormat
{
class
FormFieldData
:
public
IVisitable
{
public:
struct
_HFD
{
bool
bExist
=
false
;
bool
fNew
=
false
;
bool
fNoHist
=
false
;
bool
fImageMap
=
false
;
bool
fLocation
=
false
;
bool
fTooltip
=
false
;
std
::
wstring
clsid
;
_UINT32
streamVersion
=
0
;
bool
hlstmfHasMoniker
=
false
;
bool
hlstmfIsAbsolute
=
false
;
bool
hlstmfSiteGaveDisplayName
=
false
;
bool
hlstmfHasLocationStr
=
false
;
bool
hlstmfHasDisplayName
=
false
;
bool
hlstmfHasGUID
=
false
;
bool
hlstmfHasCreationTime
=
false
;
bool
hlstmfHasFrameName
=
false
;
bool
hlstmfMonikerSavedAsStr
=
false
;
bool
hlstmfAbsFromGetdataRel
=
false
;
std
::
wstring
displayName
;
std
::
wstring
targetFrameName
;
std
::
wstring
moniker
;
std
::
wstring
oleMoniker_clsid
;
std
::
wstring
oleMoniker_data
;
std
::
wstring
location
;
std
::
wstring
guid
;
_UINT64
fileTime
=
0
;
void
read
(
VirtualStreamReader
*
reader
);
};
struct
_FFData
{
bool
bExist
=
false
;
_UINT32
version
=
0
;
unsigned
char
iType
=
0
;
unsigned
char
iRes
=
0
;
bool
fOwnHelp
=
false
;
bool
fOwnStat
=
false
;
bool
fProt
=
false
;
bool
iSize
=
false
;
unsigned
char
iTypeTxt
=
0
;
bool
fRecalc
=
false
;
bool
fHasListBox
=
false
;
unsigned
short
cch_field
=
0
;
unsigned
short
hps
=
0
;
std
::
wstring
xstzName
;
std
::
wstring
xstzTextDef
;
unsigned
short
wDef
=
0
;
std
::
wstring
xstzTextFormat
;
std
::
wstring
xstzHelpText
;
std
::
wstring
xstzStatText
;
std
::
wstring
xstzEntryMcr
;
std
::
wstring
xstzExitMcr
;
//STTB hsttbDropList;
void
read
(
VirtualStreamReader
*
reader
);
};
FormFieldData
(
int
type
,
const
CharacterPropertyExceptions
*
chpx
,
POLE
::
Stream
*
stream
,
bool
bOlderVersion
);
virtual
~
FormFieldData
()
{}
private:
friend
class
FormFieldDataMapping
;
std
::
wstring
name
;
std
::
wstring
rsid
;
_FFData
FFData
;
_HFD
HFD
;
std
::
shared_ptr
<
unsigned
char
>
binary_data
;
int
binary_data_size
;
};
}
ASCOfficeDocFile/DocDocxConverter/FormFieldDataMapping.h
0 → 100644
View file @
5b48a7a3
/*
* (c) Copyright Ascensio System SIA 2010-2017
*
* 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
*
*/
#pragma once
#include "ConversionContext.h"
#include "FormFieldData.h"
#include "AbstractOpenXmlMapping.h"
#include "IMapping.h"
namespace
DocFileFormat
{
class
FormFieldDataMapping
:
public
AbstractOpenXmlMapping
,
public
IMapping
{
public:
FormFieldDataMapping
(
XMLTools
::
CStringXmlWriter
*
writer
,
ConversionContext
*
context
,
IMapping
*
caller
)
:
AbstractOpenXmlMapping
(
writer
),
m_context
(
NULL
),
_caller
(
NULL
)
{
m_context
=
context
;
_caller
=
caller
;
}
virtual
void
Apply
(
IVisitable
*
visited
)
{
FormFieldData
*
ffData
=
static_cast
<
FormFieldData
*>
(
visited
);
if
(
ffData
==
NULL
)
return
;
if
(
ffData
->
FFData
.
bExist
)
{
m_pXmlWriter
->
WriteNodeBegin
(
L"w:ffData"
);
m_pXmlWriter
->
WriteNodeBegin
(
L"w:name"
,
true
);
m_pXmlWriter
->
WriteAttribute
(
L"w:val"
,
ffData
->
FFData
.
xstzName
);
m_pXmlWriter
->
WriteNodeEnd
(
L"w:name"
,
true
,
true
);
m_pXmlWriter
->
WriteNodeBegin
(
L"w:calcOnExit"
,
true
);
m_pXmlWriter
->
WriteAttribute
(
L"w:val"
,
ffData
->
FFData
.
fRecalc
);
m_pXmlWriter
->
WriteNodeEnd
(
L"w:calcOnExit"
,
true
,
true
);
m_pXmlWriter
->
WriteNodeBegin
(
L"w:textInput"
);
m_pXmlWriter
->
WriteNodeBegin
(
L"w:maxLength"
,
true
);
m_pXmlWriter
->
WriteAttribute
(
L"w:val"
,
ffData
->
FFData
.
cch_field
);
m_pXmlWriter
->
WriteNodeEnd
(
L"w:maxLength"
,
true
,
true
);
m_pXmlWriter
->
WriteNodeEnd
(
L"w:textInput"
);
m_pXmlWriter
->
WriteNodeEnd
(
L"w:ffData"
);
}
}
private:
ConversionContext
*
m_context
;
IMapping
*
_caller
;
};
}
ASCOfficeDocFile/DocDocxConverter/IVisitable.h
View file @
5b48a7a3
...
...
@@ -34,6 +34,7 @@
#include "IMapping.h"
#define GETBITS(from, numL, numH) ((from & (((1 << (numH - numL + 1)) - 1) << numL)) >> numL)
#define GETBIT(from, num) ((from & (1 << num)) != 0)
namespace
DocFileFormat
{
...
...
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/PathParser.h
View file @
5b48a7a3
...
...
@@ -53,62 +53,31 @@ namespace DocFileFormat
PathParser
(
const
unsigned
char
*
pSegmentInfo
,
unsigned
int
pSegmentInfoSize
,
const
unsigned
char
*
pVertices
,
unsigned
int
pVerticesSize
,
std
::
vector
<
_guides
>
&
guides
)
{
int
offset
=
6
;
if
((
pSegmentInfo
!=
NULL
)
&&
(
pSegmentInfoSize
>
0
))
{
int
offset
=
6
;
unsigned
short
nElems
=
FormatUtils
::
BytesToUInt16
(
pSegmentInfo
,
0
,
pSegmentInfoSize
);
unsigned
short
nElemsAlloc
=
FormatUtils
::
BytesToUInt16
(
pSegmentInfo
,
2
,
pSegmentInfoSize
);
unsigned
short
cb
=
FormatUtils
::
BytesToUInt16
(
pSegmentInfo
,
4
,
pSegmentInfoSize
);
// видимо без шапки сразу пишутся все элементы
bool
headerIs
=
((
0xfff0
!=
cb
)
&&
(
cb
>
8
)
||
nElems
>
nElemsAlloc
);
if
(
headerIs
)
{
cb
=
2
;
offset
=
0
;
nElems
=
pSegmentInfoSize
/
2
;
unsigned
short
cbElement
=
4
;
for
(
unsigned
short
i
=
0
;
i
<
nElems
;
++
i
)
{
PathSegment
oSegment
=
PathSegment
(
FormatUtils
::
BytesToUInt16
(
pSegmentInfo
+
offset
,
(
i
*
cb
),
pSegmentInfoSize
));
m_arSegments
.
push_back
(
oSegment
);
}
if
(
cb
==
0xfff0
)
cbElement
=
2
;
if
(
nElems
==
0
)
{
nElems
=
(
pSegmentInfoSize
-
offset
)
/
cbElement
;
}
else
for
(
unsigned
short
i
=
0
;
i
<
nElems
;
++
i
)
{
if
((
0xfff0
!=
cb
)
&&
(
8
!=
cb
)
&&
(
4
!=
cb
)
&&
(
2
!=
cb
))
{
cb
=
0xfff0
;
offset
=
0
;
nElems
=
pSegmentInfoSize
/
2
;
}
if
(
0xfff0
==
cb
)
{
cb
=
4
;
for
(
unsigned
short
i
=
0
;
i
<
nElems
;
++
i
)
{
PathSegment
oSegment
=
PathSegment
(
FormatUtils
::
BytesToUInt16
(
pSegmentInfo
+
offset
,
(
i
*
cb
),
pSegmentInfoSize
));
m_arSegments
.
push_back
(
oSegment
);
}
}
else
{
if
((
2
!=
cb
)
&&
(
1
!=
cb
))
cb
=
8
;
for
(
unsigned
short
i
=
0
;
i
<
nElems
;
++
i
)
{
PathSegment
oSegment
=
PathSegment
(
FormatUtils
::
BytesToInt32
(
pSegmentInfo
+
offset
,
(
i
*
cb
),
pSegmentInfoSize
));
m_arSegments
.
push_back
(
oSegment
);
}
if
((
long
)
pSegmentInfoSize
<
(
long
)(
cb
*
nElems
))
// Есть несколько файлов с мусором вместо данных
m_arSegments
.
clear
();
}
PathSegment
oSegment
=
PathSegment
(
FormatUtils
::
BytesToInt32
(
pSegmentInfo
+
offset
,
(
i
*
cbElement
),
pSegmentInfoSize
-
offset
));
m_arSegments
.
push_back
(
oSegment
);
}
if
((
long
)
pSegmentInfoSize
<
(
long
)(
cb
*
nElems
))
// Есть несколько файлов с мусором вместо данных
m_arSegments
.
clear
();
}
if
((
NULL
!=
pVertices
)
&&
(
pVerticesSize
>
0
))
...
...
@@ -117,26 +86,30 @@ namespace DocFileFormat
unsigned
short
nElemsAlloc
=
FormatUtils
::
BytesToUInt16
(
pVertices
,
2
,
pVerticesSize
);
unsigned
short
cb
=
FormatUtils
::
BytesToUInt16
(
pVertices
,
4
,
pVerticesSize
);
unsigned
short
cbElement
=
cb
;
if
(
cb
==
0xfff0
)
cbElement
=
4
;
for
(
unsigned
short
i
=
0
;
i
<
nElems
;
++
i
)
{
POINT
point
;
if
(
0xfff0
==
cb
)
if
(
cbElement
==
4
)
{
cb
=
4
;
point
.
x
=
FormatUtils
::
BytesToInt16
(
pVertices
+
6
,
(
i
*
cb
),
pVerticesSize
);
point
.
y
=
FormatUtils
::
BytesToInt16
(
pVertices
+
6
,
(
i
*
cb
)
+
(
cb
/
2
),
pVerticesSize
);
point
.
x
=
FormatUtils
::
BytesToInt16
(
pVertices
+
offset
,
(
i
*
cbElement
),
pVerticesSize
-
offset
);
point
.
y
=
FormatUtils
::
BytesToInt16
(
pVertices
+
offset
,
(
i
*
cbElement
)
+
(
cbElement
/
2
),
pVerticesSize
-
offset
);
}
else
{
point
.
x
=
FormatUtils
::
BytesToInt32
(
pVertices
+
6
,
(
i
*
cb
),
pVerticesSize
);
point
.
y
=
FormatUtils
::
BytesToInt32
(
pVertices
+
6
,
(
i
*
cb
)
+
(
cb
/
2
),
pVerticesSize
);
point
.
x
=
FormatUtils
::
BytesToInt32
(
pVertices
+
offset
,
(
i
*
cbElement
),
pVerticesSize
-
offset
);
point
.
y
=
FormatUtils
::
BytesToInt32
(
pVertices
+
offset
,
(
i
*
cbElement
)
+
(
cbElement
/
2
),
pVerticesSize
-
offset
);
}
LONG
lMinF
=
(
LONG
)
0x80000000
;
if
(
lMinF
<=
point
.
x
)
{
int
index
=
(
DWORD
)
point
.
x
-
0x80000000
;
if
(
index
>=
0
&&
index
<
(
int
)
guides
.
size
())
if
(
index
>=
0
&&
index
<
guides
.
size
())
{
point
.
x
=
guides
[
index
].
param3
;
}
...
...
@@ -144,7 +117,7 @@ namespace DocFileFormat
if
(
lMinF
<=
point
.
y
)
{
int
index
=
(
DWORD
)
point
.
y
-
0x80000000
;
if
(
index
>=
0
&&
index
<
(
int
)
guides
.
size
())
if
(
index
>=
0
&&
index
<
guides
.
size
())
{
point
.
y
=
guides
[
index
].
param3
;
}
...
...
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/ShapeOptions.h
View file @
5b48a7a3
...
...
@@ -597,16 +597,12 @@ namespace DocFileFormat
virtual
~
ShapeOptions
()
{
//for (std::vector<OptionEntry>::iterator iter = Options.begin(); iter != Options.end(); ++iter)
// RELEASEARRAYOBJECTS( iter->opComplex );
}
ShapeOptions
(
IBinaryReader
*
_reader
,
unsigned
int
size
,
unsigned
int
typeCode
,
unsigned
int
version
,
unsigned
int
instance
)
:
Record
(
_reader
,
size
,
typeCode
,
version
,
instance
)
{
long
pos
=
Reader
->
GetPosition
();
//instance is the count of properties stored in this record
//parse the flags and the simple values
for
(
unsigned
int
i
=
0
;
i
<
instance
;
++
i
)
{
...
...
@@ -621,9 +617,7 @@ namespace DocFileFormat
Options
.
push_back
(
entry
);
}
//parse the complex values
//these values are stored directly at the end
//of the OptionEntry arry, sorted by pid
//parse the complex values & sorted by pid
for
(
unsigned
int
i
=
0
;
i
<
instance
;
++
i
)
{
if
(
Options
[
i
]
->
fComplex
&&
Options
[
i
]
->
op
>
0
)
...
...
ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.cpp
View file @
5b48a7a3
...
...
@@ -43,6 +43,7 @@
#include "MainDocumentMapping.h"
#include "OleObjectMapping.h"
#include "VMLPictureMapping.h"
#include "FormFieldDataMapping.h"
#include "../../DesktopEditor/common/File.h"
#include "../../DesktopEditor/common/Directory.h"
...
...
@@ -144,9 +145,9 @@ namespace DocFileFormat
{
if
(
docFile
==
NULL
)
return
S_FALSE
;
POLE
::
Storage
*
storageOut
=
new
POLE
::
Storage
(
fileName
.
c_str
());
POLE
::
Storage
*
storageOut
=
new
POLE
::
Storage
(
fileName
.
c_str
());
if
(
storageOut
==
NULL
)
return
S_FALSE
;
if
(
storageOut
->
open
(
true
,
true
)
==
false
)
{
delete
storageOut
;
...
...
ASCOfficeDocFile/DocDocxConverter/RevisionData.cpp
View file @
5b48a7a3
...
...
@@ -40,19 +40,13 @@ namespace DocFileFormat
RELEASEOBJECT
(
Changes
);
}
/*========================================================================================================*/
RevisionData
::
RevisionData
()
:
Dttm
(),
Isbt
(
0
),
Type
(
NoRevision
),
Changes
(
NULL
),
RsidDel
(
0
),
RsidProp
(
0
),
Rsid
(
0
)
{
this
->
Changes
=
new
std
::
list
<
SinglePropertyModifier
>
();
}
/*========================================================================================================*/
/// Collects the revision data of a CHPX
RevisionData
::
RevisionData
(
CharacterPropertyExceptions
*
chpx
)
:
Dttm
(),
Isbt
(
0
),
Type
(
NoRevision
),
Changes
(
NULL
),
RsidDel
(
0
),
RsidProp
(
0
),
Rsid
(
0
)
RevisionData
::
RevisionData
(
CharacterPropertyExceptions
*
chpx
)
:
Dttm
(),
Isbt
(
0
),
Type
(
NoRevision
),
Changes
(
NULL
),
RsidDel
(
0
),
RsidProp
(
0
),
Rsid
(
0
)
{
bool
collectRevisionData
=
true
;
this
->
Changes
=
new
std
::
list
<
SinglePropertyModifier
>
();
...
...
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
View file @
5b48a7a3
...
...
@@ -288,6 +288,7 @@ namespace DocFileFormat
int
ndyTextBottom
=
-
1
;
bool
bHavePath
=
false
;
int
nShapePath
=
-
1
;
int
nAdjValues
=
0
;
int
nLTxID
=
-
1
;
...
...
@@ -361,6 +362,7 @@ namespace DocFileFormat
case
shapePath
:
{
bHavePath
=
true
;
nShapePath
=
iter
->
op
;
}
break
;
case
pVertices
:
{
...
...
@@ -1653,7 +1655,7 @@ namespace DocFileFormat
}
if
(
!
bRelV
&&
m_pSpa
)
{
appendStyleProperty
(
oStyle
,
L"mso-position-vertical-relative"
,
mapVerticalPositionRelative
(
m_pSpa
->
b
x
));
appendStyleProperty
(
oStyle
,
L"mso-position-vertical-relative"
,
mapVerticalPositionRelative
(
m_pSpa
->
b
y
));
}
if
(
!
m_isInlineShape
&&
!
bZIndex
)
{
...
...
@@ -2165,7 +2167,7 @@ namespace DocFileFormat
//todooo нарисовать кастомный шейп
}
else
WritePrimitiveProps
(
primitive
,
(
index
==
0
?
true
:
false
));
WritePrimitiveProps
(
primitive
,
(
index
==
0
?
true
:
false
));
if
(
primitive
->
type
==
0x0000
)
...
...
ASCOfficeDocFile/DocFormatLib/Linux/DocFormatLib.pro
View file @
5b48a7a3
...
...
@@ -94,6 +94,7 @@ SOURCES += \
..
/../
DocDocxConverter
/
VMLShapeTypeMapping
.
cpp
\
..
/../
DocDocxConverter
/
WordDocument
.
cpp
\
..
/../
DocDocxConverter
/
WordprocessingDocument
.
cpp
\
..
/../
DocDocxConverter
/
FormFieldData
.
cpp
\
..
/../
DocDocxConverter
/
OfficeDrawing
/
Record
.
cpp
\
..
/../
DocDocxConverter
/
OfficeDrawing
/
RecordFactory
.
cpp
\
..
/../
DocDocxConverter
/
OfficeDrawing
/
ShapeTypeFactory
.
cpp
...
...
ASCOfficeDocFile/DocFormatLib/Linux/docformatlib_converter.cpp
View file @
5b48a7a3
...
...
@@ -74,6 +74,7 @@
#include "../../DocDocxConverter/VMLShapeTypeMapping.cpp"
#include "../../DocDocxConverter/WordDocument.cpp"
#include "../../DocDocxConverter/WordprocessingDocument.cpp"
#include "../../DocDocxConverter/FormFieldData.cpp"
#include "../../DocDocxConverter/OfficeDrawing/Record.cpp"
#include "../../DocDocxConverter/OfficeDrawing/RecordFactory.cpp"
#include "../../DocDocxConverter/OfficeDrawing/ShapeTypeFactory.cpp"
ASCOfficeDocFile/DocFormatLib/Win32/DocFormatLib.vcproj
View file @
5b48a7a3
...
...
@@ -44,7 +44,7 @@
Name=
"VCCLCompilerTool"
Optimization=
"0"
AdditionalIncludeDirectories=
""
PreprocessorDefinitions=
"WIN32;_DEBUG;_LIB;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS"
PreprocessorDefinitions=
"WIN32;_DEBUG;_LIB;_USE_LIBXML2_READER_;LIBXML_READER_ENABLED;USE_LITE_READER;_USE_XMLLITE_READER_;
PPTX_DEF;PPT_DEF;ENABLE_PPT_TO_PPTX_CONVERT;
AVS_USE_CONVERT_PPTX_TOCUSTOM_VML;DONT_WRITE_EMBEDDED_FONTS"
MinimalRebuild=
"true"
BasicRuntimeChecks=
"3"
RuntimeLibrary=
"3"
...
...
@@ -479,6 +479,14 @@
RelativePath=
"..\..\DocDocxConverter\FormattedDiskPagePAPX.h"
>
</File>
<File
RelativePath=
"..\..\DocDocxConverter\FormFieldData.cpp"
>
</File>
<File
RelativePath=
"..\..\DocDocxConverter\FormFieldData.h"
>
</File>
<File
RelativePath=
"..\..\DocDocxConverter\Global.h"
>
...
...
@@ -1090,6 +1098,10 @@
RelativePath=
"..\..\DocDocxConverter\FootnotesMapping.h"
>
</File>
<File
RelativePath=
"..\..\DocDocxConverter\FormFieldDataMapping.h"
>
</File>
<File
RelativePath=
"..\..\DocDocxConverter\HeaderMapping.cpp"
>
...
...
ASCOfficeDocFile/DocFormatTest/DocFormatTest.cpp
View file @
5b48a7a3
...
...
@@ -29,19 +29,17 @@
* terms at http://creativecommons.org/licenses/by-sa/4.0/legalcode
*
*/
// DocFormatTest.cpp : Defines the entry point for the console application.
//
#include "../DocFormatLib/DocFormatLib.h"
#include "../../OfficeUtils/src/ASCOfficeCriticalSection.h"
#include <iostream>
#include "../../Common/DocxFormat/Source/Base/Base.h"
#include "../../DesktopEditor/common/Directory.h"
#include "../../OfficeUtils/src/OfficeUtils.h"
#include "../
../DesktopEditor/common/Directory
.h"
#include "../
DocFormatLib/DocFormatLib
.h"
#
include <string>
#
include <windows.h>
#
include <tchar.h>
#
pragma comment(lib,"Shell32.lib")
#
pragma comment(lib,"Advapi32.lib")
#
pragma comment(lib,"Rpcrt4.lib")
#if defined(_WIN64)
#pragma comment(lib, "../../build/bin/icu/win_64/icuuc.lib")
...
...
@@ -49,36 +47,34 @@
#pragma comment(lib, "../../build/bin/icu/win_32/icuuc.lib")
#endif
#pragma comment(lib, "Rpcrt4.lib")
HRESULT
convert_single
(
std
::
wstring
sSrcDoc
)
HRESULT
convert_single
(
std
::
wstring
srcFileName
)
{
HRESULT
hr
=
S_OK
;
std
::
wstring
outputDir
=
NSDirectory
::
GetFolderPath
(
s
SrcDoc
);
std
::
wstring
outputDir
=
NSDirectory
::
GetFolderPath
(
s
rcFileName
);
std
::
wstring
dstTempPath
=
NSDirectory
::
CreateDirectoryWithUniqueName
(
outputDir
);
std
::
wstring
dstPath
;
COfficeDocFile
docFile
;
docFile
.
m_sTempFolder
=
outputDir
;
bool
bMacros
=
true
;
HRESULT
hRes
=
docFile
.
LoadFromFile
(
s
SrcDoc
,
dstTempPath
,
L"password"
,
bMacros
,
NULL
);
HRESULT
hRes
=
docFile
.
LoadFromFile
(
s
rcFileName
,
dstTempPath
,
L"password"
,
bMacros
,
NULL
);
std
::
wstring
sDstDocx
;
if
(
bMacros
)
{
sDstDocx
=
sSrcDoc
+
L"-my.docm"
;
dstPath
=
srcFileName
+
L"-my.docm"
;
}
else
{
sDstDocx
=
sSrcDoc
+
L"-my.docx"
;
dstPath
=
srcFileName
+
L"-my.docx"
;
}
if
(
hRes
==
S_OK
)
{
COfficeUtils
oCOfficeUtils
(
NULL
);
hRes
=
oCOfficeUtils
.
CompressFileOrDirectory
(
dstTempPath
.
c_str
(),
sDstDocx
,
-
1
);
hRes
=
oCOfficeUtils
.
CompressFileOrDirectory
(
dstTempPath
.
c_str
(),
dstPath
,
-
1
);
}
NSDirectory
::
DeleteDirectory
(
dstTempPath
);
...
...
ASCOfficeDocFile/DocFormatTest/DocFormatTest.vcproj
View file @
5b48a7a3
...
...
@@ -442,6 +442,10 @@
RelativePath=
"..\..\Common\OfficeFileFormatChecker2.cpp"
>
</File>
<File
RelativePath=
"..\..\Common\3dParty\pole\pole.cpp"
>
</File>
<File
RelativePath=
"..\..\UnicodeConverter\UnicodeConverter.cpp"
>
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/AxisLine.h
View file @
5b48a7a3
...
...
@@ -36,8 +36,6 @@
namespace
XLS
{
// Logical representation of AxisLine record in BIFF8
class
AxisLine
:
public
BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO
(
AxisLine
)
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/ExternSheet.cpp
View file @
5b48a7a3
...
...
@@ -31,8 +31,8 @@
*/
#include "ExternSheet.h"
#include
<Logic/Biff_structures/XTI.h>
#include
<Logic/Biff_structures/BiffString.h>
#include
"../Biff_structures/XTI.h"
#include
"../Biff_structures/BiffString.h"
namespace
XLS
{
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/Biff_records/InterfaceEnd.h
View file @
5b48a7a3
...
...
@@ -36,7 +36,6 @@
namespace
XLS
{
// Logical representation of InterfaceEnd record in BIFF8
class
InterfaceEnd
:
public
BiffRecord
{
BIFF_RECORD_DEFINE_TYPE_INFO
(
InterfaceEnd
)
...
...
@@ -47,6 +46,7 @@ public:
BaseObjectPtr
clone
();
static
const
ElementType
type
=
typeInterfaceEnd
;
void
readFields
(
CFRecord
&
record
);
...
...
ASCOfficeXlsFile2/source/XlsFormat/Logic/GlobalsSubstream.cpp
View file @
5b48a7a3
...
...
@@ -625,9 +625,7 @@ void GlobalsSubstream::UpdateXti()
ExternSheet
*
extern_sheet
=
dynamic_cast
<
ExternSheet
*>
(
SUPP
->
m_ExternSheet
.
get
());
if
(
!
extern_sheet
)
continue
;
for
(
size_t
i
=
0
;
i
<
extern_sheet
->
rgXTI
.
size
();
i
++
)
for
(
size_t
i
=
0
;
extern_sheet
&&
i
<
extern_sheet
->
rgXTI
.
size
();
i
++
)
{
XTI
*
xti
=
dynamic_cast
<
XTI
*>
(
extern_sheet
->
rgXTI
[
i
].
get
());
if
(
!
xti
)
continue
;
...
...
@@ -671,9 +669,17 @@ void GlobalsSubstream::UpdateXti()
val
.
link
=
XMLSTUFF
::
xti_indexes2sheet_name
(
xti
->
itabFirst
,
xti
->
itabLast
,
info
->
rgst
,
val
.
link
);
}
}
global_info_
->
arXti
.
push_back
(
val
);
}
if
(
!
extern_sheet
&&
!
SUPP
->
m_arExternName
.
empty
())
{
GlobalWorkbookInfo
::
_xti
val
;
val
.
iSup
=
s
;
val
.
pNames
=
&
SUPP
->
arNames
;
global_info_
->
arXti
.
push_back
(
val
);
}
}
}
...
...
X2tConverter/build/Qt/X2tConverter.pri
View file @
5b48a7a3
...
...
@@ -7,7 +7,7 @@
QT -= core
QT -= gui
VERSION = 2.4.49
0
.0
VERSION = 2.4.49
2
.0
DEFINES += INTVER=$$VERSION
TARGET = x2t
...
...
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