summaryrefslogtreecommitdiffstats
path: root/svtools/source/contnr/templwin.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noel@peralex.com>2012-05-26 13:53:19 +0200
committerStephan Bergmann <sbergman@redhat.com>2012-06-04 16:57:55 +0200
commitb3c76dee6d44d07eae404b8d7341e6c88e6c4429 (patch)
treec747dd5bddf94c3b4312c7b1861a5087e76e71d6 /svtools/source/contnr/templwin.cxx
parentImprove error reporting (diff)
downloadcore-b3c76dee6d44d07eae404b8d7341e6c88e6c4429.tar.gz
core-b3c76dee6d44d07eae404b8d7341e6c88e6c4429.zip
fdo#46808, Adapt UNO services to new style, Part 7, updating ::create
Update calls to factories to use new ::create methods Change-Id: I01d4417820f52718836c92faf3c2fae0dc96b30d Signed-off-by: Stephan Bergmann <sbergman@redhat.com>, added some tweaks.
Diffstat (limited to 'svtools/source/contnr/templwin.cxx')
-rw-r--r--svtools/source/contnr/templwin.cxx67
1 files changed, 30 insertions, 37 deletions
diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx
index aed37c9a3fea..a0f5a7b39e89 100644
--- a/svtools/source/contnr/templwin.cxx
+++ b/svtools/source/contnr/templwin.cxx
@@ -54,6 +54,7 @@
#include <com/sun/star/util/XURLTransformer.hpp>
#include <com/sun/star/util/XOfficeInstallationDirectories.hpp>
#include <com/sun/star/frame/XDispatchProvider.hpp>
+#include <com/sun/star/frame/DocumentTemplates.hpp>
#include <com/sun/star/frame/XDocumentTemplates.hpp>
#include <com/sun/star/frame/XComponentLoader.hpp>
#include <com/sun/star/beans/PropertyValue.hpp>
@@ -176,17 +177,13 @@ SvtIconWindow_Impl::SvtIconWindow_Impl( Window* pParent ) :
aIconCtrl.Show();
// detect the root URL of templates
- Reference< XDocumentTemplates > xTemplates( ::comphelper::getProcessServiceFactory()->
- createInstance( ASCII_STR("com.sun.star.frame.DocumentTemplates") ), UNO_QUERY );
+ Reference< XDocumentTemplates > xTemplates( frame::DocumentTemplates::create(::comphelper::getProcessComponentContext()) );
- if ( xTemplates.is() )
- {
- Reference < XContent > aRootContent = xTemplates->getContent();
- Reference < XCommandEnvironment > aCmdEnv;
+ Reference < XContent > aRootContent = xTemplates->getContent();
+ Reference < XCommandEnvironment > aCmdEnv;
- if ( aRootContent.is() )
- aTemplateRootURL = aRootContent->getIdentifier()->getContentIdentifier();
- }
+ if ( aRootContent.is() )
+ aTemplateRootURL = aRootContent->getIdentifier()->getContentIdentifier();
// insert the categories
// "New Document"
@@ -1644,35 +1641,31 @@ IMPL_LINK_NOARG(SvtDocumentTemplateDialog , OrganizerHdl_Impl)
IMPL_LINK ( SvtDocumentTemplateDialog, UpdateHdl_Impl, Timer*, _pEventSource )
{
pImpl->pWin->SetFocus( sal_False );
- Reference< XDocumentTemplates > xTemplates( ::comphelper::getProcessServiceFactory()->
- createInstance( ASCII_STR("com.sun.star.frame.DocumentTemplates") ), UNO_QUERY );
- if ( xTemplates.is() )
- {
- if ( _pEventSource )
- { // it was no direct call, which means it was triggered by the timer, which means we alread checked the necessity
- WaitObject aWaitCursor( this );
- xTemplates->update();
- if ( pImpl->pWin->IsTemplateFolderOpen() )
- {
- pImpl->pWin->ClearHistory();
- pImpl->pWin->OpenTemplateRoot();
- }
- }
- else
+ Reference< XDocumentTemplates > xTemplates( frame::DocumentTemplates::create(::comphelper::getProcessComponentContext()) );
+ if ( _pEventSource )
+ { // it was no direct call, which means it was triggered by the timer, which means we alread checked the necessity
+ WaitObject aWaitCursor( this );
+ xTemplates->update();
+ if ( pImpl->pWin->IsTemplateFolderOpen() )
{
- // check if we really need to do the update
- ::svt::TemplateFolderCache aCache;
- if ( aCache.needsUpdate() )
- { // yes -> do it asynchronous (it will take a noticeable time)
-
- // (but first store the current state)
- aCache.storeState();
-
- // start the timer for the async update
- pImpl->aUpdateTimer.SetTimeout( 300 );
- pImpl->aUpdateTimer.SetTimeoutHdl( LINK( this, SvtDocumentTemplateDialog, UpdateHdl_Impl ) );
- pImpl->aUpdateTimer.Start();
- }
+ pImpl->pWin->ClearHistory();
+ pImpl->pWin->OpenTemplateRoot();
+ }
+ }
+ else
+ {
+ // check if we really need to do the update
+ ::svt::TemplateFolderCache aCache;
+ if ( aCache.needsUpdate() )
+ { // yes -> do it asynchronous (it will take a noticeable time)
+
+ // (but first store the current state)
+ aCache.storeState();
+
+ // start the timer for the async update
+ pImpl->aUpdateTimer.SetTimeout( 300 );
+ pImpl->aUpdateTimer.SetTimeoutHdl( LINK( this, SvtDocumentTemplateDialog, UpdateHdl_Impl ) );
+ pImpl->aUpdateTimer.Start();
}
}
return 0;