[Libreoffice-commits] core.git: sc/inc sc/source

Eike Rathke erack at redhat.com
Fri Feb 16 22:59:43 UTC 2018


 sc/inc/global.hxx                  |    3 +++
 sc/source/ui/docshell/arealink.cxx |    2 +-
 sc/source/ui/docshell/docsh.cxx    |    2 +-
 sc/source/ui/miscdlgs/linkarea.cxx |    2 +-
 sc/source/ui/vba/vbaworkbook.cxx   |    4 ++--
 sc/source/ui/vba/vbaworkbooks.cxx  |    2 +-
 6 files changed, 9 insertions(+), 6 deletions(-)

New commits:
commit b87fe45e8b087a315a65b92bf9c168b1e4c5cc00
Author: Eike Rathke <erack at redhat.com>
Date:   Fri Feb 16 23:52:04 2018 +0100

    Consolidate the dreaded "Text - txt - csv (StarCalc)" filter name
    
    ... into one define SC_TEXT_CSV_FILTER_NAME. This might prevent
    typos and doesn't look as ugly.
    
    Change-Id: If954852e5e6673331b29c4994f9d97c77b6564a6

diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 438cfe804b44..78600a827954 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -50,6 +50,9 @@ enum class SvNumFormatType : sal_Int16;
 
 #define STRING_STANDARD "Standard"
 
+// Have the dreaded programmatic filter name defined in one place.
+#define SC_TEXT_CSV_FILTER_NAME "Text - txt - csv (StarCalc)"
+
 // characters
 
 const sal_Unicode CHAR_NBSP     = 0x00A0;
diff --git a/sc/source/ui/docshell/arealink.cxx b/sc/source/ui/docshell/arealink.cxx
index 81e2c7cf5b0d..63ea2ad325f0 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -272,7 +272,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
     SCROW nHeight = 0;
     ScRangeList aSourceRanges;
 
-    if (rNewFilter == "Text - txt - csv (StarCalc)" && aTempArea == "CSV_all")
+    if (rNewFilter == SC_TEXT_CSV_FILTER_NAME && aTempArea == "CSV_all")
     {
         // The dummy All range. All data, including top/left empty
         // rows/columns.
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 8d1117af8d48..7815e68d5566 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -145,7 +145,7 @@ using ::std::vector;
 
 static const sal_Char pFilterSc50[]     = "StarCalc 5.0";
 static const sal_Char pFilterXML[]      = "StarOffice XML (Calc)";
-static const sal_Char pFilterAscii[]    = "Text - txt - csv (StarCalc)";
+static const sal_Char pFilterAscii[]    = SC_TEXT_CSV_FILTER_NAME;
 static const sal_Char pFilterLotus[]    = "Lotus";
 static const sal_Char pFilterQPro6[]    = "Quattro Pro 6.0";
 static const sal_Char pFilterExcel4[]   = "MS Excel 4.0";
diff --git a/sc/source/ui/miscdlgs/linkarea.cxx b/sc/source/ui/miscdlgs/linkarea.cxx
index 96f613ffa7a1..c66534c91839 100644
--- a/sc/source/ui/miscdlgs/linkarea.cxx
+++ b/sc/source/ui/miscdlgs/linkarea.cxx
@@ -258,7 +258,7 @@ void ScLinkedAreaDlg::UpdateSourceRanges()
     if ( pSourceShell )
     {
         std::shared_ptr<const SfxFilter> pFilter = pSourceShell->GetMedium()->GetFilter();
-        if (pFilter && pFilter->GetFilterName() == "Text - txt - csv (StarCalc)")
+        if (pFilter && pFilter->GetFilterName() == SC_TEXT_CSV_FILTER_NAME)
         {
             // Insert dummy All range to have something selectable.
             m_pLbRanges->InsertEntry("CSV_all");
diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx
index 978915ef71d6..f0a6432df330 100644
--- a/sc/source/ui/vba/vbaworkbook.cxx
+++ b/sc/source/ui/vba/vbaworkbook.cxx
@@ -103,7 +103,7 @@ bool ScVbaWorkbook::setFilterPropsFromFormat( sal_Int32 nFormat, uno::Sequence<
             switch( nFormat )
             {
                 case excel::XlFileFormat::xlCSV:
-                    rProps[ index ].Value <<= OUString("Text - txt - csv (StarCalc)");
+                    rProps[ index ].Value <<= OUString(SC_TEXT_CSV_FILTER_NAME);
                     break;
                 case excel::XlFileFormat::xlDBF4:
                     rProps[ index ].Value <<= OUString("DBF");
@@ -150,7 +150,7 @@ ScVbaWorkbook::getFileFormat(  )
            aArgs[1].Value >>= aFilterName;
         }
 
-        if (aFilterName == "Text - txt - csv (StarCalc)") {
+        if (aFilterName == SC_TEXT_CSV_FILTER_NAME) {
             aFileFormat = excel::XlFileFormat::xlCSV; //xlFileFormat.
         }
 
diff --git a/sc/source/ui/vba/vbaworkbooks.cxx b/sc/source/ui/vba/vbaworkbooks.cxx
index 1fd605d8b972..fa12faae8f1e 100644
--- a/sc/source/ui/vba/vbaworkbooks.cxx
+++ b/sc/source/ui/vba/vbaworkbooks.cxx
@@ -254,7 +254,7 @@ ScVbaWorkbooks::Open( const OUString& rFileName, const uno::Any& /*UpdateLinks*/
         sFormat = OUString::number( nDelim ) + ",34,0,1";
         sProps[ nIndex++ ].Value <<= sFormat;
         sProps[ nIndex ].Name = "FilterName";
-        sProps[ nIndex++ ].Value <<= OUString( "Text - txt - csv (StarCalc)" );
+        sProps[ nIndex++ ].Value <<= OUString( SC_TEXT_CSV_FILTER_NAME );
         // Ensure WORKAROUND_CSV_TXT_BUG_i60158 gets called in typedetection.cxx so
         // csv is forced for deep detected 'writerxxx' types
         sProps[ nIndex ].Name = "DocumentService";


More information about the Libreoffice-commits mailing list