Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
sdkjs
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
sdkjs
Commits
b6c76476
Commit
b6c76476
authored
Nov 03, 2017
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
The "Leader" field for ParaTab were implemented.
parent
812f09fa
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
128 additions
and
102 deletions
+128
-102
word/Drawing/DrawingDocument.js
word/Drawing/DrawingDocument.js
+4
-4
word/Drawing/Rulers.js
word/Drawing/Rulers.js
+24
-23
word/Editor/ParagraphContent.js
word/Editor/ParagraphContent.js
+89
-71
word/Editor/Paragraph_Recalculate.js
word/Editor/Paragraph_Recalculate.js
+6
-1
word/Editor/Run.js
word/Editor/Run.js
+4
-2
word/Editor/Styles.js
word/Editor/Styles.js
+1
-1
No files found.
word/Drawing/DrawingDocument.js
View file @
b6c76476
...
...
@@ -5694,15 +5694,15 @@ function CDrawingDocument()
for
(
var
i
=
0
;
i
<
_len
;
i
++
)
{
if
(
__tabs
[
i
].
Value
==
tab_Left
)
_ar
[
i
]
=
new
CTab
(
__tabs
[
i
].
Pos
,
AscCommon
.
g_tabtype_left
);
_ar
[
i
]
=
new
CTab
(
__tabs
[
i
].
Pos
,
AscCommon
.
g_tabtype_left
,
__tabs
[
i
].
Leader
);
else
if
(
__tabs
[
i
].
Value
==
tab_Center
)
_ar
[
i
]
=
new
CTab
(
__tabs
[
i
].
Pos
,
AscCommon
.
g_tabtype_center
);
_ar
[
i
]
=
new
CTab
(
__tabs
[
i
].
Pos
,
AscCommon
.
g_tabtype_center
,
__tabs
[
i
].
Leader
);
else
if
(
__tabs
[
i
].
Value
==
tab_Right
)
_ar
[
i
]
=
new
CTab
(
__tabs
[
i
].
Pos
,
AscCommon
.
g_tabtype_right
);
_ar
[
i
]
=
new
CTab
(
__tabs
[
i
].
Pos
,
AscCommon
.
g_tabtype_right
,
__tabs
[
i
].
Leader
);
else
{
// не должно такого быть. но приходит
_ar
[
i
]
=
new
CTab
(
__tabs
[
i
].
Pos
,
AscCommon
.
g_tabtype_left
);
_ar
[
i
]
=
new
CTab
(
__tabs
[
i
].
Pos
,
AscCommon
.
g_tabtype_left
,
__tabs
[
i
].
Leader
);
}
}
...
...
word/Drawing/Rulers.js
View file @
b6c76476
...
...
@@ -38,10 +38,11 @@ var global_mouseEvent = AscCommon.global_mouseEvent;
var
g_dKoef_pix_to_mm
=
AscCommon
.
g_dKoef_pix_to_mm
;
var
g_dKoef_mm_to_pix
=
AscCommon
.
g_dKoef_mm_to_pix
;
function
CTab
(
pos
,
type
)
function
CTab
(
pos
,
type
,
leader
)
{
this
.
pos
=
pos
;
this
.
type
=
type
;
this
.
pos
=
pos
;
this
.
type
=
type
;
this
.
leader
=
leader
;
}
var
g_array_objects_length
=
1
;
...
...
@@ -2214,26 +2215,26 @@ function CHorRuler()
}
this
.
SetTabsProperties
=
function
()
{
// потом заменить на объекты CTab (когда Илюха реализует не только левые табы)
var
_arr
=
new
CParaTabs
();
var
_c
=
this
.
m_arrTabs
.
length
;
for
(
var
i
=
0
;
i
<
_c
;
i
++
)
{
if
(
this
.
m_arrTabs
[
i
].
type
==
AscCommon
.
g_tabtype_left
)
_arr
.
Add
(
new
CParaTab
(
tab_Left
,
this
.
m_arrTabs
[
i
].
pos
)
);
else
if
(
this
.
m_arrTabs
[
i
].
type
==
AscCommon
.
g_tabtype_right
)
_arr
.
Add
(
new
CParaTab
(
tab_Right
,
this
.
m_arrTabs
[
i
].
pos
)
);
else
if
(
this
.
m_arrTabs
[
i
].
type
==
AscCommon
.
g_tabtype_center
)
_arr
.
Add
(
new
CParaTab
(
tab_Center
,
this
.
m_arrTabs
[
i
].
pos
)
);
}
if
(
false
===
this
.
m_oWordControl
.
m_oLogicDocument
.
Document_Is_SelectionLocked
(
AscCommon
.
changestype_Paragraph_Properties
)
)
{
this
.
m_oWordControl
.
m_oLogicDocument
.
Create_NewHistoryPoint
(
AscDFH
.
historydescription_Document_SetParagraphTabs
);
this
.
m_oWordControl
.
m_oLogicDocument
.
SetParagraphTabs
(
_arr
);
}
}
{
// потом заменить на объекты CTab (когда Илюха реализует не только левые табы)
var
_arr
=
new
CParaTabs
();
var
_c
=
this
.
m_arrTabs
.
length
;
for
(
var
i
=
0
;
i
<
_c
;
i
++
)
{
if
(
this
.
m_arrTabs
[
i
].
type
==
AscCommon
.
g_tabtype_left
)
_arr
.
Add
(
new
CParaTab
(
tab_Left
,
this
.
m_arrTabs
[
i
].
pos
,
this
.
m_arrTabs
[
i
].
leader
)
);
else
if
(
this
.
m_arrTabs
[
i
].
type
==
AscCommon
.
g_tabtype_right
)
_arr
.
Add
(
new
CParaTab
(
tab_Right
,
this
.
m_arrTabs
[
i
].
pos
,
this
.
m_arrTabs
[
i
].
leader
)
);
else
if
(
this
.
m_arrTabs
[
i
].
type
==
AscCommon
.
g_tabtype_center
)
_arr
.
Add
(
new
CParaTab
(
tab_Center
,
this
.
m_arrTabs
[
i
].
pos
,
this
.
m_arrTabs
[
i
].
leader
)
);
}
if
(
false
===
this
.
m_oWordControl
.
m_oLogicDocument
.
Document_Is_SelectionLocked
(
AscCommon
.
changestype_Paragraph_Properties
)
)
{
this
.
m_oWordControl
.
m_oLogicDocument
.
Create_NewHistoryPoint
(
AscDFH
.
historydescription_Document_SetParagraphTabs
);
this
.
m_oWordControl
.
m_oLogicDocument
.
SetParagraphTabs
(
_arr
);
}
}
this
.
SetPrProperties
=
function
()
{
...
...
word/Editor/ParagraphContent.js
View file @
b6c76476
...
...
@@ -181,7 +181,7 @@ function CRunElementBase()
CRunElementBase
.
prototype
.
Type
=
para_RunBase
;
CRunElementBase
.
prototype
.
Get_Type
=
function
()
{
return
para_RunBas
e
;
return
this
.
Typ
e
;
};
CRunElementBase
.
prototype
.
Draw
=
function
(
X
,
Y
,
Context
,
PDSE
)
{
...
...
@@ -1214,90 +1214,108 @@ var tab_Center = 0x03;
var
tab_Symbol
=
0x0022
;
//0x2192;
// Класс ParaTab
/**
* Класс представляющий элемент табуляции.
* @constructor
* @extends {CRunElementBase}
*/
function
ParaTab
()
{
this
.
TabType
=
tab_Left
;
CRunElementBase
.
call
(
this
)
;
this
.
Width
=
0
;
this
.
WidthVisible
=
0
;
this
.
RealWidth
=
0
;
this
.
Width
=
0
;
this
.
WidthVisible
=
0
;
this
.
RealWidth
=
0
;
this
.
DotWidth
=
0
;
this
.
UnderscoreWidth
=
0
;
this
.
HyphenWidth
=
0
;
this
.
Leader
=
Asc
.
c_oAscTabLeader
.
None
;
}
ParaTab
.
prototype
=
ParaTab
.
prototype
=
Object
.
create
(
CRunElementBase
.
prototype
);
ParaTab
.
prototype
.
constructor
=
ParaTab
;
ParaTab
.
prototype
.
Type
=
para_Tab
;
ParaTab
.
prototype
.
Draw
=
function
(
X
,
Y
,
Context
)
{
Type
:
para_Tab
,
Get_Type
:
function
()
{
return
para_Tab
;
},
Draw
:
function
(
X
,
Y
,
Context
)
{
if
(
typeof
(
editor
)
!==
"
undefined
"
&&
editor
.
ShowParaMarks
)
{
var
X0
=
this
.
Width
/
2
-
this
.
RealWidth
/
2
;
Context
.
SetFont
(
{
FontFamily
:
{
Name
:
"
ASCW3
"
,
Index
:
-
1
},
FontSize
:
10
,
Italic
:
false
,
Bold
:
false
}
);
if
(
X0
>
0
)
Context
.
FillText2
(
X
+
X0
,
Y
,
String
.
fromCharCode
(
tab_Symbol
),
0
,
this
.
Width
);
else
Context
.
FillText2
(
X
,
Y
,
String
.
fromCharCode
(
tab_Symbol
),
this
.
RealWidth
-
this
.
Width
,
this
.
Width
);
}
},
Measure
:
function
(
Context
)
{
Context
.
SetFont
(
{
FontFamily
:
{
Name
:
"
ASCW3
"
,
Index
:
-
1
},
FontSize
:
10
,
Italic
:
false
,
Bold
:
false
}
);
this
.
RealWidth
=
Context
.
Measure
(
String
.
fromCharCode
(
tab_Symbol
)
).
Width
;
},
if
(
this
.
WidthVisible
>
0.01
)
{
var
sChar
=
null
,
nCharWidth
=
0
;
switch
(
this
.
Leader
)
{
case
Asc
.
c_oAscTabLeader
.
Dot
:
sChar
=
'
.
'
;
nCharWidth
=
this
.
DotWidth
;
break
;
case
Asc
.
c_oAscTabLeader
.
Hyphen
:
sChar
=
'
_
'
;
nCharWidth
=
this
.
UnderscoreWidth
;
break
;
case
Asc
.
c_oAscTabLeader
.
MiddleDot
:
sChar
=
'
-
'
;
nCharWidth
=
this
.
HyphenWidth
;
break
;
case
Asc
.
c_oAscTabLeader
.
Underscore
:
sChar
=
'
·
'
;
nCharWidth
=
this
.
MiddleDotWidth
;
break
;
}
Get_Width
:
function
(
)
{
return
this
.
Width
;
},
if
(
null
!==
sChar
&&
nCharWidth
>
0.001
)
{
Context
.
SetFontSlot
(
fontslot_ASCII
,
1
)
;
var
nCharsCount
=
Math
.
floor
(
this
.
WidthVisible
/
nCharWidth
);
Get_WidthVisible
:
function
()
{
return
this
.
WidthVisible
;
},
var
_X
=
X
+
(
this
.
WidthVisible
-
nCharsCount
*
nCharWidth
)
/
2
;
for
(
var
nIndex
=
0
;
nIndex
<
nCharsCount
;
++
nIndex
,
_X
+=
nCharWidth
)
Context
.
FillText
(
_X
,
Y
,
sChar
);
}
}
Set_WidthVisible
:
function
(
WidthVisible
)
{
this
.
WidthVisible
=
WidthVisible
;
},
if
(
editor
&&
editor
.
ShowParaMarks
)
{
var
X0
=
this
.
Width
/
2
-
this
.
RealWidth
/
2
;
Is_RealContent
:
function
()
{
return
true
;
},
Context
.
SetFont
({
FontFamily
:
{
Name
:
"
ASCW3
"
,
Index
:
-
1
},
FontSize
:
10
,
Italic
:
false
,
Bold
:
false
});
Can_AddNumbering
:
function
()
{
return
true
;
},
if
(
X0
>
0
)
Context
.
FillText2
(
X
+
X0
,
Y
,
String
.
fromCharCode
(
tab_Symbol
),
0
,
this
.
Width
);
else
Context
.
FillText2
(
X
,
Y
,
String
.
fromCharCode
(
tab_Symbol
),
this
.
RealWidth
-
this
.
Width
,
this
.
Width
);
}
};
ParaTab
.
prototype
.
Measure
=
function
(
Context
)
{
this
.
DotWidth
=
Context
.
Measure
(
"
.
"
).
Width
;
this
.
UnderscoreWidth
=
Context
.
Measure
(
"
_
"
).
Width
;
this
.
HyphenWidth
=
Context
.
Measure
(
"
-
"
).
Width
*
1.5
;
this
.
MiddleDotWidth
=
Context
.
Measure
(
"
·
"
).
Width
;
Copy
:
function
()
{
return
new
ParaTab
();
},
Context
.
SetFont
({
FontFamily
:
{
Name
:
"
ASCW3
"
,
Index
:
-
1
},
FontSize
:
10
,
Italic
:
false
,
Bold
:
false
});
this
.
RealWidth
=
Context
.
Measure
(
String
.
fromCharCode
(
tab_Symbol
)).
Width
;
};
ParaTab
.
prototype
.
SetLeader
=
function
(
nLeaderType
)
{
this
.
Leader
=
nLeaderType
;
};
ParaTab
.
prototype
.
Get_Width
=
function
()
{
return
this
.
Width
;
};
ParaTab
.
prototype
.
Get_WidthVisible
=
function
()
{
return
this
.
WidthVisible
;
};
ParaTab
.
prototype
.
Set_WidthVisible
=
function
(
WidthVisible
)
{
this
.
WidthVisible
=
WidthVisible
;
};
ParaTab
.
prototype
.
Copy
=
function
()
{
return
new
ParaTab
();
};
Write_ToBinary
:
function
(
Writer
)
{
// Long : Type
// Long : TabType
Writer
.
WriteLong
(
para_Tab
);
Writer
.
WriteLong
(
this
.
TabType
);
},
Read_FromBinary
:
function
(
Reader
)
{
this
.
TabType
=
Reader
.
GetLong
();
}
};
// Класс ParaPageNum
function
ParaPageNum
()
...
...
word/Editor/Paragraph_Recalculate.js
View file @
b6c76476
...
...
@@ -2056,7 +2056,12 @@ Paragraph.prototype.private_RecalculateGetTabPos = function(X, ParaPr, CurPage,
NewX
=
Tab
.
Pos
+
PageStart
.
X
;
}
return
{
NewX
:
NewX
,
TabValue
:
(
null
===
Tab
?
tab_Left
:
Tab
.
Value
),
DefaultTab
:
(
null
===
Tab
?
true
:
false
)
};
return
{
NewX
:
NewX
,
TabValue
:
Tab
?
Tab
.
Value
:
tab_Left
,
DefaultTab
:
Tab
?
false
:
true
,
TabLeader
:
Tab
?
Tab
.
Leader
:
Asc
.
c_oAscTabLeader
.
None
};
};
Paragraph
.
prototype
.
private_CheckSkipKeepLinesAndWidowControl
=
function
(
CurPage
)
...
...
word/Editor/Run.js
View file @
b6c76476
...
...
@@ -3097,10 +3097,12 @@ ParaRun.prototype.Recalculate_Range = function(PRS, ParaPr, Depth)
SpaceLen
=
0
;
WordLen
=
0
;
var
TabPos
=
Para
.
private_RecalculateGetTabPos
(
X
,
ParaPr
,
PRS
.
Page
,
false
);
var
NewX
=
TabPos
.
NewX
;
var
TabPos
=
Para
.
private_RecalculateGetTabPos
(
X
,
ParaPr
,
PRS
.
Page
,
false
);
var
NewX
=
TabPos
.
NewX
;
var
TabValue
=
TabPos
.
TabValue
;
Item
.
SetLeader
(
TabPos
.
TabLeader
);
// Если таб не левый, значит он не может быть сразу рассчитан, а если левый, тогда
// рассчитываем его сразу здесь
if
(
tab_Left
!==
TabValue
)
...
...
word/Editor/Styles.js
View file @
b6c76476
...
...
@@ -8422,7 +8422,7 @@ function CParaTab(Value, Pos, Leader)
{
this
.
Value
=
Value
;
this
.
Pos
=
Pos
;
this
.
Leader
=
Leader
?
Leader
:
Asc
.
c_oAscTabLeader
.
None
;
this
.
Leader
=
undefined
!==
Leader
?
Leader
:
Asc
.
c_oAscTabLeader
.
None
;
}
CParaTab
.
prototype
.
Copy
=
function
()
{
...
...
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