diff options
1151 files changed, 6970 insertions, 252 deletions
diff --git a/animations/source/animcore/animcore.cxx b/animations/source/animcore/animcore.cxx index b7e28dc15c6d..3a2c0256a06a 100644 --- a/animations/source/animcore/animcore.cxx +++ b/animations/source/animcore/animcore.cxx @@ -101,6 +101,8 @@ using namespace ::com::sun::star::animations::AnimationNodeType; namespace animcore { +namespace { + class AnimationNodeBase : public XAnimateMotion, public XAnimateColor, public XTransitionFilter, @@ -365,6 +367,8 @@ private: Mutex maMutex; }; +} + TimeContainerEnumeration::TimeContainerEnumeration( const std::vector< Reference< XAnimationNode > > &rChildren ) : maChildren( rChildren ) { diff --git a/basctl/source/basicide/baside2b.cxx b/basctl/source/basicide/baside2b.cxx index 6bf425a65c8b..25633088e9eb 100644 --- a/basctl/source/basicide/baside2b.cxx +++ b/basctl/source/basicide/baside2b.cxx @@ -1670,6 +1670,8 @@ void WatchWindow::Resize() Invalidate(); } +namespace { + struct WatchItem { OUString maName; @@ -1700,6 +1702,8 @@ struct WatchItem SbxDimArray* GetRootArray(); }; +} + WatchItem* WatchItem::GetRootItem() { WatchItem* pItem = mpArrayParentItem; diff --git a/basctl/source/basicide/baside3.cxx b/basctl/source/basicide/baside3.cxx index f495e362a371..4e59686119bd 100644 --- a/basctl/source/basicide/baside3.cxx +++ b/basctl/source/basicide/baside3.cxx @@ -789,6 +789,7 @@ static std::vector< lang::Locale > implGetLanguagesOnlyContainedInFirstSeq return avRet; } +namespace { class NameClashQueryBox { @@ -827,6 +828,8 @@ public: short run() { return m_xQueryBox->run(); } }; +} + bool implImportDialog(weld::Window* pWin, const OUString& rCurPath, const ScriptDocument& rDocument, const OUString& aLibName) { bool bDone = false; diff --git a/basctl/source/basicide/moduldl2.cxx b/basctl/source/basicide/moduldl2.cxx index 34db6905702f..0783d697b1ba 100644 --- a/basctl/source/basicide/moduldl2.cxx +++ b/basctl/source/basicide/moduldl2.cxx @@ -970,6 +970,8 @@ void LibPage::implExportLib( const OUString& aLibName, const OUString& aTargetUR // Implementation XCommandEnvironment +namespace { + class OLibCommandEnvironment : public cppu::WeakImplHelper< XCommandEnvironment > { Reference< task::XInteractionHandler > mxInteraction; @@ -984,6 +986,8 @@ public: virtual Reference< XProgressHandler > SAL_CALL getProgressHandler() override; }; +} + Reference< task::XInteractionHandler > OLibCommandEnvironment::getInteractionHandler() { return mxInteraction; diff --git a/basegfx/source/polygon/b2dpolygon.cxx b/basegfx/source/polygon/b2dpolygon.cxx index 87343028ecfe..4cf280cd5b91 100644 --- a/basegfx/source/polygon/b2dpolygon.cxx +++ b/basegfx/source/polygon/b2dpolygon.cxx @@ -29,6 +29,8 @@ #include <memory> #include <vector> +namespace { + struct CoordinateData2D : public basegfx::B2DPoint { public: @@ -552,6 +554,8 @@ public: } }; +} + class ImplB2DPolygon { private: diff --git a/basegfx/source/polygon/b2dpolygonclipper.cxx b/basegfx/source/polygon/b2dpolygonclipper.cxx index 9d672b4397c0..043f2c9bdfe3 100644 --- a/basegfx/source/polygon/b2dpolygonclipper.cxx +++ b/basegfx/source/polygon/b2dpolygonclipper.cxx @@ -510,6 +510,8 @@ namespace basegfx return aRetval; } + namespace { + /* * let a plane be defined as * @@ -536,6 +538,8 @@ namespace basegfx sal_uInt32 clipmask; // clipping mask, e.g. 1000 1000 }; + } + /* * * polygon clipping rules (straight out of Foley and Van Dam) diff --git a/basegfx/source/polygon/b2dtrapezoid.cxx b/basegfx/source/polygon/b2dtrapezoid.cxx index ec3d037e6aa8..8bba58f8106e 100644 --- a/basegfx/source/polygon/b2dtrapezoid.cxx +++ b/basegfx/source/polygon/b2dtrapezoid.cxx @@ -36,6 +36,8 @@ namespace basegfx // class for this since holding the pointers is more effective and also can be // used as baseclass for the traversing edges + namespace { + class TrDeSimpleEdge { protected: @@ -58,6 +60,8 @@ namespace basegfx const B2DPoint& getEnd() const { return *mpEnd; } }; + } + // define vector of simple edges typedef std::vector< TrDeSimpleEdge > TrDeSimpleEdges; @@ -67,6 +71,8 @@ namespace basegfx // hold and used in SortValue to allow sorting traversing edges by Y, X and slope // (in that order) + namespace { + class TrDeEdgeEntry : public TrDeSimpleEdge { private: @@ -179,6 +185,8 @@ namespace basegfx } }; + } + // define double linked list of edges (for fast random insert) typedef std::list< TrDeEdgeEntry > TrDeEdgeEntries; @@ -192,6 +200,8 @@ namespace basegfx { // FIXME: templatize this and use it for TrDeEdgeEntries too ... + namespace { + /// Class to allow efficient allocation and release of B2DPoints class PointBlockAllocator { @@ -883,6 +893,8 @@ namespace basegfx } } }; + + } } // end of anonymous namespace } // end of namespace basegfx diff --git a/basegfx/source/polygon/b3dpolygon.cxx b/basegfx/source/polygon/b3dpolygon.cxx index 5d23be90562c..422353fba8ad 100644 --- a/basegfx/source/polygon/b3dpolygon.cxx +++ b/basegfx/source/polygon/b3dpolygon.cxx @@ -27,6 +27,8 @@ #include <vector> #include <algorithm> +namespace { + class CoordinateData3D { basegfx::B3DPoint maPoint; @@ -672,6 +674,8 @@ public: } }; +} + class ImplB3DPolygon { // The point vector. This vector exists always and defines the diff --git a/basic/source/basmgr/basicmanagerrepository.cxx b/basic/source/basmgr/basicmanagerrepository.cxx index edc73fed8c4a..296e59327d8f 100644 --- a/basic/source/basmgr/basicmanagerrepository.cxx +++ b/basic/source/basmgr/basicmanagerrepository.cxx @@ -64,10 +64,16 @@ namespace basic typedef std::vector< BasicManagerCreationListener* > CreationListeners; + namespace { + + struct CreateImplRepository; + + } + class ImplRepository : public ::utl::OEventListenerAdapter, public SfxListener { private: - friend struct CreateImplRepository; + friend CreateImplRepository; ImplRepository(); private: @@ -192,6 +198,7 @@ namespace basic StarBASIC* impl_getDefaultAppBasicLibrary(); }; + namespace { struct CreateImplRepository { @@ -202,6 +209,7 @@ namespace basic } }; + } ImplRepository::ImplRepository() { diff --git a/basic/source/basmgr/basmgr.cxx b/basic/source/basmgr/basmgr.cxx index 46fa3740777a..8adc59a9e874 100644 --- a/basic/source/basmgr/basmgr.cxx +++ b/basic/source/basmgr/basmgr.cxx @@ -1586,6 +1586,7 @@ ErrCode BasicManager::ExecuteMacro( OUString const& i_fullyQualifiedName, OUStri return SbxBase::GetError(); } +namespace { class ModuleInfo_Impl : public ModuleInfoHelper { @@ -1692,6 +1693,8 @@ public: virtual void SAL_CALL removeByName( const OUString& Name ) override; }; +} + // Methods XElementAccess uno::Type ModuleContainer_Impl::getElementType() { @@ -1794,6 +1797,7 @@ static SbxObject* implCreateDialog( const uno::Sequence< sal_Int8 >& aData ) // which we can't include here, we have to use the value directly #define SBXID_DIALOG 101 +namespace { class DialogContainer_Impl : public NameContainerHelper { @@ -1820,6 +1824,8 @@ public: virtual void SAL_CALL removeByName( const OUString& Name ) override; }; +} + // Methods XElementAccess uno::Type DialogContainer_Impl::getElementType() { diff --git a/basic/source/classes/sb.cxx b/basic/source/classes/sb.cxx index 3ee34bc7e2fb..00454a759ef0 100644 --- a/basic/source/classes/sb.cxx +++ b/basic/source/classes/sb.cxx @@ -268,6 +268,8 @@ SbxVariable* StarBASIC::VBAFind( const OUString& rName, SbxClassType t ) return nullptr; } +namespace { + // Create array for conversion SFX <-> VB error code struct SFX_VB_ErrorItem { @@ -275,6 +277,8 @@ struct SFX_VB_ErrorItem ErrCode nErrorSFX; }; +} + const SFX_VB_ErrorItem SFX_VB_ErrorTab[] = { { 1, ERRCODE_BASIC_EXCEPTION }, // #87844 Map exception to error code 1 diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 8fbb3dd66c03..c8d9b7ec16fb 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -433,6 +433,8 @@ static void implHandleAnyException( const Any& _rCaughtException ) } } +namespace { + // NativeObjectWrapper handling struct ObjectItem { @@ -443,9 +445,16 @@ struct ObjectItem {} }; +} + typedef std::vector< ObjectItem > NativeObjectWrapperVector; + +namespace { + class GaNativeObjectWrapperVector : public rtl::Static<NativeObjectWrapperVector, GaNativeObjectWrapperVector> {}; +} + void clearNativeObjectWrapperVector() { GaNativeObjectWrapperVector::get().clear(); @@ -3770,6 +3779,7 @@ void SbUnoSingleton::Notify( SfxBroadcaster& rBC, const SfxHint& rHint ) } } +namespace { // Implementation of an EventAttacher-drawn AllListener, which // solely transmits several events to a general AllListener @@ -3791,6 +3801,7 @@ public: virtual void SAL_CALL disposing(const EventObject& Source) override; }; +} BasicAllListener_Impl::BasicAllListener_Impl(const OUString& aPrefixName_) : aPrefixName( aPrefixName_ ) @@ -3872,6 +3883,8 @@ void BasicAllListener_Impl ::disposing(const EventObject& ) // class InvocationToAllListenerMapper // helper class to map XInvocation to XAllListener (also in project eventattacher!) +namespace { + class InvocationToAllListenerMapper : public WeakImplHelper< XInvocation > { public: @@ -3892,6 +3905,7 @@ private: Any m_Helper; }; +} // Function to replace AllListenerAdapterService::createAllListerAdapter static Reference< XInterface > createAllListenerAdapter @@ -4158,6 +4172,7 @@ void RTL_Impl_CreateUnoValue( SbxArray& rPar ) refVar->PutObject( xUnoAnyObject.get() ); } +namespace { class ModuleInvocationProxy : public WeakImplHelper< XInvocation, XComponent > { @@ -4189,6 +4204,8 @@ public: virtual void SAL_CALL removeEventListener( const Reference< XEventListener >& aListener ) override; }; +} + ModuleInvocationProxy::ModuleInvocationProxy( OUString const & aPrefix, SbxObjectRef const & xScopeObj ) : m_aMutex() , m_aPrefix( aPrefix + "_" ) @@ -4400,6 +4417,8 @@ Reference< XInterface > createComListener( const Any& aControlAny, const OUStrin typedef std::vector< WeakReference< XComponent > > ComponentRefVector; +namespace { + struct StarBasicDisposeItem { StarBASIC* m_pBasic; @@ -4413,6 +4432,8 @@ struct StarBasicDisposeItem } }; +} + typedef std::vector< StarBasicDisposeItem* > DisposeItemVector; static DisposeItemVector GaDisposeItemVector; diff --git a/basic/source/classes/sbxmod.cxx b/basic/source/classes/sbxmod.cxx index c837105a4dfe..f288f0ec99ae 100644 --- a/basic/source/classes/sbxmod.cxx +++ b/basic/source/classes/sbxmod.cxx @@ -83,6 +83,8 @@ using namespace com::sun::star::uno; typedef ::cppu::WeakImplHelper< XInvocation > DocObjectWrapper_BASE; typedef std::map< sal_Int16, Any > OutParamMap; +namespace { + class DocObjectWrapper : public DocObjectWrapper_BASE { Reference< XAggregation > m_xAggProxy; @@ -115,6 +117,8 @@ public: virtual Sequence< Type > SAL_CALL getTypes() override; }; +} + DocObjectWrapper::DocObjectWrapper( SbModule* pVar ) : m_pMod( pVar ) { SbObjModule* pMod = dynamic_cast<SbObjModule*>( pVar ); @@ -1674,6 +1678,8 @@ bool SbModule::ExceedsLegacyModuleSize() return pImage && pImage->ExceedsLegacyLimits(); } +namespace { + class ErrorHdlResetter { Link<StarBASIC*,bool> mErrHandler; @@ -1695,6 +1701,8 @@ public: bool HasError() const { return mbError; } }; +} + IMPL_LINK( ErrorHdlResetter, BasicErrorHdl, StarBASIC *, /*pBasic*/, bool) { mbError = true; diff --git a/basic/source/comp/codegen.cxx b/basic/source/comp/codegen.cxx index bebedd8f852d..569824648fc1 100644 --- a/basic/source/comp/codegen.cxx +++ b/basic/source/comp/codegen.cxx @@ -386,6 +386,8 @@ void SbiCodeGen::Save() rMod.EndDefinitions(); } +namespace { + template < class T > class PCodeVisitor { @@ -399,9 +401,13 @@ public: virtual bool processParams() = 0; }; +} + template <class T> PCodeVisitor< T >::~PCodeVisitor() {} +namespace { + template <class T> class PCodeBufferWalker { @@ -544,6 +550,8 @@ public: } }; +} + sal_uInt32 SbiCodeGen::calcNewOffSet( sal_uInt8 const * pCode, sal_uInt16 nOffset ) { diff --git a/basic/source/comp/exprgen.cxx b/basic/source/comp/exprgen.cxx index 01da0420fd5e..d1ebb48c4c09 100644 --- a/basic/source/comp/exprgen.cxx +++ b/basic/source/comp/exprgen.cxx @@ -25,11 +25,15 @@ // Transform table for token operators and opcodes +namespace { + struct OpTable { SbiToken eTok; // Token SbiOpcode eOp; // Opcode }; +} + static const OpTable aOpTable [] = { { EXPON,SbiOpcode::EXP_ }, { MUL, SbiOpcode::MUL_ }, diff --git a/basic/source/comp/parser.cxx b/basic/source/comp/parser.cxx index 1de38c9c8541..45cf7e358fe6 100644 --- a/basic/source/comp/parser.cxx +++ b/basic/source/comp/parser.cxx @@ -33,6 +33,8 @@ struct SbiParseStack { // "Stack" for statement-blocks sal_uInt32 nChain; // JUMP-Chain }; +namespace { + struct SbiStatement { SbiToken eTok; void( SbiParser::*Func )(); @@ -40,6 +42,8 @@ struct SbiStatement { bool bSubr; // true: OK inside the SUB }; +} + #define Y true #define N false diff --git a/basic/source/comp/token.cxx b/basic/source/comp/token.cxx index 2e0141827858..92fabfe98ddd 100644 --- a/basic/source/comp/token.cxx +++ b/basic/source/comp/token.cxx @@ -26,8 +26,12 @@ #include <basiccharclass.hxx> #include <token.hxx> +namespace { + struct TokenTable { SbiToken t; const char *s; }; +} + static const TokenTable aTokTable_Basic [] = { { CAT, "&" }, { MUL, "*" }, @@ -174,6 +178,8 @@ static const TokenTable aTokTable_Basic [] = { { XOR, "Xor" }, }; +namespace { + // #i109076 class TokenLabelInfo { @@ -188,6 +194,8 @@ public: class StaticTokenLabelInfo: public ::rtl::Static< TokenLabelInfo, StaticTokenLabelInfo >{}; +} + // #i109076 TokenLabelInfo::TokenLabelInfo() { diff --git a/basic/source/runtime/inputbox.cxx b/basic/source/runtime/inputbox.cxx index 24a71850607b..296063d9534e 100644 --- a/basic/source/runtime/inputbox.cxx +++ b/basic/source/runtime/inputbox.cxx @@ -25,6 +25,8 @@ #include <rtlproto.hxx> #include <memory> +namespace { + class SvRTLInputBox : public weld::GenericDialogController { std::unique_ptr<weld::Entry> m_xEdit; @@ -45,6 +47,8 @@ public: OUString const & GetText() const { return m_aText; } }; +} + SvRTLInputBox::SvRTLInputBox(weld::Window* pParent, const OUString& rPrompt, const OUString& rTitle, const OUString& rDefault, long nXTwips, long nYTwips) diff --git a/basic/source/runtime/iosys.cxx b/basic/source/runtime/iosys.cxx index e58c0a060df2..533ee4f4d6a4 100644 --- a/basic/source/runtime/iosys.cxx +++ b/basic/source/runtime/iosys.cxx @@ -47,6 +47,7 @@ using namespace com::sun::star::bridge; #include <iosys.hxx> +namespace { class SbiInputDialog : public weld::GenericDialogController { @@ -62,6 +63,8 @@ public: const OUString& GetInput() const { return m_aText; } }; +} + SbiInputDialog::SbiInputDialog(weld::Window* pParent, const OUString& rPrompt) : GenericDialogController(pParent, "svt/ui/inputbox.ui", "InputBox") , m_xInput(m_xBuilder->weld_entry("entry")) @@ -156,6 +159,7 @@ bool hasUno() return bRetVal; } +namespace { class OslStream : public SvStream { @@ -171,6 +175,8 @@ public: virtual void SetSize( sal_uInt64 nSize) override; }; +} + OslStream::OslStream( const OUString& rName, StreamMode nStrmMode ) : maFile( rName ) { @@ -251,6 +257,7 @@ void OslStream::SetSize( sal_uInt64 nSize ) maFile.setSize( nSize ); } +namespace { class UCBStream : public SvStream { @@ -268,6 +275,8 @@ public: virtual void SetSize( sal_uInt64 nSize ) override; }; +} + UCBStream::UCBStream( Reference< XInputStream > const & rStm ) : xIS( rStm ) , xSeek( rStm, UNO_QUERY ) diff --git a/basic/source/runtime/methods1.cxx b/basic/source/runtime/methods1.cxx index ea65461ff73c..ad782bc8ef38 100644 --- a/basic/source/runtime/methods1.cxx +++ b/basic/source/runtime/methods1.cxx @@ -1787,8 +1787,6 @@ enum Interval INTERVAL_S }; -} - struct IntervalInfo { Interval meInterval; @@ -1797,6 +1795,8 @@ struct IntervalInfo bool mbSimple; }; +} + static IntervalInfo const * getIntervalInfo( const OUString& rStringCode ) { static IntervalInfo const aIntervalTable[] = diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 033285d8f7fe..8451455fbe89 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -1695,6 +1695,7 @@ void SbiRuntime::StepPUT() refVar->SetFlags( n ); } +namespace { // VBA Dim As New behavior handling, save init object information struct DimAsNewRecoverItem @@ -1726,11 +1727,17 @@ struct SbxVariablePtrHash { return reinterpret_cast<size_t>(pVar); } }; +} + typedef std::unordered_map< SbxVariable*, DimAsNewRecoverItem, SbxVariablePtrHash > DimAsNewRecoverHash; +namespace { + class GaDimAsNewRecoverHash : public rtl::Static<DimAsNewRecoverHash, GaDimAsNewRecoverHash> {}; +} + void removeDimAsNewRecoverItem( SbxVariable* pVar ) { DimAsNewRecoverHash &rDimAsNewRecoverHash = GaDimAsNewRecoverHash::get(); diff --git a/basic/source/runtime/stdobj.cxx b/basic/source/runtime/stdobj.cxx index 234deed57ea0..c8138e34ac60 100644 --- a/basic/source/runtime/stdobj.cxx +++ b/basic/source/runtime/stdobj.cxx @@ -55,6 +55,8 @@ #define RWPROP_ 0x4300 // mask Read/Write-Property #define CPROP_ 0x4900 // mask for constant +namespace { + struct Methods { const char* pName; SbxDataType eType; @@ -63,6 +65,8 @@ struct Methods { sal_uInt16 nHash; }; +} + static Methods aMethods[] = { { "Abs", SbxDOUBLE, 1 | FUNCTION_, RTLNAME(Abs),0 }, diff --git a/bridges/source/jni_uno/jni_java2uno.cxx b/bridges/source/jni_uno/jni_java2uno.cxx index 4092933be49f..b6c4c6ea9b35 100644 --- a/bridges/source/jni_uno/jni_java2uno.cxx +++ b/bridges/source/jni_uno/jni_java2uno.cxx @@ -144,6 +144,8 @@ void Bridge::handle_uno_exc( JNI_context const & jni, uno_Any * uno_exc ) const } } +namespace { + union largest { sal_Int64 n; @@ -152,6 +154,7 @@ union largest uno_Any a; }; +} jobject Bridge::call_uno( JNI_context const & jni, diff --git a/bridges/source/jni_uno/jni_uno2java.cxx b/bridges/source/jni_uno/jni_uno2java.cxx index 9b7c45c6185b..eb152c110ec7 100644 --- a/bridges/source/jni_uno/jni_uno2java.cxx +++ b/bridges/source/jni_uno/jni_uno2java.cxx @@ -383,6 +383,8 @@ void Bridge::call_java( } } +namespace { + // a UNO proxy wrapping a Java interface struct UNO_proxy : public uno_Interface { @@ -405,6 +407,7 @@ struct UNO_proxy : public uno_Interface JNI_interface_type_info const * info ); }; +} inline UNO_proxy::UNO_proxy( JNI_context const & jni, Bridge const * bridge, diff --git a/canvas/source/cairo/cairo_canvashelper_text.cxx b/canvas/source/cairo/cairo_canvashelper_text.cxx index bed807ed4f1c..386c922f4397 100644 --- a/canvas/source/cairo/cairo_canvashelper_text.cxx +++ b/canvas/source/cairo/cairo_canvashelper_text.cxx @@ -143,6 +143,8 @@ namespace cairocanvas return nTransparency; } + namespace { + class DeviceSettingsGuard { private: @@ -168,6 +170,8 @@ namespace cairocanvas } }; + } + static bool setupTextOutput( OutputDevice& rOutDev, const rendering::XCanvas* pOwner, ::Point& o_rOutPos, diff --git a/canvas/source/tools/surfaceproxymanager.cxx b/canvas/source/tools/surfaceproxymanager.cxx index d0ddfff51f66..ef70b824e9e0 100644 --- a/canvas/source/tools/surfaceproxymanager.cxx +++ b/canvas/source/tools/surfaceproxymanager.cxx @@ -26,6 +26,8 @@ namespace canvas { + namespace { + class SurfaceProxyManager : public ISurfaceProxyManager { public: @@ -60,6 +62,8 @@ namespace canvas PageManagerSharedPtr mpPageManager; }; + } + std::shared_ptr<ISurfaceProxyManager> createSurfaceProxyManager( const std::shared_ptr<IRenderModule>& rRenderModule ) { return std::shared_ptr<ISurfaceProxyManager>( diff --git a/canvas/workben/canvasdemo.cxx b/canvas/workben/canvasdemo.cxx index 3e768f5ef118..00acbe9a5d82 100644 --- a/canvas/workben/canvasdemo.cxx +++ b/canvas/workben/canvasdemo.cxx @@ -53,6 +53,8 @@ static void PrintHelp() fprintf( stdout, "canvasdemo - Exercise the new canvas impl\n" ); } +namespace { + class TestWindow : public WorkWindow { public: @@ -533,6 +535,7 @@ class DemoRenderer } }; +} void TestWindow::Paint(vcl::RenderContext&, const tools::Rectangle&) { @@ -595,6 +598,8 @@ void TestWindow::Paint(vcl::RenderContext&, const tools::Rectangle&) } } +namespace { + class DemoApp : public Application { public: @@ -606,6 +611,8 @@ protected: void DeInit() override; }; +} + int DemoApp::Main() { bool bHelp = false; diff --git a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx index 5696d6b5c3f4..73811542998d 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDataWrapper.cxx @@ -106,6 +106,8 @@ struct lcl_Operator } }; +namespace { + struct lcl_AllOperator : public lcl_Operator { explicit lcl_AllOperator( const Reference< XChartData >& xDataToApply ) @@ -365,6 +367,8 @@ struct lcl_DateCategoriesOperator : public lcl_Operator const Sequence< double >& m_rDates; }; +} + ChartDataWrapper::ChartDataWrapper(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : m_spChart2ModelContact(spChart2ModelContact) , m_aEventListenerContainer(m_aMutex) diff --git a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx index 406df92db13a..cb3c49687f82 100644 --- a/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/ChartDocumentWrapper.cxx @@ -248,6 +248,8 @@ namespace chart namespace wrapper { +namespace { + //PROP_DOCUMENT_LABELS_IN_FIRST_ROW class WrappedDataSourceLabelsInFirstRowProperty : public WrappedProperty { @@ -265,6 +267,8 @@ private: //member mutable Any m_aOuterValue; }; +} + WrappedDataSourceLabelsInFirstRowProperty::WrappedDataSourceLabelsInFirstRowProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("DataSourceLabelsInFirstRow",OUString()) , m_spChart2ModelContact( spChart2ModelContact ) @@ -335,6 +339,8 @@ Any WrappedDataSourceLabelsInFirstRowProperty::getPropertyDefault( const Referen return aRet; } +namespace { + //PROP_DOCUMENT_LABELS_IN_FIRST_COLUMN class WrappedDataSourceLabelsInFirstColumnProperty : public WrappedProperty { @@ -352,6 +358,8 @@ private: //member mutable Any m_aOuterValue; }; +} + WrappedDataSourceLabelsInFirstColumnProperty::WrappedDataSourceLabelsInFirstColumnProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("DataSourceLabelsInFirstColumn",OUString()) , m_spChart2ModelContact( spChart2ModelContact ) @@ -422,6 +430,8 @@ Any WrappedDataSourceLabelsInFirstColumnProperty::getPropertyDefault( const Refe return aRet; } +namespace { + //PROP_DOCUMENT_HAS_LEGEND class WrappedHasLegendProperty : public WrappedProperty { @@ -438,6 +448,8 @@ private: //member std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; }; +} + WrappedHasLegendProperty::WrappedHasLegendProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("HasLegend",OUString()) , m_spChart2ModelContact( spChart2ModelContact ) @@ -495,6 +507,8 @@ Any WrappedHasLegendProperty::getPropertyDefault( const Reference< beans::XPrope return aRet; } +namespace { + //PROP_DOCUMENT_HAS_MAIN_TITLE class WrappedHasMainTitleProperty : public WrappedProperty { @@ -511,6 +525,8 @@ private: //member std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; }; +} + WrappedHasMainTitleProperty::WrappedHasMainTitleProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("HasMainTitle",OUString()) , m_spChart2ModelContact( spChart2ModelContact ) @@ -557,6 +573,8 @@ Any WrappedHasMainTitleProperty::getPropertyDefault( const Reference< beans::XPr return aRet; } +namespace { + //PROP_DOCUMENT_HAS_SUB_TITLE class WrappedHasSubTitleProperty : public WrappedProperty { @@ -573,6 +591,8 @@ private: //member std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; }; +} + WrappedHasSubTitleProperty::WrappedHasSubTitleProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("HasSubTitle",OUString()) , m_spChart2ModelContact( spChart2ModelContact ) diff --git a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx index 3ba2fe5323db..07d48ff4eb9d 100644 --- a/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/DiagramWrapper.cxx @@ -1096,6 +1096,8 @@ void SAL_CALL DiagramWrapper::removeEventListener( m_aEventListenerContainer.removeInterface( aListener ); } +namespace { + //PROP_DIAGRAM_DATAROW_SOURCE class WrappedDataRowSourceProperty : public WrappedProperty { @@ -1113,6 +1115,8 @@ private: //member mutable Any m_aOuterValue; }; +} + WrappedDataRowSourceProperty::WrappedDataRowSourceProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("DataRowSource",OUString()) , m_spChart2ModelContact( spChart2ModelContact ) @@ -1184,6 +1188,8 @@ Any WrappedDataRowSourceProperty::getPropertyDefault( const Reference< beans::XP return aRet; } +namespace { + //PROP_DIAGRAM_STACKED //PROP_DIAGRAM_DEEP //PROP_DIAGRAM_PERCENT_STACKED @@ -1207,6 +1213,8 @@ std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; mutable Any m_aOuterValue; }; +} + WrappedStackingProperty::WrappedStackingProperty(StackMode eStackMode, const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty(OUString(),OUString()) , m_spChart2ModelContact( spChart2ModelContact ) @@ -1285,6 +1293,8 @@ Any WrappedStackingProperty::getPropertyDefault( const Reference< beans::XProper return aRet; } +namespace { + //PROP_DIAGRAM_THREE_D class WrappedDim3DProperty : public WrappedProperty { @@ -1302,6 +1312,8 @@ private: //member mutable Any m_aOuterValue; }; +} + WrappedDim3DProperty::WrappedDim3DProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("Dim3D",OUString()) , m_spChart2ModelContact( spChart2ModelContact ) @@ -1345,6 +1357,8 @@ Any WrappedDim3DProperty::getPropertyDefault( const Reference< beans::XPropertyS return aRet; } +namespace { + //PROP_DIAGRAM_VERTICAL class WrappedVerticalProperty : public WrappedProperty { @@ -1362,6 +1376,8 @@ private: //member mutable Any m_aOuterValue; }; +} + WrappedVerticalProperty::WrappedVerticalProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("Vertical",OUString()) , m_spChart2ModelContact( spChart2ModelContact ) @@ -1410,6 +1426,8 @@ Any WrappedVerticalProperty::getPropertyDefault( const Reference< beans::XProper return aRet; } +namespace { + //PROP_DIAGRAM_NUMBER_OF_LINES class WrappedNumberOfLinesProperty : public WrappedProperty { @@ -1430,6 +1448,8 @@ private: //member mutable Any m_aOuterValue; }; +} + WrappedNumberOfLinesProperty::WrappedNumberOfLinesProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("NumberOfLines",OUString()) , m_spChart2ModelContact( spChart2ModelContact ) @@ -1553,6 +1573,8 @@ Any WrappedNumberOfLinesProperty::getPropertyDefault( const Reference< beans::XP return aRet; } +namespace { + //PROP_DIAGRAM_ATTRIBUTED_DATA_POINTS class WrappedAttributedDataPointsProperty : public WrappedProperty { @@ -1570,6 +1592,8 @@ private: //member mutable Any m_aOuterValue; }; +} + WrappedAttributedDataPointsProperty::WrappedAttributedDataPointsProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("AttributedDataPoints",OUString()) , m_spChart2ModelContact( spChart2ModelContact ) @@ -1654,6 +1678,8 @@ Any WrappedAttributedDataPointsProperty::getPropertyDefault( const Reference< be return aRet; } +namespace { + //PROP_DIAGRAM_SOLIDTYPE class WrappedSolidTypeProperty : public WrappedProperty { @@ -1671,6 +1697,8 @@ private: //member mutable Any m_aOuterValue; }; +} + WrappedSolidTypeProperty::WrappedSolidTypeProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty( "SolidType", OUString() ) , m_spChart2ModelContact( spChart2ModelContact ) @@ -1717,6 +1745,8 @@ Any WrappedSolidTypeProperty::getPropertyDefault( const Reference< beans::XPrope return uno::Any( css::chart::ChartSolidType::RECTANGULAR_SOLID ); } +namespace { + class WrappedAutomaticSizeProperty : public WrappedProperty { public: @@ -1729,6 +1759,8 @@ public: virtual css::uno::Any getPropertyDefault( const css::uno::Reference< css::beans::XPropertyState >& xInnerPropertyState ) const override; }; +} + WrappedAutomaticSizeProperty::WrappedAutomaticSizeProperty() : WrappedProperty( "AutomaticSize", OUString() ) { @@ -1777,6 +1809,8 @@ Any WrappedAutomaticSizeProperty::getPropertyDefault( const Reference< beans::XP return aRet; } +namespace { + //PROP_DIAGRAM_INCLUDE_HIDDEN_CELLS class WrappedIncludeHiddenCellsProperty : public WrappedProperty { @@ -1790,6 +1824,8 @@ private: //member std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; }; +} + WrappedIncludeHiddenCellsProperty::WrappedIncludeHiddenCellsProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedProperty("IncludeHiddenCells","IncludeHiddenCells") , m_spChart2ModelContact( spChart2ModelContact ) diff --git a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx index 994dfcd034e4..21da1f1c6ceb 100644 --- a/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/LegendWrapper.cxx @@ -49,6 +49,8 @@ using ::com::sun::star::uno::Sequence; namespace chart { +namespace { + class WrappedLegendAlignmentProperty : public WrappedProperty { public: @@ -62,6 +64,8 @@ protected: virtual Any convertOuterToInnerValue( const Any& rOuterValue ) const override; }; +} + WrappedLegendAlignmentProperty::WrappedLegendAlignmentProperty() : ::chart::WrappedProperty( "Alignment", "AnchorPosition" ) { diff --git a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx index 8a30633ac935..20495fc8e7e5 100644 --- a/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx +++ b/chart2/source/controller/chartapiwrapper/TitleWrapper.cxx @@ -50,6 +50,8 @@ using ::com::sun::star::uno::Sequence; namespace chart { +namespace { + class WrappedTitleStringProperty : public WrappedProperty { public: @@ -63,6 +65,8 @@ protected: Reference< uno::XComponentContext > m_xContext; }; +} + WrappedTitleStringProperty::WrappedTitleStringProperty( const Reference< uno::XComponentContext >& xContext ) : ::chart::WrappedProperty( "String", OUString() ) , m_xContext( xContext ) @@ -101,12 +105,16 @@ Any WrappedTitleStringProperty::getPropertyDefault( const Reference< beans::XPro return uno::Any( OUString() );//default title is an empty String } +namespace { + class WrappedStackedTextProperty : public WrappedProperty { public: WrappedStackedTextProperty(); }; +} + WrappedStackedTextProperty::WrappedStackedTextProperty() : ::chart::WrappedProperty( "StackedText", "StackCharacters" ) { diff --git a/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx index 8ac56ce8c446..58e89e439b00 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedAutomaticPositionProperties.cxx @@ -35,6 +35,8 @@ namespace chart namespace wrapper { +namespace { + class WrappedAutomaticPositionProperty : public WrappedProperty { public: @@ -45,6 +47,8 @@ public: virtual Any getPropertyDefault( const Reference< beans::XPropertyState >& xInnerPropertyState ) const override; }; +} + WrappedAutomaticPositionProperty::WrappedAutomaticPositionProperty() : ::chart::WrappedProperty( "AutomaticPosition" , OUString() ) { diff --git a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx index ad349fa0275a..3949037a8a93 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedAxisAndGridExistenceProperties.cxx @@ -34,6 +34,8 @@ namespace chart namespace wrapper { +namespace { + class WrappedAxisAndGridExistenceProperty : public WrappedProperty { public: @@ -53,6 +55,8 @@ private: //member sal_Int32 m_nDimensionIndex; }; +} + void WrappedAxisAndGridExistenceProperties::addWrappedProperties( std::vector< std::unique_ptr<WrappedProperty> >& rList , const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact ) { @@ -190,6 +194,8 @@ Any WrappedAxisAndGridExistenceProperty::getPropertyDefault( const Reference< be return aRet; } +namespace { + class WrappedAxisTitleExistenceProperty : public WrappedProperty { public: @@ -207,6 +213,8 @@ private: //member TitleHelper::eTitleType m_eTitleType; }; +} + void WrappedAxisTitleExistenceProperties::addWrappedProperties( std::vector< std::unique_ptr<WrappedProperty> >& rList , const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact ) { @@ -292,6 +300,8 @@ Any WrappedAxisTitleExistenceProperty::getPropertyDefault( const Reference< bean return aRet; } +namespace { + class WrappedAxisLabelExistenceProperty : public WrappedProperty { public: @@ -310,6 +320,8 @@ private: //member sal_Int32 m_nDimensionIndex; }; +} + void WrappedAxisLabelExistenceProperties::addWrappedProperties( std::vector< std::unique_ptr<WrappedProperty> >& rList , const std::shared_ptr< Chart2ModelContact >& spChart2ModelContact ) { diff --git a/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx index 6468d64acec8..4d9b77f29eb3 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedDataCaptionProperties.cxx @@ -36,6 +36,9 @@ namespace chart namespace wrapper { +namespace +{ + class WrappedDataCaptionProperty : public WrappedSeriesOrDiagramProperty< sal_Int32 > { public: @@ -46,8 +49,6 @@ public: tSeriesOrDiagramPropertyType ePropertyType ); }; -namespace -{ enum { //data caption properties diff --git a/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx index 003c3b877514..047ad10740f1 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedScaleTextProperties.cxx @@ -37,6 +37,8 @@ namespace chart namespace wrapper { +namespace { + class WrappedScaleTextProperty : public WrappedProperty { public: @@ -50,6 +52,8 @@ private: std::shared_ptr< Chart2ModelContact > m_spChart2ModelContact; }; +} + WrappedScaleTextProperty::WrappedScaleTextProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : ::chart::WrappedProperty( "ScaleText" , OUString() ) , m_spChart2ModelContact( spChart2ModelContact ) diff --git a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx index ae114a30ea64..15645fa0c174 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedSplineProperties.cxx @@ -40,6 +40,9 @@ namespace chart namespace wrapper { +namespace +{ + //PROPERTYTYPE is the type of the outer property template< typename PROPERTYTYPE > @@ -167,8 +170,6 @@ public: virtual css::uno::Any convertOuterToInnerValue( const css::uno::Any& rOuterValue ) const override; }; -namespace -{ enum { //spline properties diff --git a/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx index 954c61aba2ff..d5508eccef44 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedStatisticProperties.cxx @@ -168,8 +168,6 @@ void lcl_ConvertRangeToXML( } } -}//anonymous namespace - template< typename PROPERTYTYPE > class WrappedStatisticProperty : public WrappedSeriesOrDiagramProperty< PROPERTYTYPE > { @@ -217,6 +215,8 @@ private: mutable Any m_aOuterValue; }; +}//anonymous namespace + WrappedConstantErrorLowProperty::WrappedConstantErrorLowProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -253,6 +253,8 @@ void WrappedConstantErrorLowProperty::setValueToSeries( const Reference< beans:: } } +namespace { + //PROP_CHART_STATISTIC_CONST_ERROR_HIGH class WrappedConstantErrorHighProperty : public WrappedStatisticProperty< double > { @@ -267,6 +269,8 @@ private: mutable Any m_aOuterValue; }; +} + WrappedConstantErrorHighProperty::WrappedConstantErrorHighProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -303,6 +307,8 @@ void WrappedConstantErrorHighProperty::setValueToSeries( const Reference< beans: } } +namespace { + //PROP_CHART_STATISTIC_MEAN_VALUE class WrappedMeanValueProperty : public WrappedStatisticProperty< bool > { @@ -314,6 +320,8 @@ public: tSeriesOrDiagramPropertyType ePropertyType ); }; +} + WrappedMeanValueProperty::WrappedMeanValueProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -342,6 +350,8 @@ void WrappedMeanValueProperty::setValueToSeries( const Reference< beans::XProper } } +namespace { + //PROP_CHART_STATISTIC_ERROR_CATEGORY // deprecated, replaced by ErrorBarStyle class WrappedErrorCategoryProperty : public WrappedStatisticProperty< css::chart::ChartErrorCategory > @@ -354,6 +364,8 @@ public: tSeriesOrDiagramPropertyType ePropertyType ); }; +} + WrappedErrorCategoryProperty::WrappedErrorCategoryProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -437,6 +449,8 @@ void WrappedErrorCategoryProperty::setValueToSeries( const Reference< beans::XPr } } +namespace { + //PROP_CHART_STATISTIC_PERCENT_ERROR class WrappedPercentageErrorProperty : public WrappedStatisticProperty< double > { @@ -451,6 +465,8 @@ private: mutable Any m_aOuterValue; }; +} + WrappedPercentageErrorProperty::WrappedPercentageErrorProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -487,6 +503,8 @@ void WrappedPercentageErrorProperty::setValueToSeries( const Reference< beans::X } } +namespace { + //PROP_CHART_STATISTIC_ERROR_MARGIN class WrappedErrorMarginProperty : public WrappedStatisticProperty< double > { @@ -501,6 +519,8 @@ private: mutable Any m_aOuterValue; }; +} + WrappedErrorMarginProperty::WrappedErrorMarginProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -537,6 +557,8 @@ void WrappedErrorMarginProperty::setValueToSeries( const Reference< beans::XProp } } +namespace { + //PROP_CHART_STATISTIC_ERROR_INDICATOR class WrappedErrorIndicatorProperty : public WrappedStatisticProperty< css::chart::ChartErrorIndicatorType > { @@ -548,6 +570,8 @@ public: tSeriesOrDiagramPropertyType ePropertyType ); }; +} + WrappedErrorIndicatorProperty::WrappedErrorIndicatorProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -605,6 +629,8 @@ void WrappedErrorIndicatorProperty::setValueToSeries( const Reference< beans::XP } } +namespace { + //PROP_CHART_STATISTIC_ERROR_BAR_STYLE // this is the new constant group that replaces the deprecated enum ChartErrorCategory class WrappedErrorBarStyleProperty : public WrappedStatisticProperty< sal_Int32 > @@ -617,6 +643,8 @@ public: tSeriesOrDiagramPropertyType ePropertyType ); }; +} + WrappedErrorBarStyleProperty::WrappedErrorBarStyleProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -648,6 +676,8 @@ void WrappedErrorBarStyleProperty::setValueToSeries( const Reference< beans::XPr } } +namespace { + //PROP_CHART_STATISTIC_ERROR_RANGE_POSITIVE class WrappedErrorBarRangePositiveProperty : public WrappedStatisticProperty< OUString > { @@ -659,6 +689,8 @@ public: tSeriesOrDiagramPropertyType ePropertyType ); }; +} + WrappedErrorBarRangePositiveProperty::WrappedErrorBarRangePositiveProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -708,6 +740,8 @@ void WrappedErrorBarRangePositiveProperty::setValueToSeries( const Reference< be } } +namespace { + //PROP_CHART_STATISTIC_ERROR_RANGE_NEGATIVE class WrappedErrorBarRangeNegativeProperty : public WrappedStatisticProperty< OUString > { @@ -719,6 +753,8 @@ public: tSeriesOrDiagramPropertyType ePropertyType ); }; +} + WrappedErrorBarRangeNegativeProperty::WrappedErrorBarRangeNegativeProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -768,6 +804,8 @@ void WrappedErrorBarRangeNegativeProperty::setValueToSeries( const Reference< be } } +namespace { + //PROP_CHART_STATISTIC_REGRESSION_CURVES class WrappedRegressionCurvesProperty : public WrappedStatisticProperty< css::chart::ChartRegressionCurveType > { @@ -779,6 +817,8 @@ public: tSeriesOrDiagramPropertyType ePropertyType ); }; +} + WrappedRegressionCurvesProperty::WrappedRegressionCurvesProperty( std::shared_ptr< Chart2ModelContact > spChart2ModelContact, tSeriesOrDiagramPropertyType ePropertyType ) @@ -815,6 +855,8 @@ void WrappedRegressionCurvesProperty::setValueToSeries( const Reference< beans:: } } +namespace { + //PROP_CHART_STATISTIC_REGRESSION_PROPERTIES //PROP_CHART_STATISTIC_ERROR_PROPERTIES //PROP_CHART_STATISTIC_MEAN_VALUE_PROPERTIES @@ -840,6 +882,8 @@ private: PropertySetType m_eType; }; +} + WrappedStatisticPropertySetProperty::WrappedStatisticPropertySetProperty( PropertySetType ePropertySetType , std::shared_ptr< Chart2ModelContact > spChart2ModelContact diff --git a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx index 9123543d9036..3155a969102f 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedStockProperties.cxx @@ -37,6 +37,8 @@ namespace chart namespace wrapper { +namespace { + class WrappedStockProperty : public WrappedProperty { public: @@ -56,6 +58,8 @@ protected: css::uno::Any m_aDefaultValue; }; +} + WrappedStockProperty::WrappedStockProperty( const OUString& rOuterName , const css::uno::Any& rDefaulValue , const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact ) @@ -107,6 +111,8 @@ css::uno::Any WrappedStockProperty::getPropertyDefault( const css::uno::Referenc return m_aDefaultValue; } +namespace { + class WrappedVolumeProperty : public WrappedStockProperty { public: @@ -117,6 +123,8 @@ public: uno::Reference< chart2::XChartTypeTemplate > getNewTemplate( bool bNewValue, const OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const override; }; +} + WrappedVolumeProperty::WrappedVolumeProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedStockProperty( "Volume", uno::Any(false) , spChart2ModelContact ) { @@ -172,6 +180,8 @@ uno::Reference< chart2::XChartTypeTemplate > WrappedVolumeProperty::getNewTempla return xTemplate; } +namespace { + class WrappedUpDownProperty : public WrappedStockProperty { public: @@ -182,6 +192,8 @@ public: uno::Reference< chart2::XChartTypeTemplate > getNewTemplate( bool bNewValue, const OUString& rCurrentTemplate, const Reference< lang::XMultiServiceFactory >& xFactory ) const override; }; +} + WrappedUpDownProperty::WrappedUpDownProperty(const std::shared_ptr<Chart2ModelContact>& spChart2ModelContact) : WrappedStockProperty( "UpDown", uno::Any(false) , spChart2ModelContact ) { diff --git a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx index 20f9da101be9..79ed7047331c 100644 --- a/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx +++ b/chart2/source/controller/chartapiwrapper/WrappedSymbolProperties.cxx @@ -43,6 +43,9 @@ namespace chart namespace wrapper { +namespace +{ + class WrappedSymbolTypeProperty : public WrappedSeriesOrDiagramProperty< sal_Int32 > { public: @@ -98,8 +101,6 @@ public: tSeriesOrDiagramPropertyType ePropertyType); }; -namespace -{ enum { //symbol properties diff --git a/chart2/source/controller/dialogs/dlg_DataSource.cxx b/chart2/source/controller/dialogs/dlg_DataSource.cxx index 283357686553..7d5c4670b81c 100644 --- a/chart2/source/controller/dialogs/dlg_DataSource.cxx +++ b/chart2/source/controller/dialogs/dlg_DataSource.cxx @@ -37,6 +37,8 @@ using ::com::sun::star::uno::Reference; namespace chart { +namespace { + class DocumentChartTypeTemplateProvider : public ChartTypeTemplateProvider { public: @@ -50,6 +52,8 @@ private: Reference< chart2::XChartTypeTemplate > m_xTemplate; }; +} + DocumentChartTypeTemplateProvider::DocumentChartTypeTemplateProvider( const Reference< chart2::XChartDocument > & xDoc ) { diff --git a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx index 8bb45729b6f4..39000a96949a 100644 --- a/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx +++ b/chart2/source/controller/dialogs/tp_3D_SceneIllumination.cxx @@ -57,6 +57,8 @@ void LightButton::switchLightOn(bool bOn) m_xButton->set_from_icon_name(RID_SVXBMP_LAMP_OFF); } +namespace { + struct LightSource { Color nDiffuseColor; @@ -70,6 +72,8 @@ struct LightSource {} }; +} + struct LightSourceInfo { LightButton* pButton; diff --git a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx index 9a5d60ed3afd..bbe54492cbd9 100644 --- a/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx +++ b/chart2/source/controller/itemsetwrapper/TitleItemConverter.cxx @@ -44,8 +44,6 @@ ItemPropertyMapType & lcl_GetTitlePropertyMap() return aTitlePropertyMap; }; -} // anonymous namespace - class FormattedStringsConverter : public MultipleItemConverter { public: @@ -59,6 +57,8 @@ protected: virtual const sal_uInt16 * GetWhichPairs() const override; }; +} // anonymous namespace + FormattedStringsConverter::FormattedStringsConverter( const uno::Sequence< uno::Reference< chart2::XFormattedString > > & aStrings, SfxItemPool & rItemPool, diff --git a/chart2/source/controller/main/ConfigurationAccess.cxx b/chart2/source/controller/main/ConfigurationAccess.cxx index dc1ba9f657a6..2d1dcfcf9b6e 100644 --- a/chart2/source/controller/main/ConfigurationAccess.cxx +++ b/chart2/source/controller/main/ConfigurationAccess.cxx @@ -38,7 +38,6 @@ bool lcl_IsMetric() return ( eSys == MeasurementSystem::Metric ); } -}//end anonymous namespace class CalcConfigItem : public ::utl::ConfigItem { @@ -52,6 +51,8 @@ public: virtual void Notify( const uno::Sequence<OUString>& aPropertyNames) override; }; +}//end anonymous namespace + CalcConfigItem::CalcConfigItem() : ConfigItem( "Office.Calc/Layout" ) { diff --git a/chart2/source/model/main/UndoManager.cxx b/chart2/source/model/main/UndoManager.cxx index 023ab553b345..f295bc288eb2 100644 --- a/chart2/source/model/main/UndoManager.cxx +++ b/chart2/source/model/main/UndoManager.cxx @@ -122,6 +122,8 @@ namespace chart throw DisposedException( OUString(), getThis() ); } + namespace { + /** guard for public UNO methods of the UndoManager The only purpose of this guard is to check for the instance being disposed already. Everything else, @@ -155,6 +157,8 @@ namespace chart virtual void release() override { } }; + } + ::framework::IMutex& UndoManagerMethodGuard::getGuardedMutex() { static DummyMutex s_aDummyMutex; diff --git a/chart2/source/tools/ExplicitCategoriesProvider.cxx b/chart2/source/tools/ExplicitCategoriesProvider.cxx index b6652e25f11d..46036e5b9d3f 100644 --- a/chart2/source/tools/ExplicitCategoriesProvider.cxx +++ b/chart2/source/tools/ExplicitCategoriesProvider.cxx @@ -208,6 +208,8 @@ SplitCategoriesProvider::~SplitCategoriesProvider() { } +namespace { + class SplitCategoriesProvider_ForLabeledDataSequences : public SplitCategoriesProvider { public: @@ -230,6 +232,8 @@ private: ChartModel& mrModel; }; +} + sal_Int32 SplitCategoriesProvider_ForLabeledDataSequences::getLevelCount() const { return m_rSplitCategoriesList.getLength(); diff --git a/chart2/source/view/axes/VCartesianAxis.cxx b/chart2/source/view/axes/VCartesianAxis.cxx index efb87de74026..7257a6432605 100644 --- a/chart2/source/view/axes/VCartesianAxis.cxx +++ b/chart2/source/view/axes/VCartesianAxis.cxx @@ -230,6 +230,8 @@ static void removeShapesAtWrongRhythm( TickIter& rIter } } +namespace { + /** * If the labels are staggered and bInnerLine is true we iterate through * only those labels that are closer to the diagram. @@ -255,6 +257,8 @@ private: //member bool m_bInnerLine; }; +} + LabelIterator::LabelIterator( TickInfoArrayType& rTickInfoVector , const AxisLabelStaggering eAxisLabelStaggering , bool bInnerLine ) @@ -448,6 +452,8 @@ static void getAxisLabelProperties( rPropValues, rPropNames, rAxisProp.maLabelAlignment.meAlignment); } +namespace { + /** * Iterate through only 3 ticks including the one that has the longest text * length. When the first tick has the longest text, it iterates through @@ -468,6 +474,8 @@ private: size_t m_nCurrentIndex; }; +} + MaxLabelTickIter::MaxLabelTickIter( TickInfoArrayType& rTickInfoVector, size_t nLongestLabelIndex ) : m_rTickInfoVector(rTickInfoVector), m_nCurrentIndex(0) @@ -1152,6 +1160,9 @@ VCartesianAxis::ScreenPosAndLogicPos VCartesianAxis::getScreenPosAndLogicPos( do } typedef std::vector< VCartesianAxis::ScreenPosAndLogicPos > tScreenPosAndLogicPosList; + +namespace { + struct lcl_LessXPos { bool operator() ( const VCartesianAxis::ScreenPosAndLogicPos& rPos1, const VCartesianAxis::ScreenPosAndLogicPos& rPos2 ) @@ -1168,6 +1179,8 @@ struct lcl_GreaterYPos } }; +} + void VCartesianAxis::get2DAxisMainLine( B2DVector& rStart, B2DVector& rEnd, AxisLabelAlignment& rAlignment, double fCrossesOtherAxis ) const { diff --git a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx index f8cfe828d0ae..61050a12500f 100644 --- a/chart2/source/view/axes/VCartesianCoordinateSystem.cxx +++ b/chart2/source/view/axes/VCartesianCoordinateSystem.cxx @@ -34,6 +34,8 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::chart2; using ::com::sun::star::uno::Reference; +namespace { + class TextualDataProvider : public ::cppu::WeakImplHelper< css::chart2::data::XTextualDataSequence > @@ -54,6 +56,8 @@ private: //member uno::Sequence< OUString > m_aTextSequence; }; +} + VCartesianCoordinateSystem::VCartesianCoordinateSystem( const Reference< XCoordinateSystem >& xCooSys ) : VCoordinateSystem(xCooSys) { diff --git a/chart2/source/view/axes/VCartesianGrid.cxx b/chart2/source/view/axes/VCartesianGrid.cxx index 45df4131faff..36a143df4545 100644 --- a/chart2/source/view/axes/VCartesianGrid.cxx +++ b/chart2/source/view/axes/VCartesianGrid.cxx @@ -39,6 +39,8 @@ using namespace ::com::sun::star::chart2; using ::com::sun::star::uno::Reference; using ::com::sun::star::uno::Sequence; +namespace { + struct GridLinePoints { Sequence< double > P0; @@ -54,6 +56,8 @@ struct GridLinePoints sal_Int32 m_nDimensionIndex; }; +} + GridLinePoints::GridLinePoints( const PlottingPositionHelper* pPosHelper, sal_Int32 nDimensionIndex , CuboidPlanePosition eLeftWallPos , CuboidPlanePosition eBackWallPos diff --git a/chart2/source/view/charttypes/AreaChart.cxx b/chart2/source/view/charttypes/AreaChart.cxx index e9c54add6c0f..ca2218087a43 100644 --- a/chart2/source/view/charttypes/AreaChart.cxx +++ b/chart2/source/view/charttypes/AreaChart.cxx @@ -581,8 +581,6 @@ void lcl_reorderSeries( std::vector< std::vector< VDataSeriesGroup > >& rZSlots rZSlots = std::move(aRet); } -}//anonymous namespace - //better performance for big data struct FormerPoint { @@ -601,6 +599,8 @@ struct FormerPoint double m_fZ; }; +}//anonymous namespace + void AreaChart::createShapes() { if( m_aZSlots.empty() ) //no series diff --git a/chart2/source/view/charttypes/BarChart.cxx b/chart2/source/view/charttypes/BarChart.cxx index 47c137b32ab4..e50fbe36ff74 100644 --- a/chart2/source/view/charttypes/BarChart.cxx +++ b/chart2/source/view/charttypes/BarChart.cxx @@ -385,6 +385,8 @@ void BarChart::addSeries( std::unique_ptr<VDataSeries> pSeries, sal_Int32 zSlot, VSeriesPlotter::addSeries( std::move(pSeries), zSlot, xSlot, ySlot ); } +namespace { + //better performance for big data struct FormerBarPoint { @@ -405,6 +407,8 @@ struct FormerBarPoint double m_fZ; }; +} + void BarChart::adaptOverlapAndGapwidthForGroupBarsPerAxis() { //adapt m_aOverlapSequence and m_aGapwidthSequence for the groupBarsPerAxis feature diff --git a/chart2/source/view/charttypes/BubbleChart.cxx b/chart2/source/view/charttypes/BubbleChart.cxx index 1a0123f0c094..ef2a75934dfb 100644 --- a/chart2/source/view/charttypes/BubbleChart.cxx +++ b/chart2/source/view/charttypes/BubbleChart.cxx @@ -136,6 +136,8 @@ drawing::Direction3D BubbleChart::getPreferredDiagramAspectRatio() const return drawing::Direction3D(-1,-1,-1); } +namespace { + //better performance for big data struct FormerPoint { @@ -154,6 +156,8 @@ struct FormerPoint double m_fZ; }; +} + void BubbleChart::createShapes() { if( m_aZSlots.empty() ) //no series diff --git a/chart2/source/view/charttypes/ConfigAccess.cxx b/chart2/source/view/charttypes/ConfigAccess.cxx index 2e6e507408b4..964e58ce43f7 100644 --- a/chart2/source/view/charttypes/ConfigAccess.cxx +++ b/chart2/source/view/charttypes/ConfigAccess.cxx @@ -28,6 +28,8 @@ namespace chart { using namespace ::com::sun::star; +namespace +{ class ChartConfigItem : public ::utl::ConfigItem { private: @@ -39,6 +41,7 @@ public: bool getUseErrorRectangle(); virtual void Notify(const uno::Sequence<OUString>& aPropertyNames) override; }; +} ChartConfigItem::ChartConfigItem() : ConfigItem("Office.Chart/ErrorProperties") diff --git a/chart2/source/view/charttypes/NetChart.cxx b/chart2/source/view/charttypes/NetChart.cxx index 823004d2091a..2f99bece1cfc 100644 --- a/chart2/source/view/charttypes/NetChart.cxx +++ b/chart2/source/view/charttypes/NetChart.cxx @@ -293,8 +293,6 @@ void lcl_reorderSeries( std::vector< std::vector< VDataSeriesGroup > >& rZSlots rZSlots = std::move(aRet); } -}//anonymous namespace - //better performance for big data struct FormerPoint { @@ -313,6 +311,8 @@ struct FormerPoint double m_fZ; }; +}//anonymous namespace + void NetChart::createShapes() { if( m_aZSlots.empty() ) //no series diff --git a/comphelper/qa/container/comphelper_ifcontainer.cxx b/comphelper/qa/container/comphelper_ifcontainer.cxx index 8bd9bf75f660..4d28c496fe2e 100644 --- a/comphelper/qa/container/comphelper_ifcontainer.cxx +++ b/comphelper/qa/container/comphelper_ifcontainer.cxx @@ -31,6 +31,8 @@ using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::lang; +namespace { + struct ContainerStats { int m_nAlive; int m_nDisposed; @@ -50,6 +52,8 @@ public: } }; +} + namespace comphelper_ifcontainer { static const int nTests = 10; diff --git a/comphelper/source/compare/AnyCompareFactory.cxx b/comphelper/source/compare/AnyCompareFactory.cxx index e4cec19feeed..7a31f10f1f71 100644 --- a/comphelper/source/compare/AnyCompareFactory.cxx +++ b/comphelper/source/compare/AnyCompareFactory.cxx @@ -31,6 +31,8 @@ using namespace com::sun::star::ucb; using namespace com::sun::star::lang; using namespace com::sun::star::i18n; +namespace { + class AnyCompare : public ::cppu::WeakImplHelper< XAnyCompare > { Reference< XCollator > m_xCollator; @@ -68,6 +70,8 @@ public: virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; }; +} + sal_Int16 SAL_CALL AnyCompare::compare( const Any& any1, const Any& any2 ) { sal_Int16 aResult = 0; diff --git a/comphelper/source/container/IndexedPropertyValuesContainer.cxx b/comphelper/source/container/IndexedPropertyValuesContainer.cxx index 0053cc8e4374..ecd1c2dbb2f8 100644 --- a/comphelper/source/container/IndexedPropertyValuesContainer.cxx +++ b/comphelper/source/container/IndexedPropertyValuesContainer.cxx @@ -34,6 +34,8 @@ using namespace com::sun::star; typedef std::vector < uno::Sequence< beans::PropertyValue > > IndexedPropertyValues; +namespace { + class IndexedPropertyValuesContainer : public cppu::WeakImplHelper< container::XIndexContainer, lang::XServiceInfo > { public: @@ -63,6 +65,8 @@ private: IndexedPropertyValues maProperties; }; +} + IndexedPropertyValuesContainer::IndexedPropertyValuesContainer() throw() { } diff --git a/comphelper/source/container/NamedPropertyValuesContainer.cxx b/comphelper/source/container/NamedPropertyValuesContainer.cxx index 13b8f855866f..79a7d714b5e6 100644 --- a/comphelper/source/container/NamedPropertyValuesContainer.cxx +++ b/comphelper/source/container/NamedPropertyValuesContainer.cxx @@ -32,6 +32,8 @@ using namespace com::sun::star; typedef std::map< OUString, uno::Sequence<beans::PropertyValue> > NamedPropertyValues; +namespace { + class NamedPropertyValuesContainer : public cppu::WeakImplHelper< container::XNameContainer, lang::XServiceInfo > { public: @@ -62,6 +64,8 @@ private: NamedPropertyValues maProperties; }; +} + NamedPropertyValuesContainer::NamedPropertyValuesContainer() throw() { } diff --git a/comphelper/source/container/enumerablemap.cxx b/comphelper/source/container/enumerablemap.cxx index bee5d03963b2..f9e5cfa8989a 100644 --- a/comphelper/source/container/enumerablemap.cxx +++ b/comphelper/source/container/enumerablemap.cxx @@ -76,9 +76,16 @@ namespace comphelper using ::com::sun::star::uno::TypeDescription; using ::com::sun::star::lang::DisposedException; + namespace { + class MapEnumerator; + } + typedef std::map< Any, Any, LessPredicateAdapter > KeyedValues; + + namespace { + struct MapData { Type m_aKeyType; @@ -106,6 +113,7 @@ namespace comphelper MapData& operator=( const MapData& _source ) = delete; }; + } static void lcl_registerMapModificationListener( MapData& _mapData, MapEnumerator& _listener ) { @@ -141,6 +149,8 @@ namespace comphelper , XServiceInfo > Map_IFace; + namespace { + class EnumerableMap: public Map_IFace, public ComponentBase { protected: @@ -194,15 +204,11 @@ namespace comphelper MapData m_aData; }; - namespace { - enum EnumerationType { eKeys, eValues, eBoth }; - } - class MapEnumerator final { public: @@ -249,6 +255,8 @@ namespace comphelper bool m_disposed; }; + } + static void lcl_notifyMapDataListeners_nothrow( const MapData& _mapData ) { for ( MapEnumerator* loop : _mapData.m_aModListeners ) @@ -259,6 +267,9 @@ namespace comphelper typedef ::cppu::WeakImplHelper < XEnumeration > MapEnumeration_Base; + + namespace { + class MapEnumeration :public ComponentBase ,public MapEnumeration_Base { @@ -294,6 +305,7 @@ namespace comphelper MapEnumerator m_aEnumerator; }; + } EnumerableMap::EnumerableMap() :Map_IFace( m_aMutex ) diff --git a/comphelper/source/container/namecontainer.cxx b/comphelper/source/container/namecontainer.cxx index 0f905fac9124..bed257ca50c7 100644 --- a/comphelper/source/container/namecontainer.cxx +++ b/comphelper/source/container/namecontainer.cxx @@ -31,6 +31,8 @@ typedef std::map<OUString, css::uno::Any> SvGenericNameContainerMapImpl; namespace comphelper { + namespace { + /** this is the base helper class for NameContainer that's also declared in this header. */ class NameContainer : public ::cppu::WeakImplHelper< css::container::XNameContainer > { @@ -58,6 +60,8 @@ namespace comphelper const css::uno::Type maType; osl::Mutex maMutex; }; + + } } using namespace ::comphelper; diff --git a/comphelper/source/eventattachermgr/eventattachermgr.cxx b/comphelper/source/eventattachermgr/eventattachermgr.cxx index 209d0ac6deb6..6651c6033bb6 100644 --- a/comphelper/source/eventattachermgr/eventattachermgr.cxx +++ b/comphelper/source/eventattachermgr/eventattachermgr.cxx @@ -62,6 +62,7 @@ using namespace osl; namespace comphelper { +namespace { struct AttachedObject_Impl { @@ -149,6 +150,7 @@ public: virtual void SAL_CALL disposing(const EventObject& Source) override; }; +} AttacherAllListener_Impl::AttacherAllListener_Impl ( diff --git a/comphelper/source/misc/anycompare.cxx b/comphelper/source/misc/anycompare.cxx index f4d2a8b5d260..bb77544c957e 100644 --- a/comphelper/source/misc/anycompare.cxx +++ b/comphelper/source/misc/anycompare.cxx @@ -49,6 +49,8 @@ namespace comphelper using ::com::sun::star::util::Time; using ::com::sun::star::util::DateTime; + namespace { + class DatePredicateLess : public IKeyPredicateLess { public: @@ -158,6 +160,7 @@ namespace comphelper } }; + } std::unique_ptr< IKeyPredicateLess > getStandardLessPredicate( Type const & i_type, Reference< XCollator > const & i_collator ) { diff --git a/comphelper/source/misc/asyncnotification.cxx b/comphelper/source/misc/asyncnotification.cxx index c73bd22cf163..a360b7207fe4 100644 --- a/comphelper/source/misc/asyncnotification.cxx +++ b/comphelper/source/misc/asyncnotification.cxx @@ -38,6 +38,8 @@ namespace comphelper { } + namespace { + struct ProcessableEvent { AnyEventRef aEvent; @@ -54,9 +56,11 @@ namespace comphelper } }; + } typedef std::deque< ProcessableEvent > EventQueue; + namespace { struct EqualProcessor { @@ -69,6 +73,8 @@ namespace comphelper } }; + } + struct EventNotifierImpl { ::osl::Mutex aMutex; @@ -178,7 +184,12 @@ namespace comphelper return AsyncEventNotifierBase::terminate(); } + namespace { + struct theNotifiersMutex : public rtl::Static<osl::Mutex, theNotifiersMutex> {}; + + } + static std::vector<std::weak_ptr<AsyncEventNotifierAutoJoin>> g_Notifiers; void JoinAsyncEventNotifiers() diff --git a/comphelper/source/misc/docpasswordrequest.cxx b/comphelper/source/misc/docpasswordrequest.cxx index e1092df36f0b..56644d4d6e59 100644 --- a/comphelper/source/misc/docpasswordrequest.cxx +++ b/comphelper/source/misc/docpasswordrequest.cxx @@ -41,6 +41,7 @@ using ::com::sun::star::task::XInteractionPassword2; namespace comphelper { +namespace { class AbortContinuation : public ::cppu::WeakImplHelper< XInteractionAbort > { @@ -48,6 +49,7 @@ public: virtual void SAL_CALL select() override {} }; +} class PasswordContinuation : public ::cppu::WeakImplHelper< XInteractionPassword2 > { diff --git a/comphelper/source/misc/random.cxx b/comphelper/source/misc/random.cxx index ddc970efe321..f001b06195d6 100644 --- a/comphelper/source/misc/random.cxx +++ b/comphelper/source/misc/random.cxx @@ -38,6 +38,8 @@ namespace rng // http://en.wikipedia.org/wiki/Mersenne_twister #define STD_RNG_ALGO std::mt19937 +namespace { + struct RandomNumberGenerator { std::mutex mutex; @@ -77,6 +79,8 @@ struct RandomNumberGenerator class theRandomNumberGenerator : public rtl::Static<RandomNumberGenerator, theRandomNumberGenerator> {}; +} + // uniform ints [a,b] distribution int uniform_int_distribution(int a, int b) { diff --git a/comphelper/source/misc/threadpool.cxx b/comphelper/source/misc/threadpool.cxx index 95b6f2dff091..9b1991b7f3a1 100644 --- a/comphelper/source/misc/threadpool.cxx +++ b/comphelper/source/misc/threadpool.cxx @@ -105,6 +105,8 @@ ThreadPool::~ThreadPool() assert(maTasks.empty()); } +namespace { + struct ThreadPoolStatic : public rtl::StaticWithInit< std::shared_ptr< ThreadPool >, ThreadPoolStatic > { @@ -114,6 +116,8 @@ struct ThreadPoolStatic : public rtl::StaticWithInit< std::shared_ptr< ThreadPoo }; }; +} + ThreadPool& ThreadPool::getSharedOptimalPool() { return *ThreadPoolStatic::get(); diff --git a/comphelper/source/property/MasterPropertySet.cxx b/comphelper/source/property/MasterPropertySet.cxx index 61e6f84ecdd5..82f9d85d7525 100644 --- a/comphelper/source/property/MasterPropertySet.cxx +++ b/comphelper/source/property/MasterPropertySet.cxx @@ -28,6 +28,8 @@ #include <memory> #include <vector> +namespace { + class AutoOGuardArray { std::vector<std::unique_ptr< osl::Guard< comphelper::SolarMutex > >> maGuardArray; @@ -38,6 +40,8 @@ public: std::unique_ptr< osl::Guard< comphelper::SolarMutex > > & operator[] ( sal_Int32 i ) { return maGuardArray[i]; } }; +} + AutoOGuardArray::AutoOGuardArray( sal_Int32 nNumElements ) : maGuardArray(nNumElements) { } diff --git a/comphelper/source/property/genericpropertyset.cxx b/comphelper/source/property/genericpropertyset.cxx index b5414b5c52d8..72cec45e2992 100644 --- a/comphelper/source/property/genericpropertyset.cxx +++ b/comphelper/source/property/genericpropertyset.cxx @@ -42,6 +42,8 @@ using namespace ::com::sun::star::lang; namespace comphelper { + namespace { + struct IMPL_GenericPropertySet_MutexContainer { Mutex maMutex; @@ -84,6 +86,7 @@ namespace comphelper virtual void SAL_CALL removePropertyChangeListener( const OUString& aPropertyName, const css::uno::Reference< css::beans::XPropertyChangeListener >& aListener ) override; }; + } } diff --git a/comphelper/source/streaming/memorystream.cxx b/comphelper/source/streaming/memorystream.cxx index 8d120989eec6..940c9012f149 100644 --- a/comphelper/source/streaming/memorystream.cxx +++ b/comphelper/source/streaming/memorystream.cxx @@ -45,6 +45,8 @@ using namespace ::osl; namespace comphelper { +namespace { + class UNOMemoryStream : public WeakImplHelper<XServiceInfo, XStream, XSeekableInputStream, XOutputStream, XTruncate> { public: @@ -84,6 +86,8 @@ private: sal_Int32 mnCursor; }; +} + UNOMemoryStream::UNOMemoryStream() : mnCursor(0) { diff --git a/comphelper/source/xml/ofopxmlhelper.cxx b/comphelper/source/xml/ofopxmlhelper.cxx index 21f097531363..46785b35cbba 100644 --- a/comphelper/source/xml/ofopxmlhelper.cxx +++ b/comphelper/source/xml/ofopxmlhelper.cxx @@ -39,6 +39,8 @@ using namespace ::com::sun::star; namespace comphelper { +namespace { + // this helper class is designed to allow to parse ContentType- and Relationship-related information from OfficeOpenXML format class OFOPXMLHelper_Impl : public cppu::WeakImplHelper< css::xml::sax::XDocumentHandler > @@ -65,6 +67,7 @@ public: virtual void SAL_CALL setDocumentLocator( const css::uno::Reference< css::xml::sax::XLocator >& xLocator ) override; }; +} namespace OFOPXMLHelper { diff --git a/compilerplugins/clang/badstatics.cxx b/compilerplugins/clang/badstatics.cxx index 737330dd10c0..60abc11c222b 100644 --- a/compilerplugins/clang/badstatics.cxx +++ b/compilerplugins/clang/badstatics.cxx @@ -117,7 +117,7 @@ public: || type.Class("weak_ptr").StdNamespace() // not owning || type.Class("ImplWallpaper").GlobalNamespace() // very odd static instance here || type.Class("Application").GlobalNamespace() // numerous odd subclasses in vclmain::createApplication() - || type.Class("DemoMtfApp").GlobalNamespace() // one of these Application with own VclPtr + || type.Class("DemoMtfApp").AnonymousNamespace().GlobalNamespace() // one of these Application with own VclPtr ) { return std::make_pair(false, std::vector<FieldDecl const*>()); diff --git a/compilerplugins/clang/external.cxx b/compilerplugins/clang/external.cxx index 64da725cfff9..b31f620cf5ef 100644 --- a/compilerplugins/clang/external.cxx +++ b/compilerplugins/clang/external.cxx @@ -133,9 +133,6 @@ public: bool VisitTagDecl(TagDecl* decl) { - /*TODO:*/ - if (!isa<EnumDecl>(decl)) - return true; // in general, moving classes into an unnamed namespace can break ADL if (isa<ClassTemplateSpecializationDecl>(decl)) { return true; @@ -266,8 +263,6 @@ public: bool VisitClassTemplateDecl(ClassTemplateDecl* decl) { - /*TODO:*/ - return true; // in general, moving classes or enumerations into an unnamed namespace can break ADL if (!decl->isThisDeclarationADefinition()) { return true; @@ -329,6 +324,7 @@ private: } else { + //TODO: Derived types are also affected! CXXRecordDecl const* rec; if (auto const d = dyn_cast<ClassTemplateDecl>(decl)) { @@ -400,6 +396,10 @@ private: if (auto const d1 = dyn_cast<FriendDecl>(d)) { d = d1->getFriendDecl(); + if (d == nullptr) // happens for 'friend struct S;' + { + continue; + } } FunctionDecl const* f; if (auto const d1 = dyn_cast<FunctionTemplateDecl>(d)) diff --git a/compilerplugins/clang/refcounting.cxx b/compilerplugins/clang/refcounting.cxx index c002a1499977..168d775b28d2 100644 --- a/compilerplugins/clang/refcounting.cxx +++ b/compilerplugins/clang/refcounting.cxx @@ -256,7 +256,7 @@ bool containsSalhelperReferenceObjectSubclass(const clang::Type* pType0) { if (pTemplate) { auto const dc = loplugin::DeclCheck(pTemplate); if (dc.Class("Reference").Namespace("rtl").GlobalNamespace() - || (dc.Class("OStoreHandle").Namespace("store") + || (dc.Class("OStoreHandle").AnonymousNamespace().Namespace("store") .GlobalNamespace())) { return false; diff --git a/compilerplugins/clang/staticmethods.cxx b/compilerplugins/clang/staticmethods.cxx index 25e4d2c77473..6070ce860d82 100644 --- a/compilerplugins/clang/staticmethods.cxx +++ b/compilerplugins/clang/staticmethods.cxx @@ -173,7 +173,7 @@ bool StaticMethods::TraverseCXXMethodDecl(const CXXMethodDecl * pCXXMethodDecl) // used in a function-pointer-table if ((cdc.Class("SbiRuntime").GlobalNamespace() && startsWith(pCXXMethodDecl->getNameAsString(), "Step")) - || (cdc.Class("OoxFormulaParserImpl").Namespace("xls").Namespace("oox") + || (cdc.Class("OoxFormulaParserImpl").AnonymousNamespace().Namespace("xls").Namespace("oox") .GlobalNamespace()) || cdc.Class("SwTableFormula").GlobalNamespace() || (cdc.Class("BiffFormulaParserImpl").Namespace("xls").Namespace("oox") diff --git a/compilerplugins/clang/test/external.cxx b/compilerplugins/clang/test/external.cxx index 28b7c6df01b7..6eb486a57fc1 100644 --- a/compilerplugins/clang/test/external.cxx +++ b/compilerplugins/clang/test/external.cxx @@ -20,6 +20,7 @@ int const n2 = 0; // no warning, internal linkage constexpr int n3 = 0; // no warning, internal linkage +// expected-error@+1 {{externally available entity 'S1' is not previously declared in an included file (if it is only used in this translation unit, put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external]}} struct S1 { friend void f1() {} // no warning for injected function (no place where to mark it `static`) @@ -28,6 +29,7 @@ struct S1 friend void f2() {} }; +// expected-error@+1 {{externally available entity 'S2' is not previously declared in an included file (if it is only used in this translation unit, put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external]}} struct S2 { friend void f1(); @@ -76,11 +78,21 @@ extern "C++" { void fc(E const*); } +// expected-error@+1 {{externally available entity 'S1' is not previously declared in an included file (if it is only used in this translation unit, put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external]}} struct S1 { struct S2; // No note about associating function; injected friend function not found by ADL: friend void f2(E const*); + // expected-note@+1 {{a function associating 'N::S1' is declared here [loplugin:external]}} + friend void h(S1); +}; + +// expected-error@+1 {{externally available entity 'S3' is not previously declared in an included file (if it is only used in this translation unit, put it in an unnamed namespace; otherwise, provide a declaration of it in an included file) [loplugin:external]}} +struct S3 +{ + // expected-note@+1 {{another declaration is here [loplugin:external]}} + friend void h(S1); }; inline namespace I2 diff --git a/connectivity/source/commontools/FValue.cxx b/connectivity/source/commontools/FValue.cxx index bf79ffd5ac7b..69f0933ef7cb 100644 --- a/connectivity/source/commontools/FValue.cxx +++ b/connectivity/source/commontools/FValue.cxx @@ -2131,6 +2131,8 @@ namespace detail virtual ~IValueSource() { } }; + namespace { + class RowValue : public IValueSource { public: @@ -2192,6 +2194,8 @@ namespace detail private: const Reference< XColumn > m_xColumn; }; + + } } diff --git a/connectivity/source/commontools/TSortIndex.cxx b/connectivity/source/commontools/TSortIndex.cxx index 0658c517a07d..76bbafaeb13a 100644 --- a/connectivity/source/commontools/TSortIndex.cxx +++ b/connectivity/source/commontools/TSortIndex.cxx @@ -24,6 +24,8 @@ using namespace connectivity; +namespace { + /// Functor object for class OSortIndex::TIntValuePairVector::value_type returntype is bool struct TKeyValueFunc { @@ -76,6 +78,7 @@ struct TKeyValueFunc } }; +} ::rtl::Reference<OKeySet> OSortIndex::CreateKeySet() { diff --git a/connectivity/source/cpool/ZConnectionPool.cxx b/connectivity/source/cpool/ZConnectionPool.cxx index 7ac1845911a1..c347e5ad84c9 100644 --- a/connectivity/source/cpool/ZConnectionPool.cxx +++ b/connectivity/source/cpool/ZConnectionPool.cxx @@ -75,6 +75,8 @@ OConnectionPool::~OConnectionPool() clear(false); } +namespace { + struct TRemoveEventListenerFunctor { OConnectionPool* m_pConnectionPool; @@ -125,6 +127,8 @@ struct TConnectionPoolFunctor } }; +} + void OConnectionPool::clear(bool _bDispose) { MutexGuard aGuard(m_aMutex); diff --git a/connectivity/source/drivers/calc/Cservices.cxx b/connectivity/source/drivers/calc/Cservices.cxx index 343c9fcb6305..91f58219cac3 100644 --- a/connectivity/source/drivers/calc/Cservices.cxx +++ b/connectivity/source/drivers/calc/Cservices.cxx @@ -36,6 +36,7 @@ typedef Reference< XSingleServiceFactory > (*createFactoryFunc) rtl_ModuleCount* ); +namespace { struct ProviderRequest { @@ -75,6 +76,7 @@ struct ProviderRequest void* getProvider() const { return xRet.get(); } }; +} extern "C" SAL_DLLPUBLIC_EXPORT void* connectivity_calc_component_getFactory( const sal_Char* pImplementationName, diff --git a/connectivity/source/drivers/dbase/Dservices.cxx b/connectivity/source/drivers/dbase/Dservices.cxx index c269ddf997f0..9e24128912b2 100644 --- a/connectivity/source/drivers/dbase/Dservices.cxx +++ b/connectivity/source/drivers/dbase/Dservices.cxx @@ -36,6 +36,7 @@ typedef Reference< XSingleServiceFactory > (*createFactoryFunc) rtl_ModuleCount* ); +namespace { struct ProviderRequest { @@ -75,6 +76,7 @@ struct ProviderRequest void* getProvider() const { return xRet.get(); } }; +} extern "C" SAL_DLLPUBLIC_EXPORT void* dbase_component_getFactory( const sal_Char* pImplementationName, diff --git a/connectivity/source/drivers/evoab2/EApi.cxx b/connectivity/source/drivers/evoab2/EApi.cxx index c802778cff2e..12096bdade87 100644 --- a/connectivity/source/drivers/evoab2/EApi.cxx +++ b/connectivity/source/drivers/evoab2/EApi.cxx @@ -38,12 +38,17 @@ static const char *eBookLibNames[] = { typedef void (*SymbolFunc) (); #define SYM_MAP(a) { #a, reinterpret_cast<SymbolFunc *>(&a) } + +namespace { + struct ApiMap { const char *sym_name; SymbolFunc *ref_value; }; +} + static const ApiMap aCommonApiMap[] = { SYM_MAP( eds_check_version ), diff --git a/connectivity/source/drivers/evoab2/NResultSet.cxx b/connectivity/source/drivers/evoab2/NResultSet.cxx index d6d55c272bfa..1341e5a33c68 100644 --- a/connectivity/source/drivers/evoab2/NResultSet.cxx +++ b/connectivity/source/drivers/evoab2/NResultSet.cxx @@ -375,8 +375,6 @@ bool isBookBackend( EBookClient *pBook, const char *backendname) return isSourceBackend(pSource, backendname); } -} - class OEvoabVersion36Helper : public OEvoabVersionHelper { private: @@ -490,8 +488,6 @@ protected: } }; -namespace { - ESource * findSource( const char *id ) { ESourceList *pSourceList = nullptr; @@ -519,8 +515,6 @@ bool isAuthRequired( EBook *pBook ) "auth" ) != nullptr; } -} - class OEvoabVersion35Helper : public OEvoabVersionHelper { private: @@ -610,6 +604,8 @@ public: } }; +} + OEvoabResultSet::OEvoabResultSet( OCommonStatement* pStmt, OEvoabConnection *pConnection ) :OResultSet_BASE(m_aMutex) ,::comphelper::OPropertyContainer( OResultSet_BASE::rBHelper ) diff --git a/connectivity/source/drivers/evoab2/NServices.cxx b/connectivity/source/drivers/evoab2/NServices.cxx index 94b6f7867438..afc6291307cb 100644 --- a/connectivity/source/drivers/evoab2/NServices.cxx +++ b/connectivity/source/drivers/evoab2/NServices.cxx @@ -37,6 +37,7 @@ typedef Reference< XSingleServiceFactory > (*createFactoryFunc) rtl_ModuleCount* ); +namespace { struct ProviderRequest { @@ -77,6 +78,7 @@ struct ProviderRequest void* getProvider() const { return xRet.get(); } }; +} extern "C" SAL_DLLPUBLIC_EXPORT void* evoab2_component_getFactory( const sal_Char* pImplementationName, diff --git a/connectivity/source/drivers/firebird/Connection.cxx b/connectivity/source/drivers/firebird/Connection.cxx index dd4917634dab..b3b5ac9ee1da 100644 --- a/connectivity/source/drivers/firebird/Connection.cxx +++ b/connectivity/source/drivers/firebird/Connection.cxx @@ -109,6 +109,8 @@ Connection::~Connection() close(); } +namespace { + struct ConnectionGuard { oslInterlockedCount& m_refCount; @@ -123,6 +125,8 @@ struct ConnectionGuard } }; +} + void Connection::construct(const OUString& url, const Sequence< PropertyValue >& info) { ConnectionGuard aGuard(m_refCount); diff --git a/connectivity/source/drivers/firebird/Services.cxx b/connectivity/source/drivers/firebird/Services.cxx index 69b05e471263..f85d5dbb48d5 100644 --- a/connectivity/source/drivers/firebird/Services.cxx +++ b/connectivity/source/drivers/firebird/Services.cxx @@ -38,6 +38,8 @@ typedef Reference< XSingleServiceFactory > (*createFactoryFunc) rtl_ModuleCount* _pTemp ); +namespace { + struct ProviderRequest { Reference< XSingleServiceFactory > xRet; @@ -76,6 +78,7 @@ struct ProviderRequest void* getProvider() const { return xRet.get(); } }; +} extern "C" SAL_DLLPUBLIC_EXPORT void* firebird_sdbc_component_getFactory( const sal_Char* pImplementationName, diff --git a/connectivity/source/drivers/flat/Eservices.cxx b/connectivity/source/drivers/flat/Eservices.cxx index 62884acef137..4b8b6c4b2879 100644 --- a/connectivity/source/drivers/flat/Eservices.cxx +++ b/connectivity/source/drivers/flat/Eservices.cxx @@ -36,6 +36,7 @@ typedef Reference< XSingleServiceFactory > (*createFactoryFunc) rtl_ModuleCount* ); +namespace { struct ProviderRequest { @@ -75,6 +76,7 @@ struct ProviderRequest void* getProvider() const { return xRet.get(); } }; +} extern "C" SAL_DLLPUBLIC_EXPORT void* flat_component_getFactory( const sal_Char* pImplementationName, diff --git a/connectivity/source/drivers/hsqldb/Hservices.cxx b/connectivity/source/drivers/hsqldb/Hservices.cxx index a7ce2346374a..b41389a6d118 100644 --- a/connectivity/source/drivers/hsqldb/Hservices.cxx +++ b/connectivity/source/drivers/hsqldb/Hservices.cxx @@ -37,6 +37,7 @@ typedef Reference< XSingleServiceFactory > (*createFactoryFunc) rtl_ModuleCount* ); +namespace { struct ProviderRequest { @@ -76,6 +77,7 @@ struct ProviderRequest void* getProvider() const { return xRet.get(); } }; +} extern "C" SAL_DLLPUBLIC_EXPORT void* hsqldb_component_getFactory( const sal_Char* pImplementationName, diff --git a/connectivity/source/drivers/jdbc/jservices.cxx b/connectivity/source/drivers/jdbc/jservices.cxx index 281d8936d488..3044724735db 100644 --- a/connectivity/source/drivers/jdbc/jservices.cxx +++ b/connectivity/source/drivers/jdbc/jservices.cxx @@ -36,6 +36,7 @@ typedef Reference< XSingleServiceFactory > (*createFactoryFunc) rtl_ModuleCount* ); +namespace { struct ProviderRequest { @@ -75,6 +76,8 @@ struct ProviderRequest void* getProvider() const { return xRet.get(); } }; +} + extern "C" SAL_DLLPUBLIC_EXPORT void* jdbc_component_getFactory( const sal_Char* pImplementationName, void* pServiceManager, diff --git a/connectivity/source/drivers/mysql_jdbc/YTable.cxx b/connectivity/source/drivers/mysql_jdbc/YTable.cxx index 6eeaf3a23897..0db740478993 100644 --- a/connectivity/source/drivers/mysql_jdbc/YTable.cxx +++ b/connectivity/source/drivers/mysql_jdbc/YTable.cxx @@ -55,6 +55,8 @@ namespace connectivity { namespace mysql { +namespace +{ class OMySQLKeysHelper : public OKeysHelper { protected: @@ -69,6 +71,7 @@ public: }; } } +} OMySQLTable::OMySQLTable(sdbcx::OCollection* _pTables, const Reference<XConnection>& _xConnection) : OTableHelper(_pTables, _xConnection, true) diff --git a/connectivity/source/drivers/mysqlc/mysqlc_services.cxx b/connectivity/source/drivers/mysqlc/mysqlc_services.cxx index d23cf66aba06..56a2242e5e50 100644 --- a/connectivity/source/drivers/mysqlc/mysqlc_services.cxx +++ b/connectivity/source/drivers/mysqlc/mysqlc_services.cxx @@ -35,6 +35,8 @@ typedef Reference<XSingleServiceFactory> (*createFactoryFunc)( ::cppu::ComponentInstantiation pCreateFunction, const Sequence<OUString>& rServiceNames, rtl_ModuleCount*); +namespace +{ struct ProviderRequest { Reference<XSingleServiceFactory> xRet; @@ -65,6 +67,7 @@ struct ProviderRequest void* getProvider() const { return xRet.get(); } }; +} extern "C" SAL_DLLPUBLIC_EXPORT void* component_getFactory(const sal_Char* pImplementationName, void* pServiceManager, diff --git a/connectivity/source/drivers/odbc/ORealDriver.cxx b/connectivity/source/drivers/odbc/ORealDriver.cxx index 8b76f4cf1cc6..1c7bc80ae203 100644 --- a/connectivity/source/drivers/odbc/ORealDriver.cxx +++ b/connectivity/source/drivers/odbc/ORealDriver.cxx @@ -26,6 +26,8 @@ namespace connectivity { namespace odbc { + namespace { + class ORealObdcDriver : public ODBCDriver { protected: @@ -35,6 +37,7 @@ namespace connectivity explicit ORealObdcDriver(const css::uno::Reference< css::lang::XMultiServiceFactory >& _rxFactory) : ODBCDriver(_rxFactory) {} }; + } oslGenericFunction ORealObdcDriver::getOdbcFunction(ODBC3SQLFunctionId _nIndex) const { diff --git a/connectivity/source/drivers/odbc/oservices.cxx b/connectivity/source/drivers/odbc/oservices.cxx index 71fd857ec19e..9c4994172422 100644 --- a/connectivity/source/drivers/odbc/oservices.cxx +++ b/connectivity/source/drivers/odbc/oservices.cxx @@ -37,6 +37,7 @@ typedef Reference< XSingleServiceFactory > (*createFactoryFunc) rtl_ModuleCount* ); +namespace { struct ProviderRequest { @@ -76,6 +77,7 @@ struct ProviderRequest void* getProvider() const { return xRet.get(); } }; +} extern "C" SAL_DLLPUBLIC_EXPORT void* odbc_component_getFactory( const sal_Char* pImplementationName, diff --git a/connectivity/source/drivers/postgresql/pq_connection.cxx b/connectivity/source/drivers/postgresql/pq_connection.cxx index 56670cef1aa5..868a011584c5 100644 --- a/connectivity/source/drivers/postgresql/pq_connection.cxx +++ b/connectivity/source/drivers/postgresql/pq_connection.cxx @@ -94,6 +94,7 @@ using com::sun::star::sdbc::XDatabaseMetaData; namespace pq_sdbc_driver { +namespace { // Helper class for statement lifetime management class ClosableReference : public cppu::WeakImplHelper< css::uno::XReference > @@ -116,6 +117,8 @@ public: } }; +} + static OUString ConnectionGetImplementationName() { return "org.openoffice.comp.connectivity.pq.Connection.noext"; @@ -393,6 +396,8 @@ void Connection::clearWarnings() { } +namespace { + class cstr_vector { std::vector<char*> values; @@ -426,6 +431,8 @@ public: char const** c_array() const { return const_cast <const char**>(values.data()); } }; +} + static void properties2arrays( const Sequence< PropertyValue > & args, const Reference< XTypeConverter> &tc, rtl_TextEncoding enc, diff --git a/connectivity/source/drivers/postgresql/pq_driver.cxx b/connectivity/source/drivers/postgresql/pq_driver.cxx index b11dc491d016..a8e915a5cc67 100644 --- a/connectivity/source/drivers/postgresql/pq_driver.cxx +++ b/connectivity/source/drivers/postgresql/pq_driver.cxx @@ -158,6 +158,7 @@ static Reference< XInterface > DriverCreateInstance( const Reference < XComponen return ret; } +namespace { class OOneInstanceComponentFactory : public MutexHolder, @@ -212,6 +213,8 @@ private: Reference< XComponentContext > m_defaultContext; }; +} + Reference< XInterface > OOneInstanceComponentFactory::createInstanceWithArgumentsAndContext( Sequence< Any > const &, const Reference< XComponentContext > & ctx ) { diff --git a/connectivity/source/drivers/postgresql/pq_statics.cxx b/connectivity/source/drivers/postgresql/pq_statics.cxx index 564ab7910567..1b8c1cc116e3 100644 --- a/connectivity/source/drivers/postgresql/pq_statics.cxx +++ b/connectivity/source/drivers/postgresql/pq_statics.cxx @@ -51,6 +51,8 @@ using com::sun::star::beans::Property; namespace pq_sdbc_driver { +namespace { + struct DefColumnMetaData { const sal_Char * columnName; @@ -83,6 +85,8 @@ struct PropertyDefEx : public PropertyDef sal_Int32 attribute; }; +} + static cppu::IPropertyArrayHelper * createPropertyArrayHelper( PropertyDef const *props, int count , sal_Int16 attr ) { diff --git a/connectivity/source/drivers/postgresql/pq_xcontainer.cxx b/connectivity/source/drivers/postgresql/pq_xcontainer.cxx index 2082816813fd..147f5c17a465 100644 --- a/connectivity/source/drivers/postgresql/pq_xcontainer.cxx +++ b/connectivity/source/drivers/postgresql/pq_xcontainer.cxx @@ -66,6 +66,8 @@ using com::sun::star::lang::XEventListener; namespace pq_sdbc_driver { +namespace { + class ReplacedBroadcaster : public EventBroadcastHelper { ContainerEvent m_event; @@ -131,6 +133,8 @@ public: } }; +} + Container::Container( const ::rtl::Reference< comphelper::RefCountedMutex > & refMutex, const css::uno::Reference< css::sdbc::XConnection > & origin, @@ -201,6 +205,7 @@ sal_Int32 Container::getCount() return m_values.size(); } +namespace { class ContainerEnumeration : public ::cppu::WeakImplHelper< XEnumeration > { @@ -219,6 +224,8 @@ public: }; +} + sal_Bool ContainerEnumeration::hasMoreElements() { return static_cast<int>(m_vec.size()) > m_index +1; diff --git a/connectivity/source/drivers/writer/Wservices.cxx b/connectivity/source/drivers/writer/Wservices.cxx index 10e0e3ef32e7..69f88016231d 100644 --- a/connectivity/source/drivers/writer/Wservices.cxx +++ b/connectivity/source/drivers/writer/Wservices.cxx @@ -28,6 +28,8 @@ using createFactoryFunc = uno::Reference<lang::XSingleServiceFactory> (*)( const OUString& rComponentName, ::cppu::ComponentInstantiation pCreateFunction, const uno::Sequence<OUString>& rServiceNames, rtl_ModuleCount*); +namespace +{ struct ProviderRequest { private: @@ -60,6 +62,7 @@ public: uno::XInterface* getProvider() const { return xRet.get(); } }; +} extern "C" SAL_DLLPUBLIC_EXPORT void* connectivity_writer_component_getFactory(const sal_Char* pImplementationName, void* pServiceManager, diff --git a/connectivity/source/manager/mdrivermanager.cxx b/connectivity/source/manager/mdrivermanager.cxx index c88e117414fa..b3291cf89f5f 100644 --- a/connectivity/source/manager/mdrivermanager.cxx +++ b/connectivity/source/manager/mdrivermanager.cxx @@ -102,6 +102,7 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) return makeAny( *m_aPos++ ); } + namespace { /// an STL functor which ensures that a SdbcDriver described by a DriverAccess is loaded struct EnsureDriver @@ -173,6 +174,8 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) } }; + } + static sal_Int32 lcl_getDriverPrecedence( const Reference<XComponentContext>& _rContext, Sequence< OUString >& _rPrecedence ) { _rPrecedence.realloc( 0 ); @@ -208,6 +211,8 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) return _rPrecedence.getLength(); } + namespace { + /// an STL argorithm compatible predicate comparing two DriverAccess instances by their implementation names struct CompareDriverAccessByName { @@ -230,6 +235,7 @@ Any SAL_CALL ODriverEnumeration::nextElement( ) } }; + } OSDBCDriverManager::OSDBCDriverManager( const Reference< XComponentContext >& _rxContext ) :m_xContext( _rxContext ) diff --git a/connectivity/source/parse/sqliterator.cxx b/connectivity/source/parse/sqliterator.cxx index 4cb00394faa3..2c928216707c 100644 --- a/connectivity/source/parse/sqliterator.cxx +++ b/connectivity/source/parse/sqliterator.cxx @@ -109,6 +109,7 @@ namespace connectivity } }; + namespace { /** helper class for temporarily adding a query name to a list of forbidden query names */ @@ -132,6 +133,8 @@ namespace connectivity m_rpAllForbiddenNames->erase( m_sForbiddenQueryName ); } }; + + } } OSQLParseTreeIterator::OSQLParseTreeIterator(const Reference< XConnection >& _rxConnection, diff --git a/connectivity/source/resource/sharedresources.cxx b/connectivity/source/resource/sharedresources.cxx index 87185d66b83a..bab95793452d 100644 --- a/connectivity/source/resource/sharedresources.cxx +++ b/connectivity/source/resource/sharedresources.cxx @@ -29,7 +29,7 @@ namespace connectivity { - + namespace { class SharedResources_Impl { @@ -59,6 +59,8 @@ namespace connectivity } }; + } + SharedResources_Impl* SharedResources_Impl::s_pInstance( nullptr ); oslInterlockedCount SharedResources_Impl::s_nClients( 0 ); diff --git a/cppu/source/AffineBridge/AffineBridge.cxx b/cppu/source/AffineBridge/AffineBridge.cxx index 1e2a45ac84cf..156d6eb9c7a0 100644 --- a/cppu/source/AffineBridge/AffineBridge.cxx +++ b/cppu/source/AffineBridge/AffineBridge.cxx @@ -29,6 +29,7 @@ #include <cppu/helper/purpenv/Mapping.hxx> #include <memory> +namespace { class InnerThread; class OuterThread; @@ -86,6 +87,8 @@ public: } }; +} + void InnerThread::run() { osl_setThreadName("UNO AffineBridge InnerThread"); @@ -95,6 +98,8 @@ void InnerThread::run() m_pAffineBridge->leave(); } +namespace { + class OuterThread : public osl::Thread { virtual void SAL_CALL run() override; @@ -105,6 +110,8 @@ public: explicit OuterThread(AffineBridge * threadEnvironment); }; +} + OuterThread::OuterThread(AffineBridge * threadEnvironment) : m_pAffineBridge(threadEnvironment) { diff --git a/cppu/source/UnsafeBridge/UnsafeBridge.cxx b/cppu/source/UnsafeBridge/UnsafeBridge.cxx index 7cf945d44391..491a888c3921 100644 --- a/cppu/source/UnsafeBridge/UnsafeBridge.cxx +++ b/cppu/source/UnsafeBridge/UnsafeBridge.cxx @@ -26,6 +26,8 @@ #include <cppu/helper/purpenv/Environment.hxx> #include <cppu/helper/purpenv/Mapping.hxx> +namespace { + class UnsafeBridge : public cppu::Enterable { osl::Mutex m_mutex; @@ -46,6 +48,8 @@ public: virtual bool v_isValid(OUString * pReason) override; }; +} + UnsafeBridge::UnsafeBridge() : m_count (0), m_threadId(0) diff --git a/cppu/source/helper/purpenv/helper_purpenv_Environment.cxx b/cppu/source/helper/purpenv/helper_purpenv_Environment.cxx index ceeee6eb0deb..bb8af537c4b8 100644 --- a/cppu/source/helper/purpenv/helper_purpenv_Environment.cxx +++ b/cppu/source/helper/purpenv/helper_purpenv_Environment.cxx @@ -59,6 +59,8 @@ typedef void ExtEnv_releaseInterface (uno_ExtEnvironment * void * pInterface); } +namespace { + class Base : public cppu::Enterable { public: @@ -117,6 +119,8 @@ protected: virtual ~Base() override; }; +} + extern "C" { static void s_acquire(uno_Environment * pEnv) //SAL_THROW_EXTERN_C() { diff --git a/cppu/source/helper/purpenv/helper_purpenv_Mapping.cxx b/cppu/source/helper/purpenv/helper_purpenv_Mapping.cxx index 19c341f15d34..6255b2f0b52a 100644 --- a/cppu/source/helper/purpenv/helper_purpenv_Mapping.cxx +++ b/cppu/source/helper/purpenv/helper_purpenv_Mapping.cxx @@ -29,6 +29,8 @@ using namespace com::sun::star; +namespace { + class Mapping : public uno_Mapping { uno::Environment m_from; @@ -55,6 +57,8 @@ public: void release(); }; +} + static void s_mapInterface( uno_Mapping * puno_Mapping, void ** ppOut, diff --git a/cppu/source/threadpool/current.cxx b/cppu/source/threadpool/current.cxx index f788e005a031..665f1b7c636e 100644 --- a/cppu/source/threadpool/current.cxx +++ b/cppu/source/threadpool/current.cxx @@ -81,6 +81,7 @@ static typelib_InterfaceTypeDescription * get_type_XCurrentContext() return s_type_XCurrentContext; } +namespace { class ThreadKey { @@ -119,6 +120,8 @@ public: } }; +} + extern "C" { static void delete_IdContainer( void * p ) diff --git a/cppu/source/threadpool/threadpool.cxx b/cppu/source/threadpool/threadpool.cxx index 40b031c85732..d11268b85784 100644 --- a/cppu/source/threadpool/threadpool.cxx +++ b/cppu/source/threadpool/threadpool.cxx @@ -44,6 +44,8 @@ namespace cppu_threadpool rtl::Reference<ORequestThread> const & theThread): thread(theThread) {} + namespace { + struct theDisposedCallerAdmin : public rtl::StaticWithInit< DisposedCallerAdminHolder, theDisposedCallerAdmin > { @@ -52,6 +54,8 @@ namespace cppu_threadpool } }; + } + DisposedCallerAdminHolder const & DisposedCallerAdmin::getInstance() { return theDisposedCallerAdmin::get(); @@ -328,6 +332,8 @@ namespace cppu_threadpool using namespace cppu_threadpool; +namespace { + struct uno_ThreadPool_Equal { bool operator () ( const uno_ThreadPool &a , const uno_ThreadPool &b ) const @@ -344,6 +350,7 @@ struct uno_ThreadPool_Hash } }; +} typedef std::unordered_map< uno_ThreadPool, ThreadPoolHolder, uno_ThreadPool_Hash, uno_ThreadPool_Equal > ThreadpoolHashSet; diff --git a/cppu/source/typelib/static_types.cxx b/cppu/source/typelib/static_types.cxx index 5a400817115d..b2638979936a 100644 --- a/cppu/source/typelib/static_types.cxx +++ b/cppu/source/typelib/static_types.cxx @@ -40,6 +40,8 @@ extern "C" #pragma pack(push, 8) #endif +namespace { + /** * The double member determines the alignment. * Under OS2 and MS-Windows the Alignment is min( 8, sizeof( type ) ). @@ -59,6 +61,8 @@ struct AlignSize_Impl #endif }; +} + #ifdef _WIN32 #pragma pack(pop) #endif diff --git a/cppu/source/typelib/typelib.cxx b/cppu/source/typelib/typelib.cxx index 1604cf7b7997..c94ee1a80ec2 100644 --- a/cppu/source/typelib/typelib.cxx +++ b/cppu/source/typelib/typelib.cxx @@ -46,6 +46,8 @@ using namespace osl; #pragma pack(push, 8) #endif +namespace { + /** * The double member determines the alignment. * Under OS2 and MS-Windows the Alignment is min( 8, sizeof( type ) ). @@ -65,6 +67,8 @@ struct AlignSize_Impl #endif }; +} + #ifdef _WIN32 #pragma pack(pop) #endif @@ -138,6 +142,7 @@ static sal_Int32 getDescriptionSize( typelib_TypeClass eTypeClass ) return nSize; } +namespace { struct equalStr_Impl { @@ -152,6 +157,7 @@ struct hashStr_Impl { return rtl_ustr_hashCode( s ); } }; +} // Heavy hack, the const sal_Unicode * is hold by the typedescription reference typedef std::unordered_map< const sal_Unicode *, typelib_TypeDescriptionReference *, @@ -164,6 +170,8 @@ typedef list< typelib_TypeDescription * > TypeDescriptionList_Impl; // # of cached elements static sal_Int32 nCacheSize = 256; +namespace { + struct TypeDescriptor_Init_Impl { //sal_Bool bDesctructorCalled; @@ -206,6 +214,8 @@ struct TypeDescriptor_Init_Impl ~TypeDescriptor_Init_Impl(); }; +} + inline Mutex & TypeDescriptor_Init_Impl::getMutex() { if( !pMutex ) diff --git a/cppu/source/uno/EnvStack.cxx b/cppu/source/uno/EnvStack.cxx index 71c87bec7c37..f6b11352cf14 100644 --- a/cppu/source/uno/EnvStack.cxx +++ b/cppu/source/uno/EnvStack.cxx @@ -33,12 +33,15 @@ using namespace com::sun::star; +namespace { struct oslThreadIdentifier_equal { bool operator()(oslThreadIdentifier s1, oslThreadIdentifier s2) const; }; +} + bool oslThreadIdentifier_equal::operator()(oslThreadIdentifier s1, oslThreadIdentifier s2) const { bool result = s1 == s2; @@ -46,12 +49,15 @@ bool oslThreadIdentifier_equal::operator()(oslThreadIdentifier s1, oslThreadIden return result; } +namespace { struct oslThreadIdentifier_hash { size_t operator()(oslThreadIdentifier s1) const; }; +} + size_t oslThreadIdentifier_hash::operator()(oslThreadIdentifier s1) const { return s1; diff --git a/cppu/source/uno/IdentityMapping.cxx b/cppu/source/uno/IdentityMapping.cxx index 6b7ad09f98c6..c6dab40cefe8 100644 --- a/cppu/source/uno/IdentityMapping.cxx +++ b/cppu/source/uno/IdentityMapping.cxx @@ -28,6 +28,8 @@ using namespace ::com::sun::star; +namespace { + struct IdentityMapping : public uno_Mapping { sal_Int32 m_nRef; @@ -36,6 +38,8 @@ struct IdentityMapping : public uno_Mapping explicit IdentityMapping(uno::Environment const & rEnv); }; +} + extern "C" { diff --git a/cppu/source/uno/cascade_mapping.cxx b/cppu/source/uno/cascade_mapping.cxx index 13df4d8814e7..f57f7dc0ac87 100644 --- a/cppu/source/uno/cascade_mapping.cxx +++ b/cppu/source/uno/cascade_mapping.cxx @@ -30,6 +30,8 @@ using namespace com::sun::star; +namespace { + class MediatorMapping : public uno_Mapping { oslInterlockedCount m_refCount; @@ -53,6 +55,8 @@ public: uno_Environment * pTo); }; +} + extern "C" { static void s_acquire(uno_Mapping * mapping) { diff --git a/cppu/source/uno/lbmap.cxx b/cppu/source/uno/lbmap.cxx index a97d2a0dc829..ad27087b9b02 100644 --- a/cppu/source/uno/lbmap.cxx +++ b/cppu/source/uno/lbmap.cxx @@ -53,6 +53,8 @@ using namespace com::sun::star::uno; namespace cppu { +namespace { + class Mapping { uno_Mapping * _pMapping; @@ -80,6 +82,8 @@ public: { return (_pMapping != nullptr); } }; +} + inline Mapping::Mapping( uno_Mapping * pMapping ) : _pMapping( pMapping ) { @@ -110,6 +114,7 @@ inline Mapping & Mapping::operator = ( uno_Mapping * pMapping ) return *this; } +namespace { struct MappingEntry { @@ -134,6 +139,8 @@ struct FctPtrHash { return reinterpret_cast<size_t>(pKey); } }; +} + typedef std::unordered_map< OUString, MappingEntry * > t_OUString2Entry; typedef std::unordered_map< @@ -141,6 +148,7 @@ typedef std::unordered_map< typedef set< uno_getMappingFunc > t_CallbackSet; +namespace { struct MappingsData { @@ -155,6 +163,8 @@ struct MappingsData set<OUString> aNegativeLibs; }; +} + static MappingsData & getMappingsData() { //TODO This memory is leaked; see #i63473# for when this should be @@ -164,6 +174,8 @@ static MappingsData & getMappingsData() return *s_p; } +namespace { + /** * This class mediates two different mapping via uno, e.g. form any language to uno, * then from uno to any other language. @@ -185,6 +197,9 @@ struct uno_Mediate_Mapping : public uno_Mapping const Mapping & rFrom2Uno_, const Mapping & rUno2To_, const OUString & rAddPurpose ); }; + +} + extern "C" { diff --git a/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx b/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx index 43a9d87df927..0dcebbbac16a 100644 --- a/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx +++ b/cppuhelper/qa/ifcontainer/cppu_ifcontainer.cxx @@ -32,6 +32,8 @@ using namespace com::sun::star; using namespace com::sun::star::uno; using namespace com::sun::star::lang; +namespace { + struct ContainerStats { int m_nAlive; int m_nDisposed; @@ -51,6 +53,8 @@ public: } }; +} + namespace cppu_ifcontainer { class IfTest : public CppUnit::TestFixture diff --git a/cppuhelper/source/component_context.cxx b/cppuhelper/source/component_context.cxx index 5d6294704f7f..6d70b7817fa7 100644 --- a/cppuhelper/source/component_context.cxx +++ b/cppuhelper/source/component_context.cxx @@ -72,6 +72,8 @@ static void try_dispose( Reference< lang::XComponent > const & xComp ) } } +namespace { + class DisposingForwarder : public WeakImplHelper< lang::XEventListener > { @@ -91,6 +93,8 @@ public: virtual void SAL_CALL disposing( lang::EventObject const & rSource ) override; }; +} + inline void DisposingForwarder::listen( Reference< lang::XComponent > const & xSource, Reference< lang::XComponent > const & xTarget ) @@ -107,6 +111,7 @@ void DisposingForwarder::disposing( lang::EventObject const & ) m_xTarget.clear(); } +namespace { struct MutexHolder { @@ -167,6 +172,8 @@ public: virtual sal_Bool SAL_CALL hasElements() override; }; +} + // XNameContainer void ComponentContext::insertByName( diff --git a/cppuhelper/source/factory.cxx b/cppuhelper/source/factory.cxx index d61639566110..8a951033cc08 100644 --- a/cppuhelper/source/factory.cxx +++ b/cppuhelper/source/factory.cxx @@ -54,6 +54,8 @@ using namespace com::sun::star::registry; namespace cppu { +namespace { + class OSingleFactoryHelper : public XServiceInfo , public XSingleServiceFactory @@ -113,6 +115,9 @@ protected: Sequence< OUString > aServiceNames; OUString aImplementationName; }; + +} + OSingleFactoryHelper::~OSingleFactoryHelper() { } @@ -222,6 +227,8 @@ Sequence< OUString > OSingleFactoryHelper::getSupportedServiceNames() return aServiceNames; } +namespace { + struct OFactoryComponentHelper_Mutex { Mutex aMutex; @@ -285,6 +292,7 @@ protected: bool isInstance() const {return xTheInstance.is();} }; +} Any SAL_CALL OFactoryComponentHelper::queryInterface( const Type & rType ) { @@ -426,6 +434,8 @@ sal_Bool SAL_CALL OFactoryComponentHelper::releaseOnNotification() return true; } +namespace { + class ORegistryFactoryHelper : public OFactoryComponentHelper, public OPropertySetHelper @@ -495,6 +505,8 @@ protected: using OPropertySetHelper::getTypes; }; +} + // XInterface Any SAL_CALL ORegistryFactoryHelper::queryInterface( @@ -800,6 +812,8 @@ sal_Bool SAL_CALL ORegistryFactoryHelper::releaseOnNotification() return retVal; } +namespace { + class OFactoryProxyHelper : public WeakImplHelper< XServiceInfo, XSingleServiceFactory, XUnloadingPreference > { @@ -824,6 +838,8 @@ public: }; +} + // XSingleServiceFactory Reference<XInterface > OFactoryProxyHelper::createInstance() { diff --git a/cppuhelper/source/propshlp.cxx b/cppuhelper/source/propshlp.cxx index 3f39522b008c..53aeb8f4d4b1 100644 --- a/cppuhelper/source/propshlp.cxx +++ b/cppuhelper/source/propshlp.cxx @@ -67,6 +67,8 @@ static int compare_OUString_Property_Impl( const void *arg1, const void *arg2 ) * The class which implements the PropertySetInfo interface. */ +namespace { + class OPropertySetHelperInfo_Impl : public WeakImplHelper< css::beans::XPropertySetInfo > { @@ -81,6 +83,7 @@ public: virtual sal_Bool SAL_CALL hasPropertyByName(const OUString& PropertyName) override; }; +} /** * Create an object that implements XPropertySetInfo IPropertyArrayHelper. diff --git a/cppuhelper/source/tdmgr.cxx b/cppuhelper/source/tdmgr.cxx index 8666fadc6554..970688d736b6 100644 --- a/cppuhelper/source/tdmgr.cxx +++ b/cppuhelper/source/tdmgr.cxx @@ -597,6 +597,7 @@ static void typelib_callback( } } +namespace { class EventListenerImpl : public WeakImplHelper< lang::XEventListener > @@ -613,6 +614,8 @@ public: virtual void SAL_CALL disposing( lang::EventObject const & rEvt ) override; }; +} + void EventListenerImpl::disposing( lang::EventObject const & rEvt ) { if (rEvt.Source != m_xTDMgr) { diff --git a/cpputools/source/unoexe/unoexe.cxx b/cpputools/source/unoexe/unoexe.cxx index 3dbfdfa843d6..98f437482d94 100644 --- a/cpputools/source/unoexe/unoexe.cxx +++ b/cpputools/source/unoexe/unoexe.cxx @@ -223,6 +223,8 @@ static Reference< XInterface > loadComponent( return xInstance; } +namespace { + class OInstanceProvider : public WeakImplHelper< XInstanceProvider > { @@ -260,6 +262,8 @@ public: virtual Reference< XInterface > SAL_CALL getInstance( const OUString & rName ) override; }; +} + inline Reference< XInterface > OInstanceProvider::createInstance() { Reference< XInterface > xRet; @@ -318,6 +322,8 @@ Reference< XInterface > OInstanceProvider::getInstance( const OUString & rName ) "no such element \"" + rName + "\"!" ); } +namespace { + struct ODisposingListener : public WeakImplHelper< XEventListener > { Condition cDisposed; @@ -328,6 +334,8 @@ struct ODisposingListener : public WeakImplHelper< XEventListener > static void waitFor( const Reference< XComponent > & xComp ); }; +} + void ODisposingListener::disposing( const EventObject & ) { cDisposed.set(); diff --git a/cui/source/dialogs/SpellDialog.cxx b/cui/source/dialogs/SpellDialog.cxx index 9c65d47cf6da..44bca8f89a5b 100644 --- a/cui/source/dialogs/SpellDialog.cxx +++ b/cui/source/dialogs/SpellDialog.cxx @@ -1805,6 +1805,8 @@ void SentenceEditWindow_Impl::SetText( const OUString& rStr ) m_xEditEngine->SetText(rStr); } +namespace { + struct LanguagePosition_Impl { sal_Int32 nPosition; @@ -1815,6 +1817,9 @@ struct LanguagePosition_Impl eLanguage(eLang) {} }; + +} + typedef std::vector<LanguagePosition_Impl> LanguagePositions_Impl; static void lcl_InsertBreakPosition_Impl( diff --git a/cui/source/dialogs/colorpicker.cxx b/cui/source/dialogs/colorpicker.cxx index e3b46bcdec87..565c3ca2c8b1 100644 --- a/cui/source/dialogs/colorpicker.cxx +++ b/cui/source/dialogs/colorpicker.cxx @@ -144,6 +144,8 @@ static void RGBtoCMYK( double dR, double dG, double dB, double& fCyan, double& f } } +namespace { + class ColorPreviewControl : public weld::CustomWidgetController { private: @@ -172,6 +174,8 @@ public: } }; +} + void ColorPreviewControl::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle&) { rRenderContext.SetFillColor(m_aColor); @@ -187,6 +191,8 @@ enum ColorMode { HUE, SATURATION, BRIGHTNESS, RED, GREEN, BLUE }; const ColorMode DefaultMode = HUE; +namespace { + class ColorFieldControl : public weld::CustomWidgetController { public: @@ -243,6 +249,8 @@ private: std::vector<sal_uInt16> maPercent_Vert; }; +} + void ColorFieldControl::UpdateBitmap() { const Size aSize(GetOutputSizePixel()); @@ -506,6 +514,8 @@ void ColorFieldControl::UpdatePosition() ShowPosition(Point(static_cast<long>(mdX * aSize.Width()), static_cast<long>((1.0 - mdY) * aSize.Height())), false); } +namespace { + class ColorSliderControl : public weld::CustomWidgetController { public: @@ -540,6 +550,8 @@ private: double mdValue; }; +} + ColorSliderControl::ColorSliderControl() : meMode( DefaultMode ) , mnLevel( 0 ) @@ -714,6 +726,8 @@ void ColorSliderControl::SetValue(const Color& rColor, ColorMode eMode, double d } } +namespace { + class ColorPickerDialog : public weld::GenericDialogController { private: @@ -774,6 +788,8 @@ private: double mdCyan, mdMagenta, mdYellow, mdKey; }; +} + ColorPickerDialog::ColorPickerDialog(weld::Window* pParent, Color nColor, sal_Int16 nDialogMode) : GenericDialogController(pParent, "cui/ui/colorpickerdialog.ui", "ColorPicker") , m_xColorField(new weld::CustomWeld(*m_xBuilder, "colorField", m_aColorField)) @@ -1192,6 +1208,8 @@ void ColorPickerDialog::setColorComponent( ColorComponent nComp, double dValue ) typedef ::cppu::WeakComponentImplHelper< XServiceInfo, XExecutableDialog, XInitialization, XPropertyAccess > ColorPickerBase; +namespace { + class ColorPicker : protected ::cppu::BaseMutex, // Struct for right initialization of mutex member! Must be first of baseclasses. public ColorPickerBase { @@ -1220,6 +1238,8 @@ private: Reference<css::awt::XWindow> mxParent; }; +} + OUString ColorPicker_getImplementationName() { return "com.sun.star.cui.ColorPicker"; diff --git a/cui/source/dialogs/hangulhanjadlg.cxx b/cui/source/dialogs/hangulhanjadlg.cxx index e3b0b2e5d592..a90d1725a50d 100644 --- a/cui/source/dialogs/hangulhanjadlg.cxx +++ b/cui/source/dialogs/hangulhanjadlg.cxx @@ -76,7 +76,6 @@ namespace svx m_rDev.Pop(); } }; - } /** a class which allows to draw two texts in a pseudo-ruby way (which basically means one text above or below the other, and a little bit smaller) @@ -105,6 +104,8 @@ namespace svx ::tools::Rectangle* _pPrimaryLocation, ::tools::Rectangle* _pSecondaryLocation ); }; + } + PseudoRubyText::PseudoRubyText() : m_ePosition(eAbove) { diff --git a/cui/source/dialogs/hldocntp.cxx b/cui/source/dialogs/hldocntp.cxx index 3e875bef1994..a68388d83031 100644 --- a/cui/source/dialogs/hldocntp.cxx +++ b/cui/source/dialogs/hldocntp.cxx @@ -55,6 +55,8 @@ using namespace ::com::sun::star; |* |************************************************************************/ +namespace { + struct DocumentTypeData { OUString aStrURL; @@ -63,6 +65,8 @@ struct DocumentTypeData {} }; +} + bool SvxHyperlinkNewDocTp::ImplGetURLObject( const OUString& rPath, const OUString& rBase, INetURLObject& aURLObject ) const { bool bIsValidURL = !rPath.isEmpty(); diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx index 08d1798b42e5..3b985b2b0d40 100644 --- a/cui/source/dialogs/hlmarkwn.cxx +++ b/cui/source/dialogs/hlmarkwn.cxx @@ -41,6 +41,8 @@ using namespace ::com::sun::star; +namespace { + // Userdata-struct for tree-entries struct TargetData { @@ -55,6 +57,8 @@ struct TargetData } }; +} + //*** Window-Class *** // Constructor / Destructor SvxHlinkDlgMarkWnd::SvxHlinkDlgMarkWnd(weld::Window* pParentDialog, SvxHyperlinkTabPageBase *pParentPage) diff --git a/cui/source/dialogs/linkdlg.cxx b/cui/source/dialogs/linkdlg.cxx index f8388ece411c..c70fa676a315 100644 --- a/cui/source/dialogs/linkdlg.cxx +++ b/cui/source/dialogs/linkdlg.cxx @@ -46,6 +46,8 @@ using namespace sfx2; using namespace ::com::sun::star; +namespace { + class SvBaseLinkMemberList { private: std::vector<SvBaseLink*> mLinks; @@ -71,6 +73,8 @@ public: } }; +} + SvBaseLinksDlg::SvBaseLinksDlg(weld::Window * pParent, LinkManager* pMgr, bool bHtmlMode) : GenericDialogController(pParent, "cui/ui/baselinksdialog.ui", "BaseLinksDialog") , aStrAutolink( CuiResId( STR_AUTOLINK ) ) diff --git a/cui/source/factory/dlgfact.cxx b/cui/source/factory/dlgfact.cxx index 80e28b271b63..039f713d2279 100644 --- a/cui/source/factory/dlgfact.cxx +++ b/cui/source/factory/dlgfact.cxx @@ -1375,6 +1375,8 @@ VclPtr<AbstractSvxPostItDialog> AbstractDialogFactory_Impl::CreateSvxPostItDialo return VclPtr<AbstractSvxPostItDialog_Impl>::Create(std::make_unique<SvxPostItDialog>(pParent, rCoreSet, bPrevNext)); } +namespace { + class SvxMacroAssignDialog : public VclAbstractDialog { public: @@ -1393,6 +1395,8 @@ private: std::unique_ptr<SvxMacroAssignDlg> m_xDialog; }; +} + short SvxMacroAssignDialog::Execute() { return m_xDialog->run(); diff --git a/cui/source/options/optasian.cxx b/cui/source/options/optasian.cxx index 89feb5760f41..07d68df2dd65 100644 --- a/cui/source/options/optasian.cxx +++ b/cui/source/options/optasian.cxx @@ -44,12 +44,16 @@ using namespace com::sun::star::beans; const sal_Char cIsKernAsianPunctuation[] = "IsKernAsianPunctuation"; const sal_Char cCharacterCompressionType[] = "CharacterCompressionType"; +namespace { + struct SvxForbiddenChars_Impl { bool bRemoved; std::unique_ptr<ForbiddenCharacters> pCharacters; }; +} + struct SvxAsianLayoutPage_Impl { SvxAsianConfig aConfig; diff --git a/cui/source/options/optcolor.cxx b/cui/source/options/optcolor.cxx index 56e75fecd969..244cbbbf0dea 100644 --- a/cui/source/options/optcolor.cxx +++ b/cui/source/options/optcolor.cxx @@ -159,8 +159,6 @@ const vEntryInfo[] = #undef IDS }; -} // namespace - // ColorConfigWindow_Impl class ColorConfigWindow_Impl @@ -260,6 +258,8 @@ private: bool IsGroupVisible (Group) const; }; +} // namespace + // ColorConfigWindow_Impl::Chapter // ctor for default groups diff --git a/cui/source/options/optlingu.cxx b/cui/source/options/optlingu.cxx index 5e394e9753e3..dca1b491932f 100644 --- a/cui/source/options/optlingu.cxx +++ b/cui/source/options/optlingu.cxx @@ -113,6 +113,8 @@ static bool KillFile_Impl( const OUString& rURL ) #define TYPE_HYPH sal_uInt8(3) #define TYPE_THES sal_uInt8(4) +namespace { + class ModuleUserData_Impl { bool bParent; @@ -156,6 +158,7 @@ public: bool IsDeletable() const { return static_cast<bool>((nVal >> 10) & 0x01); } }; +} DicUserData::DicUserData( sal_uInt16 nEID, @@ -212,6 +215,8 @@ static OUString lcl_GetPropertyName( EID_OPTIONS eEntryId ) return OUString::createFromAscii( aEidToPropName[ static_cast<int>(eEntryId) ] ); } +namespace { + class OptionsBreakSet : public weld::GenericDialogController { std::unique_ptr<weld::Widget> m_xBeforeFrame; @@ -273,6 +278,8 @@ public: void SetNumericValue( sal_uInt8 nNumVal ); }; +} + OptionsUserData::OptionsUserData( sal_uInt16 nEID, bool bHasNV, sal_uInt16 nNumVal, bool bCheckable, bool bChecked ) @@ -298,6 +305,8 @@ void OptionsUserData::SetNumericValue( sal_uInt8 nNumVal ) // ServiceInfo_Impl ---------------------------------------------------- +namespace { + struct ServiceInfo_Impl { OUString sDisplayName; @@ -314,6 +323,8 @@ struct ServiceInfo_Impl ServiceInfo_Impl() : bConfigured(false) {} }; +} + typedef std::vector< ServiceInfo_Impl > ServiceInfoArr; typedef std::map< LanguageType, Sequence< OUString > > LangImplNameTable; diff --git a/cui/source/options/optpath.cxx b/cui/source/options/optpath.cxx index b287852f2329..a35f98ec3248 100644 --- a/cui/source/options/optpath.cxx +++ b/cui/source/options/optpath.cxx @@ -74,6 +74,8 @@ struct OptPath_Impl } }; +namespace { + struct PathUserData_Impl { sal_uInt16 nRealId; @@ -96,6 +98,8 @@ struct Handle2CfgNameMapping_Impl const char* m_pCfgName; }; +} + static Handle2CfgNameMapping_Impl const Hdl2CfgMap_Impl[] = { { SvtPathOptions::PATH_AUTOCORRECT, "AutoCorrect" }, diff --git a/cui/source/options/treeopt.cxx b/cui/source/options/treeopt.cxx index f36a8ab76029..8b7c32b051bd 100644 --- a/cui/source/options/treeopt.cxx +++ b/cui/source/options/treeopt.cxx @@ -130,6 +130,8 @@ static OUString GetViewOptUserItem( const SvtViewOptions& rOpt ) return aUserData; } +namespace { + struct ModuleToGroupNameMap_Impl { const char* m_pModule; @@ -137,6 +139,8 @@ struct ModuleToGroupNameMap_Impl sal_uInt16 m_nNodeId; }; +} + static ModuleToGroupNameMap_Impl ModuleMap[] = { { "ProductName", OUString(), SID_GENERAL_OPTIONS }, @@ -232,6 +236,8 @@ static sal_uInt16 getGroupNodeId( const OUString& rModule ) return nNodeId; } +namespace { + class MailMergeCfg_Impl : public utl::ConfigItem { private: @@ -250,6 +256,8 @@ public: }; +} + MailMergeCfg_Impl::MailMergeCfg_Impl() : utl::ConfigItem("Office.Writer/MailMergeWizard"), bIsEmailSupported(false) @@ -314,6 +322,8 @@ static std::unique_ptr<SfxTabPage> CreateGeneralTabPage(sal_uInt16 nId, weld::Co return fnCreate ? (*fnCreate)( pPage, pController, &rSet ) : nullptr; } +namespace { + struct OptionsMapping_Impl { const char* m_pGroupName; @@ -321,6 +331,8 @@ struct OptionsMapping_Impl sal_uInt16 m_nPageId; }; +} + static OptionsMapping_Impl const OptionsMap_Impl[] = { // GROUP PAGE PAGE-ID @@ -450,6 +462,8 @@ struct OptionsPageInfo explicit OptionsPageInfo( sal_uInt16 nId ) : m_nPageId( nId ) {} }; +namespace { + struct OptionsGroupInfo { std::unique_ptr<SfxItemSet> m_pInItemSet; @@ -463,6 +477,8 @@ struct OptionsGroupInfo m_pModule( pMod ), m_nDialogId( nId ) {} }; +} + #define INI_LIST() \ , m_pParent ( pParent )\ , sTitle ( m_xDialog->get_title() )\ diff --git a/cui/source/tabpages/autocdlg.cxx b/cui/source/tabpages/autocdlg.cxx index edb129d8c227..4952e7b8203c 100644 --- a/cui/source/tabpages/autocdlg.cxx +++ b/cui/source/tabpages/autocdlg.cxx @@ -283,6 +283,8 @@ void OfaAutocorrOptionsPage::Reset( const SfxItemSet* ) /* */ /*********************************************************************/ +namespace { + struct ImpUserData { OUString *pString; @@ -321,8 +323,6 @@ public: /* */ /*********************************************************************/ -namespace { - enum OfaAutoFmtOptions { USE_REPLACE_TABLE, @@ -2139,6 +2139,8 @@ std::unique_ptr<SfxTabPage> OfaSmartTagOptionsTabPage::Create(weld::Container* p return std::make_unique<OfaSmartTagOptionsTabPage>(pPage, pController, *rSet); } +namespace { + /** This struct is used to associate list box entries with smart tag data */ struct ImplSmartTagLBUserData @@ -2155,6 +2157,8 @@ struct ImplSmartTagLBUserData mnSmartTagIdx( nSmartTagIdx ) {} }; +} + /** Clears m_xSmartTagTypesLB */ void OfaSmartTagOptionsTabPage::ClearListBox() diff --git a/cui/source/tabpages/swpossizetabpage.cxx b/cui/source/tabpages/swpossizetabpage.cxx index 33a0649d21e6..24251a1800c1 100644 --- a/cui/source/tabpages/swpossizetabpage.cxx +++ b/cui/source/tabpages/swpossizetabpage.cxx @@ -55,6 +55,8 @@ struct FrmMap LB nLBRelations; }; +namespace { + struct RelationMap { SvxSwFramePosString::StringId eStrId; @@ -68,8 +70,6 @@ struct StringIdPair_Impl SvxSwFramePosString::StringId eVert; }; -namespace { - enum class LB { NONE = 0x000000, Frame = 0x000001, // paragraph text area diff --git a/dbaccess/qa/unit/tdf119625.cxx b/dbaccess/qa/unit/tdf119625.cxx index e1bb46b087f7..bbbe232a292d 100644 --- a/dbaccess/qa/unit/tdf119625.cxx +++ b/dbaccess/qa/unit/tdf119625.cxx @@ -44,11 +44,14 @@ void Tdf119625Test::setUp() osl_setEnvironment(OUString{ "DBACCESS_HSQL_MIGRATION" }.pData, OUString{ "1" }.pData); } +namespace +{ struct expect_t { sal_Int16 id; sal_Int16 h, m, s; }; +} /* The values here assume that our results are in UTC. However, tdf#119675 "Firebird: Migration: User dialog to set treatment of diff --git a/dbaccess/qa/unit/tdf126268.cxx b/dbaccess/qa/unit/tdf126268.cxx index 9d41b95809aa..45b386ed1901 100644 --- a/dbaccess/qa/unit/tdf126268.cxx +++ b/dbaccess/qa/unit/tdf126268.cxx @@ -43,11 +43,14 @@ void Tdf126268Test::setUp() osl_setEnvironment(OUString{ "DBACCESS_HSQL_MIGRATION" }.pData, OUString{ "1" }.pData); } +namespace +{ struct expect_t { sal_Int16 id; OUString number; }; +} static const expect_t expect[] = { { 1, "0.00" }, { 2, "25.00" }, { 3, "26.00" }, { 4, "30.4" }, { 5, "45.8" }, diff --git a/dbaccess/source/core/api/FilteredContainer.cxx b/dbaccess/source/core/api/FilteredContainer.cxx index c69cc4158a14..3cc33cfe323b 100644 --- a/dbaccess/source/core/api/FilteredContainer.cxx +++ b/dbaccess/source/core/api/FilteredContainer.cxx @@ -100,6 +100,9 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std:: } typedef ::boost::optional< OUString > OptionalString; + + namespace { + struct TableInfo { OptionalString sComposedName; @@ -123,6 +126,9 @@ static sal_Int32 createWildCardVector(Sequence< OUString >& _rTableFilter, std:: { } }; + + } + typedef std::vector< TableInfo > TableInfos; static void lcl_ensureComposedName( TableInfo& _io_tableInfo, const Reference< XDatabaseMetaData >& _metaData ) diff --git a/dbaccess/source/core/dataaccess/databasedocument.cxx b/dbaccess/source/core/dataaccess/databasedocument.cxx index 30ffe0cfadda..c8a287cde253 100644 --- a/dbaccess/source/core/dataaccess/databasedocument.cxx +++ b/dbaccess/source/core/dataaccess/databasedocument.cxx @@ -2031,6 +2031,8 @@ Reference< XInterface > ODatabaseDocument::getThis() const return *const_cast< ODatabaseDocument* >( this ); } +namespace { + struct CreateAny { Any operator() (const Reference<XController>& lhs) const @@ -2039,6 +2041,8 @@ struct CreateAny } }; +} + // XModel2 Reference< XEnumeration > SAL_CALL ODatabaseDocument::getControllers( ) { diff --git a/dbaccess/source/core/dataaccess/databaseregistrations.cxx b/dbaccess/source/core/dataaccess/databaseregistrations.cxx index 9178e60efd85..516873746d7a 100644 --- a/dbaccess/source/core/dataaccess/databaseregistrations.cxx +++ b/dbaccess/source/core/dataaccess/databaseregistrations.cxx @@ -70,6 +70,9 @@ namespace dbaccess // DatabaseRegistrations - declaration typedef ::cppu::WeakAggImplHelper1 < XDatabaseRegistrations > DatabaseRegistrations_Base; + + namespace { + class DatabaseRegistrations :public ::cppu::BaseMutex ,public DatabaseRegistrations_Base { @@ -137,6 +140,8 @@ namespace dbaccess ::comphelper::OInterfaceContainerHelper2 m_aRegistrationListeners; }; + } + // DatabaseRegistrations - implementation DatabaseRegistrations::DatabaseRegistrations( const Reference<XComponentContext> & _rxContext ) :m_aContext( _rxContext ) diff --git a/dbaccess/source/core/dataaccess/datasource.cxx b/dbaccess/source/core/dataaccess/datasource.cxx index 95aef3c1a236..a605b2e0c907 100644 --- a/dbaccess/source/core/dataaccess/datasource.cxx +++ b/dbaccess/source/core/dataaccess/datasource.cxx @@ -98,6 +98,8 @@ using namespace ::comphelper; namespace dbaccess { +namespace { + /** helper class which implements a XFlushListener, and forwards all notification events to another XFlushListener @@ -133,6 +135,8 @@ protected: virtual void SAL_CALL disposing( const css::lang::EventObject& Source ) override; }; +} + FlushNotificationAdapter::FlushNotificationAdapter( const Reference< XFlushable >& _rxBroadcaster, const Reference< XFlushListener >& _rxListener ) :m_aBroadcaster( _rxBroadcaster ) ,m_aListener( _rxListener ) @@ -255,6 +259,8 @@ void SAL_CALL OAuthenticationContinuation::setRememberAccount( RememberAuthentic SAL_WARN("dbaccess","OAuthenticationContinuation::setRememberAccount: not supported!"); } +namespace { + /** The class OSharedConnectionManager implements a structure to share connections. It owns the master connections which will be disposed when the last connection proxy is gone. */ @@ -269,6 +275,8 @@ struct TDigestHolder }; +} + class OSharedConnectionManager : public ::cppu::WeakImplHelper< XEventListener > { diff --git a/dbaccess/source/core/dataaccess/documentcontainer.cxx b/dbaccess/source/core/dataaccess/documentcontainer.cxx index c30f15000323..05f0da16f474 100644 --- a/dbaccess/source/core/dataaccess/documentcontainer.cxx +++ b/dbaccess/source/core/dataaccess/documentcontainer.cxx @@ -59,6 +59,8 @@ using namespace ::cppu; namespace dbaccess { +namespace { + // LocalNameApproval class LocalNameApproval : public IContainerApprove { @@ -68,6 +70,8 @@ public: void approveElement( const OUString& _rName ) override; }; +} + void LocalNameApproval::approveElement( const OUString& _rName ) { if ( _rName.indexOf( '/' ) != -1 ) diff --git a/dbaccess/source/core/dataaccess/documentdefinition.cxx b/dbaccess/source/core/dataaccess/documentdefinition.cxx index 9c89e4da2b8a..511cc0147775 100644 --- a/dbaccess/source/core/dataaccess/documentdefinition.cxx +++ b/dbaccess/source/core/dataaccess/documentdefinition.cxx @@ -156,6 +156,9 @@ namespace dbaccess // OEmbedObjectHolder typedef ::cppu::WeakComponentImplHelper< embed::XStateChangeListener > TEmbedObjectHolder; + + namespace { + class OEmbedObjectHolder : public ::cppu::BaseMutex ,public TEmbedObjectHolder { @@ -184,6 +187,8 @@ namespace dbaccess virtual void SAL_CALL disposing( const lang::EventObject& Source ) override; }; + } + void SAL_CALL OEmbedObjectHolder::disposing() { if ( m_xBroadCaster.is() ) @@ -235,6 +240,8 @@ namespace dbaccess } }; + namespace { + // LockModifiable class LockModifiable { @@ -267,9 +274,14 @@ namespace dbaccess Reference< XModifiable2 > m_xModifiable; }; + } + // LifetimeCoupler typedef ::cppu::WeakImplHelper< css::lang::XEventListener > LifetimeCoupler_Base; + + namespace { + /** helper class which couples the lifetime of a component to the lifetime of another component @@ -309,11 +321,15 @@ namespace dbaccess protected: }; + } + void SAL_CALL LifetimeCoupler::disposing( const css::lang::EventObject& /*Source*/ ) { m_xClient.clear(); } + namespace { + // ODocumentSaveContinuation class ODocumentSaveContinuation : public OInteraction< XInteractionDocumentSave > { @@ -330,6 +346,8 @@ namespace dbaccess virtual void SAL_CALL setName( const OUString& _sName,const Reference<XContent>& _xParent) override; }; + } + void SAL_CALL ODocumentSaveContinuation::setName( const OUString& _sName,const Reference<XContent>& _xParent) { m_sName = _sName; @@ -531,6 +549,8 @@ IPropertyArrayHelper* ODocumentDefinition::createArrayHelper( ) const return new OPropertyArrayHelper( ::comphelper::concatSequences( aProps, aManualProps ) ); } +namespace { + class OExecuteImpl { bool& m_rbSet; @@ -539,8 +559,6 @@ public: ~OExecuteImpl(){ m_rbSet = false; } }; -namespace -{ bool lcl_extractOpenMode( const Any& _rValue, sal_Int32& _out_rMode ) { OpenCommandArgument aOpenCommand; diff --git a/dbaccess/source/core/dataaccess/documentevents.cxx b/dbaccess/source/core/dataaccess/documentevents.cxx index 418d466ad816..a6705d850161 100644 --- a/dbaccess/source/core/dataaccess/documentevents.cxx +++ b/dbaccess/source/core/dataaccess/documentevents.cxx @@ -56,6 +56,8 @@ namespace dbaccess const DocumentEvents_Data& operator=(const DocumentEvents_Data&) = delete; }; + namespace { + // helper struct DocumentEventData { @@ -63,8 +65,6 @@ namespace dbaccess bool bNeedsSyncNotify; }; - namespace - { const DocumentEventData* lcl_getDocumentEventData() { static const DocumentEventData s_aData[] = { diff --git a/dbaccess/source/core/dataaccess/intercept.cxx b/dbaccess/source/core/dataaccess/intercept.cxx index 7a567de02326..b0143978df73 100644 --- a/dbaccess/source/core/dataaccess/intercept.cxx +++ b/dbaccess/source/core/dataaccess/intercept.cxx @@ -89,12 +89,16 @@ OInterceptor::~OInterceptor() { } +namespace { + struct DispatchHelper { URL aURL; Sequence<PropertyValue > aArguments; }; +} + //XDispatch void SAL_CALL OInterceptor::dispatch( const URL& URL,const Sequence<PropertyValue >& Arguments ) { diff --git a/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx b/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx index f1d03b10e915..04db3216cef0 100644 --- a/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx +++ b/dbaccess/source/core/dataaccess/myucp_datasupplier.cxx @@ -42,6 +42,8 @@ using namespace dbaccess; namespace dbaccess { +namespace { + // struct ResultListEntry. struct ResultListEntry { @@ -54,6 +56,8 @@ struct ResultListEntry explicit ResultListEntry(const ContentProperties& rEntry) : rData( rEntry ) {} }; +} + // struct DataSupplier_Impl. struct DataSupplier_Impl { diff --git a/dbaccess/source/core/recovery/subcomponentrecovery.cxx b/dbaccess/source/core/recovery/subcomponentrecovery.cxx index 41020966602b..f569307fdf3a 100644 --- a/dbaccess/source/core/recovery/subcomponentrecovery.cxx +++ b/dbaccess/source/core/recovery/subcomponentrecovery.cxx @@ -165,6 +165,8 @@ namespace dbaccess static const char sCurrentQueryDesignName[] = "ooo:current-query-design"; } + namespace { + // SettingsExportContext class SettingsExportContext : public ::xmloff::XMLSettingsExportContext { @@ -202,6 +204,8 @@ namespace dbaccess const OUString m_aNamespace; }; + } + void SettingsExportContext::AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, const OUString& i_rValue ) { m_rDelegator.addAttribute( impl_prefix( i_eName ), i_rValue ); @@ -239,6 +243,9 @@ namespace dbaccess // SettingsDocumentHandler typedef ::cppu::WeakImplHelper< XDocumentHandler > SettingsDocumentHandler_Base; + + namespace { + class SettingsDocumentHandler : public SettingsDocumentHandler_Base { public: @@ -269,6 +276,8 @@ namespace dbaccess ::comphelper::NamedValueCollection m_aSettings; }; + } + void SAL_CALL SettingsDocumentHandler::startDocument( ) { } diff --git a/dbaccess/source/filter/xml/dbloader2.cxx b/dbaccess/source/filter/xml/dbloader2.cxx index ee3478412a81..0116f8691986 100644 --- a/dbaccess/source/filter/xml/dbloader2.cxx +++ b/dbaccess/source/filter/xml/dbloader2.cxx @@ -90,6 +90,8 @@ using ::com::sun::star::sdb::application::NamedDatabaseObject; namespace dbaxml { +namespace { + class DBTypeDetection : public ::cppu::WeakImplHelper< XExtendedFilterDetection, XServiceInfo> { const Reference< XComponentContext > m_aContext; @@ -114,6 +116,8 @@ public: virtual OUString SAL_CALL detect( css::uno::Sequence< css::beans::PropertyValue >& Descriptor ) override; }; +} + DBTypeDetection::DBTypeDetection(const Reference< XComponentContext >& _rxContext) :m_aContext( _rxContext ) { @@ -220,6 +224,8 @@ extern "C" void createRegistryInfo_DBTypeDetection() namespace dbaxml { +namespace { + class DBContentLoader : public ::cppu::WeakImplHelper< XFrameLoader, XServiceInfo> { private: @@ -256,6 +262,7 @@ private: bool impl_executeNewDatabaseWizard( Reference< XModel > const & _rxModel, bool& _bShouldStartTableWizard ); }; +} DBContentLoader::DBContentLoader(const Reference< XComponentContext >& _rxFactory) :m_aContext( _rxFactory ) diff --git a/dbaccess/source/filter/xml/xmlExport.cxx b/dbaccess/source/filter/xml/xmlExport.cxx index cf9f3a75dff7..43a199f2b91e 100644 --- a/dbaccess/source/filter/xml/xmlExport.cxx +++ b/dbaccess/source/filter/xml/xmlExport.cxx @@ -67,6 +67,8 @@ using namespace ::com::sun::star; namespace dbaxml { + namespace { + class ODBExportHelper { public: @@ -85,6 +87,8 @@ namespace dbaxml static Sequence< OUString > getSupportedServiceNames_Static( ); static Reference< XInterface > Create(const Reference< css::lang::XMultiServiceFactory >&); }; + + } } extern "C" void createRegistryInfo_ODBFilterExport( ) @@ -165,6 +169,8 @@ namespace dbaxml } } + namespace { + class OSpecialHandleXMLExportPropertyMapper : public SvXMLExportPropertyMapper { public: @@ -184,6 +190,9 @@ namespace dbaxml // nothing to do here } }; + + } + ODBExport::ODBExport(const Reference< XComponentContext >& _rxContext, OUString const & implementationName, SvXMLExportFlags nExportFlag) : SvXMLExport( util::MeasureUnit::MM_10TH, _rxContext, implementationName, XML_DATABASE, SvXMLExportFlags::OASIS | nExportFlag) diff --git a/dbaccess/source/filter/xml/xmlfilter.cxx b/dbaccess/source/filter/xml/xmlfilter.cxx index 80faab524164..2d5733dfee07 100644 --- a/dbaccess/source/filter/xml/xmlfilter.cxx +++ b/dbaccess/source/filter/xml/xmlfilter.cxx @@ -408,6 +408,8 @@ bool ODBFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) return bRet; } +namespace { + class DBXMLDocumentSettingsContext : public SvXMLImportContext { public: @@ -541,6 +543,8 @@ public: } }; +} + SvXMLImportContext* ODBFilter::CreateDocumentContext(sal_uInt16 const nPrefix, const OUString& rLocalName, const uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) diff --git a/dbaccess/source/sdbtools/connection/objectnames.cxx b/dbaccess/source/sdbtools/connection/objectnames.cxx index f5b8455b037d..d067a042afa8 100644 --- a/dbaccess/source/sdbtools/connection/objectnames.cxx +++ b/dbaccess/source/sdbtools/connection/objectnames.cxx @@ -55,6 +55,8 @@ namespace sdbtools namespace CommandType = ::com::sun::star::sdb::CommandType; namespace ErrorCondition = ::com::sun::star::sdb::ErrorCondition; + namespace { + // INameValidation class INameValidation { @@ -64,8 +66,13 @@ namespace sdbtools virtual ~INameValidation() { } }; + + } + typedef std::shared_ptr< INameValidation > PNameValidation; + namespace { + // PlainExistenceCheck class PlainExistenceCheck : public INameValidation { @@ -263,6 +270,8 @@ namespace sdbtools static void verifyCommandType( sal_Int32 _nCommandType ); }; + } + void NameCheckFactory::verifyCommandType( sal_Int32 _nCommandType ) { if ( ( _nCommandType != CommandType::TABLE ) diff --git a/dbaccess/source/ui/app/AppController.cxx b/dbaccess/source/ui/app/AppController.cxx index f79c6d3e030f..df35c9a36111 100644 --- a/dbaccess/source/ui/app/AppController.cxx +++ b/dbaccess/source/ui/app/AppController.cxx @@ -179,6 +179,12 @@ Reference< XInterface > OApplicationController::Create(const Reference<XMultiSer return *(new OApplicationController( comphelper::getComponentContext(_rxFactory))); } +namespace { + +class SelectionGuard; + +} + // OApplicationController class SelectionNotifier { @@ -214,7 +220,7 @@ public: m_aSelectionListeners.disposeAndClear( aEvent ); } - struct SelectionGuardAccess { friend class SelectionGuard; private: SelectionGuardAccess() { } }; + struct SelectionGuardAccess { friend SelectionGuard; private: SelectionGuardAccess() { } }; /** enters a block which modifies the selection of our owner. @@ -243,6 +249,8 @@ public: } }; +namespace { + class SelectionGuard { public: @@ -264,6 +272,8 @@ private: SelectionNotifier& m_rNotifier; }; +} + // OApplicationController OApplicationController::OApplicationController(const Reference< XComponentContext >& _rxORB) :OGenericUnoController( _rxORB ) diff --git a/dbaccess/source/ui/browser/brwctrlr.cxx b/dbaccess/source/ui/browser/brwctrlr.cxx index 803f00f56e5a..818b423a205b 100644 --- a/dbaccess/source/ui/browser/brwctrlr.cxx +++ b/dbaccess/source/ui/browser/brwctrlr.cxx @@ -133,6 +133,8 @@ using namespace ::svt; namespace dbaui { +namespace { + // OParameterContinuation class OParameterContinuation : public OInteraction< XInteractionSupplyParameters > { @@ -147,6 +149,8 @@ public: virtual void SAL_CALL setParameters( const Sequence< PropertyValue >& _rValues ) override; }; +} + void SAL_CALL OParameterContinuation::setParameters( const Sequence< PropertyValue >& _rValues ) { m_aValues = _rValues; diff --git a/dbaccess/source/ui/browser/dbloader.cxx b/dbaccess/source/ui/browser/dbloader.cxx index 35df7976f0d6..5a5c46048f0a 100644 --- a/dbaccess/source/ui/browser/dbloader.cxx +++ b/dbaccess/source/ui/browser/dbloader.cxx @@ -62,6 +62,8 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::registry; using namespace dbaui; +namespace { + class DBContentLoader : public ::cppu::WeakImplHelper< XFrameLoader, XServiceInfo> { private: @@ -92,6 +94,7 @@ public: virtual void SAL_CALL cancel() override; }; +} DBContentLoader::DBContentLoader(const Reference< XComponentContext >& _rxContext) :m_xContext(_rxContext) diff --git a/dbaccess/source/ui/browser/genericcontroller.cxx b/dbaccess/source/ui/browser/genericcontroller.cxx index 644c3417065e..a5dc5e061720 100644 --- a/dbaccess/source/ui/browser/genericcontroller.cxx +++ b/dbaccess/source/ui/browser/genericcontroller.cxx @@ -87,6 +87,8 @@ typedef std::unordered_map< sal_Int16, sal_Int16 > CommandHashMap; namespace dbaui { +namespace { + // UserDefinedFeatures class UserDefinedFeatures { @@ -99,6 +101,8 @@ private: css::uno::WeakReference< XController > m_aController; }; +} + UserDefinedFeatures::UserDefinedFeatures( const Reference< XController >& _rxController ) :m_aController( _rxController ) { diff --git a/dbaccess/source/ui/browser/sbagrid.cxx b/dbaccess/source/ui/browser/sbagrid.cxx index 42ed0377446c..43655259bc06 100644 --- a/dbaccess/source/ui/browser/sbagrid.cxx +++ b/dbaccess/source/ui/browser/sbagrid.cxx @@ -1188,6 +1188,8 @@ void SbaGridControl::DoFieldDrag(sal_uInt16 nColumnPos, sal_Int16 nRowPos) } + namespace { + /// unary_function Functor object for class ZZ returntype is void struct SbaGridControlPrec { @@ -1204,6 +1206,9 @@ void SbaGridControl::DoFieldDrag(sal_uInt16 nColumnPos, sal_Int16 nRowPos) return false; } }; + + } + sal_Int8 SbaGridControl::AcceptDrop( const BrowserAcceptDropEvent& rEvt ) { sal_Int8 nAction = DND_ACTION_NONE; diff --git a/dbaccess/source/ui/dlg/DbAdminImpl.cxx b/dbaccess/source/ui/dlg/DbAdminImpl.cxx index c5cb06c6c645..40efd0d7485b 100644 --- a/dbaccess/source/ui/dlg/DbAdminImpl.cxx +++ b/dbaccess/source/ui/dlg/DbAdminImpl.cxx @@ -543,12 +543,16 @@ OUString ODbDataSourceAdministrationHelper::getConnectionURL() const return sNewUrl; } +namespace { + struct PropertyValueLess { bool operator() (const PropertyValue& x, const PropertyValue& y) const { return x.Name < y.Name; } // construct prevents a MSVC6 warning }; +} + typedef std::set<PropertyValue, PropertyValueLess> PropertyValueSet; void ODbDataSourceAdministrationHelper::translateProperties(const Reference< XPropertySet >& _rxSource, SfxItemSet& _rDest) diff --git a/dbaccess/source/ui/dlg/UserAdmin.cxx b/dbaccess/source/ui/dlg/UserAdmin.cxx index 0310967fa290..3a2804b3ac32 100644 --- a/dbaccess/source/ui/dlg/UserAdmin.cxx +++ b/dbaccess/source/ui/dlg/UserAdmin.cxx @@ -50,6 +50,8 @@ using namespace dbaui; using namespace ucbhelper; using namespace comphelper; +namespace { + class OPasswordDialog : public weld::GenericDialogController { std::unique_ptr<weld::Frame> m_xUser; @@ -68,6 +70,8 @@ public: OUString GetNewPassword() const { return m_xEDPassword->get_text(); } }; +} + OPasswordDialog::OPasswordDialog(weld::Window* _pParent,const OUString& rUserName) : GenericDialogController(_pParent, "dbaccess/ui/password.ui", "PasswordDialog") , m_xUser(m_xBuilder->weld_frame("userframe")) diff --git a/dbaccess/source/ui/dlg/adtabdlg.cxx b/dbaccess/source/ui/dlg/adtabdlg.cxx index e69987042145..04dceaa09259 100644 --- a/dbaccess/source/ui/dlg/adtabdlg.cxx +++ b/dbaccess/source/ui/dlg/adtabdlg.cxx @@ -54,6 +54,8 @@ TableObjectListFacade::~TableObjectListFacade() { } +namespace { + class TableListFacade : public ::cppu::BaseMutex , public TableObjectListFacade , public ::comphelper::OContainerListener @@ -84,6 +86,8 @@ private: virtual void _elementReplaced( const css::container::ContainerEvent& _rEvent ) override; }; +} + TableListFacade::~TableListFacade() { if ( m_pContainerListener.is() ) @@ -233,6 +237,8 @@ bool TableListFacade::isLeafSelected() const return bEntry && !rTableList.iter_has_child(*xEntry); } +namespace { + class QueryListFacade : public ::cppu::BaseMutex , public TableObjectListFacade , public ::comphelper::OContainerListener @@ -261,6 +267,8 @@ private: virtual void _elementReplaced( const css::container::ContainerEvent& _rEvent ) override; }; +} + QueryListFacade::~QueryListFacade() { if ( m_pContainerListener.is() ) diff --git a/dbaccess/source/ui/dlg/sqlmessage.cxx b/dbaccess/source/ui/dlg/sqlmessage.cxx index c48c4c224c12..047758341b58 100644 --- a/dbaccess/source/ui/dlg/sqlmessage.cxx +++ b/dbaccess/source/ui/dlg/sqlmessage.cxx @@ -260,6 +260,8 @@ namespace } } +namespace { + class OExceptionChainDialog : public weld::GenericDialogController { std::unique_ptr<weld::TreeView> m_xExceptionList; @@ -277,6 +279,8 @@ protected: DECL_LINK(OnExceptionSelected, weld::TreeView&, void); }; +} + OExceptionChainDialog::OExceptionChainDialog(weld::Window* pParent, const ExceptionDisplayChain& rExceptions) : GenericDialogController(pParent, "dbaccess/ui/sqlexception.ui", "SQLExceptionDialog") , m_xExceptionList(m_xBuilder->weld_tree_view("list")) diff --git a/dbaccess/source/ui/misc/WCopyTable.cxx b/dbaccess/source/ui/misc/WCopyTable.cxx index 98ec40a808b6..6be2d87fa9a9 100644 --- a/dbaccess/source/ui/misc/WCopyTable.cxx +++ b/dbaccess/source/ui/misc/WCopyTable.cxx @@ -387,6 +387,8 @@ OUString NamedTableCopySource::getSelectStatement() const return const_cast< NamedTableCopySource* >( this )->impl_ensureStatement_throw(); } +namespace { + // DummyCopySource class DummyCopySource : public ICopyTableSourceObject { @@ -410,6 +412,8 @@ public: getPreparedSelectStatement() const override; }; +} + const DummyCopySource& DummyCopySource::Instance() { static DummyCopySource s_aTheInstance; diff --git a/dbaccess/source/ui/misc/asyncmodaldialog.cxx b/dbaccess/source/ui/misc/asyncmodaldialog.cxx index 2f1b3e27b194..3c59a58f8b85 100644 --- a/dbaccess/source/ui/misc/asyncmodaldialog.cxx +++ b/dbaccess/source/ui/misc/asyncmodaldialog.cxx @@ -32,6 +32,8 @@ namespace dbaui using ::com::sun::star::lang::IllegalArgumentException; using ::com::sun::star::uno::Exception; + namespace { + // AsyncDialogExecutor class DialogExecutor_Impl { @@ -57,6 +59,8 @@ namespace dbaui DECL_LINK( onExecute, void*, void ); }; + } + IMPL_LINK_NOARG( DialogExecutor_Impl, onExecute, void*, void ) { try diff --git a/dbaccess/source/ui/misc/controllerframe.cxx b/dbaccess/source/ui/misc/controllerframe.cxx index 4bd0c9e4426d..599398e5d00f 100644 --- a/dbaccess/source/ui/misc/controllerframe.cxx +++ b/dbaccess/source/ui/misc/controllerframe.cxx @@ -64,6 +64,9 @@ namespace dbaui // FrameWindowActivationListener typedef ::cppu::WeakImplHelper< XTopWindowListener > FrameWindowActivationListener_Base; + + namespace { + class FrameWindowActivationListener : public FrameWindowActivationListener_Base { public: @@ -94,6 +97,8 @@ namespace dbaui ControllerFrame_Data* m_pData; }; + } + // ControllerFrame_Data struct ControllerFrame_Data { diff --git a/dbaccess/source/ui/misc/dbaundomanager.cxx b/dbaccess/source/ui/misc/dbaundomanager.cxx index 0ee8e9985590..d8659ce6157d 100644 --- a/dbaccess/source/ui/misc/dbaundomanager.cxx +++ b/dbaccess/source/ui/misc/dbaundomanager.cxx @@ -78,6 +78,8 @@ namespace dbaui return static_cast< XUndoManager* >( &rAntiImpl ); } + namespace { + // OslMutexFacade class OslMutexFacade : public ::framework::IMutex { @@ -96,6 +98,8 @@ namespace dbaui ::osl::Mutex& m_rMutex; }; + } + void OslMutexFacade::acquire() { m_rMutex.acquire(); @@ -106,6 +110,8 @@ namespace dbaui m_rMutex.release(); } + namespace { + // UndoManagerMethodGuard /** guard for public UNO methods of the UndoManager */ @@ -133,6 +139,8 @@ namespace dbaui OslMutexFacade m_aMutexFacade; }; + } + ::framework::IMutex& UndoManagerMethodGuard::getGuardedMutex() { return m_aMutexFacade; diff --git a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx index 505391d7cdb8..eb3331d6fe88 100644 --- a/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx +++ b/dbaccess/source/ui/misc/dbsubcomponentcontroller.cxx @@ -81,6 +81,8 @@ namespace dbaui using ::com::sun::star::uno::UNO_QUERY_THROW; using ::com::sun::star::frame::XUntitledNumbers; + namespace { + class DataSourceHolder { public: @@ -116,6 +118,8 @@ namespace dbaui Reference< XOfficeDatabaseDocument > m_xDocument; }; + } + struct DBSubComponentController_Impl { private: diff --git a/dbaccess/source/ui/misc/dsmeta.cxx b/dbaccess/source/ui/misc/dsmeta.cxx index 82ccab986fd6..045f5b10bcdc 100644 --- a/dbaccess/source/ui/misc/dsmeta.cxx +++ b/dbaccess/source/ui/misc/dsmeta.cxx @@ -31,6 +31,8 @@ namespace dbaui using namespace dbaccess; using namespace ::com::sun::star; + namespace { + struct FeatureSupport { // authentication mode of the data source @@ -54,6 +56,8 @@ namespace dbaui const sal_Char* pAsciiFeatureName; }; + } + // global tables static const FeatureMapping* lcl_getFeatureMappings() { diff --git a/dbaccess/source/ui/querydesign/querycontroller.cxx b/dbaccess/source/ui/querydesign/querycontroller.cxx index 1d6694c5bf99..3937c3d09d0d 100644 --- a/dbaccess/source/ui/querydesign/querycontroller.cxx +++ b/dbaccess/source/ui/querydesign/querycontroller.cxx @@ -96,6 +96,8 @@ namespace dbaui using namespace ::com::sun::star::util; using namespace ::com::sun::star::lang; + namespace { + class OViewController : public OQueryController { virtual OUString SAL_CALL getImplementationName() override @@ -127,6 +129,8 @@ namespace dbaui return *(new OViewController(comphelper::getComponentContext(_rM))); } }; + + } } extern "C" void createRegistryInfo_OViewControl() diff --git a/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx b/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx index bd8e33d436dc..9a2d0e652176 100644 --- a/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx +++ b/dbaccess/source/ui/uno/AdvancedSettingsDlg.cxx @@ -35,6 +35,8 @@ namespace dbaui using namespace ::com::sun::star::lang; using namespace ::com::sun::star::beans; + namespace { + // OAdvancedSettingsDialog class OAdvancedSettingsDialog :public ODatabaseAdministrationDialog @@ -71,6 +73,8 @@ namespace dbaui virtual std::unique_ptr<weld::DialogController> createDialog(const css::uno::Reference<css::awt::XWindow>& rParent) override; }; + } + OAdvancedSettingsDialog::OAdvancedSettingsDialog(const Reference< XComponentContext >& _rxORB) :ODatabaseAdministrationDialog(_rxORB) { diff --git a/dbaccess/source/ui/uno/copytablewizard.cxx b/dbaccess/source/ui/uno/copytablewizard.cxx index edb6805853eb..90fb3cc95b4f 100644 --- a/dbaccess/source/ui/uno/copytablewizard.cxx +++ b/dbaccess/source/ui/uno/copytablewizard.cxx @@ -142,6 +142,9 @@ namespace dbaui typedef ::cppu::ImplInheritanceHelper< CopyTableWizard_DialogBase , XCopyTableWizard > CopyTableWizard_Base; + + namespace { + class CopyTableWizard :public CopyTableWizard_Base ,public ::comphelper::OPropertyArrayUsageHelper< CopyTableWizard > @@ -372,6 +375,8 @@ private: CopyTableWizard& m_rWizard; }; +} + CopyTableWizard::CopyTableWizard( const Reference< XComponentContext >& _rxORB ) :CopyTableWizard_Base( _rxORB ) ,m_xContext( _rxORB ) diff --git a/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx b/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx index ff9e8a3dee0a..879a633cc00e 100644 --- a/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx +++ b/dbaccess/source/ui/uno/textconnectionsettings_uno.cxx @@ -51,12 +51,19 @@ namespace dbaui // OTextConnectionSettingsDialog + namespace { + class OTextConnectionSettingsDialog; + + } + typedef ::cppu::ImplInheritanceHelper< ODatabaseAdministrationDialog , css::sdb::XTextConnectionSettings > OTextConnectionSettingsDialog_BASE; typedef ::comphelper::OPropertyArrayUsageHelper< OTextConnectionSettingsDialog > OTextConnectionSettingsDialog_PBASE; + namespace { + class OTextConnectionSettingsDialog :public OTextConnectionSettingsDialog_BASE ,public OTextConnectionSettingsDialog_PBASE @@ -108,6 +115,8 @@ namespace dbaui using OTextConnectionSettingsDialog_BASE::getFastPropertyValue; }; + } + // OTextConnectionSettingsDialog OTextConnectionSettingsDialog::OTextConnectionSettingsDialog( const Reference<XComponentContext>& _rContext ) :OTextConnectionSettingsDialog_BASE( _rContext ) diff --git a/desktop/qa/desktop_lib/test_desktop_lib.cxx b/desktop/qa/desktop_lib/test_desktop_lib.cxx index 2c2d03b967ea..242a539cf08e 100644 --- a/desktop/qa/desktop_lib/test_desktop_lib.cxx +++ b/desktop/qa/desktop_lib/test_desktop_lib.cxx @@ -1794,6 +1794,8 @@ void DesktopLOKTest::testRedlineCalc() CPPUNIT_ASSERT_EQUAL(std::string("Cell B4 changed from '5' to 't'"), rRedline.second.get<std::string>("description")); } +namespace { + class ViewCallback { LibLODocument_Impl* mpDocument; @@ -1864,6 +1866,8 @@ public: } }; +} + void DesktopLOKTest::testPaintPartTile() { // Load an impress doc of 2 slides. diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx index 82422c835210..f448d6e7e507 100644 --- a/desktop/source/app/app.cxx +++ b/desktop/source/app/app.cxx @@ -1207,6 +1207,8 @@ void Desktop::AppEvent( const ApplicationEvent& rAppEvent ) HandleAppEvent( rAppEvent ); } +namespace { + struct ExecuteGlobals { Reference < css::document::XDocumentEventListener > xGlobalBroadcaster; @@ -1221,6 +1223,8 @@ struct ExecuteGlobals {} }; +} + static ExecuteGlobals* pExecGlobals = nullptr; int Desktop::Main() @@ -1888,6 +1892,7 @@ void Desktop::OverrideSystemSettings( AllSettings& rSettings ) rSettings.SetStyleSettings ( hStyleSettings ); } +namespace { class ExitTimer : public Timer { @@ -1903,6 +1908,8 @@ class ExitTimer : public Timer } }; +} + IMPL_LINK_NOARG(Desktop, OpenClients_Impl, void*, void) { try { diff --git a/desktop/source/app/appinit.cxx b/desktop/source/app/appinit.cxx index 642733efceb2..dc2095a14af5 100644 --- a/desktop/source/app/appinit.cxx +++ b/desktop/source/app/appinit.cxx @@ -175,6 +175,8 @@ void Desktop::createAcceptor(const OUString& aAcceptString) } } +namespace { + class enable { private: @@ -190,6 +192,8 @@ class enable } }; +} + // enable acceptors IMPL_STATIC_LINK_NOARG(Desktop, EnableAcceptors_Impl, void*, void) { diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx index f3857d8cff57..ade5ad25acc8 100644 --- a/desktop/source/app/dispatchwatcher.cxx +++ b/desktop/source/app/dispatchwatcher.cxx @@ -83,6 +83,8 @@ namespace document = ::com::sun::star::document; namespace desktop { +namespace { + struct DispatchHolder { DispatchHolder( const URL& rURL, Reference< XDispatch > const & rDispatch ) : @@ -92,9 +94,6 @@ struct DispatchHolder Reference< XDispatch > xDispatch; }; -namespace -{ - std::shared_ptr<const SfxFilter> impl_lookupExportFilterForUrl( const OUString& rUrl, const OUString& rFactory ) { // create the list of filters diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index e375c17f683c..5a79206c96ee 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -266,6 +266,8 @@ static OUString CreateMD5FromString( const OUString& aMsg ) return OUString(); } +namespace { + class ProcessEventsClass_Impl { public: @@ -273,6 +275,8 @@ public: DECL_STATIC_LINK( ProcessEventsClass_Impl, ProcessDocumentsEvent, void*, void ); }; +} + IMPL_STATIC_LINK( ProcessEventsClass_Impl, CallEvent, void*, pEvent, void ) { // Application events are processed by the Desktop::HandleAppEvent implementation. @@ -1300,6 +1304,8 @@ static void AddConversionsToDispatchList( } } +namespace { + struct ConditionSetGuard { osl::Condition* m_pCondition; @@ -1307,6 +1313,8 @@ struct ConditionSetGuard ~ConditionSetGuard() { if (m_pCondition) m_pCondition->set(); } }; +} + bool RequestHandler::ExecuteCmdLineRequests( ProcessDocumentsRequest& aRequest, bool noTerminate) { diff --git a/desktop/source/deployment/dp_log.cxx b/desktop/source/deployment/dp_log.cxx index 3cfdb338d9b7..000dc46b347c 100644 --- a/desktop/source/deployment/dp_log.cxx +++ b/desktop/source/deployment/dp_log.cxx @@ -46,6 +46,7 @@ namespace dp_log { typedef ::cppu::WeakComponentImplHelper<ucb::XProgressHandler> t_log_helper; +namespace { class ProgressLogImpl : public ::dp_misc::MutexHolder, public t_log_helper { @@ -65,6 +66,7 @@ public: virtual void SAL_CALL pop() override; }; +} ProgressLogImpl::~ProgressLogImpl() { diff --git a/desktop/source/deployment/gui/dp_gui_dialog2.cxx b/desktop/source/deployment/gui/dp_gui_dialog2.cxx index e48bb2d0912d..5fb33529c395 100644 --- a/desktop/source/deployment/gui/dp_gui_dialog2.cxx +++ b/desktop/source/deployment/gui/dp_gui_dialog2.cxx @@ -87,6 +87,7 @@ namespace dp_gui { #define SHARED_PACKAGE_MANAGER "shared" #define BUNDLED_PACKAGE_MANAGER "bundled" +namespace { struct StrAllFiles : public rtl::StaticWithInit< OUString, StrAllFiles > { @@ -97,6 +98,8 @@ struct StrAllFiles : public rtl::StaticWithInit< OUString, StrAllFiles > } }; +} + // ExtBoxWithBtns_Impl class ExtBoxWithBtns_Impl : public ExtensionBox_Impl { diff --git a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx index 31f29368708e..179304795611 100644 --- a/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx +++ b/desktop/source/deployment/gui/dp_gui_extensioncmdqueue.cxx @@ -109,6 +109,7 @@ OUString getVersion( const uno::Reference< deployment::XPackage > &rPackage ) namespace dp_gui { +namespace { class ProgressCmdEnv : public ::cppu::WeakImplHelper< ucb::XCommandEnvironment, @@ -199,6 +200,8 @@ struct ExtensionCmd m_vExtensionList( vExtensionList ) {}; }; +} + typedef std::shared_ptr< ExtensionCmd > TExtensionCmd; diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx index 10325631d6a2..fbcb4ed13232 100644 --- a/desktop/source/deployment/gui/dp_gui_service.cxx +++ b/desktop/source/deployment/gui/dp_gui_service.cxx @@ -49,6 +49,7 @@ namespace sdecl = comphelper::service_decl; namespace dp_gui { +namespace { class MyApp : public Application { @@ -63,6 +64,8 @@ public: virtual void DeInit() override; }; +} + MyApp::MyApp() { } @@ -133,6 +136,7 @@ static OUString ReplaceProductNameHookProc( const OUString& rStr ) return sRet; } +namespace { class ServiceImpl : public ::cppu::WeakImplHelper<ui::dialogs::XAsynchronousExecutableDialog, @@ -157,6 +161,7 @@ public: virtual void SAL_CALL trigger( OUString const & event ) override; }; +} ServiceImpl::ServiceImpl( Sequence<Any> const& args, Reference<XComponentContext> const& xComponentContext) diff --git a/desktop/source/deployment/gui/license_dialog.cxx b/desktop/source/deployment/gui/license_dialog.cxx index 9ab343730d89..7f7f14402278 100644 --- a/desktop/source/deployment/gui/license_dialog.cxx +++ b/desktop/source/deployment/gui/license_dialog.cxx @@ -41,6 +41,8 @@ using namespace ::com::sun::star::uno; namespace dp_gui { +namespace { + struct LicenseDialogImpl : public weld::GenericDialogController { bool m_bLicenseRead; @@ -74,6 +76,8 @@ struct LicenseDialogImpl : public weld::GenericDialogController bool IsEndReached() const; }; +} + LicenseDialogImpl::LicenseDialogImpl( weld::Window * pParent, const OUString & sExtensionName, diff --git a/desktop/source/deployment/manager/dp_informationprovider.cxx b/desktop/source/deployment/manager/dp_informationprovider.cxx index 5eafb605c91a..2866d0dccac3 100644 --- a/desktop/source/deployment/manager/dp_informationprovider.cxx +++ b/desktop/source/deployment/manager/dp_informationprovider.cxx @@ -61,6 +61,8 @@ namespace xml = com::sun::star::xml ; namespace dp_info { +namespace { + class PackageInformationProvider : public ::cppu::WeakImplHelper< deployment::XPackageInformationProvider > @@ -83,6 +85,7 @@ private: uno::Reference< deployment::XUpdateInformationProvider > mxUpdateInformation; }; +} PackageInformationProvider::PackageInformationProvider( uno::Reference< uno::XComponentContext > const& xContext) : mxContext( xContext ), diff --git a/desktop/source/deployment/manager/dp_manager.cxx b/desktop/source/deployment/manager/dp_manager.cxx index ac814592daf8..7c79ab43405e 100644 --- a/desktop/source/deployment/manager/dp_manager.cxx +++ b/desktop/source/deployment/manager/dp_manager.cxx @@ -90,6 +90,8 @@ extern comphelper::service_decl::ServiceDecl const serviceDecl; namespace dp_manager { +namespace { + struct MatchTempDir { OUString m_str; @@ -99,8 +101,6 @@ struct MatchTempDir } }; - -namespace { OUString getExtensionFolder(OUString const & parentFolder, Reference<ucb::XCommandEnvironment> const & xCmdEnv, Reference<uno::XComponentContext> const & xContext) diff --git a/desktop/source/deployment/manager/dp_managerfac.cxx b/desktop/source/deployment/manager/dp_managerfac.cxx index 5b7c7e11a3f0..f284c7e3cceb 100644 --- a/desktop/source/deployment/manager/dp_managerfac.cxx +++ b/desktop/source/deployment/manager/dp_managerfac.cxx @@ -36,6 +36,7 @@ namespace factory { typedef ::cppu::WeakComponentImplHelper< deployment::XPackageManagerFactory > t_pmfac_helper; +namespace { class PackageManagerFactoryImpl : private MutexHolder, public t_pmfac_helper { @@ -63,6 +64,7 @@ public: OUString const & context ) override; }; +} namespace sdecl = comphelper::service_decl; sdecl::class_<PackageManagerFactoryImpl> const servicePMFI; diff --git a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx index 0701a3492e86..4b66e51ede80 100644 --- a/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx +++ b/desktop/source/deployment/registry/sfwk/dp_sfwk.cxx @@ -48,6 +48,7 @@ namespace backend namespace sfwk { +namespace { class BackendImpl : public ::dp_registry::backend::PackageRegistryBackend { @@ -103,6 +104,8 @@ public: virtual void SAL_CALL packageRemoved(OUString const & url, OUString const & mediaType) override; }; +} + BackendImpl * BackendImpl::PackageImpl::getMyBackend() const { BackendImpl * pBackend = static_cast<BackendImpl *>(m_myBackend.get()); diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 1e97c1aecc4b..9298be14c0dc 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -177,12 +177,16 @@ static void SetLastExceptionMsg(const OUString& s = OUString()) gImpl->maLastExceptionMsg = s; } +namespace { + struct ExtensionMap { const char *extn; const char *filterName; }; +} + static const ExtensionMap aWriterExtensionMap[] = { { "doc", "MS Word 97" }, @@ -3237,6 +3241,8 @@ static size_t doc_renderShapeSelection(LibreOfficeKitDocument* pThis, char** pOu return 0; } +namespace { + /** Class to react on finishing of a dispatched command. This will call a LOK_COMMAND_FINISHED callback when postUnoCommand was @@ -3279,6 +3285,8 @@ public: virtual void SAL_CALL disposing(const css::lang::EventObject&) override {} }; +} + static void doc_sendDialogEvent(LibreOfficeKitDocument* /*pThis*/, unsigned nWindowId, const char* pArguments) { SolarMutexGuard aGuard; @@ -5410,6 +5418,8 @@ static void preloadData() rtl::Bootstrap::set("UserInstallation", sUserPath); } +namespace { + class ProfileZoneDumper : public AutoTimer { static const int dumpTimeoutMS = 5000; @@ -5435,6 +5445,8 @@ public: } }; +} + static int lo_initialize(LibreOfficeKit* pThis, const char* pAppPath, const char* pUserProfileUrl) { enum { diff --git a/desktop/source/migration/services/jvmfwk.cxx b/desktop/source/migration/services/jvmfwk.cxx index 034a526a810f..e0c13c7767ee 100644 --- a/desktop/source/migration/services/jvmfwk.cxx +++ b/desktop/source/migration/services/jvmfwk.cxx @@ -58,6 +58,8 @@ using namespace com::sun::star::configuration::backend; namespace migration { +namespace { + class JavaMigration : public ::cppu::WeakImplHelper< css::lang::XServiceInfo, css::lang::XInitialization, @@ -140,6 +142,8 @@ private: }; +} + JavaMigration::~JavaMigration() { OSL_ASSERT(m_aStack.empty()); diff --git a/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx b/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx index a6f53af028fa..b47ffc6cda69 100644 --- a/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx +++ b/drawinglayer/source/drawinglayeruno/xprimitive2drenderer.cxx @@ -44,6 +44,8 @@ namespace drawinglayer { namespace unorenderer { + namespace { + class XPrimitive2DRenderer: public cppu::WeakAggImplHelper2< css::graphic::XPrimitive2DRenderer, css::lang::XServiceInfo> @@ -68,6 +70,8 @@ namespace drawinglayer virtual sal_Bool SAL_CALL supportsService(const OUString&) override; virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; }; + + } } // end of namespace unorenderer } // end of namespace drawinglayer diff --git a/drawinglayer/source/primitive2d/baseprimitive2d.cxx b/drawinglayer/source/primitive2d/baseprimitive2d.cxx index b19d90783744..4db80991dd93 100644 --- a/drawinglayer/source/primitive2d/baseprimitive2d.cxx +++ b/drawinglayer/source/primitive2d/baseprimitive2d.cxx @@ -52,6 +52,8 @@ namespace drawinglayer return (getPrimitive2DID() == rPrimitive.getPrimitive2DID()); } + namespace { + // Visitor class to get the B2D range from a tree of Primitive2DReference's // class B2DRangeVisitor : public Primitive2DDecompositionVisitor { @@ -69,6 +71,9 @@ namespace drawinglayer maRetval.expand(r.getB2DRange(mrViewInformation)); } }; + + } + basegfx::B2DRange BasePrimitive2D::getB2DRange(const geometry::ViewInformation2D& rViewInformation) const { B2DRangeVisitor aVisitor(rViewInformation); diff --git a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx index 421e1a5a19e2..75de37a701c6 100644 --- a/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx +++ b/drawinglayer/source/primitive2d/graphicprimitivehelper2d.cxx @@ -45,6 +45,8 @@ namespace drawinglayer { namespace primitive2d { + namespace { + class AnimatedGraphicPrimitive2D : public AnimatedSwitchPrimitive2D { private: @@ -339,6 +341,8 @@ namespace drawinglayer virtual void get2DDecomposition(Primitive2DDecompositionVisitor& rVisitor, const geometry::ViewInformation2D& rViewInformation) const override; }; + } + AnimatedGraphicPrimitive2D::AnimatedGraphicPrimitive2D( const Graphic& rGraphic, const basegfx::B2DHomMatrix& rTransform) diff --git a/drawinglayer/source/tools/wmfemfhelper.cxx b/drawinglayer/source/tools/wmfemfhelper.cxx index 88755d2e9d2e..485000f3cf76 100644 --- a/drawinglayer/source/tools/wmfemfhelper.cxx +++ b/drawinglayer/source/tools/wmfemfhelper.cxx @@ -58,6 +58,8 @@ namespace drawinglayer { namespace primitive2d { + namespace { + /** NonOverlappingFillGradientPrimitive2D class This is a special version of the FillGradientPrimitive2D which decomposes @@ -85,6 +87,8 @@ namespace drawinglayer } }; + } + void NonOverlappingFillGradientPrimitive2D::create2DDecomposition( Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const diff --git a/editeng/source/accessibility/AccessibleEditableTextPara.cxx b/editeng/source/accessibility/AccessibleEditableTextPara.cxx index c68c79ebea8f..62ba3b0f7905 100644 --- a/editeng/source/accessibility/AccessibleEditableTextPara.cxx +++ b/editeng/source/accessibility/AccessibleEditableTextPara.cxx @@ -837,6 +837,8 @@ namespace accessibility return aNames; } + namespace { + struct IndexCompare { const PropertyValue* pValues; @@ -846,6 +848,8 @@ namespace accessibility return pValues[a].Name < pValues[b].Name; } }; + + } } namespace diff --git a/editeng/source/accessibility/AccessibleParaManager.cxx b/editeng/source/accessibility/AccessibleParaManager.cxx index 8a7ce274e5d0..5d6be4dd60b5 100644 --- a/editeng/source/accessibility/AccessibleParaManager.cxx +++ b/editeng/source/accessibility/AccessibleParaManager.cxx @@ -267,6 +267,8 @@ namespace accessibility nStateId ) ); } + namespace { + // not generic yet, no arguments... class AccessibleParaManager_DisposeChildren { @@ -278,6 +280,8 @@ namespace accessibility } }; + } + void AccessibleParaManager::Dispose() { AccessibleParaManager_DisposeChildren aFunctor; @@ -286,6 +290,8 @@ namespace accessibility WeakChildAdapter< AccessibleParaManager_DisposeChildren > (aFunctor) ); } + namespace { + // not generic yet, too many method arguments... class StateChangeEvent { @@ -308,6 +314,8 @@ namespace accessibility const uno::Any& mrOldValue; }; + } + void AccessibleParaManager::FireEvent( sal_Int32 nStartPara, sal_Int32 nEndPara, const sal_Int16 nEventId, @@ -337,6 +345,8 @@ namespace accessibility } } + namespace { + class ReleaseChild { public: @@ -349,6 +359,8 @@ namespace accessibility } }; + } + void AccessibleParaManager::Release( sal_Int32 nStartPara, sal_Int32 nEndPara ) { DBG_ASSERT( 0 <= nStartPara && 0 <= nEndPara && diff --git a/editeng/source/accessibility/AccessibleStaticTextBase.cxx b/editeng/source/accessibility/AccessibleStaticTextBase.cxx index c85cc3c9a589..8cef86269d1d 100644 --- a/editeng/source/accessibility/AccessibleStaticTextBase.cxx +++ b/editeng/source/accessibility/AccessibleStaticTextBase.cxx @@ -64,6 +64,8 @@ namespace accessibility { typedef std::vector< beans::PropertyValue > PropertyValueVector; + namespace { + class PropertyValueEqualFunctor { const beans::PropertyValue& m_rPValue; @@ -77,6 +79,9 @@ namespace accessibility return ( m_rPValue.Name == rhs.Name && m_rPValue.Value == rhs.Value ); } }; + + } + sal_Unicode const cNewLine(0x0a); diff --git a/editeng/source/editeng/impedit3.cxx b/editeng/source/editeng/impedit3.cxx index ad09f1d543dc..2128434ed05d 100644 --- a/editeng/source/editeng/impedit3.cxx +++ b/editeng/source/editeng/impedit3.cxx @@ -88,6 +88,8 @@ using namespace ::com::sun::star::linguistic2; #define WRONG_SHOW_MIN 5 +namespace { + struct TabInfo { bool bValid; @@ -106,6 +108,8 @@ struct TabInfo }; +} + Point Rotate( const Point& rPoint, short nOrientation, const Point& rOrigin ) { double nRealOrientation = nOrientation*F_PI1800; diff --git a/editeng/source/items/svxfont.cxx b/editeng/source/items/svxfont.cxx index 2f9119a0f143..58cc0ddab5da 100644 --- a/editeng/source/items/svxfont.cxx +++ b/editeng/source/items/svxfont.cxx @@ -571,6 +571,8 @@ SvxFont& SvxFont::operator=( const SvxFont& rFont ) return *this; } +namespace { + class SvxDoGetCapitalSize : public SvxDoCapitals { protected: @@ -592,6 +594,8 @@ public: const Size &GetSize() const { return aTxtSize; }; }; +} + void SvxDoGetCapitalSize::Do( const OUString &_rTxt, const sal_Int32 _nIdx, const sal_Int32 _nLen, const bool bUpper ) { @@ -633,6 +637,8 @@ Size SvxFont::GetCapitalSize( const OutputDevice *pOut, const OUString &rTxt, return aTxtSize; } +namespace { + class SvxDoDrawCapital : public SvxDoCapitals { protected: @@ -656,6 +662,8 @@ public: const sal_Int32 nLen, const bool bUpper ) override; }; +} + void SvxDoDrawCapital::DoSpace( const bool bDraw ) { if ( bDraw || pFont->IsWordLineMode() ) diff --git a/editeng/source/misc/txtrange.cxx b/editeng/source/misc/txtrange.cxx index 2158e48b0cc6..712eea464024 100644 --- a/editeng/source/misc/txtrange.cxx +++ b/editeng/source/misc/txtrange.cxx @@ -88,6 +88,8 @@ void TextRanger::SetVertical( bool bNew ) } } +namespace { + //! SvxBoundArgs is used to perform temporary calculations on a range array. //! Temporary instances are created in TextRanger::GetTextRanges() class SvxBoundArgs @@ -140,6 +142,8 @@ public: bool IsConcat() const { return bConcat; } }; +} + SvxBoundArgs::SvxBoundArgs( TextRanger* pRanger, LongDqPtr pLong, const Range& rRange ) : pLongArr(pLong) diff --git a/editeng/source/misc/unolingu.cxx b/editeng/source/misc/unolingu.cxx index 10c184aaa2f7..8aa7a229bc64 100644 --- a/editeng/source/misc/unolingu.cxx +++ b/editeng/source/misc/unolingu.cxx @@ -72,6 +72,8 @@ static uno::Reference< XLinguServiceManager2 > GetLngSvcMgr_Impl() return xRes; } +namespace { + //! Dummy implementation in order to avoid loading of lingu DLL //! when only the XSupportedLocales interface is used. //! The dummy accesses the real implementation (and thus loading the DLL) @@ -103,6 +105,7 @@ public: const css::uno::Sequence< css::beans::PropertyValue >& rProperties ) override; }; +} void ThesDummy_Impl::GetCfgLocales() { @@ -186,6 +189,7 @@ uno::Sequence< uno::Reference< linguistic2::XMeaning > > SAL_CALL return aRes; } +namespace { //! Dummy implementation in order to avoid loading of lingu DLL. //! The dummy accesses the real implementation (and thus loading the DLL) @@ -214,6 +218,7 @@ public: const css::uno::Sequence< css::beans::PropertyValue >& rProperties ) override; }; +} void SpellDummy_Impl::GetSpell_Impl() { @@ -270,6 +275,7 @@ uno::Reference< linguistic2::XSpellAlternatives > SAL_CALL return xRes; } +namespace { //! Dummy implementation in order to avoid loading of lingu DLL. //! The dummy accesses the real implementation (and thus loading the DLL) @@ -311,6 +317,7 @@ public: const css::uno::Sequence< css::beans::PropertyValue >& rProperties ) override; }; +} void HyphDummy_Impl::GetHyph_Impl() { diff --git a/editeng/source/uno/unoedprx.cxx b/editeng/source/uno/unoedprx.cxx index 915fe7193eaa..c7ac1bc3786b 100644 --- a/editeng/source/uno/unoedprx.cxx +++ b/editeng/source/uno/unoedprx.cxx @@ -45,6 +45,7 @@ using namespace ::com::sun::star; +namespace { class SvxAccessibleTextIndex { @@ -120,6 +121,8 @@ private: bool mbInBullet; }; +} + static ESelection MakeEESelection( const SvxAccessibleTextIndex& rStart, const SvxAccessibleTextIndex& rEnd ) { // deal with field special case: to really get a field contained diff --git a/editeng/source/uno/unonrule.cxx b/editeng/source/uno/unonrule.cxx index 3742a02a1db5..dea25ce79a08 100644 --- a/editeng/source/uno/unonrule.cxx +++ b/editeng/source/uno/unonrule.cxx @@ -494,12 +494,16 @@ css::uno::Reference< css::container::XIndexReplace > SvxCreateNumRule(const SvxN } } +namespace { + class SvxUnoNumberingRulesCompare : public ::cppu::WeakAggImplHelper1< XAnyCompare > { public: virtual sal_Int16 SAL_CALL compare( const Any& Any1, const Any& Any2 ) override; }; +} + sal_Int16 SAL_CALL SvxUnoNumberingRulesCompare::compare( const Any& Any1, const Any& Any2 ) { return SvxUnoNumberingRules::Compare( Any1, Any2 ); diff --git a/editeng/source/xml/xmltxtexp.cxx b/editeng/source/xml/xmltxtexp.cxx index 646d6819b1d3..89ab645e3283 100644 --- a/editeng/source/xml/xmltxtexp.cxx +++ b/editeng/source/xml/xmltxtexp.cxx @@ -248,6 +248,7 @@ void SAL_CALL SvxSimpleUnoModel::removeEventListener( const css::uno::Reference< { } +namespace { class SvxXMLTextExportComponent : public SvXMLExport { @@ -268,6 +269,7 @@ private: css::uno::Reference< css::text::XText > mxText; }; +} SvxXMLTextExportComponent::SvxXMLTextExportComponent( const css::uno::Reference< css::uno::XComponentContext >& xContext, diff --git a/editeng/source/xml/xmltxtimp.cxx b/editeng/source/xml/xmltxtimp.cxx index b3e40380fba0..ac28c0d6b457 100644 --- a/editeng/source/xml/xmltxtimp.cxx +++ b/editeng/source/xml/xmltxtimp.cxx @@ -55,6 +55,7 @@ using namespace com::sun::star::text; using namespace cppu; using namespace xmloff::token; +namespace { class SvxXMLTextImportContext : public SvXMLImportContext { @@ -67,6 +68,7 @@ private: const uno::Reference< XText > mxText; }; +} SvxXMLTextImportContext::SvxXMLTextImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference< XText >& xText ) : SvXMLImportContext( rImport, nPrfx, rLName ), mxText( xText ) @@ -97,6 +99,7 @@ SvXMLImportContextRef SvxXMLTextImportContext::CreateChildContext( sal_uInt16 nP return pContext; } +namespace { class SvxXMLXTextImportComponent : public SvXMLImport { @@ -112,6 +115,8 @@ private: const uno::Reference< XText > mxText; }; +} + SvXMLImportContext *SvxXMLXTextImportComponent::CreateDocumentContext( sal_uInt16 const nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList >& /*xAttrList*/) diff --git a/embeddedobj/source/general/docholder.cxx b/embeddedobj/source/general/docholder.cxx index 6b9bb85ea5e0..4c35ffc156e6 100644 --- a/embeddedobj/source/general/docholder.cxx +++ b/embeddedobj/source/general/docholder.cxx @@ -73,6 +73,8 @@ using namespace ::com::sun::star; +namespace { + class IntCounterGuard { sal_Int32& m_rFlag; @@ -90,6 +92,8 @@ public: } }; +} + static void InsertMenu_Impl( const uno::Reference< container::XIndexContainer >& xTargetMenu, sal_Int32 nTargetIndex, const uno::Reference< container::XIndexAccess >& xSourceMenu, diff --git a/embeddedobj/source/msole/ownview.cxx b/embeddedobj/source/msole/ownview.cxx index 7d938cfd15ba..3344bc6804ed 100644 --- a/embeddedobj/source/msole/ownview.cxx +++ b/embeddedobj/source/msole/ownview.cxx @@ -49,6 +49,8 @@ using namespace ::com::sun::star; using namespace ::comphelper; +namespace { + class DummyHandler_Impl : public ::cppu::WeakImplHelper< task::XInteractionHandler > { public: @@ -57,6 +59,7 @@ public: virtual void SAL_CALL handle( const uno::Reference< task::XInteractionRequest >& xRequest ) override; }; +} void SAL_CALL DummyHandler_Impl::handle( const uno::Reference< task::XInteractionRequest >& ) { diff --git a/emfio/source/emfuno/xemfparser.cxx b/emfio/source/emfuno/xemfparser.cxx index f28633a73446..c5aad2411b2b 100644 --- a/emfio/source/emfuno/xemfparser.cxx +++ b/emfio/source/emfuno/xemfparser.cxx @@ -55,6 +55,8 @@ namespace emfio { namespace emfreader { + namespace { + class XEmfParser : public ::cppu::WeakAggImplHelper2< graphic::XEmfParser, lang::XServiceInfo > { private: @@ -78,6 +80,8 @@ namespace emfio virtual sal_Bool SAL_CALL supportsService(const OUString&) override; virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; }; + + } } // end of namespace emfreader } // end of namespace emfio diff --git a/eventattacher/source/eventattacher.cxx b/eventattacher/source/eventattacher.cxx index 2ade05a1fd25..1a8af4411fd4 100644 --- a/eventattacher/source/eventattacher.cxx +++ b/eventattacher/source/eventattacher.cxx @@ -62,6 +62,8 @@ namespace comp_EventAttacher { // class InvocationToAllListenerMapper // helper class to map XInvocation to XAllListener +namespace { + class InvocationToAllListenerMapper : public WeakImplHelper< XInvocation > { public: @@ -82,6 +84,7 @@ private: Any m_Helper; }; +} // Function to replace AllListenerAdapterService::createAllListerAdapter static Reference< XInterface > createAllListenerAdapter @@ -199,6 +202,8 @@ sal_Bool SAL_CALL InvocationToAllListenerMapper::hasProperty(const OUString& Nam // class EventAttacherImpl // represents an implementation of the EventAttacher service +namespace { + class EventAttacherImpl : public WeakImplHelper < XEventAttacher2, XInitialization, XServiceInfo > { public: @@ -269,6 +274,7 @@ private: Reference< XInvocationAdapterFactory2 > getInvocationAdapterService(); }; +} EventAttacherImpl::EventAttacherImpl( const Reference< XComponentContext >& rxContext ) : m_xContext( rxContext ) @@ -403,6 +409,7 @@ Reference< XTypeConverter > EventAttacherImpl::getConverter() return m_xConverter; } +namespace { // Implementation of an EventAttacher-related AllListeners, which brings // a few Events to a general AllListener @@ -430,6 +437,7 @@ private: Reference< XAllListener > m_AllListener; }; +} FilterAllListenerImpl::FilterAllListenerImpl( EventAttacherImpl * pEA_, const OUString& EventMethod_, const Reference< XAllListener >& AllListener_ ) diff --git a/extensions/source/bibliography/bibload.cxx b/extensions/source/bibliography/bibload.cxx index dc861bbeb3e3..6edbddd3c744 100644 --- a/extensions/source/bibliography/bibload.cxx +++ b/extensions/source/bibliography/bibload.cxx @@ -75,6 +75,8 @@ using namespace ::com::sun::star::frame; static Reference< XInterface > BibliographyLoader_CreateInstance( const Reference< XMultiServiceFactory > & rSMgr ); +namespace { + class BibliographyLoader : public cppu::WeakImplHelper < XServiceInfo, XNameAccess, XPropertySet, XFrameLoader > { @@ -130,7 +132,7 @@ public: static Sequence<OUString> getSupportedServiceNames_Static() throw( ); /// @throws Exception - friend Reference< XInterface > BibliographyLoader_CreateInstance( const Reference< XMultiServiceFactory > & rSMgr ); + friend Reference< XInterface > (::BibliographyLoader_CreateInstance)( const Reference< XMultiServiceFactory > & rSMgr ); // XLoader virtual void SAL_CALL load(const Reference< XFrame > & aFrame, const OUString& aURL, @@ -139,6 +141,8 @@ public: virtual void SAL_CALL cancel() override; }; +} + BibliographyLoader::BibliographyLoader() : m_pBibMod(nullptr) { diff --git a/extensions/source/bibliography/datman.cxx b/extensions/source/bibliography/datman.cxx index 8364deb9e657..c9ccfc133919 100644 --- a/extensions/source/bibliography/datman.cxx +++ b/extensions/source/bibliography/datman.cxx @@ -179,6 +179,8 @@ static Reference< XNameAccess > getColumns(const Reference< XForm > & _rxForm) return xReturn; } +namespace { + class MappingDialog_Impl : public weld::GenericDialogController { BibDataManager* pDatMan; @@ -227,6 +229,8 @@ public: MappingDialog_Impl(weld::Window* pParent, BibDataManager* pDatMan); }; +} + static sal_uInt16 lcl_FindLogicalName(BibConfig const * pConfig , const OUString& rLogicalColumnName) { @@ -397,6 +401,8 @@ IMPL_LINK_NOARG(MappingDialog_Impl, OkHdl, weld::Button&, void) m_xDialog->response(bModified ? RET_OK : RET_CANCEL); } +namespace { + class DBChangeDialog_Impl : public weld::GenericDialogController { DBChangeDialogConfig_Impl aConfig; @@ -411,6 +417,8 @@ public: OUString GetCurrentURL()const; }; +} + DBChangeDialog_Impl::DBChangeDialog_Impl(weld::Window* pParent, BibDataManager* pMan ) : GenericDialogController(pParent, "modules/sbibliography/ui/choosedatasourcedialog.ui", "ChooseDataSourceDialog") , pDatMan(pMan) diff --git a/extensions/source/bibliography/formcontrolcontainer.cxx b/extensions/source/bibliography/formcontrolcontainer.cxx index fcb4851d91bc..4a9c23d0c97d 100644 --- a/extensions/source/bibliography/formcontrolcontainer.cxx +++ b/extensions/source/bibliography/formcontrolcontainer.cxx @@ -71,6 +71,8 @@ namespace bib m_xForm = _rxForm; } + namespace { + struct ControlModeSwitch { bool bDesign; @@ -83,6 +85,8 @@ namespace bib } }; + } + void FormControlContainer::implSetDesignMode( bool _bDesign ) { try diff --git a/extensions/source/bibliography/framectr.cxx b/extensions/source/bibliography/framectr.cxx index a36efe9b550a..80d2ae7b8f52 100644 --- a/extensions/source/bibliography/framectr.cxx +++ b/extensions/source/bibliography/framectr.cxx @@ -60,6 +60,7 @@ using namespace com::sun::star::frame; using namespace com::sun::star::uno; using namespace com::sun::star; +namespace { struct DispatchInfo { @@ -74,6 +75,8 @@ struct CacheDispatchInfo bool bActiveConnection; }; +} + // Attention: commands must be sorted by command groups. Implementation is dependent // on this!! static const DispatchInfo SupportedCommandsArray[] = diff --git a/extensions/source/bibliography/general.cxx b/extensions/source/bibliography/general.cxx index 11163a1227be..450bcc9ef882 100644 --- a/extensions/source/bibliography/general.cxx +++ b/extensions/source/bibliography/general.cxx @@ -70,6 +70,8 @@ static OUString lcl_GetColumnName( const Mapping* pMapping, sal_uInt16 nIndexPos return sRet; } +namespace { + class BibPosListener :public cppu::WeakImplHelper <sdbc::XRowSetListener> { VclPtr<BibGeneralPage> pParentPage; @@ -86,6 +88,8 @@ public: }; +} + BibPosListener::BibPosListener(BibGeneralPage* pParent) : pParentPage(pParent) { diff --git a/extensions/source/logging/consolehandler.cxx b/extensions/source/logging/consolehandler.cxx index a241126cc7d6..d1455baa3178 100644 --- a/extensions/source/logging/consolehandler.cxx +++ b/extensions/source/logging/consolehandler.cxx @@ -50,6 +50,9 @@ namespace logging typedef ::cppu::WeakComponentImplHelper < XConsoleHandler , XServiceInfo > ConsoleHandler_Base; + + namespace { + class ConsoleHandler :public ::cppu::BaseMutex ,public ConsoleHandler_Base { @@ -91,6 +94,8 @@ namespace logging void leaveMethod( MethodGuard::Access ); }; + } + ConsoleHandler::ConsoleHandler(const Reference<XComponentContext> &context, const css::uno::Sequence<css::uno::Any> &arguments) :ConsoleHandler_Base( m_aMutex ) diff --git a/extensions/source/logging/csvformatter.cxx b/extensions/source/logging/csvformatter.cxx index bce6922dcb62..42c51a348701 100644 --- a/extensions/source/logging/csvformatter.cxx +++ b/extensions/source/logging/csvformatter.cxx @@ -39,6 +39,8 @@ namespace logging using ::com::sun::star::uno::Sequence; using ::com::sun::star::logging::LogRecord; + namespace { + // formats for csv files as defined by RFC4180 class CsvFormatter : public cppu::WeakImplHelper<css::logging::XCsvLogFormatter, css::lang::XServiceInfo> { @@ -79,6 +81,8 @@ namespace logging bool m_MultiColumn; css::uno::Sequence< OUString > m_Columnnames; }; + + } } // namespace logging // private helpers diff --git a/extensions/source/logging/filehandler.cxx b/extensions/source/logging/filehandler.cxx index bec33521418c..cd62535ad15c 100644 --- a/extensions/source/logging/filehandler.cxx +++ b/extensions/source/logging/filehandler.cxx @@ -60,6 +60,9 @@ namespace logging typedef ::cppu::WeakComponentImplHelper < XLogHandler , XServiceInfo > FileHandler_Base; + + namespace { + class FileHandler :public ::cppu::BaseMutex ,public FileHandler_Base { @@ -122,6 +125,8 @@ namespace logging void impl_doStringsubstitution_nothrow( OUString& _inout_rURL ); }; + } + FileHandler::FileHandler(const css::uno::Reference<XComponentContext> &context, const css::uno::Sequence<css::uno::Any> &arguments) :FileHandler_Base( m_aMutex ) diff --git a/extensions/source/logging/logger.cxx b/extensions/source/logging/logger.cxx index 43dbe1a3a2a2..1770ca377175 100644 --- a/extensions/source/logging/logger.cxx +++ b/extensions/source/logging/logger.cxx @@ -49,6 +49,8 @@ namespace logging using ::com::sun::star::logging::XLogHandler; using ::com::sun::star::logging::LogRecord; + namespace { + class EventLogger : public cppu::BaseMutex, public cppu::WeakImplHelper<css::logging::XLogger> { @@ -110,6 +112,8 @@ namespace logging virtual Reference< XLogger > SAL_CALL getDefaultLogger( ) override; }; + } + EventLogger::EventLogger( const Reference< XComponentContext >& _rxContext, const OUString& _rName ) :m_aHandlers( m_aMutex ) ,m_nEventNumber( 0 ) diff --git a/extensions/source/logging/plaintextformatter.cxx b/extensions/source/logging/plaintextformatter.cxx index 58884a36512c..23392b61c491 100644 --- a/extensions/source/logging/plaintextformatter.cxx +++ b/extensions/source/logging/plaintextformatter.cxx @@ -38,6 +38,8 @@ namespace logging using ::com::sun::star::logging::LogRecord; using ::com::sun::star::uno::XInterface; + namespace { + class PlainTextFormatter : public cppu::WeakImplHelper<css::logging::XLogFormatter, css::lang::XServiceInfo> { public: @@ -55,6 +57,8 @@ namespace logging virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override; }; + } + PlainTextFormatter::PlainTextFormatter() { } diff --git a/extensions/source/logging/simpletextformatter.cxx b/extensions/source/logging/simpletextformatter.cxx index 003c978233b1..542f696e5d34 100644 --- a/extensions/source/logging/simpletextformatter.cxx +++ b/extensions/source/logging/simpletextformatter.cxx @@ -37,6 +37,8 @@ namespace logging using css::logging::LogRecord; using namespace css::uno; +namespace +{ class SimpleTextFormatter : public cppu::WeakImplHelper<css::logging::XLogFormatter, css::lang::XServiceInfo> { @@ -54,6 +56,7 @@ private: virtual sal_Bool SAL_CALL supportsService(const OUString& _rServiceName) override; virtual Sequence<OUString> SAL_CALL getSupportedServiceNames() override; }; +} SimpleTextFormatter::SimpleTextFormatter() {} diff --git a/extensions/source/propctrlr/browserlistbox.cxx b/extensions/source/propctrlr/browserlistbox.cxx index 1e77361f9400..b98f3c1e25c0 100644 --- a/extensions/source/propctrlr/browserlistbox.cxx +++ b/extensions/source/propctrlr/browserlistbox.cxx @@ -68,8 +68,6 @@ namespace pcr ACTIVATE_NEXT }; - } - struct ControlEvent : public ::comphelper::AnyEvent { Reference< XPropertyControl > xControl; @@ -95,6 +93,7 @@ namespace pcr getNotifier(); }; + } ::rtl::Reference< ::comphelper::AsyncEventNotifier > SharedNotifier::s_pNotifier; diff --git a/extensions/source/propctrlr/composeduiupdate.cxx b/extensions/source/propctrlr/composeduiupdate.cxx index 679a894795ee..4d59e51f9544 100644 --- a/extensions/source/propctrlr/composeduiupdate.cxx +++ b/extensions/source/propctrlr/composeduiupdate.cxx @@ -66,6 +66,9 @@ namespace pcr typedef ::cppu::WeakImplHelper < css::inspection::XObjectInspectorUI > CachedInspectorUI_Base; + + namespace { + struct CachedInspectorUI : public CachedInspectorUI_Base { private: @@ -167,6 +170,7 @@ namespace pcr }; }; + } CachedInspectorUI::CachedInspectorUI( ComposedPropertyUIUpdate& _rMaster, FNotifySingleUIChange _pUIChangeNotification ) :m_bDisposed( false ) diff --git a/extensions/source/propctrlr/eventhandler.cxx b/extensions/source/propctrlr/eventhandler.cxx index e368bdf5f100..646e4feec6f0 100644 --- a/extensions/source/propctrlr/eventhandler.cxx +++ b/extensions/source/propctrlr/eventhandler.cxx @@ -296,6 +296,9 @@ namespace pcr typedef ::cppu::WeakImplHelper < css::container::XNameReplace > EventHolder_Base; + + namespace { + /* A UNO component holding assigned event descriptions, for use with a SvxMacroAssignDlg */ class EventHolder : public EventHolder_Base { @@ -331,6 +334,7 @@ namespace pcr ScriptEventDescriptor const & impl_getDescriptor_throw( const OUString& _rEventName ) const; }; + } EventHolder::EventHolder() { diff --git a/extensions/source/propctrlr/fontdialog.cxx b/extensions/source/propctrlr/fontdialog.cxx index d065e7b63429..43ad19ce294a 100644 --- a/extensions/source/propctrlr/fontdialog.cxx +++ b/extensions/source/propctrlr/fontdialog.cxx @@ -69,6 +69,8 @@ namespace pcr //= OFontPropertyExtractor + namespace { + class OFontPropertyExtractor { protected: @@ -95,6 +97,7 @@ namespace pcr bool _bForceInvalidation = false); }; + } OFontPropertyExtractor::OFontPropertyExtractor(const Reference< XPropertySet >& _rxProps) :m_xPropValueAccess(_rxProps) diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index 7feca01b5a55..833359fdb583 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -173,6 +173,7 @@ namespace pcr return aSupported; } + namespace { // TODO: -> export from toolkit struct LanguageDependentProp @@ -181,6 +182,8 @@ namespace pcr sal_Int32 nPropNameLength; }; + } + static const LanguageDependentProp aLanguageDependentProp[] = { { "Text", 4 }, diff --git a/extensions/source/propctrlr/formgeometryhandler.cxx b/extensions/source/propctrlr/formgeometryhandler.cxx index 8ea36b02a7bb..f6a2d7a15d31 100644 --- a/extensions/source/propctrlr/formgeometryhandler.cxx +++ b/extensions/source/propctrlr/formgeometryhandler.cxx @@ -96,6 +96,8 @@ namespace pcr //= BroadcastHelperBase + namespace { + class BroadcastHelperBase { protected: @@ -111,6 +113,7 @@ namespace pcr ::cppu::OBroadcastHelper maBHelper; }; + } //= ShapeGeometryChangeNotifier - declaration @@ -121,6 +124,8 @@ namespace pcr typedef ::cppu::WeakImplHelper < css::beans::XPropertyChangeListener > ShapeGeometryChangeNotifier_IBase; + namespace { + class ShapeGeometryChangeNotifier :public BroadcastHelperBase ,public ShapeGeometryChangeNotifier_CBase ,public ShapeGeometryChangeNotifier_IBase @@ -195,13 +200,22 @@ namespace pcr Reference< XShape > m_xShape; }; + } //= FormGeometryHandler - declaration + namespace { + class FormGeometryHandler; + + } + typedef HandlerComponentBase< FormGeometryHandler > FormGeometryHandler_Base; /** a property handler for any virtual string properties */ + + namespace { + class FormGeometryHandler : public FormGeometryHandler_Base { public: @@ -247,6 +261,7 @@ namespace pcr ::rtl::Reference< ShapeGeometryChangeNotifier > m_xChangeNotifier; }; + } //= FormGeometryHandler - implementation diff --git a/extensions/source/propctrlr/formmetadata.cxx b/extensions/source/propctrlr/formmetadata.cxx index 2592c47c57eb..f2e3c0328c84 100644 --- a/extensions/source/propctrlr/formmetadata.cxx +++ b/extensions/source/propctrlr/formmetadata.cxx @@ -66,6 +66,7 @@ namespace pcr { } + namespace { // Compare PropertyInfo struct PropertyInfoLessByName @@ -76,6 +77,7 @@ namespace pcr } }; + } //= OPropertyInfoService diff --git a/extensions/source/propctrlr/genericpropertyhandler.cxx b/extensions/source/propctrlr/genericpropertyhandler.cxx index c393e3921137..d30d80918077 100644 --- a/extensions/source/propctrlr/genericpropertyhandler.cxx +++ b/extensions/source/propctrlr/genericpropertyhandler.cxx @@ -63,6 +63,8 @@ namespace pcr using ::com::sun::star::awt::XActionListener; using ::com::sun::star::awt::ActionEvent; + namespace { + class EnumRepresentation : public IPropertyEnumRepresentation { private: @@ -84,6 +86,8 @@ namespace pcr void impl_getValues( Sequence< sal_Int32 >& _out_rValues ) const; }; + } + EnumRepresentation::EnumRepresentation( const Reference< XComponentContext >& _rxContext, const Type& _rEnumType ) :m_aEnumType( _rEnumType ) { @@ -177,6 +181,9 @@ namespace pcr typedef ::cppu::WeakImplHelper < XActionListener > UrlClickHandler_Base; + + namespace { + class UrlClickHandler : public UrlClickHandler_Base { Reference<XComponentContext> m_xContext; @@ -196,6 +203,7 @@ namespace pcr void impl_dispatch_throw( const OUString& _rURL ); }; + } UrlClickHandler::UrlClickHandler( const Reference<XComponentContext>& _rContext, const Reference< XHyperlinkControl >& _rxControl ) :m_xContext( _rContext ) diff --git a/extensions/source/propctrlr/objectinspectormodel.cxx b/extensions/source/propctrlr/objectinspectormodel.cxx index aa0628555e59..00520029b490 100644 --- a/extensions/source/propctrlr/objectinspectormodel.cxx +++ b/extensions/source/propctrlr/objectinspectormodel.cxx @@ -42,6 +42,8 @@ namespace pcr //= ObjectInspectorModel + namespace { + class ObjectInspectorModel : public ImplInspectorModel { private: @@ -81,6 +83,7 @@ namespace pcr void impl_verifyArgument_throw( bool _bCondition, sal_Int16 _nArgumentPosition ); }; + } //= ObjectInspectorModel diff --git a/extensions/source/propctrlr/stringrepresentation.cxx b/extensions/source/propctrlr/stringrepresentation.cxx index 42d638c2f9e5..c16565028355 100644 --- a/extensions/source/propctrlr/stringrepresentation.cxx +++ b/extensions/source/propctrlr/stringrepresentation.cxx @@ -66,6 +66,8 @@ namespace pcr{ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +namespace { + class StringRepresentation: public ::cppu::WeakImplHelper< lang::XServiceInfo, @@ -141,6 +143,8 @@ private: }; +} + StringRepresentation::StringRepresentation(uno::Reference< uno::XComponentContext > const & context) : m_xContext(context) {} diff --git a/extensions/source/propctrlr/taborder.cxx b/extensions/source/propctrlr/taborder.cxx index 3fc08b9599a5..90d28f8794bc 100644 --- a/extensions/source/propctrlr/taborder.cxx +++ b/extensions/source/propctrlr/taborder.cxx @@ -79,8 +79,6 @@ namespace pcr return sImageId; } - } - //= OSimpleTabModel class OSimpleTabModel : public ::cppu::WeakImplHelper< XTabControllerModel> @@ -104,6 +102,8 @@ namespace pcr virtual void SAL_CALL setGroupControl(sal_Bool /*GroupControl*/) override {}; }; + } + //= TabOrderDialog TabOrderDialog::TabOrderDialog(weld::Window* _pParent, const Reference< XTabControllerModel >& _rxTabModel, const Reference< XControlContainer >& _rxControlCont, const Reference< XComponentContext >& _rxORB) diff --git a/extensions/source/scanner/scanunx.cxx b/extensions/source/scanner/scanunx.cxx index a9ee05e5164e..83df6c32d5d2 100644 --- a/extensions/source/scanner/scanunx.cxx +++ b/extensions/source/scanner/scanunx.cxx @@ -76,6 +76,7 @@ Sequence< sal_Int8 > BitmapTransporter::getDIB() return aValue; } +namespace { struct SaneHolder { @@ -88,9 +89,6 @@ struct SaneHolder SaneHolder() : m_nError(ScanError_ScanErrorNone), m_bBusy(false) {} }; - -namespace -{ typedef std::vector< std::shared_ptr<SaneHolder> > sanevec; class allSanes { @@ -119,8 +117,6 @@ namespace struct theSaneProtector : public rtl::Static<osl::Mutex, theSaneProtector> {}; struct theSanes : public rtl::Static<allSanes, theSanes> {}; -} - class ScannerThread : public osl::Thread { @@ -138,6 +134,7 @@ public: virtual ~ScannerThread() override; }; +} ScannerThread::ScannerThread(const std::shared_ptr<SaneHolder>& pHolder, const Reference< css::lang::XEventListener >& listener, diff --git a/filter/source/config/cache/filterfactory.cxx b/filter/source/config/cache/filterfactory.cxx index 06d273f2cbd3..a012b5542a8a 100644 --- a/filter/source/config/cache/filterfactory.cxx +++ b/filter/source/config/cache/filterfactory.cxx @@ -320,6 +320,7 @@ std::vector<OUString> FilterFactory::impl_queryMatchByDocumentService(const Quer return lResult; } +namespace { class stlcomp_removeIfMatchFlags { @@ -361,6 +362,7 @@ class stlcomp_removeIfMatchFlags } }; +} std::vector<OUString> FilterFactory::impl_getSortedFilterList(const QueryTokenizer& lTokens) const { diff --git a/filter/source/flash/swffilter.cxx b/filter/source/flash/swffilter.cxx index eac3e9385ad9..a0cae19a890f 100644 --- a/filter/source/flash/swffilter.cxx +++ b/filter/source/flash/swffilter.cxx @@ -59,6 +59,8 @@ using ::com::sun::star::container::XIndexAccess; namespace swf { +namespace { + class OslOutputStreamWrapper : public ::cppu::WeakImplHelper<css::io::XOutputStream> { osl::File maFile; @@ -76,6 +78,8 @@ public: virtual void SAL_CALL closeOutput( ) override; }; +} + void SAL_CALL OslOutputStreamWrapper::writeBytes( const css::uno::Sequence< sal_Int8 >& aData ) { sal_uInt64 uBytesToWrite = aData.getLength(); @@ -132,6 +136,7 @@ void SAL_CALL OslOutputStreamWrapper::closeOutput( ) } } +namespace { class FlashExportFilter : public cppu::WeakImplHelper < @@ -173,6 +178,8 @@ public: virtual Sequence< OUString > SAL_CALL getSupportedServiceNames() override; }; +} + FlashExportFilter::FlashExportFilter(const Reference< XComponentContext > &rxContext) : mxDoc() , mxContext(rxContext) diff --git a/filter/source/flash/swfwriter2.cxx b/filter/source/flash/swfwriter2.cxx index 428c807c50ca..3b6e57d2974e 100644 --- a/filter/source/flash/swfwriter2.cxx +++ b/filter/source/flash/swfwriter2.cxx @@ -531,6 +531,7 @@ void FillStyle::addTo( Tag* pTag ) const } } +namespace { struct GradRecord { @@ -540,6 +541,8 @@ struct GradRecord GradRecord( sal_uInt8 nRatio, const Color& rColor ) : mnRatio( nRatio ), maColor( rColor ) {} }; +} + // TODO: better emulation of our gradients void FillStyle::Impl_addGradient( Tag* pTag ) const { diff --git a/filter/source/graphicfilter/egif/egif.cxx b/filter/source/graphicfilter/egif/egif.cxx index 42ad6ce71a64..b7e4ac40fe06 100644 --- a/filter/source/graphicfilter/egif/egif.cxx +++ b/filter/source/graphicfilter/egif/egif.cxx @@ -30,6 +30,7 @@ #include "giflzwc.hxx" #include <memory> +namespace { class GIFWriter { @@ -72,6 +73,7 @@ public: bool WriteGIF( const Graphic& rGraphic, FilterConfigItem* pConfigItem ); }; +} GIFWriter::GIFWriter(SvStream &rStream) : m_rGIF(rStream) diff --git a/filter/source/graphicfilter/eps/eps.cxx b/filter/source/graphicfilter/eps/eps.cxx index cac944a1ec64..e933763c9140 100644 --- a/filter/source/graphicfilter/eps/eps.cxx +++ b/filter/source/graphicfilter/eps/eps.cxx @@ -64,6 +64,8 @@ using namespace ::com::sun::star::uno; // -----------------------------field-types------------------------------ +namespace { + struct StackMember { struct StackMember * pSucc; @@ -231,6 +233,8 @@ public: PSWriter(); }; +} + //========================== methods from PSWriter ========================== diff --git a/filter/source/graphicfilter/etiff/etiff.cxx b/filter/source/graphicfilter/etiff/etiff.cxx index 8e70295203e7..456088d0c234 100644 --- a/filter/source/graphicfilter/etiff/etiff.cxx +++ b/filter/source/graphicfilter/etiff/etiff.cxx @@ -44,6 +44,7 @@ #define ResolutionUnit 296 #define ColorMap 320 +namespace { struct TIFFLZWCTreeNode { @@ -112,6 +113,7 @@ public: bool WriteTIFF( const Graphic& rGraphic, FilterConfigItem const * pFilterConfigItem ); }; +} TIFFWriter::TIFFWriter(SvStream &rStream) : m_rOStm(rStream) diff --git a/filter/source/graphicfilter/ieps/ieps.cxx b/filter/source/graphicfilter/ieps/ieps.cxx index 39c2d1fe784d..b8942d13e48c 100644 --- a/filter/source/graphicfilter/ieps/ieps.cxx +++ b/filter/source/graphicfilter/ieps/ieps.cxx @@ -269,6 +269,8 @@ static bool RenderAsEMF(const sal_uInt8* pBuf, sal_uInt32 nBytesRead, Graphic &r return bRet; } +namespace { + struct WriteData { oslFileHandle m_pFile; @@ -276,6 +278,8 @@ struct WriteData sal_uInt32 m_nBytesToWrite; }; +} + extern "C" { static void WriteFileInThread(void *wData) diff --git a/filter/source/graphicfilter/ios2met/ios2met.cxx b/filter/source/graphicfilter/ios2met/ios2met.cxx index b0426d5c47d3..1ec1754d0d71 100644 --- a/filter/source/graphicfilter/ios2met/ios2met.cxx +++ b/filter/source/graphicfilter/ios2met/ios2met.cxx @@ -213,6 +213,8 @@ enum PenStyle { PEN_NULL, PEN_SOLID, PEN_DOT, PEN_DASH, PEN_DASHDOT }; //============================ OS2METReader ================================== +namespace { + struct OSPalette { OSPalette * pSucc; sal_uInt32 * p0RGB; // May be NULL! @@ -420,6 +422,8 @@ public: }; +} + //=================== Methods of OS2METReader ============================== OS2METReader::OS2METReader() diff --git a/filter/source/graphicfilter/ipbm/ipbm.cxx b/filter/source/graphicfilter/ipbm/ipbm.cxx index f192c847ab5e..3e882aa3c884 100644 --- a/filter/source/graphicfilter/ipbm/ipbm.cxx +++ b/filter/source/graphicfilter/ipbm/ipbm.cxx @@ -26,6 +26,8 @@ //============================ PBMReader ================================== +namespace { + class PBMReader { private: @@ -49,6 +51,8 @@ public: bool ReadPBM(Graphic & rGraphic ); }; +} + //=================== Methods of PBMReader ============================== PBMReader::PBMReader(SvStream & rPBM) diff --git a/filter/source/graphicfilter/ipcd/ipcd.cxx b/filter/source/graphicfilter/ipcd/ipcd.cxx index c1b3f0061201..9c9fc0983f30 100644 --- a/filter/source/graphicfilter/ipcd/ipcd.cxx +++ b/filter/source/graphicfilter/ipcd/ipcd.cxx @@ -42,8 +42,6 @@ enum PCDResolution { PCDRES_16BASE // 3072 x 3072 }; -} - class PCDReader { private: @@ -95,6 +93,8 @@ public: bool ReadPCD( Graphic & rGraphic, FilterConfigItem* pConfigItem ); }; +} + //=================== Methods of PCDReader ============================== bool PCDReader::ReadPCD( Graphic & rGraphic, FilterConfigItem* pConfigItem ) diff --git a/filter/source/graphicfilter/ipcx/ipcx.cxx b/filter/source/graphicfilter/ipcx/ipcx.cxx index 93cebc1e6dce..e4e4575618cd 100644 --- a/filter/source/graphicfilter/ipcx/ipcx.cxx +++ b/filter/source/graphicfilter/ipcx/ipcx.cxx @@ -27,6 +27,8 @@ class FilterConfigItem; //============================ PCXReader ================================== +namespace { + class PCXReader { private: @@ -59,6 +61,8 @@ public: // Reads a PCX file from the stream and fills the GDIMetaFile }; +} + //=================== methods of PCXReader ============================== PCXReader::PCXReader(SvStream &rStream) diff --git a/filter/source/graphicfilter/ipict/ipict.cxx b/filter/source/graphicfilter/ipict/ipict.cxx index 8fc618bc3b10..a916f090ea4c 100644 --- a/filter/source/graphicfilter/ipict/ipict.cxx +++ b/filter/source/graphicfilter/ipict/ipict.cxx @@ -37,6 +37,8 @@ // complete FilterConfigItem for GraphicImport under -fsanitize=function namespace PictReaderInternal { + namespace { + //! utilitary class to store a pattern, ... class Pattern { public: @@ -86,6 +88,8 @@ namespace PictReaderInternal { bool isRead; }; + } + sal_uLong Pattern::read(SvStream &stream) { unsigned char nbyte[8]; sal_uLong nHiBytes, nLoBytes; @@ -145,8 +149,6 @@ enum class PictDrawingMethod { TEXT, UNDEFINED }; -} - class PictReader { typedef class PictReaderInternal::Pattern Pattern; private: @@ -266,6 +268,8 @@ public: }; +} + static void SetByte(sal_uInt16& nx, sal_uInt16 ny, vcl::bitmap::RawBitmap& rBitmap, sal_uInt16 nPixelSize, sal_uInt8 nDat, sal_uInt16 nWidth, std::vector<Color> const & rvPalette) { switch (nPixelSize) diff --git a/filter/source/graphicfilter/ipsd/ipsd.cxx b/filter/source/graphicfilter/ipsd/ipsd.cxx index a404e6f63b45..0f8f0dfa3b04 100644 --- a/filter/source/graphicfilter/ipsd/ipsd.cxx +++ b/filter/source/graphicfilter/ipsd/ipsd.cxx @@ -40,6 +40,8 @@ class FilterConfigItem; #define PSD_DUOTONE 8 #define PSD_LAB 9 +namespace { + struct PSDFileHeader { sal_uInt32 nSignature; @@ -82,6 +84,8 @@ public: bool ReadPSD(Graphic & rGraphic); }; +} + //=================== Methods of PSDReader ============================== PSDReader::PSDReader(SvStream &rStream) diff --git a/filter/source/graphicfilter/iras/iras.cxx b/filter/source/graphicfilter/iras/iras.cxx index f2fca2cdf960..4bafe0fe8e9c 100644 --- a/filter/source/graphicfilter/iras/iras.cxx +++ b/filter/source/graphicfilter/iras/iras.cxx @@ -38,6 +38,8 @@ class FilterConfigItem; //============================ RASReader ================================== +namespace { + class RASReader { private: @@ -61,6 +63,8 @@ public: bool ReadRAS(Graphic & rGraphic); }; +} + //=================== Methods of RASReader ============================== RASReader::RASReader(SvStream &rRAS) diff --git a/filter/source/graphicfilter/itga/itga.cxx b/filter/source/graphicfilter/itga/itga.cxx index 1408bf5ff4cc..f7748022fadb 100644 --- a/filter/source/graphicfilter/itga/itga.cxx +++ b/filter/source/graphicfilter/itga/itga.cxx @@ -27,6 +27,8 @@ class FilterConfigItem; //============================ TGAReader ================================== +namespace { + struct TGAFileHeader { sal_uInt8 nImageIDLength; @@ -110,6 +112,8 @@ public: bool ReadTGA(Graphic &rGraphic); }; +} + //=================== Methods of TGAReader ============================== TGAReader::TGAReader(SvStream &rTGA) diff --git a/filter/source/graphicfilter/itiff/itiff.cxx b/filter/source/graphicfilter/itiff/itiff.cxx index 0d1bf7ae059d..d81cc2d7b073 100644 --- a/filter/source/graphicfilter/itiff/itiff.cxx +++ b/filter/source/graphicfilter/itiff/itiff.cxx @@ -40,8 +40,6 @@ template< typename T > T BYTESWAP(T nByte) { ( ( nByte & 128 ) >> 7 ); } -} - //============================ TIFFReader ================================== class TIFFReader @@ -188,6 +186,8 @@ public: bool ReadTIFF( SvStream & rTIFF, Graphic & rGraphic ); }; +} + //=================== Methods of TIFFReader ============================== sal_uInt32 TIFFReader::DataTypeSize() diff --git a/filter/source/msfilter/escherex.cxx b/filter/source/msfilter/escherex.cxx index 0279bc6684e7..69559fbc98b0 100644 --- a/filter/source/msfilter/escherex.cxx +++ b/filter/source/msfilter/escherex.cxx @@ -4403,6 +4403,8 @@ sal_uInt32 EscherGraphicProvider::GetBlibID( SvStream& rPicOutStrm, GraphicObjec return nBlibId; } +namespace { + struct EscherConnectorRule { sal_uInt32 nRuleId; @@ -4413,6 +4415,8 @@ struct EscherConnectorRule sal_uInt32 ncptiB; // Connection site Index of shape B }; +} + struct EscherShapeListEntry { uno::Reference<drawing::XShape>aXShape; @@ -4892,6 +4896,8 @@ SvStream* EscherExGlobal::ImplQueryPictureStream() return nullptr; } +namespace { + // Implementation of an empty stream that silently succeeds, but does nothing. // // In fact, this is a hack. The right solution is to abstract EscherEx to be @@ -4910,6 +4916,8 @@ public: SvNullStream() : SvStream() {} }; +} + EscherEx::EscherEx(const std::shared_ptr<EscherExGlobal>& rxGlobal, SvStream* pOutStrm, bool bOOXML) : mxGlobal(rxGlobal) , mpOutStrm(pOutStrm) diff --git a/filter/source/msfilter/msdffimp.cxx b/filter/source/msfilter/msdffimp.cxx index 10a0ca1f6382..3d791bbb9bc8 100644 --- a/filter/source/msfilter/msdffimp.cxx +++ b/filter/source/msfilter/msdffimp.cxx @@ -191,6 +191,8 @@ using namespace container ; static sal_uInt32 nMSOleObjCntr = 0; #define MSO_OLE_Obj "MSO_OLE_Obj" +namespace { + struct SvxMSDffBLIPInfo { sal_uLong nFilePos; ///< offset of the BLIP in data stream @@ -200,6 +202,8 @@ struct SvxMSDffBLIPInfo } }; +} + /// the following will be sorted by the order of their appearance: struct SvxMSDffBLIPInfos : public std::vector<SvxMSDffBLIPInfo> {}; @@ -1123,6 +1127,8 @@ void DffPropertyReader::ApplyLineAttributes( SfxItemSet& rSet, const MSO_SPT eSh rSet.Put( XLineStyleItem( drawing::LineStyle_NONE ) ); } +namespace { + struct ShadeColor { Color aColor; @@ -1131,6 +1137,8 @@ struct ShadeColor ShadeColor( const Color& rC, double fR ) : aColor( rC ), fDist( fR ) {}; }; +} + static void GetShadeColors( const SvxMSDffManager& rManager, const DffPropertyReader& rProperties, SvStream& rIn, std::vector< ShadeColor >& rShadeColors ) { sal_uInt32 nPos = rIn.Tell(); @@ -6800,11 +6808,16 @@ bool SvxMSDffManager::MakeContentStream( SotStorage * pStor, const GDIMetaFile & return xStm->GetError() == ERRCODE_NONE; } +namespace { + struct ClsIDs { sal_uInt32 nId; const sal_Char* pSvrName; const sal_Char* pDspName; }; + +} + static const ClsIDs aClsIDs[] = { { 0x000212F0, "MSWordArt", "Microsoft Word Art" }, diff --git a/filter/source/msfilter/msvbahelper.cxx b/filter/source/msfilter/msvbahelper.cxx index ffebbaaf70e4..736f65887764 100644 --- a/filter/source/msfilter/msvbahelper.cxx +++ b/filter/source/msfilter/msvbahelper.cxx @@ -643,12 +643,16 @@ static sal_uInt16 parseChar( sal_Unicode c ) return nVclKey; } +namespace { + struct KeyCodeEntry { const char* sName; sal_uInt16 nCode; }; +} + KeyCodeEntry const aMSKeyCodesData[] = { { "BACKSPACE", KEY_BACKSPACE }, { "BS", KEY_BACKSPACE }, diff --git a/filter/source/msfilter/util.cxx b/filter/source/msfilter/util.cxx index a007c709b66a..8654458b98cf 100644 --- a/filter/source/msfilter/util.cxx +++ b/filter/source/msfilter/util.cxx @@ -558,12 +558,16 @@ EquationResult ParseCombinedChars(const OUString& rStr) return aResult; } +namespace { + struct CustomShapeTypeTranslationTable { const char* sOOo; const char* sMSO; }; +} + static const CustomShapeTypeTranslationTable pCustomShapeTypeTranslationTable[] = { // { "non-primitive", mso_sptMin }, diff --git a/filter/source/odfflatxml/OdfFlatXml.cxx b/filter/source/odfflatxml/OdfFlatXml.cxx index 8e0a4beb076e..cf7f37b9f993 100644 --- a/filter/source/odfflatxml/OdfFlatXml.cxx +++ b/filter/source/odfflatxml/OdfFlatXml.cxx @@ -52,6 +52,8 @@ using namespace ::com::sun::star::xml::sax; namespace filter { namespace odfflatxml { + namespace { + /* * OdfFlatXml export and imports ODF flat XML documents by plugging a pass-through * filter implementation into XmlFilterAdaptor. @@ -102,6 +104,8 @@ namespace filter { static Reference< XInterface > SAL_CALL impl_createInstance(const Reference< XMultiServiceFactory >& fact); }; + + } } } diff --git a/filter/source/pdf/pdfexport.cxx b/filter/source/pdf/pdfexport.cxx index c24e3e6581f4..039ac09de19c 100644 --- a/filter/source/pdf/pdfexport.cxx +++ b/filter/source/pdf/pdfexport.cxx @@ -284,6 +284,8 @@ bool PDFExport::ExportSelection( vcl::PDFWriter& rPDFWriter, return bRet; } +namespace { + class PDFExportStreamDoc : public vcl::PDFOutputStream { private: @@ -301,6 +303,8 @@ public: virtual void write( const Reference< XOutputStream >& xStream ) override; }; +} + void PDFExportStreamDoc::write( const Reference< XOutputStream >& xStream ) { Reference< css::frame::XStorable > xStore( m_xSrcDoc, UNO_QUERY ); diff --git a/filter/source/pdf/pdffilter.cxx b/filter/source/pdf/pdffilter.cxx index 698735c969e0..b79cc7884346 100644 --- a/filter/source/pdf/pdffilter.cxx +++ b/filter/source/pdf/pdffilter.cxx @@ -172,6 +172,7 @@ bool PDFFilter::implExport( const Sequence< PropertyValue >& rDescriptor ) return bRet; } +namespace { class FocusWindowWaitCursor { @@ -202,6 +203,7 @@ public: DECL_LINK( DestroyedLink, VclWindowEvent&, void ); }; +} IMPL_LINK( FocusWindowWaitCursor, DestroyedLink, VclWindowEvent&, rEvent, void ) { diff --git a/filter/source/svg/svgexport.cxx b/filter/source/svg/svgexport.cxx index 7913d3704e73..7fbf85283d7f 100644 --- a/filter/source/svg/svgexport.cxx +++ b/filter/source/svg/svgexport.cxx @@ -103,6 +103,8 @@ static const char constSvgNamespace[] = "http://www.w3.org/2000/svg"; This is a set of classes for exporting text field meta info. */ +namespace { + class TextField { protected: @@ -310,11 +312,12 @@ public: }; -static bool operator==( const TextField & aLhsTextField, const TextField & aRhsTextField ) +bool operator==( const TextField & aLhsTextField, const TextField & aRhsTextField ) { return aLhsTextField.equalTo( aRhsTextField ); } +} SVGExport::SVGExport( const css::uno::Reference< css::uno::XComponentContext >& rContext, diff --git a/filter/source/svg/svgfilter.cxx b/filter/source/svg/svgfilter.cxx index 5677d63fcc6c..ba3e56cf045c 100644 --- a/filter/source/svg/svgfilter.cxx +++ b/filter/source/svg/svgfilter.cxx @@ -616,6 +616,8 @@ void SAL_CALL SVGFilter::setTargetDocument( const Reference< XComponent >& xDoc mxDstDoc = xDoc; } +namespace { + // There is already another SVG-Type_Detector, see // vcl/source/filter/graphicfilter.cxx ("DOCTYPE svg"), // but since these start from different preconditions it is not @@ -788,6 +790,8 @@ public: } }; +} + OUString SAL_CALL SVGFilter::detect(Sequence<PropertyValue>& rDescriptor) { utl::MediaDescriptor aMediaDescriptor(rDescriptor); diff --git a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx index f454dfda5627..efaf7a32ff83 100644 --- a/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx +++ b/filter/source/xsltdialog/xmlfilterdialogcomponent.cxx @@ -52,6 +52,7 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::registry; using namespace ::com::sun::star::frame; +namespace { class XMLFilterDialogComponentBase { @@ -109,6 +110,8 @@ private: std::shared_ptr<XMLFilterSettingsDialog> mxDialog; }; +} + XMLFilterDialogComponent::XMLFilterDialogComponent(const css::uno::Reference< XComponentContext >& rxContext) : OComponentHelper(maMutex) , mxContext(rxContext) diff --git a/filter/source/xsltdialog/xmlfiltertestdialog.cxx b/filter/source/xsltdialog/xmlfiltertestdialog.cxx index c0352343adb6..94780eef3324 100644 --- a/filter/source/xsltdialog/xmlfiltertestdialog.cxx +++ b/filter/source/xsltdialog/xmlfiltertestdialog.cxx @@ -66,6 +66,7 @@ using namespace com::sun::star::system; using namespace com::sun::star::xml; using namespace com::sun::star::xml::sax; +namespace { class GlobalEventListenerImpl : public ::cppu::WeakImplHelper< css::document::XDocumentEventListener > { @@ -81,6 +82,8 @@ private: XMLFilterTestDialog* mpDialog; }; +} + GlobalEventListenerImpl::GlobalEventListenerImpl( XMLFilterTestDialog* pDialog ) : mpDialog( pDialog ) { diff --git a/filter/source/xsltfilter/LibXSLTTransformer.cxx b/filter/source/xsltfilter/LibXSLTTransformer.cxx index 42980eeeaff7..a98b6537855f 100644 --- a/filter/source/xsltfilter/LibXSLTTransformer.cxx +++ b/filter/source/xsltfilter/LibXSLTTransformer.cxx @@ -70,6 +70,8 @@ namespace XSLT const sal_Int32 Reader::INPUT_BUFFER_SIZE = 4096; + namespace { + /** * ParserInputBufferCallback forwards IO call-backs to libxml stream IO. */ @@ -201,6 +203,8 @@ namespace XSLT } }; + } + Reader::Reader(LibXSLTTransformer* transformer) : Thread("LibXSLTTransformer"), m_transformer(transformer), m_readBuf(INPUT_BUFFER_SIZE), m_writeBuf(OUTPUT_BUFFER_SIZE), diff --git a/filter/source/xsltfilter/XSLTFilter.cxx b/filter/source/xsltfilter/XSLTFilter.cxx index 340414598e9c..cdc5b5497dec 100644 --- a/filter/source/xsltfilter/XSLTFilter.cxx +++ b/filter/source/xsltfilter/XSLTFilter.cxx @@ -92,6 +92,8 @@ using namespace ::com::sun::star::task; namespace XSLT { + namespace { + /* * XSLTFilter reads flat XML streams from the XML filter framework and passes * them to an XSLT transformation service. XSLT transformation errors are @@ -163,6 +165,8 @@ namespace XSLT endDocument() override; }; + } + XSLTFilter::XSLTFilter(const css::uno::Reference<XComponentContext> &r): m_xContext(r), m_bTerminated(false), m_bError(false) {} diff --git a/forms/source/component/Button.cxx b/forms/source/component/Button.cxx index 31f87284d0d4..ffa29b1bb6ce 100644 --- a/forms/source/component/Button.cxx +++ b/forms/source/component/Button.cxx @@ -537,6 +537,7 @@ void SAL_CALL OButtonControl::removeActionListener(const Reference<XActionListen m_aActionListeners.removeInterface(_rxListener); } +namespace { class DoPropertyListening { @@ -555,6 +556,7 @@ public: void handleListening( const OUString& _rPropertyName ); }; +} DoPropertyListening::DoPropertyListening( const Reference< XInterface >& _rxComponent, const Reference< XPropertyChangeListener >& _rxListener, diff --git a/forms/source/component/DatabaseForm.cxx b/forms/source/component/DatabaseForm.cxx index f2b307c702ad..3bd03fce0b03 100644 --- a/forms/source/component/DatabaseForm.cxx +++ b/forms/source/component/DatabaseForm.cxx @@ -98,6 +98,8 @@ using namespace ::com::sun::star::util; namespace frm { +namespace { + class DocumentModifyGuard { public: @@ -129,6 +131,8 @@ private: Reference< XModifiable2 > m_xDocumentModify; }; +} + // submitting and resetting html-forms asynchronously class OFormSubmitResetThread: public OComponentEventThread { diff --git a/forms/source/component/FormComponent.cxx b/forms/source/component/FormComponent.cxx index 7ab3e7732f7d..fb584d478ced 100644 --- a/forms/source/component/FormComponent.cxx +++ b/forms/source/component/FormComponent.cxx @@ -89,6 +89,8 @@ void ControlModelLock::addPropertyNotification( const sal_Int32 _nHandle, const m_aNewValues.push_back( _rNewValue ); } +namespace { + class FieldChangeNotifier { public: @@ -112,6 +114,8 @@ private: Reference< XPropertySet > m_xOldField; }; +} + // base class for form layer controls OControl::OControl( const Reference< XComponentContext >& _rxContext, const OUString& _rAggregateService, const bool _bSetDelegator ) :OComponentHelper(m_aMutex) diff --git a/forms/source/component/FormattedField.cxx b/forms/source/component/FormattedField.cxx index 178cf037312d..805076b545d1 100644 --- a/forms/source/component/FormattedField.cxx +++ b/forms/source/component/FormattedField.cxx @@ -76,6 +76,8 @@ using namespace css::form::binding; namespace frm { +namespace { + class StandardFormatsSupplier : protected SvNumberFormatsSupplierObj, public ::utl::ITerminationListener { protected: @@ -90,6 +92,9 @@ protected: virtual bool queryTermination() const override; virtual void notifyTermination() override; }; + +} + WeakReference< XNumberFormatsSupplier > StandardFormatsSupplier::s_xDefaultFormatsSupplier; StandardFormatsSupplier::StandardFormatsSupplier(const Reference< XComponentContext > & _rxContext,LanguageType _eSysLanguage) :SvNumberFormatsSupplierObj() diff --git a/forms/source/component/imgprod.cxx b/forms/source/component/imgprod.cxx index c1b72d90daed..848b2ce0629b 100644 --- a/forms/source/component/imgprod.cxx +++ b/forms/source/component/imgprod.cxx @@ -34,6 +34,7 @@ #include <svtools/imageresourceaccess.hxx> #include <comphelper/processfactory.hxx> +namespace { class ImgProdLockBytes : public SvLockBytes { @@ -52,6 +53,7 @@ public: virtual ErrCode Stat( SvLockBytesStat* ) const override; }; +} ImgProdLockBytes::ImgProdLockBytes( SvStream* pStm, bool bOwner ) : SvLockBytes( pStm, bOwner ) diff --git a/forms/source/helper/commandimageprovider.cxx b/forms/source/helper/commandimageprovider.cxx index a40783149416..6569c8a4373e 100644 --- a/forms/source/helper/commandimageprovider.cxx +++ b/forms/source/helper/commandimageprovider.cxx @@ -52,6 +52,8 @@ namespace frm namespace ImageType = ::com::sun::star::ui::ImageType; + namespace { + class DocumentCommandImageProvider : public ICommandImageProvider { public: @@ -71,6 +73,7 @@ namespace frm Reference< XImageManager > m_xModuleImageManager; }; + } void DocumentCommandImageProvider::impl_init_nothrow( const Reference<XComponentContext>& _rContext, const Reference< XModel >& _rxDocument ) { diff --git a/forms/source/misc/InterfaceContainer.cxx b/forms/source/misc/InterfaceContainer.cxx index ac86a12b0454..c318b936d8af 100644 --- a/forms/source/misc/InterfaceContainer.cxx +++ b/forms/source/misc/InterfaceContainer.cxx @@ -347,6 +347,7 @@ void SAL_CALL OInterfaceContainer::writeEvents(const Reference<XObjectOutputStre lcl_restoreEvents( aSave, m_xEventAttacher ); } +namespace { struct TransformEventTo52Format { @@ -370,6 +371,7 @@ struct TransformEventTo52Format } }; +} void OInterfaceContainer::transformEvents() { diff --git a/forms/source/misc/limitedformats.cxx b/forms/source/misc/limitedformats.cxx index c079591e61b8..e7f0fb4cb352 100644 --- a/forms/source/misc/limitedformats.cxx +++ b/forms/source/misc/limitedformats.cxx @@ -76,6 +76,7 @@ namespace frm return s_aSystem; } + namespace { struct FormatEntry { @@ -84,6 +85,7 @@ namespace frm LocaleType eLocale; }; + } static FormatEntry* lcl_getFormatTable(sal_Int16 nTableId) { diff --git a/formula/source/core/api/token.cxx b/formula/source/core/api/token.cxx index 17594207234f..88c5d3a57de1 100644 --- a/formula/source/core/api/token.cxx +++ b/formula/source/core/api/token.cxx @@ -1023,6 +1023,8 @@ inline bool MissingConventionOOXML::isRewriteNeeded( OpCode eOp ) } } +namespace { + class FormulaMissingContext { public: @@ -1036,6 +1038,8 @@ class FormulaMissingContext void AddMoreArgs( FormulaTokenArray *pNewArr, const MissingConvention & rConv ) const; }; +} + void FormulaMissingContext::AddMoreArgs( FormulaTokenArray *pNewArr, const MissingConvention & rConv ) const { if ( !mpFunc ) diff --git a/fpicker/source/office/fileview.cxx b/fpicker/source/office/fileview.cxx index c544da915ec7..9fda18b2a36f 100644 --- a/fpicker/source/office/fileview.cxx +++ b/fpicker/source/office/fileview.cxx @@ -116,9 +116,6 @@ namespace virtual void SAL_CALL onShot() override; }; - -} - class ViewTabListBox_Impl { private: @@ -226,6 +223,8 @@ public: void ExecuteContextMenuAction(const OString& rSelectedPopentry); }; +} + //= SvtFileView_Impl class SvtFileView_Impl :public ::svt::IEnumerationResultHandler { diff --git a/framework/source/fwe/dispatch/interaction.cxx b/framework/source/fwe/dispatch/interaction.cxx index 2f17a19eaa86..ef851093e70e 100644 --- a/framework/source/fwe/dispatch/interaction.cxx +++ b/framework/source/fwe/dispatch/interaction.cxx @@ -26,6 +26,8 @@ using namespace ::com::sun::star; namespace framework{ +namespace { + /*-************************************************************************************************************ @short declaration of special continuation for filter selection @descr Sometimes filter detection during loading document failed. Then we need a possibility @@ -63,6 +65,8 @@ class ContinuationFilterSelect : public comphelper::OInteraction< css::document: }; // class ContinuationFilterSelect +} + // initialize continuation with right start values ContinuationFilterSelect::ContinuationFilterSelect() @@ -180,6 +184,8 @@ uno::Reference < task::XInteractionRequest > RequestFilterSelect::GetRequest() return mxImpl.get(); } +namespace { + class InteractionRequest_Impl : public ::cppu::WeakImplHelper< css::task::XInteractionRequest > { uno::Any m_aRequest; @@ -197,6 +203,8 @@ public: virtual uno::Sequence< uno::Reference< task::XInteractionContinuation > > SAL_CALL getContinuations() override; }; +} + uno::Any SAL_CALL InteractionRequest_Impl::getRequest() { return m_aRequest; diff --git a/framework/source/fwe/helper/documentundoguard.cxx b/framework/source/fwe/helper/documentundoguard.cxx index c4aac1619b1e..5f7d16041caa 100644 --- a/framework/source/fwe/helper/documentundoguard.cxx +++ b/framework/source/fwe/helper/documentundoguard.cxx @@ -43,6 +43,9 @@ namespace framework typedef ::cppu::WeakImplHelper < XUndoManagerListener > UndoManagerContextListener_Base; + + namespace { + class UndoManagerContextListener : public UndoManagerContextListener_Base { public: @@ -97,6 +100,8 @@ namespace framework bool m_documentDisposed; }; + } + void SAL_CALL UndoManagerContextListener::undoActionAdded( const UndoManagerEvent& ) { // not interested in diff --git a/framework/source/fwe/helper/undomanagerhelper.cxx b/framework/source/fwe/helper/undomanagerhelper.cxx index 080b70eef4c6..a621a39ae320 100644 --- a/framework/source/fwe/helper/undomanagerhelper.cxx +++ b/framework/source/fwe/helper/undomanagerhelper.cxx @@ -67,6 +67,8 @@ namespace framework //= UndoActionWrapper + namespace { + class UndoActionWrapper : public SfxUndoAction { public: @@ -84,6 +86,8 @@ namespace framework const Reference< XUndoAction > m_xUndoAction; }; + } + UndoActionWrapper::UndoActionWrapper( Reference< XUndoAction > const& i_undoAction ) :SfxUndoAction() ,m_xUndoAction( i_undoAction ) @@ -136,6 +140,8 @@ namespace framework //= UndoManagerRequest + namespace { + class UndoManagerRequest : public ::comphelper::AnyEvent { public: @@ -187,6 +193,8 @@ namespace framework ::osl::Condition m_finishCondition; }; + } + //= UndoManagerHelper_Impl class UndoManagerHelper_Impl : public SfxUndoListener diff --git a/framework/source/fwe/xml/menudocumenthandler.cxx b/framework/source/fwe/xml/menudocumenthandler.cxx index 1e69c23e5b2d..144c6c600d22 100644 --- a/framework/source/fwe/xml/menudocumenthandler.cxx +++ b/framework/source/fwe/xml/menudocumenthandler.cxx @@ -92,12 +92,16 @@ using namespace ::com::sun::star::ui; namespace framework { +namespace { + struct MenuStyleItem { sal_Int16 nBit; const char* attrName; }; +} + const MenuStyleItem MenuItemStyles[ ] = { { css::ui::ItemStyle::ICON, ATTRIBUTE_ITEMSTYLE_IMAGE }, { css::ui::ItemStyle::TEXT, ATTRIBUTE_ITEMSTYLE_TEXT }, diff --git a/framework/source/fwe/xml/statusbardocumenthandler.cxx b/framework/source/fwe/xml/statusbardocumenthandler.cxx index 18b6388d41d3..43d6cc12e811 100644 --- a/framework/source/fwe/xml/statusbardocumenthandler.cxx +++ b/framework/source/fwe/xml/statusbardocumenthandler.cxx @@ -126,12 +126,16 @@ static void ExtractStatusbarItemParameters( } } +namespace { + struct StatusBarEntryProperty { OReadStatusBarDocumentHandler::StatusBar_XML_Namespace nNamespace; char aEntryName[20]; }; +} + StatusBarEntryProperty const StatusBarEntries[OReadStatusBarDocumentHandler::SB_XML_ENTRY_COUNT] = { { OReadStatusBarDocumentHandler::SB_NS_STATUSBAR, ELEMENT_STATUSBAR }, diff --git a/framework/source/fwe/xml/toolboxdocumenthandler.cxx b/framework/source/fwe/xml/toolboxdocumenthandler.cxx index 7089623094b7..1ded389cdcce 100644 --- a/framework/source/fwe/xml/toolboxdocumenthandler.cxx +++ b/framework/source/fwe/xml/toolboxdocumenthandler.cxx @@ -81,12 +81,16 @@ static void ExtractToolbarParameters( const Sequence< PropertyValue >& rProp, } } +namespace { + struct ToolboxStyleItem { sal_Int16 nBit; const char* attrName; }; +} + const ToolboxStyleItem Styles[ ] = { { css::ui::ItemStyle::RADIO_CHECK, ATTRIBUTE_ITEMSTYLE_RADIO }, { css::ui::ItemStyle::ALIGN_LEFT, ATTRIBUTE_ITEMSTYLE_LEFT }, @@ -100,12 +104,16 @@ const ToolboxStyleItem Styles[ ] = { sal_Int32 const nStyleItemEntries = SAL_N_ELEMENTS(Styles); +namespace { + struct ToolBarEntryProperty { OReadToolBoxDocumentHandler::ToolBox_XML_Namespace nNamespace; char aEntryName[20]; }; +} + ToolBarEntryProperty const ToolBoxEntries[OReadToolBoxDocumentHandler::TB_XML_ENTRY_COUNT] = { { OReadToolBoxDocumentHandler::TB_NS_TOOLBAR, ELEMENT_TOOLBAR }, diff --git a/framework/source/helper/statusindicatorfactory.cxx b/framework/source/helper/statusindicatorfactory.cxx index 8bab8ca452c0..f00ce08eb043 100644 --- a/framework/source/helper/statusindicatorfactory.cxx +++ b/framework/source/helper/statusindicatorfactory.cxx @@ -41,8 +41,13 @@ namespace framework{ sal_Int32 StatusIndicatorFactory::m_nInReschedule = 0; ///< static counter for rescheduling + +namespace { + struct RescheduleLock: public rtl::Static<osl::Mutex, RescheduleLock> {}; ///< mutex to guard the m_nInReschedule +} + const char PROGRESS_RESOURCE[] = "private:resource/progressbar/progressbar"; StatusIndicatorFactory::StatusIndicatorFactory(const css::uno::Reference< css::uno::XComponentContext >& xContext) diff --git a/framework/source/loadenv/loadenv.cxx b/framework/source/loadenv/loadenv.cxx index a4ed4a3ef23b..96e9b6f2a970 100644 --- a/framework/source/loadenv/loadenv.cxx +++ b/framework/source/loadenv/loadenv.cxx @@ -96,6 +96,8 @@ namespace framework { using namespace com::sun::star; +namespace { + class LoadEnvListener : public ::cppu::WeakImplHelper< css::frame::XLoadEventListener , css::frame::XDispatchResultListener > { @@ -124,6 +126,8 @@ class LoadEnvListener : public ::cppu::WeakImplHelper< css::frame::XLoadEventLis virtual void SAL_CALL disposing(const css::lang::EventObject& aEvent) override; }; +} + LoadEnv::LoadEnv(const css::uno::Reference< css::uno::XComponentContext >& xContext) : m_xContext(xContext) , m_nSearchFlags(0) diff --git a/framework/source/uiconfiguration/globalsettings.cxx b/framework/source/uiconfiguration/globalsettings.cxx index 288e81a676c0..f8a492299b95 100644 --- a/framework/source/uiconfiguration/globalsettings.cxx +++ b/framework/source/uiconfiguration/globalsettings.cxx @@ -40,6 +40,8 @@ namespace framework // Configuration access class for WindowState supplier implementation +namespace { + class GlobalSettings_Access : public ::cppu::WeakImplHelper< css::lang::XComponent, css::lang::XEventListener> @@ -73,6 +75,8 @@ class GlobalSettings_Access : public ::cppu::WeakImplHelper< css::uno::Reference< css::uno::XComponentContext> m_xContext; }; +} + GlobalSettings_Access::GlobalSettings_Access( const css::uno::Reference< css::uno::XComponentContext >& rxContext ) : m_bDisposed( false ), m_bConfigRead( false ), @@ -217,7 +221,12 @@ void GlobalSettings_Access::impl_initConfigAccess() // global class +namespace { + struct mutexGlobalSettings : public rtl::Static< osl::Mutex, mutexGlobalSettings > {}; + +} + static GlobalSettings_Access* pStaticSettings = nullptr; static GlobalSettings_Access* GetGlobalSettings( const css::uno::Reference< css::uno::XComponentContext >& rxContext ) diff --git a/framework/source/uielement/subtoolbarcontroller.cxx b/framework/source/uielement/subtoolbarcontroller.cxx index 058cbeee3a3c..e36ec92ea4aa 100644 --- a/framework/source/uielement/subtoolbarcontroller.cxx +++ b/framework/source/uielement/subtoolbarcontroller.cxx @@ -41,6 +41,8 @@ typedef cppu::ImplInheritanceHelper< svt::ToolboxController, css::awt::XDockableWindowListener, css::lang::XServiceInfo > ToolBarBase; +namespace { + class SubToolBarController : public ToolBarBase { OUString m_aSubTbName; @@ -88,6 +90,8 @@ public: virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; }; +} + SubToolBarController::SubToolBarController( const css::uno::Sequence< css::uno::Any >& rxArgs ) { css::beans::PropertyValue aPropValue; diff --git a/framework/source/uielement/thesaurusmenucontroller.cxx b/framework/source/uielement/thesaurusmenucontroller.cxx index bfff4cb778a0..6cae0457f61d 100644 --- a/framework/source/uielement/thesaurusmenucontroller.cxx +++ b/framework/source/uielement/thesaurusmenucontroller.cxx @@ -29,6 +29,8 @@ #include <com/sun/star/linguistic2/LinguServiceManager.hpp> +namespace { + class ThesaurusMenuController : public svt::PopupMenuControllerBase { public: @@ -50,6 +52,8 @@ private: OUString m_aLastWord; }; +} + ThesaurusMenuController::ThesaurusMenuController( const css::uno::Reference< css::uno::XComponentContext >& rxContext ) : svt::PopupMenuControllerBase( rxContext ), m_xLinguServiceManager( css::linguistic2::LinguServiceManager::create( rxContext ) ), diff --git a/framework/source/uielement/toolbarsmenucontroller.cxx b/framework/source/uielement/toolbarsmenucontroller.cxx index f9f79ee19f76..3caf634f32c4 100644 --- a/framework/source/uielement/toolbarsmenucontroller.cxx +++ b/framework/source/uielement/toolbarsmenucontroller.cxx @@ -77,6 +77,8 @@ namespace framework typedef std::unordered_map< OUString, OUString > ToolbarHashMap; +namespace { + struct ToolBarEntry { OUString aUIName; @@ -86,6 +88,8 @@ struct ToolBarEntry const CollatorWrapper* pCollatorWrapper; }; +} + static bool CompareToolBarEntry( const ToolBarEntry& aOne, const ToolBarEntry& aTwo ) { sal_Int32 nComp = aOne.pCollatorWrapper->compareString( aOne.aUIName, aTwo.aUIName ); @@ -109,12 +113,16 @@ static Reference< XLayoutManager > getLayoutManagerFromFrame( const Reference< X return xLayoutManager; } +namespace { + struct ToolBarInfo { OUString aToolBarResName; OUString aToolBarUIName; }; +} + DEFINE_XSERVICEINFO_MULTISERVICE_2 ( ToolbarsMenuController , OWeakObject , SERVICENAME_POPUPMENUCONTROLLER , diff --git a/framework/source/uielement/uicommanddescription.cxx b/framework/source/uielement/uicommanddescription.cxx index afbaba2f08cf..85c97cee559d 100644 --- a/framework/source/uielement/uicommanddescription.cxx +++ b/framework/source/uielement/uicommanddescription.cxx @@ -60,6 +60,8 @@ namespace framework // Configuration access class for PopupMenuControllerFactory implementation +namespace { + class ConfigurationAccess_UICommand : // Order is necessary for right initialization! public ::cppu::WeakImplHelper<XNameAccess,XContainerListener> { @@ -145,6 +147,9 @@ class ConfigurationAccess_UICommand : // Order is necessary for right initializa bool m_bGenericDataRetrieved; }; +} + + // XInterface, XTypeProvider ConfigurationAccess_UICommand::ConfigurationAccess_UICommand( const OUString& aModuleName, const Reference< XNameAccess >& rGenericUICommands, const Reference< XComponentContext>& rxContext ) : diff --git a/framework/source/xml/imagesdocumenthandler.cxx b/framework/source/xml/imagesdocumenthandler.cxx index 90c717afad8b..45a5387186b9 100644 --- a/framework/source/xml/imagesdocumenthandler.cxx +++ b/framework/source/xml/imagesdocumenthandler.cxx @@ -67,12 +67,16 @@ using namespace ::com::sun::star::xml::sax; namespace framework { +namespace { + struct ImageXMLEntryProperty { OReadImagesDocumentHandler::Image_XML_Namespace nNamespace; char aEntryName[20]; }; +} + ImageXMLEntryProperty const ImagesEntries[OReadImagesDocumentHandler::IMG_XML_ENTRY_COUNT] = { { OReadImagesDocumentHandler::IMG_NS_IMAGE, ELEMENT_IMAGECONTAINER }, diff --git a/helpcompiler/source/HelpCompiler.cxx b/helpcompiler/source/HelpCompiler.cxx index 70159a2c65fd..8be6842fd3a1 100644 --- a/helpcompiler/source/HelpCompiler.cxx +++ b/helpcompiler/source/HelpCompiler.cxx @@ -240,6 +240,8 @@ xmlNodePtr HelpCompiler::clone(xmlNodePtr node, const std::string& appl) return root; } +namespace { + class myparser { public: @@ -265,6 +267,8 @@ private: std::string dump(xmlNodePtr node); }; +} + std::string myparser::dump(xmlNodePtr node) { std::string app; diff --git a/helpcompiler/source/HelpLinker.cxx b/helpcompiler/source/HelpLinker.cxx index 44444902eb71..cad47dad0b08 100644 --- a/helpcompiler/source/HelpLinker.cxx +++ b/helpcompiler/source/HelpLinker.cxx @@ -122,6 +122,8 @@ void IndexerPreProcessor::processDocument } } +namespace { + struct Data { std::vector<std::string> _idList; @@ -140,6 +142,8 @@ struct Data } }; +} + static void writeKeyValue_DBHelp( FILE* pFile, const std::string& aKeyStr, const std::string& aValueStr ) { if( pFile == nullptr ) @@ -164,6 +168,8 @@ static void writeKeyValue_DBHelp( FILE* pFile, const std::string& aKeyStr, const fprintf(stderr, "fwrite to db failed\n"); } +namespace { + class HelpKeyword { private: @@ -190,6 +196,8 @@ public: } }; +} + namespace URLEncoder { static std::string encode(const std::string &rIn) diff --git a/hwpfilter/source/attributes.cxx b/hwpfilter/source/attributes.cxx index 533769d879ac..f9e33b1f40f7 100644 --- a/hwpfilter/source/attributes.cxx +++ b/hwpfilter/source/attributes.cxx @@ -22,6 +22,8 @@ #include <vector> #include "attributes.hxx" +namespace { + struct TagAttribute { TagAttribute( const OUString &rName, const OUString &rType , const OUString &rValue ) @@ -36,6 +38,8 @@ struct TagAttribute OUString sValue; }; +} + struct AttributeListImpl_impl { AttributeListImpl_impl() diff --git a/hwpfilter/source/fontmap.cxx b/hwpfilter/source/fontmap.cxx index 52fffd8f910a..fcd6c4822169 100644 --- a/hwpfilter/source/fontmap.cxx +++ b/hwpfilter/source/fontmap.cxx @@ -27,12 +27,17 @@ #include <sal/types.h> #include "fontmap.hxx" +namespace { + struct FontEntry { const char *familyname; int key; double ratio; }; + +} + /** * ratio\xb4\xc2 \xc7\xd1\xb1\xdb 70%, \xbc\xfd\xc0\xda 10% \xbf\xb5\xb9\xae 20%\xc0\xc7 \xba\xf1\xc0\xb2\xb7\xce \xb1\xb8\xbc\xba\xb5\xc7\xbe\xfa\xb4\xd9\xb4\xc2 \xb0\xa1\xc1\xa4\xc7\xcf\xbf\xa1 \xc1\xa4\xc7\xd8\xc1\xf8\xb4\xd9. */ diff --git a/hwpfilter/source/hcode.cxx b/hwpfilter/source/hcode.cxx index fda36e0953ca..99885d00460b 100644 --- a/hwpfilter/source/hcode.cxx +++ b/hwpfilter/source/hcode.cxx @@ -653,12 +653,17 @@ static const hchar jamo_to_unicode[] = 0x11f6, 0x11f7, 0x11f8, 0x11f9 }; +namespace { + struct JamoComp{ int size; hchar v1; hchar v2; hchar v3; }; + +} + /* 704 + 12 = 706 */ static const JamoComp jamocomp1_to_unicode[] = { diff --git a/hwpfilter/source/hstyle.cxx b/hwpfilter/source/hstyle.cxx index e0573edf9cad..e80a9c1a8b0d 100644 --- a/hwpfilter/source/hstyle.cxx +++ b/hwpfilter/source/hstyle.cxx @@ -30,6 +30,8 @@ enum #define DATA static_cast<StyleData *>(style) +namespace { + struct StyleData { char name[MAXSTYLENAME + 1]; @@ -37,6 +39,8 @@ struct StyleData ParaShape pshape; }; +} + static char buffer[MAXSTYLENAME + 1]; HWPStyle::HWPStyle() diff --git a/hwpfilter/source/hwpeq.cxx b/hwpfilter/source/hwpeq.cxx index d3bd46207469..00cf2182866c 100644 --- a/hwpfilter/source/hwpeq.cxx +++ b/hwpfilter/source/hwpeq.cxx @@ -68,6 +68,8 @@ enum { SCRIPT_NONE, SCRIPT_SUB, SCRIPT_SUP, SCRIPT_ALL}; static int eq_word(MzString& outs, istream *strm, int script = SCRIPT_NONE); static bool eq_sentence(MzString& outs, istream *strm, const char *end = nullptr); +namespace { + struct hwpeq { const char *key; // hwp math keyword const char *latex; // corresponding latex keyword @@ -75,6 +77,8 @@ struct hwpeq { unsigned char flag; // case sensitive? }; +} + static const hwpeq eq_tbl[] = { { "!=", "\\equiv ", 0, 0 }, { "#", "\\\\", 0, 0 }, @@ -452,6 +456,8 @@ static void make_keyword( char *keyword, const char *token) } } +namespace { + // token reading function struct eq_stack { MzString white; @@ -465,6 +471,8 @@ struct eq_stack { } }; +} + static eq_stack *stk = nullptr; static void push_token(MzString const &white, MzString const &token, istream *strm) diff --git a/hwpfilter/source/hwpreader.cxx b/hwpfilter/source/hwpreader.cxx index 4144d20e0bde..51f072fed4ad 100644 --- a/hwpfilter/source/hwpreader.cxx +++ b/hwpfilter/source/hwpreader.cxx @@ -927,6 +927,7 @@ void HwpReader::makeAutoStyles() rendEl("office:automatic-styles"); } +namespace { struct PageSetting { @@ -951,6 +952,8 @@ struct PageSetting bool bIsSet; }; +} + void HwpReader::makeMasterStyles() { rstartEl("office:master-styles", mxList.get()); diff --git a/hwpfilter/source/lexer.cxx b/hwpfilter/source/lexer.cxx index d70d81a92923..829431cfcc50 100644 --- a/hwpfilter/source/lexer.cxx +++ b/hwpfilter/source/lexer.cxx @@ -89,8 +89,12 @@ /* Size of default input buffer. */ #define YY_BUF_SIZE 16384 +namespace { + typedef struct yy_buffer_state *YY_BUFFER_STATE; +} + #define EOB_ACT_CONTINUE_SCAN 0 #define EOB_ACT_END_OF_FILE 1 #define EOB_ACT_LAST_MATCH 2 @@ -103,6 +107,7 @@ typedef struct yy_buffer_state *YY_BUFFER_STATE; */ typedef unsigned int yy_size_t; +namespace { struct yy_buffer_state { @@ -161,6 +166,8 @@ struct yy_buffer_state #define YY_BUFFER_EOF_PENDING 2 }; +} + static YY_BUFFER_STATE yy_current_buffer = nullptr; /* We provide macros for accessing buffer states in case in the diff --git a/i18nlangtag/source/isolang/isolang.cxx b/i18nlangtag/source/isolang/isolang.cxx index 3d8da21708b1..60fbe5ff4e0a 100644 --- a/i18nlangtag/source/isolang/isolang.cxx +++ b/i18nlangtag/source/isolang/isolang.cxx @@ -104,6 +104,8 @@ struct Bcp47CountryEntry css::lang::Locale getLocale() const; }; +namespace { + struct IsoLangEngEntry { LanguageType mnLang; @@ -123,6 +125,7 @@ struct IsoLangOtherEntry const sal_Char* mpLanguage; }; +} // Entries for languages are lower case, for countries upper case, as // recommended by rfc5646 (obsoletes rfc4646 (obsoletes rfc3066 (obsoletes @@ -1412,6 +1415,7 @@ LanguageType MsLangId::Conversion::convertIsoNamesToLanguage( const OString& rLa return convertIsoNamesToLanguage( aLang, aCountry, false); } +namespace { struct IsoLangGLIBCModifiersEntry { @@ -1421,6 +1425,8 @@ struct IsoLangGLIBCModifiersEntry sal_Char maAtString[9]; }; +} + static IsoLangGLIBCModifiersEntry const aImplIsoLangGLIBCModifiersEntries[] = { // MS-LANGID codes ISO639-1/2/3 ISO3166 glibc modifier diff --git a/i18nlangtag/source/languagetag/languagetag.cxx b/i18nlangtag/source/languagetag/languagetag.cxx index 7f580dfc9dd3..ef47e54579bc 100644 --- a/i18nlangtag/source/languagetag/languagetag.cxx +++ b/i18nlangtag/source/languagetag/languagetag.cxx @@ -33,6 +33,7 @@ using namespace com::sun::star; +namespace { // Helper to ensure lt_error_t is free'd struct myLtError @@ -43,7 +44,6 @@ struct myLtError }; // "statics" to be returned as const reference to an empty locale and string. -namespace { struct theEmptyLocale : public rtl::Static< lang::Locale, theEmptyLocale > {}; struct theEmptyBcp47 : public rtl::Static< OUString, theEmptyBcp47 > {}; } @@ -141,6 +141,7 @@ bool LanguageTag::isOnTheFlyID( LanguageType nLang ) LANGUAGE_ON_THE_FLY_SUB_START <= nSub && nSub <= LANGUAGE_ON_THE_FLY_SUB_END; } +namespace { /** A reference holder for liblangtag data de/initialization, one static instance. Currently implemented such that the first "ref" inits and dtor @@ -165,7 +166,6 @@ private: static void teardown(); }; -namespace { struct theDataRef : public rtl::Static< LiblangtagDataRef, theDataRef > {}; } diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index e1675ec6a41d..93f81fa9cc6c 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -58,6 +58,8 @@ BreakIterator_Unicode::~BreakIterator_Unicode() { } +namespace { + /* Wrapper class to provide public access to the icu::RuleBasedBreakIterator's setbreakType method. @@ -79,6 +81,8 @@ class OOoRuleBasedBreakIterator : public icu::RuleBasedBreakIterator }; +} + // loading ICU breakiterator on demand. void BreakIterator_Unicode::loadICUBreakIterator(const css::lang::Locale& rLocale, sal_Int16 rBreakType, sal_Int16 nWordType, const sal_Char *rule, const OUString& rText) diff --git a/i18npool/source/calendar/calendar_jewish.cxx b/i18npool/source/calendar/calendar_jewish.cxx index 996d01d73f49..549bae3c12aa 100644 --- a/i18npool/source/calendar/calendar_jewish.cxx +++ b/i18npool/source/calendar/calendar_jewish.cxx @@ -128,6 +128,7 @@ static sal_Int32 LastDayOfHebrewMonth(sal_Int32 month, sal_Int32 year) { return 30; } +namespace { class HebrewDate { private: @@ -187,6 +188,8 @@ public: }; +} + // Gregorian dates static int LastDayOfGregorianMonth(int month, int year) { @@ -207,6 +210,8 @@ static int LastDayOfGregorianMonth(int month, int year) { } } +namespace { + class GregorianDate { private: int year; // 1... @@ -246,6 +251,8 @@ public: }; +} + // map field value from gregorian calendar to other calendar, it can be overwritten by derived class. void Calendar_jewish::mapFromGregorian() { diff --git a/i18npool/source/localedata/LocaleNode.cxx b/i18npool/source/localedata/LocaleNode.cxx index 273d40698a8f..80972f61092c 100644 --- a/i18npool/source/localedata/LocaleNode.cxx +++ b/i18npool/source/localedata/LocaleNode.cxx @@ -1966,10 +1966,15 @@ void LCTransliterationNode::generateCode (const OFileWriter &of) const of.writeFunction("getTransliterations_", "nbOfTransliterations", "LCTransliterationsArray"); } +namespace { + struct NameValuePair { const sal_Char *name; const sal_Char *value; }; + +} + static const NameValuePair ReserveWord[] = { { "trueWord", "true" }, { "falseWord", "false" }, diff --git a/i18npool/source/localedata/localedata.cxx b/i18npool/source/localedata/localedata.cxx index 0679407cc81b..91e4c5de21bb 100644 --- a/i18npool/source/localedata/localedata.cxx +++ b/i18npool/source/localedata/localedata.cxx @@ -1318,6 +1318,8 @@ LocaleDataImpl::getContinuousNumberingLevels( const lang::Locale& rLocale ) // OutlineNumbering helper class +namespace { + struct OutlineNumberingLevel_Impl { OUString sPrefix; @@ -1351,6 +1353,8 @@ public: virtual sal_Bool SAL_CALL hasElements( ) override; }; +} + Sequence< Reference<container::XIndexAccess> > LocaleDataImpl::getOutlineNumberingLevels( const lang::Locale& rLocale ) { diff --git a/i18npool/source/localedata/saxparser.cxx b/i18npool/source/localedata/saxparser.cxx index ace747d8286f..e667f523316c 100644 --- a/i18npool/source/localedata/saxparser.cxx +++ b/i18npool/source/localedata/saxparser.cxx @@ -46,6 +46,7 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::xml::sax; using namespace ::com::sun::star::io; +namespace { /************ * Sequence of bytes -> InputStream @@ -88,6 +89,7 @@ public: Sequence< sal_Int8> m_seq; }; +} // Helper : create an input stream from a file @@ -135,6 +137,7 @@ static Reference< XInputStream > createStreamFromFile( return r; } +namespace { class TestDocumentHandler : public WeakImplHelper< XExtendedDocumentHandler , XEntityResolver , XErrorHandler > @@ -292,6 +295,7 @@ public: OFileWriter of; }; +} SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) { diff --git a/i18npool/source/nativenumber/nativenumbersupplier.cxx b/i18npool/source/nativenumber/nativenumbersupplier.cxx index c19e6521d347..89d56a97826d 100644 --- a/i18npool/source/nativenumber/nativenumbersupplier.cxx +++ b/i18npool/source/nativenumber/nativenumbersupplier.cxx @@ -38,6 +38,8 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::i18n; using namespace ::com::sun::star::lang; +namespace { + struct Number { sal_Int16 number; const sal_Unicode *multiplierChar; @@ -46,6 +48,7 @@ struct Number { const sal_Int16 *multiplierExponent; }; +} #define NUMBER_OMIT_ZERO (1 << 0) #define NUMBER_OMIT_ONLY_ZERO (1 << 1) @@ -65,8 +68,12 @@ struct Number { namespace i18npool { +namespace { + struct theNatNumMutex : public rtl::Static<osl::Mutex, theNatNumMutex> {}; +} + static OUString getHebrewNativeNumberString(const OUString& aNumberString, bool useGeresh); static OUString getCyrillicNativeNumberString(const OUString& aNumberString); @@ -981,10 +988,16 @@ sal_Int16 SAL_CALL NativeNumberSupplierService::convertFromXmlAttributes( const // see numerical system in the Hebrew Numbering System in following link for details, // http://smontagu.org/writings/HebrewNumbers.html +namespace { + struct HebrewNumberChar { sal_Unicode code; sal_Int16 value; -} const HebrewNumberCharArray[] = { +}; + +} + +HebrewNumberChar const HebrewNumberCharArray[] = { { 0x05ea, 400 }, { 0x05ea, 400 }, { 0x05e9, 300 }, @@ -1089,10 +1102,16 @@ static const sal_Unicode cyrillicThousandsMark = 0x0482; static const sal_Unicode cyrillicTitlo = 0x0483; static const sal_Unicode cyrillicTen = 0x0456; +namespace { + struct CyrillicNumberChar { sal_Unicode code; sal_Int16 value; -} const CyrillicNumberCharArray[] = { +}; + +} + +CyrillicNumberChar const CyrillicNumberCharArray[] = { { 0x0446, 900 }, { 0x047f, 800 }, { 0x0471, 700 }, diff --git a/i18npool/source/registerservices/registerservices.cxx b/i18npool/source/registerservices/registerservices.cxx index dd891558696d..eb71012e90eb 100644 --- a/i18npool/source/registerservices/registerservices.cxx +++ b/i18npool/source/registerservices/registerservices.cxx @@ -247,11 +247,17 @@ IMPL_CREATEINSTANCE( halfwidthKatakanaToFullwidthKatakana ) IMPL_CREATEINSTANCE( fullwidthToHalfwidthLikeASC ) IMPL_CREATEINSTANCE( halfwidthToFullwidthLikeJIS ) -static const struct InstancesArray { +namespace { + +struct InstancesArray { const sal_Char* pServiceNm; const sal_Char* pImplementationNm; FN_CreateInstance pFn; -} aInstances[] = { +}; + +} + +static const InstancesArray aInstances[] = { { "com.sun.star.i18n.IndexEntrySupplier", "com.sun.star.i18n.IndexEntrySupplier", &IndexEntrySupplier_CreateInstance }, diff --git a/i18npool/source/textconversion/genconv_dict.cxx b/i18npool/source/textconversion/genconv_dict.cxx index 4173d898622d..8cebdb7f1a52 100644 --- a/i18npool/source/textconversion/genconv_dict.cxx +++ b/i18npool/source/textconversion/genconv_dict.cxx @@ -319,6 +319,7 @@ void make_stc_char(FILE *sfp, FILE *cfp) fprintf (cfp, "\tconst sal_Unicode* getSTC_CharData_T2S() { return STC_CharData_T2S; }\n"); } +namespace { struct Index { sal_uInt16 address; @@ -326,6 +327,8 @@ struct Index { sal_Unicode *data; }; +} + extern "C" { static int Index_comp(const void* s1, const void* s2) { diff --git a/i18nutil/source/utility/paper.cxx b/i18nutil/source/utility/paper.cxx index 6b59399e9124..a8476334622e 100644 --- a/i18nutil/source/utility/paper.cxx +++ b/i18nutil/source/utility/paper.cxx @@ -39,6 +39,8 @@ #endif #endif +namespace { + struct PageDesc { long m_nWidth; @@ -47,6 +49,8 @@ struct PageDesc const char *m_pAltPSName; }; +} + #define PT2MM100( v ) \ long(((v) * 35.27777778) + 0.5) diff --git a/idl/source/prj/database.cxx b/idl/source/prj/database.cxx index 2629c2d457cb..7613e0a59c6d 100644 --- a/idl/source/prj/database.cxx +++ b/idl/source/prj/database.cxx @@ -500,6 +500,8 @@ void SvIdlDataBase::AddDepFile(OUString const& rFileName) m_DepFiles.insert(rFileName); } +namespace { + struct WriteDep { SvFileStream & m_rStream; @@ -524,6 +526,8 @@ struct WriteDummy } }; +} + void SvIdlDataBase::WriteDepFile( SvFileStream & rStream, OUString const& rTarget) { diff --git a/idlc/source/idlc.cxx b/idlc/source/idlc.cxx index cd532f91320f..61190845f1ba 100644 --- a/idlc/source/idlc.cxx +++ b/idlc/source/idlc.cxx @@ -282,6 +282,8 @@ static void lcl_writeString(::osl::File & rFile, ::osl::FileBase::RC & o_rRC, } } +namespace { + struct WriteDep { ::osl::File& m_rFile; @@ -310,6 +312,8 @@ struct WriteDummy } }; +} + bool Idlc::dumpDeps(OString const& rDepFile, OString const& rTarget) { diff --git a/io/source/TextInputStream/TextInputStream.cxx b/io/source/TextInputStream/TextInputStream.cxx index d90f30976ec8..fc860b1063b1 100644 --- a/io/source/TextInputStream/TextInputStream.cxx +++ b/io/source/TextInputStream/TextInputStream.cxx @@ -55,6 +55,8 @@ namespace io_TextInputStream #define INITIAL_UNICODE_BUFFER_CAPACITY 0x100 #define READ_BYTE_COUNT 0x100 +namespace { + class OTextInputStream : public WeakImplHelper< XTextInputStream2, XServiceInfo > { Reference< XInputStream > mxStream; @@ -105,6 +107,8 @@ public: virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; }; +} + OTextInputStream::OTextInputStream() : mbEncodingInitialized(false) , mConvText2Unicode(nullptr) diff --git a/io/source/TextOutputStream/TextOutputStream.cxx b/io/source/TextOutputStream/TextOutputStream.cxx index 22fab1f01bd0..5f39c8afbb5e 100644 --- a/io/source/TextOutputStream/TextOutputStream.cxx +++ b/io/source/TextOutputStream/TextOutputStream.cxx @@ -47,6 +47,8 @@ namespace io_TextOutputStream // Implementation XTextOutputStream +namespace { + class OTextOutputStream : public WeakImplHelper< XTextOutputStream2, XServiceInfo > { Reference< XOutputStream > mxStream; @@ -83,6 +85,8 @@ public: virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; }; +} + OTextOutputStream::OTextOutputStream() : mbEncodingInitialized(false) , mConvUnicode2Text(nullptr) diff --git a/io/source/acceptor/acc_pipe.cxx b/io/source/acceptor/acc_pipe.cxx index ad9ce09a20cb..b06b0aa678bc 100644 --- a/io/source/acceptor/acc_pipe.cxx +++ b/io/source/acceptor/acc_pipe.cxx @@ -37,6 +37,7 @@ using namespace ::com::sun::star::io; namespace io_acceptor { + namespace { class PipeConnection : public WeakImplHelper< XConnection > @@ -55,6 +56,7 @@ namespace io_acceptor OUString m_sDescription; }; + } PipeConnection::PipeConnection( const OUString &sConnectionDescription) : m_nStatus( 0 ), diff --git a/io/source/acceptor/acc_socket.cxx b/io/source/acceptor/acc_socket.cxx index a72179ecb356..9700cd566bb8 100644 --- a/io/source/acceptor/acc_socket.cxx +++ b/io/source/acceptor/acc_socket.cxx @@ -41,6 +41,7 @@ namespace io_acceptor { typedef std::unordered_set< css::uno::Reference< css::io::XStreamListener> > XStreamListener_hash_set; + namespace { class SocketConnection : public ::cppu::WeakImplHelper< css::connection::XConnection, @@ -75,6 +76,8 @@ namespace io_acceptor { XStreamListener_hash_set _listeners; }; + } + template<class T> static void notifyListeners(SocketConnection * pCon, bool * notified, T t) { @@ -98,6 +101,8 @@ namespace io_acceptor { xStreamListener->started(); } + namespace { + struct callError { const Any & any; @@ -106,6 +111,8 @@ namespace io_acceptor { void operator () (const Reference<XStreamListener>& xStreamListener); }; + } + callError::callError(const Any & aAny) : any(aAny) { diff --git a/io/source/acceptor/acceptor.cxx b/io/source/acceptor/acceptor.cxx index 217c23b9a845..d1f2bb54bf40 100644 --- a/io/source/acceptor/acceptor.cxx +++ b/io/source/acceptor/acceptor.cxx @@ -46,6 +46,8 @@ using namespace ::com::sun::star::connection; namespace io_acceptor { + namespace { + class OAcceptor : public WeakImplHelper< XAcceptor, XServiceInfo > { public: @@ -73,6 +75,7 @@ namespace io_acceptor Reference<XAcceptor> _xAcceptor; }; + } OAcceptor::OAcceptor( const Reference< XComponentContext > & xCtx ) : m_bInAccept( false ) @@ -85,6 +88,8 @@ namespace io_acceptor m_pPipe.reset(); } + namespace { + struct BeingInAccept { /// @throws AlreadyAcceptingException @@ -102,6 +107,8 @@ namespace io_acceptor bool *m_pFlag; }; + } + Reference< XConnection > OAcceptor::accept( const OUString &sConnectionDescription ) { // if there is a thread already accepting in this object, throw an exception. diff --git a/io/source/connector/connector.cxx b/io/source/connector/connector.cxx index c21a34d17eac..0f4792f3aa8e 100644 --- a/io/source/connector/connector.cxx +++ b/io/source/connector/connector.cxx @@ -45,6 +45,8 @@ using namespace ::com::sun::star::connection; namespace stoc_connector { + namespace { + class OConnector : public WeakImplHelper< XConnector, XServiceInfo > { Reference< XMultiComponentFactory > _xSMgr; @@ -62,6 +64,8 @@ namespace stoc_connector virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; }; + } + OConnector::OConnector(const Reference< XComponentContext > &xCtx) : _xSMgr( xCtx->getServiceManager() ) , _xCtx( xCtx ) diff --git a/io/source/connector/ctr_socket.cxx b/io/source/connector/ctr_socket.cxx index ada34a6e2016..164cd4f6f31c 100644 --- a/io/source/connector/ctr_socket.cxx +++ b/io/source/connector/ctr_socket.cxx @@ -53,6 +53,8 @@ namespace stoc_connector { xStreamListener->started(); } + namespace { + struct callError { const Any & any; @@ -61,6 +63,8 @@ namespace stoc_connector { void operator () (const Reference<XStreamListener>& xStreamListener); }; + } + callError::callError(const Any & aAny) : any(aAny) { diff --git a/io/source/stm/odata.cxx b/io/source/stm/odata.cxx index 0c1dd29f9bb1..6ffd12c89387 100644 --- a/io/source/stm/odata.cxx +++ b/io/source/stm/odata.cxx @@ -49,6 +49,8 @@ using namespace ::com::sun::star::lang; namespace io_stm { +namespace { + class ODataInputStream : public WeakImplHelper < XDataInputStream, @@ -106,6 +108,8 @@ protected: bool m_bValidStream; }; +} + // XInputStream sal_Int32 ODataInputStream::readBytes(Sequence< sal_Int8 >& aData, sal_Int32 nBytesToRead) { @@ -428,6 +432,7 @@ Sequence<OUString> ODataInputStream_getSupportedServiceNames() return aRet; } +namespace { class ODataOutputStream : public WeakImplHelper < @@ -480,6 +485,8 @@ protected: bool m_bValidStream; }; +} + // XOutputStream void ODataOutputStream::writeBytes(const Sequence< sal_Int8 >& aData) { @@ -732,6 +739,7 @@ Sequence<OUString> ODataOutputStream_getSupportedServiceNames() return aRet; } +namespace { struct equalObjectContainer_Impl { @@ -751,6 +759,8 @@ struct hashObjectContainer_Impl } }; +} + typedef std::unordered_map < Reference< XInterface >, @@ -759,6 +769,8 @@ typedef std::unordered_map equalObjectContainer_Impl > ObjectContainer_Impl; +namespace { + class OObjectOutputStream: public ImplInheritanceHelper< ODataOutputStream, /* parent */ @@ -827,6 +839,8 @@ private: bool m_bValidMarkable; }; +} + void OObjectOutputStream::writeObject( const Reference< XPersistObject > & xPObj ) { @@ -998,6 +1012,8 @@ Sequence< OUString > OObjectOutputStream::getSupportedServiceNames() return OObjectOutputStream_getSupportedServiceNames(); } +namespace { + class OObjectInputStream: public ImplInheritanceHelper< ODataInputStream, /* parent */ @@ -1073,6 +1089,8 @@ private: }; +} + Reference< XPersistObject > OObjectInputStream::readObject() { // check if chain contains a XMarkableStream diff --git a/io/source/stm/omark.cxx b/io/source/stm/omark.cxx index 19191e4a957b..7623392b4277 100644 --- a/io/source/stm/omark.cxx +++ b/io/source/stm/omark.cxx @@ -52,6 +52,8 @@ using namespace ::com::sun::star::lang; namespace io_stm { +namespace { + /*********************** * * OMarkableOutputStream. @@ -122,6 +124,8 @@ private: Mutex m_mutex; }; +} + OMarkableOutputStream::OMarkableOutputStream( ) : m_bValidStream(false) , m_pBuffer( new MemRingBuffer ) @@ -386,6 +390,7 @@ Sequence<OUString> OMarkableOutputStream_getSupportedServiceNames() // XMarkableInputStream +namespace { class OMarkableInputStream : public WeakImplHelper @@ -448,6 +453,8 @@ private: Mutex m_mutex; }; +} + OMarkableInputStream::OMarkableInputStream() : m_bValidStream(false) , m_nCurrentPos(0) diff --git a/io/source/stm/opipe.cxx b/io/source/stm/opipe.cxx index 4815a69bc862..07331472d5e5 100644 --- a/io/source/stm/opipe.cxx +++ b/io/source/stm/opipe.cxx @@ -52,6 +52,8 @@ namespace com::sun::star::uno { class XComponentContext; } namespace io_stm{ +namespace { + class OPipeImpl : public WeakImplHelper< XPipe , XConnectable , XServiceInfo > { @@ -98,6 +100,7 @@ private: std::unique_ptr<MemFIFO> m_pFIFO; }; +} OPipeImpl::OPipeImpl() : m_nBytesToSkip(0 ) diff --git a/io/source/stm/opump.cxx b/io/source/stm/opump.cxx index fc6ba14c8488..29f09bdd3e81 100644 --- a/io/source/stm/opump.cxx +++ b/io/source/stm/opump.cxx @@ -46,6 +46,8 @@ using namespace com::sun::star::io; namespace io_stm { + namespace { + class Pump : public WeakImplHelper< XActiveDataSource, XActiveDataSink, XActiveDataControl, XConnectable, XServiceInfo > { @@ -98,6 +100,8 @@ namespace io_stm { virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; }; + } + Pump::Pump() : m_aThread( nullptr ), m_cnt( m_aMutex ), m_closeFired( false ) diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx index f703fb4c200b..3afa7fcbbd07 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util.cxx @@ -193,6 +193,7 @@ rtl::Bootstrap * getBootstrap() InitBootstrap(), ::osl::GetGlobalMutex(), InitBootstrapData()); } +namespace { class FileHandleGuard { @@ -211,6 +212,8 @@ private: oslFileHandle & m_rHandle; }; +} + inline FileHandleGuard::~FileHandleGuard() { if (m_rHandle != nullptr) @@ -222,6 +225,7 @@ inline FileHandleGuard::~FileHandleGuard() } } +namespace { class FileHandleReader { @@ -248,6 +252,8 @@ private: bool m_bLf; }; +} + FileHandleReader::Result FileHandleReader::readLine(OString * pLine) { @@ -304,6 +310,8 @@ FileHandleReader::readLine(OString * pLine) } } +namespace { + class AsynchReader: public salhelper::Thread { size_t m_nDataSize; @@ -326,6 +334,8 @@ public: OString getData(); }; +} + AsynchReader::AsynchReader(oslFileHandle & rHandle): Thread("jvmfwkAsyncReader"), m_nDataSize(0), m_aGuard(rHandle) diff --git a/libreofficekit/qa/gtktiledviewer/gtv-application.cxx b/libreofficekit/qa/gtktiledviewer/gtv-application.cxx index b6598991f44b..fcbd57dda73e 100644 --- a/libreofficekit/qa/gtktiledviewer/gtv-application.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtv-application.cxx @@ -14,11 +14,15 @@ #include <string> +namespace { + struct GtvApplicationPrivate { GtvRenderingArgs* m_pRenderingArgs; }; +} + #if defined __clang__ #if __has_warning("-Wdeprecated-volatile") #pragma clang diagnostic push diff --git a/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx b/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx index 7e6e14d0a9d9..c28349046cb6 100644 --- a/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtv-calc-header-bar.cxx @@ -21,6 +21,8 @@ #include <boost/property_tree/json_parser.hpp> #include <boost/optional.hpp> +namespace { + struct GtvCalcHeaderBarPrivateImpl { /// Stores size and content of a single row header. @@ -52,6 +54,8 @@ struct GtvCalcHeaderBarPrivate } }; +} + #if defined __clang__ #if __has_warning("-Wdeprecated-volatile") #pragma clang diagnostic push diff --git a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx index 3c9e68747074..fcb336fb248b 100644 --- a/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtv-lok-dialog.cxx @@ -28,6 +28,8 @@ #include <map> #include <boost/property_tree/json_parser.hpp> +namespace { + struct GtvLokDialogPrivate { LOKDocView* lokdocview; @@ -54,6 +56,8 @@ struct GtvLokDialogPrivate guint dialogid; }; +} + #if defined __clang__ #if __has_warning("-Wdeprecated-volatile") #pragma clang diagnostic push diff --git a/libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx b/libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx index bdb1192f94da..cdbb236a600a 100644 --- a/libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx +++ b/libreofficekit/qa/gtktiledviewer/gtv-main-toolbar.cxx @@ -22,6 +22,8 @@ #include <boost/property_tree/json_parser.hpp> #include <boost/optional.hpp> +namespace { + struct GtvMainToolbarPrivateImpl { GtkWidget* toolbar1; @@ -66,6 +68,8 @@ struct GtvMainToolbarPrivate } }; +} + #if defined __clang__ #if __has_warning("-Wdeprecated-volatile") #pragma clang diagnostic push diff --git a/libreofficekit/qa/tilebench/tilebench.cxx b/libreofficekit/qa/tilebench/tilebench.cxx index 2a8142de9a7c..aceed1fa59b2 100644 --- a/libreofficekit/qa/tilebench/tilebench.cxx +++ b/libreofficekit/qa/tilebench/tilebench.cxx @@ -48,6 +48,9 @@ static double getTimeNow() } static double origin; + +namespace { + struct TimeRecord { const char *mpName; double mfTime; @@ -59,6 +62,9 @@ struct TimeRecord { fprintf(stderr, "%3.3fs - %s\n", (mfTime - origin), mpName); } }; + +} + static std::vector< TimeRecord > aTimes; /// Dump an array (or sub-array) of RGBA or BGRA to an RGB PPM file. diff --git a/lingucomponent/source/languageguessing/guesslang.cxx b/lingucomponent/source/languageguessing/guesslang.cxx index 89e16dcfd19b..a5695bb8dd69 100644 --- a/lingucomponent/source/languageguessing/guesslang.cxx +++ b/lingucomponent/source/languageguessing/guesslang.cxx @@ -72,6 +72,8 @@ static osl::Mutex & GetLangGuessMutex() return aMutex; } +namespace { + class LangGuess_Impl : public ::cppu::WeakImplHelper< XLanguageGuessing, @@ -107,6 +109,8 @@ public: void SetFingerPrintsDB( const OUString &fileName ); }; +} + LangGuess_Impl::LangGuess_Impl() : m_bInitialized( false ) { diff --git a/lingucomponent/source/languageguessing/simpleguesser.cxx b/lingucomponent/source/languageguessing/simpleguesser.cxx index 3220935e1688..76b3b65c3632 100644 --- a/lingucomponent/source/languageguessing/simpleguesser.cxx +++ b/lingucomponent/source/languageguessing/simpleguesser.cxx @@ -68,6 +68,8 @@ static int startsAsciiCaseInsensitive(const std::string &s1, const std::string & return ret; } +namespace { + /** * This following structure is from textcat.c */ @@ -83,6 +85,8 @@ typedef struct textcat_t{ } textcat_t; // end of the 3 structs +} + SimpleGuesser::SimpleGuesser() { h = nullptr; diff --git a/lingucomponent/source/numbertext/numbertext.cxx b/lingucomponent/source/numbertext/numbertext.cxx index fea2cb50e2c7..7ea2db473b04 100644 --- a/lingucomponent/source/numbertext/numbertext.cxx +++ b/lingucomponent/source/numbertext/numbertext.cxx @@ -66,6 +66,8 @@ static osl::Mutex& GetNumberTextMutex() return aMutex; } +namespace +{ class NumberText_Impl : public ::cppu::WeakImplHelper<XNumberText, XServiceInfo> { #if ENABLE_LIBNUMBERTEXT @@ -92,6 +94,7 @@ public: const ::css::lang::Locale& rLocale) override; virtual css::uno::Sequence<css::lang::Locale> SAL_CALL getAvailableLanguages() override; }; +} NumberText_Impl::NumberText_Impl() : m_bInitialized(false) diff --git a/linguistic/source/convdicxml.cxx b/linguistic/source/convdicxml.cxx index 979a33ab8464..ccd52688108e 100644 --- a/linguistic/source/convdicxml.cxx +++ b/linguistic/source/convdicxml.cxx @@ -68,6 +68,7 @@ static sal_Int16 GetConversionTypeFromText( const OUString &rText ) return nRes; } +namespace { class ConvDicXMLImportContext : public SvXMLImportContext @@ -154,6 +155,7 @@ public: const OUString & GetLeftText() const { return rEntryContext.GetLeftText(); } }; +} void ConvDicXMLImportContext::characters(const OUString & /*rChars*/) { diff --git a/linguistic/source/lngopt.cxx b/linguistic/source/lngopt.cxx index e2d6d652460a..0bd9883f999e 100644 --- a/linguistic/source/lngopt.cxx +++ b/linguistic/source/lngopt.cxx @@ -78,12 +78,16 @@ LinguOptions::~LinguOptions() } } +namespace { + struct WID_Name { sal_Int32 nWID; const char *pPropertyName; }; +} + //! order of entries is import (see LinguOptions::GetName) //! since the WID is used as index in this table! WID_Name const aWID_Name[] = diff --git a/linguistic/source/misc.cxx b/linguistic/source/misc.cxx index ef64ac9d25b3..eb10b709e21d 100644 --- a/linguistic/source/misc.cxx +++ b/linguistic/source/misc.cxx @@ -58,11 +58,15 @@ using namespace com::sun::star::linguistic2; namespace linguistic { +namespace { + //!! multi-thread safe mutex for all platforms !! struct LinguMutex : public rtl::Static< osl::Mutex, LinguMutex > { }; +} + osl::Mutex & GetLinguMutex() { return LinguMutex::get(); @@ -115,6 +119,8 @@ static sal_Int32 Minimum( sal_Int32 n1, sal_Int32 n2, sal_Int32 n3 ) return std::min(std::min(n1, n2), n3); } +namespace { + class IntArray2D { private: @@ -127,6 +133,8 @@ public: sal_Int32 & Value( int i, int k ); }; +} + IntArray2D::IntArray2D( int nDim1, int nDim2 ) { n1 = nDim1; diff --git a/linguistic/source/spelldsp.cxx b/linguistic/source/spelldsp.cxx index ba0c45f08bc5..42ae281fd917 100644 --- a/linguistic/source/spelldsp.cxx +++ b/linguistic/source/spelldsp.cxx @@ -46,6 +46,7 @@ using namespace com::sun::star::uno; using namespace com::sun::star::linguistic2; using namespace linguistic; +namespace { // ProposalList: list of proposals for misspelled words // The order of strings in the array should be left unchanged because the @@ -73,6 +74,7 @@ public: std::vector< OUString > GetVector() const; }; +} bool ProposalList::HasEntry( const OUString &rText ) const { diff --git a/o3tl/qa/test-lru_map.cxx b/o3tl/qa/test-lru_map.cxx index 5ceec149571c..a03a6bf37200 100644 --- a/o3tl/qa/test-lru_map.cxx +++ b/o3tl/qa/test-lru_map.cxx @@ -182,6 +182,8 @@ void lru_map_test::testLruRemoval() CPPUNIT_ASSERT_EQUAL(700, lru.find(7)->second); } +namespace { + struct TestClassKey { int mA; @@ -210,6 +212,8 @@ struct TestClassKeyHashFunction } }; +} + void lru_map_test::testCustomHash() { // check lru_map with custom hash function diff --git a/o3tl/qa/test-sorted_vector.cxx b/o3tl/qa/test-sorted_vector.cxx index 92fab00cd186..8b335040ee84 100644 --- a/o3tl/qa/test-sorted_vector.cxx +++ b/o3tl/qa/test-sorted_vector.cxx @@ -17,6 +17,7 @@ using namespace ::o3tl; +namespace { // helper class class SwContent @@ -32,6 +33,8 @@ public: } }; +} + class sorted_vector_test : public CppUnit::TestFixture { public: diff --git a/oox/source/drawingml/chart/objectformatter.cxx b/oox/source/drawingml/chart/objectformatter.cxx index ed52ccf5c2b1..b071126be53d 100644 --- a/oox/source/drawingml/chart/objectformatter.cxx +++ b/oox/source/drawingml/chart/objectformatter.cxx @@ -570,6 +570,8 @@ void lclConvertPictureOptions( FillProperties& orFillProps, const PictureOptions struct ObjectFormatterData; +namespace { + class DetailFormatterBase { public: @@ -700,6 +702,8 @@ private: const ObjectTypeFormatEntry& mrEntry; /// Additional settings. }; +} + struct ObjectFormatterData { typedef RefMap< ObjectType, ObjectTypeFormatter > ObjectTypeFormatterMap; diff --git a/oox/source/drawingml/clrscheme.cxx b/oox/source/drawingml/clrscheme.cxx index 47d9426e0646..e1d184f9f413 100644 --- a/oox/source/drawingml/clrscheme.cxx +++ b/oox/source/drawingml/clrscheme.cxx @@ -45,6 +45,8 @@ void ClrMap::setColorMap( sal_Int32 nClrToken, sal_Int32 nMappedClrToken ) maClrMap[ nClrToken ] = nMappedClrToken; } +namespace { + struct find_by_token { explicit find_by_token(sal_Int32 token): @@ -61,6 +63,8 @@ private: sal_Int32 const m_token; }; +} + bool ClrScheme::getColor( sal_Int32 nSchemeClrToken, ::Color& rColor ) const { OSL_ASSERT((nSchemeClrToken & sal_Int32(0xFFFF0000))==0); diff --git a/oox/source/drawingml/customshapegeometry.cxx b/oox/source/drawingml/customshapegeometry.cxx index 20db50d0d865..6b436c05cdb8 100644 --- a/oox/source/drawingml/customshapegeometry.cxx +++ b/oox/source/drawingml/customshapegeometry.cxx @@ -63,13 +63,14 @@ enum FormularCommand FC_VAL }; -} - struct FormularCommandNameTable { const char* pS; FormularCommand const pE; }; + +} + static const FormularCommandNameTable pFormularCommandNameTable[] = { { "*/", FC_MULDIV }, @@ -426,6 +427,8 @@ static EnhancedCustomShapeParameter GetAdjCoordinate( CustomShapeProperties& rCu return aRet; } +namespace { + // CT_GeomGuideList class GeomGuideListContext : public ContextHandler2 { @@ -438,6 +441,8 @@ protected: CustomShapeProperties& mrCustomShapeProperties; }; +} + GeomGuideListContext::GeomGuideListContext( ContextHandler2Helper const & rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< CustomShapeGuide >& rGuideList ) : ContextHandler2( rParent ) , mrGuideList( rGuideList ) @@ -628,6 +633,8 @@ static const OUString& GetGeomGuideName( const OUString& rValue ) return rValue; } +namespace { + // CT_AdjPoint2D class AdjPoint2DContext : public ContextHandler2 { @@ -635,6 +642,8 @@ public: AdjPoint2DContext( ContextHandler2Helper const & rParent, const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D ); }; +} + AdjPoint2DContext::AdjPoint2DContext( ContextHandler2Helper const & rParent, const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D ) : ContextHandler2( rParent ) { @@ -642,6 +651,8 @@ AdjPoint2DContext::AdjPoint2DContext( ContextHandler2Helper const & rParent, con rAdjPoint2D.Second = GetAdjCoordinate( rCustomShapeProperties, rAttribs.getString( XML_y ).get() ); } +namespace { + // CT_XYAdjustHandle class XYAdjustHandleContext : public ContextHandler2 { @@ -654,6 +665,8 @@ protected: CustomShapeProperties& mrCustomShapeProperties; }; +} + XYAdjustHandleContext::XYAdjustHandleContext( ContextHandler2Helper const & rParent, const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle ) : ContextHandler2( rParent ) , mrAdjustHandle( rAdjustHandle ) @@ -692,6 +705,8 @@ ContextHandlerRef XYAdjustHandleContext::onCreateContext( sal_Int32 aElementToke return nullptr; } +namespace { + // CT_PolarAdjustHandle class PolarAdjustHandleContext : public ContextHandler2 { @@ -704,6 +719,8 @@ protected: CustomShapeProperties& mrCustomShapeProperties; }; +} + PolarAdjustHandleContext::PolarAdjustHandleContext( ContextHandler2Helper const & rParent, const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, AdjustHandle& rAdjustHandle ) : ContextHandler2( rParent ) , mrAdjustHandle( rAdjustHandle ) @@ -745,6 +762,8 @@ ContextHandlerRef PolarAdjustHandleContext::onCreateContext( sal_Int32 aElementT return nullptr; } +namespace { + // CT_AdjustHandleList class AdjustHandleListContext : public ContextHandler2 { @@ -757,6 +776,8 @@ protected: CustomShapeProperties& mrCustomShapeProperties; }; +} + AdjustHandleListContext::AdjustHandleListContext( ContextHandler2Helper const & rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< AdjustHandle >& rAdjustHandleList ) : ContextHandler2( rParent ) , mrAdjustHandleList( rAdjustHandleList ) @@ -781,6 +802,8 @@ ContextHandlerRef AdjustHandleListContext::onCreateContext( sal_Int32 aElementTo return nullptr; } +namespace { + // CT_ConnectionSite class ConnectionSiteContext : public ContextHandler2 { @@ -793,6 +816,8 @@ protected: CustomShapeProperties& mrCustomShapeProperties; }; +} + ConnectionSiteContext::ConnectionSiteContext( ContextHandler2Helper const & rParent, const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, ConnectionSite& rConnectionSite ) : ContextHandler2( rParent ) , mrConnectionSite( rConnectionSite ) @@ -808,6 +833,8 @@ ContextHandlerRef ConnectionSiteContext::onCreateContext( sal_Int32 aElementToke return nullptr; } +namespace { + // CT_Path2DMoveTo class Path2DMoveToContext : public ContextHandler2 { @@ -820,6 +847,8 @@ protected: CustomShapeProperties& mrCustomShapeProperties; }; +} + Path2DMoveToContext::Path2DMoveToContext( ContextHandler2Helper const & rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D ) : ContextHandler2( rParent ) , mrAdjPoint2D( rAdjPoint2D ) @@ -834,6 +863,8 @@ ContextHandlerRef Path2DMoveToContext::onCreateContext( sal_Int32 aElementToken, return nullptr; } +namespace { + // CT_Path2DLineTo class Path2DLineToContext : public ContextHandler2 { @@ -846,6 +877,8 @@ protected: CustomShapeProperties& mrCustomShapeProperties; }; +} + Path2DLineToContext::Path2DLineToContext( ContextHandler2Helper const & rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rAdjPoint2D ) : ContextHandler2( rParent ) , mrAdjPoint2D( rAdjPoint2D ) @@ -860,6 +893,8 @@ ContextHandlerRef Path2DLineToContext::onCreateContext( sal_Int32 aElementToken, return nullptr; } +namespace { + // CT_Path2DQuadBezierTo class Path2DQuadBezierToContext : public ContextHandler2 { @@ -874,6 +909,8 @@ protected: CustomShapeProperties& mrCustomShapeProperties; }; +} + Path2DQuadBezierToContext::Path2DQuadBezierToContext( ContextHandler2Helper const & rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rPt1, @@ -893,6 +930,8 @@ ContextHandlerRef Path2DQuadBezierToContext::onCreateContext( sal_Int32 aElement return nullptr; } +namespace { + // CT_Path2DCubicBezierTo class Path2DCubicBezierToContext : public ContextHandler2 { @@ -909,6 +948,8 @@ protected: int nCount; }; +} + Path2DCubicBezierToContext::Path2DCubicBezierToContext( ContextHandler2Helper const & rParent, CustomShapeProperties& rCustomShapeProperties, EnhancedCustomShapeParameterPair& rControlPt1, EnhancedCustomShapeParameterPair& rControlPt2, @@ -930,6 +971,8 @@ ContextHandlerRef Path2DCubicBezierToContext::onCreateContext( sal_Int32 aElemen return nullptr; } +namespace { + // CT_Path2DContext class Path2DContext : public ContextHandler2 { @@ -945,6 +988,8 @@ protected: CustomShapeProperties& mrCustomShapeProperties; }; +} + Path2DContext::Path2DContext( ContextHandler2Helper const & rParent, const AttributeList& rAttribs, CustomShapeProperties& rCustomShapeProperties, std::vector< css::drawing::EnhancedCustomShapeSegment >& rSegments, Path2D& rPath2D ) : ContextHandler2( rParent ) , mrPath2D( rPath2D ) @@ -1127,6 +1172,8 @@ ContextHandlerRef Path2DContext::onCreateContext( sal_Int32 aElementToken, return nullptr; } +namespace { + // CT_Path2DList class Path2DListContext : public ContextHandler2 { @@ -1143,6 +1190,8 @@ protected: std::vector< Path2D >& mrPath2DList; }; +} + Path2DListContext:: Path2DListContext( ContextHandler2Helper const & rParent, CustomShapeProperties& rCustomShapeProperties, std::vector< EnhancedCustomShapeSegment >& rSegments, std::vector< Path2D >& rPath2DList ) : ContextHandler2( rParent ) diff --git a/oox/source/drawingml/diagram/datamodelcontext.cxx b/oox/source/drawingml/diagram/datamodelcontext.cxx index b98d0ee87ccf..3746addb8550 100644 --- a/oox/source/drawingml/diagram/datamodelcontext.cxx +++ b/oox/source/drawingml/diagram/datamodelcontext.cxx @@ -31,6 +31,8 @@ using namespace ::com::sun::star::uno; namespace oox { namespace drawingml { +namespace { + // CT_CxnList class CxnListContext : public ContextHandler2 @@ -320,6 +322,8 @@ private: DiagramDataPtr mpDataModel; }; +} + DataModelContext::DataModelContext( ContextHandler2Helper const & rParent, const DiagramDataPtr & pDataModel ) : ContextHandler2( rParent ) diff --git a/oox/source/drawingml/diagram/layoutnodecontext.cxx b/oox/source/drawingml/diagram/layoutnodecontext.cxx index 3547aad28a7a..35128debddb9 100644 --- a/oox/source/drawingml/diagram/layoutnodecontext.cxx +++ b/oox/source/drawingml/diagram/layoutnodecontext.cxx @@ -34,6 +34,8 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { +namespace { + class IfContext : public LayoutNodeContext { @@ -169,6 +171,8 @@ private: LayoutNode::VarMap & mVariables; }; +} + // CT_LayoutNode LayoutNodeContext::LayoutNodeContext( ContextHandler2Helper const & rParent, const AttributeList& rAttribs, diff --git a/oox/source/drawingml/shape.cxx b/oox/source/drawingml/shape.cxx index 4e574af50869..68f0d3c62b51 100644 --- a/oox/source/drawingml/shape.cxx +++ b/oox/source/drawingml/shape.cxx @@ -347,6 +347,8 @@ void Shape::applyShapeReference( const Shape& rReferencedShape, bool bUseText ) mbLocked = rReferencedShape.mbLocked; } +namespace { + struct ActionLockGuard { explicit ActionLockGuard(Reference<drawing::XShape> const& xShape) @@ -366,6 +368,8 @@ private: Reference<document::XActionLockable> m_xLockable; }; +} + // for group shapes, the following method is also adding each child void Shape::addChildren( XmlFilterBase& rFilterBase, diff --git a/oox/source/drawingml/textbodycontext.cxx b/oox/source/drawingml/textbodycontext.cxx index cbd1e420ee5a..0f8c90ab4c89 100644 --- a/oox/source/drawingml/textbodycontext.cxx +++ b/oox/source/drawingml/textbodycontext.cxx @@ -40,6 +40,8 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { +namespace { + // CT_TextParagraph class TextParagraphContext : public ContextHandler2 { @@ -52,6 +54,8 @@ protected: TextParagraph& mrParagraph; }; +} + TextParagraphContext::TextParagraphContext( ContextHandler2Helper const & rParent, TextParagraph& rPara ) : ContextHandler2( rParent ) , mrParagraph( rPara ) diff --git a/oox/source/drawingml/themeelementscontext.cxx b/oox/source/drawingml/themeelementscontext.cxx index 8c94a9bf74db..3919a3790bd6 100644 --- a/oox/source/drawingml/themeelementscontext.cxx +++ b/oox/source/drawingml/themeelementscontext.cxx @@ -38,6 +38,8 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace drawingml { +namespace { + class FillStyleListContext : public ContextHandler2 { public: @@ -48,6 +50,8 @@ private: FillStyleList& mrFillStyleList; }; +} + FillStyleListContext::FillStyleListContext( ContextHandler2Helper const & rParent, FillStyleList& rFillStyleList ) : ContextHandler2( rParent ), mrFillStyleList( rFillStyleList ) @@ -70,6 +74,8 @@ ContextHandlerRef FillStyleListContext::onCreateContext( sal_Int32 nElement, con return nullptr; } +namespace { + class LineStyleListContext : public ContextHandler2 { public: @@ -80,6 +86,8 @@ private: LineStyleList& mrLineStyleList; }; +} + LineStyleListContext::LineStyleListContext( ContextHandler2Helper const & rParent, LineStyleList& rLineStyleList ) : ContextHandler2( rParent ), mrLineStyleList( rLineStyleList ) @@ -97,6 +105,8 @@ ContextHandlerRef LineStyleListContext::onCreateContext( sal_Int32 nElement, con return nullptr; } +namespace { + class EffectStyleListContext : public ContextHandler2 { public: @@ -107,6 +117,8 @@ private: EffectStyleList& mrEffectStyleList; }; +} + EffectStyleListContext::EffectStyleListContext( ContextHandler2Helper const & rParent, EffectStyleList& rEffectStyleList ) : ContextHandler2( rParent ), mrEffectStyleList( rEffectStyleList ) @@ -129,6 +141,8 @@ ContextHandlerRef EffectStyleListContext::onCreateContext( sal_Int32 nElement, c return nullptr; } +namespace { + class FontSchemeContext : public ContextHandler2 { public: @@ -141,6 +155,8 @@ private: TextCharacterPropertiesPtr mxCharProps; }; +} + FontSchemeContext::FontSchemeContext( ContextHandler2Helper const & rParent, FontScheme& rFontScheme ) : ContextHandler2( rParent ), mrFontScheme( rFontScheme ) diff --git a/oox/source/export/chartexport.cxx b/oox/source/export/chartexport.cxx index 7f0f948a4d85..89513746bcca 100644 --- a/oox/source/export/chartexport.cxx +++ b/oox/source/export/chartexport.cxx @@ -136,8 +136,6 @@ bool isPrimaryAxes(sal_Int32 nIndex) return nIndex != 1; } -} - class lcl_MatchesRole { public: @@ -161,6 +159,8 @@ private: OUString const m_aRole; }; +} + static Reference< chart2::data::XLabeledDataSequence > lcl_getCategories( const Reference< chart2::XDiagram > & xDiagram ) { Reference< chart2::data::XLabeledDataSequence > xResult; diff --git a/oox/source/helper/progressbar.cxx b/oox/source/helper/progressbar.cxx index cf74b0341736..351b8e1422f5 100644 --- a/oox/source/helper/progressbar.cxx +++ b/oox/source/helper/progressbar.cxx @@ -72,6 +72,8 @@ void ProgressBar::setPosition( double fPosition ) namespace prv { +namespace { + class SubSegment : public ISegmentProgressBar { public: @@ -91,6 +93,8 @@ private: double mfFreeStart; }; +} + SubSegment::SubSegment( IProgressBar& rParentProgress, double fStartPos, double fLength ) : mrParentProgress( rParentProgress ), mfStartPos( fStartPos ), diff --git a/oox/source/mathml/import.cxx b/oox/source/mathml/import.cxx index ec338c451638..557f34016148 100644 --- a/oox/source/mathml/import.cxx +++ b/oox/source/mathml/import.cxx @@ -28,6 +28,8 @@ FormulaImportBase::FormulaImportBase() namespace formulaimport { +namespace { + class LazyMathBufferingContext : public core::ContextHandler { private: @@ -47,6 +49,8 @@ public: }; +} + LazyMathBufferingContext::LazyMathBufferingContext( core::ContextHandler const& rParent, drawingml::TextParagraph & rPara) : core::ContextHandler(rParent) diff --git a/oox/source/ppt/customshowlistcontext.cxx b/oox/source/ppt/customshowlistcontext.cxx index 0a8174cd053f..3be796d639d9 100644 --- a/oox/source/ppt/customshowlistcontext.cxx +++ b/oox/source/ppt/customshowlistcontext.cxx @@ -29,6 +29,8 @@ using namespace ::com::sun::star::xml::sax; namespace oox { namespace ppt { +namespace { + class CustomShowContext : public ::oox::core::FragmentHandler2 { CustomShow mrCustomShow; @@ -41,6 +43,8 @@ public: virtual ::oox::core::ContextHandlerRef onCreateContext( sal_Int32 aElementToken, const AttributeList& rAttribs ) override; }; +} + CustomShowContext::CustomShowContext( FragmentHandler2 const & rParent, const Reference< XFastAttributeList >& rxAttribs, CustomShow const & rCustomShow ) diff --git a/oox/source/ppt/timenodelistcontext.cxx b/oox/source/ppt/timenodelistcontext.cxx index b965dfea1b6f..1a69bb97a729 100644 --- a/oox/source/ppt/timenodelistcontext.cxx +++ b/oox/source/ppt/timenodelistcontext.cxx @@ -98,6 +98,8 @@ namespace { namespace oox { namespace ppt { + namespace { + struct AnimColor { AnimColor(sal_Int16 cs, sal_Int32 o, sal_Int32 t, sal_Int32 th ) @@ -897,6 +899,8 @@ namespace oox { namespace ppt { Any maProgress; }; + } + TimeNodeContext * TimeNodeContext::makeContext( FragmentHandler2 const & rParent, sal_Int32 aElement, const Reference< XFastAttributeList >& xAttribs, diff --git a/oox/source/ppt/timetargetelementcontext.cxx b/oox/source/ppt/timetargetelementcontext.cxx index 43f10ee05df9..ab524c513e58 100644 --- a/oox/source/ppt/timetargetelementcontext.cxx +++ b/oox/source/ppt/timetargetelementcontext.cxx @@ -39,6 +39,8 @@ using namespace ::oox::core; namespace oox { namespace ppt { + namespace { + // CT_TLShapeTargetElement class ShapeTargetElementContext : public FragmentHandler2 @@ -97,6 +99,8 @@ namespace oox { namespace ppt { ShapeTargetElement & maShapeTarget; }; + } + TimeTargetElementContext::TimeTargetElementContext( FragmentHandler2 const & rParent, const AnimTargetElementPtr & pValue ) : FragmentHandler2( rParent ), mpTarget( pValue ) diff --git a/oox/source/shape/ShapeFilterBase.cxx b/oox/source/shape/ShapeFilterBase.cxx index 562504090f76..6f96395c2806 100644 --- a/oox/source/shape/ShapeFilterBase.cxx +++ b/oox/source/shape/ShapeFilterBase.cxx @@ -77,6 +77,8 @@ OUString ShapeFilterBase::getImplementationName() return OUString(); } +namespace { + /// Graphic helper for shapes, that can manage color schemes. class ShapeGraphicHelper : public GraphicHelper { @@ -87,6 +89,8 @@ private: const ShapeFilterBase& mrFilter; }; +} + ShapeGraphicHelper::ShapeGraphicHelper( const ShapeFilterBase& rFilter ) : GraphicHelper( rFilter.getComponentContext(), rFilter.getTargetFrame(), rFilter.getStorage() ), mrFilter( rFilter ) diff --git a/package/source/zippackage/ZipPackage.cxx b/package/source/zippackage/ZipPackage.cxx index 63178c7fec24..a7e632472c67 100644 --- a/package/source/zippackage/ZipPackage.cxx +++ b/package/source/zippackage/ZipPackage.cxx @@ -106,6 +106,8 @@ using namespace com::sun::star::packages::zip::ZipConstants; #define THROW_WHERE "" #endif +namespace { + class ActiveDataStreamer : public ::cppu::WeakImplHelper< XActiveDataStreamer > { uno::Reference< XStream > mStream; @@ -136,6 +138,8 @@ class DummyInputStream : public ::cppu::WeakImplHelper< XInputStream > {} }; +} + ZipPackage::ZipPackage ( const uno::Reference < XComponentContext > &xContext ) : m_aMutexHolder( new comphelper::RefCountedMutex ) , m_nStartKeyGenerationID( xml::crypto::DigestID::SHA1 ) diff --git a/pyuno/source/loader/pyuno_loader.cxx b/pyuno/source/loader/pyuno_loader.cxx index ffdb81143961..8f1a0f6a89a3 100644 --- a/pyuno/source/loader/pyuno_loader.cxx +++ b/pyuno/source/loader/pyuno_loader.cxx @@ -175,6 +175,8 @@ static void prependPythonPath( const OUString & pythonPathBootstrap ) osl_setEnvironment(envVar.pData, envValue.pData); } +namespace { + struct PythonInit { PythonInit() { @@ -237,6 +239,8 @@ PythonInit() { } }; +} + static Reference<XInterface> CreateInstance(const Reference<XComponentContext> & ctx) { // tdf#114815 thread-safe static to init python only once diff --git a/pyuno/source/module/pyuno_callable.cxx b/pyuno/source/module/pyuno_callable.cxx index 656d1c84cb0e..9be3e1f1aef8 100644 --- a/pyuno/source/module/pyuno_callable.cxx +++ b/pyuno/source/module/pyuno_callable.cxx @@ -31,6 +31,8 @@ using com::sun::star::script::XInvocation2; namespace pyuno { +namespace { + struct PyUNO_callable_Internals { Reference<XInvocation2> xInvocation; @@ -44,6 +46,8 @@ struct PyUNO_callable PyUNO_callable_Internals* members; }; +} + static void PyUNO_callable_del (PyObject* self) { PyUNO_callable* me; diff --git a/pyuno/source/module/pyuno_gc.cxx b/pyuno/source/module/pyuno_gc.cxx index 1be9cd4ed69b..e4ed6cb9d0a6 100644 --- a/pyuno/source/module/pyuno_gc.cxx +++ b/pyuno/source/module/pyuno_gc.cxx @@ -28,6 +28,9 @@ namespace pyuno { static bool g_destructorsOfStaticObjectsHaveBeenCalled; + +namespace { + class StaticDestructorGuard { public: @@ -36,6 +39,9 @@ public: g_destructorsOfStaticObjectsHaveBeenCalled = true; } }; + +} + static StaticDestructorGuard guard; static bool isAfterUnloadOrPy_Finalize() @@ -44,6 +50,8 @@ static bool isAfterUnloadOrPy_Finalize() !Py_IsInitialized(); } +namespace { + class GCThread: public salhelper::Thread { public: GCThread( PyInterpreterState *interpreter, PyObject * object ); @@ -57,6 +65,8 @@ private: PyInterpreterState *mPyInterpreter; }; +} + GCThread::GCThread( PyInterpreterState *interpreter, PyObject * object ) : Thread( "pyunoGCThread" ), mPyObject( object ), mPyInterpreter( interpreter ) diff --git a/registry/source/reflread.cxx b/registry/source/reflread.cxx index b799e8b30ef2..501ad3096804 100644 --- a/registry/source/reflread.cxx +++ b/registry/source/reflread.cxx @@ -52,6 +52,8 @@ const sal_uInt16 majorVersion = 0x0001; **************************************************************************/ +namespace { + class BlopObject { public: @@ -148,6 +150,8 @@ public: } }; +} + BlopObject::BlopObject(const sal_uInt8* buffer, sal_uInt32 len) : m_bufferLen(len) { @@ -160,6 +164,8 @@ BlopObject::BlopObject(const sal_uInt8* buffer, sal_uInt32 len) **************************************************************************/ +namespace { + class StringCache { public: @@ -172,6 +178,8 @@ public: sal_uInt16 createString(const sal_uInt8* buffer); // throws std::bad_alloc }; +} + StringCache::StringCache(sal_uInt16 size) : m_stringTable(size) , m_stringsCopied(0) @@ -208,6 +216,8 @@ sal_uInt16 StringCache::createString(const sal_uInt8* buffer) **************************************************************************/ +namespace { + class ConstantPool : public BlopObject { public: @@ -242,6 +252,8 @@ public: // throws std::bad_alloc }; +} + sal_uInt32 ConstantPool::parseIndex() { m_pIndex.reset(); @@ -524,6 +536,8 @@ const sal_Unicode* ConstantPool::readStringConstant(sal_uInt16 index) const **************************************************************************/ +namespace { + class FieldList : public BlopObject { public: @@ -558,6 +572,7 @@ public: const sal_Char* getFieldFileName(sal_uInt16 index) const; }; +} const sal_Char* FieldList::getFieldName(sal_uInt16 index) const { @@ -708,6 +723,8 @@ const sal_Char* FieldList::getFieldFileName(sal_uInt16 index) const **************************************************************************/ +namespace { + class ReferenceList : public BlopObject { public: @@ -737,6 +754,7 @@ public: RTFieldAccess getReferenceAccess(sal_uInt16 index) const; }; +} const sal_Char* ReferenceList::getReferenceName(sal_uInt16 index) const { @@ -808,6 +826,8 @@ RTFieldAccess ReferenceList::getReferenceAccess(sal_uInt16 index) const **************************************************************************/ +namespace { + class MethodList : public BlopObject { public: @@ -850,6 +870,8 @@ private: sal_uInt16 calcMethodParamIndex( const sal_uInt16 index ) const; }; +} + sal_uInt16 MethodList::calcMethodParamIndex( const sal_uInt16 index ) const { return (METHOD_OFFSET_PARAM_COUNT + sizeof(sal_uInt16) + (index * m_PARAM_ENTRY_SIZE)); @@ -1069,6 +1091,8 @@ const sal_Char* MethodList::getMethodDoku(sal_uInt16 index) const **************************************************************************/ +namespace { + class TypeRegistryEntry: public BlopObject { public: std::unique_ptr<ConstantPool> m_pCP; @@ -1086,6 +1110,8 @@ public: typereg_Version getVersion() const; }; +} + TypeRegistryEntry::TypeRegistryEntry( const sal_uInt8* buffer, sal_uInt32 len): BlopObject(buffer, len), m_refCount(1), m_nSuperTypes(0), diff --git a/registry/tools/regmerge.cxx b/registry/tools/regmerge.cxx index 6b29fab9e448..409773a7017d 100644 --- a/registry/tools/regmerge.cxx +++ b/registry/tools/regmerge.cxx @@ -30,6 +30,8 @@ using namespace registry::tools; +namespace { + class Options_Impl : public Options { bool m_bVerbose; @@ -45,6 +47,8 @@ protected: virtual bool initOptions_Impl(std::vector< std::string > & rArgs) override; }; +} + void Options_Impl::printUsage_Impl() const { fprintf(stderr, "using: regmerge [-v|--verbose] mergefile mergeKeyName regfile_1 ... regfile_n\n"); diff --git a/remotebridges/source/unourl_resolver/unourl_resolver.cxx b/remotebridges/source/unourl_resolver/unourl_resolver.cxx index eb94a0706c35..ddafd346bc7e 100644 --- a/remotebridges/source/unourl_resolver/unourl_resolver.cxx +++ b/remotebridges/source/unourl_resolver/unourl_resolver.cxx @@ -55,6 +55,8 @@ static OUString resolver_getImplementationName() return IMPLNAME; } +namespace { + class ResolverImpl : public WeakImplHelper< XServiceInfo, XUnoUrlResolver > { Reference< XMultiComponentFactory > _xSMgr; @@ -72,6 +74,8 @@ public: virtual Reference< XInterface > SAL_CALL resolve( const OUString & rUnoUrl ) override; }; +} + ResolverImpl::ResolverImpl( const Reference< XComponentContext > & xCtx ) : _xSMgr( xCtx->getServiceManager() ) , _xCtx( xCtx ) diff --git a/reportdesign/source/core/api/ReportDefinition.cxx b/reportdesign/source/core/api/ReportDefinition.cxx index a051e20ea484..296419e4f2db 100644 --- a/reportdesign/source/core/api/ReportDefinition.cxx +++ b/reportdesign/source/core/api/ReportDefinition.cxx @@ -229,11 +229,19 @@ static void lcl_extractAndStartStatusIndicator( const utl::MediaDescriptor& _rDe } typedef ::comphelper::OPropertyStateContainer OStyle_PBASE; + +namespace { + class OStyle; + +} + typedef ::comphelper::OPropertyArrayUsageHelper < OStyle > OStyle_PABASE; typedef ::cppu::WeakImplHelper< style::XStyle, beans::XMultiPropertyStates> TStyleBASE; +namespace { + class OStyle : public ::comphelper::OMutexAndBroadcastHelper ,public TStyleBASE ,public OStyle_PBASE @@ -275,6 +283,8 @@ public: uno::Sequence< uno::Any > SAL_CALL getPropertyDefaults( const uno::Sequence< OUString >& aPropertyNames ) override; }; +} + OStyle::OStyle() :OStyle_PBASE(m_aBHelper) ,m_aSize(21000,29700) @@ -2216,6 +2226,9 @@ OUString SAL_CALL OReportDefinition::getShapeType( ) typedef ::cppu::WeakImplHelper< container::XNameContainer, container::XIndexAccess > TStylesBASE; + +namespace { + class OStylesHelper: public cppu::BaseMutex, public TStylesBASE { @@ -2251,6 +2264,8 @@ public: virtual sal_Bool SAL_CALL hasByName( const OUString& aName ) override; }; +} + OStylesHelper::OStylesHelper(const uno::Type& rType) : cppu::BaseMutex() , m_aType(rType) diff --git a/reportdesign/source/core/sdr/UndoEnv.cxx b/reportdesign/source/core/sdr/UndoEnv.cxx index 80aab3c3a428..645797498c04 100644 --- a/reportdesign/source/core/sdr/UndoEnv.cxx +++ b/reportdesign/source/core/sdr/UndoEnv.cxx @@ -59,6 +59,7 @@ namespace rptui using namespace container; using namespace report; +namespace { struct PropertyInfo { @@ -70,8 +71,12 @@ struct PropertyInfo } }; +} + typedef std::unordered_map< OUString, PropertyInfo > PropertiesInfo; +namespace { + struct ObjectInfo { PropertiesInfo aProperties; @@ -84,6 +89,8 @@ struct ObjectInfo } }; +} + typedef ::std::map< Reference< XPropertySet >, ObjectInfo > PropertySetInfoCache; diff --git a/reportdesign/source/filter/xml/xmlExport.cxx b/reportdesign/source/filter/xml/xmlExport.cxx index 2f00950b265c..0c3ad1e70ce3 100644 --- a/reportdesign/source/filter/xml/xmlExport.cxx +++ b/reportdesign/source/filter/xml/xmlExport.cxx @@ -154,6 +154,7 @@ namespace rptxml return aSupported; } + namespace { class OSpecialHandleXMLExportPropertyMapper : public SvXMLExportPropertyMapper { @@ -175,6 +176,8 @@ namespace rptxml } }; + } + static void lcl_adjustColumnSpanOverRows(ORptExport::TSectionsGrid& _rGrid) { for (auto& rEntry : _rGrid) diff --git a/reportdesign/source/filter/xml/xmlFixedContent.cxx b/reportdesign/source/filter/xml/xmlFixedContent.cxx index 94842e6bdb4c..0f33f91e98a9 100644 --- a/reportdesign/source/filter/xml/xmlFixedContent.cxx +++ b/reportdesign/source/filter/xml/xmlFixedContent.cxx @@ -36,6 +36,8 @@ namespace rptxml { using namespace ::com::sun::star; +namespace { + class OXMLCharContent: public XMLCharContext { OXMLFixedContent* m_pFixedContent; @@ -62,6 +64,9 @@ public: virtual void InsertControlCharacter(sal_Int16 _nControl) override; virtual void InsertString(const OUString& _sString) override; }; + +} + OXMLCharContent::OXMLCharContent( SvXMLImport& rImport, OXMLFixedContent* _pFixedContent, diff --git a/reportdesign/source/filter/xml/xmlStyleImport.cxx b/reportdesign/source/filter/xml/xmlStyleImport.cxx index 092f928b22a1..6c454eda45d0 100644 --- a/reportdesign/source/filter/xml/xmlStyleImport.cxx +++ b/reportdesign/source/filter/xml/xmlStyleImport.cxx @@ -44,6 +44,7 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::container; using namespace xmloff::token; +namespace { class OSpecialHanldeXMLImportPropertyMapper : public SvXMLImportPropertyMapper { @@ -64,6 +65,7 @@ public: } }; +} OControlStyleContext::OControlStyleContext( ORptFilter& rImport, sal_uInt16 nPrfx, const OUString& rLName, diff --git a/reportdesign/source/filter/xml/xmlfilter.cxx b/reportdesign/source/filter/xml/xmlfilter.cxx index e4df625cacce..b39b315ce13b 100644 --- a/reportdesign/source/filter/xml/xmlfilter.cxx +++ b/reportdesign/source/filter/xml/xmlfilter.cxx @@ -83,6 +83,8 @@ using namespace ::com::sun::star::xml::sax; using namespace xmloff; using namespace ::com::sun::star::util; +namespace { + class RptMLMasterStylesContext_Impl: public XMLTextMasterStylesContext { @@ -101,6 +103,8 @@ public: virtual void EndElement() override; }; +} + RptMLMasterStylesContext_Impl::RptMLMasterStylesContext_Impl( ORptFilter& rImport, sal_uInt16 nPrfx, const OUString& rLName , @@ -576,6 +580,8 @@ bool ORptFilter::implImport( const Sequence< PropertyValue >& rDescriptor ) return bRet; } +namespace { + class RptXMLDocumentSettingsContext : public SvXMLImportContext { public: @@ -651,6 +657,8 @@ public: } }; +} + SvXMLImportContextRef RptXMLDocumentBodyContext::CreateChildContext( sal_uInt16 const nPrefix, const OUString& rLocalName, @@ -678,6 +686,8 @@ SvXMLImportContextRef RptXMLDocumentBodyContext::CreateChildContext( } } +namespace { + class RptXMLDocumentContentContext : public SvXMLImportContext { public: @@ -720,6 +730,8 @@ public: } }; +} + SvXMLImportContext* ORptFilter::CreateDocumentContext( sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList >& xAttrList ) diff --git a/reportdesign/source/ui/dlg/GroupsSorting.cxx b/reportdesign/source/ui/dlg/GroupsSorting.cxx index abd9102c46fa..b3219be00fe0 100644 --- a/reportdesign/source/ui/dlg/GroupsSorting.cxx +++ b/reportdesign/source/ui/dlg/GroupsSorting.cxx @@ -77,6 +77,9 @@ using namespace ::comphelper; * Separated out from OFieldExpressionControl to prevent collision of ref-counted base classes */ class OFieldExpressionControl; + +namespace { + class OFieldExpressionControlContainerListener : public ::cppu::WeakImplHelper< container::XContainerListener > { VclPtr<OFieldExpressionControl> mpParent; @@ -91,6 +94,8 @@ public: virtual void SAL_CALL elementRemoved(const css::container::ContainerEvent& rEvent) override; }; +} + class OFieldExpressionControl : public ::svt::EditBrowseBox { ::osl::Mutex m_aMutex; diff --git a/reportdesign/source/ui/dlg/Navigator.cxx b/reportdesign/source/ui/dlg/Navigator.cxx index 80d018d88220..ef09f4ae2455 100644 --- a/reportdesign/source/ui/dlg/Navigator.cxx +++ b/reportdesign/source/ui/dlg/Navigator.cxx @@ -102,6 +102,7 @@ static OUString lcl_getName(const uno::Reference< beans::XPropertySet>& _xElemen return sName.makeStringAndClear(); } +namespace { class NavigatorTree : public ::cppu::BaseMutex , public SvTreeListBox @@ -205,6 +206,8 @@ private: using SvTreeListBox::ExecuteDrop; }; +} + NavigatorTree::NavigatorTree( vcl::Window* pParent,OReportController& _rController ) :SvTreeListBox( pParent, WB_TABSTOP| WB_HASBUTTONS|WB_HASLINES|WB_BORDER|WB_HSCROLL|WB_HASBUTTONSATROOT ) ,comphelper::OSelectionChangeListener() diff --git a/reportdesign/source/ui/inspection/metadata.cxx b/reportdesign/source/ui/inspection/metadata.cxx index 2fd4bc6bf20d..fe968c7fddd6 100644 --- a/reportdesign/source/ui/inspection/metadata.cxx +++ b/reportdesign/source/ui/inspection/metadata.cxx @@ -63,6 +63,7 @@ namespace rptui { } + namespace { // compare PropertyInfo struct PropertyInfoLessByName @@ -73,6 +74,7 @@ namespace rptui } }; + } //= OPropertyInfoService diff --git a/reportdesign/source/ui/report/DesignView.cxx b/reportdesign/source/ui/report/DesignView.cxx index de49c0361817..a970d73b9873 100644 --- a/reportdesign/source/ui/report/DesignView.cxx +++ b/reportdesign/source/ui/report/DesignView.cxx @@ -55,6 +55,8 @@ using namespace container; #define REPORT_ID 2 #define TASKPANE_ID 3 +namespace { + class OTaskWindow : public vcl::Window { VclPtr<PropBrw> m_pPropWin; @@ -76,6 +78,7 @@ public: } }; +} // class ODesignView diff --git a/sal/osl/all/utility.cxx b/sal/osl/all/utility.cxx index 5f157c120b2d..76bdc4cd26ed 100644 --- a/sal/osl/all/utility.cxx +++ b/sal/osl/all/utility.cxx @@ -27,6 +27,8 @@ namespace osl { +namespace { + class OGlobalTimer { @@ -38,6 +40,8 @@ public: }; +} + static OGlobalTimer aGlobalTimer; } // namespace osl diff --git a/sal/osl/unx/conditn.cxx b/sal/osl/unx/conditn.cxx index cede35a86d04..d73d67e91b37 100644 --- a/sal/osl/unx/conditn.cxx +++ b/sal/osl/unx/conditn.cxx @@ -29,6 +29,8 @@ #include <osl/conditn.h> #include <osl/time.h> +namespace { + struct oslConditionImpl { pthread_cond_t m_Condition; @@ -36,6 +38,8 @@ struct oslConditionImpl bool m_State; }; +} + oslCondition SAL_CALL osl_createCondition() { oslConditionImpl* pCond; diff --git a/sal/osl/unx/file.cxx b/sal/osl/unx/file.cxx index b6a0acaae2c4..cfd71419d3fe 100644 --- a/sal/osl/unx/file.cxx +++ b/sal/osl/unx/file.cxx @@ -60,6 +60,8 @@ #include <android/asset_manager.h> #endif +namespace { + struct FileHandle_Impl { pthread_mutex_t m_mutex; @@ -155,6 +157,8 @@ struct FileHandle_Impl }; }; +} + FileHandle_Impl::Guard::Guard(pthread_mutex_t * pMutex) : m_mutex(pMutex) { diff --git a/sal/osl/unx/file_path_helper.cxx b/sal/osl/unx/file_path_helper.cxx index 4d629f849868..163deb0c2493 100644 --- a/sal/osl/unx/file_path_helper.cxx +++ b/sal/osl/unx/file_path_helper.cxx @@ -158,6 +158,8 @@ bool osl_systemPathIsLocalOrParentDirectoryEntry( dirent == ".."); } +namespace { + /** Simple iterator for a path list separated by the specified character */ class path_list_iterator @@ -225,6 +227,8 @@ private: const sal_Unicode* m_path_segment_end; }; +} + bool osl_searchPath( const rtl_uString* pustrFilePath, const rtl_uString* pustrSearchPathList, diff --git a/sal/osl/unx/process.cxx b/sal/osl/unx/process.cxx index 41d6de0b04ea..d479e0d40cfc 100644 --- a/sal/osl/unx/process.cxx +++ b/sal/osl/unx/process.cxx @@ -788,6 +788,8 @@ void SAL_CALL osl_freeProcessHandle(oslProcess Process) } #if defined(LINUX) +namespace { + struct osl_procStat { /* from 'stat' */ @@ -848,6 +850,8 @@ struct osl_procStat unsigned long vm_lib; /* library size */ }; +} + static bool osl_getProcStat(pid_t pid, struct osl_procStat* procstat) { int fd = 0; diff --git a/sal/osl/unx/process_impl.cxx b/sal/osl/unx/process_impl.cxx index 35a5b90ece0d..fe7dc9db5ccf 100644 --- a/sal/osl/unx/process_impl.cxx +++ b/sal/osl/unx/process_impl.cxx @@ -140,6 +140,8 @@ oslProcessError bootstrap_getExecutableFile(rtl_uString ** ppFileURL) #endif +namespace { + struct CommandArgs_Impl { pthread_mutex_t m_mutex; @@ -147,6 +149,8 @@ struct CommandArgs_Impl rtl_uString ** m_ppArgs; }; +} + static struct CommandArgs_Impl g_command_args = { PTHREAD_MUTEX_INITIALIZER, @@ -409,12 +413,16 @@ oslProcessError SAL_CALL osl_getProcessWorkingDir(rtl_uString **ppustrWorkingDir return result; } +namespace { + struct ProcessLocale_Impl { pthread_mutex_t m_mutex; rtl_Locale * m_pLocale; }; +} + static struct ProcessLocale_Impl g_process_locale = { PTHREAD_MUTEX_INITIALIZER, diff --git a/sal/osl/unx/profile.cxx b/sal/osl/unx/profile.cxx index ad8868b5490c..717316c0817c 100644 --- a/sal/osl/unx/profile.cxx +++ b/sal/osl/unx/profile.cxx @@ -58,8 +58,6 @@ enum osl_TLockMode un_lock, read_lock, write_lock }; -} - struct osl_TFile { int m_Handle; @@ -104,6 +102,8 @@ struct osl_TProfileImpl bool m_bIsValid; }; +} + static osl_TFile* openFileImpl(const sal_Char* pszFilename, oslProfileOption ProfileFlags); static osl_TStamp closeFileImpl(osl_TFile* pFile, oslProfileOption Flags); static bool OslProfile_lockFile(const osl_TFile* pFile, osl_TLockMode eMode); diff --git a/sal/osl/unx/thread.cxx b/sal/osl/unx/thread.cxx index 5ea77495daa6..fb694ebd92cd 100644 --- a/sal/osl/unx/thread.cxx +++ b/sal/osl/unx/thread.cxx @@ -75,6 +75,8 @@ #define THREADIMPL_FLAGS_ATTACHED 0x00010 #define THREADIMPL_FLAGS_DESTROYED 0x00020 +namespace { + typedef struct osl_thread_impl_st { pthread_t m_hThread; @@ -95,18 +97,26 @@ struct osl_thread_priority_st int m_Lowest; }; +} + #define OSL_THREAD_PRIORITY_INITIALIZER { 127, 96, 64, 32, 0 } static void osl_thread_priority_init_Impl(); +namespace { + struct osl_thread_textencoding_st { pthread_key_t m_key; /* key to store thread local text encoding */ rtl_TextEncoding m_default; /* the default text encoding */ }; +} + #define OSL_THREAD_TEXTENCODING_INITIALIZER { 0, RTL_TEXTENCODING_DONTKNOW } static void osl_thread_textencoding_init_Impl(); +namespace { + struct osl_thread_global_st { pthread_once_t m_once; @@ -114,6 +124,8 @@ struct osl_thread_global_st struct osl_thread_textencoding_st m_textencoding; }; +} + static struct osl_thread_global_st g_thread = { PTHREAD_ONCE_INIT, @@ -555,6 +567,8 @@ void SAL_CALL osl_setThreadName(char const * name) /* osl_getThreadIdentifier @@@ see TODO @@@ */ +namespace { + struct HashEntry { pthread_t Handle; @@ -562,6 +576,8 @@ struct HashEntry HashEntry * Next; }; +} + static HashEntry* HashTable[31]; static const int HashSize = SAL_N_ELEMENTS(HashTable); @@ -951,12 +967,16 @@ oslThreadPriority SAL_CALL osl_getThreadPriority(const oslThread Thread) return Priority; } +namespace { + struct wrapper_pthread_key { pthread_key_t m_key; oslThreadKeyCallbackFunction pfnCallback; }; +} + oslThreadKey SAL_CALL osl_createThreadKey( oslThreadKeyCallbackFunction pCallback ) { wrapper_pthread_key *pKey = static_cast<wrapper_pthread_key*>(malloc(sizeof(wrapper_pthread_key))); diff --git a/sal/qa/osl/condition/osl_Condition.cxx b/sal/qa/osl/condition/osl_Condition.cxx index 0d3cba799583..0e6a56f37c3b 100644 --- a/sal/qa/osl/condition/osl_Condition.cxx +++ b/sal/qa/osl/condition/osl_Condition.cxx @@ -31,8 +31,6 @@ enum ConditionType thread_type_wait }; -} - /** thread for testing Condition. */ class ConditionThread : public Thread @@ -61,6 +59,8 @@ protected: } }; +} + namespace osl_Condition { /** testing the method: diff --git a/sal/qa/osl/file/osl_File.cxx b/sal/qa/osl/file/osl_File.cxx index 54c0e01b90ff..3811ab29d3e8 100644 --- a/sal/qa/osl/file/osl_File.cxx +++ b/sal/qa/osl/file/osl_File.cxx @@ -4997,6 +4997,8 @@ namespace osl_Directory } } + namespace { + class DirCreatedObserver : public DirectoryCreationObserver { public: @@ -5009,6 +5011,8 @@ namespace osl_Directory int i; }; + } + class createPath : public CppUnit::TestFixture { public: @@ -5149,6 +5153,8 @@ OUString getCurrentPID() return OUString::number(nPID); } +namespace { + //~ do some clean up work after all test completed. class GlobalObject { @@ -5197,6 +5203,8 @@ public: } }; +} + static GlobalObject theGlobalObject; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sal/qa/osl/module/osl_Module.cxx b/sal/qa/osl/module/osl_Module.cxx index 52112cb9f151..f440a715162f 100644 --- a/sal/qa/osl/module/osl_Module.cxx +++ b/sal/qa/osl/module/osl_Module.cxx @@ -44,6 +44,7 @@ static OUString getDllURL() namespace osl_Module { + namespace { /** class and member function that is available for module test : */ @@ -57,6 +58,8 @@ namespace osl_Module }; }; + } + /** testing the methods: Module(); Module( const OUString& strModuleName, sal_Int32 nRtldMode = SAL_LOADMODULE_DEFAULT); diff --git a/sal/qa/osl/mutex/osl_Mutex.cxx b/sal/qa/osl/mutex/osl_Mutex.cxx index d0b8283c68e3..c345ae33eb2b 100644 --- a/sal/qa/osl/mutex/osl_Mutex.cxx +++ b/sal/qa/osl/mutex/osl_Mutex.cxx @@ -49,6 +49,8 @@ namespace ThreadHelper // Beginning of the test cases for osl_Mutex class +namespace { + /** mutually exclusive data */ struct resource { @@ -229,6 +231,8 @@ protected: } }; +} + namespace osl_Mutex { @@ -524,6 +528,8 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Mutex::getGlobalMutex, "osl_Mutex"); // Beginning of the test cases for osl_Guard class +namespace { + class GuardThread : public Thread { public: @@ -545,6 +551,8 @@ protected: } }; +} + namespace osl_Guard { class ctor : public CppUnit::TestFixture @@ -607,6 +615,8 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION(osl_Guard::ctor, "osl_Guard"); // Beginning of the test cases for osl_ClearableGuard class +namespace { + /** Thread for test ClearableGuard */ class ClearGuardThread : public Thread @@ -635,6 +645,8 @@ protected: } }; +} + namespace osl_ClearableGuard { @@ -748,6 +760,8 @@ CPPUNIT_TEST_SUITE_NAMED_REGISTRATION( osl_ClearableGuard::clear, "osl_Clearable // Beginning of the test cases for osl_ResettableGuard class +namespace { + /** Thread for test ResettableGuard */ class ResetGuardThread : public Thread @@ -774,6 +788,8 @@ protected: } }; +} + namespace osl_ResettableGuard { class ctor : public CppUnit::TestFixture diff --git a/sal/qa/osl/pipe/osl_Pipe.cxx b/sal/qa/osl/pipe/osl_Pipe.cxx index 482ae750f36f..d7bedb5baaa8 100644 --- a/sal/qa/osl/pipe/osl_Pipe.cxx +++ b/sal/qa/osl/pipe/osl_Pipe.cxx @@ -744,6 +744,8 @@ namespace osl_StreamPipe } // test read/write & send/recv data to pipe + namespace { + class Pipe_DataSink_Thread : public Thread { public: @@ -838,6 +840,8 @@ namespace osl_StreamPipe } }; + } + /** testing the method: read/write/send/recv and Pipe::accept */ class recv : public CppUnit::TestFixture diff --git a/sal/qa/osl/process/osl_Thread.cxx b/sal/qa/osl/process/osl_Thread.cxx index 0b97d0b95d8c..3c9891b76e54 100644 --- a/sal/qa/osl/process/osl_Thread.cxx +++ b/sal/qa/osl/process/osl_Thread.cxx @@ -48,6 +48,8 @@ using namespace osl; +namespace { + // Small stopwatch class StopWatch { TimeValue t1,t2; // Start and stoptime @@ -69,6 +71,8 @@ public: double getTenthSec() const; }; +} + // ================================= Stop Watch ================================= // A small stopwatch for internal use @@ -145,6 +149,8 @@ double StopWatch::getTenthSec() const return nValue ; } +namespace { + template <class T> class ThreadSafeValue { @@ -168,6 +174,8 @@ public: void release() {m_aMutex.release();} }; +} + namespace ThreadHelper { static void thread_sleep_tenth_sec(sal_Int32 _nTenthSec) @@ -205,6 +213,8 @@ namespace ThreadHelper } } +namespace { + /** Simple thread for testing Thread-create. Just add 1 of value 0, and after running, result is 1. @@ -393,6 +403,8 @@ public: }; +} + namespace osl_Thread { @@ -1671,6 +1683,8 @@ static void destroyCallback(void * data) static ThreadData myThreadData(destroyCallback); +namespace { + class myKeyThread : public Thread { public: @@ -1708,8 +1722,12 @@ public: } }; +} + static ThreadData idData; +namespace { + class idThread: public Thread { public: @@ -1735,6 +1753,8 @@ public: } }; +} + namespace osl_ThreadData { diff --git a/sal/qa/osl/process/osl_process.cxx b/sal/qa/osl/process/osl_process.cxx index eaf34bd46d5b..104f9238eea6 100644 --- a/sal/qa/osl/process/osl_process.cxx +++ b/sal/qa/osl/process/osl_process.cxx @@ -80,6 +80,8 @@ static OUString getExecutablePath() #if !defined _WIN32 +namespace { + class exclude { public: @@ -118,8 +120,6 @@ private: std::vector<OString> exclude_list_; }; -namespace -{ void tidy_container(std::vector<OString> &env_container) { //sort them because there are no guarantees to ordering diff --git a/sal/qa/osl/security/osl_Security.cxx b/sal/qa/osl/security/osl_Security.cxx index 3bce893731cc..bc00d27a21e7 100644 --- a/sal/qa/osl/security/osl_Security.cxx +++ b/sal/qa/osl/security/osl_Security.cxx @@ -309,6 +309,8 @@ CPPUNIT_TEST_SUITE_REGISTRATION(osl_Security::loginUserOnFileServer); */ #include <cppunit/plugin/TestPlugInDefaultImpl.h> +namespace { + class MyTestPlugInImpl: public CPPUNIT_NS::TestPlugInDefaultImpl { public: @@ -317,6 +319,8 @@ class MyTestPlugInImpl: public CPPUNIT_NS::TestPlugInDefaultImpl const CPPUNIT_NS::PlugInParameters ¶meters ) override; }; +} + void MyTestPlugInImpl::initialize( CPPUNIT_NS::TestFactoryRegistry *, const CPPUNIT_NS::PlugInParameters & ) { diff --git a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx index d2e094d19c12..6f59e55e62cd 100644 --- a/sal/qa/rtl/doublelock/rtl_doublelocking.cxx +++ b/sal/qa/rtl/doublelock/rtl_doublelocking.cxx @@ -50,7 +50,6 @@ struct Gregorian : public rtl::StaticWithInit<OUString, Gregorian> { return CONST_TEST_STRING; } }; -} /** Simple thread for testing Thread-create. * Just add 1 of value 0, and after running, result is 1. @@ -108,6 +107,8 @@ public: } }; +} + namespace rtl_DoubleLocking { diff --git a/sal/qa/rtl/random/rtl_random.cxx b/sal/qa/rtl/random/rtl_random.cxx index 1e0eb625d5f5..c43638277c90 100644 --- a/sal/qa/rtl/random/rtl_random.cxx +++ b/sal/qa/rtl/random/rtl_random.cxx @@ -139,6 +139,8 @@ public: CPPUNIT_TEST_SUITE_END(); }; // class addBytes +namespace { + class Statistics { int m_nDispensation[256]; @@ -208,6 +210,8 @@ public: }; +} + class getBytes : public CppUnit::TestFixture { public: diff --git a/sal/qa/rtl/ref/rtl_ref.cxx b/sal/qa/rtl/ref/rtl_ref.cxx index 2c7d3aae5276..2bf7c9803f3d 100644 --- a/sal/qa/rtl/ref/rtl_ref.cxx +++ b/sal/qa/rtl/ref/rtl_ref.cxx @@ -16,6 +16,8 @@ namespace rtl_ref { +namespace { + class MoveTestClass { private: @@ -45,6 +47,8 @@ public: void set_inc_flag() { m_bIncFlag = true; } }; +} + static rtl::Reference< MoveTestClass > get_reference( MoveTestClass* pcTestClass ) { // constructor will increment the reference count diff --git a/sal/rtl/alloc_arena.cxx b/sal/rtl/alloc_arena.cxx index 626d05c7b895..f126efdabd27 100644 --- a/sal/rtl/alloc_arena.cxx +++ b/sal/rtl/alloc_arena.cxx @@ -29,6 +29,8 @@ #include <string.h> #include <stdio.h> +namespace { + /** @internal */ @@ -38,6 +40,8 @@ struct rtl_arena_list_st rtl_arena_type m_arena_head; }; +} + static rtl_arena_list_st g_arena_list; /** diff --git a/sal/rtl/bootstrap.cxx b/sal/rtl/bootstrap.cxx index 7f5d4317636a..dae54a88df66 100644 --- a/sal/rtl/bootstrap.cxx +++ b/sal/rtl/bootstrap.cxx @@ -55,11 +55,11 @@ using osl::DirectoryItem; using osl::FileStatus; -struct Bootstrap_Impl; - namespace { +struct Bootstrap_Impl; + static char const VND_SUN_STAR_PATHNAME[] = "vnd.sun.star.pathname:"; bool isPathnameUrl(OUString const & url) @@ -111,8 +111,6 @@ OUString recursivelyExpandMacros( return expandMacros(file, text, mode, &link); } -} // end namespace - struct rtl_bootstrap_NameValue { OUString sName; @@ -126,6 +124,8 @@ struct rtl_bootstrap_NameValue {} }; +} // end namespace + typedef std::vector<rtl_bootstrap_NameValue> NameValueVector; static bool find( @@ -281,6 +281,8 @@ static void EnsureNoFinalSlash (OUString & url) url = url.copy(0, i - 1); } +namespace { + struct Bootstrap_Impl { sal_Int32 _nRefCount; @@ -313,6 +315,8 @@ struct Bootstrap_Impl ExpandRequestLink const * requestStack) const; }; +} + Bootstrap_Impl::Bootstrap_Impl( OUString const & rIniName ) : _nRefCount( 0 ), _base_ini( nullptr ), diff --git a/sal/rtl/cipher.cxx b/sal/rtl/cipher.cxx index 26d9cca29afc..9bc438114651 100644 --- a/sal/rtl/cipher.cxx +++ b/sal/rtl/cipher.cxx @@ -105,6 +105,8 @@ typedef rtlCipherError(cipher_update_t) ( typedef void (cipher_delete_t) (rtlCipher Cipher); +namespace { + struct Cipher_Impl { rtlCipherAlgorithm m_algorithm; @@ -117,6 +119,8 @@ struct Cipher_Impl cipher_delete_t *m_delete; }; +} + rtlCipher SAL_CALL rtl_cipher_create( rtlCipherAlgorithm Algorithm, rtlCipherMode Mode) SAL_THROW_EXTERN_C() @@ -192,6 +196,8 @@ void SAL_CALL rtl_cipher_destroy(rtlCipher Cipher) SAL_THROW_EXTERN_C() pImpl->m_delete(Cipher); } +namespace { + #if !defined LIBO_CIPHER_OPENSSL_BACKEND #define CIPHER_ROUNDS_BF 16 @@ -223,6 +229,8 @@ struct CipherBF_Impl CipherContextBF m_context; }; +} + #if !defined LIBO_CIPHER_OPENSSL_BACKEND static rtlCipherError BF_init( CipherContextBF *ctx, @@ -1150,6 +1158,8 @@ void SAL_CALL rtl_cipher_destroyBF(rtlCipher Cipher) SAL_THROW_EXTERN_C() #define CIPHER_CBLOCK_ARCFOUR 256 #endif +namespace { + struct ContextARCFOUR_Impl { #if defined LIBO_CIPHER_OPENSSL_BACKEND @@ -1166,6 +1176,8 @@ struct CipherARCFOUR_Impl ContextARCFOUR_Impl m_context; }; +} + static rtlCipherError rtl_cipherARCFOUR_update_Impl( ContextARCFOUR_Impl *ctx, const sal_uInt8 *pData, sal_Size nDatLen, diff --git a/sal/rtl/digest.cxx b/sal/rtl/digest.cxx index 1000fc0aed02..55af5ad7c3b2 100644 --- a/sal/rtl/digest.cxx +++ b/sal/rtl/digest.cxx @@ -52,6 +52,8 @@ typedef rtlDigestError (Digest_update_t) ( typedef rtlDigestError (Digest_get_t) ( void *ctx, sal_uInt8 *Buffer, sal_uInt32 BufLen); +namespace { + struct Digest_Impl { rtlDigestAlgorithm m_algorithm; @@ -63,6 +65,8 @@ struct Digest_Impl Digest_get_t *m_get; }; +} + static void swapLong(sal_uInt32 *pData, sal_uInt32 nDatLen) { sal_uInt32 *X; @@ -175,6 +179,8 @@ void SAL_CALL rtl_digest_destroy(rtlDigest Digest) SAL_THROW_EXTERN_C() #define DIGEST_CBLOCK_MD2 16 #define DIGEST_LBLOCK_MD2 16 +namespace { + struct DigestContextMD2 { sal_uInt32 m_nDatLen; @@ -189,6 +195,8 @@ struct DigestMD2_Impl DigestContextMD2 m_context; }; +} + static void initMD2 (DigestContextMD2 *ctx); static void updateMD2 (DigestContextMD2 *ctx); static void endMD2 (DigestContextMD2 *ctx); @@ -437,6 +445,8 @@ void SAL_CALL rtl_digest_destroyMD2(rtlDigest Digest) SAL_THROW_EXTERN_C() #define DIGEST_CBLOCK_MD5 64 #define DIGEST_LBLOCK_MD5 16 +namespace { + struct DigestContextMD5 { sal_uInt32 m_nDatLen; @@ -451,6 +461,8 @@ struct DigestMD5_Impl DigestContextMD5 m_context; }; +} + static void initMD5 (DigestContextMD5 *ctx); static void updateMD5 (DigestContextMD5 *ctx); static void endMD5 (DigestContextMD5 *ctx); @@ -824,6 +836,8 @@ typedef sal_uInt32 DigestSHA_update_t(sal_uInt32 x); static sal_uInt32 updateSHA_0(sal_uInt32 x); static sal_uInt32 updateSHA_1(sal_uInt32 x); +namespace { + struct DigestContextSHA { DigestSHA_update_t *m_update; @@ -839,6 +853,8 @@ struct DigestSHA_Impl DigestContextSHA m_context; }; +} + static void initSHA( DigestContextSHA *ctx, DigestSHA_update_t *fct); @@ -1390,6 +1406,8 @@ void SAL_CALL rtl_digest_destroySHA1(rtlDigest Digest) SAL_THROW_EXTERN_C() #define DIGEST_CBLOCK_HMAC_MD5 64 +namespace { + struct ContextHMAC_MD5 { DigestMD5_Impl m_hash; @@ -1402,6 +1420,8 @@ struct DigestHMAC_MD5_Impl ContextHMAC_MD5 m_context; }; +} + static void initHMAC_MD5(ContextHMAC_MD5 * ctx); static void ipadHMAC_MD5(ContextHMAC_MD5 * ctx); static void opadHMAC_MD5(ContextHMAC_MD5 * ctx); @@ -1586,6 +1606,8 @@ void SAL_CALL rtl_digest_destroyHMAC_MD5(rtlDigest Digest) SAL_THROW_EXTERN_C() #define DIGEST_CBLOCK_HMAC_SHA1 64 +namespace { + struct ContextHMAC_SHA1 { DigestSHA_Impl m_hash; @@ -1598,6 +1620,8 @@ struct DigestHMAC_SHA1_Impl ContextHMAC_SHA1 m_context; }; +} + static void initHMAC_SHA1(ContextHMAC_SHA1 * ctx); static void ipadHMAC_SHA1(ContextHMAC_SHA1 * ctx); static void opadHMAC_SHA1(ContextHMAC_SHA1 * ctx); diff --git a/sal/rtl/hash.cxx b/sal/rtl/hash.cxx index 4cbe1da785c6..4fed60889f50 100644 --- a/sal/rtl/hash.cxx +++ b/sal/rtl/hash.cxx @@ -26,12 +26,16 @@ #include <osl/diagnose.h> #include <sal/macros.h> +namespace { + struct StringHashTableImpl { sal_uInt32 nEntries; sal_uInt32 nSize; rtl_uString **pData; }; +} + typedef StringHashTableImpl StringHashTable; // Only for use in the implementation diff --git a/sal/rtl/locale.cxx b/sal/rtl/locale.cxx index e362a342bcbc..bae0f40b3d66 100644 --- a/sal/rtl/locale.cxx +++ b/sal/rtl/locale.cxx @@ -26,6 +26,8 @@ #include <memory> #include <unordered_map> +namespace { + struct locale_deleter { void operator() (rtl_Locale* p) noexcept @@ -37,6 +39,8 @@ struct locale_deleter } }; +} + using locale_unique_ptr = std::unique_ptr<rtl_Locale, locale_deleter>; static std::unordered_map<sal_Int32, locale_unique_ptr>* g_pLocaleTable = nullptr; diff --git a/sal/rtl/random.cxx b/sal/rtl/random.cxx index c9cc0f841ea9..418358b22e22 100644 --- a/sal/rtl/random.cxx +++ b/sal/rtl/random.cxx @@ -46,6 +46,8 @@ if ((z) < 0) (z) += 30307; \ } +namespace { + struct RandomData_Impl { sal_Int16 m_nX; @@ -53,12 +55,16 @@ struct RandomData_Impl sal_Int16 m_nZ; }; +} + static double data (RandomData_Impl *pImpl); #define RTL_RANDOM_DIGEST rtl_Digest_AlgorithmMD5 #define RTL_RANDOM_SIZE_DIGEST RTL_DIGEST_LENGTH_MD5 #define RTL_RANDOM_SIZE_POOL 1023 +namespace { + struct RandomPool_Impl { rtlDigest m_hDigest; @@ -69,6 +75,8 @@ struct RandomPool_Impl sal_uInt32 m_nCount; }; +} + static bool initPool(RandomPool_Impl *pImpl); static void seedPool( diff --git a/sal/rtl/uuid.cxx b/sal/rtl/uuid.cxx index bb9490ef8b99..130be12456d6 100644 --- a/sal/rtl/uuid.cxx +++ b/sal/rtl/uuid.cxx @@ -55,6 +55,8 @@ ( ( static_cast<sal_uInt32>(p[3])) & 0xff);\ } +namespace { + struct UUID { sal_uInt32 time_low; @@ -65,6 +67,8 @@ struct UUID sal_uInt8 node[6]; }; +} + static void write_v3( sal_uInt8 *pUuid ) { UUID uuid; diff --git a/sal/textenc/convertisciidevangari.cxx b/sal/textenc/convertisciidevangari.cxx index b8566ed6a51e..ae25d811df2d 100644 --- a/sal/textenc/convertisciidevangari.cxx +++ b/sal/textenc/convertisciidevangari.cxx @@ -22,6 +22,8 @@ using namespace sal::detail::textenc; using namespace rtl::textenc; +namespace { + struct IsciiDevanagariToUnicode { sal_uInt8 m_cPrevChar; @@ -57,6 +59,8 @@ struct UnicodeToIsciiDevanagari sal_uInt32 * pInfo, sal_Size * pSrcCvtChars); }; +} + static const sal_Unicode IsciiDevanagariMap[256] = { 0x0000,0x0001,0x0002,0x0003,0x0004,0x0005,0x0006,0x0007, diff --git a/sal/textenc/tcvtutf7.cxx b/sal/textenc/tcvtutf7.cxx index b09ccd47f1d8..1a1ca7603241 100644 --- a/sal/textenc/tcvtutf7.cxx +++ b/sal/textenc/tcvtutf7.cxx @@ -91,6 +91,8 @@ static unsigned char const aImplMustShiftTab[128] = /* ----------------------------------------------------------------------- */ +namespace { + struct ImplUTF7ToUCContextData { bool mbShifted; @@ -100,6 +102,8 @@ struct ImplUTF7ToUCContextData sal_uInt32 mnBufferBits; }; +} + /* ----------------------------------------------------------------------- */ void* ImplUTF7CreateUTF7TextToUnicodeContext() @@ -410,6 +414,8 @@ sal_Size ImplUTF7ToUnicode( SAL_UNUSED_PARAMETER const void*, void* pContext, /* ======================================================================= */ +namespace { + struct ImplUTF7FromUCContextData { bool mbShifted; @@ -417,6 +423,8 @@ struct ImplUTF7FromUCContextData sal_uInt32 mnBufferBits; }; +} + /* ----------------------------------------------------------------------- */ void* ImplUTF7CreateUnicodeToTextContext() diff --git a/sal/textenc/tcvtutf8.cxx b/sal/textenc/tcvtutf8.cxx index 950d810e8b85..ca29156c418f 100644 --- a/sal/textenc/tcvtutf8.cxx +++ b/sal/textenc/tcvtutf8.cxx @@ -30,6 +30,8 @@ #include "tenchelp.hxx" #include "unichars.hxx" +namespace { + struct ImplUtf8ToUnicodeContext { sal_uInt32 nUtf32; @@ -43,6 +45,8 @@ struct ImplUnicodeToUtf8Context sal_Unicode nHighSurrogate; /* 0xFFFF: write BOM */ }; +} + void * ImplCreateUtf8ToUnicodeContext() { ImplUtf8ToUnicodeContext * p = new ImplUtf8ToUnicodeContext; diff --git a/sal/textenc/tencinfo.cxx b/sal/textenc/tencinfo.cxx index f541fcb20004..b69cf4c586fd 100644 --- a/sal/textenc/tencinfo.cxx +++ b/sal/textenc/tencinfo.cxx @@ -102,6 +102,8 @@ static bool Impl_matchString( const char* pCompStr, const char* pMatchStr ) /* ======================================================================= */ +namespace { + struct ImplStrCharsetDef { const char* mpCharsetStr; @@ -114,6 +116,8 @@ struct ImplStrFirstPartCharsetDef const ImplStrCharsetDef* mpSecondPartTab; }; +} + /* ======================================================================= */ sal_Bool SAL_CALL rtl_getTextEncodingInfo( rtl_TextEncoding eTextEncoding, rtl_TextEncodingInfo* pEncInfo ) diff --git a/sc/qa/extras/scddelinkobj.cxx b/sc/qa/extras/scddelinkobj.cxx index 49a8fda8c244..a64104e661f1 100644 --- a/sc/qa/extras/scddelinkobj.cxx +++ b/sc/qa/extras/scddelinkobj.cxx @@ -45,6 +45,8 @@ static utl::TempFile createTempCopy(OUString const& url) return tmp; } +namespace +{ struct TempFileBase { utl::TempFile m_TempFile; @@ -53,6 +55,7 @@ struct TempFileBase { } }; +} class ScDDELinkObj : public CalcUnoApiTest, public TempFileBase, diff --git a/sc/qa/extras/scuniquecellformatsenumeration.cxx b/sc/qa/extras/scuniquecellformatsenumeration.cxx index c0a8f9cdf8fa..ea6a76e7680d 100644 --- a/sc/qa/extras/scuniquecellformatsenumeration.cxx +++ b/sc/qa/extras/scuniquecellformatsenumeration.cxx @@ -30,6 +30,8 @@ using namespace css::uno; namespace sc_apitest { +namespace +{ struct RGBColor { int m_nRed; @@ -45,6 +47,7 @@ struct RGBColor sal_Int32 hashCode() const { return (255 << 24) | (m_nRed << 16) | (m_nGreen << 8) | m_nBlue; } }; +} class ScUniqueCellFormatsEnumeration : public CalcUnoApiTest, public apitest::XEnumeration { diff --git a/sc/qa/unit/mark_test.cxx b/sc/qa/unit/mark_test.cxx index f6c2e81ef356..6c2d3e870370 100644 --- a/sc/qa/unit/mark_test.cxx +++ b/sc/qa/unit/mark_test.cxx @@ -16,10 +16,20 @@ #include <markdata.hxx> #include "../../source/core/data/markarr.cxx" #include "../../source/core/data/markmulti.cxx" +#if defined __GNUC__ && !defined __clang__ +#pragma GCC diagnostic push +#pragma GCC diagnostic ignored "-Wsubobject-linkage" + // automatically suppressed in the main .cxx, but not in this included one +#endif #include "../../source/core/data/segmenttree.cxx" +#if defined __GNUC__ && !defined __clang__ +#pragma GCC diagnostic push +#endif #include <utility> +namespace { + struct MarkTestData // To represent a single rectangle part of a multiselection { ScRange aRange; @@ -80,6 +90,8 @@ struct MultiMarkTestData std::vector<std::pair<SCCOL,SCCOL>> aColsWithUnequalMarksList; }; +} + class Test : public CppUnit::TestFixture { public: diff --git a/sc/qa/unit/subsequent_filters-test.cxx b/sc/qa/unit/subsequent_filters-test.cxx index 9110505667fc..e3c7bfae4d82 100644 --- a/sc/qa/unit/subsequent_filters-test.cxx +++ b/sc/qa/unit/subsequent_filters-test.cxx @@ -1015,6 +1015,8 @@ void ScFiltersTest::testBorderODS() xDocSh->DoClose(); } +namespace { + struct Border { sal_Int16 column; @@ -1049,6 +1051,8 @@ struct Border lStyle(static_cast<SvxBorderLineStyle>(lSt)), tStyle(static_cast<SvxBorderLineStyle>(tSt)), rStyle(static_cast<SvxBorderLineStyle>(rSt)), bStyle(static_cast<SvxBorderLineStyle>(bSt)) {}; }; +} + void ScFiltersTest::testBordersOoo33() { std::vector<Border> borders; diff --git a/sc/qa/unit/ucalc.cxx b/sc/qa/unit/ucalc.cxx index ae28aadeae31..5f5e79cb7933 100644 --- a/sc/qa/unit/ucalc.cxx +++ b/sc/qa/unit/ucalc.cxx @@ -1677,6 +1677,8 @@ static void checkMatrixElements(const ScMatrix& rMat) } } +namespace { + struct AllZeroMatrix { void operator() (SCSIZE /*nCol*/, SCSIZE /*nRow*/, const ScMatrixValue& rVal) const @@ -1743,6 +1745,8 @@ struct PartiallyFilledEmptyMatrix } }; +} + void Test::testMatrix() { svl::SharedStringPool& rPool = m_pDoc->GetSharedStringPool(); diff --git a/sc/qa/unit/ucalc_formula.cxx b/sc/qa/unit/ucalc_formula.cxx index 6bbe59d067ea..a8a98ce2fa44 100644 --- a/sc/qa/unit/ucalc_formula.cxx +++ b/sc/qa/unit/ucalc_formula.cxx @@ -5437,11 +5437,15 @@ void Test::testFuncVLOOKUP() m_pDoc->DeleteTab(0); } +namespace { + struct StrStrCheck { const char* pVal; const char* pRes; }; +} + template<size_t DataSize, size_t FormulaSize, int Type> static void runTestMATCH(ScDocument* pDoc, const char* aData[DataSize], const StrStrCheck aChecks[FormulaSize]) { diff --git a/sc/qa/unit/ucalc_sharedformula.cxx b/sc/qa/unit/ucalc_sharedformula.cxx index 7cb85e8c9bbf..b67880171d63 100644 --- a/sc/qa/unit/ucalc_sharedformula.cxx +++ b/sc/qa/unit/ucalc_sharedformula.cxx @@ -599,6 +599,8 @@ void Test::testSharedFormulasRefUpdateRange() m_pDoc->DeleteTab(0); } +namespace { + struct SortByArea { bool operator ()( const sc::AreaListener& rLeft, const sc::AreaListener& rRight ) const @@ -622,6 +624,8 @@ struct SortByArea } }; +} + void Test::testSharedFormulasRefUpdateRangeDeleteRow() { sc::AutoCalcSwitch aACSwitch(*m_pDoc, true); // turn on auto calc. diff --git a/sc/source/core/data/bcaslot.cxx b/sc/source/core/data/bcaslot.cxx index c904ad716bd1..227a6d751e63 100644 --- a/sc/source/core/data/bcaslot.cxx +++ b/sc/source/core/data/bcaslot.cxx @@ -53,6 +53,8 @@ constexpr int BCA_SLOTS = BCA_SLOTS_COL * BCA_SLOTS_ROW; // anyway, once you reached these values... static_assert(BCA_SLOTS <= 268435456, "DOOMed"); +namespace { + struct ScSlotData { SCROW const nStartRow; // first row of this segment @@ -62,6 +64,9 @@ struct ScSlotData ScSlotData( SCROW r1, SCROW r2, SCSIZE s, SCSIZE c ) : nStartRow(r1), nStopRow(r2), nSlice(s), nCumulated(c) {} }; + +} + typedef ::std::vector< ScSlotData > ScSlotDistribution; // Logarithmic or any other distribution. // Upper sheet part usually is more populated and referenced and gets fine diff --git a/sc/source/core/data/column3.cxx b/sc/source/core/data/column3.cxx index 90a0dcec43aa..18f505f45bd2 100644 --- a/sc/source/core/data/column3.cxx +++ b/sc/source/core/data/column3.cxx @@ -93,6 +93,8 @@ void ScColumn::BroadcastRows( SCROW nStartRow, SCROW nEndRow, SfxHintId nHint ) BroadcastCells(aRows, nHint); } +namespace { + struct DirtyCellInterpreter { void operator() (size_t, ScFormulaCell* p) @@ -102,6 +104,8 @@ struct DirtyCellInterpreter } }; +} + void ScColumn::InterpretDirtyCells( SCROW nRow1, SCROW nRow2 ) { if (!ValidRow(nRow1) || !ValidRow(nRow2) || nRow1 > nRow2) diff --git a/sc/source/core/data/document.cxx b/sc/source/core/data/document.cxx index ac2a1e786939..c4e6c06327ed 100644 --- a/sc/source/core/data/document.cxx +++ b/sc/source/core/data/document.cxx @@ -143,8 +143,6 @@ void collectUIInformation(const std::map<OUString, OUString>& aParameters, const UITestLogger::getInstance().logEvent(aDescription); } -} - struct ScDefaultAttr { const ScPatternAttr* pAttr; @@ -161,6 +159,8 @@ struct ScLessDefaultAttr } }; +} + typedef std::set<ScDefaultAttr, ScLessDefaultAttr> ScDefaultAttrSet; void ScDocument::MakeTable( SCTAB nTab,bool _bNeedsNameCheck ) diff --git a/sc/source/core/data/dpgroup.cxx b/sc/source/core/data/dpgroup.cxx index 0327dcb5c44f..026d1a2639b7 100644 --- a/sc/source/core/data/dpgroup.cxx +++ b/sc/source/core/data/dpgroup.cxx @@ -43,6 +43,8 @@ using ::std::shared_ptr; const sal_uInt16 SC_DP_LEAPYEAR = 1648; // arbitrary leap year for date calculations +namespace { + class ScDPGroupNumFilter : public ScDPFilteredCache::FilterBase { public: @@ -55,6 +57,8 @@ private: ScDPNumGroupInfo const maNumInfo; }; +} + ScDPGroupNumFilter::ScDPGroupNumFilter(const std::vector<ScDPItemData>& rValues, const ScDPNumGroupInfo& rInfo) : maValues(rValues), maNumInfo(rInfo) {} @@ -99,6 +103,8 @@ std::vector<ScDPItemData> ScDPGroupNumFilter::getMatchValues() const return std::vector<ScDPItemData>(); } +namespace { + class ScDPGroupDateFilter : public ScDPFilteredCache::FilterBase { public: @@ -114,6 +120,8 @@ private: ScDPNumGroupInfo const maNumInfo; }; +} + ScDPGroupDateFilter::ScDPGroupDateFilter( const std::vector<ScDPItemData>& rValues, const Date& rNullDate, const ScDPNumGroupInfo& rNumInfo) : maValues(rValues), diff --git a/sc/source/core/data/dptabres.cxx b/sc/source/core/data/dptabres.cxx index 67f742dece8b..43fb34e75e7d 100644 --- a/sc/source/core/data/dptabres.cxx +++ b/sc/source/core/data/dptabres.cxx @@ -129,8 +129,6 @@ public: } }; -} - // function objects for sorting of the column and row members: class ScDPRowMembersOrder @@ -165,6 +163,8 @@ public: bool operator()( sal_Int32 nIndex1, sal_Int32 nIndex2 ) const; }; +} + static bool lcl_IsLess( const ScDPDataMember* pDataMember1, const ScDPDataMember* pDataMember2, long nMeasure, bool bAscending ) { // members can be NULL if used for rows @@ -2677,6 +2677,8 @@ void ScDPDataMember::Dump(int nIndent) const // Helper class to select the members to include in // ScDPResultDimension::InitFrom or LateInitFrom if groups are used +namespace { + class ScDPGroupCompare { private: @@ -2693,6 +2695,8 @@ public: bool TestIncluded( const ScDPMember& rMember ); }; +} + ScDPGroupCompare::ScDPGroupCompare( const ScDPResultData* pData, const ScDPInitState& rState, long nDimension ) : pResultData( pData ), rInitState( rState ), diff --git a/sc/source/core/data/dptabsrc.cxx b/sc/source/core/data/dptabsrc.cxx index f656370a5686..caadfb5bc458 100644 --- a/sc/source/core/data/dptabsrc.cxx +++ b/sc/source/core/data/dptabsrc.cxx @@ -1848,6 +1848,8 @@ ScDPLevel* ScDPLevels::getByIndex(long nIndex) const return nullptr; //TODO: exception? } +namespace { + class ScDPGlobalMembersOrder { ScDPLevel& rLevel; @@ -1862,6 +1864,8 @@ public: bool operator()( sal_Int32 nIndex1, sal_Int32 nIndex2 ) const; }; +} + bool ScDPGlobalMembersOrder::operator()( sal_Int32 nIndex1, sal_Int32 nIndex2 ) const { sal_Int32 nCompare = 0; diff --git a/sc/source/core/data/formulacell.cxx b/sc/source/core/data/formulacell.cxx index acfe85bd332b..d07619e07fc4 100644 --- a/sc/source/core/data/formulacell.cxx +++ b/sc/source/core/data/formulacell.cxx @@ -4247,8 +4247,6 @@ int splitup(int N, int K, int& A) return num_parts; } -} // anonymous namespace - struct ScDependantsCalculator { ScDocument& mrDoc; @@ -4558,6 +4556,8 @@ struct ScDependantsCalculator } }; +} // anonymous namespace + bool ScFormulaCell::InterpretFormulaGroup(SCROW nStartOffset, SCROW nEndOffset) { if (!mxGroup || !pCode) diff --git a/sc/source/core/data/funcdesc.cxx b/sc/source/core/data/funcdesc.cxx index abeccaba4b9f..690c033abf7c 100644 --- a/sc/source/core/data/funcdesc.cxx +++ b/sc/source/core/data/funcdesc.cxx @@ -38,6 +38,8 @@ #include <memory> +namespace { + struct ScFuncDescCore { /* @@ -88,6 +90,8 @@ struct ScFuncDescCore sal_uInt8 const aOptionalArgs[7]; }; +} + static void ScFuncRes(const ScFuncDescCore &rEntry, ScFuncDesc*, bool& rbSuppressed); // class ScFuncDesc: diff --git a/sc/source/core/data/segmenttree.cxx b/sc/source/core/data/segmenttree.cxx index b47f1e7b9f3c..3e7bfd9aca48 100644 --- a/sc/source/core/data/segmenttree.cxx +++ b/sc/source/core/data/segmenttree.cxx @@ -27,6 +27,8 @@ using ::std::numeric_limits; +namespace { + template<typename ValueType_, typename ExtValueType_ = ValueType_> class ScFlatSegmentsImpl { @@ -72,6 +74,8 @@ private: bool mbTreeSearchEnabled:1; }; +} + template<typename ValueType_, typename ExtValueType_> ScFlatSegmentsImpl<ValueType_, ExtValueType_>::ScFlatSegmentsImpl(SCCOLROW nMax, ValueType nDefault) : maSegments(0, nMax+1, nDefault), diff --git a/sc/source/core/data/table3.cxx b/sc/source/core/data/table3.cxx index 41a130d65f6c..9f4eeb59e6a7 100644 --- a/sc/source/core/data/table3.cxx +++ b/sc/source/core/data/table3.cxx @@ -219,12 +219,16 @@ static short Compare( const OUString &sInput1, const OUString &sInput2, } +namespace { + struct ScSortInfo final { ScRefCellValue maCell; SCCOLROW nOrg; }; +} + class ScSortInfoArray { public: @@ -1894,6 +1898,8 @@ static void lcl_RemoveNumberFormat( ScTable* pTab, SCCOL nCol, SCROW nRow ) } } +namespace { + struct RowEntry { sal_uInt16 nGroupNo; @@ -1903,6 +1909,7 @@ struct RowEntry SCROW nFuncEnd; }; +} static const char* lcl_GetSubTotalStrId(int id) { diff --git a/sc/source/core/opencl/formulagroupcl.cxx b/sc/source/core/opencl/formulagroupcl.cxx index 24815b4937b1..12eb62bbe1eb 100644 --- a/sc/source/core/opencl/formulagroupcl.cxx +++ b/sc/source/core/opencl/formulagroupcl.cxx @@ -345,6 +345,8 @@ size_t VectorRef::Marshal( cl_kernel k, int argno, int, cl_program ) /// automatically disables use of OpenCL for a formula group. If at some point there are resources /// to drain the OpenCL swamp, this should go away. +namespace { + class ConstStringArgument : public DynamicKernelArgument { public: @@ -875,6 +877,8 @@ public: virtual size_t Marshal( cl_kernel, int, int, cl_program ) override; }; +} + /// Marshal a string vector reference size_t DynamicKernelStringArgument::Marshal( cl_kernel k, int argno, int, cl_program ) { @@ -964,6 +968,8 @@ size_t DynamicKernelStringArgument::Marshal( cl_kernel k, int argno, int, cl_pro return 1; } +namespace { + /// A mixed string/numeric vector class DynamicKernelMixedArgument : public VectorRef { @@ -1304,6 +1310,8 @@ private: std::vector<DynamicKernelArgumentRef> mParams; }; +} + void SymbolTable::Marshal( cl_kernel k, int nVectorWidth, cl_program pProgram ) { int i = 1; //The first argument is reserved for results @@ -1313,6 +1321,8 @@ void SymbolTable::Marshal( cl_kernel k, int nVectorWidth, cl_program pProgram ) } } +namespace { + /// Handling a Double Vector that is used as a sliding window input /// Performs parallel reduction based on given operator template<class Base> @@ -2316,7 +2326,7 @@ public: } virtual std::string BinFuncName() const override { return "fsop"; } }; -namespace { + struct SumIfsArgs { explicit SumIfsArgs(cl_mem x) : mCLMem(x), mConst(0.0) { } @@ -2324,7 +2334,6 @@ struct SumIfsArgs cl_mem mCLMem; double mConst; }; -} /// Helper functions that have multiple buffers class DynamicKernelSoPArguments : public DynamicKernelArgument @@ -2619,6 +2628,8 @@ private: cl_mem mpClmem2; }; +} + static DynamicKernelArgumentRef SoPHelper( const ScCalcConfig& config, const std::string& ts, const FormulaTreeNodeRef& ft, SlidingFunctionBase* pCodeGen, int nResultSize ) @@ -3793,6 +3804,8 @@ DynamicKernelSoPArguments::DynamicKernelSoPArguments(const ScCalcConfig& config, } } +namespace { + class DynamicKernel : public CompiledFormula { public: @@ -3833,6 +3846,8 @@ private: int const mnResultSize; }; +} + DynamicKernel::DynamicKernel( const ScCalcConfig& config, const FormulaTreeNodeRef& r, int nResultSize ) : mCalcConfig(config), mpRoot(r), diff --git a/sc/source/core/tool/compiler.cxx b/sc/source/core/tool/compiler.cxx index d750f377d1ad..b943edf34af1 100644 --- a/sc/source/core/tool/compiler.cxx +++ b/sc/source/core/tool/compiler.cxx @@ -705,6 +705,8 @@ static bool lcl_getLastTabName( OUString& rTabName2, const OUString& rTabName1, return true; } +namespace { + struct Convention_A1 : public ScCompiler::Convention { explicit Convention_A1( FormulaGrammar::AddressConvention eConv ) : ScCompiler::Convention( eConv ) { } @@ -737,6 +739,8 @@ struct Convention_A1 : public ScCompiler::Convention } }; +} + void Convention_A1::MakeColStr( OUStringBuffer& rBuffer, SCCOL nCol ) { if ( !ValidCol( nCol) ) @@ -753,6 +757,8 @@ void Convention_A1::MakeRowStr( OUStringBuffer& rBuffer, SCROW nRow ) rBuffer.append(sal_Int32(nRow + 1)); } +namespace { + struct ConventionOOO_A1 : public Convention_A1 { ConventionOOO_A1() : Convention_A1 (FormulaGrammar::CONV_OOO) { } @@ -1549,6 +1555,8 @@ struct ConventionXL_OOX : public ConventionXL_A1 } }; +} + static void r1c1_add_col( OUStringBuffer &rBuf, const ScSingleRefData& rRef, const ScAddress& rAbsRef ) { @@ -1577,6 +1585,8 @@ r1c1_add_row( OUStringBuffer &rBuf, const ScSingleRefData& rRef, const ScAddress rBuf.append( OUString::number( rAbsRef.Row() + 1 ) ); } +namespace { + struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL { ConventionXL_R1C1() : ScCompiler::Convention( FormulaGrammar::CONV_XL_R1C1 ) { } @@ -1764,6 +1774,8 @@ struct ConventionXL_R1C1 : public ScCompiler::Convention, public ConventionXL } }; +} + ScCompiler::ScCompiler( sc::CompileFormulaContext& rCxt, const ScAddress& rPos, ScTokenArray& rArr, bool bComputeII, bool bMatrixFlag, const ScInterpreterContext* pContext ) : FormulaCompiler(rArr, bComputeII, bMatrixFlag), diff --git a/sc/source/core/tool/detfunc.cxx b/sc/source/core/tool/detfunc.cxx index 3ea84ef59bbf..b253e6c4bbbb 100644 --- a/sc/source/core/tool/detfunc.cxx +++ b/sc/source/core/tool/detfunc.cxx @@ -114,6 +114,8 @@ public: sal_uInt16 GetMaxLevel() const { return nMaxLevel; } }; +namespace { + class ScCommentData { public: @@ -126,6 +128,8 @@ private: SfxItemSet aCaptionSet; }; +} + Color ScDetectiveFunc::nArrowColor = Color(0); Color ScDetectiveFunc::nErrorColor = Color(0); Color ScDetectiveFunc::nCommentColor = Color(0); diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index 9069138c3013..a62e6885c0eb 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -8937,11 +8937,15 @@ void ScInterpreter::ScLeft() } } +namespace { + struct UBlockScript { UBlockCode const from; UBlockCode const to; }; +} + static const UBlockScript scriptList[] = { {UBLOCK_HANGUL_JAMO, UBLOCK_HANGUL_JAMO}, {UBLOCK_CJK_RADICALS_SUPPLEMENT, UBLOCK_HANGUL_SYLLABLES}, diff --git a/sc/source/core/tool/interpr3.cxx b/sc/source/core/tool/interpr3.cxx index f219beca9386..31dee4ce707e 100644 --- a/sc/source/core/tool/interpr3.cxx +++ b/sc/source/core/tool/interpr3.cxx @@ -51,6 +51,8 @@ using namespace formula; const double ScInterpreter::fMaxGammaArgument = 171.624376956302; // found experimental const double fMachEps = ::std::numeric_limits<double>::epsilon(); +namespace { + class ScDistFunc { public: @@ -60,6 +62,8 @@ protected: ~ScDistFunc() {} }; +} + // iteration for inverse distributions //template< class T > double lcl_IterateInverse( const T& rFunction, double x0, double x1, bool& rConvError ) @@ -4765,6 +4769,8 @@ static SCSIZE lcl_bitReverse(SCSIZE nIn, SCSIZE nBound) return nOut; } +namespace { + // Computes and stores twiddle factors for computing DFT later. struct ScTwiddleFactors { @@ -4790,6 +4796,8 @@ struct ScTwiddleFactors bool mbInverse; }; +} + void ScTwiddleFactors::Compute() { mfWReal.resize(mnN); @@ -4905,6 +4913,8 @@ void ScTwiddleFactors::Compute() } } +namespace { + // A radix-2 decimation in time FFT algorithm for complex valued input. class ScComplexFFT2 { @@ -4995,6 +5005,8 @@ private: bool mbSubSampleTFs:1; }; +} + void ScComplexFFT2::prepare() { SCSIZE nPoints = mnPoints; @@ -5094,6 +5106,8 @@ void ScComplexFFT2::Compute() lcl_normalize(mrArray, mbPolar); } +namespace { + // Bluestein's algorithm or chirp z-transform algorithm that can be used to // compute DFT of a complex valued input of any length N in O(N lgN) time. class ScComplexBluesteinFFT @@ -5123,6 +5137,8 @@ private: bool mbDisableNormalize:1; }; +} + void ScComplexBluesteinFFT::Compute() { std::vector<double> aRealScalars(mnPoints); @@ -5213,6 +5229,8 @@ void ScComplexBluesteinFFT::Compute() lcl_normalize(mrArray, mbPolar); } +namespace { + // Computes DFT of an even length(N) real-valued input by using a // ScComplexFFT2 if N == 2^k for some k or else by using a ScComplexBluesteinFFT // with a complex valued input of length = N/2. @@ -5239,6 +5257,8 @@ private: bool mbPolar:1; }; +} + void ScRealFFT::Compute() { // input length has to be even to do this optimization. @@ -5338,6 +5358,8 @@ void ScRealFFT::Compute() using ScMatrixGenerator = ScMatrixRef(SCSIZE, SCSIZE, std::vector<double>&); +namespace { + // Generic FFT class that decides which FFT implementation to use. class ScFFT { @@ -5361,6 +5383,8 @@ private: bool mbPolar:1; }; +} + ScMatrixRef ScFFT::Compute(const std::function<ScMatrixGenerator>& rMatGenFunc) { std::vector<double> aArray; diff --git a/sc/source/core/tool/interpr6.cxx b/sc/source/core/tool/interpr6.cxx index c2655fceb3d7..7038e4de1f81 100644 --- a/sc/source/core/tool/interpr6.cxx +++ b/sc/source/core/tool/interpr6.cxx @@ -203,6 +203,8 @@ double ScInterpreter::GetGammaDist( double fX, double fAlpha, double fLambda ) return GetLowRegIGamma( fAlpha, fX / fLambda); } +namespace { + class NumericCellAccumulator { double mfFirst; @@ -399,6 +401,8 @@ public: sal_uInt32 getNumberFormat() const { return mnNumFmt; } }; +} + static void IterateMatrix( const ScMatrixRef& pMat, ScIterFunc eFunc, bool bTextAsZero, sal_uLong& rCount, SvNumFormatType& rFuncFmtType, double& fRes, double& fMem ) diff --git a/sc/source/core/tool/interpr8.cxx b/sc/source/core/tool/interpr8.cxx index 9738c2ce7421..39706cf7882c 100644 --- a/sc/source/core/tool/interpr8.cxx +++ b/sc/source/core/tool/interpr8.cxx @@ -23,6 +23,8 @@ using namespace formula; +namespace { + struct DataPoint { double X, Y; @@ -30,6 +32,8 @@ struct DataPoint DataPoint( double rX, double rY ) : X( rX ), Y( rY ) {}; }; +} + static bool lcl_SortByX( const DataPoint &lhs, const DataPoint &rhs ) { return lhs.X < rhs.X; } /* @@ -70,6 +74,9 @@ static bool lcl_SortByX( const DataPoint &lhs, const DataPoint &rhs ) { return l * Intervals for Future Values * */ + +namespace { + class ScETSForecastCalculation { private: @@ -128,6 +135,8 @@ public: void GetETSPredictionIntervals( const ScMatrixRef& rTMat, const ScMatrixRef& rPIMat, double fPILevel ); }; +} + ScETSForecastCalculation::ScETSForecastCalculation( SCSIZE nSize, SvNumberFormatter* pFormatter ) : mpFormatter(pFormatter) , mnSmplInPrd(0) diff --git a/sc/source/core/tool/rangelst.cxx b/sc/source/core/tool/rangelst.cxx index 90bda2d1f9dc..76b68d1a1b27 100644 --- a/sc/source/core/tool/rangelst.cxx +++ b/sc/source/core/tool/rangelst.cxx @@ -1243,6 +1243,8 @@ ScRangePairList* ScRangePairList::Clone() const return pNew; } +namespace { + class ScRangePairList_sortNameCompare { public: @@ -1319,6 +1321,8 @@ private: ScDocument * const mpDoc; }; +} + void ScRangePairList::Join( const ScRangePair& r, bool bIsInList ) { if ( maPairs.empty() ) diff --git a/sc/source/core/tool/scmatrix.cxx b/sc/source/core/tool/scmatrix.cxx index 34ee65302349..3e5bb647db9f 100644 --- a/sc/source/core/tool/scmatrix.cxx +++ b/sc/source/core/tool/scmatrix.cxx @@ -55,6 +55,8 @@ using std::endl; using ::std::pair; using ::std::advance; +namespace { + /** * Custom string trait struct to tell mdds::multi_type_matrix about the * custom string type and how to handle blocks storing them. @@ -67,6 +69,8 @@ struct matrix_trait typedef mdds::mtv::custom_block_func1<sc::string_block> element_block_func; }; +} + typedef mdds::multi_type_matrix<matrix_trait> MatrixImplType; namespace { @@ -2194,6 +2198,8 @@ void ScMatrixImpl::MergeDoubleArrayMultiply( std::vector<double>& rArray ) const namespace Op { +namespace { + template<typename T> struct return_type { @@ -2214,6 +2220,10 @@ struct return_type<char> } +} + +namespace { + template<typename T, typename U, typename return_type> struct wrapped_iterator { @@ -2320,8 +2330,6 @@ public: } }; -namespace { - MatrixImplType::position_type increment_position(const MatrixImplType::position_type& pos, size_t n) { MatrixImplType::position_type ret = pos; @@ -2343,8 +2351,6 @@ MatrixImplType::position_type increment_position(const MatrixImplType::position_ return ret; } -} - template<typename T> struct MatrixOpWrapper { @@ -2419,6 +2425,8 @@ public: } }; +} + template<typename T> void ScMatrixImpl::ApplyOperation(T aOp, ScMatrixImpl& rMat) { @@ -3281,6 +3289,8 @@ void ScMatrix::MergeDoubleArrayMultiply( std::vector<double>& rArray ) const namespace matop { +namespace { + /** * COp struct is used in MatOp class to provide (through template specialization) * different actions for empty entries in a matrix. @@ -3288,6 +3298,8 @@ namespace matop { template <typename T, typename S> struct COp {}; +} + template <typename T> struct COp<T, svl::SharedString> { @@ -3306,6 +3318,8 @@ struct COp<T, double> } }; +namespace { + /** A template for operations where operands are supposed to be numeric. A non-numeric (string) operand leads to the configured conversion to number method being called if in interpreter context and a FormulaError::NoValue DoubleError @@ -3371,6 +3385,8 @@ public: } +} + void ScMatrix::NotOp( const ScMatrix& rMat) { auto not_ = [](double a, double){return double(a == 0.0);}; diff --git a/sc/source/core/tool/stylehelper.cxx b/sc/source/core/tool/stylehelper.cxx index 6e42c06a5df1..61ec2a3c37a1 100644 --- a/sc/source/core/tool/stylehelper.cxx +++ b/sc/source/core/tool/stylehelper.cxx @@ -44,12 +44,16 @@ #define SC_PIVOT_STYLE_PROG_FIELDNAME "Pivot Table Field" #define SC_PIVOT_STYLE_PROG_TOP "Pivot Table Corner" +namespace { + struct ScDisplayNameMap { OUString aDispName; OUString aProgName; }; +} + static const ScDisplayNameMap* lcl_GetStyleNameMap( SfxStyleFamily nType ) { if ( nType == SfxStyleFamily::Para ) diff --git a/sc/source/filter/excel/excimp8.cxx b/sc/source/filter/excel/excimp8.cxx index 95d2d0fb94c8..67520923d96f 100644 --- a/sc/source/filter/excel/excimp8.cxx +++ b/sc/source/filter/excel/excimp8.cxx @@ -65,6 +65,8 @@ using namespace ::comphelper; //OleNameOverrideContainer +namespace { + class OleNameOverrideContainer : public ::cppu::WeakImplHelper< container::XNameContainer > { private: @@ -127,8 +129,6 @@ public: } }; -namespace { - /** Future Record Type header. @return whether read rt matches nRecordID */ diff --git a/sc/source/filter/excel/xecontent.cxx b/sc/source/filter/excel/xecontent.cxx index 98079cd96345..f0cb4cd2646f 100644 --- a/sc/source/filter/excel/xecontent.cxx +++ b/sc/source/filter/excel/xecontent.cxx @@ -63,6 +63,8 @@ using ::com::sun::star::sheet::XAreaLink; // Shared string table ======================================================== +namespace { + /** A single string entry in the hash table. */ struct XclExpHashEntry { @@ -79,6 +81,8 @@ struct XclExpHashEntrySWO { return *rLeft.mpString < *rRight.mpString; } }; +} + /** Implementation of the SST export. @descr Stores all passed strings in a hash table and prevents repeated insertion of equal strings. */ diff --git a/sc/source/filter/excel/xedbdata.cxx b/sc/source/filter/excel/xedbdata.cxx index 6eacd6ef1a61..043c1791acf6 100644 --- a/sc/source/filter/excel/xedbdata.cxx +++ b/sc/source/filter/excel/xedbdata.cxx @@ -16,6 +16,8 @@ using namespace oox; +namespace { + /** (So far) dummy implementation of table export for BIFF5/BIFF7. */ class XclExpTablesImpl5 : public XclExpTables { @@ -36,6 +38,7 @@ public: virtual void SaveXml( XclExpXmlStream& rStrm ) override; }; +} XclExpTablesImpl5::XclExpTablesImpl5( const XclExpRoot& rRoot ) : XclExpTables( rRoot ) diff --git a/sc/source/filter/excel/xelink.cxx b/sc/source/filter/excel/xelink.cxx index 4142ae5e625e..3dd30eb9a9fa 100644 --- a/sc/source/filter/excel/xelink.cxx +++ b/sc/source/filter/excel/xelink.cxx @@ -49,6 +49,8 @@ using namespace oox; // External names ============================================================= +namespace { + /** This is a base class for any external name (i.e. add-in names or DDE links). @descr Derived classes implement creation and export of the external names. */ class XclExpExtNameBase : public XclExpRecord, protected XclExpRoot @@ -190,7 +192,7 @@ private: SCROW mnScRow; /// Row index of the external cells. }; -namespace { class XclExpCrnList; } +class XclExpCrnList; /** Represents the record XCT which is the header record of a CRN record list. */ @@ -387,7 +389,7 @@ struct XclExpXti { rStrm << mnSupbook << mnFirstSBTab << mnLastSBTab; } }; -static bool operator==( const XclExpXti& rLeft, const XclExpXti& rRight ) +bool operator==( const XclExpXti& rLeft, const XclExpXti& rRight ) { return (rLeft.mnSupbook == rRight.mnSupbook) && @@ -483,6 +485,8 @@ private: sal_uInt16 mnAddInSB; /// Index to add-in SUPBOOK. }; +} + // Export link manager ======================================================== /** Abstract base class for implementation classes of the link manager. */ @@ -535,6 +539,8 @@ protected: explicit XclExpLinkManagerImpl( const XclExpRoot& rRoot ); }; +namespace { + /** Implementation of the link manager for BIFF5/BIFF7. */ class XclExpLinkManagerImpl5 : public XclExpLinkManagerImpl { @@ -658,6 +664,8 @@ private: XclExpXtiVec maXtiVec; /// List of XTI structures for the EXTERNSHEET record. }; +} + // *** Implementation *** // Excel sheet indexes ======================================================== @@ -869,6 +877,8 @@ void XclExpTabInfo::CalcXclIndexes() typedef ::std::pair< OUString, SCTAB > XclExpTabName; +namespace { + struct XclExpTabNameSort { bool operator ()( const XclExpTabName& rArg1, const XclExpTabName& rArg2 ) { @@ -877,6 +887,8 @@ struct XclExpTabNameSort { } }; +} + void XclExpTabInfo::CalcSortedIndexes() { ScDocument& rDoc = GetDoc(); diff --git a/sc/source/filter/excel/xename.cxx b/sc/source/filter/excel/xename.cxx index 67a1fd3464df..01b778eb044b 100644 --- a/sc/source/filter/excel/xename.cxx +++ b/sc/source/filter/excel/xename.cxx @@ -40,6 +40,8 @@ using namespace ::oox; // *** Helper classes *** +namespace { + /** Represents an internal defined name, supports writing it to a NAME record. */ class XclExpName : public XclExpRecord, protected XclExpRoot { @@ -107,6 +109,8 @@ private: sal_uInt16 mnXclTab; /// The 1-based Excel sheet index for local names. }; +} + /** Implementation class of the name manager. */ class XclExpNameManagerImpl : protected XclExpRoot { diff --git a/sc/source/filter/excel/xepage.cxx b/sc/source/filter/excel/xepage.cxx index 9783ea5e5fc0..41c531264b15 100644 --- a/sc/source/filter/excel/xepage.cxx +++ b/sc/source/filter/excel/xepage.cxx @@ -335,6 +335,8 @@ XclExpPageSettings::XclExpPageSettings( const XclExpRoot& rRoot ) : maData.maVerPageBreaks.push_back(rColBreak); } +namespace { + class XclExpXmlStartHeaderFooterElementRecord : public XclExpXmlElementRecord { public: @@ -344,6 +346,8 @@ public: virtual void SaveXml( XclExpXmlStream& rStrm ) override; }; +} + void XclExpXmlStartHeaderFooterElementRecord::SaveXml(XclExpXmlStream& rStrm) { // OOXTODO: we currently only emit oddHeader/oddFooter elements, and diff --git a/sc/source/filter/excel/xestyle.cxx b/sc/source/filter/excel/xestyle.cxx index 7b6a3b5a5665..2ee1648432a8 100644 --- a/sc/source/filter/excel/xestyle.cxx +++ b/sc/source/filter/excel/xestyle.cxx @@ -1309,6 +1309,8 @@ size_t XclExpFontBuffer::Find( const XclFontData& rFontData ) // FORMAT record - number formats ============================================= +namespace { + /** Predicate for search algorithm. */ struct XclExpNumFmtPred { @@ -1318,6 +1320,8 @@ struct XclExpNumFmtPred { return rFormat.mnScNumFmt == mnScNumFmt; } }; +} + void XclExpNumFmt::SaveXml( XclExpXmlStream& rStrm ) { sax_fastparser::FSHelperPtr& rStyleSheet = rStrm.GetCurrentStream(); @@ -2346,6 +2350,8 @@ XclExpXFBuffer::XclExpBuiltInInfo::XclExpBuiltInInfo() : { } +namespace { + /** Predicate for search algorithm. */ struct XclExpBorderPred { @@ -2355,6 +2361,8 @@ struct XclExpBorderPred bool operator()( const XclExpCellBorder& rBorder ) const; }; +} + bool XclExpBorderPred::operator()( const XclExpCellBorder& rBorder ) const { return @@ -2377,6 +2385,8 @@ bool XclExpBorderPred::operator()( const XclExpCellBorder& rBorder ) const mrBorder.mnDiagColorId == rBorder.mnDiagColorId; } +namespace { + struct XclExpFillPred { const XclExpCellArea& @@ -2385,6 +2395,8 @@ struct XclExpFillPred bool operator()( const XclExpCellArea& rFill ) const; }; +} + bool XclExpFillPred::operator()( const XclExpCellArea& rFill ) const { return diff --git a/sc/source/filter/excel/xetable.cxx b/sc/source/filter/excel/xetable.cxx index 4604b860172f..132f48c2f44b 100644 --- a/sc/source/filter/excel/xetable.cxx +++ b/sc/source/filter/excel/xetable.cxx @@ -2149,6 +2149,8 @@ void XclExpRowBuffer::CreateRows( SCROW nFirstFreeScRow ) GetOrCreateRow( ::std::max ( nFirstFreeScRow - 1, GetMaxPos().Row() ), true ); } +namespace { + class RowFinalizeTask : public comphelper::ThreadTask { bool mbProgress; @@ -2170,6 +2172,8 @@ public: } }; +} + void XclExpRowBuffer::Finalize( XclExpDefaultRowData& rDefRowData, const ScfUInt16Vec& rColXFIndexes ) { // *** Finalize all rows *** ---------------------------------------------- diff --git a/sc/source/filter/excel/xiescher.cxx b/sc/source/filter/excel/xiescher.cxx index fe59a3495ba4..47ca45d10f25 100644 --- a/sc/source/filter/excel/xiescher.cxx +++ b/sc/source/filter/excel/xiescher.cxx @@ -3559,6 +3559,8 @@ void XclImpDffConverter::ProcessClientAnchor2( SvStream& rDffStrm, } } +namespace { + struct XclImpDrawObjClientData : public SvxMSDffClientData { const XclImpDrawObjBase* m_pTopLevelObj; @@ -3570,6 +3572,8 @@ struct XclImpDrawObjClientData : public SvxMSDffClientData virtual void NotifyFreeObj(SdrObject*) override {} }; +} + SdrObject* XclImpDffConverter::ProcessObj( SvStream& rDffStrm, DffObjData& rDffObjData, SvxMSDffClientData& rClientData, tools::Rectangle& /*rTextRect*/, SdrObject* pOldSdrObj ) { diff --git a/sc/source/filter/excel/xilink.cxx b/sc/source/filter/excel/xilink.cxx index 40128838a629..3e86e5bea064 100644 --- a/sc/source/filter/excel/xilink.cxx +++ b/sc/source/filter/excel/xilink.cxx @@ -38,6 +38,8 @@ // Cached external cells ====================================================== +namespace { + /** * Contains the address and value of an external referenced cell. * Note that this is non-copyable, so cannot be used in most stl/boost containers. @@ -80,6 +82,8 @@ private: OUString maTabName; /// Name of the external sheet. }; +} + // External document (SUPBOOK) ================================================ /** This class represents an external linked document (record SUPBOOK). @@ -134,6 +138,8 @@ private: // Import link manager ======================================================== +namespace { + /** Contains the SUPBOOK index and sheet indexes of an external link. @descr It is possible to enter a formula like =SUM(Sheet1:Sheet3!A1), therefore here occurs a sheet range. */ @@ -145,7 +151,7 @@ struct XclImpXti explicit XclImpXti() : mnSupbook( SAL_MAX_UINT16 ), mnSBTabFirst( SAL_MAX_UINT16 ), mnSBTabLast( SAL_MAX_UINT16 ) {} }; -static XclImpStream& operator>>( XclImpStream& rStrm, XclImpXti& rXti ) +XclImpStream& operator>>( XclImpStream& rStrm, XclImpXti& rXti ) { rXti.mnSupbook = rStrm.ReaduInt16(); rXti.mnSBTabFirst = rStrm.ReaduInt16(); @@ -153,6 +159,8 @@ static XclImpStream& operator>>( XclImpStream& rStrm, XclImpXti& rXti ) return rStrm; } +} + /** Implementation of the link manager. */ class XclImpLinkManagerImpl : protected XclImpRoot { diff --git a/sc/source/filter/excel/xistyle.cxx b/sc/source/filter/excel/xistyle.cxx index dea7ab2886c5..66d7429b6c6a 100644 --- a/sc/source/filter/excel/xistyle.cxx +++ b/sc/source/filter/excel/xistyle.cxx @@ -80,6 +80,8 @@ using namespace ::com::sun::star; typedef ::cppu::WeakImplHelper< container::XIndexAccess > XIndexAccess_BASE; typedef ::std::vector< Color > ColorVec; +namespace { + class PaletteIndex : public XIndexAccess_BASE { public: @@ -111,6 +113,8 @@ private: ColorVec maColor; }; +} + void XclImpPalette::ExportPalette() { diff --git a/sc/source/filter/excel/xltoolbar.cxx b/sc/source/filter/excel/xltoolbar.cxx index cd3a355f252a..c65e1919541e 100644 --- a/sc/source/filter/excel/xltoolbar.cxx +++ b/sc/source/filter/excel/xltoolbar.cxx @@ -21,6 +21,8 @@ using namespace com::sun::star; typedef std::map< sal_Int16, OUString > IdToString; +namespace { + class MSOExcelCommandConvertor : public MSOCommandConvertor { IdToString msoToOOcmd; @@ -31,6 +33,8 @@ public: virtual OUString MSOTCIDToOOCommand( sal_Int16 key ) override; }; +} + MSOExcelCommandConvertor::MSOExcelCommandConvertor() { /* diff --git a/sc/source/filter/html/htmlpars.cxx b/sc/source/filter/html/htmlpars.cxx index ae46949e4b21..3da6e228d0e8 100644 --- a/sc/source/filter/html/htmlpars.cxx +++ b/sc/source/filter/html/htmlpars.cxx @@ -1768,6 +1768,8 @@ ScHTMLTable* ScHTMLTableMap::CreateTable( const HtmlImportInfo& rInfo, bool bPre return pTable; } +namespace { + /** Simplified forward iterator for convenience. Before the iterator can be dereferenced, it must be tested with the is() @@ -1791,6 +1793,8 @@ private: const ScHTMLTableMap* mpTableMap; }; +} + ScHTMLTableIterator::ScHTMLTableIterator( const ScHTMLTableMap* pTableMap ) : mpTableMap(pTableMap) { diff --git a/sc/source/filter/oox/formulaparser.cxx b/sc/source/filter/oox/formulaparser.cxx index 0426e3c433e1..d44c7a9407f9 100644 --- a/sc/source/filter/oox/formulaparser.cxx +++ b/sc/source/filter/oox/formulaparser.cxx @@ -1168,6 +1168,8 @@ OUString FormulaParserImpl::resolveDefinedName( sal_Int32 nTokenIndex ) const // OOXML/BIFF12 parser implementation ========================================= +namespace { + class OoxFormulaParserImpl : public FormulaParserImpl { public: @@ -1219,6 +1221,8 @@ private: bool mbNeedExtRefs; /// True = parser needs initialization of external reference info. }; +} + OoxFormulaParserImpl::OoxFormulaParserImpl( const FormulaParser& rParent ) : FormulaParserImpl( rParent ), maApiParser( rParent.getBaseFilter().getModelFactory(), rParent ), diff --git a/sc/source/filter/oox/pagesettings.cxx b/sc/source/filter/oox/pagesettings.cxx index 14e4f9baaf82..dc92ad40ca11 100644 --- a/sc/source/filter/oox/pagesettings.cxx +++ b/sc/source/filter/oox/pagesettings.cxx @@ -353,8 +353,6 @@ enum HFPortionId HF_COUNT }; -} - struct HFPortionInfo { Reference<text::XText> mxText; /// XText interface of this portion. @@ -366,6 +364,8 @@ struct HFPortionInfo bool initialize( const Reference<text::XText>& rxText ); }; +} + bool HFPortionInfo::initialize( const Reference<text::XText>& rxText ) { mfTotalHeight = mfCurrHeight = 0.0; diff --git a/sc/source/filter/orcus/interface.cxx b/sc/source/filter/orcus/interface.cxx index efd7f55a73e3..f7c8a5177e04 100644 --- a/sc/source/filter/orcus/interface.cxx +++ b/sc/source/filter/orcus/interface.cxx @@ -298,6 +298,8 @@ orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::append_sheet( return maSheets.back().get(); } +namespace { + class FindSheetByIndex { SCTAB const mnTab; @@ -309,6 +311,8 @@ public: } }; +} + orcus::spreadsheet::iface::import_sheet* ScOrcusFactory::get_sheet(const char* sheet_name, size_t sheet_name_length) { OUString aTabName(sheet_name, sheet_name_length, maGlobalSettings.getTextEncoding()); diff --git a/sc/source/filter/xcl97/XclExpChangeTrack.cxx b/sc/source/filter/xcl97/XclExpChangeTrack.cxx index 9a7ee2fa7392..e80aed2267da 100644 --- a/sc/source/filter/xcl97/XclExpChangeTrack.cxx +++ b/sc/source/filter/xcl97/XclExpChangeTrack.cxx @@ -1366,6 +1366,8 @@ void ExcXmlRecord::Save( XclExpStream& ) // Do nothing; ignored for BIFF output. } +namespace { + class EndXmlElement : public ExcXmlRecord { sal_Int32 mnElement; @@ -1374,6 +1376,8 @@ public: virtual void SaveXml( XclExpXmlStream& rStrm ) override; }; +} + void EndXmlElement::SaveXml( XclExpXmlStream& rStrm ) { sax_fastparser::FSHelperPtr pStream = rStrm.GetCurrentStream(); diff --git a/sc/source/filter/xcl97/xcl97rec.cxx b/sc/source/filter/xcl97/xcl97rec.cxx index da91d360aee3..d05afbf27334 100644 --- a/sc/source/filter/xcl97/xcl97rec.cxx +++ b/sc/source/filter/xcl97/xcl97rec.cxx @@ -565,6 +565,8 @@ void XclObjComment::Save( XclExpStream& rStrm ) XclObj::Save( rStrm ); } +namespace { + class VmlCommentExporter : public VMLExport { ScAddress maScPos; @@ -583,6 +585,8 @@ protected: virtual void EndShape( sal_Int32 nShapeElement ) override; }; +} + VmlCommentExporter::VmlCommentExporter( const sax_fastparser::FSHelperPtr& p, const ScAddress& aScPos, SdrCaptionObj* pCaption, bool bVisible, const tools::Rectangle &aFrom, const tools::Rectangle &aTo ) : VMLExport( p ) @@ -1537,12 +1541,16 @@ std::size_t ExcEScenarioManager::GetLen() const return 8; } +namespace { + struct XclExpTabProtectOption { ScTableProtection::Option eOption; sal_uInt16 nMask; }; +} + XclExpSheetProtectOptions::XclExpSheetProtectOptions( const XclExpRoot& rRoot, SCTAB nTab ) : XclExpRecord( 0x0867, 23 ) { diff --git a/sc/source/filter/xml/XMLTrackedChangesContext.cxx b/sc/source/filter/xml/XMLTrackedChangesContext.cxx index c8e652f4522b..2b0e2afa0171 100644 --- a/sc/source/filter/xml/XMLTrackedChangesContext.cxx +++ b/sc/source/filter/xml/XMLTrackedChangesContext.cxx @@ -39,6 +39,8 @@ using namespace com::sun::star; using namespace xmloff::token; +namespace { + class ScXMLChangeInfoContext : public ScXMLImportContext { ScMyActionInfo aInfo; @@ -348,6 +350,8 @@ public: virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override; }; +} + ScXMLTrackedChangesContext::ScXMLTrackedChangesContext( ScXMLImport& rImport, const rtl::Reference<sax_fastparser::FastAttributeList>& rAttrList, ScXMLChangeTrackingImportHelper* pTempChangeTrackingImportHelper ) : diff --git a/sc/source/filter/xml/xmlcvali.cxx b/sc/source/filter/xml/xmlcvali.cxx index 78dc7fd49597..cff9a046c0da 100644 --- a/sc/source/filter/xml/xmlcvali.cxx +++ b/sc/source/filter/xml/xmlcvali.cxx @@ -33,6 +33,8 @@ using namespace com::sun::star; using namespace xmloff::token; using namespace ::formula; +namespace { + class ScXMLContentValidationContext : public ScXMLImportContext { OUString sName; @@ -136,6 +138,8 @@ public: virtual void SAL_CALL endFastElement( sal_Int32 nElement ) override; }; +} + ScXMLContentValidationsContext::ScXMLContentValidationsContext( ScXMLImport& rImport ) : ScXMLImportContext( rImport ) { diff --git a/sc/source/filter/xml/xmlexprt.cxx b/sc/source/filter/xml/xmlexprt.cxx index a1fdf72f53b1..4e98d40ddb45 100644 --- a/sc/source/filter/xml/xmlexprt.cxx +++ b/sc/source/filter/xml/xmlexprt.cxx @@ -303,6 +303,8 @@ Calc_XMLOasisSettingsExporter_get_implementation(css::uno::XComponentContext* co return cppu::acquire(new ScXMLExport(context, "com.sun.star.comp.Calc.XMLOasisSettingsExporter", SvXMLExportFlags::SETTINGS|SvXMLExportFlags::OASIS)); } +namespace { + class ScXMLShapeExport : public XMLShapeExport { public: @@ -312,6 +314,8 @@ public: virtual void onExport( const uno::Reference < drawing::XShape >& xShape ) override; }; +} + void ScXMLShapeExport::onExport( const uno::Reference < drawing::XShape >& xShape ) { uno::Reference< beans::XPropertySet > xShapeProp( xShape, uno::UNO_QUERY ); diff --git a/sc/source/filter/xml/xmlfonte.cxx b/sc/source/filter/xml/xmlfonte.cxx index 773848bfdf47..22b31e73f27e 100644 --- a/sc/source/filter/xml/xmlfonte.cxx +++ b/sc/source/filter/xml/xmlfonte.cxx @@ -30,6 +30,8 @@ #include <stlpool.hxx> #include <attrib.hxx> +namespace { + class ScXMLFontAutoStylePool_Impl: public XMLFontAutoStylePool { private: @@ -43,6 +45,8 @@ public: virtual ~ScXMLFontAutoStylePool_Impl() override; }; +} + void ScXMLFontAutoStylePool_Impl::AddFontItems(const sal_uInt16* pWhichIds, sal_uInt8 nIdCount, const SfxItemPool* pItemPool, const bool bExportDefaults) { for( sal_uInt16 i=0; i < nIdCount; ++i ) diff --git a/sc/source/filter/xml/xmlimprt.cxx b/sc/source/filter/xml/xmlimprt.cxx index f97b06884261..08e01b8cf7cd 100644 --- a/sc/source/filter/xml/xmlimprt.cxx +++ b/sc/source/filter/xml/xmlimprt.cxx @@ -222,6 +222,8 @@ const SvXMLTokenMap& ScXMLImport::GetTableRowCellAttrTokenMap() return *pTableRowCellAttrTokenMap; } +namespace { + // NB: virtually inherit so we can multiply inherit properly // in ScXMLFlatDocContext_Impl class ScXMLDocContext_Impl : public virtual SvXMLImportContext @@ -248,11 +250,15 @@ public: virtual void SAL_CALL endFastElement(sal_Int32 nElement) override; }; +} + ScXMLDocContext_Impl::ScXMLDocContext_Impl( ScXMLImport& rImport ) : SvXMLImportContext( rImport ) { } +namespace { + // context for flat file xml format class ScXMLFlatDocContext_Impl : public ScXMLDocContext_Impl, public SvXMLMetaDocumentContext @@ -274,6 +280,8 @@ public: const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList ) override; }; +} + ScXMLFlatDocContext_Impl::ScXMLFlatDocContext_Impl( ScXMLImport& i_rImport, const uno::Reference<document::XDocumentProperties>& i_xDocProps) : SvXMLImportContext(i_rImport), @@ -308,6 +316,8 @@ void SAL_CALL ScXMLFlatDocContext_Impl::characters(const OUString& rChars) SvXMLMetaDocumentContext::characters(rChars); } +namespace { + class ScXMLBodyContext_Impl : public ScXMLImportContext { public: @@ -318,6 +328,8 @@ public: const css::uno::Reference<css::xml::sax::XFastAttributeList>& xAttrList ) override; }; +} + ScXMLBodyContext_Impl::ScXMLBodyContext_Impl( ScXMLImport& rImport ) : ScXMLImportContext( rImport ) { diff --git a/sc/source/filter/xml/xmlstyli.cxx b/sc/source/filter/xml/xmlstyli.cxx index 792e59594bc7..1a92449707ec 100644 --- a/sc/source/filter/xml/xmlstyli.cxx +++ b/sc/source/filter/xml/xmlstyli.cxx @@ -260,6 +260,8 @@ void ScXMLRowImportPropertyMapper::finished(::std::vector< XMLPropertyState >& r // don't access pointers to rProperties elements after push_back! } +namespace { + class XMLTableCellPropsContext : public SvXMLPropertySetContext { using SvXMLPropertySetContext::CreateChildContext; @@ -279,6 +281,8 @@ class XMLTableCellPropsContext : public SvXMLPropertySetContext const XMLPropertyState& rProp ) override; }; +} + XMLTableCellPropsContext::XMLTableCellPropsContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, @@ -329,6 +333,8 @@ SvXMLImportContextRef XMLTableCellPropsContext::CreateChildContext( sal_uInt16 n return SvXMLPropertySetContext::CreateChildContext( nPrefix, rLocalName, xAttrList, rProperties, rProp ); } +namespace { + class ScXMLMapContext : public SvXMLImportContext { OUString msApplyStyle; @@ -346,6 +352,8 @@ public: ScCondFormatEntry* CreateConditionEntry(); }; +} + ScXMLMapContext::ScXMLMapContext(SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference< xml::sax::XAttributeList > & xAttrList ) : SvXMLImportContext( rImport, nPrfx, rLName ) diff --git a/sc/source/ui/Accessibility/AccessibleDocument.cxx b/sc/source/ui/Accessibility/AccessibleDocument.cxx index 836106cf193e..74d0b60ffe52 100644 --- a/sc/source/ui/Accessibility/AccessibleDocument.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocument.cxx @@ -86,6 +86,8 @@ using namespace ::com::sun::star::accessibility; //===== internal ======================================================== +namespace { + struct ScAccessibleShapeData { ScAccessibleShapeData(css::uno::Reference< css::drawing::XShape > xShape_); @@ -100,6 +102,8 @@ struct ScAccessibleShapeData boost::optional<sal_Int32> mxZOrder; }; +} + ScAccessibleShapeData::ScAccessibleShapeData(css::uno::Reference< css::drawing::XShape > xShape_) : xShape(xShape_), bSelected(false), bSelectable(true) @@ -128,6 +132,8 @@ ScAccessibleShapeData::~ScAccessibleShapeData() } } +namespace { + struct ScShapeDataLess { static void ConvertLayerId(sal_Int16& rLayerID) // changes the number of the LayerId so it the accessibility order @@ -193,6 +199,8 @@ struct ScShapeDataLess } }; +} + class ScChildrenShapes : public SfxListener, public ::accessibility::IAccessibleParent { diff --git a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx index a6d7f5f08169..f887784bd92d 100644 --- a/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx +++ b/sc/source/ui/Accessibility/AccessibleDocumentPagePreview.cxx @@ -61,6 +61,8 @@ using namespace ::com::sun::star::accessibility; typedef std::vector< uno::Reference< XAccessible > > ScXAccVector; +namespace { + struct ScAccNote { OUString maNoteText; @@ -78,6 +80,8 @@ struct ScAccNote } }; +} + class ScNotesChildren { public: @@ -120,6 +124,8 @@ ScNotesChildren::ScNotesChildren(ScPreviewShell* pViewShell, ScAccessibleDocumen { } +namespace { + struct DeleteAccNote { void operator()(ScAccNote& rNote) @@ -129,6 +135,8 @@ struct DeleteAccNote } }; +} + ScNotesChildren::~ScNotesChildren() { std::for_each(maNotes.begin(), maNotes.end(), DeleteAccNote()); @@ -196,6 +204,8 @@ void ScNotesChildren::Init(const tools::Rectangle& rVisRect, sal_Int32 nOffset) } } +namespace { + struct ScParaFound { sal_Int32 mnIndex; @@ -211,6 +221,8 @@ struct ScParaFound } }; +} + uno::Reference<XAccessible> ScNotesChildren::GetChild(sal_Int32 nIndex) const { uno::Reference<XAccessible> xAccessible; @@ -252,6 +264,8 @@ uno::Reference<XAccessible> ScNotesChildren::GetChild(sal_Int32 nIndex) const return xAccessible; } +namespace { + struct ScPointFound { tools::Rectangle const maPoint; @@ -268,6 +282,8 @@ struct ScPointFound } }; +} + uno::Reference<XAccessible> ScNotesChildren::GetAt(const awt::Point& rPoint) const { uno::Reference<XAccessible> xAccessible; @@ -410,6 +426,8 @@ sal_Int32 ScNotesChildren::CheckChanges(const ScPreviewLocationData& rData, return nParagraphs; } +namespace { + struct ScChildGone { ScAccessibleDocumentPagePreview* const mpAccDoc; @@ -446,6 +464,8 @@ struct ScChildNew } }; +} + void ScNotesChildren::DataChanged(const tools::Rectangle& rVisRect) { if (mpViewShell && mpAccDoc) @@ -472,6 +492,8 @@ inline ScDocument* ScNotesChildren::GetDocument() const return pDoc; } +namespace { + class ScIAccessibleViewForwarder : public ::accessibility::IAccessibleViewForwarder { public: @@ -492,6 +514,8 @@ private: MapMode maMapMode; }; +} + ScIAccessibleViewForwarder::ScIAccessibleViewForwarder() : mpViewShell(nullptr), mpAccDoc(nullptr) { @@ -548,6 +572,8 @@ Size ScIAccessibleViewForwarder::LogicToPixel (const Size& rSize) const return aSize; } +namespace { + struct ScShapeChild { ScShapeChild() @@ -560,6 +586,8 @@ struct ScShapeChild sal_Int32 mnRangeId; }; +} + ScShapeChild::~ScShapeChild() { if (mpAccShape.is()) @@ -568,6 +596,8 @@ ScShapeChild::~ScShapeChild() } } +namespace { + struct ScShapeChildLess { bool operator()(const ScShapeChild& rChild1, const ScShapeChild& rChild2) const @@ -579,8 +609,12 @@ struct ScShapeChildLess } }; +} + typedef std::vector<ScShapeChild> ScShapeChildVec; +namespace { + struct ScShapeRange { ScShapeChildVec maBackShapes; @@ -589,6 +623,8 @@ struct ScShapeRange ScIAccessibleViewForwarder maViewForwarder; }; +} + typedef std::vector<ScShapeRange> ScShapeRangeVec; class ScShapeChildren : public ::accessibility::IAccessibleParent @@ -856,6 +892,8 @@ uno::Reference<XAccessible> ScShapeChildren::GetControl(sal_Int32 nIndex) const return xAccessible; } +namespace { + struct ScShapePointFound { Point const maPoint; @@ -869,6 +907,8 @@ struct ScShapePointFound } }; +} + uno::Reference<XAccessible> ScShapeChildren::GetForegroundShapeAt(const awt::Point& rPoint) const //inclusive Controls { uno::Reference<XAccessible> xAcc; @@ -1016,6 +1056,8 @@ SdrPage* ScShapeChildren::GetDrawPage() const return pDrawPage; } +namespace { + struct ScPagePreviewCountData { // order is background shapes, header, table or notes, footer, foreground shapes, controls @@ -1038,6 +1080,8 @@ struct ScPagePreviewCountData } }; +} + ScPagePreviewCountData::ScPagePreviewCountData( const ScPreviewLocationData& rData, const vcl::Window* pSizeWindow, const ScNotesChildren* pNotesChildren, const ScShapeChildren* pShapeChildren) : diff --git a/sc/source/ui/Accessibility/AccessibleText.cxx b/sc/source/ui/Accessibility/AccessibleText.cxx index 2fa6f42415c7..0c167403cac6 100644 --- a/sc/source/ui/Accessibility/AccessibleText.cxx +++ b/sc/source/ui/Accessibility/AccessibleText.cxx @@ -249,48 +249,64 @@ void ScPreviewViewForwarder::SetInvalid() mpViewShell = nullptr; } +namespace { + class ScPreviewHeaderFooterViewForwarder : public ScPreviewViewForwarder { public: ScPreviewHeaderFooterViewForwarder(ScPreviewShell* pViewShell); }; +} + ScPreviewHeaderFooterViewForwarder::ScPreviewHeaderFooterViewForwarder(ScPreviewShell* pViewShell) : ScPreviewViewForwarder(pViewShell) { } +namespace { + class ScPreviewCellViewForwarder : public ScPreviewViewForwarder { public: ScPreviewCellViewForwarder(ScPreviewShell* pViewShell); }; +} + ScPreviewCellViewForwarder::ScPreviewCellViewForwarder(ScPreviewShell* pViewShell) : ScPreviewViewForwarder(pViewShell) { } +namespace { + class ScPreviewHeaderCellViewForwarder : public ScPreviewViewForwarder { public: ScPreviewHeaderCellViewForwarder(ScPreviewShell* pViewShell); }; +} + ScPreviewHeaderCellViewForwarder::ScPreviewHeaderCellViewForwarder(ScPreviewShell* pViewShell) : ScPreviewViewForwarder(pViewShell) { } +namespace { + class ScPreviewNoteViewForwarder : public ScPreviewViewForwarder { public: ScPreviewNoteViewForwarder(ScPreviewShell* pViewShell); }; +} + ScPreviewNoteViewForwarder::ScPreviewNoteViewForwarder(ScPreviewShell* pViewShell) : ScPreviewViewForwarder(pViewShell) diff --git a/sc/source/ui/dbgui/csvgrid.cxx b/sc/source/ui/dbgui/csvgrid.cxx index 1275113c7f29..5d3500097e24 100644 --- a/sc/source/ui/dbgui/csvgrid.cxx +++ b/sc/source/ui/dbgui/csvgrid.cxx @@ -49,6 +49,8 @@ #include <editutil.hxx> // *** edit engine *** +namespace { + struct Func_SetType { sal_Int32 const mnType; @@ -65,6 +67,8 @@ struct Func_Select { rState.Select( mbSelect ); } }; +} + ScCsvGrid::ScCsvGrid(const ScCsvLayoutData& rData, std::unique_ptr<weld::Menu> xPopup, ScCsvTableBox* pTableBox) : ScCsvControl(rData) , mpTableBox(pTableBox) diff --git a/sc/source/ui/dbgui/dbnamdlg.cxx b/sc/source/ui/dbgui/dbnamdlg.cxx index 722ffee83bdc..3f2592516319 100644 --- a/sc/source/ui/dbgui/dbnamdlg.cxx +++ b/sc/source/ui/dbgui/dbnamdlg.cxx @@ -36,8 +36,12 @@ #include <dbnamdlg.hxx> #include <dbdocfun.hxx> +namespace { + class DBSaveData; +} + static DBSaveData* pSaveObj = nullptr; namespace @@ -49,7 +53,6 @@ namespace rString)); xBox->run(); } -} // class DBSaveData @@ -94,6 +97,8 @@ private: bool bDirty:1; }; +} + void DBSaveData::Save() { aArea = rCurArea; diff --git a/sc/source/ui/docshell/docfunc.cxx b/sc/source/ui/docshell/docfunc.cxx index 6ce6664c024d..7b6794f2445d 100644 --- a/sc/source/ui/docshell/docfunc.cxx +++ b/sc/source/ui/docshell/docfunc.cxx @@ -1099,6 +1099,8 @@ void ScDocFunc::NotifyInputHandler( const ScAddress& rPos ) } } + namespace { + struct ScMyRememberItem { sal_Int32 const nIndex; @@ -1108,6 +1110,8 @@ void ScDocFunc::NotifyInputHandler( const ScAddress& rPos ) nIndex(nTempIndex), aItemSet(rItemSet) {} }; + } + typedef ::std::vector<std::unique_ptr<ScMyRememberItem>> ScMyRememberItemVector; void ScDocFunc::PutData( const ScAddress& rPos, ScEditEngineDefaulter& rEngine, bool bApi ) diff --git a/sc/source/ui/docshell/macromgr.cxx b/sc/source/ui/docshell/macromgr.cxx index 6f262bc5b35b..832dc35917b9 100644 --- a/sc/source/ui/docshell/macromgr.cxx +++ b/sc/source/ui/docshell/macromgr.cxx @@ -102,6 +102,8 @@ ScMacroManager::~ScMacroManager() typedef ::cppu::WeakImplHelper< css::container::XContainerListener > ContainerListenerHelper; +namespace { + class VBAProjectListener : public ContainerListenerHelper { ScMacroManager* mpMacroMgr; @@ -123,6 +125,8 @@ public: }; +} + void ScMacroManager::InitUserFuncData() { // Clear unordered_map diff --git a/sc/source/ui/miscdlgs/solveroptions.cxx b/sc/source/ui/miscdlgs/solveroptions.cxx index ce9f4f6d7c66..9e6333db4679 100644 --- a/sc/source/ui/miscdlgs/solveroptions.cxx +++ b/sc/source/ui/miscdlgs/solveroptions.cxx @@ -35,6 +35,8 @@ using namespace com::sun::star; +namespace { + /// Helper for sorting properties struct ScSolverOptionsEntry { @@ -49,6 +51,8 @@ struct ScSolverOptionsEntry } }; +} + ScSolverOptionsDialog::ScSolverOptionsDialog(weld::Window* pParent, const uno::Sequence<OUString>& rImplNames, const uno::Sequence<OUString>& rDescriptions, diff --git a/sc/source/ui/unoobj/cellsuno.cxx b/sc/source/ui/unoobj/cellsuno.cxx index 45df3be40ddc..8696bda0a8ff 100644 --- a/sc/source/ui/unoobj/cellsuno.cxx +++ b/sc/source/ui/unoobj/cellsuno.cxx @@ -138,6 +138,8 @@ using namespace com::sun::star; +namespace { + class ScNamedEntry { OUString aName; @@ -151,6 +153,8 @@ public: const ScRange& GetRange() const { return aRange; } }; +} + // The names in the maps must be sorted according to strcmp! //! Instead of Which-ID 0 use special IDs and do not compare via names! @@ -9071,6 +9075,8 @@ void ScUniqueCellFormatsObj::Notify( SfxBroadcaster&, const SfxHint& rHint ) // Fill the list of formats from the document +namespace { + // hash code to access the range lists by ScPatternAttr pointer struct ScPatternHashCode { @@ -9080,11 +9086,15 @@ struct ScPatternHashCode } }; +} + // Hash map to find a range by its start row typedef std::unordered_map< SCROW, ScRange > ScRowRangeHashMap; typedef std::vector<ScRange> ScRangeVector; +namespace { + // Hash map entry. // The Join method depends on the column-wise order of ScAttrRectIterator class ScUniqueFormatsEntry @@ -9105,6 +9115,8 @@ public: void Clear() { aReturnRanges.clear(); } // aJoinedRanges and aCompletedRanges are cleared in GetRanges }; +} + void ScUniqueFormatsEntry::Join( const ScRange& rNewRange ) { // Special-case handling for single range @@ -9192,6 +9204,8 @@ const ScRangeList& ScUniqueFormatsEntry::GetRanges() typedef std::unordered_map< const ScPatternAttr*, ScUniqueFormatsEntry, ScPatternHashCode > ScUniqueFormatsHashMap; +namespace { + // function object to sort the range lists by start of first range struct ScUniqueFormatsOrder { @@ -9205,6 +9219,8 @@ struct ScUniqueFormatsOrder } }; +} + ScUniqueCellFormatsObj::ScUniqueCellFormatsObj(ScDocShell* pDocSh, const ScRange& rRange) : pDocShell( pDocSh ), aTotalRange( rRange ), diff --git a/sc/source/ui/unoobj/fielduno.cxx b/sc/source/ui/unoobj/fielduno.cxx index 4e6b6332be89..331b38de448a 100644 --- a/sc/source/ui/unoobj/fielduno.cxx +++ b/sc/source/ui/unoobj/fielduno.cxx @@ -157,8 +157,6 @@ enum ScUnoCollectMode SC_UNO_COLLECT_FINDPOS }; -} - /** * This class exists solely to allow searching through field items. TODO: * Look into providing the same functionality directly in EditEngine, to @@ -189,6 +187,8 @@ public: sal_Int32 GetFieldPos() const { return nFieldPos; } }; +} + ScUnoEditEngine::ScUnoEditEngine(ScEditEngineDefaulter* pSource) : ScEditEngineDefaulter(*pSource) , eMode(SC_UNO_COLLECT_NONE) diff --git a/sc/source/ui/unoobj/funcuno.cxx b/sc/source/ui/unoobj/funcuno.cxx index 128811bf1ae7..b65b34d168e7 100644 --- a/sc/source/ui/unoobj/funcuno.cxx +++ b/sc/source/ui/unoobj/funcuno.cxx @@ -57,6 +57,8 @@ using namespace com::sun::star; // helper to use cached document if not in use, temporary document otherwise +namespace { + class ScTempDocSource { private: @@ -72,6 +74,8 @@ public: ScDocument* GetDocument(); }; +} + ScDocument* ScTempDocSource::CreateDocument() { ScDocument* pDoc = new ScDocument( SCDOCMODE_FUNCTIONACCESS ); @@ -312,6 +316,8 @@ static void lcl_AddRef( ScTokenArray& rArray, long nStartRow, long nColCount, lo rArray.AddDoubleReference(aRef); } +namespace { + class SimpleVisitor { protected: @@ -439,6 +445,8 @@ static void processSequences( ScDocument* pDoc, const uno::Any& rArg, ScTokenArr } }; +} + uno::Any SAL_CALL ScFunctionAccess::callFunction( const OUString& aName, const uno::Sequence<uno::Any>& aArguments ) { diff --git a/sc/source/ui/unoobj/servuno.cxx b/sc/source/ui/unoobj/servuno.cxx index 23c7c4b93d27..ac0409d1cf15 100644 --- a/sc/source/ui/unoobj/servuno.cxx +++ b/sc/source/ui/unoobj/servuno.cxx @@ -81,6 +81,8 @@ static bool isInVBAMode( ScDocShell& rDocSh ) #endif +namespace { + class ScVbaObjectForCodeNameProvider : public ::cppu::WeakImplHelper< container::XNameAccess > { uno::Any maWorkbook; @@ -240,8 +242,6 @@ public: } }; -namespace { - using Type = ScServiceProvider::Type; struct ProvNamesId_Type diff --git a/sc/source/ui/vba/excelvbahelper.cxx b/sc/source/ui/vba/excelvbahelper.cxx index 3a1e025bd717..b1f98144fd93 100644 --- a/sc/source/ui/vba/excelvbahelper.cxx +++ b/sc/source/ui/vba/excelvbahelper.cxx @@ -110,6 +110,8 @@ void implSetZoom( const uno::Reference< frame::XModel >& xModel, sal_Int16 nZoom const OUString REPLACE_CELLS_WARNING( "ReplaceCellsWarning"); +namespace { + class PasteCellsWarningReseter { private: @@ -154,6 +156,8 @@ public: } }; +} + void implnPaste( const uno::Reference< frame::XModel>& xModel ) { diff --git a/sc/source/ui/vba/vbaapplication.cxx b/sc/source/ui/vba/vbaapplication.cxx index 4c09ace2e90c..877020e061c5 100644 --- a/sc/source/ui/vba/vbaapplication.cxx +++ b/sc/source/ui/vba/vbaapplication.cxx @@ -115,6 +115,8 @@ ScVbaAppSettings::ScVbaAppSettings() : { } +namespace { + struct ScVbaStaticAppSettings : public ::rtl::Static< ScVbaAppSettings, ScVbaStaticAppSettings > {}; class ScVbaApplicationOutgoingConnectionPoint : public cppu::WeakImplHelper<XConnectionPoint> @@ -130,6 +132,8 @@ public: void SAL_CALL Unadvise( sal_uInt32 Cookie ) override; }; +} + sal_uInt32 ScVbaApplication::AddSink( const uno::Reference< XSink >& xSink ) { diff --git a/sc/source/ui/vba/vbaborders.cxx b/sc/source/ui/vba/vbaborders.cxx index 815f007676fa..406cea8a410b 100644 --- a/sc/source/ui/vba/vbaborders.cxx +++ b/sc/source/ui/vba/vbaborders.cxx @@ -49,6 +49,8 @@ const static sal_Int32 OOLineMedium = 88; const static sal_Int32 OOLineThick = 141; const static sal_Int32 OOLineHairline = 2; +namespace { + class ScVbaBorder : public ScVbaBorder_Base { private: @@ -350,12 +352,16 @@ public: } }; +} + static uno::Reference< container::XIndexAccess > rangeToBorderIndexAccess( const uno::Reference< table::XCellRange >& xRange, const uno::Reference< uno::XComponentContext > & xContext, const ScVbaPalette& rPalette ) { return new RangeBorders( xRange, xContext, rPalette ); } +namespace { + class RangeBorderEnumWrapper : public EnumerationHelper_BASE { uno::Reference<container::XIndexAccess > m_xIndexAccess; @@ -375,6 +381,8 @@ public: } }; +} + ScVbaBorders::ScVbaBorders( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< table::XCellRange >& xRange, diff --git a/sc/source/ui/vba/vbachartobjects.cxx b/sc/source/ui/vba/vbachartobjects.cxx index 1ded0545c49e..dabe9a1a06dd 100644 --- a/sc/source/ui/vba/vbachartobjects.cxx +++ b/sc/source/ui/vba/vbachartobjects.cxx @@ -35,6 +35,8 @@ using namespace ::com::sun::star; using namespace ::ooo::vba; +namespace { + class ChartObjectEnumerationImpl : public EnumerationHelperImpl { uno::Reference< drawing::XDrawPageSupplier > xDrawPageSupplier; @@ -76,6 +78,8 @@ public: } }; +} + ScVbaChartObjects::ScVbaChartObjects( const css::uno::Reference< ov::XHelperInterface >& _xParent, const css::uno::Reference< css::uno::XComponentContext >& _xContext, const css::uno::Reference< css::table::XTableCharts >& _xTableCharts, const uno::Reference< drawing::XDrawPageSupplier >& _xDrawPageSupplier ) : ChartObjects_BASE(_xParent, _xContext, css::uno::Reference< css::container::XIndexAccess >( _xTableCharts, css::uno::UNO_QUERY ) ), xTableCharts( _xTableCharts ) , xDrawPageSupplier( _xDrawPageSupplier ) { diff --git a/sc/source/ui/vba/vbacomments.cxx b/sc/source/ui/vba/vbacomments.cxx index a1b2001c522a..b8d933fc8378 100644 --- a/sc/source/ui/vba/vbacomments.cxx +++ b/sc/source/ui/vba/vbacomments.cxx @@ -38,6 +38,8 @@ static uno::Any AnnotationToComment( const uno::Any& aSource, const uno::Referen new ScVbaComment( uno::Reference< XHelperInterface >(), xContext, xModel, xCellRange ) ) ); } +namespace { + class CommentEnumeration : public EnumerationHelperImpl { css::uno::Reference< css::frame::XModel > mxModel; @@ -59,6 +61,8 @@ public: }; +} + ScVbaComments::ScVbaComments( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, diff --git a/sc/source/ui/vba/vbafiledialogitems.cxx b/sc/source/ui/vba/vbafiledialogitems.cxx index 66d6ea976b2a..14c7853ee178 100644 --- a/sc/source/ui/vba/vbafiledialogitems.cxx +++ b/sc/source/ui/vba/vbafiledialogitems.cxx @@ -21,6 +21,8 @@ using namespace ::com::sun::star; using namespace ::ooo::vba; +namespace { + class FileDialogItemEnumeration : public ::cppu::WeakImplHelper< container::XEnumeration > { std::vector< OUString > m_sItems; @@ -40,6 +42,8 @@ public: } }; +} + ScVbaFileDialogSelectedItems::ScVbaFileDialogSelectedItems( const css::uno::Reference< ov::XHelperInterface >& xParent ,const css::uno::Reference< css::uno::XComponentContext >& xContext diff --git a/sc/source/ui/vba/vbamenubars.cxx b/sc/source/ui/vba/vbamenubars.cxx index c521cf562920..5e84e72139c0 100644 --- a/sc/source/ui/vba/vbamenubars.cxx +++ b/sc/source/ui/vba/vbamenubars.cxx @@ -15,6 +15,8 @@ using namespace com::sun::star; using namespace ooo::vba; +namespace { + class MenuBarEnumeration : public ::cppu::WeakImplHelper< container::XEnumeration > { uno::Reference< XHelperInterface > m_xParent; @@ -41,6 +43,8 @@ public: } }; +} + ScVbaMenuBars::ScVbaMenuBars( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCommandBars >& xCommandBars ) : MenuBars_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() ), m_xCommandBars( xCommandBars ) { } diff --git a/sc/source/ui/vba/vbamenuitems.cxx b/sc/source/ui/vba/vbamenuitems.cxx index c64fefb9e6a1..fb7271ef3f21 100644 --- a/sc/source/ui/vba/vbamenuitems.cxx +++ b/sc/source/ui/vba/vbamenuitems.cxx @@ -18,6 +18,8 @@ using namespace ooo::vba; typedef ::cppu::WeakImplHelper< container::XEnumeration > MenuEnumeration_BASE; +namespace { + class MenuEnumeration : public MenuEnumeration_BASE { uno::Reference< XHelperInterface > m_xParent; @@ -55,6 +57,8 @@ public: } }; +} + ScVbaMenuItems::ScVbaMenuItems( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCommandBarControls >& xCommandBarControls ) : MenuItems_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() ), m_xCommandBarControls( xCommandBarControls ) { } diff --git a/sc/source/ui/vba/vbamenus.cxx b/sc/source/ui/vba/vbamenus.cxx index 84c001d9adec..f6b33fd89603 100644 --- a/sc/source/ui/vba/vbamenus.cxx +++ b/sc/source/ui/vba/vbamenus.cxx @@ -17,6 +17,8 @@ using namespace ooo::vba; typedef ::cppu::WeakImplHelper< container::XEnumeration > MenuEnumeration_BASE; +namespace { + class MenuEnumeration : public MenuEnumeration_BASE { uno::Reference< XHelperInterface > m_xParent; @@ -49,6 +51,8 @@ public: } }; +} + ScVbaMenus::ScVbaMenus( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< XCommandBarControls >& xCommandBarControls ) : Menus_BASE( xParent, xContext, uno::Reference< container::XIndexAccess>() ), m_xCommandBarControls( xCommandBarControls ) { } diff --git a/sc/source/ui/vba/vbanames.cxx b/sc/source/ui/vba/vbanames.cxx index 357067363074..6f2c2c5a255a 100644 --- a/sc/source/ui/vba/vbanames.cxx +++ b/sc/source/ui/vba/vbanames.cxx @@ -37,6 +37,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class NamesEnumeration : public EnumerationHelperImpl { uno::Reference< frame::XModel > m_xModel; @@ -53,6 +55,8 @@ public: }; +} + ScVbaNames::ScVbaNames(const css::uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext, const css::uno::Reference< css::sheet::XNamedRanges >& xNames, diff --git a/sc/source/ui/vba/vbapagebreaks.cxx b/sc/source/ui/vba/vbapagebreaks.cxx index 3da93b39c235..6fafa9ec1420 100644 --- a/sc/source/ui/vba/vbapagebreaks.cxx +++ b/sc/source/ui/vba/vbapagebreaks.cxx @@ -29,6 +29,8 @@ using namespace ::com::sun::star; using namespace ::ooo::vba; +namespace { + class RangePageBreaks : public ::cppu::WeakImplHelper<container::XIndexAccess > { private: @@ -102,6 +104,8 @@ public: } }; +} + /** @TODO Unlike MS Excel this method only considers the pagebreaks that intersect the used range * To become completely compatible the print area has to be considered. As far as I found out this printarea * also considers the position and sizes of shapes and manually inserted page breaks @@ -184,6 +188,8 @@ uno::Any RangePageBreaks::Add( const css::uno::Any& Before ) return uno::makeAny( uno::Reference< excel::XHPageBreak >( new ScVbaHPageBreak( mxParent, mxContext, xRowColPropertySet, aTablePageBreakData) )); } +namespace { + class RangePageBreaksEnumWrapper : public EnumerationHelper_BASE { uno::Reference<container::XIndexAccess > m_xIndexAccess; @@ -203,6 +209,8 @@ public: } }; +} + ScVbaHPageBreaks::ScVbaHPageBreaks( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< sheet::XSheetPageBreak >& xSheetPageBreak): diff --git a/sc/source/ui/vba/vbapalette.cxx b/sc/source/ui/vba/vbapalette.cxx index 36b658a2e596..86bbc1031f15 100644 --- a/sc/source/ui/vba/vbapalette.cxx +++ b/sc/source/ui/vba/vbapalette.cxx @@ -51,6 +51,8 @@ static const Color spnDefColorTable8[] = typedef ::cppu::WeakImplHelper< container::XIndexAccess > XIndexAccess_BASE; +namespace { + class DefaultPalette : public XIndexAccess_BASE { public: @@ -81,6 +83,8 @@ public: }; +} + ScVbaPalette::ScVbaPalette( const uno::Reference< frame::XModel >& rxModel ) : m_pShell( excel::getDocShell( rxModel ) ) { diff --git a/sc/source/ui/vba/vbapivottables.cxx b/sc/source/ui/vba/vbapivottables.cxx index 383faf3ee2b9..8dad4b638624 100644 --- a/sc/source/ui/vba/vbapivottables.cxx +++ b/sc/source/ui/vba/vbapivottables.cxx @@ -30,6 +30,8 @@ static uno::Any DataPilotToPivotTable( const uno::Any& aSource, const uno::Refer return uno::makeAny( uno::Reference< excel::XPivotTable > ( new ScVbaPivotTable( xContext, xTable ) ) ); } +namespace { + class PivotTableEnumeration : public EnumerationHelperImpl { public: @@ -43,6 +45,8 @@ public: }; +} + ScVbaPivotTables::ScVbaPivotTables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess ): ScVbaPivotTables_BASE( xParent, xContext, xIndexAccess ) { } diff --git a/sc/source/ui/vba/vbarange.cxx b/sc/source/ui/vba/vbarange.cxx index 7b049cb1c6ca..6233f5c5aaa0 100644 --- a/sc/source/ui/vba/vbarange.cxx +++ b/sc/source/ui/vba/vbarange.cxx @@ -269,6 +269,8 @@ void ScVbaRange::fireChangeEvent() } } +namespace { + class SingleRangeEnumeration : public EnumerationHelper_BASE { uno::Reference< table::XCellRange > m_xRange; @@ -347,6 +349,8 @@ public: }; +} + uno::Reference< container::XEnumeration > SAL_CALL ScVbaRangeAreas::createEnumeration() { @@ -472,6 +476,8 @@ const ScRangeList& ScVbaRange::getScRangeList( const uno::Reference< excel::XRan throw uno::RuntimeException("Cannot obtain VBA range implementation object" ); } +namespace { + class NumFormatHelper { uno::Reference< util::XNumberFormatsSupplier > mxSupplier; @@ -576,9 +582,13 @@ sal_Int32 const m_nCol; sal_Int32 const m_nArea; }; +} + typedef ::cppu::WeakImplHelper< container::XEnumeration > CellsEnumeration_BASE; typedef ::std::vector< CellPos > vCellPos; +namespace { + // #FIXME - QUICK // we could probably could and should modify CellsEnumeration below // to handle rows and columns (but I do this separately for now @@ -661,6 +671,8 @@ public: } }; +} + static const char ISVISIBLE[] = "IsVisible"; static const char EQUALS[] = "="; static const char NOTEQUALS[] = "<>"; @@ -671,6 +683,8 @@ static const char LESSTHANEQUALS[] = "<="; static const char STR_ERRORMESSAGE_APPLIESTOSINGLERANGEONLY[] = "The command you chose cannot be performed with multiple selections.\nSelect a single range and click the command again"; static const char CELLSTYLE[] = "CellStyle"; +namespace { + class CellValueSetter : public ValueSetter { protected: @@ -682,6 +696,8 @@ public: }; +} + CellValueSetter::CellValueSetter( const uno::Any& aValue ): maValue( aValue ) {} void @@ -765,6 +781,8 @@ CellValueSetter::processValue( const uno::Any& aValue, const uno::Reference< tab } +namespace { + class CellValueGetter : public ValueGetter { protected: @@ -777,6 +795,8 @@ public: }; +} + void CellValueGetter::processValue( const uno::Any& aValue ) { @@ -833,6 +853,8 @@ void CellValueGetter::visitNode( sal_Int32 /*x*/, sal_Int32 /*y*/, const uno::Re processValue( aValue ); } +namespace { + class CellFormulaValueSetter : public CellValueSetter { private: @@ -946,8 +968,12 @@ public: }; +} + static const char sNA[] = "#N/A"; +namespace { + class Dim1ArrayValueSetter : public ArrayVisitor { uno::Sequence< uno::Any > aMatrix; @@ -1117,6 +1143,8 @@ public: }; +} + bool ScVbaRange::getCellRangesForAddress( ScRefFlags& rResFlags, const OUString& sAddress, ScDocShell* pDocSh, ScRangeList& rCellRanges, formula::FormulaGrammar::AddressConvention eConv, char cDelimiter ) { diff --git a/sc/source/ui/vba/vbasheetobjects.cxx b/sc/source/ui/vba/vbasheetobjects.cxx index 2d8568526039..672c638c37c1 100644 --- a/sc/source/ui/vba/vbasheetobjects.cxx +++ b/sc/source/ui/vba/vbasheetobjects.cxx @@ -267,6 +267,8 @@ void ScVbaObjectContainer::implOnShapeCreated( const uno::Reference< drawing::XS { } +namespace { + class ScVbaObjectEnumeration : public SimpleEnumerationBase { public: @@ -277,6 +279,8 @@ private: ScVbaObjectContainerRef mxContainer; }; +} + ScVbaObjectEnumeration::ScVbaObjectEnumeration( const ScVbaObjectContainerRef& rxContainer ) : SimpleEnumerationBase( rxContainer.get() ), mxContainer( rxContainer ) @@ -362,6 +366,8 @@ uno::Any SAL_CALL ScVbaGraphicObjectsBase::Add( const uno::Any& rLeft, const uno // Drawing controls +namespace { + class ScVbaControlContainer : public ScVbaObjectContainer { public: @@ -391,6 +397,8 @@ protected: sal_Int16 /* css::form::FormComponentType */ meType; }; +} + ScVbaControlContainer::ScVbaControlContainer( const uno::Reference< XHelperInterface >& rxParent, const uno::Reference< uno::XComponentContext >& rxContext, @@ -475,6 +483,8 @@ void ScVbaControlContainer::implOnShapeCreated( const uno::Reference< drawing::X // Push button +namespace { + class ScVbaButtonContainer : public ScVbaControlContainer { bool mbOptionButtons; @@ -492,6 +502,8 @@ protected: virtual bool implCheckProperties( const uno::Reference< beans::XPropertySet >& rxModelProps ) const override; }; +} + ScVbaButtonContainer::ScVbaButtonContainer( const uno::Reference< XHelperInterface >& rxParent, const uno::Reference< uno::XComponentContext >& rxContext, diff --git a/sc/source/ui/vba/vbawindow.cxx b/sc/source/ui/vba/vbawindow.cxx index fd07496d5f1a..34e2e95d54b3 100644 --- a/sc/source/ui/vba/vbawindow.cxx +++ b/sc/source/ui/vba/vbawindow.cxx @@ -62,6 +62,8 @@ typedef ::cppu::WeakImplHelper< container::XEnumerationAccess , css::container::XNameAccess > SelectedSheets_BASE; +namespace { + class SelectedSheetsEnum : public ::cppu::WeakImplHelper< container::XEnumeration > { public: @@ -182,6 +184,8 @@ public: }; +} + ScVbaWindow::ScVbaWindow( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, diff --git a/sc/source/ui/vba/vbawindows.cxx b/sc/source/ui/vba/vbawindows.cxx index 648109031e46..b9b869f60412 100644 --- a/sc/source/ui/vba/vbawindows.cxx +++ b/sc/source/ui/vba/vbawindows.cxx @@ -51,6 +51,9 @@ static uno::Any ComponentToWindow( const uno::Any& aSource, const uno::Reference } typedef std::vector < uno::Reference< sheet::XSpreadsheetDocument > > Components; + +namespace { + // #TODO more or less the same as class in workwindows ( code sharing needed ) class WindowComponentEnumImpl : public EnumerationHelper_BASE { @@ -106,11 +109,15 @@ public: } }; +} + typedef ::cppu::WeakImplHelper< container::XEnumerationAccess , css::container::XIndexAccess , css::container::XNameAccess > WindowsAccessImpl_BASE; +namespace { + class WindowsAccessImpl : public WindowsAccessImpl_BASE { uno::Reference< uno::XComponentContext > m_xContext; @@ -192,6 +199,8 @@ public: }; +} + ScVbaWindows::ScVbaWindows( const uno::Reference< ov::XHelperInterface >& xParent, const css::uno::Reference< css::uno::XComponentContext >& xContext ) : ScVbaWindows_BASE( xParent, xContext, uno::Reference< container::XIndexAccess > ( new WindowsAccessImpl( xContext ) ) ) { } diff --git a/sc/source/ui/vba/vbaworkbooks.cxx b/sc/source/ui/vba/vbaworkbooks.cxx index b5a53c772930..61edd810ba9c 100644 --- a/sc/source/ui/vba/vbaworkbooks.cxx +++ b/sc/source/ui/vba/vbaworkbooks.cxx @@ -56,6 +56,8 @@ getWorkbook( const uno::Reference< uno::XComponentContext >& xContext, return uno::Any( uno::Reference< excel::XWorkbook > (pWb) ); } +namespace { + class WorkBookEnumImpl : public EnumerationHelperImpl { public: @@ -70,6 +72,8 @@ public: }; +} + ScVbaWorkbooks::ScVbaWorkbooks( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext >& xContext ) : ScVbaWorkbooks_BASE( xParent, xContext, VbaDocumentsBase::EXCEL_DOCUMENT ) { } diff --git a/sc/source/ui/vba/vbaworksheets.cxx b/sc/source/ui/vba/vbaworksheets.cxx index d2c6a882658c..5e6e384433c5 100644 --- a/sc/source/ui/vba/vbaworksheets.cxx +++ b/sc/source/ui/vba/vbaworksheets.cxx @@ -49,6 +49,8 @@ typedef std::vector< uno::Reference< sheet::XSpreadsheet > > SheetMap; // #FIXME #TODO the implementation of the Sheets collections sucks, // e.g. there is no support for tracking sheets added/removed from the collection +namespace { + class WorkSheetsEnumeration : public ::cppu::WeakImplHelper< container::XEnumeration > { SheetMap mSheetMap; @@ -155,6 +157,8 @@ public: }; +} + ScVbaWorksheets::ScVbaWorksheets( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xSheets, const uno::Reference< frame::XModel >& xModel ): ScVbaWorksheets_BASE( xParent, xContext, xSheets ), mxModel( xModel ), m_xSheets( uno::Reference< sheet::XSpreadsheets >( xSheets, uno::UNO_QUERY ) ) { } diff --git a/sc/source/ui/view/dbfunc3.cxx b/sc/source/ui/view/dbfunc3.cxx index d25183400750..07a61bf4fc64 100644 --- a/sc/source/ui/view/dbfunc3.cxx +++ b/sc/source/ui/view/dbfunc3.cxx @@ -1619,6 +1619,8 @@ static void lcl_MoveToEnd( ScDPSaveDimension& rDim, const OUString& rItemName ) // puts it to the end of the list even if it was in the list before. } +namespace { + struct ScOUStringCollate { CollatorWrapper* const mpCollator; @@ -1631,6 +1633,8 @@ struct ScOUStringCollate } }; +} + void ScDBFunc::DataPilotSort(ScDPObject* pDPObj, long nDimIndex, bool bAscending, const sal_uInt16* pUserListId) { if (!pDPObj) diff --git a/sc/source/ui/view/drawview.cxx b/sc/source/ui/view/drawview.cxx index 992e716e0657..74d054f092a0 100644 --- a/sc/source/ui/view/drawview.cxx +++ b/sc/source/ui/view/drawview.cxx @@ -1147,6 +1147,8 @@ namespace sdr { namespace contact { + namespace { + class ObjectContactOfScDrawView final : public ObjectContactOfPageView { private: @@ -1168,6 +1170,8 @@ namespace sdr const basegfx::B2DRange& rB2DRange) const override; }; + } + ObjectContactOfScDrawView::ObjectContactOfScDrawView( const ScDrawView& rScDrawView, SdrPageWindow& rPageWindow, diff --git a/sc/source/ui/view/gridwin.cxx b/sc/source/ui/view/gridwin.cxx index e5b7d9e8756e..f6b63b2186da 100644 --- a/sc/source/ui/view/gridwin.cxx +++ b/sc/source/ui/view/gridwin.cxx @@ -306,6 +306,8 @@ void ScFilterListBox::SelectHdl() } } +namespace { + // use a System floating window for the above filter listbox class ScFilterFloatingWindow : public FloatingWindow { @@ -315,6 +317,8 @@ public: virtual void dispose() override; }; +} + ScFilterFloatingWindow::ScFilterFloatingWindow( vcl::Window* pParent, WinBits nStyle ) : FloatingWindow( pParent, nStyle|WB_SYSTEMWINDOW ) // make it a system floater {} diff --git a/sc/source/ui/view/scextopt.cxx b/sc/source/ui/view/scextopt.cxx index 167b75d721ab..4f8fa5eae9dc 100644 --- a/sc/source/ui/view/scextopt.cxx +++ b/sc/source/ui/view/scextopt.cxx @@ -50,6 +50,8 @@ ScExtTabSettings::ScExtTabSettings() : { } +namespace { + /** A container for ScExtTabSettings objects. @descr Internally, a std::map with shared pointers to ScExtTabSettings is used. The copy constructor and assignment operator make deep copies of the @@ -76,6 +78,8 @@ private: ScExtTabSettingsMap maMap; }; +} + ScExtTabSettingsCont::ScExtTabSettingsCont() { } diff --git a/sc/source/ui/view/tabvwshb.cxx b/sc/source/ui/view/tabvwshb.cxx index 76c330dadc50..8f3e89b2b50a 100644 --- a/sc/source/ui/view/tabvwshb.cxx +++ b/sc/source/ui/view/tabvwshb.cxx @@ -93,6 +93,8 @@ void ScTabViewShell::ConnectObject( const SdrOle2Obj* pObj ) } } +namespace { + class PopupCallback : public cppu::WeakImplHelper<css::awt::XCallback> { ScTabViewShell* m_pViewShell; @@ -134,6 +136,8 @@ public: } }; +} + void ScTabViewShell::ActivateObject( SdrOle2Obj* pObj, long nVerb ) { // Do not leave the hint message box on top of the object diff --git a/sccomp/source/solver/CoinMPSolver.cxx b/sccomp/source/solver/CoinMPSolver.cxx index 41d3601b114e..bd12c85c4fc4 100644 --- a/sccomp/source/solver/CoinMPSolver.cxx +++ b/sccomp/source/solver/CoinMPSolver.cxx @@ -35,6 +35,8 @@ namespace com::sun::star::uno { class XComponentContext; } using namespace com::sun::star; +namespace { + class CoinMPSolver : public SolverComponent { public: @@ -52,6 +54,8 @@ private: } }; +} + void SAL_CALL CoinMPSolver::solve() { uno::Reference<frame::XModel> xModel( mxDoc, uno::UNO_QUERY_THROW ); diff --git a/sccomp/source/solver/LpsolveSolver.cxx b/sccomp/source/solver/LpsolveSolver.cxx index 01f4bfba2bb1..e53c685555d8 100644 --- a/sccomp/source/solver/LpsolveSolver.cxx +++ b/sccomp/source/solver/LpsolveSolver.cxx @@ -64,6 +64,8 @@ namespace com::sun::star::uno { class XComponentContext; } using namespace com::sun::star; +namespace { + class LpsolveSolver : public SolverComponent { public: @@ -81,6 +83,8 @@ private: } }; +} + void SAL_CALL LpsolveSolver::solve() { uno::Reference<frame::XModel> xModel( mxDoc, uno::UNO_QUERY_THROW ); diff --git a/sccomp/source/solver/SwarmSolver.cxx b/sccomp/source/solver/SwarmSolver.cxx index c15745cf7eee..a3f2bbec518a 100644 --- a/sccomp/source/solver/SwarmSolver.cxx +++ b/sccomp/source/solver/SwarmSolver.cxx @@ -99,6 +99,8 @@ enum typedef cppu::WeakImplHelper<sheet::XSolver, sheet::XSolverDescription, lang::XServiceInfo> SwarmSolver_Base; +namespace +{ class SwarmSolver : public comphelper::OMutexAndBroadcastHelper, public comphelper::OPropertyContainer, public comphelper::OPropertyArrayUsageHelper<SwarmSolver>, @@ -278,6 +280,7 @@ public: double clampVariable(size_t nVarIndex, double fValue); double boundVariable(size_t nVarIndex, double fValue); }; +} OUString SwarmSolver::getResourceString(const char* pId) { @@ -448,6 +451,8 @@ bool SwarmSolver::doesViolateConstraints() return false; } +namespace +{ template <typename SwarmAlgorithm> class SwarmRunner { private: @@ -494,6 +499,7 @@ public: return mrAlgorithm.getResult(); } }; +} void SAL_CALL SwarmSolver::solve() { diff --git a/scripting/source/dlgprov/dlgevtatt.cxx b/scripting/source/dlgprov/dlgevtatt.cxx index 33e979753d3e..bf7fe601d299 100644 --- a/scripting/source/dlgprov/dlgevtatt.cxx +++ b/scripting/source/dlgprov/dlgevtatt.cxx @@ -58,6 +58,7 @@ using namespace ::com::sun::star::reflection; namespace dlgprov { + namespace { class DialogSFScriptListenerImpl : public DialogScriptListenerImpl { @@ -106,6 +107,8 @@ namespace dlgprov DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel, const OUString& sDialogLibName ); }; + } + DialogVBAScriptListenerImpl::DialogVBAScriptListenerImpl( const Reference< XComponentContext >& rxContext, const Reference< awt::XControl >& rxControl, const Reference< frame::XModel >& xModel, const OUString& sDialogLibName ) : DialogScriptListenerImpl( rxContext ), msDialogLibName( sDialogLibName ) { Reference< XMultiComponentFactory > xSMgr( m_xContext->getServiceManager() ); diff --git a/scripting/source/provider/BrowseNodeFactoryImpl.cxx b/scripting/source/provider/BrowseNodeFactoryImpl.cxx index 5603cbdae062..b544fd328a56 100644 --- a/scripting/source/provider/BrowseNodeFactoryImpl.cxx +++ b/scripting/source/provider/BrowseNodeFactoryImpl.cxx @@ -54,6 +54,7 @@ using namespace ::sf_misc; namespace browsenodefactory { +namespace { class BrowseNodeAggregator : public ::cppu::WeakImplHelper< browse::XBrowseNode > { @@ -257,9 +258,6 @@ private: } }; -namespace -{ - std::vector< Reference< browse::XBrowseNode > > getAllBrowseNodes( const Reference< XComponentContext >& xCtx ) { const Sequence< OUString > openDocs = @@ -325,6 +323,8 @@ std::vector< Reference< browse::XBrowseNode > > getAllBrowseNodes( const Referen typedef ::std::vector< Reference< browse::XBrowseNode > > vXBrowseNodes; +namespace { + struct alphaSortForBNodes { bool operator()( const Reference< browse::XBrowseNode >& a, const Reference< browse::XBrowseNode >& b ) @@ -333,7 +333,12 @@ struct alphaSortForBNodes } }; +} + typedef ::cppu::WeakImplHelper< browse::XBrowseNode > t_BrowseNodeBase; + +namespace { + class DefaultBrowseNode : public t_BrowseNodeBase { @@ -575,6 +580,8 @@ public: } }; +} + BrowseNodeFactoryImpl::BrowseNodeFactoryImpl( Reference< XComponentContext > const & xComponentContext ) : m_xComponentContext( xComponentContext ) diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx index 5440e7a1c220..266737de056a 100644 --- a/scripting/source/stringresource/stringresource.cxx +++ b/scripting/source/stringresource/stringresource.cxx @@ -1289,6 +1289,8 @@ void StringResourcePersistenceImpl::implWriteLocaleBinary // BinaryOutput, helper class for exportBinary +namespace { + class BinaryInput { Sequence< sal_Int8 > const m_aData; @@ -1313,6 +1315,8 @@ public: OUString readString(); }; +} + BinaryInput::BinaryInput( const Sequence< ::sal_Int8 >& aData, Reference< XComponentContext > const & xContext ) : m_aData( aData ) , m_xContext( xContext ) diff --git a/scripting/source/vbaevents/eventhelper.cxx b/scripting/source/vbaevents/eventhelper.cxx index f5e148b47029..0bec24e2a047 100644 --- a/scripting/source/vbaevents/eventhelper.cxx +++ b/scripting/source/vbaevents/eventhelper.cxx @@ -163,6 +163,8 @@ static Sequence< Any > ooKeyPressedToVBAKeyUpDown( const Sequence< Any >& params typedef Sequence< Any > (*Translator)(const Sequence< Any >&); +namespace { + //expand the "TranslateInfo" struct to support more kinds of events struct TranslateInfo { @@ -172,11 +174,13 @@ struct TranslateInfo void const *pPara; //Parameters for the above approve method }; +} typedef std::unordered_map< OUString, std::list< TranslateInfo > > EventInfoHash; +namespace { struct TranslatePropMap { @@ -184,17 +188,23 @@ struct TranslatePropMap TranslateInfo const aTransInfo; }; +} + static bool ApproveAll(const ScriptEvent& evt, void const * pPara); //allow all types of controls to execute the event static bool ApproveType(const ScriptEvent& evt, void const * pPara); //certain types of controls should execute the event, those types are given by pPara static bool DenyType(const ScriptEvent& evt, void const * pPara); //certain types of controls should not execute the event, those types are given by pPara static bool DenyMouseDrag(const ScriptEvent& evt, void const * pPara); //used for VBA MouseMove event when "Shift" key is pressed +namespace { + struct TypeList { uno::Type const * pTypeList; int const nListLength; }; +} + Type const typeXFixedText = cppu::UnoType<awt::XFixedText>::get(); Type const typeXTextComponent = cppu::UnoType<awt::XTextComponent>::get(); Type const typeXComboBox = cppu::UnoType<awt::XComboBox>::get(); @@ -286,6 +296,8 @@ static EventInfoHash& getEventTransInfo() // Helper class +namespace { + class ScriptEventHelper { public: @@ -300,6 +312,8 @@ private: bool const m_bDispose; }; +} + static bool eventMethodToDescriptor( const OUString& rEventMethod, ScriptEventDescriptor& evtDesc, const OUString& sCodeName ) { @@ -426,6 +440,8 @@ ScriptEventHelper::createEvents( const OUString& sCodeName ) typedef ::cppu::WeakImplHelper< container::XNameContainer > NameContainer_BASE; +namespace { + class ReadOnlyEventsNameContainer : public NameContainer_BASE { public: @@ -466,6 +482,8 @@ typedef std::unordered_map< OUString, Any > EventSupplierHash; EventSupplierHash m_hEvents; }; +} + ReadOnlyEventsNameContainer::ReadOnlyEventsNameContainer( const Sequence< OUString >& eventMethods, const OUString& sCodeName ) { for ( const OUString& rSrc : eventMethods ) @@ -503,6 +521,8 @@ ReadOnlyEventsNameContainer::hasByName( const OUString& aName ) return true; } +namespace { + class ReadOnlyEventsSupplier : public ::cppu::WeakImplHelper< XScriptEventsSupplier > { public: @@ -515,11 +535,15 @@ private: Reference< container::XNameContainer > m_xNameContainer; }; +} + typedef ::cppu::WeakImplHelper< XScriptListener, util::XCloseListener, lang::XInitialization, css::lang::XServiceInfo > EventListener_BASE; #define EVENTLSTNR_PROPERTY_ID_MODEL 1 #define EVENTLSTNR_PROPERTY_MODEL "Model" +namespace { + class EventListener : public EventListener_BASE ,public ::comphelper::OMutexAndBroadcastHelper ,public ::comphelper::OPropertyContainer @@ -605,6 +629,8 @@ private: SfxObjectShell* mpShell; }; +} + EventListener::EventListener() : OPropertyContainer(GetBroadcastHelper()), m_bDocClosed(false), mpShell( nullptr ) { @@ -909,6 +935,8 @@ EventListener::firing_Impl(const ScriptEvent& evt, Any* pRet ) } } +namespace { + class VBAToOOEventDescGen : public ::cppu::WeakImplHelper< XVBAToOOEventDescGen, css::lang::XServiceInfo > { public: @@ -935,6 +963,8 @@ public: }; +} + VBAToOOEventDescGen::VBAToOOEventDescGen() {} Sequence< ScriptEventDescriptor > SAL_CALL diff --git a/sd/qa/unit/tiledrendering/tiledrendering.cxx b/sd/qa/unit/tiledrendering/tiledrendering.cxx index cfcf3241e2b9..1e40d9645627 100644 --- a/sd/qa/unit/tiledrendering/tiledrendering.cxx +++ b/sd/qa/unit/tiledrendering/tiledrendering.cxx @@ -944,6 +944,8 @@ void SdTiledRenderingTest::testResizeTableColumn() pXmlDoc = nullptr; } +namespace { + /// A view callback tracks callbacks invoked on one specific view. class ViewCallback { @@ -1072,6 +1074,8 @@ public: } }; +} + void SdTiledRenderingTest::testViewCursors() { // Create two views. diff --git a/sd/source/core/CustomAnimationCloner.cxx b/sd/source/core/CustomAnimationCloner.cxx index 3049abb60d5c..03e38cf7c5f5 100644 --- a/sd/source/core/CustomAnimationCloner.cxx +++ b/sd/source/core/CustomAnimationCloner.cxx @@ -51,6 +51,8 @@ using ::com::sun::star::beans::NamedValue; namespace sd { + namespace { + class CustomAnimationClonerImpl { public: @@ -69,6 +71,8 @@ namespace sd std::vector< Reference< XAnimationNode > > maCloneNodeVector; }; + } + CustomAnimationClonerImpl::CustomAnimationClonerImpl() { } diff --git a/sd/source/core/CustomAnimationEffect.cxx b/sd/source/core/CustomAnimationEffect.cxx index 1a08b9b4d7de..f940e44645ae 100644 --- a/sd/source/core/CustomAnimationEffect.cxx +++ b/sd/source/core/CustomAnimationEffect.cxx @@ -2692,6 +2692,8 @@ void EffectSequenceHelper::setTextGroupingAuto( const CustomAnimationTextGroupPt notify_listeners(); } +namespace { + struct ImplStlTextGroupSortHelper { explicit ImplStlTextGroupSortHelper( bool bReverse ) : mbReverse( bReverse ) {}; @@ -2700,6 +2702,8 @@ struct ImplStlTextGroupSortHelper sal_Int32 getTargetParagraph( const CustomAnimationEffectPtr& p1 ); }; +} + sal_Int32 ImplStlTextGroupSortHelper::getTargetParagraph( const CustomAnimationEffectPtr& p1 ) { const Any aTarget(p1->getTarget()); @@ -2772,12 +2776,16 @@ void EffectSequenceHelper::removeListener( ISequenceListener* pListener ) maListeners.remove( pListener ); } +namespace { + struct stl_notify_listeners_func { stl_notify_listeners_func() {} void operator()(ISequenceListener* pListener) { pListener->notify_change(); } }; +} + void EffectSequenceHelper::notify_listeners() { stl_notify_listeners_func aFunc; @@ -2928,6 +2936,8 @@ void EffectSequenceHelper::processAfterEffect( const Reference< XAnimationNode > } } +namespace { + class AnimationChangeListener : public cppu::WeakImplHelper< XChangesListener > { public: @@ -2939,6 +2949,8 @@ private: MainSequence* mpMainSequence; }; +} + void SAL_CALL AnimationChangeListener::changesOccurred( const css::util::ChangesEvent& ) { if( mpMainSequence ) diff --git a/sd/source/core/EffectMigration.cxx b/sd/source/core/EffectMigration.cxx index 8f73d7bb8883..cac5a8896fd0 100644 --- a/sd/source/core/EffectMigration.cxx +++ b/sd/source/core/EffectMigration.cxx @@ -47,13 +47,17 @@ using ::com::sun::star::lang::XMultiServiceFactory; using ::com::sun::star::drawing::XShape; using ::com::sun::star::beans::NamedValue; +namespace { + struct deprecated_FadeEffect_conversion_table_entry { FadeEffect const meFadeEffect; const sal_Char* mpPresetId; +}; + } -const deprecated_FadeEffect_conversion_table[] = +deprecated_FadeEffect_conversion_table_entry const deprecated_FadeEffect_conversion_table[] = { // OOo 1.x transitions { FadeEffect_FADE_FROM_LEFT, "wipe-right" }, @@ -213,13 +217,18 @@ FadeEffect EffectMigration::GetFadeEffect( const SdPage* pPage ) return FadeEffect_NONE; } +namespace { + struct deprecated_AnimationEffect_conversion_table_entry { AnimationEffect const meEffect; const sal_Char* mpPresetId; const sal_Char* mpPresetSubType; +}; + } -const deprecated_AnimationEffect_conversion_table[] = + +deprecated_AnimationEffect_conversion_table_entry const deprecated_AnimationEffect_conversion_table[] = { // OOo 1.x entrance effects { AnimationEffect_APPEAR, "ooo-entrance-appear",nullptr }, diff --git a/sd/source/core/annotations/Annotation.cxx b/sd/source/core/annotations/Annotation.cxx index 554dc4318786..5edfaae9b317 100644 --- a/sd/source/core/annotations/Annotation.cxx +++ b/sd/source/core/annotations/Annotation.cxx @@ -57,6 +57,8 @@ using namespace ::com::sun::star; namespace sd { +namespace { + class Annotation : private ::cppu::BaseMutex, public ::cppu::WeakComponentImplHelper< XAnnotation>, public ::cppu::PropertySetMixin< XAnnotation > @@ -181,6 +183,8 @@ protected: AnnotationData maRedoData; }; +} + void createAnnotation( Reference< XAnnotation >& xAnnotation, SdPage* pPage ) { xAnnotation.set( diff --git a/sd/source/core/annotations/AnnotationEnumeration.cxx b/sd/source/core/annotations/AnnotationEnumeration.cxx index 669205825f58..018de9b379b2 100644 --- a/sd/source/core/annotations/AnnotationEnumeration.cxx +++ b/sd/source/core/annotations/AnnotationEnumeration.cxx @@ -33,6 +33,8 @@ using namespace ::com::sun::star::lang; namespace sd { +namespace { + class AnnotationEnumeration: public ::cppu::WeakImplHelper< css::office::XAnnotationEnumeration > { public: @@ -51,6 +53,8 @@ private: AnnotationVector::iterator maIter; }; +} + Reference< XAnnotationEnumeration > createAnnotationEnumeration( const sd::AnnotationVector& rAnnotations ) { return new AnnotationEnumeration( rAnnotations ); diff --git a/sd/source/core/drawdoc3.cxx b/sd/source/core/drawdoc3.cxx index 99647b42aab0..f9942b1d3d27 100644 --- a/sd/source/core/drawdoc3.cxx +++ b/sd/source/core/drawdoc3.cxx @@ -60,6 +60,8 @@ using namespace ::com::sun::star; every page in the bookmark document/list */ +namespace { + class InsertBookmarkAsPage_FindDuplicateLayouts { public: @@ -70,6 +72,8 @@ private: std::vector<OUString> &mrLayoutsToTransfer; }; +} + void InsertBookmarkAsPage_FindDuplicateLayouts::operator()( SdDrawDocument& rDoc, SdPage const * pBMMPage, bool bRenameDuplicates, SdDrawDocument* pBookmarkDoc ) { // now check for duplicate masterpage and layout names diff --git a/sd/source/core/sdpage.cxx b/sd/source/core/sdpage.cxx index ffbd3ff1041f..cff2714a3d75 100644 --- a/sd/source/core/sdpage.cxx +++ b/sd/source/core/sdpage.cxx @@ -178,6 +178,8 @@ SdPage::~SdPage() ClearSdrObjList(); } +namespace { + struct OrdNumSorter { bool operator()( SdrObject const * p1, SdrObject const * p2 ) @@ -186,6 +188,8 @@ struct OrdNumSorter } }; +} + /** returns the nIndex'th object from the given PresObjKind, index starts with 1 */ SdrObject* SdPage::GetPresObj(PresObjKind eObjKind, int nIndex, bool bFuzzySearch /* = false */ ) { @@ -1199,6 +1203,8 @@ void SdPage::DestroyDefaultPresObj(PresObjKind eObjKind) const int MAX_PRESOBJS = 7; // maximum number of presentation objects per layout const int VERTICAL = 0x8000; +namespace { + struct LayoutDescriptor { PresObjKind meKind[MAX_PRESOBJS]; @@ -1207,6 +1213,8 @@ struct LayoutDescriptor LayoutDescriptor( int k0 = 0, int k1 = 0, int k2 = 0, int k3 = 0, int k4 = 0, int k5 = 0, int k6 = 0 ); }; +} + LayoutDescriptor::LayoutDescriptor( int k0, int k1, int k2, int k3, int k4, int k5, int k6 ) { meKind[0] = static_cast<PresObjKind>(k0 & (~VERTICAL)); mbVertical[0] = (k0 & VERTICAL) == VERTICAL; diff --git a/sd/source/core/text/textapi.cxx b/sd/source/core/text/textapi.cxx index 8689e154a614..89efeebaebd2 100644 --- a/sd/source/core/text/textapi.cxx +++ b/sd/source/core/text/textapi.cxx @@ -42,6 +42,8 @@ using namespace ::com::sun::star::container; namespace sd { +namespace { + class UndoTextAPIChanged : public SdrUndoAction { public: @@ -56,6 +58,8 @@ protected: rtl::Reference< TextApiObject > mxTextObj; }; +} + UndoTextAPIChanged::UndoTextAPIChanged(SdrModel& rModel, TextApiObject* pTextObj ) : SdrUndoAction( rModel ) , mpOldText( pTextObj->CreateText() ) @@ -79,6 +83,8 @@ void UndoTextAPIChanged::Redo() } } +namespace { + struct TextAPIEditSource_Impl { SdDrawDocument* mpDoc; @@ -86,6 +92,8 @@ struct TextAPIEditSource_Impl SvxOutlinerForwarder* mpTextForwarder; }; +} + class TextAPIEditSource : public SvxEditSource { // refcounted diff --git a/sd/source/filter/eppt/epptso.cxx b/sd/source/filter/eppt/epptso.cxx index e03db4c9ddd3..1cd19b23c1f8 100644 --- a/sd/source/filter/eppt/epptso.cxx +++ b/sd/source/filter/eppt/epptso.cxx @@ -3035,6 +3035,8 @@ void PPTWriter::WriteCString( SvStream& rSt, const OUString& rString, sal_uInt32 } } +namespace { + class ContainerGuard { private: @@ -3051,6 +3053,8 @@ public: } }; +} + void PPTWriter::ImplCreateTable( uno::Reference< drawing::XShape > const & rXShape, EscherSolverContainer& aSolverContainer, EscherPropertyContainer& aPropOpt ) { diff --git a/sd/source/filter/eppt/pptx-epptooxml.cxx b/sd/source/filter/eppt/pptx-epptooxml.cxx index 9ef75df597ad..9789e20a343c 100644 --- a/sd/source/filter/eppt/pptx-epptooxml.cxx +++ b/sd/source/filter/eppt/pptx-epptooxml.cxx @@ -152,8 +152,6 @@ enum PPTXLayout LAYOUT_SIZE }; -} - struct PPTXLayoutInfo { int const nType; @@ -161,6 +159,8 @@ struct PPTXLayoutInfo const char* sType; }; +} + static const PPTXLayoutInfo aLayoutInfo[LAYOUT_SIZE] = { { 20, "Blank Slide", "blank" }, diff --git a/sd/source/filter/grf/sdgrffilter.cxx b/sd/source/filter/grf/sdgrffilter.cxx index d16491dff288..c1f920362b81 100644 --- a/sd/source/filter/grf/sdgrffilter.cxx +++ b/sd/source/filter/grf/sdgrffilter.cxx @@ -59,6 +59,8 @@ using namespace ::com::sun::star::ucb; using namespace com::sun::star::ui::dialogs; using namespace ::sfx2; +namespace { + class SdGRFFilter_ImplInteractionHdl : public ::cppu::WeakImplHelper< css::task::XInteractionHandler > { css::uno::Reference< css::task::XInteractionHandler > m_xInter; @@ -76,6 +78,8 @@ class SdGRFFilter_ImplInteractionHdl : public ::cppu::WeakImplHelper< css::task: virtual void SAL_CALL handle( const css::uno::Reference< css::task::XInteractionRequest >& ) override; }; +} + void SdGRFFilter_ImplInteractionHdl::handle( const css::uno::Reference< css::task::XInteractionRequest >& xRequest ) { if( !m_xInter.is() ) diff --git a/sd/source/filter/html/HtmlOptionsDialog.cxx b/sd/source/filter/html/HtmlOptionsDialog.cxx index ec523e2c86aa..5db49c2af647 100644 --- a/sd/source/filter/html/HtmlOptionsDialog.cxx +++ b/sd/source/filter/html/HtmlOptionsDialog.cxx @@ -38,6 +38,8 @@ using namespace com::sun::star::ui::dialogs; #include <pres.hxx> #include <sdabstdlg.hxx> +namespace { + class SdHtmlOptionsDialog : public cppu::WeakImplHelper < XExporter, @@ -80,6 +82,8 @@ public: }; +} + SdHtmlOptionsDialog::SdHtmlOptionsDialog() : meDocType ( DocumentType::Draw ) { diff --git a/sd/source/filter/html/buttonset.cxx b/sd/source/filter/html/buttonset.cxx index 751e5db0b63f..cb382303287f 100644 --- a/sd/source/filter/html/buttonset.cxx +++ b/sd/source/filter/html/buttonset.cxx @@ -45,6 +45,8 @@ using namespace ::com::sun::star::io; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::lang; +namespace { + class ButtonsImpl { public: @@ -60,6 +62,8 @@ private: Reference< XStorage > mxStorage; }; +} + ButtonsImpl::ButtonsImpl( const OUString& rURL ) { try diff --git a/sd/source/filter/html/htmlex.cxx b/sd/source/filter/html/htmlex.cxx index ad8e2a97eae6..77189e3d543d 100644 --- a/sd/source/filter/html/htmlex.cxx +++ b/sd/source/filter/html/htmlex.cxx @@ -114,6 +114,8 @@ const char * const pButtonNames[] = #define BTN_MORE 10 #define BTN_LESS 11 +namespace { + // Helper class for the simple creation of files local/remote class EasyFile { @@ -131,6 +133,8 @@ public: void close(); }; +} + // Helper class for the embedding of text attributes into the html output class HtmlState { diff --git a/sd/source/filter/html/pubdlg.cxx b/sd/source/filter/html/pubdlg.cxx index 7623d34a115d..6026e78c67aa 100644 --- a/sd/source/filter/html/pubdlg.cxx +++ b/sd/source/filter/html/pubdlg.cxx @@ -335,6 +335,8 @@ SvStream& WriteSdPublishingDesign(SvStream& rOut, const SdPublishingDesign& rDes return rOut; } +namespace { + // Dialog for the entry of the name of the design class SdDesignNameDlg : public weld::GenericDialogController { @@ -348,6 +350,8 @@ public: DECL_LINK(ModifyHdl, weld::Entry&, void); }; +} + // SdPublishingDlg Methods SdPublishingDlg::SdPublishingDlg(weld::Window* pWindow, DocumentType eDocType) diff --git a/sd/source/filter/ppt/pptin.cxx b/sd/source/filter/ppt/pptin.cxx index 89af5b41019c..c2f30fa880e4 100644 --- a/sd/source/filter/ppt/pptin.cxx +++ b/sd/source/filter/ppt/pptin.cxx @@ -1475,12 +1475,16 @@ void ImplSdPPTImport::SetHeaderFooterPageSettings( SdPage* pPage, const PptSlide } } +namespace { + // Import of pages struct Ppt97AnimationStlSortHelper { bool operator()( const std::pair< SdrObject*, Ppt97AnimationPtr >& p1, const std::pair< SdrObject*, Ppt97AnimationPtr >& p2 ); }; +} + bool Ppt97AnimationStlSortHelper::operator()( const std::pair< SdrObject*, Ppt97AnimationPtr >& p1, const std::pair< SdrObject*, Ppt97AnimationPtr >& p2 ) { if( !p1.second.get() || !p2.second.get() ) diff --git a/sd/source/filter/xml/sdtransform.cxx b/sd/source/filter/xml/sdtransform.cxx index fa0cced78971..586d6ba9dbdc 100644 --- a/sd/source/filter/xml/sdtransform.cxx +++ b/sd/source/filter/xml/sdtransform.cxx @@ -34,6 +34,8 @@ using namespace ::com::sun::star::style; +namespace { + class SdTransformOOo2xDocument { public: @@ -65,6 +67,8 @@ public: SdrOutliner& mrOutliner; }; +} + /** transforms the given model from OOo 2.x to OOo 3.x. This maps the deprecated EE_PARA_BULLETSTATE and clears the EE_PARA_LRSPACE if used together with a EE_PARA_NUMBULLET */ diff --git a/sd/source/filter/xml/sdxmlwrp.cxx b/sd/source/filter/xml/sdxmlwrp.cxx index f23eabd0f6c8..90e0e4f120fa 100644 --- a/sd/source/filter/xml/sdxmlwrp.cxx +++ b/sd/source/filter/xml/sdxmlwrp.cxx @@ -126,6 +126,8 @@ char const sXML_import_draw_styles_ooo_service[] = "com.sun.star.comp.Draw.XMLSt char const sXML_import_draw_content_ooo_service[] = "com.sun.star.comp.Draw.XMLContentImporter"; char const sXML_import_draw_settings_ooo_service[] = "com.sun.star.comp.Draw.XMLSettingsImporter"; +namespace { + struct XML_SERVICEMAP { const sal_Char* mpService; @@ -140,6 +142,8 @@ struct XML_SERVICES const sal_Char* mpSettings; }; +} + static XML_SERVICES const * getServices( bool bImport, bool bDraw, sal_uLong nStoreVer ) { static XML_SERVICES const gServices[] = diff --git a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx index ce7c3abad3f6..af0204877141 100644 --- a/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx +++ b/sd/source/ui/accessibility/AccessibleDrawDocumentView.cxx @@ -60,6 +60,8 @@ using namespace ::com::sun::star::accessibility; namespace accessibility { +namespace { + struct XShapePosCompareHelper { bool operator() ( const uno::Reference<drawing::XShape>& xshape1, @@ -74,6 +76,9 @@ struct XShapePosCompareHelper return false; } }; + +} + //===== internal ============================================================ AccessibleDrawDocumentView::AccessibleDrawDocumentView ( diff --git a/sd/source/ui/animations/CustomAnimationDialog.cxx b/sd/source/ui/animations/CustomAnimationDialog.cxx index 1052b7b89e9c..b9015ddb4c58 100644 --- a/sd/source/ui/animations/CustomAnimationDialog.cxx +++ b/sd/source/ui/animations/CustomAnimationDialog.cxx @@ -88,6 +88,8 @@ using ::com::sun::star::beans::XPropertySet; namespace sd { +namespace { + class PresetPropertyBox : public PropertySubControl { public: @@ -105,6 +107,8 @@ private: Link<LinkParamNone*,void> const maModifyLink; }; +} + PresetPropertyBox::PresetPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const OUString& aPresetId, const Link<LinkParamNone*,void>& rModifyHdl ) : PropertySubControl( nControlType ), maModifyLink(rModifyHdl) { @@ -174,6 +178,8 @@ SdPropertySubControl::~SdPropertySubControl() { } +namespace { + class SdPresetPropertyBox : public SdPropertySubControl { public: @@ -190,6 +196,8 @@ private: DECL_LINK(OnSelect, weld::ComboBox&, void); }; +} + SdPresetPropertyBox::SdPresetPropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const OUString& aPresetId, const Link<LinkParamNone*,void>& rModifyHdl) : SdPropertySubControl(pParent) , maModifyLink(rModifyHdl) @@ -253,6 +261,8 @@ Any SdPresetPropertyBox::getValue() return makeAny(maPropertyValues[nIndex]); } +namespace { + class ColorPropertyBox : public PropertySubControl { public: @@ -269,6 +279,8 @@ private: Link<LinkParamNone*,void> const maModifyLink; }; +} + ColorPropertyBox::ColorPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl ) : PropertySubControl( nControlType ), maModifyLink(rModifyHdl) { @@ -314,6 +326,8 @@ Control* ColorPropertyBox::getControl() return mpControl; } +namespace { + class SdColorPropertyBox : public SdPropertySubControl { public: @@ -329,6 +343,8 @@ private: DECL_LINK(OnSelect, ColorListBox&, void); }; +} + SdColorPropertyBox::SdColorPropertyBox(weld::Label* pLabel, weld::Container* pParent, weld::Window* pTopLevel, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl) : SdPropertySubControl(pParent) , maModifyLink(rModifyHdl) @@ -366,6 +382,8 @@ Any SdColorPropertyBox::getValue() return makeAny(sal_Int32(mxControl->GetSelectEntryColor().GetRGBColor())); } +namespace { + class FontPropertyBox : public PropertySubControl { public: @@ -383,6 +401,8 @@ private: DECL_LINK(ControlSelectHdl, ComboBox&, void); }; +} + FontPropertyBox::FontPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl ) : PropertySubControl( nControlType ), maModifyHdl(rModifyHdl) { @@ -446,6 +466,8 @@ Control* FontPropertyBox::getControl() return mpControl; } +namespace { + class SdFontPropertyBox : public SdPropertySubControl { public: @@ -461,6 +483,8 @@ private: DECL_LINK(ControlSelectHdl, weld::ComboBox&, void); }; +} + SdFontPropertyBox::SdFontPropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl) : SdPropertySubControl(pParent) , maModifyHdl(rModifyHdl) @@ -524,6 +548,8 @@ Any SdFontPropertyBox::getValue() return makeAny(aFontName); } +namespace { + class DropdownMenuBox : public Edit { public: @@ -542,6 +568,8 @@ private: VclPtr<PopupMenu> mpMenu; }; +} + DropdownMenuBox::DropdownMenuBox( vcl::Window* pParent, Edit* pSubControl, PopupMenu* pMenu ) : Edit( pParent, WB_BORDER|WB_TABSTOP| WB_DIALOGCONTROL ), mpSubControl(pSubControl),mpDropdownButton(nullptr),mpMenu(pMenu) @@ -606,6 +634,8 @@ bool DropdownMenuBox::PreNotify( NotifyEvent& rNEvt ) return bResult; } +namespace { + class CharHeightPropertyBox : public PropertySubControl { public: @@ -628,6 +658,8 @@ private: Link<LinkParamNone*,void> const maModifyHdl; }; +} + CharHeightPropertyBox::CharHeightPropertyBox(sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl) : PropertySubControl(nControlType) , maBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/simpress/ui/fontsizemenu.ui", "") @@ -685,6 +717,8 @@ Control* CharHeightPropertyBox::getControl() return mpControl; } +namespace { + class SdCharHeightPropertyBox : public SdPropertySubControl { public: @@ -703,6 +737,8 @@ private: DECL_LINK(EditModifyHdl, weld::MetricSpinButton&, void); }; +} + SdCharHeightPropertyBox::SdCharHeightPropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl) : SdPropertySubControl(pParent) , maModifyHdl(rModifyHdl) @@ -748,6 +784,8 @@ Any SdCharHeightPropertyBox::getValue() return makeAny(static_cast<double>(mxMetric->get_value(FieldUnit::PERCENT)) / 100.0); } +namespace { + class TransparencyPropertyBox : public PropertySubControl { public: @@ -771,6 +809,8 @@ private: Link<LinkParamNone*,void> const maModifyHdl; }; +} + TransparencyPropertyBox::TransparencyPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl ) : PropertySubControl( nControlType ) , maModifyHdl( rModifyHdl ) @@ -847,6 +887,8 @@ Control* TransparencyPropertyBox::getControl() return mpControl; } +namespace { + class SdTransparencyPropertyBox : public SdPropertySubControl { public: @@ -867,6 +909,8 @@ private: std::unique_ptr<weld::MenuButton> mxControl; }; +} + SdTransparencyPropertyBox::SdTransparencyPropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl) : SdPropertySubControl(pParent) , maModifyHdl(rModifyHdl) @@ -932,6 +976,8 @@ Any SdTransparencyPropertyBox::getValue() return makeAny(static_cast<double>(mxMetric->get_value(FieldUnit::PERCENT)) / 100.0); } +namespace { + class RotationPropertyBox : public PropertySubControl { public: @@ -956,6 +1002,8 @@ private: Link<LinkParamNone*,void> const maModifyHdl; }; +} + RotationPropertyBox::RotationPropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl ) : PropertySubControl(nControlType) , maBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/simpress/ui/rotatemenu.ui", "") @@ -1051,6 +1099,8 @@ Control* RotationPropertyBox::getControl() return mpControl; } +namespace { + class SdRotationPropertyBox : public SdPropertySubControl { public: @@ -1071,6 +1121,8 @@ private: std::unique_ptr<weld::MenuButton> mxControl; }; +} + SdRotationPropertyBox::SdRotationPropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl) : SdPropertySubControl(pParent) , maModifyHdl(rModifyHdl) @@ -1150,6 +1202,8 @@ Any SdRotationPropertyBox::getValue() return makeAny(static_cast<double>(mxMetric->get_value(FieldUnit::DEGREE))); } +namespace { + class ScalePropertyBox : public PropertySubControl { public: @@ -1175,6 +1229,8 @@ private: int mnDirection; }; +} + ScalePropertyBox::ScalePropertyBox(sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl) : PropertySubControl( nControlType ) , maBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/simpress/ui/scalemenu.ui", "") @@ -1328,6 +1384,8 @@ Control* ScalePropertyBox::getControl() return mpControl; } +namespace { + class SdScalePropertyBox : public SdPropertySubControl { public: @@ -1349,6 +1407,8 @@ private: std::unique_ptr<weld::MenuButton> mxControl; }; +} + SdScalePropertyBox::SdScalePropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl) : SdPropertySubControl(pParent) , maModifyHdl( rModifyHdl ) @@ -1487,6 +1547,8 @@ Any SdScalePropertyBox::getValue() return makeAny( aValues ); } +namespace { + class FontStylePropertyBox : public PropertySubControl { public: @@ -1514,6 +1576,8 @@ private: sal_Int16 mnFontUnderline; }; +} + FontStylePropertyBox::FontStylePropertyBox( sal_Int32 nControlType, vcl::Window* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl ) : PropertySubControl(nControlType) , maBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "modules/simpress/ui/fontstylemenu.ui", "") @@ -1607,6 +1671,8 @@ Control* FontStylePropertyBox::getControl() return mpControl; } +namespace { + class SdFontStylePropertyBox : public SdPropertySubControl { public: @@ -1629,6 +1695,8 @@ private: std::unique_ptr<weld::MenuButton> mxControl; }; +} + SdFontStylePropertyBox::SdFontStylePropertyBox(weld::Label* pLabel, weld::Container* pParent, const Any& rValue, const Link<LinkParamNone*,void>& rModifyHdl ) : SdPropertySubControl(pParent) , maModifyHdl( rModifyHdl ) diff --git a/sd/source/ui/animations/CustomAnimationList.cxx b/sd/source/ui/animations/CustomAnimationList.cxx index 717232b014e2..d312cebef4e9 100644 --- a/sd/source/ui/animations/CustomAnimationList.cxx +++ b/sd/source/ui/animations/CustomAnimationList.cxx @@ -351,6 +351,8 @@ std::unique_ptr<SvLBoxItem> CustomAnimationListEntryItem::Clone(SvLBoxItem const return nullptr; } +namespace { + class CustomAnimationListEntry : public SvTreeListEntry { public: @@ -363,6 +365,8 @@ private: CustomAnimationEffectPtr const mpEffect; }; +} + CustomAnimationListEntry::CustomAnimationListEntry() { } @@ -372,6 +376,8 @@ CustomAnimationListEntry::CustomAnimationListEntry(const CustomAnimationEffectPt { } +namespace { + class CustomAnimationTriggerEntryItem : public SvLBoxString { public: @@ -387,6 +393,8 @@ private: static const long nIconWidth = 19; }; +} + CustomAnimationTriggerEntryItem::CustomAnimationTriggerEntryItem( const OUString& aDescription ) : SvLBoxString( aDescription ), msDescription( aDescription ) { diff --git a/sd/source/ui/animations/SlideTransitionBox.cxx b/sd/source/ui/animations/SlideTransitionBox.cxx index 6e54ed52b0d6..c4ebe697f529 100644 --- a/sd/source/ui/animations/SlideTransitionBox.cxx +++ b/sd/source/ui/animations/SlideTransitionBox.cxx @@ -27,6 +27,8 @@ namespace sd { +namespace { + class SlideTransitionBox : public VclVBox { VclPtr<SlideTransitionPane> m_pPane; @@ -40,6 +42,8 @@ public: virtual void StateChanged(StateChangedType nStateChange) override; }; +} + VCL_BUILDER_FACTORY(SlideTransitionBox); SlideTransitionBox::SlideTransitionBox(vcl::Window* pParent) diff --git a/sd/source/ui/animations/SlideTransitionPane.cxx b/sd/source/ui/animations/SlideTransitionPane.cxx index 3d616c990247..babab59d9b11 100644 --- a/sd/source/ui/animations/SlideTransitionPane.cxx +++ b/sd/source/ui/animations/SlideTransitionPane.cxx @@ -369,6 +369,8 @@ size_t getPresetOffset( const sd::impl::TransitionEffect &rEffect ) namespace sd { +namespace { + class TransitionPane : public ValueSet { public: @@ -389,6 +391,8 @@ public: } }; +} + // SlideTransitionPane SlideTransitionPane::SlideTransitionPane( Window * pParent, diff --git a/sd/source/ui/animations/motionpathtag.cxx b/sd/source/ui/animations/motionpathtag.cxx index 53f141e80c76..3021c6616796 100644 --- a/sd/source/ui/animations/motionpathtag.cxx +++ b/sd/source/ui/animations/motionpathtag.cxx @@ -67,6 +67,8 @@ namespace sd const sal_uInt32 SMART_TAG_HDL_NUM = SAL_MAX_UINT32; static const int DRGPIX = 2; // Drag MinMove in Pixel +namespace { + class PathDragMove : public SdrDragMove { private: @@ -97,6 +99,8 @@ public: rtl::Reference <MotionPathTag > mxTag; }; +} + void PathDragMove::createSdrDragEntries() { // call parent @@ -130,6 +134,8 @@ bool PathDragMove::EndSdrDrag(bool /*bCopy*/) return true; } +namespace { + class PathDragResize : public SdrDragResize { private: @@ -158,6 +164,8 @@ public: rtl::Reference <MotionPathTag > mxTag; }; +} + void PathDragResize::createSdrDragEntries() { // call parent @@ -189,6 +197,8 @@ bool PathDragResize::EndSdrDrag(bool /*bCopy*/) return true; } +namespace { + class PathDragObjOwn : public SdrDragObjOwn { private: @@ -212,6 +222,8 @@ public: virtual bool EndSdrDrag(bool bCopy) override; }; +} + void PathDragObjOwn::createSdrDragEntries() { // call parent @@ -241,6 +253,8 @@ bool PathDragObjOwn::EndSdrDrag(bool /*bCopy*/) } } +namespace { + class SdPathHdl : public SmartHdl { public: @@ -253,6 +267,8 @@ private: SdrPathObj* const mpPathObj; }; +} + SdPathHdl::SdPathHdl( const SmartTagReference& xTag, SdrPathObj* pPathObj ) : SmartHdl( xTag, pPathObj->GetCurrentBoundRect().TopLeft(), SdrHdlKind::SmartTag ) , mpPathObj( pPathObj ) diff --git a/sd/source/ui/annotations/annotationtag.cxx b/sd/source/ui/annotations/annotationtag.cxx index bbec5d9223c6..098a2a816cd7 100644 --- a/sd/source/ui/annotations/annotationtag.cxx +++ b/sd/source/ui/annotations/annotationtag.cxx @@ -86,6 +86,8 @@ static OUString getInitials( const OUString& rName ) return sInitials.makeStringAndClear(); } +namespace { + class AnnotationDragMove : public SdrDragMove { public: @@ -100,6 +102,8 @@ private: Point maOrigin; }; +} + AnnotationDragMove::AnnotationDragMove(SdrDragView& rNewView, const rtl::Reference <AnnotationTag >& xTag) : SdrDragMove(rNewView) , mxTag( xTag ) @@ -147,6 +151,8 @@ void AnnotationDragMove::CancelSdrDrag() Hide(); } +namespace { + class AnnotationHdl : public SmartHdl { public: @@ -160,6 +166,8 @@ private: rtl::Reference< AnnotationTag > mxTag; }; +} + AnnotationHdl::AnnotationHdl( const SmartTagReference& xTag, const Reference< XAnnotation >& xAnnotation, const Point& rPnt ) : SmartHdl( xTag, rPnt, SdrHdlKind::SmartTag ) , mxAnnotation( xAnnotation ) diff --git a/sd/source/ui/app/tmplctrl.cxx b/sd/source/ui/app/tmplctrl.cxx index c78f1a3ef126..fd9d27da3d1d 100644 --- a/sd/source/ui/app/tmplctrl.cxx +++ b/sd/source/ui/app/tmplctrl.cxx @@ -37,6 +37,8 @@ SFX_IMPL_STATUSBAR_CONTROL( SdTemplateControl, SfxStringItem ); // class SdTemplatePopup_Impl -------------------------------------------------- +namespace { + class SdTemplatePopup_Impl : public PopupMenu { public: @@ -50,6 +52,8 @@ private: virtual void Select() override; }; +} + SdTemplatePopup_Impl::SdTemplatePopup_Impl() : PopupMenu(), nCurId(USHRT_MAX) diff --git a/sd/source/ui/controller/displaymodecontroller.cxx b/sd/source/ui/controller/displaymodecontroller.cxx index 161ff808773d..8706e506472a 100644 --- a/sd/source/ui/controller/displaymodecontroller.cxx +++ b/sd/source/ui/controller/displaymodecontroller.cxx @@ -29,6 +29,8 @@ namespace sd // Composed of a dropdown button in the toolbar and a // popup menu to select the value +namespace { + class DisplayModeController : public svt::PopupWindowController { public: @@ -74,6 +76,8 @@ struct snewfoil_value_info const char* msUnoCommand; }; +} + static const snewfoil_value_info editmodes[] = { {1, diff --git a/sd/source/ui/controller/slidelayoutcontroller.cxx b/sd/source/ui/controller/slidelayoutcontroller.cxx index fc64f7439d78..12d741224787 100644 --- a/sd/source/ui/controller/slidelayoutcontroller.cxx +++ b/sd/source/ui/controller/slidelayoutcontroller.cxx @@ -48,6 +48,8 @@ using namespace ::com::sun::star::beans; namespace sd { +namespace { + class LayoutToolbarMenu : public svtools::ToolbarMenu { public: @@ -73,6 +75,8 @@ struct snewfoil_value_info_layout AutoLayout const maAutoLayout; }; +} + static const snewfoil_value_info_layout notes[] = { {BMP_FOILN_01, STR_AUTOLAYOUT_NOTES, AUTOLAYOUT_NOTES}, diff --git a/sd/source/ui/dlg/headerfooterdlg.cxx b/sd/source/ui/dlg/headerfooterdlg.cxx index d30af2b22110..b53d25c72946 100644 --- a/sd/source/ui/dlg/headerfooterdlg.cxx +++ b/sd/source/ui/dlg/headerfooterdlg.cxx @@ -52,6 +52,8 @@ namespace sd { +namespace { + class PresLayoutPreview : public weld::CustomWidgetController { private: @@ -76,16 +78,24 @@ public: } +} + // tab page for slide & header'n'notes namespace sd { const int nDateTimeFormatsCount = 12; + +namespace { + struct DateAndTimeFormat { SvxDateFormat const meDateFormat; SvxTimeFormat const meTimeFormat; }; + +} + DateAndTimeFormat const nDateTimeFormats[nDateTimeFormatsCount] = { { SvxDateFormat::A, SvxTimeFormat::AppDefault }, diff --git a/sd/source/ui/dlg/paragr.cxx b/sd/source/ui/dlg/paragr.cxx index b9607094810c..e9fd852cb40f 100644 --- a/sd/source/ui/dlg/paragr.cxx +++ b/sd/source/ui/dlg/paragr.cxx @@ -28,6 +28,8 @@ #include <paragr.hxx> #include <sdattr.hrc> +namespace { + class SdParagraphNumTabPage : public SfxTabPage { public: @@ -48,6 +50,8 @@ private: DECL_LINK( ImplNewStartHdl, weld::Button&, void ); }; +} + SdParagraphNumTabPage::SdParagraphNumTabPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rAttr) : SfxTabPage(pPage, pController, "modules/sdraw/ui/paranumberingtab.ui", "DrawParaNumbering", &rAttr) , mbModified(false) diff --git a/sd/source/ui/framework/tools/FrameworkHelper.cxx b/sd/source/ui/framework/tools/FrameworkHelper.cxx index cfa6db43d316..e75508e344ac 100644 --- a/sd/source/ui/framework/tools/FrameworkHelper.cxx +++ b/sd/source/ui/framework/tools/FrameworkHelper.cxx @@ -664,6 +664,8 @@ void FrameworkHelper::RunOnResourceActivation( } } +namespace { + /** A callback that sets a flag to a specified value when the callback is called. */ @@ -676,6 +678,8 @@ private: bool& mrFlag; }; +} + void FrameworkHelper::RequestSynchronousUpdate() { rtl::Reference<ConfigurationController> pCC ( diff --git a/sd/source/ui/presenter/PresenterCanvas.cxx b/sd/source/ui/presenter/PresenterCanvas.cxx index 83eb7c79f793..c3164529864c 100644 --- a/sd/source/ui/presenter/PresenterCanvas.cxx +++ b/sd/source/ui/presenter/PresenterCanvas.cxx @@ -46,7 +46,7 @@ namespace { typedef ::cppu::WeakComponentImplHelper < css::rendering::XCustomSprite > PresenterCustomSpriteInterfaceBase; -} + class PresenterCustomSprite : protected ::cppu::BaseMutex, public PresenterCustomSpriteInterfaceBase @@ -92,6 +92,8 @@ private: void ThrowIfDisposed(); }; +} + //===== PresenterCanvas ======================================================= PresenterCanvas::PresenterCanvas ( diff --git a/sd/source/ui/remotecontrol/BluetoothServer.cxx b/sd/source/ui/remotecontrol/BluetoothServer.cxx index f731d25504bd..16113f5f709f 100644 --- a/sd/source/ui/remotecontrol/BluetoothServer.cxx +++ b/sd/source/ui/remotecontrol/BluetoothServer.cxx @@ -57,6 +57,8 @@ using namespace sd; #ifdef LINUX_BLUETOOTH +namespace { + struct DBusObject { OString maBusName; OString maPath; @@ -83,6 +85,8 @@ struct DBusObject { } }; +} + static std::unique_ptr<DBusObject> getBluez5Adapter(DBusConnection *pConnection); struct sd::BluetoothServer::Impl { diff --git a/sd/source/ui/sidebar/LayoutMenu.cxx b/sd/source/ui/sidebar/LayoutMenu.cxx index bacfa1c5f261..3ac6020987b6 100644 --- a/sd/source/ui/sidebar/LayoutMenu.cxx +++ b/sd/source/ui/sidebar/LayoutMenu.cxx @@ -68,6 +68,8 @@ using ::sd::framework::FrameworkHelper; namespace sd { namespace sidebar { +namespace { + struct snewfoil_value_info { const char* msBmpResId; @@ -76,6 +78,8 @@ struct snewfoil_value_info AutoLayout const maAutoLayout; }; +} + static const snewfoil_value_info notes[] = { {BMP_FOILN_01, STR_AUTOLAYOUT_NOTES, WritingMode_LR_TB, diff --git a/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx b/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx index 80ce031e76b3..3dfa4204fd08 100644 --- a/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx +++ b/sd/source/ui/slidesorter/cache/SlsBitmapCache.cxx @@ -77,12 +77,16 @@ private: bool mbIsPrecious; }; +namespace { + class CacheHash { public: size_t operator()(const BitmapCache::CacheKey& p) const { return reinterpret_cast<size_t>(p); } }; +} + class BitmapCache::CacheBitmapContainer : public std::unordered_map<CacheKey, CacheEntry, CacheHash> { diff --git a/sd/source/ui/slidesorter/cache/SlsRequestQueue.cxx b/sd/source/ui/slidesorter/cache/SlsRequestQueue.cxx index f16a4b8f6ce2..bf387210f0c8 100644 --- a/sd/source/ui/slidesorter/cache/SlsRequestQueue.cxx +++ b/sd/source/ui/slidesorter/cache/SlsRequestQueue.cxx @@ -25,6 +25,8 @@ namespace sd { namespace slidesorter { namespace cache { +namespace { + /** This class extends the actual request data with additional information that is used by the priority queues. */ @@ -76,6 +78,8 @@ public: RequestPriorityClass const meClass; }; +} + class RequestQueue::Container : public ::std::set< Request, diff --git a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx index f86e07942100..23378029bb91 100644 --- a/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx +++ b/sd/source/ui/slidesorter/controller/SlsSelectionFunction.cxx @@ -174,6 +174,8 @@ private: const bool mbIsMouseOverIndicatorAllowed; }; +namespace { + /** This is the default handler for processing events. It activates the multi selection or drag-and-drop when the right conditions are met. */ @@ -280,6 +282,8 @@ private: std::unique_ptr<DragAndDropContext, o3tl::default_delete<DragAndDropContext>> mpDragAndDropContext; }; +} + //===== SelectionFunction ===================================================== diff --git a/sd/source/ui/slidesorter/view/SlideSorterView.cxx b/sd/source/ui/slidesorter/view/SlideSorterView.cxx index 32a8e8c2bc6b..1772bf8c7f00 100644 --- a/sd/source/ui/slidesorter/view/SlideSorterView.cxx +++ b/sd/source/ui/slidesorter/view/SlideSorterView.cxx @@ -82,6 +82,8 @@ namespace { }; } +namespace { + class BackgroundPainter : public ILayerPainter { @@ -105,6 +107,7 @@ private: Color maBackgroundColor; }; +} SlideSorterView::SlideSorterView (SlideSorter& rSlideSorter) : ::sd::View ( diff --git a/sd/source/ui/slidesorter/view/SlsLayouter.cxx b/sd/source/ui/slidesorter/view/SlsLayouter.cxx index fb80dc9ec127..a4cf7fdf613f 100644 --- a/sd/source/ui/slidesorter/view/SlsLayouter.cxx +++ b/sd/source/ui/slidesorter/view/SlsLayouter.cxx @@ -218,6 +218,8 @@ protected: InsertPosition& rPosition) const; }; +namespace { + /** The vertical layouter has one column and as many rows as there are pages. */ @@ -285,6 +287,8 @@ protected: const Size& rWindowSize) const override; }; +} + //===== Layouter ============================================================== Layouter::Layouter ( diff --git a/sd/source/ui/table/TableDesignPane.cxx b/sd/source/ui/table/TableDesignPane.cxx index c0b1be827bb8..bea6a35797f3 100644 --- a/sd/source/ui/table/TableDesignPane.cxx +++ b/sd/source/ui/table/TableDesignPane.cxx @@ -419,6 +419,8 @@ IMPL_LINK(TableDesignWidget,EventMultiplexerListener, } } +namespace { + struct CellInfo { Color maCellColor; @@ -428,6 +430,8 @@ struct CellInfo explicit CellInfo( const Reference< XStyle >& xStyle ); }; +} + CellInfo::CellInfo( const Reference< XStyle >& xStyle ) : maBorder(std::make_shared<SvxBoxItem>(SDRATTR_TABLE_BORDER)) { @@ -457,6 +461,8 @@ CellInfo::CellInfo( const Reference< XStyle >& xStyle ) typedef std::vector< std::shared_ptr< CellInfo > > CellInfoVector; typedef std::shared_ptr< CellInfo > CellInfoMatrix[nPreviewColumns * nPreviewRows]; +namespace { + struct TableStyleSettings { bool mbUseFirstRow; @@ -475,6 +481,8 @@ struct TableStyleSettings , mbUseColumnBanding(false) {} }; +} + static void FillCellInfoVector( const Reference< XIndexAccess >& xTableStyle, CellInfoVector& rVector ) { DBG_ASSERT( xTableStyle.is() && (xTableStyle->getCount() == sdr::table::style_count ), "sd::FillCellInfoVector(), invalid table style!" ); diff --git a/sd/source/ui/uitest/uiobject.cxx b/sd/source/ui/uitest/uiobject.cxx index 1e18071092c9..e1bb16b8dd1c 100644 --- a/sd/source/ui/uitest/uiobject.cxx +++ b/sd/source/ui/uitest/uiobject.cxx @@ -16,6 +16,8 @@ #include <svx/uiobject.hxx> +namespace { + class ImpressSdrObject : public SdrUIObject { public: @@ -29,8 +31,6 @@ private: OUString const maName; }; -namespace { - sd::DrawViewShell* getViewShell(const VclPtr<sd::Window>& xWindow) { sd::DrawViewShell* pViewShell = dynamic_cast<sd::DrawViewShell*>(xWindow->GetViewShell()); diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx index 701c5462bae6..e30b28a740b1 100644 --- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx +++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx @@ -66,6 +66,8 @@ using namespace ::com::sun::star::i18n; namespace sd { + namespace { + class DocumentSettings : public WeakImplHelper< XPropertySet, XMultiPropertySet, XServiceInfo >, public comphelper::PropertySetHelper, public DocumentSettingsSerializer @@ -121,6 +123,8 @@ namespace sd rtl::Reference<SdXImpressDocument> mxModel; }; + } + Reference< XInterface > DocumentSettings_createInstance( SdXImpressDocument* pModel ) throw () { diff --git a/sd/source/ui/unoidl/randomnode.cxx b/sd/source/ui/unoidl/randomnode.cxx index 64fcfd6b32b5..84b66f19bc05 100644 --- a/sd/source/ui/unoidl/randomnode.cxx +++ b/sd/source/ui/unoidl/randomnode.cxx @@ -66,6 +66,9 @@ namespace sd { typedef ::cppu::WeakImplHelper< XTimeContainer, XEnumerationAccess, XCloneable, XServiceInfo, XInitialization > RandomAnimationNodeBase; + +namespace { + class RandomAnimationNode : public RandomAnimationNodeBase { public: @@ -151,6 +154,8 @@ private: Reference< XAnimate > mxFirstNode; }; +} + Reference< XInterface > RandomAnimationNode_createInstance( sal_Int16 nPresetClass ) { Reference< XInterface > xInt( static_cast<XWeak*>( new RandomAnimationNode( nPresetClass ) ) ); diff --git a/sd/source/ui/unoidl/unomodel.cxx b/sd/source/ui/unoidl/unomodel.cxx index 6f7510488a30..ca60d3821e88 100644 --- a/sd/source/ui/unoidl/unomodel.cxx +++ b/sd/source/ui/unoidl/unomodel.cxx @@ -126,6 +126,8 @@ using namespace ::cppu; using namespace ::com::sun::star; using namespace ::sd; +namespace { + class SdUnoForbiddenCharsTable : public SvxUnoForbiddenCharsTable, public SfxListener { @@ -142,6 +144,8 @@ private: SdrModel* mpModel; }; +} + SdUnoForbiddenCharsTable::SdUnoForbiddenCharsTable( SdrModel* pModel ) : SvxUnoForbiddenCharsTable( pModel->GetForbiddenCharsTable() ), mpModel( pModel ) { @@ -1484,6 +1488,8 @@ uno::Sequence< beans::PropertyValue > SAL_CALL SdXImpressDocument::getRenderer( return aRenderer; } +namespace { + class ImplRenderPaintProc : public sdr::contact::ViewObjectContactRedirector { const SdrLayerAdmin& rLayerAdmin; @@ -1505,6 +1511,8 @@ public: const sdr::contact::DisplayInfo& rDisplayInfo) override; }; +} + ImplRenderPaintProc::ImplRenderPaintProc( const SdrLayerAdmin& rLA, SdrPageView* pView, vcl::PDFExtOutDevData* pData ) : ViewObjectContactRedirector(), rLayerAdmin ( rLA ), diff --git a/sd/source/ui/unoidl/unopage.cxx b/sd/source/ui/unoidl/unopage.cxx index 328e50f0aba0..534bdbd29981 100644 --- a/sd/source/ui/unoidl/unopage.cxx +++ b/sd/source/ui/unoidl/unopage.cxx @@ -2538,6 +2538,8 @@ void SdGenericDrawPage::setNavigationOrder( const Any& rValue ) throw IllegalArgumentException(); } +namespace { + class SdNavigationOrderAccess : public ::cppu::WeakImplHelper< XIndexAccess > { public: @@ -2555,6 +2557,8 @@ private: std::vector< Reference< XShape > > maShapes; }; +} + SdNavigationOrderAccess::SdNavigationOrderAccess( SdrPage const * pPage ) : maShapes( pPage ? pPage->GetObjCount() : 0 ) { diff --git a/sd/source/ui/unoidl/unopool.cxx b/sd/source/ui/unoidl/unopool.cxx index 6b91088aeab2..7345dc45dfb7 100644 --- a/sd/source/ui/unoidl/unopool.cxx +++ b/sd/source/ui/unoidl/unopool.cxx @@ -42,6 +42,8 @@ static LanguageType SdUnoGetLanguage( const lang::Locale& rLocale ) return eRet; } +namespace { + class SdUnoDrawPool : public SvxUnoDrawPool { public: @@ -54,6 +56,8 @@ private: SdDrawDocument* mpDrawModel; }; +} + SdUnoDrawPool::SdUnoDrawPool(SdDrawDocument* pModel) : SvxUnoDrawPool( pModel ), mpDrawModel( pModel ) { diff --git a/sd/source/ui/unoidl/unosrch.cxx b/sd/source/ui/unoidl/unosrch.cxx index 45177d2adfd4..0312bb56d413 100644 --- a/sd/source/ui/unoidl/unosrch.cxx +++ b/sd/source/ui/unoidl/unosrch.cxx @@ -52,6 +52,8 @@ static const SfxItemPropertyMapEntry* ImplGetSearchPropertyMap() return aSearchPropertyMap_Impl; } +namespace { + class SearchContext_impl { uno::Reference< drawing::XShapes > mxShapes; @@ -79,6 +81,8 @@ public: } }; +} + /* ================================================================= */ /** this class implements a search or replace operation on a given page or a given sdrobj diff --git a/sd/source/ui/view/drviews2.cxx b/sd/source/ui/view/drviews2.cxx index 664609e87597..d1f037bf2b69 100644 --- a/sd/source/ui/view/drviews2.cxx +++ b/sd/source/ui/view/drviews2.cxx @@ -230,8 +230,6 @@ OUString getWeightString(SfxItemSet const & rItemSet) return sWeightString; } -} // end anonymous namespace - class ClassificationCommon { protected: @@ -539,8 +537,6 @@ public: } }; -namespace -{ void lcl_convertStringArguments(sal_uInt16 nSlot, std::unique_ptr<SfxItemSet>& pArgs) { Color aColor; diff --git a/sd/source/ui/view/drviewsa.cxx b/sd/source/ui/view/drviewsa.cxx index 53fc3cfa941d..789d46eafce3 100644 --- a/sd/source/ui/view/drviewsa.cxx +++ b/sd/source/ui/view/drviewsa.cxx @@ -76,6 +76,7 @@ namespace sd { bool DrawViewShell::mbPipette = false; +namespace { class ScannerEventListener : public ::cppu::WeakImplHelper< lang::XEventListener > { @@ -93,6 +94,8 @@ public: void ParentDestroyed() { mpParent = nullptr; } }; +} + void SAL_CALL ScannerEventListener::disposing( const lang::EventObject& /*rEventObject*/ ) { if( mpParent ) diff --git a/sd/source/ui/view/sdview.cxx b/sd/source/ui/view/sdview.cxx index 0abaff31fc9f..56df6e5d2caf 100644 --- a/sd/source/ui/view/sdview.cxx +++ b/sd/source/ui/view/sdview.cxx @@ -149,6 +149,8 @@ View::~View() } } +namespace { + class ViewRedirector : public sdr::contact::ViewObjectContactRedirector { public: @@ -161,6 +163,8 @@ public: const sdr::contact::DisplayInfo& rDisplayInfo) override; }; +} + ViewRedirector::ViewRedirector() { } diff --git a/sd/source/ui/view/sdview2.cxx b/sd/source/ui/view/sdview2.cxx index ef22fde0f15b..825094382c98 100644 --- a/sd/source/ui/view/sdview2.cxx +++ b/sd/source/ui/view/sdview2.cxx @@ -60,6 +60,7 @@ namespace sd { using namespace ::com::sun::star; +namespace { struct SdNavigatorDropEvent : public ExecuteDropEvent { @@ -73,6 +74,8 @@ struct SdNavigatorDropEvent : public ExecuteDropEvent {} }; +} + css::uno::Reference< css::datatransfer::XTransferable > View::CreateClipboardDataObject() { // since SdTransferable::CopyToClipboard is called, this diff --git a/sd/source/ui/view/sdview3.cxx b/sd/source/ui/view/sdview3.cxx index d1873a6b73aa..c74845cc836d 100644 --- a/sd/source/ui/view/sdview3.cxx +++ b/sd/source/ui/view/sdview3.cxx @@ -84,12 +84,16 @@ namespace sd { |* \************************************************************************/ +namespace { + struct ImpRememberOrigAndClone { SdrObject* pOrig; SdrObject* pClone; }; +} + static SdrObject* ImpGetClone(std::vector<ImpRememberOrigAndClone>& aConnectorContainer, SdrObject const * pConnObj) { for(const ImpRememberOrigAndClone& rImp : aConnectorContainer) diff --git a/sd/source/ui/view/viewoverlaymanager.cxx b/sd/source/ui/view/viewoverlaymanager.cxx index 8b5814749529..3dc5260944a2 100644 --- a/sd/source/ui/view/viewoverlaymanager.cxx +++ b/sd/source/ui/view/viewoverlaymanager.cxx @@ -51,8 +51,12 @@ using namespace ::com::sun::star::uno; namespace sd { +namespace { + class ImageButtonHdl; +} + static const sal_uInt16 gButtonSlots[] = { SID_INSERT_TABLE, SID_INSERT_DIAGRAM, SID_INSERT_GRAPHIC, SID_INSERT_AVMEDIA }; static const char* gButtonToolTips[] = { STR_INSERT_TABLE, STR_INSERT_CHART, STR_INSERT_PICTURE, STR_INSERT_MOVIE }; @@ -108,6 +112,8 @@ static BitmapEx* getButtonImage( int index, bool large ) const sal_uInt32 SMART_TAG_HDL_NUM = SAL_MAX_UINT32; +namespace { + class ChangePlaceholderTag : public SmartTag { friend class ImageButtonHdl; @@ -154,6 +160,8 @@ private: Size maImageSize; }; +} + ImageButtonHdl::ImageButtonHdl( const SmartTagReference& xTag /*, sal_uInt16 nSID, const Image& rImage, const Image& rImageMO*/, const Point& rPnt ) : SmartHdl( xTag, rPnt, SdrHdlKind::SmartTag ) , mxChangePlaceholderTag( dynamic_cast< ChangePlaceholderTag* >( xTag.get() ) ) diff --git a/sd/source/ui/view/viewshel.cxx b/sd/source/ui/view/viewshel.cxx index 5df5c54de71e..9697c3de8461 100644 --- a/sd/source/ui/view/viewshel.cxx +++ b/sd/source/ui/view/viewshel.cxx @@ -1154,6 +1154,8 @@ void ViewShell::ImpGetRedoStrings(SfxItemSet &rSet) const } } +namespace { + class KeepSlideSorterInSyncWithPageChanges { sd::slidesorter::view::SlideSorterView::DrawLock m_aDrawLock; @@ -1171,6 +1173,8 @@ public: } }; +} + void ViewShell::ImpSidUndo(SfxRequest& rReq) { //The xWatcher keeps the SlideSorter selection in sync diff --git a/sdext/source/minimizer/pppoptimizertoken.cxx b/sdext/source/minimizer/pppoptimizertoken.cxx index 31cb4ecb524a..d4d4c99c4ba5 100644 --- a/sdext/source/minimizer/pppoptimizertoken.cxx +++ b/sdext/source/minimizer/pppoptimizertoken.cxx @@ -32,12 +32,16 @@ static ::osl::Mutex& getHashMapMutex() return s_aHashMapProtection; } +namespace { + struct TokenTable { const char* pS; PPPOptimizerTokenEnum const pE; }; +} + static const TokenTable pTokenTableArray[] = { { "rdmNavi", TK_rdmNavi }, diff --git a/sdext/source/pdfimport/filterdet.cxx b/sdext/source/pdfimport/filterdet.cxx index 03931f47edb0..004d2d813abf 100644 --- a/sdext/source/pdfimport/filterdet.cxx +++ b/sdext/source/pdfimport/filterdet.cxx @@ -46,6 +46,8 @@ namespace pdfi // TODO(T3): locking/thread safety +namespace { + class FileEmitContext : public pdfparse::EmitContext { private: @@ -69,6 +71,8 @@ public: const uno::Reference< io::XStream >& getContextStream() const { return m_xContextStream; } }; +} + FileEmitContext::FileEmitContext( const OUString& rOrigFile, const uno::Reference< uno::XComponentContext >& xContext, const pdfparse::PDFContainer* pTop ) : diff --git a/sdext/source/pdfimport/odf/odfemitter.cxx b/sdext/source/pdfimport/odf/odfemitter.cxx index dd5b4e5872b7..b191462eef15 100644 --- a/sdext/source/pdfimport/odf/odfemitter.cxx +++ b/sdext/source/pdfimport/odf/odfemitter.cxx @@ -31,6 +31,8 @@ using namespace com::sun::star; namespace pdfi { +namespace { + class OdfEmitter : public XmlEmitter { private: @@ -46,6 +48,8 @@ public: virtual void endTag( const char* pTag ) override; }; +} + OdfEmitter::OdfEmitter( const uno::Reference<io::XOutputStream>& xOutput ) : m_xOutput( xOutput ), m_aLineFeed(1), diff --git a/sdext/source/pdfimport/pdfparse/pdfparse.cxx b/sdext/source/pdfimport/pdfparse/pdfparse.cxx index 0be394d58eb1..03dd5aca4dea 100644 --- a/sdext/source/pdfimport/pdfparse/pdfparse.cxx +++ b/sdext/source/pdfimport/pdfparse/pdfparse.cxx @@ -52,6 +52,7 @@ using namespace boost::spirit; using namespace pdfparse; +namespace { class StringEmitContext : public EmitContext { @@ -548,6 +549,8 @@ public: } }; +} + #ifdef _WIN32 std::unique_ptr<PDFEntry> PDFReader::read( const char* pBuffer, unsigned int nLen ) { diff --git a/sdext/source/pdfimport/test/pdfunzip.cxx b/sdext/source/pdfimport/test/pdfunzip.cxx index 7d27aaf3253d..7c857e884bd6 100644 --- a/sdext/source/pdfimport/test/pdfunzip.cxx +++ b/sdext/source/pdfimport/test/pdfunzip.cxx @@ -52,6 +52,8 @@ static void printHelp( const char* pExe ) , pExe, pExe, pExe, pExe, pExe ); } +namespace { + class FileEmitContext : public EmitContext { oslFileHandle m_aHandle; @@ -70,6 +72,8 @@ class FileEmitContext : public EmitContext virtual unsigned int readOrigBytes( unsigned int nOrigOffset, unsigned int nLen, void* pBuf ) throw() override; }; +} + FileEmitContext::FileEmitContext( const char* pFileName, const char* pOrigName, const PDFContainer* pTop ) : EmitContext( pTop ), m_aHandle( nullptr ), diff --git a/sdext/source/pdfimport/tree/treevisitorfactory.cxx b/sdext/source/pdfimport/tree/treevisitorfactory.cxx index 094fe0935c22..a9cf73cc2aa8 100644 --- a/sdext/source/pdfimport/tree/treevisitorfactory.cxx +++ b/sdext/source/pdfimport/tree/treevisitorfactory.cxx @@ -24,6 +24,8 @@ namespace pdfi { + namespace { + struct WriterTreeVisitorFactory : public TreeVisitorFactory { WriterTreeVisitorFactory() {} @@ -94,6 +96,8 @@ namespace pdfi } }; + } + TreeVisitorFactorySharedPtr createWriterTreeVisitorFactory() { return TreeVisitorFactorySharedPtr(new WriterTreeVisitorFactory()); diff --git a/sdext/source/pdfimport/wrapper/wrapper.cxx b/sdext/source/pdfimport/wrapper/wrapper.cxx index 3d36e77110be..5074258605a5 100644 --- a/sdext/source/pdfimport/wrapper/wrapper.cxx +++ b/sdext/source/pdfimport/wrapper/wrapper.cxx @@ -952,6 +952,8 @@ static bool checkEncryption( const OUString& i_rPa return bSuccess; } +namespace { + class Buffering { static const int SIZE = 64*1024; @@ -991,6 +993,8 @@ public: } }; +} + bool xpdf_ImportFromFile(const OUString& rURL, const ContentSinkSharedPtr& rSink, const uno::Reference<task::XInteractionHandler>& xIHdl, diff --git a/sdext/source/presenter/PresenterAccessibility.cxx b/sdext/source/presenter/PresenterAccessibility.cxx index 14c3c81ede7f..c69f3f15b96f 100644 --- a/sdext/source/presenter/PresenterAccessibility.cxx +++ b/sdext/source/presenter/PresenterAccessibility.cxx @@ -198,7 +198,6 @@ namespace { typedef ::cppu::WeakComponentImplHelper < css::accessibility::XAccessibleStateSet > AccessibleStateSetInterfaceBase; -} class AccessibleStateSet : public ::cppu::BaseMutex, @@ -225,11 +224,9 @@ private: //===== AccessibleRelationSet ================================================= -namespace { typedef ::cppu::WeakComponentImplHelper < css::accessibility::XAccessibleRelationSet > AccessibleRelationSetInterfaceBase; -} class AccessibleRelationSet : public ::cppu::BaseMutex, @@ -258,7 +255,6 @@ private: //===== PresenterAccessibleParagraph ========================================== -namespace { typedef ::cppu::ImplInheritanceHelper < PresenterAccessible::AccessibleObject, css::accessibility::XAccessibleText @@ -340,6 +336,8 @@ private: //===== AccessibleConsole ===================================================== +namespace { + class AccessibleConsole { public: @@ -453,6 +451,8 @@ private: AccessibleFocusManager(); }; +} + //===== PresenterAccessible =================================================== PresenterAccessible::PresenterAccessible ( diff --git a/sfx2/source/appl/appcfg.cxx b/sfx2/source/appl/appcfg.cxx index 208c23aca8b5..8b9ca9e6f413 100644 --- a/sfx2/source/appl/appcfg.cxx +++ b/sfx2/source/appl/appcfg.cxx @@ -76,6 +76,7 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; using namespace ::com::sun::star::beans; +namespace { class SfxEventAsyncer_Impl : public SfxListener { @@ -89,6 +90,7 @@ public: DECL_LINK( IdleHdl, Timer*, void ); }; +} void SfxEventAsyncer_Impl::Notify( SfxBroadcaster&, const SfxHint& rHint ) { diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx index 3b2234e8545b..68ee31f76b89 100644 --- a/sfx2/source/appl/appinit.cxx +++ b/sfx2/source/appl/appinit.cxx @@ -72,6 +72,8 @@ using namespace ::com::sun::star::frame; using namespace ::com::sun::star::lang; using namespace ::com::sun::star; +namespace { + class SfxTerminateListener_Impl : public ::cppu::WeakImplHelper< XTerminateListener, XServiceInfo > { public: @@ -87,6 +89,8 @@ public: virtual css::uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; }; +} + void SAL_CALL SfxTerminateListener_Impl::disposing( const EventObject& ) { } diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index 5ef87f45cc91..5f6fb65c3684 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -117,6 +117,7 @@ void SetTemplate_Impl( const OUString &rFileName, pDoc->ResetFromTemplate( rLongName, rFileName ); } +namespace { class SfxDocPasswordVerifier : public ::comphelper::IDocPasswordVerifier { @@ -134,6 +135,7 @@ private: Reference< embed::XStorage > mxStorage; }; +} ::comphelper::DocPasswordVerifierResult SfxDocPasswordVerifier::verifyPassword( const OUString& rPassword, uno::Sequence< beans::NamedValue >& o_rEncryptionData ) { diff --git a/sfx2/source/appl/childwin.cxx b/sfx2/source/appl/childwin.cxx index a7013fa6c530..602b24967d5c 100644 --- a/sfx2/source/appl/childwin.cxx +++ b/sfx2/source/appl/childwin.cxx @@ -64,6 +64,7 @@ struct SfxChildWindow_Impl SfxWorkWindow* pWorkWin; }; +namespace { class DisposeListener : public ::cppu::WeakImplHelper< css::lang::XEventListener > { @@ -107,6 +108,7 @@ class DisposeListener : public ::cppu::WeakImplHelper< css::lang::XEventListener SfxChildWindow_Impl* m_pData ; }; +} bool GetPosSizeFromString( const OUString& rStr, Point& rPos, Size& rSize ) { diff --git a/sfx2/source/appl/impldde.cxx b/sfx2/source/appl/impldde.cxx index 25097d480440..39cd6629b12a 100644 --- a/sfx2/source/appl/impldde.cxx +++ b/sfx2/source/appl/impldde.cxx @@ -47,6 +47,8 @@ using namespace ::com::sun::star::uno; namespace sfx2 { +namespace { + class SvDDELinkEditDialog : public weld::GenericDialogController { std::unique_ptr<weld::Entry> m_xEdDdeApp; @@ -60,6 +62,8 @@ public: OUString GetCmd() const; }; +} + SvDDELinkEditDialog::SvDDELinkEditDialog(weld::Window* pParent, SvBaseLink const * pLink) : GenericDialogController(pParent, "sfx/ui/linkeditdialog.ui", "LinkEditDialog") , m_xEdDdeApp(m_xBuilder->weld_entry("app")) diff --git a/sfx2/source/appl/linkmgr2.cxx b/sfx2/source/appl/linkmgr2.cxx index 4f9c109a23d1..fb8746e834fd 100644 --- a/sfx2/source/appl/linkmgr2.cxx +++ b/sfx2/source/appl/linkmgr2.cxx @@ -60,6 +60,8 @@ using ::com::sun::star::util::XCloseable; namespace sfx2 { +namespace { + class SvxInternalLink : public sfx2::SvLinkSource { public: @@ -68,6 +70,8 @@ public: virtual bool Connect( sfx2::SvBaseLink* ) override; }; +} + LinkManager::LinkManager(SfxObjectShell* p) : pPersist( p ) { diff --git a/sfx2/source/appl/linksrc.cxx b/sfx2/source/appl/linksrc.cxx index 98c347713dfb..9bfab2bfa4d8 100644 --- a/sfx2/source/appl/linksrc.cxx +++ b/sfx2/source/appl/linksrc.cxx @@ -33,6 +33,7 @@ using namespace ::com::sun::star::uno; namespace sfx2 { +namespace { class SvLinkSourceTimer : public Timer { @@ -42,6 +43,8 @@ public: explicit SvLinkSourceTimer( SvLinkSource * pOwn ); }; +} + SvLinkSourceTimer::SvLinkSourceTimer( SvLinkSource * pOwn ) : pOwner( pOwn ) { @@ -65,6 +68,7 @@ static void StartTimer( std::unique_ptr<SvLinkSourceTimer>& pTimer, SvLinkSource } } +namespace { struct SvLinkSource_Entry_Impl { @@ -119,6 +123,8 @@ public: bool IsValidCurrValue( SvLinkSource_Entry_Impl const * pEntry ); }; +} + SvLinkSource_EntryIter_Impl::SvLinkSource_EntryIter_Impl( const SvLinkSource_Array_Impl& rArr ) : rOrigArr( rArr ), nPos( 0 ) diff --git a/sfx2/source/appl/lnkbase2.cxx b/sfx2/source/appl/lnkbase2.cxx index 9d234bf82c81..ab0119053021 100644 --- a/sfx2/source/appl/lnkbase2.cxx +++ b/sfx2/source/appl/lnkbase2.cxx @@ -40,9 +40,12 @@ using namespace ::com::sun::star::uno; namespace sfx2 { +namespace { class ImplDdeItem; +} + struct BaseLink_Impl { Link<SvBaseLink&,void> m_aEndEditLink; @@ -89,6 +92,7 @@ struct ImplBaseLinkData } }; +namespace { class ImplDdeItem : public DdeGetPutItem { @@ -119,6 +123,7 @@ public: bool IsInDTOR() const { return bIsInDTOR; } }; +} SvBaseLink::SvBaseLink() : pImpl ( new BaseLink_Impl ), diff --git a/sfx2/source/appl/newhelp.cxx b/sfx2/source/appl/newhelp.cxx index c34308afb72d..945d24a1f63b 100644 --- a/sfx2/source/appl/newhelp.cxx +++ b/sfx2/source/appl/newhelp.cxx @@ -243,6 +243,8 @@ namespace sfx2 // struct IndexEntry_Impl ------------------------------------------------ +namespace { + struct IndexEntry_Impl { bool const m_bSubEntry; @@ -263,6 +265,8 @@ struct ContentEntry_Impl aURL( rURL ), bIsFolder( bFolder ) {} }; +} + // ContentListBox_Impl --------------------------------------------------- ContentListBox_Impl::ContentListBox_Impl(vcl::Window* pParent, WinBits nStyle) diff --git a/sfx2/source/appl/openuriexternally.cxx b/sfx2/source/appl/openuriexternally.cxx index c0a14425ebc8..45e9ee0861f4 100644 --- a/sfx2/source/appl/openuriexternally.cxx +++ b/sfx2/source/appl/openuriexternally.cxx @@ -31,6 +31,8 @@ #include <sfx2/viewsh.hxx> #include <sfx2/strings.hrc> +namespace { + class URITools { private: @@ -47,6 +49,8 @@ public: void openURI(const OUString& sURI, bool bHandleSystemShellExecuteException); }; +} + void URITools::openURI(const OUString& sURI, bool bHandleSystemShellExecuteException) { if (comphelper::LibreOfficeKit::isActive()) diff --git a/sfx2/source/appl/sfxhelp.cxx b/sfx2/source/appl/sfxhelp.cxx index c4c1735f6418..2158acdcc7fd 100644 --- a/sfx2/source/appl/sfxhelp.cxx +++ b/sfx2/source/appl/sfxhelp.cxx @@ -102,6 +102,8 @@ using namespace ::com::sun::star::util; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::system; +namespace { + class NoHelpErrorBox { private: @@ -122,6 +124,8 @@ public: } }; +} + IMPL_STATIC_LINK_NOARG(NoHelpErrorBox, HelpRequestHdl, weld::Widget&, bool) { // do nothing, because no help available @@ -329,12 +333,16 @@ static bool GetHelpAnchor_Impl( const OUString& _rURL, OUString& _rAnchor ) return bRet; } +namespace { + class SfxHelp_Impl { public: static OUString GetHelpText( const OUString& aCommandURL, const OUString& rModule ); }; +} + OUString SfxHelp_Impl::GetHelpText( const OUString& aCommandURL, const OUString& rModule ) { // create help url @@ -994,6 +1002,8 @@ namespace } } +namespace { + class HelpManualMessage : public weld::MessageDialogController { private: @@ -1013,6 +1023,8 @@ public: bool GetOfflineHelpPopUp() const { return !m_xHideOfflineHelpCB->get_active(); } }; +} + bool SfxHelp::Start_Impl(const OUString& rURL, const vcl::Window* pWindow, const OUString& rKeyword) { OUStringBuffer aHelpRootURL("vnd.sun.star.help://"); diff --git a/sfx2/source/appl/workwin.cxx b/sfx2/source/appl/workwin.cxx index 5feb326243fc..f372857c286a 100644 --- a/sfx2/source/appl/workwin.cxx +++ b/sfx2/source/appl/workwin.cxx @@ -63,12 +63,16 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +namespace { + struct ResIdToResName { ToolbarId const eId; const char* pName; }; +} + static const ResIdToResName pToolBarResToName[] = { { ToolbarId::FullScreenToolbox, "fullscreenbar" }, diff --git a/sfx2/source/bastyp/fltlst.cxx b/sfx2/source/bastyp/fltlst.cxx index d1f1199ff7e7..ef9e333129b8 100644 --- a/sfx2/source/bastyp/fltlst.cxx +++ b/sfx2/source/bastyp/fltlst.cxx @@ -34,6 +34,7 @@ using namespace ::com::sun::star; +namespace { class SfxRefreshListener : public ::cppu::WeakImplHelper<css::util::XRefreshListener> { @@ -59,6 +60,8 @@ class SfxRefreshListener : public ::cppu::WeakImplHelper<css::util::XRefreshList } }; +} + /*-************************************************************************************************************ @short ctor @descr These initialize an instance of a SfxFilterListener class. Created object listen automatically diff --git a/sfx2/source/control/dispatch.cxx b/sfx2/source/control/dispatch.cxx index 246a10d32ca5..a05abc6cb7cf 100644 --- a/sfx2/source/control/dispatch.cxx +++ b/sfx2/source/control/dispatch.cxx @@ -78,6 +78,8 @@ typedef std::vector<SfxShell*> SfxShellStack_Impl; +namespace { + struct SfxToDo_Impl { SfxShell* pCluster; @@ -104,6 +106,8 @@ struct SfxObjectBars_Impl SfxObjectBars_Impl() : eId(ToolbarId::None), nPos(0), nFlags(SfxVisibilityFlags::Invisible) {} }; +} + struct SfxDispatcher_Impl { //When the dispatched is locked, SfxRequests accumulate in aReqArr for diff --git a/sfx2/source/control/objface.cxx b/sfx2/source/control/objface.cxx index f87b4fbbb10e..3a459dd5551e 100644 --- a/sfx2/source/control/objface.cxx +++ b/sfx2/source/control/objface.cxx @@ -50,6 +50,8 @@ SfxCompareSlots_bsearch( const void* pSmaller, const void* pBigger ) } +namespace { + struct SfxObjectUI_Impl { sal_uInt16 const nPos; @@ -68,6 +70,8 @@ struct SfxObjectUI_Impl } }; +} + struct SfxInterface_Impl { std::vector<std::unique_ptr<SfxObjectUI_Impl>> diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx index f9a11830e925..1eef3824302d 100644 --- a/sfx2/source/dialog/backingwindow.cxx +++ b/sfx2/source/dialog/backingwindow.cxx @@ -704,6 +704,8 @@ IMPL_LINK(BackingWindow, EditTemplateHdl, ThumbnailViewItem*, pItem, void) } } +namespace { + struct ImplDelayedDispatch { Reference< XDispatch > xDispatch; @@ -720,6 +722,8 @@ struct ImplDelayedDispatch } }; +} + static void implDispatchDelayed( void*, void* pArg ) { struct ImplDelayedDispatch* pDispatch = static_cast<ImplDelayedDispatch*>(pArg); diff --git a/sfx2/source/dialog/dinfdlg.cxx b/sfx2/source/dialog/dinfdlg.cxx index 85d46610b73a..1abf3e3d3d91 100644 --- a/sfx2/source/dialog/dinfdlg.cxx +++ b/sfx2/source/dialog/dinfdlg.cxx @@ -1153,6 +1153,8 @@ CustomPropertiesYesNoButton::~CustomPropertiesYesNoButton() { } +namespace { + class DurationDialog_Impl : public weld::GenericDialogController { std::unique_ptr<weld::CheckButton> m_xNegativeCB; @@ -1169,6 +1171,8 @@ public: util::Duration GetDuration() const; }; +} + DurationDialog_Impl::DurationDialog_Impl(weld::Widget* pParent, const util::Duration& rDuration) : GenericDialogController(pParent, "sfx/ui/editdurationdialog.ui", "EditDurationDialog") , m_xNegativeCB(m_xBuilder->weld_check_button("negative")) diff --git a/sfx2/source/dialog/dockwin.cxx b/sfx2/source/dialog/dockwin.cxx index faa103d55e04..ff2e65a21507 100644 --- a/sfx2/source/dialog/dockwin.cxx +++ b/sfx2/source/dialog/dockwin.cxx @@ -62,6 +62,8 @@ using namespace ::com::sun::star; // - Add new slot definitions to sfx.sdi static const int NUM_OF_DOCKINGWINDOWS = 10; +namespace { + class SfxTitleDockingWindow : public SfxDockingWindow { VclPtr<vcl::Window> m_pWrappedWindow; @@ -83,8 +85,6 @@ public: virtual void Resizing( Size& rSize ) override; }; -namespace -{ struct WindowState { OUString sTitle; diff --git a/sfx2/source/dialog/filtergrouping.cxx b/sfx2/source/dialog/filtergrouping.cxx index 8db8f4f8bdad..ea77aa764317 100644 --- a/sfx2/source/dialog/filtergrouping.cxx +++ b/sfx2/source/dialog/filtergrouping.cxx @@ -134,6 +134,8 @@ namespace sfx2 // which a given filter may belong to typedef ::std::map< OUString, FilterGroup::iterator > FilterGroupEntryReferrer; + namespace { + /// a descriptor for a filter class (which in the final dialog is represented by one filter entry) struct FilterClass { @@ -141,6 +143,8 @@ namespace sfx2 Sequence< FilterName > aSubFilters; // the (logical) names of the filter which belong to the class }; + } + typedef ::std::list< FilterClass > FilterClassList; typedef ::std::map< OUString, FilterClassList::iterator > FilterClassReferrer; @@ -159,6 +163,7 @@ namespace sfx2 aClassDesc.getNodeValue( "Filters" ) >>= _rClass.aSubFilters; } + namespace { struct CreateEmptyClassRememberPos { @@ -219,6 +224,7 @@ namespace sfx2 } }; + } static void lcl_ReadGlobalFilters( const OConfigurationNode& _rFilterClassification, FilterClassList& _rGlobalClasses, std::vector<OUString>& _rGlobalClassNames ) { @@ -258,6 +264,7 @@ namespace sfx2 ); } + namespace { struct ReadLocalFilter { @@ -284,6 +291,7 @@ namespace sfx2 } }; + } static void lcl_ReadLocalFilters( const OConfigurationNode& _rFilterClassification, FilterClassList& _rLocalClasses ) { @@ -326,6 +334,7 @@ namespace sfx2 // = grouping and classifying + namespace { // a struct which adds helps remembering a reference to a class entry struct ReferToFilterEntry @@ -390,6 +399,7 @@ namespace sfx2 } }; + } static const sal_Unicode s_cWildcardSeparator( ';' ); @@ -398,6 +408,7 @@ namespace sfx2 return ";"; } + namespace { struct CheckAppendSingleWildcard { @@ -455,6 +466,7 @@ namespace sfx2 } }; + } AppendWildcardToDescriptor::AppendWildcardToDescriptor( const OUString& _rWildCard ) { @@ -519,6 +531,8 @@ namespace sfx2 MapGroupEntry2GroupEntry; // this is not really a map - it's just called this way because it is used as a map + namespace { + struct FindGroupEntry { FilterGroupEntryReferrer::mapped_type const aLookingFor; @@ -551,6 +565,7 @@ namespace sfx2 } }; + } static void lcl_GroupAndClassify( TSortedFilterList& _rFilterMatcher, GroupedFilterList& _rAllFilters ) { @@ -703,6 +718,7 @@ namespace sfx2 rGlobalFilters.swap( aNonEmptyGlobalFilters ); } + namespace { struct AppendFilter { @@ -734,6 +750,7 @@ namespace sfx2 } }; + } // = handling for the "all files" entry @@ -773,6 +790,7 @@ namespace sfx2 // = filling an XFilterManager + namespace { struct AppendFilterGroup { @@ -830,6 +848,7 @@ namespace sfx2 } }; + } TSortedFilterList::TSortedFilterList(const css::uno::Reference< css::container::XEnumeration >& xFilterList) : m_nIterator(0) @@ -927,6 +946,8 @@ namespace sfx2 } } + namespace { + struct ExportFilter { ExportFilter( const OUString& _aUIName, const OUString& _aWildcard ) : @@ -936,6 +957,7 @@ namespace sfx2 OUString aWildcard; }; + } void appendExportFilters( TSortedFilterList& _rFilterMatcher, const Reference< XFilterManager >& _rxFilterManager, diff --git a/sfx2/source/dialog/mailmodel.cxx b/sfx2/source/dialog/mailmodel.cxx index 7d8e3b01f34c..c208cf21153a 100644 --- a/sfx2/source/dialog/mailmodel.cxx +++ b/sfx2/source/dialog/mailmodel.cxx @@ -84,6 +84,8 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::util; using namespace ::com::sun::star::system; +namespace { + // - class PrepareListener_Impl ------------------------------------------ class PrepareListener_Impl : public ::cppu::WeakImplHelper< css::frame::XStatusListener > { @@ -100,6 +102,8 @@ public: bool IsSet() const {return m_bState;} }; +} + PrepareListener_Impl::PrepareListener_Impl() : m_bState( false ) { diff --git a/sfx2/source/dialog/tabdlg.cxx b/sfx2/source/dialog/tabdlg.cxx index a85f4ea1368e..abcdca034b42 100644 --- a/sfx2/source/dialog/tabdlg.cxx +++ b/sfx2/source/dialog/tabdlg.cxx @@ -56,6 +56,8 @@ struct TabPageImpl TabPageImpl() : mbStandard(false), mpSfxDialogController(nullptr) {} }; +namespace { + struct Data_Impl { OString const sId; // The ID @@ -76,6 +78,8 @@ struct Data_Impl } }; +} + SfxTabDialogItem::SfxTabDialogItem( const SfxTabDialogItem& rAttr, SfxItemPool* pItemPool ) : SfxSetItem( rAttr, pItemPool ) { diff --git a/sfx2/source/dialog/templdlg.cxx b/sfx2/source/dialog/templdlg.cxx index 2bda9d438466..e1a42b0fcb90 100644 --- a/sfx2/source/dialog/templdlg.cxx +++ b/sfx2/source/dialog/templdlg.cxx @@ -553,9 +553,16 @@ void StyleTreeListBox_Impl::Recalc() } /** Internal structure for the establishment of the hierarchical view */ +namespace { + class StyleTree_Impl; + +} + typedef std::vector<std::unique_ptr<StyleTree_Impl>> StyleTreeArr_Impl; +namespace { + class StyleTree_Impl { private: @@ -574,6 +581,7 @@ public: StyleTreeArr_Impl& getChildren() { return pChildren; } }; +} static void MakeTree_Impl(StyleTreeArr_Impl& rArr) { diff --git a/sfx2/source/doc/Metadatable.cxx b/sfx2/source/doc/Metadatable.cxx index 13d3021bc95f..4062fffba1b4 100644 --- a/sfx2/source/doc/Metadatable.cxx +++ b/sfx2/source/doc/Metadatable.cxx @@ -206,6 +206,8 @@ protected: // XmlIdRegistryDocument --------------------------------------------- +namespace { + /** non-clipboard documents */ class XmlIdRegistryDocument : public XmlIdRegistry { @@ -249,6 +251,8 @@ private: ::std::unique_ptr<XmlIdRegistry_Impl> m_pImpl; }; +} + // MetadatableUndo --------------------------------------------------- /** the horrible Undo Metadatable: is inserted into lists to track position */ @@ -300,6 +304,8 @@ public: // XmlIdRegistryClipboard -------------------------------------------- +namespace { + class XmlIdRegistryClipboard : public XmlIdRegistry { @@ -338,6 +344,7 @@ private: ::std::unique_ptr<XmlIdRegistry_Impl> m_pImpl; }; +} // XmlIdRegistry @@ -422,6 +429,8 @@ typedef ::std::vector< Metadatable* > XmlIdVector_t; typedef std::unordered_map< OUString, ::std::pair< XmlIdVector_t, XmlIdVector_t > > XmlIdMap_t; +namespace { + /// pointer hash template template<typename T> struct PtrHash { @@ -431,6 +440,8 @@ template<typename T> struct PtrHash } }; +} + /// element -> (stream name, idref) typedef std::unordered_map< const Metadatable*, ::std::pair< OUString, OUString>, PtrHash<Metadatable> > @@ -876,6 +887,8 @@ XmlIdRegistryDocument::JoinMetadatables( // Clipboard XML ID Registry (_Impl) +namespace { + struct RMapEntry { RMapEntry() : m_xLink() { } @@ -891,6 +904,8 @@ struct RMapEntry std::shared_ptr<MetadatableClipboard> m_xLink; }; +} + /// element -> (stream name, idref, source) typedef std::unordered_map< const Metadatable*, struct RMapEntry, diff --git a/sfx2/source/doc/doctempl.cxx b/sfx2/source/doc/doctempl.cxx index 167caae41043..02744f627657 100644 --- a/sfx2/source/doc/doctempl.cxx +++ b/sfx2/source/doc/doctempl.cxx @@ -104,10 +104,16 @@ using namespace ::ucbhelper; #define COMMAND_TRANSFER "transfer" +namespace { + class RegionData_Impl; +} + namespace DocTempl { +namespace { + class DocTempl_EntryData_Impl { RegionData_Impl* mpParent; @@ -140,8 +146,11 @@ public: } +} + using namespace ::DocTempl; +namespace { class RegionData_Impl { @@ -179,6 +188,7 @@ public: int Compare( RegionData_Impl const * pCompareWith ) const; }; +} class SfxDocTemplate_Impl : public SvRefBase { @@ -229,6 +239,7 @@ public: const uno::Reference< XDocumentTemplates >& getDocTemplates() const { return mxTemplates; } }; +namespace { class DocTemplLocker_Impl { @@ -246,6 +257,8 @@ public: } }; +} + static SfxDocTemplate_Impl *gpTemplateData = nullptr; diff --git a/sfx2/source/doc/docundomanager.cxx b/sfx2/source/doc/docundomanager.cxx index 68cefec38e1f..0d4caadb10c4 100644 --- a/sfx2/source/doc/docundomanager.cxx +++ b/sfx2/source/doc/docundomanager.cxx @@ -139,6 +139,8 @@ namespace sfx2 //= SolarMutexFacade + namespace { + /** a facade for the SolarMutex, implementing ::framework::IMutex */ class SolarMutexFacade : public ::framework::IMutex @@ -197,6 +199,7 @@ namespace sfx2 SolarMutexFacade m_solarMutexFacade; }; + } //= DocumentUndoManager diff --git a/sfx2/source/doc/objcont.cxx b/sfx2/source/doc/objcont.cxx index 8837e9fb82a7..9aa966384297 100644 --- a/sfx2/source/doc/objcont.cxx +++ b/sfx2/source/doc/objcont.cxx @@ -300,12 +300,16 @@ SfxStyleSheetBasePool* SfxObjectShell::GetStyleSheetPool() return nullptr; } +namespace { + struct Styles_Impl { SfxStyleSheetBase *pSource; SfxStyleSheetBase *pDest; }; +} + void SfxObjectShell::LoadStyles ( SfxObjectShell &rSource /* the document template from which diff --git a/sfx2/source/doc/objmisc.cxx b/sfx2/source/doc/objmisc.cxx index 5af5ddfdf2f0..64d9e1793a9d 100644 --- a/sfx2/source/doc/objmisc.cxx +++ b/sfx2/source/doc/objmisc.cxx @@ -130,6 +130,8 @@ using namespace ::com::sun::star::container; // class SfxHeaderAttributes_Impl ---------------------------------------- +namespace { + class SfxHeaderAttributes_Impl : public SvKeyValueIterator { private: @@ -152,6 +154,7 @@ public: void SetAttribute( const SvKeyValue& rKV ); }; +} sal_uInt16 const aTitleMap_Impl[3][2] = { diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index ff155a031383..21997d0c5c49 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -150,6 +150,8 @@ void SfxObjectShell::InitInterface_Impl() { } +namespace { + class SfxClosePreventer_Impl : public ::cppu::WeakImplHelper< css::util::XCloseListener > { bool m_bGotOwnership; @@ -170,6 +172,8 @@ public: } ; +} + SfxClosePreventer_Impl::SfxClosePreventer_Impl() : m_bGotOwnership( false ) , m_bPreventClose( true ) @@ -193,6 +197,7 @@ void SAL_CALL SfxClosePreventer_Impl::notifyClosing( const lang::EventObject& ) void SAL_CALL SfxClosePreventer_Impl::disposing( const lang::EventObject& ) {} +namespace { class SfxInstanceCloseGuard_Impl { @@ -207,6 +212,8 @@ public: bool Init_Impl( const uno::Reference< util::XCloseable >& xCloseable ); }; +} + bool SfxInstanceCloseGuard_Impl::Init_Impl( const uno::Reference< util::XCloseable >& xCloseable ) { bool bResult = false; diff --git a/sfx2/source/doc/objxtor.cxx b/sfx2/source/doc/objxtor.cxx index 1f1ead6642ed..d004c7a69e91 100644 --- a/sfx2/source/doc/objxtor.cxx +++ b/sfx2/source/doc/objxtor.cxx @@ -146,9 +146,6 @@ OUString lclGetVBAGlobalConstName( const Reference< XInterface >& rxComponent ) #endif -} // namespace - - class SfxModelListener_Impl : public ::cppu::WeakImplHelper< css::util::XCloseListener > { SfxObjectShell* mpDoc; @@ -160,6 +157,8 @@ public: }; +} // namespace + void SAL_CALL SfxModelListener_Impl::queryClosing( const css::lang::EventObject& , sal_Bool ) { } @@ -513,6 +512,7 @@ bool SfxObjectShell::IsInPrepareClose() const return pImpl->bInPrepareClose; } +namespace { struct BoolEnv_Impl { @@ -522,6 +522,7 @@ struct BoolEnv_Impl ~BoolEnv_Impl() { rImpl.bInPrepareClose = false; } }; +} bool SfxObjectShell::PrepareClose ( diff --git a/sfx2/source/doc/oleprops.cxx b/sfx2/source/doc/oleprops.cxx index b1299b57b832..6ff78214d802 100644 --- a/sfx2/source/doc/oleprops.cxx +++ b/sfx2/source/doc/oleprops.cxx @@ -42,6 +42,8 @@ using namespace ::com::sun::star; /// Invalid value for date to create invalid instance of TimeStamp. #define TIMESTAMP_INVALID_UTILDATE (util::Date(1, 1, 1601)) +namespace { + /** Property representing a signed 32-bit integer value. */ class SfxOleInt32Property : public SfxOlePropertyBase { @@ -221,6 +223,7 @@ private: uno::Sequence<sal_Int8> const mData; }; +} sal_uInt16 SfxOleTextEncoding::GetCodePage() const { diff --git a/sfx2/source/doc/printhelper.cxx b/sfx2/source/doc/printhelper.cxx index 661074a9a102..ce69c37b6471 100644 --- a/sfx2/source/doc/printhelper.cxx +++ b/sfx2/source/doc/printhelper.cxx @@ -96,6 +96,8 @@ static Size impl_Size_Struct2Object( const awt::Size& aSize ) return aReturnValue ; } +namespace { + class SfxPrintJob_Impl : public cppu::WeakImplHelper < css::view::XPrintJob @@ -111,6 +113,8 @@ public: virtual void SAL_CALL cancelJob() override; }; +} + SfxPrintJob_Impl::SfxPrintJob_Impl( IMPL_PrintListener_DataContainer* pData ) : m_pData( pData ) { @@ -457,6 +461,7 @@ void SAL_CALL SfxPrintHelper::setPrinter(const uno::Sequence< beans::PropertyVal // ImplPrintWatch thread for asynchronous printing with moving temp. file to ucb location +namespace { /* This implements a thread which will be started to wait for asynchronous print jobs to temp. locally files. If they finish we move the temp. files @@ -569,6 +574,7 @@ class ImplUCBPrintWatcher : public ::osl::Thread } }; +} // XPrintable diff --git a/sfx2/source/doc/sfxbasemodel.cxx b/sfx2/source/doc/sfxbasemodel.cxx index 74b1497829bc..c841644cc98c 100644 --- a/sfx2/source/doc/sfxbasemodel.cxx +++ b/sfx2/source/doc/sfxbasemodel.cxx @@ -155,6 +155,8 @@ using ::com::sun::star::document::XUndoManager; using ::com::sun::star::document::XUndoAction; using ::com::sun::star::frame::XModel; +namespace { + /** This Listener is used to get notified when the XDocumentProperties of the XModel change. */ @@ -173,6 +175,8 @@ public: virtual void SAL_CALL modified( const lang::EventObject& ) override; }; +} + void SAL_CALL SfxDocInfoListener_Impl::modified( const lang::EventObject& ) { SolarMutexGuard aSolarGuard; @@ -316,6 +320,7 @@ struct IMPL_SfxBaseModel_DataContainer : public ::sfx2::IModifiableDocument // static member initialization. sal_Int64 IMPL_SfxBaseModel_DataContainer::g_nInstanceCounter = 0; +namespace { // Listener that forwards notifications from the PrintHelper to the "real" listeners class SfxPrintHelperListener_Impl : public ::cppu::WeakImplHelper< view::XPrintJobListener > @@ -330,6 +335,8 @@ public: virtual void SAL_CALL printJobEvent( const view::PrintJobEvent& rEvent ) override; }; +} + void SAL_CALL SfxPrintHelperListener_Impl::disposing( const lang::EventObject& ) { m_pData->m_xPrintable = nullptr; @@ -346,6 +353,8 @@ void SAL_CALL SfxPrintHelperListener_Impl::printJobEvent( const view::PrintJobEv } } +namespace { + // SfxOwnFramesLocker ==================================================================================== // allows to lock all the frames related to the provided SfxObjectShell class SfxOwnFramesLocker @@ -358,6 +367,8 @@ public: ~SfxOwnFramesLocker(); }; +} + SfxOwnFramesLocker::SfxOwnFramesLocker( SfxObjectShell const * pObjectShell ) { if ( !pObjectShell ) @@ -440,6 +451,8 @@ vcl::Window* SfxOwnFramesLocker::GetVCLWindow( const Reference< frame::XFrame >& return pWindow; } +namespace { + // SfxSaveGuard ==================================================================================== class SfxSaveGuard { @@ -457,6 +470,8 @@ class SfxSaveGuard ~SfxSaveGuard(); }; +} + SfxSaveGuard::SfxSaveGuard(const Reference< frame::XModel >& xModel , IMPL_SfxBaseModel_DataContainer* pData) : m_xModel ( xModel ) diff --git a/sfx2/source/doc/sfxmodelfactory.cxx b/sfx2/source/doc/sfxmodelfactory.cxx index 9b2403d00e46..838e948eacda 100644 --- a/sfx2/source/doc/sfxmodelfactory.cxx +++ b/sfx2/source/doc/sfxmodelfactory.cxx @@ -57,6 +57,9 @@ namespace sfx2 typedef ::cppu::WeakImplHelper < XSingleServiceFactory , XServiceInfo > SfxModelFactory_Base; + + namespace { + /** implements a XSingleServiceFactory which can be used to created instances of classes derived from SfxBaseModel @@ -93,6 +96,7 @@ namespace sfx2 const SfxModelFactoryFunc m_pComponentFactoryFunc; }; + } //= SfxModelFactory - implementation diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 90c8c4dda017..0de62325ab66 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -89,6 +89,8 @@ static bool lcl_getServiceName (const OUString &rFileURL, OUString &rName ); static std::vector<OUString> lcl_getAllFactoryURLs (); +namespace { + class SearchView_Keyword { public: @@ -137,6 +139,8 @@ private: FILTER_APPLICATION const meApp; }; +} + /*** * * Order items in ascending order (useful for the selection sets and move/copy operations since the associated ids diff --git a/sfx2/source/explorer/nochaos.cxx b/sfx2/source/explorer/nochaos.cxx index f2432563533f..d12a09a35a78 100644 --- a/sfx2/source/explorer/nochaos.cxx +++ b/sfx2/source/explorer/nochaos.cxx @@ -32,6 +32,7 @@ // class CntStaticPoolDefaults_Impl +namespace { class CntItemPool; @@ -69,6 +70,7 @@ public: static sal_uInt16 Release(); }; +} // static SfxItemPool* NoChaos::GetItemPool() diff --git a/sfx2/source/notebookbar/NotebookbarTabControl.cxx b/sfx2/source/notebookbar/NotebookbarTabControl.cxx index de3eaf04ad6b..5aaacf1cb549 100644 --- a/sfx2/source/notebookbar/NotebookbarTabControl.cxx +++ b/sfx2/source/notebookbar/NotebookbarTabControl.cxx @@ -119,6 +119,8 @@ public: } }; +namespace { + class ShortcutsToolBox : public sfx2::sidebar::SidebarToolBox { public: @@ -144,6 +146,8 @@ public: } }; +} + NotebookbarTabControl::NotebookbarTabControl( Window* pParent ) : NotebookbarTabControlBase( pParent ) , m_bInitialized( false ) diff --git a/sfx2/source/notebookbar/PriorityMergedHBox.cxx b/sfx2/source/notebookbar/PriorityMergedHBox.cxx index 328241ae67d8..0ef63410f80c 100644 --- a/sfx2/source/notebookbar/PriorityMergedHBox.cxx +++ b/sfx2/source/notebookbar/PriorityMergedHBox.cxx @@ -30,6 +30,8 @@ * PriorityMergedHBox is a VclHBox which hides its own children if there is no sufficient space. */ +namespace +{ class PriorityMergedHBox : public PriorityHBox { private: @@ -69,6 +71,7 @@ public: PriorityHBox::dispose(); } }; +} IMPL_LINK(PriorityMergedHBox, PBClickHdl, Button*, /*pButton*/, void) { diff --git a/sfx2/source/sidebar/SidebarToolBox.cxx b/sfx2/source/sidebar/SidebarToolBox.cxx index 2aead2974987..32c3876da73c 100644 --- a/sfx2/source/sidebar/SidebarToolBox.cxx +++ b/sfx2/source/sidebar/SidebarToolBox.cxx @@ -316,6 +316,8 @@ void SidebarToolBox::InitToolBox(VclBuilder::stringmap& rMap) } } +namespace { + class NotebookbarToolBox : public SidebarToolBox { public: @@ -331,6 +333,8 @@ public: } }; +} + extern "C" SAL_DLLPUBLIC_EXPORT void makeSidebarToolBox(VclPtr<vcl::Window> & rRet, const VclPtr<vcl::Window> & pParent, VclBuilder::stringmap & rMap) { static_assert(std::is_same_v<std::remove_pointer_t<VclBuilder::customMakeWidget>, diff --git a/sfx2/source/view/classificationcontroller.cxx b/sfx2/source/view/classificationcontroller.cxx index d1737912b3ca..4a61909fc4f8 100644 --- a/sfx2/source/view/classificationcontroller.cxx +++ b/sfx2/source/view/classificationcontroller.cxx @@ -36,9 +36,16 @@ using namespace com::sun::star; namespace sfx2 { +namespace { + class ClassificationCategoriesController; + +} + using ClassificationPropertyListenerBase = comphelper::ConfigurationListenerProperty<OUString>; +namespace { + /// Listens to configuration changes, so no restart is needed after setting the classification path. class ClassificationPropertyListener : public ClassificationPropertyListenerBase { @@ -49,8 +56,12 @@ public: void setProperty(const uno::Any& rProperty) override; }; +} + using ClassificationCategoriesControllerBase = cppu::ImplInheritanceHelper<svt::ToolboxController, lang::XServiceInfo>; +namespace { + class ClassificationControl; /// Controller for .uno:ClassificationApply. @@ -104,9 +115,6 @@ public: void setCategoryStateFromPolicy(const SfxClassificationHelper & rHelper); }; -namespace -{ - OUString const & getCategoryType() { return SfxClassificationHelper::policyTypeToString(SfxClassificationHelper::getPolicyType()); diff --git a/sfx2/source/view/ipclient.cxx b/sfx2/source/view/ipclient.cxx index be9b43cd9035..998ae24c2e84 100644 --- a/sfx2/source/view/ipclient.cxx +++ b/sfx2/source/view/ipclient.cxx @@ -78,6 +78,7 @@ using namespace com::sun::star; +namespace { // SfxEmbedResizeGuard class SfxBooleanFlagGuard @@ -96,6 +97,7 @@ public: } }; +} // SfxInPlaceClient_Impl diff --git a/sfx2/source/view/sfxbasecontroller.cxx b/sfx2/source/view/sfxbasecontroller.cxx index 22ec268c9518..e2100e3f74a7 100644 --- a/sfx2/source/view/sfxbasecontroller.cxx +++ b/sfx2/source/view/sfxbasecontroller.cxx @@ -171,6 +171,8 @@ static void reschedule() } } +namespace { + class SfxStatusIndicator : public ::cppu::WeakImplHelper< task::XStatusIndicator, lang::XEventListener > { friend class SfxBaseController; @@ -201,6 +203,8 @@ public: virtual void SAL_CALL disposing( const lang::EventObject& Source ) override; }; +} + void SAL_CALL SfxStatusIndicator::start(const OUString& aText, sal_Int32 nRange) { SolarMutexGuard aGuard; @@ -289,6 +293,7 @@ void SAL_CALL SfxStatusIndicator::disposing( const lang::EventObject& /*Source*/ // declaration IMPL_SfxBaseController_ListenerHelper +namespace { class IMPL_SfxBaseController_ListenerHelper : public ::cppu::WeakImplHelper< frame::XFrameActionListener > { @@ -319,6 +324,8 @@ private: } ; // class IMPL_SfxBaseController_ListenerContainer +} + IMPL_SfxBaseController_CloseListenerHelper::IMPL_SfxBaseController_CloseListenerHelper( SfxBaseController* pController ) : m_pController ( pController ) { diff --git a/sfx2/source/view/viewprn.cxx b/sfx2/source/view/viewprn.cxx index 2347f69584c4..793ad0458e0b 100644 --- a/sfx2/source/view/viewprn.cxx +++ b/sfx2/source/view/viewprn.cxx @@ -411,6 +411,8 @@ void SfxPrinterController::jobFinished( css::view::PrintableState nState ) } } +namespace { + /** An instance of this class is created for the life span of the printer dialogue, to create in its click handler for the additions by the @@ -435,6 +437,8 @@ public: void DisableHelp() { _bHelpDisabled = true; } }; +} + SfxDialogExecutor_Impl::SfxDialogExecutor_Impl( SfxViewShell* pViewSh, PrinterSetupDialog& rParent ) : _pViewSh ( pViewSh ), diff --git a/slideshow/source/engine/animationnodes/animationaudionode.cxx b/slideshow/source/engine/animationnodes/animationaudionode.cxx index b5e6f53a6210..571af6c7b773 100644 --- a/slideshow/source/engine/animationnodes/animationaudionode.cxx +++ b/slideshow/source/engine/animationnodes/animationaudionode.cxx @@ -99,6 +99,8 @@ void AnimationAudioNode::activate_st() // TODO(F2): generate deactivation event, when sound // is over +namespace { + // libc++ and MSVC std::bind doesn't cut it here, and it's not possible to use // a lambda because the preprocessor thinks that comma in capture list // separates macro parameters @@ -116,6 +118,8 @@ struct NotifyAudioStopped } }; +} + void AnimationAudioNode::deactivate_st( NodeState /*eDestState*/ ) { AnimationEventHandlerSharedPtr aHandler( diff --git a/slideshow/source/engine/eventmultiplexer.cxx b/slideshow/source/engine/eventmultiplexer.cxx index b583bd42c151..7aa09adf1ac9 100644 --- a/slideshow/source/engine/eventmultiplexer.cxx +++ b/slideshow/source/engine/eventmultiplexer.cxx @@ -129,6 +129,8 @@ struct slideshow::internal::ListenerOperations<ViewEventHandlerWeakPtrWrapper> namespace slideshow { namespace internal { +namespace { + template <typename HandlerT> class PrioritizedHandlerEntry { @@ -161,11 +163,14 @@ public: } }; +} typedef cppu::WeakComponentImplHelper< awt::XMouseListener, awt::XMouseMotionListener > Listener_UnoBase; +namespace { + /** Listener class, to decouple UNO lifetime from EventMultiplexer This class gets registered as the XMouse(Motion)Listener on the @@ -208,6 +213,7 @@ private: EventMultiplexerImpl* mpEventMultiplexer; }; +} struct EventMultiplexerImpl { diff --git a/slideshow/source/engine/shapes/appletshape.cxx b/slideshow/source/engine/shapes/appletshape.cxx index 46f75e18f417..1fac5a42739d 100644 --- a/slideshow/source/engine/shapes/appletshape.cxx +++ b/slideshow/source/engine/shapes/appletshape.cxx @@ -36,6 +36,8 @@ namespace slideshow { namespace internal { + namespace { + /** Represents an applet shape. This implementation offers support for applet shapes (both @@ -105,6 +107,8 @@ namespace slideshow bool mbIsPlaying; }; + } + AppletShape::AppletShape( const uno::Reference< drawing::XShape >& xShape, double nPrio, const OUString& rServiceName, diff --git a/slideshow/source/engine/shapes/backgroundshape.cxx b/slideshow/source/engine/shapes/backgroundshape.cxx index 11c4ed1c1e0f..704e7cb9598e 100644 --- a/slideshow/source/engine/shapes/backgroundshape.cxx +++ b/slideshow/source/engine/shapes/backgroundshape.cxx @@ -48,6 +48,8 @@ namespace slideshow { namespace internal { + namespace { + /** Representation of a draw document's background shape. This class implements the Shape interface for the @@ -114,6 +116,7 @@ namespace slideshow ViewBackgroundShapeVector maViewShapes; }; + } BackgroundShape::BackgroundShape( const uno::Reference< drawing::XDrawPage >& xDrawPage, const uno::Reference< drawing::XDrawPage >& xMasterPage, diff --git a/slideshow/source/engine/shapes/intrinsicanimationactivity.cxx b/slideshow/source/engine/shapes/intrinsicanimationactivity.cxx index 5461299beb2e..cf3748f4a4d5 100644 --- a/slideshow/source/engine/shapes/intrinsicanimationactivity.cxx +++ b/slideshow/source/engine/shapes/intrinsicanimationactivity.cxx @@ -33,6 +33,8 @@ namespace slideshow { namespace internal { + namespace { + /** Activity for intrinsic shape animations This is an Activity interface implementation for intrinsic @@ -108,6 +110,7 @@ namespace slideshow IntrinsicAnimationActivity& mrActivity; }; + } IntrinsicAnimationActivity::IntrinsicAnimationActivity( const SlideShowContext& rContext, const DrawShapeSharedPtr& rDrawShape, diff --git a/slideshow/source/engine/shapes/mediashape.cxx b/slideshow/source/engine/shapes/mediashape.cxx index 5cabfe623bff..17a82c4392a1 100644 --- a/slideshow/source/engine/shapes/mediashape.cxx +++ b/slideshow/source/engine/shapes/mediashape.cxx @@ -39,6 +39,8 @@ namespace slideshow { namespace internal { + namespace { + /** Represents a media shape. This implementation offers support for media shapes. @@ -89,6 +91,7 @@ namespace slideshow bool mbIsPlaying; }; + } MediaShape::MediaShape( const uno::Reference< drawing::XShape >& xShape, double nPrio, diff --git a/slideshow/source/engine/usereventqueue.cxx b/slideshow/source/engine/usereventqueue.cxx index 935c0976db55..e0ff40f4f545 100644 --- a/slideshow/source/engine/usereventqueue.cxx +++ b/slideshow/source/engine/usereventqueue.cxx @@ -277,6 +277,8 @@ private: bool mbSkipTriggersNextEffect; }; +namespace { + /** Base class to share some common code between ShapeClickEventHandler and MouseMoveHandler @@ -373,6 +375,8 @@ private: ImpShapeEventMap maShapeEventMap; }; +} + class ShapeClickEventHandler : public MouseHandlerBase { public: diff --git a/slideshow/test/testshape.cxx b/slideshow/test/testshape.cxx index e9926218d283..f00ae08cbb59 100644 --- a/slideshow/test/testshape.cxx +++ b/slideshow/test/testshape.cxx @@ -37,6 +37,9 @@ using namespace ::com::sun::star; // our test shape subject typedef ::cppu::WeakComponentImplHelper< drawing::XShape > ShapeBase; + +namespace { + class ImplTestShape : public TestShape, private cppu::BaseMutex, public ShapeBase @@ -193,6 +196,7 @@ private: } }; +} TestShapeSharedPtr createTestShape(const basegfx::B2DRange& rRect, double nPrio) diff --git a/slideshow/test/testview.cxx b/slideshow/test/testview.cxx index f391059722e2..99a385681e17 100644 --- a/slideshow/test/testview.cxx +++ b/slideshow/test/testview.cxx @@ -46,6 +46,9 @@ using namespace ::com::sun::star; // our test view subject typedef ::cppu::WeakComponentImplHelper< presentation::XSlideShowView > ViewBase; + +namespace { + class ImplTestView : public TestView, private cppu::BaseMutex, public ViewBase @@ -270,6 +273,7 @@ public: } }; +} TestViewSharedPtr createTestView() { diff --git a/sot/source/base/exchange.cxx b/sot/source/base/exchange.cxx index da90eef263d7..4888a366ec71 100644 --- a/sot/source/base/exchange.cxx +++ b/sot/source/base/exchange.cxx @@ -34,6 +34,8 @@ using namespace::com::sun::star::uno; using namespace::com::sun::star::datatransfer; +namespace { + /* * These tables contain all MimeTypes, format identifiers, and types used in * the Office. The table is sorted by the format string ID, and each ID is @@ -47,8 +49,6 @@ struct DataFlavorRepresentation const css::uno::Type* pType; }; -namespace -{ struct ImplFormatArray_Impl { const DataFlavorRepresentation* operator()() diff --git a/sot/source/base/formats.cxx b/sot/source/base/formats.cxx index 51c6b157496f..f911b0b89c0c 100644 --- a/sot/source/base/formats.cxx +++ b/sot/source/base/formats.cxx @@ -49,6 +49,8 @@ using namespace ::com::sun::star::datatransfer; * it appears in the list. */ +namespace { + struct SotDestinationEntry_Impl { SotExchangeDest const nDestination; @@ -58,8 +60,6 @@ struct SotDestinationEntry_Impl const SotAction_Impl* aLinkActions; }; -namespace -{ /* * Via this table, the destination, existing data formats and the desired action * are assigned to an action and the data format to be used in it. The table is diff --git a/sot/source/sdstor/stgio.cxx b/sot/source/sdstor/stgio.cxx index 026881b9a7d7..08f023c5f52a 100644 --- a/sot/source/sdstor/stgio.cxx +++ b/sot/source/sdstor/stgio.cxx @@ -154,6 +154,7 @@ bool StgIo::CommitAll() return false; } +namespace { class EasyFat { @@ -171,6 +172,8 @@ public: bool HasUnrefChains() const; }; +} + EasyFat::EasyFat( StgIo& rIo, StgStrm* pFatStream, sal_Int32 nPSize ) { nPages = pFatStream->GetSize() >> 2; @@ -236,6 +239,8 @@ FatError EasyFat::Mark( sal_Int32 nPage, sal_Int32 nCount, sal_Int32 nExpect ) return FatError::Ok; } +namespace { + class Validator { FatError nError; @@ -255,6 +260,8 @@ public: bool IsError() const { return nError != FatError::Ok; } }; +} + Validator::Validator( StgIo &rIoP ) : aSmallFat( rIoP, rIoP.m_pDataFAT, 1 << rIoP.m_aHdr.GetDataPageSize() ), aFat( rIoP, rIoP.m_pFAT, 1 << rIoP.m_aHdr.GetPageSize() ), diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx index 22ef098bbbf4..9edd26aae4eb 100644 --- a/sot/source/sdstor/ucbstorage.cxx +++ b/sot/source/sdstor/ucbstorage.cxx @@ -79,6 +79,9 @@ static int nOpenStreams=0; #endif typedef ::cppu::WeakImplHelper < XInputStream, XSeekable > FileInputStreamWrapper_Base; + +namespace { + class FileStreamWrapper_Impl : public FileInputStreamWrapper_Base { protected: @@ -104,6 +107,7 @@ protected: void checkError(); }; +} FileStreamWrapper_Impl::FileStreamWrapper_Impl( const OUString& rName ) : m_aURL( rName ) diff --git a/starmath/source/dialog.cxx b/starmath/source/dialog.cxx index 1c2d5f3405fc..de1fd7eb4bc8 100644 --- a/starmath/source/dialog.cxx +++ b/starmath/source/dialog.cxx @@ -67,8 +67,6 @@ void lclGetSettingColors(Color& rBackgroundColor, Color& rTextColor) } } -} // end anonymous namespace - // Since it's better to set/query the FontStyle via its attributes rather // than via the StyleName we create a way to translate // Attribute <-> StyleName @@ -88,6 +86,8 @@ public: const OUString& GetStyleName(sal_uInt16 nIdx) const; }; +} // end anonymous namespace + SmFontStyles::SmFontStyles() : aNormal(SmResId(RID_FONTREGULAR)) , aBold(SmResId(RID_FONTBOLD)) @@ -340,6 +340,8 @@ SmFontDialog::~SmFontDialog() { } +namespace { + class SaveDefaultsQuery : public weld::MessageDialogController { public: @@ -350,6 +352,8 @@ public: } }; +} + IMPL_LINK_NOARG( SmFontSizeDialog, DefaultButtonClickHdl, weld::Button&, void ) { SaveDefaultsQuery aQuery(m_xDialog.get()); @@ -530,11 +534,15 @@ void SmFontTypeDialog::WriteTo(SmFormat &rFormat) const /**************************************************************************/ +namespace { + struct FieldMinMax { sal_uInt16 nMin, nMax; }; +} + // Data for min and max values of the 4 metric fields // for each of the 10 categories static const FieldMinMax pMinMaxData[10][4] = diff --git a/starmath/source/mathmlimport.cxx b/starmath/source/mathmlimport.cxx index 808a235b96b8..18cf0e3b7ca6 100644 --- a/starmath/source/mathmlimport.cxx +++ b/starmath/source/mathmlimport.cxx @@ -502,6 +502,7 @@ void SmXMLImport::endDocument() SvXMLImport::endDocument(); } +namespace { class SmXMLImportContext: public SvXMLImportContext { @@ -534,6 +535,8 @@ public: } }; +} + void SmXMLImportContext::TCharacters(const OUString & /*rChars*/) { } @@ -559,6 +562,7 @@ SvXMLImportContextRef SmXMLImportContext::CreateChildContext(sal_uInt16 /*nPrefi return nullptr; } +namespace { struct SmXMLContext_Helper { @@ -582,6 +586,8 @@ struct SmXMLContext_Helper void ApplyAttrs(); }; +} + bool SmXMLContext_Helper::IsFontNodeNeeded() const { return nIsBold != -1 || @@ -742,6 +748,7 @@ void SmXMLContext_Helper::ApplyAttrs() } } +namespace { class SmXMLTokenAttrHelper { @@ -760,6 +767,8 @@ public: void ApplyAttrs(MathMLMathvariantValue eDefaultMv); }; +} + void SmXMLTokenAttrHelper::RetrieveAttrs(const uno::Reference<xml::sax::XAttributeList>& xAttrList) { if (!xAttrList.is()) @@ -867,6 +876,7 @@ void SmXMLTokenAttrHelper::ApplyAttrs(MathMLMathvariantValue eDefaultMv) } } +namespace { class SmXMLDocContext_Impl : public SmXMLImportContext { @@ -915,6 +925,8 @@ public: void EndElement() override; }; +} + void SmXMLEncloseContext_Impl::EndElement() { /* @@ -926,6 +938,7 @@ void SmXMLEncloseContext_Impl::EndElement() SmXMLRowContext_Impl::EndElement(); } +namespace { class SmXMLFracContext_Impl : public SmXMLRowContext_Impl { @@ -976,6 +989,8 @@ public: void StartElement(const uno::Reference< xml::sax::XAttributeList > &xAttrList ) override; }; +} + void SmXMLStyleContext_Impl::StartElement(const uno::Reference< xml::sax::XAttributeList > & xAttrList ) { @@ -996,6 +1011,7 @@ void SmXMLStyleContext_Impl::EndElement() aStyleHelper.ApplyAttrs(); } +namespace { class SmXMLPaddedContext_Impl : public SmXMLRowContext_Impl { @@ -1008,6 +1024,8 @@ public: void EndElement() override; }; +} + void SmXMLPaddedContext_Impl::EndElement() { /* @@ -1019,6 +1037,7 @@ void SmXMLPaddedContext_Impl::EndElement() SmXMLRowContext_Impl::EndElement(); } +namespace { class SmXMLPhantomContext_Impl : public SmXMLRowContext_Impl { @@ -1031,6 +1050,8 @@ public: void EndElement() override; }; +} + void SmXMLPhantomContext_Impl::EndElement() { /* @@ -1052,6 +1073,7 @@ void SmXMLPhantomContext_Impl::EndElement() rNodeStack.push_front(std::move(pPhantom)); } +namespace { class SmXMLFencedContext_Impl : public SmXMLRowContext_Impl { @@ -1069,6 +1091,7 @@ public: void EndElement() override; }; +} void SmXMLFencedContext_Impl::StartElement(const uno::Reference< xml::sax::XAttributeList > & xAttrList ) @@ -1145,6 +1168,7 @@ void SmXMLFencedContext_Impl::EndElement() GetSmImport().GetNodeStack().push_front(std::move(pSNode)); } +namespace { class SmXMLErrorContext_Impl : public SmXMLRowContext_Impl { @@ -1156,6 +1180,8 @@ public: void EndElement() override; }; +} + void SmXMLErrorContext_Impl::EndElement() { /*Right now the error tag is completely ignored, what @@ -1172,6 +1198,7 @@ void SmXMLErrorContext_Impl::EndElement() } } +namespace { class SmXMLNumberContext_Impl : public SmXMLImportContext { @@ -1193,6 +1220,8 @@ public: void EndElement() override; }; +} + void SmXMLNumberContext_Impl::TCharacters(const OUString &rChars) { aToken.aText = rChars; @@ -1203,6 +1232,7 @@ void SmXMLNumberContext_Impl::EndElement() GetSmImport().GetNodeStack().push_front(std::make_unique<SmTextNode>(aToken,FNT_NUMBER)); } +namespace { class SmXMLAnnotationContext_Impl : public SmXMLImportContext { @@ -1218,6 +1248,8 @@ public: void StartElement(const uno::Reference<xml::sax::XAttributeList > & xAttrList ) override; }; +} + void SmXMLAnnotationContext_Impl::StartElement(const uno::Reference< xml::sax::XAttributeList > & xAttrList ) { @@ -1249,6 +1281,7 @@ void SmXMLAnnotationContext_Impl::Characters(const OUString &rChars) GetSmImport().SetText( GetSmImport().GetText() + rChars ); } +namespace { class SmXMLTextContext_Impl : public SmXMLImportContext { @@ -1270,6 +1303,8 @@ public: void EndElement() override; }; +} + void SmXMLTextContext_Impl::TCharacters(const OUString &rChars) { aToken.aText = rChars; @@ -1280,6 +1315,7 @@ void SmXMLTextContext_Impl::EndElement() GetSmImport().GetNodeStack().push_front(std::make_unique<SmTextNode>(aToken,FNT_TEXT)); } +namespace { class SmXMLStringContext_Impl : public SmXMLImportContext { @@ -1301,6 +1337,8 @@ public: void EndElement() override; }; +} + void SmXMLStringContext_Impl::TCharacters(const OUString &rChars) { /* @@ -1321,6 +1359,7 @@ void SmXMLStringContext_Impl::EndElement() GetSmImport().GetNodeStack().push_front(std::make_unique<SmTextNode>(aToken,FNT_FIXED)); } +namespace { class SmXMLIdentifierContext_Impl : public SmXMLImportContext { @@ -1349,6 +1388,8 @@ public: void EndElement() override; }; +} + void SmXMLIdentifierContext_Impl::EndElement() { std::unique_ptr<SmTextNode> pNode; @@ -1384,6 +1425,7 @@ void SmXMLIdentifierContext_Impl::TCharacters(const OUString &rChars) aToken.aText = rChars; } +namespace { class SmXMLOperatorContext_Impl : public SmXMLImportContext { @@ -1407,6 +1449,8 @@ public: void EndElement() override; }; +} + void SmXMLOperatorContext_Impl::TCharacters(const OUString &rChars) { aToken.cMathChar = rChars[0]; @@ -1455,6 +1499,7 @@ void SmXMLOperatorContext_Impl::StartElement(const uno::Reference< } } +namespace { class SmXMLSpaceContext_Impl : public SmXMLImportContext { @@ -1466,8 +1511,6 @@ public: void StartElement(const uno::Reference< xml::sax::XAttributeList >& xAttrList ) override; }; -namespace { - bool lcl_CountBlanks(const MathMLAttributeLengthValue &rLV, sal_Int32 *pWide, sal_Int32 *pNarrow) { @@ -1542,6 +1585,7 @@ void SmXMLSpaceContext_Impl::StartElement( GetSmImport().GetNodeStack().push_front(std::move(pBlank)); } +namespace { class SmXMLSubContext_Impl : public SmXMLRowContext_Impl { @@ -1559,6 +1603,7 @@ public: } }; +} void SmXMLSubContext_Impl::GenericEndElement(SmTokenType eType, SmSubSup eSubSup) { @@ -1586,6 +1631,7 @@ void SmXMLSubContext_Impl::GenericEndElement(SmTokenType eType, SmSubSup eSubSup rNodeStack.push_front(std::move(pNode)); } +namespace { class SmXMLSupContext_Impl : public SmXMLSubContext_Impl { @@ -1617,6 +1663,8 @@ public: } }; +} + void SmXMLSubSupContext_Impl::GenericEndElement(SmTokenType eType, SmSubSup aSub,SmSubSup aSup) { @@ -1645,6 +1693,7 @@ void SmXMLSubSupContext_Impl::GenericEndElement(SmTokenType eType, rNodeStack.push_front(std::move(pNode)); } +namespace { class SmXMLUnderContext_Impl : public SmXMLSubContext_Impl { @@ -1663,6 +1712,8 @@ public: void HandleAccent(); }; +} + void SmXMLUnderContext_Impl::StartElement(const uno::Reference< xml::sax::XAttributeList > & xAttrList ) { @@ -1707,6 +1758,7 @@ void SmXMLUnderContext_Impl::EndElement() HandleAccent(); } +namespace { class SmXMLOverContext_Impl : public SmXMLSubContext_Impl { @@ -1723,6 +1775,7 @@ public: void HandleAccent(); }; +} void SmXMLOverContext_Impl::StartElement(const uno::Reference< xml::sax::XAttributeList > & xAttrList ) @@ -1762,6 +1815,7 @@ void SmXMLOverContext_Impl::HandleAccent() } +namespace { class SmXMLUnderOverContext_Impl : public SmXMLSubSupContext_Impl { @@ -1806,6 +1860,7 @@ public: void EndElement() override; }; +} void SmXMLNoneContext_Impl::EndElement() { @@ -1818,6 +1873,7 @@ void SmXMLNoneContext_Impl::EndElement() std::make_unique<SmTextNode>(aToken,FNT_VARIABLE)); } +namespace { class SmXMLPrescriptsContext_Impl : public SmXMLImportContext { @@ -1919,6 +1975,8 @@ public: sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; }; +} + SvXMLImportContextRef SmXMLOfficeContext_Impl::CreateChildContext(sal_uInt16 nPrefix, const OUString& rLocalName, const uno::Reference< xml::sax::XAttributeList > &xAttrList) @@ -1948,6 +2006,7 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL SmXMLOfficeContext_Impl return new SvXMLImportContext( GetImport() ); } +namespace { // context for flat file xml format class SmXMLFlatDocContext_Impl @@ -1968,6 +2027,8 @@ public: sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; }; +} + SmXMLFlatDocContext_Impl::SmXMLFlatDocContext_Impl( SmXMLImport& i_rImport, const uno::Reference<document::XDocumentProperties>& i_xDocProps) : SvXMLImportContext(i_rImport), diff --git a/starmath/source/unofilter.cxx b/starmath/source/unofilter.cxx index 7add12f9e3fb..5886e9e6e0b9 100644 --- a/starmath/source/unofilter.cxx +++ b/starmath/source/unofilter.cxx @@ -21,6 +21,8 @@ using namespace ::com::sun::star; +namespace { + /// Invokes the MathType importer via UNO. class MathTypeFilter : public cppu::WeakImplHelper < @@ -47,6 +49,8 @@ public: uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; }; +} + MathTypeFilter::MathTypeFilter() = default; sal_Bool MathTypeFilter::filter(const uno::Sequence<beans::PropertyValue>& rDescriptor) diff --git a/stoc/source/corereflection/crcomp.cxx b/stoc/source/corereflection/crcomp.cxx index 0e05a88192fb..a42ee6742f92 100644 --- a/stoc/source/corereflection/crcomp.cxx +++ b/stoc/source/corereflection/crcomp.cxx @@ -33,6 +33,7 @@ using namespace css::uno; namespace stoc_corefl { +namespace { class IdlCompFieldImpl : public IdlMemberImpl @@ -70,6 +71,8 @@ public: virtual void SAL_CALL set( Any & rObj, const Any & rValue ) override; }; +} + // XInterface Any IdlCompFieldImpl::queryInterface( const Type & rType ) diff --git a/stoc/source/corereflection/crenum.cxx b/stoc/source/corereflection/crenum.cxx index bbe3fa3e800e..a225a2b63f25 100644 --- a/stoc/source/corereflection/crenum.cxx +++ b/stoc/source/corereflection/crenum.cxx @@ -31,6 +31,7 @@ using namespace css::uno; namespace stoc_corefl { +namespace { class IdlEnumFieldImpl : public IdlMemberImpl @@ -67,6 +68,8 @@ public: virtual void SAL_CALL set( Any & rObj, const Any & rValue ) override; }; +} + // XInterface Any IdlEnumFieldImpl::queryInterface( const Type & rType ) diff --git a/stoc/source/corereflection/criface.cxx b/stoc/source/corereflection/criface.cxx index 8dd7d55e7fd7..f958994d7b1d 100644 --- a/stoc/source/corereflection/criface.cxx +++ b/stoc/source/corereflection/criface.cxx @@ -55,6 +55,7 @@ std::size_t multipleOf16(std::size_t n) { namespace stoc_corefl { +namespace { class IdlAttributeFieldImpl : public IdlMemberImpl @@ -95,6 +96,8 @@ private: uno_Any * exception, Reference< XInterface > const & context) const; }; +} + // XInterface Any IdlAttributeFieldImpl::queryInterface( const Type & rType ) @@ -313,6 +316,7 @@ void IdlAttributeFieldImpl::checkException( cppu::throwException(e); } +namespace { class IdlInterfaceMethodImpl : public IdlMemberImpl @@ -352,6 +356,8 @@ public: virtual Any SAL_CALL invoke( const Any & rObj, Sequence< Any > & rArgs ) override; }; +} + // XInterface Any IdlInterfaceMethodImpl::queryInterface( const Type & rType ) diff --git a/stoc/source/implementationregistration/mergekeys.cxx b/stoc/source/implementationregistration/mergekeys.cxx index 0fddd887d732..1a8f8fcce8c4 100644 --- a/stoc/source/implementationregistration/mergekeys.cxx +++ b/stoc/source/implementationregistration/mergekeys.cxx @@ -33,6 +33,8 @@ using namespace ::com::sun::star; namespace stoc_impreg { +namespace { + struct Link { OUString const m_name; @@ -43,6 +45,9 @@ struct Link , m_target( target ) {} }; + +} + typedef ::std::vector< Link > t_links; diff --git a/stoc/source/invocation/invocation.cxx b/stoc/source/invocation/invocation.cxx index 0969578620db..d70ed15cc2b8 100644 --- a/stoc/source/invocation/invocation.cxx +++ b/stoc/source/invocation/invocation.cxx @@ -81,6 +81,7 @@ static Reference<XIdlClass> TypeToIdlClass( const Type& rType, const Reference< return xRefl->forName( rType.getTypeName() ); } +namespace { class Invocation_Impl : public OWeakObject @@ -214,6 +215,7 @@ private: bool const mbFromOLE; }; +} Invocation_Impl::Invocation_Impl ( @@ -694,6 +696,7 @@ Any Invocation_Impl::invoke( const OUString& FunctionName, const Sequence<Any>& throw aExc; } +namespace { // Struct to optimize sorting struct MemberItem @@ -708,6 +711,8 @@ struct MemberItem sal_Int32 nIndex; }; +} + // Implementation of getting name or info // String sequence will be filled when pStringSeq != NULL // Info sequence will be filled when pInfoSeq != NULL @@ -1004,6 +1009,7 @@ Sequence< sal_Int8 > SAL_CALL Invocation_Impl::getImplementationId( ) return css::uno::Sequence<sal_Int8>(); } +namespace { class InvocationService : public WeakImplHelper< XSingleServiceFactory, XServiceInfo > @@ -1028,6 +1034,8 @@ private: Reference<XIdlReflection> xCoreReflection; }; +} + InvocationService::InvocationService( const Reference<XComponentContext> & xCtx ) : mxCtx( xCtx ) , mxSMgr( xCtx->getServiceManager() ) diff --git a/stoc/source/invocation_adapterfactory/iafactory.cxx b/stoc/source/invocation_adapterfactory/iafactory.cxx index 4a8c716dbeb4..4aecc1899c69 100644 --- a/stoc/source/invocation_adapterfactory/iafactory.cxx +++ b/stoc/source/invocation_adapterfactory/iafactory.cxx @@ -68,14 +68,20 @@ static OUString invadp_getImplementationName() return IMPLNAME; } +namespace { + struct hash_ptr { size_t operator() ( void * p ) const { return reinterpret_cast<size_t>(p); } }; + +} + typedef std::unordered_set< void *, hash_ptr > t_ptr_set; typedef std::unordered_map< void *, t_ptr_set, hash_ptr > t_ptr_map; +namespace { class FactoryImpl : public ::cppu::WeakImplHelper< lang::XServiceInfo, @@ -161,6 +167,8 @@ struct AdapterImpl AdapterImpl & operator= (const AdapterImpl &) = delete; }; +} + inline AdapterImpl::~AdapterImpl() { for ( size_t nPos = m_vInterfaces.size(); nPos--; ) diff --git a/stoc/source/javaloader/javaloader.cxx b/stoc/source/javaloader/javaloader.cxx index 4af288f737b8..274de5c79990 100644 --- a/stoc/source/javaloader/javaloader.cxx +++ b/stoc/source/javaloader/javaloader.cxx @@ -76,6 +76,8 @@ static OUString loader_getImplementationName() return "com.sun.star.comp.stoc.JavaComponentLoader"; } +namespace { + class JavaComponentLoader : public WeakImplHelper<XImplementationLoader, XServiceInfo> { css::uno::Reference<XComponentContext> m_xComponentContext; @@ -111,6 +113,8 @@ public: const OUString& implementationLoaderUrl, const OUString& locationUrl) override; }; +} + const css::uno::Reference<XImplementationLoader> & JavaComponentLoader::getJavaLoader() { MutexGuard aGuard(getInitMutex()); diff --git a/stoc/source/namingservice/namingservice.cxx b/stoc/source/namingservice/namingservice.cxx index 8b35ec58b3c5..6e613f11fd7d 100644 --- a/stoc/source/namingservice/namingservice.cxx +++ b/stoc/source/namingservice/namingservice.cxx @@ -57,6 +57,7 @@ static OUString ns_getImplementationName() typedef std::unordered_map< OUString, Reference<XInterface > > HashMap_OWString_Interface; +namespace { class NamingService_Impl : public WeakImplHelper < XServiceInfo, XNamingService > @@ -76,6 +77,7 @@ public: virtual void SAL_CALL revokeObject( const OUString& Name ) override; }; +} static Reference<XInterface> NamingService_Impl_create( SAL_UNUSED_PARAMETER const Reference<XComponentContext> & ) diff --git a/stoc/source/security/permissions.cxx b/stoc/source/security/permissions.cxx index 9568602c1fb4..ed05614bb2a0 100644 --- a/stoc/source/security/permissions.cxx +++ b/stoc/source/security/permissions.cxx @@ -96,6 +96,7 @@ static OUString makeStrings( return buf.makeStringAndClear(); } +namespace { class SocketPermission : public Permission { @@ -120,6 +121,8 @@ public: virtual OUString toString() const override; }; +} + char const * SocketPermission::s_actions [] = { "accept", "connect", "listen", "resolve", nullptr }; SocketPermission::SocketPermission( @@ -263,6 +266,7 @@ OUString SocketPermission::toString() const return buf.makeStringAndClear(); } +namespace { class FilePermission : public Permission { @@ -280,6 +284,8 @@ public: virtual OUString toString() const override; }; +} + char const * FilePermission::s_actions [] = { "read", "write", "execute", "delete", nullptr }; static OUString const & getWorkingDir() @@ -406,6 +412,7 @@ OUString FilePermission::toString() const return buf.makeStringAndClear(); } +namespace { class RuntimePermission : public Permission { @@ -422,6 +429,8 @@ public: virtual OUString toString() const override; }; +} + bool RuntimePermission::implies( Permission const & perm ) const { // check type diff --git a/stoc/source/typeconv/convert.cxx b/stoc/source/typeconv/convert.cxx index b74a3d1a5714..37d6c63e3d4b 100644 --- a/stoc/source/typeconv/convert.cxx +++ b/stoc/source/typeconv/convert.cxx @@ -208,6 +208,7 @@ static bool getHyperValue( sal_Int64 & rnVal, const OUString & rStr ) return false; } +namespace { class TypeConverter_Impl : public WeakImplHelper< XTypeConverter, XServiceInfo > { @@ -231,6 +232,8 @@ public: virtual Any SAL_CALL convertToSimpleType( const Any& aFrom, TypeClass aDestinationType ) override; }; +} + TypeConverter_Impl::TypeConverter_Impl() {} // XServiceInfo diff --git a/store/source/lockbyte.cxx b/store/source/lockbyte.cxx index dfc7ad920a99..139857440dfb 100644 --- a/store/source/lockbyte.cxx +++ b/store/source/lockbyte.cxx @@ -143,6 +143,8 @@ storeError ILockBytes::flush() namespace store { +namespace { + struct FileHandle { oslFileHandle m_handle; @@ -315,6 +317,8 @@ protected: virtual ~FileLockBytes() override; }; +} + } // namespace store FileLockBytes::FileLockBytes (FileHandle const & rFile) @@ -442,6 +446,8 @@ storeError FileLockBytes::flush_Impl() namespace store { +namespace { + struct FileMapping { sal_uInt8 * m_pAddr; @@ -543,6 +549,8 @@ protected: virtual ~MappedLockBytes() override; }; +} + } // namespace store MappedLockBytes::MappedLockBytes (FileMapping const & rMapping) @@ -641,6 +649,8 @@ storeError MappedLockBytes::flush_Impl() namespace store { +namespace { + class MemoryLockBytes : public store::OStoreObject, public store::ILockBytes @@ -680,6 +690,8 @@ protected: virtual ~MemoryLockBytes() override; }; +} + } // namespace store MemoryLockBytes::MemoryLockBytes() @@ -804,6 +816,8 @@ storeError MemoryLockBytes::flush_Impl() namespace store { +namespace { + template< class T > struct ResourceHolder { typedef typename T::destructor_type destructor_type; @@ -838,6 +852,8 @@ template< class T > struct ResourceHolder } }; +} + storeError FileLockBytes_createInstance ( rtl::Reference< ILockBytes > & rxLockBytes, diff --git a/store/source/storbios.cxx b/store/source/storbios.cxx index 93e47d700841..a98f4e9a35a3 100644 --- a/store/source/storbios.cxx +++ b/store/source/storbios.cxx @@ -43,6 +43,8 @@ using namespace store; *======================================================================*/ #define STORE_MAGIC_SUPERBLOCK sal_uInt32(0x484D5343) +namespace { + struct OStoreSuperBlock { typedef OStorePageGuard G; @@ -139,6 +141,8 @@ struct OStoreSuperBlock } }; +} + /*======================================================================== * * SuperBlockPage interface. diff --git a/store/source/store.cxx b/store/source/store.cxx index 2f2b4bed4763..dfd41571e2dd 100644 --- a/store/source/store.cxx +++ b/store/source/store.cxx @@ -35,6 +35,9 @@ using rtl::Reference; namespace store { + +namespace { + /** Template helper class as type safe Reference to store_handle_type. */ template<class store_handle_type> @@ -52,6 +55,9 @@ public: static_cast<store_handle_type*>(0)); } }; + +} + } using namespace store; diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx index edd77e2921eb..2e88862cb2fb 100644 --- a/svgio/source/svgreader/svgcharacternode.cxx +++ b/svgio/source/svgreader/svgcharacternode.cxx @@ -154,6 +154,8 @@ namespace svgio { namespace svgreader { + namespace { + class localTextBreakupHelper : public drawinglayer::primitive2d::TextBreakupHelper { private: @@ -174,6 +176,8 @@ namespace svgio } }; + } + bool localTextBreakupHelper::allowChange(sal_uInt32 /*nCount*/, basegfx::B2DHomMatrix& rNewTransform, sal_uInt32 /*nIndex*/, sal_uInt32 /*nLength*/) { const double fRotation(mrSvgTextPosition.consumeRotation()); diff --git a/svgio/source/svgreader/svgtextpathnode.cxx b/svgio/source/svgreader/svgtextpathnode.cxx index 1ff4741fa2b2..04c7cbbc9e9f 100644 --- a/svgio/source/svgreader/svgtextpathnode.cxx +++ b/svgio/source/svgreader/svgtextpathnode.cxx @@ -34,6 +34,8 @@ namespace svgio { namespace svgreader { + namespace { + class pathTextBreakupHelper : public drawinglayer::primitive2d::TextBreakupHelper { private: @@ -71,6 +73,8 @@ namespace svgio double getPosition() const { return mfPosition; } }; + } + void pathTextBreakupHelper::freeB2DCubicBezierHelper() { mpB2DCubicBezierHelper.reset(); diff --git a/svgio/source/svguno/xsvgparser.cxx b/svgio/source/svguno/xsvgparser.cxx index f7fbcc59cf0b..710ef636c89d 100644 --- a/svgio/source/svguno/xsvgparser.cxx +++ b/svgio/source/svguno/xsvgparser.cxx @@ -43,6 +43,8 @@ namespace svgio { namespace svgreader { + namespace { + class XSvgParser : public ::cppu::WeakAggImplHelper2< graphic::XSvgParser, lang::XServiceInfo > { private: @@ -71,6 +73,8 @@ namespace svgio virtual sal_Bool SAL_CALL supportsService(const OUString&) override; virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames() override; }; + + } } // end of namespace svgreader } // end of namespace svgio diff --git a/svl/qa/unit/items/test_IndexedStyleSheets.cxx b/svl/qa/unit/items/test_IndexedStyleSheets.cxx index 5326b5b5cabc..88af521d3aef 100644 --- a/svl/qa/unit/items/test_IndexedStyleSheets.cxx +++ b/svl/qa/unit/items/test_IndexedStyleSheets.cxx @@ -20,6 +20,8 @@ using namespace svl; +namespace { + class MockedStyleSheet : public SfxStyleSheetBase { public: @@ -35,6 +37,8 @@ struct DummyPredicate : public StyleSheetPredicate { } }; +} + class IndexedStyleSheetsTest : public CppUnit::TestFixture { void InstantiationWorks(); diff --git a/svl/qa/unit/notify/test_SfxBroadcaster.cxx b/svl/qa/unit/notify/test_SfxBroadcaster.cxx index f0bd409cd969..79b6543ad681 100644 --- a/svl/qa/unit/notify/test_SfxBroadcaster.cxx +++ b/svl/qa/unit/notify/test_SfxBroadcaster.cxx @@ -36,6 +36,8 @@ class SfxBroadcasterTest : public CppUnit::TestFixture CPPUNIT_TEST_SUITE_END(); }; +namespace { + class MockedSfxListener : public SfxListener { public: @@ -54,6 +56,8 @@ private: bool mNotifyWasCalled; }; +} + void SfxBroadcasterTest::AddingListenersIncreasesCount() { diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx index 950201bef962..f1463d501c3e 100644 --- a/svl/source/items/style.cxx +++ b/svl/source/items/style.cxx @@ -38,6 +38,8 @@ #include <string.h> #ifdef DBG_UTIL +namespace { + class DbgStyleSheetReferences { public: @@ -54,6 +56,8 @@ public: sal_uInt32 mnPools; }; +} + static DbgStyleSheetReferences aDbgStyleSheetReferences; #endif diff --git a/svl/source/misc/gridprinter.cxx b/svl/source/misc/gridprinter.cxx index 4f013d4b6b8c..b40dd049c8ef 100644 --- a/svl/source/misc/gridprinter.cxx +++ b/svl/source/misc/gridprinter.cxx @@ -26,6 +26,8 @@ const mdds::mtv::element_t element_type_string = mdds::mtv::element_type_user_st // String block typedef mdds::mtv::default_element_block<element_type_string, OUString> string_block; +namespace { + struct matrix_trait { typedef string_block string_element_block; @@ -36,6 +38,8 @@ struct matrix_trait } +} + namespace rtl { // Callbacks for the string block. This needs to be in the same namespace as diff --git a/svl/source/undo/undo.cxx b/svl/source/undo/undo.cxx index 5d84ae1e0378..98b15675c00e 100644 --- a/svl/source/undo/undo.cxx +++ b/svl/source/undo/undo.cxx @@ -212,6 +212,8 @@ namespace svl { namespace undo { namespace impl typedef void ( SfxUndoListener::*UndoListenerVoidMethod )(); typedef void ( SfxUndoListener::*UndoListenerStringMethod )( const OUString& ); + namespace { + struct NotifyUndoListener { explicit NotifyUndoListener( UndoListenerVoidMethod i_notificationMethod ) @@ -252,6 +254,8 @@ namespace svl { namespace undo { namespace impl OUString m_sActionComment; }; + } + class UndoManagerGuard { public: diff --git a/svl/source/uno/pathservice.cxx b/svl/source/uno/pathservice.cxx index 6b428b160f64..3b4e0c178b2c 100644 --- a/svl/source/uno/pathservice.cxx +++ b/svl/source/uno/pathservice.cxx @@ -30,6 +30,8 @@ namespace com { namespace sun { namespace star { namespace uno { class XComponentContext; } } } } +namespace { + class PathService : public ::cppu::WeakImplHelper< css::frame::XConfigManager, css::lang::XServiceInfo > { SvtPathOptions const m_aOptions; @@ -73,6 +75,7 @@ public: {} }; +} extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface* com_sun_star_comp_svl_PathService_get_implementation(css::uno::XComponentContext*, diff --git a/svtools/source/control/ctrltool.cxx b/svtools/source/control/ctrltool.cxx index 957e153e916a..0e8e84174bc4 100644 --- a/svtools/source/control/ctrltool.cxx +++ b/svtools/source/control/ctrltool.cxx @@ -70,9 +70,11 @@ const sal_IntPtr FontList::aStdSizeAry[] = 0 }; +namespace { + class ImplFontListFontMetric : public FontMetric { - friend class FontList; + friend FontList; private: VclPtr<OutputDevice> mpDevice; @@ -89,8 +91,6 @@ public: OutputDevice* GetDevice() const { return mpDevice; } }; -namespace { - enum class FontListFontNameType { NONE = 0x00, diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index b469088b3c12..cce013c60993 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -367,6 +367,8 @@ void ImplTabSizer::Paint( vcl::RenderContext& rRenderContext, const tools::Recta aDecoView.DrawHandle(aOutputRect); } +namespace { + // Is not named Impl. as it may be both instantiated and derived from class TabBarEdit : public Edit { @@ -389,6 +391,8 @@ public: virtual void LoseFocus() override; }; +} + TabBarEdit::TabBarEdit( TabBar* pParent, WinBits nWinStyle ) : Edit( pParent, nWinStyle ) { diff --git a/svtools/source/dialogs/addresstemplate.cxx b/svtools/source/dialogs/addresstemplate.cxx index 2ed288bbac99..d6f84191fa05 100644 --- a/svtools/source/dialogs/addresstemplate.cxx +++ b/svtools/source/dialogs/addresstemplate.cxx @@ -83,8 +83,6 @@ namespace svt } return selectedDataSource; } - } - // = IAssigmentData @@ -111,6 +109,7 @@ namespace svt virtual void setCommand(const OUString& _rCommand) = 0; }; + } IAssigmentData::~IAssigmentData() { @@ -119,6 +118,8 @@ namespace svt // = AssigmentTransientData + namespace { + class AssigmentTransientData : public IAssigmentData { protected: @@ -145,6 +146,7 @@ namespace svt virtual void setCommand(const OUString& _rCommand) override; }; + } AssigmentTransientData::AssigmentTransientData( const OUString& _rDataSourceName, const OUString& _rTableName, @@ -232,6 +234,8 @@ namespace svt // = AssignmentPersistentData + namespace { + class AssignmentPersistentData :public ::utl::ConfigItem ,public IAssigmentData @@ -268,6 +272,7 @@ namespace svt void clearFieldAssignment(const OUString& _rLogicalName); }; + } void AssignmentPersistentData::Notify( const css::uno::Sequence<OUString>& ) { diff --git a/svtools/source/dialogs/insdlg.cxx b/svtools/source/dialogs/insdlg.cxx index 2ae9eb66dc9a..75c5fb6e632a 100644 --- a/svtools/source/dialogs/insdlg.cxx +++ b/svtools/source/dialogs/insdlg.cxx @@ -39,6 +39,7 @@ using namespace ::com::sun::star; // OBJECTDESCRIPTOR -> see oleidl.h // (MS platform sdk) +namespace { struct OleObjectDescriptor { @@ -52,6 +53,8 @@ struct OleObjectDescriptor sal_uInt32 dwSrcOfCopy; }; +} + /********************** SvObjectServerList ******************************** **************************************************************************/ diff --git a/svtools/source/misc/acceleratorexecute.cxx b/svtools/source/misc/acceleratorexecute.cxx index a9e44ba6a9f8..3648e200e7c2 100644 --- a/svtools/source/misc/acceleratorexecute.cxx +++ b/svtools/source/misc/acceleratorexecute.cxx @@ -38,6 +38,8 @@ namespace svt { +namespace { + class AsyncAccelExec : public cppu::WeakImplHelper<css::lang::XEventListener> { private: @@ -77,6 +79,7 @@ class AsyncAccelExec : public cppu::WeakImplHelper<css::lang::XEventListener> DECL_LINK(impl_ts_asyncCallback, LinkParamNone*, void); }; +} AcceleratorExecute::AcceleratorExecute() : TMutexInit() diff --git a/svtools/source/misc/embedhlp.cxx b/svtools/source/misc/embedhlp.cxx index 3e270f0e8d60..2319485a65bd 100644 --- a/svtools/source/misc/embedhlp.cxx +++ b/svtools/source/misc/embedhlp.cxx @@ -58,6 +58,8 @@ using namespace com::sun::star; namespace svt { +namespace { + class EmbedEventListener_Impl : public ::cppu::WeakImplHelper < embed::XStateChangeListener, document::XEventListener, util::XModifyListener, @@ -83,6 +85,8 @@ public: virtual void SAL_CALL modified( const css::lang::EventObject& aEvent ) override; }; +} + rtl::Reference<EmbedEventListener_Impl> EmbedEventListener_Impl::Create( EmbeddedObjectRef* p ) { rtl::Reference<EmbedEventListener_Impl> pRet(new EmbedEventListener_Impl( p )); diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx index 5fc3456d0bbd..0a36573bb9b5 100644 --- a/svtools/source/misc/imagemgr.cxx +++ b/svtools/source/misc/imagemgr.cxx @@ -43,6 +43,8 @@ #define NO_INDEX (-1) #define CONTENT_HELPER ::utl::UCBContentHelper +namespace { + struct SvtExtensionResIdMapping_Impl { const char* _pExt; @@ -51,6 +53,8 @@ struct SvtExtensionResIdMapping_Impl SvImageId const _nImgId; }; +} + static SvtExtensionResIdMapping_Impl const ExtensionMap_Impl[] = { { "awk", true, STR_DESCRIPTION_SOURCEFILE, SvImageId::NONE }, @@ -166,12 +170,16 @@ static SvtExtensionResIdMapping_Impl const ExtensionMap_Impl[] = { nullptr, false, nullptr, SvImageId::NONE } }; +namespace { + struct SvtFactory2ExtensionMapping_Impl { const char* _pFactory; const char* _pExtension; }; +} + // mapping from "private:factory" url to extension static SvtFactory2ExtensionMapping_Impl const Fac2ExtMap_Impl[] = diff --git a/svtools/source/misc/imageresourceaccess.cxx b/svtools/source/misc/imageresourceaccess.cxx index 829ffdb5feb5..8f07e59b999b 100644 --- a/svtools/source/misc/imageresourceaccess.cxx +++ b/svtools/source/misc/imageresourceaccess.cxx @@ -40,6 +40,8 @@ using namespace css; typedef ::cppu::WeakImplHelper<io::XStream, io::XSeekable> StreamSupplier_Base; +namespace { + class StreamSupplier : public StreamSupplier_Base { private: @@ -61,6 +63,8 @@ protected: virtual sal_Int64 SAL_CALL getLength() override; }; +} + StreamSupplier::StreamSupplier(uno::Reference<io::XInputStream> const & rxInput, uno::Reference<io::XOutputStream> const & rxOutput) : m_xInput(rxInput) , m_xOutput(rxOutput) diff --git a/svtools/source/misc/langhelp.cxx b/svtools/source/misc/langhelp.cxx index bedd8d1205c5..b3df64fce1a1 100644 --- a/svtools/source/misc/langhelp.cxx +++ b/svtools/source/misc/langhelp.cxx @@ -64,6 +64,8 @@ OUString getInstalledLocaleForLanguage(css::uno::Sequence<OUString> const & inst static std::unique_ptr<Idle> xLangpackInstaller; +namespace { + class InstallLangpack : public Idle { std::vector<OUString> const m_aPackages; @@ -99,6 +101,8 @@ public: } }; +} + OUString getInstalledLocaleForSystemUILanguage(const css::uno::Sequence<OUString>& rLocaleElementNames, bool bRequestInstallIfMissing, const OUString& rPreferredLocale) { OUString wantedLocale(rPreferredLocale); diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx index 2b4311cde7f6..7c655b1f04f6 100644 --- a/svtools/source/misc/langtab.cxx +++ b/svtools/source/misc/langtab.cxx @@ -37,6 +37,8 @@ using namespace ::com::sun::star; +namespace { + class SvtLanguageTableImpl { private: @@ -71,7 +73,6 @@ public: } }; -namespace { struct theLanguageTable : public rtl::Static< SvtLanguageTableImpl, theLanguageTable > {}; } diff --git a/svtools/source/misc/templatefoldercache.cxx b/svtools/source/misc/templatefoldercache.cxx index 7048441ecf8a..36761da02577 100644 --- a/svtools/source/misc/templatefoldercache.cxx +++ b/svtools/source/misc/templatefoldercache.cxx @@ -93,11 +93,18 @@ namespace svt //= TemplateContent + namespace { + struct TemplateContent; + + } + typedef ::std::vector< ::rtl::Reference< TemplateContent > > TemplateFolderContent; typedef TemplateFolderContent::const_iterator ConstFolderIterator; typedef TemplateFolderContent::iterator FolderIterator; + namespace { + /** a struct describing one content in one of the template dirs (or at least it's relevant aspects) */ struct TemplateContent : public ::salhelper::SimpleReferenceObject @@ -138,6 +145,7 @@ namespace svt { m_aSubContents.push_back( _rxNewElement ); } }; + } TemplateContent::TemplateContent( const INetURLObject& _rURL ) :m_aURL( _rURL ) @@ -154,6 +162,7 @@ namespace svt //= stl helpers + namespace { /// compares two TemplateContent by URL struct TemplateContentURLLess @@ -365,6 +374,7 @@ namespace svt } }; + } //= TemplateFolderCacheImpl diff --git a/svtools/source/svhtml/htmlkywd.cxx b/svtools/source/svhtml/htmlkywd.cxx index b3dddc650dee..70bc2ebe49c7 100644 --- a/svtools/source/svhtml/htmlkywd.cxx +++ b/svtools/source/svhtml/htmlkywd.cxx @@ -25,12 +25,17 @@ #include <svtools/htmltokn.h> #include <svtools/htmlkywd.hxx> +namespace { + template<typename T> struct TokenEntry { OUStringLiteral sToken; T nToken; }; + +} + template<typename T> static bool sortCompare(const TokenEntry<T> & lhs, const TokenEntry<T> & rhs) { diff --git a/svtools/source/svrtf/rtfkeywd.cxx b/svtools/source/svrtf/rtfkeywd.cxx index 5fdfbb26387b..410aa5d3791c 100644 --- a/svtools/source/svrtf/rtfkeywd.cxx +++ b/svtools/source/svrtf/rtfkeywd.cxx @@ -24,6 +24,8 @@ #include <algorithm> #include <string.h> +namespace { + // the table is still to be sorted struct RTF_TokenEntry { @@ -31,6 +33,8 @@ struct RTF_TokenEntry int nToken; }; +} + // Flag: RTF-token table has been sorted static bool bSortKeyWords = false; diff --git a/svtools/source/table/cellvalueconversion.cxx b/svtools/source/table/cellvalueconversion.cxx index 948dd80580be..6219eee3efc5 100644 --- a/svtools/source/table/cellvalueconversion.cxx +++ b/svtools/source/table/cellvalueconversion.cxx @@ -74,11 +74,12 @@ namespace svt { return tools::Time( i_hours, i_minutes, i_seconds, i_100thSeconds ).GetTimeInDays(); } - } - //= CellValueConversion_Data class StandardFormatNormalizer; + + } + struct CellValueConversion_Data { typedef std::unordered_map< OUString, std::shared_ptr< StandardFormatNormalizer > > NormalizerCache; @@ -98,6 +99,8 @@ namespace svt //= StandardFormatNormalizer + namespace { + class StandardFormatNormalizer { public: @@ -285,9 +288,6 @@ namespace svt //= operations - namespace - { - bool lcl_ensureNumberFormatter( CellValueConversion_Data & io_data ) { if ( io_data.bAttemptedFormatterCreation ) diff --git a/svtools/source/table/gridtablerenderer.cxx b/svtools/source/table/gridtablerenderer.cxx index d28a8a7f5b49..0f58e4dec291 100644 --- a/svtools/source/table/gridtablerenderer.cxx +++ b/svtools/source/table/gridtablerenderer.cxx @@ -51,6 +51,8 @@ namespace svt { namespace table //= CachedSortIndicator + namespace { + class CachedSortIndicator { public: @@ -70,6 +72,8 @@ namespace svt { namespace table BitmapEx m_sortDescending; }; + } + BitmapEx const & CachedSortIndicator::getBitmapFor(vcl::RenderContext const& i_device, long const i_headerHeight, StyleSettings const & i_style, bool const i_sortAscending ) { diff --git a/svtools/source/table/tablecontrol_impl.cxx b/svtools/source/table/tablecontrol_impl.cxx index 7153a8fa7838..8dfaf9d7450b 100644 --- a/svtools/source/table/tablecontrol_impl.cxx +++ b/svtools/source/table/tablecontrol_impl.cxx @@ -62,6 +62,8 @@ namespace svt { namespace table //= SuppressCursor + namespace { + class SuppressCursor { private: @@ -212,6 +214,8 @@ namespace svt { namespace table } }; + } + TableControl_Impl::TableControl_Impl( TableControl& _rAntiImpl ) :m_rAntiImpl ( _rAntiImpl ) ,m_pModel ( new EmptyTableModel ) diff --git a/svtools/source/uno/generictoolboxcontroller.cxx b/svtools/source/uno/generictoolboxcontroller.cxx index f5a8d470b7b1..c4e409546018 100644 --- a/svtools/source/uno/generictoolboxcontroller.cxx +++ b/svtools/source/uno/generictoolboxcontroller.cxx @@ -38,6 +38,8 @@ using namespace css::util; namespace svt { +namespace { + struct ExecuteInfo { css::uno::Reference< css::frame::XDispatch > xDispatch; @@ -45,6 +47,8 @@ struct ExecuteInfo css::uno::Sequence< css::beans::PropertyValue > aArgs; }; +} + GenericToolboxController::GenericToolboxController( const Reference< XComponentContext >& rxContext, const Reference< XFrame >& rFrame, ToolBox* pToolbox, diff --git a/svtools/source/uno/popupmenucontrollerbase.cxx b/svtools/source/uno/popupmenucontrollerbase.cxx index ca2510806d9f..9ce0bda33a63 100644 --- a/svtools/source/uno/popupmenucontrollerbase.cxx +++ b/svtools/source/uno/popupmenucontrollerbase.cxx @@ -39,6 +39,8 @@ using namespace css::util; namespace svt { +namespace { + struct PopupMenuControllerBaseDispatchInfo { Reference< XDispatch > mxDispatch; @@ -49,6 +51,8 @@ struct PopupMenuControllerBaseDispatchInfo : mxDispatch( xDispatch ), maURL( rURL ), maArgs( rArgs ) {} }; +} + PopupMenuControllerBase::PopupMenuControllerBase( const Reference< XComponentContext >& xContext ) : ::cppu::BaseMutex(), PopupMenuControllerBaseType(m_aMutex), diff --git a/svtools/source/uno/treecontrolpeer.cxx b/svtools/source/uno/treecontrolpeer.cxx index 3c5ee8c0364d..da477a40de78 100644 --- a/svtools/source/uno/treecontrolpeer.cxx +++ b/svtools/source/uno/treecontrolpeer.cxx @@ -52,6 +52,8 @@ using namespace css::container; using namespace css::util; using namespace css::graphic; +namespace { + struct LockGuard { public: @@ -81,6 +83,8 @@ public: }; +} + class UnoTreeListBoxImpl : public SvTreeListBox { public: @@ -104,6 +108,8 @@ private: }; +namespace { + class UnoTreeListItem : public SvLBoxString { public: @@ -122,6 +128,7 @@ private: Image maImage; }; +} class UnoTreeListEntry : public SvTreeListEntry { @@ -562,6 +569,7 @@ sal_Int32 SAL_CALL TreeControlPeer::getSelectionCount() return getTreeListBoxOrThrow().GetSelectionCount(); } +namespace { class TreeSelectionEnumeration : public ::cppu::WeakImplHelper< XEnumeration > { @@ -574,6 +582,7 @@ public: std::list< Any >::iterator maIter; }; +} TreeSelectionEnumeration::TreeSelectionEnumeration( std::list< Any >& rSelection ) { diff --git a/svtools/source/uno/unoimap.cxx b/svtools/source/uno/unoimap.cxx index 265055d96dab..ef14c9487575 100644 --- a/svtools/source/uno/unoimap.cxx +++ b/svtools/source/uno/unoimap.cxx @@ -63,6 +63,8 @@ const sal_Int32 HANDLE_RADIUS = 8; const sal_Int32 HANDLE_BOUNDARY = 9; const sal_Int32 HANDLE_TITLE = 10; +namespace { + class SvUnoImageMapObject : public OWeakAggObject, public XEventsSupplier, public XServiceInfo, @@ -120,6 +122,8 @@ private: PointSequence maPolygon; }; +} + UNO3_GETIMPLEMENTATION_IMPL( SvUnoImageMapObject ); rtl::Reference<PropertySetInfo> SvUnoImageMapObject::createPropertySetInfo( sal_uInt16 nType ) @@ -496,6 +500,7 @@ Reference< XNameReplace > SAL_CALL SvUnoImageMapObject::getEvents() return mxEvents.get(); } +namespace { class SvUnoImageMap : public WeakImplHelper< XIndexContainer, XServiceInfo, XUnoTunnel > { @@ -535,6 +540,8 @@ private: std::vector< rtl::Reference<SvUnoImageMapObject> > maObjectList; }; +} + UNO3_GETIMPLEMENTATION_IMPL( SvUnoImageMap ); SvUnoImageMap::SvUnoImageMap() diff --git a/svx/source/accessibility/AccessibleEmptyEditSource.cxx b/svx/source/accessibility/AccessibleEmptyEditSource.cxx index c39bbc26b6ac..a0a31d959183 100644 --- a/svx/source/accessibility/AccessibleEmptyEditSource.cxx +++ b/svx/source/accessibility/AccessibleEmptyEditSource.cxx @@ -38,6 +38,7 @@ namespace accessibility { + namespace { /** This class simply wraps a SvxTextEditSource, forwarding all methods except the GetBroadcaster() call @@ -163,6 +164,7 @@ namespace accessibility }; + } // Implementing AccessibleProxyEditSource_Impl diff --git a/svx/source/accessibility/AccessibleShape.cxx b/svx/source/accessibility/AccessibleShape.cxx index 3e181647808b..4116589a4934 100644 --- a/svx/source/accessibility/AccessibleShape.cxx +++ b/svx/source/accessibility/AccessibleShape.cxx @@ -1151,6 +1151,7 @@ sal_Int16 SAL_CALL AccessibleShape::getAccessibleRole() return nAccessibleRole; } +namespace { //sort the drawing objects from up to down, from left to right struct XShapePosCompareHelper @@ -1166,6 +1167,8 @@ struct XShapePosCompareHelper return false; } }; + +} //end of group position // XAccessibleGroupPosition diff --git a/svx/source/accessibility/AccessibleTextHelper.cxx b/svx/source/accessibility/AccessibleTextHelper.cxx index 68a0e40cff9f..46b88a92f702 100644 --- a/svx/source/accessibility/AccessibleTextHelper.cxx +++ b/svx/source/accessibility/AccessibleTextHelper.cxx @@ -329,6 +329,8 @@ namespace accessibility return maEditSource; } + namespace { + // functor for sending child events (no stand-alone function, they are maybe not inlined) class AccessibleTextHelper_OffsetChildIndex { @@ -343,6 +345,8 @@ namespace accessibility const sal_Int32 mnDifference; }; + } + void AccessibleTextHelper_Impl::SetStartIndex( sal_Int32 nOffset ) { sal_Int32 nOldOffset( mnStartIndex ); @@ -796,6 +800,8 @@ namespace accessibility } } + namespace { + // functor for checking changes in paragraph bounding boxes (no stand-alone function, maybe not inlined) class AccessibleTextHelper_UpdateChildBounds { @@ -829,6 +835,8 @@ namespace accessibility } }; + } + void AccessibleTextHelper_Impl::UpdateBoundRect() { // send BOUNDRECT_CHANGED to affected children @@ -847,6 +855,8 @@ namespace accessibility } #endif + namespace { + // functor for sending child events (no stand-alone function, they are maybe not inlined) class AccessibleTextHelper_LostChildEvent { @@ -865,6 +875,8 @@ namespace accessibility AccessibleTextHelper_Impl& mrImpl; }; + } + void AccessibleTextHelper_Impl::ParagraphsMoved( sal_Int32 nFirst, sal_Int32 nMiddle, sal_Int32 nLast ) { const sal_Int32 nParas = GetTextForwarder().GetParagraphCount(); @@ -942,6 +954,8 @@ namespace accessibility } } + namespace { + // functor for sending child events (no stand-alone function, they are maybe not inlined) class AccessibleTextHelper_ChildrenTextChanged { @@ -1021,6 +1035,8 @@ namespace accessibility SfxHintId mnHintId; }; + } + void AccessibleTextHelper_Impl::ProcessQueue() { // inspect queue for paragraph insert/remove events. If there diff --git a/svx/source/core/extedit.cxx b/svx/source/core/extedit.cxx index e1d31771c06d..4135495cabb3 100644 --- a/svx/source/core/extedit.cxx +++ b/svx/source/core/extedit.cxx @@ -71,6 +71,8 @@ void ExternalToolEdit::StartListeningEvent() m_aFileName, [this] () { return HandleCloseEvent(this); })); } +namespace { + // self-destructing thread to make shell execute async class ExternalToolEditThread : public ::salhelper::Thread @@ -87,6 +89,8 @@ public: {} }; +} + void ExternalToolEditThread::execute() { try diff --git a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx index e91751e0ed2c..cf0be984808f 100644 --- a/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeFontWork.cxx @@ -61,6 +61,8 @@ using namespace com::sun::star; using namespace com::sun::star::uno; +namespace { + struct FWCharacterData // representing a single character { std::vector< tools::PolyPolygon > vOutlines; @@ -89,6 +91,7 @@ struct FWData // representing the whole text bool bScaleX; }; +} static bool InitializeFontWorkData( const SdrObjCustomShape& rSdrObjCustomShape, diff --git a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx index 197acb8db4ce..4b257d9ffb7e 100644 --- a/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx +++ b/svx/source/customshapes/EnhancedCustomShapeTypeNames.cxx @@ -31,11 +31,16 @@ static ::osl::Mutex& getHashMapMutex() return s_aHashMapProtection; } +namespace { + struct NameTypeTable { const char* pS; MSO_SPT const pE; }; + +} + static const NameTypeTable pNameTypeTableArray[] = { { "non-primitive", mso_sptMin }, @@ -309,12 +314,17 @@ OUString EnhancedCustomShapeTypeNames::Get( const MSO_SPT eShapeType ) typedef std::unordered_map< const char*, const char*, rtl::CStringHash, rtl::CStringEqual> TypeACCNameHashMap; static TypeACCNameHashMap* pACCHashMap = nullptr; + +namespace { + struct ACCNameTypeTable { const char* pS; const char* pE; }; +} + static const ACCNameTypeTable pACCNameTypeTableArray[] = { { "non-primitive", "Non Primitive Shape" }, diff --git a/svx/source/dialog/framelinkarray.cxx b/svx/source/dialog/framelinkarray.cxx index 49bdb3aeacf6..d93e50e1c21c 100644 --- a/svx/source/dialog/framelinkarray.cxx +++ b/svx/source/dialog/framelinkarray.cxx @@ -33,6 +33,8 @@ namespace svx { namespace frame { +namespace { + class Cell { private: @@ -81,6 +83,8 @@ public: basegfx::B2DHomMatrix CreateCoordinateSystem(const Array& rArray, size_t nCol, size_t nRow, bool bExpandMerged) const; }; +} + typedef std::vector< Cell > CellVec; basegfx::B2DHomMatrix Cell::CreateCoordinateSystem(const Array& rArray, size_t nCol, size_t nRow, bool bExpandMerged) const @@ -365,6 +369,8 @@ bool ArrayImpl::HasCellRotation() const return false; } +namespace { + class MergedCellIterator { public: @@ -385,6 +391,7 @@ private: size_t mnRow; }; +} MergedCellIterator::MergedCellIterator( const Array& rArray, size_t nCol, size_t nRow ) { diff --git a/svx/source/dialog/weldeditview.cxx b/svx/source/dialog/weldeditview.cxx index c7de008f28d2..0d0173fc0be5 100644 --- a/svx/source/dialog/weldeditview.cxx +++ b/svx/source/dialog/weldeditview.cxx @@ -178,6 +178,8 @@ bool WeldEditView::Command(const CommandEvent& rCEvt) class WeldEditAccessible; +namespace +{ class WeldViewForwarder : public SvxViewForwarder { WeldEditAccessible& m_rEditAcc; @@ -195,8 +197,12 @@ public: virtual Point LogicToPixel(const Point& rPoint, const MapMode& rMapMode) const override; virtual Point PixelToLogic(const Point& rPoint, const MapMode& rMapMode) const override; }; +} class WeldEditAccessible; + +namespace +{ class WeldEditSource; /* analog to SvxEditEngineForwarder */ @@ -349,6 +355,7 @@ public: return const_cast<WeldEditSource*>(this)->m_aBroadCaster; } }; +} typedef cppu::WeakImplHelper< css::accessibility::XAccessible, css::accessibility::XAccessibleComponent, diff --git a/svx/source/engine3d/helperhittest3d.cxx b/svx/source/engine3d/helperhittest3d.cxx index 7d644192a3ae..ef4d3bad4743 100644 --- a/svx/source/engine3d/helperhittest3d.cxx +++ b/svx/source/engine3d/helperhittest3d.cxx @@ -31,6 +31,7 @@ using namespace com::sun::star; +namespace { class ImplPairDephAndObject { @@ -54,6 +55,7 @@ public: const E3dCompoundObject* getObject() const { return mpObject; } }; +} static void getAllHit3DObjectWithRelativePoint( const basegfx::B3DPoint& rFront, diff --git a/svx/source/engine3d/helperminimaldepth3d.cxx b/svx/source/engine3d/helperminimaldepth3d.cxx index bceb7df00f6b..298174047fbd 100644 --- a/svx/source/engine3d/helperminimaldepth3d.cxx +++ b/svx/source/engine3d/helperminimaldepth3d.cxx @@ -34,6 +34,8 @@ namespace drawinglayer { namespace processor3d { + namespace { + class MinimalDephInViewExtractor : public BaseProcessor3D { private: @@ -54,6 +56,8 @@ namespace drawinglayer double getMinimalDepth() const { return mfMinimalDepth; } }; + } + void MinimalDephInViewExtractor::processBasePrimitive3D(const primitive3d::BasePrimitive3D& rCandidate) { // it is a BasePrimitive3D implementation, use getPrimitive3DID() call for switch diff --git a/svx/source/engine3d/scene3d.cxx b/svx/source/engine3d/scene3d.cxx index db818000f152..ad77779c02b1 100644 --- a/svx/source/engine3d/scene3d.cxx +++ b/svx/source/engine3d/scene3d.cxx @@ -47,6 +47,7 @@ #include <svx/e3dsceneupdater.hxx> #include <svx/svdmodel.hxx> +namespace { class ImpRemap3DDepth { @@ -67,6 +68,8 @@ public: bool IsScene() const { return mbIsScene; } }; +} + ImpRemap3DDepth::ImpRemap3DDepth(sal_uInt32 nOrdNum, double fMinimalDepth) : mnOrdNum(nOrdNum), mfMinimalDepth(fMinimalDepth), diff --git a/svx/source/engine3d/view3d.cxx b/svx/source/engine3d/view3d.cxx index e3a806fccb88..4fd79ce943fd 100644 --- a/svx/source/engine3d/view3d.cxx +++ b/svx/source/engine3d/view3d.cxx @@ -1011,6 +1011,8 @@ void E3dView::ConvertMarkedObjTo3D(bool bExtrude, const basegfx::B2DPoint& rPnt1 //Arrange all created extrude objects by depth +namespace { + struct E3dDepthNeighbour { E3dExtrudeObj* mpObj; @@ -1034,6 +1036,8 @@ struct E3dDepthLayer } }; +} + void E3dView::DoDepthArrange(E3dScene const * pScene, double fDepth) { if(pScene && pScene->GetSubList() && pScene->GetSubList()->GetObjCount() > 1) diff --git a/svx/source/form/filtnav.cxx b/svx/source/form/filtnav.cxx index 1ba6f7ad6fb5..2020cb99f614 100644 --- a/svx/source/form/filtnav.cxx +++ b/svx/source/form/filtnav.cxx @@ -177,6 +177,8 @@ Image FmFilterItem::GetImage() const // Hints for communication between model and view +namespace { + class FmFilterHint : public SfxHint { FmFilterData* const m_pData; @@ -225,6 +227,8 @@ public: FmFilterCurrentChangedHint(){} }; +} + // class FmFilterAdapter, listener at the FilterControls class FmFilterAdapter : public ::cppu::WeakImplHelper< XFilterControllerListener > { @@ -935,6 +939,8 @@ void FmFilterModel::EnsureEmptyFilterRows( FmParentData& _rItem ) } } +namespace { + class FmFilterItemsString : public SvLBoxString { public: @@ -948,6 +954,8 @@ public: virtual void InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry, SvViewDataItem* pViewData = nullptr) override; }; +} + const int nxDBmp = 12; void FmFilterItemsString::Paint(const Point& rPos, SvTreeListBox& rDev, vcl::RenderContext& rRenderContext, @@ -994,6 +1002,8 @@ void FmFilterItemsString::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pE pViewData->mnHeight = aSize.Height(); } +namespace { + class FmFilterString : public SvLBoxString { OUString m_aName; @@ -1011,6 +1021,8 @@ public: virtual void InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry, SvViewDataItem* pViewData = nullptr) override; }; +} + const int nxD = 4; void FmFilterString::InitViewData( SvTreeListBox* pView,SvTreeListEntry* pEntry, SvViewDataItem* pViewData) diff --git a/svx/source/form/fmscriptingenv.cxx b/svx/source/form/fmscriptingenv.cxx index 5edf19daa490..f76f8e86f729 100644 --- a/svx/source/form/fmscriptingenv.cxx +++ b/svx/source/form/fmscriptingenv.cxx @@ -71,14 +71,19 @@ namespace svxform using ::com::sun::star::awt::XControl; using ::com::sun::star::beans::XPropertySet; + namespace { + class FormScriptingEnvironment; + } //= FormScriptListener typedef ::cppu::WeakImplHelper < XScriptListener > FormScriptListener_Base; + namespace { + /** implements the XScriptListener interface, is used by FormScriptingEnvironment */ class FormScriptListener :public FormScriptListener_Base @@ -169,6 +174,8 @@ namespace svxform void impl_registerOrRevoke_throw( const Reference< XEventAttacherManager >& _rxManager, bool _bRegister ); }; + } + FormScriptListener::FormScriptListener( FormScriptingEnvironment* pScriptExecutor ) :m_pScriptExecutor( pScriptExecutor ) { @@ -770,6 +777,8 @@ namespace svxform m_pScriptExecutor = nullptr; } + namespace { + // tdf#88985 If LibreOffice tries to exit during the execution of a macro // then: detect the effort, stop basic execution, block until the macro // returns due to that stop, then restart the quit. This avoids the app @@ -869,6 +878,8 @@ namespace svxform } }; + } + IMPL_LINK( FormScriptListener, OnAsyncScriptEvent, void*, p, void ) { ScriptEvent* _pEvent = static_cast<ScriptEvent*>(p); diff --git a/svx/source/form/fmsrccfg.cxx b/svx/source/form/fmsrccfg.cxx index 021d5b40b201..2a543178b571 100644 --- a/svx/source/form/fmsrccfg.cxx +++ b/svx/source/form/fmsrccfg.cxx @@ -74,12 +74,16 @@ namespace svxform // maps from ascii values to int values + namespace { + struct Ascii2Int16 { const sal_Char* pAscii; sal_Int16 const nValue; }; + } + static const Ascii2Int16* lcl_getSearchForTypeValueMap() { static const Ascii2Int16 s_aSearchForTypeMap[] = diff --git a/svx/source/form/fmundo.cxx b/svx/source/form/fmundo.cxx index 7b632521b465..2552161a43f9 100644 --- a/svx/source/form/fmundo.cxx +++ b/svx/source/form/fmundo.cxx @@ -77,6 +77,8 @@ using namespace ::dbtools; #include <comphelper/processfactory.hxx> #include <cppuhelper/implbase.hxx> +namespace { + class ScriptEventListenerWrapper : public cppu::WeakImplHelper< XScriptListener > { public: @@ -164,6 +166,8 @@ struct PropertySetInfo // sal_False -> the set has _no_ such property or its value isn't empty }; +} + typedef std::map<Reference< XPropertySet >, PropertySetInfo> PropertySetInfoCache; diff --git a/svx/source/form/formcontroller.cxx b/svx/source/form/formcontroller.cxx index 0a1aa102d718..d5fde904fff6 100644 --- a/svx/source/form/formcontroller.cxx +++ b/svx/source/form/formcontroller.cxx @@ -206,6 +206,8 @@ namespace svxform namespace RowChangeAction = ::com::sun::star::sdb::RowChangeAction; namespace FormFeature = ::com::sun::star::form::runtime::FormFeature; +namespace { + struct ColumnInfo { // information about the column itself @@ -241,6 +243,8 @@ struct ColumnInfo } }; +} + class ColumnInfoCache { public: @@ -415,6 +419,8 @@ const ColumnInfo& ColumnInfoCache::getColumnInfo( size_t _pos ) return m_aColumns[ _pos ]; } +namespace { + class OParameterContinuation : public OInteraction< XInteractionSupplyParameters > { Sequence< PropertyValue > m_aValues; @@ -428,6 +434,7 @@ public: virtual void SAL_CALL setParameters( const Sequence< PropertyValue >& _rValues ) override; }; +} void SAL_CALL OParameterContinuation::setParameters( const Sequence< PropertyValue >& _rValues ) { @@ -449,6 +456,8 @@ struct FmFieldInfo {xField->getPropertyValue(FM_PROP_NAME) >>= aFieldName;} }; +namespace { + class FmXAutoControl: public UnoControl { @@ -464,6 +473,7 @@ protected: virtual void ImplSetPeerProperty( const OUString& rPropName, const Any& rVal ) override; }; +} void FmXAutoControl::createPeer( const Reference< XToolkit > & rxToolkit, const Reference< XWindowPeer > & rParentPeer ) { @@ -493,6 +503,7 @@ IMPL_LINK_NOARG( FormController, OnActivateTabOrder, Timer*, void ) activateTabOrder(); } +namespace { struct UpdateAllListeners { @@ -504,6 +515,8 @@ struct UpdateAllListeners } }; +} + IMPL_LINK_NOARG( FormController, OnInvalidateFeatures, Timer*, void ) { ::osl::MutexGuard aGuard( m_aMutex ); diff --git a/svx/source/form/legacyformcontroller.cxx b/svx/source/form/legacyformcontroller.cxx index 9e14d3758cd1..0c72859d0945 100644 --- a/svx/source/form/legacyformcontroller.cxx +++ b/svx/source/form/legacyformcontroller.cxx @@ -55,6 +55,9 @@ namespace svxform typedef ::cppu::WeakImplHelper < form::XFormController , XServiceInfo > LegacyFormController_Base; + + namespace { + /** is an implementation of the legacy form controller service, namely css.form.FormController, supporting the css.form.XFormController interface. @@ -100,6 +103,7 @@ namespace svxform const Reference< form::runtime::XFormController > m_xDelegator; }; + } Reference< XControl > SAL_CALL LegacyFormController::getCurrentControl( ) { diff --git a/svx/source/gengal/gengal.cxx b/svx/source/gengal/gengal.cxx index 99e7f4820860..907682089ea3 100644 --- a/svx/source/gengal/gengal.cxx +++ b/svx/source/gengal/gengal.cxx @@ -42,6 +42,8 @@ using namespace ::com::sun::star; +namespace { + class GalApp : public Application { bool mbInBuildTree; @@ -58,6 +60,8 @@ protected: void DeInit() override; }; +} + static void createTheme( const OUString& aThemeName, const OUString& aGalleryURL, const OUString& aDestDir, std::vector<INetURLObject> &rFiles, bool bRelativeURLs ) diff --git a/svx/source/mnuctrls/smarttagmenu.cxx b/svx/source/mnuctrls/smarttagmenu.cxx index dd55876b85ed..8701f669b842 100644 --- a/svx/source/mnuctrls/smarttagmenu.cxx +++ b/svx/source/mnuctrls/smarttagmenu.cxx @@ -26,6 +26,8 @@ const sal_uInt16 MN_ST_INSERT_START = 500; +namespace { + class SmartTagMenuController : public svt::PopupMenuControllerBase { public: @@ -54,6 +56,8 @@ private: std::unique_ptr< const SvxSmartTagItem > m_pSmartTagItem; }; +} + SmartTagMenuController::SmartTagMenuController( const css::uno::Reference< css::uno::XComponentContext >& rxContext ) : svt::PopupMenuControllerBase( rxContext ) { diff --git a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx index ed5459388400..adedad499f22 100644 --- a/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx +++ b/svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx @@ -131,6 +131,8 @@ namespace sdr { namespace contact { using ::com::sun::star::container::ContainerEvent; using ::com::sun::star::uno::Any; + namespace { + class ControlHolder { private: @@ -202,17 +204,18 @@ namespace sdr { namespace contact { const Reference< XControl >& getControl() const { return m_xControl; } }; - - static bool operator==( const ControlHolder& _rControl, const Reference< XInterface >& _rxCompare ) + bool operator==( const ControlHolder& _rControl, const Reference< XInterface >& _rxCompare ) { return _rControl.getControl() == _rxCompare; } - static bool operator==( const ControlHolder& _rControl, const Any& _rxCompare ) + bool operator==( const ControlHolder& _rControl, const Any& _rxCompare ) { return _rControl == Reference< XInterface >( _rxCompare, UNO_QUERY ); } + } + void ControlHolder::setPosSize( const tools::Rectangle& _rPosSize ) const { // no check whether we're valid, this is the responsibility of the caller @@ -334,6 +337,8 @@ namespace sdr { namespace contact { } + namespace { + /** interface encapsulating access to an SdrPageView, stripped down to the methods we really need */ class IPageViewAccess @@ -372,6 +377,7 @@ namespace sdr { namespace contact { virtual bool isLayerVisible( SdrLayerID _nLayerID ) const override; }; + } bool SdrPageViewAccess::isDesignMode() const { @@ -393,6 +399,8 @@ namespace sdr { namespace contact { return m_rPageView.GetVisibleLayers().IsSet( _nLayerID ); } + namespace { + /** is a ->IPageViewAccess implementation which can be used to create an invisible control for an arbitrary window */ @@ -414,6 +422,7 @@ namespace sdr { namespace contact { virtual bool isLayerVisible( SdrLayerID _nLayerID ) const override; }; + } bool InvisibleControlViewAccess::isDesignMode() const { @@ -439,6 +448,7 @@ namespace sdr { namespace contact { return false; } + namespace { //= DummyPageViewAccess @@ -464,6 +474,7 @@ namespace sdr { namespace contact { virtual bool isLayerVisible( SdrLayerID _nLayerID ) const override; }; + } bool DummyPageViewAccess::isDesignMode() const { @@ -771,6 +782,8 @@ namespace sdr { namespace contact { const OutputDevice& impl_getOutputDevice_throw() const; }; + namespace { + class LazyControlCreationPrimitive2D : public ::drawinglayer::primitive2d::BufferedDecompositionPrimitive2D { private: @@ -824,6 +837,8 @@ namespace sdr { namespace contact { ::basegfx::B2DHomMatrix m_aTransformation; }; + } + ViewObjectContactOfUnoControl_Impl::ViewObjectContactOfUnoControl_Impl( ViewObjectContactOfUnoControl* _pAntiImpl ) :m_pAntiImpl( _pAntiImpl ) ,m_bCreatingControl( false ) diff --git a/svx/source/sidebar/nbdtmg.cxx b/svx/source/sidebar/nbdtmg.cxx index 082bb29d81e7..0fe474c3784a 100644 --- a/svx/source/sidebar/nbdtmg.cxx +++ b/svx/source/sidebar/nbdtmg.cxx @@ -255,8 +255,12 @@ BulletsTypeMgr::BulletsTypeMgr() Init(); } +namespace { + class theBulletsTypeMgr : public rtl::Static<BulletsTypeMgr, theBulletsTypeMgr> {}; +} + BulletsTypeMgr& BulletsTypeMgr::GetInstance() { return theBulletsTypeMgr::get(); @@ -401,8 +405,12 @@ static const char* RID_SVXSTR_SINGLENUM_DESCRIPTIONS[] = RID_SVXSTR_SINGLENUM_DESCRIPTION_7 }; +namespace { + class theNumberingTypeMgr : public rtl::Static<NumberingTypeMgr, theNumberingTypeMgr> {}; +} + NumberingTypeMgr& NumberingTypeMgr::GetInstance() { return theNumberingTypeMgr::get(); @@ -574,8 +582,12 @@ OutlineTypeMgr::OutlineTypeMgr() ImplLoad("standard.syc"); } +namespace { + class theOutlineTypeMgr : public rtl::Static<OutlineTypeMgr, theOutlineTypeMgr> {}; +} + OutlineTypeMgr& OutlineTypeMgr::GetInstance() { return theOutlineTypeMgr::get(); diff --git a/svx/source/stbctrls/pszctrl.cxx b/svx/source/stbctrls/pszctrl.cxx index c79a778459a2..d55b895af65c 100644 --- a/svx/source/stbctrls/pszctrl.cxx +++ b/svx/source/stbctrls/pszctrl.cxx @@ -94,6 +94,8 @@ OUString SvxPosSizeStatusBarControl::GetMetricStr_Impl( long nVal ) SFX_IMPL_STATUSBAR_CONTROL(SvxPosSizeStatusBarControl, SvxSizeItem); +namespace { + class FunctionPopup_Impl { VclBuilder m_aBuilder; @@ -107,6 +109,8 @@ public: sal_uInt32 GetSelected() const; }; +} + sal_uInt16 FunctionPopup_Impl::id_to_function(const OString& rIdent) { if (rIdent == "avg") diff --git a/svx/source/stbctrls/selctrl.cxx b/svx/source/stbctrls/selctrl.cxx index 1e97e160f289..6bb61c549c02 100644 --- a/svx/source/stbctrls/selctrl.cxx +++ b/svx/source/stbctrls/selctrl.cxx @@ -34,6 +34,8 @@ SFX_IMPL_STATUSBAR_CONTROL(SvxSelectionModeControl, SfxUInt16Item); +namespace { + /// Popup menu to select the selection type class SelectionTypePopup { @@ -48,6 +50,8 @@ public: sal_uInt16 Execute(vcl::Window* pWindow, const Point& rPopupPos) { return m_xMenu->Execute(pWindow, rPopupPos); } }; +} + sal_uInt16 SelectionTypePopup::id_to_state(const OString& rIdent) { if (rIdent == "block") diff --git a/svx/source/stbctrls/zoomctrl.cxx b/svx/source/stbctrls/zoomctrl.cxx index ace1cc1ffea7..d5445b56faa5 100644 --- a/svx/source/stbctrls/zoomctrl.cxx +++ b/svx/source/stbctrls/zoomctrl.cxx @@ -43,6 +43,8 @@ SFX_IMPL_STATUSBAR_CONTROL(SvxZoomStatusBarControl,SvxZoomItem); +namespace { + class ZoomPopup_Impl { public: @@ -62,6 +64,8 @@ private: sal_uInt16 nZoom; }; +} + ZoomPopup_Impl::ZoomPopup_Impl( sal_uInt16 nZ, SvxZoomEnableFlags nValueSet ) : m_aBuilder(nullptr, VclBuilderContainer::getUIRootDir(), "svx/ui/zoommenu.ui", "") , m_xMenu(m_aBuilder.get_menu("menu")) diff --git a/svx/source/svdraw/sdrpaintwindow.cxx b/svx/source/svdraw/sdrpaintwindow.cxx index 666a81c92312..f4b959ce435d 100644 --- a/svx/source/svdraw/sdrpaintwindow.cxx +++ b/svx/source/svdraw/sdrpaintwindow.cxx @@ -28,6 +28,8 @@ #include <set> #include <vector> +namespace { + //rhbz#1007697 do this in two loops, one to collect the candidates //and another to update them because updating a candidate can //trigger the candidate to be deleted, so asking for its @@ -42,6 +44,8 @@ public: ~CandidateMgr(); }; +} + IMPL_LINK(CandidateMgr, WindowEventListener, VclWindowEvent&, rEvent, void) { vcl::Window* pWindow = rEvent.GetWindow(); diff --git a/svx/source/svdraw/svdedtv2.cxx b/svx/source/svdraw/svdedtv2.cxx index f0836ed14f69..286b74bb5a23 100644 --- a/svx/source/svdraw/svdedtv2.cxx +++ b/svx/source/svdraw/svdedtv2.cxx @@ -757,6 +757,8 @@ basegfx::B2DPolygon SdrEditView::ImpCombineToSinglePolygon(const basegfx::B2DPol } } +namespace { + // for distribution dialog function struct ImpDistributeEntry { @@ -765,6 +767,8 @@ struct ImpDistributeEntry sal_Int32 mnLength; }; +} + typedef vector<ImpDistributeEntry> ImpDistributeEntryList; void SdrEditView::DistributeMarkedObjects(weld::Window* pParent) diff --git a/svx/source/svdraw/svdhdl.cxx b/svx/source/svdraw/svdhdl.cxx index e6fd42899721..fc1a6caf7d3a 100644 --- a/svx/source/svdraw/svdhdl.cxx +++ b/svx/source/svdraw/svdhdl.cxx @@ -70,6 +70,8 @@ #include <memory> #include <bitmaps.hlst> +namespace { + // #i15222# // Due to the resource problems in Win95/98 with bitmap resources I // will change this handle bitmap providing class. Old version was splitting @@ -95,6 +97,7 @@ public: const BitmapEx& GetBitmapEx(BitmapMarkerKind eKindOfMarker, sal_uInt16 nInd); }; +} #define KIND_COUNT (14) #define INDEX_COUNT (6) @@ -1912,6 +1915,7 @@ static bool ImpSdrHdlListSorter(std::unique_ptr<SdrHdl> const& lhs, std::unique_ } } +namespace { // Helper struct for re-sorting handles struct ImplHdlAndIndex @@ -1920,6 +1924,8 @@ struct ImplHdlAndIndex sal_uInt32 mnIndex; }; +} + extern "C" { // Helper method for sorting handles taking care of OrdNums, keeping order in diff --git a/svx/source/svdraw/svdocirc.cxx b/svx/source/svdraw/svdocirc.cxx index c104a33ae21a..7c5aa3bf9196 100644 --- a/svx/source/svdraw/svdocirc.cxx +++ b/svx/source/svdraw/svdocirc.cxx @@ -396,6 +396,8 @@ basegfx::B2DPolyPolygon SdrCircObj::TakeXorPoly() const return basegfx::B2DPolyPolygon(aCircPolygon); } +namespace { + struct ImpCircUser : public SdrDragStatUserData { tools::Rectangle aR; @@ -416,6 +418,8 @@ public: void SetCreateParams(SdrDragStat const & rStat); }; +} + sal_uInt32 SdrCircObj::GetHdlCount() const { if(SdrCircKind::Full != meCircleKind) diff --git a/svx/source/svdraw/svdomeas.cxx b/svx/source/svdraw/svdomeas.cxx index c992fadae228..ca047cde59af 100644 --- a/svx/source/svdraw/svdomeas.cxx +++ b/svx/source/svdraw/svdomeas.cxx @@ -270,12 +270,16 @@ struct ImpMeasureRec : public SdrDragStatUserData long nTextAutoAngleView; }; +namespace { + struct ImpLineRec { Point aP1; Point aP2; }; +} + struct ImpMeasurePoly { ImpLineRec aMainline1; // those with the 1st arrowhead diff --git a/svx/source/svdraw/svdoole2.cxx b/svx/source/svdraw/svdoole2.cxx index 16617ecaf94f..6f4ed4edcb8e 100644 --- a/svx/source/svdraw/svdoole2.cxx +++ b/svx/source/svdraw/svdoole2.cxx @@ -108,6 +108,8 @@ static uno::Reference < beans::XPropertySet > lcl_getFrame_throw(const SdrOle2Ob return xFrame; } +namespace { + class SdrLightEmbeddedClient_Impl : public ::cppu::WeakImplHelper < embed::XStateChangeListener , document::XEventListener @@ -175,6 +177,8 @@ private: virtual uno::Reference< awt::XWindow > SAL_CALL getWindow() override; }; +} + SdrLightEmbeddedClient_Impl::SdrLightEmbeddedClient_Impl( SdrOle2Obj* pObj ) : mpObj( pObj ) { diff --git a/svx/source/svdraw/svdopath.cxx b/svx/source/svdraw/svdopath.cxx index 0ae3fe029ef7..b586d83b3079 100644 --- a/svx/source/svdraw/svdopath.cxx +++ b/svx/source/svdraw/svdopath.cxx @@ -74,6 +74,8 @@ static sal_uInt16 GetNextPnt(sal_uInt16 nPnt, sal_uInt16 nPntMax, bool bClosed) return nPnt; } +namespace { + struct ImpSdrPathDragData : public SdrDragStatUserData { XPolygon aXP; // section of the original polygon @@ -112,6 +114,8 @@ public: bool IsMultiPointDrag() const { return mbMultiPointDrag; } }; +} + ImpSdrPathDragData::ImpSdrPathDragData(const SdrPathObj& rPO, const SdrHdl& rHdl, bool bMuPoDr, const SdrDragStat& rDrag) : aXP(5) , bValid(false) @@ -224,6 +228,8 @@ void ImpSdrPathDragData::ResetPoly(const SdrPathObj& rPO) aXP[4]=aTmpXP[nNextNextPnt0]; aXP.SetFlags(4,aTmpXP.GetFlags(nNextNextPnt0)); } +namespace { + struct ImpPathCreateUser : public SdrDragStatUserData { Point aBezControl0; @@ -273,6 +279,8 @@ public: XPolygon GetRectPoly() const; }; +} + XPolygon ImpPathCreateUser::GetFormPoly() const { if (bBezier) return GetBezierPoly(); diff --git a/svx/source/svdraw/svdpdf.cxx b/svx/source/svdraw/svdpdf.cxx index b392e9523f79..dee1f97d0223 100644 --- a/svx/source/svdraw/svdpdf.cxx +++ b/svx/source/svdraw/svdpdf.cxx @@ -110,10 +110,13 @@ long lcl_ToLogic(double value) double sqrt2(double a, double b) { return sqrt(a * a + b * b); } } +namespace +{ struct FPDFBitmapDeleter { void operator()(FPDF_BITMAP bitmap) { FPDFBitmap_Destroy(bitmap); } }; +} using namespace com::sun::star; diff --git a/svx/source/table/svdotable.cxx b/svx/source/table/svdotable.cxx index b6aede0dd926..68386971fb88 100644 --- a/svx/source/table/svdotable.cxx +++ b/svx/source/table/svdotable.cxx @@ -84,6 +84,8 @@ using namespace ::com::sun::star::style; namespace sdr { namespace table { +namespace { + class TableProperties : public TextProperties { protected: @@ -103,6 +105,8 @@ public: virtual void ItemChange(const sal_uInt16 nWhich, const SfxPoolItem* pNewItem = nullptr) override; }; +} + TableProperties::TableProperties(SdrObject& rObj) : TextProperties(rObj) { @@ -143,12 +147,16 @@ std::unique_ptr<SfxItemSet> TableProperties::CreateObjectSpecificItemSet(SfxItem EE_ITEMS_START, EE_ITEMS_END>{}); } +namespace { + class TableObjectGeoData : public SdrTextObjGeoData { public: tools::Rectangle maLogicRect; }; +} + TableStyleSettings::TableStyleSettings() : mbUseFirstRow(true) , mbUseLastRow(false) diff --git a/svx/source/table/tablecontroller.cxx b/svx/source/table/tablecontroller.cxx index d4c5ab1ad43b..2690e1d5062f 100644 --- a/svx/source/table/tablecontroller.cxx +++ b/svx/source/table/tablecontroller.cxx @@ -112,6 +112,8 @@ namespace o3tl namespace sdr { namespace table { +namespace { + class SvxTableControllerModifyListener : public ::cppu::WeakImplHelper< css::util::XModifyListener > { public: @@ -127,6 +129,7 @@ public: SvxTableController* mpController; }; +} // XModifyListener diff --git a/svx/source/table/tabledesign.cxx b/svx/source/table/tabledesign.cxx index 0a4f81417f63..c80f4ace3f60 100644 --- a/svx/source/table/tabledesign.cxx +++ b/svx/source/table/tabledesign.cxx @@ -67,6 +67,8 @@ typedef std::map< OUString, sal_Int32 > CellStyleNameMap; typedef ::cppu::WeakComponentImplHelper< XStyle, XNameReplace, XServiceInfo, XIndexAccess, XModifyBroadcaster, XModifyListener > TableDesignStyleBase; +namespace { + class TableDesignStyle : private ::cppu::BaseMutex, public TableDesignStyleBase { public: @@ -122,8 +124,12 @@ public: Reference< XStyle > maCellStyles[style_count]; }; +} + typedef std::vector< Reference< XStyle > > TableDesignStyleVector; +namespace { + class TableDesignFamily : public ::cppu::WeakImplHelper< XNameContainer, XNamed, XIndexAccess, XSingleServiceFactory, XServiceInfo, XComponent, XPropertySet > { public: @@ -177,6 +183,8 @@ public: TableDesignStyleVector maDesigns; }; +} + TableDesignStyle::TableDesignStyle() : TableDesignStyleBase(m_aMutex) { diff --git a/svx/source/table/tablehandles.cxx b/svx/source/table/tablehandles.cxx index 776768affc53..abf7c55f85ba 100644 --- a/svx/source/table/tablehandles.cxx +++ b/svx/source/table/tablehandles.cxx @@ -41,6 +41,7 @@ namespace sdr { namespace table { +namespace { class OverlayTableEdge : public sdr::overlay::OverlayObject { @@ -55,6 +56,7 @@ public: OverlayTableEdge( const basegfx::B2DPolyPolygon& rPolyPolygon, bool bVisible ); }; +} TableEdgeHdl::TableEdgeHdl( const Point& rPnt, bool bHorizontal, sal_Int32 nMin, sal_Int32 nMax, sal_Int32 nEdges ) : SdrHdl( rPnt, SdrHdlKind::User ) diff --git a/svx/source/table/tablertfimporter.cxx b/svx/source/table/tablertfimporter.cxx index 43b7f44b2e78..267c6a9c6519 100644 --- a/svx/source/table/tablertfimporter.cxx +++ b/svx/source/table/tablertfimporter.cxx @@ -49,6 +49,8 @@ using namespace ::com::sun::star::beans; namespace sdr { namespace table { +namespace { + struct RTFCellDefault { SfxItemSet maItemSet; @@ -59,8 +61,12 @@ struct RTFCellDefault explicit RTFCellDefault( SfxItemPool* pPool ) : maItemSet( *pPool ), mnRowSpan(1), mnColSpan(1), mnCellX(0) {} }; +} + typedef std::vector< std::shared_ptr< RTFCellDefault > > RTFCellDefaultVector; +namespace { + struct RTFCellInfo { SfxItemSet const maItemSet; @@ -73,6 +79,8 @@ struct RTFCellInfo explicit RTFCellInfo( SfxItemPool& rPool ) : maItemSet( rPool ), mnStartPara(0), mnParaCount(0), mnCellX(0), mnRowSpan(1) {} }; +} + typedef std::shared_ptr< RTFCellInfo > RTFCellInfoPtr; typedef std::vector< RTFCellInfoPtr > RTFColumnVector; diff --git a/svx/source/table/viewcontactoftableobj.cxx b/svx/source/table/viewcontactoftableobj.cxx index 10a6173fab56..3687df3424e9 100644 --- a/svx/source/table/viewcontactoftableobj.cxx +++ b/svx/source/table/viewcontactoftableobj.cxx @@ -54,6 +54,8 @@ namespace drawinglayer { namespace primitive2d { + namespace { + class SdrCellPrimitive2D : public BufferedDecompositionPrimitive2D { private: @@ -85,6 +87,8 @@ namespace drawinglayer DeclPrimitive2DIDBlock() }; + } + void SdrCellPrimitive2D::create2DDecomposition(Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*aViewInformation*/) const { // prepare unit polygon diff --git a/svx/source/tbxctrls/bulletsnumbering.cxx b/svx/source/tbxctrls/bulletsnumbering.cxx index 443b29ebdc20..9ec03e787958 100644 --- a/svx/source/tbxctrls/bulletsnumbering.cxx +++ b/svx/source/tbxctrls/bulletsnumbering.cxx @@ -22,6 +22,8 @@ #include <vcl/toolbox.hxx> #include <vcl/settings.hxx> +namespace { + class NumberingToolBoxControl; class NumberingPopup : public svtools::ToolbarMenu @@ -59,6 +61,8 @@ public: using svt::ToolboxController::createPopupWindow; }; +} + //class NumberingPopup NumberingPopup::NumberingPopup( NumberingToolBoxControl& rController, vcl::Window* pParent, NumberingPageType ePageType ) : diff --git a/svx/source/tbxctrls/colrctrl.cxx b/svx/source/tbxctrls/colrctrl.cxx index 329931809c3a..65af6c136503 100644 --- a/svx/source/tbxctrls/colrctrl.cxx +++ b/svx/source/tbxctrls/colrctrl.cxx @@ -49,6 +49,7 @@ using namespace com::sun::star; +namespace { class SvxColorValueSetData : public TransferableHelper { @@ -68,6 +69,8 @@ public: {} }; +} + void SvxColorValueSetData::AddSupportedFormats() { AddFormat( SotClipboardFormatId::XFA ); diff --git a/svx/source/tbxctrls/fontworkgallery.cxx b/svx/source/tbxctrls/fontworkgallery.cxx index 1b2483f11e4e..3d22213ca065 100644 --- a/svx/source/tbxctrls/fontworkgallery.cxx +++ b/svx/source/tbxctrls/fontworkgallery.cxx @@ -263,6 +263,8 @@ IMPL_LINK_NOARG(FontWorkGalleryDialog, DoubleClickFavoriteHdl, SvtValueSet*, voi m_xDialog->response(RET_OK); } +namespace { + class FontworkAlignmentWindow : public ToolbarMenu { public: @@ -278,6 +280,8 @@ private: void implSetAlignment( int nAlignmentMode, bool bEnabled ); }; +} + static const OUStringLiteral gsFontworkAlignment(".uno:FontworkAlignment"); FontworkAlignmentWindow::FontworkAlignmentWindow(svt::ToolboxController& rController, vcl::Window* pParentWindow) @@ -348,6 +352,8 @@ IMPL_LINK_NOARG(FontworkAlignmentWindow, SelectHdl, ToolbarMenu*, void) } } +namespace { + class FontworkAlignmentControl : public svt::PopupWindowController { public: @@ -365,6 +371,7 @@ public: using svt::PopupWindowController::createPopupWindow; }; +} FontworkAlignmentControl::FontworkAlignmentControl( const Reference< XComponentContext >& rxContext ) : svt::PopupWindowController( rxContext, Reference< css::frame::XFrame >(), ".uno:FontworkAlignment" ) @@ -412,6 +419,7 @@ com_sun_star_comp_svx_FontworkAlignmentControl_get_implementation( return cppu::acquire(new FontworkAlignmentControl(xContext)); } +namespace { class FontworkCharacterSpacingWindow : public ToolbarMenu { @@ -428,6 +436,9 @@ private: void implSetKernCharacterPairs( bool bEnabled ); }; + +} + static const OUStringLiteral gsFontworkCharacterSpacing(".uno:FontworkCharacterSpacing"); static const OUStringLiteral gsFontworkKernCharacterPairs(".uno:FontworkKernCharacterPairs"); @@ -561,6 +572,8 @@ IMPL_LINK_NOARG(FontworkCharacterSpacingWindow, SelectHdl,ToolbarMenu*, void) } } +namespace { + class FontworkCharacterSpacingControl : public svt::PopupWindowController { public: @@ -578,6 +591,7 @@ public: using svt::PopupWindowController::createPopupWindow; }; +} FontworkCharacterSpacingControl::FontworkCharacterSpacingControl( const Reference< XComponentContext >& rxContext ) : svt::PopupWindowController( rxContext, Reference< css::frame::XFrame >(), ".uno:FontworkCharacterSpacingFloater" ) diff --git a/svx/source/tbxctrls/grafctrl.cxx b/svx/source/tbxctrls/grafctrl.cxx index dee443327e08..a3095c8409c8 100644 --- a/svx/source/tbxctrls/grafctrl.cxx +++ b/svx/source/tbxctrls/grafctrl.cxx @@ -73,6 +73,8 @@ using namespace ::com::sun::star::lang; #define TOOLBOX_NAME "colorbar" #define RID_SVXSTR_UNDO_GRAFCROP RID_SVXSTR_GRAFCROP +namespace { + class ImplGrafMetricField : public MetricField { using Window::Update; @@ -94,6 +96,8 @@ public: void Update( const SfxPoolItem* pItem ); }; +} + ImplGrafMetricField::ImplGrafMetricField( vcl::Window* pParent, const OUString& rCmd, const Reference< XFrame >& rFrame ) : MetricField( pParent, WB_BORDER | WB_SPIN | WB_REPEAT | WB_3DLOOK ), maCommand( rCmd ), @@ -184,12 +188,16 @@ void ImplGrafMetricField::Update( const SfxPoolItem* pItem ) SetText( OUString() ); } +namespace { + struct CommandToRID { const char* pCommand; const char* sResId; }; +} + static OUString ImplGetRID( const OUString& aCommand ) { static const CommandToRID aImplCommandToResMap[] = @@ -220,6 +228,8 @@ static OUString ImplGetRID( const OUString& aCommand ) return sRID; } +namespace { + class ImplGrafControl : public Control { using Window::Update; @@ -242,6 +252,8 @@ public: virtual void Resize() override; }; +} + ImplGrafControl::ImplGrafControl( vcl::Window* pParent, const OUString& rCmd, @@ -315,6 +327,8 @@ void ImplGrafControl::Resize() Control::Resize(); } +namespace { + class ImplGrafModeControl : public ListBox { using Window::Update; @@ -333,6 +347,8 @@ public: void Update( const SfxPoolItem* pItem ); }; +} + ImplGrafModeControl::ImplGrafModeControl( vcl::Window* pParent, const Reference< XFrame >& rFrame ) : ListBox( pParent, WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL ), mnCurPos( 0 ), diff --git a/svx/source/tbxctrls/layctrl.cxx b/svx/source/tbxctrls/layctrl.cxx index 5e995a8f4833..14289e2fd704 100644 --- a/svx/source/tbxctrls/layctrl.cxx +++ b/svx/source/tbxctrls/layctrl.cxx @@ -47,6 +47,8 @@ using namespace ::com::sun::star::frame; SFX_IMPL_TOOLBOX_CONTROL(SvxTableToolBoxControl,SfxUInt16Item); SFX_IMPL_TOOLBOX_CONTROL(SvxColumnsToolBoxControl,SfxUInt16Item); +namespace { + class TableWindow : public SfxPopupWindow { private: @@ -93,6 +95,8 @@ private: void CloseAndShowTableDialog(); }; +} + const long TableWindow::TABLE_CELLS_HORIZ = 10; const long TableWindow::TABLE_CELLS_VERT = 15; @@ -401,6 +405,8 @@ bool TableWindow::EventNotify( NotifyEvent& rNEvt ) return SfxPopupWindow::EventNotify( rNEvt ); } +namespace { + class ColumnsWindow : public SfxPopupWindow { private: @@ -431,6 +437,7 @@ public: virtual void PopupModeEnd() override; }; +} ColumnsWindow::ColumnsWindow( sal_uInt16 nId, vcl::Window* pParent, const OUString& rCmd, const OUString& rText, const Reference< XFrame >& rFrame ) : diff --git a/svx/source/tbxctrls/linectrl.cxx b/svx/source/tbxctrls/linectrl.cxx index 0704b88006dc..545c58eda1d1 100644 --- a/svx/source/tbxctrls/linectrl.cxx +++ b/svx/source/tbxctrls/linectrl.cxx @@ -244,6 +244,8 @@ VclPtr<vcl::Window> SvxLineWidthToolBoxControl::CreateItemWindow( vcl::Window *p return VclPtr<SvxMetricField>::Create( pParent, m_xFrame ).get(); } +namespace { + class SvxLineEndWindow : public svtools::ToolbarPopup { private: @@ -267,6 +269,8 @@ public: virtual void statusChanged( const css::frame::FeatureStateEvent& rEvent ) override; }; +} + static constexpr sal_uInt16 gnCols = 2; SvxLineEndWindow::SvxLineEndWindow( svt::ToolboxController& rController, vcl::Window* pParentWindow ) @@ -458,6 +462,8 @@ void SvxLineEndWindow::GetFocus() } } +namespace { + class SvxLineEndToolBoxControl : public svt::PopupWindowController { public: @@ -475,6 +481,8 @@ private: using svt::ToolboxController::createPopupWindow; }; +} + SvxLineEndToolBoxControl::SvxLineEndToolBoxControl( const css::uno::Reference<css::uno::XComponentContext>& rContext ) : svt::PopupWindowController( rContext, nullptr, OUString() ) { diff --git a/svx/source/tbxctrls/tbcontrl.cxx b/svx/source/tbxctrls/tbcontrl.cxx index dfb3bbd13c7a..e864878bf6e1 100644 --- a/svx/source/tbxctrls/tbcontrl.cxx +++ b/svx/source/tbxctrls/tbcontrl.cxx @@ -191,6 +191,8 @@ private: DECL_STATIC_LINK(SvxStyleBox_Impl, ShowMoreHdl, void*, void); }; +namespace { + class SvxFontNameBox_Impl : public FontNameBox { using Window::Update; @@ -259,12 +261,16 @@ public: }; +} + void SvxFrmValueSet_Impl::MouseButtonUp( const MouseEvent& rMEvt ) { nModifier = rMEvt.GetModifier(); ValueSet::MouseButtonUp(rMEvt); } +namespace { + class SvxFrameWindow_Impl : public svtools::ToolbarPopup { private: @@ -290,8 +296,6 @@ public: virtual void DataChanged( const DataChangedEvent& rDCEvt ) override; }; -namespace -{ class LineListBox final : public ListBox { public: @@ -606,6 +610,8 @@ namespace } } +namespace { + class SvxLineWindow_Impl : public svtools::ToolbarPopup { private: @@ -645,6 +651,8 @@ public: virtual void dispose() override; }; +} + class SvxStyleToolBoxControl; class SfxStyleControllerItem_Impl : public SfxStatusListener @@ -3303,6 +3311,8 @@ VclPtr<vcl::Window> SvxStyleToolBoxControl::CreateItemWindow( vcl::Window *pPare return pBox.get(); } +namespace { + class SvxFontNameToolBoxControl : public cppu::ImplInheritanceHelper< svt::ToolboxController, css::lang::XServiceInfo > { @@ -3327,6 +3337,8 @@ private: VclPtr<SvxFontNameBox_Impl> m_pBox; }; +} + SvxFontNameToolBoxControl::SvxFontNameToolBoxControl() { } @@ -3635,6 +3647,8 @@ com_sun_star_comp_svx_ColorToolBoxControl_get_implementation( // class SvxFrameToolBoxControl -------------------------------------------- +namespace { + class SvxFrameToolBoxControl : public svt::PopupWindowController { public: @@ -3652,6 +3666,8 @@ private: using svt::ToolboxController::createPopupWindow; }; +} + SvxFrameToolBoxControl::SvxFrameToolBoxControl( const css::uno::Reference< css::uno::XComponentContext >& rContext ) : svt::PopupWindowController( rContext, nullptr, OUString() ) { diff --git a/svx/source/unodraw/UnoNamespaceMap.cxx b/svx/source/unodraw/UnoNamespaceMap.cxx index 3bf56c17707f..d9c196a2dda3 100644 --- a/svx/source/unodraw/UnoNamespaceMap.cxx +++ b/svx/source/unodraw/UnoNamespaceMap.cxx @@ -41,6 +41,8 @@ using namespace ::com::sun::star::lang; namespace svx { + namespace { + /** implements a component to export namespaces of all SvXMLAttrContainerItem inside one or two pools with a variable count of which ids. */ @@ -68,6 +70,8 @@ namespace svx virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; }; + } + Reference< XInterface > NamespaceMap_createInstance( sal_uInt16* pWhichIds, SfxItemPool* pPool ) { return static_cast<XWeak*>(new NamespaceMap( pWhichIds, pPool )); @@ -86,6 +90,7 @@ namespace svx return "com.sun.star.comp.Svx.NamespaceMap"; } + namespace { class NamespaceIteratorImpl { @@ -106,6 +111,8 @@ namespace svx bool next( OUString& rPrefix, OUString& rURL ); }; + + } } using namespace ::svx; diff --git a/svx/source/unodraw/XPropertyTable.cxx b/svx/source/unodraw/XPropertyTable.cxx index fc2ce754652f..68c1a27517fe 100644 --- a/svx/source/unodraw/XPropertyTable.cxx +++ b/svx/source/unodraw/XPropertyTable.cxx @@ -43,6 +43,8 @@ using namespace com::sun::star; using namespace ::cppu; +namespace { + class SvxUnoXPropertyTable : public WeakImplHelper< container::XNameContainer, lang::XServiceInfo > { private: @@ -79,6 +81,8 @@ public: virtual sal_Bool SAL_CALL hasElements( ) override; }; +} + SvxUnoXPropertyTable::SvxUnoXPropertyTable( sal_Int16 nWhich, XPropertyList* pList ) throw() : mpList( pList ), mnWhich( nWhich ) { @@ -230,6 +234,7 @@ sal_Bool SAL_CALL SvxUnoXPropertyTable::hasElements( ) return getCount() != 0; } +namespace { class SvxUnoXColorTable : public SvxUnoXPropertyTable { @@ -248,6 +253,8 @@ public: virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; }; +} + uno::Reference< uno::XInterface > SvxUnoXColorTable_createInstance( XPropertyList* pList ) throw() { return static_cast<OWeakObject*>(new SvxUnoXColorTable( pList )); @@ -285,6 +292,7 @@ uno::Sequence< OUString > SAL_CALL SvxUnoXColorTable::getSupportedServiceNames( return { "com.sun.star.drawing.ColorTable" }; } +namespace { class SvxUnoXLineEndTable : public SvxUnoXPropertyTable { @@ -303,6 +311,8 @@ public: virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; }; +} + uno::Reference< uno::XInterface > SvxUnoXLineEndTable_createInstance( XPropertyList* pTable ) throw() { return static_cast<OWeakObject*>(new SvxUnoXLineEndTable( pTable )); @@ -350,6 +360,7 @@ uno::Sequence< OUString > SAL_CALL SvxUnoXLineEndTable::getSupportedServiceName return { "com.sun.star.drawing.LineEndTable" }; } +namespace { class SvxUnoXDashTable : public SvxUnoXPropertyTable { @@ -368,6 +379,8 @@ public: virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; }; +} + uno::Reference< uno::XInterface > SvxUnoXDashTable_createInstance( XPropertyList* pTable ) throw() { return static_cast<OWeakObject*>(new SvxUnoXDashTable( pTable )); @@ -425,6 +438,7 @@ uno::Sequence< OUString > SAL_CALL SvxUnoXDashTable::getSupportedServiceNames( return { "com.sun.star.drawing.DashTable" }; } +namespace { class SvxUnoXHatchTable : public SvxUnoXPropertyTable { @@ -443,6 +457,8 @@ public: virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; }; +} + uno::Reference< uno::XInterface > SvxUnoXHatchTable_createInstance( XPropertyList* pTable ) throw() { return static_cast<OWeakObject*>(new SvxUnoXHatchTable( pTable )); @@ -495,6 +511,7 @@ uno::Sequence< OUString > SAL_CALL SvxUnoXHatchTable::getSupportedServiceNames( return { "com.sun.star.drawing.HatchTable" }; } +namespace { class SvxUnoXGradientTable : public SvxUnoXPropertyTable { @@ -513,6 +530,8 @@ public: virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; }; +} + uno::Reference< uno::XInterface > SvxUnoXGradientTable_createInstance( XPropertyList* pTable ) throw() { return static_cast<OWeakObject*>(new SvxUnoXGradientTable( pTable )); @@ -577,6 +596,7 @@ uno::Sequence< OUString > SAL_CALL SvxUnoXGradientTable::getSupportedServiceNam return { "com.sun.star.drawing.GradientTable" }; } +namespace { class SvxUnoXBitmapTable : public SvxUnoXPropertyTable { @@ -595,6 +615,8 @@ public: virtual uno::Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; }; +} + uno::Reference< uno::XInterface > SvxUnoXBitmapTable_createInstance( XPropertyList* pTable ) throw() { return static_cast<OWeakObject*>(new SvxUnoXBitmapTable( pTable )); diff --git a/svx/source/unodraw/gluepts.cxx b/svx/source/unodraw/gluepts.cxx index 2b1ba019292e..575c9ecc189a 100644 --- a/svx/source/unodraw/gluepts.cxx +++ b/svx/source/unodraw/gluepts.cxx @@ -37,6 +37,8 @@ using namespace ::cppu; const sal_uInt16 NON_USER_DEFINED_GLUE_POINTS = 4; +namespace { + class SvxUnoGluePointAccess : public WeakImplHelper< container::XIndexContainer, container::XIdentifierContainer > { private: @@ -75,6 +77,8 @@ public: virtual sal_Bool SAL_CALL hasElements( ) override; }; +} + static void convert( const SdrGluePoint& rSdrGlue, drawing::GluePoint2& rUnoGlue ) throw() { rUnoGlue.Position.X = rSdrGlue.GetPos().X(); diff --git a/svx/source/unodraw/unobtabl.cxx b/svx/source/unodraw/unobtabl.cxx index c80ffcb69f10..f94369907f73 100644 --- a/svx/source/unodraw/unobtabl.cxx +++ b/svx/source/unodraw/unobtabl.cxx @@ -36,6 +36,8 @@ using namespace ::com::sun::star; using namespace ::cppu; +namespace { + class SvxUnoBitmapTable : public SvxUnoNameItemTable { public: @@ -52,6 +54,8 @@ public: virtual uno::Type SAL_CALL getElementType( ) override; }; +} + SvxUnoBitmapTable::SvxUnoBitmapTable( SdrModel* pModel ) throw() : SvxUnoNameItemTable( pModel, XATTR_FILLBITMAP, MID_BITMAP ) { diff --git a/svx/source/unodraw/unodtabl.cxx b/svx/source/unodraw/unodtabl.cxx index c827a288fafe..f285ac30c7d1 100644 --- a/svx/source/unodraw/unodtabl.cxx +++ b/svx/source/unodraw/unodtabl.cxx @@ -33,6 +33,8 @@ using namespace ::com::sun::star; using namespace ::cppu; +namespace { + class SvxUnoDashTable : public SvxUnoNameItemTable { public: @@ -48,6 +50,8 @@ public: virtual uno::Type SAL_CALL getElementType( ) override; }; +} + SvxUnoDashTable::SvxUnoDashTable( SdrModel* pModel ) throw() : SvxUnoNameItemTable( pModel, XATTR_LINEDASH, MID_LINEDASH ) { diff --git a/svx/source/unodraw/unogtabl.cxx b/svx/source/unodraw/unogtabl.cxx index f33d947fcd08..4b3842c9d026 100644 --- a/svx/source/unodraw/unogtabl.cxx +++ b/svx/source/unodraw/unogtabl.cxx @@ -32,6 +32,8 @@ using namespace ::com::sun::star; using namespace ::cppu; +namespace { + class SvxUnoGradientTable : public SvxUnoNameItemTable { public: @@ -47,6 +49,8 @@ public: virtual uno::Type SAL_CALL getElementType( ) override; }; +} + SvxUnoGradientTable::SvxUnoGradientTable( SdrModel* pModel ) throw() : SvxUnoNameItemTable( pModel, XATTR_FILLGRADIENT, MID_FILLGRADIENT ) { diff --git a/svx/source/unodraw/unohtabl.cxx b/svx/source/unodraw/unohtabl.cxx index 8e21de8229bd..ec114ba91b10 100644 --- a/svx/source/unodraw/unohtabl.cxx +++ b/svx/source/unodraw/unohtabl.cxx @@ -32,6 +32,8 @@ using namespace ::com::sun::star; using namespace ::cppu; +namespace { + class SvxUnoHatchTable : public SvxUnoNameItemTable { public: @@ -47,6 +49,8 @@ public: virtual uno::Type SAL_CALL getElementType( ) override; }; +} + SvxUnoHatchTable::SvxUnoHatchTable( SdrModel* pModel ) throw() : SvxUnoNameItemTable( pModel, XATTR_FILLHATCH, MID_FILLHATCH ) { diff --git a/svx/source/unodraw/unomtabl.cxx b/svx/source/unodraw/unomtabl.cxx index a6d56f20d479..ec1d0d4cbfe1 100644 --- a/svx/source/unodraw/unomtabl.cxx +++ b/svx/source/unodraw/unomtabl.cxx @@ -51,6 +51,8 @@ using namespace ::cppu; typedef std::vector<std::unique_ptr<SfxItemSet>> ItemPoolVector; +namespace { + class SvxUnoMarkerTable : public WeakImplHelper< container::XNameContainer, lang::XServiceInfo >, public SfxListener { @@ -93,6 +95,8 @@ public: virtual sal_Bool SAL_CALL hasElements( ) override; }; +} + SvxUnoMarkerTable::SvxUnoMarkerTable( SdrModel* pModel ) throw() : mpModel( pModel ), mpModelPool( pModel ? &pModel->GetItemPool() : nullptr ) diff --git a/svx/source/unodraw/unoprov.cxx b/svx/source/unodraw/unoprov.cxx index 06bd11bda42e..891423952aff 100644 --- a/svx/source/unodraw/unoprov.cxx +++ b/svx/source/unodraw/unoprov.cxx @@ -861,11 +861,15 @@ sal_uInt32 UHashMap::getId( const OUString& rCompareString ) return it->second; } +namespace { + struct theSvxMapProvider : public rtl::Static<SvxUnoPropertyMapProvider, theSvxMapProvider> { }; +} + SvxUnoPropertyMapProvider& getSvxMapProvider() { return theSvxMapProvider::get(); diff --git a/svx/source/unodraw/unoshap3.cxx b/svx/source/unodraw/unoshap3.cxx index 10ab55650102..aaa66de99511 100644 --- a/svx/source/unodraw/unoshap3.cxx +++ b/svx/source/unodraw/unoshap3.cxx @@ -246,6 +246,7 @@ static void ConvertObjectToHomogenMatric( E3dObject const * pObject, Any& rValue rValue <<= aHomMat; } +namespace { struct ImpRememberTransAndRect { @@ -253,6 +254,8 @@ struct ImpRememberTransAndRect tools::Rectangle maRect; }; +} + bool Svx3DSceneObject::setPropertyValueImpl( const OUString& rName, const SfxItemPropertySimpleEntry* pProperty, const css::uno::Any& rValue ) { switch( pProperty->nWID ) diff --git a/svx/source/unodraw/unoshape.cxx b/svx/source/unodraw/unoshape.cxx index 6ebb7a090f36..37283fa085f6 100644 --- a/svx/source/unodraw/unoshape.cxx +++ b/svx/source/unodraw/unoshape.cxx @@ -142,6 +142,8 @@ struct SvxShapeImpl } }; +namespace { + class ShapePositionProvider : public PropertyValueProvider { public: @@ -173,6 +175,8 @@ protected: } }; +} + SvxShape::SvxShape( SdrObject* pObject ) : maSize(100,100) , mpImpl( new SvxShapeImpl( *this, maMutex ) ) diff --git a/svx/source/unodraw/unottabl.cxx b/svx/source/unodraw/unottabl.cxx index 2ad927a35716..9653f36360bb 100644 --- a/svx/source/unodraw/unottabl.cxx +++ b/svx/source/unodraw/unottabl.cxx @@ -32,6 +32,8 @@ using namespace ::com::sun::star; using namespace ::cppu; +namespace { + class SvxUnoTransGradientTable : public SvxUnoNameItemTable { public: @@ -47,6 +49,8 @@ public: virtual uno::Type SAL_CALL getElementType( ) override; }; +} + SvxUnoTransGradientTable::SvxUnoTransGradientTable( SdrModel* pModel ) throw() : SvxUnoNameItemTable( pModel, XATTR_FILLFLOATTRANSPARENCE, MID_FILLGRADIENT ) { diff --git a/svx/source/xml/xmlxtexp.cxx b/svx/source/xml/xmlxtexp.cxx index 400146ce579b..4ec6f5aeb8db 100644 --- a/svx/source/xml/xmlxtexp.cxx +++ b/svx/source/xml/xmlxtexp.cxx @@ -65,6 +65,8 @@ using namespace cppu; using com::sun::star::embed::XTransactedObject; +namespace { + class SvxXMLTableEntryExporter { public: @@ -134,6 +136,7 @@ public: virtual void exportEntry( const OUString& rStrName, const Any& rValue ) override; }; +} SvxXMLXTableExportComponent::SvxXMLXTableExportComponent( const css::uno::Reference< css::uno::XComponentContext >& rContext, diff --git a/svx/source/xml/xmlxtimp.cxx b/svx/source/xml/xmlxtimp.cxx index bb2c67e39475..570ae8df777f 100644 --- a/svx/source/xml/xmlxtimp.cxx +++ b/svx/source/xml/xmlxtimp.cxx @@ -69,8 +69,6 @@ namespace { enum class SvxXMLTableImportContextEnum { Color, Marker, Dash, Hatch, Gradient, Bitmap }; -} - class SvxXMLTableImportContext : public SvXMLImportContext { public: @@ -93,6 +91,7 @@ private: bool const mbOOoFormat; }; +} SvxXMLTableImportContext::SvxXMLTableImportContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, SvxXMLTableImportContextEnum eContext, const uno::Reference< XNameContainer >& xTable, bool bOOoFormat ) : SvXMLImportContext( rImport, nPrfx, rLName ), mxTable( xTable ), meContext( eContext ), diff --git a/sw/qa/core/test_ToxLinkProcessor.cxx b/sw/qa/core/test_ToxLinkProcessor.cxx index 01e349a5fea5..2e65c2ff6c28 100644 --- a/sw/qa/core/test_ToxLinkProcessor.cxx +++ b/sw/qa/core/test_ToxLinkProcessor.cxx @@ -87,6 +87,8 @@ ToxLinkProcessorTest::AddingAndClosingTwoOverlappingLinksResultsInOneClosedLink( CPPUNIT_ASSERT_EQUAL(URL_1, sut.m_ClosedLinks[0]->mINetFormat.GetValue()); } +namespace { + class ToxLinkProcessorWithOverriddenObtainPoolId : public ToxLinkProcessor { public: virtual sal_uInt16 @@ -101,6 +103,8 @@ public: } }; +} + void ToxLinkProcessorTest::LinkIsCreatedCorrectly() { diff --git a/sw/qa/core/test_ToxTextGenerator.cxx b/sw/qa/core/test_ToxTextGenerator.cxx index e46e40ab4776..a2d347536a65 100644 --- a/sw/qa/core/test_ToxTextGenerator.cxx +++ b/sw/qa/core/test_ToxTextGenerator.cxx @@ -51,6 +51,8 @@ public: }; +namespace { + struct MockedSortTab : public SwTOXSortTabBase { MockedSortTab() : SwTOXSortTabBase(TOX_SORT_INDEX,nullptr,nullptr,nullptr) {} @@ -63,6 +65,8 @@ struct MockedSortTab : public SwTOXSortTabBase { } }; +} + void ToxTextGeneratorTest::EmptyStringIsReturnedForPageNumberPlaceholderOfZeroItems() { @@ -109,6 +113,8 @@ ToxTextGeneratorTest::EmptyStringIsReturnedAsNumStringIfToxSourcesIsEmpty() CPPUNIT_ASSERT_EQUAL(expected, actual); } +namespace { + class MockedToxTabStopTokenHandler : public ToxTabStopTokenHandler { public: virtual HandledTabStopToken @@ -140,6 +146,8 @@ private: SwChapterField mChapterField; }; +} + void ToxTextGeneratorTest::ChapterNumberWithoutTextIsGeneratedForNoprepstTitle() { diff --git a/sw/qa/extras/accessibility/accessible_relation_set.cxx b/sw/qa/extras/accessibility/accessible_relation_set.cxx index 9efcc8ec060c..faf05c8c7daa 100644 --- a/sw/qa/extras/accessibility/accessible_relation_set.cxx +++ b/sw/qa/extras/accessibility/accessible_relation_set.cxx @@ -38,6 +38,8 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::accessibility; using namespace css::lang; +namespace +{ class AccessibilityTools { public: @@ -45,6 +47,7 @@ public: getAccessibleObjectForRole(const css::uno::Reference<css::accessibility::XAccessible>& xacc, sal_Int16 role); }; +} css::uno::Reference<css::accessibility::XAccessibleContext> AccessibilityTools::getAccessibleObjectForRole( diff --git a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx index c3f700aa3a92..7ccadb2ba4c7 100644 --- a/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx +++ b/sw/qa/extras/ooxmlexport/ooxmlexport2.cxx @@ -332,6 +332,8 @@ DECLARE_OOXMLEXPORT_TEST(testTable, "table.odt") assertXPath(pXmlDocCT, "//w:style[@w:styleId='Normal']/w:qFormat", 1); } +namespace { + struct SingleLineBorders { sal_Int16 top, bottom, left, right; SingleLineBorders(int t=0, int b=0, int l=0, int r=0) @@ -348,6 +350,8 @@ struct SingleLineBorders { } }; +} + DECLARE_OOXMLEXPORT_TEST(testTableBorders, "table-borders.docx") { uno::Reference<text::XTextTablesSupplier> xTablesSupplier(mxComponent, uno::UNO_QUERY); diff --git a/sw/qa/extras/tiledrendering/tiledrendering.cxx b/sw/qa/extras/tiledrendering/tiledrendering.cxx index e6b624a5cb1e..0e01db65ba67 100644 --- a/sw/qa/extras/tiledrendering/tiledrendering.cxx +++ b/sw/qa/extras/tiledrendering/tiledrendering.cxx @@ -714,6 +714,8 @@ void SwTiledRenderingTest::testPartHash() } } +namespace { + /// A view callback tracks callbacks invoked on one specific view. class ViewCallback { @@ -923,6 +925,8 @@ public: } }; +} + void SwTiledRenderingTest::testMissingInvalidation() { comphelper::LibreOfficeKit::setActive(); diff --git a/sw/qa/extras/uiwriter/uiwriter.cxx b/sw/qa/extras/uiwriter/uiwriter.cxx index 49ff03a594c1..27cd93fb857e 100644 --- a/sw/qa/extras/uiwriter/uiwriter.cxx +++ b/sw/qa/extras/uiwriter/uiwriter.cxx @@ -4057,6 +4057,8 @@ void SwUiWriterTest::testDde() #endif } +namespace { + //IdleTask class to add a low priority Idle task class IdleTask { @@ -4069,6 +4071,8 @@ class IdleTask Idle maIdle; }; +} + //constructor of IdleTask Class IdleTask::IdleTask() : flag( false ) { @@ -4254,6 +4258,8 @@ void SwUiWriterTest::testTdf87922() } #if HAVE_MORE_FONTS +namespace { + struct PortionItem { PortionItem(OUString const & sItemType, sal_Int32 nLength, @@ -4310,6 +4316,8 @@ class PortionHandler : public SwPortionHandler mPortionItems.emplace_back("finish", 0, PortionType::NONE); } }; + +} #endif void SwUiWriterTest::testTdf77014() diff --git a/sw/source/core/access/accmap.cxx b/sw/source/core/access/accmap.cxx index 3a35b5c03e26..df641292b4f0 100644 --- a/sw/source/core/access/accmap.cxx +++ b/sw/source/core/access/accmap.cxx @@ -81,6 +81,8 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::accessibility; using namespace ::sw::access; +namespace { + struct SwFrameFunc { bool operator()( const SwFrame * p1, const SwFrame * p2) const @@ -89,6 +91,8 @@ struct SwFrameFunc } }; +} + class SwAccessibleContextMap_Impl { public: @@ -122,6 +126,8 @@ public: iterator erase(const_iterator const & pos) { return maMap.erase(pos); } }; +namespace { + class SwDrawModellListener_Impl : public SfxListener, public ::cppu::WeakImplHelper< document::XShapeEventBroadcaster > { @@ -146,6 +152,8 @@ public: void Dispose(); }; +} + SwDrawModellListener_Impl::SwDrawModellListener_Impl( SdrModel *pDrawModel ) : maEventListeners( maListenerMutex ), mpDrawModel( pDrawModel ) @@ -252,6 +260,8 @@ void SwDrawModellListener_Impl::Dispose() mpDrawModel = nullptr; } +namespace { + struct SwShapeFunc { bool operator()( const SdrObject * p1, const SdrObject * p2) const @@ -259,6 +269,9 @@ struct SwShapeFunc return p1 < p2; } }; + +} + typedef std::pair < const SdrObject *, ::rtl::Reference < ::accessibility::AccessibleShape > > SwAccessibleObjShape_Impl; class SwAccessibleShapeMap_Impl @@ -599,6 +612,8 @@ void SwAccessibleEventList_Impl::MoveMissingXAccToEnd() assert(size() == nSize); } +namespace { + struct SwAccessibleChildFunc { bool operator()( const SwAccessibleChild& r1, @@ -618,6 +633,8 @@ struct SwAccessibleChildFunc } }; +} + class SwAccessibleEventMap_Impl { public: @@ -637,6 +654,8 @@ public: iterator erase(const_iterator const & pos) { return maMap.erase(pos); } }; +namespace { + struct SwAccessibleParaSelection { TextFrameIndex const nStartOfSelection; @@ -658,6 +677,8 @@ struct SwXAccWeakRefComp } }; +} + class SwAccessibleSelectedParas_Impl { public: @@ -791,6 +812,8 @@ void SwAccPreviewData::InvalidateSelection( const SwPageFrame* _pSelectedPageFra assert(mpSelPage); } +namespace { + struct ContainsPredicate { const Point& mrPoint; @@ -801,6 +824,7 @@ struct ContainsPredicate } }; +} void SwAccPreviewData::AdjustMapMode( MapMode& rMapMode, const Point& rPoint ) const diff --git a/sw/source/core/access/accpara.cxx b/sw/source/core/access/accpara.cxx index e50c0a3a9c7f..1df390906ce9 100644 --- a/sw/source/core/access/accpara.cxx +++ b/sw/source/core/access/accpara.cxx @@ -1147,6 +1147,8 @@ css::uno::Sequence< css::style::TabStop > SwAccessibleParagraph::GetCurrentTabSt return tabs; } +namespace { + struct IndexCompare { const PropertyValue* pValues; @@ -1157,6 +1159,8 @@ struct IndexCompare } }; +} + OUString SwAccessibleParagraph::GetFieldTypeNameAtIndex(sal_Int32 nIndex) { OUString strTypeName; @@ -2694,6 +2698,8 @@ void SwAccessibleParagraph::deselectAccessibleChild( // XAccessibleHypertext +namespace { + class SwHyperlinkIter_Impl { SwTextFrame const& m_rFrame; @@ -2709,6 +2715,8 @@ public: TextFrameIndex endIdx() const { return m_nEnd; } }; +} + SwHyperlinkIter_Impl::SwHyperlinkIter_Impl(const SwTextFrame & rTextFrame) : m_rFrame(rTextFrame) , m_Iter(rTextFrame) diff --git a/sw/source/core/access/acctable.cxx b/sw/source/core/access/acctable.cxx index 6bb085d6a3bc..426d448327f3 100644 --- a/sw/source/core/access/acctable.cxx +++ b/sw/source/core/access/acctable.cxx @@ -59,6 +59,8 @@ typedef std::pair < sal_Int32, sal_Int32 > Int32Pair_Impl; const unsigned int SELECTION_WITH_NUM = 10; +namespace { + class SwAccTableSelHander_Impl { public: @@ -68,6 +70,8 @@ protected: ~SwAccTableSelHander_Impl() {} }; +} + class SwAccessibleTableData_Impl { SwAccessibleMap& mrAccMap; @@ -474,6 +478,8 @@ void SwAccessibleTableData_Impl::GetRowColumnAndExtent( rColumnExtent = nColumnEnd - rColumn; } +namespace { + class SwAccSingleTableSelHander_Impl : public SwAccTableSelHander_Impl { bool m_bSelected; @@ -489,6 +495,8 @@ public: virtual void Unselect( sal_Int32, sal_Int32 ) override; }; +} + inline SwAccSingleTableSelHander_Impl::SwAccSingleTableSelHander_Impl() : m_bSelected( true ) { @@ -499,6 +507,8 @@ void SwAccSingleTableSelHander_Impl::Unselect( sal_Int32, sal_Int32 ) m_bSelected = false; } +namespace { + class SwAccAllTableSelHander_Impl : public SwAccTableSelHander_Impl { @@ -518,6 +528,8 @@ public: virtual ~SwAccAllTableSelHander_Impl(); }; +} + SwAccAllTableSelHander_Impl::~SwAccAllTableSelHander_Impl() { } diff --git a/sw/source/core/crsr/DateFormFieldButton.cxx b/sw/source/core/crsr/DateFormFieldButton.cxx index 4ecaf15dbfba..d5c44f121f42 100644 --- a/sw/source/core/crsr/DateFormFieldButton.cxx +++ b/sw/source/core/crsr/DateFormFieldButton.cxx @@ -15,6 +15,8 @@ #include <tools/date.hxx> #include <svl/zforlist.hxx> +namespace +{ class SwDatePickerDialog : public FloatingWindow { private: @@ -30,6 +32,7 @@ public: virtual ~SwDatePickerDialog() override; virtual void dispose() override; }; +} SwDatePickerDialog::SwDatePickerDialog(SwEditWin* parent, sw::mark::DateFieldmark* pFieldmark, SvNumberFormatter* pNumberFormatter) diff --git a/sw/source/core/crsr/DropDownFormFieldButton.cxx b/sw/source/core/crsr/DropDownFormFieldButton.cxx index 7a42bf7c853f..916d6ab1a8b7 100644 --- a/sw/source/core/crsr/DropDownFormFieldButton.cxx +++ b/sw/source/core/crsr/DropDownFormFieldButton.cxx @@ -18,6 +18,8 @@ #include <docsh.hxx> #include <strings.hrc> +namespace +{ /** * Popup dialog for drop-down form field showing the list items of the field. * The user can select the item using this popup while filling in a form. @@ -35,6 +37,7 @@ public: virtual ~SwFieldDialog() override; virtual void dispose() override; }; +} SwFieldDialog::SwFieldDialog(SwEditWin* parent, sw::mark::IFieldmark* fieldBM, long nMinListWidth) : FloatingWindow(parent, WB_BORDER | WB_SYSTEMWINDOW) diff --git a/sw/source/core/crsr/crsrsh.cxx b/sw/source/core/crsr/crsrsh.cxx index 967743a2a2dc..838159a28034 100644 --- a/sw/source/core/crsr/crsrsh.cxx +++ b/sw/source/core/crsr/crsrsh.cxx @@ -1530,6 +1530,8 @@ static void lcl_CheckHiddenPara( SwPosition& rPos ) rPos = SwPosition( aTmp, SwIndex( pTextNd, 0 ) ); } +namespace { + // #i27301# - helper class that notifies the accessibility about invalid text // selections in its destructor class SwNotifyAccAboutInvalidTextSelections @@ -1548,6 +1550,8 @@ class SwNotifyAccAboutInvalidTextSelections } }; +} + void SwCursorShell::UpdateCursor( sal_uInt16 eFlags, bool bIdleEnd ) { SET_CURR_SHELL( this ); diff --git a/sw/source/core/crsr/findattr.cxx b/sw/source/core/crsr/findattr.cxx index 7f35f3c37351..51518bccad35 100644 --- a/sw/source/core/crsr/findattr.cxx +++ b/sw/source/core/crsr/findattr.cxx @@ -174,6 +174,8 @@ static bool lcl_SearchAttr( const SwTextNode& rTextNd, SwPaM& rPam, return false; } +namespace { + /// search for multiple text attributes struct SwSrchChrAttr { @@ -221,6 +223,8 @@ public: bool SetAttrBwd( const SwTextAttr& rAttr ); }; +} + SwAttrCheckArr::SwAttrCheckArr( const SfxItemSet& rSet, bool bFwd, bool bNoCollections ) : m_nNodeStart(0) @@ -1200,6 +1204,8 @@ static bool FindAttrsImpl(SwPaM & rSearchPam, return bFound; } +namespace { + /// parameters for search for attributes struct SwFindParaAttr : public SwFindParas { @@ -1227,6 +1233,8 @@ struct SwFindParaAttr : public SwFindParas virtual bool IsReplaceMode() const override; }; +} + int SwFindParaAttr::DoFind(SwPaM & rCursor, SwMoveFnCollection const & fnMove, const SwPaM & rRegion, bool bInReadOnly) { diff --git a/sw/source/core/crsr/findcoll.cxx b/sw/source/core/crsr/findcoll.cxx index ec033d6bb207..f80fff2c10ee 100644 --- a/sw/source/core/crsr/findcoll.cxx +++ b/sw/source/core/crsr/findcoll.cxx @@ -26,6 +26,8 @@ #include <SwRewriter.hxx> #include <strings.hrc> +namespace { + /// parameters for a search for FormatCollections struct SwFindParaFormatColl : public SwFindParas { @@ -43,6 +45,8 @@ struct SwFindParaFormatColl : public SwFindParas virtual bool IsReplaceMode() const override; }; +} + int SwFindParaFormatColl::DoFind(SwPaM & rCursor, SwMoveFnCollection const & fnMove, const SwPaM & rRegion, bool bInReadOnly) { diff --git a/sw/source/core/crsr/findtxt.cxx b/sw/source/core/crsr/findtxt.cxx index 683904754e5a..d9658bc75335 100644 --- a/sw/source/core/crsr/findtxt.cxx +++ b/sw/source/core/crsr/findtxt.cxx @@ -54,6 +54,8 @@ using namespace ::com::sun::star; using namespace util; +namespace { + /// because the Find may be called on the View or the Model, we need an index /// afflicted by multiple personality disorder struct AmbiguousIndex @@ -174,6 +176,8 @@ public: } }; +} + static OUString lcl_CleanStr(const SwTextNode& rNd, SwTextFrame const*const pFrame, @@ -891,6 +895,8 @@ bool DoSearch(SwPaM & rSearchPam, return bFound; } +namespace { + /// parameters for search and replace in text struct SwFindParaText : public SwFindParas { @@ -915,6 +921,8 @@ struct SwFindParaText : public SwFindParas virtual ~SwFindParaText(); }; +} + SwFindParaText::~SwFindParaText() { } diff --git a/sw/source/core/crsr/swcrsr.cxx b/sw/source/core/crsr/swcrsr.cxx index 5509b9f33027..611430d7113b 100644 --- a/sw/source/core/crsr/swcrsr.cxx +++ b/sw/source/core/crsr/swcrsr.cxx @@ -58,6 +58,8 @@ using namespace ::com::sun::star::i18n; static const sal_uInt16 coSrchRplcThreshold = 60000; +namespace { + struct PercentHdl { SwDocShell* const pDSh; @@ -115,6 +117,8 @@ struct PercentHdl } }; +} + SwCursor::SwCursor( const SwPosition &rPos, SwPaM* pRing ) : SwPaM( rPos, pRing ) , m_nRowSpanOffset(0) diff --git a/sw/source/core/doc/doc.cxx b/sw/source/core/doc/doc.cxx index 246ffc1a5c8a..4ad631e560b2 100644 --- a/sw/source/core/doc/doc.cxx +++ b/sw/source/core/doc/doc.cxx @@ -461,6 +461,8 @@ void SwDoc::ChgDBData(const SwDBData& rNewData) getIDocumentFieldsAccess().GetSysFieldType(SwFieldIds::DatabaseName)->UpdateFields(); } +namespace { + struct PostItField_ : public SetGetExpField { PostItField_( const SwNodeIndex& rNdIdx, const SwTextField* pField ) @@ -476,6 +478,8 @@ struct PostItField_ : public SetGetExpField } }; +} + sal_uInt16 PostItField_::GetPageNo( const StringRangeEnumerator &rRangeEnum, const std::set< sal_Int32 > &rPossiblePages, diff --git a/sw/source/core/doc/docbm.cxx b/sw/source/core/doc/docbm.cxx index c0c973904bf5..dec1b3d58654 100644 --- a/sw/source/core/doc/docbm.cxx +++ b/sw/source/core/doc/docbm.cxx @@ -1117,6 +1117,8 @@ namespace sw { namespace mark lcl_DebugMarks(m_vAllMarks); } + namespace { + struct LazyFieldmarkDeleter : public IDocumentMarkAccess::ILazyDeleter { std::unique_ptr<Fieldmark> m_pFieldmark; @@ -1136,6 +1138,8 @@ namespace sw { namespace mark } }; + } + std::unique_ptr<IDocumentMarkAccess::ILazyDeleter> MarkManager::deleteMark(const const_iterator_t& ppMark) { diff --git a/sw/source/core/doc/doccomp.cxx b/sw/source/core/doc/doccomp.cxx index 534f471e9310..e3562414907d 100644 --- a/sw/source/core/doc/doccomp.cxx +++ b/sw/source/core/doc/doccomp.cxx @@ -47,6 +47,8 @@ using namespace ::com::sun::star; using std::vector; +namespace { + class SwCompareLine { const SwNode& rNode; @@ -307,8 +309,13 @@ struct CmpOptionsContainer int nIgnoreLen; bool bUseRsid; }; + +} + static CmpOptionsContainer CmpOptions; +namespace { + class CommonSubseq { private: @@ -372,6 +379,8 @@ public: } }; +} + CompareData::~CompareData() { if( pDelRing ) diff --git a/sw/source/core/doc/docedt.cxx b/sw/source/core/doc/docedt.cxx index 7ecb764e30b5..3cc2e8b6144c 100644 --- a/sw/source/core/doc/docedt.cxx +++ b/sw/source/core/doc/docedt.cxx @@ -721,6 +721,8 @@ uno::Any SwDoc::Spell( SwPaM& rPaM, return aRet; } +namespace { + class SwHyphArgs : public SwInterHyphInfo { const SwNode *pStart; @@ -744,6 +746,8 @@ public: sal_uInt16 *GetPageSt() { return pPageSt; } }; +} + SwHyphArgs::SwHyphArgs( const SwPaM *pPam, const Point &rCursorPos, sal_uInt16* pPageCount, sal_uInt16* pPageStart ) : SwInterHyphInfo( rCursorPos ), pNode(nullptr), diff --git a/sw/source/core/doc/doctxm.cxx b/sw/source/core/doc/doctxm.cxx index d429af8bdf89..1526f0bd347e 100644 --- a/sw/source/core/doc/doctxm.cxx +++ b/sw/source/core/doc/doctxm.cxx @@ -192,6 +192,8 @@ void SwDoc::DeleteTOXMark( const SwTOXMark* pTOXMark ) getIDocumentState().SetModified(); } +namespace { + /// Travel between table of content Marks class CompareNodeContent { @@ -219,6 +221,8 @@ public: ( nNode == rCmp.nNode && nContent >= rCmp.nContent); } }; +} + const SwTOXMark& SwDoc::GotoTOXMark( const SwTOXMark& rCurTOXMark, SwTOXSearch eDir, bool bInReadOnly ) { diff --git a/sw/source/core/doc/gctable.cxx b/sw/source/core/doc/gctable.cxx index 493ef4248c91..ddcf9e20c0f4 100644 --- a/sw/source/core/doc/gctable.cxx +++ b/sw/source/core/doc/gctable.cxx @@ -319,6 +319,8 @@ static void lcl_GC_Box_Border( const SwTableBox* pBox, SwGCLineBorder* pPara ) } } +namespace { + struct GCLinePara { SwTableLines* pLns; @@ -329,6 +331,8 @@ struct GCLinePara {} }; +} + static bool lcl_MergeGCLine(SwTableLine* pLine, GCLinePara* pPara); static bool lcl_MergeGCBox(SwTableBox* pTableBox, GCLinePara* pPara) diff --git a/sw/source/core/doc/htmltbl.cxx b/sw/source/core/doc/htmltbl.cxx index 2873c98161e5..8e6f8ac1d446 100644 --- a/sw/source/core/doc/htmltbl.cxx +++ b/sw/source/core/doc/htmltbl.cxx @@ -48,6 +48,8 @@ using namespace ::com::sun::star; #define COLFUZZY 20 #define MAX_TABWIDTH (USHRT_MAX - 2001) +namespace { + class SwHTMLTableLayoutConstraints { sal_uInt16 const nRow; // start row @@ -72,6 +74,8 @@ public: sal_uInt16 GetColumn() const { return nCol; } }; +} + SwHTMLTableLayoutCnts::SwHTMLTableLayoutCnts(const SwStartNode *pSttNd, std::shared_ptr<SwHTMLTableLayout> const& rTab, bool bNoBrTag, diff --git a/sw/source/core/doc/number.cxx b/sw/source/core/doc/number.cxx index f57933440278..44b59a283faf 100644 --- a/sw/source/core/doc/number.cxx +++ b/sw/source/core/doc/number.cxx @@ -1050,6 +1050,8 @@ void SwNumRule::SetGrabBagItem(const uno::Any& rVal) namespace numfunc { + namespace { + /** class containing default bullet list configuration data */ class SwDefBulletConfig : private utl::ConfigItem { @@ -1112,8 +1114,6 @@ namespace numfunc std::unique_ptr<vcl::Font> mpFont; }; - namespace - { class theSwDefBulletConfig : public rtl::Static<SwDefBulletConfig, theSwDefBulletConfig>{}; } @@ -1276,6 +1276,8 @@ namespace numfunc return SwDefBulletConfig::getInstance().GetChar( nLevel ); } + namespace { + /** class containing configuration data about user interface behavior regarding lists and list items. configuration item about behavior of <TAB>/<SHIFT-TAB>-key at first @@ -1312,8 +1314,6 @@ namespace numfunc bool mbChangeIndentOnTabAtFirstPosOfFirstListItem; }; - namespace - { class theSwNumberingUIBehaviorConfig : public rtl::Static<SwNumberingUIBehaviorConfig, theSwNumberingUIBehaviorConfig>{}; } diff --git a/sw/source/core/doc/swstylemanager.cxx b/sw/source/core/doc/swstylemanager.cxx index abb217bcf80b..3af1b80d7596 100644 --- a/sw/source/core/doc/swstylemanager.cxx +++ b/sw/source/core/doc/swstylemanager.cxx @@ -26,6 +26,8 @@ typedef std::unordered_map< OUString, std::shared_ptr<SfxItemSet> > SwStyleNameCache; +namespace { + class SwStyleCache { SwStyleNameCache mMap; @@ -37,6 +39,8 @@ public: std::shared_ptr<SfxItemSet> getByName( const OUString& rName ) { return mMap[rName]; } }; +} + void SwStyleCache::addCompletePool( StylePool& rPool ) { std::unique_ptr<IStylePoolIteratorAccess> pIter = rPool.createIterator(); @@ -49,6 +53,8 @@ void SwStyleCache::addCompletePool( StylePool& rPool ) } } +namespace { + class SwStyleManager : public IStyleAccess { StylePool aAutoCharPool; @@ -74,6 +80,8 @@ public: virtual void clearCaches() override; }; +} + std::unique_ptr<IStyleAccess> createStyleManager( SfxItemSet const * pIgnorableParagraphItems ) { return std::make_unique<SwStyleManager>( pIgnorableParagraphItems ); diff --git a/sw/source/core/doc/tblrwcl.cxx b/sw/source/core/doc/tblrwcl.cxx index 1c295d097a6a..dd150db18b2a 100644 --- a/sw/source/core/doc/tblrwcl.cxx +++ b/sw/source/core/doc/tblrwcl.cxx @@ -69,6 +69,8 @@ using namespace com::sun::star::uno; #define CHECK_TABLE(t) #endif +namespace { + // In order to set the Frame Formats for the Boxes, it's enough to look // up the current one in the array. If it's already there return the new one. struct CpyTabFrame @@ -121,6 +123,8 @@ struct CR_SetBoxWidth } }; +} + static bool lcl_SetSelBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, SwTwips nDist, bool bCheck ); static bool lcl_SetOtherBoxWidth( SwTableLine* pLine, CR_SetBoxWidth& rParam, @@ -161,6 +165,8 @@ typedef bool (*FN_lcl_SetBoxWidth)(SwTableLine*, CR_SetBoxWidth&, SwTwips, bool #endif // DBG_UTIL +namespace { + struct CR_SetLineHeight { SwTableNode* pTableNd; @@ -183,6 +189,8 @@ struct CR_SetLineHeight {} }; +} + static bool lcl_SetSelLineHeight( SwTableLine* pLine, const CR_SetLineHeight& rParam, SwTwips nDist, bool bCheck ); static bool lcl_SetOtherLineHeight( SwTableLine* pLine, const CR_SetLineHeight& rParam, @@ -192,6 +200,8 @@ typedef bool (*FN_lcl_SetLineHeight)(SwTableLine*, CR_SetLineHeight&, SwTwips, b typedef o3tl::sorted_vector<CpyTabFrame> CpyTabFrames; +namespace { + struct CpyPara { std::shared_ptr< std::vector< std::vector< sal_uLong > > > pWidths; @@ -233,6 +243,8 @@ struct CpyPara {} }; +} + static void lcl_CopyRow(FndLine_ & rFndLine, CpyPara *const pCpyPara); static void lcl_CopyCol( FndBox_ & rFndBox, CpyPara *const pCpyPara) @@ -1306,6 +1318,8 @@ static void lcl_CalcWidth( SwTableBox* pBox ) pFormat->ResetFormatAttr( RES_BOXATR_BEGIN, RES_BOXATR_END - 1 ); } +namespace { + struct InsULPara { SwTableNode* pTableNd; @@ -1331,6 +1345,8 @@ struct InsULPara { bUL_LR = true; bUL = false; if( pLine ) pInsLine = pLine; } }; +} + static void lcl_Merge_MoveLine(FndLine_ & rFndLine, InsULPara *const pULPara); static void lcl_Merge_MoveBox(FndBox_ & rFndBox, InsULPara *const pULPara) diff --git a/sw/source/core/docnode/ndcopy.cxx b/sw/source/core/docnode/ndcopy.cxx index e08835cf66e1..6f97cc44db57 100644 --- a/sw/source/core/docnode/ndcopy.cxx +++ b/sw/source/core/docnode/ndcopy.cxx @@ -38,6 +38,7 @@ #define CHECK_TABLE(t) #endif +namespace { // Structure for the mapping from old and new frame formats to the // boxes and lines of a table @@ -50,6 +51,8 @@ struct MapTableFrameFormat {} }; +} + typedef std::vector<MapTableFrameFormat> MapTableFrameFormats; SwContentNode* SwTextNode::MakeCopy(SwDoc* pDoc, const SwNodeIndex& rIdx, bool const bNewFrames) const @@ -118,6 +121,8 @@ static bool lcl_SrchNew( const MapTableFrameFormat& rMap, SwFrameFormat** pPara return false; } +namespace { + struct CopyTable { SwDoc* m_pDoc; @@ -135,6 +140,8 @@ struct CopyTable {} }; +} + static void lcl_CopyTableLine( const SwTableLine* pLine, CopyTable* pCT ); static void lcl_CopyTableBox( SwTableBox* pBox, CopyTable* pCT ) diff --git a/sw/source/core/docnode/ndtbl.cxx b/sw/source/core/docnode/ndtbl.cxx index 00e249b9e0fb..c35ca9731936 100644 --- a/sw/source/core/docnode/ndtbl.cxx +++ b/sw/source/core/docnode/ndtbl.cxx @@ -1485,6 +1485,8 @@ bool SwDoc::TableToText( const SwTableNode* pTableNd, sal_Unicode cCh ) return bRet; } +namespace { + /** * Use the ForEach method from PtrArray to recreate Text from a Table. * The Boxes can also contain Lines! @@ -1500,6 +1502,8 @@ struct DelTabPara pLastNd(nullptr), rNds( rNodes ), pUndo( pU ), cCh( cChar ) {} }; +} + // Forward declare so that the Lines and Boxes can use recursion static void lcl_DelBox( SwTableBox* pBox, DelTabPara* pDelPara ); @@ -2500,11 +2504,15 @@ void SwDoc::GetTabCols( SwTabCols &rFill, const SwCellFrame* pBoxFrame ) #define ROWFUZZY 25 +namespace { + struct FuzzyCompare { bool operator() ( long s1, long s2 ) const; }; +} + bool FuzzyCompare::operator() ( long s1, long s2 ) const { return ( s1 < s2 && std::abs( s1 - s2 ) > ROWFUZZY ); @@ -3239,6 +3247,8 @@ static bool lcl_ChgTableSize( SwTable& rTable ) return true; } +namespace { + class SplitTable_Para { std::map<SwFrameFormat const *, SwFrameFormat*> aSrcDestMap; @@ -3265,6 +3275,8 @@ public: } }; +} + static void lcl_SplitTable_CpyBox( SwTableBox* pBox, SplitTable_Para* pPara ); static void lcl_SplitTable_CpyLine( SwTableLine* pLn, SplitTable_Para* pPara ) @@ -3583,6 +3595,8 @@ bool SwNodes::MergeTable( const SwNodeIndex& rPos, bool bWithPrev, return true; } +namespace { + // Use the PtrArray's ForEach method struct SetAFormatTabPara { @@ -3598,6 +3612,8 @@ struct SetAFormatTabPara {} }; +} + // Forward declare so that the Lines and Boxes can use recursion static bool lcl_SetAFormatBox(FndBox_ &, SetAFormatTabPara *pSetPara, bool bResetDirect); static bool lcl_SetAFormatLine(FndLine_ &, SetAFormatTabPara *pPara, bool bResetDirect); diff --git a/sw/source/core/docnode/ndtbl1.cxx b/sw/source/core/docnode/ndtbl1.cxx index e1b1c14159bd..c8e9db3c41a8 100644 --- a/sw/source/core/docnode/ndtbl1.cxx +++ b/sw/source/core/docnode/ndtbl1.cxx @@ -57,6 +57,8 @@ using namespace ::com::sun::star; static bool IsSame( long nA, long nB ) { return std::abs(nA-nB) <= COLFUZZY; } +namespace { + // SwTableLine::ChgFrameFormat may delete old format which doesn't have writer listeners anymore. // This may invalidate my pointers, and lead to use-after-free. For this reason, I register myself // as a writer listener for the old format here, and take care to delete formats without listeners @@ -75,6 +77,8 @@ private: sal_Int16 const nType; }; +} + SwTableFormatCmp::SwTableFormatCmp( SwFrameFormat *pO, SwFrameFormat *pN, sal_Int16 nT ) : pOld ( pO ), pNew ( pN ), nType( nT ) { @@ -174,6 +178,8 @@ static bool lcl_IsAnLower( const SwTableLine *pLine, const SwTableLine *pAssumed return false; } +namespace { + struct LinesAndTable { std::vector<SwTableLine*> &m_rLines; @@ -184,6 +190,8 @@ struct LinesAndTable m_rLines(rL), m_rTable(rTable), m_bInsertLines(true) {} }; +} + static bool FindLine_( FndLine_ & rLine, LinesAndTable* pPara ); static bool FindBox_( FndBox_ & rBox, LinesAndTable* pPara ) diff --git a/sw/source/core/docnode/nodes.cxx b/sw/source/core/docnode/nodes.cxx index 2feef62276df..10cc05aec7af 100644 --- a/sw/source/core/docnode/nodes.cxx +++ b/sw/source/core/docnode/nodes.cxx @@ -1395,12 +1395,16 @@ void SwNodes::DelNodes( const SwNodeIndex & rStart, sal_uLong nCnt ) } } +namespace { + struct HighLevel { sal_uInt16 nLevel, nTop; explicit HighLevel( sal_uInt16 nLv ) : nLevel( nLv ), nTop( nLv ) {} }; +} + static bool lcl_HighestLevel( const SwNodePtr& rpNode, void * pPara ) { HighLevel * pHL = static_cast<HighLevel*>(pPara); diff --git a/sw/source/core/docnode/section.cxx b/sw/source/core/docnode/section.cxx index 21e4247cfc62..5ee2c0cda4c1 100644 --- a/sw/source/core/docnode/section.cxx +++ b/sw/source/core/docnode/section.cxx @@ -65,6 +65,8 @@ using namespace ::com::sun::star; +namespace { + class SwIntrnlSectRefLink : public SwBaseLink { SwSectionFormat& rSectFormat; @@ -88,6 +90,7 @@ public: } }; +} SwSectionData::SwSectionData(SectionType const eType, OUString const& rName) : m_eType(eType) diff --git a/sw/source/core/docnode/swthreadmanager.cxx b/sw/source/core/docnode/swthreadmanager.cxx index cadbfda29887..4b646e8b22df 100644 --- a/sw/source/core/docnode/swthreadmanager.cxx +++ b/sw/source/core/docnode/swthreadmanager.cxx @@ -39,8 +39,12 @@ SwThreadManager::~SwThreadManager() { } +namespace { + struct InitInstance : public rtl::Static<SwThreadManager, InitInstance> {}; +} + SwThreadManager& SwThreadManager::GetThreadManager() { return InitInstance::get(); diff --git a/sw/source/core/draw/dcontact.cxx b/sw/source/core/draw/dcontact.cxx index 5ffe5728fd49..82548ced5a6f 100644 --- a/sw/source/core/draw/dcontact.cxx +++ b/sw/source/core/draw/dcontact.cxx @@ -1992,6 +1992,8 @@ namespace sdr { namespace contact { + namespace { + class VOCOfDrawVirtObj : public ViewObjectContactOfSdrObj { protected: @@ -2035,6 +2037,8 @@ namespace sdr return static_cast<SwDrawVirtObj&>(mrObject); } }; + + } } // end of namespace contact } // end of namespace sdr diff --git a/sw/source/core/draw/dflyobj.cxx b/sw/source/core/draw/dflyobj.cxx index e21f3f35b992..37778cfd9f86 100644 --- a/sw/source/core/draw/dflyobj.cxx +++ b/sw/source/core/draw/dflyobj.cxx @@ -75,6 +75,8 @@ namespace sdr { namespace contact { + namespace { + /** * @see #i95264# * @@ -100,6 +102,8 @@ namespace sdr } }; + } + drawinglayer::primitive2d::Primitive2DContainer VCOfSwFlyDrawObj::createViewIndependentPrimitive2DSequence() const { // currently gets not visualized, return empty sequence @@ -148,6 +152,8 @@ namespace drawinglayer { namespace primitive2d { + namespace { + class SwVirtFlyDrawObjPrimitive : public BufferedDecompositionPrimitive2D { private: @@ -182,6 +188,8 @@ namespace drawinglayer /// provide unique ID DeclPrimitive2DIDBlock() }; + + } } // end of namespace primitive2d } // end of namespace drawinglayer @@ -252,6 +260,8 @@ namespace sdr { namespace contact { + namespace { + class VCOfSwVirtFlyDrawObj : public ViewContactOfVirtObj { protected: @@ -274,6 +284,8 @@ namespace sdr return static_cast<SwVirtFlyDrawObj&>(mrObject); } }; + + } } // end of namespace contact } // end of namespace sdr diff --git a/sw/source/core/draw/dview.cxx b/sw/source/core/draw/dview.cxx index c1a7b6a8cbbc..fd69be2ca96a 100644 --- a/sw/source/core/draw/dview.cxx +++ b/sw/source/core/draw/dview.cxx @@ -58,6 +58,8 @@ using namespace com::sun::star; +namespace { + class SwSdrHdl : public SdrHdl { public: @@ -66,6 +68,8 @@ public: virtual bool IsFocusHdl() const override; }; +} + bool SwSdrHdl::IsFocusHdl() const { if( SdrHdlKind::Anchor == eKind || SdrHdlKind::Anchor_TR == eKind ) diff --git a/sw/source/core/edit/acorrect.cxx b/sw/source/core/edit/acorrect.cxx index da544315a9ff..95e3a7e98b69 100644 --- a/sw/source/core/edit/acorrect.cxx +++ b/sw/source/core/edit/acorrect.cxx @@ -36,6 +36,8 @@ using namespace ::com::sun::star; +namespace { + class PaMIntoCursorShellRing { SwCursorShell& rSh; @@ -49,6 +51,8 @@ public: ~PaMIntoCursorShellRing(); }; +} + PaMIntoCursorShellRing::PaMIntoCursorShellRing( SwCursorShell& rCSh, SwPaM& rShCursor, SwPaM& rPam ) : rSh( rCSh ), rDelPam( rPam ), rCursor( rShCursor ) diff --git a/sw/source/core/edit/edlingu.cxx b/sw/source/core/edit/edlingu.cxx index fa1078cdecf7..ef4c5af85743 100644 --- a/sw/source/core/edit/edlingu.cxx +++ b/sw/source/core/edit/edlingu.cxx @@ -60,6 +60,8 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using namespace ::com::sun::star::linguistic2; +namespace { + class SwLinguIter { SwEditShell *pSh; @@ -101,8 +103,12 @@ struct SpellContentPosition sal_Int32 nRight; }; +} + typedef std::vector<SpellContentPosition> SpellContentPositions; +namespace { + class SwSpellIter : public SwLinguIter { uno::Reference< XSpellChecker1 > xSpeller; @@ -172,6 +178,8 @@ public: void ShowSelection(); }; +} + static SwSpellIter* g_pSpellIter = nullptr; static SwConvIter* g_pConvIter = nullptr; static SwHyphIter* g_pHyphIter = nullptr; diff --git a/sw/source/core/fields/ddefld.cxx b/sw/source/core/fields/ddefld.cxx index e1e5ce3daf23..7d6c91d31d17 100644 --- a/sw/source/core/fields/ddefld.cxx +++ b/sw/source/core/fields/ddefld.cxx @@ -40,6 +40,8 @@ using namespace ::com::sun::star; #define DDE_TXT_ENCODING osl_getThreadTextEncoding() +namespace { + class SwIntrnlRefLink : public SwBaseLink { SwDDEFieldType& rFieldType; @@ -57,6 +59,8 @@ public: virtual bool IsInRange( sal_uLong nSttNd, sal_uLong nEndNd ) const override; }; +} + ::sfx2::SvBaseLink::UpdateResult SwIntrnlRefLink::DataChanged( const OUString& rMimeType, const uno::Any & rValue ) { diff --git a/sw/source/core/fields/reffld.cxx b/sw/source/core/fields/reffld.cxx index 19c258c86cd3..6ffe0c8000ec 100644 --- a/sw/source/core/fields/reffld.cxx +++ b/sw/source/core/fields/reffld.cxx @@ -1249,6 +1249,8 @@ SwTextNode* SwGetRefFieldType::FindAnchor( SwDoc* pDoc, const OUString& rRefMark return pTextNd; } +namespace { + struct RefIdsMap { private: @@ -1272,6 +1274,8 @@ public: const OUString& GetName() const { return aName; } }; +} + /// Get a sorted list of the field IDs from a document. /// @param[in] rDoc The document to search. /// @param[in,out] rIds The list of IDs found in the document. diff --git a/sw/source/core/frmedt/fetab.cxx b/sw/source/core/frmedt/fetab.cxx index f6bda8ebc469..41c0b9184207 100644 --- a/sw/source/core/frmedt/fetab.cxx +++ b/sw/source/core/frmedt/fetab.cxx @@ -68,6 +68,8 @@ using namespace ::com::sun::star; static bool IsSame( long nA, long nB ) { return std::abs(nA-nB) <= COLFUZZY; } +namespace { + class TableWait { const std::unique_ptr<SwWait> m_pWait; @@ -81,6 +83,8 @@ public: { } }; +} + void SwFEShell::ParkCursorInTab() { SwCursor * pSwCursor = GetSwCursor(); diff --git a/sw/source/core/frmedt/tblsel.cxx b/sw/source/core/frmedt/tblsel.cxx index 318453df4dd4..a020bb44170c 100644 --- a/sw/source/core/frmedt/tblsel.cxx +++ b/sw/source/core/frmedt/tblsel.cxx @@ -62,6 +62,8 @@ #undef DEL_ONLY_EMPTY_LINES #undef DEL_EMPTY_BOXES_AT_START_AND_END +namespace { + struct CmpLPt { Point aPos; @@ -82,8 +84,11 @@ struct CmpLPt long Y() const { return aPos.Y(); } }; +} + typedef o3tl::sorted_vector<CmpLPt> MergePos; +namespace { struct Sort_CellFrame { @@ -93,6 +98,8 @@ struct Sort_CellFrame : pFrame( &rCFrame ) {} }; +} + static const SwLayoutFrame *lcl_FindCellFrame( const SwLayoutFrame *pLay ) { while ( pLay && !pLay->IsCellFrame() ) diff --git a/sw/source/core/layout/anchoreddrawobject.cxx b/sw/source/core/layout/anchoreddrawobject.cxx index 079468fdf062..b28c9ebf317a 100644 --- a/sw/source/core/layout/anchoreddrawobject.cxx +++ b/sw/source/core/layout/anchoreddrawobject.cxx @@ -37,6 +37,8 @@ using namespace ::com::sun::star; +namespace { + /// helper class for correct notification due to the positioning of /// the anchored drawing object class SwPosNotify @@ -53,6 +55,8 @@ class SwPosNotify Point const & LastObjPos() const; }; +} + SwPosNotify::SwPosNotify( SwAnchoredDrawObject* _pAnchoredDrawObj ) : mpAnchoredDrawObj( _pAnchoredDrawObj ) { @@ -130,6 +134,8 @@ Point const & SwPosNotify::LastObjPos() const return maOldObjRect.Pos(); } +namespace { + // #i32795# /// helper class for oscillation control on object positioning class SwObjPosOscillationControl @@ -145,6 +151,8 @@ class SwObjPosOscillationControl bool OscillationDetected(); }; +} + SwObjPosOscillationControl::SwObjPosOscillationControl( const SwAnchoredDrawObject& _rAnchoredDrawObj ) : mpAnchoredDrawObj( &_rAnchoredDrawObj ) diff --git a/sw/source/core/layout/dbg_lay.cxx b/sw/source/core/layout/dbg_lay.cxx index a7e727fc2669..ec09f8c4305c 100644 --- a/sw/source/core/layout/dbg_lay.cxx +++ b/sw/source/core/layout/dbg_lay.cxx @@ -177,6 +177,8 @@ public: virtual void Leave(); // message when leaving }; +namespace { + class SwSizeEnterLeave : public SwImplEnterLeave { long nFrameHeight; @@ -209,6 +211,8 @@ public: virtual void Leave() override; // message when resizing the Frame area }; +} + void SwProtocol::Record( const SwFrame* pFrame, PROT nFunction, DbgAction nAct, void* pParam ) { if( Start() ) diff --git a/sw/source/core/layout/flycnt.cxx b/sw/source/core/layout/flycnt.cxx index 1e449338331e..262357d8d2a2 100644 --- a/sw/source/core/layout/flycnt.cxx +++ b/sw/source/core/layout/flycnt.cxx @@ -201,6 +201,8 @@ void SwFlyAtContentFrame::Modify( const SfxPoolItem* pOld, const SfxPoolItem *pN //We need some helper classes to monitor the oscillation and a few functions //to not get lost. +namespace { + // #i3317# - re-factoring of the position stack class SwOszControl { @@ -220,6 +222,8 @@ public: static bool IsInProgress( const SwFlyFrame *pFly ); }; +} + const SwFlyFrame *SwOszControl::pStack1 = nullptr; const SwFlyFrame *SwOszControl::pStack2 = nullptr; const SwFlyFrame *SwOszControl::pStack3 = nullptr; @@ -539,6 +543,8 @@ bool SwFlyAtContentFrame::IsFormatPossible() const !SwOszControl::IsInProgress( this ); } +namespace { + class SwDistance { public: @@ -552,6 +558,8 @@ public: !rTwo.nSub || nSub <= rTwo.nSub ) ); } }; +} + static const SwFrame * lcl_CalcDownDist( SwDistance &rRet, const Point &rPt, const SwContentFrame *pCnt ) diff --git a/sw/source/core/layout/frmtool.cxx b/sw/source/core/layout/frmtool.cxx index 44d1cd422c10..9c804b7c1ff8 100644 --- a/sw/source/core/layout/frmtool.cxx +++ b/sw/source/core/layout/frmtool.cxx @@ -3501,6 +3501,8 @@ const SwFrame* FindPage( const SwRect &rRect, const SwFrame *pPage ) return pPage; } +namespace { + class SwFrameHolder : private SfxListener { SwFrame* pFrame; @@ -3514,6 +3516,8 @@ public: bool IsSet() const { return bSet; } }; +} + void SwFrameHolder::SetFrame( SwFrame* pHold ) { bSet = true; diff --git a/sw/source/core/layout/laycache.cxx b/sw/source/core/layout/laycache.cxx index 58a1fc3e3391..423d63699fc9 100644 --- a/sw/source/core/layout/laycache.cxx +++ b/sw/source/core/layout/laycache.cxx @@ -944,6 +944,8 @@ bool SwLayHelper::CheckInsert( sal_uLong nNodeIndex ) return bRet; } +namespace { + struct SdrObjectCompare { bool operator()( const SdrObject* pF1, const SdrObject* pF2 ) const @@ -960,6 +962,8 @@ struct FlyCacheCompare } }; +} + /** * If a new page is inserted, the last page is analysed. * If there are text frames with default position, the fly cache diff --git a/sw/source/core/layout/objectformattertxtfrm.cxx b/sw/source/core/layout/objectformattertxtfrm.cxx index 9d25adc56f03..cc59fdd4e15c 100644 --- a/sw/source/core/layout/objectformattertxtfrm.cxx +++ b/sw/source/core/layout/objectformattertxtfrm.cxx @@ -33,6 +33,8 @@ using namespace ::com::sun::star; +namespace { + // little helper class to forbid follow formatting for the given text frame class SwForbidFollowFormat { @@ -57,6 +59,8 @@ public: } }; +} + SwObjectFormatterTextFrame::SwObjectFormatterTextFrame( SwTextFrame& _rAnchorTextFrame, const SwPageFrame& _rPageFrame, SwTextFrame* _pMasterAnchorTextFrame, diff --git a/sw/source/core/layout/paintfrm.cxx b/sw/source/core/layout/paintfrm.cxx index 5e69b24d94c1..a7508171ecad 100644 --- a/sw/source/core/layout/paintfrm.cxx +++ b/sw/source/core/layout/paintfrm.cxx @@ -127,10 +127,10 @@ using ::drawinglayer::primitive2d::BorderLine; using std::pair; using std::make_pair; -struct SwPaintProperties; - namespace { +struct SwPaintProperties; + //Class declaration; here because they are only used in this file enum class SubColFlags { Page = 0x01, //Helplines of the page @@ -145,6 +145,8 @@ namespace o3tl { template<> struct typed_flags<SubColFlags> : is_typed_flags<SubColFlags, 0x39> {}; } +namespace { + // Classes collecting the border lines and help lines class SwLineRect : public SwRect { @@ -174,6 +176,8 @@ public: bool MakeUnion( const SwRect &rRect, SwPaintProperties const &properties ); }; +} + #ifdef IOS static void dummy_function() { @@ -182,6 +186,8 @@ static void dummy_function() } #endif +namespace { + class SwLineRects { public: @@ -232,6 +238,8 @@ public: } }; +} + // Default zoom factor const static double aEdgeScale = 0.5; @@ -246,6 +254,8 @@ Color* GetActiveRetoucheColor() } } +namespace { + /** * Container for static properties */ @@ -312,6 +322,8 @@ struct SwPaintProperties { }; +} + static SwPaintProperties gProp; static bool isSubsidiaryLinesFlysEnabled() @@ -420,6 +432,8 @@ void SwCalcPixStatics( vcl::RenderContext const *pOut ) gProp.aSScaleY = double(rMap.GetScaleY()); } +namespace { + /** * To be able to save the statics so the paint is more or less reentrant */ @@ -430,6 +444,8 @@ public: ~SwSavePaintStatics(); }; +} + SwSavePaintStatics::SwSavePaintStatics() { // Saving globales @@ -2221,6 +2237,8 @@ static void lcl_AdjustRectToPixelSize( SwRect& io_aSwRect, const vcl::RenderCont // FUNCTIONS USED FOR COLLAPSING TABLE BORDER LINES START +namespace { + struct SwLineEntry { SwTwips mnKey; @@ -2240,6 +2258,8 @@ public: OverlapType Overlaps( const SwLineEntry& rComp ) const; }; +} + SwLineEntry::SwLineEntry( SwTwips nKey, SwTwips nStartPos, SwTwips nEndPos, @@ -2300,6 +2320,8 @@ SwLineEntry::OverlapType SwLineEntry::Overlaps( const SwLineEntry& rNew ) const return eRet; } +namespace { + struct lt_SwLineEntry { bool operator()( const SwLineEntry& e1, const SwLineEntry& e2 ) const @@ -2308,9 +2330,13 @@ struct lt_SwLineEntry } }; +} + typedef std::set< SwLineEntry, lt_SwLineEntry > SwLineEntrySet; typedef std::map< SwTwips, SwLineEntrySet > SwLineEntryMap; +namespace { + class SwTabFramePainter { SwLineEntryMap maVertLines; @@ -2331,6 +2357,8 @@ public: void PaintLines( OutputDevice& rDev, const SwRect& rRect ) const; }; +} + SwTabFramePainter::SwTabFramePainter( const SwTabFrame& rTabFrame ) : mrTabFrame( rTabFrame ) { @@ -3284,6 +3312,8 @@ static void lcl_EmergencyFormatFootnoteCont( SwFootnoteContFrame *pCont ) } } +namespace { + class SwShortCut { SwRectDist fnCheck; @@ -3294,6 +3324,8 @@ public: { return (rRect.*fnCheck)( nLimit ) > 0; } }; +} + SwShortCut::SwShortCut( const SwFrame& rFrame, const SwRect& rRect ) { bool bVert = rFrame.IsVertical(); @@ -3854,6 +3886,8 @@ void SwCellFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const& SwLayoutFrame::PaintSwFrame( rRenderContext, rRect ); } +namespace { + struct BorderLinesGuard { explicit BorderLinesGuard() : m_pBorderLines(std::move(gProp.pBLines)) @@ -3868,6 +3902,8 @@ private: std::unique_ptr<BorderLines> m_pBorderLines; }; +} + void SwFlyFrame::PaintSwFrame(vcl::RenderContext& rRenderContext, SwRect const& rRect, SwPrintData const*const) const { //optimize thumbnail generation and store procedure to improve odt saving performance, #i120030# @@ -4483,6 +4519,8 @@ namespace drawinglayer { namespace primitive2d { + namespace { + class SwBorderRectanglePrimitive2D : public BufferedDecompositionPrimitive2D { private: @@ -4527,6 +4565,8 @@ namespace drawinglayer DeclPrimitive2DIDBlock() }; + } + void SwBorderRectanglePrimitive2D::create2DDecomposition( Primitive2DContainer& rContainer, const geometry::ViewInformation2D& /*rViewInformation*/) const diff --git a/sw/source/core/layout/sectfrm.cxx b/sw/source/core/layout/sectfrm.cxx index f4bb297b6df5..ef1fa6a39ab2 100644 --- a/sw/source/core/layout/sectfrm.cxx +++ b/sw/source/core/layout/sectfrm.cxx @@ -1190,6 +1190,8 @@ void SwSectionFrame::SimpleFormat() UnlockJoin(); } +namespace { + // #i40147# - helper class to perform extra section format // to position anchored objects and to keep the position of whose objects locked. class ExtraFormatToPositionObjs @@ -1322,6 +1324,8 @@ class ExtraFormatToPositionObjs } }; +} + /// "formats" the frame; Frame and PrtArea void SwSectionFrame::Format( vcl::RenderContext* pRenderContext, const SwBorderAttrs *pAttr ) { diff --git a/sw/source/core/layout/sortedobjs.cxx b/sw/source/core/layout/sortedobjs.cxx index 40d87c43b7bf..2e3df19104f0 100644 --- a/sw/source/core/layout/sortedobjs.cxx +++ b/sw/source/core/layout/sortedobjs.cxx @@ -70,7 +70,6 @@ namespace return 1; return 2; } -} struct ObjAnchorOrder { @@ -198,6 +197,8 @@ struct ObjAnchorOrder } }; +} + bool SwSortedObjs::is_sorted() const { return std::is_sorted(maSortedObjLst.begin(), maSortedObjLst.end(), ObjAnchorOrder()); diff --git a/sw/source/core/layout/trvlfrm.cxx b/sw/source/core/layout/trvlfrm.cxx index 55c2eb66e6e1..369207a36221 100644 --- a/sw/source/core/layout/trvlfrm.cxx +++ b/sw/source/core/layout/trvlfrm.cxx @@ -105,6 +105,8 @@ namespace { } } +namespace { + //For SwFlyFrame::GetCursorOfst class SwCursorOszControl { @@ -140,6 +142,8 @@ public: } }; +} + static SwCursorOszControl g_OszCtrl = { nullptr, nullptr, nullptr }; /** Searches the ContentFrame owning the PrtArea containing the point. */ diff --git a/sw/source/core/ole/ndole.cxx b/sw/source/core/ole/ndole.cxx index 9000d6ef1b9e..c66ff319ac93 100644 --- a/sw/source/core/ole/ndole.cxx +++ b/sw/source/core/ole/ndole.cxx @@ -64,6 +64,8 @@ using namespace utl; using namespace com::sun::star::uno; using namespace com::sun::star; +namespace { + class SwOLELRUCache : private utl::ConfigItem { @@ -86,6 +88,8 @@ public: void RemoveObj( SwOLEObj& rObj ); }; +} + static std::shared_ptr<SwOLELRUCache> g_pOLELRU_Cache; class SwOLEListener_Impl : public ::cppu::WeakImplHelper< embed::XStateChangeListener > diff --git a/sw/source/core/swg/SwXMLBlockImport.cxx b/sw/source/core/swg/SwXMLBlockImport.cxx index 05ad9d164281..14fe001096b7 100644 --- a/sw/source/core/swg/SwXMLBlockImport.cxx +++ b/sw/source/core/swg/SwXMLBlockImport.cxx @@ -43,6 +43,8 @@ using namespace css::xml::sax; class SwXMLBlockListImport; class SwXMLTextBlockImport; +namespace { + class SwXMLBlockListContext : public SvXMLImportContext { private: @@ -113,6 +115,8 @@ public: virtual ~SwXMLTextBlockParContext() override; }; +} + SwXMLTextBlockTokenHandler::SwXMLTextBlockTokenHandler() { } diff --git a/sw/source/core/swg/SwXMLSectionList.cxx b/sw/source/core/swg/SwXMLSectionList.cxx index 2f835bd606a3..2dfcb49e8457 100644 --- a/sw/source/core/swg/SwXMLSectionList.cxx +++ b/sw/source/core/swg/SwXMLSectionList.cxx @@ -26,6 +26,8 @@ using namespace ::com::sun::star; using namespace ::xmloff::token; +namespace { + class SvXMLSectionListContext : public SvXMLImportContext { private: @@ -73,6 +75,7 @@ public: } }; +} SwXMLSectionList::SwXMLSectionList(const css::uno::Reference< css::uno::XComponentContext >& rContext, std::vector<OUString> &rNewSectionList) : SvXMLImport(rContext, "") diff --git a/sw/source/core/table/swnewtable.cxx b/sw/source/core/table/swnewtable.cxx index 04a2509b1e37..69b61fd8b447 100644 --- a/sw/source/core/table/swnewtable.cxx +++ b/sw/source/core/table/swnewtable.cxx @@ -2091,6 +2091,8 @@ void SwTable::CleanUpBottomRowSpan( sal_uInt16 nDelLines ) #ifdef DBG_UTIL +namespace { + struct RowSpanCheck { long nRowSpan; @@ -2098,6 +2100,8 @@ struct RowSpanCheck SwTwips nRight; }; +} + void SwTable::CheckConsistency() const { if( !IsNewModel() ) diff --git a/sw/source/core/text/frmcrsr.cxx b/sw/source/core/text/frmcrsr.cxx index 7eae6a55198e..d5252724679d 100644 --- a/sw/source/core/text/frmcrsr.cxx +++ b/sw/source/core/text/frmcrsr.cxx @@ -741,6 +741,8 @@ bool SwTextFrame::RightMargin(SwPaM *pPam, bool bAPI) const // to the base class. // The Cursor's horizontal justification is done afterwards by the CursorShell. +namespace { + class SwSetToRightMargin { bool bRight; @@ -750,6 +752,8 @@ public: void SetRight( const bool bNew ) { bRight = bNew; } }; +} + bool SwTextFrame::UnitUp_( SwPaM *pPam, const SwTwips nOffset, bool bSetInReadOnly ) const { diff --git a/sw/source/core/text/frmform.cxx b/sw/source/core/text/frmform.cxx index 37543c700b76..751d9b94c59e 100644 --- a/sw/source/core/text/frmform.cxx +++ b/sw/source/core/text/frmform.cxx @@ -59,6 +59,8 @@ // Tolerance in formatting and text output #define SLOPPY_TWIPS 5 +namespace { + class FormatLevel { static sal_uInt16 nLevel; @@ -68,6 +70,9 @@ public: static sal_uInt16 GetLevel() { return nLevel; } static bool LastLevel() { return 10 < nLevel; } }; + +} + sal_uInt16 FormatLevel::nLevel = 0; void ValidateText( SwFrame *pFrame ) // Friend of frame diff --git a/sw/source/core/text/frmpaint.cxx b/sw/source/core/text/frmpaint.cxx index 393968dbd032..967925d5847c 100644 --- a/sw/source/core/text/frmpaint.cxx +++ b/sw/source/core/text/frmpaint.cxx @@ -59,6 +59,8 @@ using namespace ::com::sun::star; static bool bInitFont = true; +namespace { + class SwExtraPainter { SwSaveClip m_aClip; @@ -93,6 +95,8 @@ public: void PaintRedline( SwTwips nY, long nMax ); }; +} + SwExtraPainter::SwExtraPainter( const SwTextFrame *pFrame, SwViewShell *pVwSh, const SwLineNumberInfo &rLnInf, const SwRect &rRct, sal_Int16 eHor, bool bLineNum ) diff --git a/sw/source/core/text/itratr.cxx b/sw/source/core/text/itratr.cxx index a27701186c1a..fd433adc724c 100644 --- a/sw/source/core/text/itratr.cxx +++ b/sw/source/core/text/itratr.cxx @@ -782,6 +782,8 @@ TextFrameIndex SwAttrIter::GetNextAttr() const } } +namespace { + class SwMinMaxArgs { public: @@ -800,6 +802,8 @@ public: void NewWord() { nWordAdd = nWordWidth = 0; } }; +} + static bool lcl_MinMaxString( SwMinMaxArgs& rArg, SwFont* pFnt, const OUString &rText, sal_Int32 nIdx, sal_Int32 nEnd ) { @@ -848,6 +852,8 @@ bool SwTextNode::IsSymbolAt(const sal_Int32 nBegin) const return aIter.GetFnt()->IsSymbol( getIDocumentLayoutAccess().GetCurrentViewShell() ); } +namespace { + class SwMinMaxNodeArgs { public: @@ -861,6 +867,8 @@ public: void Minimum( long nNew ) { if( nNew > nMinWidth ) nMinWidth = nNew; } }; +} + static void lcl_MinMaxNode( SwFrameFormat* pNd, SwMinMaxNodeArgs* pIn ) { const SwFormatAnchor& rFormatA = pNd->GetAnchor(); diff --git a/sw/source/core/text/itrform2.cxx b/sw/source/core/text/itrform2.cxx index 2a1b8432ac0e..d8fa076085fc 100644 --- a/sw/source/core/text/itrform2.cxx +++ b/sw/source/core/text/itrform2.cxx @@ -817,6 +817,8 @@ void SwTextFormatter::CalcAscent( SwTextFormatInfo &rInf, SwLinePortion *pPor ) } } +namespace { + class SwMetaPortion : public SwTextPortion { public: @@ -824,6 +826,8 @@ public: virtual void Paint( const SwTextPaintInfo &rInf ) const override; }; +} + void SwMetaPortion::Paint( const SwTextPaintInfo &rInf ) const { if ( Width() ) diff --git a/sw/source/core/text/porfld.cxx b/sw/source/core/text/porfld.cxx index 11338d9a8c39..3c42df910be4 100644 --- a/sw/source/core/text/porfld.cxx +++ b/sw/source/core/text/porfld.cxx @@ -133,6 +133,8 @@ sal_uInt16 SwFieldPortion::GetViewWidth( const SwTextSizeInfo &rInf ) const return m_nViewWidth; } +namespace { + /** * Never just use SetLen(0) */ @@ -150,6 +152,8 @@ public: ~SwFieldSlot(); }; +} + SwFieldSlot::SwFieldSlot( const SwTextFormatInfo* pNew, const SwFieldPortion *pPor ) : pOldText(nullptr) , nIdx(0) diff --git a/sw/source/core/text/pormulti.cxx b/sw/source/core/text/pormulti.cxx index 260e1921ae1a..d2486329cbc0 100644 --- a/sw/source/core/text/pormulti.cxx +++ b/sw/source/core/text/pormulti.cxx @@ -810,6 +810,7 @@ static bool lcl_HasRotation(const SwTextAttr& rAttr, } namespace sw { + namespace { // need to use a very special attribute iterator here that returns // both the hints and the nodes, so that GetMultiCreator() can handle @@ -833,6 +834,8 @@ namespace sw { } }; + } + SwTextAttr const* MergedAttrIterMulti::NextAttr(SwTextNode const*& rpNode) { if (m_First) @@ -1400,6 +1403,8 @@ std::unique_ptr<SwMultiCreator> SwTextSizeInfo::GetMultiCreator(TextFrameIndex & return nullptr; } +namespace { + // A little helper class to manage the spaceadd-arrays of the text adjustment // during a PaintMultiPortion. // The constructor prepares the array for the first line of multiportion, @@ -1422,6 +1427,8 @@ public: long GetSpaceAdd() const { return nSpaceAdd; } }; +} + SwSpaceManipulator::SwSpaceManipulator( SwTextPaintInfo& rInf, SwMultiPortion& rMult ) : rInfo(rInf) diff --git a/sw/source/core/text/txtdrop.cxx b/sw/source/core/text/txtdrop.cxx index 7588b20d4ad9..6fa6702baebc 100644 --- a/sw/source/core/text/txtdrop.cxx +++ b/sw/source/core/text/txtdrop.cxx @@ -64,6 +64,8 @@ static bool lcl_IsDropFlyInter( const SwTextFormatInfo &rInf, return false; } +namespace { + class SwDropSave { SwTextPaintInfo* pInf; @@ -77,6 +79,8 @@ public: ~SwDropSave(); }; +} + SwDropSave::SwDropSave( const SwTextPaintInfo &rInf ) : pInf( const_cast<SwTextPaintInfo*>(&rInf) ), nIdx( rInf.GetIdx() ), nLen( rInf.GetLen() ), nX( rInf.X() ), nY( rInf.Y() ) diff --git a/sw/source/core/text/txtftn.cxx b/sw/source/core/text/txtftn.cxx index 4ca6938e82f3..5c17be3cbdb3 100644 --- a/sw/source/core/text/txtftn.cxx +++ b/sw/source/core/text/txtftn.cxx @@ -1241,6 +1241,8 @@ void SwTextFormatter::MakeDummyLine() } } +namespace { + class SwFootnoteSave { SwTextSizeInfo *pInf; @@ -1258,6 +1260,8 @@ public: ~SwFootnoteSave() COVERITY_NOEXCEPT_FALSE; }; +} + SwFootnoteSave::SwFootnoteSave( const SwTextSizeInfo &rInf, const SwTextFootnote* pTextFootnote, const bool bApplyGivenScriptType, diff --git a/sw/source/core/text/xmldump.cxx b/sw/source/core/text/xmldump.cxx index 20f61111126a..2f8fd90e1d62 100644 --- a/sw/source/core/text/xmldump.cxx +++ b/sw/source/core/text/xmldump.cxx @@ -30,6 +30,8 @@ #include <view.hxx> #include <svx/svdobj.hxx> +namespace { + class XmlPortionDumper:public SwPortionHandler { private: @@ -226,8 +228,6 @@ class XmlPortionDumper:public SwPortionHandler }; -namespace -{ xmlTextWriterPtr lcl_createDefaultWriter() { xmlTextWriterPtr writer = xmlNewTextWriterFilename( "layout.xml", 0 ); diff --git a/sw/source/core/txtnode/SwGrammarContact.cxx b/sw/source/core/txtnode/SwGrammarContact.cxx index 38f095cd1996..bb26450cc31b 100644 --- a/sw/source/core/txtnode/SwGrammarContact.cxx +++ b/sw/source/core/txtnode/SwGrammarContact.cxx @@ -27,6 +27,8 @@ #include <rootfrm.hxx> #include <viewsh.hxx> +namespace { + /* * This class is responsible for the delayed display of grammar checks when a paragraph is edited * It's a client of the paragraph the cursor points to. @@ -59,6 +61,8 @@ protected: virtual void Modify( const SfxPoolItem* pOld, const SfxPoolItem *pNew) override; }; +} + SwGrammarContact::SwGrammarContact() : mbFinished( false ) { aTimer.SetTimeout( 2000 ); // Repaint of grammar check after 'setChecked' diff --git a/sw/source/core/txtnode/fmtatr2.cxx b/sw/source/core/txtnode/fmtatr2.cxx index ef37d507efae..376908cdbc8a 100644 --- a/sw/source/core/txtnode/fmtatr2.cxx +++ b/sw/source/core/txtnode/fmtatr2.cxx @@ -786,6 +786,8 @@ MetaFieldManager::makeMetaField(SwFormatMeta * const i_pFormat, return pMetaField; } +namespace { + struct IsInUndo { bool operator()(std::weak_ptr<MetaField> const & pMetaField) { @@ -802,6 +804,8 @@ struct MakeUnoObject } }; +} + std::vector< uno::Reference<text::XTextField> > MetaFieldManager::getMetaFields() { diff --git a/sw/source/core/txtnode/fntcache.cxx b/sw/source/core/txtnode/fntcache.cxx index 6fa6b159705a..7ced0397cd17 100644 --- a/sw/source/core/txtnode/fntcache.cxx +++ b/sw/source/core/txtnode/fntcache.cxx @@ -246,6 +246,8 @@ static bool lcl_IsFontAdjustNecessary( const vcl::RenderContext& rOutDev, OUTDEV_PRINTER != rOutDev.GetOutDevType() ); } +namespace { + struct CalcLinePosData { SwDrawTextInfo& rInf; @@ -274,6 +276,8 @@ struct CalcLinePosData } }; +} + // Computes the start and end position of an underline. This function is called // from the DrawText-method (for underlining misspelled words or smarttag terms). static void lcl_calcLinePos( const CalcLinePosData &rData, diff --git a/sw/source/core/txtnode/fntcap.cxx b/sw/source/core/txtnode/fntcap.cxx index 171accf5ae5d..09695fa0c74d 100644 --- a/sw/source/core/txtnode/fntcap.cxx +++ b/sw/source/core/txtnode/fntcap.cxx @@ -36,6 +36,8 @@ using namespace ::com::sun::star::i18n; +namespace { + // The information encapsulated in SwCapitalInfo is required // by the ::Do functions. They contain the information about // the original string, whereas rDo.GetInf() contains information @@ -50,6 +52,8 @@ public: TextFrameIndex nLen; }; +} + // rFnt: required for CalcCaseMap // rOrigString: The original string // nOfst: Position of the substring in rOrigString @@ -105,6 +109,8 @@ public: void SetCapInf( SwCapitalInfo& rNew ) { pCapInf = &rNew; } }; +namespace { + class SwDoGetCapitalSize : public SwDoCapitals { protected: @@ -117,6 +123,8 @@ public: const Size &GetSize() const { return aTextSize; } }; +} + void SwDoGetCapitalSize::Init( SwFntObj *, SwFntObj * ) { aTextSize.setHeight( 0 ); @@ -152,6 +160,8 @@ Size SwSubFont::GetCapitalSize( SwDrawTextInfo& rInf ) return aTextSize; } +namespace { + class SwDoGetCapitalBreak : public SwDoCapitals { protected: @@ -170,6 +180,8 @@ public: TextFrameIndex getBreak() const { return m_nBreak; } }; +} + void SwDoGetCapitalBreak::Init( SwFntObj *, SwFntObj * ) { } @@ -231,6 +243,8 @@ TextFrameIndex SwFont::GetCapitalBreak( SwViewShell const * pSh, const OutputDev return aDo.getBreak(); } +namespace { + class SwDoDrawCapital : public SwDoCapitals { protected: @@ -246,6 +260,8 @@ public: void DrawSpace( Point &rPos ); }; +} + void SwDoDrawCapital::Init( SwFntObj *pUpperFont, SwFntObj *pLowerFont ) { pUpperFnt = pUpperFont; @@ -313,6 +329,8 @@ void SwSubFont::DrawCapital( SwDrawTextInfo &rInf ) DoOnCapitals( aDo ); } +namespace { + class SwDoCapitalCursorOfst : public SwDoCapitals { protected: @@ -331,6 +349,8 @@ public: TextFrameIndex GetCursor() const { return nCursor; } }; +} + void SwDoCapitalCursorOfst::Init( SwFntObj *pUpperFont, SwFntObj *pLowerFont ) { pUpperFnt = pUpperFont; @@ -386,6 +406,8 @@ TextFrameIndex SwSubFont::GetCapitalCursorOfst( SwDrawTextInfo& rInf ) return aDo.GetCursor(); } +namespace { + class SwDoDrawStretchCapital : public SwDoDrawCapital { const TextFrameIndex nStrLen; @@ -402,6 +424,8 @@ public: { } }; +} + void SwDoDrawStretchCapital::Do() { SV_STAT( nDrawStretchText ); diff --git a/sw/source/core/txtnode/modeltoviewhelper.cxx b/sw/source/core/txtnode/modeltoviewhelper.cxx index 3bc3dbb59f21..c8c9726c9a6c 100644 --- a/sw/source/core/txtnode/modeltoviewhelper.cxx +++ b/sw/source/core/txtnode/modeltoviewhelper.cxx @@ -34,6 +34,8 @@ #include <set> #include <vector> +namespace { + struct FieldResult { sal_Int32 const m_nFieldPos; @@ -53,8 +55,12 @@ public: } }; +} + typedef std::set<FieldResult, sortfieldresults> FieldResultSet; +namespace { + struct block { sal_Int32 const m_nStart; @@ -80,6 +86,8 @@ struct containsPos } }; +} + ModelToViewHelper::ModelToViewHelper(const SwTextNode &rNode, SwRootFrame const*const pLayout, ExpandMode eMode) { diff --git a/sw/source/core/txtnode/thints.cxx b/sw/source/core/txtnode/thints.cxx index 35819fa8214d..f6c0b771b52a 100644 --- a/sw/source/core/txtnode/thints.cxx +++ b/sw/source/core/txtnode/thints.cxx @@ -2065,6 +2065,8 @@ static void lcl_MergeAttr_ExpandChrFormat( SfxItemSet& rSet, const SfxPoolItem& rSet.Put( rAttr ); } +namespace { + struct SwPoolItemEndPair { public: @@ -2074,6 +2076,8 @@ public: SwPoolItemEndPair() : mpItem( nullptr ), mnEndPos( 0 ) {}; }; +} + static void lcl_MergeListLevelIndentAsLRSpaceItem( const SwTextNode& rTextNode, SfxItemSet& rSet ) { diff --git a/sw/source/core/undo/docundo.cxx b/sw/source/core/undo/docundo.cxx index 2b2d3450cb34..015cec4cebd7 100644 --- a/sw/source/core/undo/docundo.cxx +++ b/sw/source/core/undo/docundo.cxx @@ -546,6 +546,8 @@ void UndoManager::AddUndoAction(std::unique_ptr<SfxUndoAction> pAction, bool bTr } } +namespace { + class CursorGuard { public: @@ -570,6 +572,8 @@ private: bool const m_bSaveCursor; }; +} + bool UndoManager::impl_DoUndoRedo(UndoOrRedoType undoOrRedo) { SwDoc & rDoc(*GetUndoNodes().GetDoc()); diff --git a/sw/source/core/undo/undobj.cxx b/sw/source/core/undo/undobj.cxx index e54290e941b0..bc6a4c5160e6 100644 --- a/sw/source/core/undo/undobj.cxx +++ b/sw/source/core/undo/undobj.cxx @@ -187,6 +187,8 @@ SwUndo::~SwUndo() { } +namespace { + class UndoRedoRedlineGuard { public: @@ -210,6 +212,8 @@ private: RedlineFlags const m_eMode; }; +} + void SwUndo::Undo() { assert(false); // SwUndo::Undo(): ERROR: must call UndoWithContext instead diff --git a/sw/source/core/undo/unsect.cxx b/sw/source/core/undo/unsect.cxx index 127ba5a410eb..7e05ae0e9fd7 100644 --- a/sw/source/core/undo/unsect.cxx +++ b/sw/source/core/undo/unsect.cxx @@ -414,6 +414,8 @@ void SwUndoDelSection::RedoImpl(::sw::UndoRedoContext & rContext) rDoc.DelSectionFormat( pNd->GetSection().GetFormat() ); } +namespace { + class SwUndoUpdateSection : public SwUndo { @@ -431,6 +433,8 @@ public: virtual void RedoImpl( ::sw::UndoRedoContext & ) override; }; +} + std::unique_ptr<SwUndo> MakeUndoUpdateSection(SwSectionFormat const& rFormat, bool const bOnlyAttr) { diff --git a/sw/source/core/undo/untbl.cxx b/sw/source/core/undo/untbl.cxx index b3b2fdd34403..37f629c92c97 100644 --- a/sw/source/core/undo/untbl.cxx +++ b/sw/source/core/undo/untbl.cxx @@ -94,13 +94,17 @@ struct UndoTableCpyTable_Entry explicit UndoTableCpyTable_Entry( const SwTableBox& rBox ); }; +namespace { + class SaveBox; class SaveLine; +} + class SaveTable { - friend class SaveBox; - friend class SaveLine; + friend SaveBox; + friend SaveLine; SfxItemSet m_aTableSet; std::unique_ptr<SaveLine> m_pLine; const SwTable* m_pSwTable; @@ -129,9 +133,11 @@ public: bool IsNewModel() const { return m_bNewModel; } }; +namespace { + class SaveLine { - friend class SaveTable; + friend SaveTable; friend class SaveBox; SaveLine* pNext; @@ -175,6 +181,8 @@ public: void CreateNew( SwTable& rTable, SwTableLine& rParent, SaveTable& rSTable ); }; +} + #if OSL_DEBUG_LEVEL > 0 #include <shellio.hxx> static void CheckTable( const SwTable& ); @@ -2177,6 +2185,8 @@ void SwUndoTableNumFormat::UndoImpl(::sw::UndoRedoContext & rContext) pPam->GetPoint()->nContent.Assign( pTextNd, 0 ); } +namespace { + /** switch the RedlineFlags on the given document, using * SetRedlineFlags_intern. This class set the mode in the constructor, * and changes it back in the destructor, i.e. it uses the @@ -2196,6 +2206,8 @@ public: ~RedlineFlagsInternGuard(); }; +} + RedlineFlagsInternGuard::RedlineFlagsInternGuard( SwDoc& rDoc, RedlineFlags eNewRedlineFlags, diff --git a/sw/source/core/unocore/unocoll.cxx b/sw/source/core/unocore/unocoll.cxx index 787f38918915..ffd3316faf7f 100644 --- a/sw/source/core/unocore/unocoll.cxx +++ b/sw/source/core/unocore/unocoll.cxx @@ -92,6 +92,8 @@ using namespace ::com::sun::star::lang; #if HAVE_FEATURE_SCRIPTING +namespace { + class SwVbaCodeNameProvider : public ::cppu::WeakImplHelper< document::XCodeNameQuery > { SwDocShell* const mpDocShell; @@ -168,8 +170,12 @@ public: } }; +} + typedef std::unordered_map< OUString, OUString > StringHashMap; +namespace { + class SwVbaProjectNameProvider : public ::cppu::WeakImplHelper< container::XNameContainer > { StringHashMap mTemplateToProject; @@ -268,14 +274,20 @@ public: }; +} + #endif +namespace { + struct ProvNamesId_Type { const char * pName; SwServiceType const nType; }; +} + // note: this thing is indexed as an array, so do not insert/remove entries! const ProvNamesId_Type aProvNamesId[] = { diff --git a/sw/source/core/unocore/unofield.cxx b/sw/source/core/unocore/unofield.cxx index b5b7f4e1a88e..90b014202640 100644 --- a/sw/source/core/unocore/unofield.cxx +++ b/sw/source/core/unocore/unofield.cxx @@ -128,12 +128,16 @@ static const sal_uInt16 aDocInfoSubTypeFromService[] = DI_DOCNO //PROPERTY_MAP_FLDTYP_DOCINFO_REVISION }; +namespace { + struct ServiceIdResId { SwFieldIds const nResId; SwServiceType const nServiceId; }; +} + static const ServiceIdResId aServiceToRes[] = { {SwFieldIds::DateTime, SwServiceType::FieldTypeDateTime }, @@ -1071,6 +1075,8 @@ OUString SwXFieldMaster::LocalizeFormula( return rFormula; } +namespace { + struct SwFieldProperties_Impl { OUString sPar1; @@ -1112,6 +1118,8 @@ struct SwFieldProperties_Impl {} }; +} + class SwXTextField::Impl : public SvtListener { diff --git a/sw/source/core/unocore/unoframe.cxx b/sw/source/core/unocore/unoframe.cxx index 294db651c919..7dbd91d656d4 100644 --- a/sw/source/core/unocore/unoframe.cxx +++ b/sw/source/core/unocore/unoframe.cxx @@ -962,6 +962,8 @@ bool BaseFrameProperties_Impl::FillBaseProperties(SfxItemSet& rToSet, const SfxI return bRet; } +namespace { + class SwFrameProperties_Impl : public BaseFrameProperties_Impl { public: @@ -970,6 +972,8 @@ public: bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound) override; }; +} + SwFrameProperties_Impl::SwFrameProperties_Impl(): BaseFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_FRAME)*/ ) { @@ -1026,6 +1030,8 @@ bool SwFrameProperties_Impl::AnyToItemSet(SwDoc *pDoc, SfxItemSet& rSet, SfxItem return bRet; } +namespace { + class SwGraphicProperties_Impl : public BaseFrameProperties_Impl { public: @@ -1034,6 +1040,8 @@ public: virtual bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound) override; }; +} + SwGraphicProperties_Impl::SwGraphicProperties_Impl( ) : BaseFrameProperties_Impl(/*aSwMapProvider.GetPropertyMap(PROPERTY_MAP_TEXT_GRAPHIC)*/ ) { @@ -1125,6 +1133,8 @@ bool SwGraphicProperties_Impl::AnyToItemSet( return bRet; } +namespace { + class SwOLEProperties_Impl : public SwFrameProperties_Impl { public: @@ -1134,6 +1144,8 @@ public: virtual bool AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound) override; }; +} + bool SwOLEProperties_Impl::AnyToItemSet( SwDoc* pDoc, SfxItemSet& rFrameSet, SfxItemSet& rSet, bool& rSizeFound) { diff --git a/sw/source/core/unocore/unoidx.cxx b/sw/source/core/unocore/unoidx.cxx index ae93e9c63b07..87e06e218d7d 100644 --- a/sw/source/core/unocore/unoidx.cxx +++ b/sw/source/core/unocore/unoidx.cxx @@ -245,6 +245,8 @@ public: }; +namespace { + class SwDocIndexDescriptorProperties_Impl { private: @@ -259,6 +261,8 @@ public: void SetTypeName(const OUString& rSet) { m_sUserTOXTypeName = rSet; } }; +} + SwDocIndexDescriptorProperties_Impl::SwDocIndexDescriptorProperties_Impl( SwTOXType const*const pType) { @@ -1884,6 +1888,8 @@ SwXDocumentIndexMark::attach( m_pImpl->m_bIsDescriptor = false; } +namespace { + template<typename T> struct NotContainedIn { std::vector<T> const& m_rVector; @@ -1895,6 +1901,8 @@ template<typename T> struct NotContainedIn } }; +} + void SwXDocumentIndexMark::Impl::InsertTOXMark( SwTOXType & rTOXType, SwTOXMark & rMark, SwPaM & rPam, SwXTextCursor const*const pTextCursor) @@ -2639,11 +2647,15 @@ SwXDocumentIndex::TokenAccess_Impl::getSupportedServiceNames() return { "com.sun.star.text.DocumentIndexLevelFormat" }; } +namespace { + struct TokenType_ { const char *pName; enum FormTokenType const eTokenType; }; +} + static const struct TokenType_ g_TokenTypes[] = { { "TokenEntryNumber", TOKEN_ENTRY_NO }, diff --git a/sw/source/core/unocore/unoobj2.cxx b/sw/source/core/unocore/unoobj2.cxx index 502e2e74c2dd..e4a282212751 100644 --- a/sw/source/core/unocore/unoobj2.cxx +++ b/sw/source/core/unocore/unoobj2.cxx @@ -138,6 +138,8 @@ void DeepCopyPaM(SwPaM const & rSource, SwPaM & rTarget) } // namespace sw +namespace { + struct FrameClientSortListLess { bool operator() (FrameClientSortListEntry const& r1, @@ -148,8 +150,6 @@ struct FrameClientSortListLess } }; -namespace -{ void lcl_CollectFrameAtNodeWithLayout(const SwContentFrame* pCFrame, FrameClientSortList_t& rFrames, const RndStdIds nAnchorType) @@ -399,6 +399,8 @@ void SwUnoCursorHelper::GetCursorAttr(SwPaM & rPam, } } +namespace { + struct SwXParagraphEnumerationImpl final : public SwXParagraphEnumeration { uno::Reference< text::XText > const m_xParentText; @@ -485,6 +487,8 @@ struct SwXParagraphEnumerationImpl final : public SwXParagraphEnumeration bool IgnoreLastElement(SwUnoCursor& rCursor, bool bMovedFromTable); }; +} + SwXParagraphEnumeration* SwXParagraphEnumeration::Create( uno::Reference< text::XText > const& xParent, const std::shared_ptr<SwUnoCursor>& pCursor, @@ -1418,6 +1422,8 @@ SwXTextRange::makeRedline( SwUnoCursorHelper::makeRedline( aPaM, rRedlineType, rRedlineProperties ); } +namespace { + struct SwXTextRangesImpl final : public SwXTextRanges { @@ -1462,6 +1468,8 @@ struct SwXTextRangesImpl final : public SwXTextRanges sw::UnoCursorPointer m_pUnoCursor; }; +} + void SwXTextRangesImpl::MakeRanges() { if (GetCursor()) @@ -1540,6 +1548,8 @@ void SwUnoCursorHelper::SetString(SwCursor & rCursor, const OUString& rString) pDoc->GetIDocumentUndoRedo().EndUndo(SwUndoId::INSERT, nullptr); } +namespace { + struct SwXParaFrameEnumerationImpl final : public SwXParaFrameEnumeration { // XServiceInfo @@ -1584,6 +1594,7 @@ struct SwXParaFrameEnumerationImpl final : public SwXParaFrameEnumeration ::sw::UnoCursorPointer m_pUnoCursor; }; +} SwXParaFrameEnumeration* SwXParaFrameEnumeration::Create(const SwPaM& rPaM, const enum ParaFrameMode eParaFrameMode, SwFrameFormat* const pFormat) { return new SwXParaFrameEnumerationImpl(rPaM, eParaFrameMode, pFormat); } diff --git a/sw/source/core/unocore/unoparagraph.cxx b/sw/source/core/unocore/unoparagraph.cxx index 2b632ab78e79..2d3e33922aa3 100644 --- a/sw/source/core/unocore/unoparagraph.cxx +++ b/sw/source/core/unocore/unoparagraph.cxx @@ -59,6 +59,7 @@ using namespace ::com::sun::star; +namespace { class SwParaSelection { @@ -68,6 +69,8 @@ public: ~SwParaSelection(); }; +} + SwParaSelection::SwParaSelection(SwCursor & rCursor) : m_rCursor(rCursor) { diff --git a/sw/source/core/unocore/unoportenum.cxx b/sw/source/core/unocore/unoportenum.cxx index 42d4658138a1..9cba2c7d9dd4 100644 --- a/sw/source/core/unocore/unoportenum.cxx +++ b/sw/source/core/unocore/unoportenum.cxx @@ -685,6 +685,8 @@ static void lcl_ExportSoftPageBreak( } } +namespace { + struct SwXRedlinePortion_Impl { const SwRangeRedline* m_pRedline; @@ -703,9 +705,13 @@ struct SwXRedlinePortion_Impl } }; +} + typedef std::shared_ptr < SwXRedlinePortion_Impl > SwXRedlinePortion_ImplSharedPtr; +namespace { + struct RedlineCompareStruct { static const SwPosition& getPosition ( const SwXRedlinePortion_ImplSharedPtr &r ) @@ -720,6 +726,8 @@ struct RedlineCompareStruct } }; +} + typedef std::multiset < SwXRedlinePortion_ImplSharedPtr, RedlineCompareStruct > SwXRedlinePortion_ImplList; diff --git a/sw/source/core/unocore/unorefmk.cxx b/sw/source/core/unocore/unorefmk.cxx index adab40c9d319..ee5756c761cd 100644 --- a/sw/source/core/unocore/unorefmk.cxx +++ b/sw/source/core/unocore/unorefmk.cxx @@ -187,6 +187,8 @@ SwXReferenceMark::getSupportedServiceNames() }; } +namespace { + template<typename T> struct NotContainedIn { std::vector<T> const& m_rVector; @@ -198,6 +200,8 @@ template<typename T> struct NotContainedIn } }; +} + void SwXReferenceMark::Impl::InsertRefMark(SwPaM& rPam, SwXTextCursor const*const pCursor) { @@ -492,6 +496,8 @@ void SAL_CALL SwXReferenceMark::removeVetoableChangeListener( OSL_FAIL("SwXReferenceMark::removeVetoableChangeListener(): not implemented"); } +namespace { + class SwXMetaText : public cppu::OWeakObject, public SwXText { private: @@ -530,6 +536,8 @@ public: }; +} + SwXMetaText::SwXMetaText(SwDoc & rDoc, SwXMeta & rMeta) : SwXText(&rDoc, CursorType::Meta) , m_rMeta(rMeta) diff --git a/sw/source/core/unocore/unosect.cxx b/sw/source/core/unocore/unosect.cxx index 05c4ba13275a..ff12dc325695 100644 --- a/sw/source/core/unocore/unosect.cxx +++ b/sw/source/core/unocore/unosect.cxx @@ -67,6 +67,8 @@ using namespace ::com::sun::star; +namespace { + struct SwTextSectionProperties_Impl { uno::Sequence<sal_Int8> m_Password; @@ -103,6 +105,8 @@ struct SwTextSectionProperties_Impl }; +} + class SwXTextSection::Impl : public SvtListener { diff --git a/sw/source/core/unocore/unostyle.cxx b/sw/source/core/unocore/unostyle.cxx index 2169cb9cd285..acf2ae04d9f7 100644 --- a/sw/source/core/unocore/unostyle.cxx +++ b/sw/source/core/unocore/unostyle.cxx @@ -114,11 +114,11 @@ #include <set> #include <limits> +namespace { + class SwXStyle; class SwStyleProperties_Impl; -namespace -{ struct StyleFamilyEntry { using GetCountOrName_t = std::function<sal_Int32 (const SwDoc&, OUString*, sal_Int32)>; @@ -184,6 +184,8 @@ using namespace ::com::sun::star; namespace sw { + namespace { + class XStyleFamily : public cppu::WeakImplHelper < container::XNameContainer, @@ -281,8 +283,11 @@ namespace sw { return { "com.sun.star.style.StyleFamily" }; } }; + } } +namespace { + class SwStyleBase_Impl; class SwXStyle : public cppu::WeakImplHelper < @@ -454,6 +459,7 @@ public: virtual css::uno::Sequence< css::uno::Any > SAL_CALL getPropertyValues( const css::uno::Sequence< OUString >& aPropertyNames ) override; }; +} using sw::XStyleFamily; @@ -1114,6 +1120,8 @@ static const std::vector<ParagraphStyleCategoryEntry>* lcl_GetParagraphStyleCate return our_pParagraphStyleCategoryEntries; } +namespace { + class SwStyleProperties_Impl { const PropertyEntryVector_t aPropertyEntries; @@ -1168,6 +1176,8 @@ public: } }; +} + static SwGetPoolIdFromName lcl_GetSwEnumFromSfxEnum(SfxStyleFamily eFamily) { auto pEntries(lcl_GetStyleFamilyEntries()); @@ -1463,6 +1473,8 @@ void SwXStyle::ApplyDescriptorProperties() m_pPropertiesImpl->Apply(*this); } +namespace { + class SwStyleBase_Impl { private: @@ -1528,8 +1540,6 @@ public: }; }; -namespace -{ const char* STR_POOLPAGE_ARY[] = { // Page styles diff --git a/sw/source/core/unocore/unotbl.cxx b/sw/source/core/unocore/unotbl.cxx index 1ad6dc454657..77330375aebf 100644 --- a/sw/source/core/unocore/unotbl.cxx +++ b/sw/source/core/unocore/unotbl.cxx @@ -1805,6 +1805,8 @@ void SwXTextTableCursor::Notify( const SfxHint& rHint ) // SwXTextTable =========================================================== +namespace { + class SwTableProperties_Impl { SwUnoCursorHelper::SwAnyMapHelper aAnyMap; @@ -1819,6 +1821,8 @@ public: void ApplyTableAttr(const SwTable& rTable, SwDoc& rDoc); }; +} + SwTableProperties_Impl::SwTableProperties_Impl() { } diff --git a/sw/source/core/unocore/unotext.cxx b/sw/source/core/unocore/unotext.cxx index d49b07e35cb9..7b528399a035 100644 --- a/sw/source/core/unocore/unotext.cxx +++ b/sw/source/core/unocore/unotext.cxx @@ -1777,6 +1777,8 @@ SwXText::convertToTextFrame( return xRet; } +namespace { + // Move previously imported paragraphs into a new text table. struct VerticallyMergedCell { @@ -1793,6 +1795,8 @@ struct VerticallyMergedCell } }; +} + #define COL_POS_FUZZY 2 static bool lcl_SimilarPosition( const sal_Int32 nPos1, const sal_Int32 nPos2 ) diff --git a/sw/source/core/view/pagepreviewlayout.cxx b/sw/source/core/view/pagepreviewlayout.cxx index 07fe504f9b9a..a47c59d71209 100644 --- a/sw/source/core/view/pagepreviewlayout.cxx +++ b/sw/source/core/view/pagepreviewlayout.cxx @@ -867,6 +867,8 @@ void SwPagePreviewLayout::CalcStartValuesForSelectedPageMove( _orNewStartPos = aNewStartPos; } +namespace { + /** checks, if given position is inside a shown document page */ struct PreviewPosInsidePagePred { @@ -885,6 +887,8 @@ struct PreviewPosInsidePagePred } }; +} + bool SwPagePreviewLayout::IsPreviewPosInDocPreviewPage( const Point& rPreviewPos, Point& _orDocPos, bool& _obPosInEmptyPage, @@ -1302,6 +1306,8 @@ void SwPagePreviewLayout::MarkNewSelectedPage( const sal_uInt16 _nSelectedPage ) // helper methods +namespace { + /** get preview page by physical page number OD 17.12.2002 #103492# @@ -1318,6 +1324,8 @@ struct EqualsPageNumPred } }; +} + const PreviewPage* SwPagePreviewLayout::GetPreviewPageByPageNum( const sal_uInt16 _nPageNum ) const { auto aFoundPreviewPageIter = diff --git a/sw/source/core/view/vprint.cxx b/sw/source/core/view/vprint.cxx index 8f0600d59a1d..7828ad97adf1 100644 --- a/sw/source/core/view/vprint.cxx +++ b/sw/source/core/view/vprint.cxx @@ -90,6 +90,8 @@ public: SwQueuedPaint *SwPaintQueue::s_pPaintQueue = nullptr; +namespace { + // saves some settings from the draw view class SwDrawViewSave { @@ -100,6 +102,8 @@ public: ~SwDrawViewSave(); }; +} + void SwPaintQueue::Add( SwViewShell *pNew, const SwRect &rNew ) { SwQueuedPaint *pPt; diff --git a/sw/source/filter/ascii/ascatr.cxx b/sw/source/filter/ascii/ascatr.cxx index 9490e1bfc926..ddf2dec8c56d 100644 --- a/sw/source/filter/ascii/ascatr.cxx +++ b/sw/source/filter/ascii/ascatr.cxx @@ -45,6 +45,8 @@ * For all nodes, attributes, formats and chars. */ +namespace { + class SwASC_AttrIter { SwASCWriter& rWrt; @@ -69,6 +71,8 @@ public: bool OutAttr( sal_Int32 nSwPos ); }; +} + SwASC_AttrIter::SwASC_AttrIter( SwASCWriter& rWr, const SwTextNode& rTextNd, @@ -168,6 +172,8 @@ bool SwASC_AttrIter::OutAttr( sal_Int32 nSwPos ) return bRet; } +namespace { + class SwASC_RedlineIter { private: @@ -236,6 +242,8 @@ public: } }; +} + // Output of the node static Writer& OutASC_SwTextNode( Writer& rWrt, SwContentNode& rNode ) diff --git a/sw/source/filter/ascii/parasc.cxx b/sw/source/filter/ascii/parasc.cxx index cbdae221ed1e..a2c0538ebf9b 100644 --- a/sw/source/filter/ascii/parasc.cxx +++ b/sw/source/filter/ascii/parasc.cxx @@ -49,6 +49,8 @@ #define ASC_BUFFLEN 4096 +namespace { + class SwASCIIParser { SwDoc* pDoc; @@ -74,6 +76,8 @@ public: ErrCode CallParser(); }; +} + // Call for the general reader interface ErrCode AsciiReader::Read( SwDoc &rDoc, const OUString&, SwPaM &rPam, const OUString & ) { diff --git a/sw/source/filter/html/css1atr.cxx b/sw/source/filter/html/css1atr.cxx index 909ec61ba98c..093409868ebc 100644 --- a/sw/source/filter/html/css1atr.cxx +++ b/sw/source/filter/html/css1atr.cxx @@ -210,6 +210,8 @@ OString GetCSS1_Color(const Color& rColor) return "#" + lclConvToHex(rColor.GetRed()) + lclConvToHex(rColor.GetGreen()) + lclConvToHex(rColor.GetBlue()); } +namespace { + class SwCSS1OutMode { SwHTMLWriter& rWrt; @@ -234,6 +236,8 @@ public: } }; +} + void SwHTMLWriter::OutCSS1_Property( const sal_Char *pProp, const sal_Char *pVal, const OUString *pSVal ) diff --git a/sw/source/filter/html/htmlatr.cxx b/sw/source/filter/html/htmlatr.cxx index 67ca2a1b4aec..72c3e20b68e8 100644 --- a/sw/source/filter/html/htmlatr.cxx +++ b/sw/source/filter/html/htmlatr.cxx @@ -201,6 +201,8 @@ sal_uInt16 SwHTMLWriter::GetCSS1ScriptForScriptType( sal_uInt16 nScriptType ) * Otherwise, attributes of the format are output as well. */ +namespace { + struct SwHTMLTextCollOutputInfo { OString aToken; // End token to be output @@ -223,6 +225,8 @@ struct SwHTMLTextCollOutputInfo bool ShouldOutputToken() const { return bOutPara || !HasParaToken(); } }; +} + SwHTMLFormatInfo::SwHTMLFormatInfo( const SwFormat *pF, SwDoc *pDoc, SwDoc *pTemplate, bool bOutStyles, LanguageType eDfltLang, @@ -1029,6 +1033,8 @@ static void OutHTML_SwFormatOff( Writer& rWrt, const SwHTMLTextCollOutputInfo& r } } +namespace { + class HTMLStartEndPos { sal_Int32 nStart; @@ -1048,6 +1054,8 @@ public: void SetEnd( sal_Int32 nE ) { nEnd = nE; } }; +} + HTMLStartEndPos::HTMLStartEndPos( const SfxPoolItem& rItem, sal_Int32 nStt, sal_Int32 nE ) : nStart( nStt ), @@ -1069,8 +1077,6 @@ enum HTMLOnOffState { HTML_NOT_SUPPORTED, // unsupported Attribute HTML_DROPCAP_VALUE, // DropCap-Attribute HTML_AUTOFMT_VALUE }; // Attribute for automatic character styles -} - class HTMLEndPosLst { HTMLStartEndPositions aStartLst; // list, sorted for start positions @@ -1153,6 +1159,8 @@ public: bool IsHTMLMode( sal_uLong nMode ) const { return (nHTMLMode & nMode) != 0; } }; +} + void HTMLEndPosLst::InsertItem_( HTMLStartEndPos *pPos, HTMLStartEndPositions::size_type nEndPos ) { // Insert the attribute in the Start list behind all attributes that diff --git a/sw/source/filter/html/htmlfld.cxx b/sw/source/filter/html/htmlfld.cxx index 92ecf5578909..e7de3fad7ee6 100644 --- a/sw/source/filter/html/htmlfld.cxx +++ b/sw/source/filter/html/htmlfld.cxx @@ -38,12 +38,16 @@ using namespace nsSwDocInfoSubType; using namespace ::com::sun::star; +namespace { + struct HTMLNumFormatTableEntry { const sal_Char *pName; NfIndexTableOffset const eFormat; }; +} + static HTMLOptionEnum<SwFieldIds> const aHTMLFieldTypeTable[] = { { OOO_STRING_SW_HTML_FT_author, SwFieldIds::Author }, diff --git a/sw/source/filter/html/htmlform.cxx b/sw/source/filter/html/htmlform.cxx index 13f33ac57839..6f536bab0bdc 100644 --- a/sw/source/filter/html/htmlform.cxx +++ b/sw/source/filter/html/htmlform.cxx @@ -365,6 +365,8 @@ const uno::Reference< script::XEventAttacherManager >& return m_xFormEventManager; } +namespace { + class SwHTMLImageWatcher : public cppu::WeakImplHelper< awt::XImageConsumer, XEventListener > { @@ -408,6 +410,8 @@ public: virtual void SAL_CALL disposing( const EventObject& Source ) override; }; +} + SwHTMLImageWatcher::SwHTMLImageWatcher( const uno::Reference< drawing::XShape >& rShape, bool bWidth, bool bHeight ) : diff --git a/sw/source/filter/html/htmltab.cxx b/sw/source/filter/html/htmltab.cxx index 0d659d7dfd65..12153fb74c4d 100644 --- a/sw/source/filter/html/htmltab.cxx +++ b/sw/source/filter/html/htmltab.cxx @@ -82,6 +82,8 @@ static HTMLOptionEnum<sal_Int16> const aHTMLTableVAlignTable[] = // table tags options +namespace { + struct HTMLTableOptions { sal_uInt16 nCols; @@ -165,6 +167,8 @@ public: size_t GetContextStAttrMin() const { return nContextStAttrMin; } }; +} + // Cell content is a linked list with SwStartNodes and // HTMLTables. @@ -208,6 +212,8 @@ public: const std::shared_ptr<SwHTMLTableLayoutCnts>& CreateLayoutInfo(); }; +namespace { + // Cell of a HTML table class HTMLTableCell { @@ -271,9 +277,13 @@ public: bool IsCovered() const { return mbCovered; } }; +} + // Row of a HTML table typedef std::vector<HTMLTableCell> HTMLTableCells; +namespace { + class HTMLTableRow { HTMLTableCells m_aCells; ///< cells of the row @@ -365,6 +375,8 @@ public: std::unique_ptr<SwHTMLTableLayoutColumn> CreateLayoutInfo(); }; +} + // HTML table typedef std::vector<HTMLTableRow> HTMLTableRows; @@ -3874,6 +3886,8 @@ void SwHTMLParser::BuildTableCell( HTMLTable *pCurTable, bool bReadOptions, xSaveStruct.reset(); } +namespace { + class RowSaveStruct : public SwPendingData { public: @@ -3886,6 +3900,8 @@ public: {} }; +} + void SwHTMLParser::BuildTableRow( HTMLTable *pCurTable, bool bReadOptions, SvxAdjust eGrpAdjust, sal_Int16 eGrpVertOri ) @@ -4245,6 +4261,8 @@ void SwHTMLParser::BuildTableSection( HTMLTable *pCurTable, // now we stand (perhaps) in front of <TBODY>,... or </TABLE> } +namespace { + struct TableColGrpSaveStruct : public SwPendingData { sal_uInt16 nColGrpSpan; @@ -4258,6 +4276,8 @@ struct TableColGrpSaveStruct : public SwPendingData inline void CloseColGroup( HTMLTable *pTable ); }; +} + inline TableColGrpSaveStruct::TableColGrpSaveStruct() : nColGrpSpan( 1 ), nColGrpWidth( 0 ), bRelColGrpWidth( false ), eColGrpAdjust( SvxAdjust::End ), @@ -4677,6 +4697,8 @@ void SwHTMLParser::BuildTableCaption( HTMLTable *pCurTable ) *m_pPam->GetPoint() = xSaveStruct->GetPos(); } +namespace { + class TableSaveStruct : public SwPendingData { public: @@ -4692,6 +4714,8 @@ public: void MakeTable( sal_uInt16 nWidth, SwPosition& rPos, SwDoc *pDoc ); }; +} + void TableSaveStruct::MakeTable( sal_uInt16 nWidth, SwPosition& rPos, SwDoc *pDoc ) { m_xCurrentTable->MakeTable(nullptr, nWidth); diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index 577a9f5c7b11..b34ae8485d6e 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -56,6 +56,8 @@ using namespace ::com::sun::star; +namespace { + class SwHTMLWrtTable : public SwWriteTable { static void Pixelize( sal_uInt16& rValue ); @@ -88,6 +90,8 @@ public: sal_uInt16 nHSpace=0, sal_uInt16 nVSpace=0 ) const; }; +} + SwHTMLWrtTable::SwHTMLWrtTable( const SwTableLines& rLines, long nWidth, sal_uInt32 nBWidth, bool bRel, sal_uInt16 nLSub, sal_uInt16 nRSub, diff --git a/sw/source/filter/html/svxcss1.cxx b/sw/source/filter/html/svxcss1.cxx index 721a9e4afd59..cbfbe2e919f3 100644 --- a/sw/source/filter/html/svxcss1.cxx +++ b/sw/source/filter/html/svxcss1.cxx @@ -256,6 +256,8 @@ static sal_uInt16 const aBorderWidths[] = #undef SBORDER_ENTRY #undef DBORDER_ENTRY +namespace { + struct SvxCSS1ItemIds { sal_uInt16 nFont; @@ -295,6 +297,8 @@ struct SvxCSS1ItemIds sal_uInt16 nDirection; }; +} + static SvxCSS1ItemIds aItemIds; struct SvxCSS1BorderInfo @@ -3062,6 +3066,8 @@ static void ParseCSS1_so_language( const CSS1Expression *pExpr, } } +namespace { + // the assignment of property to parsing function struct CSS1PropEntry { @@ -3069,6 +3075,8 @@ struct CSS1PropEntry FnParseCSS1Prop pFunc; }; +} + #define CSS1_PROP_ENTRY(p) \ { sCSS1_P_##p, ParseCSS1_##p } diff --git a/sw/source/filter/rtf/swparrtf.cxx b/sw/source/filter/rtf/swparrtf.cxx index e9854065b387..394da93ad3a0 100644 --- a/sw/source/filter/rtf/swparrtf.cxx +++ b/sw/source/filter/rtf/swparrtf.cxx @@ -39,12 +39,15 @@ using namespace ::com::sun::star; +namespace +{ /// Glue class to call RtfImport as an internal filter, needed by copy&paste support. class SwRTFReader : public Reader { ErrCode Read(SwDoc& rDoc, const OUString& rBaseURL, SwPaM& rPam, const OUString& rFileName) override; }; +} ErrCode SwRTFReader::Read(SwDoc& rDoc, const OUString& /*rBaseURL*/, SwPaM& rPam, const OUString& /*rFileName*/) diff --git a/sw/source/filter/ww8/docxattributeoutput.cxx b/sw/source/filter/ww8/docxattributeoutput.cxx index b6caf17412b3..152a947c3afb 100644 --- a/sw/source/filter/ww8/docxattributeoutput.cxx +++ b/sw/source/filter/ww8/docxattributeoutput.cxx @@ -180,6 +180,8 @@ static const sal_Int32 Tag_TableDefinition = 15; static const sal_Int32 Tag_OutputFlyFrame = 16; static const sal_Int32 Tag_StartSection = 17; +namespace { + class FFDataWriterHelper { ::sax_fastparser::FSHelperPtr m_pSerializer; @@ -289,6 +291,9 @@ class FieldMarkParamsHelper return bResult; } }; + +} + void DocxAttributeOutput::RTLAndCJKState( bool bIsRTL, sal_uInt16 /*nScript*/ ) { if (bIsRTL) @@ -5749,6 +5754,8 @@ oox::drawingml::DrawingML& DocxAttributeOutput::GetDrawingML() return m_rDrawingML; } +namespace { + /// Functor to do case-insensitive ordering of OUString instances. struct OUStringIgnoreCase { @@ -5758,6 +5765,8 @@ struct OUStringIgnoreCase } }; +} + /// Guesses if a style created in Writer (no grab-bag) should be qFormat or not. static bool lcl_guessQFormat(const OUString& rName, sal_uInt16 nWwId) { diff --git a/sw/source/filter/ww8/rtfexport.cxx b/sw/source/filter/ww8/rtfexport.cxx index f29268032ed0..db27ad412270 100644 --- a/sw/source/filter/ww8/rtfexport.cxx +++ b/sw/source/filter/ww8/rtfexport.cxx @@ -1433,6 +1433,8 @@ void RtfExport::WriteHeaderFooter(const SwFrameFormat& rFormat, bool bHeader, co SAL_INFO("sw.rtf", OSL_THIS_FUNC << " end"); } +namespace +{ /// Glue class to call RtfExport as an internal filter, needed by copy&paste support. class SwRTFWriter : public Writer { @@ -1444,6 +1446,7 @@ public: ErrCode WriteStream() override; }; +} SwRTFWriter::SwRTFWriter(const OUString& rFilterName, const OUString& rBaseURL) { diff --git a/sw/source/filter/ww8/writerhelper.cxx b/sw/source/filter/ww8/writerhelper.cxx index fa56ce68878e..cf2a051bd237 100644 --- a/sw/source/filter/ww8/writerhelper.cxx +++ b/sw/source/filter/ww8/writerhelper.cxx @@ -686,6 +686,8 @@ namespace sw maStack.emplace_back(new SwFltStackEntry(rPos, std::unique_ptr<SfxPoolItem>(rAttr.Clone()))); } + namespace { + class SameOpenRedlineType { private: @@ -700,6 +702,8 @@ namespace sw } }; + } + bool RedlineStack::close(const SwPosition& rPos, RedlineType eType) { //Search from end for same type diff --git a/sw/source/filter/ww8/writerwordglue.cxx b/sw/source/filter/ww8/writerwordglue.cxx index 9853bb36fee6..d2ae4e6e7b19 100644 --- a/sw/source/filter/ww8/writerwordglue.cxx +++ b/sw/source/filter/ww8/writerwordglue.cxx @@ -321,6 +321,8 @@ namespace myImplHelpers return GetSubsFontName(rFont, SubsFontFlags::ONLYONE | SubsFontFlags::MS); } + namespace { + //Utility to remove entries before a given starting position class IfBeforeStart { @@ -333,6 +335,8 @@ namespace myImplHelpers return rEntry.mnEndPos < mnStart; } }; + + } } /// Count what Word calls left/right margin from a format's LRSpace + Box. diff --git a/sw/source/filter/ww8/wrtw8nds.cxx b/sw/source/filter/ww8/wrtw8nds.cxx index 89de28bf5182..13732268af52 100644 --- a/sw/source/filter/ww8/wrtw8nds.cxx +++ b/sw/source/filter/ww8/wrtw8nds.cxx @@ -169,6 +169,8 @@ MSWordAttrIter::~MSWordAttrIter() m_rExport.m_pChpIter = pOld; } +namespace { + class sortswflys { public: @@ -178,6 +180,8 @@ public: } }; +} + void SwWW8AttrIter::IterToCurrent() { OSL_ENSURE(maCharRuns.begin() != maCharRuns.end(), "Impossible"); @@ -1936,6 +1940,8 @@ bool MSWordExportBase::GetAnnotationMarks( const SwWW8AttrIter& rAttrs, sal_Int3 return ( !rArr.empty() ); } +namespace { + class CompareMarksEnd { public: @@ -1948,6 +1954,8 @@ public: } }; +} + bool MSWordExportBase::NearestBookmark( sal_Int32& rNearest, const sal_Int32 nCurrentPos, bool bNextPositionOnly ) { bool bHasBookmark = false; diff --git a/sw/source/filter/ww8/wrtw8sty.cxx b/sw/source/filter/ww8/wrtw8sty.cxx index 3c6813406420..aad292dc5b18 100644 --- a/sw/source/filter/ww8/wrtw8sty.cxx +++ b/sw/source/filter/ww8/wrtw8sty.cxx @@ -88,6 +88,8 @@ struct WW8_PdAttrDesc { } }; +namespace { + struct WW8_SED { SVBT16 aBits1; // orientation change + internal, Default: 6 @@ -99,6 +101,8 @@ struct WW8_SED // cbSED is 12 (decimal)), C (hex). }; +} + // class WW8_WrPlc0 is only used for header and footer positioning // ie there is no content support structure class WW8_WrPlc0 diff --git a/sw/source/filter/ww8/wrtww8.cxx b/sw/source/filter/ww8/wrtww8.cxx index e908cab35162..bf755c606808 100644 --- a/sw/source/filter/ww8/wrtww8.cxx +++ b/sw/source/filter/ww8/wrtww8.cxx @@ -2665,6 +2665,8 @@ void WW8Export::SectionBreaksAndFrames( const SwTextNode& rNode ) OutputSectionBreaks( rNode.GetpSwAttrSet(), rNode ); } +namespace { + class TrackContentToExport { private: @@ -2707,6 +2709,8 @@ public: } }; +} + void MSWordExportBase::WriteText() { TrackContentToExport aContentTracking(m_pCurPam.get(), m_nCurStart, m_nCurEnd); diff --git a/sw/source/filter/ww8/ww8atr.cxx b/sw/source/filter/ww8/ww8atr.cxx index 00dd85bdb6cd..b5cfddc8fde2 100644 --- a/sw/source/filter/ww8/ww8atr.cxx +++ b/sw/source/filter/ww8/ww8atr.cxx @@ -4872,6 +4872,8 @@ void WW8AttributeOutput::ParaWidows( const SvxWidowsItem& rWidows ) m_rWW8Export.pO->push_back( rWidows.GetValue() ? 1 : 0 ); } +namespace { + class SwWW8WrTabu { std::unique_ptr<sal_uInt8[]> pDel; // DelArray @@ -4891,6 +4893,8 @@ public: void PutAll(WW8Export& rWW8Wrt); }; +} + SwWW8WrTabu::SwWW8WrTabu(sal_uInt16 nDelMax, sal_uInt16 nAddMax) : nAdd(0), nDel(0) { diff --git a/sw/source/filter/ww8/ww8graf.cxx b/sw/source/filter/ww8/ww8graf.cxx index a49d9dea7054..b780e3ac6c66 100644 --- a/sw/source/filter/ww8/ww8graf.cxx +++ b/sw/source/filter/ww8/ww8graf.cxx @@ -574,6 +574,8 @@ static void lcl_StripFields(OUString &rString, WW8_CP &rNewStartCp) } } +namespace { + class Chunk { private: @@ -595,8 +597,6 @@ public: } }; -namespace -{ bool IsValidSel(const EditEngine& rEngine, const ESelection& rSel) { const auto nParaCount = rEngine.GetParagraphCount(); diff --git a/sw/source/filter/ww8/ww8par.cxx b/sw/source/filter/ww8/ww8par.cxx index ca2c97b2125d..bf9c2804a16a 100644 --- a/sw/source/filter/ww8/ww8par.cxx +++ b/sw/source/filter/ww8/ww8par.cxx @@ -360,6 +360,8 @@ void SwWW8ImplReader::ReadEmbeddedData(SvStream& rStrm, SwDocShell const * pDocS } } +namespace { + class BasicProjImportHelper { SwDocShell& mrDocShell; @@ -373,6 +375,8 @@ public: OUString getProjectName() const; }; +} + bool BasicProjImportHelper::import( const uno::Reference< io::XInputStream >& rxIn ) { bool bRet = false; @@ -412,6 +416,8 @@ OUString BasicProjImportHelper::getProjectName() const return sProjName; } +namespace { + class Sttb : public TBBase { struct SBBItem @@ -436,6 +442,8 @@ public: OUString getStringAtIndex( sal_uInt32 ); }; +} + Sttb::Sttb() : fExtend(0) , cData(0) @@ -4870,6 +4878,8 @@ static void lcl_createTemplateToProjectEntry( const uno::Reference< container::X } } +namespace { + class WW8Customizations { SvStream* mpTableStream; @@ -4879,6 +4889,8 @@ public: void Import( SwDocShell* pShell ); }; +} + WW8Customizations::WW8Customizations( SvStream* pTableStream, WW8Fib const & rFib ) : mpTableStream(pTableStream), mWw8Fib( rFib ) { } diff --git a/sw/source/filter/ww8/ww8par3.cxx b/sw/source/filter/ww8/ww8par3.cxx index c07da7e81efb..eafe88b8392c 100644 --- a/sw/source/filter/ww8/ww8par3.cxx +++ b/sw/source/filter/ww8/ww8par3.cxx @@ -327,6 +327,8 @@ typedef sal_uInt16 WW8aIdSty[WW8ListManager::nMaxLevel]; // Character Style Pointer typedef SwCharFormat* WW8aCFormat[WW8ListManager::nMaxLevel]; +namespace { + struct WW8LST // only THOSE entries, WE need! { WW8aIdSty aIdSty; // Style Id's for each level, @@ -338,8 +340,12 @@ struct WW8LST // only THOSE entries, WE need! // true if the list should start numbering over }; // at the beginning of each section +} + const sal_uInt32 cbLSTF=28; +namespace { + struct WW8LFO // only THOSE entries, WE need! { SwNumRule* pNumRule; // Parent NumRule @@ -388,6 +394,8 @@ struct WW8LFOLVL nStartAt(1), nLevel(0), bStartAt(true), bFormat(false) {} }; +} + // Data to be saved in ListInfo struct WW8LSTInfo // sorted by nIdLst (in WW8 used list-Id) @@ -457,6 +465,8 @@ SprmResult WW8ListManager::GrpprlHasSprm(sal_uInt16 nId, sal_uInt8& rSprms, return maSprmParser.findSprmData(nId, &rSprms, nLen); } +namespace { + class ListWithId { private: @@ -467,6 +477,8 @@ public: { return (pEntry->nIdLst == mnIdLst); } }; +} + // Access via List-Id of LST Entry WW8LSTInfo* WW8ListManager::GetLSTByListId( sal_uInt32 nIdLst ) const { diff --git a/sw/source/filter/ww8/ww8par4.cxx b/sw/source/filter/ww8/ww8par4.cxx index 3b5535ef430a..ceaed401a577 100644 --- a/sw/source/filter/ww8/ww8par4.cxx +++ b/sw/source/filter/ww8/ww8par4.cxx @@ -60,6 +60,8 @@ #include "ww8par.hxx" #include "ww8par2.hxx" +namespace { + struct OLE_MFP { sal_Int16 mm; // 0x6 int @@ -68,6 +70,8 @@ struct OLE_MFP sal_Int16 hMF; // 0xc int }; +} + using namespace ::com::sun::star; static bool SwWw8ReadScaling(long& rX, long& rY, tools::SvRef<SotStorage> const & rSrc1) diff --git a/sw/source/filter/ww8/ww8scan.cxx b/sw/source/filter/ww8/ww8scan.cxx index 142d20c8ee98..4e522698dede 100644 --- a/sw/source/filter/ww8/ww8scan.cxx +++ b/sw/source/filter/ww8/ww8scan.cxx @@ -3015,6 +3015,8 @@ void WW8PLCFx::SetIdx2(sal_uInt32) { } +namespace { + class SamePos { private: @@ -3025,6 +3027,8 @@ public: {return mnPo == pFkp->GetFilePos();} }; +} + bool WW8PLCFx_Fc_FKP::NewFkp() { WW8_CP nPLCFStart, nPLCFEnd; @@ -7031,7 +7035,6 @@ std::unique_ptr<WW8_STD> WW8Style::Read1Style(sal_uInt16& rSkip, OUString* pStri namespace { const sal_uInt16 maxStrSize = 65; -} struct WW8_FFN_Ver6 { @@ -7062,6 +7065,8 @@ struct WW8_FFN_Ver8 : public WW8_FFN_BASE // font does not exist on this system. }; +} + // #i43762# check font name for illegal characters static void lcl_checkFontname( OUString& sString ) { diff --git a/sw/source/filter/ww8/ww8toolbar.cxx b/sw/source/filter/ww8/ww8toolbar.cxx index d3b52cce6cc3..5d34c76fee6e 100644 --- a/sw/source/filter/ww8/ww8toolbar.cxx +++ b/sw/source/filter/ww8/ww8toolbar.cxx @@ -35,6 +35,8 @@ const short nVisualData = 5; typedef std::map< sal_Int16, OUString > IdToString; +namespace { + class MSOWordCommandConvertor : public MSOCommandConvertor { IdToString msoToOOcmd; @@ -46,6 +48,8 @@ public: virtual OUString MSOTCIDToOOCommand( sal_Int16 key ) override; }; +} + MSOWordCommandConvertor::MSOWordCommandConvertor() { // mso command id to ooo command string diff --git a/sw/source/filter/xml/XMLRedlineImportHelper.cxx b/sw/source/filter/xml/XMLRedlineImportHelper.cxx index bfd4e488fcb8..1075588797ce 100644 --- a/sw/source/filter/xml/XMLRedlineImportHelper.cxx +++ b/sw/source/filter/xml/XMLRedlineImportHelper.cxx @@ -86,6 +86,8 @@ static SwDoc* lcl_GetDocViaTunnel( Reference<XTextRange> const & rRange ) // the matter that (e.g in section import) we delete a few characters, // which may cause bookmarks (as used by XTextRange) to be deleted. +namespace { + class XTextRangeOrNodeIndexPosition { Reference<XTextRange> xRange; @@ -104,6 +106,8 @@ public: bool IsValid() const; }; +} + XTextRangeOrNodeIndexPosition::XTextRangeOrNodeIndexPosition() { } diff --git a/sw/source/filter/xml/xmlfmt.cxx b/sw/source/filter/xml/xmlfmt.cxx index b0a453d48443..fd6f957be4a1 100644 --- a/sw/source/filter/xml/xmlfmt.cxx +++ b/sw/source/filter/xml/xmlfmt.cxx @@ -64,6 +64,8 @@ using namespace ::com::sun::star::beans; using namespace ::com::sun::star::uno; using namespace ::xmloff::token; +namespace { + class SwXMLConditionParser_Impl { OUString const sInput; @@ -89,6 +91,8 @@ public: sal_uInt32 GetSubCondition() const { return nSubCondition; } }; +} + inline bool SwXMLConditionParser_Impl::SkipWS() { while( nPos < nLength && ' ' == sInput[nPos] ) @@ -197,6 +201,8 @@ SwXMLConditionParser_Impl::SwXMLConditionParser_Impl( const OUString& rInp ) : } } +namespace { + class SwXMLConditionContext_Impl : public SvXMLImportContext { Master_CollCondition nCondition; @@ -218,6 +224,8 @@ public: OUString const &getApplyStyle() const { return sApplyStyle; } }; +} + SwXMLConditionContext_Impl::SwXMLConditionContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, @@ -258,6 +266,8 @@ SwXMLConditionContext_Impl::SwXMLConditionContext_Impl( typedef std::vector<rtl::Reference<SwXMLConditionContext_Impl>> SwXMLConditions_Impl; +namespace { + class SwXMLTextStyleContext_Impl : public XMLTextStyleContext { std::unique_ptr<SwXMLConditions_Impl> pConditions; @@ -283,6 +293,7 @@ public: const uno::Reference< xml::sax::XAttributeList > & xAttrList ) override; }; +} uno::Reference < style::XStyle > SwXMLTextStyleContext_Impl::Create() { @@ -388,6 +399,8 @@ SvXMLImportContextRef SwXMLTextStyleContext_Impl::CreateChildContext( return xContext; } +namespace { + class SwXMLItemSetStyleContext_Impl : public SvXMLStyleContext { OUString sMasterPageName; @@ -442,6 +455,8 @@ public: bool ResolveDataStyleName(); }; +} + void SwXMLItemSetStyleContext_Impl::SetAttribute( sal_uInt16 nPrefixKey, const OUString& rLocalName, const OUString& rValue ) @@ -665,6 +680,8 @@ bool SwXMLItemSetStyleContext_Impl::ResolveDataStyleName() } } +namespace { + class SwXMLStylesContext_Impl : public SvXMLStylesContext { SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); } @@ -706,6 +723,8 @@ public: virtual void EndElement() override; }; +} + SvXMLStyleContext *SwXMLStylesContext_Impl::CreateStyleChildContext( sal_uInt16 nPrefix, const OUString& rLocalName, const css::uno::Reference< css::xml::sax::XAttributeList > & xAttrList ) @@ -887,6 +906,8 @@ void SwXMLStylesContext_Impl::EndElement() GetSwImport().InsertStyles( IsAutomaticStyle() ); } +namespace { + class SwXMLMasterStylesContext_Impl : public XMLTextMasterStylesContext { protected: @@ -907,6 +928,7 @@ public: virtual void EndElement() override; }; +} SwXMLMasterStylesContext_Impl::SwXMLMasterStylesContext_Impl( SwXMLImport& rImport, diff --git a/sw/source/filter/xml/xmlfmte.cxx b/sw/source/filter/xml/xmlfmte.cxx index 642e9d1d93fd..485bf87e764e 100644 --- a/sw/source/filter/xml/xmlfmte.cxx +++ b/sw/source/filter/xml/xmlfmte.cxx @@ -257,6 +257,8 @@ void SwXMLExport::ExportMasterStyles_() GetPageExport()->exportMasterStyles( false ); } +namespace { + class SwXMLAutoStylePoolP : public SvXMLAutoStylePoolP { SvXMLExport& rExport; @@ -278,6 +280,8 @@ public: explicit SwXMLAutoStylePoolP( SvXMLExport& rExport ); }; +} + void SwXMLAutoStylePoolP::exportStyleAttributes( SvXMLAttributeList& rAttrList, sal_Int32 nFamily, diff --git a/sw/source/filter/xml/xmlfonte.cxx b/sw/source/filter/xml/xmlfonte.cxx index 7b92a8c43419..1f910e60944e 100644 --- a/sw/source/filter/xml/xmlfonte.cxx +++ b/sw/source/filter/xml/xmlfonte.cxx @@ -30,12 +30,16 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::text; +namespace { + class SwXMLFontAutoStylePool_Impl: public XMLFontAutoStylePool { public: SwXMLFontAutoStylePool_Impl(SwXMLExport& rExport, bool bFontEmbedding); }; +} + SwXMLFontAutoStylePool_Impl::SwXMLFontAutoStylePool_Impl(SwXMLExport& _rExport, bool bFontEmbedding) : XMLFontAutoStylePool(_rExport, bFontEmbedding) { diff --git a/sw/source/filter/xml/xmlimp.cxx b/sw/source/filter/xml/xmlimp.cxx index 43040d441db3..9c983b882db5 100644 --- a/sw/source/filter/xml/xmlimp.cxx +++ b/sw/source/filter/xml/xmlimp.cxx @@ -135,6 +135,8 @@ static const SvXMLTokenMapEntry aDocTokenMap[] = XML_TOKEN_MAP_END }; +namespace { + class SwXMLBodyContext_Impl : public SvXMLImportContext { SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); } @@ -149,6 +151,8 @@ public: const Reference< xml::sax::XAttributeList > & xAttrList ) override; }; +} + SwXMLBodyContext_Impl::SwXMLBodyContext_Impl( SwXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName) : SvXMLImportContext( rImport, nPrfx, rLName ) @@ -187,6 +191,8 @@ SvXMLImportContextRef SwXMLBodyContext_Impl::CreateChildContext( return GetSwImport().CreateBodyContentContext( rLocalName ); } +namespace { + // #i69629# // enhance class <SwXMLDocContext_Impl> in order to be able to create subclasses // NB: virtually inherit so we can multiply inherit properly @@ -212,6 +218,8 @@ public: sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; }; +} + SwXMLDocContext_Impl::SwXMLDocContext_Impl( SwXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName ) : SvXMLImportContext( rImport, nPrfx, rLName ) @@ -286,6 +294,8 @@ SvXMLImportContextRef SwXMLDocContext_Impl::CreateChildContext( return pContext; } +namespace { + // #i69629# - new subclass <SwXMLOfficeDocContext_Impl> of class <SwXMLDocContext_Impl> class SwXMLOfficeDocContext_Impl : public SwXMLDocContext_Impl, public SvXMLMetaDocumentContext @@ -299,6 +309,8 @@ public: sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& Attribs ) override; }; +} + SwXMLOfficeDocContext_Impl::SwXMLOfficeDocContext_Impl( SwXMLImport& rImport, const Reference< document::XDocumentProperties >& xDocProps) : @@ -331,6 +343,8 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL SwXMLOfficeDocContext_I } } +namespace { + // #i69629# - new subclass <SwXMLDocStylesContext_Impl> of class <SwXMLDocContext_Impl> class SwXMLDocStylesContext_Impl : public SwXMLDocContext_Impl { @@ -343,6 +357,8 @@ public: virtual void EndElement() override; }; +} + SwXMLDocStylesContext_Impl::SwXMLDocStylesContext_Impl( SwXMLImport& rImport, sal_uInt16 nPrfx, @@ -1154,6 +1170,8 @@ void SwXMLImport::MergeListsAtDocumentInsertPosition(SwDoc *pDoc) } } +namespace { + // Locally derive XMLTextShapeImportHelper, so we can take care of the // form import This is Writer, but not text specific, so it should go // here! @@ -1175,6 +1193,8 @@ public: virtual ~SvTextShapeImportHelper() override; }; +} + SvTextShapeImportHelper::SvTextShapeImportHelper(SvXMLImport& rImp) : XMLTextShapeImportHelper(rImp) { diff --git a/sw/source/filter/xml/xmlimpit.cxx b/sw/source/filter/xml/xmlimpit.cxx index 2436e2e4f1c8..1da664861205 100644 --- a/sw/source/filter/xml/xmlimpit.cxx +++ b/sw/source/filter/xml/xmlimpit.cxx @@ -215,6 +215,8 @@ SvXMLImportItemMapper::finished(SfxItemSet &, SvXMLUnitConverter const&) const // nothing to do here } +namespace { + struct BoxHolder { std::unique_ptr<SvxBorderLine> pTop; @@ -238,6 +240,8 @@ struct BoxHolder } }; +} + // put an XML-string value into an item bool SvXMLImportItemMapper::PutXMLValue( SfxPoolItem& rItem, diff --git a/sw/source/filter/xml/xmliteme.cxx b/sw/source/filter/xml/xmliteme.cxx index b307a5c10872..433eb1fc2397 100644 --- a/sw/source/filter/xml/xmliteme.cxx +++ b/sw/source/filter/xml/xmliteme.cxx @@ -46,6 +46,8 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::xmloff::token; +namespace { + class SwXMLTableItemMapper_Impl: public SvXMLExportItemMapper { SwXMLBrushItemExport aBrushItemExport; @@ -79,6 +81,8 @@ public: inline void SetAbsWidth( sal_uInt32 nAbs ); }; +} + SwXMLTableItemMapper_Impl::SwXMLTableItemMapper_Impl( SvXMLItemMapEntriesRef rMapEntries, SwXMLExport& rExp ) : diff --git a/sw/source/filter/xml/xmlitemi.cxx b/sw/source/filter/xml/xmlitemi.cxx index e6542b33157d..7708985d0adc 100644 --- a/sw/source/filter/xml/xmlitemi.cxx +++ b/sw/source/filter/xml/xmlitemi.cxx @@ -52,6 +52,8 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; +namespace { + class SwXMLImportTableItemMapper_Impl: public SvXMLImportItemMapper { @@ -85,6 +87,8 @@ private: bool m_bHaveMargin[4]; }; +} + SwXMLImportTableItemMapper_Impl::SwXMLImportTableItemMapper_Impl( const SvXMLItemMapEntriesRef& rMapEntries ) : SvXMLImportItemMapper( rMapEntries ) @@ -229,6 +233,8 @@ void SwXMLImportTableItemMapper_Impl::finished( } } +namespace { + class SwXMLItemSetContext_Impl : public SvXMLItemSetContext { SvXMLImportContextRef xBackground; @@ -252,6 +258,8 @@ public: const SvXMLUnitConverter& rUnitConv ) override; }; +} + SwXMLItemSetContext_Impl::SwXMLItemSetContext_Impl( SwXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, diff --git a/sw/source/filter/xml/xmlmeta.cxx b/sw/source/filter/xml/xmlmeta.cxx index 2a95dc8106cb..c8739eeafa14 100644 --- a/sw/source/filter/xml/xmlmeta.cxx +++ b/sw/source/filter/xml/xmlmeta.cxx @@ -87,8 +87,6 @@ enum SvXMLTokenMapAttrs XML_TOK_META_STAT_END=XML_TOK_UNKNOWN }; -} - struct statistic { SvXMLTokenMapAttrs const token; const char* name; @@ -96,6 +94,8 @@ struct statistic { sal_uLong SwDocStat::* target32; /* or 64, on LP64 platforms */ }; +} + static const struct statistic s_stats [] = { { XML_TOK_META_STAT_TABLE, "TableCount", &SwDocStat::nTable, nullptr }, { XML_TOK_META_STAT_IMAGE, "ImageCount", &SwDocStat::nGrf, nullptr }, diff --git a/sw/source/filter/xml/xmltble.cxx b/sw/source/filter/xml/xmltble.cxx index bef72a6f5357..13d004732c37 100644 --- a/sw/source/filter/xml/xmltble.cxx +++ b/sw/source/filter/xml/xmltble.cxx @@ -84,6 +84,8 @@ public: sal_uInt32 GetRelWidth() const { return nRelWidth; } }; +namespace { + struct SwXMLTableColumnCmpWidth_Impl { bool operator()( SwXMLTableColumn_Impl* const& lhs, SwXMLTableColumn_Impl* const& rhs ) const @@ -98,6 +100,8 @@ struct SwXMLTableColumnCmpWidth_Impl class SwXMLTableColumns_Impl : public o3tl::sorted_vector<std::unique_ptr<SwXMLTableColumn_Impl>, o3tl::less_uniqueptr_to<SwXMLTableColumn_Impl> > { }; +} + class SwXMLTableColumnsSortByWidth_Impl : public o3tl::sorted_vector<SwXMLTableColumn_Impl*, SwXMLTableColumnCmpWidth_Impl> {}; class SwXMLTableLines_Impl diff --git a/sw/source/filter/xml/xmltbli.cxx b/sw/source/filter/xml/xmltbli.cxx index 657ac47e6c4f..db95b73a328b 100644 --- a/sw/source/filter/xml/xmltbli.cxx +++ b/sw/source/filter/xml/xmltbli.cxx @@ -378,6 +378,8 @@ void SwXMLTableRow_Impl::Dispose() } } +namespace { + class SwXMLTableCellContext_Impl : public SvXMLImportContext { OUString m_aStyleName; @@ -422,6 +424,8 @@ public: SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); } }; +} + SwXMLTableCellContext_Impl::SwXMLTableCellContext_Impl( SwXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const Reference< xml::sax::XAttributeList > & xAttrList, @@ -708,6 +712,8 @@ void SwXMLTableCellContext_Impl::EndElement() GetImport().GetTextImport()->SetCellParaStyleDefault(m_sSaveParaDefault); } +namespace { + class SwXMLTableColContext_Impl : public SvXMLImportContext { SvXMLImportContextRef const xMyTable; @@ -724,6 +730,8 @@ public: SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); } }; +} + SwXMLTableColContext_Impl::SwXMLTableColContext_Impl( SwXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const Reference< xml::sax::XAttributeList > & xAttrList, @@ -793,6 +801,8 @@ SwXMLTableColContext_Impl::SwXMLTableColContext_Impl( } } +namespace { + class SwXMLTableColsContext_Impl : public SvXMLImportContext { SvXMLImportContextRef const xMyTable; @@ -813,6 +823,8 @@ public: SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); } }; +} + SwXMLTableColsContext_Impl::SwXMLTableColsContext_Impl( SwXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, SwXMLTableContext *pTable ) : @@ -841,6 +853,8 @@ SvXMLImportContextRef SwXMLTableColsContext_Impl::CreateChildContext( return pContext; } +namespace { + class SwXMLTableRowContext_Impl : public SvXMLImportContext { SvXMLImportContextRef const xMyTable; @@ -865,6 +879,8 @@ public: SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); } }; +} + SwXMLTableRowContext_Impl::SwXMLTableRowContext_Impl( SwXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, @@ -957,6 +973,8 @@ SvXMLImportContextRef SwXMLTableRowContext_Impl::CreateChildContext( return pContext; } +namespace { + class SwXMLTableRowsContext_Impl : public SvXMLImportContext { SvXMLImportContextRef const xMyTable; @@ -979,6 +997,8 @@ public: SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); } }; +} + SwXMLTableRowsContext_Impl::SwXMLTableRowsContext_Impl( SwXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, diff --git a/sw/source/filter/xml/xmltext.cxx b/sw/source/filter/xml/xmltext.cxx index be51bf82ed68..690c3cac4d8d 100644 --- a/sw/source/filter/xml/xmltext.cxx +++ b/sw/source/filter/xml/xmltext.cxx @@ -24,6 +24,8 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::text; +namespace { + class SwXMLBodyContentContext_Impl : public SvXMLImportContext { SwXMLImport& GetSwImport() { return static_cast<SwXMLImport&>(GetImport()); } @@ -41,6 +43,8 @@ public: virtual void EndElement() override; }; +} + SwXMLBodyContentContext_Impl::SwXMLBodyContentContext_Impl( SwXMLImport& rImport, const OUString& rLName ) : SvXMLImportContext( rImport, XML_NAMESPACE_OFFICE, rLName ) diff --git a/sw/source/filter/xml/xmltexti.cxx b/sw/source/filter/xml/xmltexti.cxx index 788bec5c2d47..dac99fc9c7ac 100644 --- a/sw/source/filter/xml/xmltexti.cxx +++ b/sw/source/filter/xml/xmltexti.cxx @@ -70,6 +70,8 @@ using namespace ::com::sun::star::frame; using namespace ::com::sun::star::beans; using namespace xml::sax; +namespace { + struct XMLServiceMapEntry_Impl { const sal_Char *sFilterService; @@ -80,6 +82,8 @@ struct XMLServiceMapEntry_Impl sal_uInt8 n4, n5, n6, n7, n8, n9, n10, n11; }; +} + #define SERVICE_MAP_ENTRY( app, s ) \ { XML_IMPORT_FILTER_##app, sizeof(XML_IMPORT_FILTER_##app)-1, \ SO3_##s##_CLASSID } diff --git a/sw/source/ui/config/mailconfigpage.cxx b/sw/source/ui/config/mailconfigpage.cxx index 1e3946208233..947c39ac52cc 100644 --- a/sw/source/ui/config/mailconfigpage.cxx +++ b/sw/source/ui/config/mailconfigpage.cxx @@ -68,6 +68,8 @@ public: virtual ~SwTestAccountSettingsDialog() override; }; +namespace { + class SwAuthenticationSettingsDialog : public SfxDialogController { SwMailMergeConfigItem& m_rConfigItem; @@ -103,6 +105,8 @@ public: SwAuthenticationSettingsDialog(weld::Window* pParent, SwMailMergeConfigItem& rItem); }; +} + SwMailConfigPage::SwMailConfigPage(weld::Container* pPage, weld::DialogController* pController, const SfxItemSet& rSet) : SfxTabPage(pPage, pController, "modules/swriter/ui/mailconfigpage.ui", "MailConfigPage", &rSet) , m_pConfigItem(new SwMailMergeConfigItem) diff --git a/sw/source/ui/config/optpage.cxx b/sw/source/ui/config/optpage.cxx index 7e49ff3dc2a9..ebc5ed7ae9de 100644 --- a/sw/source/ui/config/optpage.cxx +++ b/sw/source/ui/config/optpage.cxx @@ -1376,6 +1376,8 @@ void SwShdwCursorOptionsTabPage::Reset( const SfxItemSet* rSet ) } } +namespace { + // TabPage for Redlining struct CharAttr { @@ -1383,6 +1385,8 @@ struct CharAttr sal_uInt16 const nAttr; }; +} + // Edit corresponds to Paste-attributes static CharAttr const aRedlineAttr[] = { diff --git a/sw/source/ui/dbui/createaddresslistdialog.cxx b/sw/source/ui/dbui/createaddresslistdialog.cxx index ae4d354ea29d..0d32e4980b36 100644 --- a/sw/source/ui/dbui/createaddresslistdialog.cxx +++ b/sw/source/ui/dbui/createaddresslistdialog.cxx @@ -48,6 +48,8 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::ui::dialogs; +namespace { + struct SwAddressFragment { std::unique_ptr<weld::Builder> m_xBuilder; @@ -67,6 +69,8 @@ struct SwAddressFragment } }; +} + class SwAddressControl_Impl { std::map<weld::Entry*, sal_Int32> m_aEditLines; diff --git a/sw/source/ui/dbui/dbinsdlg.cxx b/sw/source/ui/dbui/dbinsdlg.cxx index 4ead5f41f49b..f25e3f138e41 100644 --- a/sw/source/ui/dbui/dbinsdlg.cxx +++ b/sw/source/ui/dbui/dbinsdlg.cxx @@ -155,6 +155,8 @@ struct DB_Column } }; +namespace { + struct DB_ColumnConfigData { SwInsDBColumns aDBColumns; @@ -177,6 +179,8 @@ struct DB_ColumnConfigData } }; +} + bool SwInsDBColumn::operator<( const SwInsDBColumn& rCmp ) const { return 0 > GetAppCollator().compareString( sColumn, rCmp.sColumn ); diff --git a/sw/source/ui/dbui/mmaddressblockpage.cxx b/sw/source/ui/dbui/mmaddressblockpage.cxx index b911b2ee31ec..a80e4eda9ae5 100644 --- a/sw/source/ui/dbui/mmaddressblockpage.cxx +++ b/sw/source/ui/dbui/mmaddressblockpage.cxx @@ -766,6 +766,8 @@ OUString SwCustomizeAddressBlockDialog::GetAddress() const return sAddress; } +namespace { + struct SwAssignFragment { std::unique_ptr<weld::Builder> m_xBuilder; @@ -790,6 +792,8 @@ struct SwAssignFragment } }; +} + class SwAssignFieldsControl { friend class SwAssignFieldsDialog; diff --git a/sw/source/ui/dbui/mmoutputtypepage.cxx b/sw/source/ui/dbui/mmoutputtypepage.cxx index e5d0b2e8528d..7e1855893a8e 100644 --- a/sw/source/ui/dbui/mmoutputtypepage.cxx +++ b/sw/source/ui/dbui/mmoutputtypepage.cxx @@ -114,6 +114,8 @@ const SwMailDescriptor* SwSendMailDialog_Impl::GetNextDescriptor() return nullptr; } +namespace { + class SwMailDispatcherListener_Impl : public IMailDispatcherListener { SwSendMailDialog& m_rSendMailDialog; @@ -129,6 +131,8 @@ public: static void DeleteAttachments( uno::Reference< mail::XMailMessage > const & xMessage ); }; +} + SwMailDispatcherListener_Impl::SwMailDispatcherListener_Impl(SwSendMailDialog& rParentDlg) : m_rSendMailDialog(rParentDlg) { @@ -178,6 +182,8 @@ void SwMailDispatcherListener_Impl::DeleteAttachments( uno::Reference< mail::XMa } } +namespace { + class SwSendWarningBox_Impl : public weld::MessageDialogController { std::unique_ptr<weld::TextView> m_xDetailED; @@ -192,6 +198,8 @@ public: } }; +} + SwSendMailDialog::SwSendMailDialog(weld::Window *pParent, SwMailMergeConfigItem& rConfigItem) : GenericDialogController(pParent, "modules/swriter/ui/mmsendmails.ui", "SendMailsDialog") , m_sContinue(SwResId( ST_CONTINUE )) diff --git a/sw/source/ui/dbui/mmresultdialogs.cxx b/sw/source/ui/dbui/mmresultdialogs.cxx index 53a76b8eb2bb..19047d79f974 100644 --- a/sw/source/ui/dbui/mmresultdialogs.cxx +++ b/sw/source/ui/dbui/mmresultdialogs.cxx @@ -153,6 +153,8 @@ static void lcl_UpdateEmailSettingsFromGlobalConfig(SwMailMergeConfigItem& rConf rConfigItem.SetInServerPassword(aConfigItem.GetInServerPassword()); } +namespace { + class SwSaveWarningBox_Impl : public SwMessageAndEditDialog { DECL_LINK( ModifyHdl, weld::Entry&, void); @@ -191,6 +193,8 @@ public: } }; +} + SwSaveWarningBox_Impl::SwSaveWarningBox_Impl(weld::Window* pParent, const OUString& rFileName) : SwMessageAndEditDialog(pParent, "AlreadyExistsDialog", "modules/swriter/ui/alreadyexistsdialog.ui") @@ -224,6 +228,8 @@ IMPL_LINK( SwSendQueryBox_Impl, ModifyHdl, weld::Entry&, rEdit, void) m_xOKPB->set_sensitive(bIsEmptyAllowed || !rEdit.get_text().isEmpty()); } +namespace { + class SwCopyToDialog : public SfxDialogController { std::unique_ptr<weld::Entry> m_xCCED; @@ -244,6 +250,8 @@ public: void SetBCC(const OUString& rSet) {m_xBCCED->set_text(rSet);} }; +} + SwMMResultSaveDialog::SwMMResultSaveDialog(weld::Window* pParent) : SfxDialogController(pParent, "modules/swriter/ui/mmresultsavedialog.ui", "MMResultSaveDialog") , m_bCancelSaving(false) diff --git a/sw/source/ui/frmdlg/cption.cxx b/sw/source/ui/frmdlg/cption.cxx index 4320d71aa4f8..5ce3b9f4cb88 100644 --- a/sw/source/ui/frmdlg/cption.cxx +++ b/sw/source/ui/frmdlg/cption.cxx @@ -49,6 +49,8 @@ using namespace ::com::sun::star; +namespace { + class SwSequenceOptionDialog : public weld::GenericDialogController { SwView& m_rView; @@ -86,6 +88,8 @@ public: } }; +} + OUString SwCaptionDialog::our_aSepTextSave(": "); // Caption separator text //Resolves: tdf#47427 disallow typing *or* pasting invalid content into the category box diff --git a/sw/source/ui/frmdlg/frmpage.cxx b/sw/source/ui/frmdlg/frmpage.cxx index 836fde5344f9..89ddff3aa9c4 100644 --- a/sw/source/ui/frmdlg/frmpage.cxx +++ b/sw/source/ui/frmdlg/frmpage.cxx @@ -82,12 +82,16 @@ using namespace ::sfx2; #define SwFPos SvxSwFramePosString +namespace { + struct StringIdPair_Impl { SvxSwFramePosString::StringId const eHori; SvxSwFramePosString::StringId const eVert; }; +} + #define MAX_PERCENT_WIDTH 254 #define MAX_PERCENT_HEIGHT 254 @@ -128,6 +132,8 @@ namespace o3tl { template<> struct typed_flags<LB> : is_typed_flags<LB, 0x00773fffL> {}; } +namespace { + struct RelationMap { SvxSwFramePosString::StringId const eStrId; @@ -136,6 +142,8 @@ struct RelationMap sal_Int16 const nRelation; }; +} + struct FrameMap { SvxSwFramePosString::StringId const eStrId; diff --git a/sw/source/ui/index/cnttab.cxx b/sw/source/ui/index/cnttab.cxx index 0238c3138638..2aa0afdf547d 100644 --- a/sw/source/ui/index/cnttab.cxx +++ b/sw/source/ui/index/cnttab.cxx @@ -120,6 +120,8 @@ static OUString lcl_CreateAutoMarkFileDlg(weld::Window* pParent, const OUString& return sRet; } +namespace { + struct AutoMarkEntry { OUString sSearch; @@ -135,8 +137,12 @@ struct AutoMarkEntry bWord(false){} }; +} + typedef ::svt::EditBrowseBox SwEntryBrowseBox_Base; +namespace { + class SwEntryBrowseBox : public SwEntryBrowseBox_Base { VclPtr<Edit> m_aCellEdit; @@ -200,6 +206,8 @@ public: virtual ~SwAutoMarkDlg_Impl() override; }; +} + sal_uInt16 CurTOXType::GetFlatIndex() const { return static_cast< sal_uInt16 >( (eType == TOX_USER && nIndex) @@ -475,6 +483,8 @@ bool SwMultiTOXTabDialog::IsNoNum(SwWrtShell& rSh, const OUString& rName) ! rSh.GetTextCollFromPool(nId)->IsAssignedToListLevelOfOutlineStyle(); } +namespace { + class SwAddStylesDlg_Impl : public SfxDialogController { OUString* pStyleArr; @@ -495,6 +505,8 @@ public: SwAddStylesDlg_Impl(weld::Window* pParent, SwWrtShell const & rWrtSh, OUString rStringArr[]); }; +} + SwAddStylesDlg_Impl::SwAddStylesDlg_Impl(weld::Window* pParent, SwWrtShell const & rWrtSh, OUString rStringArr[]) : SfxDialogController(pParent, "modules/swriter/ui/assignstylesdialog.ui", "AssignStylesDialog") diff --git a/sw/source/ui/index/swuiidxmrk.cxx b/sw/source/ui/index/swuiidxmrk.cxx index 33a0eab8cd69..03dc2072cc5e 100644 --- a/sw/source/ui/index/swuiidxmrk.cxx +++ b/sw/source/ui/index/swuiidxmrk.cxx @@ -559,6 +559,8 @@ void SwIndexMarkPane::UpdateKeyBoxes() } } +namespace { + class SwNewUserIdxDlg : public weld::GenericDialogController { SwIndexMarkPane* m_pDlg; @@ -582,6 +584,8 @@ public: OUString GetName() const { return m_xNameED->get_text(); } }; +} + IMPL_LINK( SwNewUserIdxDlg, ModifyHdl, weld::Entry&, rEdit, void) { m_xOKPB->set_sensitive(!rEdit.get_text().isEmpty() && !m_pDlg->IsTOXType(rEdit.get_text())); @@ -991,6 +995,8 @@ short SwIndexMarkModalDlg::run() return nRet; } +namespace { + class SwCreateAuthEntryDlg_Impl : public weld::GenericDialogController { std::vector<std::unique_ptr<weld::Builder>> m_aBuilders; @@ -1035,6 +1041,8 @@ struct TextInfo const char* pHelpId; }; +} + static const TextInfo aTextInfoArr[] = { {AUTH_FIELD_IDENTIFIER, HID_AUTH_FIELD_IDENTIFIER }, diff --git a/sw/source/ui/misc/outline.cxx b/sw/source/ui/misc/outline.cxx index 47af1e385015..4f979bb3570b 100644 --- a/sw/source/ui/misc/outline.cxx +++ b/sw/source/ui/misc/outline.cxx @@ -55,6 +55,8 @@ using namespace ::com::sun::star; +namespace { + class SwNumNamesDlg : public weld::GenericDialogController { std::unique_ptr<weld::Entry> m_xFormEdit; @@ -72,6 +74,8 @@ public: int GetCurEntryPos() const { return m_xFormBox->get_selected_index(); } }; +} + // remember selected entry IMPL_LINK( SwNumNamesDlg, SelectHdl, weld::TreeView&, rBox, void ) { diff --git a/sw/source/ui/table/tautofmt.cxx b/sw/source/ui/table/tautofmt.cxx index 9f8d1e64898b..bf8a4a701d6c 100644 --- a/sw/source/ui/table/tautofmt.cxx +++ b/sw/source/ui/table/tautofmt.cxx @@ -26,6 +26,8 @@ #include <shellres.hxx> #include <tautofmt.hxx> +namespace { + class SwStringInputDlg : public SfxDialogController { private: @@ -52,6 +54,8 @@ public: } }; +} + // AutoFormat-Dialogue: SwAutoFormatDlg::SwAutoFormatDlg(weld::Window* pParent, SwWrtShell* pWrtShell, bool bAutoFormat, const SwTableAutoFormat* pSelFormat) diff --git a/sw/source/ui/vba/vbaapplication.cxx b/sw/source/ui/vba/vbaapplication.cxx index ed0a28863f3d..dc0ae39bb33c 100644 --- a/sw/source/ui/vba/vbaapplication.cxx +++ b/sw/source/ui/vba/vbaapplication.cxx @@ -55,6 +55,8 @@ using namespace ::ooo; using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class SwVbaApplicationOutgoingConnectionPoint : public cppu::WeakImplHelper<XConnectionPoint> { private: @@ -131,6 +133,8 @@ public: virtual css::uno::Any SAL_CALL AppCount() override; }; +} + SwVbaApplication::SwVbaApplication( uno::Reference<uno::XComponentContext >& xContext ): SwVbaApplication_BASE( xContext ) { diff --git a/sw/source/ui/vba/vbabookmarks.cxx b/sw/source/ui/vba/vbabookmarks.cxx index ae0eaed5e89a..53c23f85e38d 100644 --- a/sw/source/ui/vba/vbabookmarks.cxx +++ b/sw/source/ui/vba/vbabookmarks.cxx @@ -31,6 +31,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class BookmarksEnumeration : public EnumerationHelperImpl { uno::Reference< frame::XModel > mxModel; @@ -108,6 +110,8 @@ public: } }; +} + SwVbaBookmarks::SwVbaBookmarks( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xBookmarks, const uno::Reference< frame::XModel >& xModel ): SwVbaBookmarks_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new BookmarkCollectionHelper( xBookmarks ) ) ), mxModel( xModel ) { mxBookmarksSupplier.set( mxModel, uno::UNO_QUERY_THROW ); diff --git a/sw/source/ui/vba/vbaborders.cxx b/sw/source/ui/vba/vbaborders.cxx index f66b38426f82..aaea6f5c6486 100644 --- a/sw/source/ui/vba/vbaborders.cxx +++ b/sw/source/ui/vba/vbaborders.cxx @@ -41,6 +41,8 @@ static const sal_Int16 supportedIndexTable[] = { word::WdBorderType::wdBorderBot // Equiv widths in 1/100 mm const static sal_Int32 OOLineHairline = 2; +namespace { + class SwVbaBorder : public SwVbaBorder_Base { private: @@ -273,12 +275,16 @@ public: } }; +} + static uno::Reference< container::XIndexAccess > rangeToBorderIndexAccess( const uno::Reference< table::XCellRange >& xRange, const uno::Reference< uno::XComponentContext > & xContext, VbaPalette const & rPalette ) { return new RangeBorders( xRange, xContext, rPalette ); } +namespace { + class RangeBorderEnumWrapper : public EnumerationHelper_BASE { uno::Reference<container::XIndexAccess > m_xIndexAccess; @@ -298,6 +304,8 @@ public: } }; +} + // for Table borders SwVbaBorders::SwVbaBorders( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< table::XCellRange >& xRange, VbaPalette const & rPalette ): SwVbaBorders_BASE( xParent, xContext, rangeToBorderIndexAccess( xRange ,xContext, rPalette ) ) { diff --git a/sw/source/ui/vba/vbacells.cxx b/sw/source/ui/vba/vbacells.cxx index 953abac9148a..e8c5f558e284 100644 --- a/sw/source/ui/vba/vbacells.cxx +++ b/sw/source/ui/vba/vbacells.cxx @@ -26,6 +26,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class CellsEnumWrapper : public EnumerationHelper_BASE { uno::Reference< container::XIndexAccess > mxIndexAccess; @@ -103,6 +105,8 @@ public: } }; +} + SwVbaCells::SwVbaCells( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, sal_Int32 nLeft, sal_Int32 nTop, sal_Int32 nRight, sal_Int32 nBottom ) : SwVbaCells_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new CellCollectionHelper( xParent, xContext, xTextTable, nLeft, nTop, nRight, nBottom ) ) ), mxTextTable( xTextTable ), mnTop( nTop ), mnBottom( nBottom ) { } diff --git a/sw/source/ui/vba/vbacolumns.cxx b/sw/source/ui/vba/vbacolumns.cxx index 7fda520b6579..04131262046d 100644 --- a/sw/source/ui/vba/vbacolumns.cxx +++ b/sw/source/ui/vba/vbacolumns.cxx @@ -28,6 +28,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class ColumnsEnumWrapper : public EnumerationHelper_BASE { uno::WeakReference< XHelperInterface > mxParent; @@ -56,6 +58,8 @@ public: } }; +} + SwVbaColumns::SwVbaColumns( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, const uno::Reference< table::XTableColumns >& xTableColumns ) : SwVbaColumns_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xTableColumns, uno::UNO_QUERY_THROW ) ), mxTextTable( xTextTable ) { mnStartColumnIndex = 0; diff --git a/sw/source/ui/vba/vbadialog.cxx b/sw/source/ui/vba/vbadialog.cxx index 8ec16e181198..f47eff0e977b 100644 --- a/sw/source/ui/vba/vbadialog.cxx +++ b/sw/source/ui/vba/vbadialog.cxx @@ -22,12 +22,16 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + struct WordDialogTable { sal_Int32 const wdDialog; const sal_Char* ooDialog; }; +} + static const WordDialogTable aWordDialogTable[] = { { word::WdWordDialog::wdDialogFileNew, ".uno:NewDoc" }, diff --git a/sw/source/ui/vba/vbadocument.cxx b/sw/source/ui/vba/vbadocument.cxx index 894bac0aa996..0883afe12374 100644 --- a/sw/source/ui/vba/vbadocument.cxx +++ b/sw/source/ui/vba/vbadocument.cxx @@ -67,6 +67,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class SwVbaDocumentOutgoingConnectionPoint : public cppu::WeakImplHelper<XConnectionPoint> { private: @@ -80,6 +82,8 @@ public: void SAL_CALL Unadvise( sal_uInt32 Cookie ) override; }; +} + SwVbaDocument::SwVbaDocument( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, uno::Reference< frame::XModel > const & xModel ): SwVbaDocument_BASE( xParent, xContext, xModel ) { Initialize(); diff --git a/sw/source/ui/vba/vbadocumentproperties.cxx b/sw/source/ui/vba/vbadocumentproperties.cxx index f0d00352bbdd..5d1d570f5356 100644 --- a/sw/source/ui/vba/vbadocumentproperties.cxx +++ b/sw/source/ui/vba/vbadocumentproperties.cxx @@ -61,6 +61,8 @@ static sal_Int8 lcl_toMSOPropType( const uno::Type& aType ) return msoType; } +namespace { + class PropertGetSetHelper { protected: @@ -386,8 +388,12 @@ public: } }; +} + typedef std::unordered_map< sal_Int32, DocPropInfo > MSOIndexToOODocPropInfo; +namespace { + class BuiltInIndexHelper { MSOIndexToOODocPropInfo m_docPropInfoMap; @@ -433,8 +439,12 @@ public: MSOIndexToOODocPropInfo& getDocPropInfoMap() { return m_docPropInfoMap; } }; +} + typedef InheritedHelperInterfaceWeakImpl< ooo::vba::XDocumentProperty > SwVbaDocumentProperty_BASE; +namespace { + class SwVbaBuiltInDocumentProperty : public SwVbaDocumentProperty_BASE { protected: @@ -477,6 +487,8 @@ public: }; +} + SwVbaCustomDocumentProperty::SwVbaCustomDocumentProperty( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const DocPropInfo& rInfo ) : SwVbaBuiltInDocumentProperty( xParent, xContext, rInfo ) { } @@ -630,6 +642,8 @@ typedef ::cppu::WeakImplHelper< css::container::XIndexAccess typedef std::unordered_map< sal_Int32, uno::Reference< XDocumentProperty > > DocProps; +namespace { + class DocPropEnumeration : public ::cppu::WeakImplHelper< css::container::XEnumeration > { DocProps mDocProps; @@ -649,8 +663,12 @@ public: } }; +} + typedef std::unordered_map< OUString, uno::Reference< XDocumentProperty > > DocPropsByName; +namespace { + class BuiltInPropertiesImpl : public PropertiesImpl_BASE { protected: @@ -725,6 +743,8 @@ protected: } }; +} + SwVbaBuiltinDocumentProperties::SwVbaBuiltinDocumentProperties( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : SwVbaDocumentproperties_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new BuiltInPropertiesImpl( xParent, xContext, xModel ) ) ) { } @@ -774,6 +794,8 @@ SwVbaBuiltinDocumentProperties::getServiceNames() return aServiceNames; } +namespace { + class CustomPropertiesImpl : public PropertiesImpl_BASE { uno::Reference< XHelperInterface > m_xParent; @@ -862,6 +884,8 @@ public: }; +} + SwVbaCustomDocumentProperties::SwVbaCustomDocumentProperties( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< frame::XModel >& xModel ) : SwVbaBuiltinDocumentProperties( xParent, xContext, xModel ) { // replace the m_xIndexAccess implementation ( we need a virtual init ) diff --git a/sw/source/ui/vba/vbadocuments.cxx b/sw/source/ui/vba/vbadocuments.cxx index 6748dc376fb9..057b25a519ce 100644 --- a/sw/source/ui/vba/vbadocuments.cxx +++ b/sw/source/ui/vba/vbadocuments.cxx @@ -51,6 +51,8 @@ getDocument( uno::Reference< uno::XComponentContext > const & xContext, const un return uno::Any( uno::Reference< word::XDocument > (pWb) ); } +namespace { + class DocumentEnumImpl : public EnumerationHelperImpl { uno::Any const m_aApplication; @@ -65,6 +67,8 @@ public: } }; +} + SwVbaDocuments::SwVbaDocuments( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext ) : SwVbaDocuments_BASE( xParent, xContext, VbaDocumentsBase::WORD_DOCUMENT ) { } diff --git a/sw/source/ui/vba/vbafield.cxx b/sw/source/ui/vba/vbafield.cxx index 49371d794b05..2c5495cf4224 100644 --- a/sw/source/ui/vba/vbafield.cxx +++ b/sw/source/ui/vba/vbafield.cxx @@ -68,6 +68,8 @@ SwVbaField::getServiceNames() return aServiceNames; } +namespace { + // FIXME? copy and paste code // the codes are copied from ww8par5.cxx class SwVbaReadFieldParams @@ -87,6 +89,8 @@ public: const OUString& GetFieldName()const { return aFieldName; } }; +} + SwVbaReadFieldParams::SwVbaReadFieldParams( const OUString& _rData ) : aData( _rData ), nLen( _rData.getLength() ), nNext( 0 ) { @@ -222,6 +226,8 @@ static uno::Any lcl_createField( const uno::Reference< XHelperInterface >& xPare return uno::makeAny( xField ); } +namespace { + class FieldEnumeration : public ::cppu::WeakImplHelper< css::container::XEnumeration > { uno::Reference< XHelperInterface > mxParent; @@ -298,6 +304,8 @@ public: } }; +} + SwVbaFields::SwVbaFields( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ) : SwVbaFields_BASE( xParent, xContext , uno::Reference< container::XIndexAccess >( new FieldCollectionHelper( xParent, xContext, xModel ) ) ), mxModel( xModel ) { mxMSF.set( mxModel, uno::UNO_QUERY_THROW ); @@ -372,12 +380,16 @@ uno::Reference< text::XTextField > SwVbaFields::Create_Field_FileName( const OUS return xTextField; } +namespace { + struct DocPropertyTable { const char* sDocPropertyName; const char* sFieldService; }; +} + static const DocPropertyTable aDocPropertyTables[] = { { "Author", "com.sun.star.text.textfield.docinfo.CreateAuthor" }, diff --git a/sw/source/ui/vba/vbafont.cxx b/sw/source/ui/vba/vbafont.cxx index de61e8696b31..2c0b7ac09e3b 100644 --- a/sw/source/ui/vba/vbafont.cxx +++ b/sw/source/ui/vba/vbafont.cxx @@ -32,12 +32,16 @@ using namespace ::com::sun::star; const uno::Any aLongAnyTrue( sal_Int16(-1) ); const uno::Any aLongAnyFalse( sal_Int16( 0 ) ); +namespace { + struct MapPair { sal_Int32 nMSOConst; sal_Int32 nOOOConst; }; +} + static MapPair const UnderLineTable[] = { { word::WdUnderline::wdUnderlineNone, css::awt::FontUnderline::NONE }, { word::WdUnderline::wdUnderlineSingle, css::awt::FontUnderline::SINGLE }, @@ -60,6 +64,9 @@ static MapPair const UnderLineTable[] = { }; typedef std::unordered_map< sal_Int32, sal_Int32 > ConstToConst; + +namespace { + class UnderLineMapper { ConstToConst MSO2OOO; @@ -103,6 +110,8 @@ public: } }; +} + SwVbaFont::SwVbaFont( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xPalette, uno::Reference< css::beans::XPropertySet > const & xPropertySet ) : SwVbaFont_BASE( xParent, xContext, xPalette, xPropertySet ) { } diff --git a/sw/source/ui/vba/vbaframes.cxx b/sw/source/ui/vba/vbaframes.cxx index 3577bfff624e..f16c028698f2 100644 --- a/sw/source/ui/vba/vbaframes.cxx +++ b/sw/source/ui/vba/vbaframes.cxx @@ -27,6 +27,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class FramesEnumeration : public ::cppu::WeakImplHelper< container::XEnumeration > { private: @@ -55,6 +57,8 @@ public: }; +} + SwVbaFrames::SwVbaFrames( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< container::XIndexAccess >& xFrames, const uno::Reference< frame::XModel >& xModel ): SwVbaFrames_BASE( xParent, xContext, xFrames ), mxModel( xModel ) { mxFramesSupplier.set( mxModel, uno::UNO_QUERY_THROW ); diff --git a/sw/source/ui/vba/vbaheadersfooters.cxx b/sw/source/ui/vba/vbaheadersfooters.cxx index 90fa4cf0fb7b..9eaafac3205c 100644 --- a/sw/source/ui/vba/vbaheadersfooters.cxx +++ b/sw/source/ui/vba/vbaheadersfooters.cxx @@ -24,6 +24,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + // I assume there is only one headersfooters in Writer class HeadersFootersIndexAccess : public ::cppu::WeakImplHelper<container::XIndexAccess > { @@ -78,6 +80,8 @@ public: } }; +} + SwVbaHeadersFooters::SwVbaHeadersFooters( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< beans::XPropertySet >& xPageStyleProps, bool isHeader ): SwVbaHeadersFooters_BASE( xParent, xContext, new HeadersFootersIndexAccess( xParent, xContext, xModel, xPageStyleProps, isHeader ) ), mxModel( xModel ), mxPageStyleProps( xPageStyleProps ), mbHeader( isHeader ) { } diff --git a/sw/source/ui/vba/vbalistgalleries.cxx b/sw/source/ui/vba/vbalistgalleries.cxx index bbe554c3900b..0a4c8084bed0 100644 --- a/sw/source/ui/vba/vbalistgalleries.cxx +++ b/sw/source/ui/vba/vbalistgalleries.cxx @@ -23,6 +23,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class ListGalleriesEnumWrapper : public EnumerationHelper_BASE { SwVbaListGalleries* pListGalleries; @@ -42,6 +44,8 @@ public: } }; +} + SwVbaListGalleries::SwVbaListGalleries( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xTextDoc ) : SwVbaListGalleries_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >() ), mxTextDocument( xTextDoc ) { } diff --git a/sw/source/ui/vba/vbalistlevels.cxx b/sw/source/ui/vba/vbalistlevels.cxx index 7e49e3ab84ba..a83e6fe971dc 100644 --- a/sw/source/ui/vba/vbalistlevels.cxx +++ b/sw/source/ui/vba/vbalistlevels.cxx @@ -23,6 +23,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class ListLevelsEnumWrapper : public EnumerationHelper_BASE { SwVbaListLevels* pListLevels; @@ -42,6 +44,8 @@ public: } }; +} + SwVbaListLevels::SwVbaListLevels( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, SwVbaListHelperRef const & pHelper ) : SwVbaListLevels_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >() ), pListHelper( pHelper ) { } diff --git a/sw/source/ui/vba/vbalisttemplates.cxx b/sw/source/ui/vba/vbalisttemplates.cxx index e4d3416f09a8..ffcef424b938 100644 --- a/sw/source/ui/vba/vbalisttemplates.cxx +++ b/sw/source/ui/vba/vbalisttemplates.cxx @@ -22,6 +22,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class ListTemplatesEnumWrapper : public EnumerationHelper_BASE { SwVbaListTemplates* pListTemplates; @@ -41,6 +43,8 @@ public: } }; +} + SwVbaListTemplates::SwVbaListTemplates( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xTextDoc, sal_Int32 nType ) : SwVbaListTemplates_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >() ), mxTextDocument( xTextDoc ), mnGalleryType( nType ) { } diff --git a/sw/source/ui/vba/vbapalette.cxx b/sw/source/ui/vba/vbapalette.cxx index fa5dbe0218c7..d86235859b23 100644 --- a/sw/source/ui/vba/vbapalette.cxx +++ b/sw/source/ui/vba/vbapalette.cxx @@ -52,6 +52,8 @@ WdColor::wdColorGray25, // 16 typedef ::cppu::WeakImplHelper< container::XIndexAccess > XIndexAccess_BASE; +namespace { + class DefaultPalette : public XIndexAccess_BASE { public: @@ -82,6 +84,8 @@ public: }; +} + VbaPalette::VbaPalette() { mxPalette = new DefaultPalette(); diff --git a/sw/source/ui/vba/vbapanes.cxx b/sw/source/ui/vba/vbapanes.cxx index 9147111ab36a..a9e4373803f0 100644 --- a/sw/source/ui/vba/vbapanes.cxx +++ b/sw/source/ui/vba/vbapanes.cxx @@ -23,6 +23,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + // I assume there is only one pane in Writer class PanesIndexAccess : public ::cppu::WeakImplHelper<container::XIndexAccess > { @@ -74,6 +76,8 @@ public: } }; +} + SwVbaPanes::SwVbaPanes( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ): SwVbaPanes_BASE( xParent, xContext, new PanesIndexAccess( xParent, xContext, xModel ) ) { } diff --git a/sw/source/ui/vba/vbaparagraph.cxx b/sw/source/ui/vba/vbaparagraph.cxx index 957dd606ff77..b9bfe036be6d 100644 --- a/sw/source/ui/vba/vbaparagraph.cxx +++ b/sw/source/ui/vba/vbaparagraph.cxx @@ -71,6 +71,8 @@ SwVbaParagraph::getServiceNames() return aServiceNames; } +namespace { + class ParagraphCollectionHelper : public ::cppu::WeakImplHelper< container::XIndexAccess, container::XEnumerationAccess > { @@ -133,6 +135,8 @@ public: } }; +} + SwVbaParagraphs::SwVbaParagraphs( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xDocument ) : SwVbaParagraphs_BASE( xParent, xContext, new ParagraphCollectionHelper( xDocument ) ), mxTextDocument( xDocument ) { } diff --git a/sw/source/ui/vba/vbarevisions.cxx b/sw/source/ui/vba/vbarevisions.cxx index a24a155484c2..2e022e35a81e 100644 --- a/sw/source/ui/vba/vbarevisions.cxx +++ b/sw/source/ui/vba/vbarevisions.cxx @@ -28,6 +28,8 @@ using namespace ::com::sun::star; typedef std::vector< uno::Reference< beans::XPropertySet > > RevisionMap; +namespace { + class RedlinesEnumeration : public ::cppu::WeakImplHelper< container::XEnumeration > { RevisionMap mRevisionMap; @@ -75,6 +77,8 @@ RevisionCollectionHelper( const uno::Reference< frame::XModel >& xModel, const u } }; +} + RevisionCollectionHelper::RevisionCollectionHelper( const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ) { uno::Reference< text::XTextRangeCompare > xTRC( xTextRange->getText(), uno::UNO_QUERY_THROW ); @@ -91,6 +95,9 @@ RevisionCollectionHelper::RevisionCollectionHelper( const uno::Reference< frame: } } } + +namespace { + class RevisionsEnumeration : public EnumerationHelperImpl { uno::Reference< frame::XModel > m_xModel; @@ -106,6 +113,8 @@ public: }; +} + SwVbaRevisions::SwVbaRevisions( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel, const uno::Reference< text::XTextRange >& xTextRange ): SwVbaRevisions_BASE( xParent, xContext, new RevisionCollectionHelper( xModel, xTextRange ) ), mxModel( xModel ) { } diff --git a/sw/source/ui/vba/vbarows.cxx b/sw/source/ui/vba/vbarows.cxx index 2ed1d4a4b64c..6159b076a676 100644 --- a/sw/source/ui/vba/vbarows.cxx +++ b/sw/source/ui/vba/vbarows.cxx @@ -31,6 +31,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class RowsEnumWrapper : public EnumerationHelper_BASE { uno::WeakReference< XHelperInterface > mxParent; @@ -59,6 +61,8 @@ public: } }; +} + SwVbaRows::SwVbaRows( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextTable >& xTextTable, const uno::Reference< table::XTableRows >& xTableRows ) : SwVbaRows_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( xTableRows, uno::UNO_QUERY_THROW ) ), mxTextTable( xTextTable ), mxTableRows( xTableRows ) { mnStartRowIndex = 0; diff --git a/sw/source/ui/vba/vbasections.cxx b/sw/source/ui/vba/vbasections.cxx index 3e57eb65430a..78f4b9c1d296 100644 --- a/sw/source/ui/vba/vbasections.cxx +++ b/sw/source/ui/vba/vbasections.cxx @@ -30,6 +30,8 @@ using namespace ::com::sun::star; typedef std::vector< uno::Reference< beans::XPropertySet > > XSectionVec; +namespace { + class SectionEnumeration : public ::cppu::WeakImplHelper< container::XEnumeration > { XSectionVec mxSections; @@ -132,6 +134,8 @@ public: } }; +} + SwVbaSections::SwVbaSections( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ): SwVbaSections_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new SectionCollectionHelper( xParent, xContext, xModel ) ) ), mxModel( xModel ) { } diff --git a/sw/source/ui/vba/vbastyles.cxx b/sw/source/ui/vba/vbastyles.cxx index 2c262a0f7c99..b3f927a01b5f 100644 --- a/sw/source/ui/vba/vbastyles.cxx +++ b/sw/source/ui/vba/vbastyles.cxx @@ -31,6 +31,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + struct BuiltinStyleTable { sal_Int32 const wdBuiltinStyle; @@ -38,6 +40,8 @@ struct BuiltinStyleTable sal_Int32 const wdStyleType; }; +} + static const BuiltinStyleTable aBuiltinStyleTable[] = { { word::WdBuiltinStyle::wdStyleBlockQuotation, "", word::WdStyleType::wdStyleTypeParagraph }, @@ -146,18 +150,24 @@ static const BuiltinStyleTable aBuiltinStyleTable[] = { 0, nullptr, 0 } }; +namespace { + struct MSOStyleNameTable { const sal_Char* pMSOStyleName; const sal_Char* pOOoStyleName; }; +} + static const MSOStyleNameTable aMSOStyleNameTable[] = { { "Normal", "Default" }, { nullptr, nullptr } }; +namespace { + class StyleCollectionHelper : public ::cppu::WeakImplHelper< container::XNameAccess, container::XIndexAccess, container::XEnumerationAccess > @@ -264,6 +274,8 @@ public: } }; +} + SwVbaStyles::SwVbaStyles( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xModel ) : SwVbaStyles_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new StyleCollectionHelper( xModel ) ) ), mxModel( xModel ) { diff --git a/sw/source/ui/vba/vbatables.cxx b/sw/source/ui/vba/vbatables.cxx index 2efbe29ca4f3..286bb25a8325 100644 --- a/sw/source/ui/vba/vbatables.cxx +++ b/sw/source/ui/vba/vbatables.cxx @@ -61,6 +61,8 @@ static bool lcl_isInHeaderFooter( const uno::Reference< text::XTextTable >& xTab typedef std::vector< uno::Reference< text::XTextTable > > XTextTableVec; +namespace { + class TableCollectionHelper : public ::cppu::WeakImplHelper< container::XIndexAccess, container::XNameAccess > { @@ -154,6 +156,8 @@ public: }; +} + SwVbaTables::SwVbaTables( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< frame::XModel >& xDocument ) : SwVbaTables_BASE( xParent, xContext , uno::Reference< container::XIndexAccess >( new TableCollectionHelper( xDocument ) ) ), mxDocument( xDocument ) { } diff --git a/sw/source/ui/vba/vbatablesofcontents.cxx b/sw/source/ui/vba/vbatablesofcontents.cxx index ffc9503db46b..c6cc23e6e155 100644 --- a/sw/source/ui/vba/vbatablesofcontents.cxx +++ b/sw/source/ui/vba/vbatablesofcontents.cxx @@ -27,6 +27,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class TablesOfContentsEnumWrapper : public EnumerationHelper_BASE { uno::Reference< container::XIndexAccess > mxIndexAccess; @@ -104,6 +106,8 @@ public: } }; +} + SwVbaTablesOfContents::SwVbaTablesOfContents( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< text::XTextDocument >& xDoc ) : SwVbaTablesOfContents_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new TableOfContentsCollectionHelper( xParent, xContext, xDoc ) ) ), mxTextDocument( xDoc ) { } diff --git a/sw/source/ui/vba/vbatabstops.cxx b/sw/source/ui/vba/vbatabstops.cxx index e0c71c9e94e4..567ee1234a4f 100644 --- a/sw/source/ui/vba/vbatabstops.cxx +++ b/sw/source/ui/vba/vbatabstops.cxx @@ -43,6 +43,8 @@ static void lcl_setTabStops( const uno::Reference< beans::XPropertySet >& xParaP xParaProps->setPropertyValue("ParaTabStops", uno::makeAny( aSeq ) ); } +namespace { + class TabStopsEnumWrapper : public EnumerationHelper_BASE { uno::Reference< container::XIndexAccess > mxIndexAccess; @@ -108,6 +110,8 @@ public: } }; +} + SwVbaTabStops::SwVbaTabStops( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext > & xContext, const uno::Reference< beans::XPropertySet >& xParaProps ) : SwVbaTabStops_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new TabStopCollectionHelper( xParent, xContext, xParaProps ) ) ), mxParaProps( xParaProps ) { } diff --git a/sw/source/uibase/app/docsh2.cxx b/sw/source/uibase/app/docsh2.cxx index c69b3e2d889f..19f36171f443 100644 --- a/sw/source/uibase/app/docsh2.cxx +++ b/sw/source/uibase/app/docsh2.cxx @@ -1442,6 +1442,8 @@ void SwDocShell::UpdateChildWindows() pRed->ReInitDlg( this ); } +namespace { + // #i48748# class SwReloadFromHtmlReader : public SwReader { @@ -1455,6 +1457,8 @@ class SwReloadFromHtmlReader : public SwReader } }; +} + void SwDocShell::ReloadFromHtml( const OUString& rStreamName, SwSrcView* pSrcView ) { bool bModified = IsModified(); diff --git a/sw/source/uibase/app/docst.cxx b/sw/source/uibase/app/docst.cxx index cb580785e8a8..ac664eb11527 100644 --- a/sw/source/uibase/app/docst.cxx +++ b/sw/source/uibase/app/docst.cxx @@ -544,6 +544,8 @@ void SwDocShell::ExecStyleSheet( SfxRequest& rReq ) } } +namespace { + class ApplyStyle { public: @@ -576,6 +578,8 @@ private: bool const m_bModified; }; +} + IMPL_LINK_NOARG(ApplyStyle, ApplyHdl, LinkParamNone*, void) { SwWrtShell* pWrtShell = m_rDocSh.GetWrtShell(); diff --git a/sw/source/uibase/app/docstyle.cxx b/sw/source/uibase/app/docstyle.cxx index 4326445cd8ec..61898b1f074c 100644 --- a/sw/source/uibase/app/docstyle.cxx +++ b/sw/source/uibase/app/docstyle.cxx @@ -89,6 +89,8 @@ using namespace com::sun::star; // In addition now there is the Bit bPhysical. In case this Bit is // TRUE, the Pool-Formatnames are not being submitted. +namespace { + class SwImplShellAction { SwWrtShell* pSh; @@ -100,6 +102,8 @@ public: SwImplShellAction& operator=(const SwImplShellAction&) = delete; }; +} + SwImplShellAction::SwImplShellAction( SwDoc& rDoc ) { if( rDoc.GetDocShell() ) diff --git a/sw/source/uibase/app/mainwn.cxx b/sw/source/uibase/app/mainwn.cxx index 2f7c1ba08a25..9a01a8437958 100644 --- a/sw/source/uibase/app/mainwn.cxx +++ b/sw/source/uibase/app/mainwn.cxx @@ -25,6 +25,8 @@ class SwDocShell; +namespace { + struct SwProgress { long nStartValue, @@ -33,6 +35,8 @@ struct SwProgress std::unique_ptr<SfxProgress> pProgress; }; +} + static std::vector<std::unique_ptr<SwProgress>> *pProgressContainer = nullptr; static SwProgress *lcl_SwFindProgress( SwDocShell const *pDocShell ) diff --git a/sw/source/uibase/config/StoredChapterNumbering.cxx b/sw/source/uibase/config/StoredChapterNumbering.cxx index d0454dc5f20c..da6ee493a414 100644 --- a/sw/source/uibase/config/StoredChapterNumbering.cxx +++ b/sw/source/uibase/config/StoredChapterNumbering.cxx @@ -158,6 +158,8 @@ public: } }; +namespace { + class StoredChapterNumberingExport : public SvXMLExport { @@ -382,6 +384,8 @@ public: } }; +} + void ExportStoredChapterNumberingRules(SwChapterNumRules & rRules, SvStream & rStream, OUString const& rFileName) { diff --git a/sw/source/uibase/dbui/dbmgr.cxx b/sw/source/uibase/dbui/dbmgr.cxx index c899b6cbd70b..32eaa13fb153 100644 --- a/sw/source/uibase/dbui/dbmgr.cxx +++ b/sw/source/uibase/dbui/dbmgr.cxx @@ -234,6 +234,8 @@ public: }; +namespace { + /// Listens to removed data sources, and if it's one that's embedded into this document, triggers embedding removal. class SwDataSourceRemovedListener : public cppu::WeakImplHelper<sdb::XDatabaseRegistrationsListener> { @@ -250,6 +252,8 @@ public: void Dispose(); }; +} + SwDataSourceRemovedListener::SwDataSourceRemovedListener(SwDBManager& rDBManager) : m_pDBManager(&rDBManager) { diff --git a/sw/source/uibase/dbui/mmconfigitem.cxx b/sw/source/uibase/dbui/mmconfigitem.cxx index 7a60a41fff79..1ca6be629095 100644 --- a/sw/source/uibase/dbui/mmconfigitem.cxx +++ b/sw/source/uibase/dbui/mmconfigitem.cxx @@ -69,6 +69,8 @@ const char cDataCommandType[] = "DataSource/DataCommandType"; #define IMAP_PORT 143 #define IMAP_SECURE_PORT 993 +namespace { + struct DBAddressDataAssignment { SwDBData aDBData; @@ -83,6 +85,8 @@ struct DBAddressDataAssignment {} }; +} + class SwMailMergeConfigItem_Impl : public utl::ConfigItem { friend class SwMailMergeConfigItem; @@ -1593,6 +1597,8 @@ SwView* SwMailMergeConfigItem::GetSourceView() return m_pSourceView; } +namespace { + //This implements XSelectionChangeListener and XDispatch because the //broadcaster uses this combo to determine if to send the database-changed //update. Its probably that listening to statusChanged at some other level is @@ -1631,6 +1637,8 @@ public: } }; +} + void SwMailMergeConfigItem::SetSourceView(SwView* pView) { if (m_xDBChangedListener.is()) diff --git a/sw/source/uibase/dochdl/gloshdl.cxx b/sw/source/uibase/dochdl/gloshdl.cxx index 3030c714e182..31af40a2011c 100644 --- a/sw/source/uibase/dochdl/gloshdl.cxx +++ b/sw/source/uibase/dochdl/gloshdl.cxx @@ -63,6 +63,8 @@ using namespace ::com::sun::star; const short RET_EDIT = 100; +namespace { + struct TextBlockInfo_Impl { OUString const sTitle; @@ -72,6 +74,8 @@ struct TextBlockInfo_Impl : sTitle(rTitle), sLongName(rLongName), sGroupName(rGroupName) {} }; +} + // Dialog for edit templates void SwGlossaryHdl::GlossaryDlg() { diff --git a/sw/source/uibase/dochdl/swdtflvr.cxx b/sw/source/uibase/dochdl/swdtflvr.cxx index bcb5f60babe1..51cc3ffdbaeb 100644 --- a/sw/source/uibase/dochdl/swdtflvr.cxx +++ b/sw/source/uibase/dochdl/swdtflvr.cxx @@ -176,6 +176,8 @@ void collectUIInformation(const OUString& rAction, const OUString& aParameters) #define DDE_TXT_ENCODING osl_getThreadTextEncoding() +namespace { + class SwTransferDdeLink : public ::sfx2::SvBaseLink { OUString sName; @@ -205,6 +207,8 @@ public: void Disconnect( bool bRemoveDataAdvise ); }; +} + /// Tracks the boundaries of pasted content and notifies listeners. class SwPasteContext { @@ -221,6 +225,8 @@ private: sal_Int32 m_nStartContent = 0; }; +namespace { + // helper class for Action and Undo enclosing class SwTrnsfrActionAndUndo { @@ -247,6 +253,8 @@ public: } }; +} + SwTransferable::SwTransferable( SwWrtShell& rSh ) : m_pWrtShell( &rSh ), m_pCreatorView( nullptr ), diff --git a/sw/source/uibase/docvw/AnchorOverlayObject.cxx b/sw/source/uibase/docvw/AnchorOverlayObject.cxx index ac843adaf2e7..04a785fae4ea 100644 --- a/sw/source/uibase/docvw/AnchorOverlayObject.cxx +++ b/sw/source/uibase/docvw/AnchorOverlayObject.cxx @@ -34,6 +34,8 @@ namespace sw { namespace sidebarwindows { +namespace { + // helper class: Primitive for discrete visualisation class AnchorPrimitive : public drawinglayer::primitive2d::DiscreteMetricDependentPrimitive2D { @@ -82,6 +84,8 @@ public: DeclPrimitive2DIDBlock() }; +} + void AnchorPrimitive::create2DDecomposition( drawinglayer::primitive2d::Primitive2DContainer& rContainer, const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const diff --git a/sw/source/uibase/docvw/PostItMgr.cxx b/sw/source/uibase/docvw/PostItMgr.cxx index 73950af7db24..6177ee855679 100644 --- a/sw/source/uibase/docvw/PostItMgr.cxx +++ b/sw/source/uibase/docvw/PostItMgr.cxx @@ -1345,6 +1345,8 @@ void SwPostItMgr::RemoveSidebarWin() PreparePageContainer(); } +namespace { + class FilterFunctor { public: @@ -1510,6 +1512,8 @@ public: } }; +} + // copy to new vector, otherwise RemoveItem would operate and delete stuff on mvPostItFields as well // RemoveItem will clean up the core field and visible postit if necessary // we cannot just delete everything as before, as postits could move into change tracking diff --git a/sw/source/uibase/docvw/ShadowOverlayObject.cxx b/sw/source/uibase/docvw/ShadowOverlayObject.cxx index 374d26231310..584af296928b 100644 --- a/sw/source/uibase/docvw/ShadowOverlayObject.cxx +++ b/sw/source/uibase/docvw/ShadowOverlayObject.cxx @@ -32,6 +32,8 @@ namespace sw { namespace sidebarwindows { // helper SwPostItShadowPrimitive +namespace { + // Used to allow view-dependent primitive definition. For that purpose, the // initially created primitive (this one) always has to be view-independent, // but the decomposition is made view-dependent. Very simple primitive which @@ -67,6 +69,8 @@ public: DeclPrimitive2DIDBlock() }; +} + void ShadowPrimitive::create2DDecomposition( drawinglayer::primitive2d::Primitive2DContainer& rContainer, const drawinglayer::geometry::ViewInformation2D& /*rViewInformation*/) const diff --git a/sw/source/uibase/docvw/SidebarTxtControlAcc.cxx b/sw/source/uibase/docvw/SidebarTxtControlAcc.cxx index ecce8ef56950..e20fbc4f2a4e 100644 --- a/sw/source/uibase/docvw/SidebarTxtControlAcc.cxx +++ b/sw/source/uibase/docvw/SidebarTxtControlAcc.cxx @@ -37,6 +37,8 @@ namespace sw { namespace sidebarwindows { +namespace { + // declaration and implementation of <SvxEditSource> // for <::accessibility::AccessibleTextHelper> instance class SidebarTextEditSource : public SvxEditSource, @@ -63,6 +65,8 @@ class SidebarTextEditSource : public SvxEditSource, SvxDrawOutlinerViewForwarder mViewForwarder; }; +} + SidebarTextEditSource::SidebarTextEditSource( SidebarTextControl& rSidebarTextControl ) : SvxEditSource() , mrSidebarTextControl( rSidebarTextControl ) @@ -123,6 +127,8 @@ IMPL_LINK(SidebarTextEditSource, NotifyHdl, EENotify&, rNotify, void) } } +namespace { + // declaration and implementation of accessible context for <SidebarTextControl> instance class SidebarTextControlAccessibleContext : public VCLXAccessibleComponent { @@ -152,6 +158,8 @@ class SidebarTextControlAccessibleContext : public VCLXAccessibleComponent void defunc(); }; +} + SidebarTextControlAccessibleContext::SidebarTextControlAccessibleContext( SidebarTextControl& rSidebarTextControl ) : VCLXAccessibleComponent( rSidebarTextControl.GetWindowPeer() ) , maMutex() diff --git a/sw/source/uibase/docvw/SidebarWinAcc.cxx b/sw/source/uibase/docvw/SidebarWinAcc.cxx index c892032b6e52..bd51ff8cea36 100644 --- a/sw/source/uibase/docvw/SidebarWinAcc.cxx +++ b/sw/source/uibase/docvw/SidebarWinAcc.cxx @@ -28,6 +28,8 @@ namespace sw { namespace sidebarwindows { +namespace { + // declaration and implementation of accessible context for <SidebarWinAccessible> instance class SidebarWinAccessibleContext : public VCLXAccessibleComponent { @@ -89,6 +91,8 @@ class SidebarWinAccessibleContext : public VCLXAccessibleComponent ::osl::Mutex maMutex; }; +} + // implementation of accessible for <SwAnnotationWin> instance SidebarWinAccessible::SidebarWinAccessible( sw::annotation::SwAnnotationWin& rSidebarWin, SwViewShell& rViewShell, diff --git a/sw/source/uibase/fldui/fldmgr.cxx b/sw/source/uibase/fldui/fldmgr.cxx index eccca960fc43..65b70130f11a 100644 --- a/sw/source/uibase/fldui/fldmgr.cxx +++ b/sw/source/uibase/fldui/fldmgr.cxx @@ -288,6 +288,8 @@ static const char* FMT_USERVAR_ARY[] = FMT_USERVAR_CMD }; +namespace { + // field types and subtypes struct SwFieldPack { @@ -300,6 +302,8 @@ struct SwFieldPack size_t const nFormatLength; }; +} + // strings and formats static const SwFieldPack aSwFields[] = { diff --git a/sw/source/uibase/lingu/hhcwrp.cxx b/sw/source/uibase/lingu/hhcwrp.cxx index 52ee334ec21d..f110c5f5fe7a 100644 --- a/sw/source/uibase/lingu/hhcwrp.cxx +++ b/sw/source/uibase/lingu/hhcwrp.cxx @@ -62,6 +62,8 @@ static void lcl_ActivateTextShell( SwWrtShell & rWrtSh ) rWrtSh.EnterStdMode(); } +namespace { + class SwKeepConversionDirectionStateContext { public: @@ -79,6 +81,8 @@ public: } }; +} + SwHHCWrapper::SwHHCWrapper( SwView* pSwView, const uno::Reference< uno::XComponentContext >& rxContext, diff --git a/sw/source/uibase/ribbar/workctrl.cxx b/sw/source/uibase/ribbar/workctrl.cxx index f62059f661e5..6ca3ce946f71 100644 --- a/sw/source/uibase/ribbar/workctrl.cxx +++ b/sw/source/uibase/ribbar/workctrl.cxx @@ -443,6 +443,8 @@ void SwScrollNaviPopup::statusChanged( const css::frame::FeatureStateEvent& rEve } } +namespace { + class SwZoomBox_Impl : public ComboBox { sal_uInt16 const nSlotId; @@ -461,6 +463,8 @@ protected: }; +} + SwZoomBox_Impl::SwZoomBox_Impl(vcl::Window* pParent, sal_uInt16 nSlot) : ComboBox(pParent, WB_HIDE | WB_BORDER | WB_DROPDOWN | WB_AUTOHSCROLL) , nSlotId(nSlot) @@ -605,6 +609,8 @@ VclPtr<vcl::Window> SwPreviewZoomControl::CreateItemWindow( vcl::Window *pParent return pRet.get(); } +namespace { + class SwJumpToSpecificBox_Impl : public NumericField { sal_uInt16 const nSlotId; @@ -617,6 +623,8 @@ protected: virtual bool EventNotify( NotifyEvent& rNEvt ) override; }; +} + SwJumpToSpecificBox_Impl::SwJumpToSpecificBox_Impl(vcl::Window* pParent, sal_uInt16 nSlot) : NumericField(pParent, WB_HIDE | WB_BORDER) , nSlotId(nSlot) @@ -659,6 +667,8 @@ VclPtr<vcl::Window> SwJumpToSpecificPageControl::CreateItemWindow( vcl::Window * return pRet.get(); } +namespace { + class NavElementBox_Impl; class NavElementToolBoxControl : public svt::ToolboxController, public lang::XServiceInfo @@ -719,6 +729,8 @@ private: void ReleaseFocus_Impl(); }; +} + NavElementBox_Impl::NavElementBox_Impl( vcl::Window* _pParent, const uno::Reference< frame::XFrame >& _xFrame, @@ -961,6 +973,8 @@ lo_writer_NavElementToolBoxController_get_implementation( return cppu::acquire( new NavElementToolBoxControl( rxContext ) ); } +namespace { + class PrevNextScrollToolboxController : public svt::ToolboxController, public css::lang::XServiceInfo { @@ -993,6 +1007,8 @@ private: Type const meType; }; +} + PrevNextScrollToolboxController::PrevNextScrollToolboxController( const css::uno::Reference< css::uno::XComponentContext > & rxContext, Type eType ) : svt::ToolboxController( rxContext, css::uno::Reference< css::frame::XFrame >(), diff --git a/sw/source/uibase/uiview/pview.cxx b/sw/source/uibase/uiview/pview.cxx index e40ee2807de4..c77d65430b12 100644 --- a/sw/source/uibase/uiview/pview.cxx +++ b/sw/source/uibase/uiview/pview.cxx @@ -140,6 +140,8 @@ static void lcl_InvalidateZoomSlots(SfxBindings& rBindings) rBindings.Invalidate( aInval ); } +namespace { + // At first the zoom dialog class SwPreviewZoomDlg : public weld::GenericDialogController { @@ -167,6 +169,8 @@ public: } }; +} + // all for SwPagePreviewWin SwPagePreviewWin::SwPagePreviewWin( vcl::Window *pParent, SwPagePreview& rPView ) : Window(pParent, WinBits(WB_CLIPCHILDREN)) diff --git a/sw/source/uibase/uiview/viewling.cxx b/sw/source/uibase/uiview/viewling.cxx index 3d85fb02edb0..e4390317d5ed 100644 --- a/sw/source/uibase/uiview/viewling.cxx +++ b/sw/source/uibase/uiview/viewling.cxx @@ -597,6 +597,8 @@ void SwView::StartThesaurus() // Offer online suggestions +namespace { + //!! Start of extra code for context menu modifying extensions struct ExecuteInfo { @@ -611,6 +613,8 @@ public: DECL_STATIC_LINK( AsyncExecute, ExecuteHdl_Impl, void*, void ); }; +} + IMPL_STATIC_LINK( AsyncExecute, ExecuteHdl_Impl, void*, p, void ) { ExecuteInfo* pExecuteInfo = static_cast<ExecuteInfo*>(p); diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx index f7367f429ab9..e266692f9c9b 100644 --- a/sw/source/uibase/uno/unotxdoc.cxx +++ b/sw/source/uibase/uno/unotxdoc.cxx @@ -1366,6 +1366,8 @@ Reference< drawing::XDrawPage > SwXTextDocument::getDrawPage() return mxXDrawPage; } +namespace { + class SwDrawPagesObj : public cppu::WeakImplHelper< css::drawing::XDrawPages, css::lang::XServiceInfo> @@ -1420,6 +1422,8 @@ public: } }; +} + // XDrawPagesSupplier uno::Reference<drawing::XDrawPages> SAL_CALL SwXTextDocument::getDrawPages() diff --git a/sw/source/uibase/utlui/bookctrl.cxx b/sw/source/uibase/utlui/bookctrl.cxx index 348ffb5f0297..2659f4a7e9c1 100644 --- a/sw/source/uibase/utlui/bookctrl.cxx +++ b/sw/source/uibase/utlui/bookctrl.cxx @@ -39,6 +39,8 @@ SFX_IMPL_STATUSBAR_CONTROL( SwBookmarkControl, SfxStringItem ); +namespace { + class BookmarkPopup_Impl : public PopupMenu { public: @@ -52,6 +54,8 @@ private: virtual void Select() override; }; +} + BookmarkPopup_Impl::BookmarkPopup_Impl() : PopupMenu(), nCurId(USHRT_MAX) diff --git a/sw/source/uibase/utlui/content.cxx b/sw/source/uibase/utlui/content.cxx index 468ba6cbfa16..c651a86df0f3 100644 --- a/sw/source/uibase/utlui/content.cxx +++ b/sw/source/uibase/utlui/content.cxx @@ -3808,6 +3808,8 @@ bool NaviContentBookmark::Paste( TransferableDataHelper& rData ) return bRet; } +namespace { + class SwContentLBoxString : public SvLBoxString { public: @@ -3817,6 +3819,8 @@ public: const SvViewDataEntry* pView, const SvTreeListEntry& rEntry) override; }; +} + void SwContentTree::InitEntry(SvTreeListEntry* pEntry, const OUString& rStr ,const Image& rImg1,const Image& rImg2) { diff --git a/sw/source/uibase/utlui/glbltree.cxx b/sw/source/uibase/utlui/glbltree.cxx index 1859e70579dd..788d999f21f6 100644 --- a/sw/source/uibase/utlui/glbltree.cxx +++ b/sw/source/uibase/utlui/glbltree.cxx @@ -114,6 +114,8 @@ static const char* aHelpForMenu[] = HID_GLBLTREEUPD_ALL //CTX_UPDATE_ALL }; +namespace { + class SwGlobalFrameListener_Impl : public SfxListener { bool bValid; @@ -129,6 +131,8 @@ public: bool IsValid() const {return bValid;} }; +} + void SwGlobalFrameListener_Impl::Notify( SfxBroadcaster& /*rBC*/, const SfxHint& rHint ) { if( rHint.GetId() == SfxHintId::Dying) diff --git a/sw/source/uibase/utlui/gloslst.cxx b/sw/source/uibase/utlui/gloslst.cxx index 9dd2a26a2a03..444babfcbc36 100644 --- a/sw/source/uibase/utlui/gloslst.cxx +++ b/sw/source/uibase/utlui/gloslst.cxx @@ -37,6 +37,8 @@ #define GLOS_TIMEOUT 30000 // update every 30 seconds #define FIND_MAX_GLOS 20 +namespace { + struct TripleString { OUString sGroup; @@ -58,6 +60,8 @@ public: weld::TreeView& GetTreeView() {return *m_xListLB;} }; +} + SwGlossDecideDlg::SwGlossDecideDlg(weld::Window* pParent) : GenericDialogController(pParent, "modules/swriter/ui/selectautotextdialog.ui", "SelectAutoTextDialog") , m_xOk(m_xBuilder->weld_button("ok")) diff --git a/sw/source/uibase/utlui/tmplctrl.cxx b/sw/source/uibase/utlui/tmplctrl.cxx index 2ab9883d231f..c944f01c2602 100644 --- a/sw/source/uibase/utlui/tmplctrl.cxx +++ b/sw/source/uibase/utlui/tmplctrl.cxx @@ -37,6 +37,8 @@ SFX_IMPL_STATUSBAR_CONTROL( SwTemplateControl, SfxStringItem ); +namespace { + class SwTemplatePopup_Impl : public PopupMenu { public: @@ -50,6 +52,8 @@ private: virtual void Select() override; }; +} + SwTemplatePopup_Impl::SwTemplatePopup_Impl() : PopupMenu(), nCurId(USHRT_MAX) diff --git a/sw/source/uibase/wrtsh/move.cxx b/sw/source/uibase/wrtsh/move.cxx index 76f4baedaba5..14070c71ef8e 100644 --- a/sw/source/uibase/wrtsh/move.cxx +++ b/sw/source/uibase/wrtsh/move.cxx @@ -39,6 +39,8 @@ const long nReadOnlyScrollOfst = 10; +namespace { + class ShellMoveCursor { SwWrtShell* pSh; @@ -63,6 +65,8 @@ public: } }; +} + void SwWrtShell::MoveCursor( bool bWithSelect ) { ResetCursorStack(); diff --git a/sw/source/uibase/wrtsh/wrtsh2.cxx b/sw/source/uibase/wrtsh/wrtsh2.cxx index 82d7c27cb0c6..a3e4d08b3e03 100644 --- a/sw/source/uibase/wrtsh/wrtsh2.cxx +++ b/sw/source/uibase/wrtsh/wrtsh2.cxx @@ -213,6 +213,8 @@ void SwWrtShell::UpdateInputFields( SwInputFieldList* pLst ) } } +namespace { + // Listener class: will close InputField dialog if input field(s) // is(are) deleted (for instance, by an extension) after the dialog shows up. // Otherwise, the for loop in SwWrtShell::UpdateInputFields will crash when doing: @@ -268,6 +270,8 @@ class FieldDeletionModify : public SwModify SwFormatField* mpFormatField; }; +} + // Start input dialog for a specific field bool SwWrtShell::StartInputFieldDlg(SwField* pField, bool bPrevButton, bool bNextButton, weld::Widget* pParentWin, SwWrtShell::FieldDialogPressedButton* pPressedButton) diff --git a/test/source/beans/xpropertyset.cxx b/test/source/beans/xpropertyset.cxx index 4abb48c44d88..ac9be2a6f81e 100644 --- a/test/source/beans/xpropertyset.cxx +++ b/test/source/beans/xpropertyset.cxx @@ -40,6 +40,8 @@ XPropertySet::PropsToTest::PropsToTest() { } +namespace +{ class MockedPropertyChangeListener : public ::cppu::WeakImplHelper<beans::XPropertyChangeListener> { public: @@ -75,6 +77,7 @@ public: virtual void SAL_CALL disposing(const lang::EventObject& /* xEventObj */) override {} }; +} void XPropertySet::testPropertyChangeListener() { diff --git a/test/source/chart/xchartdata.cxx b/test/source/chart/xchartdata.cxx index 5f099fde69d6..e7669fbd149a 100644 --- a/test/source/chart/xchartdata.cxx +++ b/test/source/chart/xchartdata.cxx @@ -23,6 +23,8 @@ using namespace css; namespace apitest { +namespace +{ class MockedChartDataChangeEventListener : public ::cppu::WeakImplHelper<chart::XChartDataChangeEventListener> { @@ -40,6 +42,7 @@ public: virtual void SAL_CALL disposing(const lang::EventObject& /* xEvent */) override {} }; +} void XChartData::testGetNotANumber() { diff --git a/test/source/diff/diff.cxx b/test/source/diff/diff.cxx index 483c3954c01a..050c5e457f59 100644 --- a/test/source/diff/diff.cxx +++ b/test/source/diff/diff.cxx @@ -28,6 +28,7 @@ #include <rtl/math.hxx> +namespace { struct tolerance { @@ -95,6 +96,7 @@ private: std::string fileName; }; +} XMLDiff::XMLDiff( const char* pFileName, const char* pContent, int size, const char* pToleranceFile) : xmlFile1(xmlParseFile(pFileName)) diff --git a/test/source/sheet/xactivationbroadcaster.cxx b/test/source/sheet/xactivationbroadcaster.cxx index 8e63e07741c8..f0f9b84c5a62 100644 --- a/test/source/sheet/xactivationbroadcaster.cxx +++ b/test/source/sheet/xactivationbroadcaster.cxx @@ -26,6 +26,8 @@ using namespace com::sun::star::uno; namespace apitest { +namespace +{ class MockedActivationEventListener : public ::cppu::WeakImplHelper<sheet::XActivationEventListener> { public: @@ -41,6 +43,7 @@ public: } virtual void SAL_CALL disposing(const lang::EventObject& /* xEventObj */) override {} }; +} void XActivationBroadcaster::testAddRemoveActivationEventListener() { diff --git a/test/source/util/xrefreshable.cxx b/test/source/util/xrefreshable.cxx index 19d1dc42acb0..4e6d2374a57f 100644 --- a/test/source/util/xrefreshable.cxx +++ b/test/source/util/xrefreshable.cxx @@ -25,6 +25,8 @@ using namespace com::sun::star::uno; namespace apitest { +namespace +{ class MockedRefreshListener : public ::cppu::WeakImplHelper<util::XRefreshListener> { public: @@ -40,6 +42,7 @@ public: } virtual void SAL_CALL disposing(const lang::EventObject& /* xEventObj */) override {} }; +} void XRefreshable::testRefreshListener() { diff --git a/testtools/source/bridgetest/bridgetest.cxx b/testtools/source/bridgetest/bridgetest.cxx index 535d8e1fa73c..c2b39378b8e6 100644 --- a/testtools/source/bridgetest/bridgetest.cxx +++ b/testtools/source/bridgetest/bridgetest.cxx @@ -98,9 +98,6 @@ bool checkEmpty(OUString const & string, char const * message) { return ok; } -} - - class TestBridgeImpl : public osl::DebugBase<TestBridgeImpl>, public WeakImplHelper< XMain, XServiceInfo > { @@ -120,6 +117,7 @@ public: virtual sal_Int32 SAL_CALL run( const Sequence< OUString > & rArgs ) override; }; +} static bool equals( const TestElement & rData1, const TestElement & rData2 ) { @@ -302,6 +300,8 @@ static bool performSequenceOfCallTest( const Reference < XBridgeTest > &xLBT ) return xLBT->sequenceOfCallTestPassed(); } +namespace { + class ORecursiveCall : public WeakImplHelper< XRecursiveCall > { private: @@ -322,6 +322,7 @@ public: } }; +} static bool performRecursiveCallTest( const Reference < XBridgeTest > & xLBT ) { @@ -330,12 +331,15 @@ static bool performRecursiveCallTest( const Reference < XBridgeTest > & xLBT ) return true; } +namespace { + class MyClass : public osl::DebugBase<MyClass>, public OWeakObject { public: MyClass(); }; +} MyClass::MyClass() { diff --git a/testtools/source/bridgetest/cppobj.cxx b/testtools/source/bridgetest/cppobj.cxx index 2a5a58be34bb..5cc360985609 100644 --- a/testtools/source/bridgetest/cppobj.cxx +++ b/testtools/source/bridgetest/cppobj.cxx @@ -117,6 +117,7 @@ static void assign( TestData & rData, rData.Sequence = rSequence; } +namespace { class Test_Impl : public osl::DebugBase<Test_Impl>, @@ -455,6 +456,8 @@ public: }; +} + Any Test_Impl::transportAny( const Any & value ) { return value; diff --git a/toolkit/source/awt/animatedimagespeer.cxx b/toolkit/source/awt/animatedimagespeer.cxx index fccfc8b0571f..e056ef04d55c 100644 --- a/toolkit/source/awt/animatedimagespeer.cxx +++ b/toolkit/source/awt/animatedimagespeer.cxx @@ -67,6 +67,8 @@ namespace toolkit //= AnimatedImagesPeer_Data + namespace { + struct CachedImage { OUString sImageURL; @@ -85,6 +87,8 @@ namespace toolkit } }; + } + struct AnimatedImagesPeer_Data { AnimatedImagesPeer& rAntiImpl; diff --git a/toolkit/source/awt/stylesettings.cxx b/toolkit/source/awt/stylesettings.cxx index 55abed46bf87..d2b250894a67 100644 --- a/toolkit/source/awt/stylesettings.cxx +++ b/toolkit/source/awt/stylesettings.cxx @@ -79,6 +79,8 @@ namespace toolkit //= StyleMethodGuard + namespace { + class StyleMethodGuard { public: @@ -92,6 +94,7 @@ namespace toolkit SolarMutexGuard const m_aGuard; }; + } //= WindowStyleSettings diff --git a/toolkit/source/controls/controlmodelcontainerbase.cxx b/toolkit/source/controls/controlmodelcontainerbase.cxx index 140d9c103db6..b8328104e518 100644 --- a/toolkit/source/controls/controlmodelcontainerbase.cxx +++ b/toolkit/source/controls/controlmodelcontainerbase.cxx @@ -75,8 +75,6 @@ namespace static Sequence<OUString> s_aLanguageDependentProperties{ "HelpText", "Title" }; return s_aLanguageDependentProperties; } -} - // functor for disposing a control model struct DisposeControlModel @@ -94,6 +92,7 @@ struct DisposeControlModel } }; +} // functor for searching control model by name struct FindControlModel diff --git a/toolkit/source/controls/dialogcontrol.cxx b/toolkit/source/controls/dialogcontrol.cxx index d260dce6ad7c..b1e944ddf697 100644 --- a/toolkit/source/controls/dialogcontrol.cxx +++ b/toolkit/source/controls/dialogcontrol.cxx @@ -62,6 +62,8 @@ using namespace ::com::sun::star::util; // we probably will need both a hash of control models and hash of controls // => use some template magic +namespace { + template< typename T > class SimpleNamedThingContainer : public ::cppu::WeakImplHelper< container::XNameContainer > { @@ -123,8 +125,6 @@ public: } }; -namespace { - class UnoControlDialogModel : public ControlModelContainerBase { protected: diff --git a/toolkit/source/controls/geometrycontrolmodel.cxx b/toolkit/source/controls/geometrycontrolmodel.cxx index a40856f16179..8bcc53aaccd0 100644 --- a/toolkit/source/controls/geometrycontrolmodel.cxx +++ b/toolkit/source/controls/geometrycontrolmodel.cxx @@ -487,6 +487,7 @@ m_nPropertyMapId = aPropMapIdPos->second; } + namespace { struct PropertyNameLess { @@ -508,6 +509,7 @@ } }; + } ::cppu::IPropertyArrayHelper* OCommonGeometryControlModel::createArrayHelper( sal_Int32 _nId ) const { @@ -569,6 +571,7 @@ return css::uno::Sequence<sal_Int8>(); } + namespace { struct Int32Equal { @@ -581,6 +584,7 @@ } }; + } void SAL_CALL OCommonGeometryControlModel::setFastPropertyValue_NoBroadcast( sal_Int32 _nHandle, const Any& _rValue ) { diff --git a/toolkit/source/controls/stdtabcontroller.cxx b/toolkit/source/controls/stdtabcontroller.cxx index b989f3f5a8e5..358eb60a5082 100644 --- a/toolkit/source/controls/stdtabcontroller.cxx +++ b/toolkit/source/controls/stdtabcontroller.cxx @@ -226,12 +226,16 @@ Sequence< Reference< XControl > > StdTabController::getControls( ) return aSeq; } +namespace { + struct ComponentEntry { css::awt::XWindow* pComponent; ::Point aPos; }; +} + void StdTabController::autoTabOrder( ) { ::osl::Guard< ::osl::Mutex > aGuard( GetMutex() ); diff --git a/toolkit/source/controls/unocontrol.cxx b/toolkit/source/controls/unocontrol.cxx index 9aa4a5e22277..c58faaed4b96 100644 --- a/toolkit/source/controls/unocontrol.cxx +++ b/toolkit/source/controls/unocontrol.cxx @@ -53,12 +53,16 @@ using namespace ::com::sun::star::util; using ::com::sun::star::accessibility::XAccessibleContext; using ::com::sun::star::accessibility::XAccessible; +namespace { + struct LanguageDependentProp { const char* pPropName; sal_Int32 const nPropNameLength; }; +} + static const LanguageDependentProp aLanguageDependentProp[] = { { "Text", 4 }, @@ -86,6 +90,7 @@ static Sequence< OUString> lcl_ImplGetPropertyNames( const Reference< XMultiProp return aNames; } +namespace { class VclListenerLock { @@ -108,6 +113,8 @@ public: VclListenerLock& operator=(const VclListenerLock&) = delete; }; +} + typedef ::std::map< OUString, sal_Int32 > MapString2Int; struct UnoControl_Data { diff --git a/toolkit/source/controls/unocontrolcontainer.cxx b/toolkit/source/controls/unocontrolcontainer.cxx index d7f2aefaba85..11d8160dc505 100644 --- a/toolkit/source/controls/unocontrolcontainer.cxx +++ b/toolkit/source/controls/unocontrolcontainer.cxx @@ -40,6 +40,8 @@ using namespace ::com::sun::star; // class UnoControlHolder +namespace { + struct UnoControlHolder { uno::Reference< awt::XControl > mxControl; @@ -56,6 +58,8 @@ public: const uno::Reference< awt::XControl >& getControl() const { return mxControl; } }; +} + class UnoControlHolderList { public: @@ -324,6 +328,8 @@ static void implUpdateVisibility typedef ::cppu::WeakImplHelper< beans::XPropertyChangeListener > PropertyChangeListenerHelper; +namespace { + class DialogStepChangedListener: public PropertyChangeListenerHelper { private: @@ -341,6 +347,8 @@ public: }; +} + void SAL_CALL DialogStepChangedListener::disposing( const lang::EventObject& /*_rSource*/) { mxControlContainer.clear(); diff --git a/toolkit/source/controls/unocontrols.cxx b/toolkit/source/controls/unocontrols.cxx index cbb04926bd95..d6d4d77f4514 100644 --- a/toolkit/source/controls/unocontrols.cxx +++ b/toolkit/source/controls/unocontrols.cxx @@ -1994,6 +1994,8 @@ stardiv_Toolkit_UnoGroupBoxControl_get_implementation( // = UnoControlListBoxModel_Data +namespace { + struct ListItem { OUString ItemText; @@ -2015,8 +2017,12 @@ struct ListItem } }; +} + typedef beans::Pair< OUString, OUString > UnoListItem; +namespace { + struct StripItemData { UnoListItem operator()( const ListItem& i_rItem ) @@ -2025,6 +2031,8 @@ struct StripItemData } }; +} + struct UnoControlListBoxModel_Data { explicit UnoControlListBoxModel_Data( UnoControlListBoxModel& i_rAntiImpl ) diff --git a/toolkit/source/helper/accessibilityclient.cxx b/toolkit/source/helper/accessibilityclient.cxx index abbd9a79066c..682354607111 100644 --- a/toolkit/source/helper/accessibilityclient.cxx +++ b/toolkit/source/helper/accessibilityclient.cxx @@ -49,6 +49,8 @@ namespace toolkit //= AccessibleDummyFactory + namespace { + class AccessibleDummyFactory: public IAccessibleFactory { @@ -129,6 +131,7 @@ namespace toolkit } }; + } AccessibleDummyFactory::AccessibleDummyFactory() { diff --git a/toolkit/source/helper/property.cxx b/toolkit/source/helper/property.cxx index b09b0a7e8fff..c3b67df41ac4 100644 --- a/toolkit/source/helper/property.cxx +++ b/toolkit/source/helper/property.cxx @@ -45,6 +45,8 @@ using ::com::sun::star::graphic::XGraphic; using namespace com::sun::star; +namespace { + struct ImplPropertyInfo { OUString aName; @@ -65,6 +67,8 @@ struct ImplPropertyInfo }; +} + #define DECL_PROP_1( asciiname, id, type, attrib1 ) \ ImplPropertyInfo( asciiname, BASEPROPERTY_##id, cppu::UnoType<type>::get(), css::beans::PropertyAttribute::attrib1 ) #define DECL_PROP_2( asciiname, id, type, attrib1, attrib2 ) \ @@ -268,6 +272,7 @@ static ImplPropertyInfo* ImplGetPropertyInfos( sal_uInt16& rElementCount ) return aImplPropertyInfos; } +namespace { struct ImplPropertyInfoCompareFunctor { @@ -281,6 +286,8 @@ struct ImplPropertyInfoCompareFunctor } }; +} + static void ImplAssertValidPropertyArray() { static bool bSorted = false; diff --git a/tools/source/debug/debug.cxx b/tools/source/debug/debug.cxx index de4a14015044..a410b6feeaa9 100644 --- a/tools/source/debug/debug.cxx +++ b/tools/source/debug/debug.cxx @@ -63,6 +63,8 @@ #ifndef NDEBUG +namespace { + struct DebugData { DbgTestSolarMutexProc pDbgTestSolarMutex; @@ -74,6 +76,8 @@ struct DebugData } }; +} + static DebugData aDebugData; void DbgSetTestSolarMutex( DbgTestSolarMutexProc pParam ) diff --git a/tools/source/generic/config.cxx b/tools/source/generic/config.cxx index fe760decf852..6808bc4a132a 100644 --- a/tools/source/generic/config.cxx +++ b/tools/source/generic/config.cxx @@ -29,6 +29,8 @@ #include <tools/config.hxx> #include <sal/log.hxx> +namespace { + struct ImplKeyData { ImplKeyData* mpNext; @@ -37,6 +39,8 @@ struct ImplKeyData bool mbIsComment; }; +} + struct ImplGroupData { ImplGroupData* mpNext; diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx index 0a597fdff1fc..7c9ece60693b 100644 --- a/tools/source/generic/poly.cxx +++ b/tools/source/generic/poly.cxx @@ -639,6 +639,8 @@ void ImplPolygon::ImplCreateFlagArray() } } +namespace { + class ImplPointFilter { public: @@ -670,6 +672,8 @@ public: ImplPolygon& get() { return maPoly; } }; +} + void ImplPolygonPointFilter::Input( const Point& rPoint ) { if ( !mnSize || (rPoint != maPoly.mxPointAry[mnSize-1]) ) @@ -687,6 +691,8 @@ void ImplPolygonPointFilter::LastPoint() maPoly.ImplSetSize( mnSize ); }; +namespace { + class ImplEdgePointFilter : public ImplPointFilter { Point maFirstPoint; @@ -721,6 +727,8 @@ public: virtual void LastPoint() override; }; +} + inline int ImplEdgePointFilter::VisibleSide( const Point& rPoint ) const { if ( mnEdge & EDGE_HORZ ) @@ -1219,6 +1227,8 @@ void Polygon::AdaptiveSubdivide( Polygon& rResult, const double d ) const } } +namespace { + class Vector2D { private: @@ -1233,6 +1243,9 @@ public: bool IsPositive( Vector2D const & rVec ) const { return ( mfX * rVec.mfY - mfY * rVec.mfX ) >= 0.0; } bool IsNegative( Vector2D const & rVec ) const { return !IsPositive( rVec ); } }; + +} + Vector2D& Vector2D::Normalize() { double fLen = Scalar( *this ); diff --git a/tools/source/reversemap/bestreversemap.cxx b/tools/source/reversemap/bestreversemap.cxx index 90679654cbbe..83b642368caa 100644 --- a/tools/source/reversemap/bestreversemap.cxx +++ b/tools/source/reversemap/bestreversemap.cxx @@ -13,6 +13,8 @@ #include <cstdlib> #include <stdio.h> +namespace { + struct Encoder { rtl_UnicodeToTextConverter const m_aConverter; @@ -55,6 +57,8 @@ struct Encoder }; +} + int main() { # define EXP(x) Encoder(x, #x) diff --git a/ucb/source/core/ucbstore.cxx b/ucb/source/core/ucbstore.cxx index ea5e23d38f9b..b36fc0e8ca78 100644 --- a/ucb/source/core/ucbstore.cxx +++ b/ucb/source/core/ucbstore.cxx @@ -110,6 +110,8 @@ static OUString makeHierarchalNameSegment( const OUString & rIn ) // PropertySetMap_Impl. typedef std::unordered_map< OUString, PersistentPropertySet*> PropertySetMap_Impl; +namespace { + // class PropertySetInfo_Impl class PropertySetInfo_Impl : public cppu::WeakImplHelper < XPropertySetInfo > { @@ -129,6 +131,7 @@ public: void reset() { m_pProps.reset(); } }; +} // UcbStore_Impl. diff --git a/ucb/source/ucp/ext/ucpext_datasupplier.cxx b/ucb/source/ucp/ext/ucpext_datasupplier.cxx index 4fdfef7bbc49..acb415f3d903 100644 --- a/ucb/source/ucp/ext/ucpext_datasupplier.cxx +++ b/ucb/source/ucp/ext/ucpext_datasupplier.cxx @@ -59,6 +59,8 @@ namespace ucb { namespace ucp { namespace ext //= ResultListEntry + namespace { + struct ResultListEntry { OUString sId; @@ -67,6 +69,8 @@ namespace ucb { namespace ucp { namespace ext Reference< XRow > xRow; }; + } + typedef ::std::vector< ResultListEntry > ResultList; diff --git a/ucb/source/ucp/file/prov.cxx b/ucb/source/ucp/file/prov.cxx index 937487e749cc..0cdbacaba61e 100644 --- a/ucb/source/ucp/file/prov.cxx +++ b/ucb/source/ucp/file/prov.cxx @@ -245,6 +245,8 @@ FileProvider::createContentIdentifier( //XPropertySetInfoImpl +namespace { + class XPropertySetInfoImpl2 : public cppu::OWeakObject, public XPropertySetInfo @@ -279,6 +281,7 @@ private: Sequence< Property > m_seq; }; +} XPropertySetInfoImpl2::XPropertySetInfoImpl2() : m_seq( 3 ) diff --git a/ucb/source/ucp/ftp/ftpcontent.cxx b/ucb/source/ucp/ftp/ftpcontent.cxx index eede2a33b6bd..e655c6cbe162 100644 --- a/ucb/source/ucp/ftp/ftpcontent.cxx +++ b/ucb/source/ucp/ftp/ftpcontent.cxx @@ -626,6 +626,7 @@ OUString FTPContent::getParentURL() return m_aFTPURL.parent(); } +namespace { class InsertData : public CurlInput { @@ -644,6 +645,7 @@ private: Reference<XInputStream> m_xInputStream; }; +} sal_Int32 InsertData::read(sal_Int8 *dest,sal_Int32 nBytesRequested) { diff --git a/ucb/source/ucp/ftp/ftpresultsetbase.cxx b/ucb/source/ucp/ftp/ftpresultsetbase.cxx index f777dad67a5b..cb3d017af7d3 100644 --- a/ucb/source/ucp/ftp/ftpresultsetbase.cxx +++ b/ucb/source/ucp/ftp/ftpresultsetbase.cxx @@ -333,6 +333,7 @@ ResultSetBase::queryContent() return uno::Reference< ucb::XContent >(); } +namespace { class XPropertySetInfoImpl : public cppu::OWeakObject, @@ -391,6 +392,7 @@ private: uno::Sequence< beans::Property > m_aSeq; }; +} // XPropertySet uno::Reference< beans::XPropertySetInfo > SAL_CALL diff --git a/ucb/source/ucp/gio/gio_content.cxx b/ucb/source/ucp/gio/gio_content.cxx index 05c26c42760f..77a5c0127ae7 100644 --- a/ucb/source/ucp/gio/gio_content.cxx +++ b/ucb/source/ucp/gio/gio_content.cxx @@ -304,6 +304,8 @@ css::uno::Any Content::getBadArgExcept() static_cast< cppu::OWeakObject * >( this ), -1) ); } +namespace { + class MountOperation { ucb::ucp::gio::glib::MainContextRef mContext; @@ -317,6 +319,8 @@ public: GError *Mount(GFile *pFile); }; +} + MountOperation::MountOperation(const css::uno::Reference< css::ucb::XCommandEnvironment >& xEnv) : mpError(nullptr) { ucb::ucp::gio::glib::MainContextRef oldContext(g_main_context_ref_thread_default()); diff --git a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx index 004c27a5f2c1..d9571c758e86 100644 --- a/ucb/source/ucp/hierarchy/hierarchydatasource.cxx +++ b/ucb/source/ucp/hierarchy/hierarchydatasource.cxx @@ -61,6 +61,7 @@ namespace hcp_impl // HierarchyDataReadAccess Implementation. +namespace { class HierarchyDataAccess : public cppu::OWeakObject, public lang::XServiceInfo, @@ -171,6 +172,8 @@ private: css::uno::Reference<T> ensureOrigInterface(css::uno::Reference<T>& x); }; +} + } // namespace hcp_impl using namespace hcp_impl; diff --git a/ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx b/ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx index c31eb075227c..fc1a0f0d9b64 100644 --- a/ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx +++ b/ucb/source/ucp/hierarchy/hierarchydatasupplier.cxx @@ -42,6 +42,7 @@ namespace hierarchy_ucp // struct ResultListEntry. +namespace { struct ResultListEntry { @@ -54,6 +55,7 @@ struct ResultListEntry explicit ResultListEntry( const HierarchyEntryData& rEntry ) : aData( rEntry ) {} }; +} // ResultList. diff --git a/ucb/source/ucp/package/pkgdatasupplier.cxx b/ucb/source/ucp/package/pkgdatasupplier.cxx index 71d58c777bb4..596282b6a1f6 100644 --- a/ucb/source/ucp/package/pkgdatasupplier.cxx +++ b/ucb/source/ucp/package/pkgdatasupplier.cxx @@ -47,6 +47,7 @@ namespace package_ucp // struct ResultListEntry. +namespace { struct ResultListEntry { @@ -58,6 +59,8 @@ struct ResultListEntry explicit ResultListEntry( const OUString& rURL ) : aURL( rURL ) {} }; +} + // struct DataSupplier_Impl. diff --git a/ucb/source/ucp/package/pkgprovider.cxx b/ucb/source/ucp/package/pkgprovider.cxx index ea4549a32268..609ce5b40671 100644 --- a/ucb/source/ucp/package/pkgprovider.cxx +++ b/ucb/source/ucp/package/pkgprovider.cxx @@ -47,11 +47,12 @@ namespace package_ucp // class Package. +namespace { class Package : public cppu::OWeakObject, public container::XHierarchicalNameAccess { - friend class ContentProvider; + friend ContentProvider; OUString const m_aName; uno::Reference< container::XHierarchicalNameAccess > m_xNA; @@ -84,6 +85,7 @@ public: { return m_xNA->hasByHierarchicalName( aName ); } }; +} class Packages : public std::unordered_map<OUString, Package*> {}; diff --git a/ucb/source/ucp/tdoc/tdoc_datasupplier.cxx b/ucb/source/ucp/tdoc/tdoc_datasupplier.cxx index 6f4c65582ec1..218fc117e44e 100644 --- a/ucb/source/ucp/tdoc/tdoc_datasupplier.cxx +++ b/ucb/source/ucp/tdoc/tdoc_datasupplier.cxx @@ -43,6 +43,7 @@ namespace tdoc_ucp // struct ResultListEntry. +namespace { struct ResultListEntry { @@ -54,6 +55,7 @@ struct ResultListEntry explicit ResultListEntry( const OUString& rURL ) : aURL( rURL ) {} }; +} // struct DataSupplier_Impl. diff --git a/ucb/source/ucp/tdoc/tdoc_passwordrequest.cxx b/ucb/source/ucp/tdoc/tdoc_passwordrequest.cxx index 0312840c3f36..cac1eaaf61e3 100644 --- a/ucb/source/ucp/tdoc/tdoc_passwordrequest.cxx +++ b/ucb/source/ucp/tdoc/tdoc_passwordrequest.cxx @@ -35,6 +35,8 @@ using namespace tdoc_ucp; namespace tdoc_ucp { + namespace { + class InteractionSupplyPassword : public ucbhelper::InteractionContinuation, public lang::XTypeProvider, @@ -66,6 +68,8 @@ namespace tdoc_ucp osl::Mutex m_aMutex; OUString m_aPassword; }; + + } } // namespace tdoc_ucp diff --git a/ucb/source/ucp/webdav-neon/LinkSequence.cxx b/ucb/source/ucp/webdav-neon/LinkSequence.cxx index 361e1a27fbd7..ea49352d93ba 100644 --- a/ucb/source/ucp/webdav-neon/LinkSequence.cxx +++ b/ucb/source/ucp/webdav-neon/LinkSequence.cxx @@ -36,6 +36,7 @@ using namespace webdav_ucp; using namespace com::sun::star; +namespace { struct LinkSequenceParseContext { @@ -47,6 +48,8 @@ struct LinkSequenceParseContext : hasSource( false ), hasDestination( false ) {} }; +} + #define STATE_TOP (1) #define STATE_LINK (STATE_TOP) diff --git a/ucb/source/ucp/webdav-neon/LockEntrySequence.cxx b/ucb/source/ucp/webdav-neon/LockEntrySequence.cxx index 0023769bcc9a..61be4420c7b9 100644 --- a/ucb/source/ucp/webdav-neon/LockEntrySequence.cxx +++ b/ucb/source/ucp/webdav-neon/LockEntrySequence.cxx @@ -35,6 +35,7 @@ using namespace webdav_ucp; using namespace com::sun::star; +namespace { struct LockEntrySequenceParseContext { @@ -46,6 +47,8 @@ struct LockEntrySequenceParseContext : hasScope( false ), hasType( false ) {} }; +} + #define STATE_TOP (1) #define STATE_LOCKENTRY (STATE_TOP) diff --git a/ucb/source/ucp/webdav-neon/LockSequence.cxx b/ucb/source/ucp/webdav-neon/LockSequence.cxx index 917945824d11..b9399c60d64e 100644 --- a/ucb/source/ucp/webdav-neon/LockSequence.cxx +++ b/ucb/source/ucp/webdav-neon/LockSequence.cxx @@ -36,6 +36,8 @@ using namespace webdav_ucp; using namespace com::sun::star; +namespace { + struct LockSequenceParseContext { std::unique_ptr<ucb::Lock> pLock; @@ -50,6 +52,8 @@ struct LockSequenceParseContext hasDepth( false ), hasHREF( false ), hasTimeout( false ) {} }; +} + #define STATE_TOP (1) #define STATE_ACTIVELOCK (STATE_TOP) diff --git a/ucb/source/ucp/webdav-neon/NeonSession.cxx b/ucb/source/ucp/webdav-neon/NeonSession.cxx index cdd703615b4c..56f813a8c1fb 100644 --- a/ucb/source/ucp/webdav-neon/NeonSession.cxx +++ b/ucb/source/ucp/webdav-neon/NeonSession.cxx @@ -79,6 +79,8 @@ using namespace webdav_ucp; # define EOL "\r\n" #endif +namespace { + struct RequestData { // POST @@ -107,6 +109,8 @@ struct hashPtr } }; +} + typedef std::unordered_map < ne_request*, @@ -149,6 +153,8 @@ static bool noKeepAlive( const uno::Sequence< beans::NamedValue >& rFlags ) return pValue != rFlags.end() && !pValue->Value.get<bool>(); } +namespace { + struct NeonRequestContext { uno::Reference< io::XOutputStream > xOutputStream; @@ -193,6 +199,8 @@ struct NeonRequestContext }; +} + // A simple Neon response_block_reader for use with an XInputStream extern "C" { diff --git a/ucb/source/ucp/webdav-neon/UCBDeadPropertyValue.cxx b/ucb/source/ucp/webdav-neon/UCBDeadPropertyValue.cxx index 659bf5d49cc1..6a06f0dcb9ba 100644 --- a/ucb/source/ucp/webdav-neon/UCBDeadPropertyValue.cxx +++ b/ucb/source/ucp/webdav-neon/UCBDeadPropertyValue.cxx @@ -37,6 +37,7 @@ using namespace webdav_ucp; using namespace com::sun::star; +namespace { struct UCBDeadPropertyValueParseContext { @@ -46,6 +47,8 @@ struct UCBDeadPropertyValueParseContext UCBDeadPropertyValueParseContext() {} }; +} + static const char aTypeString[] = "string"; static const char aTypeLong[] = "long"; static const char aTypeShort[] = "short"; diff --git a/ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx b/ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx index 00085956aa3c..062cf2d5683f 100644 --- a/ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx +++ b/ucb/source/ucp/webdav-neon/webdavdatasupplier.cxx @@ -55,6 +55,7 @@ namespace webdav_ucp // struct ResultListEntry. +namespace { struct ResultListEntry { @@ -69,6 +70,7 @@ struct ResultListEntry {} }; +} // ResultList. diff --git a/ucbhelper/source/client/content.cxx b/ucbhelper/source/client/content.cxx index 9641a4e0a87a..5c698a2d7ba6 100644 --- a/ucbhelper/source/client/content.cxx +++ b/ucbhelper/source/client/content.cxx @@ -74,6 +74,8 @@ using namespace com::sun::star::uno; namespace ucbhelper { +namespace { + class EmptyInputStream : public ::cppu::WeakImplHelper< XInputStream > { public: @@ -86,6 +88,8 @@ public: virtual void SAL_CALL closeInput() override; }; +} + sal_Int32 EmptyInputStream::readBytes( Sequence< sal_Int8 > & data, sal_Int32 ) { @@ -116,6 +120,7 @@ void EmptyInputStream::closeInput() // class ContentEventListener_Impl. +namespace { class ContentEventListener_Impl : public cppu::OWeakObject, public XContentEventListener @@ -140,13 +145,14 @@ public: virtual void SAL_CALL disposing( const EventObject& Source ) override; }; +} // class Content_Impl. class Content_Impl : public salhelper::SimpleReferenceObject { -friend class ContentEventListener_Impl; +friend ContentEventListener_Impl; mutable OUString m_aURL; Reference< XComponentContext > m_xCtx; diff --git a/ucbhelper/source/client/proxydecider.cxx b/ucbhelper/source/client/proxydecider.cxx index b56ffbf76d71..062dd64b2887 100644 --- a/ucbhelper/source/client/proxydecider.cxx +++ b/ucbhelper/source/client/proxydecider.cxx @@ -62,6 +62,8 @@ namespace ucbhelper namespace proxydecider_impl { +namespace { + // A simple case ignoring wildcard matcher. class WildCard { @@ -77,9 +79,12 @@ public: bool Matches( const OUString & rStr ) const; }; +} typedef std::pair< WildCard, WildCard > NoProxyListEntry; +namespace { + class HostnameCache { typedef std::pair< OUString, OUString > HostListEntry; @@ -111,6 +116,7 @@ public: } }; +} class InternetProxyDecider_Impl : public cppu::WeakImplHelper< util::XChangesListener > diff --git a/ucbhelper/source/provider/contenthelper.cxx b/ucbhelper/source/provider/contenthelper.cxx index a7f39fced3d8..653f0d47e125 100644 --- a/ucbhelper/source/provider/contenthelper.cxx +++ b/ucbhelper/source/provider/contenthelper.cxx @@ -48,6 +48,8 @@ using namespace com::sun::star; namespace ucbhelper_impl { +namespace { + class PropertyEventSequence { uno::Sequence< beans::PropertyChangeEvent > m_aSeq; @@ -64,8 +66,12 @@ public: { m_aSeq.realloc( m_nPos ); return m_aSeq; } }; +} + typedef void* XPropertiesChangeListenerPtr; // -> Compiler problems! +namespace { + struct equalPtr { bool operator()( const XPropertiesChangeListenerPtr& rp1, @@ -83,6 +89,8 @@ struct hashPtr } }; +} + typedef std::unordered_map < XPropertiesChangeListenerPtr, diff --git a/ucbhelper/source/provider/resultset.cxx b/ucbhelper/source/provider/resultset.cxx index 133b66a1da56..de8f868c8445 100644 --- a/ucbhelper/source/provider/resultset.cxx +++ b/ucbhelper/source/provider/resultset.cxx @@ -38,6 +38,8 @@ using namespace com::sun::star; namespace ucbhelper_impl { +namespace { + struct PropertyInfo { const char* pName; @@ -46,6 +48,8 @@ struct PropertyInfo const uno::Type& (*pGetCppuType)(); }; +} + static const uno::Type& sal_Int32_getCppuType() { return cppu::UnoType<sal_Int32>::get(); @@ -80,6 +84,7 @@ static const PropertyInfo aPropertyTable[] = // class PropertySetInfo +namespace { class PropertySetInfo : public cppu::OWeakObject, @@ -115,9 +120,13 @@ public: virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) override; }; +} + typedef cppu::OMultiTypeInterfaceContainerHelperVar<OUString> PropertyChangeListenerContainer; +namespace { + class PropertyChangeListeners : public PropertyChangeListenerContainer { public: @@ -125,6 +134,8 @@ public: : PropertyChangeListenerContainer( rMtx ) {} }; +} + } // namespace ucbhelper_impl using namespace ucbhelper_impl; diff --git a/unotools/source/config/cmdoptions.cxx b/unotools/source/config/cmdoptions.cxx index 56b61ad2704a..5826eb0ac082 100644 --- a/unotools/source/config/cmdoptions.cxx +++ b/unotools/source/config/cmdoptions.cxx @@ -47,6 +47,8 @@ using namespace ::com::sun::star::beans; #define PROPERTYNAME_CMD "Command" +namespace { + /*-**************************************************************************************************************** @descr support simple command option structures and operations on it ****************************************************************************************************************-*/ @@ -83,6 +85,8 @@ class SvtCmdOptions CommandHashMap m_aCommandHashMap; }; +} + typedef ::std::vector< css::uno::WeakReference< css::frame::XFrame > > SvtFrameVector; class SvtCommandOptions_Impl : public ConfigItem diff --git a/unotools/source/config/configitem.cxx b/unotools/source/config/configitem.cxx index 8ed1d317a09c..5de369999fc3 100644 --- a/unotools/source/config/configitem.cxx +++ b/unotools/source/config/configitem.cxx @@ -76,6 +76,8 @@ namespace utl{ }; } +namespace { + class ValueCounter_Impl { sal_Int16& rCnt; @@ -92,6 +94,8 @@ public: } }; +} + ConfigChangeListener_Impl::ConfigChangeListener_Impl( ConfigItem& rItem, const Sequence< OUString >& rNames) : pParent(&rItem), diff --git a/unotools/source/config/configvaluecontainer.cxx b/unotools/source/config/configvaluecontainer.cxx index 780a59d99926..01a974bcecf2 100644 --- a/unotools/source/config/configvaluecontainer.cxx +++ b/unotools/source/config/configvaluecontainer.cxx @@ -140,6 +140,8 @@ namespace utl //= functors on NodeValueAccessor instances + namespace { + /// base class for functors synchronizing between exchange locations and config sub nodes struct SubNodeAccess { @@ -179,6 +181,8 @@ namespace utl } }; + } + //= OConfigurationValueContainerImpl struct OConfigurationValueContainerImpl diff --git a/unotools/source/config/defaultoptions.cxx b/unotools/source/config/defaultoptions.cxx index dddbd22d3b13..b3c9dca8e38b 100644 --- a/unotools/source/config/defaultoptions.cxx +++ b/unotools/source/config/defaultoptions.cxx @@ -110,12 +110,16 @@ std::weak_ptr<SvtDefaultOptions_Impl> g_pOptions; typedef OUString SvtDefaultOptions_Impl:: *PathStrPtr; +namespace { + struct PathToDefaultMapping_Impl { SvtPathOptions::Paths const _ePath; PathStrPtr const _pDefaultPath; }; +} + static PathToDefaultMapping_Impl const PathMap_Impl[] = { { SvtPathOptions::PATH_ADDIN, &SvtDefaultOptions_Impl::m_aAddinPath }, diff --git a/unotools/source/config/dynamicmenuoptions.cxx b/unotools/source/config/dynamicmenuoptions.cxx index fe7f31d6b96a..019ca1b86407 100644 --- a/unotools/source/config/dynamicmenuoptions.cxx +++ b/unotools/source/config/dynamicmenuoptions.cxx @@ -59,6 +59,8 @@ using namespace ::com::sun::star::beans; #define PATHPREFIX_SETUP "m" +namespace { + /*-**************************************************************************************************************** @descr struct to hold information about one menu entry. ****************************************************************************************************************-*/ @@ -139,6 +141,8 @@ class SvtDynMenu vector< SvtDynMenuEntry > lUserEntries; }; +} + class SvtDynamicMenuOptions_Impl : public ConfigItem { public: @@ -440,6 +444,8 @@ Sequence< OUString > SvtDynamicMenuOptions_Impl::impl_GetPropertyNames( sal_uInt // private helper +namespace { + class CountWithPrefixSort { public: @@ -467,6 +473,8 @@ class SelectByPrefix } }; +} + // private method void SvtDynamicMenuOptions_Impl::impl_SortAndExpandPropertyNames( const Sequence< OUString >& lSource , diff --git a/unotools/source/config/fltrcfg.cxx b/unotools/source/config/fltrcfg.cxx index 92ec14e0dd14..c68ac827ee79 100644 --- a/unotools/source/config/fltrcfg.cxx +++ b/unotools/source/config/fltrcfg.cxx @@ -64,6 +64,8 @@ namespace o3tl { template<> struct typed_flags<ConfigFlags> : is_typed_flags<ConfigFlags, 0xe7fff3f> {}; } +namespace { + class SvtAppFilterOptions_Impl : public utl::ConfigItem { private: @@ -98,6 +100,8 @@ public: } }; +} + SvtAppFilterOptions_Impl::~SvtAppFilterOptions_Impl() { assert(!IsModified()); // should have been committed @@ -130,6 +134,8 @@ void SvtAppFilterOptions_Impl::Load() bSaveVBA = *o3tl::doAccess<bool>(pValues[1]); } +namespace { + class SvtWriterFilterOptions_Impl : public SvtAppFilterOptions_Impl { private: @@ -153,6 +159,8 @@ public: } }; +} + void SvtWriterFilterOptions_Impl::ImplCommit() { SvtAppFilterOptions_Impl::ImplCommit(); @@ -176,6 +184,8 @@ void SvtWriterFilterOptions_Impl::Load() bLoadExecutable = *o3tl::doAccess<bool>(pValues[0]); } +namespace { + class SvtCalcFilterOptions_Impl : public SvtAppFilterOptions_Impl { private: @@ -199,6 +209,8 @@ public: } }; +} + void SvtCalcFilterOptions_Impl::ImplCommit() { SvtAppFilterOptions_Impl::ImplCommit(); diff --git a/unotools/source/config/fontcfg.cxx b/unotools/source/config/fontcfg.cxx index bd7f7e21330b..1da36a7e978c 100644 --- a/unotools/source/config/fontcfg.cxx +++ b/unotools/source/config/fontcfg.cxx @@ -448,12 +448,16 @@ static const char* const aImplKillTrailingWithExceptionsList[] = nullptr }; +namespace { + struct ImplFontAttrWeightSearchData { const char* mpStr; FontWeight const meWeight; }; +} + static ImplFontAttrWeightSearchData const aImplWeightAttrSearchList[] = { // the attribute names are ordered by "first match wins" @@ -474,12 +478,16 @@ static ImplFontAttrWeightSearchData const aImplWeightAttrSearchList[] = { nullptr, WEIGHT_DONTKNOW }, }; +namespace { + struct ImplFontAttrWidthSearchData { const char* mpStr; FontWidth const meWidth; }; +} + static ImplFontAttrWidthSearchData const aImplWidthAttrSearchList[] = { { "narrow", WIDTH_CONDENSED }, @@ -495,12 +503,16 @@ static ImplFontAttrWidthSearchData const aImplWidthAttrSearchList[] = { nullptr, WIDTH_DONTKNOW }, }; +namespace { + struct ImplFontAttrTypeSearchData { const char* mpStr; ImplFontAttrs const mnType; }; +} + static ImplFontAttrTypeSearchData const aImplTypeAttrSearchList[] = { { "monotype", ImplFontAttrs::None }, @@ -734,12 +746,16 @@ void FontSubstConfiguration::getMapName( const OUString& rOrgName, OUString& rSh } } +namespace { + struct StrictStringSort { bool operator()( const FontNameAttr& rLeft, const FontNameAttr& rRight ) { return rLeft.Name.compareTo( rRight.Name ) < 0; } }; +} + // The entries in this table must match the bits in the ImplFontAttrs enum. static const char* const pAttribNames[] = @@ -778,12 +794,16 @@ static const char* const pAttribNames[] = "other" }; +namespace { + struct enum_convert { const char* pName; int const nEnum; }; +} + static const enum_convert pWeightNames[] = { { "normal", WEIGHT_NORMAL }, diff --git a/unotools/source/config/lingucfg.cxx b/unotools/source/config/lingucfg.cxx index 7c7a6b700cc8..0bbd036b6255 100644 --- a/unotools/source/config/lingucfg.cxx +++ b/unotools/source/config/lingucfg.cxx @@ -208,12 +208,18 @@ void SvtLinguConfigItem::ImplCommit() SaveOptions( GetPropertyNames() ); } -static struct NamesToHdl +namespace { + +struct NamesToHdl { const char *pFullPropName; // full qualified name as used in configuration const char *pPropName; // property name only (atom) of above sal_Int32 const nHdl; // numeric handle representing the property -} const aNamesToHdl[] = +}; + +} + +static NamesToHdl const aNamesToHdl[] = { {/* 0 */ "General/DefaultLocale", UPN_DEFAULT_LOCALE, UPH_DEFAULT_LOCALE}, {/* 1 */ "General/DictionaryList/ActiveDictionaries", UPN_ACTIVE_DICTIONARIES, UPH_ACTIVE_DICTIONARIES}, diff --git a/unotools/source/config/moduleoptions.cxx b/unotools/source/config/moduleoptions.cxx index c6442a16ab9e..be70d4d7e0c1 100644 --- a/unotools/source/config/moduleoptions.cxx +++ b/unotools/source/config/moduleoptions.cxx @@ -82,6 +82,8 @@ #define FACTORYCOUNT 11 +namespace { + /*-************************************************************************************************************ @descr This struct hold information about one factory. We declare a complete array which can hold infos for all well known factories. Values of enum "EFactory" (see header!) are directly used as index! @@ -224,6 +226,8 @@ struct FactoryInfo css::uno::Reference< css::util::XStringSubstitution > xSubstVars; }; +} + class SvtModuleOptions_Impl : public ::utl::ConfigItem { diff --git a/unotools/source/config/pathoptions.cxx b/unotools/source/config/pathoptions.cxx index b6e5006ce39c..f54b388d50a3 100644 --- a/unotools/source/config/pathoptions.cxx +++ b/unotools/source/config/pathoptions.cxx @@ -151,6 +151,8 @@ class SvtPathOptions_Impl static std::weak_ptr<SvtPathOptions_Impl> g_pOptions; +namespace { + // functions ------------------------------------------------------------- struct PropertyStruct { @@ -163,6 +165,8 @@ struct VarNameAttribute const char* pVarName; // The name of the path variable }; +} + static const PropertyStruct aPropNames[] = { { "Addin", SvtPathOptions::PATH_ADDIN }, diff --git a/unotools/source/config/saveopt.cxx b/unotools/source/config/saveopt.cxx index 6c8922edf706..82f63887932d 100644 --- a/unotools/source/config/saveopt.cxx +++ b/unotools/source/config/saveopt.cxx @@ -35,9 +35,13 @@ using namespace utl; using namespace com::sun::star::uno; +namespace { + class SvtSaveOptions_Impl; class SvtLoadOptions_Impl; +} + #define CFG_READONLY_DEFAULT false struct SvtLoadSaveOptions_Impl @@ -49,6 +53,8 @@ struct SvtLoadSaveOptions_Impl static std::unique_ptr<SvtLoadSaveOptions_Impl> pOptions; static sal_Int32 nRefCount = 0; +namespace { + class SvtSaveOptions_Impl : public utl::ConfigItem { sal_Int32 nAutoSaveTime; @@ -128,6 +134,8 @@ public: bool IsReadOnly( SvtSaveOptions::EOption eOption ) const; }; +} + void SvtSaveOptions_Impl::SetAutoSaveTime( sal_Int32 n ) { if (!bROAutoSaveTime && nAutoSaveTime!=n) @@ -686,6 +694,8 @@ void SvtSaveOptions_Impl::Notify( const Sequence<OUString>& ) { } +namespace { + class SvtLoadOptions_Impl : public utl::ConfigItem { private: @@ -702,6 +712,8 @@ public: bool IsLoadUserSettings() const {return bLoadUserDefinedSettings;} }; +} + const sal_Char cUserDefinedSettings[] = "UserDefinedSettings"; SvtLoadOptions_Impl::SvtLoadOptions_Impl() diff --git a/unotools/source/misc/closeveto.cxx b/unotools/source/misc/closeveto.cxx index d47ecb500f86..92ef895bf931 100644 --- a/unotools/source/misc/closeveto.cxx +++ b/unotools/source/misc/closeveto.cxx @@ -43,6 +43,9 @@ namespace utl typedef ::cppu::WeakImplHelper < XCloseListener > CloseListener_Base; + + namespace { + class CloseListener_Impl : public CloseListener_Base { public: @@ -69,6 +72,8 @@ namespace utl bool m_bHasOwnership; }; + } + void SAL_CALL CloseListener_Impl::queryClosing( const EventObject&, sal_Bool i_deliverOwnership ) { if ( !m_bHasOwnership ) diff --git a/unotools/source/misc/fontcvt.cxx b/unotools/source/misc/fontcvt.cxx index d9d80ce2e2de..6a04e7d612a9 100644 --- a/unotools/source/misc/fontcvt.cxx +++ b/unotools/source/misc/fontcvt.cxx @@ -1027,6 +1027,8 @@ const char * const aSymbolNames[] = "Wingdings 3", "MT Extra", "Times New Roman" }; +namespace { + struct SymbolEntry { sal_uInt8 cIndex; @@ -1044,6 +1046,8 @@ public: struct ExtraTable { sal_Unicode cStar; sal_uInt8 cMS;}; +} + ExtraTable const aWingDingsExtraTab[] = { {0x25cf, 0x6C}, {0x2714, 0xFC}, {0x2717, 0xFB}, {0x2794, 0xE8}, @@ -1304,8 +1308,12 @@ void ConvertChar::RecodeString( OUString& rStr, sal_Int32 nIndex, sal_Int32 nLen rStr = aTmpStr.makeStringAndClear(); } +namespace { + struct RecodeTable { const char* pOrgName; ConvertChar aCvt;}; +} + static const RecodeTable aStarSymbolRecodeTable[] = { // the first two entries must be StarMath and StarBats; do not reorder! diff --git a/unotools/source/misc/fontdefs.cxx b/unotools/source/misc/fontdefs.cxx index c8c05c94fe59..3e0b78a37f39 100644 --- a/unotools/source/misc/fontdefs.cxx +++ b/unotools/source/misc/fontdefs.cxx @@ -22,12 +22,16 @@ #include <rtl/ustrbuf.hxx> #include <unordered_map> +namespace { + struct ImplLocalizedFontName { const char* mpEnglishName; const sal_Unicode* mpLocalizedNames; }; +} + // TODO: where did the 0,0 delimiters come from? A single 0 should suffice... static sal_Unicode const aBatang[] = { 0xBC14, 0xD0D5, 0, 0 }; static sal_Unicode const aBatangChe[] = { 0xBC14, 0xD0D5, 0xCCB4, 0, 0 }; diff --git a/unotools/source/ucbhelper/tempfile.cxx b/unotools/source/ucbhelper/tempfile.cxx index bce71120f4f9..b168957055ce 100644 --- a/unotools/source/ucbhelper/tempfile.cxx +++ b/unotools/source/ucbhelper/tempfile.cxx @@ -163,6 +163,8 @@ static OUString ConstructTempDir_Impl( const OUString* pParent ) return aName; } +namespace { + class Tokens { public: virtual bool next(OUString *) = 0; @@ -226,6 +228,8 @@ private: sal_uInt32 m_count; }; +} + sal_uInt32 UniqueTokens::globalValue = SAL_MAX_UINT32; namespace diff --git a/unotools/source/ucbhelper/ucblockbytes.cxx b/unotools/source/ucbhelper/ucblockbytes.cxx index 0aa836bfd7fb..b410352bfe93 100644 --- a/unotools/source/ucbhelper/ucblockbytes.cxx +++ b/unotools/source/ucbhelper/ucblockbytes.cxx @@ -68,6 +68,8 @@ using namespace ::com::sun::star::beans; namespace utl { +namespace { + /** Helper class for getting a XInputStream when opening a content */ @@ -159,6 +161,8 @@ public: virtual void SAL_CALL propertiesChange ( const Sequence<PropertyChangeEvent> &rEvent) override; }; +} + void SAL_CALL UcbPropertiesChangeListener_Impl::propertiesChange ( const Sequence<PropertyChangeEvent> &rEvent) { for (const auto& rPropChangeEvent : rEvent) @@ -170,6 +174,8 @@ void SAL_CALL UcbPropertiesChangeListener_Impl::propertiesChange ( const Sequenc } } +namespace { + class Moderator : public osl::Thread { @@ -337,6 +343,8 @@ private: Reference<XInputStream> m_xStream; }; +} + ModeratorsActiveDataSink::ModeratorsActiveDataSink(Moderator &theModerator) : m_aModerator(theModerator) { @@ -371,6 +379,8 @@ ModeratorsActiveDataStreamer::setStream ( m_xStream = rxStream; } +namespace { + class ModeratorsInteractionHandler : public ::cppu::WeakImplHelper<XInteractionHandler> { @@ -386,6 +396,8 @@ private: Moderator& m_aModerator; }; +} + ModeratorsInteractionHandler::ModeratorsInteractionHandler( Moderator &aModerator) : m_aModerator(aModerator) diff --git a/unoxml/source/dom/document.cxx b/unoxml/source/dom/document.cxx index e84ff5bdc8d3..51277a5ad5aa 100644 --- a/unoxml/source/dom/document.cxx +++ b/unoxml/source/dom/document.cxx @@ -324,12 +324,16 @@ namespace DOM m_streamListeners.erase(aListener); } + namespace { + // IO context functions for libxml2 interaction typedef struct { Reference< XOutputStream > stream; bool const allowClose; } IOContext; + } + extern "C" { // write callback // int xmlOutputWriteCallback (void * context, const char * buffer, int len) diff --git a/unoxml/source/dom/documentbuilder.cxx b/unoxml/source/dom/documentbuilder.cxx index 5a03cf0bcf2d..bb2b7293fb45 100644 --- a/unoxml/source/dom/documentbuilder.cxx +++ b/unoxml/source/dom/documentbuilder.cxx @@ -61,6 +61,7 @@ using css::xml::sax::InputSource; namespace DOM { + namespace { class CDefaultEntityResolver : public cppu::WeakImplHelper< XEntityResolver > { @@ -88,6 +89,8 @@ namespace DOM }; + } + CDocumentBuilder::CDocumentBuilder() : m_xEntityResolver(new CDefaultEntityResolver) { @@ -169,6 +172,8 @@ namespace DOM // -- c-linkage, so the callbacks can be used by libxml extern "C" { + namespace { + // context struct passed to IO functions typedef struct context { Reference< XInputStream > rInputStream; @@ -176,6 +181,8 @@ namespace DOM bool freeOnClose; } context_t; + } + static int xmlIO_read_func( void *context, char *buffer, int len) { // get the context... diff --git a/uui/source/fltdlg.cxx b/uui/source/fltdlg.cxx index 124471716771..989a915301b3 100644 --- a/uui/source/fltdlg.cxx +++ b/uui/source/fltdlg.cxx @@ -142,6 +142,8 @@ bool FilterDialog::AskForFilter( FilterNameListPtr& pSelectedItem ) return bSelected; } +namespace { + /*-************************************************************************************************************ @short helper class to calculate length of given string @descr Instances of it can be used as callback for INetURLObject::getAbbreviated() method to build @@ -168,6 +170,8 @@ class StringCalculator : public ::cppu::WeakImplHelper< css::util::XStringWidth weld::Widget* const m_pDevice; }; +} + /*-************************************************************************************************************ @short try to build short name of given URL to show it n GUI @descr We detect type of given URL automatically and build this short name depend on this type ... diff --git a/vbahelper/source/msforms/vbacontrol.cxx b/vbahelper/source/msforms/vbacontrol.cxx index aa386fdae3e7..1e877c66d063 100644 --- a/vbahelper/source/msforms/vbacontrol.cxx +++ b/vbahelper/source/msforms/vbacontrol.cxx @@ -97,6 +97,8 @@ ScVbaControl::getWindowPeer() return xWinPeer; } +namespace { + //ScVbaControlListener class ScVbaControlListener: public cppu::WeakImplHelper< lang::XEventListener > { @@ -108,6 +110,8 @@ public: virtual void SAL_CALL disposing( const lang::EventObject& rEventObject ) override; }; +} + ScVbaControlListener::ScVbaControlListener( ScVbaControl *pTmpControl ): pControl( pTmpControl ) { } @@ -430,6 +434,7 @@ void SAL_CALL ScVbaControl::setTag( const OUString& aTag ) return OORGBToXLRGB( nForeColor ); } +namespace { struct PointerStyles { @@ -437,6 +442,8 @@ struct PointerStyles PointerStyle const loPointStyle; }; +} + // 1 -> 1 map of styles ( some dubious choices in there though ) PointerStyles const styles[] = { /// assuming pointer default is Arrow @@ -759,6 +766,8 @@ void ScVbaControl::setLocked( bool bLocked ) m_xProps->setPropertyValue( "ReadOnly" , uno::makeAny( bLocked ) ); } +namespace { + class ControlProviderImpl : public cppu::WeakImplHelper< XControlProvider > { uno::Reference< uno::XComponentContext > m_xCtx; @@ -767,6 +776,8 @@ public: virtual uno::Reference< msforms::XControl > SAL_CALL createControl( const uno::Reference< drawing::XControlShape >& xControl, const uno::Reference< frame::XModel >& xDocOwner ) override; }; +} + uno::Reference< msforms::XControl > SAL_CALL ControlProviderImpl::createControl( const uno::Reference< drawing::XControlShape >& xControlShape, const uno::Reference< frame::XModel >& xDocOwner ) { diff --git a/vbahelper/source/msforms/vbacontrols.cxx b/vbahelper/source/msforms/vbacontrols.cxx index 01abc34f67dd..c3cf49b86f0d 100644 --- a/vbahelper/source/msforms/vbacontrols.cxx +++ b/vbahelper/source/msforms/vbacontrols.cxx @@ -42,6 +42,8 @@ using namespace ooo::vba; typedef std::unordered_map< OUString, sal_Int32 > ControlIndexMap; +namespace { + class ControlArrayWrapper : public ::cppu::WeakImplHelper< container::XNameAccess, container::XIndexAccess > { uno::Reference< awt::XControlContainer > mxDialog; @@ -190,6 +192,7 @@ public: }; +} static uno::Reference<container::XIndexAccess > lcl_controlsWrapper( const uno::Reference< awt::XControl >& xDlg ) diff --git a/vbahelper/source/msforms/vbalistcontrolhelper.cxx b/vbahelper/source/msforms/vbalistcontrolhelper.cxx index dfbbb19a3bde..b1601f99ec43 100644 --- a/vbahelper/source/msforms/vbalistcontrolhelper.cxx +++ b/vbahelper/source/msforms/vbalistcontrolhelper.cxx @@ -26,6 +26,8 @@ using namespace com::sun::star; using namespace ooo::vba; +namespace { + class ListPropListener : public PropListener { private: @@ -40,6 +42,8 @@ public: virtual css::uno::Any getValueEvent() override; }; +} + ListPropListener::ListPropListener( const uno::Reference< beans::XPropertySet >& xProps, const uno::Any& pvargIndex, const uno::Any& pvarColumn ) : m_xProps( xProps ), m_pvargIndex( pvargIndex ), m_pvarColumn( pvarColumn ) { } diff --git a/vbahelper/source/msforms/vbamultipage.cxx b/vbahelper/source/msforms/vbamultipage.cxx index 18c74ffdff30..58ca2182cda6 100644 --- a/vbahelper/source/msforms/vbamultipage.cxx +++ b/vbahelper/source/msforms/vbamultipage.cxx @@ -27,6 +27,8 @@ using namespace ooo::vba; const OUString SVALUE( "MultiPageValue" ); +namespace { + class PagesImpl : public cppu::WeakImplHelper< container::XIndexAccess > { sal_Int32 const mnPages; @@ -52,6 +54,8 @@ public: } }; +} + ScVbaMultiPage::ScVbaMultiPage( const uno::Reference< ov::XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, diff --git a/vbahelper/source/vbahelper/vbaapplicationbase.cxx b/vbahelper/source/vbahelper/vbaapplicationbase.cxx index 94c3419f6e2a..bf7ac741563c 100644 --- a/vbahelper/source/vbahelper/vbaapplicationbase.cxx +++ b/vbahelper/source/vbahelper/vbaapplicationbase.cxx @@ -60,6 +60,8 @@ using namespace ::ooo::vba; typedef ::std::pair< OUString, ::std::pair< double, double > > VbaTimerInfo; +namespace { + class VbaTimer { Timer m_aTimer; @@ -115,6 +117,8 @@ public: DECL_LINK( MacroCallHdl, Timer*, void ); }; +} + IMPL_LINK_NOARG(VbaTimer, MacroCallHdl, Timer *, void) { if ( m_aTimerInfo.second.second == 0 || GetNow() < m_aTimerInfo.second.second ) @@ -136,6 +140,8 @@ IMPL_LINK_NOARG(VbaTimer, MacroCallHdl, Timer *, void) {} } +namespace { + struct VbaTimerInfoHash { size_t operator()( const VbaTimerInfo& rTimerInfo ) const @@ -148,6 +154,8 @@ struct VbaTimerInfoHash } }; +} + typedef std::unordered_map< VbaTimerInfo, std::unique_ptr<VbaTimer>, VbaTimerInfoHash > VbaTimerHashMap; struct VbaApplicationBase_Impl final diff --git a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx index f789a487f6b2..cb83e51c8204 100644 --- a/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx +++ b/vbahelper/source/vbahelper/vbacommandbarcontrols.cxx @@ -23,6 +23,8 @@ using namespace com::sun::star; using namespace ooo::vba; +namespace { + class CommandBarControlEnumeration : public ::cppu::WeakImplHelper< container::XEnumeration > { //uno::Reference< uno::XComponentContext > m_xContext; @@ -45,6 +47,8 @@ public: } }; +} + ScVbaCommandBarControls::ScVbaCommandBarControls( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess>& xIndexAccess, VbaCommandBarHelperRef const & pHelper, const uno::Reference< container::XIndexAccess>& xBarSettings, const OUString& sResourceUrl ) : CommandBarControls_BASE( xParent, xContext, xIndexAccess ), pCBarHelper( pHelper ), m_xBarSettings( xBarSettings ), m_sResourceUrl( sResourceUrl ) { m_bIsMenu = sResourceUrl == ITEM_MENUBAR_URL; @@ -243,6 +247,7 @@ ScVbaCommandBarControls::getServiceNames() return aServiceNames; } +namespace { class VbaDummyIndexAccess : public ::cppu::WeakImplHelper< container::XIndexAccess > { @@ -260,6 +265,7 @@ public: { return false; } }; +} VbaDummyCommandBarControls::VbaDummyCommandBarControls( const uno::Reference< XHelperInterface >& xParent, diff --git a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx index aa18d1b0dc49..f2926139aea9 100644 --- a/vbahelper/source/vbahelper/vbacommandbarhelper.cxx +++ b/vbahelper/source/vbahelper/vbacommandbarhelper.cxx @@ -41,6 +41,8 @@ using namespace ooo::vba; typedef std::map< OUString, OUString > MSO2OOCommandbarMap; +namespace { + class MSO2OOCommandbarHelper final { private: @@ -83,6 +85,8 @@ public: } }; +} + MSO2OOCommandbarHelper* MSO2OOCommandbarHelper::pMSO2OOCommandbarHelper = nullptr; diff --git a/vbahelper/source/vbahelper/vbacommandbars.cxx b/vbahelper/source/vbahelper/vbacommandbars.cxx index be173f49b2a7..332249049b84 100644 --- a/vbahelper/source/vbahelper/vbacommandbars.cxx +++ b/vbahelper/source/vbahelper/vbacommandbars.cxx @@ -31,6 +31,7 @@ using namespace com::sun::star; using namespace ooo::vba; +namespace { class CommandBarEnumeration : public ::cppu::WeakImplHelper< container::XEnumeration > { @@ -71,6 +72,8 @@ public: } }; +} + ScVbaCommandBars::ScVbaCommandBars( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xIndexAccess, const uno::Reference< frame::XModel >& xModel ) : CommandBars_BASE( xParent, xContext, xIndexAccess ) { m_pCBarHelper.reset( new VbaCommandBarHelper( mxContext, xModel ) ); diff --git a/vbahelper/source/vbahelper/vbadocumentsbase.cxx b/vbahelper/source/vbahelper/vbadocumentsbase.cxx index 1ba2bb1a0b0f..d0951b0c13e7 100644 --- a/vbahelper/source/vbahelper/vbadocumentsbase.cxx +++ b/vbahelper/source/vbahelper/vbadocumentsbase.cxx @@ -56,6 +56,8 @@ typedef std::vector < uno::Reference< frame::XModel > > Documents; // #FIXME clearly this is a candidate for some sort of helper base class as // this is a copy of SelectedSheetsEnum ( vbawindow.cxx ) +namespace { + class DocumentsEnumImpl : public ::cppu::WeakImplHelper< container::XEnumeration > { uno::Reference< uno::XComponentContext > m_xContext; @@ -97,6 +99,8 @@ public: } }; +} + // #FIXME clearly this is also a candidate for some sort of helper base class as // a very similar one is used in vbawindow ( SelectedSheetsEnumAccess ) // Maybe a template base class that does all of the operations on the hashmap @@ -108,6 +112,8 @@ typedef ::cppu::WeakImplHelper< container::XEnumerationAccess , css::container::XNameAccess > DocumentsAccessImpl_BASE; +namespace { + class DocumentsAccessImpl : public DocumentsAccessImpl_BASE { uno::Reference< uno::XComponentContext > m_xContext; @@ -187,6 +193,8 @@ public: }; +} + VbaDocumentsBase::VbaDocumentsBase( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< css::uno::XComponentContext >& xContext, DOCUMENT_TYPE eDocType ) : VbaDocumentsBase_BASE( xParent, xContext, uno::Reference< container::XIndexAccess >( new DocumentsAccessImpl( xContext, eDocType ) ) ), meDocType( eDocType ) { } diff --git a/vbahelper/source/vbahelper/vbashaperange.cxx b/vbahelper/source/vbahelper/vbashaperange.cxx index b21c24165cf7..6f353e5e14d1 100644 --- a/vbahelper/source/vbahelper/vbashaperange.cxx +++ b/vbahelper/source/vbahelper/vbashaperange.cxx @@ -29,6 +29,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class VbShapeRangeEnumHelper : public EnumerationHelper_BASE { uno::Reference< XCollection > m_xParent; @@ -50,6 +52,8 @@ public: }; +} + ScVbaShapeRange::ScVbaShapeRange( const uno::Reference< XHelperInterface >& xParent, const uno::Reference< uno::XComponentContext >& xContext, const uno::Reference< container::XIndexAccess >& xShapes, const uno::Reference< drawing::XDrawPage >& xDrawPage, const uno::Reference< frame::XModel >& xModel ) : ScVbaShapeRange_BASE( xParent, xContext, xShapes ), m_xDrawPage( xDrawPage ), m_xModel( xModel ) { } diff --git a/vbahelper/source/vbahelper/vbashapes.cxx b/vbahelper/source/vbahelper/vbashapes.cxx index 7c9ca3f22cd9..f9356efedd9d 100644 --- a/vbahelper/source/vbahelper/vbashapes.cxx +++ b/vbahelper/source/vbahelper/vbashapes.cxx @@ -51,6 +51,8 @@ using namespace ::ooo::vba; using namespace ::com::sun::star; +namespace { + class VbShapeEnumHelper : public EnumerationHelper_BASE { uno::Reference<msforms::XShapes > m_xParent; @@ -72,6 +74,8 @@ public: }; +} + void ScVbaShapes::initBaseCollection() { if ( m_xNameAccess.is() ) // already has NameAccess 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 diff --git a/writerfilter/source/dmapper/DomainMapper_Impl.cxx b/writerfilter/source/dmapper/DomainMapper_Impl.cxx index db838493e60e..dedf2214a453 100644 --- a/writerfilter/source/dmapper/DomainMapper_Impl.cxx +++ b/writerfilter/source/dmapper/DomainMapper_Impl.cxx @@ -166,12 +166,16 @@ static void lcl_handleTextField( const uno::Reference< beans::XPropertySet >& rx } } +namespace { + struct FieldConversion { const sal_Char* cFieldServiceName; FieldId const eFieldId; }; +} + typedef std::unordered_map<OUString, FieldConversion> FieldConversionMap_t; /// Gives access to the parent field context of the topmost one, if there is any. diff --git a/writerfilter/source/dmapper/GraphicImport.cxx b/writerfilter/source/dmapper/GraphicImport.cxx index 0d673cdc19bd..7dd903b7784f 100644 --- a/writerfilter/source/dmapper/GraphicImport.cxx +++ b/writerfilter/source/dmapper/GraphicImport.cxx @@ -89,6 +89,8 @@ namespace writerfilter { namespace dmapper { +namespace { + class XInputStreamHelper : public cppu::WeakImplHelper<io::XInputStream> { const sal_uInt8* m_pBuffer; @@ -104,6 +106,8 @@ public: virtual void SAL_CALL closeInput( ) override; }; +} + XInputStreamHelper::XInputStreamHelper(const sal_uInt8* buf, size_t len) : m_pBuffer( buf ), m_nLength( len ), @@ -155,6 +159,7 @@ void XInputStreamHelper::closeInput( ) { } +namespace { struct GraphicBorderLine { @@ -173,6 +178,8 @@ struct GraphicBorderLine }; +} + class GraphicImport_Impl { private: diff --git a/writerfilter/source/dmapper/PropertyMap.cxx b/writerfilter/source/dmapper/PropertyMap.cxx index 188b95634d62..226ac355ead5 100644 --- a/writerfilter/source/dmapper/PropertyMap.cxx +++ b/writerfilter/source/dmapper/PropertyMap.cxx @@ -1694,6 +1694,8 @@ void SectionPropertyMap::ClearHeaderFooterLinkToPrevious( bool bHeader, PageType } } +namespace { + class NamedPropertyValue { private: @@ -1711,6 +1713,8 @@ public: } }; +} + void SectionPropertyMap::ApplyProperties_( const uno::Reference< beans::XPropertySet >& xStyle ) { uno::Reference< beans::XMultiPropertySet > const xMultiSet( xStyle, uno::UNO_QUERY ); diff --git a/writerfilter/source/dmapper/SettingsTable.cxx b/writerfilter/source/dmapper/SettingsTable.cxx index 05f655675e66..271386db704c 100644 --- a/writerfilter/source/dmapper/SettingsTable.cxx +++ b/writerfilter/source/dmapper/SettingsTable.cxx @@ -58,6 +58,8 @@ sal_Int16 lcl_GetZoomType(Id nType) namespace dmapper { + namespace { + /** Document protection restrictions * * This element specifies the set of document protection restrictions which have been applied to the contents of a @@ -115,6 +117,8 @@ namespace dmapper bool isNone() const { return m_nEdit == NS_ooxml::LN_Value_doc_ST_DocProtect_none; }; }; + } + css::uno::Sequence<css::beans::PropertyValue> DocumentProtection_Impl::toSequence() const { std::vector<beans::PropertyValue> documentProtection; diff --git a/writerfilter/source/dmapper/StyleSheetTable.cxx b/writerfilter/source/dmapper/StyleSheetTable.cxx index ded569a09418..4c05506a9151 100644 --- a/writerfilter/source/dmapper/StyleSheetTable.cxx +++ b/writerfilter/source/dmapper/StyleSheetTable.cxx @@ -251,6 +251,7 @@ PropertyMapPtr TableStyleSheetEntry::GetLocalPropertiesFromMask( sal_Int32 nMask return pProps; } +namespace { struct ListCharStylePropertyMap_t { @@ -262,6 +263,9 @@ struct ListCharStylePropertyMap_t aPropertyValues( rPropertyValues ) {} }; + +} + typedef std::vector< ListCharStylePropertyMap_t > ListCharStylePropertyVector_t; @@ -840,6 +844,8 @@ void StyleSheetTable::lcl_entry(writerfilter::Reference<Properties>::Pointer_t r /*------------------------------------------------------------------------- sorting helper -----------------------------------------------------------------------*/ +namespace { + class PropValVector { std::vector<beans::PropertyValue> m_aValues; @@ -852,6 +858,8 @@ public: const std::vector<beans::PropertyValue>& getProperties() const { return m_aValues; }; }; +} + void PropValVector::Insert(const beans::PropertyValue& rVal) { auto aIt = std::find_if(m_aValues.begin(), m_aValues.end(), diff --git a/writerfilter/source/dmapper/TagLogger.cxx b/writerfilter/source/dmapper/TagLogger.cxx index 943fc34eae58..3f2c730ff266 100644 --- a/writerfilter/source/dmapper/TagLogger.cxx +++ b/writerfilter/source/dmapper/TagLogger.cxx @@ -94,10 +94,14 @@ namespace writerfilter #endif +namespace { + struct TheTagLogger: public rtl::Static<TagLogger, TheTagLogger> {}; +} + TagLogger& TagLogger::getInstance() { return TheTagLogger::get(); diff --git a/writerfilter/source/filter/RtfFilter.cxx b/writerfilter/source/filter/RtfFilter.cxx index 3cb4b3579d65..1f6260b1c1e6 100644 --- a/writerfilter/source/filter/RtfFilter.cxx +++ b/writerfilter/source/filter/RtfFilter.cxx @@ -41,6 +41,8 @@ using namespace ::com::sun::star; +namespace { + /// Invokes the RTF tokenizer + dmapper or RtfExportFilter in sw via UNO. class RtfFilter : public cppu::WeakImplHelper < @@ -77,6 +79,8 @@ public: }; +} + RtfFilter::RtfFilter(uno::Reference<uno::XComponentContext> xContext) : m_xContext(std::move(xContext)) { diff --git a/writerfilter/source/filter/WriterFilter.cxx b/writerfilter/source/filter/WriterFilter.cxx index 266367b4ac2b..a89c6874427a 100644 --- a/writerfilter/source/filter/WriterFilter.cxx +++ b/writerfilter/source/filter/WriterFilter.cxx @@ -83,6 +83,8 @@ static OUString lcl_GetExceptionMessageRec(xml::sax::SAXException const& e) return OUString(); } +namespace { + /// Common DOCX filter, calls DocxExportFilter via UNO or does the DOCX import. class WriterFilter : public cppu::WeakImplHelper < @@ -121,6 +123,8 @@ public: uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; }; +} + sal_Bool WriterFilter::filter(const uno::Sequence< beans::PropertyValue >& rDescriptor) { if (m_xSrcDoc.is()) diff --git a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx index 0ed1903172e1..b2f00e437e3a 100644 --- a/writerperfect/source/calc/MSWorksCalcImportFilter.cxx +++ b/writerperfect/source/calc/MSWorksCalcImportFilter.cxx @@ -58,6 +58,8 @@ catch (...) return uno::Reference<sdbc::XResultSet>(); } +namespace +{ /** internal class used to create a structured RVNGInputStream from a list of path and their short names */ class FolderStream : public librevenge::RVNGInputStream @@ -170,6 +172,7 @@ private: FolderStream& operator=(const FolderStream&) = delete; }; } +} //////////////////////////////////////////////////////////// bool MSWorksCalcImportFilter::doImportDocument(weld::Window* pParent, diff --git a/writerperfect/source/writer/exp/XMLFootnoteImportContext.cxx b/writerperfect/source/writer/exp/XMLFootnoteImportContext.cxx index 15753306a97d..d11ad62e7357 100644 --- a/writerperfect/source/writer/exp/XMLFootnoteImportContext.cxx +++ b/writerperfect/source/writer/exp/XMLFootnoteImportContext.cxx @@ -20,6 +20,8 @@ namespace writerperfect { namespace exp { +namespace +{ /// Handler for <text:note-citation>. class XMLTextNoteCitationContext : public XMLImportContext { @@ -33,6 +35,7 @@ private: librevenge::RVNGPropertyList& m_rProperties; OUString m_aCharacters; }; +} XMLTextNoteCitationContext::XMLTextNoteCitationContext(XMLImport& rImport, librevenge::RVNGPropertyList& rProperties) @@ -51,6 +54,8 @@ void XMLTextNoteCitationContext::characters(const OUString& rCharacters) m_aCharacters += rCharacters; } +namespace +{ /// Handler for <text:note-body>. class XMLFootnoteBodyImportContext : public XMLImportContext { @@ -70,6 +75,7 @@ public: private: const librevenge::RVNGPropertyList& m_rProperties; }; +} XMLFootnoteBodyImportContext::XMLFootnoteBodyImportContext( XMLImport& rImport, const librevenge::RVNGPropertyList& rProperties) diff --git a/writerperfect/source/writer/exp/XMLTextFrameContext.cxx b/writerperfect/source/writer/exp/XMLTextFrameContext.cxx index dc62f8bf85ce..23a60970bc1a 100644 --- a/writerperfect/source/writer/exp/XMLTextFrameContext.cxx +++ b/writerperfect/source/writer/exp/XMLTextFrameContext.cxx @@ -22,6 +22,8 @@ namespace writerperfect { namespace exp { +namespace +{ /// Handler for <draw:text-box>. class XMLTextBoxContext : public XMLImportContext { @@ -37,6 +39,7 @@ public: const css::uno::Reference<css::xml::sax::XAttributeList>& xAttribs) override; void SAL_CALL endElement(const OUString& rName) override; }; +} XMLTextBoxContext::XMLTextBoxContext(XMLImport& rImport) : XMLImportContext(rImport) @@ -61,6 +64,8 @@ void XMLTextBoxContext::endElement(const OUString& /*rName*/) GetImport().GetGenerator().closeTextBox(); } +namespace +{ /// Handler for <draw:image>. class XMLTextImageContext : public XMLImportContext { @@ -80,6 +85,7 @@ private: OString m_aMimeType; rtl::Reference<XMLBase64ImportContext> m_xBinaryData; }; +} XMLTextImageContext::XMLTextImageContext(XMLImport& rImport) : XMLImportContext(rImport) diff --git a/writerperfect/source/writer/exp/txtparai.cxx b/writerperfect/source/writer/exp/txtparai.cxx index a129db80763d..e3ba3bde1f26 100644 --- a/writerperfect/source/writer/exp/txtparai.cxx +++ b/writerperfect/source/writer/exp/txtparai.cxx @@ -54,6 +54,8 @@ namespace writerperfect { namespace exp { +namespace +{ /// Handler for <text:sequence>. class XMLTextSequenceContext : public XMLImportContext { @@ -65,6 +67,7 @@ public: private: librevenge::RVNGPropertyList m_aPropertyList; }; +} XMLTextSequenceContext::XMLTextSequenceContext(XMLImport& rImport, const librevenge::RVNGPropertyList& rPropertyList) @@ -86,6 +89,8 @@ void XMLTextSequenceContext::characters(const OUString& rChars) GetImport().GetGenerator().closeSpan(); } +namespace +{ /// Handler for <text:span>. class XMLSpanContext : public XMLImportContext { @@ -104,6 +109,7 @@ public: private: librevenge::RVNGPropertyList m_aPropertyList; }; +} XMLSpanContext::XMLSpanContext(XMLImport& rImport, const librevenge::RVNGPropertyList& rPropertyList) @@ -150,6 +156,8 @@ void XMLSpanContext::characters(const OUString& rChars) GetImport().GetGenerator().closeSpan(); } +namespace +{ /// Handler for <text:ruby>. class XMLRubyContext : public XMLImportContext { @@ -203,6 +211,7 @@ public: private: XMLRubyContext& m_rParent; }; +} XMLRubyContext::XMLRubyContext(XMLImport& rImport, const librevenge::RVNGPropertyList& rPropertyList) @@ -235,6 +244,8 @@ void XMLRubyContext::endElement(const OUString& /*rName*/) GetImport().GetGenerator().closeSpan(); } +namespace +{ /// Base class for contexts that represent a single character only. class XMLCharContext : public XMLImportContext { @@ -246,6 +257,7 @@ public: private: librevenge::RVNGPropertyList m_aPropertyList; }; +} XMLCharContext::XMLCharContext(XMLImport& rImport, const librevenge::RVNGPropertyList& rPropertyList) @@ -257,6 +269,8 @@ XMLCharContext::XMLCharContext(XMLImport& rImport, m_aPropertyList.insert(itProp.key(), itProp()->clone()); } +namespace +{ /// Handler for <text:line-break>. class XMLLineBreakContext : public XMLCharContext { @@ -267,6 +281,7 @@ public: startElement(const OUString& rName, const css::uno::Reference<css::xml::sax::XAttributeList>& xAttribs) override; }; +} XMLLineBreakContext::XMLLineBreakContext(XMLImport& rImport, const librevenge::RVNGPropertyList& rPropertyList) @@ -283,6 +298,8 @@ void XMLLineBreakContext::startElement( GetImport().GetGenerator().closeSpan(); } +namespace +{ /// Handler for <text:s>. class XMLSpaceContext : public XMLCharContext { @@ -293,6 +310,7 @@ public: startElement(const OUString& rName, const css::uno::Reference<css::xml::sax::XAttributeList>& xAttribs) override; }; +} XMLSpaceContext::XMLSpaceContext(XMLImport& rImport, const librevenge::RVNGPropertyList& rPropertyList) @@ -309,6 +327,8 @@ void XMLSpaceContext::startElement( GetImport().GetGenerator().closeSpan(); } +namespace +{ /// Handler for <text:tab>. class XMLTabContext : public XMLCharContext { @@ -319,6 +339,7 @@ public: startElement(const OUString& rName, const css::uno::Reference<css::xml::sax::XAttributeList>& xAttribs) override; }; +} XMLTabContext::XMLTabContext(XMLImport& rImport, const librevenge::RVNGPropertyList& rPropertyList) : XMLCharContext(rImport, rPropertyList) @@ -334,6 +355,8 @@ void XMLTabContext::startElement( GetImport().GetGenerator().closeSpan(); } +namespace +{ /// Handler for <draw:a>. class XMLTextFrameHyperlinkContext : public XMLImportContext { @@ -354,6 +377,7 @@ private: librevenge::RVNGPropertyList m_aPropertyList; PopupState m_ePopupState = PopupState::NONE; }; +} XMLTextFrameHyperlinkContext::XMLTextFrameHyperlinkContext( XMLImport& rImport, const librevenge::RVNGPropertyList& rPropertyList) @@ -419,6 +443,8 @@ void XMLTextFrameHyperlinkContext::characters(const OUString& rChars) GetImport().GetGenerator().closeSpan(); } +namespace +{ /// Handler for <text:a>. class XMLHyperlinkContext : public XMLImportContext { @@ -438,6 +464,7 @@ private: librevenge::RVNGPropertyList m_aPropertyList; PopupState m_ePopupState = PopupState::NONE; }; +} XMLHyperlinkContext::XMLHyperlinkContext(XMLImport& rImport, const librevenge::RVNGPropertyList& rPropertyList) diff --git a/writerperfect/source/writer/exp/txtstyli.cxx b/writerperfect/source/writer/exp/txtstyli.cxx index 02d2bb206e4b..9c7a156de984 100644 --- a/writerperfect/source/writer/exp/txtstyli.cxx +++ b/writerperfect/source/writer/exp/txtstyli.cxx @@ -17,6 +17,8 @@ namespace writerperfect { namespace exp { +namespace +{ /// Handler for <style:paragraph-properties>. class XMLParagraphPropertiesContext : public XMLImportContext { @@ -30,6 +32,7 @@ public: private: XMLStyleContext& mrStyle; }; +} XMLParagraphPropertiesContext::XMLParagraphPropertiesContext(XMLImport& rImport, XMLStyleContext& rStyle) @@ -49,6 +52,8 @@ void XMLParagraphPropertiesContext::startElement( } } +namespace +{ /// Handler for <style:text-properties>. class XMLTextPropertiesContext : public XMLImportContext { @@ -62,6 +67,7 @@ public: private: XMLStyleContext& mrStyle; }; +} XMLTextPropertiesContext::XMLTextPropertiesContext(XMLImport& rImport, XMLStyleContext& rStyle) : XMLImportContext(rImport) @@ -80,6 +86,8 @@ void XMLTextPropertiesContext::startElement( } } +namespace +{ /// Handler for <style:graphic-properties>. class XMLGraphicPropertiesContext : public XMLImportContext { @@ -93,6 +101,7 @@ public: private: XMLStyleContext& mrStyle; }; +} XMLGraphicPropertiesContext::XMLGraphicPropertiesContext(XMLImport& rImport, XMLStyleContext& rStyle) @@ -112,6 +121,8 @@ void XMLGraphicPropertiesContext::startElement( } } +namespace +{ /// Handler for <style:page-layout-properties>. class XMLPageLayoutPropertiesContext : public XMLImportContext { @@ -125,6 +136,7 @@ public: private: XMLStyleContext& mrStyle; }; +} XMLPageLayoutPropertiesContext::XMLPageLayoutPropertiesContext(XMLImport& rImport, XMLStyleContext& rStyle) @@ -148,6 +160,8 @@ void XMLPageLayoutPropertiesContext::startElement( } } +namespace +{ /// Handler for <style:table-properties>. class XMLTablePropertiesContext : public XMLImportContext { @@ -161,6 +175,7 @@ public: private: XMLStyleContext& mrStyle; }; +} XMLTablePropertiesContext::XMLTablePropertiesContext(XMLImport& rImport, XMLStyleContext& rStyle) : XMLImportContext(rImport) @@ -184,6 +199,8 @@ void XMLTablePropertiesContext::startElement( } } +namespace +{ /// Handler for <style:table-row-properties>. class XMLTableRowPropertiesContext : public XMLImportContext { @@ -197,6 +214,7 @@ public: private: XMLStyleContext& mrStyle; }; +} XMLTableRowPropertiesContext::XMLTableRowPropertiesContext(XMLImport& rImport, XMLStyleContext& rStyle) @@ -216,6 +234,8 @@ void XMLTableRowPropertiesContext::startElement( } } +namespace +{ /// Handler for <style:table-column-properties>. class XMLTableColumnPropertiesContext : public XMLImportContext { @@ -229,6 +249,7 @@ public: private: XMLStyleContext& mrStyle; }; +} XMLTableColumnPropertiesContext::XMLTableColumnPropertiesContext(XMLImport& rImport, XMLStyleContext& rStyle) @@ -248,6 +269,8 @@ void XMLTableColumnPropertiesContext::startElement( } } +namespace +{ /// Handler for <style:table-cell-properties>. class XMLTableCellPropertiesContext : public XMLImportContext { @@ -261,6 +284,7 @@ public: private: XMLStyleContext& mrStyle; }; +} XMLTableCellPropertiesContext::XMLTableCellPropertiesContext(XMLImport& rImport, XMLStyleContext& rStyle) diff --git a/writerperfect/source/writer/exp/xmlfmt.cxx b/writerperfect/source/writer/exp/xmlfmt.cxx index 20269949ebe9..eaba8085fa4e 100644 --- a/writerperfect/source/writer/exp/xmlfmt.cxx +++ b/writerperfect/source/writer/exp/xmlfmt.cxx @@ -95,6 +95,8 @@ std::map<OUString, librevenge::RVNGPropertyList>& XMLStylesContext::GetCurrentMa return m_rMasterStyles; } +namespace +{ /// Handler for <style:font-face>. class XMLFontFaceContext : public XMLImportContext { @@ -161,6 +163,7 @@ public: private: XMLFontFaceUriContext& mrFontFaceUri; }; +} XMLFontFaceFormatContext::XMLFontFaceFormatContext(XMLImport& rImport, XMLFontFaceUriContext& rFontFaceUri) diff --git a/writerperfect/source/writer/exp/xmlimp.cxx b/writerperfect/source/writer/exp/xmlimp.cxx index 1ed88dffcf73..2f95f2dde4bc 100644 --- a/writerperfect/source/writer/exp/xmlimp.cxx +++ b/writerperfect/source/writer/exp/xmlimp.cxx @@ -198,7 +198,6 @@ void FindXMPMetadata(const uno::Reference<uno::XComponentContext>& xContext, return; } } -} /// Handler for <office:body>. class XMLBodyContext : public XMLImportContext @@ -210,6 +209,7 @@ public: CreateChildContext(const OUString& rName, const uno::Reference<xml::sax::XAttributeList>& /*xAttribs*/) override; }; +} XMLBodyContext::XMLBodyContext(XMLImport& rImport) : XMLImportContext(rImport) @@ -225,6 +225,8 @@ XMLBodyContext::CreateChildContext(const OUString& rName, return nullptr; } +namespace +{ /// Handler for <office:document>. class XMLOfficeDocContext : public XMLImportContext { @@ -238,6 +240,7 @@ public: // Handles metafile for a single page. void HandleFixedLayoutPage(const FixedLayoutPage& rPage, bool bFirst); }; +} XMLOfficeDocContext::XMLOfficeDocContext(XMLImport& rImport) : XMLImportContext(rImport) diff --git a/writerperfect/source/writer/exp/xmlmetai.cxx b/writerperfect/source/writer/exp/xmlmetai.cxx index 19641d345cfb..76b8699f5e97 100644 --- a/writerperfect/source/writer/exp/xmlmetai.cxx +++ b/writerperfect/source/writer/exp/xmlmetai.cxx @@ -17,6 +17,8 @@ namespace writerperfect { namespace exp { +namespace +{ /// Handler for <dc:title>. class XMLDcTitleContext : public XMLImportContext { @@ -28,6 +30,7 @@ public: private: XMLMetaDocumentContext& mrMeta; }; +} XMLDcTitleContext::XMLDcTitleContext(XMLImport& rImport, XMLMetaDocumentContext& rMeta) : XMLImportContext(rImport) @@ -42,6 +45,8 @@ void XMLDcTitleContext::characters(const OUString& rChars) mrMeta.GetPropertyList().insert("dc:title", librevenge::RVNGString(sCharU8.getStr())); } +namespace +{ /// Handler for <dc:language>. class XMLDcLanguageContext : public XMLImportContext { @@ -53,6 +58,7 @@ public: private: XMLMetaDocumentContext& mrMeta; }; +} XMLDcLanguageContext::XMLDcLanguageContext(XMLImport& rImport, XMLMetaDocumentContext& rMeta) : XMLImportContext(rImport) @@ -67,6 +73,8 @@ void XMLDcLanguageContext::characters(const OUString& rChars) mrMeta.GetPropertyList().insert("dc:language", librevenge::RVNGString(sCharU8.getStr())); } +namespace +{ /// Handler for <dc:date>. class XMLDcDateContext : public XMLImportContext { @@ -78,6 +86,7 @@ public: private: XMLMetaDocumentContext& mrMeta; }; +} XMLDcDateContext::XMLDcDateContext(XMLImport& rImport, XMLMetaDocumentContext& rMeta) : XMLImportContext(rImport) @@ -92,6 +101,8 @@ void XMLDcDateContext::characters(const OUString& rChars) mrMeta.GetPropertyList().insert("dc:date", librevenge::RVNGString(sCharU8.getStr())); } +namespace +{ /// Handler for <meta:generator>. class XMLMetaGeneratorContext : public XMLImportContext { @@ -103,6 +114,7 @@ public: private: XMLMetaDocumentContext& mrMeta; }; +} XMLMetaGeneratorContext::XMLMetaGeneratorContext(XMLImport& rImport, XMLMetaDocumentContext& rMeta) : XMLImportContext(rImport) @@ -116,6 +128,8 @@ void XMLMetaGeneratorContext::characters(const OUString& rChars) mrMeta.GetPropertyList().insert("meta:generator", librevenge::RVNGString(sCharU8.getStr())); } +namespace +{ /// Handler for <meta:initial-creator>. class XMLMetaInitialCreatorContext : public XMLImportContext { @@ -127,6 +141,7 @@ public: private: XMLMetaDocumentContext& mrMeta; }; +} XMLMetaInitialCreatorContext::XMLMetaInitialCreatorContext(XMLImport& rImport, XMLMetaDocumentContext& rMeta) diff --git a/writerperfect/source/writer/exp/xmltbli.cxx b/writerperfect/source/writer/exp/xmltbli.cxx index 263b6c3af414..68e0b29116a4 100644 --- a/writerperfect/source/writer/exp/xmltbli.cxx +++ b/writerperfect/source/writer/exp/xmltbli.cxx @@ -21,6 +21,8 @@ namespace writerperfect { namespace exp { +namespace +{ /// Handler for <table:table-row>. class XMLTableRowContext : public XMLImportContext { @@ -60,6 +62,7 @@ public: private: XMLTableRowContext& m_rRow; }; +} XMLTableCellContext::XMLTableCellContext(XMLImport& rImport, XMLTableRowContext& rRow) : XMLImportContext(rImport) @@ -102,6 +105,8 @@ void XMLTableCellContext::endElement(const OUString& /*rName*/) GetImport().GetGenerator().closeTableCell(); } +namespace +{ /// Handler for <table:table-column>. class XMLTableColumnContext : public XMLImportContext { @@ -115,6 +120,7 @@ public: private: librevenge::RVNGPropertyListVector& m_rColumns; }; +} XMLTableColumnContext::XMLTableColumnContext(XMLImport& rImport, librevenge::RVNGPropertyListVector& rColumns) diff --git a/xmlhelp/source/cxxhelp/provider/content.cxx b/xmlhelp/source/cxxhelp/provider/content.cxx index 55fef768ffab..88ebe87bfece 100644 --- a/xmlhelp/source/cxxhelp/provider/content.cxx +++ b/xmlhelp/source/cxxhelp/provider/content.cxx @@ -125,6 +125,8 @@ void SAL_CALL Content::abort( sal_Int32 /*CommandId*/ ) { } +namespace { + class ResultSetForRootFactory : public ResultSetFactory { @@ -199,6 +201,8 @@ public: } }; +} + // virtual uno::Any SAL_CALL Content::execute( const ucb::Command& aCommand, diff --git a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx index e4d74404b7fd..4a88add7e5b2 100644 --- a/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx +++ b/xmlhelp/source/cxxhelp/provider/resultsetbase.cxx @@ -328,6 +328,7 @@ ResultSetBase::queryContent() return uno::Reference< ucb::XContent >(); } +namespace { class XPropertySetInfoImpl : public cppu::OWeakObject, @@ -385,6 +386,7 @@ private: uno::Sequence< beans::Property > m_aSeq; }; +} // XPropertySet uno::Reference< beans::XPropertySetInfo > SAL_CALL diff --git a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx index d599a217446d..05cfa7027baa 100644 --- a/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx +++ b/xmlhelp/source/cxxhelp/provider/resultsetforquery.cxx @@ -54,6 +54,8 @@ using namespace com::sun::star::i18n; using namespace com::sun::star::uno; using namespace com::sun::star::lang; +namespace { + struct HitItem { OUString m_aURL; @@ -69,6 +71,8 @@ struct HitItem } }; +} + ResultSetForQuery::ResultSetForQuery( const uno::Reference< uno::XComponentContext >& rxContext, const uno::Reference< XContentProvider >& xProvider, const uno::Sequence< beans::Property >& seq, diff --git a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx index 6893c17cc213..6dbe5bd9a09b 100644 --- a/xmlhelp/source/cxxhelp/provider/urlparameter.cxx +++ b/xmlhelp/source/cxxhelp/provider/urlparameter.cxx @@ -279,6 +279,7 @@ void URLParameter::readHelpDataFile() // Class encapsulating the transformation of the XInputStream to XHTML +namespace { class InputStreamTransformer : public OWeakObject, @@ -323,6 +324,7 @@ private: OStringBuffer buffer; }; +} void URLParameter::open( const Reference< XOutputStream >& xDataSink ) { @@ -513,6 +515,8 @@ bool URLParameter::query() return ret; } +namespace { + struct UserData { UserData( URLParameter* pInitial, @@ -526,6 +530,8 @@ struct UserData { URLParameter* m_pInitial; }; +} + static UserData *ugblData = nullptr; extern "C" { diff --git a/xmloff/source/chart/SchXMLAxisContext.cxx b/xmloff/source/chart/SchXMLAxisContext.cxx index 931983bc8c01..766f2f5e81a3 100644 --- a/xmloff/source/chart/SchXMLAxisContext.cxx +++ b/xmloff/source/chart/SchXMLAxisContext.cxx @@ -70,6 +70,8 @@ static const SvXMLEnumMapEntry<sal_uInt16> aXMLAxisTypeMap[] = { XML_TOKEN_INVALID, 0 } }; +namespace { + class SchXMLCategoriesContext : public SvXMLImportContext { private: @@ -96,6 +98,8 @@ private: Reference< beans::XPropertySet > m_xAxisProps; }; +} + SchXMLAxisContext::SchXMLAxisContext( SchXMLImportHelper& rImpHelper, SvXMLImport& rImport, const OUString& rLocalName, Reference< chart::XDiagram > const & xDiagram, diff --git a/xmloff/source/chart/SchXMLExport.cxx b/xmloff/source/chart/SchXMLExport.cxx index d94732c7e4b0..337a322fc469 100644 --- a/xmloff/source/chart/SchXMLExport.cxx +++ b/xmloff/source/chart/SchXMLExport.cxx @@ -919,8 +919,6 @@ bool lcl_exportDomainForThisSequence( const Reference< chart2::data::XDataSequen return bDomainExported; } -} // anonymous namespace - struct SchXMLDataPointStruct { OUString maStyleName; @@ -929,6 +927,8 @@ struct SchXMLDataPointStruct SchXMLDataPointStruct() : mnRepeat( 1 ) {} }; +} // anonymous namespace + // class SchXMLExportHelper SchXMLExportHelper::SchXMLExportHelper( SvXMLExport& rExport, SvXMLAutoStylePoolP& rASPool ) diff --git a/xmloff/source/chart/SchXMLSeries2Context.cxx b/xmloff/source/chart/SchXMLSeries2Context.cxx index 8b47555ccbb3..11cea543d7d7 100644 --- a/xmloff/source/chart/SchXMLSeries2Context.cxx +++ b/xmloff/source/chart/SchXMLSeries2Context.cxx @@ -497,6 +497,8 @@ void SchXMLSeries2Context::StartElement( const uno::Reference< xml::sax::XAttrib } } +namespace { + struct DomainInfo { DomainInfo( const OUString& rRole, const OUString& rRange, sal_Int32 nIndex ) @@ -508,6 +510,8 @@ struct DomainInfo sal_Int32 nIndexForLocalData; }; +} + void SchXMLSeries2Context::EndElement() { // special handling for different chart types. This is necessary as the diff --git a/xmloff/source/chart/SchXMLTableContext.cxx b/xmloff/source/chart/SchXMLTableContext.cxx index cb4a7e789793..ca52090960cc 100644 --- a/xmloff/source/chart/SchXMLTableContext.cxx +++ b/xmloff/source/chart/SchXMLTableContext.cxx @@ -559,6 +559,8 @@ SvXMLImportContextRef SchXMLTableRowContext::CreateChildContext( return pContext; } +namespace { + class SchXMLRangeSomewhereContext : public SvXMLImportContext { //#i113950# previously the range was exported to attribute text:id, @@ -583,6 +585,8 @@ public: virtual void EndElement() override; }; +} + // classes for cells and their content // class SchXMLTableCellContext SchXMLTableCellContext::SchXMLTableCellContext( diff --git a/xmloff/source/chart/SchXMLTextListContext.cxx b/xmloff/source/chart/SchXMLTextListContext.cxx index b2da8f6ad6f8..7f65edb2cd30 100644 --- a/xmloff/source/chart/SchXMLTextListContext.cxx +++ b/xmloff/source/chart/SchXMLTextListContext.cxx @@ -28,6 +28,8 @@ using ::com::sun::star::uno::Reference; using namespace com::sun::star; using namespace ::xmloff::token; +namespace { + class SchXMLListItemContext : public SvXMLImportContext { public: @@ -45,6 +47,8 @@ private: OUString& m_rText; }; +} + SchXMLListItemContext::SchXMLListItemContext( SvXMLImport& rImport , const OUString& rLocalName diff --git a/xmloff/source/chart/contexts.cxx b/xmloff/source/chart/contexts.cxx index c0cf395a0a1d..62bebf34ded9 100644 --- a/xmloff/source/chart/contexts.cxx +++ b/xmloff/source/chart/contexts.cxx @@ -31,6 +31,8 @@ using namespace com::sun::star; using namespace ::xmloff::token; +namespace { + class SchXMLBodyContext_Impl : public SvXMLImportContext { private: @@ -47,6 +49,8 @@ public: const uno::Reference< xml::sax::XAttributeList > & xAttrList ) override; }; +} + SchXMLBodyContext_Impl::SchXMLBodyContext_Impl( SchXMLImportHelper& rImpHelper, SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName ) : diff --git a/xmloff/source/core/DocumentSettingsContext.cxx b/xmloff/source/core/DocumentSettingsContext.cxx index 59c61614e6d8..6f8b9788d082 100644 --- a/xmloff/source/core/DocumentSettingsContext.cxx +++ b/xmloff/source/core/DocumentSettingsContext.cxx @@ -51,6 +51,8 @@ using namespace com::sun::star; using namespace ::xmloff::token; +namespace { + class XMLMyList { std::vector<beans::PropertyValue> aProps; @@ -67,6 +69,8 @@ public: uno::Reference<container::XIndexContainer> GetIndexContainer(); }; +} + XMLMyList::XMLMyList(const uno::Reference<uno::XComponentContext>& rxContext) : nCount(0), m_xContext(rxContext) @@ -115,6 +119,8 @@ uno::Reference<container::XIndexContainer> XMLMyList::GetIndexContainer() return xIndexContainer; } +namespace { + class XMLConfigBaseContext : public SvXMLImportContext { protected: @@ -206,6 +212,8 @@ public: virtual void EndElement() override; }; +} + static SvXMLImportContext *CreateSettingsContext(SvXMLImport& rImport, sal_uInt16 p_nPrefix, const OUString& rLocalName, const uno::Reference<xml::sax::XAttributeList>& xAttrList, diff --git a/xmloff/source/core/DomExport.cxx b/xmloff/source/core/DomExport.cxx index d437f2617c6d..1a16a155a3fc 100644 --- a/xmloff/source/core/DomExport.cxx +++ b/xmloff/source/core/DomExport.cxx @@ -46,6 +46,7 @@ using std::vector; using namespace com::sun::star::xml::dom; +namespace { class DomVisitor { @@ -57,6 +58,8 @@ public: virtual void endElement( const Reference<XElement>& ) {} }; +} + static void visit( DomVisitor&, const Reference<XDocument>& ); static void visit( DomVisitor&, const Reference<XNode>& ); @@ -115,6 +118,7 @@ void visit( DomVisitor& rVisitor, const Reference<XNode>& xNode ) rVisitor.endElement( Reference<XElement>( xNode, UNO_QUERY_THROW ) ); } +namespace { class DomExport: public DomVisitor { @@ -139,6 +143,8 @@ public: virtual void character( const Reference<XCharacterData>& ) override; }; +} + DomExport::DomExport( SvXMLExport& rExport ) : mrExport( rExport ) { diff --git a/xmloff/source/core/PropertySetMerger.cxx b/xmloff/source/core/PropertySetMerger.cxx index 7aeff6cc1b8f..812201024c86 100644 --- a/xmloff/source/core/PropertySetMerger.cxx +++ b/xmloff/source/core/PropertySetMerger.cxx @@ -28,6 +28,8 @@ using namespace ::com::sun::star::lang; #include <comphelper/sequence.hxx> #include <cppuhelper/implbase3.hxx> +namespace { + class PropertySetMergerImpl : public ::cppu::WeakAggImplHelper3< XPropertySet, XPropertyState, XPropertySetInfo > { private: @@ -63,6 +65,8 @@ public: virtual sal_Bool SAL_CALL hasPropertyByName( const OUString& Name ) override; }; +} + // Interface implementation PropertySetMergerImpl::PropertySetMergerImpl( Reference< XPropertySet > const & rPropSet1, Reference< XPropertySet > const & rPropSet2 ) diff --git a/xmloff/source/core/RDFaImportHelper.cxx b/xmloff/source/core/RDFaImportHelper.cxx index 7b408ecbbb49..7b29abf94f41 100644 --- a/xmloff/source/core/RDFaImportHelper.cxx +++ b/xmloff/source/core/RDFaImportHelper.cxx @@ -37,6 +37,8 @@ using namespace ::com::sun::star; namespace xmloff { +namespace { + /** a bit of context for parsing RDFa attributes */ class RDFaReader { @@ -102,6 +104,8 @@ public: void InsertRDFaEntry(struct RDFaEntry const & i_rEntry); }; +} + /** store parsed RDFa attributes */ struct ParsedRDFaAttributes { diff --git a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx index a690a5770f1c..57403644aea4 100644 --- a/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx +++ b/xmloff/source/core/XMLEmbeddedObjectImportContext.cxx @@ -38,6 +38,8 @@ using namespace ::com::sun::star::document; using namespace ::com::sun::star::xml::sax; using namespace ::xmloff::token; +namespace { + class XMLEmbeddedObjectImportContext_Impl : public SvXMLImportContext { css::uno::Reference< css::xml::sax::XDocumentHandler > xHandler; @@ -59,6 +61,7 @@ public: virtual void Characters( const OUString& rChars ) override; }; +} XMLEmbeddedObjectImportContext_Impl::XMLEmbeddedObjectImportContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx, diff --git a/xmloff/source/core/attrlist.cxx b/xmloff/source/core/attrlist.cxx index 805cafdd45b6..d0dfaa7185ba 100644 --- a/xmloff/source/core/attrlist.cxx +++ b/xmloff/source/core/attrlist.cxx @@ -29,6 +29,8 @@ using namespace ::com::sun::star; using namespace ::xmloff::token; +namespace { + struct SvXMLTagAttribute_Impl { SvXMLTagAttribute_Impl( const OUString &rName, @@ -48,6 +50,8 @@ struct SvXMLTagAttribute_Impl OUString sValue; }; +} + struct SvXMLAttributeList_Impl { SvXMLAttributeList_Impl() diff --git a/xmloff/source/core/xmlexp.cxx b/xmloff/source/core/xmlexp.cxx index 59dcf10f60a5..6bf39cd993cb 100644 --- a/xmloff/source/core/xmlexp.cxx +++ b/xmloff/source/core/xmlexp.cxx @@ -145,6 +145,8 @@ const XMLServiceMapEntry_Impl aServiceMap[] = { nullptr, 0, nullptr, 0 } }; +namespace { + class SettingsExportFacade : public ::xmloff::XMLSettingsExportContext { public: @@ -174,6 +176,8 @@ private: ::std::stack< OUString > m_aElements; }; +} + void SettingsExportFacade::AddAttribute( enum ::xmloff::token::XMLTokenEnum i_eName, const OUString& i_rValue ) { m_rExport.AddAttribute( XML_NAMESPACE_CONFIG, i_eName, i_rValue ); @@ -208,6 +212,8 @@ Reference< XComponentContext > SettingsExportFacade::GetComponentContext() const return m_rExport.getComponentContext(); } +namespace { + class SvXMLExportEventListener : public cppu::WeakImplHelper< css::lang::XEventListener > { @@ -221,6 +227,8 @@ public: virtual void SAL_CALL disposing(const lang::EventObject& rEventObject) override; }; +} + SvXMLExportEventListener::SvXMLExportEventListener(SvXMLExport* pTempExport) : pExport(pTempExport) { diff --git a/xmloff/source/core/xmlimp.cxx b/xmloff/source/core/xmlimp.cxx index 51a1ef9b2c0d..9c1f806a999c 100644 --- a/xmloff/source/core/xmlimp.cxx +++ b/xmloff/source/core/xmlimp.cxx @@ -89,6 +89,8 @@ const OUString SvXMLImport::aDefaultNamespace = OUString(""); const OUString SvXMLImport::aNamespaceSeparator = OUString(":"); bool SvXMLImport::bIsNSMapsInitialized = false; +namespace { + class SvXMLImportEventListener : public cppu::WeakImplHelper< css::lang::XEventListener > { private: @@ -101,6 +103,8 @@ public: virtual void SAL_CALL disposing(const lang::EventObject& rEventObject) override; }; +} + SvXMLImportEventListener::SvXMLImportEventListener(SvXMLImport* pTempImport) : pImport(pTempImport) { diff --git a/xmloff/source/draw/EnhancedCustomShapeToken.cxx b/xmloff/source/draw/EnhancedCustomShapeToken.cxx index 6e65cabbde7e..3abca04a50db 100644 --- a/xmloff/source/draw/EnhancedCustomShapeToken.cxx +++ b/xmloff/source/draw/EnhancedCustomShapeToken.cxx @@ -32,12 +32,16 @@ static ::osl::Mutex& getHashMapMutex() return s_aHashMapProtection; } +namespace { + struct TokenTable { const char* pS; EnhancedCustomShapeTokenEnum const pE; }; +} + static const TokenTable pTokenTableArray[] = { { "type", EAS_type }, diff --git a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx index e502f4ea1aee..dc0b67f4ad9b 100644 --- a/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx +++ b/xmloff/source/draw/XMLGraphicsDefaultStyle.cxx @@ -84,6 +84,8 @@ SvXMLImportContextRef XMLGraphicsDefaultStyle::CreateChildContext( sal_uInt16 nP return xContext; } +namespace { + struct XMLPropertyByIndex { sal_Int32 const m_nIndex; explicit XMLPropertyByIndex(sal_Int32 const nIndex) : m_nIndex(nIndex) {} @@ -92,6 +94,8 @@ struct XMLPropertyByIndex { } }; +} + // This method is called for every default style void XMLGraphicsDefaultStyle::SetDefaults() { diff --git a/xmloff/source/draw/XMLImageMapContext.cxx b/xmloff/source/draw/XMLImageMapContext.cxx index 40d5a8f0d6db..e40be35d9969 100644 --- a/xmloff/source/draw/XMLImageMapContext.cxx +++ b/xmloff/source/draw/XMLImageMapContext.cxx @@ -94,6 +94,7 @@ static const SvXMLTokenMapEntry aImageMapObjectTokenMap[] = XML_TOKEN_MAP_END }; +namespace { class XMLImageMapObjectContext : public SvXMLImportContext { @@ -141,6 +142,7 @@ protected: css::uno::Reference<css::beans::XPropertySet> & rPropertySet); }; +} XMLImageMapObjectContext::XMLImageMapObjectContext( SvXMLImport& rImport, @@ -275,6 +277,7 @@ void XMLImageMapObjectContext::Prepare( rPropertySet->setPropertyValue( "Name", Any( sNam ) ); } +namespace { class XMLImageMapRectangleContext : public XMLImageMapObjectContext { @@ -302,6 +305,7 @@ protected: css::uno::Reference<css::beans::XPropertySet> & rPropertySet) override; }; +} XMLImageMapRectangleContext::XMLImageMapRectangleContext( SvXMLImport& rImport, @@ -372,6 +376,7 @@ void XMLImageMapRectangleContext::Prepare( XMLImageMapObjectContext::Prepare(rPropertySet); } +namespace { class XMLImageMapPolygonContext : public XMLImageMapObjectContext { @@ -398,6 +403,7 @@ protected: css::uno::Reference<css::beans::XPropertySet> & rPropertySet) override; }; +} XMLImageMapPolygonContext::XMLImageMapPolygonContext( SvXMLImport& rImport, @@ -455,6 +461,8 @@ void XMLImageMapPolygonContext::Prepare(Reference<XPropertySet> & rPropertySet) XMLImageMapObjectContext::Prepare(rPropertySet); } +namespace { + class XMLImageMapCircleContext : public XMLImageMapObjectContext { awt::Point aCenter; @@ -481,6 +489,7 @@ protected: css::uno::Reference<css::beans::XPropertySet> & rPropertySet) override; }; +} XMLImageMapCircleContext::XMLImageMapCircleContext( SvXMLImport& rImport, diff --git a/xmloff/source/draw/XMLNumberStyles.cxx b/xmloff/source/draw/XMLNumberStyles.cxx index 79a5c600deb9..98bdeb17ef9e 100644 --- a/xmloff/source/draw/XMLNumberStyles.cxx +++ b/xmloff/source/draw/XMLNumberStyles.cxx @@ -31,6 +31,8 @@ using namespace ::xmloff::token; +namespace { + struct SdXMLDataStyleNumber { enum XMLTokenEnum const meNumberStyle; @@ -38,8 +40,11 @@ struct SdXMLDataStyleNumber bool const mbTextual; bool const mbDecimal02; const char* mpText; +}; + } -const aSdXMLDataStyleNumbers[] = + +SdXMLDataStyleNumber const aSdXMLDataStyleNumbers[] = { { XML_DAY, false, false, false, nullptr }, { XML_DAY, true, false, false, nullptr }, diff --git a/xmloff/source/draw/animationimport.cxx b/xmloff/source/draw/animationimport.cxx index 082f7ad5153b..d5b2c7d1d3fa 100644 --- a/xmloff/source/draw/animationimport.cxx +++ b/xmloff/source/draw/animationimport.cxx @@ -1205,6 +1205,8 @@ SvXMLImportContextRef AnimationNodeContext::CreateChildContext( sal_uInt16 nPref return new SvXMLImportContext( GetImport(), nPrefix, rLocalName ); } +namespace { + class AnimationsImport: public SvXMLImport, public XAnimationNodeSupplier { public: @@ -1224,6 +1226,8 @@ private: Reference< XAnimationNode > mxRootNode; }; +} + AnimationsImport::AnimationsImport( const Reference< XComponentContext > & rxContext ) : SvXMLImport( rxContext, AnimationsImport_getImplementationName(), SvXMLImportFlags::META ) //FIXME: the above "IMPORT_META" used to be a nonsensical "true", question diff --git a/xmloff/source/draw/animexp.cxx b/xmloff/source/draw/animexp.cxx index 2b0071cd1b5b..fbed96791f34 100644 --- a/xmloff/source/draw/animexp.cxx +++ b/xmloff/source/draw/animexp.cxx @@ -47,15 +47,19 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::presentation; using namespace ::xmloff::token; +namespace { -const struct Effect +struct Effect { XMLEffect const meKind; XMLEffectDirection const meDirection; sal_Int16 const mnStartScale; bool const mbIn; +}; + } - AnimationEffectMap[] = + +const Effect AnimationEffectMap[] = { { EK_none, ED_none, -1, true }, // AnimationEffect_NONE { EK_fade, ED_from_left, -1, true }, // AnimationEffect_FADE_FROM_LEFT @@ -196,8 +200,6 @@ enum XMLActionKind XMLE_PLAY }; -} - struct XMLEffectHint { XMLActionKind meKind; @@ -224,6 +226,8 @@ struct XMLEffectHint {} }; +} + class AnimExpImpl { public: diff --git a/xmloff/source/draw/animimp.cxx b/xmloff/source/draw/animimp.cxx index f1ad97e5af1f..f2178aeb8454 100644 --- a/xmloff/source/draw/animimp.cxx +++ b/xmloff/source/draw/animimp.cxx @@ -345,8 +345,6 @@ enum XMLActionKind XMLE_PLAY }; -} - class XMLAnimationsEffectContext : public SvXMLImportContext { public: @@ -387,6 +385,7 @@ public: XMLAnimationsSoundContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, XMLAnimationsEffectContext* pParent ); }; +} XMLAnimationsSoundContext::XMLAnimationsSoundContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, XMLAnimationsEffectContext* pParent ) : SvXMLImportContext( rImport, nPrfx, rLocalName ) diff --git a/xmloff/source/draw/eventimp.cxx b/xmloff/source/draw/eventimp.cxx index f9e10c11cf7d..f88af2fc88b3 100644 --- a/xmloff/source/draw/eventimp.cxx +++ b/xmloff/source/draw/eventimp.cxx @@ -75,6 +75,8 @@ SdXMLEventContextData::SdXMLEventContextData(const Reference< XShape >& rxShape) { } +namespace { + class SdXMLEventContext : public SvXMLImportContext { public: @@ -95,6 +97,7 @@ public: XMLEventSoundContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, SdXMLEventContext* pParent ); }; +} XMLEventSoundContext::XMLEventSoundContext( SvXMLImport& rImp, sal_uInt16 nPrfx, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, SdXMLEventContext* pParent ) : SvXMLImportContext( rImp, nPrfx, rLocalName ) diff --git a/xmloff/source/draw/layerimp.cxx b/xmloff/source/draw/layerimp.cxx index 80c869da085b..c0826cbec25b 100644 --- a/xmloff/source/draw/layerimp.cxx +++ b/xmloff/source/draw/layerimp.cxx @@ -46,6 +46,8 @@ using namespace ::com::sun::star::lang; using namespace ::com::sun::star::container; using ::xmloff::token::IsXMLToken; +namespace { + class SdXMLLayerContext : public SvXMLImportContext { public: @@ -63,6 +65,8 @@ private: OUString msProtected; }; +} + SdXMLLayerContext::SdXMLLayerContext( SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName, const Reference< XAttributeList >& xAttrList, const Reference< XNameAccess >& xLayerManager ) : SvXMLImportContext(rImport, nPrefix, rLocalName) , mxLayerManager( xLayerManager ) diff --git a/xmloff/source/draw/sdpropls.cxx b/xmloff/source/draw/sdpropls.cxx index de6a5e4655d5..94e976f2fc89 100644 --- a/xmloff/source/draw/sdpropls.cxx +++ b/xmloff/source/draw/sdpropls.cxx @@ -752,6 +752,8 @@ static SvXMLEnumMapEntry<sal_Int32> const pXML_Caption_Type_Enum[] = { XML_TOKEN_INVALID,0 } }; +namespace { + class XMLCaptionEscapeRelative : public XMLPropertyHandler { public: @@ -765,6 +767,8 @@ public: const SvXMLUnitConverter& rUnitConverter ) const override; }; +} + bool XMLCaptionEscapeRelative::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const { sal_Int32 nValue; @@ -790,6 +794,8 @@ bool XMLCaptionEscapeRelative::exportXML( OUString& rStrExpValue, const Any& rVa return true; } +namespace { + class XMLMoveSizeProtectHdl : public XMLPropertyHandler { public: @@ -807,6 +813,8 @@ private: const sal_Int32 mnType; }; +} + bool XMLMoveSizeProtectHdl::importXML( const OUString& rStrImpValue, Any& rValue, const SvXMLUnitConverter& ) const { const bool bValue = rStrImpValue.indexOf( GetXMLToken( mnType == XML_SD_TYPE_MOVE_PROTECT ? XML_POSITION : XML_SIZE ) ) != -1; @@ -831,6 +839,8 @@ bool XMLMoveSizeProtectHdl::exportXML( OUString& rStrExpValue, const Any& rValue return true; } +namespace { + class XMLSdHeaderFooterVisibilityTypeHdl : public XMLPropertyHandler { public: @@ -838,6 +848,8 @@ public: virtual bool exportXML( OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter ) const override; }; +} + bool XMLSdHeaderFooterVisibilityTypeHdl::importXML( const OUString& rStrImpValue, css::uno::Any& rValue, @@ -871,6 +883,8 @@ bool XMLSdHeaderFooterVisibilityTypeHdl::exportXML( return bRet; } +namespace { + class XMLSdRotationAngleTypeHdl : public XMLPropertyHandler { public: @@ -878,6 +892,8 @@ public: virtual bool exportXML(OUString& rStrExpValue, const css::uno::Any& rValue, const SvXMLUnitConverter& rUnitConverter) const override; }; +} + bool XMLSdRotationAngleTypeHdl::importXML( const OUString& rStrImpValue, css::uno::Any& rValue, @@ -917,6 +933,8 @@ bool XMLSdRotationAngleTypeHdl::exportXML( return bRet; } +namespace { + class XMLFitToSizeEnumPropertyHdl : public XMLEnumPropertyHdl { public: @@ -948,6 +966,7 @@ public: } }; +} XMLSdPropHdlFactory::XMLSdPropHdlFactory( uno::Reference< frame::XModel > const & xModel, SvXMLImport& rImport ) : mxModel( xModel ), mpExport(nullptr), mpImport( &rImport ) diff --git a/xmloff/source/draw/sdxmlimp.cxx b/xmloff/source/draw/sdxmlimp.cxx index 829c0ad16c87..3a7d52b880ab 100644 --- a/xmloff/source/draw/sdxmlimp.cxx +++ b/xmloff/source/draw/sdxmlimp.cxx @@ -48,6 +48,8 @@ using namespace ::com::sun::star; using namespace ::xmloff::token; +namespace { + class SdXMLBodyContext_Impl : public SvXMLImportContext { SdXMLImport& GetSdImport() { return static_cast<SdXMLImport&>(GetImport()); } @@ -63,6 +65,8 @@ public: const uno::Reference< xml::sax::XAttributeList > & xAttrList ) override; }; +} + SdXMLBodyContext_Impl::SdXMLBodyContext_Impl( SdXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const uno::Reference< xml::sax::XAttributeList > & ) : @@ -78,6 +82,8 @@ SvXMLImportContextRef SdXMLBodyContext_Impl::CreateChildContext( return GetSdImport().CreateBodyContext(rLocalName, xAttrList); } +namespace { + // NB: virtually inherit so we can multiply inherit properly // in SdXMLFlatDocContext_Impl class SdXMLDocContext_Impl : public virtual SvXMLImportContext @@ -103,6 +109,8 @@ public: virtual void SAL_CALL endFastElement( sal_Int32 /*nElement*/ ) override {} }; +} + SdXMLDocContext_Impl::SdXMLDocContext_Impl( SdXMLImport& rImport ) : SvXMLImportContext(rImport) @@ -198,6 +206,8 @@ uno::Reference< xml::sax::XFastContextHandler > SAL_CALL SdXMLDocContext_Impl::c return new SvXMLImportContext( GetImport() ); } +namespace { + // context for flat file xml format class SdXMLFlatDocContext_Impl : public SdXMLDocContext_Impl, public SvXMLMetaDocumentContext @@ -217,6 +227,8 @@ public: sal_Int32 nElement, const css::uno::Reference< css::xml::sax::XFastAttributeList >& xAttrList ) override; }; +} + SdXMLFlatDocContext_Impl::SdXMLFlatDocContext_Impl( SdXMLImport& i_rImport, const uno::Reference<document::XDocumentProperties>& i_xDocProps) : SvXMLImportContext(i_rImport), diff --git a/xmloff/source/draw/shapeimport.cxx b/xmloff/source/draw/shapeimport.cxx index 59d08cacfed1..856635c09d31 100644 --- a/xmloff/source/draw/shapeimport.cxx +++ b/xmloff/source/draw/shapeimport.cxx @@ -47,12 +47,18 @@ #include <map> #include <vector> +namespace { + class ShapeGroupContext; +} + using namespace ::std; using namespace ::com::sun::star; using namespace ::xmloff::token; +namespace { + struct ConnectionHint { css::uno::Reference< css::drawing::XShape > mxConnector; @@ -70,6 +76,8 @@ struct XShapeCompareHelper } }; +} + /** this map store all glue point id mappings for shapes that had user defined glue points. This is needed because on insertion the glue points will get a new and unique id */ typedef std::map<sal_Int32,sal_Int32> GluePointIdMap; @@ -694,6 +702,8 @@ void XMLShapeImportHelper::finishShape( } } +namespace { + // helper functions for z-order sorting struct ZOrderHint { @@ -725,6 +735,8 @@ private: void moveShape( sal_Int32 nSourcePos, sal_Int32 nDestPos ); }; +} + ShapeGroupContext::ShapeGroupContext( uno::Reference< drawing::XShapes > const & rShapes, std::shared_ptr<ShapeGroupContext> pParentContext ) : mxShapes( rShapes ), mnCurrentZ( 0 ), mpParentContext( std::move(pParentContext) ) { diff --git a/xmloff/source/draw/xexptran.cxx b/xmloff/source/draw/xexptran.cxx index f0a297c935f3..eb7cb4a634d5 100644 --- a/xmloff/source/draw/xexptran.cxx +++ b/xmloff/source/draw/xexptran.cxx @@ -178,6 +178,8 @@ struct ImpSdXMLExpTransObj2DBase // classes of objects, different sizes +namespace { + struct ImpSdXMLExpTransObj2DRotate : public ImpSdXMLExpTransObj2DBase { double const mfRotate; @@ -215,6 +217,8 @@ struct ImpSdXMLExpTransObj2DMatrix : public ImpSdXMLExpTransObj2DBase : ImpSdXMLExpTransObj2DBase(IMP_SDXMLEXP_TRANSOBJ2D_MATRIX), maMatrix(rNew) {} }; +} + // add members void SdXMLImExTransform2D::AddRotate(double fNew) @@ -548,6 +552,8 @@ struct ImpSdXMLExpTransObj3DBase // classes of objects, different sizes +namespace { + struct ImpSdXMLExpTransObj3DRotateX : public ImpSdXMLExpTransObj3DBase { double const mfRotateX; @@ -585,6 +591,8 @@ struct ImpSdXMLExpTransObj3DMatrix : public ImpSdXMLExpTransObj3DBase : ImpSdXMLExpTransObj3DBase(IMP_SDXMLEXP_TRANSOBJ3D_MATRIX), maMatrix(rNew) {} }; +} + // add members void SdXMLImExTransform3D::AddMatrix(const ::basegfx::B3DHomMatrix& rNew) diff --git a/xmloff/source/draw/ximppage.cxx b/xmloff/source/draw/ximppage.cxx index af7fcdde026c..cd8d2b2a36de 100644 --- a/xmloff/source/draw/ximppage.cxx +++ b/xmloff/source/draw/ximppage.cxx @@ -53,6 +53,8 @@ using namespace ::com::sun::star::office; using namespace ::com::sun::star::xml::sax; using namespace ::com::sun::star::geometry; +namespace { + class DrawAnnotationContext : public SvXMLImportContext { @@ -71,6 +73,8 @@ private: OUStringBuffer maDateBuffer; }; +} + DrawAnnotationContext::DrawAnnotationContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLocalName,const Reference< xml::sax::XAttributeList>& xAttrList, const Reference< XAnnotationAccess >& xAnnotationAccess ) : SvXMLImportContext( rImport, nPrfx, rLocalName ) , mxAnnotation( xAnnotationAccess->createAndInsertAnnotation() ) @@ -510,6 +514,8 @@ void SdXMLGenericPageContext::SetPageMaster( OUString const & rsPageMasterName ) } } +namespace { + class XoNavigationOrderAccess : public ::cppu::WeakImplHelper< XIndexAccess > { public: @@ -527,6 +533,8 @@ private: std::vector< Reference< XShape > > maShapes; }; +} + XoNavigationOrderAccess::XoNavigationOrderAccess( std::vector< Reference< XShape > >& rShapes ) { maShapes.swap( rShapes ); diff --git a/xmloff/source/draw/ximpstyl.cxx b/xmloff/source/draw/ximpstyl.cxx index 929fa5b37aa2..070b9ecad1e3 100644 --- a/xmloff/source/draw/ximpstyl.cxx +++ b/xmloff/source/draw/ximpstyl.cxx @@ -55,6 +55,8 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::xml::sax; using namespace ::xmloff::token; +namespace { + class SdXMLDrawingPagePropertySetContext : public SvXMLPropertySetContext { public: @@ -74,6 +76,7 @@ public: const XMLPropertyState& rProp) override; }; +} SdXMLDrawingPagePropertySetContext::SdXMLDrawingPagePropertySetContext( SvXMLImport& rImport, sal_uInt16 nPrfx, @@ -124,6 +127,8 @@ SvXMLImportContextRef SdXMLDrawingPagePropertySetContext::CreateChildContext( return xContext; } +namespace { + class SdXMLDrawingPageStyleContext : public XMLPropStyleContext { public: @@ -147,6 +152,7 @@ public: virtual void FillPropertySet( const css::uno::Reference< css::beans::XPropertySet > & rPropSet ) override; }; +} SdXMLDrawingPageStyleContext::SdXMLDrawingPageStyleContext( SvXMLImport& rImport, diff --git a/xmloff/source/forms/elementimport.cxx b/xmloff/source/forms/elementimport.cxx index fa3289e73826..877095defd42 100644 --- a/xmloff/source/forms/elementimport.cxx +++ b/xmloff/source/forms/elementimport.cxx @@ -76,6 +76,8 @@ namespace xmloff #define PROPID_MIN_VALUE 3 #define PROPID_MAX_VALUE 4 + namespace { + struct PropertyValueLess { bool operator()(const PropertyValue& _rLeft, const PropertyValue& _rRight) @@ -84,6 +86,8 @@ namespace xmloff } }; + } + //= OElementNameMap OElementNameMap::MapString2Element OElementNameMap::s_sElementTranslations; @@ -1349,6 +1353,8 @@ namespace xmloff simulateDefaultedAttribute(OAttributeMetaData::getDatabaseAttributeName(DAFlags::ConvertEmpty), PROPERTY_EMPTY_IS_NULL, "false"); } + namespace { + struct EqualHandle { const sal_Int32 m_nHandle; @@ -1360,6 +1366,8 @@ namespace xmloff } }; + } + void OTextLikeImport::removeRedundantCurrentValue() { if ( m_bEncounteredTextPara ) @@ -1402,6 +1410,8 @@ namespace xmloff // since this is the default of this property, anyway. } + namespace { + struct EqualName { const OUString & m_sName; @@ -1413,6 +1423,8 @@ namespace xmloff } }; + } + void OTextLikeImport::adjustDefaultControlProperty() { // In OpenOffice.org 2.0, we changed the implementation of the css.form.component.TextField (the model of a text field control), diff --git a/xmloff/source/meta/MetaImportComponent.cxx b/xmloff/source/meta/MetaImportComponent.cxx index 72661847c046..c3cbdb03d2b2 100644 --- a/xmloff/source/meta/MetaImportComponent.cxx +++ b/xmloff/source/meta/MetaImportComponent.cxx @@ -28,6 +28,8 @@ using namespace ::com::sun::star; using namespace ::xmloff::token; +namespace { + class XMLMetaImportComponent : public SvXMLImport { private: @@ -48,6 +50,8 @@ protected: virtual void SAL_CALL setTargetDocument( const css::uno::Reference< css::lang::XComponent >& xDoc ) override; }; +} + // global functions to support the component extern "C" SAL_DLLPUBLIC_EXPORT css::uno::XInterface * diff --git a/xmloff/source/meta/xmlmetai.cxx b/xmloff/source/meta/xmlmetai.cxx index 907fd68d4e0d..533cc761d55c 100644 --- a/xmloff/source/meta/xmlmetai.cxx +++ b/xmloff/source/meta/xmlmetai.cxx @@ -39,6 +39,8 @@ using namespace com::sun::star; using namespace ::xmloff::token; +namespace { + /// builds a DOM tree from SAX events, by forwarding to SAXDocumentBuilder class XMLDocumentBuilderContext : public SvXMLImportContext { @@ -67,6 +69,8 @@ public: }; +} + XMLDocumentBuilderContext::XMLDocumentBuilderContext(SvXMLImport& rImport, sal_Int32 /*nElement*/, const uno::Reference<xml::sax::XFastAttributeList>&, const uno::Reference<xml::dom::XSAXDocumentBuilder2>& rDocBuilder) : diff --git a/xmloff/source/script/xmlscripti.cxx b/xmloff/source/script/xmlscripti.cxx index d3c9232f0317..9b6850102f5a 100644 --- a/xmloff/source/script/xmlscripti.cxx +++ b/xmloff/source/script/xmlscripti.cxx @@ -38,6 +38,8 @@ using namespace ::xmloff::token; // XMLScriptChildContext: context for <office:script> element +namespace { + class XMLScriptChildContext : public SvXMLImportContext { private: @@ -56,6 +58,8 @@ public: virtual void EndElement() override; }; +} + XMLScriptChildContext::XMLScriptChildContext( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, const Reference< frame::XModel >& rxModel, const OUString& rLanguage ) :SvXMLImportContext( rImport, nPrfx, rLName ) diff --git a/xmloff/source/style/PageMasterExportPropMapper.cxx b/xmloff/source/style/PageMasterExportPropMapper.cxx index 377f76f4bc18..c19d145ed299 100644 --- a/xmloff/source/style/PageMasterExportPropMapper.cxx +++ b/xmloff/source/style/PageMasterExportPropMapper.cxx @@ -62,6 +62,8 @@ static void lcl_AddState(::std::vector< XMLPropertyState >& rPropState, sal_Int3 // helper struct to handle equal XMLPropertyState's for page, header and footer +namespace { + struct XMLPropertyStateBuffer { XMLPropertyState* pPMMarginAll; @@ -88,6 +90,8 @@ struct XMLPropertyStateBuffer void ContextFilter( ::std::vector< XMLPropertyState >& rPropState ); }; +} + XMLPropertyStateBuffer::XMLPropertyStateBuffer() : pPMMarginAll( nullptr ) , diff --git a/xmloff/source/style/XMLFontAutoStylePool.cxx b/xmloff/source/style/XMLFontAutoStylePool.cxx index c3e263430a8b..d25bd5130545 100644 --- a/xmloff/source/style/XMLFontAutoStylePool.cxx +++ b/xmloff/source/style/XMLFontAutoStylePool.cxx @@ -47,6 +47,8 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::uno; using namespace ::xmloff::token; +namespace { + class XMLFontAutoStylePoolEntry_Impl { OUString const sName; @@ -81,6 +83,7 @@ public: rtl_TextEncoding GetEncoding() const { return eEnc; } }; +} inline XMLFontAutoStylePoolEntry_Impl::XMLFontAutoStylePoolEntry_Impl( const OUString& rName, @@ -112,6 +115,8 @@ inline XMLFontAutoStylePoolEntry_Impl::XMLFontAutoStylePoolEntry_Impl( { } +namespace { + struct XMLFontAutoStylePoolEntryCmp_Impl { bool operator()( std::unique_ptr<XMLFontAutoStylePoolEntry_Impl> const& r1, @@ -136,6 +141,8 @@ struct XMLFontAutoStylePoolEntryCmp_Impl { } }; +} + class XMLFontAutoStylePool_Impl : public o3tl::sorted_vector<std::unique_ptr<XMLFontAutoStylePoolEntry_Impl>, XMLFontAutoStylePoolEntryCmp_Impl> { }; diff --git a/xmloff/source/style/impastpl.cxx b/xmloff/source/style/impastpl.cxx index 13b600c21204..6934de7383e2 100644 --- a/xmloff/source/style/impastpl.cxx +++ b/xmloff/source/style/impastpl.cxx @@ -249,6 +249,8 @@ XMLAutoStylePoolParent::~XMLAutoStylePoolParent() { } +namespace { + struct ComparePartial { const XMLAutoStyleFamily& rFamilyData; @@ -265,6 +267,8 @@ struct ComparePartial } }; +} + // Adds an array of XMLPropertyState ( vector< XMLPropertyState > ) to list // if not added, yet. diff --git a/xmloff/source/style/prstylecond.cxx b/xmloff/source/style/prstylecond.cxx index ad16ee813cb8..e384a645dffe 100644 --- a/xmloff/source/style/prstylecond.cxx +++ b/xmloff/source/style/prstylecond.cxx @@ -25,12 +25,18 @@ using namespace ::xmloff::token; // note: keep this in sync with the list of conditions in sw/source/uibase/chrdlg/ccoll.cxx -static const struct ConditionMap +namespace { + +struct ConditionMap { char const* aInternal; XMLTokenEnum const nExternal; int const aValue; -} g_ConditionMap[] = +}; + +} + +static const ConditionMap g_ConditionMap[] = { { "TableHeader", XML_TABLE_HEADER, -1 }, { "Table", XML_TABLE, -1 }, diff --git a/xmloff/source/style/weighhdl.cxx b/xmloff/source/style/weighhdl.cxx index cb4d261010b9..b1b671d56efe 100644 --- a/xmloff/source/style/weighhdl.cxx +++ b/xmloff/source/style/weighhdl.cxx @@ -31,12 +31,16 @@ using namespace ::com::sun::star::uno; using namespace ::xmloff::token; +namespace { + struct FontWeightMapper { float const fWeight; sal_uInt16 const nValue; }; +} + FontWeightMapper const aFontWeightMap[] = { { css::awt::FontWeight::DONTKNOW, 0 }, diff --git a/xmloff/source/style/xmlimppr.cxx b/xmloff/source/style/xmlimppr.cxx index d21c219f12cb..b7a4c96b2525 100644 --- a/xmloff/source/style/xmlimppr.cxx +++ b/xmloff/source/style/xmlimppr.cxx @@ -548,6 +548,8 @@ bool SvXMLImportPropertyMapper::FillPropertySet_( typedef pair<const OUString*, const Any* > PropertyPair; typedef vector<PropertyPair> PropertyPairs; +namespace { + struct PropertyPairLessFunctor { bool operator()( const PropertyPair& a, const PropertyPair& b ) const @@ -556,6 +558,8 @@ struct PropertyPairLessFunctor } }; +} + void SvXMLImportPropertyMapper::PrepareForMultiPropertySet_( const vector<XMLPropertyState> & rProperties, const Reference<XPropertySetInfo> & rPropSetInfo, diff --git a/xmloff/source/style/xmlnumfe.cxx b/xmloff/source/style/xmlnumfe.cxx index e5b367e1343e..7fc07dbb8120 100644 --- a/xmloff/source/style/xmlnumfe.cxx +++ b/xmloff/source/style/xmlnumfe.cxx @@ -55,6 +55,8 @@ using namespace ::svt; typedef std::set< sal_uInt32 > SvXMLuInt32Set; +namespace { + struct SvXMLEmbeddedTextEntry { sal_uInt16 const nSourcePos; // position in NumberFormat (to skip later) @@ -65,6 +67,8 @@ struct SvXMLEmbeddedTextEntry nSourcePos(nSP), nFormatPos(nFP), aText(rT) {} }; +} + class SvXMLEmbeddedTextEntryArr { typedef std::vector<SvXMLEmbeddedTextEntry> DataType; diff --git a/xmloff/source/style/xmlnumfi.cxx b/xmloff/source/style/xmlnumfi.cxx index 29f9e1f7527b..4d3c334668be 100644 --- a/xmloff/source/style/xmlnumfi.cxx +++ b/xmloff/source/style/xmlnumfi.cxx @@ -47,6 +47,8 @@ using namespace ::com::sun::star; using namespace ::xmloff::token; +namespace { + struct SvXMLNumFmtEntry { OUString const aName; @@ -57,6 +59,8 @@ struct SvXMLNumFmtEntry aName(rN), nKey(nK), bRemoveAfterUse(bR) {} }; +} + class SvXMLNumImpData { SvNumberFormatter* pFormatter; @@ -109,6 +113,8 @@ struct SvXMLNumberInfo std::map<sal_Int32, OUString> m_EmbeddedElements; }; +namespace { + class SvXMLNumFmtElementContext : public SvXMLImportContext { SvXMLNumFormatContext& rParent; @@ -192,8 +198,6 @@ public: virtual void EndElement() override; }; -namespace { - enum SvXMLStyleTokens { XML_TOK_STYLE_TEXT, @@ -307,6 +311,8 @@ static const SvXMLEnumMapEntry<bool> aFormatSourceMap[] = { XML_TOKEN_INVALID, false } }; +namespace { + struct SvXMLDefaultDateFormat { NfIndexTableOffset const eFormat; @@ -320,6 +326,8 @@ struct SvXMLDefaultDateFormat bool const bSystem; }; +} + static const SvXMLDefaultDateFormat aDefaultDateFormats[] = { // format day-of-week day month year hours minutes seconds format-source diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx index 09c95178212b..1ea6831d07b8 100644 --- a/xmloff/source/style/xmlnumi.cxx +++ b/xmloff/source/style/xmlnumi.cxx @@ -71,6 +71,8 @@ using namespace ::com::sun::star::io; class SvxXMLListLevelStyleContext_Impl; +namespace { + class SvxXMLListLevelStyleAttrContext_Impl : public SvXMLImportContext { SvxXMLListLevelStyleContext_Impl& rListLevel; @@ -99,8 +101,6 @@ public: SvxXMLListLevelStyleContext_Impl& rLLevel ); }; -namespace { - enum SvxXMLTextListLevelStyleAttrTokens { XML_TOK_TEXT_LEVEL_ATTR_LEVEL, @@ -146,7 +146,7 @@ static const SvXMLTokenMapEntry* lcl_getLevelAttrTokenMap() class SvxXMLListLevelStyleContext_Impl : public SvXMLImportContext { - friend class SvxXMLListLevelStyleAttrContext_Impl; + friend SvxXMLListLevelStyleAttrContext_Impl; OUString sPrefix; OUString sSuffix; diff --git a/xmloff/source/style/xmlprmap.cxx b/xmloff/source/style/xmlprmap.cxx index ff55ebd3b7a5..eb232b155477 100644 --- a/xmloff/source/style/xmlprmap.cxx +++ b/xmloff/source/style/xmlprmap.cxx @@ -36,6 +36,8 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::beans; using ::xmloff::token::GetXMLToken; +namespace { + /** Helper-class for XML-im/export: - Holds a pointer to a given array of XMLPropertyMapEntry - Provides several methods to access data from this array @@ -69,6 +71,8 @@ struct XMLPropertySetMapperEntry_Impl sal_uInt32 GetPropType() const { return nType & XML_TYPE_PROP_MASK; } }; +} + XMLPropertySetMapperEntry_Impl::XMLPropertySetMapperEntry_Impl( const XMLPropertyMapEntry& rMapEntry, const rtl::Reference< XMLPropertyHandlerFactory >& rFactory ) : diff --git a/xmloff/source/style/xmlstyle.cxx b/xmloff/source/style/xmlstyle.cxx index 5c4c12f667cf..17e72b70b62b 100644 --- a/xmloff/source/style/xmlstyle.cxx +++ b/xmloff/source/style/xmlstyle.cxx @@ -200,6 +200,8 @@ bool SvXMLStyleContext::IsTransient() const return false; } +namespace { + class SvXMLStyleIndex_Impl { OUString const sName; @@ -243,6 +245,8 @@ struct SvXMLStyleIndexCmp_Impl } }; +} + class SvXMLStylesContext_Impl { typedef std::set<SvXMLStyleIndex_Impl, SvXMLStyleIndexCmp_Impl> IndicesType; diff --git a/xmloff/source/table/XMLTableExport.cxx b/xmloff/source/table/XMLTableExport.cxx index 1703542d0cf0..1154ef82fe98 100644 --- a/xmloff/source/table/XMLTableExport.cxx +++ b/xmloff/source/table/XMLTableExport.cxx @@ -98,6 +98,8 @@ const XMLPropertyMapEntry* getCellPropertiesMap() return &aXMLCellProperties[0]; } +namespace { + class StringStatisticHelper { private: @@ -110,6 +112,8 @@ public: sal_Int32 getModeString( /* out */ OUString& rModeString ); }; +} + void StringStatisticHelper::add( const OUString& rStyleName ) { std::map< OUString, sal_Int32 >::iterator iter( mStats.find( rStyleName ) ); diff --git a/xmloff/source/table/XMLTableImport.cxx b/xmloff/source/table/XMLTableImport.cxx index ddaae9f5e484..1dd094c16c8a 100644 --- a/xmloff/source/table/XMLTableImport.cxx +++ b/xmloff/source/table/XMLTableImport.cxx @@ -65,8 +65,6 @@ struct ColumnInfo OUString msDefaultCellStyleName; }; -} - class XMLProxyContext : public SvXMLImportContext { public: @@ -89,6 +87,8 @@ struct MergeInfo : mnStartColumn( nStartColumn ), mnStartRow( nStartRow ), mnEndColumn( nStartColumn + nColumnSpan - 1 ), mnEndRow( nStartRow + nRowSpan - 1 ) {}; }; +} + typedef std::vector< std::shared_ptr< MergeInfo > > MergeInfoVector; class XMLTableImportContext : public SvXMLImportContext @@ -124,6 +124,8 @@ public: MergeInfoVector maMergeInfos; }; +namespace { + class XMLCellImportContext : public SvXMLImportContext { public: @@ -166,6 +168,8 @@ private: OUString msTemplateStyleName; }; +} + // class XMLProxyContext XMLProxyContext::XMLProxyContext( SvXMLImport& rImport, const SvXMLImportContextRef& xParent, sal_uInt16 nPrfx, const OUString& rLName ) diff --git a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx index cf3beb02918f..4177068ae434 100644 --- a/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx +++ b/xmloff/source/text/XMLFootnoteConfigurationImportContext.cxx @@ -51,6 +51,7 @@ using namespace ::xmloff::token; // XMLFootnoteConfigHelper +namespace { /// local helper class for import of quo-vadis and ergo-sum elements class XMLFootnoteConfigHelper : public SvXMLImportContext @@ -73,6 +74,7 @@ public: virtual void Characters( const OUString& rChars ) override; }; +} XMLFootnoteConfigHelper::XMLFootnoteConfigHelper( SvXMLImport& rImport, diff --git a/xmloff/source/text/XMLTextFrameContext.cxx b/xmloff/source/text/XMLTextFrameContext.cxx index 0f33c760a6ac..c7e98d6791fc 100644 --- a/xmloff/source/text/XMLTextFrameContext.cxx +++ b/xmloff/source/text/XMLTextFrameContext.cxx @@ -113,6 +113,8 @@ inline XMLTextFrameContextHyperlink_Impl::XMLTextFrameContextHyperlink_Impl( { } +namespace { + // Implement Title/Description Elements UI (#i73249#) class XMLTextFrameTitleOrDescContext_Impl : public SvXMLImportContext { @@ -129,6 +131,7 @@ public: virtual void Characters( const OUString& rText ) override; }; +} XMLTextFrameTitleOrDescContext_Impl::XMLTextFrameTitleOrDescContext_Impl( SvXMLImport& rImport, @@ -145,6 +148,8 @@ void XMLTextFrameTitleOrDescContext_Impl::Characters( const OUString& rText ) mrTitleOrDesc += rText; } +namespace { + class XMLTextFrameParam_Impl : public SvXMLImportContext { public: @@ -156,6 +161,8 @@ public: ParamMap &rParamMap); }; +} + XMLTextFrameParam_Impl::XMLTextFrameParam_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, @@ -189,6 +196,9 @@ XMLTextFrameParam_Impl::XMLTextFrameParam_Impl( if (!sName.isEmpty() && bFoundValue ) rParamMap[sName] = sValue; } + +namespace { + class XMLTextFrameContourContext_Impl : public SvXMLImportContext { Reference < XPropertySet > xPropSet; @@ -203,6 +213,7 @@ public: bool bPath ); }; +} XMLTextFrameContourContext_Impl::XMLTextFrameContourContext_Impl( SvXMLImport& rImport, @@ -325,6 +336,8 @@ XMLTextFrameContourContext_Impl::XMLTextFrameContourContext_Impl( } } +namespace { + class XMLTextFrameContext_Impl : public SvXMLImportContext { css::uno::Reference < css::text::XTextCursor > xOldTextCursor; @@ -416,6 +429,7 @@ public: const css::uno::Reference < css::beans::XPropertySet >& GetPropSet() const { return xPropSet; } }; +} void XMLTextFrameContext_Impl::Create() { diff --git a/xmloff/source/text/XMLTextListAutoStylePool.cxx b/xmloff/source/text/XMLTextListAutoStylePool.cxx index aa23ec13bf29..dd788e215d8c 100644 --- a/xmloff/source/text/XMLTextListAutoStylePool.cxx +++ b/xmloff/source/text/XMLTextListAutoStylePool.cxx @@ -115,6 +115,8 @@ XMLTextListAutoStylePoolEntry_Impl::XMLTextListAutoStylePoolEntry_Impl( while (rNames.find(sName) != rNames.end()); } +namespace { + struct XMLTextListAutoStylePoolEntryCmp_Impl { bool operator()( @@ -137,6 +139,9 @@ struct XMLTextListAutoStylePoolEntryCmp_Impl } } }; + +} + class XMLTextListAutoStylePool_Impl : public o3tl::sorted_vector<std::unique_ptr<XMLTextListAutoStylePoolEntry_Impl>, XMLTextListAutoStylePoolEntryCmp_Impl> {}; XMLTextListAutoStylePool::XMLTextListAutoStylePool( SvXMLExport& rExp ) : diff --git a/xmloff/source/text/XMLTextShapeStyleContext.cxx b/xmloff/source/text/XMLTextShapeStyleContext.cxx index a781cc60be07..627f3ee3d60d 100644 --- a/xmloff/source/text/XMLTextShapeStyleContext.cxx +++ b/xmloff/source/text/XMLTextShapeStyleContext.cxx @@ -41,6 +41,8 @@ using namespace ::com::sun::star::style; using namespace ::com::sun::star::beans; using namespace ::xmloff::token; +namespace { + class XMLTextShapePropertySetContext_Impl : public XMLShapePropertySetContext { public: @@ -59,6 +61,8 @@ public: const XMLPropertyState& rProp) override; }; +} + XMLTextShapePropertySetContext_Impl::XMLTextShapePropertySetContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrfx, const OUString& rLName, diff --git a/xmloff/source/text/txtparai.cxx b/xmloff/source/text/txtparai.cxx index e4f25cfa86cb..e44771a224a9 100644 --- a/xmloff/source/text/txtparai.cxx +++ b/xmloff/source/text/txtparai.cxx @@ -189,6 +189,8 @@ void XMLCharContext::InsertString(const OUString& _sString) GetImport().GetTextImport()->InsertString( _sString ); } +namespace { + /** import start of reference (<text:reference-start>) */ class XMLStartReferenceContext_Impl : public SvXMLImportContext { @@ -208,6 +210,7 @@ public: OUString& rName); }; +} XMLStartReferenceContext_Impl::XMLStartReferenceContext_Impl( SvXMLImport& rImport, @@ -258,6 +261,8 @@ bool XMLStartReferenceContext_Impl::FindName( return bNameOK; } +namespace { + /** import end of reference (<text:reference-end>) */ class XMLEndReferenceContext_Impl : public SvXMLImportContext { @@ -272,6 +277,7 @@ public: const Reference<xml::sax::XAttributeList> & xAttrList); }; +} XMLEndReferenceContext_Impl::XMLEndReferenceContext_Impl( SvXMLImport& rImport, @@ -303,6 +309,8 @@ XMLEndReferenceContext_Impl::XMLEndReferenceContext_Impl( } } +namespace { + class XMLImpSpanContext_Impl : public SvXMLImportContext { XMLHints_Impl& m_rHints; @@ -369,6 +377,7 @@ public: virtual void Characters( const OUString& rChars ) override; }; +} XMLImpHyperlinkContext_Impl::XMLImpHyperlinkContext_Impl( SvXMLImport& rImport, @@ -475,6 +484,8 @@ void XMLImpHyperlinkContext_Impl::Characters( const OUString& rChars ) GetImport().GetTextImport()->InsertString( rChars, mrbIgnoreLeadingSpace ); } +namespace { + class XMLImpRubyBaseContext_Impl : public SvXMLImportContext { XMLHints_Impl& m_rHints; @@ -499,6 +510,7 @@ public: virtual void Characters( const OUString& rChars ) override; }; +} XMLImpRubyBaseContext_Impl::XMLImpRubyBaseContext_Impl( SvXMLImport& rImport, @@ -531,6 +543,8 @@ void XMLImpRubyBaseContext_Impl::Characters( const OUString& rChars ) GetImport().GetTextImport()->InsertString( rChars, rIgnoreLeadingSpace ); } +namespace { + class XMLImpRubyContext_Impl : public SvXMLImportContext { XMLHints_Impl& m_rHints; @@ -580,6 +594,7 @@ public: virtual void Characters( const OUString& rChars ) override; }; +} XMLImpRubyTextContext_Impl::XMLImpRubyTextContext_Impl( SvXMLImport& rImport, @@ -692,6 +707,8 @@ SvXMLImportContextRef XMLImpRubyContext_Impl::CreateChildContext( return xContext; } +namespace { + /** for text:meta and text:meta-field */ class XMLMetaImportContextBase : public SvXMLImportContext @@ -733,6 +750,7 @@ public: = 0; }; +} XMLMetaImportContextBase::XMLMetaImportContextBase( SvXMLImport& i_rImport, @@ -807,6 +825,8 @@ void XMLMetaImportContextBase::ProcessAttribute(sal_uInt16 const i_nPrefix, } } +namespace { + /** text:meta */ class XMLMetaImportContext : public XMLMetaImportContextBase { @@ -832,6 +852,7 @@ public: virtual void InsertMeta(const Reference<XTextRange> & i_xInsertionRange) override; }; +} XMLMetaImportContext::XMLMetaImportContext( SvXMLImport& i_rImport, @@ -904,6 +925,8 @@ void XMLMetaImportContext::InsertMeta( } } +namespace { + /** text:meta-field */ class XMLMetaFieldImportContext : public XMLMetaImportContextBase { @@ -924,6 +947,7 @@ public: virtual void InsertMeta(const Reference<XTextRange> & i_xInsertionRange) override; }; +} XMLMetaFieldImportContext::XMLMetaFieldImportContext( SvXMLImport& i_rImport, @@ -993,6 +1017,8 @@ void XMLMetaFieldImportContext::InsertMeta( } } +namespace { + /** * Process index marks. * @@ -1043,6 +1069,7 @@ protected: const OUString& rServiceName); }; +} XMLIndexMarkImportContext_Impl::XMLIndexMarkImportContext_Impl( SvXMLImport& rImport, @@ -1249,6 +1276,8 @@ bool XMLIndexMarkImportContext_Impl::CreateMark( return false; } +namespace { + class XMLTOCMarkImportContext_Impl : public XMLIndexMarkImportContext_Impl { public: @@ -1269,6 +1298,7 @@ protected: Reference<beans::XPropertySet>& rPropSet) override; }; +} XMLTOCMarkImportContext_Impl::XMLTOCMarkImportContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName, @@ -1308,6 +1338,8 @@ void XMLTOCMarkImportContext_Impl::ProcessAttribute( } } +namespace { + class XMLUserIndexMarkImportContext_Impl : public XMLIndexMarkImportContext_Impl { public: @@ -1328,6 +1360,7 @@ protected: Reference<beans::XPropertySet>& rPropSet) override; }; +} XMLUserIndexMarkImportContext_Impl::XMLUserIndexMarkImportContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName, @@ -1374,6 +1407,8 @@ void XMLUserIndexMarkImportContext_Impl::ProcessAttribute( } } +namespace { + class XMLAlphaIndexMarkImportContext_Impl : public XMLIndexMarkImportContext_Impl { public: @@ -1394,6 +1429,7 @@ protected: Reference<beans::XPropertySet>& rPropSet) override; }; +} XMLAlphaIndexMarkImportContext_Impl::XMLAlphaIndexMarkImportContext_Impl( SvXMLImport& rImport, sal_uInt16 nPrefix, const OUString& rLocalName, diff --git a/xmloff/source/text/txtprhdl.cxx b/xmloff/source/text/txtprhdl.cxx index 32644e5f7f1c..2a6e3a32c0d5 100644 --- a/xmloff/source/text/txtprhdl.cxx +++ b/xmloff/source/text/txtprhdl.cxx @@ -245,6 +245,8 @@ static SvXMLEnumMapEntry<drawing::TextVerticalAdjust> const pXML_VerticalAlign_E { XML_TOKEN_INVALID, drawing::TextVerticalAdjust(0) } }; +namespace { + class XMLDropCapPropHdl_Impl : public XMLPropertyHandler { public: @@ -263,6 +265,8 @@ public: const SvXMLUnitConverter& ) const override; }; +} + bool XMLDropCapPropHdl_Impl::equals( const Any& r1, const Any& r2 ) const @@ -295,6 +299,8 @@ bool XMLDropCapPropHdl_Impl::exportXML( return false; } +namespace { + class XMLOpaquePropHdl_Impl : public XMLPropertyHandler { public: @@ -308,6 +314,8 @@ public: const SvXMLUnitConverter& ) const override; }; +} + bool XMLOpaquePropHdl_Impl::importXML( const OUString& rStrImpValue, Any& rValue, @@ -339,6 +347,8 @@ bool XMLOpaquePropHdl_Impl::exportXML( return true; } +namespace { + class XMLContourModePropHdl_Impl : public XMLPropertyHandler { public: @@ -352,6 +362,8 @@ public: const SvXMLUnitConverter& ) const override; }; +} + bool XMLContourModePropHdl_Impl::importXML( const OUString& rStrImpValue, Any& rValue, @@ -383,6 +395,8 @@ bool XMLContourModePropHdl_Impl::exportXML( return true; } +namespace { + class XMLParagraphOnlyPropHdl_Impl : public XMLPropertyHandler { public: @@ -396,6 +410,8 @@ public: const SvXMLUnitConverter& ) const override; }; +} + bool XMLParagraphOnlyPropHdl_Impl::importXML( const OUString& rStrImpValue, Any& rValue, @@ -441,6 +457,8 @@ SvXMLEnumMapEntry<WrapTextMode> const pXML_Wrap_Enum[] = { XML_TOKEN_INVALID, WrapTextMode(0) } }; +namespace { + class XMLWrapPropHdl_Impl : public XMLPropertyHandler { public: @@ -454,6 +472,8 @@ public: const SvXMLUnitConverter& ) const override; }; +} + bool XMLWrapPropHdl_Impl::importXML( const OUString& rStrImpValue, Any& rValue, @@ -486,6 +506,8 @@ bool XMLWrapPropHdl_Impl::exportXML( return bRet; } +namespace { + class XMLFrameProtectPropHdl_Impl : public XMLPropertyHandler { const OUString sVal; @@ -503,6 +525,8 @@ public: const SvXMLUnitConverter& ) const override; }; +} + bool XMLFrameProtectPropHdl_Impl::importXML( const OUString& rStrImpValue, Any& rValue, @@ -661,6 +685,8 @@ bool XMLTextColumnsPropertyHandler::exportXML( return false; } +namespace { + class XMLHoriMirrorPropHdl_Impl : public XMLPropertyHandler { public: @@ -674,6 +700,8 @@ public: const SvXMLUnitConverter& ) const override; }; +} + bool XMLHoriMirrorPropHdl_Impl::importXML( const OUString& rStrImpValue, Any& rValue, @@ -701,6 +729,8 @@ bool XMLHoriMirrorPropHdl_Impl::exportXML( return false; } +namespace { + class XMLGrfMirrorPropHdl_Impl : public XMLPropertyHandler { const OUString sVal; @@ -721,6 +751,8 @@ public: const SvXMLUnitConverter& ) const override; }; +} + bool XMLGrfMirrorPropHdl_Impl::importXML( const OUString& rStrImpValue, Any& rValue, @@ -795,6 +827,9 @@ SvXMLEnumMapEntry<sal_uInt16> const pXML_Emphasize_Enum[] = { XML_ACCENT, FontEmphasis::ACCENT_ABOVE }, { XML_TOKEN_INVALID, 0 } }; + +namespace { + class XMLTextEmphasizePropHdl_Impl : public XMLPropertyHandler { public: @@ -810,6 +845,8 @@ public: const SvXMLUnitConverter& ) const override; }; +} + bool XMLTextEmphasizePropHdl_Impl::importXML( const OUString& rStrImpValue, Any& rValue, @@ -891,6 +928,8 @@ bool XMLTextEmphasizePropHdl_Impl::exportXML( return bRet; } +namespace { + class XMLTextCombineCharPropHdl_Impl : public XMLPropertyHandler { public: @@ -906,6 +945,8 @@ public: const SvXMLUnitConverter& ) const override; }; +} + bool XMLTextCombineCharPropHdl_Impl::importXML( const OUString& rStrImpValue, Any& rValue, @@ -930,6 +971,8 @@ bool XMLTextCombineCharPropHdl_Impl::exportXML( return (1 == rStrExpValue.getLength()); } +namespace { + class XMLTextRelWidthHeightPropHdl_Impl : public XMLPropertyHandler { public: @@ -945,6 +988,8 @@ public: const SvXMLUnitConverter& ) const override; }; +} + bool XMLTextRelWidthHeightPropHdl_Impl::importXML( const OUString& rStrImpValue, Any& rValue, @@ -977,6 +1022,8 @@ bool XMLTextRelWidthHeightPropHdl_Impl::exportXML( return bRet; } +namespace { + class XMLTextSyncWidthHeightPropHdl_Impl : public XMLPropertyHandler { const OUString sValue; @@ -995,6 +1042,8 @@ public: const SvXMLUnitConverter& ) const override; }; +} + bool XMLTextSyncWidthHeightPropHdl_Impl::importXML( const OUString& rStrImpValue, Any& rValue, @@ -1020,6 +1069,8 @@ bool XMLTextSyncWidthHeightPropHdl_Impl::exportXML( return bRet; } +namespace { + class XMLTextRotationAnglePropHdl_Impl : public XMLPropertyHandler { @@ -1036,6 +1087,8 @@ public: const SvXMLUnitConverter& ) const override; }; +} + bool XMLTextRotationAnglePropHdl_Impl::importXML( const OUString& rStrImpValue, Any& rValue, @@ -1077,6 +1130,8 @@ bool XMLTextRotationAnglePropHdl_Impl::exportXML( return bRet; } +namespace { + class XMLNumber8OneBasedHdl : public XMLPropertyHandler { @@ -1093,6 +1148,8 @@ public: const SvXMLUnitConverter& ) const override; }; +} + bool XMLNumber8OneBasedHdl::importXML( const OUString& rStrImpValue, Any& rValue, @@ -1119,6 +1176,8 @@ bool XMLNumber8OneBasedHdl::exportXML( return bRet; } +namespace { + class XMLGraphicPropertyHandler : public XMLPropertyHandler { public: @@ -1139,6 +1198,8 @@ public: virtual bool equals(const css::uno::Any& rAny1, const css::uno::Any& rAny2) const override; }; +} + bool XMLGraphicPropertyHandler::equals(const Any& rAny1, const Any& rAny2) const { uno::Reference<graphic::XGraphic> xGraphic1; diff --git a/xmloff/source/transform/ChartPlotAreaOASISTContext.cxx b/xmloff/source/transform/ChartPlotAreaOASISTContext.cxx index 187333016852..a4fcb6129eba 100644 --- a/xmloff/source/transform/ChartPlotAreaOASISTContext.cxx +++ b/xmloff/source/transform/ChartPlotAreaOASISTContext.cxx @@ -32,6 +32,8 @@ using namespace ::xmloff::token; using ::com::sun::star::uno::Reference; +namespace { + class XMLAxisOASISContext : public XMLPersElemContentTContext { public: @@ -53,6 +55,8 @@ private: bool m_bHasCategories; }; +} + XMLAxisOASISContext::XMLAxisOASISContext( XMLTransformerBase& rTransformer, const OUString& rQName, diff --git a/xmloff/source/transform/MergeElemTContext.cxx b/xmloff/source/transform/MergeElemTContext.cxx index ac10b3044282..3d0a7543a6a4 100644 --- a/xmloff/source/transform/MergeElemTContext.cxx +++ b/xmloff/source/transform/MergeElemTContext.cxx @@ -30,6 +30,8 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::xml::sax; using namespace ::xmloff::token; +namespace { + class XMLParagraphTransformerContext : public XMLTransformerContext { public: @@ -44,6 +46,8 @@ public: const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; }; +} + XMLParagraphTransformerContext::XMLParagraphTransformerContext( XMLTransformerBase& rImp, const OUString& rQName ) : @@ -61,6 +65,8 @@ rtl::Reference<XMLTransformerContext> XMLParagraphTransformerContext::CreateChil rQName, true ); } +namespace { + class XMLPersTextContentRNGTransformTContext : public XMLPersTextContentTContext { public: @@ -73,6 +79,8 @@ public: virtual void Characters( const OUString& rChars ) override; }; +} + XMLPersTextContentRNGTransformTContext::XMLPersTextContentRNGTransformTContext( XMLTransformerBase& rTransformer, const OUString& rQName, diff --git a/xmloff/source/transform/OOo2Oasis.cxx b/xmloff/source/transform/OOo2Oasis.cxx index 1e6055ebec14..2badb088e673 100644 --- a/xmloff/source/transform/OOo2Oasis.cxx +++ b/xmloff/source/transform/OOo2Oasis.cxx @@ -1090,6 +1090,8 @@ static XMLTokenEnum const aTokenMap[] = XML_TOKEN_END }; +namespace { + class XMLDocumentTransformerContext_Impl : public XMLTransformerContext { OUString const m_aElemQName; @@ -1107,6 +1109,8 @@ public: virtual void EndElement() override; }; +} + XMLDocumentTransformerContext_Impl::XMLDocumentTransformerContext_Impl( XMLTransformerBase& rImp, const OUString& rQName ) : @@ -1229,6 +1233,8 @@ void XMLDocumentTransformerContext_Impl::EndElement() GetTransformer().SetClass( m_aOldClass ); } +namespace { + class XMLBodyTransformerContext_Impl : public XMLTransformerContext { OUString m_aClassQName; @@ -1241,6 +1247,8 @@ public: virtual void EndElement() override; }; +} + XMLBodyTransformerContext_Impl::XMLBodyTransformerContext_Impl( XMLTransformerBase& rImp, const OUString& rQName ) : @@ -1283,6 +1291,8 @@ void XMLBodyTransformerContext_Impl::EndElement() XMLTransformerContext::EndElement(); } +namespace { + class XMLTabStopOOoTContext_Impl : public XMLPersElemContentTContext { public: @@ -1292,6 +1302,8 @@ public: virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; }; +} + XMLTabStopOOoTContext_Impl::XMLTabStopOOoTContext_Impl( XMLTransformerBase& rImp, const OUString& rQName ) : @@ -1370,6 +1382,8 @@ void XMLTabStopOOoTContext_Impl::StartElement( XMLPersElemContentTContext::StartElement( xAttrList ); } +namespace { + class XMLTrackedChangesOOoTContext_Impl : public XMLTransformerContext { sal_uInt16 const m_nPrefix; @@ -1384,6 +1398,8 @@ public: virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; }; +} + XMLTrackedChangesOOoTContext_Impl::XMLTrackedChangesOOoTContext_Impl( XMLTransformerBase& rImp, const OUString& rQName, @@ -1435,6 +1451,8 @@ void XMLTrackedChangesOOoTContext_Impl::StartElement( XMLTransformerContext::StartElement( rAttrList ); } +namespace { + class XMLTableOOoTransformerContext_Impl : public XMLTransformerContext { OUString const m_aElemQName; @@ -1447,6 +1465,8 @@ public: virtual void EndElement() override; }; +} + XMLTableOOoTransformerContext_Impl::XMLTableOOoTransformerContext_Impl( XMLTransformerBase& rImp, const OUString& rQName ) : diff --git a/xmloff/source/transform/Oasis2OOo.cxx b/xmloff/source/transform/Oasis2OOo.cxx index 0f55019aa7b9..896b424f87e0 100644 --- a/xmloff/source/transform/Oasis2OOo.cxx +++ b/xmloff/source/transform/Oasis2OOo.cxx @@ -1148,6 +1148,8 @@ static XMLTokenEnum const aTokenMap[] = XML_DOT_DOT_DASH, XML_WAVE, XML_SMALL_WAVE, XML_TOKEN_END }; +namespace { + class XMLTableTransformerContext_Impl : public XMLTransformerContext { OUString m_aElemQName; @@ -1160,6 +1162,8 @@ public: virtual void EndElement() override; }; +} + XMLTableTransformerContext_Impl::XMLTableTransformerContext_Impl( XMLTransformerBase& rImp, const OUString& rQName ) : @@ -1240,6 +1244,8 @@ void XMLTableTransformerContext_Impl::EndElement() GetTransformer().GetDocHandler()->endElement( m_aElemQName ); } +namespace { + class XMLBodyOASISTransformerContext_Impl : public XMLTransformerContext { bool m_bFirstChild; @@ -1257,6 +1263,8 @@ public: virtual void EndElement() override; }; +} + XMLBodyOASISTransformerContext_Impl::XMLBodyOASISTransformerContext_Impl( XMLTransformerBase& rImp, const OUString& rQName ) : @@ -1292,6 +1300,8 @@ void XMLBodyOASISTransformerContext_Impl::EndElement() XMLTransformerContext::EndElement(); } +namespace { + class XMLTabStopOASISTContext_Impl : public XMLPersElemContentTContext { public: @@ -1301,6 +1311,8 @@ public: virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; }; +} + XMLTabStopOASISTContext_Impl::XMLTabStopOASISTContext_Impl( XMLTransformerBase& rImp, const OUString& rQName ) : @@ -1411,6 +1423,8 @@ void XMLTabStopOASISTContext_Impl::StartElement( XMLPersElemContentTContext::StartElement( xAttrList ); } +namespace { + class XMLConfigItemTContext_Impl : public XMLTransformerContext { OUString m_aContent; @@ -1428,6 +1442,8 @@ public: virtual void Characters( const OUString& rChars ) override; }; +} + XMLConfigItemTContext_Impl::XMLConfigItemTContext_Impl( XMLTransformerBase& rImp, const OUString& rQName ) : @@ -1512,6 +1528,8 @@ void XMLConfigItemTContext_Impl::EndElement() XMLTransformerContext::EndElement(); } +namespace { + class XMLTrackedChangesOASISTContext_Impl : public XMLTransformerContext { OUString const m_aAttrQName; @@ -1526,6 +1544,8 @@ public: virtual void StartElement( const css::uno::Reference< css::xml::sax::XAttributeList >& xAttrList ) override; }; +} + XMLTrackedChangesOASISTContext_Impl::XMLTrackedChangesOASISTContext_Impl( XMLTransformerBase& rImp, const OUString& rQName, diff --git a/xmloff/source/transform/PersMixedContentTContext.cxx b/xmloff/source/transform/PersMixedContentTContext.cxx index 6d5342a09df3..f892530ac111 100644 --- a/xmloff/source/transform/PersMixedContentTContext.cxx +++ b/xmloff/source/transform/PersMixedContentTContext.cxx @@ -25,6 +25,8 @@ using namespace ::com::sun::star::uno; using namespace ::com::sun::star::xml::sax; +namespace { + class XMLPersTextTContext_Impl : public XMLTransformerContext { OUString m_aCharacters; @@ -45,6 +47,8 @@ public: virtual void Export() override; }; +} + XMLPersTextTContext_Impl::XMLPersTextTContext_Impl( XMLTransformerBase& rImp, const OUString& rChars ) : diff --git a/xmloff/source/transform/StyleOOoTContext.cxx b/xmloff/source/transform/StyleOOoTContext.cxx index 00f429ee721b..584ae5985790 100644 --- a/xmloff/source/transform/StyleOOoTContext.cxx +++ b/xmloff/source/transform/StyleOOoTContext.cxx @@ -140,6 +140,8 @@ static const sal_uInt16 aElemActionMaps[XML_PROP_TYPE_END] = PROP_OOO_CHART_ELEM_ACTIONS }; +namespace { + class XMLTypedPropertiesOOoTContext_Impl : public XMLPersElemContentTContext { css::uno::Reference< css::xml::sax::XAttributeList > m_xAttrList; @@ -159,6 +161,8 @@ public: virtual void Export() override; }; +} + XMLTypedPropertiesOOoTContext_Impl::XMLTypedPropertiesOOoTContext_Impl( XMLTransformerBase& rImp, const OUString& rQName ) : @@ -202,6 +206,8 @@ void XMLTypedPropertiesOOoTContext_Impl::Export() } } +namespace { + class XMLPropertiesOOoTContext_Impl : public XMLTransformerContext { ::rtl::Reference < XMLTypedPropertiesOOoTContext_Impl > @@ -244,6 +250,8 @@ public: virtual bool IsPersistent() const override; }; +} + XMLTypedPropertiesOOoTContext_Impl *XMLPropertiesOOoTContext_Impl::GetPropContext( XMLPropType eType ) diff --git a/xmloff/source/xforms/xformsexport.cxx b/xmloff/source/xforms/xformsexport.cxx index 35b10383f6d4..2235af1e2079 100644 --- a/xmloff/source/xforms/xformsexport.cxx +++ b/xmloff/source/xforms/xformsexport.cxx @@ -103,6 +103,9 @@ static void exportXFormsSchemas( SvXMLExport&, const Reference<css::xforms::XMod typedef OUString (*convert_t)( const Any& ); + +namespace { + struct ExportTable { const sal_Char* pPropertyName; @@ -110,6 +113,9 @@ struct ExportTable sal_uInt16 const nToken; convert_t const aConverter; }; + +} + static void lcl_export( const Reference<XPropertySet>& rPropertySet, SvXMLExport& rExport, const ExportTable* pTable ); diff --git a/xmlscript/source/xml_helper/xml_byteseq.cxx b/xmlscript/source/xml_helper/xml_byteseq.cxx index 23322324bf4e..693ef301384e 100644 --- a/xmlscript/source/xml_helper/xml_byteseq.cxx +++ b/xmlscript/source/xml_helper/xml_byteseq.cxx @@ -32,6 +32,8 @@ using namespace com::sun::star::uno; namespace xmlscript { +namespace { + class BSeqInputStream : public ::cppu::WeakImplHelper< io::XInputStream > { @@ -55,6 +57,8 @@ public: virtual void SAL_CALL closeInput() override; }; +} + sal_Int32 BSeqInputStream::readBytes( Sequence< sal_Int8 > & rData, sal_Int32 nBytesToRead ) { @@ -91,6 +95,8 @@ void BSeqInputStream::closeInput() { } +namespace { + class BSeqOutputStream : public ::cppu::WeakImplHelper< io::XOutputStream > { @@ -108,6 +114,8 @@ public: virtual void SAL_CALL closeOutput() override; }; +} + void BSeqOutputStream::writeBytes( Sequence< sal_Int8 > const & rData ) { sal_Int32 nPos = _seq->size(); diff --git a/xmlscript/source/xml_helper/xml_impctx.cxx b/xmlscript/source/xml_helper/xml_impctx.cxx index 6391734cac01..b696577b90da 100644 --- a/xmlscript/source/xml_helper/xml_impctx.cxx +++ b/xmlscript/source/xml_helper/xml_impctx.cxx @@ -56,6 +56,8 @@ OUString getImplementationName_DocumentHandlerImpl() typedef std::unordered_map< OUString, sal_Int32 > t_OUString2LongMap; +namespace { + struct PrefixEntry { ::std::vector< sal_Int32 > m_Uids; @@ -64,9 +66,13 @@ struct PrefixEntry { m_Uids.reserve( 4 ); } }; +} + typedef std::unordered_map< OUString, std::unique_ptr<PrefixEntry> > t_OUString2PrefixMap; +namespace { + struct ElementEntry { Reference< xml::input::XElement > m_xElement; @@ -163,6 +169,8 @@ public: virtual OUString SAL_CALL getUriByUid( sal_Int32 Uid ) override; }; +} + static OUString const g_sXMLNS_PREFIX_UNKNOWN( "<<< unknown prefix >>>" ); static OUString const g_sXMLNS( "xmlns" ); @@ -293,6 +301,8 @@ inline void DocumentHandlerImpl::getElementName( nColonPos >= 0 ? rQName.copy( 0, nColonPos ) : OUString() ); } +namespace { + class ExtendedAttributes : public ::cppu::WeakImplHelper< xml::input::XAttributes > { @@ -330,6 +340,8 @@ public: sal_Int32 nIndex ) override; }; +} + inline ExtendedAttributes::ExtendedAttributes( sal_Int32 nAttributes, std::unique_ptr<sal_Int32[]> pUids, diff --git a/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx b/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx index 22c891c47384..6b3d9c425417 100644 --- a/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx +++ b/xmlscript/source/xmldlg_imexp/xmldlg_addfunc.cxx @@ -32,6 +32,8 @@ using namespace ::com::sun::star::frame; namespace xmlscript { +namespace { + class InputStreamProvider : public ::cppu::WeakImplHelper< io::XInputStreamProvider > { @@ -46,6 +48,9 @@ public: // XInputStreamProvider virtual uno::Reference< io::XInputStream > SAL_CALL createInputStream() override; }; + +} + uno::Reference< io::XInputStream > InputStreamProvider::createInputStream() { return ::xmlscript::createInputStream( _bytes ); diff --git a/xmlsecurity/qa/unit/signing/signing.cxx b/xmlsecurity/qa/unit/signing/signing.cxx index f2039b609e7e..7c1d8292c2bc 100644 --- a/xmlsecurity/qa/unit/signing/signing.cxx +++ b/xmlsecurity/qa/unit/signing/signing.cxx @@ -1198,6 +1198,8 @@ CPPUNIT_TEST_FIXTURE(SigningTest, testDropMacroTemplateSignature) SignatureState::NOSIGNATURES, ODFVER_012_TEXT); } +namespace +{ class Resetter { private: @@ -1221,6 +1223,7 @@ public: } } }; +} /// Test if a macro signature from a OTT 1.0 template is preserved for ODT 1.0 CPPUNIT_TEST_FIXTURE(SigningTest, testPreserveMacroTemplateSignature10) diff --git a/xmlsecurity/source/component/certificatecontainer.cxx b/xmlsecurity/source/component/certificatecontainer.cxx index 648d72c13c20..7e9db35583ca 100644 --- a/xmlsecurity/source/component/certificatecontainer.cxx +++ b/xmlsecurity/source/component/certificatecontainer.cxx @@ -34,6 +34,8 @@ using namespace ::com::sun::star; using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; +namespace { + class CertificateContainer : public ::cppu::WeakImplHelper<css::lang::XServiceInfo, css::security::XCertificateContainer> { @@ -62,6 +64,8 @@ public: virtual css::uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; }; +} + bool CertificateContainer::searchMap( const OUString & url, const OUString & certificate_name, Map &_certMap ) { diff --git a/xmlsecurity/source/component/documentdigitalsignatures.cxx b/xmlsecurity/source/component/documentdigitalsignatures.cxx index dcfaad0af773..7c3ec4232b80 100644 --- a/xmlsecurity/source/component/documentdigitalsignatures.cxx +++ b/xmlsecurity/source/component/documentdigitalsignatures.cxx @@ -66,6 +66,8 @@ using namespace css::lang; using namespace css::security; using namespace css::xml::crypto; +namespace { + class DocumentDigitalSignatures : public cppu::WeakImplHelper<css::security::XDocumentDigitalSignatures, css::lang::XInitialization, css::lang::XServiceInfo> @@ -190,6 +192,8 @@ public: } }; +} + DocumentDigitalSignatures::DocumentDigitalSignatures( const Reference< XComponentContext >& rxCtx ): mxCtx(rxCtx), m_sODFVersion(ODFVER_012_TEXT), diff --git a/xmlsecurity/source/xmlsec/nss/secerror.cxx b/xmlsecurity/source/xmlsec/nss/secerror.cxx index 2b3438a356f6..b7e623ce00b8 100644 --- a/xmlsecurity/source/xmlsec/nss/secerror.cxx +++ b/xmlsecurity/source/xmlsec/nss/secerror.cxx @@ -24,11 +24,14 @@ #include <certt.h> #include <sal/log.hxx> +namespace { + struct ErrDesc { PRErrorCode const errNum; const char * errString; }; +} const ErrDesc allDesc[] = { diff --git a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx index 4c03131c07f2..1ac8d052b5c3 100644 --- a/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/securityenvironment_nssimpl.cxx @@ -71,6 +71,7 @@ template <> struct default_delete<PRArenaPool> static X509Certificate_NssImpl* NssCertToXCert( CERTCertificate* cert ) ; static X509Certificate_NssImpl* NssPrivKeyToXCert( SECKEYPrivateKey* ) ; +namespace { struct UsageDescription { @@ -88,6 +89,7 @@ struct UsageDescription {} }; +} static char* GetPasswordFunction( PK11SlotInfo* pSlot, PRBool bRetry, void* /*arg*/ ) { diff --git a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx index 707f050330f1..beefb82e0748 100644 --- a/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/seinitializer_nssimpl.cxx @@ -104,6 +104,8 @@ uno::Sequence< OUString > SAL_CALL SEInitializer_NssImpl::getSupportedServiceNam return seqServiceNames; } +namespace { + class NSSInitializer_NssImpl : public SEInitializer_NssImpl { public: @@ -112,6 +114,8 @@ public: uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; }; +} + NSSInitializer_NssImpl::NSSInitializer_NssImpl(const uno::Reference<uno::XComponentContext>& xContext) : SEInitializer_NssImpl(xContext) { diff --git a/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx index 18c0bd3ecd5e..2566a40accfb 100644 --- a/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/xmlsecuritycontext_nssimpl.cxx @@ -32,6 +32,8 @@ using namespace ::com::sun::star::lang ; using ::com::sun::star::xml::crypto::XSecurityEnvironment ; using ::com::sun::star::xml::crypto::XXMLSecurityContext ; +namespace { + class XMLSecurityContext_NssImpl : public ::cppu::WeakImplHelper<xml::crypto::XXMLSecurityContext, lang::XServiceInfo> { @@ -67,6 +69,8 @@ public: virtual uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; }; +} + XMLSecurityContext_NssImpl::XMLSecurityContext_NssImpl() : m_nDefaultEnvIndex(-1) { diff --git a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx index c39f6cc72f76..9f2c8e43acdc 100644 --- a/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx +++ b/xmlsecurity/source/xmlsec/nss/xmlsignature_nssimpl.cxx @@ -54,6 +54,8 @@ template <> struct default_delete<xmlSecDSigCtx> }; } +namespace { + class XMLSignature_NssImpl : public ::cppu::WeakImplHelper<xml::crypto::XXMLSignature, lang::XServiceInfo> { @@ -77,6 +79,8 @@ public: virtual uno::Sequence<OUString> SAL_CALL getSupportedServiceNames() override; }; +} + XMLSignature_NssImpl::XMLSignature_NssImpl() { } |