include/svl/style.hxx                         |   14 ++++++++++++--
 include/svx/chinese_translation_unodialog.hxx |    7 ++++++-
 sd/inc/ResourceId.hxx                         |    7 ++++++-
 svl/source/items/style.cxx                    |    4 +---
 4 files changed, 25 insertions(+), 7 deletions(-)

New commits:
commit f5667d1e3b62da5bbae597725fdbf08a50cabba0
Author:     Mike Kaganski <mike.kagan...@collabora.com>
AuthorDate: Thu Jun 26 18:25:31 2025 +0500
Commit:     Mike Kaganski <mike.kagan...@collabora.com>
CommitDate: Thu Jun 26 18:12:14 2025 +0200

    Fix error LNK2005 in MSVC after recent sd changes
    
    Seen as:
    
    isvl.lib(svllo.dll) : error LNK2005: "public: virtual class 
com::sun::star::uno::Any __cdecl cppu::WeakImplHelper<>::queryInterface(class 
com::sun::star::uno::Type const &)" 
(?queryInterface@?$WeakImplHelper@$$V@cppu@@UEAA?AVAny@uno@star@sun@com@@AEBVType@4567@@Z)
 already defined in Configuration.o
    isvl.lib(svllo.dll) : error LNK2005: "public: virtual void __cdecl 
cppu::WeakImplHelper<>::acquire(void)" 
(?acquire@?$WeakImplHelper@$$V@cppu@@UEAAXXZ) already defined in Configuration.o
    isvl.lib(svllo.dll) : error LNK2005: "public: virtual void __cdecl 
cppu::WeakImplHelper<>::release(void)" 
(?release@?$WeakImplHelper@$$V@cppu@@UEAAXXZ) already defined in Configuration.o
    isvl.lib(svllo.dll) : error LNK2005: "public: virtual class 
com::sun::star::uno::Sequence<class com::sun::star::uno::Type> __cdecl 
cppu::WeakImplHelper<>::getTypes(void)" 
(?getTypes@?$WeakImplHelper@$$V@cppu@@UEAA?AV?$Sequence@VType@uno@star@sun@com@@@uno@star@sun@com@@XZ)
 already defined in Configuration.o
    C:\louild\instdir\program\sdlo.dll : fatal error LNK1169: one or more 
multiply defined symbols found
    
    Change-Id: I3d52651f37952cb5f7c68959e8b300c235a8bac5
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/187052
    Tested-by: Jenkins
    Reviewed-by: Mike Kaganski <mike.kagan...@collabora.com>
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/include/svl/style.hxx b/include/svl/style.hxx
index 0073d5b93ee9..0144ddd125ed 100644
--- a/include/svl/style.hxx
+++ b/include/svl/style.hxx
@@ -110,7 +110,12 @@ SfxStyleSheetHint( SfxHintId::StyleSheetErased, *p ) from:
    SfxStyleSheetBasePool::Clear()
 */
 
