diff --git a/source/distro/changelog.txt b/source/distro/changelog.txt index 19058f7..7aa2880 100644 --- a/source/distro/changelog.txt +++ b/source/distro/changelog.txt @@ -2,6 +2,12 @@ Changelog for Writer2LaTeX version 1.0 -> 1.2 ---------- version 1.1.9 ---------- +[all] Custom config ui: Style controls are now disabled if there are no definitions for the current style famlily + +[w2l] Custom config ui: The table and figure sequence name can now be selected from existing field masters + +[w2l] Custom config ui: The four special styles for tables are now localized and can be selected from existing styles + [w2x] In EPUB export, convert_to_px=true now (despite the name) exports relative font sizes [w2l] Custom config ui is now refactored to use ConfigurationDialogBase, fixing some minor bugs diff --git a/source/distro/doc/user-manual.odt b/source/distro/doc/user-manual.odt index 641dabc..e20be04 100644 Binary files a/source/distro/doc/user-manual.odt and b/source/distro/doc/user-manual.odt differ diff --git a/source/java/org/openoffice/da/comp/w2lcommon/filter/ConfigurationDialogBase.java b/source/java/org/openoffice/da/comp/w2lcommon/filter/ConfigurationDialogBase.java index 9a717d5..f7ae651 100644 --- a/source/java/org/openoffice/da/comp/w2lcommon/filter/ConfigurationDialogBase.java +++ b/source/java/org/openoffice/da/comp/w2lcommon/filter/ConfigurationDialogBase.java @@ -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 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 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 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()); 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 nameTranslation) { diff --git a/source/java/org/openoffice/da/comp/w2lcommon/helper/FieldMasterNameProvider.java b/source/java/org/openoffice/da/comp/w2lcommon/helper/FieldMasterNameProvider.java new file mode 100644 index 0000000..17274b0 --- /dev/null +++ b/source/java/org/openoffice/da/comp/w2lcommon/helper/FieldMasterNameProvider.java @@ -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 FieldMasterNameProvider + * + * @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 Set containing all known names with the given prefix, stripped for the prefix + */ + public Set getFieldMasterNames(String sPrefix) { + Set names = new HashSet(); + for (String sName : fieldMasterNames) { + if (sName.startsWith(sPrefix)) { + names.add(sName.substring(sPrefix.length())); + } + } + return names; + } + +} diff --git a/source/java/org/openoffice/da/comp/writer2latex/ConfigurationDialog.java b/source/java/org/openoffice/da/comp/writer2latex/ConfigurationDialog.java index 0c9666d..d400d2a 100644 --- a/source/java/org/openoffice/da/comp/writer2latex/ConfigurationDialog.java +++ b/source/java/org/openoffice/da/comp/writer2latex/ConfigurationDialog.java @@ -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 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 diff --git a/source/java/org/openoffice/da/comp/writer2xhtml/ConfigurationDialog.java b/source/java/org/openoffice/da/comp/writer2xhtml/ConfigurationDialog.java index 03e9b5c..b460916 100644 --- a/source/java/org/openoffice/da/comp/writer2xhtml/ConfigurationDialog.java +++ b/source/java/org/openoffice/da/comp/writer2xhtml/ConfigurationDialog.java @@ -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)); } } diff --git a/source/oxt/writer2latex/W2LDialogs2/Figures.xdl b/source/oxt/writer2latex/W2LDialogs2/Figures.xdl index c3e9bb6..418d05e 100644 --- a/source/oxt/writer2latex/W2LDialogs2/Figures.xdl +++ b/source/oxt/writer2latex/W2LDialogs2/Figures.xdl @@ -6,7 +6,10 @@ - + + + + diff --git a/source/oxt/writer2latex/W2LDialogs2/Tables.xdl b/source/oxt/writer2latex/W2LDialogs2/Tables.xdl index 0e537cd..5adb2b5 100644 --- a/source/oxt/writer2latex/W2LDialogs2/Tables.xdl +++ b/source/oxt/writer2latex/W2LDialogs2/Tables.xdl @@ -17,12 +17,27 @@ - - - - + + + + + + + + + + + + + + + + - + + + + \ No newline at end of file diff --git a/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/Configuration/Figures.xhp b/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/Configuration/Figures.xhp index 299dd4c..bd54ff5 100644 --- a/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/Configuration/Figures.xhp +++ b/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/Configuration/Figures.xhp @@ -33,7 +33,10 @@ This option can be set to a sequence name in the source document. OpenDocument has a very weak sense of figure captions: A figure caption is a paragraph containing a sequence number. If you use %PRODUCTNAME's defaults, Writer2LaTeX can guess which sequence name to use. - If it fails, you can type the name here. Normally it should be left empty. + If it fails, you can type the name here, or select the name from the list. (Note that %PRODUCTNAME Writer has four + basic sequence names which always will be displayed in English here. These are Drawing, Illustration, Table, Text.) + Normally this field should be left empty. + Graphics diff --git a/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/Configuration/Tables.xhp b/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/Configuration/Tables.xhp index c507d61..25d6c4c 100644 --- a/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/Configuration/Tables.xhp +++ b/source/oxt/writer2latex/help/en/org.openoffice.da.writer2latex.oxt/Configuration/Tables.xhp @@ -43,7 +43,8 @@ Style for first head This option is used to produce advanced tables, that are not supported in - %PRODUCTNAME Writer. Enter the name of a paragraph style. If the first paragraph of the first cell in a row is formatted + %PRODUCTNAME Writer. Enter the name of a paragraph style, or select a style in the list. + If the first paragraph of the first cell in a row is formatted with this paragraph style, the row in question will be used for the first head in a multipage table. @@ -66,6 +67,8 @@ This option can be set to a sequence name in the source document. OpenDocument has a very weak sense of table captions: A table caption is a paragraph containing a sequence number. If you use %PRODUCTNAME's defaults, Writer2LaTeX can guess which sequence name to use. - If it fails, you can type the name here. Normally it should be left empty. + If it fails, you can type the name here, or select the name from the list. (Note that %PRODUCTNAME Writer has four + basic sequence names which always will be displayed in English here. These are Drawing, Illustration, Table, Text.) + Normally this field should be left empty. \ No newline at end of file