[Libreoffice-commits] core.git: sfx2/source

Jan Holesovsky kendy at collabora.com
Thu Nov 14 10:16:51 PST 2013


 sfx2/source/dialog/backingwindow.cxx |   56 ++++++++++++++++++++++++++++++++---
 sfx2/source/dialog/backingwindow.hxx |    5 +--
 2 files changed, 55 insertions(+), 6 deletions(-)

New commits:
commit 663fd49286f67d1bbb7fcccc6672ba7f11401ace
Author: Jan Holesovsky <kendy at collabora.com>
Date:   Thu Nov 14 19:06:16 2013 +0100

    startcenter: Make the Help and Extensions button work.
    
    Change-Id: I9017dd830c44f642f7d4821345f3831c9031ff9f

diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index fa4943bd..31d399e 100644
--- a/sfx2/source/dialog/backingwindow.cxx
+++ b/sfx2/source/dialog/backingwindow.cxx
@@ -25,18 +25,21 @@
 #include <unotools/dynamicmenuoptions.hxx>
 #include <svtools/openfiledroptargetlistener.hxx>
 #include <svtools/colorcfg.hxx>
+#include <svtools/langhelp.hxx>
 
 #include <comphelper/processfactory.hxx>
 #include <comphelper/sequenceashashmap.hxx>
 
 #include <toolkit/awt/vclxmenu.hxx>
 
+#include <com/sun/star/configuration/theDefaultProvider.hpp>
+#include <com/sun/star/container/XNameAccess.hpp>
 #include <com/sun/star/document/MacroExecMode.hpp>
 #include <com/sun/star/document/UpdateDocMode.hpp>
 #include <com/sun/star/frame/Desktop.hpp>
 #include <com/sun/star/lang/XMultiServiceFactory.hpp>
-#include <com/sun/star/container/XNameAccess.hpp>
-#include <com/sun/star/configuration/theDefaultProvider.hpp>
+#include <com/sun/star/system/SystemShellExecute.hpp>
+#include <com/sun/star/system/SystemShellExecuteFlags.hpp>
 #include <com/sun/star/util/URLTransformer.hpp>
 #include <com/sun/star/task/InteractionHandler.hpp>
 
@@ -141,6 +144,9 @@ BackingWindow::BackingWindow( Window* i_pParent ) :
     mpDBAllButton->SetHelpId( ".HelpId:StartCenter:DBButton" );
     mpMathAllButton->SetHelpId( ".HelpId:StartCenter:MathButton" );
 
+    mpHelpButton->SetHelpId(".HelpId:StartCenter:Info");
+    mpExtensionsButton->SetHelpId(".HelpId:StartCenter:Extensions");
+
     // init background
     SetBackground();
 }
@@ -216,8 +222,6 @@ void BackingWindow::initControls()
     setupButton( mpOpenButton );
     setupButton( mpTemplateButton );
 
-    mpCreateLabel->SetControlForeground(aButtonsText);
-
     setupButton( mpWriterAllButton );
     setupButton( mpDrawAllButton );
     setupButton( mpCalcAllButton );
@@ -225,6 +229,12 @@ void BackingWindow::initControls()
     setupButton( mpImpressAllButton );
     setupButton( mpMathAllButton );
 
+    mpHelpButton->SetClickHdl(LINK(this, BackingWindow, ExtLinkClickHdl));
+    mpExtensionsButton->SetClickHdl(LINK(this, BackingWindow, ExtLinkClickHdl));
+
+    // setup nice colors
+    mpCreateLabel->SetControlForeground(aButtonsText);
+
     mpHelpButton->SetControlForeground(aButtonsText);
     mpExtensionsButton->SetControlForeground(aButtonsText);
 
@@ -340,6 +350,44 @@ void BackingWindow::Resize()
         Invalidate();
 }
 
+IMPL_LINK(BackingWindow, ExtLinkClickHdl, Button*, pButton)
+{
+    OUString aNode;
+
+    if (pButton == mpExtensionsButton)
+        aNode = "AddFeatureURL";
+    else if (pButton == mpHelpButton)
+        aNode = "InfoURL";
+
+    if (!aNode.isEmpty())
+    {
+        try
+        {
+            Sequence<Any> args(1);
+            PropertyValue val("nodepath", 0, Any(OUString("/org.openoffice.Office.Common/Help/StartCenter")), PropertyState_DIRECT_VALUE);
+            args.getArray()[0] <<= val;
+
+            Reference<lang::XMultiServiceFactory> xConfig = configuration::theDefaultProvider::get( comphelper::getProcessComponentContext() );
+            Reference<container::XNameAccess> xNameAccess(xConfig->createInstanceWithArguments(SERVICENAME_CFGREADACCESS, args), UNO_QUERY);
+            if (xNameAccess.is())
+            {
+                OUString sURL;
+                Any value(xNameAccess->getByName(aNode));
+
+                sURL = value.get<OUString>();
+                localizeWebserviceURI(sURL);
+
+                Reference<system::XSystemShellExecute> xSystemShellExecute(system::SystemShellExecute::create(comphelper::getProcessComponentContext()));
+                xSystemShellExecute->execute(sURL, OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY);
+            }
+        }
+        catch (const Exception&)
+        {
+        }
+    }
+    return 0;
+}
+
 IMPL_LINK( BackingWindow, ClickHdl, Button*, pButton )
 {
     // dispatch the appropriate URL and end the dialog
diff --git a/sfx2/source/dialog/backingwindow.hxx b/sfx2/source/dialog/backingwindow.hxx
index 725823f..8afb203 100644
--- a/sfx2/source/dialog/backingwindow.hxx
+++ b/sfx2/source/dialog/backingwindow.hxx
@@ -95,8 +95,9 @@ class BackingWindow
                       const com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >& = com::sun::star::uno::Sequence< com::sun::star::beans::PropertyValue >()
                       );
 
-    DECL_LINK( ClickHdl, Button* );
-    DECL_LINK( OpenTemplateHdl, ThumbnailViewItem* );
+    DECL_LINK(ClickHdl, Button*);
+    DECL_LINK(ExtLinkClickHdl, Button*);
+    DECL_LINK(OpenTemplateHdl, ThumbnailViewItem*);
 
     void initControls();
 


More information about the Libreoffice-commits mailing list