-class SVL_DLLPUBLIC SfxStyleSheetBase : public cppu::WeakImplHelper<>
+// avoid LNK2005 duplicate WeakImplHelper definitions with MSVC
+class SAL_DLLPUBLIC_TEMPLATE SfxStyleSheetBase_Base : public 
cppu::WeakImplHelper<>
+{
+};
+
+class SVL_DLLPUBLIC SfxStyleSheetBase : public SfxStyleSheetBase_Base
 {
 private:
     friend class SfxStyleSheetBasePool;
@@ -225,7 +230,12 @@ friend class SfxStyleSheetBasePool;
 
 class SfxStyleSheetBasePool_Impl;
 
-class SVL_DLLPUBLIC SfxStyleSheetBasePool: public SfxBroadcaster, public 
cppu::WeakImplHelper<>
+// avoid LNK2005 duplicate WeakImplHelper definitions with MSVC
+class SAL_DLLPUBLIC_TEMPLATE SfxStyleSheetBasePool_Base : public 
cppu::WeakImplHelper<>
+{
+};
+
+class SVL_DLLPUBLIC SfxStyleSheetBasePool : public SfxBroadcaster, public 
SfxStyleSheetBasePool_Base
 {
 friend class SfxStyleSheetIterator;
 friend class SfxStyleSheetBase;
diff --git a/include/svx/chinese_translation_unodialog.hxx 
b/include/svx/chinese_translation_unodialog.hxx
index b75796fc1041..743d4d935e7e 100644
--- a/include/svx/chinese_translation_unodialog.hxx
+++ b/include/svx/chinese_translation_unodialog.hxx
@@ -55,7 +55,12 @@ The dialog gets this information from the registry on 
execute and writes it back
 
 class ChineseTranslationDialog;
 
-class TEXTCONVERSIONDLGS_DLLPUBLIC ChineseTranslation_UnoDialog final : public 
::cppu::WeakImplHelper <>
+// avoid LNK2005 duplicate WeakImplHelper definitions with MSVC
+class SAL_DLLPUBLIC_TEMPLATE ChineseTranslation_UnoDialog_Base : public 
cppu::WeakImplHelper<>
+{
+};
+
+class TEXTCONVERSIONDLGS_DLLPUBLIC ChineseTranslation_UnoDialog final : public 
ChineseTranslation_UnoDialog_Base
 {
 public:
     ChineseTranslation_UnoDialog(const css::uno::Reference< css::awt::XWindow 
>& xParentWindow);
diff --git a/sd/inc/ResourceId.hxx b/sd/inc/ResourceId.hxx
index b61df4918dae..11312ce598d3 100644
--- a/sd/inc/ResourceId.hxx
+++ b/sd/inc/ResourceId.hxx
@@ -33,6 +33,11 @@ namespace com::sun::star::uno { template <class 
interface_type> class WeakRefere
 
 namespace sd::framework {
 
+// avoid LNK2005 duplicate WeakImplHelper definitions with MSVC
+class SAL_DLLPUBLIC_TEMPLATE ResourceId_Base : public cppu::WeakImplHelper<>
+{
+};
+
 /** A resource id uses a set of URLs to unambiguously specify a resource of
     the drawing framework.
     <p>Resources of the drawing framework are panes, views, tool bars, and
@@ -48,7 +53,7 @@ namespace sd::framework {
     method on its creation.  Arguments are only available through the
     getFullResourceURL().  The getResourceURL() method strips them away.</p>
 */
-class SD_DLLPUBLIC ResourceId final : public ::cppu::WeakImplHelper<>
+class SD_DLLPUBLIC ResourceId final : public ResourceId_Base
 {
 public:
     /** Create a new, empty resource id.
diff --git a/svl/source/items/style.cxx b/svl/source/items/style.cxx
index a5144962632e..9a568272372a 100644
--- a/svl/source/items/style.cxx
+++ b/svl/source/items/style.cxx
@@ -120,8 +120,7 @@ SfxStyleSheetBase::SfxStyleSheetBase( const OUString& 
rName, SfxStyleSheetBasePo
 }
 
 SfxStyleSheetBase::SfxStyleSheetBase( const SfxStyleSheetBase& r )
-    : WeakImplHelper()
-    , m_pPool( r.m_pPool )
+    : m_pPool( r.m_pPool )
     , nFamily( r.nFamily )
     , aName( r.aName )
     , aParent( r.aParent )
@@ -566,7 +565,6 @@ SfxStyleSheetBasePool::SfxStyleSheetBasePool( SfxItemPool& 
r ) :
 
 SfxStyleSheetBasePool::SfxStyleSheetBasePool( const SfxStyleSheetBasePool& r ) 
:
     SfxBroadcaster( r ),
-    WeakImplHelper(),
     pImpl(new SfxStyleSheetBasePool_Impl),
     rPool(r.rPool)
 {

Reply via email to