Skip to content

Commit

Permalink
[de] Add method to disconnect everyone from current file
Browse files Browse the repository at this point in the history
  • Loading branch information
KirillovIlya committed Feb 18, 2025
1 parent ff8de1e commit 96ee2fa
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 3 deletions.
7 changes: 4 additions & 3 deletions common/HistoryCommon.js
Original file line number Diff line number Diff line change
Expand Up @@ -1849,6 +1849,8 @@
window['AscDFH'].historyitem_Document_Settings_DoNotHyphenateCaps = window['AscDFH'].historyitem_type_Document | 14;
window['AscDFH'].historyitem_Document_Settings_HyphenationZone = window['AscDFH'].historyitem_type_Document | 15;
window['AscDFH'].historyitem_Document_PageColor = window['AscDFH'].historyitem_type_Document | 16;

window['AscDFH'].historyitem_Document_DisconnectEveryone = window['AscDFH'].historyitem_type_Document | 10000;
//------------------------------------------------------------------------------------------------------------------
// Типы изменений в классе Paragraph
//------------------------------------------------------------------------------------------------------------------
Expand Down Expand Up @@ -4550,16 +4552,15 @@
window['AscDFH'].historydescription_Document_EditComplexFieldInstruction = 0x01b5;
window['AscDFH'].historydescription_Collaborative_DeletedTextRecovery = 0x01b6;
window['AscDFH'].historydescription_Document_AutoCorrectMath = 0x01b7;

window['AscDFH'].historydescription_CustomProperties_Add = 0x01b8;
window['AscDFH'].historydescription_CustomProperties_Remove = 0x01b9;
window['AscDFH'].historydescription_CustomProperties_Modify = 0x01c0;

window['AscDFH'].historydescription_Presentation_MergeSelectedShapes = 0x01c1;
window['AscDFH'].historydescription_Presentation_SaveAnnotations = 0x01c2;
window['AscDFH'].historydescription_Document_SetParagraphBidi = 0x01c3;

window['AscDFH'].historydescription_RemoveAllInks = 0x01c4;
window['AscDFH'].historydescription_DisconnectEveryone = 0x01c5;

// pdf
window['AscDFH'].historydescription_Pdf_AddAnnot = 0x29a;
window['AscDFH'].historydescription_Pdf_FreeTextGeom = 0x29b;
Expand Down
28 changes: 28 additions & 0 deletions word/Editor/DocumentChanges.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,8 @@ AscDFH.changesFactory[AscDFH.historyitem_Document_Settings_ConsecutiveHyphenLimi
AscDFH.changesFactory[AscDFH.historyitem_Document_Settings_DoNotHyphenateCaps] = CChangesDocumentSettingsDoNotHyphenateCaps;
AscDFH.changesFactory[AscDFH.historyitem_Document_Settings_HyphenationZone] = CChangesDocumentSettingsHyphenationZone;
AscDFH.changesFactory[AscDFH.historyitem_Document_PageColor] = CChangesDocumentPageColor;

AscDFH.changesFactory[AscDFH.historyitem_Document_DisconnectEveryone] = CChangesDocumentDisconnectEveryone;
//----------------------------------------------------------------------------------------------------------------------
// Карта зависимости изменений
//----------------------------------------------------------------------------------------------------------------------
Expand All @@ -69,6 +71,7 @@ AscDFH.changesRelationMap[AscDFH.historyitem_Document_Settings_GutterAtTop]
AscDFH.changesRelationMap[AscDFH.historyitem_Document_Settings_MirrorMargins] = [AscDFH.historyitem_Document_Settings_MirrorMargins];
AscDFH.changesRelationMap[AscDFH.historyitem_Document_SpecialFormsGlobalSettings] = [AscDFH.historyitem_Document_SpecialFormsGlobalSettings];
AscDFH.changesRelationMap[AscDFH.historyitem_Document_Settings_TrackRevisions] = [AscDFH.historyitem_Document_Settings_TrackRevisions];
AscDFH.changesRelationMap[AscDFH.historyitem_Document_DisconnectEveryone] = [AscDFH.historyitem_Document_DisconnectEveryone];
//----------------------------------------------------------------------------------------------------------------------

/**
Expand Down Expand Up @@ -1198,3 +1201,28 @@ CChangesDocumentPageColor.prototype.CreateReverseChange = function()
{
return new CChangesDocumentPageColor(this.Class, this.New, this.Old);
};

/**
* @constructor
* @extends {AscDFH.CChangesBase}
*/
function CChangesDocumentDisconnectEveryone(Class)
{
AscDFH.CChangesBase.call(this, Class);
}
CChangesDocumentDisconnectEveryone.prototype = Object.create(AscDFH.CChangesBase.prototype);
CChangesDocumentDisconnectEveryone.prototype.constructor = CChangesDocumentDisconnectEveryone;
CChangesDocumentDisconnectEveryone.prototype.Type = AscDFH.historyitem_Document_DisconnectEveryone;
CChangesDocumentDisconnectEveryone.prototype.Undo = function()
{
};
CChangesDocumentDisconnectEveryone.prototype.Redo = function()
{
let logicDocument = this.Class;

logicDocument.sendEvent("asc_onDisconnectEveryone");
let editorApi = logicDocument.GetApi();

editorApi.setViewModeDisconnect(true);
editorApi.asc_coAuthoringDisconnect();
};
29 changes: 29 additions & 0 deletions word/api.js
Original file line number Diff line number Diff line change
Expand Up @@ -899,6 +899,8 @@
this.CollaborativeMarksShowType = c_oAscCollaborativeMarksShowType.All;

this.stylePainter = null;

this.forceSaveDisconnectRequest = false;

// объекты, нужные для отправки в тулбар (шрифты, стили)
this._gui_control_colors = null;
Expand Down Expand Up @@ -2684,6 +2686,15 @@ background-repeat: no-repeat;\
"UserShortId" : this.DocInfo.get_UserId(),
"CursorInfo" : CursorInfo
}, HaveOtherChanges, true);

