[Libreoffice-commits] .: 3 commits - ios/CustomTarget_Viewer_app.mk ios/experimental sfx2/source toolkit/source

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sun Jan 6 14:50:34 PST 2013


 ios/CustomTarget_Viewer_app.mk              |    4 ++
 ios/experimental/Viewer/Viewer/lo-viewer.mm |   44 ++++++++++++++++++++++++++--
 sfx2/source/appl/appdata.cxx                |    2 +
 sfx2/source/appl/appinit.cxx                |    5 ++-
 sfx2/source/appl/appquit.cxx                |    4 ++
 sfx2/source/inc/appdata.hxx                 |    4 ++
 toolkit/source/awt/vclxtoolkit.cxx          |    7 ----
 7 files changed, 60 insertions(+), 10 deletions(-)

New commits:
commit 32e927952cff4f715eceb861a3c4c8ab088be405
Author: Tor Lillqvist <tml at iki.fi>
Date:   Mon Jan 7 00:42:06 2013 +0200

    Add a sample document to the test app bundle and try to load it
    
    Change-Id: Id0f13351108cbcd748f3c403fe7a6716145f1892

diff --git a/ios/CustomTarget_Viewer_app.mk b/ios/CustomTarget_Viewer_app.mk
index 9af7a49..8c05728 100644
--- a/ios/CustomTarget_Viewer_app.mk
+++ b/ios/CustomTarget_Viewer_app.mk
@@ -127,6 +127,10 @@ $(SCRIPT_OUTPUT_FILE_0) : $(call gb_Executable_get_target,Viewer)
 		echo 'ProductMajor=360' && \
 		echo 'ProductMinor=1' && \
 	: ) > $(appdir)/program/versionrc
+#
+# Copy a sample document... good old test1.odt...
+#
+	cp $(SRC_ROOT)/odk/examples/java/DocumentHandling/test/test1.odt $(appdir)
 
 else
 # When run just from the command line, we don't have any app bundle to
diff --git a/ios/experimental/Viewer/Viewer/lo-viewer.mm b/ios/experimental/Viewer/Viewer/lo-viewer.mm
index 616f136..10c3156 100644
--- a/ios/experimental/Viewer/Viewer/lo-viewer.mm
+++ b/ios/experimental/Viewer/Viewer/lo-viewer.mm
@@ -18,12 +18,17 @@
 #include <osl/detail/ios-bootstrap.h>
 #include <osl/process.h>
 
+#include <com/sun/star/awt/XDevice.hpp>
+#include <com/sun/star/awt/XToolkitExperimental.hpp>
+#include <com/sun/star/beans/PropertyValue.hpp>
 #include <com/sun/star/beans/XPropertySet.hpp>
 #include <com/sun/star/bridge/XUnoUrlResolver.hpp>
 #include <com/sun/star/frame/XComponentLoader.hpp>
 #include <com/sun/star/lang/XMultiComponentFactory.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
 #include <com/sun/star/registry/XSimpleRegistry.hpp>
+#include <com/sun/star/uno/XComponentContext.hpp>
+#include <com/sun/star/view/XRenderable.hpp>
 
 #include <vcl/svapp.hxx>
 
@@ -32,6 +37,8 @@ using namespace com::sun::star;
 using ::rtl::OUString;
 using ::rtl::OUStringToOString;
 
