diff options
author | Tor Lillqvist <tml@collabora.com> | 2015-02-04 17:48:41 +0100 |
---|---|---|
committer | Tor Lillqvist <tml@collabora.com> | 2015-02-04 18:07:30 +0100 |
commit | 4b269ecb7a699318b067eb64c464460b1783d3d2 (patch) | |
tree | 9e9cdc73ca84f48f64a400545e84023bad86d35e /desktop | |
parent | ac8a2dee02032db2523888927f7973b219f3a9a9 (diff) |
Use LibreOfficeKit in the TiledLibreOffice iOS demo app, too
For iOS, the pBuffer argument to LibreOfficeKitDocument::paintTile()
is not a pixel buffer, but a CGContextRef. Thus we can keep the
existing CGContext-oriented vcl code for iOS as is.
I commented out the <touch/touch.h> -using code in sw, and it probably
would be OK to just kill <touch/touch.h> and remove use and
implementations of its API. I don't think they are used by our current
Android or iOS code.
This concludes the commits of the work I did at the post-FOSDEM
hackfest and on the flight home. TiledLibreOffice now works as before,
but uses LibreOfficeKit.
Change-Id: Ibbde6e11d660561840eab6335f7fc0db6758173e
Diffstat (limited to 'desktop')
-rw-r--r-- | desktop/source/app/officeipcthread.cxx | 24 | ||||
-rw-r--r-- | desktop/source/app/sofficemain.cxx | 12 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 16 |
3 files changed, 33 insertions, 19 deletions
diff --git a/desktop/source/app/officeipcthread.cxx b/desktop/source/app/officeipcthread.cxx index 58fa25a6878b..c5f2367ca24a 100644 --- a/desktop/source/app/officeipcthread.cxx +++ b/desktop/source/app/officeipcthread.cxx @@ -449,12 +449,12 @@ void OfficeIPCThread::RequestsCompleted( int nCount ) OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread() { -#if HAVE_FEATURE_DESKTOP || defined(ANDROID) ::osl::MutexGuard aGuard( GetMutex() ); if( pGlobalOfficeIPCThread.is() ) return IPC_STATUS_OK; +#if HAVE_FEATURE_DESKTOP || defined(ANDROID) OUString aUserInstallPath; OUString aDummy; @@ -605,14 +605,15 @@ OfficeIPCThread::Status OfficeIPCThread::EnableOfficeIPCThread() return IPC_STATUS_2ND_OFFICE; } #else - pGlobalOfficeIPCThread = rtl::Reference< OfficeIPCThread >(new OfficeIPCThread); + rtl::Reference< OfficeIPCThread > pThread(new OfficeIPCThread); + pGlobalOfficeIPCThread = pThread; + pThread->launch(); #endif return IPC_STATUS_OK; } void OfficeIPCThread::DisableOfficeIPCThread(bool join) { -#if HAVE_FEATURE_DESKTOP || defined(ANDROID) osl::ClearableMutexGuard aMutex( GetMutex() ); if( pGlobalOfficeIPCThread.is() ) @@ -635,9 +636,6 @@ void OfficeIPCThread::DisableOfficeIPCThread(bool join) pOfficeIPCThread->join(); } } -#else - (void) join; -#endif } OfficeIPCThread::OfficeIPCThread() : @@ -967,6 +965,20 @@ void OfficeIPCThread::execute() salhelper::Thread::wait( tval ); } } while( schedule() ); +#else + +#if 0 // Seems to work fine to let this thread just die? + + // Not sure what to do, so wait forever. Note that on iOS (or + // Android, but in this case ANDROID is handled like DESKTOP, see + // above) an app never exits voluntarily, but is always killed by + // the system when its resources are needed.) + TimeValue tval; + tval.Seconds = 100000; + tval.Nanosec = 0; + salhelper::Thread::wait( tval ); +#endif + #endif } diff --git a/desktop/source/app/sofficemain.cxx b/desktop/source/app/sofficemain.cxx index 9cee2c4cc6dd..0597a4f0d395 100644 --- a/desktop/source/app/sofficemain.cxx +++ b/desktop/source/app/sofficemain.cxx @@ -49,10 +49,6 @@ # define LOGI(...) ((void)__android_log_print(ANDROID_LOG_INFO, LOGTAG, __VA_ARGS__)) #endif -#ifdef IOS -#include <touch/touch.h> -#endif - extern "C" int DESKTOP_DLLPUBLIC soffice_main() { #if defined( UNX ) && !defined MACOSX && !defined IOS && !defined ANDROID @@ -114,22 +110,16 @@ extern "C" int DESKTOP_DLLPUBLIC soffice_main() extern "C" SAL_JNI_EXPORT void JNICALL Java_org_libreoffice_android_AppSupport_runMain(JNIEnv* /* env */, jobject /* clazz */) -#else -extern "C" -void -touch_lo_runMain() -#endif { int nRet; do { nRet = soffice_main(); -#ifdef ANDROID LOGI("soffice_main returned %d", nRet); -#endif } while (nRet == EXITHELPER_NORMAL_RESTART || nRet == EXITHELPER_CRASH_WITH_RESTART); // pretend to re-start. } +#endif extern "C" void PtylTestEncryptionAndExport(const char *pathname) { diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index c79db3b5e460..940f413a2c9b 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -50,9 +50,8 @@ #include <app.hxx> #include <salinst.hxx> -// Tiled Rendering is Linux only for now. #if defined(UNX) && !defined(MACOSX) && !defined(ENABLE_HEADLESS) -// And let's also grab the SvpSalInstance and SvpSalVirtualDevice +// Let's grab the SvpSalInstance and SvpSalVirtualDevice #include <headless/svpinst.hxx> #include <headless/svpframe.hxx> #include <headless/svpvd.hxx> @@ -582,6 +581,7 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, SvpSalInstance* pSalInstance = static_cast< SvpSalInstance* >(pSVData->mpDefInst); pSalInstance->setBitCountFormatMapping( 32, ::basebmp::FORMAT_THIRTYTWO_BIT_TC_MASK_RGBA ); +#ifndef IOS VirtualDevice aDevice(0, Size(1, 1), (sal_uInt16)32); boost::shared_array< sal_uInt8 > aBuffer( pBuffer, NoDelete< sal_uInt8 >() ); aDevice.SetOutputSizePixelScaleOffsetAndBuffer( @@ -596,6 +596,18 @@ void doc_paintTile (LibreOfficeKitDocument* pThis, *pRowStride = pBmpDev->getScanlineStride(); #else + SystemGraphicsData aData; + aData.rCGContext = reinterpret_cast<CGContextRef>(pBuffer); + // the Size argument is irrelevant, I hope + VirtualDevice aDevice(&aData, Size(1, 1), (sal_uInt16)0); + + pDoc->paintTile(aDevice, nCanvasWidth, nCanvasHeight, + nTilePosX, nTilePosY, nTileWidth, nTileHeight); + + (void) pRowStride; +#endif + +#else (void) pBuffer; (void) nCanvasWidth; (void) nCanvasHeight; |