diff options
Diffstat (limited to 'vcl')
88 files changed, 642 insertions, 26 deletions
diff --git a/vcl/backendtest/VisualBackendTest.cxx b/vcl/backendtest/VisualBackendTest.cxx index a3cfb8cb9ba1..10000d79f671 100644 --- a/vcl/backendtest/VisualBackendTest.cxx +++ b/vcl/backendtest/VisualBackendTest.cxx @@ -83,6 +83,8 @@ static void assertAndSetBackground(vcl::test::TestResult eResult, tools::Rectang drawBackgroundRect(rRect, COL_RED, rRenderContext); } +namespace { + class VisualBackendTestWindow : public WorkWindow { private: @@ -481,6 +483,8 @@ public: } }; +} + IMPL_LINK_NOARG(VisualBackendTestWindow, updateHdl, Timer *, void) { if (mbAnimate) @@ -491,6 +495,8 @@ IMPL_LINK_NOARG(VisualBackendTestWindow, updateHdl, Timer *, void) } } +namespace { + class VisualBackendTestApp : public Application { @@ -549,6 +555,8 @@ protected: } }; +} + void vclmain::createApplication() { static VisualBackendTestApp aApplication; diff --git a/vcl/headless/svpdata.cxx b/vcl/headless/svpdata.cxx index 313786ad793e..4ac909c67c1f 100644 --- a/vcl/headless/svpdata.cxx +++ b/vcl/headless/svpdata.cxx @@ -10,6 +10,8 @@ #include <unx/gendata.hxx> #include <headless/svpinst.hxx> +namespace { + class SvpSalData : public GenericUnixSalData { public: @@ -18,6 +20,8 @@ public: virtual bool ErrorTrapPop( bool /*bIgnoreError*/ = true ) override { return false; } }; +} + // plugin factory function SalInstance* svp_create_SalInstance() { diff --git a/vcl/headless/svpgdi.cxx b/vcl/headless/svpgdi.cxx index eab7ab4b0456..02d1373b7ef3 100644 --- a/vcl/headless/svpgdi.cxx +++ b/vcl/headless/svpgdi.cxx @@ -1037,6 +1037,8 @@ void SvpSalGraphics::drawLine( long nX1, long nY1, long nX2, long nY2 ) releaseCairoContext(cr, false, extents); } +namespace { + class SystemDependentData_CairoPath : public basegfx::SystemDependentData { private: @@ -1063,6 +1065,8 @@ public: virtual sal_Int64 estimateUsageInBytes() const override; }; +} + SystemDependentData_CairoPath::SystemDependentData_CairoPath( basegfx::SystemDependentDataManager& rSystemDependentDataManager, cairo_path_t* pCairoPath, diff --git a/vcl/headless/svpinst.cxx b/vcl/headless/svpinst.cxx index 4687bf1dce4c..70ba9b153168 100644 --- a/vcl/headless/svpinst.cxx +++ b/vcl/headless/svpinst.cxx @@ -575,6 +575,8 @@ std::shared_ptr<vcl::BackendCapabilities> SvpSalInstance::GetBackendCapabilities #if HAVE_FEATURE_UI +namespace { + class SvpOpenGLContext : public OpenGLContext { GLWindow m_aGLWin; @@ -583,6 +585,8 @@ private: virtual GLWindow& getModifiableOpenGLWindow() override { return m_aGLWin; } }; +} + OpenGLContext* SvpSalInstance::CreateOpenGLContext() { return new SvpOpenGLContext; diff --git a/vcl/opengl/PackedTextureAtlas.cxx b/vcl/opengl/PackedTextureAtlas.cxx index dd9310103e35..f881afe60f16 100644 --- a/vcl/opengl/PackedTextureAtlas.cxx +++ b/vcl/opengl/PackedTextureAtlas.cxx @@ -18,6 +18,8 @@ #include <opengl/PackedTextureAtlas.hxx> +namespace { + struct Node { tools::Rectangle const mRectangle; @@ -32,6 +34,8 @@ struct Node Node* insert(int nWidth, int nHeight, int nPadding); }; +} + Node::Node(int nWidth, int nHeight) : mRectangle(tools::Rectangle(Point(), Size(nWidth, nHeight))) , mLeftNode() diff --git a/vcl/opengl/x11/gdiimpl.cxx b/vcl/opengl/x11/gdiimpl.cxx index f238422ff441..0813503baa75 100644 --- a/vcl/opengl/x11/gdiimpl.cxx +++ b/vcl/opengl/x11/gdiimpl.cxx @@ -35,6 +35,8 @@ static std::vector<GLXContext> g_vShareList; static bool g_bAnyCurrent; +namespace { + class X11OpenGLContext : public OpenGLContext { public: @@ -56,9 +58,6 @@ private: virtual void swapBuffers() override; }; -namespace -{ - #ifdef DBG_UTIL int unxErrorHandler(Display* dpy, XErrorEvent* event) { diff --git a/vcl/qa/cppunit/errorhandler.cxx b/vcl/qa/cppunit/errorhandler.cxx index 2936234ceedf..21c672ac5ba6 100644 --- a/vcl/qa/cppunit/errorhandler.cxx +++ b/vcl/qa/cppunit/errorhandler.cxx @@ -12,9 +12,13 @@ #include <vcl/errinf.hxx> +class ErrorHandlerTest; + +namespace { + class MockErrorHandler : private ErrorHandler { - friend class ErrorHandlerTest; + friend ErrorHandlerTest; protected: virtual bool CreateString(const ErrorInfo *pErrInfo, OUString &rErrString) const override @@ -28,6 +32,7 @@ protected: } }; +} class ErrorHandlerTest : public test::BootstrapFixture { diff --git a/vcl/qa/cppunit/lifecycle.cxx b/vcl/qa/cppunit/lifecycle.cxx index 51d90776bb44..857ad9b46d08 100644 --- a/vcl/qa/cppunit/lifecycle.cxx +++ b/vcl/qa/cppunit/lifecycle.cxx @@ -143,6 +143,8 @@ void LifecycleTest::testParentedWidgets() testWidgets(xWin); } +namespace { + class DisposableChild : public vcl::Window { public: @@ -153,6 +155,8 @@ public: } }; +} + void LifecycleTest::testChildDispose() { VclPtrInstance<WorkWindow> xWin(nullptr, WB_APP|WB_STDWORK); @@ -178,6 +182,8 @@ void LifecycleTest::testPostDispose() CPPUNIT_ASSERT(!xWin->GetWindow(GetWindowType::Parent)); } +namespace { + class FocusCrashPostDispose : public TabControl { public: @@ -203,6 +209,8 @@ public: } }; +} + void LifecycleTest::testFocus() { ScopedVclPtrInstance<WorkWindow> xWin(nullptr, WB_APP|WB_STDWORK); @@ -215,6 +223,8 @@ void LifecycleTest::testFocus() // CPPUNIT_ASSERT(xChild->HasFocus()); } +namespace { + template <class vcl_type> class LeakTestClass : public vcl_type { @@ -272,6 +282,8 @@ public: } }; +} + void LifecycleTest::testLeakage() { std::vector<LeakTestObject *> aObjects; diff --git a/vcl/qa/cppunit/timer.cxx b/vcl/qa/cppunit/timer.cxx index 90705d26ec19..03f295943ea1 100644 --- a/vcl/qa/cppunit/timer.cxx +++ b/vcl/qa/cppunit/timer.cxx @@ -27,6 +27,8 @@ // Enables timer tests that appear to provoke windows under load unduly. //#define TEST_TIMERPRECISION +namespace { + /// Avoid our timer tests just wedging the build if they fail. class WatchDog : public osl::Thread { @@ -47,6 +49,8 @@ public: } }; +} + static WatchDog * aWatchDog = new WatchDog( 120 ); // random high number in secs class TimerTest : public test::BootstrapFixture @@ -102,6 +106,7 @@ void TimerTest::testWatchdog() } #endif +namespace { class IdleBool : public Idle { @@ -121,6 +126,8 @@ public: } }; +} + void TimerTest::testIdle() { bool bTriggered = false; @@ -147,6 +154,8 @@ void TimerTest::testIdleMainloop() CPPUNIT_ASSERT_MESSAGE("mainloop idle triggered", bTriggered); } +namespace { + class TimerBool : public Timer { bool &mrBool; @@ -165,6 +174,8 @@ public: } }; +} + void TimerTest::testDurations() { static const sal_uLong aDurations[] = { 0, 1, 500, 1000 }; @@ -180,6 +191,7 @@ void TimerTest::testDurations() } } +namespace { class AutoTimerCount : public AutoTimer { @@ -207,6 +219,8 @@ public: } }; +} + #ifdef TEST_TIMERPRECISION void TimerTest::testAutoTimer() @@ -321,6 +335,7 @@ void TimerTest::testAutoTimerStop() CPPUNIT_ASSERT( !Application::Reschedule() ); } +namespace { class YieldTimer : public Timer { @@ -337,6 +352,8 @@ public: } }; +} + void TimerTest::testNestedTimer() { sal_Int32 nCount = 0; @@ -347,6 +364,7 @@ void TimerTest::testNestedTimer() Application::Yield(); } +namespace { class SlowCallbackTimer : public Timer { @@ -366,6 +384,8 @@ public: } }; +} + void TimerTest::testSlowTimerCallback() { bool bBeenSlow = false; @@ -380,6 +400,7 @@ void TimerTest::testSlowTimerCallback() Application::Yield(); } +namespace { class TriggerIdleFromIdle : public Idle { @@ -401,6 +422,8 @@ public: } }; +} + void TimerTest::testTriggerIdleFromIdle() { bool bTriggered1 = false; @@ -413,6 +436,7 @@ void TimerTest::testTriggerIdleFromIdle() CPPUNIT_ASSERT_MESSAGE("idle not triggered", bTriggered2); } +namespace { class IdleInvokedReStart : public Idle { @@ -431,6 +455,8 @@ public: } }; +} + void TimerTest::testInvokedReStart() { sal_Int32 nCount = 0; @@ -439,6 +465,7 @@ void TimerTest::testInvokedReStart() CPPUNIT_ASSERT_EQUAL( sal_Int32(2), nCount ); } +namespace { class IdleSerializer : public Idle { @@ -461,6 +488,8 @@ public: } }; +} + void TimerTest::testPriority() { // scope, so tasks are deleted @@ -487,6 +516,7 @@ void TimerTest::testPriority() } } +namespace { class TestAutoIdleRR : public AutoIdle { @@ -506,6 +536,8 @@ public: } }; +} + IMPL_LINK_NOARG(TestAutoIdleRR, IdleRRHdl, Timer *, void) { ++mrCount; diff --git a/vcl/qt5/Qt5Graphics_Text.cxx b/vcl/qt5/Qt5Graphics_Text.cxx index d72bfdbc46b4..4ba009106d26 100644 --- a/vcl/qt5/Qt5Graphics_Text.cxx +++ b/vcl/qt5/Qt5Graphics_Text.cxx @@ -149,6 +149,8 @@ void Qt5Graphics::GetGlyphWidths(const PhysicalFontFace* /*pPFF*/, bool /*bVerti { } +namespace +{ class Qt5CommonSalLayout : public GenericSalLayout { public: @@ -159,6 +161,7 @@ public: void SetOrientation(int nOrientation) { mnOrientation = nOrientation; } }; +} std::unique_ptr<GenericSalLayout> Qt5Graphics::GetTextLayout(int nFallbackLevel) { diff --git a/vcl/qt5/Qt5Instance.cxx b/vcl/qt5/Qt5Instance.cxx index eae41ad9a2bd..1a0f10864e41 100644 --- a/vcl/qt5/Qt5Instance.cxx +++ b/vcl/qt5/Qt5Instance.cxx @@ -54,6 +54,8 @@ #include <mutex> #include <condition_variable> +namespace +{ /// TODO: not much Qt5 specific here? could be generalised, esp. for OSX... /// this subclass allows for the transfer of a closure for running on the main /// thread, to handle all the thread affine stuff in Qt5; the SolarMutex is @@ -83,6 +85,7 @@ public: virtual void doAcquire(sal_uInt32 nLockCount) override; virtual sal_uInt32 doRelease(bool const bUnlockAll) override; }; +} bool Qt5YieldMutex::IsCurrentThread() const { 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); diff --git a/vcl/unx/generic/app/i18n_im.cxx b/vcl/unx/generic/app/i18n_im.cxx index 56a0d3f3e82a..18ad9a3f0f8a 100644 --- a/vcl/unx/generic/app/i18n_im.cxx +++ b/vcl/unx/generic/app/i18n_im.cxx @@ -40,6 +40,8 @@ using namespace vcl; // kinput2 IME needs special key handling since key release events are filtered in // preeditmode and XmbResetIC does not work +namespace { + class XKeyEventOp : public XKeyEvent { private: @@ -53,6 +55,8 @@ class XKeyEventOp : public XKeyEvent bool match (const XKeyEvent &rEvent) const; }; +} + void XKeyEventOp::init() { diff --git a/vcl/unx/generic/app/i18n_keysym.cxx b/vcl/unx/generic/app/i18n_keysym.cxx index 53b1ae7e642e..a77632a3e70d 100644 --- a/vcl/unx/generic/app/i18n_keysym.cxx +++ b/vcl/unx/generic/app/i18n_keysym.cxx @@ -26,11 +26,15 @@ // for all keysyms with byte1 and byte2 equal zero, and of course only for // keysyms that have a unicode counterpart +namespace { + struct keymap_t { const int first; const int last; const sal_Unicode *map; }; +} + // Latin-1 Byte 3 = 0x00 const sal_Unicode keymap00_map[] = { 0x0020, 0x0021, 0x0022, 0x0023, 0x0024, 0x0025, 0x0026, 0x0027, diff --git a/vcl/unx/generic/app/keysymnames.cxx b/vcl/unx/generic/app/keysymnames.cxx index 8e5788275263..e1d112adad22 100644 --- a/vcl/unx/generic/app/keysymnames.cxx +++ b/vcl/unx/generic/app/keysymnames.cxx @@ -39,6 +39,8 @@ namespace vcl_sal { + namespace { + struct KeysymNameReplacement { KeySym const aSymbol; @@ -52,6 +54,8 @@ namespace vcl_sal { int const nReplacements; }; + } + // CAUTION CAUTION CAUTION // every string value in the replacements tables must be in UTF8 // be careful with your editor ! diff --git a/vcl/unx/generic/app/saldata.cxx b/vcl/unx/generic/app/saldata.cxx index 42dc10e0fc85..e48e71761b60 100644 --- a/vcl/unx/generic/app/saldata.cxx +++ b/vcl/unx/generic/app/saldata.cxx @@ -551,6 +551,8 @@ void X11SalData::Timeout() pSVData->maSchedCtx.mpSalTimer->CallCallback(); } +namespace { + struct YieldEntry { int fd; // file descriptor for reading @@ -564,6 +566,8 @@ struct YieldEntry void HandleNextEvent() const { handle( fd, data ); } }; +} + #define MAX_NUM_DESCRIPTORS 128 static YieldEntry yieldTable[ MAX_NUM_DESCRIPTORS ]; diff --git a/vcl/unx/generic/app/salinst.cxx b/vcl/unx/generic/app/salinst.cxx index 8a076e762f4a..2d97bb88dc02 100644 --- a/vcl/unx/generic/app/salinst.cxx +++ b/vcl/unx/generic/app/salinst.cxx @@ -85,12 +85,16 @@ SalX11Display* X11SalInstance::CreateDisplay() const // AnyInput from sv/mow/source/app/svapp.cxx +namespace { + struct PredicateReturn { VclInputFlags nType; bool bRet; }; +} + extern "C" { static Bool ImplPredicateEvent( Display *, XEvent *pEvent, char *pData ) { diff --git a/vcl/unx/generic/app/wmadaptor.cxx b/vcl/unx/generic/app/wmadaptor.cxx index 8bd45098ef3c..02659996768c 100644 --- a/vcl/unx/generic/app/wmadaptor.cxx +++ b/vcl/unx/generic/app/wmadaptor.cxx @@ -77,12 +77,16 @@ public: using namespace vcl_sal; +namespace { + struct WMAdaptorProtocol { const char* pProtocol; int nProtocol; }; +} + /* * table must be sorted ascending in strings * since it is use with bsearch diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index e9c00d0174fb..54340ba23606 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -104,6 +104,8 @@ extern "C" static const long nXdndProtocolRevision = 5; +namespace { + // mapping between mime types (or what the office thinks of mime types) // and X convention types struct NativeTypeEntry @@ -114,6 +116,8 @@ struct NativeTypeEntry int const nFormat; // the corresponding format }; +} + // the convention for Xdnd is mime types as specified by the corresponding // RFC's with the addition that text/plain without charset tag contains iso8859-1 // sadly some applications (e.g. gtk) do not honor the mimetype only rule, diff --git a/vcl/unx/generic/dtrans/config.cxx b/vcl/unx/generic/dtrans/config.cxx index 5a8266c804e8..7ee1f18e8138 100644 --- a/vcl/unx/generic/dtrans/config.cxx +++ b/vcl/unx/generic/dtrans/config.cxx @@ -28,6 +28,8 @@ namespace x11 { +namespace { + class DtransX11ConfigItem : public ::utl::ConfigItem { sal_Int32 m_nSelectionTimeout; @@ -43,6 +45,8 @@ public: } +} + using namespace com::sun::star::lang; using namespace com::sun::star::uno; using namespace x11; diff --git a/vcl/unx/generic/fontmanager/fontconfig.cxx b/vcl/unx/generic/fontmanager/fontconfig.cxx index 75343a41b771..821d030c1d24 100644 --- a/vcl/unx/generic/fontmanager/fontconfig.cxx +++ b/vcl/unx/generic/fontmanager/fontconfig.cxx @@ -52,7 +52,6 @@ using namespace osl; namespace { typedef std::pair<FcChar8*, FcChar8*> lang_and_element; -} class FontCfgWrapper { @@ -83,6 +82,8 @@ private: std::unique_ptr<LanguageTag> m_pLanguageTag; }; +} + FontCfgWrapper::FontCfgWrapper() : m_pFontSet( nullptr ) { diff --git a/vcl/unx/generic/fontmanager/fontsubst.cxx b/vcl/unx/generic/fontmanager/fontsubst.cxx index a8adb6cf89fd..1b8fb5807bee 100644 --- a/vcl/unx/generic/fontmanager/fontsubst.cxx +++ b/vcl/unx/generic/fontmanager/fontsubst.cxx @@ -24,6 +24,8 @@ // platform specific font substitution hooks +namespace { + class FcPreMatchSubstitution : public ImplPreMatchFontSubstitution { @@ -43,6 +45,8 @@ public: bool FindFontSubstitute(FontSelectPattern&, LogicalFontInstance* pLogicalFont, OUString& rMissingCodes) const override; }; +} + void SalGenericInstance::RegisterFontSubstitutors( PhysicalFontCollection* pFontCollection ) { // register font fallback substitutions diff --git a/vcl/unx/generic/gdi/gdiimpl.cxx b/vcl/unx/generic/gdi/gdiimpl.cxx index 52a3bd73a618..80d8c82ae22b 100644 --- a/vcl/unx/generic/gdi/gdiimpl.cxx +++ b/vcl/unx/generic/gdi/gdiimpl.cxx @@ -1570,6 +1570,8 @@ bool X11SalGraphicsImpl::drawFilledTriangles( return true; } +namespace { + class SystemDependentData_Triangulation : public basegfx::SystemDependentData { private: @@ -1601,6 +1603,8 @@ public: virtual sal_Int64 estimateUsageInBytes() const override; }; +} + SystemDependentData_Triangulation::SystemDependentData_Triangulation( basegfx::SystemDependentDataManager& rSystemDependentDataManager, const basegfx::triangulator::B2DTriangleVector& rTriangles, diff --git a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx index 5d64fc08c4a1..a4f9fce70e94 100644 --- a/vcl/unx/generic/glyphs/freetype_glyphcache.cxx +++ b/vcl/unx/generic/glyphs/freetype_glyphcache.cxx @@ -711,6 +711,8 @@ bool FreetypeFont::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) // outline stuff +namespace { + class PolyArgs { public: @@ -740,6 +742,8 @@ private: PolyArgs& operator=(const PolyArgs&) = delete; }; +} + PolyArgs::PolyArgs( tools::PolyPolygon& rPolyPoly, sal_uInt16 nMaxPoints ) : mrPolyPoly(rPolyPoly), mnMaxPoints(nMaxPoints), diff --git a/vcl/unx/generic/print/bitmap_gfx.cxx b/vcl/unx/generic/print/bitmap_gfx.cxx index f58e77d0ecae..b70a1e9ce981 100644 --- a/vcl/unx/generic/print/bitmap_gfx.cxx +++ b/vcl/unx/generic/print/bitmap_gfx.cxx @@ -40,6 +40,8 @@ PrinterBmp::~PrinterBmp() /* virtual base class */ +namespace { + class ByteEncoder { private: @@ -50,12 +52,16 @@ public: virtual ~ByteEncoder () = 0; }; +} + ByteEncoder::~ByteEncoder() { } /* HexEncoder */ +namespace { + class HexEncoder : public ByteEncoder { private: @@ -74,6 +80,8 @@ public: void FlushLine (); }; +} + HexEncoder::HexEncoder (osl::File* pFile) : mpFile (pFile), mnColumn (0), @@ -122,6 +130,8 @@ HexEncoder::FlushLine () /* Ascii85 encoder, is abi compatible with HexEncoder but writes a ~> to indicate end of data EOD */ +namespace { + class Ascii85Encoder : public ByteEncoder { private: @@ -147,6 +157,8 @@ public: void WriteAscii (sal_uInt8 nByte); }; +} + Ascii85Encoder::Ascii85Encoder (osl::File* pFile) : mpFile (pFile), mnByte (0), @@ -272,6 +284,8 @@ Ascii85Encoder::~Ascii85Encoder () /* LZW encoder */ +namespace { + class LZWEncoder : public Ascii85Encoder { private: @@ -305,6 +319,8 @@ public: virtual void EncodeByte (sal_uInt8 nByte) override; }; +} + LZWEncoder::LZWEncoder(osl::File* pOutputFile) : Ascii85Encoder (pOutputFile), mpPrefix(nullptr), diff --git a/vcl/unx/generic/print/genprnpsp.cxx b/vcl/unx/generic/print/genprnpsp.cxx index 7b479816e1ec..90309c95ea53 100644 --- a/vcl/unx/generic/print/genprnpsp.cxx +++ b/vcl/unx/generic/print/genprnpsp.cxx @@ -907,6 +907,8 @@ void PspSalPrinter::EndPage() SAL_INFO( "vcl.unx.print", "PspSalPrinter::EndPage"); } +namespace { + struct PDFNewJobParameters { Size maPageSize; @@ -943,6 +945,8 @@ struct PDFPrintFile , maParameters( i_rNewParameters ) {} }; +} + bool PspSalPrinter::StartJob( const OUString* i_pFileName, const OUString& i_rJobName, const OUString& i_rAppName, ImplJobSetup* i_pSetupData, vcl::PrinterController& i_rController ) { @@ -1196,6 +1200,8 @@ bool PspSalPrinter::StartJob( const OUString* i_pFileName, const OUString& i_rJo return true; } +namespace { + class PrinterUpdate { static Idle* pPrinterUpdateIdle; @@ -1209,6 +1215,8 @@ public: static void jobEnded(); }; +} + Idle* PrinterUpdate::pPrinterUpdateIdle = nullptr; int PrinterUpdate::nActiveJobs = 0; diff --git a/vcl/unx/generic/print/genpspgraphics.cxx b/vcl/unx/generic/print/genpspgraphics.cxx index ab5c2ab77d7a..8f1adf73e632 100644 --- a/vcl/unx/generic/print/genpspgraphics.cxx +++ b/vcl/unx/generic/print/genpspgraphics.cxx @@ -56,6 +56,8 @@ using namespace psp; // ----- Implementation of PrinterBmp by means of SalBitmap/BitmapBuffer --------------- +namespace { + class SalPrinterBmp : public psp::PrinterBmp { private: @@ -76,8 +78,6 @@ public: virtual sal_uInt32 GetDepth () const override; }; -namespace -{ bool Bitmap32IsPreMultipled() { auto pBackendCapabilities = ImplGetSVData()->mpDefInst->GetBackendCapabilities(); @@ -533,6 +533,8 @@ void GenPspGraphics::invert(long,long,long,long,SalInvert) OSL_FAIL("Warning: PrinterGfx::Invert() not implemented"); } +namespace { + class ImplPspFontData : public FreetypeFontFace { private: @@ -543,11 +545,15 @@ public: virtual sal_IntPtr GetFontId() const override { return mnFontId; } }; +} + ImplPspFontData::ImplPspFontData(const psp::FastPrintFontInfo& rInfo) : FreetypeFontFace(nullptr, GenPspGraphics::Info2FontAttributes(rInfo)), mnFontId( rInfo.m_nID ) {} +namespace { + class PspSalLayout : public GenericSalLayout { public: @@ -565,6 +571,8 @@ private: bool mbArtBold; }; +} + PspSalLayout::PspSalLayout(::psp::PrinterGfx& rGfx, const FreetypeFont& rFont) : GenericSalLayout(*rFont.GetFontInstance()) , mrPrinterGfx(rGfx) diff --git a/vcl/unx/generic/print/glyphset.cxx b/vcl/unx/generic/print/glyphset.cxx index a3508233e13f..1e4b0a0f291b 100644 --- a/vcl/unx/generic/print/glyphset.cxx +++ b/vcl/unx/generic/print/glyphset.cxx @@ -183,6 +183,8 @@ void GlyphSet::DrawGlyph(PrinterGfx& rGfx, rGfx.PSShowGlyph(nGlyphID); } +namespace { + struct EncEntry { unsigned char aEnc; @@ -194,6 +196,8 @@ struct EncEntry { return aEnc < rRight.aEnc; } }; +} + static void CreatePSUploadableFont( TrueTypeFont* pSrcFont, FILE* pTmpFile, const char* pGlyphSetName, int nGlyphCount, /*const*/ const sal_uInt16* pRequestedGlyphs, /*const*/ const unsigned char* pEncoding, diff --git a/vcl/unx/generic/print/printerjob.cxx b/vcl/unx/generic/print/printerjob.cxx index 7d805ef942e5..6985ecf78c9f 100644 --- a/vcl/unx/generic/print/printerjob.cxx +++ b/vcl/unx/generic/print/printerjob.cxx @@ -632,12 +632,16 @@ PrinterJob::EndPage () pPageBody->close(); } +namespace { + struct less_ppd_key { bool operator()(const PPDKey* left, const PPDKey* right) { return left->getOrderDependency() < right->getOrderDependency(); } }; +} + static bool writeFeature( osl::File* pFile, const PPDKey* pKey, const PPDValue* pValue, bool bUseIncluseFeature ) { if( ! pKey || ! pValue ) diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx index 12482b2ba878..17e8112f4bff 100644 --- a/vcl/unx/generic/printer/cupsmgr.cxx +++ b/vcl/unx/generic/printer/cupsmgr.cxx @@ -44,6 +44,8 @@ using namespace psp; using namespace osl; +namespace { + struct GetPPDAttribs { osl::Condition m_aCondition; @@ -116,6 +118,8 @@ struct GetPPDAttribs } }; +} + extern "C" { static void getPPDWorker(void* pData) { @@ -593,12 +597,16 @@ FILE* CUPSManager::startSpool( const OUString& rPrintername, bool bQuickCommand return fp; } +namespace { + struct less_ppd_key { bool operator()(const PPDKey* left, const PPDKey* right) { return left->getOrderDependency() < right->getOrderDependency(); } }; +} + void CUPSManager::getOptionsFromDocumentSetup( const JobData& rJob, bool bBanner, int& rNumOptions, void** rOptions ) { rNumOptions = 0; diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index 880a7d958000..fde5c08c8274 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -251,7 +251,6 @@ using namespace psp; namespace { struct thePPDCache : public rtl::Static<PPDCache, thePPDCache> {}; -} class PPDDecompressStream { @@ -275,6 +274,8 @@ public: const OUString& GetFileName() const { return maFileName; } }; +} + PPDDecompressStream::PPDDecompressStream( const OUString& i_rFile ) { Open( i_rFile ); diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx index 3f02da765611..7bdddb5cfed2 100644 --- a/vcl/unx/generic/printer/printerinfomanager.cxx +++ b/vcl/unx/generic/printer/printerinfomanager.cxx @@ -671,11 +671,18 @@ OUString SystemQueueInfo::getCommand() const return aRet; } +namespace { + struct SystemCommandParameters; + +} + typedef void(* tokenHandler)(const std::vector< OString >&, std::vector< PrinterInfoManager::SystemPrintQueue >&, const SystemCommandParameters*); +namespace { + struct SystemCommandParameters { const char* pQueueCommand; @@ -686,6 +693,8 @@ struct SystemCommandParameters tokenHandler const pHandler; }; +} + #if ! (defined(LINUX) || defined(NETBSD) || defined(FREEBSD) || defined(OPENBSD)) static void lpgetSysQueueTokenHandler( const std::vector< OString >& i_rLines, diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index 83dfaf35e434..8ac555009541 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -2823,6 +2823,8 @@ bool X11SalFrame::HandleMouseEvent( XEvent *pEvent ) return nRet; } +namespace { + // F10 means either KEY_F10 or KEY_MENU, which has to be decided // in the independent part. struct KeyAlternate @@ -2833,6 +2835,8 @@ struct KeyAlternate KeyAlternate( sal_uInt16 nKey, sal_Unicode nChar = 0 ) : nKeyCode( nKey ), nCharCode( nChar ) {} }; +} + static KeyAlternate GetAlternateKeyCode( const sal_uInt16 nKeyCode ) { diff --git a/vcl/unx/gtk3/a11y/gtk3atkhypertext.cxx b/vcl/unx/gtk3/a11y/gtk3atkhypertext.cxx index ab94126dfc51..83f6817fc9e2 100644 --- a/vcl/unx/gtk3/a11y/gtk3atkhypertext.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atkhypertext.cxx @@ -25,12 +25,16 @@ using namespace ::com::sun::star; // ---------------------- AtkHyperlink ---------------------- +namespace { + struct HyperLink { AtkHyperlink const atk_hyper_link; uno::Reference< accessibility::XAccessibleHyperlink > xLink; }; +} + static uno::Reference< accessibility::XAccessibleHyperlink > const & getHyperlink( AtkHyperlink *pHyperlink ) { diff --git a/vcl/unx/gtk3/a11y/gtk3atktextattributes.cxx b/vcl/unx/gtk3/a11y/gtk3atktextattributes.cxx index fa5ab6030eae..73ba933d5a98 100644 --- a/vcl/unx/gtk3/a11y/gtk3atktextattributes.cxx +++ b/vcl/unx/gtk3/a11y/gtk3atktextattributes.cxx @@ -1304,12 +1304,16 @@ AtkAttributeSet* attribute_set_prepend_tracked_change_formatchange( AtkAttribute /*****************************************************************************/ +namespace { + struct AtkTextAttrMapping { const char * name; TextPropertyValueFunc const toPropertyValue; }; +} + const AtkTextAttrMapping g_TextAttrMap[] = { { "", InvalidValue }, // ATK_TEXT_ATTR_INVALID = 0 diff --git a/vcl/unx/gtk3/gtk3glomenu.cxx b/vcl/unx/gtk3/gtk3glomenu.cxx index e14574722800..ca6887cb9d95 100644 --- a/vcl/unx/gtk3/gtk3glomenu.cxx +++ b/vcl/unx/gtk3/gtk3glomenu.cxx @@ -32,12 +32,16 @@ G_DEFINE_TYPE (GLOMenu, g_lo_menu, G_TYPE_MENU_MODEL); #pragma GCC diagnostic pop #endif +namespace { + struct item { GHashTable* attributes; // Item attributes. GHashTable* links; // Item links. }; +} + static void g_lo_menu_struct_item_init (struct item *menu_item) { diff --git a/vcl/unx/gtk3/gtk3gtkframe.cxx b/vcl/unx/gtk3/gtk3gtkframe.cxx index 8ec93277e1a0..0d1348b8e551 100644 --- a/vcl/unx/gtk3/gtk3gtkframe.cxx +++ b/vcl/unx/gtk3/gtk3gtkframe.cxx @@ -300,6 +300,8 @@ guint GtkSalFrame::GetKeyValFor(GdkKeymap* pKeyMap, guint16 hardware_keycode, gu return updated_keyval; } +namespace { + // F10 means either KEY_F10 or KEY_MENU, which has to be decided // in the independent part. struct KeyAlternate @@ -310,6 +312,8 @@ struct KeyAlternate KeyAlternate( sal_uInt16 nKey, sal_Unicode nChar = 0 ) : nKeyCode( nKey ), nCharCode( nChar ) {} }; +} + static KeyAlternate GetAlternateKeyCode( const sal_uInt16 nKeyCode ) { @@ -3289,6 +3293,8 @@ namespace static bool g_DropSuccessSet = false; static bool g_DropSuccess = false; +namespace { + class GtkDropTargetDropContext : public cppu::WeakImplHelper<css::datatransfer::dnd::XDropTargetDropContext> { GdkDragContext *m_pContext; @@ -3322,6 +3328,8 @@ public: } }; +} + class GtkDnDTransferable : public GtkTransferable { GdkDragContext *m_pContext; @@ -3467,6 +3475,7 @@ gboolean GtkDropTarget::signalDragDrop(GtkWidget* pWidget, GdkDragContext* conte return true; } +namespace { class GtkDropTargetDragContext : public cppu::WeakImplHelper<css::datatransfer::dnd::XDropTargetDragContext> { @@ -3490,6 +3499,8 @@ public: } }; +} + void GtkSalFrame::signalDragDropReceived(GtkWidget* pWidget, GdkDragContext* context, gint x, gint y, GtkSelectionData* data, guint ttype, guint time, gpointer frame) { GtkSalFrame* pThis = static_cast<GtkSalFrame*>(frame); diff --git a/vcl/unx/gtk3/gtk3hudawareness.cxx b/vcl/unx/gtk3/gtk3hudawareness.cxx index 79ade04b4ee1..dddad28dafb6 100644 --- a/vcl/unx/gtk3/gtk3hudawareness.cxx +++ b/vcl/unx/gtk3/gtk3hudawareness.cxx @@ -11,6 +11,8 @@ #include <unx/gtk/hudawareness.h> +namespace { + struct HudAwarenessHandle { GDBusConnection *connection; @@ -19,6 +21,8 @@ struct HudAwarenessHandle GDestroyNotify notify; }; +} + static void hud_awareness_method_call (GDBusConnection * /* connection */, const gchar * /* sender */, diff --git a/vcl/unx/gtk3/gtk3salprn-gtk.cxx b/vcl/unx/gtk3/gtk3salprn-gtk.cxx index e9d57c56a940..56f2173b119f 100644 --- a/vcl/unx/gtk3/gtk3salprn-gtk.cxx +++ b/vcl/unx/gtk3/gtk3salprn-gtk.cxx @@ -41,6 +41,8 @@ using vcl::unx::GtkPrintWrapper; using uno::UNO_QUERY; +namespace { + class GtkPrintDialog { public: @@ -94,6 +96,8 @@ private: std::shared_ptr<GtkPrintWrapper> m_xWrapper; }; +} + struct GtkSalPrinter_Impl { OString m_sSpoolFile; diff --git a/vcl/workben/icontest.cxx b/vcl/workben/icontest.cxx index 28bcee6c85b7..4203ecdaf9d3 100644 --- a/vcl/workben/icontest.cxx +++ b/vcl/workben/icontest.cxx @@ -57,8 +57,6 @@ namespace { static_cast<double>(aValue.Nanosec) / (1000*1000*1000); } -} - class MyWorkWindow : public WorkWindow { double mnStartTime; @@ -78,6 +76,8 @@ public: virtual void Resize() override; }; +} + MyWorkWindow::MyWorkWindow( vcl::Window* pParent, WinBits nWinStyle ) : WorkWindow(pParent, nWinStyle) , mpBitmap(nullptr) @@ -133,6 +133,8 @@ void MyWorkWindow::Resize() SAL_INFO("vcl.icontest", "Resize " << GetSizePixel()); } +namespace { + class IconTestApp : public Application { public: @@ -147,6 +149,8 @@ private: void DoItWithVcl(const OUString& sImageFile); }; +} + void IconTestApp::Init() { nRet = EXIT_SUCCESS; diff --git a/vcl/workben/mtfdemo.cxx b/vcl/workben/mtfdemo.cxx index 0ee726e051f8..ea987186ceb2 100644 --- a/vcl/workben/mtfdemo.cxx +++ b/vcl/workben/mtfdemo.cxx @@ -32,6 +32,8 @@ using namespace css; +namespace { + class DemoMtfWin : public WorkWindow { GDIMetaFile maMtf; @@ -55,6 +57,8 @@ public: virtual void Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) override; }; +} + void DemoMtfWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rRect) { maMtf.Play(this, maMtf.GetActionSize()); @@ -62,6 +66,8 @@ void DemoMtfWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangl WorkWindow::Paint(rRenderContext, rRect); } +namespace { + class DemoMtfApp : public Application { VclPtr<DemoMtfWin> mpWin; @@ -149,6 +155,7 @@ private: }; +} void vclmain::createApplication() { diff --git a/vcl/workben/svdem.cxx b/vcl/workben/svdem.cxx index ebd7c94fb289..399a3683f853 100644 --- a/vcl/workben/svdem.cxx +++ b/vcl/workben/svdem.cxx @@ -71,12 +71,16 @@ SAL_IMPLEMENT_MAIN() return 0; } +namespace { + class MyWin : public WorkWindow { public: MyWin( vcl::Window* pParent, WinBits nWinStyle ); }; +} + void Main() { ScopedVclPtrInstance< MyWin > aMainWin( nullptr, WB_APP | WB_STDWORK ); diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx index 2396c6fa69f2..5d7cf8b9aae8 100644 --- a/vcl/workben/svpclient.cxx +++ b/vcl/workben/svpclient.cxx @@ -91,6 +91,8 @@ SAL_IMPLEMENT_MAIN() return 0; } +namespace { + class MyWin : public WorkWindow { VclPtr<PushButton> m_aListButton; @@ -112,6 +114,8 @@ public: DECL_STATIC_LINK( MyWin, QuitHdl, Button*, void ); }; +} + void Main() { ScopedVclPtrInstance< MyWin > aMainWin( nullptr, WB_STDWORK ); diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx index 72ff179821a8..06937d2255ed 100644 --- a/vcl/workben/svptest.cxx +++ b/vcl/workben/svptest.cxx @@ -82,6 +82,8 @@ SAL_IMPLEMENT_MAIN() return 0; } +namespace { + class MyWin : public WorkWindow { Bitmap m_aBitmap; @@ -91,6 +93,8 @@ public: virtual void Paint( vcl::RenderContext& /*rRenderContext*/, const tools::Rectangle& rRect ) override; }; +} + void Main() { ScopedVclPtrInstance< MyWin > aMainWin( nullptr, WB_APP | WB_STDWORK ); diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 42e4c5cda164..b1657c965d28 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -93,8 +93,6 @@ enum RenderStyle { RENDER_EXPANDED, // expanded view of this renderer }; -} - class DemoRenderer { Bitmap maIntroBW; @@ -1527,6 +1525,8 @@ public: } }; +} + #if FIXME_BOUNCE_BUTTON IMPL_LINK_NOARG(DemoRenderer,BounceTimerCb,Timer*,void) { @@ -1715,6 +1715,8 @@ int DemoRenderer::selectNextRenderer() return mnSelectedRenderer; } +namespace { + class DemoWin : public WorkWindow { DemoRenderer &mrRenderer; @@ -1830,6 +1832,9 @@ struct PointerData { PointerStyle eStyle; const char * name; }; + +} + static const PointerData gvPointerData [] = { { PointerStyle::Null, "Null" }, { PointerStyle::Magnify, "Magnify" }, @@ -1895,6 +1900,9 @@ static const PointerData gvPointerData [] = { { PointerStyle::HideWhitespace, "HideWhitespace" }, { PointerStyle::ShowWhitespace, "ShowWhitespace" }, }; + +namespace { + class DemoWidgets : public WorkWindow { VclPtr<MenuBar> mpBar; @@ -2027,6 +2035,8 @@ public: } }; +} + IMPL_LINK_NOARG(DemoWidgets, GLTestClick, Button*, void) { sal_Int32 nSelected = mpGLCombo->GetSelectedEntryPos(); @@ -2069,6 +2079,8 @@ IMPL_LINK(DemoWidgets, CursorButtonClick, Button*, pButton, void) assert(false); } +namespace { + class DemoPopup : public FloatingWindow { public: @@ -2113,6 +2125,8 @@ class DemoPopup : public FloatingWindow } }; +} + class OpenGLTests { VclPtr<WorkWindow> mxWinA; @@ -2280,6 +2294,8 @@ include/vcl/outdev.hxx: DrawTextFla } }; +namespace { + class DemoApp : public Application { static int showHelp(DemoRenderer &rRenderer) @@ -2418,6 +2434,8 @@ protected: } }; +} + void vclmain::createApplication() { #ifdef _WIN32 |