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
acf84ab6
Commit
acf84ab6
authored
Jun 20, 2016
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Рефакторинг и частичная реализация для сносок функции выделения.
parent
a73ed133
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
200 additions
and
118 deletions
+200
-118
word/Editor/Document.js
word/Editor/Document.js
+105
-118
word/Editor/DocumentControllerBase.js
word/Editor/DocumentControllerBase.js
+18
-0
word/Editor/DrawingsController.js
word/Editor/DrawingsController.js
+12
-0
word/Editor/Footnotes.js
word/Editor/Footnotes.js
+41
-0
word/Editor/HeaderFooterController.js
word/Editor/HeaderFooterController.js
+12
-0
word/Editor/LogicDocumentController.js
word/Editor/LogicDocumentController.js
+12
-0
No files found.
word/Editor/Document.js
View file @
acf84ab6
...
...
@@ -5211,24 +5211,14 @@ CDocument.prototype.Selection_SetEnd = function(X, Y, MouseEvent)
*/
CDocument
.
prototype
.
Selection_Is_OneElement
=
function
()
{
if
(
true
===
this
.
Selection
.
Use
&&
this
.
CurPos
.
Type
===
docpostype_Content
&&
this
.
Selection
.
Flag
===
selectionflag_Common
&&
this
.
Selection
.
StartPos
===
this
.
Selection
.
EndPos
)
return
0
;
if
(
true
===
this
.
Selection
.
Use
&&
docpostype_Content
===
this
.
Get_DocPosType
()
&&
this
.
Selection
.
Flag
===
selectionflag_Common
&&
this
.
Selection
.
StartPos
===
this
.
Selection
.
EndPos
)
return
0
;
return
(
this
.
Selection
.
StartPos
<
this
.
Selection
.
EndPos
?
1
:
-
1
);
return
(
this
.
Selection
.
StartPos
<
this
.
Selection
.
EndPos
?
1
:
-
1
);
};
CDocument
.
prototype
.
Selection_Is_TableBorderMove
=
function
()
{
if
(
docpostype_HdrFtr
===
this
.
CurPos
.
Type
)
return
this
.
HdrFtr
.
Selection_Is_TableBorderMove
();
else
if
(
docpostype_DrawingObjects
===
this
.
CurPos
.
Type
)
return
this
.
DrawingObjects
.
selectionIsTableBorder
();
else
//if ( docpostype_Content === this.CurPos.Type )
{
if
(
null
!=
this
.
Selection
.
Data
&&
true
===
this
.
Selection
.
Data
.
TableBorder
&&
type_Table
==
this
.
Content
[
this
.
Selection
.
Data
.
Pos
].
GetType
())
return
true
;
}
return
false
;
return
this
.
Controller
.
IsMovingTableBorder
();
};
/**
* Проверяем попали ли мы в селект.
...
...
@@ -5238,119 +5228,29 @@ CDocument.prototype.Selection_Is_TableBorderMove = function()
* @param NearPos
* @returns {boolean}
*/
CDocument
.
prototype
.
Selection_Check
=
function
(
X
,
Y
,
Page
_
Abs
,
NearPos
)
CDocument
.
prototype
.
Selection_Check
=
function
(
X
,
Y
,
PageAbs
,
NearPos
)
{
// Работаем с колонтитулом
if
(
docpostype_HdrFtr
===
this
.
CurPos
.
Type
)
return
this
.
HdrFtr
.
Selection_Check
(
X
,
Y
,
Page_Abs
,
NearPos
);
else
if
(
docpostype_DrawingObjects
===
this
.
CurPos
.
Type
)
return
this
.
DrawingObjects
.
selectionCheck
(
X
,
Y
,
Page_Abs
,
NearPos
);
else
//if ( docpostype_Content === this.CurPos.Type )
{
if
(
true
===
this
.
Selection
.
Use
)
{
switch
(
this
.
Selection
.
Flag
)
{
case
selectionflag_Common
:
{
var
Start
=
this
.
Selection
.
StartPos
;
var
End
=
this
.
Selection
.
EndPos
;
if
(
Start
>
End
)
{
Start
=
this
.
Selection
.
EndPos
;
End
=
this
.
Selection
.
StartPos
;
}
if
(
undefined
!==
NearPos
)
{
for
(
var
Index
=
Start
;
Index
<=
End
;
Index
++
)
{
if
(
true
===
this
.
Content
[
Index
].
Selection_Check
(
0
,
0
,
0
,
NearPos
))
return
true
;
}
return
false
;
}
else
{
var
ContentPos
=
this
.
Internal_GetContentPosByXY
(
X
,
Y
,
Page_Abs
,
NearPos
);
if
(
ContentPos
>
Start
&&
ContentPos
<
End
)
{
return
true
;
}
else
if
(
ContentPos
<
Start
||
ContentPos
>
End
)
{
return
false
;
}
else
{
var
ElementPageIndex
=
this
.
private_GetElementPageIndexByXY
(
ContentPos
,
X
,
Y
,
Page_Abs
);
return
this
.
Content
[
ContentPos
].
Selection_Check
(
X
,
Y
,
ElementPageIndex
,
undefined
);
}
}
}
case
selectionflag_Numbering
:
{
return
false
;
}
}
return
false
;
}
return
false
;
}
return
this
.
Controller
.
CheckPosInSelection
(
X
,
Y
,
PageAbs
,
NearPos
);
};
/**
* Выделяем все содержимое, в зависимости от текущего положения курсора.
*/
CDocument
.
prototype
.
Select_All
=
function
()
CDocument
.
prototype
.
Select_All
=
function
()
{
this
.
private_UpdateTargetForCollaboration
();
// Работаем с колонтитулом
if
(
docpostype_HdrFtr
===
this
.
CurPos
.
Type
)
{
this
.
HdrFtr
.
Select_All
();
}
else
if
(
docpostype_DrawingObjects
===
this
.
CurPos
.
Type
&&
true
===
this
.
DrawingObjects
.
isSelectedText
())
{
this
.
DrawingObjects
.
selectAll
();
}
else
{
if
(
true
===
this
.
Selection
.
Use
)
this
.
Selection_Remove
();
this
.
DrawingDocument
.
SelectEnabled
(
true
);
this
.
DrawingDocument
.
TargetEnd
();
this
.
Set_DocPosType
(
docpostype_Content
);
this
.
Selection
.
Use
=
true
;
this
.
Selection
.
Start
=
false
;
this
.
Selection
.
Flag
=
selectionflag_Common
;
this
.
Selection
.
StartPos
=
0
;
this
.
Selection
.
EndPos
=
this
.
Content
.
length
-
1
;
this
.
private_UpdateTargetForCollaboration
();
for
(
var
Index
=
0
;
Index
<
this
.
Content
.
length
;
Index
++
)
{
this
.
Content
[
Index
].
Select_All
();
}
}
this
.
Controller
.
SelectAll
();
// TODO: Пока делаем Start = true, чтобы при Ctrl+A не происходил переход к концу селекта, надо будет
// сделать по нормальному
this
.
Selection
.
Start
=
true
;
this
.
Document_UpdateSelectionState
();
this
.
Document_UpdateInterfaceState
();
this
.
Document_UpdateRulersState
();
this
.
Selection
.
Start
=
false
;
// TODO: Пока делаем Start = true, чтобы при Ctrl+A не происходил переход к концу селекта, надо будет
// сделать по нормальному
this
.
Selection
.
Start
=
true
;
this
.
Document_UpdateSelectionState
();
this
.
Document_UpdateInterfaceState
();
this
.
Document_UpdateRulersState
();
this
.
Selection
.
Start
=
false
;
// Отдельно обрабатываем это событие, потому что внутри него идет проверка на this.Selection.Start !== true
this
.
Document_UpdateCopyCutState
();
// Отдельно обрабатываем это событие, потому что внутри него идет проверка на this.Selection.Start !== true
this
.
Document_UpdateCopyCutState
();
};
CDocument
.
prototype
.
On_DragTextEnd
=
function
(
NearPos
,
bCopy
)
{
...
...
@@ -15876,6 +15776,93 @@ CDocument.prototype.controller_GetSelectionBounds = function()
return
null
;
};
CDocument
.
prototype
.
controller_IsMovingTableBorder
=
function
()
{
if
(
null
!=
this
.
Selection
.
Data
&&
true
===
this
.
Selection
.
Data
.
TableBorder
&&
type_Table
==
this
.
Content
[
this
.
Selection
.
Data
.
Pos
].
GetType
())
return
true
;
return
false
;
};
CDocument
.
prototype
.
controller_CheckPosInSelection
=
function
(
X
,
Y
,
PageAbs
,
NearPos
)
{
if
(
true
===
this
.
Selection
.
Use
)
{
switch
(
this
.
Selection
.
Flag
)
{
case
selectionflag_Common
:
{
var
Start
=
this
.
Selection
.
StartPos
;
var
End
=
this
.
Selection
.
EndPos
;
if
(
Start
>
End
)
{
Start
=
this
.
Selection
.
EndPos
;
End
=
this
.
Selection
.
StartPos
;
}
if
(
undefined
!==
NearPos
)
{
for
(
var
Index
=
Start
;
Index
<=
End
;
Index
++
)
{
if
(
true
===
this
.
Content
[
Index
].
Selection_Check
(
0
,
0
,
0
,
NearPos
))
return
true
;
}
return
false
;
}
else
{
var
ContentPos
=
this
.
Internal_GetContentPosByXY
(
X
,
Y
,
PageAbs
,
NearPos
);
if
(
ContentPos
>
Start
&&
ContentPos
<
End
)
{
return
true
;
}
else
if
(
ContentPos
<
Start
||
ContentPos
>
End
)
{
return
false
;
}
else
{
var
ElementPageIndex
=
this
.
private_GetElementPageIndexByXY
(
ContentPos
,
X
,
Y
,
PageAbs
);
return
this
.
Content
[
ContentPos
].
Selection_Check
(
X
,
Y
,
ElementPageIndex
,
undefined
);
}
}
}
case
selectionflag_Numbering
:
{
return
false
;
}
}
return
false
;
}
return
false
;
};
CDocument
.
prototype
.
controller_SelectAll
=
function
()
{
if
(
true
===
this
.
Selection
.
Use
)
this
.
Selection_Remove
();
this
.
DrawingDocument
.
SelectEnabled
(
true
);
this
.
DrawingDocument
.
TargetEnd
();
this
.
Set_DocPosType
(
docpostype_Content
);
this
.
Selection
.
Use
=
true
;
this
.
Selection
.
Start
=
false
;
this
.
Selection
.
Flag
=
selectionflag_Common
;
this
.
Selection
.
StartPos
=
0
;
this
.
Selection
.
EndPos
=
this
.
Content
.
length
-
1
;
for
(
var
Index
=
0
;
Index
<
this
.
Content
.
length
;
Index
++
)
{
this
.
Content
[
Index
].
Select_All
();
}
};
CDocument
.
prototype
.
controller_AddToParagraph
=
function
(
ParaItem
,
bRecalculate
)
{
...
...
word/Editor/DocumentControllerBase.js
View file @
acf84ab6
...
...
@@ -491,6 +491,24 @@ CDocumentControllerBase.prototype.DrawSelectionOnPage = function(PageAbs){};
* @returns {*}
*/
CDocumentControllerBase
.
prototype
.
GetSelectionBounds
=
function
(){
return
null
;};
/**
* Проверяем осуществляется ли сейчас движение таблицы.
* @returns {boolean}
*/
CDocumentControllerBase
.
prototype
.
IsMovingTableBorder
=
function
(){
return
false
;};
/**
* Проверяем попадает ли заданная позиция в селект.
* @param X
* @param Y
* @param PageAbs
* @param NearPos
* @returns {boolean}
*/
CDocumentControllerBase
.
prototype
.
CheckPosInSelection
=
function
(
X
,
Y
,
PageAbs
,
NearPos
){
return
false
;};
/**
* Выделяем все содержимое.
*/
CDocumentControllerBase
.
prototype
.
SelectAll
=
function
(){};
/**
* Добавляем элемент в параграф.
* @param oItem
...
...
word/Editor/DrawingsController.js
View file @
acf84ab6
...
...
@@ -283,6 +283,18 @@ CDrawingsController.prototype.GetSelectionBounds = function()
{
return
this
.
DrawingObjects
.
Get_SelectionBounds
();
};
CDrawingsController
.
prototype
.
IsMovingTableBorder
=
function
()
{
return
this
.
DrawingObjects
.
selectionIsTableBorder
();
};
CDrawingsController
.
prototype
.
CheckPosInSelection
=
function
(
X
,
Y
,
PageAbs
,
NearPos
)
{
return
this
.
DrawingObjects
.
selectionCheck
(
X
,
Y
,
PageAbs
,
NearPos
);
};
CDrawingsController
.
prototype
.
SelectAll
=
function
()
{
this
.
DrawingObjects
.
selectAll
();
};
CDrawingsController
.
prototype
.
AddToParagraph
=
function
(
oItem
,
bRecalculate
)
{
...
...
word/Editor/Footnotes.js
View file @
acf84ab6
...
...
@@ -813,6 +813,47 @@ CFootnotesController.prototype.GetSelectionBounds = function()
// TODO: Доделать селект и курсор
return
null
;
};
CFootnotesController
.
prototype
.
IsMovingTableBorder
=
function
()
{
// TODO: Доделать селект и курсор
if
(
true
===
this
.
Selection
.
Use
)
{
}
else
{
if
(
null
!==
this
.
CurFootnote
)
return
this
.
CurFootnote
.
Selection_Is_TableBorderMove
();
}
return
false
;
};
CFootnotesController
.
prototype
.
CheckPosInSelection
=
function
(
X
,
Y
,
PageAbs
,
NearPos
)
{
// TODO: Доделать селект и курсор
if
(
true
===
this
.
Selection
.
Use
)
{
}
else
{
if
(
null
!==
this
.
CurFootnote
)
return
this
.
CurFootnote
.
Selection_Check
(
X
,
Y
,
PageAbs
,
NearPos
);
}
return
false
;
};
CFootnotesController
.
prototype
.
SelectAll
=
function
()
{
// TODO: Доделать селект и курсор
if
(
true
===
this
.
Selection
.
Use
)
{
}
else
{
if
(
null
!==
this
.
CurFootnote
)
this
.
CurFootnote
.
Select_All
();
}
};
CFootnotesController
.
prototype
.
AddToParagraph
=
function
(
oItem
,
bRecalculate
)
{
...
...
word/Editor/HeaderFooterController.js
View file @
acf84ab6
...
...
@@ -233,6 +233,18 @@ CHdrFtrController.prototype.GetSelectionBounds = function()
{
return
this
.
HdrFtr
.
Get_SelectionBounds
();
};
CHdrFtrController
.
prototype
.
IsMovingTableBorder
=
function
()
{
return
this
.
HdrFtr
.
Selection_Is_TableBorderMove
();
};
CHdrFtrController
.
prototype
.
CheckPosInSelection
=
function
(
X
,
Y
,
PageAbs
,
NearPos
)
{
return
this
.
HdrFtr
.
Selection_Check
(
X
,
Y
,
PageAbs
,
NearPos
);
};
CHdrFtrController
.
prototype
.
SelectAll
=
function
()
{
this
.
HdrFtr
.
Select_All
();
};
CHdrFtrController
.
prototype
.
AddToParagraph
=
function
(
oItem
,
bRecalculate
)
{
...
...
word/Editor/LogicDocumentController.js
View file @
acf84ab6
...
...
@@ -209,6 +209,18 @@ CLogicDocumentController.prototype.GetSelectionBounds = function()
{
return
this
.
LogicDocument
.
controller_GetSelectionBounds
();
};
CLogicDocumentController
.
prototype
.
IsMovingTableBorder
=
function
()
{
return
this
.
LogicDocument
.
controller_IsMovingTableBorder
();
};
CLogicDocumentController
.
prototype
.
CheckPosInSelection
=
function
(
X
,
Y
,
PageAbs
,
NearPos
)
{
return
this
.
LogicDocument
.
controller_CheckPosInSelection
(
X
,
Y
,
PageAbs
,
NearPos
);
};
CLogicDocumentController
.
prototype
.
SelectAll
=
function
()
{
this
.
LogicDocument
.
controller_SelectAll
();
};
...
...
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