Kaydet (Commit) b87fe45e authored tarafından Eike Rathke's avatar Eike Rathke

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
üst f0c25c75
...@@ -50,6 +50,9 @@ enum class SvNumFormatType : sal_Int16; ...@@ -50,6 +50,9 @@ enum class SvNumFormatType : sal_Int16;
#define STRING_STANDARD "Standard" #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 // characters
const sal_Unicode CHAR_NBSP = 0x00A0; const sal_Unicode CHAR_NBSP = 0x00A0;
......
...@@ -272,7 +272,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter, ...@@ -272,7 +272,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const OUString& rNewFilter,
SCROW nHeight = 0; SCROW nHeight = 0;
ScRangeList aSourceRanges; 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 // The dummy All range. All data, including top/left empty
// rows/columns. // rows/columns.
......
...@@ -145,7 +145,7 @@ using ::std::vector; ...@@ -145,7 +145,7 @@ using ::std::vector;
static const sal_Char pFilterSc50[] = "StarCalc 5.0"; static const sal_Char pFilterSc50[] = "StarCalc 5.0";
static const sal_Char pFilterXML[] = "StarOffice XML (Calc)"; 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 pFilterLotus[] = "Lotus";
static const sal_Char pFilterQPro6[] = "Quattro Pro 6.0"; static const sal_Char pFilterQPro6[] = "Quattro Pro 6.0";
static const sal_Char pFilterExcel4[] = "MS Excel 4.0"; static const sal_Char pFilterExcel4[] = "MS Excel 4.0";
......
...@@ -258,7 +258,7 @@ void ScLinkedAreaDlg::UpdateSourceRanges() ...@@ -258,7 +258,7 @@ void ScLinkedAreaDlg::UpdateSourceRanges()
if ( pSourceShell ) if ( pSourceShell )
{ {
std::shared_ptr<const SfxFilter> pFilter = pSourceShell->GetMedium()->GetFilter(); 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. // Insert dummy All range to have something selectable.
m_pLbRanges->InsertEntry("CSV_all"); m_pLbRanges->InsertEntry("CSV_all");
......
...@@ -103,7 +103,7 @@ bool ScVbaWorkbook::setFilterPropsFromFormat( sal_Int32 nFormat, uno::Sequence< ...@@ -103,7 +103,7 @@ bool ScVbaWorkbook::setFilterPropsFromFormat( sal_Int32 nFormat, uno::Sequence<
switch( nFormat ) switch( nFormat )
{ {
case excel::XlFileFormat::xlCSV: case excel::XlFileFormat::xlCSV:
rProps[ index ].Value <<= OUString("Text - txt - csv (StarCalc)"); rProps[ index ].Value <<= OUString(SC_TEXT_CSV_FILTER_NAME);
break; break;
case excel::XlFileFormat::xlDBF4: case excel::XlFileFormat::xlDBF4:
rProps[ index ].Value <<= OUString("DBF"); rProps[ index ].Value <<= OUString("DBF");
...@@ -150,7 +150,7 @@ ScVbaWorkbook::getFileFormat( ) ...@@ -150,7 +150,7 @@ ScVbaWorkbook::getFileFormat( )
aArgs[1].Value >>= aFilterName; aArgs[1].Value >>= aFilterName;
} }
if (aFilterName == "Text - txt - csv (StarCalc)") { if (aFilterName == SC_TEXT_CSV_FILTER_NAME) {
aFileFormat = excel::XlFileFormat::xlCSV; //xlFileFormat. aFileFormat = excel::XlFileFormat::xlCSV; //xlFileFormat.
} }
......
...@@ -254,7 +254,7 @@ ScVbaWorkbooks::Open( const OUString& rFileName, const uno::Any& /*UpdateLinks*/ ...@@ -254,7 +254,7 @@ ScVbaWorkbooks::Open( const OUString& rFileName, const uno::Any& /*UpdateLinks*/
sFormat = OUString::number( nDelim ) + ",34,0,1"; sFormat = OUString::number( nDelim ) + ",34,0,1";
sProps[ nIndex++ ].Value <<= sFormat; sProps[ nIndex++ ].Value <<= sFormat;
sProps[ nIndex ].Name = "FilterName"; 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 // Ensure WORKAROUND_CSV_TXT_BUG_i60158 gets called in typedetection.cxx so
// csv is forced for deep detected 'writerxxx' types // csv is forced for deep detected 'writerxxx' types
sProps[ nIndex ].Name = "DocumentService"; sProps[ nIndex ].Name = "DocumentService";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment