20#undef SC_DLLIMPLEMENTATION
26#include <officecfg/Office/Calc.hxx>
27#include <osl/thread.h>
28#include <rtl/tencinfo.h>
44 sal_uInt16
GetCode( std::u16string_view rDelimiter )
const;
81 sal_Int32 nPrevIdx {nIdx};
94 m_xLbCharset->FillFromTextEncodingTable(bExcludeImportSubsets, nExcludeInfoFlags);
96 m_xTvCharset->FillFromTextEncodingTable(bExcludeImportSubsets, nExcludeInfoFlags);
102 m_xLbCharset->FillFromDbTextEncodingMap(bExcludeImportSubsets, nExcludeInfoFlags);
104 m_xTvCharset->FillFromDbTextEncodingMap(bExcludeImportSubsets, nExcludeInfoFlags);
110 const OUString* pStrTitle,
111 bool bMultiByte,
bool bOnlyDbtoolsEncodings,
113 : GenericDialogController(pParent,
"modules/scalc/ui/imoptdialog.ui",
"ImOptDialog")
114 , m_bIsAsciiImport(bAscii)
115 , m_xFieldFrame(m_xBuilder->weld_frame(
"fieldframe"))
116 , m_xFtCharset(m_xBuilder->weld_label(
"charsetft"))
117 , m_xEncGrid(m_xBuilder->weld_widget(
"grid2"))
118 , m_xFtFieldSep(m_xBuilder->weld_label(
"fieldft"))
119 , m_xEdFieldSep(m_xBuilder->weld_combo_box(
"field"))
120 , m_xFtTextSep(m_xBuilder->weld_label(
"textft"))
121 , m_xEdTextSep(m_xBuilder->weld_combo_box(
"text"))
122 , m_xCbShown(m_xBuilder->weld_check_button(
"asshown"))
123 , m_xCbFormulas(m_xBuilder->weld_check_button(
"formulas"))
124 , m_xCbQuoteAll(m_xBuilder->weld_check_button(
"quoteall"))
125 , m_xCbFixed(m_xBuilder->weld_check_button(
"fixedwidth"))
144 sFieldSep = sFieldSep.replaceFirst(
"%TAB",
ScResId(SCSTR_FIELDSEP_TAB) );
145 sFieldSep = sFieldSep.replaceFirst(
"%SPACE",
ScResId(SCSTR_FIELDSEP_SPACE) );
153 while (!
aStr.isEmpty())
161 while (!
aStr.isEmpty())
170 if ( bOnlyDbtoolsEncodings )
184 RTL_TEXTENCODING_INFO_MULTIBYTE );
193 if (
aStr.isEmpty() )
201 if (
aStr.isEmpty() )
212 sal_Int32 nCharSet = officecfg::Office::Calc::Dialogs::CSVExport::CharSet::get();
213 OUString strFieldSeparator = officecfg::Office::Calc::Dialogs::CSVExport::FieldSeparator::get();
214 OUString strTextSeparator = officecfg::Office::Calc::Dialogs::CSVExport::TextSeparator::get();
215 bool bSaveTrueCellContent = officecfg::Office::Calc::Dialogs::CSVExport::SaveTrueCellContent::get();
216 bool bSaveCellFormulas = officecfg::Office::Calc::Dialogs::CSVExport::SaveCellFormulas::get();
217 bool bQuoteAllTextCells = officecfg::Office::Calc::Dialogs::CSVExport::QuoteAllTextCells::get();
218 bool bFixedWidth = officecfg::Office::Calc::Dialogs::CSVExport::FixedWidth::get();
225 m_xCbShown->set_active( bSaveTrueCellContent );
232 if (strFieldSeparator.getLength() > 0)
234 if (strTextSeparator.getLength() > 0)
236 if (nCharSet < 0 || nCharSet == RTL_TEXTENCODING_DONTKNOW )
294 if (
aStr.isEmpty() )
303 nCode =
static_cast<sal_uInt16
>(
aStr[0]);
311 bool bEnable = !m_xCbFixed->get_active();
312 m_xFtFieldSep->set_sensitive( bEnable );
313 m_xEdFieldSep->set_sensitive( bEnable );
314 m_xFtTextSep->set_sensitive( bEnable );
315 m_xEdTextSep->set_sensitive( bEnable );
316 m_xCbShown->set_sensitive( bEnable );
317 m_xCbQuoteAll->set_sensitive( bEnable );
330 officecfg::Office::Calc::Dialogs::CSVExport::CharSet::set(nEncoding, batch);
331 officecfg::Office::Calc::Dialogs::CSVExport::FieldSeparator::set(
m_xEdFieldSep->get_active_text(), batch);
332 officecfg::Office::Calc::Dialogs::CSVExport::TextSeparator::set(
m_xEdTextSep->get_active_text(), batch);
333 officecfg::Office::Calc::Dialogs::CSVExport::FixedWidth::set(
m_xCbFixed->get_active(), batch);
334 officecfg::Office::Calc::Dialogs::CSVExport::SaveCellFormulas::set(
m_xCbFormulas->get_active(), batch);
335 officecfg::Office::Calc::Dialogs::CSVExport::SaveTrueCellContent::set(
m_xCbShown->get_active(), batch);
336 officecfg::Office::Calc::Dialogs::CSVExport::QuoteAllTextCells::set(
m_xCbQuoteAll->get_active(), batch);
Reference< XExecutableDialog > m_xDialog
ScDelimiterTable(OUString aDelTab)
sal_uInt16 GetCode(std::u16string_view rDelimiter) const
static constexpr sal_Unicode cSep
OUString GetDelimiter(sal_Unicode nCode) const
std::unique_ptr< weld::CheckButton > m_xCbFixed
std::unique_ptr< weld::Label > m_xFtFieldSep
std::unique_ptr< weld::ComboBox > m_xEdFieldSep
std::unique_ptr< weld::CheckButton > m_xCbQuoteAll
ScImportOptionsDlg(weld::Window *pParent, bool bAscii, const ScImportOptions *pOptions, const OUString *pStrTitle, bool bMultiByte, bool bOnlyDbtoolsEncodings, bool bImport)
std::unique_ptr< weld::Label > m_xFtTextSep
std::unique_ptr< weld::Widget > m_xEncGrid
std::unique_ptr< weld::CheckButton > m_xCbShown
void FillFromDbTextEncodingMap(bool bExcludeImportSubsets, sal_uInt32 nExcludeInfoFlags=0)
std::unique_ptr< weld::ComboBox > m_xEdTextSep
std::unique_ptr< ScDelimiterTable > pTextSepTab
std::unique_ptr< SvxTextEncodingBox > m_xLbCharset
std::unique_ptr< SvxTextEncodingTreeView > m_xTvCharset
std::unique_ptr< weld::Label > m_xFtCharset
void GetImportOptions(ScImportOptions &rOptions) const
std::unique_ptr< ScDelimiterTable > pFieldSepTab
virtual ~ScImportOptionsDlg() override
std::unique_ptr< weld::CheckButton > m_xCbFormulas
sal_uInt16 GetCodeFromCombo(const weld::ComboBox &rEd) const
void SaveImportOptions() const
std::unique_ptr< weld::Frame > m_xFieldFrame
void FillFromTextEncodingTable(bool bExcludeImportSubsets, sal_uInt32 nExcludeInfoFlags=0)
void SetTextEncoding(rtl_TextEncoding nEnc)
sal_Unicode nFieldSepCode
rtl_TextEncoding eCharSet
static std::shared_ptr< ConfigurationChanges > create()
virtual OUString get_active_text() const=0
std::shared_ptr< weld::Dialog > m_xDialog
#define LINK(Instance, Class, Member)
sal_Int32 toInt32(std::u16string_view str, sal_Int16 radix=10)
std::basic_string_view< charT, traits > getToken(std::basic_string_view< charT, traits > sv, charT delimiter, std::size_t &position)
OUString ScResId(TranslateId aId)
IMPL_LINK_NOARG(ScImportOptionsDlg, FixedWidthHdl, weld::Toggleable &, void)
constexpr OUStringLiteral SCSTR_FIELDSEP
constexpr OUStringLiteral SCSTR_TEXTSEP