summaryrefslogtreecommitdiffstats
path: root/include
diff options
context:
space:
mode:
authorStephan Bergmann <sbergman@redhat.com>2017-03-05 13:19:41 +0100
committerStephan Bergmann <sbergman@redhat.com>2017-03-05 15:10:37 +0000
commit177f5c2e505b7978fc232a891577a448e49b290d (patch)
tree8fcb4ca27cfdb49ee44d884809c60455b5ecfa03 /include
parentIs gbuildtojson missing support for ExternalPackage? (diff)
downloadcore-177f5c2e505b7978fc232a891577a448e49b290d.tar.gz
core-177f5c2e505b7978fc232a891577a448e49b290d.zip
Proper fix for multiply defined SfxEnumItem<sal_uInt16> with MSVC
With --disable-pch the original hack from f091259ad2ec1590714645839668580cd7b8c7c4 "convert SfxEnumItem to type-safe template class" doesn't happen to work: When linking sd, the occurrences of SfxEnumItem<sal_uInt16> in sd/inc/sdattr.hxx clash with those from editeng (where LanguageType is a typedef for sal_uInt16) and svl (as the respective include files from editeng and svl happen to not be included). For whatever reason, the explicit instantiation declaration without a __declspec(...) in include/svl/eitem.hxx doesn't seem to make a difference (at least with MSVC 2015 Update 3). Change-Id: I51b5943fe19a7184db9414192c6364f7c26b79eb Reviewed-on: https://gerrit.libreoffice.org/34903 Reviewed-by: Stephan Bergmann <sbergman@redhat.com> Tested-by: Stephan Bergmann <sbergman@redhat.com>
Diffstat (limited to 'include')
-rw-r--r--include/editeng/langitem.hxx10
-rw-r--r--include/svl/aeitem.hxx14
-rw-r--r--include/svl/eitem.hxx8
3 files changed, 22 insertions, 10 deletions
diff --git a/include/editeng/langitem.hxx b/include/editeng/langitem.hxx
index e2ae3e8b8186..81bbe052e460 100644
--- a/include/editeng/langitem.hxx
+++ b/include/editeng/langitem.hxx
@@ -32,7 +32,15 @@ class SvXMLUnitConverter;
This item describes a Language.
*/
-class EDITENG_DLLPUBLIC SvxLanguageItem : public SfxEnumItem<LanguageType>
+// MSVC hack:
+class SvxLanguageItem_Base: public SfxEnumItem<LanguageType> {
+protected:
+ explicit SvxLanguageItem_Base(sal_uInt16 nWhich, LanguageType nValue):
+ SfxEnumItem(nWhich, nValue)
+ {}
+};
+
+class EDITENG_DLLPUBLIC SvxLanguageItem : public SvxLanguageItem_Base
{
public:
static SfxPoolItem* CreateDefault();
diff --git a/include/svl/aeitem.hxx b/include/svl/aeitem.hxx
index ee38084a04c7..d203e2383f12 100644
--- a/include/svl/aeitem.hxx
+++ b/include/svl/aeitem.hxx
@@ -26,7 +26,19 @@
class SfxAllEnumValueArr;
-class SVL_DLLPUBLIC SfxAllEnumItem: public SfxEnumItem<sal_uInt16>
+// MSVC hack:
+class SfxAllEnumItem_Base: public SfxEnumItem<sal_uInt16> {
+protected:
+ explicit SfxAllEnumItem_Base(sal_uInt16 nWhich, sal_uInt16 nValue):
+ SfxEnumItem(nWhich, nValue)
+ {}
+
+ explicit SfxAllEnumItem_Base(sal_uInt16 const nWhich, SvStream & rStream):
+ SfxEnumItem(nWhich, rStream)
+ {}
+};
+
+class SVL_DLLPUBLIC SfxAllEnumItem: public SfxAllEnumItem_Base
{
SfxAllEnumValueArr* pValues;
std::vector<sal_uInt16>* pDisabledValues;
diff --git a/include/svl/eitem.hxx b/include/svl/eitem.hxx
index 93c122b10888..49b932985c2d 100644
--- a/include/svl/eitem.hxx
+++ b/include/svl/eitem.hxx
@@ -82,14 +82,6 @@ public:
}
};
-// We need to have this one instantiated only once to prevent LNK2005 "already defined" on 32-bit MSVC.
-// But then we run into the problem that "extern" and SVL_DLLPUBLIC are mutually exclusive on templates for MSVC.
-#ifdef _WIN32
-extern template class SfxEnumItem<sal_uInt16>;
-#else
-extern template class SVL_DLLPUBLIC SfxEnumItem<sal_uInt16>;
-#endif
-
class SVL_DLLPUBLIC SfxBoolItem
: public SfxPoolItem
{