diff options
-rw-r--r-- | Repository.mk | 11 | ||||
-rw-r--r-- | include/vcl/dllapi.h | 2 | ||||
-rw-r--r-- | include/vcl/print.hxx | 78 | ||||
-rw-r--r-- | solenv/clang-format/blacklist | 1 | ||||
-rw-r--r-- | vcl/Library_vcl.mk | 37 | ||||
-rw-r--r-- | vcl/Library_vclplug_win.mk | 98 | ||||
-rw-r--r-- | vcl/Module_vcl.mk | 1 | ||||
-rw-r--r-- | vcl/inc/fontselect.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/fontsubset.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/helpwin.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/opengl/FixedTextureAtlas.hxx | 6 | ||||
-rw-r--r-- | vcl/inc/opengl/PackedTextureAtlas.hxx | 6 | ||||
-rw-r--r-- | vcl/inc/salinst.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/salprn.hxx | 3 | ||||
-rw-r--r-- | vcl/inc/salsys.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/sft.hxx | 10 | ||||
-rw-r--r-- | vcl/inc/svdata.hxx | 2 | ||||
-rw-r--r-- | vcl/inc/vclpluginapi.h | 6 | ||||
-rw-r--r-- | vcl/source/app/svapp.cxx | 3 | ||||
-rw-r--r-- | vcl/win/app/salinst.cxx | 76 | ||||
-rw-r--r-- | vcl/win/app/salplug.cxx | 199 | ||||
-rw-r--r-- | vcl/win/window/salframe.cxx | 10 |
22 files changed, 396 insertions, 163 deletions
diff --git a/Repository.mk b/Repository.mk index b2c8c8c0d857..34ac4e5c6ae0 100644 --- a/Repository.mk +++ b/Repository.mk @@ -398,6 +398,8 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \ $(if $(MERGELIBS),merged) \ migrationoo2 \ migrationoo3 \ + mork \ + mozbootstrap \ msfilter \ $(call gb_Helper_optional,SCRIPTING,msforms) \ mtfrenderer \ @@ -456,9 +458,6 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \ ) \ vcl \ vclcanvas \ - $(if $(USING_X11), \ - vclplug_gen \ - ) \ writerperfect \ xmlscript \ xmlfa \ @@ -467,12 +466,14 @@ $(eval $(call gb_Helper_register_libraries_for_install,OOOLIBS,ooo, \ xof \ xsltdlg \ xsltfilter \ - mork \ - mozbootstrap \ + $(if $(USING_X11), \ + vclplug_gen \ + ) \ $(if $(filter $(OS),WNT), \ ado \ oleautobridge \ smplmail \ + vclplug_win \ wininetbe1 \ ) \ $(if $(filter $(OS),MACOSX), \ diff --git a/include/vcl/dllapi.h b/include/vcl/dllapi.h index b85e2ab87ce5..805d1cb00908 100644 --- a/include/vcl/dllapi.h +++ b/include/vcl/dllapi.h @@ -36,7 +36,7 @@ #define UITEST_DLLPUBLIC SAL_DLLPUBLIC_IMPORT #endif -#if defined UNX && ! defined MACOS +#if (defined UNX && ! defined MACOS) || defined _WIN32 #define VCL_PLUGIN_PUBLIC VCL_DLLPUBLIC #else #define VCL_PLUGIN_PUBLIC SAL_DLLPRIVATE diff --git a/include/vcl/print.hxx b/include/vcl/print.hxx index 85b9bd471786..d5f4f6d86635 100644 --- a/include/vcl/print.hxx +++ b/include/vcl/print.hxx @@ -203,28 +203,28 @@ private: bool mbInPrintPage; bool mbNewJobSetup; - SAL_DLLPRIVATE void ImplInitData(); - SAL_DLLPRIVATE void ImplInit( SalPrinterQueueInfo* pInfo ); - SAL_DLLPRIVATE void ImplInitDisplay(); - SAL_DLLPRIVATE static SalPrinterQueueInfo* + VCL_DLLPRIVATE void ImplInitData(); + VCL_DLLPRIVATE void ImplInit( SalPrinterQueueInfo* pInfo ); + VCL_DLLPRIVATE void ImplInitDisplay(); + VCL_DLLPRIVATE static SalPrinterQueueInfo* ImplGetQueueInfo( const OUString& rPrinterName, const OUString* pDriver ); - SAL_DLLPRIVATE void ImplUpdatePageData(); - SAL_DLLPRIVATE void ImplUpdateFontList(); - SAL_DLLPRIVATE void ImplFindPaperFormatForUserSize( JobSetup&, bool bMatchNearest ); + VCL_DLLPRIVATE void ImplUpdatePageData(); + VCL_DLLPRIVATE void ImplUpdateFontList(); + VCL_DLLPRIVATE void ImplFindPaperFormatForUserSize( JobSetup&, bool bMatchNearest ); - SAL_DLLPRIVATE bool StartJob( const OUString& rJobName, std::shared_ptr<vcl::PrinterController> const & ); + VCL_DLLPRIVATE bool StartJob( const OUString& rJobName, std::shared_ptr<vcl::PrinterController> const & ); - static SAL_DLLPRIVATE ErrCode + static VCL_DLLPRIVATE ErrCode ImplSalPrinterErrorCodeToVCL( SalPrinterError nError ); private: - SAL_DLLPRIVATE void EndJob(); + VCL_DLLPRIVATE void EndJob(); Printer( const Printer& rPrinter ) = delete; Printer& operator =( const Printer& rPrinter ) = delete; public: - SAL_DLLPRIVATE void ImplStartPage(); - SAL_DLLPRIVATE void ImplEndPage(); + VCL_DLLPRIVATE void ImplStartPage(); + VCL_DLLPRIVATE void ImplEndPage(); protected: virtual bool AcquireGraphics() const override; @@ -300,7 +300,7 @@ public: should the need arise to set the printer options outside vcl, also a method would have to be devised to not override these again internally */ - SAL_DLLPRIVATE void SetPrinterOptions( const PrinterOptions& rOptions ); + VCL_DLLPRIVATE void SetPrinterOptions( const PrinterOptions& rOptions ); const PrinterOptions& GetPrinterOptions() const { return( *mpPrinterOptions ); } bool SetOrientation( Orientation eOrient ); @@ -378,7 +378,7 @@ public: not exported, not usable outside vcl */ - static void SAL_DLLPRIVATE ImplPrintJob( const std::shared_ptr<vcl::PrinterController>& i_pController, + static void VCL_DLLPRIVATE ImplPrintJob( const std::shared_ptr<vcl::PrinterController>& i_pController, const JobSetup& i_rInitSetup ); }; @@ -529,36 +529,36 @@ public: // don't use outside vcl. Some of these are exported for // the benefit of vcl's plugins. // Still: DO NOT USE OUTSIDE VCL - VCL_PLUGIN_PUBLIC int getFilteredPageCount(); - SAL_DLLPRIVATE PageSize getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf, + int getFilteredPageCount(); + VCL_DLLPRIVATE PageSize getPageFile( int i_inUnfilteredPage, GDIMetaFile& rMtf, bool i_bMayUseCache = false ); - VCL_PLUGIN_PUBLIC PageSize getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, + PageSize getFilteredPageFile( int i_nFilteredPage, GDIMetaFile& o_rMtf, bool i_bMayUseCache = false ); - VCL_PLUGIN_PUBLIC void printFilteredPage( int i_nPage ); - SAL_DLLPRIVATE void setPrinter( const VclPtr<Printer>& ); - VCL_PLUGIN_PUBLIC void createProgressDialog(); - VCL_PLUGIN_PUBLIC bool isProgressCanceled() const; - SAL_DLLPRIVATE void setMultipage( const MultiPageSetup& ); - SAL_DLLPRIVATE const MultiPageSetup& + void printFilteredPage( int i_nPage ); + VCL_DLLPRIVATE void setPrinter( const VclPtr<Printer>& ); + void createProgressDialog(); + bool isProgressCanceled() const; + VCL_DLLPRIVATE void setMultipage( const MultiPageSetup& ); + VCL_DLLPRIVATE const MultiPageSetup& getMultipage() const; - VCL_PLUGIN_PUBLIC void setLastPage( bool i_bLastPage ); - SAL_DLLPRIVATE void setReversePrint( bool i_bReverse ); - SAL_DLLPRIVATE bool getReversePrint() const; - SAL_DLLPRIVATE void setPapersizeFromSetup( bool i_bPapersizeFromSetup ); - SAL_DLLPRIVATE bool getPapersizeFromSetup() const; - VCL_PLUGIN_PUBLIC void setPrinterModified( bool i_bPapersizeFromSetup ); - VCL_PLUGIN_PUBLIC bool getPrinterModified() const; - SAL_DLLPRIVATE void pushPropertiesToPrinter(); - SAL_DLLPRIVATE void resetPaperToLastConfigured(); - VCL_PLUGIN_PUBLIC void setJobState( css::view::PrintableState ); - SAL_DLLPRIVATE void setupPrinter( weld::Window* i_pDlgParent ); - - SAL_DLLPRIVATE int getPageCountProtected() const; - SAL_DLLPRIVATE css::uno::Sequence< css::beans::PropertyValue > + void setLastPage( bool i_bLastPage ); + VCL_DLLPRIVATE void setReversePrint( bool i_bReverse ); + VCL_DLLPRIVATE bool getReversePrint() const; + VCL_DLLPRIVATE void setPapersizeFromSetup( bool i_bPapersizeFromSetup ); + VCL_DLLPRIVATE bool getPapersizeFromSetup() const; + void setPrinterModified( bool i_bPapersizeFromSetup ); + bool getPrinterModified() const; + VCL_DLLPRIVATE void pushPropertiesToPrinter(); + VCL_DLLPRIVATE void resetPaperToLastConfigured(); + void setJobState( css::view::PrintableState ); + VCL_DLLPRIVATE void setupPrinter( weld::Window* i_pDlgParent ); + + VCL_DLLPRIVATE int getPageCountProtected() const; + VCL_DLLPRIVATE css::uno::Sequence< css::beans::PropertyValue > getPageParametersProtected( int i_nPage ) const; - SAL_DLLPRIVATE DrawModeFlags removeTransparencies( GDIMetaFile const & i_rIn, GDIMetaFile& o_rOut ); - SAL_DLLPRIVATE void resetPrinterOptions( bool i_bFileOutput ); + VCL_DLLPRIVATE DrawModeFlags removeTransparencies( GDIMetaFile const & i_rIn, GDIMetaFile& o_rOut ); + VCL_DLLPRIVATE void resetPrinterOptions( bool i_bFileOutput ); }; class VCL_DLLPUBLIC PrinterOptionsHelper diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist index 60b94466e9c8..09489f6e1d2f 100644 --- a/solenv/clang-format/blacklist +++ b/solenv/clang-format/blacklist @@ -18449,6 +18449,7 @@ vcl/unx/x11/xlimits.cxx vcl/win/app/saldata.cxx vcl/win/app/salinfo.cxx vcl/win/app/salinst.cxx +vcl/win/app/salplug.cxx vcl/win/app/salshl.cxx vcl/win/app/saltimer.cxx vcl/win/gdi/DWriteTextRenderer.cxx diff --git a/vcl/Library_vcl.mk b/vcl/Library_vcl.mk index f9df0a3a5f36..095e040154c9 100644 --- a/vcl/Library_vcl.mk +++ b/vcl/Library_vcl.mk @@ -731,52 +731,19 @@ endif ifeq ($(OS),WNT) $(eval $(call gb_Library_add_exception_objects,vcl,\ - vcl/opengl/win/gdiimpl \ vcl/opengl/win/WinDeviceInfo \ vcl/opengl/win/blocklist_parser \ - vcl/win/app/saldata \ - vcl/win/app/salinfo \ - vcl/win/app/salinst \ - vcl/win/app/salshl \ - vcl/win/app/saltimer \ - vcl/win/gdi/gdiimpl \ - vcl/win/gdi/salbmp \ - vcl/win/gdi/salgdi \ - vcl/win/gdi/salgdi2 \ - vcl/win/gdi/salfont \ - vcl/win/gdi/salgdi_gdiplus \ - vcl/win/gdi/salnativewidgets-luna \ - vcl/win/gdi/salprn \ - vcl/win/gdi/salvd \ - vcl/win/gdi/winlayout \ - vcl/win/gdi/DWriteTextRenderer \ - vcl/win/window/salframe \ - vcl/win/window/keynames \ - vcl/win/window/salmenu \ - vcl/win/window/salobj \ + vcl/win/app/salplug \ )) $(eval $(call gb_Library_use_system_win32_libs,vcl,\ - advapi32 \ - crypt32 \ - gdi32 \ - gdiplus \ - imm32 \ - mpr \ ole32 \ - shell32 \ - usp10 \ - uuid \ - version \ - winspool \ setupapi \ - shlwapi \ + version \ )) $(eval $(call gb_Library_add_nativeres,vcl,vcl/salsrc)) -endif -ifeq ($(OS),WNT) # HACK: dependency on icon themes so running unit tests don't # prevent delivering these by having open file handles on WNT $(eval $(call gb_Library_use_package,vcl,postprocess_images)) diff --git a/vcl/Library_vclplug_win.mk b/vcl/Library_vclplug_win.mk new file mode 100644 index 000000000000..97a83d436cc1 --- /dev/null +++ b/vcl/Library_vclplug_win.mk @@ -0,0 +1,98 @@ +# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*- +# +# This file is part of the LibreOffice project. +# +# This Source Code Form is subject to the terms of the Mozilla Public +# License, v. 2.0. If a copy of the MPL was not distributed with this +# file, You can obtain one at http://mozilla.org/MPL/2.0/. +# +# This file incorporates work covered by the following license notice: +# +# Licensed to the Apache Software Foundation (ASF) under one or more +# contributor license agreements. See the NOTICE file distributed +# with this work for additional information regarding copyright +# ownership. The ASF licenses this file to you under the Apache +# License, Version 2.0 (the "License"); you may not use this file +# except in compliance with the License. You may obtain a copy of +# the License at http://www.apache.org/licenses/LICENSE-2.0 . +# + +$(eval $(call gb_Library_Library,vclplug_win)) + +$(eval $(call gb_Library_set_include,vclplug_win,\ + $$(INCLUDE) \ + -I$(SRCDIR)/vcl/inc \ + -I$(SRCDIR)/vcl/inc/win \ +)) + +$(eval $(call gb_Library_add_defs,vclplug_win,\ + -DVCLPLUG_WIN_IMPLEMENTATION \ +)) + +$(eval $(call gb_Library_use_custom_headers,vclplug_win,\ + officecfg/registry \ +)) + +$(eval $(call gb_Library_use_sdk_api,vclplug_win)) + +$(eval $(call gb_Library_use_libraries,vclplug_win,\ + basegfx \ + comphelper \ + cppu \ + i18nlangtag \ + i18nutil \ + sal \ + salhelper \ + tl \ + utl \ + vcl \ +)) + +$(eval $(call gb_Library_use_externals,vclplug_win,\ + boost_headers \ + epoxy \ + glm_headers \ + harfbuzz \ +)) + +$(eval $(call gb_Library_add_exception_objects,vclplug_win,\ + vcl/opengl/win/gdiimpl \ + vcl/win/app/saldata \ + vcl/win/app/salinfo \ + vcl/win/app/salinst \ + vcl/win/app/salshl \ + vcl/win/app/saltimer \ + vcl/win/gdi/gdiimpl \ + vcl/win/gdi/salbmp \ + vcl/win/gdi/salgdi \ + vcl/win/gdi/salgdi2 \ + vcl/win/gdi/salfont \ + vcl/win/gdi/salgdi_gdiplus \ + vcl/win/gdi/salnativewidgets-luna \ + vcl/win/gdi/salprn \ + vcl/win/gdi/salvd \ + vcl/win/gdi/winlayout \ + vcl/win/gdi/DWriteTextRenderer \ + vcl/win/window/salframe \ + vcl/win/window/keynames \ + vcl/win/window/salmenu \ + vcl/win/window/salobj \ +)) + +$(eval $(call gb_Library_use_system_win32_libs,vclplug_win,\ + gdi32 \ + gdiplus \ + imm32 \ + ole32 \ + shell32 \ + version \ + winspool \ +)) + +$(eval $(call gb_Library_add_nativeres,vclplug_win,vcl/salsrc)) + +# HACK: dependency on icon themes so running unit tests don't +# prevent delivering these by having open file handles on WNT +$(eval $(call gb_Library_use_package,vclplug_win,postprocess_images)) + +# vim: set noet sw=4 ts=4: diff --git a/vcl/Module_vcl.mk b/vcl/Module_vcl.mk index b8731614797a..4f8d26c01c4b 100644 --- a/vcl/Module_vcl.mk +++ b/vcl/Module_vcl.mk @@ -112,6 +112,7 @@ endif ifeq ($(OS),WNT) $(eval $(call gb_Module_add_targets,vcl,\ WinResTarget_vcl \ + Library_vclplug_win \ )) endif diff --git a/vcl/inc/fontselect.hxx b/vcl/inc/fontselect.hxx index 9707ba4e5fa9..51f70997ac53 100644 --- a/vcl/inc/fontselect.hxx +++ b/vcl/inc/fontselect.hxx @@ -34,7 +34,7 @@ class LogicalFontInstance; class PhysicalFontFace; class Size; -class FontSelectPattern : public FontAttributes +class VCL_DLLPUBLIC FontSelectPattern : public FontAttributes { public: FontSelectPattern( const vcl::Font&, const OUString& rSearchName, diff --git a/vcl/inc/fontsubset.hxx b/vcl/inc/fontsubset.hxx index 66368b7cbcb9..76551c29d89d 100644 --- a/vcl/inc/fontsubset.hxx +++ b/vcl/inc/fontsubset.hxx @@ -44,7 +44,7 @@ namespace o3tl { template<> struct typed_flags<FontType> : is_typed_flags<FontType, (1<<8)-1> {}; } -class FontSubsetInfo final +class VCL_DLLPUBLIC FontSubsetInfo final { public: explicit FontSubsetInfo(); diff --git a/vcl/inc/helpwin.hxx b/vcl/inc/helpwin.hxx index 09fed59b7138..765dac0508e5 100644 --- a/vcl/inc/helpwin.hxx +++ b/vcl/inc/helpwin.hxx @@ -74,7 +74,7 @@ public: void ImplShowHelpWindow( vcl::Window* pParent, sal_uInt16 nHelpWinStyle, QuickHelpFlags nStyle, const OUString& rHelpText, const OUString& rStatusText, const Point& rScreenPos, const tools::Rectangle& rHelpArea ); -void ImplDestroyHelpWindow( bool bUpdateHideTime ); +VCL_DLLPUBLIC void ImplDestroyHelpWindow( bool bUpdateHideTime ); void ImplSetHelpWindowPos( vcl::Window* pHelpWindow, sal_uInt16 nHelpWinStyle, QuickHelpFlags nStyle, const Point& rPos, const tools::Rectangle& rHelpArea ); diff --git a/vcl/inc/opengl/FixedTextureAtlas.hxx b/vcl/inc/opengl/FixedTextureAtlas.hxx index c273a5e36c0c..145ddf52f5e1 100644 --- a/vcl/inc/opengl/FixedTextureAtlas.hxx +++ b/vcl/inc/opengl/FixedTextureAtlas.hxx @@ -16,7 +16,7 @@ struct FixedTexture; -class VCL_PLUGIN_PUBLIC FixedTextureAtlasManager +class FixedTextureAtlasManager final { std::vector<std::unique_ptr<FixedTexture>> maFixedTextures; @@ -26,9 +26,13 @@ class VCL_PLUGIN_PUBLIC FixedTextureAtlasManager void CreateNewTexture(); + FixedTextureAtlasManager( const FixedTextureAtlasManager& ) = delete; + FixedTextureAtlasManager& operator=( const FixedTextureAtlasManager& ) = delete; + public: FixedTextureAtlasManager(int nWidthFactor, int nHeightFactor, int nTextureSize); ~FixedTextureAtlasManager(); + OpenGLTexture InsertBuffer(int nWidth, int nHeight, int nFormat, int nType, sal_uInt8 const * pData); OpenGLTexture Reserve(int nWidth, int nHeight); diff --git a/vcl/inc/opengl/PackedTextureAtlas.hxx b/vcl/inc/opengl/PackedTextureAtlas.hxx index 8e6def84c9e4..c7f39d86b4d9 100644 --- a/vcl/inc/opengl/PackedTextureAtlas.hxx +++ b/vcl/inc/opengl/PackedTextureAtlas.hxx @@ -26,7 +26,7 @@ struct PackedTexture; * [2]: https://github.com/lukaszdk/texture-atlas-generator * */ -class VCL_PLUGIN_PUBLIC PackedTextureAtlasManager +class VCL_DLLPUBLIC PackedTextureAtlasManager final { std::vector<std::unique_ptr<PackedTexture>> maPackedTextures; @@ -35,6 +35,9 @@ class VCL_PLUGIN_PUBLIC PackedTextureAtlasManager void CreateNewTexture(); + PackedTextureAtlasManager( const PackedTextureAtlasManager& ) = delete; + PackedTextureAtlasManager& operator=( const PackedTextureAtlasManager& ) = delete; + public: /** @@ -43,6 +46,7 @@ public: */ PackedTextureAtlasManager(int nTextureWidth, int nTextureHeight); ~PackedTextureAtlasManager(); + OpenGLTexture InsertBuffer(int nWidth, int nHeight, int nFormat, int nType, sal_uInt8 const * pData); OpenGLTexture Reserve(int nWidth, int nHeight); std::vector<GLuint> ReduceTextureNumber(int nMaxNumberOfTextures); diff --git a/vcl/inc/salinst.hxx b/vcl/inc/salinst.hxx index 3ee6aca23567..9f20394fe4e6 100644 --- a/vcl/inc/salinst.hxx +++ b/vcl/inc/salinst.hxx @@ -209,7 +209,7 @@ void DestroySalInstance( SalInstance* pInst ); void SalAbort( const OUString& rErrorText, bool bDumpCore ); -VCL_PLUGIN_PUBLIC const OUString& SalGetDesktopEnvironment(); +VCL_DLLPUBLIC const OUString& SalGetDesktopEnvironment(); void InitSalData(); // called from Application-Ctor void DeInitSalData(); // called from Application-Dtor diff --git a/vcl/inc/salprn.hxx b/vcl/inc/salprn.hxx index 014f61179b47..d9669793655d 100644 --- a/vcl/inc/salprn.hxx +++ b/vcl/inc/salprn.hxx @@ -86,6 +86,9 @@ public: class VCL_PLUGIN_PUBLIC SalPrinter { + SalPrinter( const SalPrinter& ) = delete; + SalPrinter& operator=( const SalPrinter& ) = delete; + public: SalPrinter() {} virtual ~SalPrinter(); diff --git a/vcl/inc/salsys.hxx b/vcl/inc/salsys.hxx index 5e3478e45b2b..fc80e90d0ca9 100644 --- a/vcl/inc/salsys.hxx +++ b/vcl/inc/salsys.hxx @@ -83,7 +83,7 @@ public: }; -SalSystem* ImplGetSalSystem(); +VCL_DLLPUBLIC SalSystem* ImplGetSalSystem(); #endif // INCLUDED_VCL_INC_SALSYS_HXX diff --git a/vcl/inc/sft.hxx b/vcl/inc/sft.hxx index 00cf119a4ca4..95fbcadb0d8d 100644 --- a/vcl/inc/sft.hxx +++ b/vcl/inc/sft.hxx @@ -344,7 +344,7 @@ namespace vcl * @ingroup sft * */ - SFErrCodes CreateTTFromTTGlyphs(TrueTypeFont *ttf, + VCL_DLLPUBLIC SFErrCodes CreateTTFromTTGlyphs(TrueTypeFont *ttf, const char *fname, sal_uInt16 const *glyphArray, sal_uInt8 const *encoding, @@ -387,7 +387,7 @@ namespace vcl * @ingroup sft * */ - std::unique_ptr<sal_uInt16[]> GetTTSimpleGlyphMetrics(TrueTypeFont const *ttf, const sal_uInt16 *glyphArray, int nGlyphs, bool vertical); + VCL_DLLPUBLIC std::unique_ptr<sal_uInt16[]> GetTTSimpleGlyphMetrics(TrueTypeFont const *ttf, const sal_uInt16 *glyphArray, int nGlyphs, bool vertical); #if defined(_WIN32) || defined(MACOSX) || defined(IOS) /** @@ -399,7 +399,7 @@ namespace vcl * @return glyph ID, if the character is missing in the font, the return value is 0. * @ingroup sft */ - sal_uInt16 MapChar(TrueTypeFont const *ttf, sal_uInt16 ch); + VCL_DLLPUBLIC sal_uInt16 MapChar(TrueTypeFont const *ttf, sal_uInt16 ch); #endif /** @@ -411,7 +411,7 @@ namespace vcl * @ingroup sft * */ - void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info); + VCL_DLLPUBLIC void GetTTGlobalFontInfo(TrueTypeFont *ttf, TTGlobalFontInfo *info); /** * Returns fonts metrics. @@ -430,7 +430,7 @@ namespace vcl /** * returns the number of glyphs in a font */ - int GetTTGlyphCount( TrueTypeFont const * ttf ); + VCL_DLLPUBLIC int GetTTGlyphCount( TrueTypeFont const * ttf ); /** * provide access to the raw data of a SFNT-container's subtable diff --git a/vcl/inc/svdata.hxx b/vcl/inc/svdata.hxx index 6df874abc74b..b36ecf7e6a41 100644 --- a/vcl/inc/svdata.hxx +++ b/vcl/inc/svdata.hxx @@ -387,7 +387,7 @@ VCL_PLUGIN_PUBLIC OUString VclResId(const char* pId); DockingManager* ImplGetDockingManager(); BlendFrameCache* ImplGetBlendFrameCache(); -bool ImplCallPreNotify( NotifyEvent& rEvt ); +VCL_DLLPUBLIC bool ImplCallPreNotify( NotifyEvent& rEvt ); VCL_PLUGIN_PUBLIC ImplSVData* ImplGetSVData(); VCL_PLUGIN_PUBLIC void ImplHideSplash(); diff --git a/vcl/inc/vclpluginapi.h b/vcl/inc/vclpluginapi.h index e8677d239937..88defd3972d6 100644 --- a/vcl/inc/vclpluginapi.h +++ b/vcl/inc/vclpluginapi.h @@ -59,6 +59,12 @@ #define VCLPLUG_SVP_PUBLIC SAL_DLLPUBLIC_IMPORT #endif +#if defined VCLPLUG_WIN_IMPLEMENTATION +#define VCLPLUG_WIN_PUBLIC SAL_DLLPUBLIC_EXPORT +#else +#define VCLPLUG_WIN_PUBLIC SAL_DLLPUBLIC_IMPORT +#endif + #if defined DESKTOP_DETECTOR_IMPLEMENTATION #define DESKTOP_DETECTOR_PUBLIC SAL_DLLPUBLIC_EXPORT #else diff --git a/vcl/source/app/svapp.cxx b/vcl/source/app/svapp.cxx index ca3848d58a22..bd5127f444c5 100644 --- a/vcl/source/app/svapp.cxx +++ b/vcl/source/app/svapp.cxx @@ -1138,8 +1138,7 @@ OUString Application::GetHWOSConfInfo() aDetails.append( VclResId(SV_APP_DEFAULT) ); aDetails.append( "; " ); -#ifdef LINUX - // Only linux has different backends, so don't show blank for others. +#if (defined LINUX || defined _WIN32) aDetails.append( SV_APP_VCLBACKEND ); aDetails.append( GetToolkitName() ); aDetails.append( "; " ); diff --git a/vcl/win/app/salinst.cxx b/vcl/win/app/salinst.cxx index 1c67113322dc..d5fca66f6bd2 100644 --- a/vcl/win/app/salinst.cxx +++ b/vcl/win/app/salinst.cxx @@ -32,6 +32,7 @@ #include <vcl/opengl/OpenGLHelper.hxx> #include <vcl/opengl/OpenGLContext.hxx> #include <vcl/timer.hxx> +#include <vclpluginapi.h> #include <opengl/salbmp.hxx> #include <opengl/win/gdiimpl.hxx> @@ -299,55 +300,33 @@ SalData::SalData() SetSalData( this ); initNWF(); + + CoInitialize(nullptr); // put main thread in Single Threaded Apartment (STA) + static Gdiplus::GdiplusStartupInput gdiplusStartupInput; + Gdiplus::GdiplusStartup(&gdiplusToken, &gdiplusStartupInput, nullptr); } SalData::~SalData() { deInitNWF(); SetSalData( nullptr ); -} - -void InitSalData() -{ - SalData* pSalData = new SalData; - CoInitialize(nullptr); // put main thread in Single Threaded Apartment (STA) - - // init GDIPlus - static Gdiplus::GdiplusStartupInput gdiplusStartupInput; - Gdiplus::GdiplusStartup(&pSalData->gdiplusToken, &gdiplusStartupInput, nullptr); -} -void DeInitSalData() -{ CoUninitialize(); - SalData* pSalData = GetSalData(); - // deinit GDIPlus - if(pSalData) - { - Gdiplus::GdiplusShutdown(pSalData->gdiplusToken); - } - - delete pSalData; + if (gdiplusToken) + Gdiplus::GdiplusShutdown(gdiplusToken); } -void InitSalMain() +extern "C" { +VCLPLUG_WIN_PUBLIC SalInstance* create_SalInstance() { - // remember data, copied from WinMain - SalData* pData = GetSalData(); - if ( pData ) // Im AppServer NULL - { - STARTUPINFOW aSI; - aSI.cb = sizeof( aSI ); - GetStartupInfoW( &aSI ); - pData->mhInst = GetModuleHandleW( nullptr ); - pData->mnCmdShow = aSI.wShowWindow; - } -} + SalData* pSalData = new SalData(); -SalInstance* CreateSalInstance() -{ - SalData* pSalData = GetSalData(); + STARTUPINFOW aSI; + aSI.cb = sizeof( aSI ); + GetStartupInfoW( &aSI ); + pSalData->mhInst = GetModuleHandleW( nullptr ); + pSalData->mnCmdShow = aSI.wShowWindow; pSalData->mnAppThreadId = GetCurrentThreadId(); @@ -405,20 +384,6 @@ SalInstance* CreateSalInstance() return pInst; } - -void DestroySalInstance( SalInstance* pInst ) -{ - SalData* pSalData = GetSalData(); - - // (only one instance in this version !!!) - - ImplFreeSalGDI(); - - // reset instance - if ( pSalData->mpInstance == pInst ) - pSalData->mpInstance = nullptr; - - delete pInst; } WinSalInstance::WinSalInstance() @@ -426,12 +391,13 @@ WinSalInstance::WinSalInstance() , mhComWnd( nullptr ) , m_nNoYieldLock( 0 ) { - GetYieldMutex()->acquire(); + ImplSVData* pSVData = ImplGetSVData(); + pSVData->maAppData.mxToolkitName = OUString("win"); } WinSalInstance::~WinSalInstance() { - GetYieldMutex()->release(); + ImplFreeSalGDI(); DestroyWindow( mhComWnd ); } @@ -1000,12 +966,6 @@ std::shared_ptr<SalBitmap> WinSalInstance::CreateSalBitmap() return std::make_shared<WinSalBitmap>(); } -const OUString& SalGetDesktopEnvironment() -{ - static OUString aDesktopEnvironment( "Windows" ); - return aDesktopEnvironment; -} - int WinSalInstance::WorkaroundExceptionHandlingInUSER32Lib(int, LPEXCEPTION_POINTERS pExceptionInfo) { // Decide if an exception is a c++ (mostly UNO) exception or a process violation. diff --git a/vcl/win/app/salplug.cxx b/vcl/win/app/salplug.cxx new file mode 100644 index 000000000000..1ef61976a23d --- /dev/null +++ b/vcl/win/app/salplug.cxx @@ -0,0 +1,199 @@ +/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ +/* + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * + * This file incorporates work covered by the following license notice: + * + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed + * with this work for additional information regarding copyright + * ownership. The ASF licenses this file to you under the Apache + * License, Version 2.0 (the "License"); you may not use this file + * except in compliance with the License. You may obtain a copy of + * the License at http://www.apache.org/licenses/LICENSE-2.0 . + */ + +#include <osl/module.hxx> +#include <osl/process.h> + +#include <rtl/bootstrap.hxx> +#include <rtl/process.h> +#include <sal/log.hxx> + +#include <salinst.hxx> +#include <saldatabasic.hxx> +#include <config_vclplug.h> +#include <desktop/crashreport.hxx> + +#include <cstdio> +#include <Windows.h> + +extern "C" { +typedef SalInstance*(*salFactoryProc)(); +} + +namespace { + +// HACK to obtain Application::IsHeadlessModeEnabled early on, before +// Application::EnableHeadlessMode has potentially been called: +bool IsHeadlessModeRequested() +{ + if (Application::IsHeadlessModeEnabled()) { + return true; + } + sal_uInt32 n = rtl_getAppCommandArgCount(); + for (sal_uInt32 i = 0; i < n; ++i) { + OUString arg; + rtl_getAppCommandArg(i, &arg.pData); + if ( arg == "--headless" || arg == "-headless" ) { + return true; + } + } + return false; +} + +} + +static oslModule pCloseModule = nullptr; + +static SalInstance* tryInstance( const OUString& rModuleBase, bool bForce = false ) +{ + SalInstance* pInst = nullptr; + OUString aModule( +#ifdef SAL_DLLPREFIX + SAL_DLLPREFIX +#endif + "vclplug_" + rModuleBase + "lo" SAL_DLLEXTENSION ); + + osl::Module aMod; + if (aMod.loadRelative(reinterpret_cast<oslGenericFunction>(&tryInstance), aModule, SAL_LOADMODULE_GLOBAL)) + { + salFactoryProc aProc = reinterpret_cast<salFactoryProc>(aMod.getFunctionSymbol("create_SalInstance")); + if (aProc) + { + pInst = aProc(); + SAL_INFO( + "vcl.plugadapt", + "sal plugin " << aModule << " produced instance " << pInst); + if (pInst) + { + pCloseModule = static_cast<oslModule>(aMod); + aMod.release(); + pCloseModule = nullptr; + } + } + else + { + SAL_WARN( + "vcl.plugadapt", + "could not load symbol create_SalInstance from shared object " + << aModule); + } + } + else if (bForce) + { + SAL_WARN("vcl.plugadapt", "could not load shared object " << aModule); + } + else + { + SAL_INFO("vcl.plugadapt", "could not load shared object " << aModule); + } + + // coverity[leaked_storage] - this is on purpose + return pInst; +} + +SalInstance *CreateSalInstance() +{ + SalInstance *pInst = nullptr; + + OUString aUsePlugin; + rtl::Bootstrap::get( "SAL_USE_VCLPLUGIN", aUsePlugin ); + + if( !aUsePlugin.isEmpty() ) + pInst = tryInstance( aUsePlugin, true ); + + // fallback, try everything + static const char* const pPlugin[] = { "win" }; + + for ( int i = 0; !pInst && i != SAL_N_ELEMENTS(pPlugin); ++i ) + pInst = tryInstance( OUString::createFromAscii( pPlugin[ i ] ) ); + + if( ! pInst ) + { + std::fprintf( stderr, "no suitable windowing system found, exiting.\n" ); + _exit( 1 ); + } + + // acquire SolarMutex + pInst->AcquireYieldMutex(); + + return pInst; +} + +void DestroySalInstance( SalInstance *pInst ) +{ + // release SolarMutex + pInst->ReleaseYieldMutexAll(); + + delete pInst; + if( pCloseModule ) + osl_unloadModule( pCloseModule ); +} + +void InitSalData() +{ +} + +void DeInitSalData() +{ +} + +void InitSalMain() +{ +} + +void SalAbort( const OUString& rErrorText, bool bDumpCore ) +{ + if( rErrorText.isEmpty() ) + std::fprintf( stderr, "Application Error\n" ); + else + { + CrashReporter::AddKeyValue("AbortMessage", rErrorText); + std::fprintf( stderr, "%s\n", OUStringToOString(rErrorText, osl_getThreadTextEncoding()).getStr() ); + } + if( bDumpCore ) + abort(); + else + _exit(1); +} + +const OUString& SalGetDesktopEnvironment() +{ + static OUString aDesktopEnvironment( "Windows" ); + return aDesktopEnvironment; +} + +SalData::SalData() : + m_pInstance(nullptr), + m_pPIManager(nullptr) +{ +} + +SalData::~SalData() COVERITY_NOEXCEPT_FALSE +{ +} + +bool HasAtHook() +{ + BOOL bIsRunning = FALSE; + // pvParam must be BOOL + return SystemParametersInfoW(SPI_GETSCREENREADER, 0, &bIsRunning, 0) + && bIsRunning; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/window/salframe.cxx b/vcl/win/window/salframe.cxx index 35da3a0b5f04..d96aa4776fa1 100644 --- a/vcl/win/window/salframe.cxx +++ b/vcl/win/window/salframe.cxx @@ -5860,14 +5860,4 @@ bool ImplHandleGlobalMsg( HWND hWnd, UINT nMsg, WPARAM wParam, LPARAM lParam, LR return bResult; } -#ifdef _WIN32 -bool HasAtHook() -{ - BOOL bIsRunning = FALSE; - // pvParam must be BOOL - return SystemParametersInfoW(SPI_GETSCREENREADER, 0, &bIsRunning, 0) - && bIsRunning; -} -#endif - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |