Function

TTemplate.CanExportXML

Module

uTemplates

Last Modified

7/15/2014 3:26:44 PM

Visibility

Public

Owner

TTemplate

Declaration

function CanExportXML(Data, Fields: TStringList; IndentLevel: integer = 0): boolean;

Calls Hierarchy


TTemplate.CanExportXML
 ├BadTemplateName
 ├AddXMLData
 ├AddXMLBool
 │ └AddXMLData
 ├AddXMLList
 │ └ListTemplateFields
 │   └GetTemplateField
 │     ├LoadTemplateFieldByIEN
 │     ├LoadTemplateField
 │     └TTemplateField.Create
 │       ├TemplateFieldCode2Field
 │       └TemplateDateCode2DateType
 ├TTemplate.GetBoilerplate
 │ └GetTemplateBoilerplate
 ├TTemplate.GetDescription
 │ └LoadTemplateDescription
 ├TTemplate.GetItems
 │ └ExpandTemplate
 │   ├TTemplate.GetChildren
 │   ├GetTemplateChildren
 │   ├AddTemplate
 │   │ ├TTemplate.Create
 │   │ │ └TTemplate.ReminderDialogIEN
 │   │ └TTemplate.AddChild
 │   │   └TTemplate.GetItems...
 │   └TTemplate.ItemIENs
 │     └TTemplate.GetItems...
 └..(rec)..

Called-By Hierarchy


                     TTemplate.CanExportXML
                                ..(rec)..┤ 
TfrmTemplateEditor.mnuExportTemplateClick┘ 

Calls

Name Declaration Comments
AddXMLBool procedure AddXMLBool(Data: TStrings; const Pad: string; FldType: TTemplateExportField; const Value: boolean); -
AddXMLData procedure AddXMLData(Data: TStrings; const Pad: string; FldType: TTemplateExportField; const Value, DefValue: string); -
AddXMLList procedure AddXMLList(Data, Fields: TStrings; const Pad: string; FldType: TTemplateExportField; Const Txt: string); -
BadTemplateName function BadTemplateName(Text: string): boolean; -
TTemplate.CanExportXML function CanExportXML(Data, Fields: TStringList; IndentLevel: integer = 0): boolean; -
TTemplate.GetBoilerplate function GetBoilerplate: string; -
TTemplate.GetDescription function GetDescription: string; -
TTemplate.GetItems function GetItems: TList; -

Called-By

Name Declaration Comments
TTemplate.CanExportXML function CanExportXML(Data, Fields: TStringList; IndentLevel: integer = 0): boolean; -
TfrmTemplateEditor.mnuExportTemplateClick procedure mnuExportTemplateClick(Sender: TObject); -


Source

2435  function TTemplate.CanExportXML(Data, Fields: TStringList; IndentLevel: integer = 0): boolean;
2436  var
2437    Pad, Tmp: string;
2438    i: integer;
2439  
2440  begin
2441    if BadTemplateName(PrintName) then
2442    begin
2443      InfoBox('Can not export template.' + CRLF + 'Template has an invalid name: ' +
2444        PrintName + '.' + BadNameText, 'Error', MB_OK or MB_ICONERROR);
2445      Result := FALSE;
2446      exit;
2447    end;
2448    Result := TRUE;
2449    Pad := StringOfChar(' ',IndentLevel);
2450    Data.Add(Pad + '<' + XMLTemplateTag + ' ' + TemplateExportTag[efName] + '="' + Text2XML(PrintName) + '">');
2451    AddXMLData(Data, Pad, efBlankLines, IntToStr(Gap), '0');
2452    if(RealType in AllTemplateRootTypes) then
2453      Tmp := TemplateTypeCodes[ttClass]
2454    else
2455      Tmp := TemplateTypeCodes[RealType];
2456    AddXMLData(Data, Pad, efType, Tmp, '');
2457    AddXMLData(Data, Pad, efStatus, TemplateActiveCode[Active], '');
2458    AddXMLBool(Data, Pad, efExclude, Exclude);
2459    AddXMLBool(Data, Pad, efDialog, Dialog);
2460    AddXMLBool(Data, Pad, efDisplayOnly, DisplayOnly);
2461    AddXMLBool(Data, Pad, efFirstLine, FirstLine);
2462    AddXMLBool(Data, Pad, efOneItemOnly, OneItemOnly);
2463    AddXMLBool(Data, Pad, efHideDialogItems, HideDlgItems);
2464    AddXMLBool(Data, Pad, efHideTreeItems, HideItems);
2465    AddXMLBool(Data, Pad, efIndentItems, IndentItems);
2466    AddXMLBool(Data, Pad, efLock, Lock);
2467    AddXMLList(Data, Fields, Pad, efBoilerplate, GetBoilerplate);
2468    AddXMLList(Data, Fields, Pad, efDescription, GetDescription);
2469    GetItems;
2470    if(FItems.Count > 0) then
2471    begin
2472      Data.Add(Pad + '  <' + TemplateExportTag[efItems] + '>');
2473      for i := 0 to FItems.Count-1 do
2474      begin
2475        Result := TTemplate(FItems[i]).CanExportXML(Data, Fields, IndentLevel + 4);
2476        if(not Result) then exit;
2477      end;
2478      Data.Add(Pad + '  </' + TemplateExportTag[efItems] + '>');
2479    end;
2480    Data.Add(Pad + '</' + XMLTemplateTag + '>');
2481  end;