summaryrefslogtreecommitdiff
path: root/sfx2/source/dialog/backingwindow.cxx
diff options
context:
space:
mode:
authorJan Holesovsky <kendy@collabora.com>2013-11-14 19:06:16 +0100
committerJan Holesovsky <kendy@collabora.com>2013-11-14 19:16:28 +0100
commit663fd49286f67d1bbb7fcccc6672ba7f11401ace (patch)
treedc762660a9b20fb4642e86762eb667a7014aae8d /sfx2/source/dialog/backingwindow.cxx
parent4cdb874b1118b8e28686ff847c636132a69ef4f2 (diff)
startcenter: Make the Help and Extensions button work.
Change-Id: I9017dd830c44f642f7d4821345f3831c9031ff9f
Diffstat (limited to 'sfx2/source/dialog/backingwindow.cxx')
-rw-r--r--sfx2/source/dialog/backingwindow.cxx56
1 files changed, 52 insertions, 4 deletions
diff --git a/sfx2/source/dialog/backingwindow.cxx b/sfx2/source/dialog/backingwindow.cxx
index fa4943bd7e2f..31d399e27831 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