Kaydet (Commit) 96a6128b authored tarafından László Németh's avatar László Németh

Initial XTiledRenderable API

Cherry-picked from e2ad83e2

Change-Id: I6dc337ec958c1e116fc9763877f331b751b64e6e
üst 65376dad
...@@ -1484,6 +1484,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,com/sun/star/text/textfield ...@@ -1484,6 +1484,9 @@ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,com/sun/star/text/textfield
Subject \ Subject \
Title \ 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,\ $(eval $(call gb_UnoApi_add_idlfiles_noheader,offapi,com/sun/star/ucb,\
CachedContentResultSet \ CachedContentResultSet \
CachedContentResultSetStub \ CachedContentResultSetStub \
......
...@@ -23,6 +23,7 @@ ...@@ -23,6 +23,7 @@
#include <com/sun/star/text/XTextDocument.idl> #include <com/sun/star/text/XTextDocument.idl>
#include <com/sun/star/util/XSearchable.idl> #include <com/sun/star/util/XSearchable.idl>
#include <com/sun/star/util/XRefreshable.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/XFootnotesSupplier.idl>
#include <com/sun/star/text/XEndnotesSupplier.idl> #include <com/sun/star/text/XEndnotesSupplier.idl>
#include <com/sun/star/util/XReplaceable.idl> #include <com/sun/star/util/XReplaceable.idl>
...@@ -76,6 +77,8 @@ published service GenericTextDocument ...@@ -76,6 +77,8 @@ published service GenericTextDocument
interface com::sun::star::util::XRefreshable; 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::XFootnotesSupplier;
[optional] interface com::sun::star::text::XEndnotesSupplier; [optional] interface com::sun::star::text::XEndnotesSupplier;
......
/* -*- 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: */
...@@ -67,6 +67,7 @@ ...@@ -67,6 +67,7 @@
#include <cppuhelper/weak.hxx> #include <cppuhelper/weak.hxx>
#include <cppuhelper/implbase.hxx> #include <cppuhelper/implbase.hxx>
#include <vcl/ITiledRenderable.hxx> #include <vcl/ITiledRenderable.hxx>
#include <com/sun/star/tiledrendering/XTiledRenderable.hpp>
#include <unobaseclass.hxx> #include <unobaseclass.hxx>
#include <viewopt.hxx> #include <viewopt.hxx>
...@@ -128,7 +129,8 @@ SwXTextDocumentBaseClass; ...@@ -128,7 +129,8 @@ SwXTextDocumentBaseClass;
class SW_DLLPUBLIC SwXTextDocument : public SwXTextDocumentBaseClass, class SW_DLLPUBLIC SwXTextDocument : public SwXTextDocumentBaseClass,
public SvxFmMSFactory, public SvxFmMSFactory,
public SfxBaseModel, public SfxBaseModel,
public vcl::ITiledRenderable public vcl::ITiledRenderable,
public ::com::sun::star::tiledrendering::XTiledRenderable
{ {
private: private:
class Impl; class Impl;
...@@ -420,6 +422,9 @@ public: ...@@ -420,6 +422,9 @@ public:
/// @see vcl::ITiledRenderable::resetSelection(). /// @see vcl::ITiledRenderable::resetSelection().
virtual void resetSelection() SAL_OVERRIDE; 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 Invalidate();
void Reactivate(SwDocShell* pNewDocShell); void Reactivate(SwDocShell* pNewDocShell);
SwXDocumentPropertyHelper * GetPropertyHelper (); SwXDocumentPropertyHelper * GetPropertyHelper ();
......
...@@ -20,6 +20,7 @@ ...@@ -20,6 +20,7 @@
#include <osl/mutex.hxx> #include <osl/mutex.hxx>
#include <vcl/image.hxx> #include <vcl/image.hxx>
#include <vcl/virdev.hxx> #include <vcl/virdev.hxx>
#include <vcl/sysdata.hxx>
#include <vcl/svapp.hxx> #include <vcl/svapp.hxx>
#include <vcl/print.hxx> #include <vcl/print.hxx>
#include <sfx2/viewfrm.hxx> #include <sfx2/viewfrm.hxx>
...@@ -289,6 +290,12 @@ Any SAL_CALL SwXTextDocument::queryInterface( const uno::Type& rType ) throw(Run ...@@ -289,6 +290,12 @@ Any SAL_CALL SwXTextDocument::queryInterface( const uno::Type& rType ) throw(Run
Reference<lang::XMultiServiceFactory> xTmp = this; Reference<lang::XMultiServiceFactory> xTmp = this;
aRet <<= xTmp; aRet <<= xTmp;
} }
if ( !aRet.hasValue() &&
rType == cppu::UnoType<tiledrendering::XTiledRenderable>::get())
{
Reference<tiledrendering::XTiledRenderable> xTmp = this;
aRet <<= xTmp;
}
if ( !aRet.hasValue() if ( !aRet.hasValue()
&& rType != cppu::UnoType<com::sun::star::document::XDocumentEventBroadcaster>::get() && rType != cppu::UnoType<com::sun::star::document::XDocumentEventBroadcaster>::get()
...@@ -338,8 +345,8 @@ Sequence< uno::Type > SAL_CALL SwXTextDocument::getTypes() throw(RuntimeExceptio ...@@ -338,8 +345,8 @@ Sequence< uno::Type > SAL_CALL SwXTextDocument::getTypes() throw(RuntimeExceptio
} }
} }
long nIndex = aBaseTypes.getLength(); long nIndex = aBaseTypes.getLength();
// don't forget the lang::XMultiServiceFactory // don't forget the lang::XMultiServiceFactory and the XTiledRenderable
aBaseTypes.realloc(aBaseTypes.getLength() + aTextTypes.getLength() + aNumTypes.getLength() + 1); aBaseTypes.realloc(aBaseTypes.getLength() + aTextTypes.getLength() + aNumTypes.getLength() + 2);
uno::Type* pBaseTypes = aBaseTypes.getArray(); uno::Type* pBaseTypes = aBaseTypes.getArray();
const uno::Type* pTextTypes = aTextTypes.getConstArray(); const uno::Type* pTextTypes = aTextTypes.getConstArray();
long nPos; long nPos;
...@@ -353,6 +360,7 @@ Sequence< uno::Type > SAL_CALL SwXTextDocument::getTypes() throw(RuntimeExceptio ...@@ -353,6 +360,7 @@ Sequence< uno::Type > SAL_CALL SwXTextDocument::getTypes() throw(RuntimeExceptio
pBaseTypes[nIndex++] = pNumTypes[nPos]; pBaseTypes[nIndex++] = pNumTypes[nPos];
} }
pBaseTypes[nIndex++] = cppu::UnoType<lang::XMultiServiceFactory>::get(); pBaseTypes[nIndex++] = cppu::UnoType<lang::XMultiServiceFactory>::get();
pBaseTypes[nIndex++] = cppu::UnoType<tiledrendering::XTiledRenderable>::get();
return aBaseTypes; return aBaseTypes;
} }
...@@ -3274,6 +3282,21 @@ void SwXTextDocument::resetSelection() ...@@ -3274,6 +3282,21 @@ void SwXTextDocument::resetSelection()
pWrtShell->ResetSelect(0, false); 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() void * SAL_CALL SwXTextDocument::operator new( size_t t) throw()
{ {
return SwXTextDocumentBaseClass::operator new(t); return SwXTextDocumentBaseClass::operator new(t);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment