diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-11-19 16:32:49 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-11-22 12:57:32 +0100 |
commit | f853ec317f6af1b8c65cc5bd758371689c75118d (patch) | |
tree | b86d729bf9a9465ee619ead3b5635efa62a1804e /vcl/source | |
parent | tdf#124513 let wizard reappear on tabbing back to document (diff) | |
download | core-f853ec317f6af1b8c65cc5bd758371689c75118d.tar.gz core-f853ec317f6af1b8c65cc5bd758371689c75118d.zip |
Extend loplugin:external to warn about classes
...following up on 314f15bff08b76bf96acf99141776ef64d2f1355 "Extend
loplugin:external to warn about enums".
Cases where free functions were moved into an unnamed namespace along with a
class, to not break ADL, are in:
filter/source/svg/svgexport.cxx
sc/source/filter/excel/xelink.cxx
sc/source/filter/excel/xilink.cxx
svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
All other free functions mentioning moved classes appear to be harmless and not
give rise to (silent, even) ADL breakage. (One remaining TODO in
compilerplugins/clang/external.cxx is that derived classes are not covered by
computeAffectedTypes, even though they could also be affected by ADL-breakage---
but don't seem to be in any acutal case across the code base.)
For friend declarations using elaborate type specifiers, like
class C1 {};
class C2 { friend class C1; };
* If C2 (but not C1) is moved into an unnamed namespace, the friend declaration
must be changed to not use an elaborate type specifier (i.e., "friend C1;"; see
C++17 [namespace.memdef]/3: "If the name in a friend declaration is neither
qualified nor a template-id and the declaration is a function or an
elaborated-type-specifier, the lookup to determine whether the entity has been
previously declared shall not consider any scopes outside the innermost
enclosing namespace.")
* If C1 (but not C2) is moved into an unnamed namespace, the friend declaration
must be changed too, see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71882>
"elaborated-type-specifier friend not looked up in unnamed namespace".
Apart from that, to keep changes simple and mostly mechanical (which should help
avoid regressions), out-of-line definitions of class members have been left in
the enclosing (named) namespace. But explicit specializations of class
templates had to be moved into the unnamed namespace to appease
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92598> "explicit specialization of
template from unnamed namespace using unqualified-id in enclosing namespace".
Also, accompanying declarations (of e.g. typedefs or static variables) that
could arguably be moved into the unnamed namespace too have been left alone.
And in some cases, mention of affected types in blacklists in other loplugins
needed to be adapted.
And sc/qa/unit/mark_test.cxx uses a hack of including other .cxx, one of which
is sc/source/core/data/segmenttree.cxx where e.g. ScFlatUInt16SegmentsImpl is
not moved into an unnamed namespace (because it is declared in
sc/inc/segmenttree.hxx), but its base ScFlatSegmentsImpl is. GCC warns about
such combinations with enabled-by-default -Wsubobject-linkage, but "The compiler
doesn’t give this warning for types defined in the main .C file, as those are
unlikely to have multiple definitions."
(<https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Warning-Options.html>) The
warned-about classes also don't have multiple definitions in the given test, so
disable the warning when including the .cxx.
Change-Id: Ib694094c0d8168be68f8fe90dfd0acbb66a3f1e4
Reviewed-on: https://gerrit.libreoffice.org/83239
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'vcl/source')
44 files changed, 373 insertions, 14 deletions
diff --git a/vcl/source/app/salvtables.cxx b/vcl/source/app/salvtables.cxx index e84c989841fa..c55b15367fde 100644 --- a/vcl/source/app/salvtables.cxx +++ b/vcl/source/app/salvtables.cxx @@ -235,6 +235,8 @@ SalMenuItem::~SalMenuItem() class SalInstanceBuilder; +namespace { + class SalInstanceWidget : public virtual weld::Widget { protected: @@ -735,6 +737,8 @@ public: } }; +} + void SalInstanceWidget::HandleEventListener(VclWindowEvent& rEvent) { if (rEvent.GetId() == VclEventId::WindowGetFocus) @@ -856,6 +860,8 @@ namespace } } +namespace { + class SalInstanceMenu : public weld::Menu { private: @@ -927,12 +933,16 @@ public: } }; +} + IMPL_LINK_NOARG(SalInstanceMenu, SelectMenuHdl, ::Menu*, bool) { signal_activate(m_xMenu->GetCurItemIdent()); return true; } +namespace { + class SalInstanceToolbar : public SalInstanceWidget, public virtual weld::Toolbar { private: @@ -1062,6 +1072,8 @@ public: } }; +} + IMPL_LINK_NOARG(SalInstanceToolbar, ClickHdl, ToolBox*, void) { sal_uInt16 nItemId = m_xToolBox->GetCurItemId(); @@ -1074,6 +1086,8 @@ IMPL_LINK_NOARG(SalInstanceToolbar, DropdownClick, ToolBox*, void) set_item_active(m_xToolBox->GetItemCommand(nItemId).toUtf8(), true); } +namespace { + class SalInstanceSizeGroup : public weld::SizeGroup { private: @@ -1156,6 +1170,8 @@ public: } }; +} + std::unique_ptr<weld::Container> SalInstanceWidget::weld_parent() const { vcl::Window* pParent = m_xWidget->GetParent(); @@ -1164,6 +1180,8 @@ std::unique_ptr<weld::Container> SalInstanceWidget::weld_parent() const return std::make_unique<SalInstanceContainer>(pParent, m_pBuilder, false); } +namespace { + class SalInstanceBox : public SalInstanceContainer, public virtual weld::Box { public: @@ -1179,8 +1197,6 @@ public: } }; -namespace -{ void CollectChildren(const vcl::Window& rCurrent, const basegfx::B2IPoint& rTopLeft, weld::ScreenShotCollection& rControlDataCollection) { if (rCurrent.IsVisible()) @@ -1205,7 +1221,6 @@ namespace } } } -} class SalInstanceWindow : public SalInstanceContainer, public virtual weld::Window { @@ -1395,6 +1410,8 @@ public: } }; +} + IMPL_LINK_NOARG(SalInstanceWindow, HelpHdl, vcl::Window&, bool) { help(); @@ -1424,7 +1441,6 @@ namespace } } } -} class SalInstanceDialog : public SalInstanceWindow, public virtual weld::Dialog { @@ -1616,6 +1632,8 @@ public: }; +} + IMPL_LINK(SalInstanceDialog, PopupScreenShotMenuHdl, const CommandEvent&, rCEvt, bool) { if (CommandEventId::ContextMenu == rCEvt.GetCommand()) @@ -1657,6 +1675,8 @@ IMPL_LINK(SalInstanceDialog, PopupScreenShotMenuHdl, const CommandEvent&, rCEvt, return false; } +namespace { + class SalInstanceMessageDialog : public SalInstanceDialog, public virtual weld::MessageDialog { private: @@ -1929,6 +1949,8 @@ public: } }; +} + IMPL_LINK_NOARG(SalInstanceAssistant, OnRoadmapItemSelected, LinkParamNone*, void) { if (notify_events_disabled()) @@ -1961,6 +1983,8 @@ IMPL_LINK_NOARG(SalInstanceAssistant, UpdateRoadmap_Hdl, Timer*, void) enable_notify_events(); } +namespace { + class SalInstanceFrame : public SalInstanceContainer, public virtual weld::Frame { private: @@ -2201,6 +2225,8 @@ public: } }; +} + IMPL_LINK(SalInstanceScrolledWindow, VscrollHdl, ScrollBar*, pScrollBar, void) { signal_vadjustment_changed(); @@ -2215,6 +2241,8 @@ IMPL_LINK_NOARG(SalInstanceScrolledWindow, HscrollHdl, ScrollBar*, void) m_aOrigHScrollHdl.Call(&m_xScrolledWindow->getHorzScrollBar()); } +namespace { + class SalInstanceNotebook : public SalInstanceContainer, public virtual weld::Notebook { private: @@ -2330,6 +2358,8 @@ public: } }; +} + IMPL_LINK_NOARG(SalInstanceNotebook, DeactivatePageHdl, TabControl*, bool) { return !m_aLeavePageHdl.IsSet() || m_aLeavePageHdl.Call(get_current_page_ident()); @@ -2340,6 +2370,8 @@ IMPL_LINK_NOARG(SalInstanceNotebook, ActivatePageHdl, TabControl*, void) m_aEnterPageHdl.Call(get_current_page_ident()); } +namespace { + class SalInstanceVerticalNotebook : public SalInstanceContainer, public virtual weld::Notebook { private: @@ -2436,6 +2468,8 @@ public: } }; +} + IMPL_LINK_NOARG(SalInstanceVerticalNotebook, DeactivatePageHdl, VerticalTabControl*, bool) { return !m_aLeavePageHdl.IsSet() || m_aLeavePageHdl.Call(get_current_page_ident()); @@ -2446,6 +2480,8 @@ IMPL_LINK_NOARG(SalInstanceVerticalNotebook, ActivatePageHdl, VerticalTabControl m_aEnterPageHdl.Call(get_current_page_ident()); } +namespace { + class SalInstanceButton : public SalInstanceContainer, public virtual weld::Button { private: @@ -2508,6 +2544,8 @@ public: } }; +} + IMPL_LINK(SalInstanceButton, ClickHdl, ::Button*, pButton, void) { //if there's no handler set, disengage our intercept and @@ -2547,6 +2585,8 @@ weld::Button* SalInstanceAssistant::weld_widget_for_response(int nResponse) return nullptr; } +namespace { + class SalInstanceMenuButton : public SalInstanceButton, public virtual weld::MenuButton { private: @@ -2676,6 +2716,8 @@ public: } }; +} + IMPL_LINK_NOARG(SalInstanceMenuButton, MenuSelectHdl, ::MenuButton*, void) { signal_selected(m_xMenuButton->GetCurItemIdent()); @@ -2688,6 +2730,8 @@ IMPL_LINK_NOARG(SalInstanceMenuButton, ActivateHdl, ::MenuButton*, void) signal_toggled(); } +namespace { + class SalInstanceLinkButton : public SalInstanceContainer, public virtual weld::LinkButton { private: @@ -2730,6 +2774,8 @@ public: } }; +} + IMPL_LINK(SalInstanceLinkButton, ClickHdl, FixedHyperlink&, rButton, void) { bool bConsumed = signal_activate_link(); @@ -2737,6 +2783,8 @@ IMPL_LINK(SalInstanceLinkButton, ClickHdl, FixedHyperlink&, rButton, void) m_aOrigClickHdl.Call(rButton); } +namespace { + class SalInstanceRadioButton : public SalInstanceButton, public virtual weld::RadioButton { private: @@ -2800,6 +2848,8 @@ public: } }; +} + IMPL_LINK_NOARG(SalInstanceRadioButton, ToggleHdl, ::RadioButton&, void) { if (notify_events_disabled()) @@ -2807,6 +2857,8 @@ IMPL_LINK_NOARG(SalInstanceRadioButton, ToggleHdl, ::RadioButton&, void) signal_toggled(); } +namespace { + class SalInstanceToggleButton : public SalInstanceButton, public virtual weld::ToggleButton { private: @@ -2859,6 +2911,8 @@ public: } }; +} + IMPL_LINK(SalInstanceToggleButton, ToggleListener, VclWindowEvent&, rEvent, void) { if (notify_events_disabled()) @@ -2867,6 +2921,8 @@ IMPL_LINK(SalInstanceToggleButton, ToggleListener, VclWindowEvent&, rEvent, void signal_toggled(); } +namespace { + class SalInstanceCheckButton : public SalInstanceButton, public virtual weld::CheckButton { private: @@ -2913,6 +2969,8 @@ public: } }; +} + IMPL_LINK_NOARG(SalInstanceCheckButton, ToggleHdl, CheckBox&, void) { if (notify_events_disabled()) @@ -2921,6 +2979,8 @@ IMPL_LINK_NOARG(SalInstanceCheckButton, ToggleHdl, CheckBox&, void) signal_toggled(); } +namespace { + class SalInstanceScale : public SalInstanceWidget, public virtual weld::Scale { private: @@ -2957,11 +3017,15 @@ public: } }; +} + IMPL_LINK_NOARG(SalInstanceScale, SlideHdl, Slider*, void) { signal_value_changed(); } +namespace { + class SalInstanceSpinner : public SalInstanceWidget, public virtual weld::Spinner { private: @@ -3075,6 +3139,8 @@ public: } }; +} + IMPL_LINK_NOARG(SalInstanceCalendar, SelectHdl, ::Calendar*, void) { if (notify_events_disabled()) @@ -3113,7 +3179,6 @@ namespace return sText; } }; -} class SalInstanceEntry : public SalInstanceWidget, public virtual weld::Entry { @@ -3282,6 +3347,8 @@ public: } }; +} + IMPL_LINK_NOARG(SalInstanceEntry, ChangeHdl, Edit&, void) { signal_changed(); @@ -3300,6 +3367,8 @@ IMPL_LINK_NOARG(SalInstanceEntry, ActivateHdl, Edit&, bool) return m_aActivateHdl.Call(*this); } +namespace { + struct SalInstanceTreeIter : public weld::TreeIter { SalInstanceTreeIter(const SalInstanceTreeIter* pOrig) @@ -3317,8 +3386,6 @@ struct SalInstanceTreeIter : public weld::TreeIter SvTreeListEntry* iter; }; -namespace -{ TriState get_toggle(SvTreeListEntry* pEntry, int col) { ++col; //skip dummy/expander column @@ -4939,6 +5006,8 @@ IMPL_LINK_NOARG(SalInstanceIconView, DoubleClickHdl, SvTreeListBox*, bool) return !signal_item_activated(); } +namespace { + class SalInstanceSpinButton : public SalInstanceEntry, public virtual weld::SpinButton { private: @@ -5046,6 +5115,8 @@ public: } }; +} + IMPL_LINK_NOARG(SalInstanceSpinButton, ActivateHdl, Edit&, bool) { // tdf#122348 return pressed to end dialog @@ -5077,6 +5148,8 @@ IMPL_LINK(SalInstanceSpinButton, InputHdl, sal_Int64*, pResult, TriState) return eRet; } +namespace { + class SalInstanceFormattedSpinButton : public SalInstanceEntry, public virtual weld::FormattedSpinButton { private: @@ -5181,6 +5254,8 @@ public: } }; +} + std::unique_ptr<weld::Label> SalInstanceFrame::weld_label_widget() const { FixedText* pLabel = dynamic_cast<FixedText*>(m_xFrame->get_label_widget()); @@ -5189,6 +5264,8 @@ std::unique_ptr<weld::Label> SalInstanceFrame::weld_label_widget() const return std::make_unique<SalInstanceLabel>(pLabel, m_pBuilder, false); } +namespace { + class SalInstanceTextView : public SalInstanceContainer, public virtual weld::TextView { private: @@ -5312,6 +5389,8 @@ public: } }; +} + IMPL_LINK(SalInstanceTextView, VscrollHdl, ScrollBar*, pScrollBar, void) { signal_vadjustment_changed(); @@ -5331,6 +5410,8 @@ IMPL_LINK(SalInstanceTextView, CursorListener, VclWindowEvent&, rEvent, void) signal_cursor_position(); } +namespace { + class SalInstanceExpander : public SalInstanceContainer, public virtual weld::Expander { private: @@ -5362,11 +5443,15 @@ public: } }; +} + IMPL_LINK_NOARG(SalInstanceExpander, ExpandedHdl, VclExpander&, void) { signal_expanded(); } +namespace { + class SalInstanceDrawingArea : public SalInstanceWidget, public virtual weld::DrawingArea { private: @@ -5522,6 +5607,8 @@ public: } }; +} + IMPL_LINK(SalInstanceDrawingArea, PaintHdl, target_and_area, aPayload, void) { m_aDrawHdl.Call(aPayload); @@ -5575,6 +5662,8 @@ IMPL_LINK(SalInstanceDrawingArea, QueryTooltipHdl, tools::Rectangle&, rHelpArea, return m_aQueryTooltipHdl.Call(rHelpArea); } +namespace { + //ComboBox and ListBox have similar apis, ComboBoxes in LibreOffice have an edit box and ListBoxes //don't. This distinction isn't there in Gtk. Use a template to sort this problem out. template <class vcl_type> @@ -5831,11 +5920,15 @@ public: } }; +} + IMPL_LINK_NOARG(SalInstanceComboBoxWithoutEdit, SelectHdl, ListBox&, void) { return signal_changed(); } +namespace { + class SalInstanceComboBoxWithEdit : public SalInstanceComboBox<ComboBox> { private: @@ -5941,6 +6034,8 @@ public: } }; +} + IMPL_LINK_NOARG(SalInstanceComboBoxWithEdit, ChangeHdl, Edit&, void) { signal_changed(); diff --git a/vcl/source/app/session.cxx b/vcl/source/app/session.cxx index faa717702326..98cad6bba0b8 100644 --- a/vcl/source/app/session.cxx +++ b/vcl/source/app/session.cxx @@ -46,6 +46,8 @@ SalSession::~SalSession() { } +namespace { + class VCLSession: private cppu::BaseMutex, public cppu::WeakComponentImplHelper < XSessionManagerClient > @@ -94,6 +96,8 @@ public: VCLSession(); }; +} + VCLSession::VCLSession() : cppu::WeakComponentImplHelper< XSessionManagerClient >( m_aMutex ), m_xSession( ImplGetSVData()->mpDefInst->CreateSalSession() ), diff --git a/vcl/source/app/svmain.cxx b/vcl/source/app/svmain.cxx index e032edcc710f..cd6f3b781823 100644 --- a/vcl/source/app/svmain.cxx +++ b/vcl/source/app/svmain.cxx @@ -232,6 +232,8 @@ static Application * pOwnSvApp = nullptr; // Exception handler. pExceptionHandler != NULL => VCL already inited static oslSignalHandler pExceptionHandler = nullptr; +namespace { + class DesktopEnvironmentContext: public cppu::WeakImplHelper< css::uno::XCurrentContext > { public: @@ -245,6 +247,8 @@ private: css::uno::Reference< css::uno::XCurrentContext > m_xNextContext; }; +} + uno::Any SAL_CALL DesktopEnvironmentContext::getValueByName( const OUString& Name) { uno::Any retVal; @@ -586,6 +590,8 @@ void DeInitVCL() EmbeddedFontsHelper::clearTemporaryFontFiles(); } +namespace { + // only one call is allowed struct WorkerThreadData { @@ -598,6 +604,8 @@ struct WorkerThreadData } }; +} + #ifdef _WIN32 static HANDLE hThreadID = nullptr; static unsigned __stdcall threadmain( void *pArgs ) diff --git a/vcl/source/components/dtranscomp.cxx b/vcl/source/components/dtranscomp.cxx index 380719541311..92cf951211b4 100644 --- a/vcl/source/components/dtranscomp.cxx +++ b/vcl/source/components/dtranscomp.cxx @@ -45,6 +45,8 @@ using namespace com::sun::star::lang; namespace vcl { +namespace { + // generic implementation to satisfy SalInstance class GenericClipboard : public cppu::WeakComponentImplHelper< @@ -103,6 +105,8 @@ public: const Reference< css::datatransfer::clipboard::XClipboardListener >& listener ) override; }; +} + Sequence< OUString > GenericClipboard::getSupportedServiceNames_static() { Sequence< OUString > aRet { "com.sun.star.datatransfer.clipboard.SystemClipboard" }; @@ -177,6 +181,8 @@ void GenericClipboard::removeClipboardListener( const Reference< datatransfer::c m_aListeners.erase(std::remove(m_aListeners.begin(), m_aListeners.end(), listener), m_aListeners.end()); } +namespace { + class ClipboardFactory : public ::cppu::WeakComponentImplHelper< css::lang::XSingleServiceFactory > @@ -192,6 +198,8 @@ public: virtual Reference< XInterface > SAL_CALL createInstanceWithArguments( const Sequence< Any >& rArgs ) override; }; +} + ClipboardFactory::ClipboardFactory() : cppu::WeakComponentImplHelper< css::lang::XSingleServiceFactory @@ -233,6 +241,8 @@ Reference< XSingleServiceFactory > Clipboard_createFactory() return Reference< XSingleServiceFactory >( new ClipboardFactory() ); } +namespace { + /* * generic DragSource dummy */ @@ -275,6 +285,8 @@ public: } }; +} + sal_Bool GenericDragSource::isDragImageSupported() { return false; @@ -334,6 +346,8 @@ Reference< XInterface > DragSource_createInstance( const Reference< XMultiServic * generic DragSource dummy */ +namespace { + class GenericDropTarget : public cppu::WeakComponentImplHelper< datatransfer::dnd::XDropTarget, XInitialization, @@ -372,6 +386,8 @@ public: } }; +} + void GenericDropTarget::initialize( const Sequence< Any >& ) { } diff --git a/vcl/source/components/fontident.cxx b/vcl/source/components/fontident.cxx index 2da25d18eb63..b5ad54e5d612 100644 --- a/vcl/source/components/fontident.cxx +++ b/vcl/source/components/fontident.cxx @@ -44,6 +44,8 @@ using namespace ::com::sun::star::awt; namespace vcl { +namespace { + class FontIdentificator : public ::cppu::WeakAggImplHelper3< XMaterialHolder, XInitialization, XServiceInfo > { Font m_aFont; @@ -63,6 +65,8 @@ FontIdentificator() {} }; +} + void SAL_CALL FontIdentificator::initialize( const Sequence<Any>& i_rArgs ) { if( !ImplGetSVData() ) diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index e8a536f1f8ae..c96591bc2714 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -33,6 +33,8 @@ #include <controldata.hxx> #include <comphelper/lok.hxx> +namespace { + struct ComboBoxBounds { Point aSubEditPos; @@ -42,6 +44,8 @@ struct ComboBoxBounds Size aButtonSize; }; +} + struct ComboBox::Impl { ComboBox & m_rThis; diff --git a/vcl/source/control/imp_listbox.cxx b/vcl/source/control/imp_listbox.cxx index fb6da7b2c6e6..9d9de05b93cd 100644 --- a/vcl/source/control/imp_listbox.cxx +++ b/vcl/source/control/imp_listbox.cxx @@ -581,6 +581,8 @@ void ImplListBoxWindow::SetUserItemSize( const Size& rSz ) ImplCalcMetrics(); } +namespace { + struct ImplEntryMetrics { bool bText; @@ -592,6 +594,8 @@ struct ImplEntryMetrics long nImgHeight; }; +} + long ImplEntryType::getHeightWithMargin() const { return mnHeight + ImplGetSVData()->maNWFData.mnListBoxEntryMargin; diff --git a/vcl/source/control/roadmap.cxx b/vcl/source/control/roadmap.cxx index 8d228e629c4b..3b954c156ccf 100644 --- a/vcl/source/control/roadmap.cxx +++ b/vcl/source/control/roadmap.cxx @@ -38,6 +38,8 @@ typedef std::vector< RoadmapItem* > HL_Vector; //= ColorChanger +namespace { + class IDLabel : public FixedText { public: @@ -46,6 +48,8 @@ public: virtual void ApplySettings(vcl::RenderContext& rRenderContext) override; }; +} + class RoadmapItem : public RoadmapTypes { private: diff --git a/vcl/source/filter/graphicfilter.cxx b/vcl/source/filter/graphicfilter.cxx index 468ff983c4f2..a0d64ddf2907 100644 --- a/vcl/source/filter/graphicfilter.cxx +++ b/vcl/source/filter/graphicfilter.cxx @@ -83,6 +83,8 @@ static ::osl::Mutex& getListMutex() return s_aListProtection; } +namespace { + class ImpFilterOutputStream : public ::cppu::WeakImplHelper< css::io::XOutputStream > { SvStream& mrStm; @@ -98,6 +100,8 @@ public: explicit ImpFilterOutputStream( SvStream& rStm ) : mrStm( rStm ) {} }; +} + static bool DirEntryExists( const INetURLObject& rObj ) { bool bExists = false; @@ -642,6 +646,8 @@ static OUString ImpCreateFullFilterPath( const OUString& rPath, const OUString& return aSystemPath; } +namespace { + class ImpFilterLibCache; struct ImpFilterLibCacheEntry @@ -660,6 +666,8 @@ struct ImpFilterLibCacheEntry PFilterCall GetImportFunction(); }; +} + ImpFilterLibCacheEntry::ImpFilterLibCacheEntry( const OUString& rPathname, const OUString& rFiltername, const OUString& rFormatName ) : mpNext ( nullptr ), #ifndef DISABLE_DYNLOADING @@ -746,6 +754,8 @@ PFilterCall ImpFilterLibCacheEntry::GetImportFunction() return mpfnImport; } +namespace { + class ImpFilterLibCache { ImpFilterLibCacheEntry* mpFirst; @@ -758,6 +768,8 @@ public: ImpFilterLibCacheEntry* GetFilter( const OUString& rFilterPath, const OUString& rFiltername, const OUString& rFormatName ); }; +} + ImpFilterLibCache::ImpFilterLibCache() : mpFirst ( nullptr ), mpLast ( nullptr ) @@ -1028,6 +1040,8 @@ ErrCode GraphicFilter::ImportGraphic( return ImportGraphic( rGraphic, rPath, rIStream, nFormat, pDeterminedFormat, nImportFlags, nullptr, pExtHeader ); } +namespace { + /// Contains a stream and other associated data to import pixels into a /// Graphic. struct GraphicImportContext @@ -1059,6 +1073,8 @@ public: static void doImport(GraphicImportContext& rContext); }; +} + GraphicImportTask::GraphicImportTask(const std::shared_ptr<comphelper::ThreadTaskTag>& pTag, GraphicImportContext& rContext) : comphelper::ThreadTask(pTag), m_rContext(rContext) diff --git a/vcl/source/filter/igif/gifread.cxx b/vcl/source/filter/igif/gifread.cxx index 34e35738bb6b..1e30f5b637f5 100644 --- a/vcl/source/filter/igif/gifread.cxx +++ b/vcl/source/filter/igif/gifread.cxx @@ -53,6 +53,8 @@ class GIFLZWDecompressor; class SvStream; +namespace { + class GIFReader : public GraphicReader { Animation aAnimation; @@ -117,6 +119,8 @@ public: explicit GIFReader( SvStream& rStm ); }; +} + GIFReader::GIFReader( SvStream& rStm ) : nAnimationByteSize(0) , nAnimationMinFileData(0) diff --git a/vcl/source/filter/ipdf/pdfdocument.cxx b/vcl/source/filter/ipdf/pdfdocument.cxx index 02bde3fcaedb..aeeb91104c92 100644 --- a/vcl/source/filter/ipdf/pdfdocument.cxx +++ b/vcl/source/filter/ipdf/pdfdocument.cxx @@ -37,6 +37,8 @@ const int MAX_SIGNATURE_CONTENT_LENGTH = 50000; class PDFTrailerElement; +namespace +{ /// A one-liner comment. class PDFCommentElement : public PDFElement { @@ -47,9 +49,12 @@ public: explicit PDFCommentElement(PDFDocument& rDoc); bool Read(SvStream& rStream) override; }; +} class PDFReferenceElement; +namespace +{ /// End of a dictionary: '>>'. class PDFEndDictionaryElement : public PDFElement { @@ -102,6 +107,7 @@ class PDFNullElement : public PDFElement public: bool Read(SvStream& rStream) override; }; +} /// The trailer singleton is at the end of the doc. class PDFTrailerElement : public PDFElement diff --git a/vcl/source/filter/ixbm/xbmread.cxx b/vcl/source/filter/ixbm/xbmread.cxx index bea2791ea56c..9b279e5cdb15 100644 --- a/vcl/source/filter/ixbm/xbmread.cxx +++ b/vcl/source/filter/ixbm/xbmread.cxx @@ -41,8 +41,6 @@ enum ReadState XBMREAD_NEED_MORE }; -} - class XBMReader : public GraphicReader { SvStream& rIStm; @@ -69,6 +67,8 @@ public: ReadState ReadXBM( Graphic& rGraphic ); }; +} + XBMReader::XBMReader( SvStream& rStm ) : rIStm ( rStm ), nLastPos ( rStm.Tell() ), diff --git a/vcl/source/filter/ixpm/xpmread.cxx b/vcl/source/filter/ixpm/xpmread.cxx index 36183e74e327..170193979008 100644 --- a/vcl/source/filter/ixpm/xpmread.cxx +++ b/vcl/source/filter/ixpm/xpmread.cxx @@ -56,6 +56,8 @@ enum ReadState class BitmapWriteAccess; class Graphic; +namespace { + class XPMReader : public GraphicReader { private: @@ -108,6 +110,8 @@ public: ReadState ReadXPM( Graphic& rGraphic ); }; +} + XPMReader::XPMReader(SvStream& rStm) : mrIStm(rStm) , mnLastPos(rStm.Tell()) diff --git a/vcl/source/filter/jpeg/JpegWriter.cxx b/vcl/source/filter/jpeg/JpegWriter.cxx index d99e46e4d8b1..0098957a5995 100644 --- a/vcl/source/filter/jpeg/JpegWriter.cxx +++ b/vcl/source/filter/jpeg/JpegWriter.cxx @@ -32,6 +32,8 @@ #define BUFFER_SIZE 4096 +namespace { + struct DestinationManagerStruct { jpeg_destination_mgr pub; /* public fields */ @@ -39,6 +41,8 @@ struct DestinationManagerStruct JOCTET * buffer; /* start of buffer */ }; +} + extern "C" { static void init_destination (j_compress_ptr cinfo) diff --git a/vcl/source/filter/jpeg/jpegc.cxx b/vcl/source/filter/jpeg/jpegc.cxx index 8a57f5559217..724f5b797ccc 100644 --- a/vcl/source/filter/jpeg/jpegc.cxx +++ b/vcl/source/filter/jpeg/jpegc.cxx @@ -43,12 +43,16 @@ extern "C" { #pragma warning (disable: 4324) /* disable to __declspec(align()) aligned warning */ #endif +namespace { + struct ErrorManagerStruct { jpeg_error_mgr pub; jmp_buf setjmp_buffer; }; +} + #ifdef _MSC_VER #pragma warning(pop) #endif @@ -99,6 +103,8 @@ static void emitMessage (j_common_ptr cinfo, int msg_level) } +namespace { + class JpegDecompressOwner { public: @@ -145,6 +151,8 @@ struct JpegStuff std::vector<sal_uInt8> pCYMKBuffer; }; +} + static void ReadJPEG(JpegStuff& rContext, JPEGReader* pJPEGReader, void* pInputStream, long* pLines, Size const & previewSize, GraphicFilterImportFlags nImportFlags, BitmapScopedWriteAccess* ppAccess) diff --git a/vcl/source/fontsubset/cff.cxx b/vcl/source/fontsubset/cff.cxx index 17112310ece0..c1b4724d3db0 100644 --- a/vcl/source/fontsubset/cff.cxx +++ b/vcl/source/fontsubset/cff.cxx @@ -161,6 +161,8 @@ static const char* pDictEscs[] = { "nFDArray", "nFDSelect", "sFontName" }; +namespace { + struct TYPE1OP { enum OPS @@ -345,6 +347,8 @@ private: ValType maCharWidth; }; +} + CffSubsetterContext::CffSubsetterContext( const U8* pBasePtr, int nBaseLen) : mpBasePtr( pBasePtr) , mpBaseEnd( pBasePtr+nBaseLen) @@ -1575,6 +1579,8 @@ const char* CffSubsetterContext::getGlyphName( int nGlyphIndex) return pGlyphName; } +namespace { + class Type1Emitter { public: @@ -1601,6 +1607,8 @@ public: int mnHexLineCol; }; +} + Type1Emitter::Type1Emitter( FILE* pOutFile, bool bPfbSubset) : mpFileOut( pOutFile) , maBuffer{} diff --git a/vcl/source/fontsubset/list.cxx b/vcl/source/fontsubset/list.cxx index 5645386f5479..aca585678e9c 100644 --- a/vcl/source/fontsubset/list.cxx +++ b/vcl/source/fontsubset/list.cxx @@ -30,6 +30,8 @@ #include "list.h" +namespace { + /*- private data types */ struct lnode { struct lnode *next; @@ -39,6 +41,8 @@ struct lnode { }; +} + struct list_ { lnode *head, *tail, *cptr; size_t aCount; diff --git a/vcl/source/fontsubset/sft.cxx b/vcl/source/fontsubset/sft.cxx index 7b905f558051..5efdf3230977 100644 --- a/vcl/source/fontsubset/sft.cxx +++ b/vcl/source/fontsubset/sft.cxx @@ -64,8 +64,6 @@ enum PathSegmentType { PS_CLOSEPATH = 4 }; -} - struct PSPathElement { PathSegmentType type; @@ -107,6 +105,8 @@ struct GlyphOffsets { sal_uInt32 *offs; /* array of nGlyphs offsets */ }; +} + static void *smalloc(size_t size) { void *res = malloc(size); @@ -1042,6 +1042,8 @@ static sal_uInt32 getGlyph0(const sal_uInt8* cmap, sal_uInt32, sal_uInt32 c) { } } +namespace { + struct subHeader2 { sal_uInt16 const firstCode; sal_uInt16 const entryCount; @@ -1049,6 +1051,8 @@ struct subHeader2 { sal_uInt16 idRangeOffset; }; +} + static sal_uInt32 getGlyph2(const sal_uInt8 *cmap, const sal_uInt32 nMaxCmapSize, sal_uInt32 c) { sal_uInt16 const *CMAP2 = reinterpret_cast<sal_uInt16 const *>(cmap); sal_uInt8 theHighByte; diff --git a/vcl/source/fontsubset/ttcr.cxx b/vcl/source/fontsubset/ttcr.cxx index e78f6d01853b..5d2f337c6c88 100644 --- a/vcl/source/fontsubset/ttcr.cxx +++ b/vcl/source/fontsubset/ttcr.cxx @@ -39,12 +39,16 @@ namespace vcl list tables; /**< List of table tags and pointers */ }; +namespace { + struct TableEntry { sal_uInt32 tag; sal_uInt32 length; sal_uInt8 *data; }; +} + /*- Data access macros for data stored in big-endian or little-endian format */ static sal_Int16 GetInt16( const sal_uInt8* ptr, sal_uInt32 offset) { @@ -307,6 +311,8 @@ SFErrCodes StreamToFile(TrueTypeCreator *_this, const char* fname) #define CMAP_PAIR_INIT 500 #define CMAP_PAIR_INCR 500 +namespace { + struct CmapSubTable { sal_uInt32 id; /* subtable ID (platform/encoding ID) */ sal_uInt32 n; /* number of used translation pairs */ @@ -341,6 +347,8 @@ struct tdata_post { void *ptr; /* format-specific pointer */ }; +} + /* allocate memory for a TT table */ static sal_uInt8 *ttmalloc(sal_uInt32 nbytes) { diff --git a/vcl/source/gdi/CommonSalLayout.cxx b/vcl/source/gdi/CommonSalLayout.cxx index f0acbdd99114..38c4760a9ec2 100644 --- a/vcl/source/gdi/CommonSalLayout.cxx +++ b/vcl/source/gdi/CommonSalLayout.cxx @@ -80,6 +80,8 @@ void GenericSalLayout::ParseFeatures(const OUString& aName) } } +namespace { + struct SubRun { int32_t mnMin; @@ -88,7 +90,11 @@ struct SubRun hb_direction_t maDirection; }; +} + namespace vcl { + namespace { + struct Run { int32_t const nStart; @@ -101,6 +107,8 @@ namespace vcl { {} }; + } + class TextLayoutCache { public: diff --git a/vcl/source/gdi/bmpfast.cxx b/vcl/source/gdi/bmpfast.cxx index 36423b1e206e..aa6d724d6a07 100644 --- a/vcl/source/gdi/bmpfast.cxx +++ b/vcl/source/gdi/bmpfast.cxx @@ -26,6 +26,8 @@ typedef unsigned char PIXBYTE; +namespace { + class BasePixelPtr { public: @@ -187,6 +189,8 @@ class TrueColorPixelPtr<ScanlineFormat::N8BitPal> : public TrueColorPixelPtr<ScanlineFormat::N8BitTcMask> {}; +} + // converting truecolor formats template <ScanlineFormat SRCFMT, ScanlineFormat DSTFMT> static void ImplConvertPixel( const TrueColorPixelPtr<DSTFMT>& rDst, diff --git a/vcl/source/gdi/gdimtf.cxx b/vcl/source/gdi/gdimtf.cxx index dea25de63719..bd83aab83f68 100644 --- a/vcl/source/gdi/gdimtf.cxx +++ b/vcl/source/gdi/gdimtf.cxx @@ -51,6 +51,8 @@ using namespace com::sun::star; #define GAMMA( _def_cVal, _def_InvGamma ) (static_cast<sal_uInt8>(MinMax(FRound(pow( _def_cVal/255.0,_def_InvGamma)*255.0),0,255))) +namespace { + struct ImplColAdjustParam { std::unique_ptr<sal_uInt8[]> pMapR; @@ -108,6 +110,8 @@ struct ImplBmpReplaceParam sal_uLong nCount; }; +} + GDIMetaFile::GDIMetaFile() : m_nCurrentActionElement( 0 ), m_aPrefSize ( 1, 1 ), diff --git a/vcl/source/gdi/impvect.cxx b/vcl/source/gdi/impvect.cxx index 5ecfb6aedbd1..d060b9d7c490 100644 --- a/vcl/source/gdi/impvect.cxx +++ b/vcl/source/gdi/impvect.cxx @@ -55,9 +55,13 @@ static void VECT_PROGRESS( const Link<long, void>* pProgress, long _def_nVal ) pProgress->Call(_def_nVal); } +namespace { + class ImplVectMap; class ImplChain; +} + namespace ImplVectorizer { static ImplVectMap* ImplExpand( BitmapReadAccess* pRAcc, const Color& rColor ); @@ -67,8 +71,12 @@ namespace ImplVectorizer static void ImplLimitPolyPoly( tools::PolyPolygon& rPolyPoly ); } +namespace { + struct ChainMove { long nDX; long nDY; }; +} + static const ChainMove aImplMove[ 8 ] = { { 1, 0 }, { 0, -1 }, @@ -102,6 +110,8 @@ static const ChainMove aImplMoveOuter[ 8 ] = { { 0, -1 } }; +namespace { + struct ImplColorSet { BitmapColor maColor; @@ -109,6 +119,8 @@ struct ImplColorSet bool mbSet = false; }; +} + static bool ImplColorSetCmpFnc( const ImplColorSet& lhs, const ImplColorSet& rhs) { if( lhs.mbSet && rhs.mbSet ) @@ -120,6 +132,8 @@ static bool ImplColorSetCmpFnc( const ImplColorSet& lhs, const ImplColorSet& rhs return lhs.mbSet < rhs.mbSet; } +namespace { + class ImplPointArray { std::unique_ptr<Point[]> mpArray; @@ -140,6 +154,8 @@ public: }; +} + ImplPointArray::ImplPointArray() : mnSize ( 0 ), mnRealSize ( 0 ) @@ -174,6 +190,8 @@ void ImplPointArray::ImplCreatePoly( tools::Polygon& rPoly ) const rPoly = tools::Polygon( sal::static_int_cast<sal_uInt16>(mnRealSize), mpArray.get() ); } +namespace { + class ImplVectMap { private: @@ -200,6 +218,8 @@ public: }; +} + ImplVectMap::ImplVectMap( long nWidth, long nHeight ) : mpBuf ( static_cast<Scanline>(rtl_allocateZeroMemory(nWidth * nHeight)) ), mpScan ( static_cast<Scanline*>(std::malloc(nHeight * sizeof(Scanline))) ), @@ -246,6 +266,8 @@ inline bool ImplVectMap::IsDone( long nY, long nX ) const return( VECT_DONE_INDEX == Get( nY, nX ) ); } +namespace { + class ImplChain { private: @@ -275,6 +297,8 @@ public: const tools::Polygon& ImplGetPoly() const { return maPoly; } }; +} + ImplChain::ImplChain() : mnArraySize ( 1024 ), mnCount ( 0 ), diff --git a/vcl/source/gdi/jobset.cxx b/vcl/source/gdi/jobset.cxx index b1ca8e3f80f7..a861169c9698 100644 --- a/vcl/source/gdi/jobset.cxx +++ b/vcl/source/gdi/jobset.cxx @@ -29,6 +29,8 @@ #define JOBSET_FILE364_SYSTEM (sal_uInt16(0xFFFF)) #define JOBSET_FILE605_SYSTEM (sal_uInt16(0xFFFE)) +namespace { + struct ImplOldJobSetupData { char cPrinterName[64]; @@ -49,6 +51,8 @@ struct Impl364JobSetupData SVBT32 nPaperHeight; }; +} + ImplJobSetup::ImplJobSetup() { mnSystem = 0; diff --git a/vcl/source/gdi/oldprintadaptor.cxx b/vcl/source/gdi/oldprintadaptor.cxx index ad5cb8279dad..05a6f9bbee2e 100644 --- a/vcl/source/gdi/oldprintadaptor.cxx +++ b/vcl/source/gdi/oldprintadaptor.cxx @@ -32,12 +32,16 @@ using namespace com::sun::star::beans; namespace vcl { + namespace { + struct AdaptorPage { GDIMetaFile maPage; css::awt::Size maPageSize; }; + } + struct ImplOldStyleAdaptorData { std::vector< AdaptorPage > maPages; diff --git a/vcl/source/gdi/pdfextoutdevdata.cxx b/vcl/source/gdi/pdfextoutdevdata.cxx index b87cee3037c4..e36cb0e9ceef 100644 --- a/vcl/source/gdi/pdfextoutdevdata.cxx +++ b/vcl/source/gdi/pdfextoutdevdata.cxx @@ -35,6 +35,8 @@ namespace vcl { +namespace { + struct PDFExtOutDevDataSync { enum Action{ CreateNamedDest, @@ -75,6 +77,8 @@ struct PDFLinkDestination PDFWriter::DestAreaType mAreaType; }; +} + struct GlobalSyncData { std::deque< PDFExtOutDevDataSync::Action > mActions; diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 83d5c75bc912..eefdc53b4db7 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -5519,6 +5519,8 @@ bool PDFWriterImpl::emitTrailer() return writeBuffer( aLine.getStr(), aLine.getLength() ); } +namespace { + struct AnnotationSortEntry { sal_Int32 nTabOrder; @@ -5570,6 +5572,8 @@ struct AnnotSorterLess } }; +} + void PDFWriterImpl::sortWidgets() { // sort widget annotations on each page as per their diff --git a/vcl/source/gdi/pdfwriter_impl2.cxx b/vcl/source/gdi/pdfwriter_impl2.cxx index 4dbc13bc6079..8556d4c570d8 100644 --- a/vcl/source/gdi/pdfwriter_impl2.cxx +++ b/vcl/source/gdi/pdfwriter_impl2.cxx @@ -1665,6 +1665,8 @@ void PDFWriterImpl::putG4Bits( sal_uInt32 i_nLength, sal_uInt32 i_nCode, BitStre } } +namespace { + struct PixelCode { sal_uInt32 const mnEncodedPixels; @@ -1672,6 +1674,8 @@ struct PixelCode sal_uInt32 const mnCode; }; +} + static const PixelCode WhitePixelCodes[] = { { 0, 8, 0x35 }, // 0011 0101 diff --git a/vcl/source/gdi/print2.cxx b/vcl/source/gdi/print2.cxx index 8d01492af20e..db4b6dd0af72 100644 --- a/vcl/source/gdi/print2.cxx +++ b/vcl/source/gdi/print2.cxx @@ -39,6 +39,8 @@ typedef ::std::pair< MetaAction*, int > Component; // MetaAction plus index in metafile +namespace { + // List of (intersecting) actions, plus overall bounds struct ConnectedComponents { @@ -57,6 +59,8 @@ struct ConnectedComponents bool bIsFullyTransparent; }; +} + typedef ::std::vector< ConnectedComponents > ConnectedComponentsList; namespace { diff --git a/vcl/source/gdi/print3.cxx b/vcl/source/gdi/print3.cxx index 50b20930cf19..0b2721b718cf 100644 --- a/vcl/source/gdi/print3.cxx +++ b/vcl/source/gdi/print3.cxx @@ -47,6 +47,8 @@ using namespace vcl; +namespace { + class ImplPageCache { struct CacheEntry @@ -122,6 +124,8 @@ public: } }; +} + class vcl::ImplPrinterControllerData { public: @@ -271,6 +275,8 @@ static OUString queryFile( Printer const * pPrinter ) return aResult; } +namespace { + struct PrintJobAsync { std::shared_ptr<PrinterController> mxController; @@ -284,6 +290,8 @@ struct PrintJobAsync DECL_LINK( ExecJob, void*, void ); }; +} + IMPL_LINK_NOARG(PrintJobAsync, ExecJob, void*, void) { Printer::ImplPrintJob(mxController, maInitSetup); diff --git a/vcl/source/image/ImplImageTree.cxx b/vcl/source/image/ImplImageTree.cxx index df561e87a842..59a4e6014464 100644 --- a/vcl/source/image/ImplImageTree.cxx +++ b/vcl/source/image/ImplImageTree.cxx @@ -631,6 +631,8 @@ OUString const & ImplImageTree::getRealImageName(OUString const & rIconName) return rIconName; } +namespace { + class FolderFileAccess : public ::cppu::WeakImplHelper<css::container::XNameAccess> { public: @@ -658,6 +660,8 @@ public: } }; +} + bool ImplImageTree::checkPathAccess() { IconSet& rIconSet = getCurrentIconSet(); diff --git a/vcl/source/treelist/transfer.cxx b/vcl/source/treelist/transfer.cxx index 38611e2c200a..ec157133e7d6 100644 --- a/vcl/source/treelist/transfer.cxx +++ b/vcl/source/treelist/transfer.cxx @@ -1051,6 +1051,8 @@ const Sequence< sal_Int8 >& TransferableHelper::getUnoTunnelId() return theTransferableHelperUnoTunnelId::get().getSeq(); } +namespace { + class TransferableClipboardNotifier : public ::cppu::WeakImplHelper< XClipboardListener > { private: @@ -1075,6 +1077,7 @@ public: void dispose(); }; +} TransferableClipboardNotifier::TransferableClipboardNotifier( const Reference< XClipboard >& _rxClipboard, TransferableDataHelper& _rListener, ::osl::Mutex& _rMutex ) :mrMutex( _rMutex ) diff --git a/vcl/source/treelist/transfer2.cxx b/vcl/source/treelist/transfer2.cxx index f1ff1daaa7d7..367e6c84f5e2 100644 --- a/vcl/source/treelist/transfer2.cxx +++ b/vcl/source/treelist/transfer2.cxx @@ -302,6 +302,7 @@ bool DropTargetHelper::IsDropFormatSupported( SotClipboardFormatId nFormat ) // TransferDataContainer +namespace { struct TDataCntnrEntry_Impl { @@ -309,6 +310,7 @@ struct TDataCntnrEntry_Impl SotClipboardFormatId nId; }; +} typedef ::std::vector< TDataCntnrEntry_Impl > TDataCntnrEntryList; diff --git a/vcl/source/treelist/treelistbox.cxx b/vcl/source/treelist/treelistbox.cxx index 20a754e3866f..601574b95d23 100644 --- a/vcl/source/treelist/treelistbox.cxx +++ b/vcl/source/treelist/treelistbox.cxx @@ -58,6 +58,8 @@ static VclPtr<SvTreeListBox> g_pDDTarget; // *************************************************************** +namespace { + class MyEdit_Impl : public Edit { SvInplaceEdit2* pOwner; @@ -69,6 +71,8 @@ public: virtual void LoseFocus() override; }; +} + MyEdit_Impl::MyEdit_Impl( vcl::Window* pParent, SvInplaceEdit2* _pOwner ) : Edit( pParent, WB_LEFT ), diff --git a/vcl/source/uipreviewer/previewer.cxx b/vcl/source/uipreviewer/previewer.cxx index 47fe2099e9fc..f089a75fcdc9 100644 --- a/vcl/source/uipreviewer/previewer.cxx +++ b/vcl/source/uipreviewer/previewer.cxx @@ -20,6 +20,8 @@ #include <vcl/svapp.hxx> #include <vcl/vclmain.hxx> +namespace { + class UIPreviewApp : public Application { public: @@ -27,6 +29,8 @@ public: virtual int Main() override; }; +} + using namespace com::sun::star; void UIPreviewApp::Init() diff --git a/vcl/source/uitest/uno/uitest_uno.cxx b/vcl/source/uitest/uno/uitest_uno.cxx index 8ae3b7e284a1..d0d70a816f0f 100644 --- a/vcl/source/uitest/uno/uitest_uno.cxx +++ b/vcl/source/uitest/uno/uitest_uno.cxx @@ -26,7 +26,6 @@ namespace typedef ::cppu::WeakComponentImplHelper < css::ui::test::XUITest, css::lang::XServiceInfo > UITestBase; -} class UITestUnoObj : public cppu::BaseMutex, public UITestBase @@ -56,6 +55,8 @@ public: css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; }; +} + UITestUnoObj::UITestUnoObj(): UITestBase(m_aMutex), mpUITest(new UITest) diff --git a/vcl/source/window/builder.cxx b/vcl/source/window/builder.cxx index 5663a2e09989..3936d94026f7 100644 --- a/vcl/source/window/builder.cxx +++ b/vcl/source/window/builder.cxx @@ -1593,6 +1593,8 @@ void VclBuilder::cleanupWidgetOwnScrolling(vcl::Window *pScrollParent, vcl::Wind extern "C" { static void thisModule() {} } +namespace { + // Don't unload the module on destruction class NoAutoUnloadModule : public osl::Module { @@ -1600,6 +1602,8 @@ public: ~NoAutoUnloadModule() { release(); } }; +} + typedef std::map<OUString, std::shared_ptr<NoAutoUnloadModule>> ModuleMap; static ModuleMap g_aModuleMap; diff --git a/vcl/source/window/dockmgr.cxx b/vcl/source/window/dockmgr.cxx index 45708e8d709f..b81741108d28 100644 --- a/vcl/source/window/dockmgr.cxx +++ b/vcl/source/window/dockmgr.cxx @@ -35,6 +35,8 @@ #define DOCKWIN_FLOATSTYLES (WB_SIZEABLE | WB_MOVEABLE | WB_CLOSEABLE | WB_STANDALONE | WB_ROLLABLE ) +namespace { + class ImplDockFloatWin2 : public FloatingWindow { private: @@ -63,6 +65,8 @@ public: virtual bool Close() override; }; +} + ImplDockFloatWin2::ImplDockFloatWin2( vcl::Window* pParent, WinBits nWinBits, ImplDockingWindowWrapper* pDockingWin ) : FloatingWindow( pParent, nWinBits ), diff --git a/vcl/source/window/dockwin.cxx b/vcl/source/window/dockwin.cxx index 6ac2562d2f41..108a7d5b3700 100644 --- a/vcl/source/window/dockwin.cxx +++ b/vcl/source/window/dockwin.cxx @@ -50,6 +50,8 @@ DockingWindow::ImplData::ImplData() maMaxOutSize = Size( SHRT_MAX, SHRT_MAX ); } +namespace { + class ImplDockFloatWin : public FloatingWindow { private: @@ -75,6 +77,8 @@ public: virtual bool Close() override; }; +} + ImplDockFloatWin::ImplDockFloatWin( vcl::Window* pParent, WinBits nWinBits, DockingWindow* pDockingWin ) : FloatingWindow( pParent, nWinBits ), diff --git a/vcl/source/window/errinf.cxx b/vcl/source/window/errinf.cxx index f1e9109f5afb..1f4a60f70dca 100644 --- a/vcl/source/window/errinf.cxx +++ b/vcl/source/window/errinf.cxx @@ -28,8 +28,13 @@ #include <vector> class ErrorHandler; + +namespace { + class TheErrorRegistry: public rtl::Static<ErrorRegistry, TheErrorRegistry> {}; +} + class ErrorStringFactory { public: diff --git a/vcl/source/window/layout.cxx b/vcl/source/window/layout.cxx index 981ac621aa60..db0f26397927 100644 --- a/vcl/source/window/layout.cxx +++ b/vcl/source/window/layout.cxx @@ -684,12 +684,16 @@ void VclButtonBox::setAllocation(const Size &rAllocation) } } +namespace { + struct ButtonOrder { const char* m_aType; int const m_nPriority; }; +} + static int getButtonPriority(const OString &rType) { static const size_t N_TYPES = 6; @@ -733,6 +737,8 @@ static int getButtonPriority(const OString &rType) return -1; } +namespace { + class sortButtons { bool const m_bVerticalContainer; @@ -744,6 +750,8 @@ public: bool operator()(const vcl::Window *pA, const vcl::Window *pB) const; }; +} + bool sortButtons::operator()(const vcl::Window *pA, const vcl::Window *pB) const { //sort into two groups of pack start and pack end @@ -791,6 +799,8 @@ void VclButtonBox::sort_native_button_order() BuilderUtils::reorderWithinParent(aChilds, true); } +namespace { + struct GridEntry { VclPtr<vcl::Window> pChild; @@ -808,6 +818,8 @@ struct GridEntry } }; +} + typedef boost::multi_array<GridEntry, 2> array_type; static array_type assembleGrid(const VclGrid &rGrid); diff --git a/vcl/source/window/splitwin.cxx b/vcl/source/window/splitwin.cxx index 8e234964ee27..4ae7f4851fda 100644 --- a/vcl/source/window/splitwin.cxx +++ b/vcl/source/window/splitwin.cxx @@ -43,6 +43,8 @@ #define SPLIT_WINDOW (sal_uInt16(0x0004)) #define SPLIT_NOSPLIT (sal_uInt16(0x8000)) +namespace { + class ImplSplitItem { public: @@ -73,6 +75,7 @@ public: long mnMaxSize; }; +} class ImplSplitSet { diff --git a/vcl/source/window/taskpanelist.cxx b/vcl/source/window/taskpanelist.cxx index 1f382b824907..c7af916d16b0 100644 --- a/vcl/source/window/taskpanelist.cxx +++ b/vcl/source/window/taskpanelist.cxx @@ -45,8 +45,6 @@ Point ImplTaskPaneListGetPos( const vcl::Window *w ) return pos; } -} - // compares window pos left-to-right struct LTRSort { @@ -75,6 +73,8 @@ struct LTRSortBackward } }; +} + static void ImplTaskPaneListGrabFocus( vcl::Window *pWindow, bool bForward ) { // put focus in child of floating windows which is typically a toolbar diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 424b8b6cdbfa..ec1228b9fe69 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -241,12 +241,16 @@ static bool ImplCallCommand( const VclPtr<vcl::Window>& pChild, CommandEventId n * necessary if there already was a popup menu running. */ +namespace { + struct ContextMenuEvent { VclPtr<vcl::Window> pWindow; Point aChildPos; }; +} + static void ContextMenuEventLink( void* pCEvent, void* ) { ContextMenuEvent* pEv = static_cast<ContextMenuEvent*>(pCEvent); @@ -1313,6 +1317,8 @@ static bool shouldReusePreviousMouseWindow(const SalWheelMouseEvent& rPrevEvt, c return (rEvt.mnX == rPrevEvt.mnX && rEvt.mnY == rPrevEvt.mnY && rEvt.mnTime-rPrevEvt.mnTime < 500/*ms*/); } +namespace { + class HandleGestureEventBase { protected: @@ -1334,6 +1340,8 @@ public: virtual ~HandleGestureEventBase() {} }; +} + bool HandleGestureEventBase::Setup() { @@ -1423,6 +1431,8 @@ vcl::Window *HandleGestureEventBase::Dispatch(vcl::Window* pMouseWindow) return pDispatchedTo; } +namespace { + class HandleWheelEvent : public HandleGestureEventBase { private: @@ -1457,6 +1467,8 @@ public: bool HandleEvent(const SalWheelMouseEvent& rEvt); }; +} + bool HandleWheelEvent::HandleEvent(const SalWheelMouseEvent& rEvt) { if (!Setup()) @@ -1482,6 +1494,8 @@ bool HandleWheelEvent::HandleEvent(const SalWheelMouseEvent& rEvt) return pSVData->maWinData.mpLastWheelWindow.get(); } +namespace { + class HandleGestureEvent : public HandleGestureEventBase { public: @@ -1492,6 +1506,8 @@ public: bool HandleEvent(); }; +} + bool HandleGestureEvent::HandleEvent() { if (!Setup()) @@ -1509,6 +1525,8 @@ static bool ImplHandleWheelEvent(vcl::Window* pWindow, const SalWheelMouseEvent& return aHandler.HandleEvent(rEvt); } +namespace { + class HandleSwipeEvent : public HandleGestureEvent { private: @@ -1525,12 +1543,16 @@ public: } }; +} + static bool ImplHandleSwipe(vcl::Window *pWindow, const SalSwipeEvent& rEvt) { HandleSwipeEvent aHandler(pWindow, rEvt); return aHandler.HandleEvent(); } +namespace { + class HandleLongPressEvent : public HandleGestureEvent { private: @@ -1547,12 +1569,16 @@ public: } }; +} + static bool ImplHandleLongPress(vcl::Window *pWindow, const SalLongPressEvent& rEvt) { HandleLongPressEvent aHandler(pWindow, rEvt); return aHandler.HandleEvent(); } +namespace { + class HandleGeneralGestureEvent : public HandleGestureEvent { private: @@ -1571,6 +1597,8 @@ public: } }; +} + static bool ImplHandleGestureEvent(vcl::Window* pWindow, const SalGestureEvent& rEvent) { HandleGeneralGestureEvent aHandler(pWindow, rEvent); @@ -1877,11 +1905,15 @@ static void ImplHandleLoseFocus( vcl::Window* pWindow ) pFirstFloat->EndPopupMode(FloatWinPopupEndFlags::Cancel | FloatWinPopupEndFlags::CloseAll); } +namespace { + struct DelayedCloseEvent { VclPtr<vcl::Window> pWindow; }; +} + static void DelayedCloseEventLink( void* pCEvent, void* ) { DelayedCloseEvent* pEv = static_cast<DelayedCloseEvent*>(pCEvent); |