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
daf44553
Commit
daf44553
authored
Aug 28, 2016
by
ElenaSubbotina
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
DocFormatReader - small refactoring
parent
1fc824db
Changes
52
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
52 changed files
with
431 additions
and
307 deletions
+431
-307
ASCOfficeDocFile/Common/FormatUtils.h
ASCOfficeDocFile/Common/FormatUtils.h
+30
-23
ASCOfficeDocFile/Common/XmlTools.h
ASCOfficeDocFile/Common/XmlTools.h
+149
-22
ASCOfficeDocFile/DocDocxConverter/AbstractOpenXmlMapping.h
ASCOfficeDocFile/DocDocxConverter/AbstractOpenXmlMapping.h
+4
-4
ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.cpp
...ceDocFile/DocDocxConverter/CharacterPropertiesMapping.cpp
+7
-5
ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.h
...ficeDocFile/DocDocxConverter/CharacterPropertiesMapping.h
+2
-2
ASCOfficeDocFile/DocDocxConverter/ContentTypes.h
ASCOfficeDocFile/DocDocxConverter/ContentTypes.h
+2
-2
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
+3
-3
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h
+1
-1
ASCOfficeDocFile/DocDocxConverter/FontTableMapping.cpp
ASCOfficeDocFile/DocDocxConverter/FontTableMapping.cpp
+1
-1
ASCOfficeDocFile/DocDocxConverter/LanguageIdMapping.cpp
ASCOfficeDocFile/DocDocxConverter/LanguageIdMapping.cpp
+1
-1
ASCOfficeDocFile/DocDocxConverter/LanguageIdMapping.h
ASCOfficeDocFile/DocDocxConverter/LanguageIdMapping.h
+1
-1
ASCOfficeDocFile/DocDocxConverter/MemoryStream.h
ASCOfficeDocFile/DocDocxConverter/MemoryStream.h
+0
-10
ASCOfficeDocFile/DocDocxConverter/NumberingMapping.cpp
ASCOfficeDocFile/DocDocxConverter/NumberingMapping.cpp
+2
-2
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/MetafilePictBlip.h
...DocFile/DocDocxConverter/OfficeDrawing/MetafilePictBlip.h
+1
-1
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/ShapeType.h
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/ShapeType.h
+1
-1
ASCOfficeDocFile/DocDocxConverter/OleObjectMapping.h
ASCOfficeDocFile/DocDocxConverter/OleObjectMapping.h
+1
-1
ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.cpp
ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.cpp
+61
-65
ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.h
ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.h
+0
-2
ASCOfficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.cpp
...ceDocFile/DocDocxConverter/ParagraphPropertiesMapping.cpp
+2
-2
ASCOfficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.h
...ficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.h
+2
-2
ASCOfficeDocFile/DocDocxConverter/PropertiesMapping.cpp
ASCOfficeDocFile/DocDocxConverter/PropertiesMapping.cpp
+1
-1
ASCOfficeDocFile/DocDocxConverter/PropertiesMapping.h
ASCOfficeDocFile/DocDocxConverter/PropertiesMapping.h
+3
-4
ASCOfficeDocFile/DocDocxConverter/RGBColor.h
ASCOfficeDocFile/DocDocxConverter/RGBColor.h
+23
-20
ASCOfficeDocFile/DocDocxConverter/SectionPropertiesMapping.cpp
...ficeDocFile/DocDocxConverter/SectionPropertiesMapping.cpp
+1
-4
ASCOfficeDocFile/DocDocxConverter/SectionPropertiesMapping.h
ASCOfficeDocFile/DocDocxConverter/SectionPropertiesMapping.h
+1
-1
ASCOfficeDocFile/DocDocxConverter/SettingsMapping.h
ASCOfficeDocFile/DocDocxConverter/SettingsMapping.h
+1
-1
ASCOfficeDocFile/DocDocxConverter/SprmTDefTable.h
ASCOfficeDocFile/DocDocxConverter/SprmTDefTable.h
+0
-2
ASCOfficeDocFile/DocDocxConverter/StyleSheetMapping.cpp
ASCOfficeDocFile/DocDocxConverter/StyleSheetMapping.cpp
+1
-1
ASCOfficeDocFile/DocDocxConverter/TableCellPropertiesMapping.cpp
...ceDocFile/DocDocxConverter/TableCellPropertiesMapping.cpp
+1
-1
ASCOfficeDocFile/DocDocxConverter/TableCellPropertiesMapping.h
...ficeDocFile/DocDocxConverter/TableCellPropertiesMapping.h
+1
-1
ASCOfficeDocFile/DocDocxConverter/TablePropertiesMapping.cpp
ASCOfficeDocFile/DocDocxConverter/TablePropertiesMapping.cpp
+1
-1
ASCOfficeDocFile/DocDocxConverter/TablePropertiesMapping.h
ASCOfficeDocFile/DocDocxConverter/TablePropertiesMapping.h
+1
-1
ASCOfficeDocFile/DocDocxConverter/TableRowPropertiesMapping.cpp
...iceDocFile/DocDocxConverter/TableRowPropertiesMapping.cpp
+1
-1
ASCOfficeDocFile/DocDocxConverter/TableRowPropertiesMapping.h
...fficeDocFile/DocDocxConverter/TableRowPropertiesMapping.h
+1
-1
ASCOfficeDocFile/DocDocxConverter/TextboxMapping.cpp
ASCOfficeDocFile/DocDocxConverter/TextboxMapping.cpp
+5
-6
ASCOfficeDocFile/DocDocxConverter/TextboxMapping.h
ASCOfficeDocFile/DocDocxConverter/TextboxMapping.h
+2
-2
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp
+1
-1
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.h
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.h
+1
-1
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
+10
-11
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.h
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.h
+2
-2
ASCOfficeDocFile/DocDocxConverter/VMLShapeTypeMapping.cpp
ASCOfficeDocFile/DocDocxConverter/VMLShapeTypeMapping.cpp
+1
-1
ASCOfficeDocFile/DocDocxConverter/VMLShapeTypeMapping.h
ASCOfficeDocFile/DocDocxConverter/VMLShapeTypeMapping.h
+1
-1
ASCOfficeDocFile/DocDocxConverter/WordDocument.cpp
ASCOfficeDocFile/DocDocxConverter/WordDocument.cpp
+3
-2
ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.cpp
ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.cpp
+28
-26
ASCOfficeDocFile/DocFormatLib/DocFormatLib.cpp
ASCOfficeDocFile/DocFormatLib/DocFormatLib.cpp
+0
-3
ASCOfficePPTFile/PPTFormatLib/Reader/ReadStructures.h
ASCOfficePPTFile/PPTFormatLib/Reader/ReadStructures.h
+12
-10
ASCOfficePPTXFile/Editor/Drawing/Attributes.h
ASCOfficePPTXFile/Editor/Drawing/Attributes.h
+5
-5
ASCOfficePPTXFile/Editor/Drawing/Metric.h
ASCOfficePPTXFile/Editor/Drawing/Metric.h
+4
-1
ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/CustomGeomShape.h
...ditor/Drawing/Shapes/BaseShape/PPTShape/CustomGeomShape.h
+3
-11
ASCOfficePPTXFile/Editor/XmlWriter.h
ASCOfficePPTXFile/Editor/XmlWriter.h
+32
-32
DesktopEditor/common/Directory.h
DesktopEditor/common/Directory.h
+12
-0
X2tConverter/src/ASCConverters.cpp
X2tConverter/src/ASCConverters.cpp
+1
-1
No files found.
ASCOfficeDocFile/Common/FormatUtils.h
View file @
daf44553
...
...
@@ -41,25 +41,25 @@
#include <set>
#include <map>
#include <limits.h>
#include <math.h>
#include "utf8.h"
#if defined(_WIN32) || defined(_WIN64)
#include <atlbase
.h>
#include <atlst
r.h>
#include <windows
.h>
#include <tcha
r.h>
#else
#include "../../DesktopEditor/common/ASCVariant.h"
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
//
#include "../../DesktopEditor/common/ASCVariant.h"
//
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
#include "../../DesktopEditor/common/Types.h"
#include "../../Common/DocxFormat/Source/XML/stringcommon.h"
#include "../../Common/DocxFormat/Source/Base/unicode_util.h"
#include "../../UnicodeConverter/UnicodeConverter.h"
#include <boost/format.hpp>
namespace
DocFormatUtils
{
typedef
unsigned
char
Bool8
;
...
...
@@ -768,10 +768,11 @@ namespace DocFormatUtils
static
inline
std
::
wstring
IntToWideString
(
int
value
)
{
CString
strValue
;
strValue
.
Format
(
_T
(
"%d"
),
value
);
wchar_t
sVal
[
32
]
=
{};
_itow
(
value
,
sVal
,
10
);
std
::
wstring
strValue
;
return
string2std_string
(
strValue
);
return
std
::
wstring
(
sVal
);
}
static
inline
std
::
wstring
DoubleToWideString
(
double
value
)
{
...
...
@@ -827,29 +828,35 @@ namespace DocFormatUtils
// wchar_t strValue[size] = _T( "\0" );
// if ( format != NULL )
// {
if
(
format
==
NULL
)
return
L""
;
// swprintf_s( strValue, size, format, value );
// }
CString
format_str
;
format_str
.
Format
(
format
,
value
);
//
//
}
//
CString format_str;
//
format_str.Format(format , value);
return
string2std_string
(
format_str
);
std
::
wstringstream
sstream
;
sstream
<<
boost
::
wformat
(
format
)
%
value
;
return
sstream
.
str
();
//return string2std_string( format_str );
}
static
inline
std
::
wstring
DoubleToFormattedWideString
(
double
value
,
wchar_t
*
format
)
{
std
::
wstring
wstr
;
if
(
format
==
NULL
)
return
L""
;
//std::wstring wstr;
if
(
format
!=
NULL
)
{
CString
strValue
;
strValue
.
Format
(
format
,
value
);
//
if ( format != NULL )
//
{
//
CString strValue;
//
strValue.Format(format, value);
wstr
=
string2std_string
(
strValue
);
}
//
wstr = string2std_string( strValue );
//
}
return
wstr
;
//return wstr;
std
::
wstringstream
sstream
;
sstream
<<
boost
::
wformat
(
format
)
%
value
;
return
sstream
.
str
();
}
static
inline
void
SetBytes
(
unsigned
char
*
bytes
,
int
value
)
...
...
ASCOfficeDocFile/Common/XmlTools.h
View file @
daf44553
...
...
@@ -34,14 +34,14 @@
#include <string>
#include <map>
#include <list>
//
//#if defined(_WIN32) || defined(_WIN64)
//#else
// #include "../../DesktopEditor/common/ASCVariant.h"
// #include "../../Common/DocxFormat/Source/Base/ASCString.h"
//#endif
#if defined(_WIN32) || defined(_WIN64)
#include <atlbase.h>
#include <atlstr.h>
#else
#include "../../DesktopEditor/common/ASCVariant.h"
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
#include "../../DesktopEditor/Common/File.h"
inline
static
std
::
wstring
ReplaceString
(
std
::
wstring
subject
,
const
std
::
wstring
&
search
,
const
std
::
wstring
&
replace
)
{
...
...
@@ -118,12 +118,12 @@ namespace XMLTools
std
::
basic_string
<
T
>
GetXMLString
()
{
std
::
basic_string
<
T
>
xmlString
(
_T
(
""
)
);
std
::
basic_string
<
T
>
xmlString
(
L""
);
xmlString
+=
m_Name
;
xmlString
+=
std
::
basic_string
<
T
>
(
_T
(
"=
\"
"
)
);
xmlString
+=
std
::
basic_string
<
T
>
(
L"=
\"
"
);
xmlString
+=
m_Value
;
xmlString
+=
std
::
basic_string
<
T
>
(
_T
(
"
\"
"
)
);
xmlString
+=
std
::
basic_string
<
T
>
(
L"
\"
"
);
return
xmlString
;
}
...
...
@@ -165,7 +165,7 @@ namespace XMLTools
/*========================================================================================================*/
XMLElement
(
const
T
*
prefix
,
const
T
*
localName
)
:
m_Name
(
std
::
basic_string
<
T
>
(
prefix
)
+
std
::
basic_string
<
T
>
(
_T
(
":"
)
)
+
std
::
basic_string
<
T
>
(
localName
)
),
m_ElementText
(
_T
(
""
)
)
XMLElement
(
const
T
*
prefix
,
const
T
*
localName
)
:
m_Name
(
std
::
basic_string
<
T
>
(
prefix
)
+
std
::
basic_string
<
T
>
(
L":"
)
+
std
::
basic_string
<
T
>
(
localName
)
),
m_ElementText
(
L""
)
{
}
...
...
@@ -341,25 +341,25 @@ namespace XMLTools
std
::
basic_string
<
T
>
GetXMLString
()
{
std
::
basic_string
<
T
>
xmlString
(
_T
(
""
)
);
std
::
basic_string
<
T
>
xmlString
(
L""
);
bool
bIsNameExists
=
(
m_Name
!=
std
::
basic_string
<
T
>
(
_T
(
""
)
)
);
bool
bIsTextExists
=
(
m_ElementText
!=
std
::
basic_string
<
T
>
(
_T
(
""
)
)
);
bool
bIsNameExists
=
(
m_Name
!=
std
::
basic_string
<
T
>
(
L""
)
);
bool
bIsTextExists
=
(
m_ElementText
!=
std
::
basic_string
<
T
>
(
L""
)
);
if
(
bIsNameExists
)
{
xmlString
+=
std
::
basic_string
<
T
>
(
_T
(
"<"
)
)
+
m_Name
;
xmlString
+=
std
::
basic_string
<
T
>
(
L"<"
)
+
m_Name
;
}
if
(
(
bIsNameExists
)
&&
(
m_AttributeMap
.
size
()
>
0
)
)
{
for
(
AttMapIterator
iter
=
m_AttributeMap
.
begin
();
iter
!=
m_AttributeMap
.
end
();
iter
++
)
{
xmlString
+=
std
::
basic_string
<
T
>
(
_T
(
" "
)
);
xmlString
+=
std
::
basic_string
<
T
>
(
L" "
);
xmlString
+=
iter
->
first
;
xmlString
+=
std
::
basic_string
<
T
>
(
_T
(
"=
\"
"
)
);
xmlString
+=
std
::
basic_string
<
T
>
(
L"=
\"
"
);
xmlString
+=
iter
->
second
;
xmlString
+=
std
::
basic_string
<
T
>
(
_T
(
"
\"
"
)
);
xmlString
+=
std
::
basic_string
<
T
>
(
L"
\"
"
);
}
}
...
...
@@ -367,7 +367,7 @@ namespace XMLTools
{
if
(
bIsNameExists
)
{
xmlString
+=
std
::
basic_string
<
T
>
(
_T
(
">"
)
);
xmlString
+=
std
::
basic_string
<
T
>
(
L">"
);
}
for
(
ElementsIterator
iter
=
m_Elements
.
begin
();
iter
!=
m_Elements
.
end
();
iter
++
)
...
...
@@ -382,16 +382,16 @@ namespace XMLTools
if
(
bIsNameExists
)
{
xmlString
+=
std
::
basic_string
<
T
>
(
_T
(
"</"
)
);
xmlString
+=
std
::
basic_string
<
T
>
(
L"</"
);
xmlString
+=
m_Name
;
xmlString
+=
std
::
basic_string
<
T
>
(
_T
(
">"
)
);
xmlString
+=
std
::
basic_string
<
T
>
(
L">"
);
}
}
else
{
if
(
bIsNameExists
)
{
xmlString
+=
std
::
basic_string
<
T
>
(
_T
(
"/>"
)
);
xmlString
+=
std
::
basic_string
<
T
>
(
L"/>"
);
}
}
...
...
@@ -413,4 +413,131 @@ namespace XMLTools
}
};
class
CStringXmlWriter
{
std
::
wstring
m_str
;
public:
CStringXmlWriter
(){}
std
::
wstring
GetXmlString
()
{
return
m_str
;
}
void
SetXmlString
(
const
std
::
wstring
&
strValue
)
{
m_str
=
strValue
;
}
bool
SaveToFile
(
const
std
::
wstring
&
strFilePath
,
bool
bEncodingToUTF8
=
false
)
{
NSFile
::
CFileBinary
file
;
if
(
!
file
.
CreateFileW
(
strFilePath
))
return
false
;
if
(
bEncodingToUTF8
)
file
.
WriteStringUTF8
(
m_str
);
else
{
std
::
string
s
(
m_str
.
begin
(),
m_str
.
end
());
file
.
WriteFile
((
unsigned
char
*
)
s
.
c_str
(),
s
.
length
());
}
file
.
CloseFile
();
return
true
;
}
void
WriteString
(
const
std
::
wstring
&
strValue
)
{
m_str
+=
strValue
;
}
void
WriteInteger
(
int
Value
,
int
Base
=
10
)
{
wchar_t
str
[
33
]
=
{};
_itow
(
Value
,
str
,
Base
);
m_str
+=
str
;
}
void
WriteDouble
(
double
Value
)
{
int
*
dec
=
NULL
,
*
sign
=
NULL
;
char
*
str
=
_fcvt
(
Value
,
4
,
dec
,
sign
);
if
(
str
)
{
std
::
string
sA
(
str
);
delete
[]
str
;
m_str
+=
std
::
wstring
(
sA
.
begin
(),
sA
.
end
());
}
else
{
m_str
+=
L"0"
;
}
}
void
WriteBoolean
(
bool
Value
)
{
if
(
Value
)
m_str
+=
L"true"
;
else
m_str
+=
L"false"
;
}
void
WriteNodeBegin
(
const
std
::
wstring
&
strNodeName
,
bool
bAttributed
=
false
)
{
m_str
+=
L"<"
+
strNodeName
;
if
(
!
bAttributed
)
m_str
+=
L">"
;
}
void
WriteNodeEnd
(
const
std
::
wstring
&
strNodeName
,
bool
bEmptyNode
=
false
,
bool
bEndNode
=
true
)
{
if
(
bEmptyNode
)
{
if
(
bEndNode
)
m_str
+=
L"/>"
;
else
m_str
+=
L">"
;
}
else
m_str
+=
L"</"
+
strNodeName
+
L">"
;
}
void
WriteNode
(
const
std
::
wstring
&
strNodeName
,
const
std
::
wstring
&
strNodeValue
)
{
if
(
strNodeValue
.
length
()
==
0
)
m_str
+=
L"<"
+
strNodeName
+
L"/>"
;
else
m_str
+=
L"<"
+
strNodeName
+
L">"
+
strNodeValue
+
L"</"
+
strNodeName
+
L">"
;
}
void
WriteNode
(
const
std
::
wstring
&
strNodeName
,
int
nValue
,
int
nBase
=
10
,
const
std
::
wstring
&
strTextBeforeValue
=
L""
,
const
std
::
wstring
&
strTextAfterValue
=
L""
)
{
WriteNodeBegin
(
strNodeName
);
WriteString
(
strTextBeforeValue
);
WriteInteger
(
nValue
,
nBase
);
WriteString
(
strTextAfterValue
);
WriteNodeEnd
(
strNodeName
);
}
void
WriteNode
(
const
std
::
wstring
&
strNodeName
,
double
dValue
)
{
WriteNodeBegin
(
strNodeName
);
WriteDouble
(
dValue
);
WriteNodeEnd
(
strNodeName
);
}
void
WriteAttribute
(
const
std
::
wstring
&
strAttributeName
,
const
std
::
wstring
&
strAttributeValue
)
{
m_str
+=
L" "
+
strAttributeName
+
L"=
\"
"
+
strAttributeValue
+
L"
\"
"
;
}
void
WriteAttribute
(
const
std
::
wstring
&
strAttributeName
,
int
nValue
,
int
nBase
=
10
,
const
std
::
wstring
&
strTextBeforeValue
=
L""
,
const
std
::
wstring
&
strTextAfterValue
=
L""
)
{
WriteString
(
L" "
+
strAttributeName
+
L"="
);
WriteString
(
L"
\"
"
);
WriteString
(
strTextBeforeValue
);
WriteInteger
(
nValue
,
nBase
);
WriteString
(
strTextAfterValue
);
WriteString
(
L"
\"
"
);
}
void
WriteAttribute
(
const
std
::
wstring
&
strAttributeName
,
double
dValue
)
{
WriteString
(
L" "
+
strAttributeName
+
L"="
);
WriteString
(
L"
\"
"
);
WriteDouble
(
dValue
);
WriteString
(
L"
\"
"
);
}
};
}
ASCOfficeDocFile/DocDocxConverter/AbstractOpenXmlMapping.h
View file @
daf44553
...
...
@@ -31,19 +31,19 @@
*/
#pragma once
#include "../
../Common/DocxFormat/Source/XML/xmluti
ls.h"
#include "../
Common/XmlToo
ls.h"
namespace
DocFileFormat
{
class
AbstractOpenXmlMapping
{
public:
AbstractOpenXmlMapping
(
X
mlUtils
::
C
XmlWriter
*
pWriter
)
:
m_pXmlWriter
(
pWriter
)
AbstractOpenXmlMapping
(
X
MLTools
::
CString
XmlWriter
*
pWriter
)
:
m_pXmlWriter
(
pWriter
)
{
}
inline
X
mlUtils
::
C
XmlWriter
*
GetXMLWriter
()
inline
X
MLTools
::
CString
XmlWriter
*
GetXMLWriter
()
{
return
m_pXmlWriter
;
}
...
...
@@ -55,6 +55,6 @@ namespace DocFileFormat
protected:
X
mlUtils
::
C
XmlWriter
*
m_pXmlWriter
;
X
MLTools
::
CString
XmlWriter
*
m_pXmlWriter
;
};
}
ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.cpp
View file @
daf44553
...
...
@@ -34,7 +34,7 @@
namespace
DocFileFormat
{
CharacterPropertiesMapping
::
CharacterPropertiesMapping
(
X
mlUtils
::
C
XmlWriter
*
writer
,
WordDocument
*
doc
,
RevisionData
*
rev
,
ParagraphPropertyExceptions
*
currentPapx
,
bool
styleChpx
,
bool
isRunStyleNeeded
)
CharacterPropertiesMapping
::
CharacterPropertiesMapping
(
X
MLTools
::
CString
XmlWriter
*
writer
,
WordDocument
*
doc
,
RevisionData
*
rev
,
ParagraphPropertyExceptions
*
currentPapx
,
bool
styleChpx
,
bool
isRunStyleNeeded
)
:
PropertiesMapping
(
writer
),
_isRunStyleNeeded
(
isRunStyleNeeded
),
_isOwnRPr
(
true
),
_isRTL
(
false
)
{
_doc
=
doc
;
...
...
@@ -294,11 +294,13 @@ namespace DocFileFormat
case
sprmCCv
:
{
CString
rgbColor
;
std
::
wstringstream
sstream
;
rgbColor
.
Format
(
_T
(
"%02x%02x%02x"
),
/*R*/
iter
->
Arguments
[
0
],
/*G*/
iter
->
Arguments
[
1
],
/*B*/
iter
->
Arguments
[
2
]
);
colorVal
->
SetValue
(
rgbColor
.
GetString
()
);
sstream
<<
boost
::
wformat
(
L"%02x%02x%02x"
)
%
iter
->
Arguments
[
0
]
%
/*G*/
iter
->
Arguments
[
1
]
%
/*B*/
iter
->
Arguments
[
2
];
colorVal
->
SetValue
(
sstream
.
str
().
c_str
());
//CString rgbColor;
//rgbColor.Format( _T( "%02x%02x%02x" ), /*R*/iter->Arguments[0], /*G*/iter->Arguments[1], /*B*/iter->Arguments[2] );
//colorVal->SetValue( rgbColor.GetString() );
}
break
;
case
sprmCOldHighlight
:
...
...
ASCOfficeDocFile/DocDocxConverter/CharacterPropertiesMapping.h
View file @
daf44553
...
...
@@ -54,7 +54,7 @@ namespace DocFileFormat
class
CharacterPropertiesMapping
:
public
PropertiesMapping
,
public
IMapping
{
public:
CharacterPropertiesMapping
(
X
mlUtils
::
C
XmlWriter
*
writer
,
WordDocument
*
doc
,
RevisionData
*
rev
,
ParagraphPropertyExceptions
*
currentPapx
,
bool
styleChpx
,
bool
isRunStyleNeeded
=
true
);
CharacterPropertiesMapping
(
X
MLTools
::
CString
XmlWriter
*
writer
,
WordDocument
*
doc
,
RevisionData
*
rev
,
ParagraphPropertyExceptions
*
currentPapx
,
bool
styleChpx
,
bool
isRunStyleNeeded
=
true
);
CharacterPropertiesMapping
(
XMLTools
::
XMLElement
<
wchar_t
>*
rPr
,
WordDocument
*
doc
,
RevisionData
*
rev
,
ParagraphPropertyExceptions
*
currentPapx
,
bool
styleChpx
,
bool
isRunStyleNeeded
=
true
);
virtual
~
CharacterPropertiesMapping
();
void
Apply
(
IVisitable
*
chpx
);
...
...
@@ -74,7 +74,7 @@ namespace DocFileFormat
virtual
void
appendFlagElement
(
XMLTools
::
XMLElement
<
wchar_t
>*
node
,
const
SinglePropertyModifier
&
sprm
,
const
wchar_t
*
elementName
,
bool
unique
);
private:
X
mlUtils
::
C
XmlWriter
pRunPr
;
X
MLTools
::
CString
XmlWriter
pRunPr
;
WordDocument
*
_doc
;
XMLTools
::
XMLElement
<
wchar_t
>*
_rPr
;
...
...
ASCOfficeDocFile/DocDocxConverter/ContentTypes.h
View file @
daf44553
...
...
@@ -32,12 +32,12 @@
#pragma once
#if defined(_WIN32) || defined(_WIN64)
#include <atlbase.h>
#include <atlstr.h>
#include <tchar.h>
#else
#include "../../DesktopEditor/common/ASCVariant.h"
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
#include <string>
namespace
OpenXmlContentTypes
{
...
...
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.cpp
View file @
daf44553
...
...
@@ -42,7 +42,7 @@
namespace
DocFileFormat
{
DocumentMapping
::
DocumentMapping
(
ConversionContext
*
context
,
IMapping
*
caller
)
:
_skipRuns
(
0
),
_lastValidPapx
(
NULL
),
_lastValidSepx
(
NULL
),
_writeInstrText
(
false
),
_fldCharCounter
(
0
),
AbstractOpenXmlMapping
(
new
X
mlUtils
::
C
XmlWriter
()
),
_sectionNr
(
0
),
_footnoteNr
(
0
),
_fldCharCounter
(
0
),
AbstractOpenXmlMapping
(
new
X
MLTools
::
CString
XmlWriter
()
),
_sectionNr
(
0
),
_footnoteNr
(
0
),
_endnoteNr
(
0
),
_commentNr
(
0
),
_caller
(
caller
)
{
m_document
=
NULL
;
...
...
@@ -55,7 +55,7 @@ namespace DocFileFormat
_isTextBoxContent
=
false
;
}
DocumentMapping
::
DocumentMapping
(
ConversionContext
*
context
,
X
mlUtils
::
C
XmlWriter
*
writer
,
IMapping
*
caller
)
:
_skipRuns
(
0
),
_lastValidPapx
(
NULL
),
_lastValidSepx
(
NULL
),
_writeInstrText
(
false
),
DocumentMapping
::
DocumentMapping
(
ConversionContext
*
context
,
X
MLTools
::
CString
XmlWriter
*
writer
,
IMapping
*
caller
)
:
_skipRuns
(
0
),
_lastValidPapx
(
NULL
),
_lastValidSepx
(
NULL
),
_writeInstrText
(
false
),
_fldCharCounter
(
0
),
AbstractOpenXmlMapping
(
writer
),
_sectionNr
(
0
),
_footnoteNr
(
0
),
_endnoteNr
(
0
),
_commentNr
(
0
),
_caller
(
caller
)
{
...
...
@@ -658,7 +658,7 @@ namespace DocFileFormat
chpxObj
->
Convert
(
rPr
);
RELEASEOBJECT
(
rPr
);
}
X
mlUtils
::
C
XmlWriter
OleWriter
;
X
MLTools
::
CString
XmlWriter
OleWriter
;
VMLPictureMapping
oVmlMapper
(
m_context
,
&
OleWriter
,
true
,
_caller
);
if
(
m_document
->
bOlderVersion
)
...
...
ASCOfficeDocFile/DocDocxConverter/DocumentMapping.h
View file @
daf44553
...
...
@@ -69,7 +69,7 @@ namespace DocFileFormat
public:
DocumentMapping
(
ConversionContext
*
context
,
IMapping
*
caller
);
DocumentMapping
(
ConversionContext
*
context
,
X
mlUtils
::
C
XmlWriter
*
writer
,
IMapping
*
caller
);
DocumentMapping
(
ConversionContext
*
context
,
X
MLTools
::
CString
XmlWriter
*
writer
,
IMapping
*
caller
);
virtual
~
DocumentMapping
();
virtual
void
Apply
(
IVisitable
*
visited
)
=
0
;
...
...
ASCOfficeDocFile/DocDocxConverter/FontTableMapping.cpp
View file @
daf44553
...
...
@@ -34,7 +34,7 @@
namespace
DocFileFormat
{
FontTableMapping
::
FontTableMapping
(
ConversionContext
*
ctx
)
:
AbstractOpenXmlMapping
(
new
X
mlUtils
::
C
XmlWriter
()
)
FontTableMapping
::
FontTableMapping
(
ConversionContext
*
ctx
)
:
AbstractOpenXmlMapping
(
new
X
MLTools
::
CString
XmlWriter
()
)
{
_ctx
=
ctx
;
}
...
...
ASCOfficeDocFile/DocDocxConverter/LanguageIdMapping.cpp
View file @
daf44553
...
...
@@ -35,7 +35,7 @@
namespace
DocFileFormat
{
LanguageIdMapping
::
LanguageIdMapping
(
X
mlUtils
::
C
XmlWriter
*
pWriter
,
LanguageType
type
)
:
PropertiesMapping
(
pWriter
)
LanguageIdMapping
::
LanguageIdMapping
(
X
MLTools
::
CString
XmlWriter
*
pWriter
,
LanguageType
type
)
:
PropertiesMapping
(
pWriter
)
{
_type
=
type
;
}
...
...
ASCOfficeDocFile/DocDocxConverter/LanguageIdMapping.h
View file @
daf44553
...
...
@@ -48,7 +48,7 @@ namespace DocFileFormat
class
LanguageIdMapping
:
public
PropertiesMapping
,
public
IMapping
{
public:
LanguageIdMapping
(
X
mlUtils
::
C
XmlWriter
*
writer
,
LanguageType
type
);
LanguageIdMapping
(
X
MLTools
::
CString
XmlWriter
*
writer
,
LanguageType
type
);
LanguageIdMapping
(
XMLTools
::
XMLElement
<
wchar_t
>*
parentElement
,
LanguageType
type
);
virtual
~
LanguageIdMapping
();
void
Apply
(
IVisitable
*
lid
);
...
...
ASCOfficeDocFile/DocDocxConverter/MemoryStream.h
View file @
daf44553
...
...
@@ -150,16 +150,6 @@ public:
//------------------------------------------------------------------------------------------------------
//ATL::CAtlFile oFile;
//if (SUCCEEDED(oFile.Create(L"d:\\blop.dat",GENERIC_WRITE, FILE_SHARE_WRITE, CREATE_ALWAYS)))
//{
// DWORD nFileBuff = 0L;
// oFile.Write (pBytes, count, &nFileBuff);
// oFile.Close();
//}
//------------------------------------------------------------------------------------------------------
if
(
!
isResultNeeded
)
{
RELEASEARRAYOBJECTS
(
pBytes
);
...
...
ASCOfficeDocFile/DocDocxConverter/NumberingMapping.cpp
View file @
daf44553
...
...
@@ -34,7 +34,7 @@
namespace
DocFileFormat
{
NumberingMapping
::
NumberingMapping
(
ConversionContext
*
context
)
:
AbstractOpenXmlMapping
(
new
X
mlUtils
::
C
XmlWriter
()),
m_context
(
context
),
m_document
(
NULL
),
m_xmldocument
(
NULL
)
NumberingMapping
::
NumberingMapping
(
ConversionContext
*
context
)
:
AbstractOpenXmlMapping
(
new
X
MLTools
::
CString
XmlWriter
()),
m_context
(
context
),
m_document
(
NULL
),
m_xmldocument
(
NULL
)
{
if
(
m_context
)
{
...
...
@@ -548,7 +548,7 @@ namespace DocFileFormat
{
if
(
!
lvl
)
return
;
X
mlUtils
::
C
XmlWriter
oWriterTemp
;
//Временный writer,что не нарушать последовательность записи
X
MLTools
::
CString
XmlWriter
oWriterTemp
;
//Временный writer,что не нарушать последовательность записи
//rPr
RevisionData
rev
(
lvl
->
grpprlChpx
);
CharacterPropertiesMapping
cpMapping
(
&
oWriterTemp
,
m_document
,
&
rev
,
lvl
->
grpprlPapx
,
false
);
...
...
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/MetafilePictBlip.h
View file @
daf44553
...
...
@@ -157,7 +157,7 @@ class CMetaFileBuffer
{
public:
bool
m_bIsValid
;
CString
m_sExtension
;
std
::
wstring
m_sExtension
;
private:
BYTE
*
m_pMetaHeader
;
BYTE
*
m_pMetaFile
;
...
...
ASCOfficeDocFile/DocDocxConverter/OfficeDrawing/ShapeType.h
View file @
daf44553
...
...
@@ -33,8 +33,8 @@
#include "ProtectionBooleanProperties.h"
#include "../IVisitable.h"
#include "../../Common/XmlTools.h"
#include "../../../Common/DocxFormat/Source/XML/xmlutils.h"
#include <list>
...
...
ASCOfficeDocFile/DocDocxConverter/OleObjectMapping.h
View file @
daf44553
...
...
@@ -43,7 +43,7 @@ namespace DocFileFormat
class
OleObjectMapping
:
public
AbstractOpenXmlMapping
,
public
IMapping
{
public:
OleObjectMapping
(
X
mlUtils
::
C
XmlWriter
*
writer
,
ConversionContext
*
context
,
PictureDescriptor
*
pict
,
IMapping
*
caller
,
const
std
::
wstring
&
shapeId
)
OleObjectMapping
(
X
MLTools
::
CString
XmlWriter
*
writer
,
ConversionContext
*
context
,
PictureDescriptor
*
pict
,
IMapping
*
caller
,
const
std
::
wstring
&
shapeId
)
:
AbstractOpenXmlMapping
(
writer
),
m_context
(
NULL
),
_pict
(
NULL
),
_caller
(
NULL
),
_shapeId
(
shapeId
)
{
...
...
ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.cpp
View file @
daf44553
This diff is collapsed.
Click to expand it.
ASCOfficeDocFile/DocDocxConverter/OpenXmlPackage.h
View file @
daf44553
...
...
@@ -36,8 +36,6 @@
#include "WordDocument.h"
#include "IMapping.h"
#include "../../Common/DocxFormat/Source/XML/xmlutils.h"
namespace
DocFileFormat
{
struct
Relationship
...
...
ASCOfficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.cpp
View file @
daf44553
...
...
@@ -35,7 +35,7 @@
namespace
DocFileFormat
{
ParagraphPropertiesMapping
::
ParagraphPropertiesMapping
(
X
mlUtils
::
C
XmlWriter
*
writer
,
ConversionContext
*
context
,
WordDocument
*
document
,
CharacterPropertyExceptions
*
paraEndChpx
,
bool
isBidi
,
bool
isParagraphStyleNeeded
)
ParagraphPropertiesMapping
::
ParagraphPropertiesMapping
(
X
MLTools
::
CString
XmlWriter
*
writer
,
ConversionContext
*
context
,
WordDocument
*
document
,
CharacterPropertyExceptions
*
paraEndChpx
,
bool
isBidi
,
bool
isParagraphStyleNeeded
)
:
PropertiesMapping
(
writer
),
m_context
(
NULL
),
_pPr
(
NULL
),
_framePr
(
NULL
),
_sepx
(
NULL
),
_paraEndChpx
(
NULL
),
_sectionNr
(
0
),
m_document
(
NULL
),
_isParagraphStyleNeeded
(
isParagraphStyleNeeded
)
{
...
...
@@ -50,7 +50,7 @@ namespace DocFileFormat
_isSectionPageBreak
=
0
;
}
ParagraphPropertiesMapping
::
ParagraphPropertiesMapping
(
X
mlUtils
::
C
XmlWriter
*
writer
,
ConversionContext
*
context
,
WordDocument
*
document
,
CharacterPropertyExceptions
*
paraEndChpx
,
bool
isBidi
,
SectionPropertyExceptions
*
sepx
,
int
sectionNr
,
bool
isParagraphStyleNeeded
)
ParagraphPropertiesMapping
::
ParagraphPropertiesMapping
(
X
MLTools
::
CString
XmlWriter
*
writer
,
ConversionContext
*
context
,
WordDocument
*
document
,
CharacterPropertyExceptions
*
paraEndChpx
,
bool
isBidi
,
SectionPropertyExceptions
*
sepx
,
int
sectionNr
,
bool
isParagraphStyleNeeded
)
:
PropertiesMapping
(
writer
),
m_context
(
NULL
),
_pPr
(
NULL
),
_framePr
(
NULL
),
_sepx
(
NULL
),
_paraEndChpx
(
NULL
),
_sectionNr
(
0
),
m_document
(
NULL
),
_isParagraphStyleNeeded
(
isParagraphStyleNeeded
)
{
...
...
ASCOfficeDocFile/DocDocxConverter/ParagraphPropertiesMapping.h
View file @
daf44553
...
...
@@ -46,8 +46,8 @@ namespace DocFileFormat
class
ParagraphPropertiesMapping
:
public
PropertiesMapping
,
public
IMapping
{
public:
ParagraphPropertiesMapping
(
X
mlUtils
::
C
XmlWriter
*
writer
,
ConversionContext
*
ctx
,
WordDocument
*
document
,
CharacterPropertyExceptions
*
paraEndChpx
,
bool
isBidi
,
bool
isParagraphStyleNeeded
=
true
);
ParagraphPropertiesMapping
(
X
mlUtils
::
C
XmlWriter
*
writer
,
ConversionContext
*
ctx
,
WordDocument
*
document
,
CharacterPropertyExceptions
*
paraEndChpx
,
bool
isBidi
,
SectionPropertyExceptions
*
sepx
,
int
sectionNr
,
bool
isParagraphStyleNeeded
=
true
);
ParagraphPropertiesMapping
(
X
MLTools
::
CString
XmlWriter
*
writer
,
ConversionContext
*
ctx
,
WordDocument
*
document
,
CharacterPropertyExceptions
*
paraEndChpx
,
bool
isBidi
,
bool
isParagraphStyleNeeded
=
true
);
ParagraphPropertiesMapping
(
X
MLTools
::
CString
XmlWriter
*
writer
,
ConversionContext
*
ctx
,
WordDocument
*
document
,
CharacterPropertyExceptions
*
paraEndChpx
,
bool
isBidi
,
SectionPropertyExceptions
*
sepx
,
int
sectionNr
,
bool
isParagraphStyleNeeded
=
true
);
virtual
~
ParagraphPropertiesMapping
();
void
Apply
(
IVisitable
*
visited
);
...
...
ASCOfficeDocFile/DocDocxConverter/PropertiesMapping.cpp
View file @
daf44553
...
...
@@ -237,7 +237,7 @@ namespace DocFileFormat
}
brcTypeMapLock
.
Leave
();
}
PropertiesMapping
::
PropertiesMapping
(
X
mlUtils
::
C
XmlWriter
*
pWriter
)
:
m_pXmlWriter
(
pWriter
)
PropertiesMapping
::
PropertiesMapping
(
X
MLTools
::
CString
XmlWriter
*
pWriter
)
:
m_pXmlWriter
(
pWriter
)
{
init
();
}
...
...
ASCOfficeDocFile/DocDocxConverter/PropertiesMapping.h
View file @
daf44553
...
...
@@ -32,14 +32,13 @@
#pragma once
#include "../Common/XmlTools.h"
#include "Global.h"
#include "BorderCode.h"
#include "RGBColor.h"
#include "ShadingDescriptor.h"
#include "SinglePropertyModifier.h"
#include "../../Common/DocxFormat/Source/XML/xmlutils.h"
#include "../Win32/ASCOfficeCriticalSection.h" //for linux make inside
...
...
@@ -48,7 +47,7 @@ namespace DocFileFormat
class
PropertiesMapping
{
public:
PropertiesMapping
(
X
mlUtils
::
C
XmlWriter
*
writer
);
PropertiesMapping
(
X
MLTools
::
CString
XmlWriter
*
writer
);
protected:
static
void
init
();
...
...
@@ -72,7 +71,7 @@ namespace DocFileFormat
protected:
X
mlUtils
::
C
XmlWriter
*
m_pXmlWriter
;
X
MLTools
::
CString
XmlWriter
*
m_pXmlWriter
;
static
std
::
map
<
unsigned
char
,
std
::
wstring
>
brcTypeMap
;
static
ASCOfficeCriticalSection
brcTypeMapLock
;
...
...
ASCOfficeDocFile/DocDocxConverter/RGBColor.h
View file @
daf44553
...
...
@@ -33,15 +33,7 @@
#include "../../DesktopEditor/common/Types.h"
#if defined(_WIN32) || defined(_WIN64)
#include <atlbase.h>
#include <atlstr.h>
#else
#include "../../DesktopEditor/common/ASCVariant.h"
#include "../../Common/DocxFormat/Source/Base/ASCString.h"
#endif
#include "../../Common/DocxFormat/Source/XML/stringcommon.h"
#include <sstream>
namespace
DocFileFormat
{
...
...
@@ -69,8 +61,9 @@ namespace DocFileFormat
// wchar_t rgbColor6[7];
// wchar_t rgbColor8[9];
CString
rgbColor6
;
CString
rgbColor8
;
//CString rgbColor6;
//CString rgbColor8;
std
::
wstringstream
rgbColor6
,
rgbColor8
;
if
(
order
==
RedFirst
)
{
...
...
@@ -83,11 +76,16 @@ namespace DocFileFormat
//Alpha
this
->
Alpha
=
bytes
[
3
];
rgbColor6
.
Format
(
_T
(
"%02x%02x%02x"
),
/*R*/
this
->
Red
,
/*G*/
this
->
Green
,
/*B*/
this
->
Blue
);
rgbColor8
.
Format
(
_T
(
"%02x%02x%02x%02x"
),
/*R*/
this
->
Red
,
/*G*/
this
->
Green
,
/*B*/
this
->
Blue
,
/*A*/
this
->
Alpha
);
//
rgbColor6.Format( _T( "%02x%02x%02x" ), /*R*/this->Red, /*G*/this->Green, /*B*/this->Blue );
//
rgbColor8.Format( _T( "%02x%02x%02x%02x" ), /*R*/this->Red, /*G*/this->Green, /*B*/this->Blue, /*A*/this->Alpha );
SixDigitHexCode
=
string2std_string
(
rgbColor6
);
EightDigitHexCode
=
string2std_string
(
rgbColor8
);
//SixDigitHexCode = string2std_string( rgbColor6 );
//EightDigitHexCode = string2std_string( rgbColor8 );
rgbColor6
<<
boost
::
wformat
(
L"%02x%02x%02x"
)
%
/*R*/
this
->
Red
%
/*G*/
this
->
Green
%
/*B*/
this
->
Blue
;
rgbColor8
<<
boost
::
wformat
(
L"%02x%02x%02x%02x"
)
%
/*R*/
this
->
Red
%
/*G*/
this
->
Green
%
/*B*/
this
->
Blue
%
/*A*/
this
->
Alpha
;
SixDigitHexCode
=
rgbColor6
.
str
();
EightDigitHexCode
=
rgbColor8
.
str
();
}
else
if
(
order
==
RedLast
)
{
...
...
@@ -100,12 +98,17 @@ namespace DocFileFormat
//Alpha
this
->
Alpha
=
bytes
[
3
];
rgbColor6
.
Format
(
_T
(
"%02x%02x%02x"
),
/*R*/
this
->
Red
,
/*G*/
this
->
Green
,
/*B*/
this
->
Blue
);
rgbColor8
.
Format
(
_T
(
"%02x%02x%02x%02x"
),
/*R*/
this
->
Red
,
/*G*/
this
->
Green
,
/*B*/
this
->
Blue
,
/*A*/
this
->
Alpha
);
//
rgbColor6.Format( _T( "%02x%02x%02x" ), /*R*/this->Red, /*G*/this->Green, /*B*/this->Blue );
//
rgbColor8.Format( _T( "%02x%02x%02x%02x" ), /*R*/this->Red, /*G*/this->Green, /*B*/this->Blue, /*A*/this->Alpha );
SixDigitHexCode
=
string2std_string
(
rgbColor6
);
EightDigitHexCode
=
string2std_string
(
rgbColor8
);
}
//SixDigitHexCode = string2std_string( rgbColor6 );
//EightDigitHexCode = string2std_string( rgbColor8 );
rgbColor6
<<
boost
::
wformat
(
L"%02x%02x%02x"
)
%
/*R*/
this
->
Red
%
/*G*/
this
->
Green
%
/*B*/
this
->
Blue
;
rgbColor8
<<
boost
::
wformat
(
L"%02x%02x%02x%02x"
)
%
/*R*/
this
->
Red
%
/*G*/
this
->
Green
%
/*B*/
this
->
Blue
%
/*A*/
this
->
Alpha
;
SixDigitHexCode
=
rgbColor6
.
str
();
EightDigitHexCode
=
rgbColor8
.
str
();
}
RELEASEARRAYOBJECTS
(
bytes
);
}
...
...
ASCOfficeDocFile/DocDocxConverter/SectionPropertiesMapping.cpp
View file @
daf44553
...
...
@@ -36,7 +36,7 @@
namespace
DocFileFormat
{
// Creates a new SectionPropertiesMapping which writes the properties to the given writer
SectionPropertiesMapping
::
SectionPropertiesMapping
(
X
mlUtils
::
C
XmlWriter
*
pWriter
,
ConversionContext
*
pContext
,
int
nSelectProperties
)
:
PropertiesMapping
(
pWriter
)
SectionPropertiesMapping
::
SectionPropertiesMapping
(
X
MLTools
::
CString
XmlWriter
*
pWriter
,
ConversionContext
*
pContext
,
int
nSelectProperties
)
:
PropertiesMapping
(
pWriter
)
{
m_bDeleteNode
=
TRUE
;
m_pXmlNode
=
new
XMLTools
::
XMLElement
<
wchar_t
>
(
_T
(
"w:sectPr"
));
...
...
@@ -456,9 +456,6 @@ namespace DocFileFormat
break
;
default:
#ifdef _DEBUG
// //ATLTRACE (_T("SectionPropertiesMapping - UNKNOWN SPRM : 0x%x\n"), iter->OpCode);
#endif
break
;
}
}
...
...
ASCOfficeDocFile/DocDocxConverter/SectionPropertiesMapping.h
View file @
daf44553
...
...
@@ -156,7 +156,7 @@ namespace DocFileFormat
{
public:
// Creates a new SectionPropertiesMapping which writes the properties to the given writer
SectionPropertiesMapping
(
X
mlUtils
::
C
XmlWriter
*
writer
,
ConversionContext
*
ctx
,
int
nSelectProperties
);
SectionPropertiesMapping
(
X
MLTools
::
CString
XmlWriter
*
writer
,
ConversionContext
*
ctx
,
int
nSelectProperties
);
// Creates a new SectionPropertiesMapping which appends the properties to a given node.
SectionPropertiesMapping
(
XMLTools
::
XMLElement
<
wchar_t
>*
sectPr
,
ConversionContext
*
ctx
,
int
nSelectProperties
);
virtual
~
SectionPropertiesMapping
();
...
...
ASCOfficeDocFile/DocDocxConverter/SettingsMapping.h
View file @
daf44553
...
...
@@ -58,7 +58,7 @@ namespace DocFileFormat
{
private:
ConversionContext
*
_ctx
;
X
mlUtils
::
C
XmlWriter
m_oXmlWriter
;
X
MLTools
::
CString
XmlWriter
m_oXmlWriter
;
public:
SettingsMapping
(
ConversionContext
*
ctx
/*, OpenXmlPart targetPart*/
);
...
...
ASCOfficeDocFile/DocDocxConverter/SprmTDefTable.h
View file @
daf44553
...
...
@@ -123,8 +123,6 @@ namespace DocFileFormat
rgTc80
.
push_back
(
oTC80
);
}
// static int m = 0; //ATLTRACE(L"PUSH: %d\n", m); ++m;
break
;
}
...
...
ASCOfficeDocFile/DocDocxConverter/StyleSheetMapping.cpp
View file @
daf44553
...
...
@@ -38,7 +38,7 @@ namespace DocFileFormat
std
::
map
<
std
::
wstring
,
std
::
wstring
>
StyleSheetMapping
::
m_mapStyleId
;
ASCOfficeCriticalSection
StyleSheetMapping
::
m_mapStyleIdLock
;
StyleSheetMapping
::
StyleSheetMapping
(
ConversionContext
*
ctx
)
:
AbstractOpenXmlMapping
(
new
X
mlUtils
::
C
XmlWriter
()
)
StyleSheetMapping
::
StyleSheetMapping
(
ConversionContext
*
ctx
)
:
AbstractOpenXmlMapping
(
new
X
MLTools
::
CString
XmlWriter
()
)
{
_ctx
=
ctx
;
m_document
=
_ctx
->
_doc
;
...
...
ASCOfficeDocFile/DocDocxConverter/TableCellPropertiesMapping.cpp
View file @
daf44553
...
...
@@ -35,7 +35,7 @@
namespace
DocFileFormat
{
TableCellPropertiesMapping
::
TableCellPropertiesMapping
(
X
mlUtils
::
C
XmlWriter
*
pWriter
,
const
std
::
vector
<
short
>*
tableGrid
,
int
gridIndex
,
int
cellIndex
)
:
TableCellPropertiesMapping
::
TableCellPropertiesMapping
(
X
MLTools
::
CString
XmlWriter
*
pWriter
,
const
std
::
vector
<
short
>*
tableGrid
,
int
gridIndex
,
int
cellIndex
)
:
PropertiesMapping
(
pWriter
)
{
_width
=
0
;
...
...
ASCOfficeDocFile/DocDocxConverter/TableCellPropertiesMapping.h
View file @
daf44553
...
...
@@ -58,7 +58,7 @@ namespace DocFileFormat
public:
virtual
~
TableCellPropertiesMapping
();
TableCellPropertiesMapping
(
X
mlUtils
::
C
XmlWriter
*
pWriter
,
const
std
::
vector
<
short
>*
tableGrid
,
int
gridIndex
,
int
cellIndex
);
TableCellPropertiesMapping
(
X
MLTools
::
CString
XmlWriter
*
pWriter
,
const
std
::
vector
<
short
>*
tableGrid
,
int
gridIndex
,
int
cellIndex
);
virtual
void
Apply
(
IVisitable
*
visited
);
inline
int
GetGridSpan
()
const
...
...
ASCOfficeDocFile/DocDocxConverter/TablePropertiesMapping.cpp
View file @
daf44553
...
...
@@ -34,7 +34,7 @@
namespace
DocFileFormat
{
TablePropertiesMapping
::
TablePropertiesMapping
(
X
mlUtils
::
C
XmlWriter
*
pWriter
,
StyleSheet
*
styles
,
std
::
vector
<
short
>*
grid
,
bool
isTableStyleNeeded
)
:
TablePropertiesMapping
::
TablePropertiesMapping
(
X
MLTools
::
CString
XmlWriter
*
pWriter
,
StyleSheet
*
styles
,
std
::
vector
<
short
>*
grid
,
bool
isTableStyleNeeded
)
:
PropertiesMapping
(
pWriter
),
_tblPr
(
NULL
),
_tblGrid
(
NULL
),
_tblBorders
(
NULL
),
_grid
(
NULL
),
brcLeft
(
NULL
),
brcTop
(
NULL
),
brcBottom
(
NULL
),
brcRight
(
NULL
),
brcHorz
(
NULL
),
brcVert
(
NULL
),
_styles
(
NULL
),
_isTableStyleNeeded
(
isTableStyleNeeded
)
...
...
ASCOfficeDocFile/DocDocxConverter/TablePropertiesMapping.h
View file @
daf44553
...
...
@@ -71,7 +71,7 @@ namespace DocFileFormat
class
TablePropertiesMapping
:
public
PropertiesMapping
,
public
IMapping
{
public:
TablePropertiesMapping
(
X
mlUtils
::
C
XmlWriter
*
writer
,
StyleSheet
*
styles
,
std
::
vector
<
short
>*
grid
,
bool
isTableStyleNeeded
=
true
);
TablePropertiesMapping
(
X
MLTools
::
CString
XmlWriter
*
writer
,
StyleSheet
*
styles
,
std
::
vector
<
short
>*
grid
,
bool
isTableStyleNeeded
=
true
);
virtual
~
TablePropertiesMapping
();
void
Apply
(
IVisitable
*
visited
);
...
...
ASCOfficeDocFile/DocDocxConverter/TableRowPropertiesMapping.cpp
View file @
daf44553
...
...
@@ -35,7 +35,7 @@
namespace
DocFileFormat
{
TableRowPropertiesMapping
::
TableRowPropertiesMapping
(
X
mlUtils
::
C
XmlWriter
*
pWriter
,
CharacterPropertyExceptions
*
rowEndChpx
)
:
PropertiesMapping
(
pWriter
),
_trPr
(
NULL
),
_tblPrEx
(
NULL
),
_rowEndChpx
(
NULL
)
TableRowPropertiesMapping
::
TableRowPropertiesMapping
(
X
MLTools
::
CString
XmlWriter
*
pWriter
,
CharacterPropertyExceptions
*
rowEndChpx
)
:
PropertiesMapping
(
pWriter
),
_trPr
(
NULL
),
_tblPrEx
(
NULL
),
_rowEndChpx
(
NULL
)
{
_trPr
=
new
XMLTools
::
XMLElement
<
wchar_t
>
(
_T
(
"w:trPr"
));
_tblPrEx
=
new
XMLTools
::
XMLElement
<
wchar_t
>
(
_T
(
"w:tblPrEx"
));
...
...
ASCOfficeDocFile/DocDocxConverter/TableRowPropertiesMapping.h
View file @
daf44553
...
...
@@ -51,7 +51,7 @@ namespace DocFileFormat
CharacterPropertyExceptions
*
_rowEndChpx
;
public:
TableRowPropertiesMapping
(
X
mlUtils
::
C
XmlWriter
*
writer
,
CharacterPropertyExceptions
*
rowEndChpx
);
TableRowPropertiesMapping
(
X
MLTools
::
CString
XmlWriter
*
writer
,
CharacterPropertyExceptions
*
rowEndChpx
);
virtual
~
TableRowPropertiesMapping
();
virtual
void
Apply
(
IVisitable
*
visited
);
};
...
...
ASCOfficeDocFile/DocDocxConverter/TextboxMapping.cpp
View file @
daf44553
...
...
@@ -42,7 +42,7 @@ namespace DocFileFormat
{
int
TextboxMapping
::
TextboxCount
=
0
;
TextboxMapping
::
TextboxMapping
(
ConversionContext
*
ctx
,
int
nTBIndex
,
X
mlUtils
::
C
XmlWriter
*
writer
,
IMapping
*
caller
)
:
DocumentMapping
(
ctx
,
writer
,
caller
),
m_nTBIndex
(
0
)
TextboxMapping
::
TextboxMapping
(
ConversionContext
*
ctx
,
int
nTBIndex
,
X
MLTools
::
CString
XmlWriter
*
writer
,
IMapping
*
caller
)
:
DocumentMapping
(
ctx
,
writer
,
caller
),
m_nTBIndex
(
0
)
{
TextboxCount
++
;
m_nTBIndex
=
nTBIndex
;
...
...
@@ -50,7 +50,7 @@ namespace DocFileFormat
}
TextboxMapping
::
TextboxMapping
(
ConversionContext
*
ctx
,
X
mlUtils
::
C
XmlWriter
*
writer
,
IMapping
*
caller
)
:
DocumentMapping
(
ctx
,
writer
,
caller
),
m_nTBIndex
(
0
)
TextboxMapping
::
TextboxMapping
(
ConversionContext
*
ctx
,
X
MLTools
::
CString
XmlWriter
*
writer
,
IMapping
*
caller
)
:
DocumentMapping
(
ctx
,
writer
,
caller
),
m_nTBIndex
(
0
)
{
TextboxCount
++
;
m_nTBIndex
=
TextboxCount
-
1
;
...
...
@@ -91,15 +91,14 @@ namespace DocFileFormat
m_pXmlWriter
->
WriteNodeBegin
(
_T
(
"v:textbox"
),
true
);
if
(
m_dxTextLeft
>=
0
&&
m_dyTextTop
>=
0
&&
m_dxTextRight
>=
0
&&
m_dyTextBottom
>=
0
)
{
m_pXmlWriter
->
WriteAttribute
(
_T
(
"inset"
),
std_string2string
(
FormatUtils
::
DoubleToWideString
(
m_dxTextLeft
)
+
m_pXmlWriter
->
WriteAttribute
(
_T
(
"inset"
),
FormatUtils
::
DoubleToWideString
(
m_dxTextLeft
)
+
_T
(
"pt,"
)
+
FormatUtils
::
DoubleToWideString
(
m_dyTextTop
)
+
_T
(
"pt,"
)
+
FormatUtils
::
DoubleToWideString
(
m_dxTextRight
)
+
_T
(
"pt,"
)
+
FormatUtils
::
DoubleToWideString
(
m_dyTextBottom
)
+
_T
(
"pt"
))
)
;
_T
(
"pt,"
)
+
FormatUtils
::
DoubleToWideString
(
m_dyTextBottom
)
+
_T
(
"pt"
));
}
if
(
!
m_sTextBoxStyle
.
empty
())
{
m_pXmlWriter
->
WriteAttribute
(
_T
(
"style"
),
std_string2string
(
m_sTextBoxStyle
)
);
m_pXmlWriter
->
WriteAttribute
(
_T
(
"style"
),
m_sTextBoxStyle
);
}
m_pXmlWriter
->
WriteNodeEnd
(
_T
(
""
),
true
,
false
);
...
...
ASCOfficeDocFile/DocDocxConverter/TextboxMapping.h
View file @
daf44553
...
...
@@ -40,8 +40,8 @@ namespace DocFileFormat
{
public:
TextboxMapping
(
ConversionContext
*
ctx
,
int
textboxIndex
,
X
mlUtils
::
C
XmlWriter
*
writer
,
IMapping
*
caller
);
TextboxMapping
(
ConversionContext
*
ctx
,
X
mlUtils
::
C
XmlWriter
*
writer
,
IMapping
*
caller
);
TextboxMapping
(
ConversionContext
*
ctx
,
int
textboxIndex
,
X
MLTools
::
CString
XmlWriter
*
writer
,
IMapping
*
caller
);
TextboxMapping
(
ConversionContext
*
ctx
,
X
MLTools
::
CString
XmlWriter
*
writer
,
IMapping
*
caller
);
virtual
~
TextboxMapping
();
virtual
void
Apply
(
IVisitable
*
visited
);
...
...
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.cpp
View file @
daf44553
...
...
@@ -201,7 +201,7 @@ namespace DocFileFormat
}
}
VMLPictureMapping
::
VMLPictureMapping
(
ConversionContext
*
ctx
,
X
mlUtils
::
C
XmlWriter
*
writer
,
bool
olePreview
,
IMapping
*
caller
,
bool
isInlinePicture
)
:
PropertiesMapping
(
writer
)
VMLPictureMapping
::
VMLPictureMapping
(
ConversionContext
*
ctx
,
X
MLTools
::
CString
XmlWriter
*
writer
,
bool
olePreview
,
IMapping
*
caller
,
bool
isInlinePicture
)
:
PropertiesMapping
(
writer
)
{
m_ctx
=
ctx
;
m_isOlePreview
=
olePreview
;
...
...
ASCOfficeDocFile/DocDocxConverter/VMLPictureMapping.h
View file @
daf44553
...
...
@@ -51,7 +51,7 @@ namespace DocFileFormat
class
VMLPictureMapping
:
public
PropertiesMapping
,
public
IMapping
{
public:
VMLPictureMapping
(
ConversionContext
*
ctx
,
X
mlUtils
::
C
XmlWriter
*
writer
,
bool
olePreview
,
IMapping
*
caller
,
bool
isInlinePicture
=
false
);
VMLPictureMapping
(
ConversionContext
*
ctx
,
X
MLTools
::
CString
XmlWriter
*
writer
,
bool
olePreview
,
IMapping
*
caller
,
bool
isInlinePicture
=
false
);
virtual
~
VMLPictureMapping
();
virtual
void
Apply
(
IVisitable
*
visited
);
std
::
wstring
GetShapeId
()
const
;
...
...
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.cpp
View file @
daf44553
...
...
@@ -56,9 +56,11 @@
#include "../../DesktopEditor/common/String.h"
#include "../Common/FormatUtils.h"
namespace
DocFileFormat
{
VMLShapeMapping
::
VMLShapeMapping
(
ConversionContext
*
pConv
,
X
mlUtils
::
C
XmlWriter
*
pWriter
,
Spa
*
pSpa
,
PictureDescriptor
*
pPicture
,
IMapping
*
pCaller
,
bool
isInlineShape
)
:
PropertiesMapping
(
pWriter
)
VMLShapeMapping
::
VMLShapeMapping
(
ConversionContext
*
pConv
,
X
MLTools
::
CString
XmlWriter
*
pWriter
,
Spa
*
pSpa
,
PictureDescriptor
*
pPicture
,
IMapping
*
pCaller
,
bool
isInlineShape
)
:
PropertiesMapping
(
pWriter
)
{
m_isInlineShape
=
isInlineShape
;
m_isBullete
=
false
;
...
...
@@ -281,7 +283,7 @@ namespace DocFileFormat
std
::
wstring
adjValues
[
8
];
ShadowStyleBooleanProperties
shadowBoolean
(
0
);
std
::
vector
<
CString
>
arrInscribe
;
std
::
vector
<
std
::
wstring
>
arrInscribe
;
std
::
list
<
OptionEntry
>::
const_iterator
end
=
options
.
end
();
for
(
std
::
list
<
OptionEntry
>::
const_iterator
iter
=
options
.
begin
();
iter
!=
end
;
++
iter
)
...
...
@@ -422,8 +424,7 @@ namespace DocFileFormat
case
lineWidth
:
{
EmuValue
eLineWidth
((
int
)
iter
->
op
);
CString
sWidth
;
sWidth
.
Format
(
_T
(
"%fpt"
),
eLineWidth
.
ToPoints
());
m_pXmlWriter
->
WriteAttribute
(
_T
(
"strokeweight"
),
sWidth
);
m_pXmlWriter
->
WriteAttribute
(
_T
(
"strokeweight"
),
FormatUtils
::
DoubleToWideString
(
eLineWidth
.
ToPoints
())
+
_T
(
"pt"
));
}
break
;
case
lineDashing
:
{
...
...
@@ -1304,8 +1305,6 @@ namespace DocFileFormat
top
=
TwipsValue
((
pSpa
->
yaBottom
+
pSpa
->
yaTop
)
*
0.5
-
(
pSpa
->
xaRight
-
pSpa
->
xaLeft
)
*
0.5
);
}
// //ATLTRACE (L"left : %f, top : %f\n", left.ToPoints(), top.ToPoints());
appendStyleProperty
(
style
,
_T
(
"margin-left"
),
(
FormatUtils
::
DoubleToWideString
(
left
.
ToPoints
())
+
std
::
wstring
(
_T
(
"pt"
)
)
));
appendStyleProperty
(
style
,
_T
(
"margin-top"
),
(
FormatUtils
::
DoubleToWideString
(
top
.
ToPoints
())
+
std
::
wstring
(
_T
(
"pt"
)
)
));
appendStyleProperty
(
style
,
_T
(
"width"
),
(
FormatUtils
::
DoubleToWideString
(
width
.
ToPoints
())
+
std
::
wstring
(
_T
(
"pt"
)
)
));
...
...
@@ -1936,7 +1935,7 @@ namespace DocFileFormat
}
//
std
::
vector
<
CS
tring
>
VMLShapeMapping
::
GetTextRectangles
(
const
OptionEntry
&
inscribe
)
const
std
::
vector
<
std
::
ws
tring
>
VMLShapeMapping
::
GetTextRectangles
(
const
OptionEntry
&
inscribe
)
const
{
MemoryStream
reader
(
inscribe
.
opComplex
,
inscribe
.
op
+
6
);
...
...
@@ -1944,7 +1943,7 @@ namespace DocFileFormat
unsigned
short
allocElems
=
reader
.
ReadUInt16
();
unsigned
short
cb
=
reader
.
ReadUInt16
();
std
::
vector
<
CS
tring
>
rectangles
;
std
::
vector
<
std
::
ws
tring
>
rectangles
;
if
(
16
!=
cb
)
return
rectangles
;
// TODO: доделать
...
...
@@ -1959,9 +1958,9 @@ namespace DocFileFormat
rc
.
right
=
reader
.
ReadInt32
();
rc
.
bottom
=
reader
.
ReadInt32
();
CString
rectangle
;
rectangle
.
Format
(
L"%d,%d,%d,%d"
,
rc
.
top
,
rc
.
left
,
rc
.
right
,
rc
.
bottom
);
rectangles
.
push_back
(
rectangle
);
std
::
wstringstream
sstream
;
sstream
<<
boost
::
wformat
(
L"%d,%d,%d,%d"
)
%
rc
.
top
%
rc
.
left
%
rc
.
right
%
rc
.
bottom
;
rectangles
.
push_back
(
sstream
.
str
()
);
}
return
rectangles
;
...
...
ASCOfficeDocFile/DocDocxConverter/VMLShapeMapping.h
View file @
daf44553
...
...
@@ -59,7 +59,7 @@ namespace DocFileFormat
{
public:
VMLShapeMapping
(
ConversionContext
*
ctx
,
X
mlUtils
::
C
XmlWriter
*
writer
,
Spa
*
pSpa
,
PictureDescriptor
*
pict
,
IMapping
*
caller
,
bool
bullet
=
false
);
VMLShapeMapping
(
ConversionContext
*
ctx
,
X
MLTools
::
CString
XmlWriter
*
writer
,
Spa
*
pSpa
,
PictureDescriptor
*
pict
,
IMapping
*
caller
,
bool
bullet
=
false
);
virtual
~
VMLShapeMapping
();
virtual
void
Apply
(
IVisitable
*
visited
);
...
...
@@ -120,7 +120,7 @@ namespace DocFileFormat
std
::
wstring
GetLineFrom
(
const
ChildAnchor
*
pAnchor
)
const
;
std
::
wstring
GetLineTo
(
const
ChildAnchor
*
pAnchor
)
const
;
std
::
vector
<
CS
tring
>
GetTextRectangles
(
const
OptionEntry
&
inscribe
)
const
;
std
::
vector
<
std
::
ws
tring
>
GetTextRectangles
(
const
OptionEntry
&
inscribe
)
const
;
private:
bool
m_isInlineShape
;
...
...
ASCOfficeDocFile/DocDocxConverter/VMLShapeTypeMapping.cpp
View file @
daf44553
...
...
@@ -36,7 +36,7 @@
namespace
DocFileFormat
{
VMLShapeTypeMapping
::
VMLShapeTypeMapping
(
X
mlUtils
::
C
XmlWriter
*
pWriter
,
bool
isInlineShape
)
:
PropertiesMapping
(
pWriter
),
_lock
(
NULL
),
_isInlineShape
(
isInlineShape
)
VMLShapeTypeMapping
::
VMLShapeTypeMapping
(
X
MLTools
::
CString
XmlWriter
*
pWriter
,
bool
isInlineShape
)
:
PropertiesMapping
(
pWriter
),
_lock
(
NULL
),
_isInlineShape
(
isInlineShape
)
{
this
->
_lock
=
new
XMLTools
::
XMLElement
<
wchar_t
>
(
_T
(
"o:lock"
)
);
appendValueAttribute
(
this
->
_lock
,
_T
(
"v:ext"
),
_T
(
"edit"
)
);
...
...
ASCOfficeDocFile/DocDocxConverter/VMLShapeTypeMapping.h
View file @
daf44553
...
...
@@ -44,7 +44,7 @@ namespace DocFileFormat
bool
_isInlineShape
;
public:
VMLShapeTypeMapping
(
X
mlUtils
::
C
XmlWriter
*
writer
,
bool
isInlineShape
=
false
);
VMLShapeTypeMapping
(
X
MLTools
::
CString
XmlWriter
*
writer
,
bool
isInlineShape
=
false
);
virtual
~
VMLShapeTypeMapping
();
virtual
void
Apply
(
IVisitable
*
visited
);
/// Returns the id of the referenced type
...
...
ASCOfficeDocFile/DocDocxConverter/WordDocument.cpp
View file @
daf44553
...
...
@@ -36,8 +36,9 @@
#include "../../ASCOfficeXlsFile2/source/XlsFormat/Logic/SummaryInformationStream/SummaryInformation.h"
#include "../../ASCOfficeXlsFile2/source/XlsFormat/Binary/CFStream.h"
#include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
#include "../../DesktopEditor/common/File.h"
#include "../../DesktopEditor/common/Directory.h"
namespace
DocFileFormat
{
...
...
@@ -450,7 +451,7 @@ namespace DocFileFormat
{
if
(
m_sTempFolder
.
empty
())
{
m_sTempFolder
=
FileSystem
::
Directory
::
GetTempPath
().
GetBuffer
();
m_sTempFolder
=
NSFile
::
CFileBinary
::
GetTempPathW
();
}
m_sTempDecryptFileName
=
m_sTempFolder
+
FILE_SEPARATOR_STR
+
L"~tempFile.doc"
;
...
...
ASCOfficeDocFile/DocDocxConverter/WordprocessingDocument.cpp
View file @
daf44553
...
...
@@ -32,10 +32,8 @@
#include "WordprocessingDocument.h"
#include "../../Common/DocxFormat/Source/SystemUtility/SystemUtility.h"
#include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
#include "../../DesktopEditor/raster/BgraFrame.h"
#include "../../DesktopEditor/Common/Directory.h"
namespace
ImageHelper
{
...
...
@@ -184,29 +182,32 @@ namespace DocFileFormat
void
WordprocessingDocument
::
SaveDocument
()
{
OOX
::
CPath
pathWord
=
CString
(
m_strOutputPath
.
c_str
())
+
FILE_SEPARATOR_STR
+
_T
(
"word"
);
FileSystem
::
Directory
::
CreateDirectory
(
pathWord
.
GetPath
()
);
std
::
wstring
pathWord
=
m_strOutputPath
+
FILE_SEPARATOR_STR
+
_T
(
"word"
)
;
//OOX::CPath pathWord = CString(m_strOutputPath.c_str()) + FILE_SEPARATOR_STR + _T( "word" );
//FileSystem::Directory::CreateDirectory( pathWord.GetPath() );
NSDirectory
::
CreateDirectoryW
(
pathWord
);
WritePackage
();
//Write main content. (word directory)
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
())
,
std
::
wstring
(
_T
(
"document.xml"
)
),
DocumentXML
);
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
())
,
std
::
wstring
(
_T
(
"fontTable.xml"
)
),
FontTableXML
);
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
())
,
std
::
wstring
(
_T
(
"styles.xml"
)
),
StyleSheetXML
);
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
())
,
std
::
wstring
(
_T
(
"footnotes.xml"
)
),
FootnotesXML
);
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
())
,
std
::
wstring
(
_T
(
"endnotes.xml"
)
),
EndnotesXML
);
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
())
,
std
::
wstring
(
_T
(
"numbering.xml"
)
),
NumberingXML
);
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
())
,
std
::
wstring
(
_T
(
"comments.xml"
)
),
CommentsXML
);
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
())
,
std
::
wstring
(
_T
(
"settings.xml"
)
),
SettingsXML
);
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
())
,
std
::
wstring
(
_T
(
"customizations.xml"
)
),
CommandTableXML
);
SaveToFile
(
pathWord
,
std
::
wstring
(
_T
(
"document.xml"
)
),
DocumentXML
);
SaveToFile
(
pathWord
,
std
::
wstring
(
_T
(
"fontTable.xml"
)
),
FontTableXML
);
SaveToFile
(
pathWord
,
std
::
wstring
(
_T
(
"styles.xml"
)
),
StyleSheetXML
);
SaveToFile
(
pathWord
,
std
::
wstring
(
_T
(
"footnotes.xml"
)
),
FootnotesXML
);
SaveToFile
(
pathWord
,
std
::
wstring
(
_T
(
"endnotes.xml"
)
),
EndnotesXML
);
SaveToFile
(
pathWord
,
std
::
wstring
(
_T
(
"numbering.xml"
)
),
NumberingXML
);
SaveToFile
(
pathWord
,
std
::
wstring
(
_T
(
"comments.xml"
)
),
CommentsXML
);
SaveToFile
(
pathWord
,
std
::
wstring
(
_T
(
"settings.xml"
)
),
SettingsXML
);
SaveToFile
(
pathWord
,
std
::
wstring
(
_T
(
"customizations.xml"
)
),
CommandTableXML
);
if
(
!
ImagesList
.
empty
())
{
OOX
::
CPath
pathMedia
=
pathWord
+
FILE_SEPARATOR_STR
+
_T
(
"media"
);
FileSystem
::
Directory
::
CreateDirectory
(
pathMedia
.
GetPath
()
);
std
::
wstring
pathMedia
=
pathWord
+
FILE_SEPARATOR_STR
+
_T
(
"media"
);
//OOX::CPath pathMedia = pathWord + FILE_SEPARATOR_STR + _T( "media" );
//FileSystem::Directory::CreateDirectory( pathMedia.GetPath() );
NSDirectory
::
CreateDirectoryW
(
pathMedia
);
int
i
=
1
;
...
...
@@ -220,12 +221,12 @@ namespace DocFileFormat
if
(
Global
::
msoblipDIB
==
iter
->
blipType
)
{
//user_manual_v52.doc
std
::
wstring
file_name
=
string2std_string
(
pathMedia
.
GetPath
())
+
FILE_SEPARATOR_STR
+
_T
(
"image"
)
+
FormatUtils
::
IntToWideString
(
i
++
);
std
::
wstring
file_name
=
pathMedia
+
FILE_SEPARATOR_STR
+
_T
(
"image"
)
+
FormatUtils
::
IntToWideString
(
i
++
);
iter
->
blipType
=
ImageHelper
::
SaveImageToFileFromDIB
(
bytes
,
iter
->
data
.
size
(),
file_name
);
}
else
{
SaveToFile
(
string2std_string
(
pathMedia
.
GetPath
())
,
std
::
wstring
(
_T
(
"image"
))
+
FormatUtils
::
IntToWideString
(
i
++
)
+
iter
->
ext
,
(
void
*
)
bytes
,
(
unsigned
int
)
iter
->
data
.
size
());
SaveToFile
(
pathMedia
,
std
::
wstring
(
_T
(
"image"
))
+
FormatUtils
::
IntToWideString
(
i
++
)
+
iter
->
ext
,
(
void
*
)
bytes
,
(
unsigned
int
)
iter
->
data
.
size
());
}
RELEASEARRAYOBJECTS
(
bytes
);
...
...
@@ -235,14 +236,15 @@ namespace DocFileFormat
if
(
!
OleObjectsList
.
empty
())
{
OOX
::
CPath
pathObjects
=
pathWord
+
FILE_SEPARATOR_STR
+
_T
(
"embeddings"
);
FileSystem
::
Directory
::
CreateDirectory
(
pathObjects
.
GetPath
());
std
::
wstring
pathObjects
=
pathWord
+
FILE_SEPARATOR_STR
+
_T
(
"embeddings"
)
;
//OOX::CPath pathObjects = pathWord + FILE_SEPARATOR_STR + _T( "embeddings" );
//FileSystem::Directory::CreateDirectory( pathObjects.GetPath());
NSDirectory
::
CreateDirectoryW
(
pathObjects
);
int
i
=
1
;
for
(
std
::
list
<
OleObjectFileStructure
>::
iterator
iter
=
OleObjectsList
.
begin
();
iter
!=
OleObjectsList
.
end
();
++
iter
)
{
std
::
wstring
fileName
=
string2std_string
(
pathObjects
.
GetPath
())
+
FILE_SEPARATOR_STR
+
_T
(
"oleObject"
)
+
FormatUtils
::
IntToWideString
(
i
++
)
+
iter
->
ext
;
std
::
wstring
fileName
=
pathObjects
+
FILE_SEPARATOR_STR
+
_T
(
"oleObject"
)
+
FormatUtils
::
IntToWideString
(
i
++
)
+
iter
->
ext
;
if
(
!
iter
->
data
.
empty
())
{
...
...
@@ -260,12 +262,12 @@ namespace DocFileFormat
for
(
std
::
list
<
std
::
wstring
>::
iterator
iter
=
HeaderXMLList
.
begin
();
iter
!=
HeaderXMLList
.
end
();
++
iter
)
{
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
())
,
(
std
::
wstring
(
_T
(
"header"
)
)
+
FormatUtils
::
IntToWideString
(
++
headersCount
)
+
std
::
wstring
(
_T
(
".xml"
)
)
),
*
iter
);
SaveToFile
(
pathWord
,
(
std
::
wstring
(
_T
(
"header"
)
)
+
FormatUtils
::
IntToWideString
(
++
headersCount
)
+
std
::
wstring
(
_T
(
".xml"
)
)
),
*
iter
);
}
for
(
std
::
list
<
std
::
wstring
>::
iterator
iter
=
FooterXMLList
.
begin
();
iter
!=
FooterXMLList
.
end
();
++
iter
)
{
SaveToFile
(
string2std_string
(
pathWord
.
GetPath
())
,
(
std
::
wstring
(
_T
(
"footer"
)
)
+
FormatUtils
::
IntToWideString
(
++
footersCount
)
+
std
::
wstring
(
_T
(
".xml"
)
)
),
*
iter
);
SaveToFile
(
pathWord
,
(
std
::
wstring
(
_T
(
"footer"
)
)
+
FormatUtils
::
IntToWideString
(
++
footersCount
)
+
std
::
wstring
(
_T
(
".xml"
)
)
),
*
iter
);
}
}
}
ASCOfficeDocFile/DocFormatLib/DocFormatLib.cpp
View file @
daf44553
...
...
@@ -32,9 +32,6 @@
#include "DocFormatLib.h"
#include "../DocDocxConverter/Converter.h"
//#include "../DocxDocConverter/FileConverter.h"
#include "../../Common/DocxFormat/Source/SystemUtility/FileSystem/Directory.h"
#include "../../OfficeUtils/src/OfficeUtils.h"
HRESULT
COfficeDocFile
::
LoadFromFile
(
const
std
::
wstring
&
docFile
,
const
std
::
wstring
&
docxDirectory
,
const
std
::
wstring
&
password
,
ProgressCallback
*
ffCallBack
)
...
...
ASCOfficePPTFile/PPTFormatLib/Reader/ReadStructures.h
View file @
daf44553
...
...
@@ -90,23 +90,26 @@ struct SFileIdCluster
}
};
#if !defined(_WIN32) && !defined (_WIN64)
struct
POINT
{
long
x
;
long
y
;
};
struct
SIZE
typedef
struct
tagPOINT
{
long
x
;
long
y
;
}
POINT
;
typedef
struct
tagSIZE
{
long
cx
;
long
cy
;
};
struct
RECT
}
SIZE
;
typedef
struct
tagRECT
{
long
left
;
long
top
;
long
right
;
long
bottom
;
};
}
RECT
;
#endif
namespace
Gdiplus
{
...
...
@@ -151,7 +154,6 @@ namespace Gdiplus
short
Checksum
;
// Checksum value for previous 10 WORDs
}
WmfPlaceableFileHeader
;
}
#endif
class
CMetaHeader
{
...
...
ASCOfficePPTXFile/Editor/Drawing/Attributes.h
View file @
daf44553
...
...
@@ -31,12 +31,12 @@
*/
#pragma once
#if defined(_WIN32) || defined(_WIN64)
#include <atlcoll.h>
#include <gdiplus.h>
#else
//
#if defined(_WIN32) || defined(_WIN64)
//
#include <atlcoll.h>
//
#include <gdiplus.h>
//
#else
#include "../../PPTXLib/Linux/PPTXFormatLib/linux_gdiplus.h"
#endif
//
#endif
#include "Metric.h"
#include "Effects.h"
...
...
ASCOfficePPTXFile/Editor/Drawing/Metric.h
View file @
daf44553
...
...
@@ -30,13 +30,16 @@
*
*/
#pragma once
#include <math.h>
#if !defined(_WIN32) && !defined(_WIN64)
#include "../../../DesktopEditor/common/ASCVariant.h"
#include "../../../Common/DocxFormat/Source/Base/ASCString.h"
#else
#include <atlbase.h>
#endif
#include <math.h>
namespace
NSPresentationEditor
{
const
double
c_dMasterUnitsToInchKoef
=
1.0
/
576
;
...
...
ASCOfficePPTXFile/Editor/Drawing/Shapes/BaseShape/PPTShape/CustomGeomShape.h
View file @
daf44553
...
...
@@ -36,13 +36,6 @@
#include "../../../Attributes.h"
#include "Formula.h"
#ifdef max
#undef max
#endif
#ifdef min
#undef min
#endif
namespace
NSCustomVML
{
using
namespace
NSPresentationEditor
;
...
...
@@ -78,7 +71,7 @@ namespace NSCustomVML
~
CSegment
()
{
}
int
Read
(
WORD
value
)
int
Read
(
WORD
value
)
//from rtf segments
{
int
repeate
=
0
;
if
(
value
>=
0x2000
&&
value
<
0x20FF
)
...
...
@@ -127,7 +120,7 @@ namespace NSCustomVML
}
return
(
std
::
max
)(
1
,
repeate
);
}
void
Read
(
POLE
::
Stream
*
pStream
)
void
Read
(
POLE
::
Stream
*
pStream
)
//from binary ms segments
{
WORD
mem
=
StreamUtils
::
ReadWORD
(
pStream
);
BYTE
type
=
mem
&
0x07
;
...
...
@@ -222,7 +215,7 @@ namespace NSCustomVML
m_nCount
=
(
mem
>>
5
)
&
0x00FF
;
}
void
Read
(
NSOfficeDrawing
::
CBinaryReader
&
oReader
)
void
Read
(
NSOfficeDrawing
::
CBinaryReader
&
oReader
)
//from binary ms segments
{
WORD
mem
=
oReader
.
ReadWORD
();
...
...
@@ -231,7 +224,6 @@ namespace NSCustomVML
{
m_eRuler
=
(
RulesType
)
type
;
m_nCount
=
(
mem
&
0x1FFF
);
//m_nCount = (WORD)GetCountPoints2(m_eRuler);
m_nCount
=
(
WORD
)
GetCountPoints2
(
m_eRuler
,
m_nCount
);
return
;
}
...
...
ASCOfficePPTXFile/Editor/XmlWriter.h
View file @
daf44553
...
...
@@ -47,15 +47,15 @@ namespace NSBinPptxRW
{
static
std
::
wstring
g_bstr_nodeopen
=
L"<"
;
static
std
::
wstring
g_bstr_nodeclose
=
L">"
;
static
std
::
wstring
g_bstr_nodeopen_slash
=
L"</"
;
static
std
::
wstring
g_bstr_nodeclose_slash
=
L"/>"
;
static
std
::
wstring
g_bstr_nodeopen_slash
=
L"</"
;
static
std
::
wstring
g_bstr_nodeclose_slash
=
L"/>"
;
static
std
::
wstring
g_bstr_node_space
=
L" "
;
static
std
::
wstring
g_bstr_node_equal
=
L"="
;
static
std
::
wstring
g_bstr_node_quote
=
L"
\"
"
;
static
std
::
wstring
g_bstr_boolean_true
=
L"true"
;
static
std
::
wstring
g_bstr_boolean_false
=
L"false"
;
static
std
::
wstring
g_bstr_boolean_true2
=
L"1"
;
static
std
::
wstring
g_bstr_boolean_false2
=
L"0"
;
static
std
::
wstring
g_bstr_boolean_false
=
L"false"
;
static
std
::
wstring
g_bstr_boolean_true2
=
L"1"
;
static
std
::
wstring
g_bstr_boolean_false2
=
L"0"
;
AVSINLINE
static
double
FABS
(
double
dVal
)
{
...
...
@@ -715,21 +715,21 @@ namespace NSBinPptxRW
m_oWriter
.
WriteString
(
g_bstr_nodeclose
);
}
#ifdef _WIN32
template
<
typename
T
>
AVSINLINE
void
WriteArray
(
const
CString
&
strName
,
const
CAtlArray
<
T
>&
arr
)
{
size_t
nCount
=
arr
.
GetCount
();
if
(
0
!=
nCount
)
{
StartNode
(
strName
);
m_oWriter
.
WriteString
(
g_bstr_nodeclose
);
for
(
size_t
i
=
0
;
i
<
nCount
;
++
i
)
arr
[
i
].
toXmlWriter
(
this
);
EndNode
(
strName
);
}
}
#endif //#ifdef _WIN32
//
#ifdef _WIN32
//
template<typename T>
//
AVSINLINE void WriteArray(const CString& strName, const CAtlArray<T>& arr)
//
{
//
size_t nCount = arr.GetCount();
//
if (0 != nCount)
//
{
//
StartNode(strName);
//
m_oWriter.WriteString(g_bstr_nodeclose);
//
for (size_t i = 0; i < nCount; ++i)
//
arr[i].toXmlWriter(this);
//
EndNode(strName);
//
}
//
}
//
#endif //#ifdef _WIN32
template
<
typename
T
>
AVSINLINE
void
WriteArray
(
const
CString
&
strName
,
const
std
::
vector
<
T
>&
arr
)
{
...
...
@@ -744,18 +744,18 @@ namespace NSBinPptxRW
}
}
#ifdef _WIN32
template
<
typename
T
>
AVSINLINE
void
WriteArray2
(
const
CAtlArray
<
T
>&
arr
)
{
size_t
nCount
=
arr
.
GetCount
();
if
(
0
!=
nCount
)
{
for
(
size_t
i
=
0
;
i
<
nCount
;
++
i
)
arr
[
i
].
toXmlWriter
(
this
);
}
}
#endif //#ifdef _WIN32
//
#ifdef _WIN32
//
template<typename T>
//
AVSINLINE void WriteArray2(const CAtlArray<T>& arr)
//
{
//
size_t nCount = arr.GetCount();
//
if (0 != nCount)
//
{
//
for (size_t i = 0; i < nCount; ++i)
//
arr[i].toXmlWriter(this);
//
}
//
}
//
#endif //#ifdef _WIN32
template
<
typename
T
>
AVSINLINE
void
WriteArray2
(
const
std
::
vector
<
T
>&
arr
)
{
...
...
DesktopEditor/common/Directory.h
View file @
daf44553
...
...
@@ -58,6 +58,18 @@
#include <dirent.h>
#endif
#ifndef FILE_SEPARATOR
#if defined(_WIN32) || defined(_WIN64)
#define FILE_SEPARATOR
#define FILE_SEPARATOR_CHAR '\\'
#define FILE_SEPARATOR_STR _T("\\")
#else
#define FILE_SEPARATOR
#define FILE_SEPARATOR_CHAR '/'
#define FILE_SEPARATOR_STR _T("/")
#endif
#endif
namespace
NSDirectory
{
#if !defined(_WIN32) && !defined (_WIN64)
...
...
X2tConverter/src/ASCConverters.cpp
View file @
daf44553
...
...
@@ -902,7 +902,7 @@ namespace NExtractTools
{
COfficeDocFile
docFile
;
docFile
.
m_sTempFolder
=
sTemp
;
long
hRes
=
docFile
.
LoadFromFile
(
sFrom
,
sTo
,
params
.
m_sPassword
?
*
params
.
m_sPassword
:
L""
,
NULL
);
long
hRes
=
docFile
.
LoadFromFile
(
sFrom
,
sTo
,
params
.
getPassword
()
,
NULL
);
if
(
AVS_ERROR_DRM
==
hRes
)
{
if
(
!
params
.
getDontSaveAdditional
())
...
...
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