private void loadDefaultsClick(DialogAccess dlg) {
      updateStyleMaps(dlg);

      // Count styles that we will overwrite
      Config clean = ConverterFactory.createConverter(getMIMEType()).getConfig();
      clean.readDefaultConfig(getDefaultConfigName());

      int nCount = 0;
      int nFamilyCount = sFamilyNames.length;
      for (int i = 0; i < nFamilyCount; i++) {
        ComplexOption cleanMap = clean.getComplexOption(sFamilyNames[i] + "-map");
        Map<String, String> displayNames = styleNameProvider.getDisplayNames(sOOoFamilyNames[i]);
        for (String sName : cleanMap.keySet()) {
          String sDisplayName =
              (displayNames != null && displayNames.containsKey(sName))
                  ? displayNames.get(sName)
                  : "";
          if (styleMap[i].containsKey(sDisplayName)) {
            nCount++;
          }
        }
      }

      // Display confirmation dialog
      boolean bConfirm = false;
      XDialog xDialog = getDialog(getDialogLibraryName() + ".LoadDefaults");
      if (xDialog != null) {
        DialogAccess ldlg = new DialogAccess(xDialog);
        if (nCount > 0) {
          String sLabel = ldlg.getLabelText("OverwriteLabel");
          sLabel = sLabel.replaceAll("%s", Integer.toString(nCount));
          ldlg.setLabelText("OverwriteLabel", sLabel);
        } else {
          ldlg.setLabelText("OverwriteLabel", "");
        }
        bConfirm = xDialog.execute() == ExecutableDialogResults.OK;
        xDialog.endExecute();
      }

      // Do the replacement
      if (bConfirm) {
        for (int i = 0; i < nFamilyCount; i++) {
          ComplexOption cleanMap = clean.getComplexOption(sFamilyNames[i] + "-map");
          Map<String, String> displayNames = styleNameProvider.getDisplayNames(sOOoFamilyNames[i]);
          copyStyles(cleanMap, styleMap[i], displayNames);
        }
      }

      // Force update of the user interface
      nCurrentFamily = -1;
      sCurrentStyleName = null;
      styleFamilyChange(dlg);
    }
 // Save the user configuration
 private void saveConfig() {
   if (sfa2 != null && sConfigFileName != null) {
     try {
       // Remove the file if it exists
       if (sfa2.exists(sConfigFileName)) {
         sfa2.kill(sConfigFileName);
       }
       // Then write the new contents
       XOutputStream xOs = sfa2.openFileWrite(sConfigFileName);
       if (xOs != null) {
         OutputStream os = new XOutputStreamToOutputStreamAdapter(xOs);
         config.write(os);
         os.close();
         xOs.closeOutput();
       }
     } catch (IOException e) {
       // ignore
     } catch (NotConnectedException e) {
       // ignore
     } catch (CommandAbortedException e) {
       // ignore
     } catch (com.sun.star.uno.Exception e) {
       // ignore
     }
   }
 }
 // Load the user configuration from file
 private void loadConfig() {
   if (sfa2 != null && sConfigFileName != null) {
     try {
       XInputStream xIs = sfa2.openFileRead(sConfigFileName);
       if (xIs != null) {
         InputStream is = new XInputStreamToInputStreamAdapter(xIs);
         config.read(is);
         is.close();
         xIs.closeInput();
       }
     } catch (IOException e) {
       // ignore
     } catch (NotConnectedException e) {
       // ignore
     } catch (CommandAbortedException e) {
       // ignore
     } catch (com.sun.star.uno.Exception e) {
       // ignore
     }
   }
 }