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
b5872b42
Commit
b5872b42
authored
Nov 02, 2017
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added the new field of CParaTab class - Leader.
parent
5d49f5ed
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
197 additions
and
166 deletions
+197
-166
common/apiCommon.js
common/apiCommon.js
+31
-15
word/Editor/Paragraph/ComplexField.js
word/Editor/Paragraph/ComplexField.js
+1
-1
word/Editor/Styles.js
word/Editor/Styles.js
+150
-150
word/apiDefines.js
word/apiDefines.js
+15
-0
No files found.
common/apiCommon.js
View file @
b5872b42
...
...
@@ -1418,21 +1418,35 @@
};
/** @constructor */
function
asc_CParagraphTab
(
Pos
,
Value
)
{
this
.
Pos
=
Pos
;
this
.
Value
=
Value
;
function
asc_CParagraphTab
(
Pos
,
Value
,
Leader
)
{
this
.
Pos
=
Pos
;
this
.
Value
=
Value
;
this
.
Leader
=
Leader
;
}
asc_CParagraphTab
.
prototype
=
{
asc_getValue
:
function
()
{
return
this
.
Value
;
},
asc_putValue
:
function
(
v
)
{
this
.
Value
=
v
;
},
asc_getPos
:
function
()
{
return
this
.
Pos
;
},
asc_putPos
:
function
(
v
)
{
this
.
Pos
=
v
;
}
asc_CParagraphTab
.
prototype
.
asc_getValue
=
function
()
{
return
this
.
Value
;
};
asc_CParagraphTab
.
prototype
.
asc_putValue
=
function
(
v
)
{
this
.
Value
=
v
;
};
asc_CParagraphTab
.
prototype
.
asc_getPos
=
function
()
{
return
this
.
Pos
;
};
asc_CParagraphTab
.
prototype
.
asc_putPos
=
function
(
v
)
{
this
.
Pos
=
v
;
};
asc_CParagraphTab
.
prototype
.
asc_getLeader
=
function
()
{
return
this
.
Leader
;
};
asc_CParagraphTab
.
prototype
.
asc_putLeader
=
function
(
v
)
{
this
.
Leader
=
v
;
};
/** @constructor */
...
...
@@ -1442,7 +1456,7 @@
if
(
undefined
!=
obj
)
{
var
Count
=
obj
.
Tabs
.
length
;
for
(
var
Index
=
0
;
Index
<
Count
;
Index
++
)
{
this
.
Tabs
.
push
(
new
asc_CParagraphTab
(
obj
.
Tabs
[
Index
].
Pos
,
obj
.
Tabs
[
Index
].
Value
));
this
.
Tabs
.
push
(
new
asc_CParagraphTab
(
obj
.
Tabs
[
Index
].
Pos
,
obj
.
Tabs
[
Index
].
Value
,
obj
.
Tabs
[
Index
].
Leader
));
}
}
}
...
...
@@ -3800,6 +3814,8 @@
prot
[
"
put_Value
"
]
=
prot
[
"
asc_putValue
"
]
=
prot
.
asc_putValue
;
prot
[
"
get_Pos
"
]
=
prot
[
"
asc_getPos
"
]
=
prot
.
asc_getPos
;
prot
[
"
put_Pos
"
]
=
prot
[
"
asc_putPos
"
]
=
prot
.
asc_putPos
;
prot
[
"
get_Leader
"
]
=
prot
[
"
asc_getPos
"
]
=
prot
.
asc_getLeader
;
prot
[
"
put_Leader
"
]
=
prot
[
"
asc_putPos
"
]
=
prot
.
asc_putLeader
;
window
[
"
Asc
"
][
"
asc_CParagraphTabs
"
]
=
window
[
"
Asc
"
].
asc_CParagraphTabs
=
asc_CParagraphTabs
;
prot
=
asc_CParagraphTabs
.
prototype
;
...
...
word/Editor/Paragraph/ComplexField.js
View file @
b5872b42
...
...
@@ -279,7 +279,7 @@ CComplexField.prototype.Update = function()
// Значение таба зависит от текущей секции
var
oTabs
=
new
CParaTabs
();
oTabs
.
Add
(
new
CParaTab
(
tab_Right
,
9345
/
20
/
72
*
25.4
));
oTabs
.
Add
(
new
CParaTab
(
tab_Right
,
9345
/
20
/
72
*
25.4
,
c_oAscTabLeader
.
Dot
));
oPara
.
Set_Tabs
(
oTabs
);
var
oTabRun
=
new
ParaRun
(
oPara
,
false
);
...
...
word/Editor/Styles.js
View file @
b5872b42
...
...
@@ -8418,184 +8418,184 @@ CTextPr.prototype['Get_Lang'] = CTextPr.prototype.Get_Lang;
CTextPr
.
prototype
[
'
Get_Shd
'
]
=
CTextPr
.
prototype
.
Get_Shd
;
//----------------------------------------------------------------------------------------------------------------------
function
CParaTab
(
Value
,
Pos
)
function
CParaTab
(
Value
,
Pos
,
Leader
)
{
this
.
Value
=
Value
;
this
.
Pos
=
Pos
;
this
.
Value
=
Value
;
this
.
Pos
=
Pos
;
this
.
Leader
=
Leader
?
Leader
:
c_oAscTabLeader
.
None
;
}
CParaTab
.
prototype
=
CParaTab
.
prototype
.
Copy
=
function
()
{
Copy
:
function
()
{
return
new
CParaTab
(
this
.
Value
,
this
.
Pos
);
},
Is_Equal
:
function
(
Tab
)
{
if
(
this
.
Value
!==
Tab
.
Value
||
this
.
Pos
!==
Tab
.
Pos
)
return
false
;
return
new
CParaTab
(
this
.
Value
,
this
.
Pos
,
this
.
Leader
);
};
CParaTab
.
prototype
.
Is_Equal
=
function
(
Tab
)
{
return
this
.
IsEqual
(
Tab
);
};
CParaTab
.
prototype
.
IsEqual
=
function
(
Tab
)
{
// TODO: Если таб точно такого же типа и в той же позиции, то неясно нужно ли проверять совпадение Tab.Leader
if
(
this
.
Value
!==
Tab
.
Value
||
this
.
Pos
!==
Tab
.
Pos
)
return
false
;
return
true
;
}
return
true
;
};
function
CParaTabs
()
{
this
.
Tabs
=
[];
this
.
Tabs
=
[];
}
CParaTabs
.
prototype
=
CParaTabs
.
prototype
.
Add
=
function
(
_Tab
)
{
Add
:
function
(
_Tab
)
{
var
Index
=
0
;
for
(
Index
=
0
;
Index
<
this
.
Tabs
.
length
;
Index
++
)
{
var
Tab
=
this
.
Tabs
[
Index
];
if
(
Math
.
abs
(
Tab
.
Pos
-
_Tab
.
Pos
)
<
0.001
)
{
this
.
Tabs
.
splice
(
Index
,
1
,
_Tab
);
break
;
}
if
(
Tab
.
Pos
>
_Tab
.
Pos
)
break
;
}
if
(
-
1
!=
Index
)
this
.
Tabs
.
splice
(
Index
,
0
,
_Tab
);
},
Merge
:
function
(
Tabs
)
{
var
_Tabs
=
Tabs
.
Tabs
;
for
(
var
Index
=
0
;
Index
<
_Tabs
.
length
;
Index
++
)
{
var
_Tab
=
_Tabs
[
Index
];
var
Index2
=
0
;
var
Flag
=
0
;
for
(
Index2
=
0
;
Index2
<
this
.
Tabs
.
length
;
Index2
++
)
{
var
Tab
=
this
.
Tabs
[
Index2
];
if
(
Math
.
abs
(
Tab
.
Pos
-
_Tab
.
Pos
)
<
0.001
)
{
if
(
tab_Clear
===
_Tab
.
Value
)
Flag
=
-
2
;
// таб нужно удалить
else
Flag
=
-
1
;
// табы совпали, не надо новый добавлять
break
;
}
if
(
Tab
.
Pos
>
_Tab
.
Pos
)
break
;
}
var
Index
=
0
;
for
(
Index
=
0
;
Index
<
this
.
Tabs
.
length
;
Index
++
)
{
var
Tab
=
this
.
Tabs
[
Index
];
if
(
-
2
===
Flag
)
this
.
Tabs
.
splice
(
Index2
,
1
);
else
if
(
-
1
!=
Flag
)
this
.
Tabs
.
splice
(
Index2
,
0
,
_Tab
);
}
},
if
(
Math
.
abs
(
Tab
.
Pos
-
_Tab
.
Pos
)
<
0.001
)
{
this
.
Tabs
.
splice
(
Index
,
1
,
_Tab
);
break
;
}
Is_Equal
:
function
(
Tabs
)
{
if
(
this
.
Tabs
.
length
!==
Tabs
.
Tabs
.
length
)
return
false
;
if
(
Tab
.
Pos
>
_Tab
.
Pos
)
break
;
}
for
(
var
CurTab
=
0
,
TabsCount
=
this
.
Tabs
.
length
;
CurTab
<
TabsCount
;
CurTab
++
)
{
if
(
true
!==
this
.
Tabs
[
CurTab
].
Is_Equal
(
Tabs
.
Tabs
[
CurTab
]))
return
false
;
}
if
(
-
1
!=
Index
)
this
.
Tabs
.
splice
(
Index
,
0
,
_Tab
);
};
CParaTabs
.
prototype
.
Merge
=
function
(
Tabs
)
{
var
_Tabs
=
Tabs
.
Tabs
;
return
true
;
},
for
(
var
Index
=
0
;
Index
<
_Tabs
.
length
;
Index
++
)
{
var
_Tab
=
_Tabs
[
Index
];
Copy
:
function
()
{
var
Tabs
=
new
CParaTabs
();
var
Count
=
this
.
Tabs
.
length
;
var
Index2
=
0
;
var
Flag
=
0
;
for
(
Index2
=
0
;
Index2
<
this
.
Tabs
.
length
;
Index2
++
)
{
var
Tab
=
this
.
Tabs
[
Index2
];
for
(
var
Index
=
0
;
Index
<
Count
;
Index
++
)
Tabs
.
Add
(
this
.
Tabs
[
Index
].
Copy
()
);
if
(
Math
.
abs
(
Tab
.
Pos
-
_Tab
.
Pos
)
<
0.001
)
{
if
(
tab_Clear
===
_Tab
.
Value
)
Flag
=
-
2
;
// таб нужно удалить
else
Flag
=
-
1
;
// табы совпали, не надо новый добавлять
return
Tabs
;
},
break
;
}
Set_FromObject
:
function
(
Tabs
)
{
if
(
Tabs
instanceof
Array
)
{
var
Count
=
Tabs
.
length
;
for
(
var
Index
=
0
;
Index
<
Count
;
Index
++
)
this
.
Add
(
new
CParaTab
(
Tabs
[
Index
].
Value
,
Tabs
[
Index
].
Pos
)
);
}
},
if
(
Tab
.
Pos
>
_Tab
.
Pos
)
break
;
}
Get_Count
:
function
()
{
return
this
.
Tabs
.
length
;
},
if
(
-
2
===
Flag
)
this
.
Tabs
.
splice
(
Index2
,
1
);
else
if
(
-
1
!=
Flag
)
this
.
Tabs
.
splice
(
Index2
,
0
,
_Tab
);
}
};
CParaTabs
.
prototype
.
IsEqual
=
function
(
Tabs
)
{
if
(
this
.
Tabs
.
length
!==
Tabs
.
Tabs
.
length
)
return
false
;
Get
:
function
(
Index
)
{
return
this
.
Tabs
[
Index
];
},
for
(
var
CurTab
=
0
,
TabsCount
=
this
.
Tabs
.
length
;
CurTab
<
TabsCount
;
CurTab
++
)
{
if
(
true
!==
this
.
Tabs
[
CurTab
].
IsEqual
(
Tabs
.
Tabs
[
CurTab
]))
return
false
;
}
Get_Value
:
function
(
Pos
)
{
var
Count
=
this
.
Tabs
.
length
;
for
(
var
Index
=
0
;
Index
<
Count
;
Index
++
)
{
var
Tab
=
this
.
Tabs
[
Index
];
if
(
Math
.
abs
(
Tab
.
Pos
-
Pos
)
<
0.001
)
return
Tab
.
Value
;
}
return
true
;
};
CParaTabs
.
prototype
.
Is_Equal
=
function
(
Tabs
)
{
return
this
.
IsEqual
(
Tabs
);
};
CParaTabs
.
prototype
.
Copy
=
function
()
{
var
Tabs
=
new
CParaTabs
();
var
Count
=
this
.
Tabs
.
length
;
return
-
1
;
},
for
(
var
Index
=
0
;
Index
<
Count
;
Index
++
)
Tabs
.
Add
(
this
.
Tabs
[
Index
].
Copy
());
Write_ToBinary
:
function
(
Writer
)
{
// Long : количество (если 0, удаляем элемент)
// Массив
// Byte : Value
// Double : Pos
return
Tabs
;
};
CParaTabs
.
prototype
.
Set_FromObject
=
function
(
Tabs
)
{
if
(
Tabs
instanceof
Array
)
{
var
Count
=
Tabs
.
length
;
for
(
var
Index
=
0
;
Index
<
Count
;
Index
++
)
this
.
Add
(
new
CParaTab
(
Tabs
[
Index
].
Value
,
Tabs
[
Index
].
Pos
,
Tabs
[
nIndex
].
Leader
));
}
};
CParaTabs
.
prototype
.
GetCount
=
function
()
{
return
this
.
Tabs
.
length
;
};
CParaTabs
.
prototype
.
Get_Count
=
function
()
{
return
this
.
GetCount
();
};
CParaTabs
.
prototype
.
Get
=
function
(
Index
)
{
return
this
.
Tabs
[
Index
];
};
CParaTabs
.
prototype
.
Get_Value
=
function
(
Pos
)
{
var
Count
=
this
.
Tabs
.
length
;
for
(
var
Index
=
0
;
Index
<
Count
;
Index
++
)
{
var
Tab
=
this
.
Tabs
[
Index
];
if
(
Math
.
abs
(
Tab
.
Pos
-
Pos
)
<
0.001
)
return
Tab
.
Value
;
}
var
Count
=
this
.
Tabs
.
length
;
Writer
.
WriteLong
(
Count
);
return
-
1
;
};
CParaTabs
.
prototype
.
Write_ToBinary
=
function
(
Writer
)
{
// Long : количество (если 0, удаляем элемент)
// Массив
// Byte : Value
// Double : Pos
// Long : Leader
for
(
var
Index
=
0
;
Index
<
Count
;
Index
++
)
{
Writer
.
WriteByte
(
this
.
Tabs
[
Index
].
Value
);
Writer
.
WriteDouble
(
this
.
Tabs
[
Index
].
Pos
);
}
},
var
Count
=
this
.
Tabs
.
length
;
Writer
.
WriteLong
(
Count
);
Read_FromBinary
:
function
(
Reader
)
{
// Long : количество (если 0, удаляем элемент)
// Массив
// Byte : Value
// Double : Pos
for
(
var
Index
=
0
;
Index
<
Count
;
Index
++
)
{
Writer
.
WriteByte
(
this
.
Tabs
[
Index
].
Value
);
Writer
.
WriteDouble
(
this
.
Tabs
[
Index
].
Pos
);
Writer
.
WriteLong
(
this
.
Tabs
[
Index
].
Leader
);
}
};
CParaTabs
.
prototype
.
Read_FromBinary
=
function
(
Reader
)
{
// Long : количество (если 0, удаляем элемент)
// Массив
// Byte : Value
// Double : Pos
// Long : Leader
var
Count
=
Reader
.
GetLong
();
this
.
Tabs
=
[];
var
Count
=
Reader
.
GetLong
();
this
.
Tabs
=
[];
for
(
var
Index
=
0
;
Index
<
Count
;
Index
++
)
{
var
Value
=
Reader
.
GetByte
();
var
Pos
=
Reader
.
GetDouble
();
this
.
Add
(
new
CParaTab
(
Value
,
Pos
)
);
}
}
for
(
var
Index
=
0
;
Index
<
Count
;
Index
++
)
{
var
Value
=
Reader
.
GetByte
();
var
Pos
=
Reader
.
GetDouble
();
var
Leader
=
Reader
.
GetLong
(
);
this
.
Add
(
new
CParaTab
(
Value
,
Pos
,
Leader
));
}
};
function
CParaInd
()
...
...
word/apiDefines.js
View file @
b5872b42
...
...
@@ -206,6 +206,14 @@ var c_oAscNumberingFormat = {
DecimalZero
:
0x2007
// numbering_numfmt_DecimalZero
};
var
c_oAscTabLeader
=
{
None
:
0x00
,
Dot
:
0x01
,
Hyphen
:
0x02
,
MiddleDot
:
0x03
,
Underscore
:
0x04
};
window
[
"
flat_desine
"
]
=
false
;
//------------------------------------------------------------export---------------------------------------------------
...
...
@@ -304,6 +312,13 @@ prot['LowerLetter'] = c_oAscNumberingFormat.LowerLetter;
prot
[
'
UpperLetter
'
]
=
c_oAscNumberingFormat
.
UpperLetter
;
prot
[
'
DecimalZero
'
]
=
c_oAscNumberingFormat
.
DecimalZero
;
prot
=
window
[
'
Asc
'
][
'
c_oAscTabLeader
'
]
=
c_oAscTabLeader
;
prot
[
"
None
"
]
=
c_oAscTabLeader
.
None
;
prot
[
"
Dot
"
]
=
c_oAscTabLeader
.
Dot
;
prot
[
"
Hyphen
"
]
=
c_oAscTabLeader
.
Hyphen
;
prot
[
"
MiddleDot
"
]
=
c_oAscTabLeader
.
MiddleDot
;
prot
[
"
Underscore
"
]
=
c_oAscTabLeader
.
Underscore
;
window
[
'
AscCommon
'
]
=
window
[
'
AscCommon
'
]
||
{};
window
[
'
AscCommon
'
].
c_oSerFormat
=
c_oSerFormat
;
...
...
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