diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-21 11:47:47 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-11-22 07:33:56 +0100 |
commit | 2e6a38b7f007b36719f5fc002cb4363dec45e0d4 (patch) | |
tree | 7b9c691228821149d96d3859be07f50bc1e93515 /filter/source/xsltdialog | |
parent | ca037ca06e5b261a243af15aa57d2b8ee047806e (diff) |
improve function-local statics in dbaccess..filter
Change-Id: I64939ad4b6c53696e33300114db384abfe73f13f
Reviewed-on: https://gerrit.libreoffice.org/63702
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'filter/source/xsltdialog')
-rw-r--r-- | filter/source/xsltdialog/xmlfiltercommon.hxx | 2 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltersettingsdialog.cxx | 56 | ||||
-rw-r--r-- | filter/source/xsltdialog/xmlfiltertabpagebasic.cxx | 14 |
3 files changed, 31 insertions, 41 deletions
diff --git a/filter/source/xsltdialog/xmlfiltercommon.hxx b/filter/source/xsltdialog/xmlfiltercommon.hxx index 3d87a3e6bce3..83ab9f470a5e 100644 --- a/filter/source/xsltdialog/xmlfiltercommon.hxx +++ b/filter/source/xsltdialog/xmlfiltercommon.hxx @@ -78,7 +78,7 @@ struct application_info_impl }; -extern std::vector< application_info_impl* >& getApplicationInfos(); +extern std::vector< application_info_impl > const & getApplicationInfos(); extern OUString getApplicationUIName( const OUString& rServiceName ); extern const application_info_impl* getApplicationInfo( const OUString& rServiceName ); OUString XsltResId(const char* pId); diff --git a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx index f1d82327ca75..88eccc7d2167 100644 --- a/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltersettingsdialog.cxx @@ -1186,74 +1186,64 @@ application_info_impl::application_info_impl( const sal_Char * pDocumentService, { } -std::vector< application_info_impl* >& getApplicationInfos() +std::vector< application_info_impl > const & getApplicationInfos() { - static std::vector< application_info_impl* > aInfos; - - if( aInfos.empty() ) + static std::vector< application_info_impl > const aInfos { - aInfos.push_back( new application_info_impl( - "com.sun.star.text.TextDocument", + { "com.sun.star.text.TextDocument", STR_APPL_NAME_WRITER, "com.sun.star.comp.Writer.XMLImporter", - "com.sun.star.comp.Writer.XMLExporter" ) ); + "com.sun.star.comp.Writer.XMLExporter" }, - aInfos.push_back( new application_info_impl( - "com.sun.star.sheet.SpreadsheetDocument", + { "com.sun.star.sheet.SpreadsheetDocument", STR_APPL_NAME_CALC, "com.sun.star.comp.Calc.XMLImporter", - "com.sun.star.comp.Calc.XMLExporter" ) ); + "com.sun.star.comp.Calc.XMLExporter" }, - aInfos.push_back( new application_info_impl( - "com.sun.star.presentation.PresentationDocument", + { "com.sun.star.presentation.PresentationDocument", STR_APPL_NAME_IMPRESS, "com.sun.star.comp.Impress.XMLImporter", - "com.sun.star.comp.Impress.XMLExporter" ) ); + "com.sun.star.comp.Impress.XMLExporter" }, - aInfos.push_back( new application_info_impl( - "com.sun.star.drawing.DrawingDocument", + { "com.sun.star.drawing.DrawingDocument", STR_APPL_NAME_DRAW, "com.sun.star.comp.Draw.XMLImporter", - "com.sun.star.comp.Draw.XMLExporter" ) ); + "com.sun.star.comp.Draw.XMLExporter" }, // --- oasis file formats... - aInfos.push_back( new application_info_impl( - "com.sun.star.text.TextDocument", + { "com.sun.star.text.TextDocument", STR_APPL_NAME_OASIS_WRITER, "com.sun.star.comp.Writer.XMLOasisImporter", - "com.sun.star.comp.Writer.XMLOasisExporter" ) ); + "com.sun.star.comp.Writer.XMLOasisExporter" }, - aInfos.push_back( new application_info_impl( - "com.sun.star.sheet.SpreadsheetDocument", + { "com.sun.star.sheet.SpreadsheetDocument", STR_APPL_NAME_OASIS_CALC, "com.sun.star.comp.Calc.XMLOasisImporter", - "com.sun.star.comp.Calc.XMLOasisExporter" ) ); + "com.sun.star.comp.Calc.XMLOasisExporter" }, - aInfos.push_back( new application_info_impl( - "com.sun.star.presentation.PresentationDocument", + { "com.sun.star.presentation.PresentationDocument", STR_APPL_NAME_OASIS_IMPRESS, "com.sun.star.comp.Impress.XMLOasisImporter", - "com.sun.star.comp.Impress.XMLOasisExporter" ) ); + "com.sun.star.comp.Impress.XMLOasisExporter" }, - aInfos.push_back( new application_info_impl( - "com.sun.star.drawing.DrawingDocument", + { "com.sun.star.drawing.DrawingDocument", STR_APPL_NAME_OASIS_DRAW, "com.sun.star.comp.Draw.XMLOasisImporter", - "com.sun.star.comp.Draw.XMLOasisExporter" ) ); - } + "com.sun.star.comp.Draw.XMLOasisExporter" }, + }; return aInfos; } const application_info_impl* getApplicationInfo( const OUString& rServiceName ) { - std::vector< application_info_impl* >& rInfos = getApplicationInfos(); + std::vector< application_info_impl > const & rInfos = getApplicationInfos(); for (auto const& info : rInfos) { - if( rServiceName == info->maXMLExporter || - rServiceName == info->maXMLImporter) + if( rServiceName == info.maXMLExporter || + rServiceName == info.maXMLImporter) { - return info; + return &info; } } return nullptr; diff --git a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx index 7b6e519c813f..af2b6148d51f 100644 --- a/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx +++ b/filter/source/xsltdialog/xmlfiltertabpagebasic.cxx @@ -34,10 +34,10 @@ XMLFilterTabPageBasic::XMLFilterTabPageBasic(weld::Widget* pPage) { m_xEDDescription->set_size_request(-1, m_xEDDescription->get_height_rows(4)); - std::vector< application_info_impl* >& rInfos = getApplicationInfos(); + std::vector< application_info_impl > const & rInfos = getApplicationInfos(); for (auto const& info : rInfos) { - OUString aEntry( info->maDocumentUIName ); + OUString aEntry( info.maDocumentUIName ); m_xCBApplication->append_text( aEntry ); } } @@ -92,14 +92,14 @@ void XMLFilterTabPageBasic::FillInfo( filter_info_impl* pInfo ) if( !pInfo->maDocumentService.isEmpty() ) { - std::vector< application_info_impl* >& rInfos = getApplicationInfos(); + std::vector< application_info_impl > const & rInfos = getApplicationInfos(); for (auto const& info : rInfos) { - if( pInfo->maDocumentService == info->maDocumentUIName ) + if( pInfo->maDocumentService == info.maDocumentUIName ) { - pInfo->maDocumentService = info->maDocumentService; - pInfo->maExportService = info->maXMLExporter; - pInfo->maImportService = info->maXMLImporter; + pInfo->maDocumentService = info.maDocumentService; + pInfo->maExportService = info.maXMLExporter; + pInfo->maImportService = info.maXMLImporter; break; } } |