diff options
author | Stephan Bergmann <sbergman@redhat.com> | 2019-11-19 16:32:49 +0100 |
---|---|---|
committer | Stephan Bergmann <sbergman@redhat.com> | 2019-11-22 12:57:32 +0100 |
commit | f853ec317f6af1b8c65cc5bd758371689c75118d (patch) | |
tree | b86d729bf9a9465ee619ead3b5635efa62a1804e /dbaccess | |
parent | f31d36966bceb90e261cbecd42634bde4448d527 (diff) |
Extend loplugin:external to warn about classes
...following up on 314f15bff08b76bf96acf99141776ef64d2f1355 "Extend
loplugin:external to warn about enums".
Cases where free functions were moved into an unnamed namespace along with a
class, to not break ADL, are in:
filter/source/svg/svgexport.cxx
sc/source/filter/excel/xelink.cxx
sc/source/filter/excel/xilink.cxx
svx/source/sdr/contact/viewobjectcontactofunocontrol.cxx
All other free functions mentioning moved classes appear to be harmless and not
give rise to (silent, even) ADL breakage. (One remaining TODO in
compilerplugins/clang/external.cxx is that derived classes are not covered by
computeAffectedTypes, even though they could also be affected by ADL-breakage---
but don't seem to be in any acutal case across the code base.)
For friend declarations using elaborate type specifiers, like
class C1 {};
class C2 { friend class C1; };
* If C2 (but not C1) is moved into an unnamed namespace, the friend declaration
must be changed to not use an elaborate type specifier (i.e., "friend C1;"; see
C++17 [namespace.memdef]/3: "If the name in a friend declaration is neither
qualified nor a template-id and the declaration is a function or an
elaborated-type-specifier, the lookup to determine whether the entity has been
previously declared shall not consider any scopes outside the innermost
enclosing namespace.")
* If C1 (but not C2) is moved into an unnamed namespace, the friend declaration
must be changed too, see <https://gcc.gnu.org/bugzilla/show_bug.cgi?id=71882>
"elaborated-type-specifier friend not looked up in unnamed namespace".
Apart from that, to keep changes simple and mostly mechanical (which should help
avoid regressions), out-of-line definitions of class members have been left in
the enclosing (named) namespace. But explicit specializations of class
templates had to be moved into the unnamed namespace to appease
<https://gcc.gnu.org/bugzilla/show_bug.cgi?id=92598> "explicit specialization of
template from unnamed namespace using unqualified-id in enclosing namespace".
Also, accompanying declarations (of e.g. typedefs or static variables) that
could arguably be moved into the unnamed namespace too have been left alone.
And in some cases, mention of affected types in blacklists in other loplugins
needed to be adapted.
And sc/qa/unit/mark_test.cxx uses a hack of including other .cxx, one of which
is sc/source/core/data/segmenttree.cxx where e.g. ScFlatUInt16SegmentsImpl is
not moved into an unnamed namespace (because it is declared in
sc/inc/segmenttree.hxx), but its base ScFlatSegmentsImpl is. GCC warns about
such combinations with enabled-by-default -Wsubobject-linkage, but "The compiler
doesn’t give this warning for types defined in the main .C file, as those are
unlikely to have multiple definitions."
(<https://gcc.gnu.org/onlinedocs/gcc-9.2.0/gcc/Warning-Options.html>) The
warned-about classes also don't have multiple definitions in the given test, so
disable the warning when including the .cxx.
Change-Id: Ib694094c0d8168be68f8fe90dfd0acbb66a3f1e4
Reviewed-on: https://gerrit.libreoffice.org/83239
Tested-by: Jenkins
Reviewed-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'dbaccess')
35 files changed, 199 insertions, 5 deletions
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 ) |