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
150ff1fa
Commit
150ff1fa
authored
Jan 24, 2017
by
Oleg Korshul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
dd1b9ca9
Changes
6
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
477 additions
and
514 deletions
+477
-514
DocxRenderer/DocxRenderer.cpp
DocxRenderer/DocxRenderer.cpp
+171
-3
DocxRenderer/src/logic/Common.h
DocxRenderer/src/logic/Common.h
+155
-369
DocxRenderer/src/logic/ElementImage.h
DocxRenderer/src/logic/ElementImage.h
+33
-34
DocxRenderer/src/logic/ElementParagraph.h
DocxRenderer/src/logic/ElementParagraph.h
+3
-4
DocxRenderer/src/logic/ElementShape.h
DocxRenderer/src/logic/ElementShape.h
+89
-79
DocxRenderer/src/logic/FontManagerBase.h
DocxRenderer/src/logic/FontManagerBase.h
+26
-25
No files found.
DocxRenderer/DocxRenderer.cpp
View file @
150ff1fa
This diff is collapsed.
Click to expand it.
DocxRenderer/src/logic/Common.h
View file @
150ff1fa
This diff is collapsed.
Click to expand it.
DocxRenderer/src/logic/ElementImage.h
View file @
150ff1fa
#pragma once
#ifndef DOCX_RENDERER_ELEMENT_IMAGE_H
#define DOCX_RENDERER_ELEMENT_IMAGE_H
#include "Common.h"
namespace
NSDocxRenderer
{
static
_bstr_t
g_bstr_image_1
=
L"<w:r><w:pict><v:shape id=
\"\"
type=
\"\"
style=
\"
position:absolute;"
;
static
_bstr_t
g_bstr_image_2
=
L"z-index:-1;mso-position-horizontal-relative:page;mso-position-vertical-relative:page
\"
filled=
\"
f
\"
>"
;
static
_bstr_t
g_bstr_image_3
=
L"</v:shape></w:pict></w:r>"
;
static
CString
g_string_image_position
=
_T
(
"margin-left:%.2lfmm;margin-top:%.2lfmm;width:%.2lfmm;height:%.2lfmm;"
);
static
CString
g_string_image_position_rotate
=
_T
(
"margin-left:%.2lfmm;margin-top:%.2lfmm;width:%.2lfmm;height:%.2lfmm;rotation:%d;"
);
static
CString
g_string_image_rid
=
_T
(
"<v:imagedata r:id=
\"
rId%d
\"
o:title=
\"\"
/>"
);
class
CImage
:
public
CBaseItem
class
CImage
:
public
CBaseItem
{
public:
CS
tring
m_strPath
;
LONG
m_lID
;
std
::
ws
tring
m_strPath
;
int
m_lID
;
double
m_dLeft
;
double
m_dTop
;
...
...
@@ -28,18 +22,18 @@ namespace NSDocxRenderer
CImage
()
{
m_eType
=
etImage
;
m_strPath
=
_T
(
""
)
;
m_strPath
=
L""
;
m_lID
=
-
1
;
}
CImage
(
const
CImage
&
oSrc
)
{
*
this
=
oSrc
;
}
CImage
(
const
CImageInfo
&
oInfo
,
const
CS
tring
&
strDstMedia
)
CImage
(
const
CImageInfo
&
oInfo
,
const
std
::
ws
tring
&
strDstMedia
)
{
m_eType
=
etImage
;
m_strPath
=
strDstMedia
;
m_lID
=
oInfo
.
m_lID
;
m_lID
=
oInfo
.
m_nId
;
}
CImage
&
operator
=
(
const
CImage
&
oSrc
)
{
...
...
@@ -57,31 +51,36 @@ namespace NSDocxRenderer
return
*
this
;
}
virtual
void
ToXml
(
NSDocxRenderer
::
CStringWrit
er
&
oWriter
)
virtual
void
ToXml
(
NSStringUtils
::
CStringBuild
er
&
oWriter
)
{
oWriter
.
WriteString
(
g_bstr_image_1
);
oWriter
.
WriteString
(
L"<w:r><w:pict><v:shape id=
\"\"
type=
\"\"
style=
\"
position:absolute;"
);
if
(
0.0
==
m_dRotate
)
{
CString
strPosition
=
_T
(
""
);
strPosition
.
Format
(
g_string_image_position
,
m_dLeft
,
m_dTop
,
m_dWidth
,
m_dHeight
);
oWriter
.
WriteString
(
strPosition
);
}
else
oWriter
.
WriteString
(
L"margin-left:"
);
oWriter
.
AddDouble
(
m_dLeft
,
2
);
oWriter
.
WriteString
(
L"mm;margin-top:"
);
oWriter
.
AddDouble
(
m_dTop
,
2
);
oWriter
.
WriteString
(
L"mm;width:"
);
oWriter
.
AddDouble
(
m_dWidth
,
2
);
oWriter
.
WriteString
(
L"mm;height:"
);
oWriter
.
AddDouble
(
m_dHeight
,
2
);
oWriter
.
WriteString
(
L"mm;"
);
if
(
fabs
(
m_dRotate
)
>
0.01
)
{
CString
strPosition
=
_T
(
"
"
);
strPosition
.
Format
(
g_string_image_position_rotate
,
m_dLeft
,
m_dTop
,
m_dWidth
,
m_dHeight
,
(
int
)
m_dRotate
);
oWriter
.
WriteString
(
strPosition
);
oWriter
.
WriteString
(
L"rotation:
"
);
oWriter
.
AddInt
(
(
int
)
m_dRotate
);
oWriter
.
AddCharSafe
(
';'
);
}
oWriter
.
WriteString
(
g_bstr_image_2
);
oWriter
.
WriteString
(
L"z-index:-1;mso-position-horizontal-relative:page;mso-position-vertical-relative:page
\"
filled=
\"
f
\"
>"
);
CString
strRid
=
_T
(
""
);
strRid
.
Format
(
g_string_image_rid
,
10
+
m_lID
);
oWriter
.
WriteString
(
L"<v:imagedata r:id=
\"
rId"
);
oWriter
.
AddInt
(
10
+
m_lID
);
oWriter
.
WriteString
(
L"
\"
o:title=
\"\"
/>"
);
oWriter
.
WriteString
(
strRid
);
oWriter
.
WriteString
(
g_bstr_image_3
);
oWriter
.
WriteString
(
L"</v:shape></w:pict></w:r>"
);
}
};
}
\ No newline at end of file
}
#endif // DOCX_RENDERER_ELEMENT_IMAGE_H
DocxRenderer/src/logic/ElementParagraph.h
View file @
150ff1fa
#pragma once
#include "Common.h"
//#include "../../Common/DocxFormat/Source/DocxFormat/Logic/Paragraph.h"
#include "FontManager.h"
namespace
NSDocxRenderer
...
...
@@ -10,7 +9,7 @@ namespace NSDocxRenderer
// T IsBigger, IsBiggerOrEqual
template
<
typename
T
>
void
SortElements
(
CAtl
Array
<
T
*>&
oArray
)
void
SortElements
(
C
Array
<
T
*>&
oArray
)
{
int
nSize
=
(
int
)
oArray
.
GetCount
();
...
...
@@ -111,7 +110,7 @@ namespace NSDocxRenderer
static
CString
g_string_par_props_mode2
=
_T
(
"<w:pPr><w:framePr w:hAnchor=
\"
page
\"
w:vAnchor=
\"
page
\"
w:x=
\"
%d
\"
w:y=
\"
%d
\"
/></w:pPr>"
);
AVSINLINE
void
DeleteSpaces
(
CString
&
strText
)
inline
void
DeleteSpaces
(
CString
&
strText
)
{
int
nLen
=
strText
.
GetLength
();
int
nStart
=
0
;
...
...
@@ -666,4 +665,4 @@ namespace NSDocxRenderer
oWriter
.
WriteString
(
g_bstr_text_par_end
);
}
};
}
\ No newline at end of file
}
DocxRenderer/src/logic/ElementShape.h
View file @
150ff1fa
This diff is collapsed.
Click to expand it.
DocxRenderer/src/logic/FontManagerBase.h
View file @
150ff1fa
#pragma once
#ifndef DOCX_RENDERER_FMB_H
#define DOCX_RENDERER_FMB_H
#include "..\stdafx.h"
#include "StringWriter.h"
#include "..\Graphics\Structures.h"
#include "..\Graphics\Matrix.h"
#include "Common.h"
#include "../DesktopEditor/fontengine/ApplicationFonts.h"
namespace
NSFontManager
{
...
...
@@ -28,10 +27,10 @@ namespace NSFontManager
double
m_dSpaceWidthMM
;
// font params
CString
m_strFamilyName
;
CString
m_strPANOSE
;
std
::
wstring
m_strFamilyName
;
std
::
wstring
m_strPANOSE
;
LONG
m_lStyle
;
CAtlArray
<
DWORD
>
m_arSignature
;
CArray
<
DWORD
>
m_arSignature
;
bool
m_bIsFixedWidth
;
LONG
m_lAvgWidth
;
...
...
@@ -49,8 +48,8 @@ namespace NSFontManager
m_dSpaceWidthMM
=
0
;
m_strFamilyName
=
_T
(
""
)
;
m_strPANOSE
=
_T
(
""
)
;
m_strFamilyName
=
L""
;
m_strPANOSE
=
L""
;
m_lStyle
=
0
;
m_arSignature
.
RemoveAll
();
m_bIsFixedWidth
=
false
;
...
...
@@ -78,7 +77,7 @@ namespace NSFontManager
m_strFamilyName
=
oSrc
.
m_strFamilyName
;
m_strPANOSE
=
oSrc
.
m_strPANOSE
;
m_lStyle
=
oSrc
.
m_lStyle
;
m_arSignature
.
Copy
(
oSrc
.
m_arSignature
)
;
m_arSignature
=
m_arSignature
;
m_bIsFixedWidth
=
oSrc
.
m_bIsFixedWidth
;
m_lAvgWidth
=
oSrc
.
m_lAvgWidth
;
...
...
@@ -92,7 +91,7 @@ namespace NSFontManager
CFontAdvanced
m_oFont
;
BYTE
m_lRangeNum
;
BYTE
m_lRange
;
CString
m_strPickFont
;
std
::
wstring
m_strPickFont
;
LONG
m_lPickStyle
;
public:
...
...
@@ -100,7 +99,7 @@ namespace NSFontManager
{
m_lRangeNum
=
0xFF
;
m_lRange
=
0xFF
;
m_strPickFont
=
_T
(
""
)
;
m_strPickFont
=
L""
;
m_lPickStyle
=
0
;
}
CFontPickUp
(
const
CFontPickUp
&
oSrc
)
...
...
@@ -129,9 +128,9 @@ namespace NSFontManager
};
protected:
AVSGraphics
::
IASCWinFonts
*
m_pWin
Fonts
;
AVSGraphics
::
IASCFontManager
*
m_pManager
;
CString
m_strDefaultFont
;
CApplicationFonts
*
m_p
Fonts
;
CFontManager
*
m_pManager
;
std
::
wstring
m_strDefaultFont
;
public:
...
...
@@ -141,8 +140,8 @@ namespace NSFontManager
BYTE
m_pRanges
[
0xFFFF
];
BYTE
m_pRangesNums
[
0xFFFF
];
CAtlL
ist
<
CFontPickUp
>
m_arListPicUps
;
CString
m_strCurrentPickFont
;
std
::
l
ist
<
CFontPickUp
>
m_arListPicUps
;
std
::
wstring
m_strCurrentPickFont
;
LONG
m_lCurrentPictFontStyle
;
public:
...
...
@@ -303,7 +302,7 @@ namespace NSFontManager
void
LoadFontMetrics
()
{
unsigned
short
iTemp
=
0
;
m_pManager
->
GetCellAscent
(
&
iTemp
);
m_pManager
->
GetCellAscent
(
&
iTemp
);
m_oFont
.
m_dAscent
=
iTemp
;
m_pManager
->
GetCellDescent
(
&
iTemp
);
m_oFont
.
m_dDescent
=
iTemp
;
...
...
@@ -1236,7 +1235,7 @@ namespace NSFontManager
//case 31: sUCRName = "Reserved for process-internal usage"; break;
}
__force
inline
bool
GetRange
(
const
WCHAR
&
symbol
,
BYTE
&
lRangeNum
,
BYTE
&
lRange
)
inline
bool
GetRange
(
const
WCHAR
&
symbol
,
BYTE
&
lRangeNum
,
BYTE
&
lRange
)
{
lRangeNum
=
m_pRangesNums
[
symbol
];
lRange
=
m_pRanges
[
symbol
];
...
...
@@ -1244,10 +1243,10 @@ namespace NSFontManager
return
(
0xFF
!=
lRangeNum
);
}
__forceinline
void
CheckRanges
(
DWORD
&
lRange1
,
DWORD
&
lRange2
,
DWORD
&
lRange3
,
DWORD
&
lRange4
,
CString
strText
)
inline
void
CheckRanges
(
DWORD
&
lRange1
,
DWORD
&
lRange2
,
DWORD
&
lRange3
,
DWORD
&
lRange4
,
const
std
::
wstring
&
strText
)
{
int
lCount
=
strText
.
GetL
ength
();
WCHAR
*
pData
=
strText
.
GetBuffe
r
();
int
lCount
=
(
int
)
strText
.
l
ength
();
WCHAR
*
pData
=
strText
.
c_st
r
();
BYTE
lRangeNum
=
0xFF
;
BYTE
lRange
=
0xFF
;
...
...
@@ -1266,7 +1265,7 @@ namespace NSFontManager
}
}
}
__force
inline
void
CheckRanges
(
DWORD
&
lRange1
,
DWORD
&
lRange2
,
DWORD
&
lRange3
,
DWORD
&
lRange4
,
BYTE
&
lRangeNum
,
BYTE
&
lRange
)
inline
void
CheckRanges
(
DWORD
&
lRange1
,
DWORD
&
lRange2
,
DWORD
&
lRange3
,
DWORD
&
lRange4
,
BYTE
&
lRangeNum
,
BYTE
&
lRange
)
{
if
(
0
==
lRangeNum
)
lRange1
|=
1
<<
lRange
;
...
...
@@ -1371,4 +1370,6 @@ namespace NSFontManager
return
true
;
}
};
};
\ No newline at end of file
};
#endif // DOCX_RENDERER_FMB_H
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