20#include <com/sun/star/ui/dialogs/ExecutableDialogResults.hpp>
25#include <osl/diagnose.h>
40#include <com/sun/star/uno/Any.hxx>
41#include <com/sun/star/uno/Sequence.hxx>
67 enum class charsetSource
70 charset_from_user_setting,
74 charsetSource load_CharSet(rtl_TextEncoding &nCharSet,
bool bExport,
SvStream* dbf_Stream)
78 return charsetSource::charset_from_file;
82 const Any *pProperties;
87 pProperties = aValues.getConstArray();
89 if( pProperties[0].hasValue() )
92 pProperties[0] >>= nChar;
95 nCharSet =
static_cast<rtl_TextEncoding
>(nChar);
96 return charsetSource::charset_from_user_setting;
101 nCharSet = RTL_TEXTENCODING_IBM_850;
102 return charsetSource::charset_default;
105 void save_CharSet( rtl_TextEncoding nCharSet,
bool bExport )
113 pProperties = aValues.getArray();
114 pProperties[0] <<=
static_cast<sal_Int32
>(nCharSet);
129extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface*
148 for (
const beans::PropertyValue& rProp : aProps)
172 sal_Int16 nRet = ui::dialogs::ExecutableDialogResults::CANCEL;
185 std::unique_ptr<SvStream> pInStream;
191 if ( pDlg->Execute() ==
RET_OK )
194 pDlg->GetOptions( aOptions );
195 pDlg->SaveParameters();
197 nRet = ui::dialogs::ExecutableDialogResults::OK;
203 nRet = ui::dialogs::ExecutableDialogResults::OK;
210 if (pDlg->Execute() ==
RET_OK)
215 aBuf.append(
static_cast<sal_Int32
>(
static_cast<sal_uInt16
>(eLang)));
217 aBuf.append(pDlg->IsDateConversionSet() ?
u'1' :
u'0');
219 aBuf.append(pDlg->IsScientificConversionSet() ?
u'1' :
u'0');
221 nRet = ui::dialogs::ExecutableDialogResults::OK;
229 bool skipDialog =
false;
233 rtl_TextEncoding eEncoding = RTL_TEXTENCODING_DONTKNOW;
236 bool bIncludeBOM =
false;
243 OUString aExt(
aURL.getExtension());
244 if (aExt.equalsIgnoreAsciiCase(
"CSV"))
249 aTitle =
ScResId( STR_EXPORT_ASCII );
259 OSL_ENSURE( !
bExport,
"Filter Options for Lotus Export is not implemented" );
261 aTitle =
ScResId( STR_IMPORT_LOTUS );
262 eEncoding = RTL_TEXTENCODING_IBM_437;
269 aTitle =
ScResId( STR_EXPORT_DBF );
274 aTitle =
ScResId( STR_IMPORT_DBF );
277 std::unique_ptr<SvStream> pInStream;
280 switch(load_CharSet( eEncoding,
bExport, pInStream.get()))
282 case charsetSource::charset_from_file:
285 case charsetSource::charset_from_user_setting:
286 case charsetSource::charset_default:
297 aTitle =
ScResId( STR_EXPORT_DIF );
302 aTitle =
ScResId( STR_IMPORT_DIF );
305 eEncoding = RTL_TEXTENCODING_MS_1252;
319 nRet = ui::dialogs::ExecutableDialogResults::OK;
324 bAscii, &aOptions, &aTitle,
326 if ( pDlg->Execute() ==
RET_OK )
328 pDlg->SaveImportOptions();
329 pDlg->GetImportOptions( aOptions );
331 nRet = ui::dialogs::ExecutableDialogResults::OK;
334 if (nRet == ui::dialogs::ExecutableDialogResults::OK)
PropertiesInfo aProperties
static weld::Window * GetFrameWeld(const css::uno::Reference< css::awt::XWindow > &rWindow)
virtual VclPtr< AbstractScImportOptionsDlg > CreateScImportOptionsDlg(weld::Window *pParent, bool bAscii, const ScImportOptions *pOptions, const OUString *pStrTitle, bool bOnlyDbtoolsEncodings, bool bImport=true)=0
virtual VclPtr< AbstractScTextImportOptionsDlg > CreateScTextImportOptionsDlg(weld::Window *pParent)=0
static SC_DLLPUBLIC ScAbstractDialogFactory * Create()
virtual VclPtr< AbstractScImportAsciiDlg > CreateScImportAsciiDlg(weld::Window *pParent, const OUString &aDatName, SvStream *pInStream, ScImportAsciiCall eCall)=0
void ReadFromString(std::u16string_view rString)
bool GetIncludeBOM() const
OUString WriteToString() const
static SC_DLLPUBLIC void Init()
DLL-init/exit-code must be linked to the DLL only.
static OUString GetHtmlFilterName()
static OUString GetDifFilterName()
static OUString GetLotusFilterName()
static OUString GetAsciiFilterName()
static OUString GetWebQueryFilterName()
static OUString GetDBaseFilterName()
css::uno::Reference< css::awt::XWindow > xDialogParent
virtual ~ScFilterOptionsObj() override
virtual void SAL_CALL setSourceDocument(const css::uno::Reference< css::lang::XComponent > &xDoc) override
virtual void SAL_CALL initialize(const css::uno::Sequence< css::uno::Any > &rArguments) override
virtual void SAL_CALL setTitle(const OUString &aTitle) override
virtual css::uno::Sequence< css::beans::PropertyValue > SAL_CALL getPropertyValues() override
virtual void SAL_CALL setTargetDocument(const css::uno::Reference< css::lang::XComponent > &xDoc) override
virtual sal_Int16 SAL_CALL execute() override
virtual void SAL_CALL setPropertyValues(const css::uno::Sequence< css::beans::PropertyValue > &aProps) override
css::uno::Reference< css::io::XInputStream > xInputStream
OUString BuildString() const
rtl_TextEncoding eCharSet
void PutProperties(const css::uno::Sequence< OUString > &rNames, const css::uno::Sequence< css::uno::Any > &rValues)
css::uno::Sequence< css::uno::Any > GetProperties(const css::uno::Sequence< OUString > &rNames)
static std::unique_ptr< SvStream > CreateStream(const OUString &rFileName, StreamMode eOpenMode, css::uno::Reference< css::awt::XWindow > xParentWin=nullptr)
constexpr OUStringLiteral DBF_SEP_PATH_IMPORT
constexpr OUStringLiteral SC_UNONAME_FILTERNAME
constexpr OUStringLiteral SCFILTEROPTIONSOBJ_IMPLNAME
constexpr OUStringLiteral DBF_CHAR_SET
constexpr OUStringLiteral SC_UNONAME_FILTEROPTIONS
constexpr OUStringLiteral SC_UNONAME_INPUTSTREAM
SAL_DLLPUBLIC_EXPORT css::uno::XInterface * Calc_FilterOptionsDialog_get_implementation(css::uno::XComponentContext *, css::uno::Sequence< css::uno::Any > const &)
constexpr OUStringLiteral DBF_SEP_PATH_EXPORT
constexpr OUStringLiteral SC_UNONAME_FILENAME
constexpr OUStringLiteral SCFILTEROPTIONSOBJ_SERVICE
#define SC_SIMPLE_SERVICE_INFO(ClassName, ClassNameAscii, ServiceAscii)
css::uno::Sequence< css::beans::PropertyValue > InitPropertySequence(::std::initializer_list< ::std::pair< OUString, css::uno::Any > > vInit)
bool dbfReadCharset(rtl_TextEncoding &nCharSet, SvStream *dbf_Stream)
OUString ScResId(TranslateId aId)