sc/inc/global.hxx                         |   18 ++++
 sc/qa/unit/filters-test.cxx               |    6 -
 sc/source/filter/oox/querytablebuffer.cxx |    5 -
 sc/source/ui/docshell/arealink.cxx        |    2 
 sc/source/ui/docshell/docsh.cxx           |  124 ++++++++----------------------
 sc/source/ui/docshell/tablink.cxx         |    2 
 sc/source/ui/inc/docsh.hxx                |    7 -
 sc/source/ui/miscdlgs/linkarea.cxx        |   11 --
 sc/source/ui/unoobj/exceldetect.cxx       |   10 +-
 sc/source/ui/unoobj/filtuno.cxx           |   12 +-
 sc/source/ui/unoobj/scdetect.cxx          |   16 ++-
 sc/source/ui/vba/vbaworkbook.cxx          |   28 +++---
 12 files changed, 98 insertions(+), 143 deletions(-)

New commits:
commit 2846cc2fae0b0e07404c3d035cc0516edd37c8c9
Author:     Mike Kaganski <[email protected]>
AuthorDate: Sun Dec 14 13:12:58 2025 +0500
Commit:     Mike Kaganski <[email protected]>
CommitDate: Sun Dec 14 12:55:44 2025 +0100

    Move filter names from docsh.cxx to global.hxx
    
    ... and drop static methods from ScDocShell, that just return the
    constant names. Use the new constants consistently.
    
    Change-Id: I34bb9eb998855a9732bac3be5445df8df6f8416b
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/195619
    Reviewed-by: Mike Kaganski <[email protected]>
    Tested-by: Jenkins

diff --git a/sc/inc/global.hxx b/sc/inc/global.hxx
index 2bd3d499bef7..4f53eede8bb8 100644
--- a/sc/inc/global.hxx
+++ b/sc/inc/global.hxx
@@ -63,6 +63,24 @@ inline constexpr OUString STRING_STANDARD = u"Standard"_ustr;
 
 // Have the dreaded programmatic filter name defined in one place.
 inline constexpr OUString SC_TEXT_CSV_FILTER_NAME = u"Text - txt - csv 
(StarCalc)"_ustr;
+inline constexpr OUString SC_HTML_FILTER_NAME = u"HTML (StarCalc)"_ustr;
+inline constexpr OUString SC_HTML_WEBQ_FILTER_NAME = 
u"calc_HTML_WebQuery"_ustr;
+inline constexpr OUString SC_LOTUS_FILTER_NAME = u"Lotus"_ustr;
+inline constexpr OUString SC_DBASE_FILTER_NAME = u"dBase"_ustr;
+inline constexpr OUString SC_DIF_FILTER_NAME = u"DIF"_ustr;
+inline constexpr OUString SC_SC50_FILTER_NAME = u"StarCalc 5.0"_ustr;
+inline constexpr OUString SC_SOXML_FILTER_NAME = u"StarOffice XML (Calc)"_ustr;
+inline constexpr OUString SC_QPRO6_FILTER_NAME = u"Quattro Pro 6.0"_ustr;
+inline constexpr OUString SC_XL4_FILTER_NAME = u"MS Excel 4.0"_ustr;
+inline constexpr OUString SC_XL4TMPL_FILTER_NAME = u"MS Excel 4.0 
Vorlage/Template"_ustr;
+inline constexpr OUString SC_XL5_FILTER_NAME = u"MS Excel 5.0/95"_ustr;
+inline constexpr OUString SC_XL5TMPL_FILTER_NAME = u"MS Excel 5.0/95 
Vorlage/Template"_ustr;
+inline constexpr OUString SC_XL95_FILTER_NAME = u"MS Excel 95"_ustr;
+inline constexpr OUString SC_XL95TMPL_FILTER_NAME = u"MS Excel 95 
Vorlage/Template"_ustr;
+inline constexpr OUString SC_XL97_FILTER_NAME = u"MS Excel 97"_ustr;
+inline constexpr OUString SC_XL97TMPL_FILTER_NAME = u"MS Excel 97 
Vorlage/Template"_ustr;
+inline constexpr OUString SC_SYLK_FILTER_NAME = u"SYLK"_ustr;
+inline constexpr OUString SC_RTF_FILTER_NAME = u"Rich Text Format 
(StarCalc)"_ustr;
 
 // characters
 
diff --git a/sc/qa/unit/filters-test.cxx b/sc/qa/unit/filters-test.cxx
index ed9c5ef3ff66..0266daf6b55c 100644
--- a/sc/qa/unit/filters-test.cxx
+++ b/sc/qa/unit/filters-test.cxx
@@ -129,7 +129,7 @@ void ScFiltersTest::testTdf90299()
     aReferencingFileURL = aTmpDirectory1URL + "/tdf90299.xls";
     aReferencedFileURL = aTmpDirectory1URL + "/dummy.xls";
 