+#define SMALLSIZE 100
+
 extern "C" {
     extern void * animcore_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
     extern void * avmedia_component_getFactory( const char * pImplName, void * pServiceManager, void * pRegistryKey );
@@ -165,6 +172,9 @@ lo_initialize(void)
 
     try {
 
+        // Should start a background thread to do all this UNO
+        // initialisation crap
+
         uno::Reference< uno::XComponentContext > xContext(::cppu::defaultBootstrap_InitialComponentContext());
 
         uno::Reference< lang::XMultiComponentFactory > xFactory( xContext->getServiceManager() );
@@ -175,9 +185,37 @@ lo_initialize(void)
 
         InitVCL();
 
-        uno::Reference< uno::XInterface > xInterface =
-            xFactory->createInstanceWithContext( "com.sun.star.frame.Desktop",
-                                                 xContext );
+        // Yes, this code does of course not belong here. Once this
+        // turns into something that actually displays something and
+        // has a proper app lifecycle etc that willl be fixed. But for
+        // now this is just a test, not supposed to work in any sane
+        // way from a "user" POV, and it doesn't matter that we do
+        // this here.
+
+        uno::Reference< uno::XInterface > xDesktop =
+            xFactory->createInstanceWithContext( "com.sun.star.frame.Desktop", xContext );
+        uno::Reference< frame::XComponentLoader > xComponentLoader( xDesktop, uno::UNO_QUERY_THROW );
+
+        uno::Reference< uno::XInterface > xToolkitService =
+            xFactory->createInstanceWithContext( "com.sun.star.awt.Toolkit", xContext );
+
+        uno::Reference< awt::XToolkitExperimental > xToolkit( xToolkitService, uno::UNO_QUERY_THROW );
+
+        char *smallbb = new char[ SMALLSIZE*SMALLSIZE*4 ];
+
+        uno::Reference< awt::XDevice > xDummyDevice = xToolkit->createScreenCompatibleDeviceUsingBuffer( SMALLSIZE, SMALLSIZE, 1, 1, 0, 0, (sal_Int64) (intptr_t) smallbb);
+
+        uno::Sequence< beans::PropertyValue > loadProps(3);
+
+        loadProps[0].Name = "Hidden";
+        loadProps[0].Value <<= sal_True;
+        loadProps[1].Name = "ReadOnly";
+        loadProps[1].Value <<= sal_True;
+        loadProps[2].Name = "Preview";
+        loadProps[2].Value <<= sal_True;
+
+        OUString test1_odt( OUString( "file://" ) + OUString::createFromAscii( [[app_root_escaped stringByAppendingPathComponent: @"test1.odt"] UTF8String] ));
+        uno::Reference< lang::XComponent > xDoc = xComponentLoader->loadComponentFromURL ( test1_odt, "_blank", 0, loadProps );
     }
     catch ( uno::Exception e ) {
         SAL_WARN("Viewer", e.Message);
commit d9388579475a11054fbe7476b307f8acfcaa04df
Author: Tor Lillqvist <tml at iki.fi>
Date:   Mon Jan 7 00:35:54 2013 +0200

    Call SetOutputSizePixelScaleOffsetAndBuffer for non-Android
    
    Change-Id: I59febb87f3da3098e1644087b498d9821b5d7047

diff --git a/toolkit/source/awt/vclxtoolkit.cxx b/toolkit/source/awt/vclxtoolkit.cxx
index 8879054..38960e2 100644
--- a/toolkit/source/awt/vclxtoolkit.cxx
+++ b/toolkit/source/awt/vclxtoolkit.cxx
@@ -558,12 +558,7 @@ void SAL_CALL VCLXToolkit::disposing()
         ByteBufferWrapper *bbw = (ByteBufferWrapper *) (intptr_t) addressOfMemoryBufferForSharedArrayWrapper;
         pV->SetOutputSizePixelScaleOffsetAndBuffer( Size( Width, Height ), Fraction(ScaleNumerator, ScaleDenominator), Point( XOffset, YOffset), basebmp::RawMemorySharedArray( bbw->pointer(), *bbw ));
 #else
-        (void) ScaleNumerator;
-        (void) ScaleDenominator;
-        (void) XOffset;
-        (void) YOffset;
-        OSL_FAIL( "rendering to a pre-allocated buffer not done yet for this OS" );
-        pV->SetOutputSizePixel( Size( Width, Height ) );
+        pV->SetOutputSizePixelScaleOffsetAndBuffer( Size( Width, Height ), Fraction(ScaleNumerator, ScaleDenominator), Point( XOffset, YOffset), basebmp::RawMemorySharedArray( (sal_uInt8*) (sal_uIntPtr) addressOfMemoryBufferForSharedArrayWrapper ));
 #endif
     } else {
         pV->SetOutputSizePixel( Size( Width, Height ) );
commit 80acb4482d392ff40c56211c1048514fbda23aa5
Author: Tor Lillqvist <tml at iki.fi>
Date:   Mon Jan 7 00:34:00 2013 +0200

    Add some DISABLE_SCRIPTING ifndefs
    
    Change-Id: I2bb4f00ece212fe3c4741deea0bcad50e1fd60e1

diff --git a/sfx2/source/appl/appdata.cxx b/sfx2/source/appl/appdata.cxx
index a49e779..e31065d 100644
--- a/sfx2/source/appl/appdata.cxx
+++ b/sfx2/source/appl/appdata.cxx
@@ -86,7 +86,9 @@ SfxAppData_Impl::SfxAppData_Impl( SfxApplication* )
     , pFactArr(0)
     , pTopFrames( new SfxFrameArr_Impl )
     , pMatcher( 0 )
+#ifndef DISABLE_SCRIPTING
     , pBasicResMgr( 0 )
+#endif
     , pSvtResMgr( 0 )
     , pAppDispatch(NULL)
     , pTemplates( 0 )
diff --git a/sfx2/source/appl/appinit.cxx b/sfx2/source/appl/appinit.cxx
index 1e0864f..935d00a 100644
--- a/sfx2/source/appl/appinit.cxx
+++ b/sfx2/source/appl/appinit.cxx
@@ -240,14 +240,17 @@ bool SfxApplication::Initialize_Impl()
     pAppData_Impl->m_pToolsErrorHdl = new SfxErrorHandler(
         RID_ERRHDL, ERRCODE_AREA_TOOLS, ERRCODE_AREA_LIB1);
 
+#ifndef DISABLE_SCRIPTING
     pAppData_Impl->pBasicResMgr = CreateResManager("sb");
+#endif
     pAppData_Impl->pSvtResMgr = CreateResManager("svt");
 
     pAppData_Impl->m_pSoErrorHdl = new SfxErrorHandler(
         RID_SO_ERROR_HANDLER, ERRCODE_AREA_SO, ERRCODE_AREA_SO_END, pAppData_Impl->pSvtResMgr );
+#ifndef DISABLE_SCRIPTING
     pAppData_Impl->m_pSbxErrorHdl = new SfxErrorHandler(
         RID_BASIC_START, ERRCODE_AREA_SBX, ERRCODE_AREA_SBX_END, pAppData_Impl->pBasicResMgr );
-
+#endif
     //ensure instantiation of listener that manages the internal recently-used
     //list
     SfxPickList::ensure();
diff --git a/sfx2/source/appl/appquit.cxx b/sfx2/source/appl/appquit.cxx
index 9db9199..7a5daab 100644
--- a/sfx2/source/appl/appquit.cxx
+++ b/sfx2/source/appl/appquit.cxx
@@ -146,10 +146,14 @@ void SfxApplication::Deinitialize()
     pAppData_Impl->pPool = NULL;
     NoChaos::ReleaseItemPool();
 
+#ifndef DISABLE_SCRIPTING
     DELETEZ(pAppData_Impl->pBasicResMgr);
+#endif
     DELETEZ(pAppData_Impl->pSvtResMgr);
 
+#ifndef DISABLE_SCRIPTING
     delete pAppData_Impl->m_pSbxErrorHdl;
+#endif
     delete pAppData_Impl->m_pSoErrorHdl;
     delete pAppData_Impl->m_pToolsErrorHdl;
 #ifdef DBG_UTIL
diff --git a/sfx2/source/inc/appdata.hxx b/sfx2/source/inc/appdata.hxx
index 9b4480b..6b711fa 100644
--- a/sfx2/source/inc/appdata.hxx
+++ b/sfx2/source/inc/appdata.hxx
@@ -85,14 +85,18 @@ public:
 
     // application members
     SfxFilterMatcher*                   pMatcher;
+#ifndef DISABLE_SCRIPTING
     ResMgr*                             pBasicResMgr;
+#endif
     ResMgr*                             pSvtResMgr;
 #ifdef DBG_UTIL
     SimpleErrorHandler *m_pSimpleErrorHdl;
 #endif
     SfxErrorHandler *m_pToolsErrorHdl;
     SfxErrorHandler *m_pSoErrorHdl;
+#ifndef DISABLE_SCRIPTING
     SfxErrorHandler *m_pSbxErrorHdl;
+#endif
     SfxStatusDispatcher*                pAppDispatch;
     SfxDocumentTemplates*               pTemplates;
 


More information about the Libreoffice-commits mailing list