diff --git a/README.md b/README.md index 7f1e36e..cd269d5 100644 --- a/README.md +++ b/README.md @@ -86,7 +86,7 @@ For special cases you can hook into the import with JavaScript, e.g. to create y |Option|Property|Type|Default|Description| |---|---|---|---|---| |Logging|isLogged|Boolean|false|Logging of info messages, e.g. which objects are created in InDesign in the course of the import. Warning messages will always be output.| -|Dialog|isDialogShown|Boolean|false|Whether dialog is displayed or not. (Not implemented yet.)| +|Dialog|isDialogShown|Boolean|true|Whether dialog is displayed or not. With `false` the dialog can be displayed by pressing and holding the **Shift** key when opening the document (click on the **Open** button).| # Document Settings @@ -196,8 +196,9 @@ Hyperlinks are automatically named by InDesign and not renamed by the script. Th |Option|Property|Type|Default|Description| |---|---|---|---|---| -|Mark|isMarkec|Boolean|false|Insert hyperlink as plain text and mark with condition.| +|Mark|isMarked|Boolean|false|Insert hyperlink as plain text and mark with condition.| |Create|isCreated|Boolean|true|Insert as InDesign hyperlink.| +|Ignore|isIgnored|Boolean|false|Ignore hyperlinks. Text content is imported as it is.| |Character Style|characterStyleName|String|Hyperlink|Character style applied to the hyperlink text.| |Add Character Style|isCharacterStyleAdded|Boolean|false| Add a character style to hyperlink text.| @@ -211,6 +212,7 @@ Please check after the import if these correspond to your needs. Otherwise deact |---|---|---|---|---| |Mark|isMarked|Boolean|false|Insert cross-reference as plain text and mark with condition.| |Create|isCreated|Boolean|true|Insert as InDesign cross-reference.| +|Ignore|isIgnored|Boolean|false|Ignore cross-references. Text content is imported as it is.| |Character Style|characterStyleName|String|Cross_Reference|Character style applied to the cross-reference text.| |Add Character Style|isCharacterStyleAdded|Boolean|false|Add a character style to cross-reference text.| @@ -219,7 +221,7 @@ Please check after the import if these correspond to your needs. Otherwise deact |Option|Property|Type|Default|Description| |---|---|---|---|---| |Create|isCreated|Boolean|false|Insert as InDesign bookmark.| -|Marker|marker|String||Marker as a prefix of the content to identify bookmarks to be included. Example: Marker `#`, Bookmark in Word `#My_bookmark_name`. So Word bookmarks with prefix `#` will be transferred to InDesgin bookmarks.| +|Marker|marker|String||Marker as a prefix of the content to identify bookmarks to be included. Example: Marker `#`, Bookmark in Word `#My_bookmark_name`. So Word bookmarks with prefix `#` will be transferred to InDesign bookmarks.| # Track Changes diff --git a/importDocx.jsx b/importDocx.jsx index 00ce323..975a439 100644 --- a/importDocx.jsx +++ b/importDocx.jsx @@ -6,7 +6,7 @@ + Author: Roland Dreger + Date: January 24, 2022 - + Last modified: July 7, 2022 + + Last modified: September 11, 2022 + Descriptions @@ -29,10 +29,10 @@ var _global = { "projectName":"Import_Docx", - "version":"0.3.1", + "version":"0.4.0", "mode":"release", /* Type: String. Value: "debug" or "release" */ "isLogged":false, - "isDialogShown":false, + "isDialogShown":true, "log":[] }; @@ -119,7 +119,8 @@ _global["setups"] = { "characterStyleName":"Hyperlink", "isCharacterStyleAdded":false, "isMarked":false, - "isCreated":true + "isCreated":true, + "isIgnored":false }, "crossReference":{ "tag":"cross-reference", @@ -133,7 +134,8 @@ _global["setups"] = { "isAnchorHidden":true, "isCharacterStyleAdded":true, "isMarked":false, - "isCreated":true + "isCreated":true, + "isIgnored":false }, "bookmark":{ "tag":"bookmark", @@ -372,6 +374,14 @@ function __runMainSequence(_doScriptParameterArray) { return false; } + /* Show import dialog */ + if(_global["isDialogShown"] || (ScriptUI && ScriptUI.environment && ScriptUI.environment.keyboardState && ScriptUI.environment.keyboardState.shiftKey)) { + _setupObj = __showImportDialog(_setupObj); + if(!_setupObj) { + return false; + } + } + /* Get package data */ var _unpackObj = __getPackageData(_docxFile); if(!_unpackObj) { @@ -1634,6 +1644,11 @@ function __handleHyperlinks(_doc, _wordXMLElement, _setupObj) { const COLOR_ARRAY = _setupObj["hyperlink"]["color"]; const IS_HYPERLINK_MARKED = _setupObj["hyperlink"]["isMarked"]; const IS_HYPERLINK_CREATED = _setupObj["hyperlink"]["isCreated"]; + const IS_HYPERLINK_IGNORED = _setupObj["hyperlink"]["isIgnored"]; + + if(IS_HYPERLINK_IGNORED) { + return true; + } var _hyperlinkXMLElementArray = _wordXMLElement.evaluateXPathExpression("//" + HYPERLINK_TAG_NAME); if(_hyperlinkXMLElementArray.length === 0) { @@ -1816,6 +1831,11 @@ function __handleCrossReferences(_doc, _wordXMLElement, _setupObj) { const COLOR_ARRAY = _setupObj["crossReference"]["color"]; const IS_CROSS_REFERENCE_MARKED = _setupObj["crossReference"]["isMarked"]; const IS_CROSS_REFERENCE_CREATED = _setupObj["crossReference"]["isCreated"]; + const IS_CROSS_REFERENCE_IGNORED = _setupObj["crossReference"]["isIgnored"]; + + if(IS_CROSS_REFERENCE_IGNORED) { + return true; + } var _crossRefXMLElementArray = _wordXMLElement.evaluateXPathExpression("//" + CROSS_REFERENCE_TAG_NAME); if(_crossRefXMLElementArray.length === 0) { @@ -3744,4 +3764,184 @@ function __defLocalizeStrings() { en: "Bookmarks", de: "Lesezeichen" }; + + _global.importDialogTitle = { + en: "Microsoft Word Import Options", + de: "Microsoft Word Importoptionen" + }; + + _global.okButtonLabel = { + en: "OK", + de: "OK" + }; + + _global.cancelButtonLabel = { + en: "Cancel", + de: "Abbrechen" + }; + + _global.documentLabel = { + en: "Document", + de: "Dokument" + }; + + _global.defaultParagraphStyleLabel = { + en: "Default paragraph style", + de: "Standard-Absatzformat" + }; + + _global.isAutoflowingLabel = { + en: "Automatic flow", + de: "Automatischer Textfluss" + }; + + _global.isUntaggedLabel = { + en: "Remove Tags", + de: "Tags entfernen" + }; + + _global.stylePanelLabel = { + en: "Styles", + de: "Formate" + }; + + _global.styleModeGroupLabel = { + en: "Character Styles", + de: "Zeichenformate" + }; + + _global.extendedStyleModeRadiobutton = { + en: "Extended Mode", + de: "Erweiterter Modus" + }; + + _global.minimizedStyleModeRadiobutton = { + en: "Minimized Mode", + de: "Reduzierter Modus" + }; + + _global.breaksLabel = { + en: "Breaks", + de: "Umbrüche" + }; + + _global.pageBreakLabel = { + en: "Page break", + de: "Seitenumbruch" + }; + + _global.columnBreakLabel = { + en: "Column break", + de: "Spaltenumbruch" + }; + + _global.forcedLineLabel = { + en: "Forced line break", + de: "Erzwungener Zeilenumbruch" + }; + + _global.sectionLabel = { + en: "Section break", + de: "Abschnittsumbruch" + }; + + _global.commentsLabel = { + en: "Comments", + de: "Kommentare" + }; + + _global.removeLabel = { + en: "Remove", + de: "Entfernen" + }; + + _global.markLabel = { + en: "Mark", + de: "Markieren" + }; + + _global.ignoreLabel = { + en: "Ignore", + de: "Ignorieren" + }; + + _global.createLabel = { + en: "Create", + de: "Erstellen" + }; + + _global.placeLabel = { + en: "Place", + de: "Platzieren" + }; + + _global.indexmarksLabel = { + en: "Index marks", + de: "Indexmarken" + }; + + _global.hyperlinksLabel = { + en: "Hyperlinks", + de: "Hyperlinks" + }; + + _global.crossReferencesLabel = { + en: "Cross-references", + de: "Querverweise" + }; + + _global.bookmarksPanelLabel = { + en: "Bookmarks", + de: "Lesezeichen" + }; + + _global.bookmarkMarkerLabel = { + en: "Marker", + de: "Marker" + }; + + _global.trackChangesLabel = { + en: "Track changes", + de: "Änderungsverfolgung" + }; + + _global.footnotesLabel = { + en: "Footnotes", + de: "Fußnoten" + }; + + _global.endnotesLabel = { + en: "Endnotes", + de: "Endnoten" + }; + + _global.imagesPanelLabel = { + en: "Images", + de: "Bilder" + }; + + _global.imageWidthLabel = { + en: "Width (mm)", + de: "Breite (mm)" + }; + + _global.imageHeightLabel = { + en: "Height (mm)", + de: "Höhe (mm)" + }; + + _global.textboxesPanelLabel = { + en: "Textboxes", + de: "Textfelder" + }; + + _global.textboxWidthLabel = { + en: "Width (mm)", + de: "Breite (mm)" + }; + + _global.textboxHeightLabel = { + en: "Height (mm)", + de: "Höhe (mm)" + }; } /* END function __defLocalizeStrings */ \ No newline at end of file diff --git a/utils/dialogs.jsx b/utils/dialogs.jsx index 15b2f71..5f0a24c 100644 --- a/utils/dialogs.jsx +++ b/utils/dialogs.jsx @@ -124,4 +124,487 @@ function __showLog(_logMessageArray) { _logDialog.show(); return true; -} /* END function __showLog */ \ No newline at end of file +} /* END function __showLog */ + + +/** + * Import Dialog + * @param {Object} _setupObj + * @returns Object + */ +function __showImportDialog(_setupObj) { + + if(!_global) { return null; } + if(!_setupObj || !(_setupObj instanceof Object)) { + throw new Error("Object as parameter required."); + } + + const GAP = 5; + const MARGIN = 5; + + var _defaultParagraphStyleEdittext; + var _isAutoflowingCheckbox; + var _isUntaggedCheckbox; + var _extendedStyleModeRadiobutton; + var _minimizedStyleModeRadiobutton; + var _pageBreakCheckbox; + var _columnBreakCheckbox; + var _forcedLineBreakCheckbox; + var _sectionBreakCheckbox; + var _commentCreatedRadiobutton; + var _commentMarkedRadiobutton; + var _commentRemovedRadiobutton; + var _indexmarkCreatedRadiobutton; + var _indexmarkRemovedRadiobutton; + var _hyperlinkCreatedRadiobutton; + var _hyperlinkMarkedRadiobutton; + var _hyperlinkIgnoredRadiobutton; + var _crossReferenceCreatedRadiobutton; + var _crossReferenceMarkedRadiobutton; + var _crossReferenceIgnoredRadiobutton; + var _bookmarkCreatedCheckbox; + var _bookmarkMarkerGroup; + var _bookmarkMarkerEdittext; + var _trackChangesMarkedRadiobutton; + var _trackChangesRemovedRadiobutton; + var _footnoteCreatedRadiobutton; + var _footnoteMarkedRadiobutton; + var _footnoteRemovedRadiobutton; + var _endnoteCreatedRadiobutton; + var _endnoteMarkedRadiobutton; + var _endnoteRemovedRadiobutton; + var _imagePlacedRadiobutton; + var _imageMarkedRadiobutton; + var _imageRemovedRadiobutton; + var _imageInputGroup; + var _imageWidthEdittext; + var _imageHeightEdittext; + var _textboxCreatedRadiobutton; + var _textboxMarkedRadiobutton; + var _textboxRemovedRadiobutton; + var _textboxInputGroup; + var _textboxWidthEdittext; + var _textboxHeightEdittext; + + var _okButton; + var _cancelButton; + + var _importDialog = new Window("dialog", localize(_global.importDialogTitle), undefined, { closeButton: true }); + with(_importDialog) { + alignChildren = ["fill","fill"]; + margins = [MARGIN*5,MARGIN*4,MARGIN*5,MARGIN*4]; + spacing = GAP*4; + var _optionsGroup = add("group"); + with(_optionsGroup) { + alignChildren = ["fill","fill"]; + spacing = GAP*4; + var _columnOne = add("group"); + with(_columnOne) { + orientation = "column"; + alignChildren = ["fill","fill"]; + spacing = GAP*5; + var _documentPanel = add("panel", undefined, localize(_global.documentLabel)); + with(_documentPanel) { + margins = [MARGIN*2,MARGIN*3,MARGIN*2,MARGIN*1]; + alignChildren = ["left","top"]; + spacing = GAP; + _isAutoflowingCheckbox = add("checkbox", undefined, localize(_global.isAutoflowingLabel)); + _isUntaggedCheckbox = add("checkbox", undefined, localize(_global.isUntaggedLabel)); + } /* END _documentPanel */ + var _stylePanel = add("panel", undefined, localize(_global.stylePanelLabel)); + with(_stylePanel) { + margins = [MARGIN*2,MARGIN*3,MARGIN*2,MARGIN*2]; + alignChildren = ["fill","top"]; + spacing = GAP*2; + var _defaultParagraphStyleGroup = add("group"); + with(_defaultParagraphStyleGroup) { + orientation = "column"; + alignChildren = ["fill","top"]; + spacing = GAP; + add("statictext", undefined, localize(_global.defaultParagraphStyleLabel)); + _defaultParagraphStyleEdittext = add("edittext"); + with(_defaultParagraphStyleEdittext) { + characters = 10; + } /* END _defaultParagraphStyleEdittext */ + } /* END _defaultParagraphStyleGroup */ + var _styleModeGroup = add("group"); + with(_styleModeGroup) { + orientation = "column"; + alignChildren = "left"; + spacing = GAP; + add("statictext", undefined, localize(_global.styleModeGroupLabel)); + var _styleModeRadioButtonGroup = add("group"); + with(_styleModeRadioButtonGroup) { + orientation = "column"; + alignChildren = "left"; + spacing = GAP; + margins.top = GAP; + _minimizedStyleModeRadiobutton = add("radiobutton", undefined, localize(_global.minimizedStyleModeRadiobutton)); + _extendedStyleModeRadiobutton = add("radiobutton", undefined, localize(_global.extendedStyleModeRadiobutton)); + } /* END _styleModeRadioButtonGroup */ + } /* END _styleModeGroup */ + } /* END _stylePanel */ + var _breaksPanel = add("panel", undefined, localize(_global.breaksLabel)); + with(_breaksPanel) { + margins = [MARGIN*2,MARGIN*3,MARGIN*2,MARGIN*1]; + alignChildren = ["left","top"]; + spacing = GAP; + _pageBreakCheckbox = add("checkbox", undefined, localize(_global.pageBreakLabel)); + _columnBreakCheckbox = add("checkbox", undefined, localize(_global.columnBreakLabel)); + _forcedLineBreakCheckbox = add("checkbox", undefined, localize(_global.forcedLineLabel)); + _sectionBreakCheckbox = add("checkbox", undefined, localize(_global.sectionLabel)); + } /* END _breaksPanel */ + } /* END _columnOne */ + var _columnTwo = add("group"); + with(_columnTwo) { + orientation = "column"; + alignChildren = ["fill","fill"]; + spacing = GAP*5; + var _imagePanel = add("panel", undefined, localize(_global.imagesPanelLabel)); + with(_imagePanel) { + orientation = "column"; + margins = [MARGIN*2,MARGIN*3,MARGIN*2,MARGIN*2]; + alignChildren = ["fill","top"]; + spacing = GAP*2; + var _imageButtonGroup = add("group"); + with(_imageButtonGroup) { + _imagePlacedRadiobutton = add("radiobutton", undefined, localize(_global.placeLabel)); + _imageMarkedRadiobutton = add("radiobutton", undefined, localize(_global.markLabel)); + _imageRemovedRadiobutton = add("radiobutton", undefined, localize(_global.removeLabel)); + } /* END _imageButtonGroup */ + _imageInputGroup = add("group"); + with(_imageInputGroup) { + alignChildren = ["fill","fill"]; + var _imageWidthGroup = add("group"); + with(_imageWidthGroup) { + orientation = "column"; + alignChildren = ["fill","fill"]; + spacing = GAP; + add("statictext", undefined, localize(_global.imageWidthLabel)); + _imageWidthEdittext = add("edittext", undefined, ""); + with(_imageWidthEdittext) { + characters = 10; + } /* END _imageWidthEdittext */ + } /* END _imageWidthGroup */ + var _imageHeightGroup = add("group"); + with(_imageHeightGroup) { + orientation = "column"; + alignChildren = ["fill","fill"]; + spacing = GAP; + add("statictext", undefined, localize(_global.imageHeightLabel)); + _imageHeightEdittext = add("edittext", undefined, ""); + with(_imageHeightEdittext) { + characters = 10; + } /* END _imageHeightEdittext */ + } /* END _imageHeightGroup */ + } /* END _imageInputGroup */ + } /* END _imagePanel */ + var _textboxPanel = add("panel", undefined, localize(_global.textboxesPanelLabel)); + with(_textboxPanel) { + orientation = "column"; + margins = [MARGIN*2,MARGIN*3,MARGIN*2,MARGIN*2]; + alignChildren = ["fill","top"]; + spacing = GAP*2; + var _textboxButtonGroup = add("group"); + with(_textboxButtonGroup) { + _textboxCreatedRadiobutton = add("radiobutton", undefined, localize(_global.createLabel)); + _textboxMarkedRadiobutton = add("radiobutton", undefined, localize(_global.markLabel)); + _textboxRemovedRadiobutton = add("radiobutton", undefined, localize(_global.removeLabel)); + } /* END _textboxButtonGroup */ + _textboxInputGroup = add("group"); + with(_textboxInputGroup) { + alignChildren = ["fill","fill"]; + var _textboxWidthGroup = add("group"); + with(_textboxWidthGroup) { + orientation = "column"; + alignChildren = ["fill","fill"]; + spacing = GAP; + add("statictext", undefined, localize(_global.textboxWidthLabel)); + _textboxWidthEdittext = add("edittext", undefined, ""); + with(_textboxWidthEdittext) { + characters = 10; + } /* END _textboxWidthEdittext */ + } /* END _textboxWidthGroup */ + var _textboxHeightGroup = add("group"); + with(_textboxHeightGroup) { + orientation = "column"; + alignChildren = ["fill","fill"]; + spacing = GAP; + add("statictext", undefined, localize(_global.textboxHeightLabel)); + _textboxHeightEdittext = add("edittext", undefined, ""); + with(_textboxHeightEdittext) { + characters = 10; + } /* END _textboxHeightEdittext */ + } /* END _textboxHeightGroup */ + } /* END _textboxInputGroup */ + } /* END _textboxPanel */ + var _footnotePanel = add("panel", undefined, localize(_global.footnotesLabel)); + with(_footnotePanel) { + orientation = "row"; + margins = [MARGIN*2,MARGIN*3,MARGIN*2,MARGIN*1]; + alignChildren = ["left","top"]; + spacing = GAP*2; + _footnoteCreatedRadiobutton = add("radiobutton", undefined, localize(_global.createLabel)); + _footnoteMarkedRadiobutton = add("radiobutton", undefined, localize(_global.markLabel)); + _footnoteRemovedRadiobutton = add("radiobutton", undefined, localize(_global.removeLabel)); + } /* END _footnotePanel */ + var _endnotePanel = add("panel", undefined, localize(_global.endnotesLabel)); + with(_endnotePanel) { + orientation = "row"; + margins = [MARGIN*2,MARGIN*3,MARGIN*2,MARGIN*1]; + alignChildren = ["left","top"]; + spacing = GAP*2; + _endnoteCreatedRadiobutton = add("radiobutton", undefined, localize(_global.createLabel)); + _endnoteMarkedRadiobutton = add("radiobutton", undefined, localize(_global.markLabel)); + _endnoteRemovedRadiobutton = add("radiobutton", undefined, localize(_global.removeLabel)); + } /* END _endnotePanel */ + } /* END _columnTwo */ + var _columnThree = add("group"); + with(_columnThree) { + orientation = "column"; + alignChildren = ["fill","fill"]; + spacing = GAP*4; + var _commentPanel = add("panel", undefined, localize(_global.commentsLabel)); + with(_commentPanel) { + orientation = "row"; + margins = [MARGIN*2,MARGIN*3,MARGIN*2,MARGIN*1]; + alignChildren = ["left","top"]; + spacing = GAP*2; + _commentCreatedRadiobutton = add("radiobutton", undefined, localize(_global.createLabel)); + _commentMarkedRadiobutton = add("radiobutton", undefined, localize(_global.markLabel)); + _commentRemovedRadiobutton = add("radiobutton", undefined, localize(_global.removeLabel)); + } /* END _commentPanel */ + var _hyperlinkPanel = add("panel", undefined, localize(_global.hyperlinksLabel)); + with(_hyperlinkPanel) { + orientation = "row"; + margins = [MARGIN*2,MARGIN*3,MARGIN*2,MARGIN*1]; + alignChildren = ["left","top"]; + spacing = GAP*2; + _hyperlinkCreatedRadiobutton = add("radiobutton", undefined, localize(_global.createLabel)); + _hyperlinkMarkedRadiobutton = add("radiobutton", undefined, localize(_global.markLabel)); + _hyperlinkIgnoredRadiobutton = add("radiobutton", undefined, localize(_global.ignoreLabel)); + } /* END _hyperlinkPanel */ + var _crossReferencePanel = add("panel", undefined, localize(_global.crossReferencesLabel)); + with(_crossReferencePanel) { + orientation = "row"; + margins = [MARGIN*2,MARGIN*3,MARGIN*2,MARGIN*1]; + alignChildren = ["left","top"]; + spacing = GAP*2; + _crossReferenceCreatedRadiobutton = add("radiobutton", undefined, localize(_global.createLabel)); + _crossReferenceMarkedRadiobutton = add("radiobutton", undefined, localize(_global.markLabel)); + _crossReferenceIgnoredRadiobutton = add("radiobutton", undefined, localize(_global.ignoreLabel)); + } /* END _crossReferencePanel */ + var _indexmarkPanel = add("panel", undefined, localize(_global.indexmarksLabel)); + with(_indexmarkPanel) { + orientation = "row"; + margins = [MARGIN*2,MARGIN*3,MARGIN*2,MARGIN*1]; + alignChildren = ["left","top"]; + spacing = GAP*2; + _indexmarkCreatedRadiobutton = add("radiobutton", undefined, localize(_global.createLabel)); + _indexmarkRemovedRadiobutton = add("radiobutton", undefined, localize(_global.removeLabel)); + } /* END _indexmarkPanel */ + var _trackChangesPanel = add("panel", undefined, localize(_global.trackChangesLabel)); + with(_trackChangesPanel) { + orientation = "row"; + margins = [MARGIN*2,MARGIN*3,MARGIN*2,MARGIN*1]; + alignChildren = ["left","top"]; + spacing = GAP*2; + _trackChangesMarkedRadiobutton = add("radiobutton", undefined, localize(_global.markLabel)); + _trackChangesRemovedRadiobutton = add("radiobutton", undefined, localize(_global.removeLabel)); + } /* END _trackChangesPanel */ + var _bookmarkPanel = add("panel", undefined, localize(_global.bookmarksPanelLabel)); + with(_bookmarkPanel) { + orientation = "row"; + margins = [MARGIN*2,MARGIN*2,MARGIN*2,MARGIN*1]; + alignChildren = ["left","top"]; + spacing = GAP*3; + var _bookmarkCreatedGroup = add("group"); + with(_bookmarkCreatedGroup) { + margins.top = 4; + _bookmarkCreatedCheckbox = add("checkbox", undefined, localize(_global.createLabel)); + } /* END _bookmarkCreatedGroup */ + _bookmarkMarkerGroup = add("group"); + with(_bookmarkMarkerGroup) { + alignChildren = "left"; + margins = [0,0,0,0]; + spacing = GAP; + add("statictext", undefined, localize(_global.bookmarkMarkerLabel) + ":"); + _bookmarkMarkerEdittext = add("edittext", undefined, ""); + with(_bookmarkMarkerEdittext) { + characters = 6; + } /* END _bookmarkMarkerEdittext */ + } /* END _bookmarkMarkerGroup */ + } /* END _bookmarkPanel */ + } /* END _columnThree */ + } /* END _optionsGroup */ + /* Action Buttons */ + var _actionButtonGroup = add("group"); + with(_actionButtonGroup) { + alignChildren = ["fill","fill"]; + margins = [0,0,GAP*4,0]; + spacing = 8; + _cancelButton = add("button", undefined, localize(_global.cancelButtonLabel), { name:"Cancel" }); + with(_cancelButton) { + alignment = ["right","top"]; + } /* END _cancelButton */ + _okButton = add("button", undefined, localize(_global.okButtonLabel), { name:"OK" }); + with(_okButton) { + alignment = ["right","top"]; + } /* END _okButton */ + } /* END _actionButtonGroup */ + } /* END _importDialog */ + + + /* Callbacks */ + _bookmarkCreatedCheckbox.onClick = function() { + if(_bookmarkCreatedCheckbox.value === true) { + _bookmarkMarkerGroup.enabled = true; + } else { + _bookmarkMarkerGroup.enabled = false; + } + }; + + _imagePlacedRadiobutton.onClick = + _imageMarkedRadiobutton.onClick = + _imageRemovedRadiobutton.onClick = function() { + if(_imagePlacedRadiobutton.value === true) { + _imageInputGroup.enabled = true; + } else { + _imageInputGroup.enabled = false; + } + }; + + _textboxCreatedRadiobutton.onClick = + _textboxMarkedRadiobutton.onClick = + _textboxRemovedRadiobutton.onClick = function() { + if(_textboxCreatedRadiobutton.value === true) { + _textboxInputGroup.enabled = true; + } else { + _textboxInputGroup.enabled = false; + } + }; + + _cancelButton.onClick = function() { + _importDialog.hide(); + _importDialog.close(2); + }; + + _okButton.onClick = function() { + _importDialog.hide(); + _importDialog.close(1); + }; + /* END Callbacks */ + + + /* Initialize Dialog */ + _defaultParagraphStyleEdittext.text = _setupObj["document"]["defaultParagraphStyle"]; + _isAutoflowingCheckbox.value = _setupObj["document"]["isAutoflowing"]; + _isUntaggedCheckbox.value = _setupObj["document"]["isUntagged"]; + if(_setupObj["import"]["styleMode"] === "extended") { + _extendedStyleModeRadiobutton.value = true; + } else { + _minimizedStyleModeRadiobutton.value = true; + } + _pageBreakCheckbox.value = _setupObj["pageBreak"]["isInserted"]; + _columnBreakCheckbox.value = _setupObj["columnBreak"]["isInserted"]; + _forcedLineBreakCheckbox.value = _setupObj["forcedLineBreak"]["isInserted"]; + _sectionBreakCheckbox.value = _setupObj["sectionBreak"]["isInserted"]; + _commentCreatedRadiobutton.value = _setupObj["comment"]["isCreated"]; + _commentMarkedRadiobutton.value = _setupObj["comment"]["isMarked"]; + _commentRemovedRadiobutton.value = _setupObj["comment"]["isRemoved"]; + _indexmarkCreatedRadiobutton.value = _setupObj["indexmark"]["isCreated"]; + _indexmarkRemovedRadiobutton.value = _setupObj["indexmark"]["isRemoved"]; + _hyperlinkCreatedRadiobutton.value = _setupObj["hyperlink"]["isCreated"]; + _hyperlinkMarkedRadiobutton.value = _setupObj["hyperlink"]["isMarked"]; + _hyperlinkIgnoredRadiobutton.value = _setupObj["hyperlink"]["isIgnored"]; + _crossReferenceCreatedRadiobutton.value = _setupObj["crossReference"]["isCreated"]; + _crossReferenceMarkedRadiobutton.value = _setupObj["crossReference"]["isMarked"]; + _crossReferenceIgnoredRadiobutton.value = _setupObj["crossReference"]["isIgnored"]; + _bookmarkCreatedCheckbox.value = _setupObj["bookmark"]["isCreated"]; + _bookmarkMarkerEdittext.text = _setupObj["bookmark"]["marker"]; + _trackChangesMarkedRadiobutton.value = _setupObj["trackChanges"]["isMarked"]; + _trackChangesRemovedRadiobutton.value = _setupObj["trackChanges"]["isRemoved"]; + _footnoteCreatedRadiobutton.value = _setupObj["footnote"]["isCreated"]; + _footnoteMarkedRadiobutton.value = _setupObj["footnote"]["isMarked"]; + _footnoteRemovedRadiobutton.value = _setupObj["footnote"]["isRemoved"]; + _endnoteCreatedRadiobutton.value = _setupObj["endnote"]["isCreated"]; + _endnoteMarkedRadiobutton.value = _setupObj["endnote"]["isMarked"]; + _endnoteRemovedRadiobutton.value = _setupObj["endnote"]["isRemoved"]; + _imagePlacedRadiobutton.value = _setupObj["image"]["isPlaced"]; + _imageMarkedRadiobutton.value = _setupObj["image"]["isMarked"]; + _imageRemovedRadiobutton.value = _setupObj["image"]["isRemoved"]; + _imageWidthEdittext.text = _setupObj["image"]["width"]; + _imageHeightEdittext.text = _setupObj["image"]["height"]; + _textboxCreatedRadiobutton.value = _setupObj["textbox"]["isCreated"]; + _textboxMarkedRadiobutton.value = _setupObj["textbox"]["isMarked"]; + _textboxRemovedRadiobutton.value = _setupObj["textbox"]["isRemoved"]; + _textboxWidthEdittext.text = _setupObj["textbox"]["width"]; + _textboxHeightEdittext.text = _setupObj["textbox"]["height"]; + + if(_bookmarkCreatedCheckbox.value === true) { + _bookmarkMarkerGroup.enabled = true; + } else { + _bookmarkMarkerGroup.enabled = false; + } + if(_imagePlacedRadiobutton.value === true) { + _imageInputGroup.enabled = true; + } else { + _imageInputGroup.enabled = false; + } + if(_textboxCreatedRadiobutton.value === true) { + _textboxInputGroup.enabled = true; + } else { + _textboxInputGroup.enabled = false; + } + + + /* Show Dialog */ + var _closeValue = _importDialog.show (); + if(_closeValue === 2) { + return null; + } + + + /* Evaluate inputs */ + _setupObj["document"]["defaultParagraphStyle"] = _defaultParagraphStyleEdittext.text; + _setupObj["document"]["isAutoflowing"] = _isAutoflowingCheckbox.value; + _setupObj["document"]["isUntagged"] = _isUntaggedCheckbox.value; + _setupObj["import"]["styleMode"] = (_extendedStyleModeRadiobutton.value && "extended") || (_minimizedStyleModeRadiobutton.value && "minimized"); + _setupObj["pageBreak"]["isInserted"] = _pageBreakCheckbox.value; + _setupObj["columnBreak"]["isInserted"] = _columnBreakCheckbox.value; + _setupObj["forcedLineBreak"]["isInserted"] = _forcedLineBreakCheckbox.value; + _setupObj["sectionBreak"]["isInserted"] = _sectionBreakCheckbox.value; + _setupObj["comment"]["isCreated"] = _commentCreatedRadiobutton.value; + _setupObj["comment"]["isMarked"] = _commentMarkedRadiobutton.value; + _setupObj["comment"]["isRemoved"] = _commentRemovedRadiobutton.value; + _setupObj["indexmark"]["isCreated"] = _indexmarkCreatedRadiobutton.value; + _setupObj["indexmark"]["isRemoved"] = _indexmarkRemovedRadiobutton.value; + _setupObj["hyperlink"]["isCreated"] = _hyperlinkCreatedRadiobutton.value; + _setupObj["hyperlink"]["isMarked"] = _hyperlinkMarkedRadiobutton.value; + _setupObj["hyperlink"]["isIgnored"] = _hyperlinkIgnoredRadiobutton.value; + _setupObj["crossReference"]["isCreated"] = _crossReferenceCreatedRadiobutton.value; + _setupObj["crossReference"]["isMarked"] = _crossReferenceMarkedRadiobutton.value; + _setupObj["crossReference"]["isIgnored"] = _crossReferenceIgnoredRadiobutton.value; + _setupObj["bookmark"]["isCreated"] = _bookmarkCreatedCheckbox.value; + _setupObj["bookmark"]["marker"] = _bookmarkMarkerEdittext.text; + _setupObj["trackChanges"]["isMarked"] = _trackChangesMarkedRadiobutton.value; + _setupObj["trackChanges"]["isRemoved"] = _trackChangesRemovedRadiobutton.value; + _setupObj["footnote"]["isCreated"] = _footnoteCreatedRadiobutton.value; + _setupObj["footnote"]["isMarked"] = _footnoteMarkedRadiobutton.value; + _setupObj["footnote"]["isRemoved"] = _footnoteRemovedRadiobutton.value; + _setupObj["endnote"]["isCreated"] = _endnoteCreatedRadiobutton.value; + _setupObj["endnote"]["isMarked"] = _endnoteMarkedRadiobutton.value; + _setupObj["endnote"]["isRemoved"] = _endnoteRemovedRadiobutton.value; + _setupObj["image"]["isPlaced"] = _imagePlacedRadiobutton.value; + _setupObj["image"]["isMarked"] = _imageMarkedRadiobutton.value; + _setupObj["image"]["isRemoved"] = _imageRemovedRadiobutton.value; + _setupObj["image"]["width"] = _imageWidthEdittext.text; + _setupObj["image"]["height"] = _imageHeightEdittext.text; + _setupObj["textbox"]["isCreated"] = _textboxCreatedRadiobutton.value; + _setupObj["textbox"]["isMarked"] = _textboxMarkedRadiobutton.value; + _setupObj["textbox"]["isRemoved"] = _textboxRemovedRadiobutton.value; + _setupObj["textbox"]["width"] = _textboxWidthEdittext.text; + _setupObj["textbox"]["height"] = _textboxHeightEdittext.text; + + return _setupObj; +} /* END function __showImportDialog */ \ No newline at end of file