-    ScDocShellRef xShell = loadDoc(aReferencingFileURL, u"MS Excel 97"_ustr, 
OUString(), OUString(),
+    ScDocShellRef xShell = loadDoc(aReferencingFileURL, SC_XL97_FILTER_NAME, 
OUString(), OUString(),
             XLS_FORMAT_TYPE, SotClipboardFormatId::STARCALC_8);
 
     ScDocument& rDoc = xShell->GetDocument();
@@ -140,7 +140,7 @@ void ScFiltersTest::testTdf90299()
     SfxMedium aStoreMedium(aReferencingFileURL, StreamMode::STD_WRITE);
 
     auto pExportFilter = std::make_shared<SfxFilter>(
-        "MS Excel 97", OUString(), XLS_FORMAT_TYPE, 
SotClipboardFormatId::NONE, OUString(),
+        SC_XL97_FILTER_NAME, OUString(), XLS_FORMAT_TYPE, 
SotClipboardFormatId::NONE, OUString(),
         OUString(), OUString(), "private:factory/scalc*");
     pExportFilter->SetVersion(SOFFICE_FILEFORMAT_CURRENT);
 
@@ -155,7 +155,7 @@ void ScFiltersTest::testTdf90299()
     aReferencingFileURL = aTmpDirectory2URL + "/tdf90299.xls";
     aReferencedFileURL = aTmpDirectory2URL + "/dummy.xls";
 
-    xShell = loadDoc(aReferencingFileURL, u"MS Excel 97"_ustr, OUString(), 
OUString(),
+    xShell = loadDoc(aReferencingFileURL, SC_XL97_FILTER_NAME, OUString(), 
OUString(),
             XLS_FORMAT_TYPE, SotClipboardFormatId::STARCALC_8);
     ScDocument& rDoc2 = xShell->GetDocument();
     CPPUNIT_ASSERT_EQUAL(OUString("='" + aReferencedFileURL + "'#$Sheet1.A1"), 
rDoc2.GetFormula(0, 0, 0));
diff --git a/sc/source/filter/oox/querytablebuffer.cxx 
b/sc/source/filter/oox/querytablebuffer.cxx
index f027ab7a4d94..dc746a389eed 100644
--- a/sc/source/filter/oox/querytablebuffer.cxx
+++ b/sc/source/filter/oox/querytablebuffer.cxx
@@ -250,13 +250,12 @@ void QueryTable::finalizeImport()
         PropertySet aDocProps(( Reference< css::beans::XPropertySet 
>(getDocument()) ));
         Reference< XAreaLinks > xAreaLinks( aDocProps.getAnyProperty( 
PROP_AreaLinks ), UNO_QUERY_THROW );
         CellAddress aDestPos( aDestRange.aStart.Tab(), 
aDestRange.aStart.Col(), aDestRange.aStart.Row() );
-        static constexpr OUString aFilterName = u"calc_HTML_WebQuery"_ustr;
-        xAreaLinks->insertAtPosition( aDestPos, aFileUrl, aTables, 
aFilterName, /*aFilterOptions*/u""_ustr );
+        xAreaLinks->insertAtPosition( aDestPos, aFileUrl, aTables, 
SC_HTML_WEBQ_FILTER_NAME, /*aFilterOptions*/u""_ustr );
         // set refresh interval (convert minutes to seconds)
         sal_Int32 nRefreshPeriod = xConnection->getModel().mnInterval * 60;
         if( nRefreshPeriod > 0 )
         {
-            PropertySet aPropSet( lclFindAreaLink( xAreaLinks, 
aDestRange.aStart, aFileUrl, aTables, aFilterName, /*aFilterOptions*/u"" ) );
+            PropertySet aPropSet( lclFindAreaLink( xAreaLinks, 
aDestRange.aStart, aFileUrl, aTables, SC_HTML_WEBQ_FILTER_NAME, 
/*aFilterOptions*/u"" ) );
             aPropSet.setProperty( PROP_RefreshPeriod, nRefreshPeriod );
         }
     }
diff --git a/sc/source/ui/docshell/arealink.cxx 
b/sc/source/ui/docshell/arealink.cxx
index 95f7f04d3f02..0258a08f91d7 100644
--- a/sc/source/ui/docshell/arealink.cxx
+++ b/sc/source/ui/docshell/arealink.cxx
@@ -261,7 +261,7 @@ bool ScAreaLink::Refresh( const OUString& rNewFile, const 
OUString& rNewFilter,
     // correct source range name list for web query import
     OUString aTempArea;
 
-    if( rNewFilter == ScDocShell::GetWebQueryFilterName() )
+    if (rNewFilter == SC_HTML_WEBQ_FILTER_NAME)
         aTempArea = ScFormatFilter::Get().GetHTMLRangeNameList( rSrcDoc, 
rNewArea );
     else
         aTempArea = rNewArea;
diff --git a/sc/source/ui/docshell/docsh.cxx b/sc/source/ui/docshell/docsh.cxx
index 8313e7ada576..c3237e9a4d62 100644
--- a/sc/source/ui/docshell/docsh.cxx
+++ b/sc/source/ui/docshell/docsh.cxx
@@ -160,27 +160,6 @@ using namespace com::sun::star;
 using ::com::sun::star::uno::Reference;
 using ::com::sun::star::lang::XMultiServiceFactory;
 
-//  Filter names (like in sclib.cxx)
-
-constexpr OUStringLiteral pFilterSc50 = u"StarCalc 5.0";
-const char pFilterXML[]      = "StarOffice XML (Calc)";
-constexpr OUString pFilterLotus = u"Lotus"_ustr;
-const char pFilterQPro6[]    = "Quattro Pro 6.0";
-const char16_t pFilterExcel4[] = u"MS Excel 4.0";
-const char16_t pFilterEx4Temp[] = u"MS Excel 4.0 Vorlage/Template";
-const char pFilterExcel5[]   = "MS Excel 5.0/95";
-const char pFilterEx5Temp[]  = "MS Excel 5.0/95 Vorlage/Template";
-const char pFilterExcel95[]  = "MS Excel 95";
-const char pFilterEx95Temp[] = "MS Excel 95 Vorlage/Template";
-const char pFilterExcel97[]  = "MS Excel 97";
-const char pFilterEx97Temp[] = "MS Excel 97 Vorlage/Template";
-constexpr OUString pFilterDBase = u"dBase"_ustr;
-constexpr OUString pFilterDif = u"DIF"_ustr;
-const char16_t pFilterSylk[] = u"SYLK";
-constexpr OUString pFilterHtml = u"HTML (StarCalc)"_ustr;
-constexpr OUString pFilterHtmlWebQ = u"calc_HTML_WebQuery"_ustr;
-const char16_t pFilterRtf[]  = u"Rich Text Format (StarCalc)";
-
 #define ShellClass_ScDocShell
 #include <scslots.hxx>
 
@@ -1292,9 +1271,9 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium )
         if (!bCalc3 && !bCalc4)
             m_pDocument->SetInsertingFromOtherDoc( true );
 
-        if (aFltName == pFilterXML)
+        if (aFltName == SC_SOXML_FILTER_NAME)
             bRet = LoadXML( &rMedium, nullptr );
-        else if (aFltName == pFilterLotus)
+        else if (aFltName == SC_LOTUS_FILTER_NAME)
         {
             OUString sItStr;
             if ( const SfxStringItem* pOptionsItem = 
rMedium.GetItemSet().GetItemIfSet( SID_FILE_FILTEROPTIONS, true ) )
@@ -1324,18 +1303,18 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium )
             bSetColWidths = true;
             bSetRowHeights = true;
         }