if (this.forceSaveDisconnectRequest)
{
this.forceSaveDisconnectRequest = false;
AscCommon.CollaborativeEditing.Set_GlobalLock(false);
this.setViewModeDisconnect(true);
this.asc_coAuthoringDisconnect();
this.sendEvent("asc_onDisconnectEveryone");
}
}
};
asc_docs_api.prototype._autoSaveInner = function () {
Expand Down Expand Up @@ -11319,6 +11330,23 @@ background-repeat: no-repeat;\

return logicDocument.GetOFormDocument();
};
asc_docs_api.prototype.asc_DisconnectEveryone = function()
{
let logicDocument = this.private_GetLogicDocument();
if (!logicDocument)
return false;

if (logicDocument.IsSelectionLocked(AscCommon.changestype_Document_Settings))
return false;

logicDocument.StartAction(AscDFH.historydescription_DisconnectEveryone);
logicDocument.GetHistory().Add(new CChangesDocumentDisconnectEveryone(logicDocument));
logicDocument.FinalizeAction();

this.forceSaveDisconnectRequest = true;
AscCommon.CollaborativeEditing.Set_GlobalLock(true);
this.asc_Save(false);
};

asc_docs_api.prototype.asc_UncheckContentControlButtons = function()
{
Expand Down Expand Up @@ -14830,6 +14858,7 @@ background-repeat: no-repeat;\
asc_docs_api.prototype['asc_SetHighlightRequiredFields'] = asc_docs_api.prototype.asc_SetHighlightRequiredFields;
asc_docs_api.prototype['asc_GetAllFormsData'] = asc_docs_api.prototype.asc_GetAllFormsData;
asc_docs_api.prototype['asc_GetOForm'] = asc_docs_api.prototype.asc_GetOForm;
asc_docs_api.prototype['asc_DisconnectEveryone'] = asc_docs_api.prototype.asc_DisconnectEveryone;

asc_docs_api.prototype['asc_BeginViewModeInReview'] = asc_docs_api.prototype.asc_BeginViewModeInReview;
asc_docs_api.prototype['asc_EndViewModeInReview'] = asc_docs_api.prototype.asc_EndViewModeInReview;
Expand Down

0 comments on commit 96ee2fa

Please sign in to comment.