diff options
Diffstat (limited to 'vcl/win')
-rw-r--r-- | vcl/win/dtrans/DtObjFactory.cxx | 5 | ||||
-rw-r--r-- | vcl/win/dtrans/FmtFilter.hxx | 20 | ||||
-rw-r--r-- | vcl/win/dtrans/ImplHelper.hxx | 22 | ||||
-rw-r--r-- | vcl/win/dtrans/MimeAttrib.hxx | 8 | ||||
-rw-r--r-- | vcl/win/dtrans/globals.hxx | 13 | ||||
-rw-r--r-- | vcl/win/dtrans/sourcecontext.hxx | 24 | ||||
-rw-r--r-- | vcl/win/dtrans/target.hxx | 95 | ||||
-rw-r--r-- | vcl/win/dtrans/targetdragcontext.cxx | 18 | ||||
-rw-r--r-- | vcl/win/dtrans/targetdragcontext.hxx | 10 | ||||
-rw-r--r-- | vcl/win/dtrans/targetdropcontext.cxx | 21 | ||||
-rw-r--r-- | vcl/win/dtrans/targetdropcontext.hxx | 12 | ||||
-rw-r--r-- | vcl/win/gdi/winlayout.cxx | 133 |
12 files changed, 184 insertions, 197 deletions
diff --git a/vcl/win/dtrans/DtObjFactory.cxx b/vcl/win/dtrans/DtObjFactory.cxx index 5a17d8b4c2e4..8fe03789b1f1 100644 --- a/vcl/win/dtrans/DtObjFactory.cxx +++ b/vcl/win/dtrans/DtObjFactory.cxx @@ -24,8 +24,9 @@ using namespace com::sun::star::uno; using namespace com::sun::star::datatransfer; using namespace com::sun::star::lang; -IDataObjectPtr CDTransObjFactory::createDataObjFromTransferable(const Reference<XComponentContext>& rxContext, - const Reference< XTransferable >& refXTransferable) +IDataObjectPtr +CDTransObjFactory::createDataObjFromTransferable(const Reference<XComponentContext>& rxContext, + const Reference<XTransferable>& refXTransferable) { return (IDataObjectPtr(new CXTDataObject(rxContext, refXTransferable))); } diff --git a/vcl/win/dtrans/FmtFilter.hxx b/vcl/win/dtrans/FmtFilter.hxx index 3c05c953c95d..b4fb1e1fc328 100644 --- a/vcl/win/dtrans/FmtFilter.hxx +++ b/vcl/win/dtrans/FmtFilter.hxx @@ -24,7 +24,7 @@ #include <com/sun/star/uno/Sequence.hxx> #if !defined WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN #endif #include <windows.h> #include <objidl.h> @@ -33,29 +33,29 @@ input: aMetaFilePict - a sequence of bytes containing a METAFILEPICT struct ------------------------------------------------------------------------*/ -css::uno::Sequence< sal_Int8 > WinMFPictToOOMFPict( css::uno::Sequence< sal_Int8 >& aMetaFilePict ); -css::uno::Sequence< sal_Int8 > WinENHMFPictToOOMFPict( HENHMETAFILE hEnhMetaFile ); +css::uno::Sequence<sal_Int8> WinMFPictToOOMFPict(css::uno::Sequence<sal_Int8>& aMetaFilePict); +css::uno::Sequence<sal_Int8> WinENHMFPictToOOMFPict(HENHMETAFILE hEnhMetaFile); /*------------------------------------------------------------------------ input: aByteStream - a sequence of bytes containing a LibreOffice metafile picture with a leading METAFILEHEADER ------------------------------------------------------------------------*/ -HMETAFILEPICT OOMFPictToWinMFPict( css::uno::Sequence< sal_Int8 > const & aOOMetaFilePict ); -HENHMETAFILE OOMFPictToWinENHMFPict( css::uno::Sequence< sal_Int8 > const & aOOMetaFilePict ); +HMETAFILEPICT OOMFPictToWinMFPict(css::uno::Sequence<sal_Int8> const& aOOMetaFilePict); +HENHMETAFILE OOMFPictToWinENHMFPict(css::uno::Sequence<sal_Int8> const& aOOMetaFilePict); /*------------------------------------------------------------------------ input: aWinDIB - sequence of bytes containing a windows device independent bitmap ------------------------------------------------------------------------*/ -css::uno::Sequence< sal_Int8 > WinDIBToOOBMP( const css::uno::Sequence< sal_Int8 >& aWinDIB ); +css::uno::Sequence<sal_Int8> WinDIBToOOBMP(const css::uno::Sequence<sal_Int8>& aWinDIB); /*------------------------------------------------------------------------ input: aWinDIB - sequence of bytes containing a windows bitmap handle ------------------------------------------------------------------------*/ -css::uno::Sequence< sal_Int8 > WinBITMAPToOOBMP( HBITMAP ); +css::uno::Sequence<sal_Int8> WinBITMAPToOOBMP(HBITMAP); /*------------------------------------------------------------------------ input: @@ -63,7 +63,7 @@ css::uno::Sequence< sal_Int8 > WinBITMAPToOOBMP( HBITMAP ); May contain CF_DIBV5 or CF_DIB, but removing the BITMAPFILEHEADER is always the same size ------------------------------------------------------------------------*/ -css::uno::Sequence< sal_Int8 > OOBmpToWinDIB( css::uno::Sequence< sal_Int8 >& aOOBmp ); +css::uno::Sequence<sal_Int8> OOBmpToWinDIB(css::uno::Sequence<sal_Int8>& aOOBmp); /*------------------------------------------------------------------------ input: @@ -72,13 +72,13 @@ css::uno::Sequence< sal_Int8 > OOBmpToWinDIB( css::uno::Sequence< sal_Int8 >& aO the Format is described in the MSDN Library under HTML Clipboard Format ------------------------------------------------------------------------*/ -css::uno::Sequence< sal_Int8 > TextHtmlToHTMLFormat( css::uno::Sequence< sal_Int8 > const & aTextHtml ); +css::uno::Sequence<sal_Int8> TextHtmlToHTMLFormat(css::uno::Sequence<sal_Int8> const& aTextHtml); /** Return a FileList in which Windows Shell Links (lnk) are resolved. If for whatever reason a resolution is not possible leave the original lnk file. */ -css::uno::Sequence< sal_Int8 > CF_HDROPToFileList(HGLOBAL hGlobal); +css::uno::Sequence<sal_Int8> CF_HDROPToFileList(HGLOBAL hGlobal); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/dtrans/ImplHelper.hxx b/vcl/win/dtrans/ImplHelper.hxx index fbe2c7ae70e5..ffc160602e7a 100644 --- a/vcl/win/dtrans/ImplHelper.hxx +++ b/vcl/win/dtrans/ImplHelper.hxx @@ -23,7 +23,7 @@ #include <rtl/ustring.hxx> #if !defined WIN32_LEAN_AND_MEAN -# define WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN #endif #include <windows.h> #include <objidl.h> @@ -31,8 +31,8 @@ // target device and formatetc helper void DeleteTargetDevice(DVTARGETDEVICE* ptd); bool CopyFormatEtc(LPFORMATETC petcDest, LPFORMATETC petcSrc); -sal_Int32 CompareFormatEtc( const FORMATETC* pFetcLeft, const FORMATETC* pFetcRight); -bool CompareTargetDevice(DVTARGETDEVICE* ptdLeft, DVTARGETDEVICE const * ptdRight); +sal_Int32 CompareFormatEtc(const FORMATETC* pFetcLeft, const FORMATETC* pFetcRight); +bool CompareTargetDevice(DVTARGETDEVICE* ptdLeft, DVTARGETDEVICE const* ptdRight); DVTARGETDEVICE* CopyTargetDevice(DVTARGETDEVICE* ptdSrc); // some codepage helper functions @@ -40,35 +40,31 @@ DVTARGETDEVICE* CopyTargetDevice(DVTARGETDEVICE* ptdSrc); // returns a windows codepage appropriate to the // given mime charset parameter value -sal_uInt32 getWinCPFromMimeCharset( - const OUString& charset ); +sal_uInt32 getWinCPFromMimeCharset(const OUString& charset); // returns a windows codepage appropriate to the // given locale and locale type -OUString getWinCPFromLocaleId( - LCID lcid, LCTYPE lctype ); +OUString getWinCPFromLocaleId(LCID lcid, LCTYPE lctype); // returns a mime charset parameter value appropriate // to the given codepage, optional a prefix can be // given, e.g. "windows-" or "cp" -OUString getMimeCharsetFromWinCP( - sal_uInt32 cp, const OUString& aPrefix ); +OUString getMimeCharsetFromWinCP(sal_uInt32 cp, const OUString& aPrefix); // returns a mime charset parameter value appropriate // to the given locale id and locale type, optional a // prefix can be given, e.g. "windows-" or "cp" -OUString getMimeCharsetFromLocaleId( - LCID lcid, LCTYPE lctype, const OUString& aPrefix ); +OUString getMimeCharsetFromLocaleId(LCID lcid, LCTYPE lctype, const OUString& aPrefix); // returns true, if a given codepage is an oem codepage -bool IsOEMCP( sal_uInt32 codepage ); +bool IsOEMCP(sal_uInt32 codepage); // converts a codepage into a string representation -OUString cptostr( sal_uInt32 codepage ); +OUString cptostr(sal_uInt32 codepage); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/dtrans/MimeAttrib.hxx b/vcl/win/dtrans/MimeAttrib.hxx index dc8c3ef86fbb..33e53d779f01 100644 --- a/vcl/win/dtrans/MimeAttrib.hxx +++ b/vcl/win/dtrans/MimeAttrib.hxx @@ -23,9 +23,9 @@ const OUString TEXTPLAIN_PARAM_CHARSET("charset"); -const OUString PRE_WINDOWS_CODEPAGE ("windows"); -const OUString PRE_OEM_CODEPAGE ("cp"); -const OUString CHARSET_UTF16 ("utf-16"); -const OUString CHARSET_UNICODE ("unicode"); +const OUString PRE_WINDOWS_CODEPAGE("windows"); +const OUString PRE_OEM_CODEPAGE("cp"); +const OUString CHARSET_UTF16("utf-16"); +const OUString CHARSET_UNICODE("unicode"); /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/dtrans/globals.hxx b/vcl/win/dtrans/globals.hxx index 824c56a5aa73..69e9f2d15597 100644 --- a/vcl/win/dtrans/globals.hxx +++ b/vcl/win/dtrans/globals.hxx @@ -23,7 +23,10 @@ #include <com/sun/star/uno/Reference.hxx> #include <osl/mutex.hxx> -namespace com::sun::star::datatransfer { class XTransferable; } +namespace com::sun::star::datatransfer +{ +class XTransferable; +} #include <wtypes.h> #include <sal/types.h> @@ -40,27 +43,27 @@ namespace com::sun::star::datatransfer { class XTransferable; } // is not considered relevant in a drag operation. Contrarily the file explorer // gives that button a special meaning: the user has to select the effect from // a context menu on drop. -sal_Int8 dndOleKeysToAction( DWORD grfKeyState, sal_Int8 sourceActions); +sal_Int8 dndOleKeysToAction(DWORD grfKeyState, sal_Int8 sourceActions); // The function maps a windows DROPEFFECTs to actions // ( css::datatransfer::dnd::DNDConstants). // The argument can be a combination of different DROPEFFECTS, // In that case the return value is also a combination of the // appropriate actions. -sal_Int8 dndOleDropEffectsToActions( DWORD dwEffect); +sal_Int8 dndOleDropEffectsToActions(DWORD dwEffect); // The function maps actions ( css::datatransfer::dnd::DNDConstants) // to window DROPEFFECTs. // The argument can be a combination of different actions // In that case the return value is also a combination of the // appropriate DROPEFFECTS. -DWORD dndActionsToDropEffects( sal_Int8 actions); +DWORD dndActionsToDropEffects(sal_Int8 actions); // If the argument constitutes only one action then it is mapped to the // corresponding DROPEFFECT otherwise DROPEFFECT_MOVE is returned. This is // why move is the default effect (no modifiers pressed, or right mouse button // or Alt). -DWORD dndActionsToSingleDropEffect( sal_Int8 actions); +DWORD dndActionsToSingleDropEffect(sal_Int8 actions); struct MutexDummy { diff --git a/vcl/win/dtrans/sourcecontext.hxx b/vcl/win/dtrans/sourcecontext.hxx index 60609559a121..9bc9e273cc7f 100644 --- a/vcl/win/dtrans/sourcecontext.hxx +++ b/vcl/win/dtrans/sourcecontext.hxx @@ -35,8 +35,7 @@ using namespace ::com::sun::star::lang; // currently. // An instance of SourceContext only lives as long as the drag and drop // operation lasts. -class SourceContext: public MutexDummy, - public WeakComponentImplHelper<XDragSourceContext> +class SourceContext : public MutexDummy, public WeakComponentImplHelper<XDragSourceContext> { DragSource* m_pDragSource; Reference<XDragSource> m_dragSource; @@ -44,24 +43,23 @@ class SourceContext: public MutexDummy, sal_Int8 m_currentAction; public: - SourceContext( DragSource* pSource, const Reference<XDragSourceListener>& listener); + SourceContext(DragSource* pSource, const Reference<XDragSourceListener>& listener); ~SourceContext() override; SourceContext(const SourceContext&) = delete; - SourceContext &operator= (const SourceContext&) = delete; + SourceContext& operator=(const SourceContext&) = delete; /// @throws RuntimeException - virtual void addDragSourceListener( const Reference<XDragSourceListener >& dsl ); + virtual void addDragSourceListener(const Reference<XDragSourceListener>& dsl); /// @throws RuntimeException - virtual void removeDragSourceListener( const Reference<XDragSourceListener >& dsl ); - virtual sal_Int32 SAL_CALL getCurrentCursor( ) override; - virtual void SAL_CALL setCursor( sal_Int32 cursorId ) override; - virtual void SAL_CALL setImage( sal_Int32 imageId ) override; - virtual void SAL_CALL transferablesFlavorsChanged( ) override; + virtual void removeDragSourceListener(const Reference<XDragSourceListener>& dsl); + virtual sal_Int32 SAL_CALL getCurrentCursor() override; + virtual void SAL_CALL setCursor(sal_Int32 cursorId) override; + virtual void SAL_CALL setImage(sal_Int32 imageId) override; + virtual void SAL_CALL transferablesFlavorsChanged() override; // non - interface functions - void fire_dragDropEnd( bool success, sal_Int8 byte); - void fire_dropActionChanged( sal_Int8 dropAction, sal_Int8 userAction); - + void fire_dragDropEnd(bool success, sal_Int8 byte); + void fire_dropActionChanged(sal_Int8 dropAction, sal_Int8 userAction); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/dtrans/target.hxx b/vcl/win/dtrans/target.hxx index 8f4a13f13ac9..0e3da70d7e5c 100644 --- a/vcl/win/dtrans/target.hxx +++ b/vcl/win/dtrans/target.hxx @@ -30,7 +30,10 @@ #include <oleidl.h> #include "globals.hxx" -namespace com::sun::star::uno { class XComponentContext; } +namespace com::sun::star::uno +{ +class XComponentContext; +} using namespace ::com::sun::star::lang; using namespace ::com::sun::star::uno; @@ -46,8 +49,8 @@ using namespace ::com::sun::star::datatransfer::dnd; // If the service calls OleInitialize then it also calls OleUnitialize when // it is destroyed. Therefore no second instance may exist which was // created in the same thread and still needs OLE. -class DropTarget: public MutexDummy, - public WeakComponentImplHelper< XInitialization, XDropTarget, XServiceInfo> +class DropTarget : public MutexDummy, + public WeakComponentImplHelper<XInitialization, XDropTarget, XServiceInfo> { private: @@ -79,7 +82,7 @@ private: // If m_bActive == sal_True then events are fired to XDropTargetListener s, // none otherwise. The default value is sal_True. bool m_bActive; - sal_Int8 m_nDefaultActions; + sal_Int8 m_nDefaultActions; // This value is set when a XDropTargetListener calls accept or reject on // the XDropTargetDropContext or XDropTargetDragContext. @@ -91,7 +94,7 @@ private: Reference<XTransferable> m_currentData; // The current action is used to determine if the USER // action has changed (dropActionChanged) -// sal_Int8 m_userAction; + // sal_Int8 m_userAction; // Set by listeners when they call XDropTargetDropContext::dropComplete bool m_bDropComplete; Reference<XDropTargetDragContext> m_currentDragContext; @@ -100,75 +103,75 @@ private: public: explicit DropTarget(const Reference<XComponentContext>& rxContext); virtual ~DropTarget() override; - DropTarget(DropTarget const &) = delete; - DropTarget &operator= (DropTarget const &) = delete; + DropTarget(DropTarget const&) = delete; + DropTarget& operator=(DropTarget const&) = delete; // Overrides WeakComponentImplHelper::disposing which is called by // WeakComponentImplHelper::dispose // Must be called. virtual void SAL_CALL disposing() override; - // XInitialization - virtual void SAL_CALL initialize( const Sequence< Any >& aArguments ) override; + // XInitialization + virtual void SAL_CALL initialize(const Sequence<Any>& aArguments) override; // XDropTarget - virtual void SAL_CALL addDropTargetListener( const Reference< XDropTargetListener >& dtl ) override; - virtual void SAL_CALL removeDropTargetListener( const Reference< XDropTargetListener >& dtl ) override; + virtual void SAL_CALL addDropTargetListener(const Reference<XDropTargetListener>& dtl) override; + virtual void SAL_CALL + removeDropTargetListener(const Reference<XDropTargetListener>& dtl) override; // Default is not active - virtual sal_Bool SAL_CALL isActive( ) override; - virtual void SAL_CALL setActive( sal_Bool isActive ) override; - virtual sal_Int8 SAL_CALL getDefaultActions( ) override; - virtual void SAL_CALL setDefaultActions( sal_Int8 actions ) override; + virtual sal_Bool SAL_CALL isActive() override; + virtual void SAL_CALL setActive(sal_Bool isActive) override; + virtual sal_Int8 SAL_CALL getDefaultActions() override; + virtual void SAL_CALL setDefaultActions(sal_Int8 actions) override; // XServiceInfo - virtual OUString SAL_CALL getImplementationName( ) override; - virtual sal_Bool SAL_CALL supportsService( const OUString& ServiceName ) override; - virtual Sequence< OUString > SAL_CALL getSupportedServiceNames( ) override; + virtual OUString SAL_CALL getImplementationName() override; + virtual sal_Bool SAL_CALL supportsService(const OUString& ServiceName) override; + virtual Sequence<OUString> SAL_CALL getSupportedServiceNames() override; // Functions called from the IDropTarget implementation ( m_pDropTarget) virtual HRESULT DragEnter( - /* [unique][in] */ IDataObject *pDataObj, - /* [in] */ DWORD grfKeyState, - /* [in] */ POINTL pt, - /* [out][in] */ DWORD *pdwEffect); + /* [unique][in] */ IDataObject* pDataObj, + /* [in] */ DWORD grfKeyState, + /* [in] */ POINTL pt, + /* [out][in] */ DWORD* pdwEffect); virtual HRESULT STDMETHODCALLTYPE DragOver( - /* [in] */ DWORD grfKeyState, - /* [in] */ POINTL pt, - /* [out][in] */ DWORD *pdwEffect); + /* [in] */ DWORD grfKeyState, + /* [in] */ POINTL pt, + /* [out][in] */ DWORD* pdwEffect); - virtual HRESULT STDMETHODCALLTYPE DragLeave( ) ; + virtual HRESULT STDMETHODCALLTYPE DragLeave(); virtual HRESULT STDMETHODCALLTYPE Drop( - /* [unique][in] */ IDataObject *pDataObj, - /* [in] */ DWORD grfKeyState, - /* [in] */ POINTL pt, - /* [out][in] */ DWORD *pdwEffect); + /* [unique][in] */ IDataObject* pDataObj, + /* [in] */ DWORD grfKeyState, + /* [in] */ POINTL pt, + /* [out][in] */ DWORD* pdwEffect); -// Non - interface functions -------------------------------------------------- -// XDropTargetDropContext delegated from DropContext + // Non - interface functions -------------------------------------------------- + // XDropTargetDropContext delegated from DropContext - void _acceptDrop( sal_Int8 dropOperation, const Reference<XDropTargetDropContext>& context); - void _rejectDrop( const Reference<XDropTargetDropContext>& context); - void _dropComplete( bool success, const Reference<XDropTargetDropContext>& context); + void _acceptDrop(sal_Int8 dropOperation, const Reference<XDropTargetDropContext>& context); + void _rejectDrop(const Reference<XDropTargetDropContext>& context); + void _dropComplete(bool success, const Reference<XDropTargetDropContext>& context); -// XDropTargetDragContext delegated from DragContext - void _acceptDrag( sal_Int8 dragOperation, const Reference<XDropTargetDragContext>& context); - void _rejectDrag( const Reference<XDropTargetDragContext>& context); + // XDropTargetDragContext delegated from DragContext + void _acceptDrag(sal_Int8 dragOperation, const Reference<XDropTargetDragContext>& context); + void _rejectDrag(const Reference<XDropTargetDragContext>& context); protected: // Gets the current action dependent on the pressed modifiers, the effects // supported by the drop source (IDropSource) and the default actions of the // drop target (XDropTarget, this class)) - inline sal_Int8 getFilteredActions( DWORD grfKeyState, DWORD sourceActions); + inline sal_Int8 getFilteredActions(DWORD grfKeyState, DWORD sourceActions); // Only filters with the default actions - inline sal_Int8 getFilteredActions( DWORD grfKeyState); - - void fire_drop( const DropTargetDropEvent& dte); - void fire_dragEnter( const DropTargetDragEnterEvent& dtde ); - void fire_dragExit( const DropTargetEvent& dte ); - void fire_dragOver( const DropTargetDragEvent& dtde ); - void fire_dropActionChanged( const DropTargetDragEvent& dtde ); + inline sal_Int8 getFilteredActions(DWORD grfKeyState); + void fire_drop(const DropTargetDropEvent& dte); + void fire_dragEnter(const DropTargetDragEnterEvent& dtde); + void fire_dragExit(const DropTargetEvent& dte); + void fire_dragOver(const DropTargetDragEvent& dtde); + void fire_dropActionChanged(const DropTargetDragEvent& dtde); }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/dtrans/targetdragcontext.cxx b/vcl/win/dtrans/targetdragcontext.cxx index 4ffd16123d9d..71e345b74c60 100644 --- a/vcl/win/dtrans/targetdragcontext.cxx +++ b/vcl/win/dtrans/targetdragcontext.cxx @@ -19,25 +19,21 @@ #include "targetdragcontext.hxx" -TargetDragContext::TargetDragContext( DropTarget* p) +TargetDragContext::TargetDragContext(DropTarget* p) { - m_pDropTarget= p; + m_pDropTarget = p; p->acquire(); } -TargetDragContext::~TargetDragContext() -{ - m_pDropTarget->release(); -} +TargetDragContext::~TargetDragContext() { m_pDropTarget->release(); } -void SAL_CALL TargetDragContext::acceptDrag( sal_Int8 dragOperation ) +void SAL_CALL TargetDragContext::acceptDrag(sal_Int8 dragOperation) { - m_pDropTarget->_acceptDrag( dragOperation, static_cast<XDropTargetDragContext*>( this) ); - + m_pDropTarget->_acceptDrag(dragOperation, static_cast<XDropTargetDragContext*>(this)); } -void SAL_CALL TargetDragContext::rejectDrag( ) +void SAL_CALL TargetDragContext::rejectDrag() { - m_pDropTarget->_rejectDrag( static_cast<XDropTargetDragContext*>( this) ); + m_pDropTarget->_rejectDrag(static_cast<XDropTargetDragContext*>(this)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/dtrans/targetdragcontext.hxx b/vcl/win/dtrans/targetdragcontext.hxx index c55a8fe673e9..5c05acc35da9 100644 --- a/vcl/win/dtrans/targetdragcontext.hxx +++ b/vcl/win/dtrans/targetdragcontext.hxx @@ -30,7 +30,7 @@ using namespace ::cppu; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; -class TargetDragContext: public WeakImplHelper<XDropTargetDragContext> +class TargetDragContext : public WeakImplHelper<XDropTargetDragContext> { // some calls to the functions of XDropTargetDragContext are delegated // to non-interface functions of m_pDropTarget @@ -39,11 +39,11 @@ class TargetDragContext: public WeakImplHelper<XDropTargetDragContext> public: explicit TargetDragContext(DropTarget* pTarget); ~TargetDragContext() override; - TargetDragContext( const TargetDragContext&) = delete; - TargetDragContext &operator= ( const TargetDragContext&) = delete; + TargetDragContext(const TargetDragContext&) = delete; + TargetDragContext& operator=(const TargetDragContext&) = delete; - virtual void SAL_CALL acceptDrag( sal_Int8 dragOperation ) override; - virtual void SAL_CALL rejectDrag( ) override; + virtual void SAL_CALL acceptDrag(sal_Int8 dragOperation) override; + virtual void SAL_CALL rejectDrag() override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/dtrans/targetdropcontext.cxx b/vcl/win/dtrans/targetdropcontext.cxx index 9719664a9fbb..fe6538943136 100644 --- a/vcl/win/dtrans/targetdropcontext.cxx +++ b/vcl/win/dtrans/targetdropcontext.cxx @@ -24,30 +24,27 @@ using namespace ::cppu; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; -TargetDropContext::TargetDropContext( DropTarget* p) +TargetDropContext::TargetDropContext(DropTarget* p) { - m_pDropTarget= p; + m_pDropTarget = p; p->acquire(); } -TargetDropContext::~TargetDropContext() -{ - m_pDropTarget->release(); -} +TargetDropContext::~TargetDropContext() { m_pDropTarget->release(); } -void SAL_CALL TargetDropContext::acceptDrop( sal_Int8 dropOperation ) +void SAL_CALL TargetDropContext::acceptDrop(sal_Int8 dropOperation) { - m_pDropTarget->_acceptDrop( dropOperation, static_cast<XDropTargetDropContext*>( this) ); + m_pDropTarget->_acceptDrop(dropOperation, static_cast<XDropTargetDropContext*>(this)); } -void SAL_CALL TargetDropContext::rejectDrop( ) +void SAL_CALL TargetDropContext::rejectDrop() { - m_pDropTarget->_rejectDrop( static_cast<XDropTargetDropContext*>( this) ); + m_pDropTarget->_rejectDrop(static_cast<XDropTargetDropContext*>(this)); } -void SAL_CALL TargetDropContext::dropComplete( sal_Bool success ) +void SAL_CALL TargetDropContext::dropComplete(sal_Bool success) { - m_pDropTarget->_dropComplete( success, static_cast<XDropTargetDropContext*>( this) ); + m_pDropTarget->_dropComplete(success, static_cast<XDropTargetDropContext*>(this)); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/dtrans/targetdropcontext.hxx b/vcl/win/dtrans/targetdropcontext.hxx index 8584c581db0a..6b3389c40017 100644 --- a/vcl/win/dtrans/targetdropcontext.hxx +++ b/vcl/win/dtrans/targetdropcontext.hxx @@ -29,7 +29,7 @@ using namespace ::cppu; using namespace ::com::sun::star::uno; using namespace ::com::sun::star::lang; -class TargetDropContext: public WeakImplHelper<XDropTargetDropContext> +class TargetDropContext : public WeakImplHelper<XDropTargetDropContext> { // calls to the functions of XDropTargetDropContext are delegated // to non-interface functions of m_pDropTarget @@ -38,15 +38,15 @@ class TargetDropContext: public WeakImplHelper<XDropTargetDropContext> public: explicit TargetDropContext(DropTarget* pTarget); ~TargetDropContext() override; - TargetDropContext( const TargetDropContext&) = delete; - TargetDropContext &operator= ( const TargetDropContext&) = delete; + TargetDropContext(const TargetDropContext&) = delete; + TargetDropContext& operator=(const TargetDropContext&) = delete; // XDropTargetDragContext - virtual void SAL_CALL acceptDrop( sal_Int8 dropOperation ) override; - virtual void SAL_CALL rejectDrop( ) override; + virtual void SAL_CALL acceptDrop(sal_Int8 dropOperation) override; + virtual void SAL_CALL rejectDrop() override; // XDropTargetDropContext (inherits XDropTargetDragContext) - virtual void SAL_CALL dropComplete( sal_Bool success ) override; + virtual void SAL_CALL dropComplete(sal_Bool success) override; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/win/gdi/winlayout.cxx b/vcl/win/gdi/winlayout.cxx index feda998d5759..7863a3c353d2 100644 --- a/vcl/win/gdi/winlayout.cxx +++ b/vcl/win/gdi/winlayout.cxx @@ -54,9 +54,9 @@ #include <shlwapi.h> #include <winver.h> -GlobalWinGlyphCache * GlobalWinGlyphCache::get() +GlobalWinGlyphCache* GlobalWinGlyphCache::get() { - SalData *data = GetSalData(); + SalData* data = GetSalData(); if (!data->m_pGlobalWinGlyphCache) { if (OpenGLHelper::isVCLOpenGLEnabled()) @@ -85,10 +85,11 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT hFont, int nGlyphIndex, return false; } const ::comphelper::ScopeGuard aHFONTrestoreScopeGuard( - [&aHDC,hOrigFont]() { SelectFont(aHDC.get(), hOrigFont); }); + [&aHDC, hOrigFont]() { SelectFont(aHDC.get(), hOrigFont); }); // For now we assume DWrite is present and we won't bother with fallback paths. - D2DWriteTextOutRenderer * pTxt = dynamic_cast<D2DWriteTextOutRenderer *>(&TextOutRenderer::get(true)); + D2DWriteTextOutRenderer* pTxt + = dynamic_cast<D2DWriteTextOutRenderer*>(&TextOutRenderer::get(true)); if (!pTxt) return false; @@ -96,7 +97,8 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT hFont, int nGlyphIndex, if (!pTxt->BindFont(aHDC.get())) { - SAL_WARN("vcl.gdi", "Binding of font failed. The font might not be supported by DirectWrite."); + SAL_WARN("vcl.gdi", + "Binding of font failed. The font might not be supported by DirectWrite."); return false; } const ::comphelper::ScopeGuard aFontReleaseScopeGuard([&pTxt]() { pTxt->ReleaseFont(); }); @@ -109,7 +111,7 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT hFont, int nGlyphIndex, if (aInkBoxes.empty()) return false; - for (auto &box : aInkBoxes) + for (auto& box : aInkBoxes) bounds.Union(box + Point(bounds.Right(), 0)); // bounds.Top() is the offset from the baseline at (0,0) to the top of the @@ -122,8 +124,8 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT hFont, int nGlyphIndex, // individual rectangles for each glyph. The ABC widths don't // take anti-aliasing into consideration. Let's hope that leaving // "extra" space between glyphs will help. - std::vector<float> aGlyphAdv(1); // offsets between glyphs - std::vector<DWRITE_GLYPH_OFFSET> aGlyphOffset(1, {0.0f, 0.0f}); + std::vector<float> aGlyphAdv(1); // offsets between glyphs + std::vector<DWRITE_GLYPH_OFFSET> aGlyphOffset(1, { 0.0f, 0.0f }); std::vector<int> aEnds(1); // end of each glyph box float fHScale = getHScale(); float totWidth = 0; @@ -150,7 +152,8 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT hFont, int nGlyphIndex, aElement.maLocation.SetBottom(bounds.getHeight() + aElement.getExtraSpace()); nPos = aEnds[0]; - std::unique_ptr<CompatibleDC> aDC(CompatibleDC::create(rGraphics, 0, 0, nBitmapWidth, nBitmapHeight)); + std::unique_ptr<CompatibleDC> aDC( + CompatibleDC::create(rGraphics, 0, 0, nBitmapWidth, nBitmapHeight)); SetTextColor(aDC->getCompatibleHDC(), RGB(0, 0, 0)); SetBkColor(aDC->getCompatibleHDC(), RGB(255, 255, 255)); @@ -164,21 +167,13 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT hFont, int nGlyphIndex, if (!SUCCEEDED(pRT->CreateSolidColorBrush(D2D1::ColorF(D2D1::ColorF::Black), &pBrush))) return false; - D2D1_POINT_2F baseline = { - static_cast<FLOAT>(aElement.getExtraOffset()), - static_cast<FLOAT>(aElement.getExtraOffset() + aElement.mnBaselineOffset) - }; - - DWRITE_GLYPH_RUN glyphs = { - pTxt->GetFontFace(), - pTxt->GetEmHeight(), - 1, - aGlyphIndices.data(), - aGlyphAdv.data(), - aGlyphOffset.data(), - false, - 0 - }; + D2D1_POINT_2F baseline + = { static_cast<FLOAT>(aElement.getExtraOffset()), + static_cast<FLOAT>(aElement.getExtraOffset() + aElement.mnBaselineOffset) }; + + DWRITE_GLYPH_RUN glyphs + = { pTxt->GetFontFace(), pTxt->GetEmHeight(), 1, aGlyphIndices.data(), + aGlyphAdv.data(), aGlyphOffset.data(), false, 0 }; WinFontTransformGuard aTransformGuard(pRT, fHScale, rLayout, baseline); pRT->BeginDraw(); @@ -189,14 +184,15 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT hFont, int nGlyphIndex, switch (hResult) { - case S_OK: - break; - case D2DERR_RECREATE_TARGET: - pTxt->CreateRenderTarget(); - break; - default: - SAL_WARN("vcl.gdi", "DrawGlyphRun-EndDraw failed: " << WindowsErrorString(GetLastError())); - return false; + case S_OK: + break; + case D2DERR_RECREATE_TARGET: + pTxt->CreateRenderTarget(); + break; + default: + SAL_WARN("vcl.gdi", + "DrawGlyphRun-EndDraw failed: " << WindowsErrorString(GetLastError())); + return false; } if (!GlobalWinGlyphCache::get()->AllocateTexture(aElement, aDC.get())) @@ -207,12 +203,12 @@ bool WinFontInstance::CacheGlyphToAtlas(HDC hDC, HFONT hFont, int nGlyphIndex, return true; } -TextOutRenderer & TextOutRenderer::get(bool bUseDWrite) +TextOutRenderer& TextOutRenderer::get(bool bUseDWrite) { - SalData *const pSalData = GetSalData(); + SalData* const pSalData = GetSalData(); if (!pSalData) - { // don't call this after DeInitVCL() + { // don't call this after DeInitVCL() fprintf(stderr, "TextOutRenderer fatal error: no SalData"); abort(); } @@ -232,12 +228,10 @@ TextOutRenderer & TextOutRenderer::get(bool bUseDWrite) return *pSalData->m_pExTextOutRenderer; } - -bool ExTextOutRenderer::operator ()(GenericSalLayout const &rLayout, - SalGraphics & /*rGraphics*/, - HDC hDC) +bool ExTextOutRenderer::operator()(GenericSalLayout const& rLayout, SalGraphics& /*rGraphics*/, + HDC hDC) { - HFONT hFont = static_cast<HFONT>(GetCurrentObject( hDC, OBJ_FONT )); + HFONT hFont = static_cast<HFONT>(GetCurrentObject(hDC, OBJ_FONT)); ScopedHFONT hAltFont; bool bUseAltFont = false; bool bShift = false; @@ -248,7 +242,7 @@ bool ExTextOutRenderer::operator ()(GenericSalLayout const &rLayout, if (aLogFont.lfFaceName[0] == '@') { memmove(&aLogFont.lfFaceName[0], &aLogFont.lfFaceName[1], - sizeof(aLogFont.lfFaceName)-sizeof(aLogFont.lfFaceName[0])); + sizeof(aLogFont.lfFaceName) - sizeof(aLogFont.lfFaceName[0])); hAltFont.reset(CreateFontIndirectW(&aLogFont)); } else @@ -260,7 +254,7 @@ bool ExTextOutRenderer::operator ()(GenericSalLayout const &rLayout, } } - UINT nTextAlign = GetTextAlign ( hDC ); + UINT nTextAlign = GetTextAlign(hDC); int nStart = 0; Point aPos(0, 0); const GlyphItem* pGlyph; @@ -273,7 +267,7 @@ bool ExTextOutRenderer::operator ()(GenericSalLayout const &rLayout, SelectFont(hDC, bUseAltFont ? hAltFont.get() : hFont); } if (bShift && pGlyph->IsVertical()) - SetTextAlign(hDC, TA_TOP|TA_LEFT); + SetTextAlign(hDC, TA_TOP | TA_LEFT); ExtTextOutW(hDC, aPos.X(), aPos.Y(), ETO_GLYPH_INDEX, nullptr, &glyphWStr, 1, nullptr); @@ -317,7 +311,7 @@ WinFontInstance::~WinFontInstance() bool WinFontInstance::hasHScale() const { - const FontSelectPattern &rPattern = GetFontSelectPattern(); + const FontSelectPattern& rPattern = GetFontSelectPattern(); int nHeight(rPattern.mnHeight); int nWidth(rPattern.mnWidth ? rPattern.mnWidth * GetAverageWidthFactor() : nHeight); return nWidth != nHeight; @@ -333,29 +327,29 @@ float WinFontInstance::getHScale() const return nWidth / nHeight; } -namespace { - +namespace +{ struct BlobReference { hb_blob_t* mpBlob; - BlobReference(hb_blob_t* pBlob) : mpBlob(pBlob) + BlobReference(hb_blob_t* pBlob) + : mpBlob(pBlob) { hb_blob_reference(mpBlob); } - BlobReference(BlobReference const & other) + BlobReference(BlobReference const& other) : mpBlob(other.mpBlob) { hb_blob_reference(mpBlob); } ~BlobReference() { hb_blob_destroy(mpBlob); } }; - } using BlobCacheKey = std::pair<rtl::Reference<PhysicalFontFace>, hb_tag_t>; -namespace { - +namespace +{ struct BlobCacheKeyHash { std::size_t operator()(BlobCacheKey const& rKey) const @@ -366,7 +360,6 @@ struct BlobCacheKeyHash return seed; } }; - } static hb_blob_t* getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pUserData) @@ -379,7 +372,7 @@ static hb_blob_t* getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pU assert(hDC); assert(hFont); - BlobCacheKey cacheKey { rtl::Reference<PhysicalFontFace>(pFont->GetFontFace()), nTableTag }; + BlobCacheKey cacheKey{ rtl::Reference<PhysicalFontFace>(pFont->GetFontFace()), nTableTag }; auto it = gCache.find(cacheKey); if (it != gCache.end()) { @@ -402,11 +395,12 @@ static hb_blob_t* getFontTable(hb_face_t* /*face*/, hb_tag_t nTableTag, void* pU if (!pBuffer) return nullptr; - hb_blob_t* pBlob = hb_blob_create(reinterpret_cast<const char*>(pBuffer), nLength, HB_MEMORY_MODE_READONLY, - pBuffer, [](void* data){ delete[] static_cast<unsigned char*>(data); }); + hb_blob_t* pBlob + = hb_blob_create(reinterpret_cast<const char*>(pBuffer), nLength, HB_MEMORY_MODE_READONLY, + pBuffer, [](void* data) { delete[] static_cast<unsigned char*>(data); }); if (!pBlob) return pBlob; - gCache.insert({cacheKey, BlobReference(pBlob)}); + gCache.insert({ cacheKey, BlobReference(pBlob) }); return pBlob; } @@ -442,7 +436,7 @@ hb_font_t* WinFontInstance::ImplInitHbFont() return pHbFont; } -void WinFontInstance::SetGraphics(WinSalGraphics *pGraphics) +void WinFontInstance::SetGraphics(WinSalGraphics* pGraphics) { m_pGraphics = pGraphics; if (m_hFont) @@ -491,7 +485,7 @@ bool WinSalGraphics::DrawCachedGlyphs(const GenericSalLayout& rLayout) COLORREF color = GetTextColor(hDC); Color salColor(GetRValue(color), GetGValue(color), GetBValue(color)); - WinSalGraphicsImplBase *pImpl = dynamic_cast<WinSalGraphicsImplBase*>(mpImpl.get()); + WinSalGraphicsImplBase* pImpl = dynamic_cast<WinSalGraphicsImplBase*>(mpImpl.get()); if (!pImpl->UseTextDraw()) return false; @@ -508,8 +502,7 @@ bool WinSalGraphics::DrawCachedGlyphs(const GenericSalLayout& rLayout) if (!texture || !texture->isValid()) return false; - SalTwoRect a2Rects(0, 0, - texture->GetWidth(), texture->GetHeight(), + SalTwoRect a2Rects(0, 0, texture->GetWidth(), texture->GetHeight(), aPos.X() - rElement.getExtraOffset() + rElement.maLeftOverhangs, aPos.Y() - rElement.mnBaselineOffset - rElement.getExtraOffset(), texture->GetWidth(), texture->GetHeight()); @@ -520,21 +513,18 @@ bool WinSalGraphics::DrawCachedGlyphs(const GenericSalLayout& rLayout) return true; } -static void PruneGlyphCache() -{ - GlobalWinGlyphCache::get()->Prune(); -} +static void PruneGlyphCache() { GlobalWinGlyphCache::get()->Prune(); } void WinSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout, HDC hDC, bool bUseDWrite) { - TextOutRenderer &render = TextOutRenderer::get(bUseDWrite); + TextOutRenderer& render = TextOutRenderer::get(bUseDWrite); render(rLayout, *this, hDC); } void WinSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout) { WinSalGraphicsImplBase* pImpl = dynamic_cast<WinSalGraphicsImplBase*>(mpImpl.get()); - if( !mbPrinter && pImpl->DrawTextLayout(rLayout)) + if (!mbPrinter && pImpl->DrawTextLayout(rLayout)) return; // handled by pImpl HDC hDC = getHDC(); @@ -593,18 +583,21 @@ void WinSalGraphics::DrawTextLayout(const GenericSalLayout& rLayout) tools::Rectangle aRect; rLayout.GetBoundRect(aRect); - if( aRect.IsEmpty()) + if (aRect.IsEmpty()) return; pImpl->PreDrawText(); - std::unique_ptr<CompatibleDC> aDC(CompatibleDC::create(*this, aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight())); + std::unique_ptr<CompatibleDC> aDC(CompatibleDC::create( + *this, aRect.Left(), aRect.Top(), aRect.GetWidth(), aRect.GetHeight())); // we are making changes to the DC, make sure we got a new one assert(aDC->getCompatibleHDC() != hDC); - RECT aWinRect = { aRect.Left(), aRect.Top(), aRect.Left() + aRect.GetWidth(), aRect.Top() + aRect.GetHeight() }; - ::FillRect(aDC->getCompatibleHDC(), &aWinRect, static_cast<HBRUSH>(::GetStockObject(WHITE_BRUSH))); + RECT aWinRect = { aRect.Left(), aRect.Top(), aRect.Left() + aRect.GetWidth(), + aRect.Top() + aRect.GetHeight() }; + ::FillRect(aDC->getCompatibleHDC(), &aWinRect, + static_cast<HBRUSH>(::GetStockObject(WHITE_BRUSH))); // setup the hidden DC with black color and white background, we will // use the result of the text drawing later as a mask only |