summaryrefslogtreecommitdiff
path: root/sfx2/source
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2012-08-12 23:57:51 -0430
committerRafael Dominguez <venccsralph@gmail.com>2012-08-14 16:07:03 -0430
commit4fe7c4f3a98b97034e880ceebcea2b6fecd05852 (patch)
treed79427983d271c2f0313bb83973e89f60b3b862e /sfx2/source
parent68909d3d25da0fe350319dfc82ca5b8fe9f38dc8 (diff)
Show template manager dialog instead of save template dialog.
- Only when experimental features is activated. Change-Id: Id60853b93f2766a5ff6a1c21907675891ab26396
Diffstat (limited to 'sfx2/source')
-rw-r--r--sfx2/source/doc/objserv.cxx138
1 files changed, 74 insertions, 64 deletions
diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx
index 3ae76e6faeda..352245a25dce 100644
--- a/sfx2/source/doc/objserv.cxx
+++ b/sfx2/source/doc/objserv.cxx
@@ -94,6 +94,7 @@
#include "helpid.hrc"
#include "guisaveas.hxx"
+#include "templatedlg.hxx"
using namespace ::com::sun::star;
using namespace ::com::sun::star::lang;
@@ -518,10 +519,10 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
{
// get statusindicator
uno::Reference< task::XStatusIndicator > xStatusIndicator;
- uno::Reference < frame::XController > xCtrl( GetModel()->getCurrentController() );
- if ( xCtrl.is() )
+ uno::Reference < frame::XController > xCtrl( GetModel()->getCurrentController() );
+ if ( xCtrl.is() )
{
- uno::Reference< task::XStatusIndicatorFactory > xStatFactory( xCtrl->getFrame(), uno::UNO_QUERY );
+ uno::Reference< task::XStatusIndicatorFactory > xStatFactory( xCtrl->getFrame(), uno::UNO_QUERY );
if( xStatFactory.is() )
xStatusIndicator = xStatFactory->createStatusIndicator();
}
@@ -799,79 +800,88 @@ void SfxObjectShell::ExecFile_Impl(SfxRequest &rReq)
case SID_DOCTEMPLATE:
{
// save as document templates
- SfxDocumentTemplateDlg *pDlg = 0;
- SfxErrorContext aEc(ERRCTX_SFX_DOCTEMPLATE,GetTitle());
- SfxDocumentTemplates *pTemplates = new SfxDocumentTemplates;
-
- if ( !rReq.GetArgs() )
+ SvtMiscOptions aMiscOptions;
+ if ( aMiscOptions.IsExperimentalMode() )
+ {
+ SfxTemplateManagerDlg aDlg(NULL);
+ aDlg.Execute();
+ }
+ else
{
- pDlg = new SfxDocumentTemplateDlg(0, pTemplates);
- if ( RET_OK == pDlg->Execute() && pDlg->GetTemplateName().Len())
+ SfxDocumentTemplateDlg *pDlg = 0;
+ SfxErrorContext aEc(ERRCTX_SFX_DOCTEMPLATE,GetTitle());
+ SfxDocumentTemplates *pTemplates = new SfxDocumentTemplates;
+
+ if ( !rReq.GetArgs() )
{
- rReq.AppendItem(SfxStringItem(
- SID_TEMPLATE_NAME, pDlg->GetTemplateName()));
- rReq.AppendItem(SfxStringItem(
- SID_TEMPLATE_REGIONNAME, pDlg->GetRegionName()));
+ pDlg = new SfxDocumentTemplateDlg(0, pTemplates);
+ if ( RET_OK == pDlg->Execute() && pDlg->GetTemplateName().Len())
+ {
+ rReq.AppendItem(SfxStringItem(
+ SID_TEMPLATE_NAME, pDlg->GetTemplateName()));
+ rReq.AppendItem(SfxStringItem(
+ SID_TEMPLATE_REGIONNAME, pDlg->GetRegionName()));
+ }
+ else
+ {
+ delete pDlg;
+ rReq.Ignore();
+ return;
+ }
}
- else
+
+ SFX_REQUEST_ARG(rReq, pRegionItem, SfxStringItem, SID_TEMPLATE_REGIONNAME, sal_False);
+ SFX_REQUEST_ARG(rReq, pNameItem, SfxStringItem, SID_TEMPLATE_NAME, sal_False);
+ SFX_REQUEST_ARG(rReq, pRegionNrItem, SfxUInt16Item, SID_TEMPLATE_REGION, sal_False);
+ if ( (!pRegionItem && !pRegionNrItem ) || !pNameItem )
{
- delete pDlg;
+ DBG_ASSERT( rReq.IsAPI(), "non-API call without Arguments" );
+ #ifndef DISABLE_SCRIPTING
+ SbxBase::SetError( SbxERR_WRONG_ARGS );
+ #endif
rReq.Ignore();
return;
}
- }
- SFX_REQUEST_ARG(rReq, pRegionItem, SfxStringItem, SID_TEMPLATE_REGIONNAME, sal_False);
- SFX_REQUEST_ARG(rReq, pNameItem, SfxStringItem, SID_TEMPLATE_NAME, sal_False);
- SFX_REQUEST_ARG(rReq, pRegionNrItem, SfxUInt16Item, SID_TEMPLATE_REGION, sal_False);
- if ( (!pRegionItem && !pRegionNrItem ) || !pNameItem )
- {
- DBG_ASSERT( rReq.IsAPI(), "non-API call without Arguments" );
-#ifndef DISABLE_SCRIPTING
- SbxBase::SetError( SbxERR_WRONG_ARGS );
-#endif
- rReq.Ignore();
- return;
- }
-
- ::rtl::OUString aTemplateName = pNameItem->GetValue();
- ::rtl::OUString aTemplateGroup;
- if ( pRegionItem )
- aTemplateGroup = pRegionItem->GetValue();
- else
- // pRegionNrItem must not be NULL, it was just checked
- aTemplateGroup = pTemplates->GetFullRegionName( pRegionNrItem->GetValue() );
- // check Group and Name
- delete pTemplates;
+ ::rtl::OUString aTemplateName = pNameItem->GetValue();
+ ::rtl::OUString aTemplateGroup;
+ if ( pRegionItem )
+ aTemplateGroup = pRegionItem->GetValue();
+ else
+ // pRegionNrItem must not be NULL, it was just checked
+ aTemplateGroup = pTemplates->GetFullRegionName( pRegionNrItem->GetValue() );
+ // check Group and Name
+ delete pTemplates;
- sal_Bool bOk = sal_False;
- try
- {
- uno::Reference< frame::XStorable > xStorable( GetModel(), uno::UNO_QUERY_THROW );
- uno::Reference< frame::XDocumentTemplates > xTemplates(
- frame::DocumentTemplates::create(comphelper::getProcessComponentContext()) );
+ sal_Bool bOk = sal_False;
+ try
+ {
+ uno::Reference< frame::XStorable > xStorable( GetModel(), uno::UNO_QUERY_THROW );
+ uno::Reference< frame::XDocumentTemplates > xTemplates(
+ frame::DocumentTemplates::create(comphelper::getProcessComponentContext()) );
- bOk = xTemplates->storeTemplate( aTemplateGroup, aTemplateName, xStorable );
- }
- catch( uno::Exception& )
- {
- }
+ bOk = xTemplates->storeTemplate( aTemplateGroup, aTemplateName, xStorable );
+ }
+ catch( uno::Exception& )
+ {
+ }
- DELETEX(pDlg);
+ DELETEX(pDlg);
- rReq.SetReturnValue( SfxBoolItem( 0, bOk ) );
- if ( bOk )
- {
- // update the Organizer runtime cache from the template
- // component if the cache has already been created
- // TODO/LATER: get rid of this cache duplication
- SfxDocumentTemplates aTemplates;
- aTemplates.ReInitFromComponent();
- }
- else
- {
- ErrorHandler::HandleError( ERRCODE_IO_GENERAL );
- return;
+ rReq.SetReturnValue( SfxBoolItem( 0, bOk ) );
+ if ( bOk )
+ {
+ // update the Organizer runtime cache from the template
+ // component if the cache has already been created
+ // TODO/LATER: get rid of this cache duplication
+ SfxDocumentTemplates aTemplates;
+ aTemplates.ReInitFromComponent();
+ }
+ else
+ {
+ ErrorHandler::HandleError( ERRCODE_IO_GENERAL );
+ return;
+ }
}
break;