Commit fcdda1b2 authored by Ilya.Kirillov's avatar Ilya.Kirillov Committed by Alexander.Trofimov

Сделана схема для шаблонных замен при открытии файла.

git-svn-id: svn://192.168.3.15/activex/AVS/Sources/TeamlabOffice/trunk/OfficeWeb@60120 954022d7-b5bf-4e40-9824-e11837661b57
parent f6f5a355
......@@ -130,8 +130,11 @@ function CDocInfo (obj){
}
if (obj.OfflineApp === true)
this.OfflineApp = true;
this.TemplateReplacement = (undefined !== obj.TemplateReplacement && null !== obj.TemplateReplacement ? obj.TemplateReplacement : null)
}
else{
else
{
this.Id = null;
this.Url = null;
this.Title = null;
......@@ -141,6 +144,7 @@ function CDocInfo (obj){
this.UserName = null;
this.Options = null;
this.CallbackUrl = null;
this.TemplateReplacement = null;
}
}
CDocInfo.prototype.get_Id = function(){return this.Id};
......@@ -163,6 +167,8 @@ CDocInfo.prototype.get_Options = function(){return this.Options;};
CDocInfo.prototype.put_Options = function(v){this.Options = v;};
CDocInfo.prototype.get_CallbackUrl = function(){return this.CallbackUrl;};
CDocInfo.prototype.put_CallbackUrl = function(v){this.CallbackUrl = v;};
CDocInfo.prototype.get_TemplateReplacement = function(){return this.TemplateReplacement;};
CDocInfo.prototype.put_TemplateReplacement = function(v){this.TemplateReplacement = v;};
// ---------------------------------------------------------------
......
......@@ -779,7 +779,16 @@ CDocument.prototype =
this.DrawingObjects.addToZIndexManagerAfterOpen();
// Перемещаем курсор в начало документа
this.Cursor_MoveToStartPos( false );
this.Cursor_MoveToStartPos(false);
if (editor.DocInfo)
{
var TemplateReplacementData = editor.DocInfo.get_TemplateReplacement();
if (null !== TemplateReplacementData)
{
this.private_ProcessTemplateReplacement(TemplateReplacementData);
}
}
},
Add_TestDocument : function()
......@@ -14104,6 +14113,14 @@ CDocument.prototype.private_MoveCursorUp = function(StartX, StartY, AddToSelect)
this.TurnOn_InterfaceEvents(true);
return Result;
};
CDocument.prototype.private_ProcessTemplateReplacement = function(TemplateReplacementData)
{
for (var Id in TemplateReplacementData)
{
this.Search(Id, {MatchCase : true}, false);
this.SearchEngine.Replace_All(TemplateReplacementData[Id], false);
}
};
//-----------------------------------------------------------------------------------
//
......
......@@ -83,7 +83,7 @@ CDocumentSearch.prototype =
return this.Id;
},
Select : function(Id)
Select : function(Id, bUpdateStates)
{
var Paragraph = this.Elements[Id];
if ( undefined != Paragraph )
......@@ -97,7 +97,7 @@ CDocumentSearch.prototype =
Paragraph.Set_SelectionContentPos(SearchElement.StartPos, SearchElement.EndPos);
Paragraph.Set_ParaContentPos(SearchElement.StartPos, false, -1, -1);
Paragraph.Document_SetThisElementCurrent(true);
Paragraph.Document_SetThisElementCurrent(false !== bUpdateStates ? true : false);
}
this.CurId = Id;
......@@ -147,7 +147,7 @@ CDocumentSearch.prototype =
}
},
Replace_All : function(NewStr)
Replace_All : function(NewStr, bUpdateStates)
{
var bSelect = true;
for ( var Id in this.Elements )
......@@ -155,7 +155,7 @@ CDocumentSearch.prototype =
if ( true === bSelect )
{
bSelect = false;
this.Select( Id );
this.Select(Id, bUpdateStates);
}
this.Replace( NewStr, Id );
......@@ -173,7 +173,7 @@ CDocumentSearch.prototype =
//----------------------------------------------------------------------------------------------------------------------
// CDocument
//----------------------------------------------------------------------------------------------------------------------
CDocument.prototype.Search = function(Str, Props)
CDocument.prototype.Search = function(Str, Props, bDraw)
{
var StartTime = new Date().getTime();
......@@ -193,8 +193,11 @@ CDocument.prototype.Search = function(Str, Props)
// Поиск в колонтитулах
this.SectionsInfo.Search( Str, Props, this.SearchEngine );
if (false !== bDraw)
{
this.DrawingDocument.ClearCachePages();
this.DrawingDocument.FirePaint();
}
//console.log( "Search logic: " + ((new Date().getTime() - StartTime) / 1000) + " s" );
......@@ -204,7 +207,7 @@ CDocument.prototype.Search = function(Str, Props)
CDocument.prototype.Search_Select = function(Id)
{
this.Selection_Remove();
this.SearchEngine.Select(Id);
this.SearchEngine.Select(Id, true);
this.RecalculateCurPos();
this.Document_UpdateInterfaceState();
......@@ -237,7 +240,7 @@ CDocument.prototype.Search_Replace = function(NewStr, bAll, Id)
History.Create_NewPoint();
if ( true === bAll )
this.SearchEngine.Replace_All( NewStr );
this.SearchEngine.Replace_All( NewStr, true );
else
this.SearchEngine.Replace( NewStr, Id );
......
......@@ -65,8 +65,11 @@ function CDocInfo (obj){
}
if (obj.OfflineApp === true)
this.OfflineApp = true;
this.TemplateReplacement = (undefined !== obj.TemplateReplacement && null !== obj.TemplateReplacement ? obj.TemplateReplacement : null)
}
else{
else
{
this.Id = null;
this.Url = null;
this.Title = null;
......@@ -76,6 +79,7 @@ function CDocInfo (obj){
this.UserName = null;
this.Options = null;
this.CallbackUrl = null;
this.TemplateReplacement = null;
}
}
CDocInfo.prototype.get_Id = function(){return this.Id};
......@@ -98,6 +102,8 @@ CDocInfo.prototype.get_Options = function(){return this.Options;};
CDocInfo.prototype.put_Options = function(v){this.Options = v;};
CDocInfo.prototype.get_CallbackUrl = function(){return this.CallbackUrl;};
CDocInfo.prototype.put_CallbackUrl = function(v){this.CallbackUrl = v;};
CDocInfo.prototype.get_TemplateReplacement = function(){return this.TemplateReplacement;};
CDocInfo.prototype.put_TemplateReplacement = function(v){this.TemplateReplacement = v;};
function CListType(obj)
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment