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
241e7393
Commit
241e7393
authored
Jun 22, 2016
by
Ilya Kirillov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Рефакторинг оставишихся функий. Теперь класс CDocument полностью работает через Controller.
parent
eca88479
Changes
6
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
6 changed files
with
1522 additions
and
1489 deletions
+1522
-1489
word/Editor/Document.js
word/Editor/Document.js
+1384
-1484
word/Editor/DocumentControllerBase.js
word/Editor/DocumentControllerBase.js
+16
-1
word/Editor/DrawingsController.js
word/Editor/DrawingsController.js
+27
-1
word/Editor/Footnotes.js
word/Editor/Footnotes.js
+16
-1
word/Editor/HeaderFooterController.js
word/Editor/HeaderFooterController.js
+66
-1
word/Editor/LogicDocumentController.js
word/Editor/LogicDocumentController.js
+13
-1
No files found.
word/Editor/Document.js
View file @
241e7393
This diff is collapsed.
Click to expand it.
word/Editor/DocumentControllerBase.js
View file @
241e7393
...
...
@@ -258,8 +258,9 @@ CDocumentControllerBase.prototype.Get_PageContentStartPos = function(PageAbs)
CDocumentControllerBase
.
prototype
.
CanTargetUpdate
=
function
(){
return
true
;};
/**
* Пересчитываем текущую позицию.
* @returns {{X: number, Y: number, Height: number, PageNum: number, Internal: {Line: number, Page: number, Range: number}, Transform: null}}
*/
CDocumentControllerBase
.
prototype
.
RecalculateCurPos
=
function
(){};
CDocumentControllerBase
.
prototype
.
RecalculateCurPos
=
function
(){
return
{
X
:
0
,
Y
:
0
,
Height
:
0
,
PageNum
:
0
,
Internal
:
{
Line
:
0
,
Page
:
0
,
Range
:
0
},
Transform
:
null
};
};
/**
* Получаем текущий номер страницы.
* @returns {number} -1 - значит, номер страницы определеить невозможно
...
...
@@ -687,6 +688,20 @@ CDocumentControllerBase.prototype.CanAddComment = function(){return false;};
* @returns {{X0: number, X1: number, Y: number, Page: number}}
*/
CDocumentControllerBase
.
prototype
.
GetSelectionAnchorPos
=
function
(){
return
{
X0
:
0
,
X1
:
0
,
Y
:
0
,
Page
:
0
};};
/**
* Начинаем селект с текущей позиции.
*/
CDocumentControllerBase
.
prototype
.
StartSelectionFromCurPos
=
function
(){};
/**
* Сохраняем состояние документа изменения перед принятием чужих изменений.
* @param State
*/
CDocumentControllerBase
.
prototype
.
SaveDocumentStateBeforeLoadChanges
=
function
(
State
){};
/**
* Восстанавливаем состояние документа после загрузки изменений.
* @param State
*/
CDocumentControllerBase
.
prototype
.
RestoreDocumentStateAfterLoadChanges
=
function
(
State
){};
/**
* Добавляем элемент в параграф.
...
...
word/Editor/DrawingsController.js
View file @
241e7393
...
...
@@ -26,7 +26,7 @@ CDrawingsController.prototype.CanTargetUpdate = function()
};
CDrawingsController
.
prototype
.
RecalculateCurPos
=
function
()
{
this
.
DrawingObjects
.
recalculateCurPos
();
return
this
.
DrawingObjects
.
recalculateCurPos
();
};
CDrawingsController
.
prototype
.
GetCurPage
=
function
()
{
...
...
@@ -461,6 +461,32 @@ CDrawingsController.prototype.GetSelectionAnchorPos = function()
Page
:
ParaDrawing
.
PageNum
};
};
CDrawingsController
.
prototype
.
StartSelectionFromCurPos
=
function
()
{
this
.
DrawingObjects
.
startSelectionFromCurPos
();
};
CDrawingsController
.
prototype
.
SaveDocumentStateBeforeLoadChanges
=
function
(
State
)
{
this
.
DrawingObjects
.
Save_DocumentStateBeforeLoadChanges
(
State
);
};
CDrawingsController
.
prototype
.
RestoreDocumentStateAfterLoadChanges
=
function
(
State
)
{
if
(
true
!==
this
.
DrawingObjects
.
Load_DocumentStateAfterLoadChanges
(
State
))
{
this
.
Set_DocPosType
(
docpostype_Content
);
var
LogicDocument
=
this
.
LogicDocument
;
var
ContentPos
=
0
;
if
(
LogicDocument
.
Pages
[
LogicDocument
.
CurPage
])
ContentPos
=
LogicDocument
.
Pages
[
LogicDocument
.
CurPage
].
Pos
+
1
;
else
ContentPos
=
0
;
ContentPos
=
Math
.
max
(
0
,
Math
.
min
(
LogicDocument
.
Content
.
length
-
1
,
ContentPos
));
LogicDocument
.
CurPos
.
ContentPos
=
ContentPos
;
LogicDocument
.
Content
[
ContentPos
].
Cursor_MoveToStartPos
(
false
);
}
};
CDrawingsController
.
prototype
.
AddToParagraph
=
function
(
oItem
,
bRecalculate
)
...
...
word/Editor/Footnotes.js
View file @
241e7393
...
...
@@ -285,8 +285,11 @@ CFootnotesController.prototype.CanTargetUpdate = function()
};
CFootnotesController
.
prototype
.
RecalculateCurPos
=
function
()
{
// TODO: Доделать селект и курсор
if
(
null
!==
this
.
CurFootnote
)
this
.
CurFootnote
.
RecalculateCurPos
();
return
this
.
CurFootnote
.
RecalculateCurPos
();
return
{
X
:
0
,
Y
:
0
,
Height
:
0
,
PageNum
:
0
,
Internal
:
{
Line
:
0
,
Page
:
0
,
Range
:
0
},
Transform
:
null
};
};
CFootnotesController
.
prototype
.
GetCurPage
=
function
()
{
...
...
@@ -1048,6 +1051,18 @@ CFootnotesController.prototype.GetSelectionAnchorPos = function()
Page
:
0
};
};
CFootnotesController
.
prototype
.
StartSelectionFromCurPos
=
function
()
{
// TODO: Реализовать
};
CFootnotesController
.
prototype
.
SaveDocumentStateBeforeLoadChanges
=
function
(
State
)
{
// TODO: Реализовать
};
CFootnotesController
.
prototype
.
RestoreDocumentStateAfterLoadChanges
=
function
(
State
)
{
// TODO: Реализовать
};
CFootnotesController
.
prototype
.
AddToParagraph
=
function
(
oItem
,
bRecalculate
)
{
...
...
word/Editor/HeaderFooterController.js
View file @
241e7393
...
...
@@ -29,7 +29,7 @@ CHdrFtrController.prototype.CanTargetUpdate = function()
};
CHdrFtrController
.
prototype
.
RecalculateCurPos
=
function
()
{
this
.
HdrFtr
.
RecalculateCurPos
();
return
this
.
HdrFtr
.
RecalculateCurPos
();
};
CHdrFtrController
.
prototype
.
GetCurPage
=
function
()
{
...
...
@@ -376,6 +376,71 @@ CHdrFtrController.prototype.GetSelectionAnchorPos = function()
{
return
this
.
HdrFtr
.
Get_SelectionAnchorPos
();
};
CHdrFtrController
.
prototype
.
StartSelectionFromCurPos
=
function
()
{
this
.
HdrFtr
.
Start_SelectionFromCurPos
();
};
CHdrFtrController
.
prototype
.
SaveDocumentStateBeforeLoadChanges
=
function
(
State
)
{
var
HdrFtr
=
this
.
HdrFtr
.
Get_CurHdrFtr
();
if
(
null
!==
HdrFtr
)
{
var
HdrFtrContent
=
HdrFtr
.
Get_DocumentContent
();
State
.
HdrFtr
=
HdrFtr
;
State
.
HdrFtrDocPosType
=
HdrFtrContent
.
CurPos
.
Type
;
State
.
HdrFtrSelection
=
HdrFtrContent
.
Selection
.
Use
;
if
(
docpostype_Content
===
HdrFtrContent
.
Get_DocPosType
())
{
State
.
Pos
=
HdrFtrContent
.
Get_ContentPosition
(
false
,
false
,
undefined
);
State
.
StartPos
=
HdrFtrContent
.
Get_ContentPosition
(
true
,
true
,
undefined
);
State
.
EndPos
=
HdrFtrContent
.
Get_ContentPosition
(
true
,
false
,
undefined
);
}
else
if
(
docpostype_DrawingObjects
===
HdrFtrContent
.
Get_DocPosType
())
{
this
.
LogicDocument
.
DrawingObjects
.
Save_DocumentStateBeforeLoadChanges
(
State
);
}
}
};
CHdrFtrController
.
prototype
.
RestoreDocumentStateAfterLoadChanges
=
function
(
State
)
{
var
HdrFtr
=
State
.
HdrFtr
;
if
(
null
!==
HdrFtr
&&
undefined
!==
HdrFtr
&&
true
===
HdrFtr
.
Is_UseInDocument
())
{
this
.
HdrFtr
.
Set_CurHdrFtr
(
HdrFtr
);
var
HdrFtrContent
=
HdrFtr
.
Get_DocumentContent
();
if
(
docpostype_Content
===
State
.
HdrFtrDocPosType
)
{
HdrFtrContent
.
Set_DocPosType
(
docpostype_Content
);
HdrFtrContent
.
Selection
.
Use
=
State
.
HdrFtrSelection
;
if
(
true
===
HdrFtrContent
.
Selection
.
Use
)
{
HdrFtrContent
.
Set_ContentPosition
(
State
.
StartPos
,
0
,
0
);
HdrFtrContent
.
Set_ContentSelection
(
State
.
StartPos
,
State
.
EndPos
,
0
,
0
,
0
);
}
else
{
HdrFtrContent
.
Set_ContentPosition
(
State
.
Pos
,
0
,
0
);
this
.
LogicDocument
.
NeedUpdateTarget
=
true
;
}
}
else
if
(
docpostype_DrawingObjects
===
State
.
HdrFtrDocPosType
)
{
HdrFtrContent
.
Set_DocPosType
(
docpostype_DrawingObjects
);
if
(
true
!==
this
.
LogicDocument
.
DrawingObjects
.
Load_DocumentStateAfterLoadChanges
(
State
))
{
HdrFtrContent
.
Set_DocPosType
(
docpostype_Content
);
this
.
LogicDocument
.
Cursor_MoveAt
(
State
.
X
?
State
.
X
:
0
,
State
.
Y
?
State
.
Y
:
0
,
false
);
}
}
}
else
{
this
.
LogicDocument
.
Document_End_HdrFtrEditing
();
}
};
CHdrFtrController
.
prototype
.
AddToParagraph
=
function
(
oItem
,
bRecalculate
)
...
...
word/Editor/LogicDocumentController.js
View file @
241e7393
...
...
@@ -23,7 +23,7 @@ CLogicDocumentController.prototype.CanTargetUpdate = function()
};
CLogicDocumentController
.
prototype
.
RecalculateCurPos
=
function
()
{
this
.
LogicDocument
.
controller_RecalculateCurPos
();
return
this
.
LogicDocument
.
controller_RecalculateCurPos
();
};
CLogicDocumentController
.
prototype
.
GetCurPage
=
function
()
{
...
...
@@ -349,6 +349,18 @@ CLogicDocumentController.prototype.GetSelectionAnchorPos = function()
{
return
this
.
LogicDocument
.
controller_GetSelectionAnchorPos
();
};
CLogicDocumentController
.
prototype
.
StartSelectionFromCurPos
=
function
()
{
this
.
LogicDocument
.
controller_StartSelectionFromCurPos
();
};
CLogicDocumentController
.
prototype
.
SaveDocumentStateBeforeLoadChanges
=
function
(
State
)
{
this
.
LogicDocument
.
controller_SaveDocumentStateBeforeLoadChanges
(
State
);
};
CLogicDocumentController
.
prototype
.
RestoreDocumentStateAfterLoadChanges
=
function
(
State
)
{
this
.
LogicDocument
.
controller_RestoreDocumentStateAfterLoadChanges
(
State
);
};
CLogicDocumentController
.
prototype
.
AddToParagraph
=
function
(
oItem
)
...
...
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