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
0368504a
Commit
0368504a
authored
Apr 11, 2017
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Continue implementing a CBlockLevelSdt class.
parent
4dc67f23
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
338 additions
and
316 deletions
+338
-316
word/Drawing/HtmlPage.js
word/Drawing/HtmlPage.js
+6
-6
word/Editor/Document.js
word/Editor/Document.js
+27
-86
word/Editor/DocumentContent.js
word/Editor/DocumentContent.js
+190
-224
word/Editor/DocumentContentElementBase.js
word/Editor/DocumentContentElementBase.js
+44
-0
word/Editor/Paragraph.js
word/Editor/Paragraph.js
+11
-0
word/Editor/StructuredDocumentTags/BlockLevel.js
word/Editor/StructuredDocumentTags/BlockLevel.js
+28
-0
word/Editor/Table.js
word/Editor/Table.js
+32
-0
No files found.
word/Drawing/HtmlPage.js
View file @
0368504a
...
...
@@ -3632,13 +3632,13 @@ function CEditorPage(api)
};
this
.
onTimerScroll2
=
function
(
is_no_timer
)
{
try
{
//
try
//
{
oThis
.
onTimerScroll2_internal
(
is_no_timer
);
}
catch
(
err
)
{
}
//
}
//
catch (err)
//
{
//
}
if
(
true
!==
is_no_timer
)
this
.
m_nPaintTimerId
=
setTimeout
(
oThis
.
onTimerScroll2
,
oThis
.
m_nTimerScrollInterval
);
...
...
word/Editor/Document.js
View file @
0368504a
...
...
@@ -5296,8 +5296,7 @@ CDocument.prototype.Selection_SetEnd = function(X, Y, MouseEvent)
var
TempLimit
=
Math
.
min
(
this
.
Selection
.
StartPos
,
this
.
Selection
.
EndPos
);
for
(
var
Index
=
OldEndPos
;
Index
<
TempLimit
;
Index
++
)
{
this
.
Content
[
Index
].
Selection
.
Use
=
false
;
this
.
Content
[
Index
].
Selection
.
Start
=
false
;
this
.
Content
[
Index
].
RemoveSelection
();
}
}
else
if
(
OldEndPos
>
this
.
Selection
.
StartPos
&&
OldEndPos
>
this
.
Selection
.
EndPos
)
...
...
@@ -5305,8 +5304,7 @@ CDocument.prototype.Selection_SetEnd = function(X, Y, MouseEvent)
var
TempLimit
=
Math
.
max
(
this
.
Selection
.
StartPos
,
this
.
Selection
.
EndPos
);
for
(
var
Index
=
TempLimit
+
1
;
Index
<=
OldEndPos
;
Index
++
)
{
this
.
Content
[
Index
].
Selection
.
Use
=
false
;
this
.
Content
[
Index
].
Selection
.
Start
=
false
;
this
.
Content
[
Index
].
RemoveSelection
();
}
}
...
...
@@ -5331,7 +5329,7 @@ CDocument.prototype.Selection_SetEnd = function(X, Y, MouseEvent)
var
ElementPageIndex
=
this
.
private_GetElementPageIndexByXY
(
this
.
Selection
.
StartPos
,
X
,
Y
,
this
.
CurPage
);
Item
.
Selection_SetEnd
(
X
,
Y
,
ElementPageIndex
,
MouseEvent
);
if
(
false
===
Item
.
Selection
.
Use
)
if
(
false
===
Item
.
IsSelectionUse
()
)
{
this
.
Selection
.
Use
=
false
;
...
...
@@ -5367,86 +5365,29 @@ CDocument.prototype.Selection_SetEnd = function(X, Y, MouseEvent)
// TODO: Разрулить пустой селект
// Чтобы не было эффекта, когда ничего не поселекчено, а при удалении соединяются параграфы
for
(
var
Index
=
Start
;
Index
<=
End
;
Index
++
)
{
var
Item
=
this
.
Content
[
Index
];
Item
.
Selection
.
Use
=
true
;
var
ItemType
=
Item
.
GetType
();
switch
(
Index
)
{
case
Start
:
if
(
type_Paragraph
===
ItemType
)
{
Item
.
Selection_SetBegEnd
((
Direction
>
0
?
false
:
true
),
false
);
}
else
//if ( type_Table === ItemType )
{
var
Row
=
Item
.
Content
.
length
-
1
;
var
Cell
=
Item
.
Content
[
Row
].
Get_CellsCount
()
-
1
;
var
Pos
=
{
Row
:
Row
,
Cell
:
Cell
};
if
(
Direction
>
0
)
Item
.
Selection
.
EndPos
.
Pos
=
Pos
;
else
Item
.
Selection
.
StartPos
.
Pos
=
Pos
;
Item
.
Internal_Selection_UpdateCells
();
}
break
;
case
End
:
if
(
type_Paragraph
===
ItemType
)
{
Item
.
Selection_SetBegEnd
((
Direction
>
0
?
true
:
false
),
true
);
}
else
//if ( type_Table === ItemType )
{
var
Pos
=
{
Row
:
0
,
Cell
:
0
};
if
(
Direction
>
0
)
Item
.
Selection
.
StartPos
.
Pos
=
Pos
;
else
Item
.
Selection
.
EndPos
.
Pos
=
Pos
;
Item
.
Internal_Selection_UpdateCells
();
}
for
(
var
Index
=
Start
;
Index
<=
End
;
Index
++
)
{
var
Item
=
this
.
Content
[
Index
];
Item
.
SetSelectionUse
(
true
);
break
;
switch
(
Index
)
{
case
Start
:
default
:
Item
.
SetSelectionToBeginEnd
(
Direction
>
0
?
false
:
true
,
false
);
break
;
if
(
type_Paragraph
===
ItemType
)
{
Item
.
Select_All
(
Direction
);
}
else
//if ( type_Table === ItemType )
{
var
Row
=
Item
.
Content
.
length
-
1
;
var
Cell
=
Item
.
Content
[
Row
].
Get_CellsCount
()
-
1
;
var
Pos0
=
{
Row
:
0
,
Cell
:
0
};
var
Pos1
=
{
Row
:
Row
,
Cell
:
Cell
};
case
End
:
if
(
Direction
>
0
)
{
Item
.
Selection
.
StartPos
.
Pos
=
Pos0
;
Item
.
Selection
.
EndPos
.
Pos
=
Pos1
;
}
else
{
Item
.
Selection
.
EndPos
.
Pos
=
Pos0
;
Item
.
Selection
.
StartPos
.
Pos
=
Pos1
;
}
Item
.
SetSelectionToBeginEnd
(
Direction
>
0
?
true
:
false
,
true
);
break
;
Item
.
Internal_Selection_UpdateCells
();
}
default
:
break
;
}
}
Item
.
SelectAll
(
Direction
);
break
;
}
}
var
ElementPageIndex
=
this
.
private_GetElementPageIndexByXY
(
ContentPos
,
X
,
Y
,
this
.
CurPage
);
this
.
Content
[
ContentPos
].
Selection_SetEnd
(
X
,
Y
,
ElementPageIndex
,
MouseEvent
);
...
...
@@ -5454,13 +5395,13 @@ CDocument.prototype.Selection_SetEnd = function(X, Y, MouseEvent)
// Проверяем, чтобы у нас в селект не попали элементы, в которых не выделено ничего
if
(
true
===
this
.
Content
[
End
].
Selection_IsEmpty
()
&&
true
===
this
.
CheckEmptyElementsOnSelection
)
{
this
.
Content
[
End
].
Selection_Remove
();
this
.
Content
[
End
].
RemoveSelection
();
End
--
;
}
if
(
Start
!=
End
&&
true
===
this
.
Content
[
Start
].
Selection_IsEmpty
()
&&
true
===
this
.
CheckEmptyElementsOnSelection
)
{
this
.
Content
[
Start
].
Selection_Remove
();
this
.
Content
[
Start
].
RemoveSelection
();
Start
++
;
}
...
...
@@ -14910,11 +14851,11 @@ CDocument.prototype.controller_GetCurrentTextPr = function()
EndPos
=
Temp
;
}
VisTextPr
=
this
.
Content
[
StartPos
].
Get
_Paragraph_
TextPr
();
VisTextPr
=
this
.
Content
[
StartPos
].
Get
Paragraph
TextPr
();
for
(
var
Index
=
StartPos
+
1
;
Index
<=
EndPos
;
Index
++
)
{
var
CurPr
=
this
.
Content
[
Index
].
Get
_Paragraph_
TextPr
();
var
CurPr
=
this
.
Content
[
Index
].
Get
Paragraph
TextPr
();
VisTextPr
=
VisTextPr
.
Compare
(
CurPr
);
}
...
...
@@ -14943,7 +14884,7 @@ CDocument.prototype.controller_GetCurrentTextPr = function()
}
else
{
Result_TextPr
=
this
.
Content
[
this
.
CurPos
.
ContentPos
].
Get
_Paragraph_
TextPr
();
Result_TextPr
=
this
.
Content
[
this
.
CurPos
.
ContentPos
].
Get
Paragraph
TextPr
();
}
return
Result_TextPr
;
...
...
@@ -15906,12 +15847,12 @@ CDocument.prototype.controller_CanAddHyperlink = function(bCheckInHyperlink)
if
(
this
.
Selection
.
StartPos
!=
this
.
Selection
.
EndPos
)
return
false
;
return
this
.
Content
[
this
.
Selection
.
StartPos
].
Hyperlink_CanAdd
(
bCheckInHyperlink
);
return
this
.
Content
[
this
.
Selection
.
StartPos
].
CanAddHyperlink
(
bCheckInHyperlink
);
}
}
else
{
return
this
.
Content
[
this
.
CurPos
.
ContentPos
].
Hyperlink_CanAdd
(
bCheckInHyperlink
);
return
this
.
Content
[
this
.
CurPos
.
ContentPos
].
CanAddHyperlink
(
bCheckInHyperlink
);
}
return
false
;
...
...
word/Editor/DocumentContent.js
View file @
0368504a
This diff is collapsed.
Click to expand it.
word/Editor/DocumentContentElementBase.js
View file @
0368504a
...
...
@@ -173,6 +173,50 @@ CDocumentContentElementBase.prototype.Document_UpdateRulersState = function(CurP
{
this
.
Content
.
Document_UpdateRulersState
(
CurPage
);
};
CDocumentContentElementBase
.
prototype
.
IsSelectionUse
=
function
()
{
return
this
.
Is_SelectionUse
();
};
CDocumentContentElementBase
.
prototype
.
Is_SelectionUse
=
function
()
{
return
false
;
};
CDocumentContentElementBase
.
prototype
.
Selection_Remove
=
function
()
{
};
CDocumentContentElementBase
.
prototype
.
RemoveSelection
=
function
()
{
this
.
Selection_Remove
();
};
CDocumentContentElementBase
.
prototype
.
SetSelectionUse
=
function
(
isUse
)
{
};
CDocumentContentElementBase
.
prototype
.
SetSelectionToBeginEnd
=
function
(
isSelectionStart
,
isElementStart
)
{
};
CDocumentContentElementBase
.
prototype
.
Select_All
=
function
(
nDirection
)
{
};
CDocumentContentElementBase
.
prototype
.
SelectAll
=
function
(
nDirection
)
{
this
.
Select_All
(
nDirection
);
};
CDocumentContentElementBase
.
prototype
.
Get_Paragraph_TextPr
=
function
()
{
return
new
CTextPr
();
};
CDocumentContentElementBase
.
prototype
.
GetParagraphTextPr
=
function
()
{
return
this
.
Get_Paragraph_TextPr
();
};
CDocumentContentElementBase
.
prototype
.
Hyperlink_CanAdd
=
function
(
bCheckInHyperlink
)
{
return
false
;
};
CDocumentContentElementBase
.
prototype
.
CanAddHyperlink
=
function
(
bCheckInHyperlink
)
{
return
this
.
Hyperlink_CanAdd
(
bCheckInHyperlink
);
};
//----------------------------------------------------------------------------------------------------------------------
// Функции для работы с номерами страниц
//----------------------------------------------------------------------------------------------------------------------
...
...
word/Editor/Paragraph.js
View file @
0368504a
...
...
@@ -6493,6 +6493,17 @@ Paragraph.prototype.Selection_SetBegEnd = function(StartSelection, StartPara)
this
.
Set_SelectionContentPos
(
this
.
Get_ParaContentPos
(
true
,
true
),
ContentPos
);
}
};
Paragraph
.
prototype
.
SetSelectionUse
=
function
(
isUse
)
{
if
(
true
===
isUse
)
this
.
Selection
.
Use
=
true
;
else
this
.
RemoveSelection
();
};
Paragraph
.
prototype
.
SetSelectionToBeginEnd
=
function
(
isSelectionStart
,
isElementStart
)
{
this
.
Selection_SetBegEnd
(
isSelectionStart
,
isElementStart
);
};
Paragraph
.
prototype
.
Select_All
=
function
(
Direction
)
{
var
Count
=
this
.
Content
.
length
;
...
...
word/Editor/StructuredDocumentTags/BlockLevel.js
View file @
0368504a
...
...
@@ -159,6 +159,34 @@ CBlockLevelSdt.prototype.Document_UpdateRulersState = function(CurPage)
{
this
.
Content
.
Document_UpdateRulersState
(
CurPage
);
};
CBlockLevelSdt
.
prototype
.
Is_SelectionUse
=
function
()
{
return
this
.
Content
.
Is_SelectionUse
();
};
CBlockLevelSdt
.
prototype
.
Selection_Remove
=
function
()
{
this
.
Content
.
Selection_Remove
();
};
CBlockLevelSdt
.
prototype
.
SetSelectionUse
=
function
(
isUse
)
{
this
.
Content
.
SetSelectionUse
(
isUse
);
};
CBlockLevelSdt
.
prototype
.
SetSelectionToBeginEnd
=
function
(
isSelectionStart
,
isElementStart
)
{
this
.
Content
.
SetSelectionToBeginEnd
(
isSelectionStart
,
isElementStart
);
};
CBlockLevelSdt
.
prototype
.
Select_All
=
function
(
nDirection
)
{
this
.
Content
.
Select_All
(
nDirection
);
};
CBlockLevelSdt
.
prototype
.
Get_Paragraph_TextPr
=
function
()
{
return
this
.
Content
.
Get_Paragraph_TextPr
();
};
CBlockLevelSdt
.
prototype
.
Hyperlink_CanAdd
=
function
(
bCheckInHyperlink
)
{
return
this
.
Content
.
Hyperlink_CanAdd
(
bCheckInHyperlink
);
};
//----------------------------------------------------------------------------------------------------------------------
CBlockLevelSdt
.
prototype
.
Is_HdrFtr
=
function
(
bReturnHdrFtr
)
{
...
...
word/Editor/Table.js
View file @
0368504a
...
...
@@ -5165,6 +5165,38 @@ CTable.prototype.Selection_IsToEnd = function()
else
return
false
;
};
CTable
.
prototype
.
SetSelectionUse
=
function
(
isUse
)
{
if
(
true
===
isUse
)
this
.
Selection
.
Use
=
true
;
else
this
.
RemoveSelection
();
};
CTable
.
prototype
.
SetSelectionToBeginEnd
=
function
(
isSelectionStart
,
isElementStart
)
{
if
(
false
===
isElementStart
)
{
var
Row
=
this
.
Content
.
length
-
1
;
var
Cell
=
this
.
Content
[
Row
].
Get_CellsCount
()
-
1
;
var
Pos
=
{
Row
:
Row
,
Cell
:
Cell
};
if
(
isSelectionStart
>
0
)
this
.
Selection
.
EndPos
.
Pos
=
Pos
;
else
this
.
Selection
.
StartPos
.
Pos
=
Pos
;
}
else
{
var
Pos
=
{
Row
:
0
,
Cell
:
0
};
if
(
isSelectionStart
>
0
)
this
.
Selection
.
StartPos
.
Pos
=
Pos
;
else
this
.
Selection
.
EndPos
.
Pos
=
Pos
;
}
this
.
Internal_Selection_UpdateCells
();
};
CTable
.
prototype
.
Cursor_MoveToStartPos
=
function
(
AddToSelect
)
{
if
(
true
===
AddToSelect
)
...
...
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