[Libreoffice-commits] core.git: Branch 'private/swe/libreoffice-5-2+backports' - officecfg/registry sc/inc sc/Library_scui.mk sc/source

Bernhard Widl bernhard.widl at cib.de
Wed Nov 22 15:51:47 UTC 2017


 officecfg/registry/schema/org/openoffice/Office/Calc.xcs |   54 +++++++++++++++
 sc/Library_scui.mk                                       |    4 +
 sc/inc/scabstdlg.hxx                                     |    1 
 sc/source/ui/attrdlg/scdlgfact.cxx                       |    5 +
 sc/source/ui/attrdlg/scdlgfact.hxx                       |    1 
 sc/source/ui/dbgui/scuiimoptdlg.cxx                      |   49 +++++++++++--
 sc/source/ui/inc/scuiimoptdlg.hxx                        |    4 -
 sc/source/ui/unoobj/filtuno.cxx                          |    1 
 8 files changed, 109 insertions(+), 10 deletions(-)

New commits:
commit ac4072fe932b0ebfd9283f3b8da2b3ffdaded028
Author: Bernhard Widl <bernhard.widl at cib.de>
Date:   Wed Apr 5 14:41:22 2017 +0200

    tdf#55236 save settings of CSV export dialog
    
    Change-Id: I250e2d8d9d7b7b806a60fb2779321685e84b44bf
    Reviewed-on: https://gerrit.libreoffice.org/36144
    Reviewed-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>
    Tested-by: Thorsten Behrens <Thorsten.Behrens at CIB.de>

diff --git a/officecfg/registry/schema/org/openoffice/Office/Calc.xcs b/officecfg/registry/schema/org/openoffice/Office/Calc.xcs
index bd17f4aa8153..0f732969278d 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 4f946f771cd7..9fd86f5fb265 100644
--- a/sc/inc/scabstdlg.hxx
+++ b/sc/inc/scabstdlg.hxx
@@ -313,6 +313,7 @@ class AbstractScImportOptionsDlg : public VclAbstractDialog
 {
 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 6bf050d4c0cb..d257401560cc 100644
--- a/sc/source/ui/attrdlg/scdlgfact.cxx
+++ b/sc/source/ui/attrdlg/scdlgfact.cxx
@@ -587,6 +587,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 ea9ea53f925f..62fa40ad5f23 100644
--- a/sc/source/ui/attrdlg/scdlgfact.hxx
+++ b/sc/source/ui/attrdlg/scdlgfact.hxx
@@ -365,6 +365,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 114ec3c88e5f..f807606f3824 100644
--- a/sc/source/ui/dbgui/scuiimoptdlg.cxx
+++ b/sc/source/ui/dbgui/scuiimoptdlg.cxx
@@ -24,6 +24,7 @@
 #include "scresid.hxx"
 #include "sc.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() );
 
     // optionaler Titel:
     if ( pStrTitle )
@@ -326,4 +344,17 @@ IMPL_LINK_TYPED( 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 9848e332e1f0..be4d7da0697c 100644
--- a/sc/source/ui/inc/scuiimoptdlg.hxx
+++ b/sc/source/ui/inc/scuiimoptdlg.hxx
@@ -39,7 +39,9 @@ public:
     virtual ~ScImportOptionsDlg();
     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:
     VclPtr<VclFrame>           m_pFieldFrame;
diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx
index 96f74ce7b949..1ee2b3665d07 100644
--- a/sc/source/ui/unoobj/filtuno.cxx
+++ b/sc/source/ui/unoobj/filtuno.cxx
@@ -283,6 +283,7 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute() throw(uno::RuntimeException, st
         OSL_ENSURE(pDlg, "Dialog create fail!");
         if ( pDlg->Execute() == RET_OK )
         {
+            pDlg->SaveImportOptions();
             pDlg->GetImportOptions( aOptions );
             save_CharSet( aOptions.eCharSet, bExport );
             if ( bAscii )


More information about the Libreoffice-commits mailing list