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,17 +130,21 @@ function CDocInfo (obj){ ...@@ -130,17 +130,21 @@ function CDocInfo (obj){
} }
if (obj.OfflineApp === true) if (obj.OfflineApp === true)
this.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.Id = null;
this.Title = null; this.Url = null;
this.Format = null; this.Title = null;
this.VKey = null; this.Format = null;
this.UserId = null; this.VKey = null;
this.UserName = null; this.UserId = null;
this.Options = null; this.UserName = null;
this.CallbackUrl = null; this.Options = null;
this.CallbackUrl = null;
this.TemplateReplacement = null;
} }
} }
CDocInfo.prototype.get_Id = function(){return this.Id}; CDocInfo.prototype.get_Id = function(){return this.Id};
...@@ -163,6 +167,8 @@ CDocInfo.prototype.get_Options = function(){return this.Options;}; ...@@ -163,6 +167,8 @@ CDocInfo.prototype.get_Options = function(){return this.Options;};
CDocInfo.prototype.put_Options = function(v){this.Options = v;}; CDocInfo.prototype.put_Options = function(v){this.Options = v;};
CDocInfo.prototype.get_CallbackUrl = function(){return this.CallbackUrl;}; CDocInfo.prototype.get_CallbackUrl = function(){return this.CallbackUrl;};
CDocInfo.prototype.put_CallbackUrl = function(v){this.CallbackUrl = v;}; 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 = ...@@ -779,7 +779,16 @@ CDocument.prototype =
this.DrawingObjects.addToZIndexManagerAfterOpen(); 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() Add_TestDocument : function()
...@@ -14104,6 +14113,14 @@ CDocument.prototype.private_MoveCursorUp = function(StartX, StartY, AddToSelect) ...@@ -14104,6 +14113,14 @@ CDocument.prototype.private_MoveCursorUp = function(StartX, StartY, AddToSelect)
this.TurnOn_InterfaceEvents(true); this.TurnOn_InterfaceEvents(true);
return Result; 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 = ...@@ -83,7 +83,7 @@ CDocumentSearch.prototype =
return this.Id; return this.Id;
}, },
Select : function(Id) Select : function(Id, bUpdateStates)
{ {
var Paragraph = this.Elements[Id]; var Paragraph = this.Elements[Id];
if ( undefined != Paragraph ) if ( undefined != Paragraph )
...@@ -97,7 +97,7 @@ CDocumentSearch.prototype = ...@@ -97,7 +97,7 @@ CDocumentSearch.prototype =
Paragraph.Set_SelectionContentPos(SearchElement.StartPos, SearchElement.EndPos); Paragraph.Set_SelectionContentPos(SearchElement.StartPos, SearchElement.EndPos);
Paragraph.Set_ParaContentPos(SearchElement.StartPos, false, -1, -1); Paragraph.Set_ParaContentPos(SearchElement.StartPos, false, -1, -1);
Paragraph.Document_SetThisElementCurrent(true); Paragraph.Document_SetThisElementCurrent(false !== bUpdateStates ? true : false);
} }
this.CurId = Id; this.CurId = Id;
...@@ -147,7 +147,7 @@ CDocumentSearch.prototype = ...@@ -147,7 +147,7 @@ CDocumentSearch.prototype =
} }
}, },
Replace_All : function(NewStr) Replace_All : function(NewStr, bUpdateStates)
{ {
var bSelect = true; var bSelect = true;
for ( var Id in this.Elements ) for ( var Id in this.Elements )
...@@ -155,7 +155,7 @@ CDocumentSearch.prototype = ...@@ -155,7 +155,7 @@ CDocumentSearch.prototype =
if ( true === bSelect ) if ( true === bSelect )
{ {
bSelect = false; bSelect = false;
this.Select( Id ); this.Select(Id, bUpdateStates);
} }
this.Replace( NewStr, Id ); this.Replace( NewStr, Id );
...@@ -173,7 +173,7 @@ CDocumentSearch.prototype = ...@@ -173,7 +173,7 @@ CDocumentSearch.prototype =
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
// CDocument // CDocument
//---------------------------------------------------------------------------------------------------------------------- //----------------------------------------------------------------------------------------------------------------------
CDocument.prototype.Search = function(Str, Props) CDocument.prototype.Search = function(Str, Props, bDraw)
{ {
var StartTime = new Date().getTime(); var StartTime = new Date().getTime();
...@@ -193,8 +193,11 @@ CDocument.prototype.Search = function(Str, Props) ...@@ -193,8 +193,11 @@ CDocument.prototype.Search = function(Str, Props)
// Поиск в колонтитулах // Поиск в колонтитулах
this.SectionsInfo.Search( Str, Props, this.SearchEngine ); this.SectionsInfo.Search( Str, Props, this.SearchEngine );
this.DrawingDocument.ClearCachePages(); if (false !== bDraw)
this.DrawingDocument.FirePaint(); {
this.DrawingDocument.ClearCachePages();
this.DrawingDocument.FirePaint();
}
//console.log( "Search logic: " + ((new Date().getTime() - StartTime) / 1000) + " s" ); //console.log( "Search logic: " + ((new Date().getTime() - StartTime) / 1000) + " s" );
...@@ -204,7 +207,7 @@ CDocument.prototype.Search = function(Str, Props) ...@@ -204,7 +207,7 @@ CDocument.prototype.Search = function(Str, Props)
CDocument.prototype.Search_Select = function(Id) CDocument.prototype.Search_Select = function(Id)
{ {
this.Selection_Remove(); this.Selection_Remove();
this.SearchEngine.Select(Id); this.SearchEngine.Select(Id, true);
this.RecalculateCurPos(); this.RecalculateCurPos();
this.Document_UpdateInterfaceState(); this.Document_UpdateInterfaceState();
...@@ -237,7 +240,7 @@ CDocument.prototype.Search_Replace = function(NewStr, bAll, Id) ...@@ -237,7 +240,7 @@ CDocument.prototype.Search_Replace = function(NewStr, bAll, Id)
History.Create_NewPoint(); History.Create_NewPoint();
if ( true === bAll ) if ( true === bAll )
this.SearchEngine.Replace_All( NewStr ); this.SearchEngine.Replace_All( NewStr, true );
else else
this.SearchEngine.Replace( NewStr, Id ); this.SearchEngine.Replace( NewStr, Id );
......
...@@ -65,17 +65,21 @@ function CDocInfo (obj){ ...@@ -65,17 +65,21 @@ function CDocInfo (obj){
} }
if (obj.OfflineApp === true) if (obj.OfflineApp === true)
this.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.Id = null;
this.Title = null; this.Url = null;
this.Format = null; this.Title = null;
this.VKey = null; this.Format = null;
this.UserId = null; this.VKey = null;
this.UserName = null; this.UserId = null;
this.Options = null; this.UserName = null;
this.CallbackUrl = null; this.Options = null;
this.CallbackUrl = null;
this.TemplateReplacement = null;
} }
} }
CDocInfo.prototype.get_Id = function(){return this.Id}; CDocInfo.prototype.get_Id = function(){return this.Id};
...@@ -98,6 +102,8 @@ CDocInfo.prototype.get_Options = function(){return this.Options;}; ...@@ -98,6 +102,8 @@ CDocInfo.prototype.get_Options = function(){return this.Options;};
CDocInfo.prototype.put_Options = function(v){this.Options = v;}; CDocInfo.prototype.put_Options = function(v){this.Options = v;};
CDocInfo.prototype.get_CallbackUrl = function(){return this.CallbackUrl;}; CDocInfo.prototype.get_CallbackUrl = function(){return this.CallbackUrl;};
CDocInfo.prototype.put_CallbackUrl = function(v){this.CallbackUrl = v;}; 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) 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