W2L custom config ui refactoring & enhancements
git-svn-id: svn://svn.code.sf.net/p/writer2latex/code/trunk@79 f0f2a975-2e09-46c8-9428-3b39399b9f3c
This commit is contained in:
parent
84f4d5cb20
commit
ea5d8679c9
10 changed files with 322 additions and 161 deletions
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-04-12)
|
||||
* Version 1.2 (2010-12-09)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -288,6 +288,14 @@ public abstract class ConfigurationDialogBase extends WeakBase implements XConta
|
|||
config.setOption(sConfigName, sConfigValues[dlg.getListBoxSelectedItem(sListBoxName)]);
|
||||
}
|
||||
|
||||
// Utilities
|
||||
protected String[] sortStringSet(Set<String> theSet) {
|
||||
String[] theArray = theSet.toArray(new String[theSet.size()]);
|
||||
// TODO: Get locale from OOo rather than the system
|
||||
Collator collator = Collator.getInstance();
|
||||
Arrays.sort(theArray, collator);
|
||||
return theArray;
|
||||
}
|
||||
}
|
||||
|
||||
protected abstract class CustomFileHandler extends PageHandler {
|
||||
|
@ -506,13 +514,7 @@ public abstract class ConfigurationDialogBase extends WeakBase implements XConta
|
|||
private String newItem(Set<String> suggestions) {
|
||||
XDialog xDialog=getDialog(getDialogLibraryName()+".NewDialog");
|
||||
if (xDialog!=null) {
|
||||
int nCount = suggestions.size();
|
||||
String[] sItems = new String[nCount];
|
||||
int i=0;
|
||||
for (String s : suggestions) {
|
||||
sItems[i++] = s;
|
||||
}
|
||||
sortStringArray(sItems);
|
||||
String[] sItems = sortStringSet(suggestions);
|
||||
DialogAccess ndlg = new DialogAccess(xDialog);
|
||||
ndlg.setListBoxStringItemList("Name", sItems);
|
||||
String sResult = null;
|
||||
|
@ -547,23 +549,6 @@ public abstract class ConfigurationDialogBase extends WeakBase implements XConta
|
|||
return sNewItem;
|
||||
}
|
||||
|
||||
// Utilities
|
||||
protected String[] sortStringSet(Set<String> theSet) {
|
||||
String[] theArray = new String[theSet.size()];
|
||||
int i=0;
|
||||
for (String s : theSet) {
|
||||
theArray[i++] = s;
|
||||
}
|
||||
sortStringArray(theArray);
|
||||
return theArray;
|
||||
}
|
||||
|
||||
protected void sortStringArray(String[] theArray) {
|
||||
// TODO: Get locale from OOo rather than the system
|
||||
Collator collator = Collator.getInstance();
|
||||
Arrays.sort(theArray, collator);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
protected abstract class StylesPageHandler extends UserListPageHandler {
|
||||
|
@ -588,7 +573,7 @@ public abstract class ConfigurationDialogBase extends WeakBase implements XConta
|
|||
|
||||
protected abstract void clearControls(DialogAccess dlg);
|
||||
|
||||
protected abstract void prepareControls(DialogAccess dlg);
|
||||
protected abstract void prepareControls(DialogAccess dlg, boolean bHasDefinitions);
|
||||
|
||||
// Constructor
|
||||
protected StylesPageHandler(int nCount) {
|
||||
|
@ -682,8 +667,7 @@ public abstract class ConfigurationDialogBase extends WeakBase implements XConta
|
|||
dlg.setListBoxSelectedItem("StyleName", (short)-1);
|
||||
}
|
||||
|
||||
updateDeleteButton(dlg);
|
||||
prepareControls(dlg);
|
||||
updateStyleControls(dlg);
|
||||
styleNameChange(dlg);
|
||||
}
|
||||
}
|
||||
|
@ -711,7 +695,7 @@ public abstract class ConfigurationDialogBase extends WeakBase implements XConta
|
|||
styleMap[nCurrentFamily].put(sNewName, new HashMap<String,String>());
|
||||
clearControls(dlg);
|
||||
}
|
||||
updateDeleteButton(dlg);
|
||||
updateStyleControls(dlg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -722,7 +706,7 @@ public abstract class ConfigurationDialogBase extends WeakBase implements XConta
|
|||
styleMap[nCurrentFamily].remove(sStyleName);
|
||||
styleNameChange(dlg);
|
||||
}
|
||||
updateDeleteButton(dlg);
|
||||
updateStyleControls(dlg);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -776,8 +760,10 @@ public abstract class ConfigurationDialogBase extends WeakBase implements XConta
|
|||
styleFamilyChange(dlg);
|
||||
}
|
||||
|
||||
private void updateDeleteButton(DialogAccess dlg) {
|
||||
dlg.setControlEnabled("DeleteStyleButton", dlg.getListBoxStringItemList("StyleName").length>0);
|
||||
private void updateStyleControls(DialogAccess dlg) {
|
||||
boolean bHasMappings = dlg.getListBoxStringItemList("StyleName").length>0;
|
||||
dlg.setControlEnabled("DeleteStyleButton", bHasMappings);
|
||||
prepareControls(dlg,bHasMappings);
|
||||
}
|
||||
|
||||
private void copyStyles(ComplexOption source, ComplexOption target, Map<String,String> nameTranslation) {
|
||||
|
|
|
@ -0,0 +1,93 @@
|
|||
/************************************************************************
|
||||
*
|
||||
* FiledMasterNameProvider.java
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License version 2.1, as published by the Free Software Foundation.
|
||||
*
|
||||
* This library is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston,
|
||||
* MA 02111-1307 USA
|
||||
*
|
||||
* Copyright: 2002-2010 by Henrik Just
|
||||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-12-09)
|
||||
*
|
||||
*/
|
||||
|
||||
package org.openoffice.da.comp.w2lcommon.helper;
|
||||
|
||||
import java.util.HashSet;
|
||||
import java.util.Set;
|
||||
|
||||
import com.sun.star.container.XNameAccess;
|
||||
import com.sun.star.frame.XController;
|
||||
import com.sun.star.frame.XDesktop;
|
||||
import com.sun.star.frame.XModel;
|
||||
import com.sun.star.text.XTextFieldsSupplier;
|
||||
import com.sun.star.uno.UnoRuntime;
|
||||
import com.sun.star.uno.XComponentContext;
|
||||
|
||||
/** This class provides access to the names of all field masters in the current document
|
||||
*/
|
||||
public class FieldMasterNameProvider {
|
||||
private String[] fieldMasterNames;
|
||||
|
||||
/** Construct a new <code>FieldMasterNameProvider</code>
|
||||
*
|
||||
* @param xContext the component context to get the desktop from
|
||||
*/
|
||||
public FieldMasterNameProvider(XComponentContext xContext) {
|
||||
fieldMasterNames = new String[0];
|
||||
|
||||
// TODO: This code should be shared (identical with StyleNameProvider...)
|
||||
// Get the model for the current frame
|
||||
XModel xModel = null;
|
||||
try {
|
||||
Object desktop = xContext.getServiceManager().createInstanceWithContext("com.sun.star.frame.Desktop", xContext);
|
||||
XDesktop xDesktop = (XDesktop)UnoRuntime.queryInterface(XDesktop.class, desktop);
|
||||
XController xController = xDesktop.getCurrentFrame().getController();
|
||||
if (xController!=null) {
|
||||
xModel = xController.getModel();
|
||||
}
|
||||
}
|
||||
catch (Exception e) {
|
||||
// do nothing
|
||||
}
|
||||
|
||||
// Get the field masters from the model
|
||||
if (xModel!=null) {
|
||||
XTextFieldsSupplier xSupplier = (XTextFieldsSupplier) UnoRuntime.queryInterface(
|
||||
XTextFieldsSupplier.class, xModel);
|
||||
if (xSupplier!=null) {
|
||||
XNameAccess xFieldMasters = xSupplier.getTextFieldMasters();
|
||||
fieldMasterNames = xFieldMasters.getElementNames();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/** Get the names of all field masters relative to a given prefix
|
||||
*
|
||||
* @param sPrefix the prefix to look for, e.g. "com.sun.star.text.fieldmaster.SetExpression."
|
||||
* @return a read only <code>Set</code> containing all known names with the given prefix, stripped for the prefix
|
||||
*/
|
||||
public Set<String> getFieldMasterNames(String sPrefix) {
|
||||
Set<String> names = new HashSet<String>();
|
||||
for (String sName : fieldMasterNames) {
|
||||
if (sName.startsWith(sPrefix)) {
|
||||
names.add(sName.substring(sPrefix.length()));
|
||||
}
|
||||
}
|
||||
return names;
|
||||
}
|
||||
|
||||
}
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-12-08)
|
||||
* Version 1.2 (2010-12-09)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -33,6 +33,8 @@ import writer2latex.api.ComplexOption;
|
|||
|
||||
import org.openoffice.da.comp.w2lcommon.filter.ConfigurationDialogBase;
|
||||
import org.openoffice.da.comp.w2lcommon.helper.DialogAccess;
|
||||
import org.openoffice.da.comp.w2lcommon.helper.FieldMasterNameProvider;
|
||||
import org.openoffice.da.comp.w2lcommon.helper.StyleNameProvider;
|
||||
|
||||
import com.sun.star.lang.XServiceInfo;
|
||||
import com.sun.star.uno.XComponentContext;
|
||||
|
@ -82,8 +84,8 @@ public final class ConfigurationDialog extends ConfigurationDialogBase implement
|
|||
pageHandlers.put("Characters", new CharactersHandler());
|
||||
pageHandlers.put("Fonts", new FontsHandler());
|
||||
pageHandlers.put("Pages", new PagesHandler());
|
||||
//pageHandlers.put("Tables", new Handler());
|
||||
//pageHandlers.put("Figures", new Handler());
|
||||
pageHandlers.put("Tables", new TablesHandler());
|
||||
pageHandlers.put("Figures", new FiguresHandler());
|
||||
//pageHandlers.put("TextAndMath", new Handler());
|
||||
}
|
||||
|
||||
|
@ -97,7 +99,7 @@ public final class ConfigurationDialog extends ConfigurationDialogBase implement
|
|||
"UseSoulChange", "FormattingAttributeChange", "CustomAttributeChange", // Characters
|
||||
"ExportGeometryChange", "ExportHeaderAndFooterChange", // Pages
|
||||
"NoTablesChange", "UseSupertabularChange", "UseLongtableChange", // Tables
|
||||
"NoImagesChange", // Images
|
||||
"NoImagesChange", // Figures
|
||||
"MathSymbolNameChange", "NewSymbolClick", "DeleteSymbolClick",
|
||||
"TextInputChange", "NewTextClick", "DeleteTextClick" // Text and Math
|
||||
};
|
||||
|
@ -455,13 +457,18 @@ public final class ConfigurationDialog extends ConfigurationDialogBase implement
|
|||
dlg.setCheckBoxStateAsBoolean("LineBreak", false);
|
||||
}
|
||||
|
||||
protected void prepareControls(DialogAccess dlg) {
|
||||
dlg.setControlEnabled("NextLabel", nCurrentFamily==2);
|
||||
dlg.setControlEnabled("Next", nCurrentFamily==2);
|
||||
dlg.setControlEnabled("AddNextButton", nCurrentFamily==2);
|
||||
dlg.setControlEnabled("RemoveNextButton", nCurrentFamily==2);
|
||||
dlg.setControlEnabled("Verbatim", nCurrentFamily<2);
|
||||
dlg.setControlEnabled("LineBreak", nCurrentFamily==1);
|
||||
protected void prepareControls(DialogAccess dlg, boolean bHasMappings) {
|
||||
dlg.setControlEnabled("BeforeLabel", bHasMappings);
|
||||
dlg.setControlEnabled("Before", bHasMappings);
|
||||
dlg.setControlEnabled("AfterLabel", bHasMappings);
|
||||
dlg.setControlEnabled("After", bHasMappings);
|
||||
dlg.setControlEnabled("NextLabel", bHasMappings && nCurrentFamily==2);
|
||||
dlg.setControlEnabled("Next", bHasMappings && nCurrentFamily==2);
|
||||
dlg.setControlEnabled("AddNextButton", bHasMappings && nCurrentFamily==2);
|
||||
//dlg.setControlEnabled("RemoveNextButton", bHasMappings && nCurrentFamily==2);
|
||||
dlg.setControlEnabled("Verbatim", bHasMappings && nCurrentFamily<2);
|
||||
dlg.setControlEnabled("LineBreak", bHasMappings && nCurrentFamily==1);
|
||||
updateRemoveNextButton(dlg);
|
||||
}
|
||||
|
||||
// Define own event handlers
|
||||
|
@ -698,6 +705,147 @@ public final class ConfigurationDialog extends ConfigurationDialogBase implement
|
|||
}
|
||||
}
|
||||
|
||||
// The page "Tables"
|
||||
// This page handles the options table_content, use_tabulary, use_colortbl, use_multirow, use_supertabular, use_longtable,
|
||||
// table_first_head_style, table_head_style, table_foot_style, table_last_foot_style
|
||||
// Limitation: Cannot handle the values "error" and "warning" for table_content
|
||||
private class TablesHandler extends PageHandler {
|
||||
|
||||
protected TablesHandler() {
|
||||
}
|
||||
|
||||
@Override protected void setControls(DialogAccess dlg) {
|
||||
// Fill the table style combo boxes with style names
|
||||
StyleNameProvider styleNameProvider = new StyleNameProvider(xContext);
|
||||
Map<String,String> internalNames = styleNameProvider.getInternalNames("ParagraphStyles");
|
||||
if (internalNames!=null) {
|
||||
String[] styleNames = sortStringSet(internalNames.keySet());
|
||||
dlg.setListBoxStringItemList("TableFirstHeadStyle",styleNames);
|
||||
dlg.setListBoxStringItemList("TableHeadStyle",styleNames);
|
||||
dlg.setListBoxStringItemList("TableFootStyle",styleNames);
|
||||
dlg.setListBoxStringItemList("TableLastFootStyle",styleNames);
|
||||
}
|
||||
|
||||
// Fill the table sequence combo box with sequence names
|
||||
FieldMasterNameProvider fieldMasterNameProvider = new FieldMasterNameProvider(xContext);
|
||||
dlg.setListBoxStringItemList("TableSequenceName",
|
||||
sortStringSet(fieldMasterNameProvider.getFieldMasterNames("com.sun.star.text.fieldmaster.SetExpression.")));
|
||||
|
||||
dlg.setCheckBoxStateAsBoolean("NoTables", !"accept".equals(config.getOption("table_content")));
|
||||
checkBoxFromConfig(dlg,"UseColortbl","use_colortbl");
|
||||
checkBoxFromConfig(dlg,"UseTabulary","use_tabulary");
|
||||
//checkBoxFromConfig(dlg,"UseMultirow","use_multirow");
|
||||
checkBoxFromConfig(dlg,"UseSupertabular","use_supertabular");
|
||||
checkBoxFromConfig(dlg,"UseLongtable","use_longtable");
|
||||
textFieldFromConfig(dlg,"TableFirstHeadStyle","table_first_head_style");
|
||||
textFieldFromConfig(dlg,"TableHeadStyle","table_head_style");
|
||||
textFieldFromConfig(dlg,"TableFootStyle","table_foot_style");
|
||||
textFieldFromConfig(dlg,"TableLastFootStyle","table_last_foot_style");
|
||||
textFieldFromConfig(dlg,"TableSequenceName","table_sequence_name");
|
||||
|
||||
checkBoxChange(dlg);
|
||||
}
|
||||
|
||||
@Override protected void getControls(DialogAccess dlg) {
|
||||
config.setOption("table_content", dlg.getCheckBoxStateAsBoolean("NoTables") ? "ignore" : "accept");
|
||||
checkBoxToConfig(dlg,"UseColortbl","use_colortbl");
|
||||
checkBoxToConfig(dlg,"UseTabulary","use_tabulary");
|
||||
//checkBoxToConfig(dlg,"UseMultirow","use_multirow");
|
||||
checkBoxToConfig(dlg,"UseSupertabular","use_supertabular");
|
||||
checkBoxToConfig(dlg,"UseLongtable","use_longtable");
|
||||
textFieldToConfig(dlg,"TableFirstHeadStyle","table_first_head_style");
|
||||
textFieldToConfig(dlg,"TableHeadStyle","table_head_style");
|
||||
textFieldToConfig(dlg,"TableFootStyle","table_foot_style");
|
||||
textFieldToConfig(dlg,"TableLastFootStyle","table_last_foot_style");
|
||||
textFieldToConfig(dlg,"TableSequenceName","table_sequence_name");
|
||||
}
|
||||
|
||||
@Override protected boolean handleEvent(DialogAccess dlg, String sMethod) {
|
||||
if (sMethod.equals("NoTablesChange")) {
|
||||
checkBoxChange(dlg);
|
||||
return true;
|
||||
}
|
||||
else if (sMethod.equals("UseSupertabularChange")) {
|
||||
checkBoxChange(dlg);
|
||||
return true;
|
||||
}
|
||||
else if (sMethod.equals("UseLongtableChange")) {
|
||||
checkBoxChange(dlg);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void checkBoxChange(DialogAccess dlg) {
|
||||
boolean bNoTables = dlg.getCheckBoxStateAsBoolean("NoTables");
|
||||
boolean bSupertabular = dlg.getCheckBoxStateAsBoolean("UseSupertabular");
|
||||
boolean bLongtable = dlg.getCheckBoxStateAsBoolean("UseLongtable");
|
||||
dlg.setControlEnabled("UseColortbl", !bNoTables);
|
||||
dlg.setControlEnabled("UseTabulary", !bNoTables);
|
||||
dlg.setControlEnabled("UseMultirow", false);
|
||||
dlg.setControlEnabled("UseSupertabular", !bNoTables);
|
||||
dlg.setControlEnabled("UseLongtable", !bNoTables && !bSupertabular);
|
||||
dlg.setControlEnabled("TableFirstHeadLabel", !bNoTables && (bSupertabular || bLongtable));
|
||||
dlg.setControlEnabled("TableFirstHeadStyle", !bNoTables && (bSupertabular || bLongtable));
|
||||
dlg.setControlEnabled("TableHeadLabel", !bNoTables && (bSupertabular || bLongtable));
|
||||
dlg.setControlEnabled("TableHeadStyle", !bNoTables && (bSupertabular || bLongtable));
|
||||
dlg.setControlEnabled("TableFootLabel", !bNoTables && (bSupertabular || bLongtable));
|
||||
dlg.setControlEnabled("TableFootStyle", !bNoTables && (bSupertabular || bLongtable));
|
||||
dlg.setControlEnabled("TableLastFootLabel", !bNoTables && (bSupertabular || bLongtable));
|
||||
dlg.setControlEnabled("TableLastFootStyle", !bNoTables && (bSupertabular || bLongtable));
|
||||
dlg.setControlEnabled("TableSequenceLabel", !bNoTables);
|
||||
dlg.setControlEnabled("TableSequenceName", !bNoTables);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
// The page "Figures"
|
||||
// This page handles the options use_caption, align_frames, figure_sequence_name, image_content,
|
||||
// remove_graphics_extension and image_options
|
||||
// Limitation: Cannot handle the values "error" and "warning" for image_content
|
||||
private class FiguresHandler extends PageHandler {
|
||||
@Override protected void setControls(DialogAccess dlg) {
|
||||
// Fill the figure sequence combo box with sequence names
|
||||
FieldMasterNameProvider fieldMasterNameProvider = new FieldMasterNameProvider(xContext);
|
||||
dlg.setListBoxStringItemList("FigureSequenceName",
|
||||
sortStringSet(fieldMasterNameProvider.getFieldMasterNames("com.sun.star.text.fieldmaster.SetExpression.")));
|
||||
|
||||
checkBoxFromConfig(dlg,"UseCaption","use_caption");
|
||||
checkBoxFromConfig(dlg,"AlignFrames","align_frames");
|
||||
textFieldFromConfig(dlg,"FigureSequenceName","figure_sequence_name");
|
||||
dlg.setCheckBoxStateAsBoolean("NoImages", !"accept".equals(config.getOption("image_content")));
|
||||
checkBoxFromConfig(dlg,"RemoveGraphicsExtension","remove_graphics_extension");
|
||||
textFieldFromConfig(dlg,"ImageOptions","image_options");
|
||||
|
||||
noImagesChange(dlg);
|
||||
}
|
||||
|
||||
@Override protected void getControls(DialogAccess dlg) {
|
||||
checkBoxToConfig(dlg,"UseCaption","use_caption");
|
||||
checkBoxToConfig(dlg,"AlignFrames","align_frames");
|
||||
textFieldToConfig(dlg,"FigureSequenceName","figure_sequence_name");
|
||||
config.setOption("image_content", dlg.getCheckBoxStateAsBoolean("NoImages") ? "ignore" : "accept");
|
||||
checkBoxToConfig(dlg,"RemoveGraphicsExtension","remove_graphics_extension");
|
||||
textFieldToConfig(dlg,"ImageOptions","image_options");
|
||||
}
|
||||
|
||||
@Override protected boolean handleEvent(DialogAccess dlg, String sMethod) {
|
||||
if (sMethod.equals("NoImagesChange")) {
|
||||
noImagesChange(dlg);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void noImagesChange(DialogAccess dlg) {
|
||||
boolean bNoImages = dlg.getCheckBoxStateAsBoolean("NoImages");
|
||||
dlg.setControlEnabled("RemoveGraphicsExtension", !bNoImages);
|
||||
dlg.setControlEnabled("ImageOptionsLabel", !bNoImages);
|
||||
dlg.setControlEnabled("ImageOptions", !bNoImages);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/*
|
||||
|
||||
|
@ -916,12 +1064,6 @@ public final class ConfigurationDialog extends ConfigurationDialogBase implement
|
|||
|
||||
// Set controls based on the config
|
||||
private void setControls() {
|
||||
else if ("Styles".equals(sTitle)) {
|
||||
loadStyles();
|
||||
}
|
||||
else if ("Tables".equals(sTitle)) {
|
||||
loadTables();
|
||||
}
|
||||
else if ("Figures".equals(sTitle)) {
|
||||
loadFigures();
|
||||
}
|
||||
|
@ -932,12 +1074,6 @@ public final class ConfigurationDialog extends ConfigurationDialogBase implement
|
|||
|
||||
// Change the config based on the controls
|
||||
private void getControls() {
|
||||
else if ("Styles".equals(sTitle)) {
|
||||
saveStyles();
|
||||
}
|
||||
else if ("Tables".equals(sTitle)) {
|
||||
saveTables();
|
||||
}
|
||||
else if ("Figures".equals(sTitle)) {
|
||||
saveFigures();
|
||||
}
|
||||
|
@ -946,95 +1082,6 @@ public final class ConfigurationDialog extends ConfigurationDialogBase implement
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
// The page "Tables"
|
||||
// This page handles the options table_content, use_tabulary, use_colortbl, use_multirow, use_supertabular, use_longtable,
|
||||
// table_first_head_style, table_head_style, table_foot_style, table_last_foot_style
|
||||
// Limitation: Cannot handle the values "error" and "warning" for table_content
|
||||
|
||||
private void loadTables() {
|
||||
dlg.setCheckBoxStateAsBoolean("NoTables", !"accept".equals(config.getOption("table_content")));
|
||||
dlg.setCheckBoxStateAsBoolean("UseColortbl","true".equals(config.getOption("use_colortbl")));
|
||||
dlg.setCheckBoxStateAsBoolean("UseTabulary", "true".equals(config.getOption("use_tabulary")));
|
||||
//dlg.setCheckBoxStateAsBoolean("UseMultirow", "true".equals(config.getOption("use_multirow")));
|
||||
dlg.setCheckBoxStateAsBoolean("UseSupertabular","true".equals(config.getOption("use_supertabular")));
|
||||
dlg.setCheckBoxStateAsBoolean("UseLongtable", "true".equals(config.getOption("use_longtable")));
|
||||
dlg.setTextFieldText("TableFirstHeadStyle", config.getOption("table_first_head_style"));
|
||||
dlg.setTextFieldText("TableHeadStyle", config.getOption("table_head_style"));
|
||||
dlg.setTextFieldText("TableFootStyle", config.getOption("table_foot_style"));
|
||||
dlg.setTextFieldText("TableLastFootStyle", config.getOption("table_last_foot_style"));
|
||||
dlg.setTextFieldText("TableSequenceName", config.getOption("table_sequence_name"));
|
||||
updateTablesControls();
|
||||
}
|
||||
|
||||
private void saveTables() {
|
||||
config.setOption("table_content", dlg.getCheckBoxStateAsBoolean("NoTables") ? "ignore" : "accept");
|
||||
config.setOption("use_colortbl", Boolean.toString(dlg.getCheckBoxStateAsBoolean("UseColortbl")));
|
||||
config.setOption("use_tabulary", Boolean.toString(dlg.getCheckBoxStateAsBoolean("UseTabulary")));
|
||||
//config.setOption("use_multirow", Boolean.toString(dlg.getCheckBoxStateAsBoolean("UseMultirow")));
|
||||
config.setOption("use_supertabular", Boolean.toString(dlg.getCheckBoxStateAsBoolean("UseSupertabular")));
|
||||
config.setOption("use_longtable", Boolean.toString(dlg.getCheckBoxStateAsBoolean("UseLongtable")));
|
||||
config.setOption("table_first_head_style", dlg.getTextFieldText("TableFirstHeadStyle"));
|
||||
config.setOption("table_head_style", dlg.getTextFieldText("TableHeadStyle"));
|
||||
config.setOption("table_foot_style", dlg.getTextFieldText("TableFootStyle"));
|
||||
config.setOption("table_last_foot_style", dlg.getTextFieldText("TableLastFootStyle"));
|
||||
config.setOption("table_sequence_name", dlg.getTextFieldText("TableSequenceName"));
|
||||
}
|
||||
|
||||
private void updateTablesControls() {
|
||||
boolean bNoTables = dlg.getCheckBoxStateAsBoolean("NoTables");
|
||||
boolean bSupertabular = dlg.getCheckBoxStateAsBoolean("UseSupertabular");
|
||||
boolean bLongtable = dlg.getCheckBoxStateAsBoolean("UseLongtable");
|
||||
dlg.setControlEnabled("UseColortbl", !bNoTables);
|
||||
dlg.setControlEnabled("UseTabulary", !bNoTables);
|
||||
dlg.setControlEnabled("UseMultirow", false);
|
||||
dlg.setControlEnabled("UseSupertabular", !bNoTables);
|
||||
dlg.setControlEnabled("UseLongtable", !bNoTables && !bSupertabular);
|
||||
dlg.setControlEnabled("TableFirstHeadLabel", !bNoTables && (bSupertabular || bLongtable));
|
||||
dlg.setControlEnabled("TableFirstHeadStyle", !bNoTables && (bSupertabular || bLongtable));
|
||||
dlg.setControlEnabled("TableHeadLabel", !bNoTables && (bSupertabular || bLongtable));
|
||||
dlg.setControlEnabled("TableHeadStyle", !bNoTables && (bSupertabular || bLongtable));
|
||||
dlg.setControlEnabled("TableFootLabel", !bNoTables && (bSupertabular || bLongtable));
|
||||
dlg.setControlEnabled("TableFootStyle", !bNoTables && (bSupertabular || bLongtable));
|
||||
dlg.setControlEnabled("TableLastFootLabel", !bNoTables && (bSupertabular || bLongtable));
|
||||
dlg.setControlEnabled("TableLastFootStyle", !bNoTables && (bSupertabular || bLongtable));
|
||||
dlg.setControlEnabled("TableSequenceLabel", !bNoTables);
|
||||
dlg.setControlEnabled("TableSequenceName", !bNoTables);
|
||||
}
|
||||
|
||||
// The page "Figures"
|
||||
// This page handles the options use_caption, align_frames, figure_sequence_name, image_content,
|
||||
// remove_graphics_extension and image_options
|
||||
// Limitation: Cannot handle the values "error" and "warning" for image_content
|
||||
|
||||
private void loadFigures() {
|
||||
dlg.setCheckBoxStateAsBoolean("UseCaption", "true".equals(config.getOption("use_caption")));
|
||||
dlg.setCheckBoxStateAsBoolean("AlignFrames", "true".equals(config.getOption("align_frames")));
|
||||
dlg.setTextFieldText("FigureSequenceName", config.getOption("figure_sequence_name"));
|
||||
dlg.setCheckBoxStateAsBoolean("NoImages", !"accept".equals(config.getOption("image_content")));
|
||||
dlg.setCheckBoxStateAsBoolean("RemoveGraphicsExtension", "true".equals(config.getOption("remove_graphics_extension")));
|
||||
dlg.setTextFieldText("ImageOptions", config.getOption("image_options"));
|
||||
updateFiguresControls();
|
||||
}
|
||||
|
||||
private void saveFigures() {
|
||||
config.setOption("use_caption", Boolean.toString(dlg.getCheckBoxStateAsBoolean("UseCaption")));
|
||||
config.setOption("align_frames", Boolean.toString(dlg.getCheckBoxStateAsBoolean("AlignFrames")));
|
||||
config.setOption("figure_sequence_name", dlg.getTextFieldText("FigureSequenceName"));
|
||||
config.setOption("image_content", dlg.getCheckBoxStateAsBoolean("NoImages") ? "ignore" : "accept");
|
||||
config.setOption("remove_graphics_extension", Boolean.toString(dlg.getCheckBoxStateAsBoolean("RemoveGraphicsExtension")));
|
||||
config.setOption("image_options", dlg.getTextFieldText("ImageOptions"));
|
||||
}
|
||||
|
||||
private void updateFiguresControls() {
|
||||
boolean bNoImages = dlg.getCheckBoxStateAsBoolean("NoImages");
|
||||
dlg.setControlEnabled("RemoveGraphicsExtension", !bNoImages);
|
||||
dlg.setControlEnabled("ImageOptionsLabel", !bNoImages);
|
||||
dlg.setControlEnabled("ImageOptions", !bNoImages);
|
||||
}
|
||||
|
||||
// The page "TextAndMath"
|
||||
// This page handles the options use_ooomath and tabstop as well as the
|
||||
// text replacements and math symbol definitions
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
*
|
||||
* All Rights Reserved.
|
||||
*
|
||||
* Version 1.2 (2010-06-20)
|
||||
* Version 1.2 (2010-12-09)
|
||||
*
|
||||
*/
|
||||
|
||||
|
@ -114,7 +114,7 @@ public class ConfigurationDialog extends ConfigurationDialogBase implements XSer
|
|||
checkBoxFromConfig(dlg, "Multilingual", "multilingual");
|
||||
checkBoxFromConfig(dlg, "PrettyPrint", "pretty_print");
|
||||
|
||||
updateControls(dlg);
|
||||
encodingChange(dlg);
|
||||
}
|
||||
|
||||
@Override protected void getControls(DialogAccess dlg) {
|
||||
|
@ -131,13 +131,13 @@ public class ConfigurationDialog extends ConfigurationDialogBase implements XSer
|
|||
|
||||
@Override protected boolean handleEvent(DialogAccess dlg, String sMethod) {
|
||||
if (sMethod.equals("EncodingChange")) {
|
||||
updateControls(dlg);
|
||||
encodingChange(dlg);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void updateControls(DialogAccess dlg) {
|
||||
private void encodingChange(DialogAccess dlg) {
|
||||
int nEncoding = dlg.getListBoxSelectedItem("Encoding");
|
||||
dlg.setControlEnabled("AddBOM", nEncoding==0); // Only for UTF-8
|
||||
dlg.setControlEnabled("HexadecimalEntitiesLabel", nEncoding>1); // Not for UNICODE
|
||||
|
@ -304,12 +304,17 @@ public class ConfigurationDialog extends ConfigurationDialogBase implements XSer
|
|||
dlg.setTextFieldText("BlockCss", "");
|
||||
}
|
||||
|
||||
protected void prepareControls(DialogAccess dlg) {
|
||||
protected void prepareControls(DialogAccess dlg, boolean bHasMappings) {
|
||||
dlg.setListBoxStringItemList("Element", sElements[nCurrentFamily]);
|
||||
dlg.setListBoxStringItemList("BlockElement", sBlockElements[nCurrentFamily]);
|
||||
dlg.setControlEnabled("Element", nCurrentFamily<=2);
|
||||
dlg.setControlEnabled("BlockElement", nCurrentFamily==1 || nCurrentFamily==2);
|
||||
dlg.setControlEnabled("BlockCss", nCurrentFamily==1 || nCurrentFamily==2);
|
||||
dlg.setControlEnabled("ElementLabel", bHasMappings && nCurrentFamily<=2);
|
||||
dlg.setControlEnabled("Element", bHasMappings && nCurrentFamily<=2);
|
||||
dlg.setControlEnabled("CssLabel", bHasMappings);
|
||||
dlg.setControlEnabled("Css", bHasMappings);
|
||||
dlg.setControlEnabled("BlockElementLabel", bHasMappings && (nCurrentFamily==1 || nCurrentFamily==2));
|
||||
dlg.setControlEnabled("BlockElement", bHasMappings && (nCurrentFamily==1 || nCurrentFamily==2));
|
||||
dlg.setControlEnabled("BlockCssLabel", bHasMappings && (nCurrentFamily==1 || nCurrentFamily==2));
|
||||
dlg.setControlEnabled("BlockCss", bHasMappings && (nCurrentFamily==1 || nCurrentFamily==2));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue