summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--officecfg/registry/schema/org/openoffice/Office/Calc.xcs54
-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
8 files changed, 108 insertions, 10 deletions
diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
index d6426a3da049..f03fcae1e147 100644
--- a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
+++ b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
@@ -1023,6 +1023,60 @@
<value>-1</value>
</prop>
</group>
+ <group oor:name="CSVExport">
+ <info>
+ <desc>Contains setting for Text CSV Export</desc>
+ </info>
+ <prop oor:name="CharSet" oor:type="xs:int" oor:nillable="false">
+ <info>
+ <desc>Char Set</desc>
+ <label>CharSet</label>
+ </info>
+ <value>-1</value>
+ </prop>
+ <prop oor:name="FieldSeparator" oor:type="xs:string" oor:nillable="false">
+ <info>
+ <desc>Field delimiter</desc>
+ <label>FieldSeparator</label>
+ </info>
+ <value/>
+ </prop>
+ <prop oor:name="TextSeparator" oor:type="xs:string" oor:nillable="false">
+ <info>
+ <desc>Text delimiter</desc>
+ <label>TextSeparator</label>
+ </info>
+ <value/>
+ </prop>
+ <prop oor:name="SaveTrueCellContent" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc>If true, formatted cell content is exported. If false, raw cell content is exported.</desc>
+ <label>SaveTrueCellContent</label>
+ </info>
+ <value>true</value>
+ </prop>
+ <prop oor:name="SaveCellFormulas" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc>If true, text formulas are exported instead of the calculated values.</desc>
+ <label>SaveCellFormulas</label>
+ </info>
+ <value>false</value>
+ </prop>
+ <prop oor:name="QuoteAllTextCells" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc>If true, text cells are always enclosed in quotes with no exception.</desc>
+ <label>QuoteAllTextCells</label>
+ </info>
+ <value>false</value>
+ </prop>
+ <prop oor:name="FixedWidth" oor:type="xs:boolean" oor:nillable="false">
+ <info>
+ <desc>All fields are exported having the same width</desc>
+ <label>FixedWidth</label>
+ </info>
+ <value>false</value>
+ </prop>
+ </group>
<group oor:name="CSVImport">
<info>
<desc>Contains setting for Text CSV Import</desc>
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 )