I don’t know where I found next macro, but it was for Save As plain text. I add the ODT to filter to show the possibilities. If you change the args(0).Name according to selected filter then you can have own Save As.
private oStoreDialog as object
private bFirst as boolean 'don't show listener during initialization of dialog
Sub SaveAsPlainText()
dim ListAny(0) as long
dim args(0) as new com.sun.star.beans.PropertyValue
dim sFileName as string
dim oListener
GlobalScope.BasicLibraries.loadLibrary("Tools")
ListAny(0)=com.sun.star.ui.dialogs.TemplateDescription.FILESAVE_AUTOEXTENSION_PASSWORD
oStoreDialog=CreateUnoService("com.sun.star.ui.dialogs.FilePicker")
oStoreDialog.Initialize(ListAny)
oStoreDialog.AppendFilter("Plain text (*.plain)", ".plain")
oStoreDialog.AppendFilter("ODT (*.odt)", ".odt")
sFileName=ThisComponent.getURL()
if sFileName <> "" then oStoreDialog.SetDefaultName(GetFileNameWithoutExtension(ThisComponent.getURL(), "/"))
oStoreDialog.setValue(com.sun.star.ui.dialogs.ExtendedFilePickerElementIds.CHECKBOX_AUTOEXTENSION, 0, true)
oListener=CreateUnoListener("L_", "com.sun.star.ui.dialogs.XFilePickerListener")
oStoreDialog.addFilePickerListener(oListener)
if oStoreDialog.Execute()<>1 then exit sub
oStoreDialog.dispose()
args(0).Name="FilterName"
args(0).Value="Text"
ThisComponent.storeAsURL(oStoreDialog.Files(0), args)
End Sub
Sub L_fileSelectionChanged(oEvt as object)
End Sub
Sub L_directoryChanged(oEvt as object)
End Sub
Sub L_helpRequested(oEvt as object)
End Sub
Sub L_controlStateChanged(oEvt as object)
if bFirst then msgbox oStoreDialog.CurrentFilter
bFirst=true
End Sub
Sub L_dialogSizeChanged(oEvt as object)
End Sub