version 1.217, 2008/11/07 16:44:14
|
version 1.218, 2008/11/12 15:54:32
|
Line 1960 void SetDocumentAsXTigerTemplate(Documen
|
Line 1960 void SetDocumentAsXTigerTemplate(Documen
|
SetDocumentAsXTigerLibrary |
SetDocumentAsXTigerLibrary |
Set the document template structure as template library. |
Set the document template structure as template library. |
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
void SetDocumentAsXTigerLibrary(Document doc) |
void SetDocumentAsXTigerLibrary (Document doc) |
{ |
{ |
#ifdef TEMPLATES |
#ifdef TEMPLATES |
XTigerTemplate t = GetXTigerDocTemplate(doc); |
XTigerTemplate t = GetXTigerDocTemplate(doc); |
Line 1974 void SetDocumentAsXTigerLibrary(Document
|
Line 1974 void SetDocumentAsXTigerLibrary(Document
|
TemplateCreateTextBox |
TemplateCreateTextBox |
Create a xt:use types="string" box around the selection. |
Create a xt:use types="string" box around the selection. |
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
void TemplateCreateTextBox(Document doc, View view) |
void TemplateCreateTextBox (Document doc, View view) |
{ |
{ |
#ifdef TEMPLATES |
#ifdef TEMPLATES |
Element selElem; |
Element selElem; |
Line 1984 void TemplateCreateTextBox(Document doc,
|
Line 1984 void TemplateCreateTextBox(Document doc,
|
ElementType useType; |
ElementType useType; |
Element use; |
Element use; |
char buffer[128]; |
char buffer[128]; |
ThotBool oldStructureChecking; |
ThotBool oldStructureChecking, open; |
|
|
char *title = TtaGetMessage (AMAYA, AM_TEMPLATE_USESTRING); |
char *title = TtaGetMessage (AMAYA, AM_TEMPLATE_USESTRING); |
char *label = TtaGetMessage (AMAYA, AM_TEMPLATE_LABEL); |
char *label = TtaGetMessage (AMAYA, AM_TEMPLATE_LABEL); |
Line 2010 void TemplateCreateTextBox(Document doc,
|
Line 2010 void TemplateCreateTextBox(Document doc,
|
// request the element label |
// request the element label |
QueryStringFromUser(label, title, buffer, 127); |
QueryStringFromUser(label, title, buffer, 127); |
if (buffer[0] == EOS) |
if (buffer[0] == EOS) |
|
// stop the creation |
return; |
return; |
|
|
|
open = TtaHasUndoSequence (doc); |
useType.ElSSchema = sstempl; |
useType.ElSSchema = sstempl; |
useType.ElTypeNum = Template_EL_useSimple; |
useType.ElTypeNum = Template_EL_useSimple; |
oldStructureChecking = TtaGetStructureChecking (doc); |
oldStructureChecking = TtaGetStructureChecking (doc); |
TtaSetStructureChecking (FALSE, doc); |
TtaSetStructureChecking (FALSE, doc); |
|
if (firstChar == 0) |
if (firstChar==0) |
|
{ |
{ |
|
// the whole string is selected |
use = TtaNewElement(doc, useType); |
use = TtaNewElement(doc, useType); |
if (use) |
if (use) |
{ |
{ |
TtaOpenUndoSequence (doc, NULL, NULL, 0, 0); |
if (!open) |
|
TtaOpenUndoSequence (doc, NULL, NULL, 0, 0); |
TtaInsertSibling(use, selElem, FALSE, doc); |
TtaInsertSibling(use, selElem, FALSE, doc); |
TtaRegisterElementCreate(use, doc); |
TtaRegisterElementCreate(use, doc); |
TtaRegisterElementDelete (selElem, doc); |
TtaRegisterElementDelete (selElem, doc); |
TtaRemoveTree(selElem, doc); |
TtaRemoveTree (selElem, doc); |
TtaInsertFirstChild(&selElem, use, doc); |
TtaInsertFirstChild(&selElem, use, doc); |
TtaRegisterElementDelete (selElem, doc); |
TtaRegisterElementDelete (selElem, doc); |
SetAttributeStringValue(use, Template_ATTR_types, "string"); |
SetAttributeStringValue (use, Template_ATTR_types, "string"); |
SetAttributeStringValue(use, Template_ATTR_title, buffer); |
SetAttributeStringValue (use, Template_ATTR_title, buffer); |
TtaCloseUndoSequence(doc); |
if (!open) |
TtaSelectElement(doc, use); |
TtaCloseUndoSequence (doc); |
|
TtaSelectElement (doc, use); |
} |
} |
} |
} |
else |
else if (GenerateInlineElement (Template_EL_useSimple, sstempl, 0, "", TRUE)) |
{ |
{ |
GenerateInlineElement(Template_EL_useSimple, sstempl, 0, "", TRUE); |
// only a piece of the string is selected |
TtaGiveFirstSelectedElement(doc, &use, &firstChar, &lastChar); |
TtaGiveFirstSelectedElement (doc, &use, &firstChar, &lastChar); |
selType = TtaGetElementType(use); |
selType = TtaGetElementType (use); |
if (selType.ElSSchema==sstempl && selType.ElTypeNum==Template_EL_useSimple) |
while (use && |
|
(selType.ElSSchema != sstempl || |
|
selType.ElTypeNum != Template_EL_useSimple)) |
{ |
{ |
|
// look for the enclosing use element |
|
use = TtaGetParent (use); |
|
selType = TtaGetElementType (use); |
|
} |
|
if (selType.ElSSchema == sstempl && |
|
selType.ElTypeNum == Template_EL_useSimple) |
|
{ |
|
if (!open) |
|
TtaExtendUndoSequence (doc); |
SetAttributeStringValue(use, Template_ATTR_types, "string"); |
SetAttributeStringValue(use, Template_ATTR_types, "string"); |
SetAttributeStringValue(use, Template_ATTR_title, buffer); |
SetAttributeStringValue(use, Template_ATTR_title, buffer); |
|
// update the status bar |
|
TtaSetStatusSelectedElement (doc, 1, use); |
|
if (!open) |
|
TtaCloseUndoSequence(doc); |
} |
} |
} |
} |
TtaSetStructureChecking (oldStructureChecking, doc); |
TtaSetStructureChecking (oldStructureChecking, doc); |
Line 2058 void TemplateCreateTextBox(Document doc,
|
Line 2077 void TemplateCreateTextBox(Document doc,
|
TemplateCreateFreeBox |
TemplateCreateFreeBox |
Create a xt:bag types="string" box around the selection. |
Create a xt:bag types="string" box around the selection. |
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
void TemplateCreateFreeBox(Document doc, View view) |
void TemplateCreateFreeBox (Document doc, View view) |
{ |
{ |
#ifdef TEMPLATES |
#ifdef TEMPLATES |
Element selElem, selElem2, parent, parent2, current, child = NULL; |
ThotBool oldStructureChecking; |
ElementType selType, selType2; |
DisplayMode dispMode; |
int firstChar, lastChar, firstChar2, lastChar2; |
Element selElem, selElem2, parent, parent2, current; |
SSchema sstempl = TtaGetSSchema ("Template", doc); |
Element bag, child = NULL; |
|
ElementType selType, selType2, bagType; |
ElementType bagType; |
SSchema sstempl, sshtml; |
Element bag; |
int firstChar, lastChar, firstChar2, lastChar2; |
char buffer[128]; |
char buffer[128], *title, *label; |
|
|
char *title = TtaGetMessage (AMAYA, AM_TEMPLATE_BAGANY); |
|
char *label = TtaGetMessage (AMAYA, AM_TEMPLATE_LABEL); |
|
|
|
if (!TtaGetDocumentAccessMode(doc)) |
if (!TtaGetDocumentAccessMode(doc)) |
return; |
return; |
//CheckSelectionLevel (TransDoc); |
|
if (doc && TtaGetDocumentAccessMode(doc) && sstempl && |
sstempl = TtaGetSSchema ("Template", doc); |
|
if (doc && sstempl && |
IsTemplateDocument(doc) && !IsTemplateInstanceDocument(doc)) |
IsTemplateDocument(doc) && !IsTemplateInstanceDocument(doc)) |
{ |
{ |
TtaGiveFirstSelectedElement(doc, &selElem, &firstChar, &lastChar); |
TtaGiveFirstSelectedElement(doc, &selElem, &firstChar, &lastChar); |
TtaGiveLastSelectedElement(doc, &selElem2, &firstChar2, &lastChar2); |
if (selElem) |
if (selElem && selElem2) |
|
{ |
{ |
// request the element label |
TtaGiveLastSelectedElement(doc, &selElem2, &firstChar2, &lastChar2); |
QueryStringFromUser(label, title, buffer, 127); |
sshtml = TtaGetSSchema ("HTML", doc); |
if (buffer[0] == EOS) |
selType = TtaGetElementType(selElem); |
return; |
selType2 = TtaGetElementType(selElem2); |
|
|
selType = TtaGetElementType(selElem); |
|
selType2 = TtaGetElementType(selElem2); |
|
bagType.ElSSchema = sstempl; |
bagType.ElSSchema = sstempl; |
bagType.ElTypeNum = Template_EL_bag; |
bagType.ElTypeNum = Template_EL_bag; |
parent = TtaGetParent(selElem); |
parent = TtaGetParent(selElem); |
parent2 = TtaGetParent(selElem2); |
parent2 = TtaGetParent(selElem2); |
|
if (firstChar != 0 || firstChar2 != 0 || parent != parent2) |
if (firstChar==0 && firstChar2==0 && parent == parent2) |
|
{ |
{ |
ThotBool oldStructureChecking; |
TtaDisplaySimpleMessage (CONFIRM, AMAYA, AM_INVALID_SELECTION); |
DisplayMode dispMode; |
return; |
dispMode = TtaGetDisplayMode (doc); |
} |
if (dispMode == DisplayImmediately) |
else if ((selType.ElSSchema == sshtml && |
TtaSetDisplayMode (doc, DeferredDisplay); |
(selType.ElTypeNum == HTML_EL_List_Item || |
oldStructureChecking = TtaGetStructureChecking (doc); |
selType.ElTypeNum == HTML_EL_Term || |
TtaSetStructureChecking (FALSE, doc); |
selType.ElTypeNum == HTML_EL_Definition || |
|
selType.ElTypeNum == HTML_EL_Option_item || |
// Create and insert xt:bag element |
selType.ElTypeNum == HTML_EL_CAPTION || |
bag = TtaNewElement(doc, bagType); |
selType.ElTypeNum == HTML_EL_Table_row || |
TtaOpenUndoSequence (doc, NULL, NULL, 0, 0); |
selType.ElTypeNum == HTML_EL_thead || |
TtaInsertSibling(bag, selElem, TRUE, doc); |
selType.ElTypeNum == HTML_EL_tbody || |
TtaRegisterElementCreate(bag, doc); |
selType.ElTypeNum == HTML_EL_tfoot)) || |
|
(selType2.ElSSchema == sshtml && |
|
(selType2.ElTypeNum == HTML_EL_List_Item || |
|
selType2.ElTypeNum == HTML_EL_Term || |
|
selType2.ElTypeNum == HTML_EL_Definition || |
|
selType2.ElTypeNum == HTML_EL_Option_item || |
|
selType2.ElTypeNum == HTML_EL_CAPTION || |
|
selType2.ElTypeNum == HTML_EL_Table_row || |
|
selType2.ElTypeNum == HTML_EL_thead || |
|
selType2.ElTypeNum == HTML_EL_tbody || |
|
selType2.ElTypeNum == HTML_EL_tfoot))) |
|
{ |
|
TtaDisplaySimpleMessage (CONFIRM, AMAYA, AM_INVALID_SELECTION); |
|
return; |
|
} |
|
else if (selElem != selElem2 && |
|
((selType.ElSSchema == sshtml && |
|
(selType.ElTypeNum == HTML_EL_Table_cell || |
|
selType.ElTypeNum == HTML_EL_Data_cell || |
|
selType.ElTypeNum == HTML_EL_Heading_cell)) || |
|
(selType2.ElSSchema == sshtml && |
|
(selType2.ElTypeNum == HTML_EL_Table_cell || |
|
selType2.ElTypeNum == HTML_EL_Data_cell || |
|
selType2.ElTypeNum == HTML_EL_Heading_cell)))) |
|
{ |
|
TtaDisplaySimpleMessage (CONFIRM, AMAYA, AM_INVALID_SELECTION); |
|
return; |
|
} |
|
|
TtaNextSibling(&selElem2); |
// request the element label |
while (selElem!=selElem2) |
title = TtaGetMessage (AMAYA, AM_TEMPLATE_BAGANY); |
{ |
label = TtaGetMessage (AMAYA, AM_TEMPLATE_LABEL); |
current = selElem; |
QueryStringFromUser(label, title, buffer, 127); |
TtaNextSibling(&selElem); |
if (buffer[0] == EOS) |
|
return; |
|
|
TtaRegisterElementDelete (current, doc); |
dispMode = TtaGetDisplayMode (doc); |
TtaRemoveTree(current, doc); |
if (dispMode == DisplayImmediately) |
if (child) |
TtaSetDisplayMode (doc, DeferredDisplay); |
TtaInsertSibling(current, child, FALSE, doc); |
oldStructureChecking = TtaGetStructureChecking (doc); |
else |
TtaSetStructureChecking (FALSE, doc); |
TtaInsertFirstChild(¤t, bag, doc); |
|
TtaRegisterElementDelete (current, doc); |
|
child = current; |
|
} |
|
|
|
SetAttributeStringValue(bag, Template_ATTR_types, "any"); |
// Create and insert xt:bag element |
SetAttributeStringValue(bag, Template_ATTR_title, buffer); |
bag = TtaNewElement(doc, bagType); |
TtaCloseUndoSequence(doc); |
TtaOpenUndoSequence (doc, NULL, NULL, 0, 0); |
TtaSelectElement(doc, bag); |
if (selType.ElSSchema == sshtml && |
|
(selType.ElTypeNum == HTML_EL_Table_cell || |
|
selType.ElTypeNum == HTML_EL_Data_cell || |
|
selType.ElTypeNum == HTML_EL_Heading_cell)) |
|
{ |
|
// move the selection to children |
|
selElem = TtaGetFirstChild (selElem); |
|
selElem2 = TtaGetLastChild (selElem2); |
|
} |
|
|
TtaSetStructureChecking (oldStructureChecking, doc); |
TtaInsertSibling (bag, selElem, TRUE, doc); |
TtaSetDisplayMode (doc, dispMode); |
TtaRegisterElementCreate (bag, doc); |
|
TtaNextSibling (&selElem2); |
|
while (selElem != selElem2) |
|
{ |
|
current = selElem; |
|
TtaNextSibling(&selElem); |
|
TtaRegisterElementDelete (current, doc); |
|
TtaRemoveTree (current, doc); |
|
if (child) |
|
TtaInsertSibling(current, child, FALSE, doc); |
|
else |
|
TtaInsertFirstChild(¤t, bag, doc); |
|
TtaRegisterElementDelete (current, doc); |
|
child = current; |
} |
} |
|
|
|
SetAttributeStringValue(bag, Template_ATTR_types, "any"); |
|
SetAttributeStringValue(bag, Template_ATTR_title, buffer); |
|
TtaSetDisplayMode (doc, dispMode); |
|
TtaCloseUndoSequence(doc); |
|
TtaSelectElement (doc, bag); |
|
// update the status bar |
|
TtaSetStatusSelectedElement (doc, 1, bag); |
|
TtaSetStructureChecking (oldStructureChecking, doc); |
} |
} |
} |
} |
#endif /* TEMPLATES */ |
#endif /* TEMPLATES */ |
Line 2144 void TemplateCreateFreeBox(Document doc,
|
Line 2210 void TemplateCreateFreeBox(Document doc,
|
TemplateCreateUnion |
TemplateCreateUnion |
Create a xt:union around the selection. |
Create a xt:union around the selection. |
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
void TemplateCreateUnion(Document doc, View view) |
void TemplateCreateUnion (Document doc, View view) |
{ |
{ |
#ifdef TEMPLATES |
#ifdef TEMPLATES |
SSchema sstempl = TtaGetSSchema ("Template", doc); |
SSchema sstempl = TtaGetSSchema ("Template", doc); |
Element head, sibling, unionEl; |
Element head, sibling, unionEl, selElem; |
ElementType unionType; |
ElementType unionType, selType; |
XTigerTemplate t = GetXTigerDocTemplate(doc); |
XTigerTemplate t = GetXTigerDocTemplate(doc); |
char *proposed, *name = NULL, *types=NULL; |
char *proposed, *name = NULL, *types=NULL; |
|
int firstChar, lastChar; |
Element selElem; |
|
ElementType selType; |
|
int firstChar, lastChar; |
|
|
|
if (t && sstempl) |
if (t && sstempl) |
{ |
{ |
TtaGiveFirstSelectedElement(doc, &selElem, &firstChar, &lastChar); |
TtaGiveFirstSelectedElement(doc, &selElem, &firstChar, &lastChar); |
selType = TtaGetElementType(selElem); |
selType = TtaGetElementType(selElem); |
if (selType.ElSSchema==sstempl && selType.ElTypeNum==Template_EL_union) |
if (selType.ElSSchema == sstempl && selType.ElTypeNum == Template_EL_union) |
Template_ModifyUnionElement(doc, selElem); |
Template_ModifyUnionElement(doc, selElem); |
else |
else |
{ |
{ |
Line 2214 void Template_ModifyUnionElement(Documen
|
Line 2277 void Template_ModifyUnionElement(Documen
|
if (doc && unionEl && t && sstempl) |
if (doc && unionEl && t && sstempl) |
{ |
{ |
unionType = TtaGetElementType(unionEl); |
unionType = TtaGetElementType(unionEl); |
if (unionType.ElSSchema==sstempl && unionType.ElTypeNum==Template_EL_union) |
if (unionType.ElSSchema == sstempl && unionType.ElTypeNum == Template_EL_union) |
{ |
{ |
proposed = Template_GetAllDeclarations(t, TRUE, FALSE, TRUE); |
proposed = Template_GetAllDeclarations(t, TRUE, FALSE, TRUE); |
checked = GetAttributeStringValueFromNum(unionEl, Template_ATTR_includeAt, NULL); |
checked = GetAttributeStringValueFromNum(unionEl, Template_ATTR_includeAt, NULL); |
name = GetAttributeStringValueFromNum(unionEl, Template_ATTR_name, NULL); |
name = GetAttributeStringValueFromNum(unionEl, Template_ATTR_name, NULL); |
if (QueryUnionFromUser(proposed, checked, &name, &types, FALSE)) |
if (QueryUnionFromUser(proposed, checked, &name, &types, FALSE)) |
{ |
{ |
TtaOpenUndoSequence (doc, NULL, NULL, 0, 0); |
TtaOpenUndoSequence (doc, NULL, NULL, 0, 0); |
Line 2237 void Template_ModifyUnionElement(Documen
|
Line 2300 void Template_ModifyUnionElement(Documen
|
TemplateCreateRepeat |
TemplateCreateRepeat |
Create a xt:repeat around the selection. |
Create a xt:repeat around the selection. |
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
void TemplateCreateRepeat(Document doc, View view) |
void TemplateCreateRepeat (Document doc, View view) |
{ |
{ |
Template_CreateRepeatFromSelection(doc, FALSE); |
Template_CreateRepeatFromSelection (doc, view, FALSE); |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 2248 void TemplateCreateRepeat(Document doc,
|
Line 2311 void TemplateCreateRepeat(Document doc,
|
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
void TemplateCreateRepeatComp (Document doc, View view) |
void TemplateCreateRepeatComp (Document doc, View view) |
{ |
{ |
Template_CreateRepeatFromSelection(doc, TRUE); |
Template_CreateRepeatFromSelection (doc, view, TRUE); |
} |
} |
|
|
/*---------------------------------------------------------------------- |
/*---------------------------------------------------------------------- |
Line 2259 void TemplateCreateRepeatComp (Document
|
Line 2322 void TemplateCreateRepeatComp (Document
|
If createComp is true, create a component with the selection. |
If createComp is true, create a component with the selection. |
Return the xt:use element. |
Return the xt:use element. |
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
Element Template_CreateRepeatFromSelection (Document doc, ThotBool createComp) |
Element Template_CreateRepeatFromSelection (Document doc, int view, |
|
ThotBool createComp) |
{ |
{ |
#ifdef TEMPLATES |
#ifdef TEMPLATES |
ThotBool oldStructureChecking; |
ThotBool oldStructureChecking; |
Line 2310 Element Template_CreateRepeatFromSelecti
|
Line 2374 Element Template_CreateRepeatFromSelecti
|
selType.ElTypeNum==Template_EL_useSimple)) |
selType.ElTypeNum==Template_EL_useSimple)) |
use = selElem; |
use = selElem; |
else |
else |
use = Template_CreateUseFromSelection (doc, createComp); |
use = Template_CreateUseFromSelection (doc, view, createComp); |
if (use) |
if (use) |
{ |
{ |
TtaExtendUndoSequence(doc); |
TtaExtendUndoSequence(doc); |
Line 2348 Element Template_CreateRepeatFromSelecti
|
Line 2412 Element Template_CreateRepeatFromSelecti
|
void TemplateCreateUseBox (Document doc, View view) |
void TemplateCreateUseBox (Document doc, View view) |
{ |
{ |
#ifdef TEMPLATES |
#ifdef TEMPLATES |
Template_CreateUseFromSelection(doc, FALSE); |
Template_CreateUseFromSelection (doc, view, FALSE); |
#endif /* TEMPLATES */ |
#endif /* TEMPLATES */ |
} |
} |
|
|
Line 2359 void TemplateCreateUseBox (Document doc,
|
Line 2423 void TemplateCreateUseBox (Document doc,
|
void TemplateCreateUseCompBox (Document doc, View view) |
void TemplateCreateUseCompBox (Document doc, View view) |
{ |
{ |
#ifdef TEMPLATES |
#ifdef TEMPLATES |
Template_CreateUseFromSelection (doc, TRUE); |
Template_CreateUseFromSelection (doc, view, TRUE); |
#endif /* TEMPLATES */ |
#endif /* TEMPLATES */ |
} |
} |
|
|
Line 2383 static Element Template_CreateInlineUse(
|
Line 2447 static Element Template_CreateInlineUse(
|
if (QueryNewUseFromUser(proposed, &label, &types, &option)) |
if (QueryNewUseFromUser(proposed, &label, &types, &option)) |
{ |
{ |
TtaOpenUndoSequence (doc, NULL, NULL, 0, 0); |
TtaOpenUndoSequence (doc, NULL, NULL, 0, 0); |
|
|
GenerateInlineElement(Template_EL_useEl, sstempl, 0, NULL, TRUE); |
GenerateInlineElement(Template_EL_useEl, sstempl, 0, NULL, TRUE); |
|
|
TtaGiveFirstSelectedElement(doc, &selElem, &firstChar, &lastChar); |
TtaGiveFirstSelectedElement(doc, &selElem, &firstChar, &lastChar); |
|
|
use = selElem; |
use = selElem; |
TtaNextSibling(&use); |
TtaNextSibling(&use); |
|
|
Line 2467 static Element Template_CreateEmptyBlock
|
Line 2528 static Element Template_CreateEmptyBlock
|
If createComp is true, create a component with the selection. |
If createComp is true, create a component with the selection. |
Return the xt:use element. |
Return the xt:use element. |
----------------------------------------------------------------------*/ |
----------------------------------------------------------------------*/ |
Element Template_CreateUseFromSelection (Document doc, ThotBool createComp) |
Element Template_CreateUseFromSelection (Document doc, int view, |
|
ThotBool createComp) |
{ |
{ |
#ifdef TEMPLATES |
#ifdef TEMPLATES |
DisplayMode dispMode; |
DisplayMode dispMode; |
Line 2502 Element Template_CreateUseFromSelection
|
Line 2564 Element Template_CreateUseFromSelection
|
parent = TtaGetParent(selElem); |
parent = TtaGetParent(selElem); |
parent2 = TtaGetParent(selElem2); |
parent2 = TtaGetParent(selElem2); |
dispMode = TtaGetDisplayMode (doc); |
dispMode = TtaGetDisplayMode (doc); |
if (dispMode == DisplayImmediately) |
|
TtaSetDisplayMode (doc, DeferredDisplay); |
|
oldStructureChecking = TtaGetStructureChecking (doc); |
oldStructureChecking = TtaGetStructureChecking (doc); |
TtaSetStructureChecking (FALSE, doc); |
TtaSetStructureChecking (FALSE, doc); |
TtaOpenUndoSequence (doc, NULL, NULL, 0, 0); |
TtaOpenUndoSequence (doc, NULL, NULL, 0, 0); |
Line 2587 Element Template_CreateUseFromSelection
|
Line 2647 Element Template_CreateUseFromSelection
|
use = Template_CreateEmptyBlockUse (doc); |
use = Template_CreateEmptyBlockUse (doc); |
else |
else |
{ |
{ |
|
if (dispMode == DisplayImmediately) |
|
TtaSetDisplayMode (doc, DeferredDisplay); |
prev = selElem; |
prev = selElem; |
TtaPreviousSibling(&prev); |
TtaPreviousSibling(&prev); |
next = selElem2; |
next = selElem2; |
Line 2608 Element Template_CreateUseFromSelection
|
Line 2670 Element Template_CreateUseFromSelection
|
{ |
{ |
// special management |
// special management |
createComp = FALSE; |
createComp = FALSE; |
getContent = TRUE; |
if (selType.ElTypeNum == HTML_EL_Table_cell || |
|
selType.ElTypeNum == HTML_EL_Data_cell || |
|
selType.ElTypeNum == HTML_EL_Heading_cell) |
|
// generate the use element around the first child |
|
// instead of the cell |
|
getContent = TRUE; |
} |
} |
if (createComp) |
if (createComp) |
{ |
{ |
Line 2681 Element Template_CreateUseFromSelection
|
Line 2748 Element Template_CreateUseFromSelection
|
{ |
{ |
SetAttributeStringValue (use, Template_ATTR_types, "string"); |
SetAttributeStringValue (use, Template_ATTR_types, "string"); |
SetAttributeStringValue (use, Template_ATTR_currentType, "string"); |
SetAttributeStringValue (use, Template_ATTR_currentType, "string"); |
} |
} |
if (buffer[0] != EOS) |
if (buffer[0] != EOS) |
SetAttributeStringValue(use, Template_ATTR_title, buffer); |
SetAttributeStringValue (use, Template_ATTR_title, buffer); |
TtaRegisterElementCreate(use, doc); |
TtaRegisterElementCreate (use, doc); |
TtaSelectElement (doc, use); |
TtaSelectElement (doc, use); |
// register document modification |
// register document modification |
TtaSetDocumentModified (doc); |
TtaSetDocumentModified (doc); |
} |
} |
} |
} |
|
if (dispMode == DisplayImmediately) |
|
TtaSetDisplayMode (doc, dispMode); |
} |
} |
} |
} |
else if (lastChar < firstChar) |
else if (lastChar < firstChar) |
use = Template_CreateInlineUse(doc); |
use = Template_CreateInlineUse (doc); |
|
else |
|
TemplateCreateTextBox (doc, view); |
|
|
TtaSetStructureChecking (oldStructureChecking, doc); |
TtaSetStructureChecking (oldStructureChecking, doc); |
TtaCloseUndoSequence(doc); |
TtaCloseUndoSequence(doc); |
if (dispMode == DisplayImmediately) |
|
TtaSetDisplayMode (doc, dispMode); |
|
} |
} |
return use; |
return use; |
#else /* TEMPLATES */ |
#else /* TEMPLATES */ |