summaryrefslogtreecommitdiff
path: root/sc
diff options
context:
space:
mode:
authorBernhard Widl <bernhard.widl@cib.de>2017-04-05 14:41:22 +0200
committerThorsten Behrens <Thorsten.Behrens@CIB.de>2017-04-06 22:07:51 +0000
commit781c026f98c848025f313940c94cbd4553259901 (patch)
treee09cbbe9b841f5ec691cbf9e233442fed4a82c61 /sc
parent26030f92629b310e66b2335c2cec0413bb7ec828 (diff)
tdf#55236 save settings of CSV export dialog
Change-Id: I250e2d8d9d7b7b806a60fb2779321685e84b44bf Reviewed-on: https://gerrit.libreoffice.org/36144 Reviewed-by: Thorsten Behrens <Thorsten.Behrens@CIB.de> Tested-by: Thorsten Behrens <Thorsten.Behrens@CIB.de>
Diffstat (limited to 'sc')
-rw-r--r--sc/Library_scui.mk4
-rw-r--r--sc/inc/scabstdlg.hxx1
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.cxx5
-rw-r--r--sc/source/ui/attrdlg/scdlgfact.hxx1
-rw-r--r--sc/source/ui/dbgui/scuiimoptdlg.cxx49
-rw-r--r--sc/source/ui/inc/scuiimoptdlg.hxx3
-rw-r--r--sc/source/ui/unoobj/filtuno.cxx1
7 files changed, 54 insertions, 10 deletions
diff --git a/sc/Library_scui.mk b/sc/Library_scui.mk
index e694885aa13b..4b911d6846b1 100644
--- a/sc/Library_scui.mk
+++ b/sc/Library_scui.mk
@@ -18,6 +18,10 @@ $(eval $(call gb_Library_set_include,scui,\
$$(INCLUDE) \
))
+$(eval $(call gb_Library_use_custom_headers,scui,\
+ officecfg/registry \
+)) \
+
$(eval $(call gb_Library_set_precompiled_header,scui,$(SRCDIR)/sc/inc/pch/precompiled_scui))
$(eval $(call gb_Library_use_sdk_api,scui))
diff --git a/sc/inc/scabstdlg.hxx b/sc/inc/scabstdlg.hxx
index 7e4f992dd900..96d154991f4e 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -380,6 +380,7 @@ protected:
virtual ~AbstractScImportOptionsDlg() override = default;
public:
virtual void GetImportOptions( ScImportOptions& rOptions ) const = 0;
+ virtual void SaveImportOptions() const = 0;
};
class AbstractScTextImportOptionsDlg : public VclAbstractDialog
diff --git a/sc/source/ui/attrdlg/scdlgfact.cxx b/sc/source/ui/attrdlg/scdlgfact.cxx
index 61efb1bb4be4..74f9bb1aeb38 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -593,6 +593,11 @@ void AbstractScImportOptionsDlg_Impl::GetImportOptions( ScImportOptions& rOption
pDlg->GetImportOptions(rOptions);
}
+void AbstractScImportOptionsDlg_Impl::SaveImportOptions() const
+{
+ pDlg->SaveImportOptions();
+}
+
LanguageType AbstractScTextImportOptionsDlg_Impl::GetLanguageType() const
{
return pDlg->getLanguageType();
diff --git a/sc/source/ui/attrdlg/scdlgfact.hxx b/sc/source/ui/attrdlg/scdlgfact.hxx
index feeca4df5377..0970af51a622 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -384,6 +384,7 @@ class AbstractScImportOptionsDlg_Impl : public AbstractScImportOptionsDlg
{
DECL_ABSTDLG_BASE( AbstractScImportOptionsDlg_Impl, ScImportOptionsDlg)
virtual void GetImportOptions( ScImportOptions& rOptions ) const override;
+ virtual void SaveImportOptions() const override;
};
class AbstractScTextImportOptionsDlg_Impl : public AbstractScTextImportOptionsDlg
diff --git a/sc/source/ui/dbgui/scuiimoptdlg.cxx b/sc/source/ui/dbgui/scuiimoptdlg.cxx
index 38ec2fbdf6c8..0f9079e728f1 100644
--- a/sc/source/ui/dbgui/scuiimoptdlg.cxx
+++ b/sc/source/ui/dbgui/scuiimoptdlg.cxx
@@ -24,6 +24,7 @@
#include "scresid.hxx"
#include "scres.hrc"
#include <comphelper/string.hxx>
+#include <officecfg/Office/Calc.hxx>
#include <osl/thread.h>
#include <rtl/tencinfo.h>
@@ -202,18 +203,34 @@ ScImportOptionsDlg::ScImportOptionsDlg(
if( bAscii )
{
+ sal_Int32 nCharSet = officecfg::Office::Calc::Dialogs::CSVExport::CharSet::get();
+ OUString strFieldSeparator = officecfg::Office::Calc::Dialogs::CSVExport::FieldSeparator::get();
+ OUString strTextSeparator = officecfg::Office::Calc::Dialogs::CSVExport::TextSeparator::get();
+ bool bSaveTrueCellContent = officecfg::Office::Calc::Dialogs::CSVExport::SaveTrueCellContent::get();
+ bool bSaveCellFormulas = officecfg::Office::Calc::Dialogs::CSVExport::SaveCellFormulas::get();
+ bool bQuoteAllTextCells = officecfg::Office::Calc::Dialogs::CSVExport::QuoteAllTextCells::get();
+ bool bFixedWidth = officecfg::Office::Calc::Dialogs::CSVExport::FixedWidth::get();
+
m_pCbFixed->Show();
m_pCbFixed->SetClickHdl( LINK( this, ScImportOptionsDlg, FixedWidthHdl ) );
- m_pCbFixed->Check( false );
+ m_pCbFixed->Check( bFixedWidth );
+ FixedWidthHdl(m_pCbFixed);
m_pCbShown->Show();
- m_pCbShown->Check();
+ m_pCbShown->Check( bSaveTrueCellContent );
m_pCbQuoteAll->Show();
- m_pCbQuoteAll->Check( false );
+ m_pCbQuoteAll->Check( bQuoteAllTextCells );
m_pCbFormulas->Show();
- ScTabViewShell* pViewSh = dynamic_cast<ScTabViewShell*>( SfxViewShell::Current() );
- bool bFormulas = pViewSh &&
- pViewSh->GetViewData().GetOptions().GetOption( VOPT_FORMULAS);
- m_pCbFormulas->Check( bFormulas );
+ // default option for "save formulas" no longer taken from view shell but from persisted dialog settings
+ m_pCbFormulas->Check( bSaveCellFormulas );
+ // if no charset, text separator or field separator exist, keep the values from dialog initialization
+ if (strFieldSeparator.getLength() > 0)
+ m_pEdFieldSep->SetText( strFieldSeparator );
+ if (strTextSeparator.getLength() > 0)
+ m_pEdTextSep->SetText( strTextSeparator );
+ if (nCharSet < 0 || nCharSet == RTL_TEXTENCODING_DONTKNOW )
+ m_pLbCharset->SelectTextEncoding(pOptions ? pOptions->eCharSet : osl_getThreadTextEncoding());
+ else
+ m_pLbCharset->SelectTextEncoding(nCharSet);
}
else
{
@@ -229,10 +246,11 @@ ScImportOptionsDlg::ScImportOptionsDlg(
m_pCbFormulas->Hide();
m_pLbCharset->GrabFocus();
m_pLbCharset->SetDoubleClickHdl( LINK( this, ScImportOptionsDlg, DoubleClickHdl ) );
+
+ m_pLbCharset->SelectTextEncoding(pOptions ? pOptions->eCharSet :
+ osl_getThreadTextEncoding());
}
- m_pLbCharset->SelectTextEncoding( pOptions ? pOptions->eCharSet :
- osl_getThreadTextEncoding() );
// optional title:
if ( pStrTitle )
@@ -332,4 +350,17 @@ IMPL_LINK( ScImportOptionsDlg, DoubleClickHdl, ListBox&, rLb, void )
}
}
+void ScImportOptionsDlg::SaveImportOptions() const
+{
+ std::shared_ptr < comphelper::ConfigurationChanges > batch(comphelper::ConfigurationChanges::create());
+ officecfg::Office::Calc::Dialogs::CSVExport::CharSet::set(this->m_pLbCharset->GetSelectTextEncoding(), batch);
+ officecfg::Office::Calc::Dialogs::CSVExport::FieldSeparator::set(m_pEdFieldSep->GetText(), batch);
+ officecfg::Office::Calc::Dialogs::CSVExport::TextSeparator::set(m_pEdTextSep->GetText(), batch);
+ officecfg::Office::Calc::Dialogs::CSVExport::FixedWidth::set(m_pCbFixed->IsChecked(), batch);
+ officecfg::Office::Calc::Dialogs::CSVExport::SaveCellFormulas::set(m_pCbFormulas->IsChecked(), batch);
+ officecfg::Office::Calc::Dialogs::CSVExport::SaveTrueCellContent::set(m_pCbShown->IsChecked(), batch);
+ officecfg::Office::Calc::Dialogs::CSVExport::QuoteAllTextCells::set(m_pCbQuoteAll->IsChecked(), batch);
+ batch->commit();
+}
+
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sc/source/ui/inc/scuiimoptdlg.hxx b/sc/source/ui/inc/scuiimoptdlg.hxx
index 02b842ffc36b..76fa5deb9693 100644
--- a/sc/source/ui/inc/scuiimoptdlg.hxx
+++ b/sc/source/ui/inc/scuiimoptdlg.hxx
@@ -39,7 +39,8 @@ public:
virtual ~ScImportOptionsDlg() override;
virtual void dispose() override;
- void GetImportOptions( ScImportOptions& rOptions ) const;
+ virtual void GetImportOptions( ScImportOptions& rOptions ) const;
+ virtual void SaveImportOptions() const;
virtual OString GetScreenshotId() const override;
private:
diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx
index be27823aaa70..b24219ae6017 100644
--- a/sc/source/ui/unoobj/filtuno.cxx
+++ b/sc/source/ui/unoobj/filtuno.cxx
@@ -281,6 +281,7 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute()
OSL_ENSURE(pDlg, "Dialog create fail!");
if ( pDlg->Execute() == RET_OK )
{
+ pDlg->SaveImportOptions();
pDlg->GetImportOptions( aOptions );
save_CharSet( aOptions.eCharSet, bExport );
if ( bAscii )