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
faa16119
Commit
faa16119
authored
May 05, 2017
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Implemented locking a changing content or/and deleting of a content control.
parent
18d5bd2b
Changes
6
Hide whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
117 additions
and
17 deletions
+117
-17
common/Private/Locks.js
common/Private/Locks.js
+100
-11
word/Editor/DocumentContent.js
word/Editor/DocumentContent.js
+1
-1
word/Editor/DocumentContentElementBase.js
word/Editor/DocumentContentElementBase.js
+7
-0
word/Editor/StructuredDocumentTags/BlockLevel.js
word/Editor/StructuredDocumentTags/BlockLevel.js
+4
-0
word/Editor/StructuredDocumentTags/SdtPr.js
word/Editor/StructuredDocumentTags/SdtPr.js
+2
-2
word/Editor/StructuredDocumentTags/SdtPrChanges.js
word/Editor/StructuredDocumentTags/SdtPrChanges.js
+3
-3
No files found.
common/Private/Locks.js
View file @
faa16119
...
...
@@ -33,7 +33,6 @@
// Import
var
locktype_None
=
AscCommon
.
locktype_None
;
var
locktype_Mine
=
AscCommon
.
locktype_Mine
;
var
changestype_Paragraph_Content
=
AscCommon
.
changestype_Paragraph_Content
;
if
(
typeof
CDocument
!==
"
undefined
"
)
{
...
...
@@ -202,7 +201,7 @@ CAbstractNum.prototype.Document_Is_SelectionLocked = function(CheckType)
{
switch
(
CheckType
)
{
case
changestype_Paragraph_Content
:
case
AscCommon
.
changestype_Paragraph_Content
:
case
AscCommon
.
changestype_Paragraph_Properties
:
{
this
.
Lock
.
Check
(
this
.
Get_Id
()
);
...
...
@@ -236,7 +235,7 @@ if(typeof CGraphicObjects !== "undefined")
||
AscCommon
.
changestype_Image_Properties
===
CheckType
||
AscCommon
.
changestype_Delete
===
CheckType
||
AscCommon
.
changestype_Remove
===
CheckType
||
changestype_Paragraph_Content
===
CheckType
||
AscCommon
.
changestype_Paragraph_Content
===
CheckType
||
AscCommon
.
changestype_Paragraph_Properties
===
CheckType
||
AscCommon
.
changestype_Document_Content_Add
===
CheckType
)
{
...
...
@@ -260,7 +259,7 @@ CStyle.prototype.Document_Is_SelectionLocked = function(CheckType)
{
switch
(
CheckType
)
{
case
changestype_Paragraph_Content
:
case
AscCommon
.
changestype_Paragraph_Content
:
case
AscCommon
.
changestype_Paragraph_Properties
:
case
AscCommon
.
changestype_Document_Content
:
case
AscCommon
.
changestype_Document_Content_Add
:
...
...
@@ -281,7 +280,7 @@ CStyles.prototype.Document_Is_SelectionLocked = function(CheckType)
{
switch
(
CheckType
)
{
case
changestype_Paragraph_Content
:
case
AscCommon
.
changestype_Paragraph_Content
:
case
AscCommon
.
changestype_Paragraph_Properties
:
case
AscCommon
.
changestype_Document_Content
:
case
AscCommon
.
changestype_Document_Content_Add
:
...
...
@@ -363,17 +362,31 @@ CDocumentContent.prototype.Document_Is_SelectionLocked = function(CheckType)
}
}
};
CDocumentContent
.
prototype
.
CheckContentControlEditingLock
=
function
()
{
if
(
this
.
Parent
&&
this
.
Parent
.
CheckContentControlEditingLock
)
this
.
Parent
.
CheckContentControlEditingLock
();
};
CDocumentContent
.
prototype
.
CheckContentControlDeletingLock
=
function
()
{
for
(
var
nIndex
=
0
,
nCount
=
this
.
Content
.
length
;
nIndex
<
nCount
;
++
nIndex
)
{
this
.
Content
[
nIndex
].
CheckContentControlDeletingLock
();
}
};
Paragraph
.
prototype
.
Document_Is_SelectionLocked
=
function
(
CheckType
)
{
var
bCheckContentControl
=
false
;
switch
(
CheckType
)
{
case
changestype_Paragraph_Content
:
case
AscCommon
.
changestype_Paragraph_Content
:
case
AscCommon
.
changestype_Paragraph_Properties
:
case
AscCommon
.
changestype_Document_Content
:
case
AscCommon
.
changestype_Document_Content_Add
:
case
AscCommon
.
changestype_Image_Properties
:
{
this
.
Lock
.
Check
(
this
.
Get_Id
()
);
bCheckContentControl
=
true
;
break
;
}
case
AscCommon
.
changestype_Remove
:
...
...
@@ -416,7 +429,7 @@ Paragraph.prototype.Document_Is_SelectionLocked = function(CheckType)
}
this
.
Lock
.
Check
(
this
.
Get_Id
()
);
bCheckContentControl
=
true
;
break
;
}
case
AscCommon
.
changestype_Delete
:
...
...
@@ -450,7 +463,7 @@ Paragraph.prototype.Document_Is_SelectionLocked = function(CheckType)
}
this
.
Lock
.
Check
(
this
.
Get_Id
()
);
bCheckContentControl
=
true
;
break
;
}
case
AscCommon
.
changestype_Document_SectPr
:
...
...
@@ -462,12 +475,18 @@ Paragraph.prototype.Document_Is_SelectionLocked = function(CheckType)
break
;
}
}
if
(
bCheckContentControl
&&
this
.
Parent
&&
this
.
Parent
.
CheckContentControlEditingLock
)
this
.
Parent
.
CheckContentControlEditingLock
();
};
Paragraph
.
prototype
.
CheckContentControlDeletingLock
=
function
()
{
};
CTable
.
prototype
.
Document_Is_SelectionLocked
=
function
(
CheckType
,
bCheckInner
)
{
switch
(
CheckType
)
{
case
changestype_Paragraph_Content
:
case
AscCommon
.
changestype_Paragraph_Content
:
case
AscCommon
.
changestype_Paragraph_Properties
:
case
AscCommon
.
changestype_Document_Content
:
case
AscCommon
.
changestype_Document_Content_Add
:
...
...
@@ -497,9 +516,21 @@ CTable.prototype.Document_Is_SelectionLocked = function(CheckType, bCheckInner)
case
AscCommon
.
changestype_Remove
:
{
if
(
true
===
this
.
ApplyToAll
||
(
true
===
this
.
Selection
.
Use
&&
table_Selection_Cell
===
this
.
Selection
.
Type
))
{
this
.
Lock
.
Check
(
this
.
Get_Id
());
var
arrCells
=
this
.
Internal_Get_SelectionArray
();
for
(
var
nIndex
=
0
,
nCellsCount
=
arrCells
.
length
;
nIndex
<
nCellsCount
;
++
nIndex
)
{
var
Pos
=
arrCells
[
nIndex
];
var
Cell
=
this
.
Content
[
Pos
.
Row
].
Get_Cell
(
Pos
.
Cell
);
Cell
.
Content
.
CheckContentControlDeletingLock
();
}
}
else
{
this
.
CurCell
.
Content
.
Document_Is_SelectionLocked
(
CheckType
);
}
break
;
}
...
...
@@ -547,10 +578,68 @@ CTable.prototype.Document_Is_SelectionLocked = function(CheckType, bCheckInner)
}
}
};
CTable
.
prototype
.
CheckContentControlDeletingLock
=
function
()
{
for
(
var
nCurRow
=
0
,
nRowsCount
=
this
.
Content
.
length
;
nCurRow
<
nRowsCount
;
++
nCurRow
)
{
var
oRow
=
this
.
Content
[
nCurRow
];
for
(
var
nCurCell
=
0
,
nCellsCount
=
oRow
.
Get_CellsCount
();
nCurCell
<
nCellsCount
;
++
nCurCell
)
{
oRow
.
Get_Cell
(
nCurCell
).
Content
.
CheckContentControlDeletingLock
();
}
}
};
CBlockLevelSdt
.
prototype
.
Document_Is_SelectionLocked
=
function
(
CheckType
,
bCheckInner
)
{
return
this
.
Content
.
Document_Is_SelectionLocked
(
CheckType
,
bCheckInner
);
var
nContentControlLock
=
this
.
GetContentControlLock
();
if
((
AscCommon
.
changestype_Paragraph_Content
===
CheckType
||
AscCommon
.
changestype_Remove
===
CheckType
||
AscCommon
.
changestype_Delete
===
CheckType
||
AscCommon
.
changestype_Document_Content
===
CheckType
||
AscCommon
.
changestype_Document_Content_Add
===
CheckType
)
&&
this
.
IsSelectionUse
()
&&
this
.
IsSelectedAll
())
{
if
(
AscCommonWord
.
sdtlock_SdtContentLocked
===
nContentControlLock
||
AscCommonWord
.
sdtlock_SdtLocked
===
nContentControlLock
)
return
AscCommon
.
CollaborativeEditing
.
Add_CheckLock
(
true
);
else
return
this
.
Content
.
Document_Is_SelectionLocked
(
CheckType
,
bCheckInner
);
}
else
if
(
AscCommonWord
.
sdtlock_SdtContentLocked
===
nContentControlLock
||
AscCommonWord
.
sdtlock_ContentLocked
===
nContentControlLock
)
{
return
AscCommon
.
CollaborativeEditing
.
Add_CheckLock
(
true
);
}
else
{
return
this
.
Content
.
Document_Is_SelectionLocked
(
CheckType
,
bCheckInner
);
}
};
CBlockLevelSdt
.
prototype
.
CheckContentControlEditingLock
=
function
()
{
var
nContentControlLock
=
this
.
GetContentControlLock
();
if
(
AscCommonWord
.
sdtlock_SdtContentLocked
===
nContentControlLock
||
AscCommonWord
.
sdtlock_ContentLocked
===
nContentControlLock
)
return
AscCommon
.
CollaborativeEditing
.
Add_CheckLock
(
true
);
if
(
this
.
Parent
&&
this
.
Parent
.
CheckContentControlEditingLock
)
this
.
Parent
.
CheckContentControlEditingLock
();
};
CBlockLevelSdt
.
prototype
.
CheckContentControlDeletingLock
=
function
()
{
var
nContentControlLock
=
this
.
GetContentControlLock
();
if
(
AscCommonWord
.
sdtlock_SdtContentLocked
===
nContentControlLock
||
AscCommonWord
.
sdtlock_SdtLocked
===
nContentControlLock
)
return
AscCommon
.
CollaborativeEditing
.
Add_CheckLock
(
true
);
this
.
Content
.
CheckContentControlEditingLock
();
};
CTableCell
.
prototype
.
CheckContentControlEditingLock
=
function
()
{
if
(
this
.
Row
&&
this
.
Row
.
Table
&&
this
.
Row
.
Table
.
Parent
&&
this
.
Row
.
Table
.
Parent
.
CheckContentControlEditingLock
)
this
.
Row
.
Table
.
Parent
.
CheckContentControlEditingLock
();
};
if
(
typeof
CComments
!==
"
undefined
"
)
{
CComments
.
prototype
.
Document_Is_SelectionLocked
=
function
(
Id
)
...
...
@@ -835,4 +924,4 @@ if(typeof CPresentation !== "undefined")
return
bResult
;
};
}
\ No newline at end of file
}
word/Editor/DocumentContent.js
View file @
faa16119
...
...
@@ -8454,7 +8454,7 @@ CDocumentContent.prototype.IsSelectedAll = function()
{
if
(
true
===
this
.
Selection
.
Use
&&
((
0
===
this
.
Selection
.
StartPos
&&
this
.
Content
.
length
-
1
===
this
.
Selection
.
EndPos
)
||
(
0
===
this
.
Selection
.
EndPos
&&
this
.
Content
.
length
-
1
===
this
.
Selection
.
End
Pos
))
||
(
0
===
this
.
Selection
.
EndPos
&&
this
.
Content
.
length
-
1
===
this
.
Selection
.
Start
Pos
))
&&
true
===
this
.
Content
[
0
].
IsSelectedAll
()
&&
true
===
this
.
Content
[
this
.
Content
.
length
-
1
].
IsSelectedAll
())
return
true
;
...
...
word/Editor/DocumentContentElementBase.js
View file @
faa16119
...
...
@@ -629,6 +629,13 @@ CDocumentContentElementBase.prototype.GetStyleFromFormatting = function()
CDocumentContentElementBase
.
prototype
.
GetAllContentControls
=
function
(
arrContentControls
)
{
};
CDocumentContentElementBase
.
prototype
.
IsSelectedAll
=
function
()
{
return
false
;
};
CDocumentContentElementBase
.
prototype
.
CheckContentControlDeletingLock
=
function
()
{
};
//----------------------------------------------------------------------------------------------------------------------
// Функции для работы с номерами страниц
//----------------------------------------------------------------------------------------------------------------------
...
...
word/Editor/StructuredDocumentTags/BlockLevel.js
View file @
faa16119
...
...
@@ -663,6 +663,10 @@ CBlockLevelSdt.prototype.GetAllContentControls = function(arrContentControls)
arrContentControls
.
push
(
this
);
this
.
Content
.
GetAllContentControls
(
arrContentControls
);
};
CBlockLevelSdt
.
prototype
.
IsSelectedAll
=
function
()
{
return
this
.
Content
.
IsSelectedAll
();
};
//----------------------------------------------------------------------------------------------------------------------
CBlockLevelSdt
.
prototype
.
Is_HdrFtr
=
function
(
bReturnHdrFtr
)
{
...
...
word/Editor/StructuredDocumentTags/SdtPr.js
View file @
faa16119
...
...
@@ -89,7 +89,7 @@ CSdtPr.prototype.Write_ToBinary = function(Writer)
if
(
undefined
!==
this
.
Label
)
{
Writer
.
Write
String2
(
this
.
Tag
);
Writer
.
Write
Long
(
this
.
Tag
);
Flags
|=
8
;
}
...
...
@@ -118,7 +118,7 @@ CSdtPr.prototype.Read_FromBinary = function(Reader)
this
.
Tag
=
Reader
.
GetString2
();
if
(
Flags
&
8
)
this
.
Tag
=
Reader
.
Get
String2
();
this
.
Tag
=
Reader
.
Get
Long
();
if
(
Flags
&
16
)
this
.
Lock
=
Reader
.
GetLong
();
...
...
word/Editor/StructuredDocumentTags/SdtPrChanges.js
View file @
faa16119
...
...
@@ -110,13 +110,13 @@ CChangesSdtPrTag.prototype.private_SetValue = function(Value)
};
/**
* @constructor
* @extends {AscDFH.CChangesBase
Stri
ngProperty}
* @extends {AscDFH.CChangesBase
Lo
ngProperty}
*/
function
CChangesSdtPrLabel
(
Class
,
Old
,
New
)
{
AscDFH
.
CChangesBase
Stri
ngProperty
.
call
(
this
,
Class
,
Old
,
New
);
AscDFH
.
CChangesBase
Lo
ngProperty
.
call
(
this
,
Class
,
Old
,
New
);
}
CChangesSdtPrLabel
.
prototype
=
Object
.
create
(
AscDFH
.
CChangesBase
Stri
ngProperty
.
prototype
);
CChangesSdtPrLabel
.
prototype
=
Object
.
create
(
AscDFH
.
CChangesBase
Lo
ngProperty
.
prototype
);
CChangesSdtPrLabel
.
prototype
.
constructor
=
CChangesSdtPrLabel
;
CChangesSdtPrLabel
.
prototype
.
Type
=
AscDFH
.
historyitem_SdtPr_Label
;
CChangesSdtPrLabel
.
prototype
.
private_SetValue
=
function
(
Value
)
...
...
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