-        else if ( aFltName == pFilterExcel4 || aFltName == pFilterExcel5 ||
-                   aFltName == pFilterExcel95 || aFltName == pFilterExcel97 ||
-                   aFltName == pFilterEx4Temp || aFltName == pFilterEx5Temp ||
-                   aFltName == pFilterEx95Temp || aFltName == pFilterEx97Temp )
+        else if ( aFltName == SC_XL4_FILTER_NAME || aFltName == 
SC_XL5_FILTER_NAME ||
+                   aFltName == SC_XL95_FILTER_NAME || aFltName == 
SC_XL97_FILTER_NAME ||
+                   aFltName == SC_XL4TMPL_FILTER_NAME || aFltName == 
SC_XL5TMPL_FILTER_NAME ||
+                   aFltName == SC_XL95TMPL_FILTER_NAME || aFltName == 
SC_XL97TMPL_FILTER_NAME )
         {
             EXCIMPFORMAT eFormat = EIF_AUTO;
-            if ( aFltName == pFilterExcel4 || aFltName == pFilterEx4Temp )
+            if (aFltName == SC_XL4_FILTER_NAME || aFltName == 
SC_XL4TMPL_FILTER_NAME)
                 eFormat = EIF_BIFF_LE4;
-            else if ( aFltName == pFilterExcel5 || aFltName == pFilterExcel95 
||
-                      aFltName == pFilterEx5Temp || aFltName == 
pFilterEx95Temp )
+            else if ( aFltName == SC_XL5_FILTER_NAME || aFltName == 
SC_XL95_FILTER_NAME ||
+                      aFltName == SC_XL5TMPL_FILTER_NAME || aFltName == 
SC_XL95TMPL_FILTER_NAME )
                 eFormat = EIF_BIFF5;
-            else if ( aFltName == pFilterExcel97 || aFltName == 
pFilterEx97Temp )
+            else if (aFltName == SC_XL97_FILTER_NAME || aFltName == 
SC_XL97TMPL_FILTER_NAME)
                 eFormat = EIF_BIFF8;
 
             MakeDrawLayer(); //! In the filter
@@ -1456,7 +1435,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium )
             bSetColWidths = true;
             bSetSimpleTextColWidths = true;
         }
-        else if (aFltName == pFilterDBase)
+        else if (aFltName == SC_DBASE_FILTER_NAME)
         {
             OUString sItStr;
             if ( const SfxStringItem* pOptionsItem = 
rMedium.GetItemSet().GetItemIfSet( SID_FILE_FILTEROPTIONS ) )
@@ -1491,7 +1470,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium )
             bSetColWidths = true;
             bSetSimpleTextColWidths = true;
         }
