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
be268e1d
Commit
be268e1d
authored
May 30, 2017
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Various embeddings of the content classes of the paragraph in others have been worked out.
parent
1a8664ae
Changes
5
Show whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
129 additions
and
271 deletions
+129
-271
word/Editor/Field.js
word/Editor/Field.js
+27
-86
word/Editor/Hyperlink.js
word/Editor/Hyperlink.js
+27
-102
word/Editor/Paragraph.js
word/Editor/Paragraph.js
+2
-0
word/Editor/ParagraphContentBase.js
word/Editor/ParagraphContentBase.js
+70
-1
word/Editor/StructuredDocumentTags/InlineLevel.js
word/Editor/StructuredDocumentTags/InlineLevel.js
+3
-82
No files found.
word/Editor/Field.js
View file @
be268e1d
...
@@ -123,62 +123,7 @@ ParaField.prototype.Remove_FromContent = function(Pos, Count, UpdatePosition)
...
@@ -123,62 +123,7 @@ ParaField.prototype.Remove_FromContent = function(Pos, Count, UpdatePosition)
};
};
ParaField
.
prototype
.
Add
=
function
(
Item
)
ParaField
.
prototype
.
Add
=
function
(
Item
)
{
{
switch
(
Item
.
Type
)
if
(
para_Field
===
Item
.
Type
)
{
case
para_Run
:
case
para_Hyperlink
:
{
var
TextPr
=
this
.
Get_FirstTextPr
();
Item
.
SelectAll
();
Item
.
Apply_TextPr
(
TextPr
);
Item
.
RemoveSelection
();
var
CurPos
=
this
.
State
.
ContentPos
;
var
CurItem
=
this
.
Content
[
CurPos
];
if
(
para_Run
===
CurItem
.
Type
)
{
var
NewRun
=
CurItem
.
Split2
(
CurItem
.
State
.
ContentPos
);
this
.
Add_ToContent
(
CurPos
+
1
,
Item
);
this
.
Add_ToContent
(
CurPos
+
2
,
NewRun
);
this
.
State
.
ContentPos
=
CurPos
+
2
;
this
.
Content
[
this
.
State
.
ContentPos
].
MoveCursorToStartPos
();
}
else
CurItem
.
Add
(
Item
);
break
;
}
case
para_Math
:
{
var
ContentPos
=
new
CParagraphContentPos
();
this
.
Get_ParaContentPos
(
false
,
false
,
ContentPos
);
var
CurPos
=
ContentPos
.
Get
(
0
);
// Ран формула делит на части, а в остальные элементы добавляется целиком
if
(
para_Run
===
this
.
Content
[
CurPos
].
Type
)
{
// Разделяем текущий элемент (возвращается правая часть)
var
NewElement
=
this
.
Content
[
CurPos
].
Split
(
ContentPos
,
1
);
if
(
null
!==
NewElement
)
this
.
Add_ToContent
(
CurPos
+
1
,
NewElement
,
true
);
var
Elem
=
new
ParaMath
();
Elem
.
Root
.
Load_FromMenu
(
Item
.
Menu
,
this
.
Get_Paragraph
());
Elem
.
Root
.
Correct_Content
(
true
);
this
.
Add_ToContent
(
CurPos
+
1
,
Elem
,
true
);
// Перемещаем кусор в конец формулы
this
.
State
.
ContentPos
=
CurPos
+
1
;
this
.
Content
[
this
.
State
.
ContentPos
].
MoveCursorToEndPos
(
false
);
}
else
this
.
Content
[
CurPos
].
Add
(
Item
);
break
;
}
case
para_Field
:
{
{
// Вместо добавления самого элемента добавляем его содержимое
// Вместо добавления самого элемента добавляем его содержимое
var
Count
=
Item
.
Content
.
length
;
var
Count
=
Item
.
Content
.
length
;
...
@@ -200,14 +145,10 @@ ParaField.prototype.Add = function(Item)
...
@@ -200,14 +145,10 @@ ParaField.prototype.Add = function(Item)
this
.
State
.
ContentPos
=
CurPos
+
Count
;
this
.
State
.
ContentPos
=
CurPos
+
Count
;
this
.
Content
[
this
.
State
.
ContentPos
].
MoveCursorToEndPos
();
this
.
Content
[
this
.
State
.
ContentPos
].
MoveCursorToEndPos
();
}
}
break
;
}
}
default
:
else
{
{
this
.
Content
[
this
.
State
.
ContentPos
].
Add
(
Item
);
CParagraphContentWithParagraphLikeContent
.
prototype
.
Add
.
apply
(
this
,
arguments
);
break
;
}
}
}
};
};
ParaField
.
prototype
.
Split
=
function
(
ContentPos
,
Depth
)
ParaField
.
prototype
.
Split
=
function
(
ContentPos
,
Depth
)
...
...
word/Editor/Hyperlink.js
View file @
be268e1d
...
@@ -108,78 +108,7 @@ ParaHyperlink.prototype.Remove_FromContent = function(Pos, Count, UpdatePosition
...
@@ -108,78 +108,7 @@ ParaHyperlink.prototype.Remove_FromContent = function(Pos, Count, UpdatePosition
ParaHyperlink
.
prototype
.
Add
=
function
(
Item
)
ParaHyperlink
.
prototype
.
Add
=
function
(
Item
)
{
{
switch
(
Item
.
Type
)
if
(
para_Hyperlink
===
Item
.
Type
)
{
case
para_Run
:
case
para_Field
:
case
para_InlineLevelSdt
:
{
var
TextPr
=
this
.
Get_FirstTextPr
();
Item
.
SelectAll
();
Item
.
Apply_TextPr
(
TextPr
);
Item
.
RemoveSelection
();
var
CurPos
=
this
.
State
.
ContentPos
;
var
CurItem
=
this
.
Content
[
CurPos
];
if
(
para_Run
===
CurItem
.
Type
||
para_Math
===
CurItem
.
Type
)
{
var
ContentPos
=
new
CParagraphContentPos
();
this
.
Content
[
CurPos
].
Get_ParaContentPos
(
false
,
false
,
ContentPos
);
// Разделяем текущий элемент (возвращается правая часть)
var
NewElement
=
this
.
Content
[
CurPos
].
Split
(
ContentPos
,
0
);
if
(
null
!==
NewElement
)
this
.
Add_ToContent
(
CurPos
+
1
,
NewElement
);
this
.
Add_ToContent
(
CurPos
+
1
,
Item
);
if
(
para_Field
===
Item
.
Type
)
{
this
.
State
.
ContentPos
=
CurPos
+
2
;
this
.
Content
[
this
.
State
.
ContentPos
].
MoveCursorToStartPos
(
false
);
}
else
{
this
.
State
.
ContentPos
=
CurPos
+
1
;
this
.
Content
[
this
.
State
.
ContentPos
].
MoveCursorToEndPos
(
false
);
}
}
else
CurItem
.
Add
(
Item
);
break
;
}
case
para_Math
:
{
var
ContentPos
=
new
CParagraphContentPos
();
this
.
Get_ParaContentPos
(
false
,
false
,
ContentPos
);
var
CurPos
=
ContentPos
.
Get
(
0
);
// Ран формула делит на части, а в остальные элементы добавляется целиком
if
(
para_Run
===
this
.
Content
[
CurPos
].
Type
)
{
// Разделяем текущий элемент (возвращается правая часть)
var
NewElement
=
this
.
Content
[
CurPos
].
Split
(
ContentPos
,
1
);
if
(
null
!==
NewElement
)
this
.
Add_ToContent
(
CurPos
+
1
,
NewElement
,
true
);
var
Elem
=
new
ParaMath
();
Elem
.
Root
.
Load_FromMenu
(
Item
.
Menu
,
this
.
Get_Paragraph
());
Elem
.
Root
.
Correct_Content
(
true
);
this
.
Add_ToContent
(
CurPos
+
1
,
Elem
,
true
);
// Перемещаем кусор в конец формулы
this
.
State
.
ContentPos
=
CurPos
+
1
;
this
.
Content
[
this
.
State
.
ContentPos
].
MoveCursorToEndPos
(
false
);
}
else
this
.
Content
[
CurPos
].
Add
(
Item
);
break
;
}
case
para_Hyperlink
:
{
{
// Вместо добавления самого элемента добавляем его содержимое
// Вместо добавления самого элемента добавляем его содержимое
var
Count
=
Item
.
Content
.
length
;
var
Count
=
Item
.
Content
.
length
;
...
@@ -201,14 +130,10 @@ ParaHyperlink.prototype.Add = function(Item)
...
@@ -201,14 +130,10 @@ ParaHyperlink.prototype.Add = function(Item)
this
.
State
.
ContentPos
=
CurPos
+
Count
;
this
.
State
.
ContentPos
=
CurPos
+
Count
;
this
.
Content
[
this
.
State
.
ContentPos
].
MoveCursorToEndPos
();
this
.
Content
[
this
.
State
.
ContentPos
].
MoveCursorToEndPos
();
}
}
break
;
}
}
default
:
else
{
{
this
.
Content
[
this
.
State
.
ContentPos
].
Add
(
Item
);
CParagraphContentWithParagraphLikeContent
.
prototype
.
Add
.
apply
(
this
,
arguments
);
break
;
}
}
}
};
};
...
...
word/Editor/Paragraph.js
View file @
be268e1d
...
@@ -3074,6 +3074,7 @@ Paragraph.prototype.Add = function(Item)
...
@@ -3074,6 +3074,7 @@ Paragraph.prototype.Add = function(Item)
}
}
case
para_Field
:
case
para_Field
:
case
para_InlineLevelSdt
:
case
para_InlineLevelSdt
:
case
para_Hyperlink
:
{
{
var
ContentPos
=
this
.
Get_ParaContentPos
(
false
,
false
);
var
ContentPos
=
this
.
Get_ParaContentPos
(
false
,
false
);
var
CurPos
=
ContentPos
.
Get
(
0
);
var
CurPos
=
ContentPos
.
Get
(
0
);
...
@@ -12057,6 +12058,7 @@ Paragraph.prototype.AddContentControl = function(nContentControlType)
...
@@ -12057,6 +12058,7 @@ Paragraph.prototype.AddContentControl = function(nContentControlType)
var
oContentControl
=
new
CInlineLevelSdt
();
var
oContentControl
=
new
CInlineLevelSdt
();
oContentControl
.
Add_ToContent
(
0
,
new
ParaRun
());
oContentControl
.
Add_ToContent
(
0
,
new
ParaRun
());
this
.
Add
(
oContentControl
);
this
.
Add
(
oContentControl
);
oContentControl
.
MoveCursorToStartPos
();
return
oContentControl
;
return
oContentControl
;
};
};
...
...
word/Editor/ParagraphContentBase.js
View file @
be268e1d
...
@@ -2763,7 +2763,76 @@ CParagraphContentWithParagraphLikeContent.prototype.GetSelectedContentControls =
...
@@ -2763,7 +2763,76 @@ CParagraphContentWithParagraphLikeContent.prototype.GetSelectedContentControls =
//----------------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------
// Функции, которые должны быть реализованы в классах наследниках
// Функции, которые должны быть реализованы в классах наследниках
//----------------------------------------------------------------------------------------------------------------------
//----------------------------------------------------------------------------------------------------------------------
CParagraphContentWithParagraphLikeContent
.
prototype
.
Add
=
function
(
Item
){};
CParagraphContentWithParagraphLikeContent
.
prototype
.
Add
=
function
(
Item
)
{
switch
(
Item
.
Type
)
{
case
para_Run
:
case
para_Hyperlink
:
case
para_InlineLevelSdt
:
case
para_Field
:
{
var
TextPr
=
this
.
Get_FirstTextPr
();
Item
.
SelectAll
();
Item
.
Apply_TextPr
(
TextPr
);
Item
.
RemoveSelection
();
var
CurPos
=
this
.
State
.
ContentPos
;
var
CurItem
=
this
.
Content
[
CurPos
];
if
(
para_Run
===
CurItem
.
Type
)
{
var
NewRun
=
CurItem
.
Split2
(
CurItem
.
State
.
ContentPos
);
this
.
Add_ToContent
(
CurPos
+
1
,
Item
);
this
.
Add_ToContent
(
CurPos
+
2
,
NewRun
);
this
.
State
.
ContentPos
=
CurPos
+
2
;
this
.
Content
[
this
.
State
.
ContentPos
].
MoveCursorToStartPos
();
}
else
{
CurItem
.
Add
(
Item
);
}
break
;
}
case
para_Math
:
{
var
ContentPos
=
new
CParagraphContentPos
();
this
.
Get_ParaContentPos
(
false
,
false
,
ContentPos
);
var
CurPos
=
ContentPos
.
Get
(
0
);
// Ран формула делит на части, а в остальные элементы добавляется целиком
if
(
para_Run
===
this
.
Content
[
CurPos
].
Type
)
{
// Разделяем текущий элемент (возвращается правая часть)
var
NewElement
=
this
.
Content
[
CurPos
].
Split
(
ContentPos
,
1
);
if
(
null
!==
NewElement
)
this
.
Add_ToContent
(
CurPos
+
1
,
NewElement
,
true
);
var
Elem
=
new
ParaMath
();
Elem
.
Root
.
Load_FromMenu
(
Item
.
Menu
,
this
.
Get_Paragraph
());
Elem
.
Root
.
Correct_Content
(
true
);
this
.
Add_ToContent
(
CurPos
+
1
,
Elem
,
true
);
// Перемещаем кусор в конец формулы
this
.
State
.
ContentPos
=
CurPos
+
1
;
this
.
Content
[
this
.
State
.
ContentPos
].
MoveCursorToEndPos
(
false
);
}
else
{
this
.
Content
[
CurPos
].
Add
(
Item
);
}
break
;
}
default
:
{
this
.
Content
[
this
.
State
.
ContentPos
].
Add
(
Item
);
break
;
}
}
};
CParagraphContentWithParagraphLikeContent
.
prototype
.
Undo
=
function
(
Data
){};
CParagraphContentWithParagraphLikeContent
.
prototype
.
Undo
=
function
(
Data
){};
CParagraphContentWithParagraphLikeContent
.
prototype
.
Redo
=
function
(
Data
){};
CParagraphContentWithParagraphLikeContent
.
prototype
.
Redo
=
function
(
Data
){};
CParagraphContentWithParagraphLikeContent
.
prototype
.
Save_Changes
=
function
(
Data
,
Writer
){};
CParagraphContentWithParagraphLikeContent
.
prototype
.
Save_Changes
=
function
(
Data
,
Writer
){};
...
...
word/Editor/StructuredDocumentTags/InlineLevel.js
View file @
be268e1d
...
@@ -94,72 +94,6 @@ CInlineLevelSdt.prototype.Remove_FromContent = function(Pos, Count, UpdatePositi
...
@@ -94,72 +94,6 @@ CInlineLevelSdt.prototype.Remove_FromContent = function(Pos, Count, UpdatePositi
CParagraphContentWithParagraphLikeContent
.
prototype
.
Remove_FromContent
.
apply
(
this
,
arguments
);
CParagraphContentWithParagraphLikeContent
.
prototype
.
Remove_FromContent
.
apply
(
this
,
arguments
);
};
};
CInlineLevelSdt
.
prototype
.
Add
=
function
(
Item
)
{
switch
(
Item
.
Type
)
{
case
para_Run
:
case
para_Hyperlink
:
case
para_InlineLevelSdt
:
case
para_Field
:
{
var
TextPr
=
this
.
Get_FirstTextPr
();
Item
.
SelectAll
();
Item
.
Apply_TextPr
(
TextPr
);
Item
.
RemoveSelection
();
var
CurPos
=
this
.
State
.
ContentPos
;
var
CurItem
=
this
.
Content
[
CurPos
];
if
(
para_Run
===
CurItem
.
Type
)
{
var
NewRun
=
CurItem
.
Split2
(
CurItem
.
State
.
ContentPos
);
this
.
Add_ToContent
(
CurPos
+
1
,
Item
);
this
.
Add_ToContent
(
CurPos
+
2
,
NewRun
);
this
.
State
.
ContentPos
=
CurPos
+
2
;
this
.
Content
[
this
.
State
.
ContentPos
].
MoveCursorToStartPos
();
}
else
CurItem
.
Add
(
Item
);
break
;
}
case
para_Math
:
{
var
ContentPos
=
new
CParagraphContentPos
();
this
.
Get_ParaContentPos
(
false
,
false
,
ContentPos
);
var
CurPos
=
ContentPos
.
Get
(
0
);
// Ран формула делит на части, а в остальные элементы добавляется целиком
if
(
para_Run
===
this
.
Content
[
CurPos
].
Type
)
{
// Разделяем текущий элемент (возвращается правая часть)
var
NewElement
=
this
.
Content
[
CurPos
].
Split
(
ContentPos
,
1
);
if
(
null
!==
NewElement
)
this
.
Add_ToContent
(
CurPos
+
1
,
NewElement
,
true
);
var
Elem
=
new
ParaMath
();
Elem
.
Root
.
Load_FromMenu
(
Item
.
Menu
,
this
.
Get_Paragraph
());
Elem
.
Root
.
Correct_Content
(
true
);
this
.
Add_ToContent
(
CurPos
+
1
,
Elem
,
true
);
// Перемещаем кусор в конец формулы
this
.
State
.
ContentPos
=
CurPos
+
1
;
this
.
Content
[
this
.
State
.
ContentPos
].
MoveCursorToEndPos
(
false
);
}
else
this
.
Content
[
CurPos
].
Add
(
Item
);
break
;
}
default
:
{
this
.
Content
[
this
.
State
.
ContentPos
].
Add
(
Item
);
break
;
}
}
};
CInlineLevelSdt
.
prototype
.
Split
=
function
(
ContentPos
,
Depth
)
CInlineLevelSdt
.
prototype
.
Split
=
function
(
ContentPos
,
Depth
)
{
{
// Не даем разделять
// Не даем разделять
...
@@ -453,21 +387,10 @@ function TEST_ADD_SDT()
...
@@ -453,21 +387,10 @@ function TEST_ADD_SDT()
oLogicDocument
.
Create_NewHistoryPoint
();
oLogicDocument
.
Create_NewHistoryPoint
();
var
oRun
=
new
ParaRun
();
oRun
.
Add
(
new
ParaText
(
"
S
"
));
oRun
.
Add
(
new
ParaText
(
"
d
"
));
oRun
.
Add
(
new
ParaText
(
"
t
"
));
var
oInlineContentControl
=
oLogicDocument
.
AddContentControl
(
AscCommonWord
.
sdttype_InlineLevel
);
var
oInlineContentControl
=
oLogicDocument
.
AddContentControl
(
AscCommonWord
.
sdttype_InlineLevel
);
oInlineContentControl
.
Add
(
new
ParaText
(
"
S
"
));
// var oInlineContentControl = new CInlineLevelSdt();
oInlineContentControl
.
Add
(
new
ParaText
(
"
d
"
));
oInlineContentControl
.
Add_ToContent
(
0
,
oRun
);
oInlineContentControl
.
Add
(
new
ParaText
(
"
t
"
));
// var oPara = oLogicDocument.GetCurrentParagraph();
// oPara.Add_ToContent(0, new ParaRun());
// oPara.Add_ToContent(1, oInlineContentControl);
oLogicDocument
.
Recalculate
();
oLogicDocument
.
Recalculate
();
oLogicDocument
.
Document_UpdateSelectionState
();
oLogicDocument
.
Document_UpdateSelectionState
();
...
@@ -483,13 +406,11 @@ function TEST_ADD_SDT2()
...
@@ -483,13 +406,11 @@ function TEST_ADD_SDT2()
oLogicDocument
.
Create_NewHistoryPoint
();
oLogicDocument
.
Create_NewHistoryPoint
();
var
oSdt
=
oLogicDocument
.
AddContentControl
(
AscCommonWord
.
sdttype_BlockLevel
);
var
oSdt
=
oLogicDocument
.
AddContentControl
(
AscCommonWord
.
sdttype_BlockLevel
);
oSdt
.
AddToParagraph
(
new
ParaText
(
"
S
"
));
oSdt
.
AddToParagraph
(
new
ParaText
(
"
S
"
));
oSdt
.
AddToParagraph
(
new
ParaText
(
"
d
"
));
oSdt
.
AddToParagraph
(
new
ParaText
(
"
d
"
));
oSdt
.
AddToParagraph
(
new
ParaText
(
"
t
"
));
oSdt
.
AddToParagraph
(
new
ParaText
(
"
t
"
));
oLogicDocument
.
Recalculate
();
oLogicDocument
.
Recalculate
();
oLogicDocument
.
Document_UpdateSelectionState
();
oLogicDocument
.
Document_UpdateSelectionState
();
oLogicDocument
.
Document_UpdateInterfaceState
();
oLogicDocument
.
Document_UpdateInterfaceState
();
...
...
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