[Libreoffice-commits] .: Branch 'feature/android' - vcl/android vcl/inc

Michael Meeks michael at kemper.freedesktop.org
Fri Feb 3 13:03:24 PST 2012


 vcl/android/androidinst.cxx     |   72 ++++++++++++++++++++++++++++++++++++++++
 vcl/inc/android/androidinst.hxx |    6 +++
 2 files changed, 78 insertions(+)

New commits:
commit 5cd1d6740cc9e85b5ed3730800dff4717cb7e1ae
Author: Michael Meeks <michael.meeks at suse.com>
Date:   Fri Feb 3 22:02:01 2012 +0100

    android: implement theming to get default font set, 1st cut at GetWorkArea

diff --git a/vcl/android/androidinst.cxx b/vcl/android/androidinst.cxx
index ec38cec..16a5125 100644
--- a/vcl/android/androidinst.cxx
+++ b/vcl/android/androidinst.cxx
@@ -347,6 +347,18 @@ static const char *app_cmd_name(int cmd)
     }
 }
 
+void AndroidSalInstance::GetWorkArea( Rectangle& rRect )
+{
+    ANativeWindow *pWindow = mpApp->window;
+    if (!pWindow)
+        rRect = Rectangle( Point( 0, 0 ),
+                           Size( 800, 600 ) );
+    else
+        rRect = Rectangle( Point( 0, 0 ),
+                           Size( ANativeWindow_getWidth( pWindow ),
+                                 ANativeWindow_getHeight( pWindow ) ) );
+}
+
 void AndroidSalInstance::onAppCmd (struct android_app* app, int32_t cmd)
 {
         fprintf (stderr, "app cmd for app %p: %s\n", app, app_cmd_name(cmd));
@@ -603,6 +615,66 @@ SalSystem *AndroidSalInstance::CreateSalSystem()
     return new AndroidSalSystem();
 }
 
+class AndroidSalFrame : public SvpSalFrame
+{
+public:
+    AndroidSalFrame( AndroidSalInstance *pInstance,
+                     SalFrame           *pParent,
+                     sal_uLong           nSalFrameStyle,
+                     SystemParentData   *pSysParent )
+        : SvpSalFrame( pInstance, pParent, nSalFrameStyle, pSysParent )
+    {
+    }
+
+    virtual void GetWorkArea( Rectangle& rRect )
+    {
+        AndroidSalInstance::getInstance()->GetWorkArea( rRect );
+    }
+
+    virtual void UpdateSettings( AllSettings &rSettings )
+    {
+        // Clobber the UI fonts
+#if 0
+        psp::FastPrintFontInfo aInfo;
+        aInfo.m_aFamilyName = rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Roboto" ) );
+        aInfo.m_eItalic = ITALIC_NORMAL;
+        aInfo.m_eWeight = WEIGHT_NORMAL;
+        aInfo.m_eWidth = WIDTH_NORMAL;
+        psp::PrintFontManager::get().matchFont( aInfo, rSettings.GetUILocale() );
+#endif
+
+        // FIXME: is 12 point enough ?
+        Font aFont( rtl::OUString( RTL_CONSTASCII_USTRINGPARAM( "Roboto" ) ),
+                    Size( 0, 14 ) );
+
+        StyleSettings aStyleSet = rSettings.GetStyleSettings();
+        aStyleSet.SetAppFont( aFont );
+        aStyleSet.SetHelpFont( aFont );
+        aStyleSet.SetMenuFont( aFont );
+        aStyleSet.SetToolFont( aFont );
+        aStyleSet.SetLabelFont( aFont );
+        aStyleSet.SetInfoFont( aFont );
+        aStyleSet.SetRadioCheckFont( aFont );
+        aStyleSet.SetPushButtonFont( aFont );
+        aStyleSet.SetFieldFont( aFont );
+        aStyleSet.SetIconFont( aFont );
+        aStyleSet.SetGroupFont( aFont );
+
+        rSettings.SetStyleSettings( aStyleSet );
+    }
+};
+
+SalFrame *AndroidSalInstance::CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle )
+{
+    return new AndroidSalFrame( this, NULL, nStyle, pParent );
+}
+
+SalFrame *AndroidSalInstance::CreateFrame( SalFrame* pParent, sal_uLong nStyle )
+{
+    return new AndroidSalFrame( this, pParent, nStyle, NULL );
+}
+
+
 // All the interesting stuff is slaved from the AndroidSalInstance
 void InitSalData()   {}
 void DeInitSalData() {}
diff --git a/vcl/inc/android/androidinst.hxx b/vcl/inc/android/androidinst.hxx
index e947737..10d17c5 100644
--- a/vcl/inc/android/androidinst.hxx
+++ b/vcl/inc/android/androidinst.hxx
@@ -49,6 +49,11 @@ public:
 
     virtual SalSystem* CreateSalSystem();
 
+    // frame management
+    void GetWorkArea( Rectangle& rRect );
+    SalFrame* CreateFrame( SalFrame* pParent, sal_uLong nStyle );
+    SalFrame* CreateChildFrame( SystemParentData* pParent, sal_uLong nStyle );
+
     // mainloop pieces
     virtual void Wakeup();
     virtual bool AnyInput( sal_uInt16 nType );
@@ -58,6 +63,7 @@ public:
     int32_t   onInputEvent (struct android_app* app, AInputEvent* event);
     void      RedrawWindows(ANativeWindow *pWindow);
     SalFrame *getFocusFrame() const;
+
 protected:
     virtual void DoReleaseYield( int nTimeoutMS );
     struct android_app *mpApp;


More information about the Libreoffice-commits mailing list