-        else if (aFltName == pFilterDif)
+        else if (aFltName == SC_DIF_FILTER_NAME)
         {
             SvStream* pStream = rMedium.GetInStream();
             if (pStream)
@@ -1528,7 +1507,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium )
             bSetSimpleTextColWidths = true;
             bSetRowHeights = true;
         }
-        else if (aFltName == pFilterSylk)
+        else if (aFltName == SC_SYLK_FILTER_NAME)
         {
             ErrCode eError = SCERR_IMPORT_UNKNOWN;
             bool bOverflowRow, bOverflowCol, bOverflowCell;
@@ -1576,7 +1555,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium )
             bSetSimpleTextColWidths = true;
             bSetRowHeights = true;
         }
-        else if (aFltName == pFilterQPro6)
+        else if (aFltName == SC_QPRO6_FILTER_NAME)
         {
             ErrCode eError = 
ScFormatFilter::Get().ScImportQuattroPro(rMedium.GetInStream(), *m_pDocument);
             if (eError != ERRCODE_NONE)
@@ -1594,7 +1573,7 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium )
             // wrapping enabled look nicer...
             bSetRowHeights = true;
         }
-        else if (aFltName == pFilterRtf)
+        else if (aFltName == SC_RTF_FILTER_NAME)
         {
             ErrCode eError = SCERR_IMPORT_UNKNOWN;
             if( !rMedium.IsStorage() )
@@ -1635,10 +1614,10 @@ bool ScDocShell::ConvertFrom( SfxMedium& rMedium )
                     bRet = true;
             }
         }
-        else if (aFltName == pFilterHtml || aFltName == pFilterHtmlWebQ)
+        else if (aFltName == SC_HTML_FILTER_NAME || aFltName == 
SC_HTML_WEBQ_FILTER_NAME)
         {
             ErrCode eError = SCERR_IMPORT_UNKNOWN;
-            bool bWebQuery = aFltName == pFilterHtmlWebQ;
+            bool bWebQuery = aFltName == SC_HTML_WEBQ_FILTER_NAME;
             if( !rMedium.IsStorage() )
             {
                 SvStream* pInStream = rMedium.GetInStream();
@@ -2468,15 +2447,15 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed )
     bool bRet = false;
     OUString aFltName = rMed.GetFilter()->GetFilterName();
 
-    if (aFltName == pFilterXML)
+    if (aFltName == SC_SOXML_FILTER_NAME)
     {
         //TODO/LATER: this shouldn't happen!
         OSL_FAIL("XML filter in ConvertFrom?!");
         bRet = SaveXML( &rMed, nullptr );
     }
-    else if (aFltName == pFilterExcel5 || aFltName == pFilterExcel95 ||
-             aFltName == pFilterExcel97 || aFltName == pFilterEx5Temp ||
-             aFltName == pFilterEx95Temp || aFltName == pFilterEx97Temp)
+    else if (aFltName == SC_XL5_FILTER_NAME || aFltName == SC_XL95_FILTER_NAME 
||
+             aFltName == SC_XL97_FILTER_NAME || aFltName == 
SC_XL5TMPL_FILTER_NAME ||
+             aFltName == SC_XL95TMPL_FILTER_NAME || aFltName == 
SC_XL97TMPL_FILTER_NAME)
     {
         weld::WaitObject aWait( GetActiveDialogParent() );
 
@@ -2516,7 +2495,7 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed )
         if( bDoSave )
         {
             ExportFormatExcel eFormat = ExpBiff5;
-            if( aFltName == pFilterExcel97 || aFltName == pFilterEx97Temp )
+            if (aFltName == SC_XL97_FILTER_NAME || aFltName == 
SC_XL97TMPL_FILTER_NAME)
                 eFormat = ExpBiff8;
             ErrCode eError = ScFormatFilter::Get().ScExportExcel5( rMed, 
m_pDocument.get(), eFormat, RTL_TEXTENCODING_MS_1252 );
 
@@ -2653,7 +2632,7 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed )
             }
         }
     }
-    else if (aFltName == pFilterDBase)
+    else if (aFltName == SC_DBASE_FILTER_NAME)
     {
         OUString sCharSet;
         if ( const SfxStringItem* pOptionsItem = 
rMed.GetItemSet().GetItemIfSet( SID_FILE_FILTEROPTIONS ) )
@@ -2722,7 +2701,7 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed )
                 SetError(eError);
         }
     }
-    else if (aFltName == pFilterDif)
+    else if (aFltName == SC_DIF_FILTER_NAME)
     {
         SvStream* pStream = rMed.GetOutStream();
         if (pStream)
@@ -2751,7 +2730,7 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed )
                     rMed.SetError(SCWARN_EXPORT_ASCII);
         }
     }
-    else if (aFltName == pFilterSylk)
+    else if (aFltName == SC_SYLK_FILTER_NAME)
     {
         SvStream* pStream = rMed.GetOutStream();
         if ( pStream )
@@ -2768,7 +2747,7 @@ bool ScDocShell::ConvertTo( SfxMedium &rMed )
             bRet = aImExport.ExportStream( *pStream, rMed.GetBaseURL( true ), 
SotClipboardFormatId::SYLK );
         }
     }
