[Libreoffice-commits] core.git: 2 commits - include/vcl offapi/com offapi/UnoApi_offapi.mk sw/inc sw/source vcl/win
László Németh
laszlo.nemeth at collabora.com
Thu May 7 08:48:34 PDT 2015
include/vcl/sysdata.hxx | 2
offapi/UnoApi_offapi.mk | 3
offapi/com/sun/star/text/GenericTextDocument.idl | 3
offapi/com/sun/star/tiledrendering/XTiledRenderable.idl | 79 ++++++++++++++++
sw/inc/unotxdoc.hxx | 7 +
sw/source/uibase/uno/unotxdoc.cxx | 27 +++++
vcl/win/source/gdi/salvd.cxx | 4
7 files changed, 120 insertions(+), 5 deletions(-)
New commits:
commit a1bfad005cfb0b54744746da20a81f9bb8908ae0
Author: László Németh <laszlo.nemeth at collabora.com>
Date: Mon Apr 27 16:22:11 2015 +0200
XTiledRenderable: use HWND instead of HDC
Cherry-picked from e1fb63bb8ed7a9bd4dbe19be0d0da7245c4a2fb2
Change-Id: I2959ea8b1213d6dade1c2567365f177bf542e075
diff --git a/include/vcl/sysdata.hxx b/include/vcl/sysdata.hxx
index a4fad69..a525f77 100644
--- a/include/vcl/sysdata.hxx
+++ b/include/vcl/sysdata.hxx
@@ -137,6 +137,7 @@ struct SystemGraphicsData
unsigned long nSize; // size in bytes of this structure
#if defined( WNT )
HDC hDC; // handle to a device context
+ HWND hWnd; // optional handle to a window
#elif defined( MACOSX )
CGContextRef rCGContext; // CoreGraphics graphic context
#elif defined( ANDROID )
@@ -156,6 +157,7 @@ struct SystemGraphicsData
: nSize( sizeof( SystemGraphicsData ) )
#if defined( WNT )
, hDC( 0 )
+ , hWnd( 0 )
#elif defined( MACOSX )
, rCGContext( NULL )
#elif defined( ANDROID )
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index 01d78fe..86689a0 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -3289,7 +3289,7 @@ void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_I
#if defined WNT
sal_Int64 nWindowHandle;
Parent >>= nWindowHandle;
- aData.hDC = (HDC) nWindowHandle;
+ aData.hWnd = (HWND) nWindowHandle;
VirtualDevice aDevice(&aData, Size(1, 1), (sal_uInt16)32);
paintTile( aDevice, nOutputWidth, nOutputHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight );
#else
diff --git a/vcl/win/source/gdi/salvd.cxx b/vcl/win/source/gdi/salvd.cxx
index c76432d..340e160 100644
--- a/vcl/win/source/gdi/salvd.cxx
+++ b/vcl/win/source/gdi/salvd.cxx
@@ -79,7 +79,7 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics,
if( pData )
{
- hDC = pData->hDC;
+ hDC = (pData->hDC) ? pData->hDC : GetDC(pData->hWnd);
hBmp = NULL;
bOk = (hDC != NULL);
if (bOk)
@@ -137,7 +137,7 @@ SalVirtualDevice* WinSalInstance::CreateVirtualDevice( SalGraphics* pSGraphics,
pVDev->mpGraphics = pVirGraphics;
pVDev->mnBitCount = nBitCount;
pVDev->mbGraphics = FALSE;
- pVDev->mbForeignDC = (pData != NULL);
+ pVDev->mbForeignDC = (pData != NULL && pData->hDC != NULL );
// insert VirDev in VirDevList
pVDev->mpNext = pSalData->mpFirstVD;
commit 96a6128b9259e62ae0b2872a3157bb1bb32d2a6d
Author: László Németh <laszlo.nemeth at collabora.com>
Date: Fri Apr 24 13:58:04 2015 +0200
Initial XTiledRenderable API
Cherry-picked from e2ad83e25aa86bc377b664d6d07a0b86abf487c0
Change-Id: I6dc337ec958c1e116fc9763877f331b751b64e6e
diff --git a/offapi/UnoApi_offapi.mk b/offapi/UnoApi_offapi.mk
index df73e01..97f4f3e 100644
--- a/offapi/UnoApi_offapi.mk
+++ b/offapi/UnoApi_offapi.mk
@@ -1484,6 +1484,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,com/sun/star/text/textfield
Subject \
Title \
))
+$(eval $(call gb_UnoApi_add_idlfiles,offapi,com/sun/star/tiledrendering,\
+ XTiledRenderable \
+))
$(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,com/sun/star/ucb,\
CachedContentResultSet \
CachedContentResultSetStub \
diff --git a/offapi/com/sun/star/text/GenericTextDocument.idl b/offapi/com/sun/star/text/GenericTextDocument.idl
index 9956b80..ad4e3d4 100644
--- a/offapi/com/sun/star/text/GenericTextDocument.idl
+++ b/offapi/com/sun/star/text/GenericTextDocument.idl
@@ -23,6 +23,7 @@
#include <com/sun/star/text/XTextDocument.idl>
#include <com/sun/star/util/XSearchable.idl>
#include <com/sun/star/util/XRefreshable.idl>
+#include <com/sun/star/tiledrendering/XTiledRenderable.idl>
#include <com/sun/star/text/XFootnotesSupplier.idl>
#include <com/sun/star/text/XEndnotesSupplier.idl>
#include <com/sun/star/util/XReplaceable.idl>
@@ -76,6 +77,8 @@ published service GenericTextDocument
interface com::sun::star::util::XRefreshable;
+ [optional] interface com::sun::star::tiledrendering::XTiledRenderable;
+
[optional] interface com::sun::star::text::XFootnotesSupplier;
[optional] interface com::sun::star::text::XEndnotesSupplier;
diff --git a/offapi/com/sun/star/tiledrendering/XTiledRenderable.idl b/offapi/com/sun/star/tiledrendering/XTiledRenderable.idl
new file mode 100644
index 0000000..2755e74
--- /dev/null
+++ b/offapi/com/sun/star/tiledrendering/XTiledRenderable.idl
@@ -0,0 +1,79 @@
+/* -*- 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 .
+ */
+
+#ifndef __com_sun_star_awt_XTiledRenderable_idl__
+#define __com_sun_star_awt_XTiledRenderable_idl__
+
+#include <com/sun/star/uno/XInterface.idl>
+
+module com { module sun { module star { module tiledrendering {
+
+/** tiled rendering using a system-specific handle to a window
+ */
+published interface XTiledRenderable : com::sun::star::uno::XInterface
+{
+
+ /** paint a tile to a system-specific window
+ *
+
+ @param Parent
+ a system-specific handle to a window.
+
+ <p>You must check the machine ID and the process ID.<BR>
+ WIN32: HWND.<BR>
+ WIN16: HWND.<BR>
+
+ JAVA: global reference to a java.awt.Component
+ object provided from the JNI-API.<BR>
+
+ MAC: (NSView*) pointer.<BR></p>
+
+ @param nOutputWidth
+ horizontal output parameter measured in pixels.
+
+ @param nOutputHeight
+ vertical output parameter measured in pixels.
+
+ @param nTilePosX
+ logical X position of the top left corner of the rendered rectangle, in TWIPs.
+
+ @param nTilePosY
+ logical Y position of the top left corner of the rendered rectangle, in TWIPs.
+
+ @param nTileWidth
+ logical width of the rendered rectangle, in TWIPs.
+
+ @param nTileHeight
+ logical height of the rendered rectangle, in TWIPs.
+ */
+ void paintTile( [in] any Parent,
+ [in] long nOutputWidth,
+ [in] long nOutputHeight,
+ [in] long nTilePosX,
+ [in] long nTilePosY,
+ [in] long nTileWidth,
+ [in] long nTileHeight );
+};
+
+
+}; }; }; };
+
+#endif
+
+/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/sw/inc/unotxdoc.hxx b/sw/inc/unotxdoc.hxx
index 8a12ff0..7d80339 100644
--- a/sw/inc/unotxdoc.hxx
+++ b/sw/inc/unotxdoc.hxx
@@ -67,6 +67,7 @@
#include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase.hxx>
#include <vcl/ITiledRenderable.hxx>
+#include <com/sun/star/tiledrendering/XTiledRenderable.hpp>
#include <unobaseclass.hxx>
#include <viewopt.hxx>
@@ -128,7 +129,8 @@ SwXTextDocumentBaseClass;
class SW_DLLPUBLIC SwXTextDocument : public SwXTextDocumentBaseClass,
public SvxFmMSFactory,
public SfxBaseModel,
- public vcl::ITiledRenderable
+ public vcl::ITiledRenderable,
+ public ::com::sun::star::tiledrendering::XTiledRenderable
{
private:
class Impl;
@@ -420,6 +422,9 @@ public:
/// @see vcl::ITiledRenderable::resetSelection().
virtual void resetSelection() SAL_OVERRIDE;
+ // ::com::sun::star::tiledrendering::XTiledRenderable
+ virtual void SAL_CALL paintTile( const ::css::uno::Any& Parent, ::sal_Int32 nOutputWidth, ::sal_Int32 nOutputHeight, ::sal_Int32 nTilePosX, ::sal_Int32 nTilePosY, ::sal_Int32 nTileWidth, ::sal_Int32 nTileHeight ) throw (::css::uno::RuntimeException, ::std::exception) SAL_OVERRIDE;
+
void Invalidate();
void Reactivate(SwDocShell* pNewDocShell);
SwXDocumentPropertyHelper * GetPropertyHelper ();
diff --git a/sw/source/uibase/uno/unotxdoc.cxx b/sw/source/uibase/uno/unotxdoc.cxx
index a83bbfc..01d78fe 100644
--- a/sw/source/uibase/uno/unotxdoc.cxx
+++ b/sw/source/uibase/uno/unotxdoc.cxx
@@ -20,6 +20,7 @@
#include <osl/mutex.hxx>
#include <vcl/image.hxx>
#include <vcl/virdev.hxx>
+#include <vcl/sysdata.hxx>
#include <vcl/svapp.hxx>
#include <vcl/print.hxx>
#include <sfx2/viewfrm.hxx>
@@ -289,6 +290,12 @@ Any SAL_CALL SwXTextDocument::queryInterface( const uno::Type& rType ) throw(Run
Reference<lang::XMultiServiceFactory> xTmp = this;
aRet <<= xTmp;
}
+ if ( !aRet.hasValue() &&
+ rType == cppu::UnoType<tiledrendering::XTiledRenderable>::get())
+ {
+ Reference<tiledrendering::XTiledRenderable> xTmp = this;
+ aRet <<= xTmp;
+ }
if ( !aRet.hasValue()
&& rType != cppu::UnoType<com::sun::star::document::XDocumentEventBroadcaster>::get()
@@ -338,8 +345,8 @@ Sequence< uno::Type > SAL_CALL SwXTextDocument::getTypes() throw(RuntimeExceptio
}
}
long nIndex = aBaseTypes.getLength();
- // don't forget the lang::XMultiServiceFactory
- aBaseTypes.realloc(aBaseTypes.getLength() + aTextTypes.getLength() + aNumTypes.getLength() + 1);
+ // don't forget the lang::XMultiServiceFactory and the XTiledRenderable
+ aBaseTypes.realloc(aBaseTypes.getLength() + aTextTypes.getLength() + aNumTypes.getLength() + 2);
uno::Type* pBaseTypes = aBaseTypes.getArray();
const uno::Type* pTextTypes = aTextTypes.getConstArray();
long nPos;
@@ -353,6 +360,7 @@ Sequence< uno::Type > SAL_CALL SwXTextDocument::getTypes() throw(RuntimeExceptio
pBaseTypes[nIndex++] = pNumTypes[nPos];
}
pBaseTypes[nIndex++] = cppu::UnoType<lang::XMultiServiceFactory>::get();
+ pBaseTypes[nIndex++] = cppu::UnoType<tiledrendering::XTiledRenderable>::get();
return aBaseTypes;
}
@@ -3274,6 +3282,21 @@ void SwXTextDocument::resetSelection()
pWrtShell->ResetSelect(0, false);
}
+void SAL_CALL SwXTextDocument::paintTile( const ::css::uno::Any& Parent, ::sal_Int32 nOutputWidth, ::sal_Int32 nOutputHeight, ::sal_Int32 nTilePosX, ::sal_Int32 nTilePosY, ::sal_Int32 nTileWidth, ::sal_Int32 nTileHeight ) throw (::css::uno::RuntimeException, ::std::exception)
+{
+ SystemGraphicsData aData;
+ aData.nSize = sizeof(SystemGraphicsData);
+ #if defined WNT
+ sal_Int64 nWindowHandle;
+ Parent >>= nWindowHandle;
+ aData.hDC = (HDC) nWindowHandle;
+ VirtualDevice aDevice(&aData, Size(1, 1), (sal_uInt16)32);
+ paintTile( aDevice, nOutputWidth, nOutputHeight, nTilePosX, nTilePosY, nTileWidth, nTileHeight );
+ #else
+ // TODO: support other platforms
+ #endif
+}
+
void * SAL_CALL SwXTextDocument::operator new( size_t t) throw()
{
return SwXTextDocumentBaseClass::operator new(t);
More information about the Libreoffice-commits
mailing list