20 #undef SC_DLLIMPLEMENTATION
24 #include <strings.hrc>
25 #include <strings.hxx>
26 #include <officecfg/Office/Calc.hxx>
27 #include <osl/thread.h>
28 #include <rtl/tencinfo.h>
42 sal_uInt16
GetCode( std::u16string_view rDelimiter )
const;
61 if (rDel !=
theDelTab.getToken( 0, cSep, nIdx ))
62 while (nIdx>0 && rDel !=
theDelTab.getToken( 1, cSep, nIdx ));
79 sal_Int32 nPrevIdx {nIdx};
80 if (nCode == static_cast<sal_Unicode>(
theDelTab.getToken( 1, cSep, nIdx ).toInt32()))
81 return theDelTab.getToken( 0, cSep, nPrevIdx );
92 m_xLbCharset->FillFromTextEncodingTable(bExcludeImportSubsets, nExcludeInfoFlags);
94 m_xTvCharset->FillFromTextEncodingTable(bExcludeImportSubsets, nExcludeInfoFlags);
100 m_xLbCharset->FillFromDbTextEncodingMap(bExcludeImportSubsets, nExcludeInfoFlags);
102 m_xTvCharset->FillFromDbTextEncodingMap(bExcludeImportSubsets, nExcludeInfoFlags);
108 const OUString* pStrTitle,
109 bool bMultiByte,
bool bOnlyDbtoolsEncodings,
111 : GenericDialogController(pParent,
"modules/scalc/ui/imoptdialog.ui",
"ImOptDialog")
112 , m_bIsAsciiImport(bAscii)
113 , m_xFieldFrame(m_xBuilder->weld_frame(
"fieldframe"))
114 , m_xFtCharset(m_xBuilder->weld_label(
"charsetft"))
115 , m_xEncGrid(m_xBuilder->weld_widget(
"grid2"))
116 , m_xFtFieldSep(m_xBuilder->weld_label(
"fieldft"))
117 , m_xEdFieldSep(m_xBuilder->weld_combo_box(
"field"))
118 , m_xFtTextSep(m_xBuilder->weld_label(
"textft"))
119 , m_xEdTextSep(m_xBuilder->weld_combo_box(
"text"))
120 , m_xCbShown(m_xBuilder->weld_check_button(
"asshown"))
121 , m_xCbFormulas(m_xBuilder->weld_check_button(
"formulas"))
122 , m_xCbQuoteAll(m_xBuilder->weld_check_button(
"quoteall"))
123 , m_xCbFixed(m_xBuilder->weld_check_button(
"fixedwidth"))
124 , m_xBtnOk(m_xBuilder->weld_button(
"ok"))
143 sFieldSep = sFieldSep.replaceFirst(
"%TAB",
ScResId(SCSTR_FIELDSEP_TAB) );
144 sFieldSep = sFieldSep.replaceFirst(
"%SPACE",
ScResId(SCSTR_FIELDSEP_SPACE) );
152 while (!aStr.isEmpty())
160 while (!aStr.isEmpty())
169 if ( bOnlyDbtoolsEncodings )
183 RTL_TEXTENCODING_INFO_MULTIBYTE );
192 if ( aStr.isEmpty() )
200 if ( aStr.isEmpty() )
211 sal_Int32 nCharSet = officecfg::Office::Calc::Dialogs::CSVExport::CharSet::get();
212 OUString strFieldSeparator = officecfg::Office::Calc::Dialogs::CSVExport::FieldSeparator::get();
213 OUString strTextSeparator = officecfg::Office::Calc::Dialogs::CSVExport::TextSeparator::get();
214 bool bSaveTrueCellContent = officecfg::Office::Calc::Dialogs::CSVExport::SaveTrueCellContent::get();
215 bool bSaveCellFormulas = officecfg::Office::Calc::Dialogs::CSVExport::SaveCellFormulas::get();
216 bool bQuoteAllTextCells = officecfg::Office::Calc::Dialogs::CSVExport::QuoteAllTextCells::get();
217 bool bFixedWidth = officecfg::Office::Calc::Dialogs::CSVExport::FixedWidth::get();
224 m_xCbShown->set_active( bSaveTrueCellContent );
231 if (strFieldSeparator.getLength() > 0)
233 if (strTextSeparator.getLength() > 0)
235 if (nCharSet < 0 || nCharSet == RTL_TEXTENCODING_DONTKNOW )
293 if (
aStr.isEmpty() )
302 nCode =
static_cast<sal_uInt16
>(
aStr[0]);
310 bool bEnable = !m_xCbFixed->get_active();
311 m_xFtFieldSep->set_sensitive( bEnable );
312 m_xEdFieldSep->set_sensitive( bEnable );
313 m_xFtTextSep->set_sensitive( bEnable );
314 m_xEdTextSep->set_sensitive( bEnable );
315 m_xCbShown->set_sensitive( bEnable );
316 m_xCbQuoteAll->set_sensitive( bEnable );
329 officecfg::Office::Calc::Dialogs::CSVExport::CharSet::set(nEncoding, batch);
330 officecfg::Office::Calc::Dialogs::CSVExport::FieldSeparator::set(
m_xEdFieldSep->get_active_text(), batch);
331 officecfg::Office::Calc::Dialogs::CSVExport::TextSeparator::set(
m_xEdTextSep->get_active_text(), batch);
332 officecfg::Office::Calc::Dialogs::CSVExport::FixedWidth::set(
m_xCbFixed->get_active(), batch);
333 officecfg::Office::Calc::Dialogs::CSVExport::SaveCellFormulas::set(
m_xCbFormulas->get_active(), batch);
334 officecfg::Office::Calc::Dialogs::CSVExport::SaveTrueCellContent::set(
m_xCbShown->get_active(), batch);
335 officecfg::Office::Calc::Dialogs::CSVExport::QuoteAllTextCells::set(
m_xCbQuoteAll->get_active(), batch);
sal_Unicode nFieldSepCode
#define LINK(Instance, Class, Member)
std::shared_ptr< weld::Dialog > m_xDialog
ScImportOptionsDlg(weld::Window *pParent, bool bAscii, const ScImportOptions *pOptions, const OUString *pStrTitle, bool bMultiByte, bool bOnlyDbtoolsEncodings, bool bImport)
sal_uInt16 GetCodeFromCombo(const weld::ComboBox &rEd) const
IMPL_LINK_NOARG(ScImportOptionsDlg, FixedWidthHdl, weld::ToggleButton &, void)
std::unique_ptr< weld::Label > m_xFtCharset
std::unique_ptr< weld::CheckButton > m_xCbQuoteAll
std::unique_ptr< weld::CheckButton > m_xCbFixed
std::unique_ptr< ScDelimiterTable > pTextSepTab
std::unique_ptr< weld::ComboBox > m_xEdFieldSep
void GetImportOptions(ScImportOptions &rOptions) const
sal_uInt16 GetCode(std::u16string_view rDelimiter) const
std::unique_ptr< SvxTextEncodingBox > m_xLbCharset
static std::shared_ptr< ConfigurationChanges > create(css::uno::Reference< css::uno::XComponentContext > const &context=comphelper::getProcessComponentContext())
OUString GetDelimiter(sal_Unicode nCode) const
virtual ~ScImportOptionsDlg() override
void FillFromDbTextEncodingMap(bool bExcludeImportSubsets, sal_uInt32 nExcludeInfoFlags=0)
std::unique_ptr< weld::CheckButton > m_xCbFormulas
OUString ScResId(const char *pId)
std::unique_ptr< SvxTextEncodingTreeView > m_xTvCharset
void SaveImportOptions() const
std::unique_ptr< weld::CheckButton > m_xCbShown
void FillFromTextEncodingTable(bool bExcludeImportSubsets, sal_uInt32 nExcludeInfoFlags=0)
std::unique_ptr< ScDelimiterTable > pFieldSepTab
std::unique_ptr< weld::ComboBox > m_xEdTextSep
std::unique_ptr< weld::Label > m_xFtTextSep
Reference< XExecutableDialog > m_xDialog
std::unique_ptr< weld::Widget > m_xEncGrid
void SetTextEncoding(rtl_TextEncoding nEnc)
rtl_TextEncoding eCharSet
ScDelimiterTable(const OUString &rDelTab)
std::unique_ptr< weld::Frame > m_xFieldFrame
std::unique_ptr< weld::Label > m_xFtFieldSep
virtual OUString get_active_text() const =0