-    else if (aFltName == pFilterHtml)
+    else if (aFltName == SC_HTML_FILTER_NAME)
     {
         SvStream* pStream = rMed.GetOutStream();
         if ( pStream )
@@ -2900,55 +2879,20 @@ bool ScDocShell::PrepareClose( bool bUI )
     return bRet;
 }
 
-OUString ScDocShell::GetOwnFilterName()
-{
-    return pFilterSc50;
-}
-
-const OUString & ScDocShell::GetHtmlFilterName()
-{
-    return pFilterHtml;
-}
-
-const OUString & ScDocShell::GetWebQueryFilterName()
-{
-    return pFilterHtmlWebQ;
-}
-
-const OUString & ScDocShell::GetAsciiFilterName()
-{
-    return SC_TEXT_CSV_FILTER_NAME;
-}
-
-const OUString & ScDocShell::GetLotusFilterName()
-{
-    return pFilterLotus;
-}
-
-const OUString & ScDocShell::GetDBaseFilterName()
-{
-    return pFilterDBase;
-}
-
-const OUString & ScDocShell::GetDifFilterName()
-{
-    return pFilterDif;
-}
-
 bool ScDocShell::HasAutomaticTableName( std::u16string_view rFilter )
 {
     //  sal_True for those filters that keep the default table name
     //  (which is language specific)
 
     return rFilter == SC_TEXT_CSV_FILTER_NAME
-        || rFilter == pFilterLotus
-        || rFilter == pFilterExcel4
-        || rFilter == pFilterEx4Temp
-        || rFilter == pFilterDBase
-        || rFilter == pFilterDif
-        || rFilter == pFilterSylk
-        || rFilter == pFilterHtml
-        || rFilter == pFilterRtf;
+        || rFilter == SC_LOTUS_FILTER_NAME
+        || rFilter == SC_XL4_FILTER_NAME
+        || rFilter == SC_XL4TMPL_FILTER_NAME
+        || rFilter == SC_DBASE_FILTER_NAME
+        || rFilter == SC_DIF_FILTER_NAME
+        || rFilter == SC_SYLK_FILTER_NAME
+        || rFilter == SC_HTML_FILTER_NAME
+        || rFilter == SC_RTF_FILTER_NAME;
 }
 
 std::unique_ptr<ScDocFunc> ScDocShell::CreateDocFunc()
diff --git a/sc/source/ui/docshell/tablink.cxx 
b/sc/source/ui/docshell/tablink.cxx
index 4babed2103ed..8d3525c4e9c4 100644
--- a/sc/source/ui/docshell/tablink.cxx
+++ b/sc/source/ui/docshell/tablink.cxx
@@ -441,7 +441,7 @@ bool ScDocumentLoader::GetFilterName( const OUString& 
rFileName,
         if ( pSfxFilter )
             rFilter = pSfxFilter->GetFilterName();
         else
-            rFilter = ScDocShell::GetOwnFilterName();       //  otherwise Calc 
file
+            rFilter = SC_SC50_FILTER_NAME; // otherwise Calc file
         bOK = !rFilter.isEmpty();
     }
 
diff --git a/sc/source/ui/inc/docsh.hxx b/sc/source/ui/inc/docsh.hxx
index bf7666555530..eb7ffd0c9bfd 100644
--- a/sc/source/ui/inc/docsh.hxx
+++ b/sc/source/ui/inc/docsh.hxx
@@ -403,13 +403,6 @@ public:
     SC_DLLPUBLIC static SCTAB       GetCurTab();
 
     SAL_RET_MAYBENULL static ScDocShell* GetShellByNum( sal_uInt16 nDocNo );
-    static OUString   GetOwnFilterName();
-    static const OUString & GetHtmlFilterName();
-    static const OUString & GetWebQueryFilterName();
-    static const OUString & GetAsciiFilterName();
-    static const OUString & GetLotusFilterName();
-    static const OUString & GetDBaseFilterName();
-    static const OUString & GetDifFilterName();
     static bool       HasAutomaticTableName( std::u16string_view rFilter );
     static void       LOKCommentNotify(LOKCommentNotificationType nType, const 
ScDocument& rDocument, const ScAddress& rPos, const ScPostIt* pNote);
 
diff --git a/sc/source/ui/miscdlgs/linkarea.cxx 
b/sc/source/ui/miscdlgs/linkarea.cxx
index ca559e626aff..906883523997 100644
--- a/sc/source/ui/miscdlgs/linkarea.cxx
+++ b/sc/source/ui/miscdlgs/linkarea.cxx
@@ -61,9 +61,6 @@ ScLinkedAreaDlg::~ScLinkedAreaDlg()
 {
 }
 
