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
f1d9c12f
Commit
f1d9c12f
authored
Jan 27, 2017
by
Oleg Korshul
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
change encoding to utf8
parent
30ef5a9d
Changes
10
Show whitespace changes
Inline
Side-by-side
Showing
10 changed files
with
58 additions
and
58 deletions
+58
-58
DocxRenderer/src/logic/Common.h
DocxRenderer/src/logic/Common.h
+1
-1
DocxRenderer/src/logic/Document.h
DocxRenderer/src/logic/Document.h
+9
-9
DocxRenderer/src/logic/ElementImage.h
DocxRenderer/src/logic/ElementImage.h
+1
-1
DocxRenderer/src/logic/ElementParagraph.h
DocxRenderer/src/logic/ElementParagraph.h
+7
-7
DocxRenderer/src/logic/ElementShape.h
DocxRenderer/src/logic/ElementShape.h
+2
-2
DocxRenderer/src/logic/FontManager.h
DocxRenderer/src/logic/FontManager.h
+2
-2
DocxRenderer/src/logic/FontManagerBase.h
DocxRenderer/src/logic/FontManagerBase.h
+11
-11
DocxRenderer/src/logic/Page.h
DocxRenderer/src/logic/Page.h
+16
-16
DocxRenderer/src/tmp/ASCDocxRenderer.cpp
DocxRenderer/src/tmp/ASCDocxRenderer.cpp
+1
-1
DocxRenderer/src/tmp/ASCDocxRenderer.h
DocxRenderer/src/tmp/ASCDocxRenderer.h
+8
-8
No files found.
DocxRenderer/src/logic/Common.h
View file @
f1d9c12f
#ifndef DOCX_RENDERER_COMMON_H
#
ifndef
DOCX_RENDERER_COMMON_H
#define DOCX_RENDERER_COMMON_H
#define DOCX_RENDERER_COMMON_H
#include "../DesktopEditor/common/StringBuilder.h"
#include "../DesktopEditor/common/StringBuilder.h"
...
...
DocxRenderer/src/logic/Document.h
View file @
f1d9c12f
#pragma once
#
pragma
once
#include "Page.h"
#include "Page.h"
namespace
NSDocxRenderer
namespace
NSDocxRenderer
...
@@ -160,7 +160,7 @@ xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:
...
@@ -160,7 +160,7 @@ xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:
*
dDpiY
=
m_dDpiY
;
*
dDpiY
=
m_dDpiY
;
return
S_OK
;
return
S_OK
;
}
}
//--------
----------------------------------------------
//--------
Функции для задания настроек текста
----------------------------------------------
// pen --------------------------------------------------------------------------------------
// pen --------------------------------------------------------------------------------------
AVSINLINE
HRESULT
SetPen
(
BSTR
bsXML
)
AVSINLINE
HRESULT
SetPen
(
BSTR
bsXML
)
{
{
...
@@ -561,7 +561,7 @@ xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:
...
@@ -561,7 +561,7 @@ xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:
return
S_OK
;
return
S_OK
;
}
}
//--------
--------------------------------------------------------
//--------
Функции для вывода текста
--------------------------------------------------------
AVSINLINE
HRESULT
CommandDrawText
(
BSTR
bsText
,
double
fX
,
double
fY
,
double
fWidth
,
double
fHeight
,
double
fBaseLineOffset
)
AVSINLINE
HRESULT
CommandDrawText
(
BSTR
bsText
,
double
fX
,
double
fY
,
double
fWidth
,
double
fHeight
,
double
fBaseLineOffset
)
{
{
double
dAngleMatrix
=
m_oTransform
.
z_Rotation
();
double
dAngleMatrix
=
m_oTransform
.
z_Rotation
();
...
@@ -596,7 +596,7 @@ xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:
...
@@ -596,7 +596,7 @@ xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:
m_oCurrentPage
.
WriteText
(
bsUnicodeText
,
bsGidText
,
fX
,
fY
,
fWidth
,
fHeight
,
fBaseLineOffset
,
m_bIsNeedPDFTextAnalyzer
);
m_oCurrentPage
.
WriteText
(
bsUnicodeText
,
bsGidText
,
fX
,
fY
,
fWidth
,
fHeight
,
fBaseLineOffset
,
m_bIsNeedPDFTextAnalyzer
);
return
S_OK
;
return
S_OK
;
}
}
//--------
---------------------------------------------------------------
//--------
Маркеры для команд
---------------------------------------------------------------
AVSINLINE
HRESULT
BeginCommand
(
DWORD
lType
)
AVSINLINE
HRESULT
BeginCommand
(
DWORD
lType
)
{
{
m_lCurrentCommandType
=
(
LONG
)
lType
;
m_lCurrentCommandType
=
(
LONG
)
lType
;
...
@@ -611,7 +611,7 @@ xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:
...
@@ -611,7 +611,7 @@ xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:
if
(
c_nPageType
==
lType
)
if
(
c_nPageType
==
lType
)
{
{
//
//
нужно записать страницу в файл
m_oCurrentPage
.
Build
();
m_oCurrentPage
.
Build
();
m_oCurrentPage
.
Write
(
m_oWriter
);
m_oCurrentPage
.
Write
(
m_oWriter
);
}
}
...
@@ -622,7 +622,7 @@ xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:
...
@@ -622,7 +622,7 @@ xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:
return
S_OK
;
return
S_OK
;
}
}
//--------
Graphics Path -----------------------------------------------
//--------
Функции для работы с
Graphics Path -----------------------------------------------
AVSINLINE
HRESULT
PathCommandMoveTo
(
double
fX
,
double
fY
)
AVSINLINE
HRESULT
PathCommandMoveTo
(
double
fX
,
double
fY
)
{
{
if
(
c_nSimpleGraphicType
==
m_lCurrentCommandType
)
if
(
c_nSimpleGraphicType
==
m_lCurrentCommandType
)
...
@@ -759,7 +759,7 @@ xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:
...
@@ -759,7 +759,7 @@ xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:
ApplyTransform2
(
dAngle
,
dLeft
,
dTop
,
dWidth
,
dHeight
,
lFlags
);
ApplyTransform2
(
dAngle
,
dLeft
,
dTop
,
dWidth
,
dHeight
,
lFlags
);
return
S_OK
;
return
S_OK
;
}
}
//--------
--------------------------------------------------
//--------
Функции для вывода изображений
--------------------------------------------------
AVSINLINE
HRESULT
DrawImage
(
IUnknown
*
pInterface
,
double
fX
,
double
fY
,
double
fWidth
,
double
fHeight
)
AVSINLINE
HRESULT
DrawImage
(
IUnknown
*
pInterface
,
double
fX
,
double
fY
,
double
fWidth
,
double
fHeight
)
{
{
CImageInfo
oInfo
=
m_oManager
.
WriteImage
(
pInterface
,
fX
,
fY
,
fWidth
,
fHeight
);
CImageInfo
oInfo
=
m_oManager
.
WriteImage
(
pInterface
,
fX
,
fY
,
fWidth
,
fHeight
);
...
@@ -955,7 +955,7 @@ xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:
...
@@ -955,7 +955,7 @@ xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:
void
Close
()
void
Close
()
{
{
// rels (images & docs)
//
сохраним
rels (images & docs)
CFile
oFile
;
CFile
oFile
;
oFile
.
CreateFile
(
m_strTempDirectory
+
_T
(
"
\\
word
\\
_rels
\\
document.xml.rels"
));
oFile
.
CreateFile
(
m_strTempDirectory
+
_T
(
"
\\
word
\\
_rels
\\
document.xml.rels"
));
...
@@ -1017,7 +1017,7 @@ xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:
...
@@ -1017,7 +1017,7 @@ xmlns:v=\"urn:schemas-microsoft-com:vml\" xmlns:w10=\"urn:schemas-microsoft-com:
oFile
.
WriteStringUTF8
(
oWriter
.
GetData
());
oFile
.
WriteStringUTF8
(
oWriter
.
GetData
());
oFile
.
CloseFile
();
oFile
.
CloseFile
();
// fontTable
//
сохраним
fontTable
CFile
oFileFontTable
;
CFile
oFileFontTable
;
oFileFontTable
.
CreateFile
(
m_strTempDirectory
+
_T
(
"
\\
word
\\
fontTable.xml"
));
oFileFontTable
.
CreateFile
(
m_strTempDirectory
+
_T
(
"
\\
word
\\
fontTable.xml"
));
...
...
DocxRenderer/src/logic/ElementImage.h
View file @
f1d9c12f
#ifndef DOCX_RENDERER_ELEMENT_IMAGE_H
#
ifndef
DOCX_RENDERER_ELEMENT_IMAGE_H
#define DOCX_RENDERER_ELEMENT_IMAGE_H
#define DOCX_RENDERER_ELEMENT_IMAGE_H
#include "Common.h"
#include "Common.h"
...
...
DocxRenderer/src/logic/ElementParagraph.h
View file @
f1d9c12f
#pragma once
#
pragma
once
#include "Common.h"
#include "Common.h"
#include "FontManager.h"
#include "FontManager.h"
...
@@ -7,7 +7,7 @@ namespace NSDocxRenderer
...
@@ -7,7 +7,7 @@ namespace NSDocxRenderer
{
{
const
double
c_dMMToDx
=
72
*
20
/
25.4
;
const
double
c_dMMToDx
=
72
*
20
/
25.4
;
//
T
IsBigger, IsBiggerOrEqual
//
у класса T должен быть метод
IsBigger, IsBiggerOrEqual
template
<
typename
T
>
template
<
typename
T
>
void
SortElements
(
CArray
<
T
*>&
oArray
)
void
SortElements
(
CArray
<
T
*>&
oArray
)
{
{
...
@@ -262,7 +262,7 @@ namespace NSDocxRenderer
...
@@ -262,7 +262,7 @@ namespace NSDocxRenderer
m_strText
+=
_T
(
" "
);
m_strText
+=
_T
(
" "
);
}
}
//
...
//
нужно перемерять
...
double
___dSize
=
(
double
)((
LONG
)(
m_oFont
.
Size
*
2
))
/
2
;
double
___dSize
=
(
double
)((
LONG
)(
m_oFont
.
Size
*
2
))
/
2
;
pManagerLight
->
LoadFont
(
m_strPickFontName
,
m_lPickFontStyle
,
___dSize
,
FALSE
);
pManagerLight
->
LoadFont
(
m_strPickFontName
,
m_lPickFontStyle
,
___dSize
,
FALSE
);
double
dWidth
=
pManagerLight
->
MeasureStringWidth
(
m_strText
);
double
dWidth
=
pManagerLight
->
MeasureStringWidth
(
m_strText
);
...
@@ -450,7 +450,7 @@ namespace NSDocxRenderer
...
@@ -450,7 +450,7 @@ namespace NSDocxRenderer
AVSINLINE
void
SortConts
()
AVSINLINE
void
SortConts
()
{
{
//
m_dX
//
сортировка непрерывных слов по
m_dX
SortElements
(
m_arConts
);
SortElements
(
m_arConts
);
}
}
...
@@ -503,19 +503,19 @@ namespace NSDocxRenderer
...
@@ -503,19 +503,19 @@ namespace NSDocxRenderer
if
(
dDelta
<
0.5
)
if
(
dDelta
<
0.5
)
{
{
//
(font/brush)
//
просто текст на тексте или сменились настройки
(font/brush)
pPrev
->
Write
(
oWriter
,
pManagerLight
);
pPrev
->
Write
(
oWriter
,
pManagerLight
);
pPrev
=
pCurrent
;
pPrev
=
pCurrent
;
}
}
//else if (dDelta < 2 * pPrev->m_dSpaceWidthMM)
//else if (dDelta < 2 * pPrev->m_dSpaceWidthMM)
//{
//{
// //
, -
// //
сменились настройки, но пробел все-таки вставить нужно
// pPrev->Write(oWriter, pManagerLight, true);
// pPrev->Write(oWriter, pManagerLight, true);
// pPrev = pCurrent;
// pPrev = pCurrent;
//}
//}
else
else
{
{
//
.
//
расстояние слишком большое. нужно сделать большой пробел
pPrev
->
Write
(
oWriter
,
pManagerLight
);
pPrev
->
Write
(
oWriter
,
pManagerLight
);
pPrev
->
WriteTo
(
dDelta
,
oWriter
,
pManagerLight
);
pPrev
->
WriteTo
(
dDelta
,
oWriter
,
pManagerLight
);
pPrev
=
pCurrent
;
pPrev
=
pCurrent
;
...
...
DocxRenderer/src/logic/ElementShape.h
View file @
f1d9c12f
#ifndef DOCX_RENDERER_ELEMENT_SHAPE_H
#
ifndef
DOCX_RENDERER_ELEMENT_SHAPE_H
#define DOCX_RENDERER_ELEMENT_SHAPE_H
#define DOCX_RENDERER_ELEMENT_SHAPE_H
#include "Common.h"
#include "Common.h"
...
@@ -58,7 +58,7 @@ namespace NSDocxRenderer
...
@@ -58,7 +58,7 @@ namespace NSDocxRenderer
double
*
pRealloc
=
(
double
*
)
realloc
(
m_pData
,
m_lSize
*
sizeof
(
double
));
double
*
pRealloc
=
(
double
*
)
realloc
(
m_pData
,
m_lSize
*
sizeof
(
double
));
if
(
NULL
!=
pRealloc
)
if
(
NULL
!=
pRealloc
)
{
{
//
//
реаллок сработал
m_pData
=
pRealloc
;
m_pData
=
pRealloc
;
m_pDataCur
=
m_pData
+
m_lSizeCur
;
m_pDataCur
=
m_pData
+
m_lSizeCur
;
}
}
...
...
DocxRenderer/src/logic/FontManager.h
View file @
f1d9c12f
#pragma once
#
pragma
once
#include "Common.h"
#include "Common.h"
#include "FontManagerBase.h"
#include "FontManagerBase.h"
...
@@ -224,7 +224,7 @@ namespace NSDocxRenderer
...
@@ -224,7 +224,7 @@ namespace NSDocxRenderer
dBoxWidth
=
(
double
)
fwidth
;
dBoxWidth
=
(
double
)
fwidth
;
dBoxHeight
=
(
double
)
fheight
;
dBoxHeight
=
(
double
)
fheight
;
//
//
переводим в миллиметры
dBoxX
*=
c_dPixToMM
;
dBoxX
*=
c_dPixToMM
;
dBoxY
*=
c_dPixToMM
;
dBoxY
*=
c_dPixToMM
;
dBoxWidth
*=
c_dPixToMM
;
dBoxWidth
*=
c_dPixToMM
;
...
...
DocxRenderer/src/logic/FontManagerBase.h
View file @
f1d9c12f
#ifndef DOCX_RENDERER_FMB_H
#
ifndef
DOCX_RENDERER_FMB_H
#define DOCX_RENDERER_FMB_H
#define DOCX_RENDERER_FMB_H
#include "Common.h"
#include "Common.h"
...
@@ -136,7 +136,7 @@ namespace NSFontManager
...
@@ -136,7 +136,7 @@ namespace NSFontManager
CFontAdvanced
m_oFont
;
CFontAdvanced
m_oFont
;
//
//
для подбора шрифтов
BYTE
m_pRanges
[
0xFFFF
];
BYTE
m_pRanges
[
0xFFFF
];
BYTE
m_pRangesNums
[
0xFFFF
];
BYTE
m_pRangesNums
[
0xFFFF
];
...
@@ -323,7 +323,7 @@ namespace NSFontManager
...
@@ -323,7 +323,7 @@ namespace NSFontManager
void
LoadFontParams
(
BOOL
bIsPath
=
TRUE
)
void
LoadFontParams
(
BOOL
bIsPath
=
TRUE
)
{
{
//
//
читаем и выставляем все настройки шрифта
if
(
NULL
==
m_pManager
)
if
(
NULL
==
m_pManager
)
return
;
return
;
...
@@ -414,7 +414,7 @@ namespace NSFontManager
...
@@ -414,7 +414,7 @@ namespace NSFontManager
memset
(
m_pRanges
,
0xFF
,
0xFFFF
);
memset
(
m_pRanges
,
0xFF
,
0xFFFF
);
memset
(
m_pRangesNums
,
0xFF
,
0xFFFF
);
memset
(
m_pRangesNums
,
0xFF
,
0xFFFF
);
//
//
теперь просто по порядку заполняем все рэнджи
int
nStart
=
0
;
int
nStart
=
0
;
int
nCount
=
0
;
int
nCount
=
0
;
...
@@ -862,7 +862,7 @@ namespace NSFontManager
...
@@ -862,7 +862,7 @@ namespace NSFontManager
memset
(
m_pRanges
+
nStart
,
24
,
nCount
);
memset
(
m_pRanges
+
nStart
,
24
,
nCount
);
memset
(
m_pRangesNums
+
nStart
,
1
,
nCount
);
memset
(
m_pRangesNums
+
nStart
,
1
,
nCount
);
//case 25: sUCRName = "Non-Plane 0"; break; /* U+D800-U+DB7F */ /* U+DB80-U+DBFF */ /* U+DC00-U+DFFF */ //
//case 25: sUCRName = "Non-Plane 0"; break; /* U+D800-U+DB7F */ /* U+DB80-U+DBFF */ /* U+DC00-U+DFFF */ //
Не юникодные символы
nStart
=
0xD800
;
nStart
=
0xD800
;
nCount
=
0xDB7F
-
nStart
+
1
;
nCount
=
0xDB7F
-
nStart
+
1
;
memset
(
m_pRanges
+
nStart
,
25
,
nCount
);
memset
(
m_pRanges
+
nStart
,
25
,
nCount
);
...
@@ -911,7 +911,7 @@ namespace NSFontManager
...
@@ -911,7 +911,7 @@ namespace NSFontManager
memset
(
m_pRanges
+
nStart
,
27
,
nCount
);
memset
(
m_pRanges
+
nStart
,
27
,
nCount
);
memset
(
m_pRangesNums
+
nStart
,
1
,
nCount
);
memset
(
m_pRangesNums
+
nStart
,
1
,
nCount
);
//case 28: sUCRName = "Private Use Area (plane 0)"; break; /* U+E000-U+F8FF */ //
//case 28: sUCRName = "Private Use Area (plane 0)"; break; /* U+E000-U+F8FF */ //
Не юникодные символы
nStart
=
0xE000
;
nStart
=
0xE000
;
nCount
=
0xF8FF
-
nStart
+
1
;
nCount
=
0xF8FF
-
nStart
+
1
;
memset
(
m_pRanges
+
nStart
,
28
,
nCount
);
memset
(
m_pRanges
+
nStart
,
28
,
nCount
);
...
@@ -1112,7 +1112,7 @@ namespace NSFontManager
...
@@ -1112,7 +1112,7 @@ namespace NSFontManager
//case 23: sUCRName = "Deseret"; break; /*U+10400-U+1044F*/
//case 23: sUCRName = "Deseret"; break; /*U+10400-U+1044F*/
//case 24: sUCRName = "Byzantine Musical Symbols"; break; /*U+1D000-U+1D0FF*/ /*U+1D100-U+1D1FF*/ /*U+1D200-U+1D24F*/
//case 24: sUCRName = "Byzantine Musical Symbols"; break; /*U+1D000-U+1D0FF*/ /*U+1D100-U+1D1FF*/ /*U+1D200-U+1D24F*/
//case 25: sUCRName = "Mathematical Alphanumeric Symbols"; break; /*U+1D400-U+1D7FF*/
//case 25: sUCRName = "Mathematical Alphanumeric Symbols"; break; /*U+1D400-U+1D7FF*/
//case 26: sUCRName = "Private Use (plane 15)"; break; /*U+F0000-U+FFFFD*/ /*U+100000-U+10FFFD*/ //
//case 26: sUCRName = "Private Use (plane 15)"; break; /*U+F0000-U+FFFFD*/ /*U+100000-U+10FFFD*/ //
Не юникодные символы
//case 27: sUCRName = "Variation Selectors"; break; /* U+FE00-U+FE0F */ /*U+E0100-U+E01EF*/
//case 27: sUCRName = "Variation Selectors"; break; /* U+FE00-U+FE0F */ /*U+E0100-U+E01EF*/
nStart
=
0xFE00
;
nStart
=
0xFE00
;
...
@@ -1301,8 +1301,8 @@ namespace NSFontManager
...
@@ -1301,8 +1301,8 @@ namespace NSFontManager
CFontPickUp
&
oPick
=
m_arListPicUps
.
GetNext
(
pos
);
CFontPickUp
&
oPick
=
m_arListPicUps
.
GetNext
(
pos
);
if
((
oPick
.
m_oFont
.
m_oFont
.
IsEqual3
(
&
m_oFont
.
m_oFont
))
&&
(
lRangeNum
==
oPick
.
m_lRangeNum
)
&&
(
lRange
==
oPick
.
m_lRange
))
if
((
oPick
.
m_oFont
.
m_oFont
.
IsEqual3
(
&
m_oFont
.
m_oFont
))
&&
(
lRangeNum
==
oPick
.
m_lRangeNum
)
&&
(
lRange
==
oPick
.
m_lRange
))
{
{
//
!
//
нашли! ничего подбирать не нужно
//
//
нужно просто выкинуть этот шрифт наверх
m_arListPicUps
.
MoveToHead
(
posOld
);
m_arListPicUps
.
MoveToHead
(
posOld
);
m_strCurrentPickFont
=
oPick
.
m_strPickFont
;
m_strCurrentPickFont
=
oPick
.
m_strPickFont
;
m_lCurrentPictFontStyle
=
oPick
.
m_lPickStyle
;
m_lCurrentPictFontStyle
=
oPick
.
m_lPickStyle
;
...
@@ -1310,7 +1310,7 @@ namespace NSFontManager
...
@@ -1310,7 +1310,7 @@ namespace NSFontManager
}
}
}
}
//
...
//
не нашли
...
m_arListPicUps
.
AddHead
();
m_arListPicUps
.
AddHead
();
CFontPickUp
&
oPick
=
m_arListPicUps
.
GetHead
();
CFontPickUp
&
oPick
=
m_arListPicUps
.
GetHead
();
...
@@ -1340,7 +1340,7 @@ namespace NSFontManager
...
@@ -1340,7 +1340,7 @@ namespace NSFontManager
}
}
else
if
(((
lRangeNum
==
2
)
&&
(
lRange
==
3
))
||
((
lRangeNum
==
1
)
&&
(
lRange
==
31
))
||
((
lRangeNum
==
0
)
&&
(
lRange
==
13
)))
else
if
(((
lRangeNum
==
2
)
&&
(
lRange
==
3
))
||
((
lRangeNum
==
1
)
&&
(
lRange
==
31
))
||
((
lRangeNum
==
0
)
&&
(
lRange
==
13
)))
{
{
//
!!!
//
ебаный арабский язык
!!!
dwR1
=
1
<<
13
;
dwR1
=
1
<<
13
;
dwR2
=
1
<<
31
;
dwR2
=
1
<<
31
;
dwR3
=
1
<<
3
;
dwR3
=
1
<<
3
;
...
...
DocxRenderer/src/logic/Page.h
View file @
f1d9c12f
#pragma once
#
pragma
once
#include "ElementShape.h"
#include "ElementShape.h"
#include "ElementParagraph.h"
#include "ElementParagraph.h"
#include "ElementImage.h"
#include "ElementImage.h"
...
@@ -152,7 +152,7 @@ namespace NSDocxRenderer
...
@@ -152,7 +152,7 @@ namespace NSDocxRenderer
{
{
if
((
NULL
==
m_pCurrentLine
)
||
(
TextAssociationTypeDefault
==
m_eTextAssociationType
))
if
((
NULL
==
m_pCurrentLine
)
||
(
TextAssociationTypeDefault
==
m_eTextAssociationType
))
{
{
//
( )
//
пуста¤ (в плане текста) страница
m_pCurrentLine
=
new
CTextLine
();
m_pCurrentLine
=
new
CTextLine
();
m_pCurrentLine
->
m_dBaselinePos
=
dBaseLinePos
;
m_pCurrentLine
->
m_dBaselinePos
=
dBaseLinePos
;
...
@@ -173,7 +173,7 @@ namespace NSDocxRenderer
...
@@ -173,7 +173,7 @@ namespace NSDocxRenderer
}
}
}
}
//
- -
//
лини¤ не нашлась - не беда - создадим новую
m_pCurrentLine
=
new
CTextLine
();
m_pCurrentLine
=
new
CTextLine
();
m_pCurrentLine
->
m_dBaselinePos
=
dBaseLinePos
;
m_pCurrentLine
->
m_dBaselinePos
=
dBaseLinePos
;
m_arTextLine
.
Add
(
m_pCurrentLine
);
m_arTextLine
.
Add
(
m_pCurrentLine
);
...
@@ -309,7 +309,7 @@ namespace NSDocxRenderer
...
@@ -309,7 +309,7 @@ namespace NSDocxRenderer
pShape
->
m_oPen
=
*
m_pPen
;
pShape
->
m_oPen
=
*
m_pPen
;
pShape
->
m_oBrush
=
*
m_pBrush
;
pShape
->
m_oBrush
=
*
m_pBrush
;
//
//
нормализуем толщину линии
double
dScaleTransform
=
(
m_pTransform
->
m_agg_mtx
.
sx
+
m_pTransform
->
m_agg_mtx
.
sy
)
/
2.0
;
double
dScaleTransform
=
(
m_pTransform
->
m_agg_mtx
.
sx
+
m_pTransform
->
m_agg_mtx
.
sy
)
/
2.0
;
pShape
->
m_oPen
.
Size
*=
dScaleTransform
;
pShape
->
m_oPen
.
Size
*=
dScaleTransform
;
...
@@ -386,7 +386,7 @@ namespace NSDocxRenderer
...
@@ -386,7 +386,7 @@ namespace NSDocxRenderer
}
}
else
else
{
{
//
(
xps)
//
такого быть не должно (только из
xps)
m_oManager
.
SetStringGid
(
0
);
m_oManager
.
SetStringGid
(
0
);
m_oManager
.
MeasureString
(
bsText
,
dTextX
,
dTextY
,
_x
,
_y
,
_w
,
_h
,
CFontManager
::
MeasureTypePosition
);
m_oManager
.
MeasureString
(
bsText
,
dTextX
,
dTextY
,
_x
,
_y
,
_w
,
_h
,
CFontManager
::
MeasureTypePosition
);
}
}
...
@@ -407,7 +407,7 @@ namespace NSDocxRenderer
...
@@ -407,7 +407,7 @@ namespace NSDocxRenderer
if
(
NULL
==
pLastCont
)
if
(
NULL
==
pLastCont
)
{
{
//
//
первое слово в линии
CContText
*
pCont
=
new
CContText
();
CContText
*
pCont
=
new
CContText
();
pCont
->
m_dX
=
dTextX
;
pCont
->
m_dX
=
dTextX
;
...
@@ -444,10 +444,10 @@ namespace NSDocxRenderer
...
@@ -444,10 +444,10 @@ namespace NSDocxRenderer
return
;
return
;
}
}
//
//
продолжение линии
//if (m_lCurrentCommand == c_nTextType && pLastCont->m_oFont.IsEqual(&m_oManager.m_oFontOld) && pLastCont->m_oBrush.IsEqual(m_pBrush))
//if (m_lCurrentCommand == c_nTextType && pLastCont->m_oFont.IsEqual(&m_oManager.m_oFontOld) && pLastCont->m_oBrush.IsEqual(m_pBrush))
//{
//{
// //
// //
быстрое отметание вс¤ких проверок
// pLastCont->m_strText += strText;
// pLastCont->m_strText += strText;
// pLastCont->m_dWidth = (dTextX + dTextW - pLastCont->m_dX);
// pLastCont->m_dWidth = (dTextX + dTextW - pLastCont->m_dX);
// return;
// return;
...
@@ -457,10 +457,10 @@ namespace NSDocxRenderer
...
@@ -457,10 +457,10 @@ namespace NSDocxRenderer
if
(
pLastCont
->
m_oFont
.
IsEqual
(
&
m_oManager
.
m_oFont
.
m_oFont
)
&&
pLastCont
->
m_oBrush
.
IsEqual
(
m_pBrush
))
if
(
pLastCont
->
m_oFont
.
IsEqual
(
&
m_oManager
.
m_oFont
.
m_oFont
)
&&
pLastCont
->
m_oBrush
.
IsEqual
(
m_pBrush
))
{
{
//
. ,
//
настройки одинаковые. “еперь смотрим, на расположение
if
(
fabs
(
dRight
-
dTextX
)
<
0.5
)
if
(
fabs
(
dRight
-
dTextX
)
<
0.5
)
{
{
//
//
продолжаем слово
pLastCont
->
m_strText
+=
strText
;
pLastCont
->
m_strText
+=
strText
;
pLastCont
->
m_dWidth
=
(
dTextX
+
dTextW
-
pLastCont
->
m_dX
);
pLastCont
->
m_dWidth
=
(
dTextX
+
dTextW
-
pLastCont
->
m_dX
);
...
@@ -480,7 +480,7 @@ namespace NSDocxRenderer
...
@@ -480,7 +480,7 @@ namespace NSDocxRenderer
}
}
else
if
((
dRight
<
dTextX
)
&&
((
dTextX
-
dRight
)
<
m_oManager
.
m_dSpaceWidthMM
))
else
if
((
dRight
<
dTextX
)
&&
((
dTextX
-
dRight
)
<
m_oManager
.
m_dSpaceWidthMM
))
{
{
//
//
продолжаем слово с пробелом
pLastCont
->
m_strText
+=
(
_T
(
" "
)
+
strText
);
pLastCont
->
m_strText
+=
(
_T
(
" "
)
+
strText
);
pLastCont
->
m_dWidth
=
(
dTextX
+
dTextW
-
pLastCont
->
m_dX
);
pLastCont
->
m_dWidth
=
(
dTextX
+
dTextW
-
pLastCont
->
m_dX
);
...
@@ -500,8 +500,8 @@ namespace NSDocxRenderer
...
@@ -500,8 +500,8 @@ namespace NSDocxRenderer
}
}
}
}
//
, , (,
)
//
либо пробел большой между словами, либо новый текст левее, либо настройки не те (шрифт, кисть
)
//
...
//
либо все вместе... просто добавл¤ем новое слово
CContText
*
pCont
=
new
CContText
();
CContText
*
pCont
=
new
CContText
();
pCont
->
m_dX
=
dTextX
;
pCont
->
m_dX
=
dTextX
;
...
@@ -541,7 +541,7 @@ namespace NSDocxRenderer
...
@@ -541,7 +541,7 @@ namespace NSDocxRenderer
{
{
if
(
m_bIsDeleteTextClipPage
)
if
(
m_bIsDeleteTextClipPage
)
{
{
//
,
//
удалим все линии, которые выход¤т за границы страницы
size_t
nCount
=
m_arTextLine
.
GetCount
();
size_t
nCount
=
m_arTextLine
.
GetCount
();
for
(
size_t
i
=
0
;
i
<
nCount
;
++
i
)
for
(
size_t
i
=
0
;
i
<
nCount
;
++
i
)
{
{
...
@@ -581,7 +581,7 @@ namespace NSDocxRenderer
...
@@ -581,7 +581,7 @@ namespace NSDocxRenderer
m_arParagraphs
.
Add
(
pParagraph
);
m_arParagraphs
.
Add
(
pParagraph
);
}
}
//
//
удалим все линии
m_arTextLine
.
RemoveAll
();
m_arTextLine
.
RemoveAll
();
break
;
break
;
}
}
...
@@ -631,7 +631,7 @@ namespace NSDocxRenderer
...
@@ -631,7 +631,7 @@ namespace NSDocxRenderer
m_arParagraphs
.
Add
(
pParagraph
);
m_arParagraphs
.
Add
(
pParagraph
);
}
}
//
//
удалим все линии
m_arTextLine
.
RemoveAll
();
m_arTextLine
.
RemoveAll
();
break
;
break
;
}
}
...
...
DocxRenderer/src/tmp/ASCDocxRenderer.cpp
View file @
f1d9c12f
// AVSDocxRenderer.cpp : Implementation of CAVSDocxRenderer
// AVSDocxRenderer.cpp : Implementation of CAVSDocxRenderer
#include "stdafx.h"
#include "stdafx.h"
#include "ASCDocxRenderer.h"
#include "ASCDocxRenderer.h"
...
...
DocxRenderer/src/tmp/ASCDocxRenderer.h
View file @
f1d9c12f
// AVSDocxRenderer.h : Declaration of the CAVSDocxRenderer
// AVSDocxRenderer.h : Declaration of the CAVSDocxRenderer
#pragma once
#pragma once
#include "stdafx.h"
#include "stdafx.h"
...
@@ -58,10 +58,10 @@ public:
...
@@ -58,10 +58,10 @@ public:
public:
public:
// IASCRenderer Methods
// IASCRenderer Methods
//
-----------------------------------------------------------------------------
//
тип рендерера
-----------------------------------------------------------------------------
STDMETHOD
(
get_Type
)(
LONG
*
lType
);
STDMETHOD
(
get_Type
)(
LONG
*
lType
);
//--------
--------------------------------------------------
//--------
Функции для работы со страницей
--------------------------------------------------
STDMETHOD
(
NewPage
)();
STDMETHOD
(
NewPage
)();
STDMETHOD
(
get_Height
)(
double
*
dHeight
);
STDMETHOD
(
get_Height
)(
double
*
dHeight
);
STDMETHOD
(
put_Height
)(
double
dHeight
);
STDMETHOD
(
put_Height
)(
double
dHeight
);
...
@@ -69,7 +69,7 @@ public:
...
@@ -69,7 +69,7 @@ public:
STDMETHOD
(
put_Width
)(
double
dWidth
);
STDMETHOD
(
put_Width
)(
double
dWidth
);
STDMETHOD
(
get_DpiX
)(
double
*
dDpiX
);
STDMETHOD
(
get_DpiX
)(
double
*
dDpiX
);
STDMETHOD
(
get_DpiY
)(
double
*
dDpiY
);
STDMETHOD
(
get_DpiY
)(
double
*
dDpiY
);
//--------
----------------------------------------------
//--------
Функции для задания настроек текста
----------------------------------------------
STDMETHOD
(
SetPen
)(
BSTR
bsXML
);
STDMETHOD
(
SetPen
)(
BSTR
bsXML
);
STDMETHOD
(
get_PenColor
)(
LONG
*
lColor
);
STDMETHOD
(
get_PenColor
)(
LONG
*
lColor
);
...
@@ -157,13 +157,13 @@ public:
...
@@ -157,13 +157,13 @@ public:
STDMETHOD
(
get_EdgeDist
)(
double
*
val
);
STDMETHOD
(
get_EdgeDist
)(
double
*
val
);
STDMETHOD
(
put_EdgeDist
)(
double
val
);
STDMETHOD
(
put_EdgeDist
)(
double
val
);
//--------
--------------------------------------------------------
//--------
Функции для вывода текста
--------------------------------------------------------
STDMETHOD
(
CommandDrawText
)(
BSTR
bsText
,
double
fX
,
double
fY
,
double
fWidth
,
double
fHeight
,
double
fBaseLineOffset
);
STDMETHOD
(
CommandDrawText
)(
BSTR
bsText
,
double
fX
,
double
fY
,
double
fWidth
,
double
fHeight
,
double
fBaseLineOffset
);
STDMETHOD
(
CommandDrawTextEx
)(
BSTR
bsUnicodeText
,
BSTR
bsGidText
,
BSTR
bsSourceCodeText
,
double
fX
,
double
fY
,
double
fWidth
,
double
fHeight
,
double
fBaseLineOffset
,
DWORD
lFlags
);
STDMETHOD
(
CommandDrawTextEx
)(
BSTR
bsUnicodeText
,
BSTR
bsGidText
,
BSTR
bsSourceCodeText
,
double
fX
,
double
fY
,
double
fWidth
,
double
fHeight
,
double
fBaseLineOffset
,
DWORD
lFlags
);
//--------
---------------------------------------------------------------
//--------
Маркеры для команд
---------------------------------------------------------------
STDMETHOD
(
BeginCommand
)(
DWORD
lType
);
STDMETHOD
(
BeginCommand
)(
DWORD
lType
);
STDMETHOD
(
EndCommand
)(
DWORD
lType
);
STDMETHOD
(
EndCommand
)(
DWORD
lType
);
//--------
Graphics Path -----------------------------------------------
//--------
Функции для работы с
Graphics Path -----------------------------------------------
STDMETHOD
(
PathCommandMoveTo
)(
double
fX
,
double
fY
);
STDMETHOD
(
PathCommandMoveTo
)(
double
fX
,
double
fY
);
STDMETHOD
(
PathCommandLineTo
)(
double
fX
,
double
fY
);
STDMETHOD
(
PathCommandLineTo
)(
double
fX
,
double
fY
);
STDMETHOD
(
PathCommandLinesTo
)(
SAFEARRAY
*
pPoints
);
STDMETHOD
(
PathCommandLinesTo
)(
SAFEARRAY
*
pPoints
);
...
@@ -181,7 +181,7 @@ public:
...
@@ -181,7 +181,7 @@ public:
STDMETHOD
(
GetCommandParams
)(
double
*
dAngle
,
double
*
dLeft
,
double
*
dTop
,
double
*
dWidth
,
double
*
dHeight
,
DWORD
*
lFlags
);
STDMETHOD
(
GetCommandParams
)(
double
*
dAngle
,
double
*
dLeft
,
double
*
dTop
,
double
*
dWidth
,
double
*
dHeight
,
DWORD
*
lFlags
);
STDMETHOD
(
SetCommandParams
)(
double
dAngle
,
double
dLeft
,
double
dTop
,
double
dWidth
,
double
dHeight
,
DWORD
lFlags
);
STDMETHOD
(
SetCommandParams
)(
double
dAngle
,
double
dLeft
,
double
dTop
,
double
dWidth
,
double
dHeight
,
DWORD
lFlags
);
//--------
--------------------------------------------------
//--------
Функции для вывода изображений
--------------------------------------------------
STDMETHOD
(
DrawImage
)(
IUnknown
*
pInterface
,
double
fX
,
double
fY
,
double
fWidth
,
double
fHeight
);
STDMETHOD
(
DrawImage
)(
IUnknown
*
pInterface
,
double
fX
,
double
fY
,
double
fWidth
,
double
fHeight
);
STDMETHOD
(
DrawImageFromFile
)(
BSTR
bstrVal
,
double
fX
,
double
fY
,
double
fWidth
,
double
fHeight
);
STDMETHOD
(
DrawImageFromFile
)(
BSTR
bstrVal
,
double
fX
,
double
fY
,
double
fWidth
,
double
fHeight
);
//------------------------------------------------------------------------------------------
//------------------------------------------------------------------------------------------
...
...
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