summaryrefslogtreecommitdiff
path: root/cui/source/dialogs/hlmarkwn.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'cui/source/dialogs/hlmarkwn.cxx')
-rw-r--r--cui/source/dialogs/hlmarkwn.cxx92
1 files changed, 42 insertions, 50 deletions
diff --git a/cui/source/dialogs/hlmarkwn.cxx b/cui/source/dialogs/hlmarkwn.cxx
index 3ce1ba13ce7c..6430658f0b09 100644
--- a/cui/source/dialogs/hlmarkwn.cxx
+++ b/cui/source/dialogs/hlmarkwn.cxx
@@ -26,7 +26,7 @@
// UNO-Stuff
#include <comphelper/processfactory.hxx>
#include <com/sun/star/awt/XBitmap.hpp>
-#include <com/sun/star/frame/XDesktop.hpp>
+#include <com/sun/star/frame/Desktop.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
#include <com/sun/star/document/XLinkTargetSupplier.hpp>
@@ -244,66 +244,58 @@ sal_Bool SvxHlinkDlgMarkWnd::RefreshFromDoc( OUString aURL )
{
mnError = LERR_NOERROR;
- uno::Reference< lang::XMultiServiceFactory > xFactory( ::comphelper::getProcessServiceFactory() );
- if( xFactory.is() )
+ uno::Reference< frame::XDesktop2 > xDesktop = frame::Desktop::create( ::comphelper::getProcessComponentContext() );
+ uno::Reference< lang::XComponent > xComp;
+
+ if( !aURL.isEmpty() )
{
- uno::Reference< frame::XDesktop > xDesktop( xFactory->createInstance( OUString(RTL_CONSTASCII_USTRINGPARAM( "com.sun.star.frame.Desktop" )) ),
- uno::UNO_QUERY );
- if( xDesktop.is() )
+ // load from url
+ uno::Reference< frame::XComponentLoader > xLoader( xDesktop, uno::UNO_QUERY );
+ if( xLoader.is() )
{
- uno::Reference< lang::XComponent > xComp;
-
- if( !aURL.isEmpty() )
- {
- // load from url
- uno::Reference< frame::XComponentLoader > xLoader( xDesktop, uno::UNO_QUERY );
- if( xLoader.is() )
- {
- try
- {
- uno::Sequence< beans::PropertyValue > aArg(1);
- aArg.getArray()[0].Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "Hidden" ));
- aArg.getArray()[0].Value <<= (sal_Bool) sal_True;
- xComp = xLoader->loadComponentFromURL( aURL, OUString(RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0, aArg );
- }
- catch( const io::IOException& )
- {
-
- }
- catch( const lang::IllegalArgumentException& )
- {
-
- }
- }
- }
- else
+ try
{
- // the component with user focus ( current document )
- xComp = xDesktop->getCurrentComponent();
+ uno::Sequence< beans::PropertyValue > aArg(1);
+ aArg.getArray()[0].Name = OUString(RTL_CONSTASCII_USTRINGPARAM( "Hidden" ));
+ aArg.getArray()[0].Value <<= (sal_Bool) sal_True;
+ xComp = xLoader->loadComponentFromURL( aURL, OUString(RTL_CONSTASCII_USTRINGPARAM( "_blank" )), 0, aArg );
}
-
- if( xComp.is() )
+ catch( const io::IOException& )
{
- uno::Reference< document::XLinkTargetSupplier > xLTS( xComp, uno::UNO_QUERY );
- if( xLTS.is() )
- {
- if( FillTree( xLTS->getLinks() ) == 0 )
- mnError = LERR_NOENTRIES;
- }
- else
- mnError = LERR_DOCNOTOPEN;
-
- if ( !aURL.isEmpty() )
- xComp->dispose();
}
- else
+ catch( const lang::IllegalArgumentException& )
{
- if( !aURL.isEmpty() )
- mnError=LERR_DOCNOTOPEN;
+
}
}
}
+ else
+ {
+ // the component with user focus ( current document )
+ xComp = xDesktop->getCurrentComponent();
+ }
+
+ if( xComp.is() )
+ {
+ uno::Reference< document::XLinkTargetSupplier > xLTS( xComp, uno::UNO_QUERY );
+
+ if( xLTS.is() )
+ {
+ if( FillTree( xLTS->getLinks() ) == 0 )
+ mnError = LERR_NOENTRIES;
+ }
+ else
+ mnError = LERR_DOCNOTOPEN;
+
+ if ( !aURL.isEmpty() )
+ xComp->dispose();
+ }
+ else
+ {
+ if( !aURL.isEmpty() )
+ mnError=LERR_DOCNOTOPEN;
+ }
return (mnError==0);
}
/*************************************************************************