-constexpr OUString FILTERNAME_HTML = u"HTML (StarCalc)"_ustr;
-constexpr OUString FILTERNAME_QUERY = u"calc_HTML_WebQuery"_ustr;
-
 IMPL_LINK_NOARG(ScLinkedAreaDlg, BrowseHdl, weld::Button&, void)
 {
     m_xDocInserter.reset( new sfx2::DocumentInserter(m_xDialog.get(), 
ScDocShell::Factory().GetFactoryName()) );
@@ -91,8 +88,8 @@ IMPL_LINK_NOARG(ScLinkedAreaDlg, FileHdl, weld::ComboBox&, 
bool)
         return true;
 
     // #i53241# replace HTML filter with DataQuery filter
-    if (aFilter == FILTERNAME_HTML)
-        aFilter = FILTERNAME_QUERY;
+    if (aFilter == SC_HTML_FILTER_NAME)
+        aFilter = SC_HTML_WEBQ_FILTER_NAME;
 
     LoadDocument( aEntered, aFilter, aOptions );
 
@@ -188,10 +185,10 @@ IMPL_LINK( ScLinkedAreaDlg, DialogClosedHdl, 
sfx2::FileDialogHelper*, _pFileDlg,
 
         // replace HTML filter with DataQuery filter
         std::shared_ptr<const SfxFilter> pFilter = pMed->GetFilter();
-        if (pFilter && FILTERNAME_HTML == pFilter->GetFilterName())
+        if (pFilter && SC_HTML_FILTER_NAME == pFilter->GetFilterName())
         {
             std::shared_ptr<const SfxFilter> pNewFilter =
-                
ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName( 
FILTERNAME_QUERY );
+                
ScDocShell::Factory().GetFilterContainer()->GetFilter4FilterName( 
SC_HTML_WEBQ_FILTER_NAME );
             if( pNewFilter )
                 pMed->SetFilter( pNewFilter );
         }
diff --git a/sc/source/ui/unoobj/exceldetect.cxx 
b/sc/source/ui/unoobj/exceldetect.cxx
index 3b75a60e45f1..631dd3d4415f 100644
--- a/sc/source/ui/unoobj/exceldetect.cxx
+++ b/sc/source/ui/unoobj/exceldetect.cxx
@@ -20,6 +20,8 @@
 #include <comphelper/diagnose_ex.hxx>
 #include <comphelper/sequenceashashmap.hxx>
 
+#include <global.hxx>
+
 using namespace com::sun::star;
 
 ScExcelBiffDetect::ScExcelBiffDetect() {}
@@ -149,7 +151,7 @@ OUString ScExcelBiffDetect::detect( 
uno::Sequence<beans::PropertyValue>& lDescri
             // BIFF8 is expected to contain a stream named "Workbook".
             return OUString();
 
-        aMediaDesc[utl::MediaDescriptor::PROP_FILTERNAME] <<= 
isTemplate(aType) ? u"MS Excel 97 Vorlage/Template"_ustr : u"MS Excel 97"_ustr;
+        aMediaDesc[utl::MediaDescriptor::PROP_FILTERNAME] <<= 
isTemplate(aType) ? SC_XL97TMPL_FILTER_NAME : SC_XL97_FILTER_NAME;
     }
 
     else if (aType == "calc_MS_Excel_95" || aType == 
"calc_MS_Excel_95_VorlageTemplate")
@@ -158,7 +160,7 @@ OUString ScExcelBiffDetect::detect( 
uno::Sequence<beans::PropertyValue>& lDescri
         if (!hasStream(xInStream, u"Book"_ustr))
             return OUString();
 
-        aMediaDesc[utl::MediaDescriptor::PROP_FILTERNAME] <<= 
isTemplate(aType) ? u"MS Excel 95 Vorlage/Template"_ustr : u"MS Excel 95"_ustr;
+        aMediaDesc[utl::MediaDescriptor::PROP_FILTERNAME] <<= 
isTemplate(aType) ? SC_XL95TMPL_FILTER_NAME : SC_XL95_FILTER_NAME;
     }
 
     else if (aType == "calc_MS_Excel_5095" || aType == 
"calc_MS_Excel_5095_VorlageTemplate")
@@ -167,7 +169,7 @@ OUString ScExcelBiffDetect::detect( 
uno::Sequence<beans::PropertyValue>& lDescri
         if (!hasStream(xInStream, u"Book"_ustr))
             return OUString();
 
-        aMediaDesc[utl::MediaDescriptor::PROP_FILTERNAME] <<= 
isTemplate(aType) ? u"MS Excel 5.0/95 Vorlage/Template"_ustr : u"MS Excel 
5.0/95"_ustr;
+        aMediaDesc[utl::MediaDescriptor::PROP_FILTERNAME] <<= 
isTemplate(aType) ? SC_XL5TMPL_FILTER_NAME : SC_XL5_FILTER_NAME;
     }
 
     else if (aType == "calc_MS_Excel_40" || aType == 
"calc_MS_Excel_40_VorlageTemplate")
@@ -176,7 +178,7 @@ OUString ScExcelBiffDetect::detect( 
uno::Sequence<beans::PropertyValue>& lDescri
         if (!isExcel40(xInStream))
             return OUString();
 
-        aMediaDesc[utl::MediaDescriptor::PROP_FILTERNAME] <<= 
isTemplate(aType) ? u"MS Excel 4.0 Vorlage/Template"_ustr : u"MS Excel 
4.0"_ustr;
+        aMediaDesc[utl::MediaDescriptor::PROP_FILTERNAME] <<= 
isTemplate(aType) ? SC_XL4TMPL_FILTER_NAME : SC_XL4_FILTER_NAME;
     }
 
     else
diff --git a/sc/source/ui/unoobj/filtuno.cxx b/sc/source/ui/unoobj/filtuno.cxx
index ef9a32696bdd..5a0fbfbdcd89 100644
--- a/sc/source/ui/unoobj/filtuno.cxx
+++ b/sc/source/ui/unoobj/filtuno.cxx
@@ -177,7 +177,7 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute()
 
     ScAbstractDialogFactory* pFact = ScAbstractDialogFactory::Create();
 
-    if ( !bExport && aFilterString == ScDocShell::GetAsciiFilterName() )
+    if (!bExport && aFilterString == SC_TEXT_CSV_FILTER_NAME)
     {
         //  ascii import is special...
 
@@ -206,7 +206,7 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute()
             nRet = ui::dialogs::ExecutableDialogResults::OK;
         }
     }
-    else if ( aFilterString == ScDocShell::GetWebQueryFilterName() || 
aFilterString == ScDocShell::GetHtmlFilterName() )
+    else if (aFilterString == SC_HTML_WEBQ_FILTER_NAME || aFilterString == 
SC_HTML_FILTER_NAME)
     {
         if (bExport)
             nRet = ui::dialogs::ExecutableDialogResults::OK;    // export HTML 
without dialog
@@ -244,7 +244,7 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute()
         OUString aTitle;
         bool bIncludeBOM = false;
 
-        if ( aFilterString == ScDocShell::GetAsciiFilterName() )
+        if (aFilterString == SC_TEXT_CSV_FILTER_NAME)
         {
             //  ascii export (import is handled above)
 
@@ -262,7 +262,7 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute()
             aOptions.ReadFromString(aFilterOptions);
             bIncludeBOM = aOptions.GetIncludeBOM();
         }
-        else if ( aFilterString == ScDocShell::GetLotusFilterName() )
+        else if (aFilterString == SC_LOTUS_FILTER_NAME)
         {
             //  lotus is only imported
             OSL_ENSURE( !bExport, "Filter Options for Lotus Export is not 
implemented" );
@@ -270,7 +270,7 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute()
             aTitle = ScResId( STR_IMPORT_LOTUS );
             eEncoding = RTL_TEXTENCODING_IBM_437;
         }
-        else if ( aFilterString == ScDocShell::GetDBaseFilterName() )
+        else if (aFilterString == SC_DBASE_FILTER_NAME)
         {
             if ( bExport )
             {
@@ -298,7 +298,7 @@ sal_Int16 SAL_CALL ScFilterOptionsObj::execute()
             bDBEnc = true;
             // pInStream goes out of scope, the stream is automatically closed
         }
-        else if ( aFilterString == ScDocShell::GetDifFilterName() )
+        else if (aFilterString == SC_DIF_FILTER_NAME)
         {
             if ( bExport )
             {
diff --git a/sc/source/ui/unoobj/scdetect.cxx b/sc/source/ui/unoobj/scdetect.cxx
index cfd515b3e4bf..6236ac62faab 100644
--- a/sc/source/ui/unoobj/scdetect.cxx
+++ b/sc/source/ui/unoobj/scdetect.cxx
@@ -31,6 +31,8 @@
 #include <sfx2/docfilt.hxx>
 #include <sfx2/fcontnr.hxx>
 
+#include <global.hxx>
+
 using namespace ::com::sun::star;
 
 namespace {
@@ -277,47 +279,47 @@ OUString SAL_CALL ScFilterDetect::detect( 
uno::Sequence<beans::PropertyValue>& l
         // No stream, no detection.
         return OUString();
 
-    const char* pSearchFilterName = nullptr;
+    OUString aSearchFilterName;
     if (aTypeName == "calc_Lotus")
     {
         if (!detectThisFormat(*pStream, pLotus) && !detectThisFormat(*pStream, 
pLotusNew) && !detectThisFormat(*pStream, pLotus2))
             return OUString();
 
-        pSearchFilterName = "Lotus";
+        aSearchFilterName = SC_LOTUS_FILTER_NAME;
     }
     else if (aTypeName == "calc_QPro")
     {
         if (!detectThisFormat(*pStream, pQPro))
             return OUString();
 
-        pSearchFilterName = "Quattro Pro 6.0";
+        aSearchFilterName = SC_QPRO6_FILTER_NAME;
     }
     else if (aTypeName == "calc_SYLK")
     {
         if (!detectThisFormat(*pStream, pSylk))
             return OUString();
 
-        pSearchFilterName = "SYLK";
+        aSearchFilterName = SC_SYLK_FILTER_NAME;
     }
     else if (aTypeName == "calc_DIF")
     {
         if (!detectThisFormat(*pStream, pDIF1) && !detectThisFormat(*pStream, 
pDIF2))
             return OUString();
 
-        pSearchFilterName = "DIF";
+        aSearchFilterName = SC_DIF_FILTER_NAME;
     }
     else if (aTypeName == "calc_dBase")
     {
         if (!lcl_MayBeDBase(*pStream))
             return OUString();
 
-        pSearchFilterName = "dBase";
+        aSearchFilterName = SC_DBASE_FILTER_NAME;
     }
     else
         return OUString();
 
     SfxFilterMatcher aMatcher(u"scalc"_ustr);
-    std::shared_ptr<const SfxFilter> pFilter = 
aMatcher.GetFilter4FilterName(OUString::createFromAscii(pSearchFilterName));
+    std::shared_ptr<const SfxFilter> pFilter = 
aMatcher.GetFilter4FilterName(aSearchFilterName);
 
     if (!pFilter)
         return OUString();
diff --git a/sc/source/ui/vba/vbaworkbook.cxx b/sc/source/ui/vba/vbaworkbook.cxx
index 8c8fcc424757..7abf25406248 100644
--- a/sc/source/ui/vba/vbaworkbook.cxx
+++ b/sc/source/ui/vba/vbaworkbook.cxx
@@ -95,23 +95,23 @@ bool ScVbaWorkbook::setFilterPropsFromFormat( sal_Int32 
nFormat, uno::Sequence<
                 pProp->Value <<= u"DBF"_ustr;
                 break;
             case excel::XlFileFormat::xlDIF:
-                pProp->Value <<= u"DIF"_ustr;
+                pProp->Value <<= SC_DIF_FILTER_NAME;
                 break;
             case excel::XlFileFormat::xlWK3:
-                pProp->Value <<= u"Lotus"_ustr;
+                pProp->Value <<= SC_LOTUS_FILTER_NAME;
                 break;
             case excel::XlFileFormat::xlExcel4Workbook:
-                pProp->Value <<= u"MS Excel 4.0"_ustr;
+                pProp->Value <<= SC_XL4_FILTER_NAME;
                 break;
             case excel::XlFileFormat::xlExcel5:
-                pProp->Value <<= u"MS Excel 5.0/95"_ustr;
+                pProp->Value <<= SC_XL5_FILTER_NAME;
                 break;
             case excel::XlFileFormat::xlHtml:
-                pProp->Value <<= u"HTML (StarCalc)"_ustr;
+                pProp->Value <<= SC_HTML_FILTER_NAME;
                 break;
             case excel::XlFileFormat::xlExcel9795:
             default:
-                pProp->Value <<= u"MS Excel 97"_ustr;
+                pProp->Value <<= SC_XL97_FILTER_NAME;
                 break;
         }
     }
@@ -141,27 +141,27 @@ ScVbaWorkbook::getFileFormat(  )
             aFileFormat = excel::XlFileFormat::xlDBF4;
         }
 
-        if ( aFilterName == "DIF" ) {
+        if ( aFilterName == SC_DIF_FILTER_NAME ) {
             aFileFormat = excel::XlFileFormat::xlDIF;
         }
 
-        if ( aFilterName == "Lotus" ) {
+        if ( aFilterName == SC_LOTUS_FILTER_NAME ) {
             aFileFormat = excel::XlFileFormat::xlWK3;
         }
 
-        if ( aFilterName == "MS Excel 4.0" ) {
+        if ( aFilterName == SC_XL4_FILTER_NAME ) {
             aFileFormat = excel::XlFileFormat::xlExcel4Workbook;
         }
 
-        if ( aFilterName == "MS Excel 5.0/95" ) {
+        if ( aFilterName == SC_XL5_FILTER_NAME ) {
             aFileFormat = excel::XlFileFormat::xlExcel5;
         }
 
-        if ( aFilterName == "MS Excel 97" ) {
+        if ( aFilterName == SC_XL97_FILTER_NAME ) {
             aFileFormat = excel::XlFileFormat::xlExcel9795;
         }
 
-        if (aFilterName == "HTML (StarCalc)") {
+        if (aFilterName == SC_HTML_FILTER_NAME) {
             aFileFormat = excel::XlFileFormat::xlHtml;
         }
 
@@ -169,7 +169,7 @@ ScVbaWorkbook::getFileFormat(  )
             aFileFormat = excel::XlFileFormat::xlTemplate;
         }
 
-        if (aFilterName == "StarOffice XML (Calc)") {
+        if (aFilterName == SC_SOXML_FILTER_NAME) {
             aFileFormat = excel::XlFileFormat::xlWorkbookNormal;
         }
         if ( aFilterName == "calc8" ) {
@@ -313,7 +313,7 @@ ScVbaWorkbook::SaveCopyAs( const OUString& sFileName )
     osl::FileBase::getFileURLFromSystemPath( sFileName, aURL );
     uno::Reference< frame::XStorable > xStor( getModel(), uno::UNO_QUERY_THROW 
);
     uno::Sequence<  beans::PropertyValue > storeProps{ 
comphelper::makePropertyValue(
-        u"FilterName"_ustr, u"MS Excel 97"_ustr) };
+        u"FilterName"_ustr, SC_XL97_FILTER_NAME) };
     xStor->storeToURL( aURL, storeProps );
 }
 

Reply via email to