}
static SaveOptions getSaveOptions(Document doc) {
SaveOptions options = doc.getSaveOptions();
if (options == null) {
ImageMetadata meta = doc.getMetadata();
Preferences prefs = getPreferences();
boolean byOriginal = prefs.getBoolean("SaveByOriginal", true);
File dir;
if (byOriginal || LastSaveOptions == null) {
dir = meta.getFile().getParentFile();
}
else {
dir = LastSaveOptions.getFile().getParentFile();
}
options = SaveOptions.getDefaultSaveOptions();
ImageFileExportOptions export =
(ImageFileExportOptions) SaveOptions.getExportOptions(options);
ImageType type = export.getImageType();
File file = new File(dir, meta.getFile().getName());
String name = ExportNameUtility.getBaseName(file);
name = name + "_lzn." + type.getExtensions()[0];
file = new File(name);
file = ExportNameUtility.ensureNotExists(file);