From 601e9d4badd84c3c4824090f1bc39bef3b64cbd1 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 13 May 2021 14:01:28 +0200 Subject: inline some typedefs Change-Id: I1608e03ff9f6fbc55987010e88897e034b690b3a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/115552 Tested-by: Jenkins Reviewed-by: Noel Grandin --- bin/find-unused-typedefs.py | 18 ++++++++++-------- package/source/xstor/owriteablestream.hxx | 4 +--- sc/source/filter/xml/xmlcelli.hxx | 3 +-- sc/source/ui/inc/csvgrid.hxx | 5 ++--- sc/source/ui/unoobj/cellsuno.cxx | 4 +--- scripting/source/stringresource/stringresource.hxx | 4 +--- sfx2/inc/preventduplicateinteraction.hxx | 5 +---- svx/source/form/filtnav.cxx | 4 +--- svx/source/form/fmshimp.cxx | 4 ++-- svx/source/form/fmvwimp.cxx | 18 +++++++++--------- svx/source/inc/fmvwimp.hxx | 12 +++++------- sw/source/filter/inc/msfilter.hxx | 3 --- sw/source/filter/ww8/ww8par.hxx | 3 ++- ucbhelper/source/client/proxydecider.cxx | 3 +-- vcl/source/gdi/pdfwriter_impl.hxx | 3 +-- writerfilter/source/dmapper/StyleSheetTable.cxx | 5 +---- xmloff/source/style/xmlimppr.cxx | 3 +-- xmloff/source/table/XMLTableImport.cxx | 4 +--- 18 files changed, 41 insertions(+), 64 deletions(-) diff --git a/bin/find-unused-typedefs.py b/bin/find-unused-typedefs.py index 9a6c0eef9118..0fd96749c300 100755 --- a/bin/find-unused-typedefs.py +++ b/bin/find-unused-typedefs.py @@ -1,4 +1,4 @@ -#!/usr/bin/python2 +#!/usr/bin/python3 import subprocess @@ -9,26 +9,28 @@ a = subprocess.Popen("git grep -P 'typedef\\s+.+\\s+\\w+;' -- \"[!e][!x][!t]*\"" typedefSet = set() with a.stdout as txt: for line in txt: - idx2 = line.rfind(";") - idx1 = line.rfind(" ", 0, idx2) + idx2 = line.rfind(b";") + idx1 = line.rfind(b" ", 0, idx2) typedefName = line[idx1+1 : idx2] - if typedefName.startswith("*"): + if typedefName.startswith(b"*"): typedefName = typedefName[1:] # ignore anything less than 5 characters, it's probably a parsing error if len(typedefName) < 5: continue typedefSet.add(typedefName) for typedefName in sorted(typedefSet): - print("checking: " + typedefName) + print(b"checking: " + typedefName) a = subprocess.Popen(["git", "grep", "-wn", typedefName], stdout=subprocess.PIPE) - foundLine2 = "" + foundLine2 = b"" cnt = 0 with a.stdout as txt2: for line2 in txt2: cnt = cnt + 1 foundLine2 += line2 + if cnt > 2: break + a.kill() if cnt == 1: - print("remove: " + foundLine2) + print(b"remove: " + foundLine2) elif cnt == 2: - print("inline: " + foundLine2) + print(b"inline: " + foundLine2) diff --git a/package/source/xstor/owriteablestream.hxx b/package/source/xstor/owriteablestream.hxx index 84fdf7c51576..0d71619a8562 100644 --- a/package/source/xstor/owriteablestream.hxx +++ b/package/source/xstor/owriteablestream.hxx @@ -62,8 +62,6 @@ namespace package { struct WSInternalData_Impl; -typedef ::std::vector< OInputCompStream* > InputStreamsVector_Impl; - struct OStorage_Impl; class OWriteStream; @@ -81,7 +79,7 @@ struct OWriteStream_Impl css::uno::Reference< css::io::XStream > m_xCacheStream; css::uno::Reference< css::io::XSeekable > m_xCacheSeek; - InputStreamsVector_Impl m_aInputStreamsVector; + std::vector< OInputCompStream* > m_aInputStreamsVector; bool m_bHasDataToFlush; // only modified elements will be sent to the original content bool m_bFlushed; // sending the streams is coordinated by the root storage of the package diff --git a/sc/source/filter/xml/xmlcelli.hxx b/sc/source/filter/xml/xmlcelli.hxx index 79c7075d21cb..74fe71029a9e 100644 --- a/sc/source/filter/xml/xmlcelli.hxx +++ b/sc/source/filter/xml/xmlcelli.hxx @@ -57,7 +57,6 @@ class ScXMLTableRowCellContext : public ScXMLImportContext ~Field(); }; - typedef std::vector > ParaFormatsType; typedef std::vector > FieldsType; typedef std::pair FormulaWithNamespace; @@ -70,7 +69,7 @@ class ScXMLTableRowCellContext : public ScXMLImportContext OUStringBuffer maParagraph{32}; sal_Int32 mnCurParagraph; - ParaFormatsType maFormats; + std::vector > maFormats; FieldsType maFields; std::unique_ptr< ScXMLAnnotationData > mxAnnotationData; diff --git a/sc/source/ui/inc/csvgrid.hxx b/sc/source/ui/inc/csvgrid.hxx index fe5e76092093..c7857ffbb4c4 100644 --- a/sc/source/ui/inc/csvgrid.hxx +++ b/sc/source/ui/inc/csvgrid.hxx @@ -57,8 +57,6 @@ typedef ::std::vector< ScCsvColState > ScCsvColStateVec; class SC_DLLPUBLIC ScCsvGrid : public ScCsvControl, public utl::ConfigurationListener { private: - typedef ::std::unique_ptr< ScEditEngineDefaulter > ScEditEnginePtr; - ScCsvTableBox* mpTableBox; /// Grid Parent VclPtr mpBackgrDev; /// Grid background, headers, cell texts. VclPtr mpGridDev; /// Data grid with selection and cursor. @@ -75,7 +73,8 @@ private: Color maHeaderTextColor; /// Text color for headers. Color maSelectColor; /// Header color of selected columns. - ScEditEnginePtr mpEditEngine; /// For drawing cell texts. + std::unique_ptr< ScEditEngineDefaulter > + mpEditEngine; /// For drawing cell texts. vcl::Font maHeaderFont; /// Font for column and row headers. vcl::Font maMonoFont; /// Monospace font for data cells. Size maWinSize; /// Size of the control. diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 811a9f19dc05..365291851c6f 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -9197,8 +9197,6 @@ const ScRangeList& ScUniqueFormatsEntry::GetRanges() return *aReturnRanges; } -typedef std::unordered_map< const ScPatternAttr*, ScUniqueFormatsEntry, ScPatternHashCode > ScUniqueFormatsHashMap; - namespace { // function object to sort the range lists by start of first range @@ -9234,7 +9232,7 @@ ScUniqueCellFormatsObj::ScUniqueCellFormatsObj(ScDocShell* pDocSh, const ScRange // Collect the ranges for each format in a hash map, to avoid nested loops - ScUniqueFormatsHashMap aHashMap; + std::unordered_map< const ScPatternAttr*, ScUniqueFormatsEntry, ScPatternHashCode > aHashMap; while (aIter.GetNext( nCol1, nCol2, nRow1, nRow2 ) ) { ScRange aRange( nCol1, nRow1, nTab, nCol2, nRow2, nTab ); diff --git a/scripting/source/stringresource/stringresource.hxx b/scripting/source/stringresource/stringresource.hxx index 6a2a583c3b3e..2cb2e0aa1424 100644 --- a/scripting/source/stringresource/stringresource.hxx +++ b/scripting/source/stringresource/stringresource.hxx @@ -81,8 +81,6 @@ struct LocaleItem {} }; -typedef std::vector< std::unique_ptr > LocaleItemVector; - typedef ::cppu::WeakImplHelper< css::lang::XServiceInfo, css::resource::XStringResourceManager > StringResourceImpl_BASE; @@ -100,7 +98,7 @@ protected: std::vector< std::unique_ptr > m_aLocaleItemVector; std::vector< std::unique_ptr > m_aDeletedLocaleItemVector; - LocaleItemVector m_aChangedDefaultLocaleVector; + std::vector< std::unique_ptr > m_aChangedDefaultLocaleVector; bool m_bModified; bool m_bReadOnly; diff --git a/sfx2/inc/preventduplicateinteraction.hxx b/sfx2/inc/preventduplicateinteraction.hxx index 970a93b159ef..b3259aa4ed80 100644 --- a/sfx2/inc/preventduplicateinteraction.hxx +++ b/sfx2/inc/preventduplicateinteraction.hxx @@ -186,9 +186,6 @@ class PreventDuplicateInteraction final : private ThreadHelpBase2 {} }; - typedef ::std::vector< InteractionInfo > InteractionList; - - // member private: @@ -204,7 +201,7 @@ class PreventDuplicateInteraction final : private ThreadHelpBase2 /** This list describe which and how incoming interactions must be handled. Further it contains all collected information after this interaction object was used.*/ - InteractionList m_lInteractionRules; + std::vector< InteractionInfo > m_lInteractionRules; // uno interface diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx index 1ed83512fadb..f5cc1e1358df 100644 --- a/svx/source/form/filtnav.cxx +++ b/svx/source/form/filtnav.cxx @@ -1559,8 +1559,6 @@ IMPL_LINK(FmFilterNavigator, PopupMenuHdl, const CommandEvent&, rEvt, bool) return bHandled; } -typedef std::vector> iter_vector; - bool FmFilterNavigator::getNextEntry(weld::TreeIter& rEntry) { bool bEntry = m_xTreeView->iter_next(rEntry); @@ -1608,7 +1606,7 @@ IMPL_LINK(FmFilterNavigator, KeyInputHdl, const ::KeyEvent&, rKEvt, bool) break; - iter_vector aSelected; + std::vector> aSelected; m_xTreeView->selected_foreach([this, &aSelected](weld::TreeIter& rEntry){ aSelected.emplace_back(m_xTreeView->make_iterator(&rEntry)); return false; diff --git a/svx/source/form/fmshimp.cxx b/svx/source/form/fmshimp.cxx index ba2875998cdc..f0162740f8c6 100644 --- a/svx/source/form/fmshimp.cxx +++ b/svx/source/form/fmshimp.cxx @@ -2913,7 +2913,7 @@ void FmXFormShell::startFiltering_Lock() else xContainer = getActiveController_Lock()->getContainer(); - PFormViewPageWindowAdapter pAdapter = pXView->findWindow( xContainer ); + rtl::Reference< FormViewPageWindowAdapter > pAdapter = pXView->findWindow( xContainer ); if ( pAdapter.is() ) { const ::std::vector< Reference< runtime::XFormController> >& rControllerList = pAdapter->GetList(); @@ -2986,7 +2986,7 @@ void FmXFormShell::stopFiltering_Lock(bool bSave) else xContainer = getActiveController_Lock()->getContainer(); - PFormViewPageWindowAdapter pAdapter = pXView->findWindow(xContainer); + rtl::Reference< FormViewPageWindowAdapter > pAdapter = pXView->findWindow(xContainer); if ( pAdapter.is() ) { const ::std::vector< Reference< runtime::XFormController > >& rControllerList = pAdapter->GetList(); diff --git a/svx/source/form/fmvwimp.cxx b/svx/source/form/fmvwimp.cxx index 5bcb4ecb49d6..0a2440cbab1c 100644 --- a/svx/source/form/fmvwimp.cxx +++ b/svx/source/form/fmvwimp.cxx @@ -491,7 +491,7 @@ void SAL_CALL FmXFormView::elementInserted(const ContainerEvent& evt) } else { - PFormViewPageWindowAdapter pAdapter = findWindow( xControlContainer ); + rtl::Reference< FormViewPageWindowAdapter > pAdapter = findWindow( xControlContainer ); if ( pAdapter.is() ) pAdapter->updateTabOrder( xForm ); } @@ -514,10 +514,10 @@ void SAL_CALL FmXFormView::elementRemoved(const ContainerEvent& /*evt*/) } -PFormViewPageWindowAdapter FmXFormView::findWindow( const Reference< XControlContainer >& _rxCC ) const +rtl::Reference< FormViewPageWindowAdapter > FmXFormView::findWindow( const Reference< XControlContainer >& _rxCC ) const { auto i = std::find_if(m_aPageWindowAdapters.begin(), m_aPageWindowAdapters.end(), - [&_rxCC](const PFormViewPageWindowAdapter& rpAdapter) { return _rxCC == rpAdapter->getControlContainer(); }); + [&_rxCC](const rtl::Reference< FormViewPageWindowAdapter >& rpAdapter) { return _rxCC == rpAdapter->getControlContainer(); }); if (i != m_aPageWindowAdapters.end()) return *i; return nullptr; @@ -535,7 +535,7 @@ void FmXFormView::addWindow(const SdrPageWindow& rWindow) && ( !findWindow( xCC ).is() ) ) { - PFormViewPageWindowAdapter pAdapter = new FormViewPageWindowAdapter( comphelper::getProcessComponentContext(), rWindow, this ); + rtl::Reference< FormViewPageWindowAdapter > pAdapter = new FormViewPageWindowAdapter( comphelper::getProcessComponentContext(), rWindow, this ); m_aPageWindowAdapters.push_back( pAdapter ); // listen at the ControlContainer to notice changes @@ -554,7 +554,7 @@ void FmXFormView::removeWindow( const Reference< XControlContainer >& _rxCC ) // - the control container for a window is removed while the active mode is on auto i = std::find_if(m_aPageWindowAdapters.begin(), m_aPageWindowAdapters.end(), - [&_rxCC](const PFormViewPageWindowAdapter& rpAdapter) { return _rxCC == rpAdapter->getControlContainer(); }); + [&_rxCC](const rtl::Reference< FormViewPageWindowAdapter >& rpAdapter) { return _rxCC == rpAdapter->getControlContainer(); }); if (i != m_aPageWindowAdapters.end()) { Reference< XContainer > xContainer( _rxCC, UNO_QUERY ); @@ -601,7 +601,7 @@ void FmXFormView::resumeTabOrderUpdate() // update the tab orders for all components which were collected since the suspendTabOrderUpdate call. for (const auto& rContainer : m_aNeedTabOrderUpdate) { - PFormViewPageWindowAdapter pAdapter = findWindow( rContainer.first ); + rtl::Reference< FormViewPageWindowAdapter > pAdapter = findWindow( rContainer.first ); if ( !pAdapter.is() ) continue; @@ -695,7 +695,7 @@ IMPL_LINK_NOARG(FmXFormView, OnActivate, void*, void) find_active_databaseform fad(pShImpl->getActiveController_Lock()); vcl::Window* pWindow = const_cast(static_cast(m_pView->GetActualOutDev())); - PFormViewPageWindowAdapter pAdapter = m_aPageWindowAdapters.empty() ? nullptr : m_aPageWindowAdapters[0]; + rtl::Reference< FormViewPageWindowAdapter > pAdapter = m_aPageWindowAdapters.empty() ? nullptr : m_aPageWindowAdapters[0]; for (const auto& rpPageWindowAdapter : m_aPageWindowAdapters) { if ( pWindow == rpPageWindowAdapter->getWindow() ) @@ -876,7 +876,7 @@ Reference< XFormController > FmXFormView::getFormController( const Reference< XF { Reference< XFormController > xController; - for (const PFormViewPageWindowAdapter& pAdapter : m_aPageWindowAdapters) + for (const rtl::Reference< FormViewPageWindowAdapter >& pAdapter : m_aPageWindowAdapters) { if ( !pAdapter ) { @@ -909,7 +909,7 @@ IMPL_LINK_NOARG(FmXFormView, OnAutoFocus, void*, void) FmFormPage* pPage = dynamic_cast( pSdrPage ); Reference< XIndexAccess > xForms( pPage ? Reference< XIndexAccess >( pPage->GetForms() ) : Reference< XIndexAccess >() ); - const PFormViewPageWindowAdapter pAdapter = m_aPageWindowAdapters.empty() ? nullptr : m_aPageWindowAdapters[0]; + const rtl::Reference< FormViewPageWindowAdapter > pAdapter = m_aPageWindowAdapters.empty() ? nullptr : m_aPageWindowAdapters[0]; const vcl::Window* pWindow = pAdapter ? pAdapter->getWindow() : nullptr; ENSURE_OR_RETURN_VOID( xForms.is() && pWindow, "FmXFormView::OnAutoFocus: could not collect all essentials!" ); diff --git a/svx/source/inc/fmvwimp.hxx b/svx/source/inc/fmvwimp.hxx index dc56630c6ef3..ee85e565e4c0 100644 --- a/svx/source/inc/fmvwimp.hxx +++ b/svx/source/inc/fmvwimp.hxx @@ -127,9 +127,6 @@ private: vcl::Window* getWindow() const {return m_pWindow;} }; -typedef ::rtl::Reference< FormViewPageWindowAdapter > PFormViewPageWindowAdapter; -typedef ::std::set< css::uno::Reference< css::form::XForm > > SetOfForms; -typedef ::std::map< css::uno::Reference< css::awt::XControlContainer >, SetOfForms > MapControlContainerToSetOfForms; class SdrModel; class FmXFormView : public ::cppu::WeakImplHelper< @@ -157,10 +154,11 @@ class FmXFormView : public ::cppu::WeakImplHelper< css::sdb::SQLErrorEvent m_aAsyncError; // error event which is to be displayed asyn. See m_nErrorMessageEvent. - std::vector< PFormViewPageWindowAdapter > + std::vector< rtl::Reference< FormViewPageWindowAdapter > > m_aPageWindowAdapters; // to be filled in alive mode only - MapControlContainerToSetOfForms - m_aNeedTabOrderUpdate; + typedef ::std::set< css::uno::Reference< css::form::XForm > > SetOfForms; + std::map< css::uno::Reference< css::awt::XControlContainer >, SetOfForms > + m_aNeedTabOrderUpdate; // map control container to set of forms // list of selected objects, used for restoration when switching from Alive to DesignMode SdrMarkList m_aMark; @@ -206,7 +204,7 @@ public: virtual void SAL_CALL focusLost( const css::awt::FocusEvent& e ) override; FmFormView* getView() const {return m_pView;} - PFormViewPageWindowAdapter findWindow( const css::uno::Reference< css::awt::XControlContainer >& _rxCC ) const; + rtl::Reference< FormViewPageWindowAdapter > findWindow( const css::uno::Reference< css::awt::XControlContainer >& _rxCC ) const; css::uno::Reference< css::form::runtime::XFormController > getFormController( const css::uno::Reference< css::form::XForm >& _rxForm, const OutputDevice& _rDevice ) const; diff --git a/sw/source/filter/inc/msfilter.hxx b/sw/source/filter/inc/msfilter.hxx index 59ede5ac2a64..2e5dcbf4b976 100644 --- a/sw/source/filter/inc/msfilter.hxx +++ b/sw/source/filter/inc/msfilter.hxx @@ -105,9 +105,6 @@ namespace sw namespace util { - /// Redlining Authors, map word author key to writer author value - typedef std::map AuthorInfos; - /** Clips a value to MAX/MIN 16bit value to make it safe for use as a position value to give to writer. i.e. +-57.8cm. Sometimes we see ridiculous values for positioning in rtf and word document, diff --git a/sw/source/filter/ww8/ww8par.hxx b/sw/source/filter/ww8/ww8par.hxx index e23d9986b7f5..575841ffbeee 100644 --- a/sw/source/filter/ww8/ww8par.hxx +++ b/sw/source/filter/ww8/ww8par.hxx @@ -1267,7 +1267,8 @@ private: std::unique_ptr m_pSmartTagData; - sw::util::AuthorInfos m_aAuthorInfos; + /// Redlining Authors, map word author key to writer author value + std::map m_aAuthorInfos; OUString m_sBaseURL; // Ini-Flags: diff --git a/ucbhelper/source/client/proxydecider.cxx b/ucbhelper/source/client/proxydecider.cxx index f3601e058aa0..829480e55c25 100644 --- a/ucbhelper/source/client/proxydecider.cxx +++ b/ucbhelper/source/client/proxydecider.cxx @@ -84,8 +84,6 @@ public: } -typedef std::pair< WildCard, WildCard > NoProxyListEntry; - namespace { class HostnameCache @@ -133,6 +131,7 @@ class InternetProxyDecider_Impl : const InternetProxyServer m_aEmptyProxy; ProxyType m_nProxyType; uno::Reference< util::XChangesNotifier > m_xNotifier; + typedef std::pair< WildCard, WildCard > NoProxyListEntry; std::vector< NoProxyListEntry > m_aNoProxyList; mutable HostnameCache m_aHostnames; diff --git a/vcl/source/gdi/pdfwriter_impl.hxx b/vcl/source/gdi/pdfwriter_impl.hxx index d49add8e8f71..b4f3bec50fd7 100644 --- a/vcl/source/gdi/pdfwriter_impl.hxx +++ b/vcl/source/gdi/pdfwriter_impl.hxx @@ -445,8 +445,6 @@ struct PDFScreen : public PDFAnnotation struct PDFWidget : public PDFAnnotation { - typedef std::unordered_map PDFAppearanceStreams; - PDFWriter::WidgetType m_eType; OString m_aName; OUString m_aDescription; @@ -474,6 +472,7 @@ struct PDFWidget : public PDFAnnotation sal_Int32 m_nDest; std::vector m_aListEntries; std::vector m_aSelectedEntries; + typedef std::unordered_map PDFAppearanceStreams; std::unordered_map m_aAppearances; PDFWidget() : m_eType( PDFWriter::PushButton ), diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index 083288bc16b6..e1329da95852 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -264,9 +264,6 @@ struct ListCharStylePropertyMap_t } -typedef std::vector< ListCharStylePropertyMap_t > ListCharStylePropertyVector_t; - - struct StyleSheetTable_Impl { DomainMapper& m_rDMapper; @@ -276,7 +273,7 @@ struct StyleSheetTable_Impl StyleSheetEntryPtr m_pCurrentEntry; PropertyMapPtr m_pDefaultParaProps, m_pDefaultCharProps; OUString m_sDefaultParaStyleName; //WW8 name - ListCharStylePropertyVector_t m_aListCharStylePropertyVector; + std::vector< ListCharStylePropertyMap_t > m_aListCharStylePropertyVector; bool m_bHasImportedDefaultParaProps; bool m_bIsNewDoc; diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx index 0b327c73e6cc..f90aa7a75b9b 100644 --- a/xmloff/source/style/xmlimppr.cxx +++ b/xmloff/source/style/xmlimppr.cxx @@ -574,7 +574,6 @@ bool SvXMLImportPropertyMapper::FillPropertySet_( typedef pair PropertyPair; -typedef vector PropertyPairs; namespace { @@ -599,7 +598,7 @@ void SvXMLImportPropertyMapper::PrepareForMultiPropertySet_( sal_Int32 nCount = rProperties.size(); // property pairs structure stores names + values of properties to be set. - PropertyPairs aPropertyPairs; + vector aPropertyPairs; aPropertyPairs.reserve( nCount ); // iterate over property states that we want to set diff --git a/xmloff/source/table/XMLTableImport.cxx b/xmloff/source/table/XMLTableImport.cxx index 99ed49941ff0..47923d66c28d 100644 --- a/xmloff/source/table/XMLTableImport.cxx +++ b/xmloff/source/table/XMLTableImport.cxx @@ -92,8 +92,6 @@ struct MergeInfo } -typedef std::vector< std::shared_ptr< MergeInfo > > MergeInfoVector; - class XMLTableImportContext : public SvXMLImportContext { public: @@ -124,7 +122,7 @@ public: // default cell style name for the current row OUString msDefaultCellStyleName; - MergeInfoVector maMergeInfos; + std::vector< std::shared_ptr< MergeInfo > > maMergeInfos; }; namespace { -- cgit