diff options
-rw-r--r-- | include/sfx2/templatedlg.hxx (renamed from sfx2/inc/templatedlg.hxx) | 5 | ||||
-rw-r--r-- | include/svtools/helpid.hrc | 10 | ||||
-rw-r--r-- | include/svtools/svtools.hrc | 28 | ||||
-rw-r--r-- | include/svtools/templdlg.hxx | 81 | ||||
-rw-r--r-- | sfx2/inc/pch/precompiled_sfx.hxx | 1 | ||||
-rw-r--r-- | sfx2/source/appl/appopen.cxx | 3 | ||||
-rw-r--r-- | sfx2/source/appl/appserv.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/objserv.cxx | 2 | ||||
-rw-r--r-- | sfx2/source/doc/templatedlg.cxx | 2 | ||||
-rw-r--r-- | svtools/source/contnr/DocumentInfoPreview.cxx | 1 | ||||
-rw-r--r-- | svtools/source/contnr/templwin.cxx | 1682 | ||||
-rw-r--r-- | svtools/source/contnr/templwin.hrc | 15 | ||||
-rw-r--r-- | svtools/source/contnr/templwin.hxx | 249 | ||||
-rw-r--r-- | svtools/source/contnr/templwin.src | 232 | ||||
-rw-r--r-- | sw/inc/pch/precompiled_sw.hxx | 1 | ||||
-rw-r--r-- | sw/source/uibase/uiview/view2.cxx | 8 |
16 files changed, 16 insertions, 2306 deletions
diff --git a/sfx2/inc/templatedlg.hxx b/include/sfx2/templatedlg.hxx index 58d18cf74e21..de9dead245c0 100644 --- a/sfx2/inc/templatedlg.hxx +++ b/include/sfx2/templatedlg.hxx @@ -10,6 +10,9 @@ #ifndef INCLUDED_SFX2_INC_TEMPLATEDLG_HXX #define INCLUDED_SFX2_INC_TEMPLATEDLG_HXX +#include <sal/config.h> +#include <sfx2/dllapi.h> + #include <set> #include <vcl/dialog.hxx> @@ -39,7 +42,7 @@ namespace com { } } } } -class SfxTemplateManagerDlg : public ModelessDialog +class SFX2_DLLPUBLIC SfxTemplateManagerDlg : public ModelessDialog { typedef bool (*selection_cmp_fn)(const ThumbnailViewItem*,const ThumbnailViewItem*); diff --git a/include/svtools/helpid.hrc b/include/svtools/helpid.hrc index 6470e0a9df5f..d65ae6dffdd3 100644 --- a/include/svtools/helpid.hrc +++ b/include/svtools/helpid.hrc @@ -24,16 +24,6 @@ #define HID_FILEDLG_PREVIEW_CB "SVT_HID_FILEDLG_PREVIEW_CB" #define HID_FILEDLG_STANDARD "SVT_HID_FILEDLG_STANDARD" -// Help ids of template dialog -#define HID_TEMPLATEDLG_DIALOG "SVT_HID_TEMPLATEDLG_DIALOG" -#define HID_TEMPLATEDLG_ICONCTRL "SVT_HID_TEMPLATEDLG_ICONCTRL" -#define HID_TEMPLATEDLG_FILEVIEW "SVT_HID_TEMPLATEDLG_FILEVIEW" -#define HID_TEMPLATEDLG_TB_BACK "SVT_HID_TEMPLATEDLG_TB_BACK" -#define HID_TEMPLATEDLG_TB_PREV "SVT_HID_TEMPLATEDLG_TB_PREV" -#define HID_TEMPLATEDLG_TB_PRINT "SVT_HID_TEMPLATEDLG_TB_PRINT" -#define HID_TEMPLATEDLG_TB_DOCINFO "SVT_HID_TEMPLATEDLG_TB_DOCINFO" -#define HID_TEMPLATEDLG_TB_PREVIEW "SVT_HID_TEMPLATEDLG_TB_PREVIEW" - // Help ids for the filepicker dialogs // help ids for fileview contextmenu #define HID_FILEVIEW_MENU_DELETE "SVT_HID_FILEVIEW_MENU_DELETE" diff --git a/include/svtools/svtools.hrc b/include/svtools/svtools.hrc index 207f2f003b86..23cf007a7139 100644 --- a/include/svtools/svtools.hrc +++ b/include/svtools/svtools.hrc @@ -50,20 +50,8 @@ #define STR_SVT_ESTIMATED_SIZE_PIX_2 (RID_SVTOOLS_START + 40) #define STR_SVT_ESTIMATED_SIZE_VEC (RID_SVTOOLS_START + 41) -// doc template dialog -#define DLG_DOCTEMPLATE (RID_SVTOOLS_START+50) // FREE -#define STR_SVT_NEWDOC (RID_SVTOOLS_START+52) -#define STR_SVT_MYDOCS (RID_SVTOOLS_START+53) -#define STR_SVT_TEMPLATES (RID_SVTOOLS_START+54) -#define STR_SVT_SAMPLES (RID_SVTOOLS_START+55) -#define TB_SVT_FILEVIEW (RID_SVTOOLS_START+56) -#define TB_SVT_FRAMEWIN (RID_SVTOOLS_START+57) #define STRARY_SVT_DOCINFO (RID_SVTOOLS_START+58) -#define STR_SVT_NEWDOC_HELP (RID_SVTOOLS_START+63) -#define STR_SVT_MYDOCS_HELP (RID_SVTOOLS_START+64) -#define STR_SVT_TEMPLATES_HELP (RID_SVTOOLS_START+65) -#define STR_SVT_SAMPLES_HELP (RID_SVTOOLS_START+66) #define STR_BASICKEY_FORMAT_ON (RID_SVTOOLS_START+103) #define STR_BASICKEY_FORMAT_OFF (RID_SVTOOLS_START+104) @@ -273,22 +261,6 @@ #define IMG_SVT_FOLDER (RID_SVTOOLS_START + 42) -#define IMG_SVT_NEWDOC (RID_SVTOOLS_START + 52) -#define IMG_SVT_MYDOCS (RID_SVTOOLS_START + 53) -#define IMG_SVT_TEMPLATES (RID_SVTOOLS_START + 54) -#define IMG_SVT_SAMPLES (RID_SVTOOLS_START + 55) - -#define IMG_SVT_DOCTEMPLATE_BACK_SMALL (RID_SVTOOLS_START + 70) -#define IMG_SVT_DOCTEMPLATE_BACK_LARGE (RID_SVTOOLS_START + 71) -#define IMG_SVT_DOCTEMPLATE_PREV_SMALL (RID_SVTOOLS_START + 72) -#define IMG_SVT_DOCTEMPLATE_PREV_LARGE (RID_SVTOOLS_START + 73) -#define IMG_SVT_DOCTEMPLATE_PRINT_SMALL (RID_SVTOOLS_START + 74) -#define IMG_SVT_DOCTEMPLATE_PRINT_LARGE (RID_SVTOOLS_START + 75) -#define IMG_SVT_DOCTEMPLATE_DOCINFO_SMALL (RID_SVTOOLS_START + 76) -#define IMG_SVT_DOCTEMPLATE_DOCINFO_LARGE (RID_SVTOOLS_START + 77) -#define IMG_SVT_DOCTEMPLATE_PREVIEW_SMALL (RID_SVTOOLS_START + 78) -#define IMG_SVT_DOCTEMPLATE_PREVIEW_LARGE (RID_SVTOOLS_START + 79) - #define RID_IMG_PRNDLG_NOCOLLATE (STR_SVT_PRNDLG_START + 30) #define STR_PARAGRAPH_START (STR_SVT_PRNDLG_START + 50) diff --git a/include/svtools/templdlg.hxx b/include/svtools/templdlg.hxx deleted file mode 100644 index 34ca7e4f6b60..000000000000 --- a/include/svtools/templdlg.hxx +++ /dev/null @@ -1,81 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ -#ifndef INCLUDED_SVTOOLS_TEMPLDLG_HXX -#define INCLUDED_SVTOOLS_TEMPLDLG_HXX - -#include <svtools/svtdllapi.h> - -#include <vcl/button.hxx> -#include <vcl/dialog.hxx> -#include <vcl/fixed.hxx> -#include <vcl/fixedhyper.hxx> - -struct SvtTmplDlg_Impl; - -// class SvtDocumentTemplateDialog --------------------------------------- - -class SvtTemplateWindow; - -class SVT_DLLPUBLIC SvtDocumentTemplateDialog : public ModalDialog -{ -private: - FixedHyperlink aMoreTemplatesLink; - FixedLine aLine; - PushButton aManageBtn; - PushButton aPackageBtn; - PushButton aEditBtn; - OKButton aOKBtn; - CancelButton aCancelBtn; - HelpButton aHelpBtn; - - SvtTmplDlg_Impl* pImpl; - - DECL_DLLPRIVATE_LINK( SelectHdl_Impl, void* ); - DECL_DLLPRIVATE_LINK( DoubleClickHdl_Impl, void* ); - DECL_DLLPRIVATE_LINK( NewFolderHdl_Impl, void* ); - DECL_DLLPRIVATE_LINK( SendFocusHdl_Impl, void* ); - DECL_DLLPRIVATE_LINK( OKHdl_Impl, PushButton* ); - DECL_DLLPRIVATE_LINK( OrganizerHdl_Impl, void* ); - DECL_DLLPRIVATE_LINK( PackageHdl_Impl, void* ); - DECL_DLLPRIVATE_LINK( UpdateHdl_Impl, Timer* ); - DECL_DLLPRIVATE_LINK( OpenLinkHdl_Impl, void* ); - -public: - SvtDocumentTemplateDialog( Window* pParent ); - - /** ctor for calling the dialog for <em>selection</em> only, not for <em>opening</em> a document - <p>If you use this ctor, the dialog will behave differently in the following areas: - <ul><li>The <em>Edit</em> button will be hidden.</li> - <li>Upon pressing em>Open</em>, the selected file will not be opened. Instead, it's - URL is available (see <method>GetSelectedFileURL</method>).</li> - </ul> - - */ - virtual ~SvtDocumentTemplateDialog(); - - void SelectTemplateFolder(); - -private: - SVT_DLLPRIVATE void InitImpl( ); - SVT_DLLPRIVATE bool CanEnableEditBtn() const; -}; - -#endif // INCLUDED_SVTOOLS_TEMPLDLG_HXX - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sfx2/inc/pch/precompiled_sfx.hxx b/sfx2/inc/pch/precompiled_sfx.hxx index bd5475c5b8dc..f941479d2f8b 100644 --- a/sfx2/inc/pch/precompiled_sfx.hxx +++ b/sfx2/inc/pch/precompiled_sfx.hxx @@ -671,7 +671,6 @@ #include <svtools/svparser.hxx> #include <svtools/svtresid.hxx> #include <svtools/templatefoldercache.hxx> -#include <svtools/templdlg.hxx> #include <svtools/toolpanel/drawerlayouter.hxx> #include <svtools/toolpanel/tablayouter.hxx> #include <svtools/toolpanel/toolpaneldeck.hxx> diff --git a/sfx2/source/appl/appopen.cxx b/sfx2/source/appl/appopen.cxx index dbe8ad9d9cfb..7bc992a85ca9 100644 --- a/sfx2/source/appl/appopen.cxx +++ b/sfx2/source/appl/appopen.cxx @@ -66,7 +66,6 @@ #include <unotools/pathoptions.hxx> #include <unotools/moduleoptions.hxx> #include <svtools/miscopt.hxx> -#include <svtools/templdlg.hxx> #include <osl/file.hxx> #include <unotools/extendedsecurityoptions.hxx> #include <comphelper/docpasswordhelper.hxx> @@ -98,7 +97,7 @@ #include <sfx2/filedlghelper.hxx> #include <sfx2/docfac.hxx> #include <sfx2/event.hxx> -#include "templatedlg.hxx" +#include <sfx2/templatedlg.hxx> #include "openuriexternally.hxx" #include <officecfg/Office/ProtocolHandler.hxx> diff --git a/sfx2/source/appl/appserv.cxx b/sfx2/source/appl/appserv.cxx index 2de745f48211..f16be36b767e 100644 --- a/sfx2/source/appl/appserv.cxx +++ b/sfx2/source/appl/appserv.cxx @@ -114,7 +114,7 @@ #include "sorgitm.hxx" #include <sfx2/sfxhelp.hxx> #include <sfx2/zoomitem.hxx> -#include "templatedlg.hxx" +#include <sfx2/templatedlg.hxx> #include <officecfg/Office/Common.hxx> #include <officecfg/Setup.hxx> diff --git a/sfx2/source/doc/objserv.cxx b/sfx2/source/doc/objserv.cxx index d365ed8f0db9..22779e4a051b 100644 --- a/sfx2/source/doc/objserv.cxx +++ b/sfx2/source/doc/objserv.cxx @@ -98,7 +98,7 @@ #include "helpid.hrc" #include "guisaveas.hxx" -#include "templatedlg.hxx" +#include <sfx2/templatedlg.hxx> #include <boost/scoped_ptr.hpp> using namespace ::com::sun::star; diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx index 2cf0516d5dee..2f9f9b5d1886 100644 --- a/sfx2/source/doc/templatedlg.cxx +++ b/sfx2/source/doc/templatedlg.cxx @@ -7,7 +7,7 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ -#include "templatedlg.hxx" +#include <sfx2/templatedlg.hxx> #include "inputdlg.hxx" #include "templatesearchview.hxx" diff --git a/svtools/source/contnr/DocumentInfoPreview.cxx b/svtools/source/contnr/DocumentInfoPreview.cxx index c371f4b088dc..793a7f39b84d 100644 --- a/svtools/source/contnr/DocumentInfoPreview.cxx +++ b/svtools/source/contnr/DocumentInfoPreview.cxx @@ -29,6 +29,7 @@ #include <svl/inettype.hxx> #include <svtools/DocumentInfoPreview.hxx> #include <svtools/imagemgr.hxx> +#include <vcl/builder.hxx> #include <vcl/txtattr.hxx> #include <vcl/settings.hxx> #include <tools/datetime.hxx> diff --git a/svtools/source/contnr/templwin.cxx b/svtools/source/contnr/templwin.cxx index 557756e88ac1..ff0036e266c9 100644 --- a/svtools/source/contnr/templwin.cxx +++ b/svtools/source/contnr/templwin.cxx @@ -17,563 +17,17 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ -#include <config_folders.h> - -#include "templwin.hxx" -#include <svtools/templdlg.hxx> -#include <svtools/svtresid.hxx> -#include <svtools/langhelp.hxx> -#include <unotools/pathoptions.hxx> -#include <unotools/dynamicmenuoptions.hxx> -#include <unotools/extendedsecurityoptions.hxx> -#include <vcl/xtextedt.hxx> -#include <svl/inettype.hxx> -#include <svtools/imagemgr.hxx> -#include <svtools/miscopt.hxx> -#include <svtools/templatefoldercache.hxx> -#include <svtools/imgdef.hxx> -#include <vcl/txtattr.hxx> -#include <vcl/settings.hxx> #include <svtools/svtools.hrc> -#include "templwin.hrc" -#include <svtools/helpid.hrc> -#include <unotools/viewoptions.hxx> -#include <unotools/ucbhelper.hxx> -#include <unotools/configmgr.hxx> -#include <com/sun/star/awt/XWindow.hpp> -#include <com/sun/star/lang/XMultiServiceFactory.hpp> -#include <com/sun/star/frame/Frame.hpp> -#include <toolkit/helper/vclunohelper.hxx> -#include <com/sun/star/util/URL.hpp> -#include <com/sun/star/util/URLTransformer.hpp> -#include <com/sun/star/util/XURLTransformer.hpp> -#include <com/sun/star/util/XOfficeInstallationDirectories.hpp> -#include <com/sun/star/frame/Desktop.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> -#include <com/sun/star/ucb/XContent.hpp> -#include <com/sun/star/ucb/XCommandEnvironment.hpp> -#include <com/sun/star/view/XPrintable.hpp> -#include <com/sun/star/document/DocumentProperties.hpp> -#include <com/sun/star/beans/XPropertySet.hpp> -#include <com/sun/star/beans/XMultiPropertySet.hpp> -#include <com/sun/star/beans/XPropertySetInfo.hpp> -#include <com/sun/star/io/IOException.hpp> -#include <com/sun/star/util/DateTime.hpp> -#include <com/sun/star/script/XTypeConverter.hpp> -#include <com/sun/star/system/SystemShellExecute.hpp> -#include <com/sun/star/system/SystemShellExecuteFlags.hpp> -#include <com/sun/star/task/InteractionHandler.hpp> -#include <org/freedesktop/PackageKit/SyncDbusSessionHelper.hpp> -#include <unotools/localedatawrapper.hxx> -#include <com/sun/star/container/XNameContainer.hpp> -#include <vcl/waitobj.hxx> -#include <comphelper/processfactory.hxx> -#include <tools/urlobj.hxx> -#include <tools/datetime.hxx> -#include <vcl/svapp.hxx> -#include <vcl/split.hxx> -#include <vcl/msgbox.hxx> -#include <svtools/DocumentInfoPreview.hxx> -#include <vcl/mnemonic.hxx> - -#include <ucbhelper/content.hxx> -#include <comphelper/string.hxx> - -using namespace ::com::sun::star; -using namespace ::com::sun::star::beans; -using namespace ::com::sun::star::container; -using namespace ::com::sun::star::frame; -using namespace ::com::sun::star::document; -using namespace ::com::sun::star::lang; -using namespace ::com::sun::star::ucb; -using namespace ::com::sun::star::uno; -using namespace ::com::sun::star::view; -using namespace svtools; - -#define aSeparatorStr "----------------------------------" - -#define ICONWIN_ID 2 -#define FILEWIN_ID 3 -#define FRAMEWIN_ID 4 - -#define ICON_POS_NEWDOC 0 -#define ICON_POS_TEMPLATES 1 -#define ICON_POS_MYDOCS 2 -#define ICON_POS_SAMPLES 3 - -#define VIEWSETTING_NEWFROMTEMPLATE "NewFromTemplate" -#define VIEWSETTING_SELECTEDGROUP "SelectedGroup" -#define VIEWSETTING_SELECTEDVIEW "SelectedView" -#define VIEWSETTING_SPLITRATIO "SplitRatio" -#define VIEWSETTING_LASTFOLDER "LastFolder" - -struct FolderHistory -{ - OUString m_sURL; - sal_uLong m_nGroup; - - FolderHistory( const OUString& _rURL, sal_Int32 _nGroup ) : - m_sURL( _rURL ), m_nGroup( _nGroup ) {} -}; - -typedef ::std::vector< OUString > NewDocList_Impl; - -// class SvtDummyHeaderBar_Impl ------------------------------------------ - -void SvtDummyHeaderBar_Impl::UpdateBackgroundColor() -{ - SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetWindowColor() ) ); -} - -SvtDummyHeaderBar_Impl::SvtDummyHeaderBar_Impl( Window* pPar ) : Window( pPar ) -{ - SetSizePixel( HeaderBar( this, 0 ).CalcWindowSizePixel() ); // HeaderBar used only to calculate size - - UpdateBackgroundColor(); -} - -SvtDummyHeaderBar_Impl::~SvtDummyHeaderBar_Impl() -{ -} - -void SvtDummyHeaderBar_Impl::DataChanged( const DataChangedEvent& r ) -{ - Window::DataChanged( r ); - if( r.GetType() == DATACHANGED_SETTINGS ) - UpdateBackgroundColor(); -} - -// class SvtIconWindow_Impl ---------------------------------------------- - -SvtIconWindow_Impl::SvtIconWindow_Impl( Window* pParent ) : - - Window( pParent, WB_DIALOGCONTROL | WB_BORDER | WB_3DLOOK ), - - aDummyHeaderBar( this ), - aIconCtrl( this, WB_ICON | WB_NOCOLUMNHEADER | WB_HIGHLIGHTFRAME | /*!WB_NOSELECTION |*/ - WB_NODRAGSELECTION | WB_TABSTOP | WB_CLIPCHILDREN ), - aNewDocumentRootURL( "private:newdoc" ), - aMyDocumentsRootURL( SvtPathOptions().GetWorkPath() ), - aSamplesFolderRootURL( SvtPathOptions(). - SubstituteVariable( "$(insturl)/" LIBO_SHARE_FOLDER "/samples/$(vlang)" ) ), - nMaxTextLength( 0 ) - -{ - aDummyHeaderBar.Show(); - - aIconCtrl.SetAccessibleName( OUString( "Groups" ) ); - aIconCtrl.SetHelpId( HID_TEMPLATEDLG_ICONCTRL ); - aIconCtrl.SetChoiceWithCursor( true ); - aIconCtrl.SetSelectionMode( SINGLE_SELECTION ); - aIconCtrl.Show(); - - // detect the root URL of templates - Reference< XDocumentTemplates > xTemplates( frame::DocumentTemplates::create(::comphelper::getProcessComponentContext()) ); - - Reference < XContent > aRootContent = xTemplates->getContent(); - Reference < XCommandEnvironment > aCmdEnv; - - if ( aRootContent.is() ) - aTemplateRootURL = aRootContent->getIdentifier()->getContentIdentifier(); - - // insert the categories - // "New Document" - Image aImage( SvtResId( IMG_SVT_NEWDOC ) ); - nMaxTextLength = aImage.GetSizePixel().Width(); - OUString aEntryStr = SVT_RESSTR(STR_SVT_NEWDOC); - SvxIconChoiceCtrlEntry* pEntry = - aIconCtrl.InsertEntry( aEntryStr, aImage, ICON_POS_NEWDOC ); - pEntry->SetUserData( new OUString(aNewDocumentRootURL) ); - pEntry->SetQuickHelpText( SVT_RESSTR(STR_SVT_NEWDOC_HELP) ); - DBG_ASSERT( !pEntry->GetBoundRect().IsEmpty(), "empty rectangle" ); - long nTemp = pEntry->GetBoundRect().GetSize().Width(); - if (nTemp > nMaxTextLength) - nMaxTextLength = nTemp; - - // "Templates" - if( !aTemplateRootURL.isEmpty() ) - { - aEntryStr = SVT_RESSTR(STR_SVT_TEMPLATES); - pEntry = aIconCtrl.InsertEntry( - aEntryStr, Image( SvtResId( IMG_SVT_TEMPLATES ) ), ICON_POS_TEMPLATES ); - pEntry->SetUserData( new OUString(aTemplateRootURL) ); - pEntry->SetQuickHelpText(SVT_RESSTR(STR_SVT_TEMPLATES_HELP)); - DBG_ASSERT( !pEntry->GetBoundRect().IsEmpty(), "empty rectangle" ); - nTemp = pEntry->GetBoundRect().GetSize().Width(); - if (nTemp > nMaxTextLength) - nMaxTextLength = nTemp; - } - - // "My Documents" - aEntryStr = SVT_RESSTR(STR_SVT_MYDOCS); - pEntry = aIconCtrl.InsertEntry( - aEntryStr, Image( SvtResId( IMG_SVT_MYDOCS ) ), ICON_POS_MYDOCS ); - pEntry->SetUserData( new OUString(aMyDocumentsRootURL) ); - pEntry->SetQuickHelpText( SVT_RESSTR(STR_SVT_MYDOCS_HELP) ); - DBG_ASSERT( !pEntry->GetBoundRect().IsEmpty(), "empty rectangle" ); - nTemp = pEntry->GetBoundRect().GetSize().Width(); - if( nTemp > nMaxTextLength ) - nMaxTextLength = nTemp; - - // "Samples" - aEntryStr = SVT_RESSTR(STR_SVT_SAMPLES); - pEntry = aIconCtrl.InsertEntry( - aEntryStr, Image( SvtResId( IMG_SVT_SAMPLES ) ), ICON_POS_SAMPLES ); - pEntry->SetUserData( new OUString(aSamplesFolderRootURL) ); - pEntry->SetQuickHelpText( SVT_RESSTR(STR_SVT_SAMPLES_HELP)); - DBG_ASSERT( !pEntry->GetBoundRect().IsEmpty(), "empty rectangle" ); - nTemp = pEntry->GetBoundRect().GetSize().Width(); - if (nTemp > nMaxTextLength) - nMaxTextLength = nTemp; - - aIconCtrl.CreateAutoMnemonics(); -} - -SvtIconWindow_Impl::~SvtIconWindow_Impl() -{ - for ( sal_uLong i = 0; i < aIconCtrl.GetEntryCount(); ++i ) - { - SvxIconChoiceCtrlEntry* pEntry = aIconCtrl.GetEntry( i ); - delete (OUString*)pEntry->GetUserData(); - } -} - -SvxIconChoiceCtrlEntry* SvtIconWindow_Impl::GetEntry( const OUString& rURL ) const -{ - SvxIconChoiceCtrlEntry* pEntry = NULL; - for ( sal_uLong i = 0; i < aIconCtrl.GetEntryCount(); ++i ) - { - SvxIconChoiceCtrlEntry* pTemp = aIconCtrl.GetEntry( i ); - OUString *pURL = (OUString*)pTemp->GetUserData(); - if ( (*pURL) == rURL ) - { - pEntry = pTemp; - break; - } - } - - return pEntry; -} - -void SvtIconWindow_Impl::Resize() -{ - Size aWinSize = GetOutputSizePixel(); - Size aHeaderSize = aDummyHeaderBar.GetSizePixel(); - aHeaderSize.Width() = aWinSize.Width(); - aDummyHeaderBar.SetSizePixel( aHeaderSize ); - long nHeaderHeight = aHeaderSize.Height(); - aWinSize.Height() -= nHeaderHeight; - aIconCtrl.SetPosSizePixel( Point( 0, nHeaderHeight ), aWinSize ); - aIconCtrl.ArrangeIcons(); -} - -OUString SvtIconWindow_Impl::GetCursorPosIconURL() const -{ - OUString aURL; - SvxIconChoiceCtrlEntry* pEntry = aIconCtrl.GetCursor( ); - if ( pEntry ) - aURL = *static_cast<OUString*>(pEntry->GetUserData()); - return aURL; - -} - -OUString SvtIconWindow_Impl::GetSelectedIconURL() const -{ - sal_uLong nPos; - SvxIconChoiceCtrlEntry* pEntry = aIconCtrl.GetSelectedEntry( nPos ); - OUString aURL; - if ( pEntry ) - aURL = *static_cast<OUString*>(pEntry->GetUserData()); - return aURL; -} - -OUString SvtIconWindow_Impl::GetIconText( const OUString& rURL ) const -{ - OUString aText; - SvxIconChoiceCtrlEntry* pEntry = GetEntry( rURL ); - if ( pEntry ) - aText = MnemonicGenerator::EraseAllMnemonicChars( pEntry->GetText() ); - return aText; -} - -void SvtIconWindow_Impl::InvalidateIconControl() -{ - aIconCtrl.Invalidate(); -} - -sal_uLong SvtIconWindow_Impl::GetCursorPos() const -{ - sal_uLong nPos = ~sal_uLong(0); - - SvxIconChoiceCtrlEntry* pCursorEntry = aIconCtrl.GetCursor( ); - if ( pCursorEntry ) - nPos = aIconCtrl.GetEntryListPos( pCursorEntry ); - - return nPos; -} - -sal_uLong SvtIconWindow_Impl::GetSelectEntryPos() const -{ - sal_uLong nPos; - if ( !aIconCtrl.GetSelectedEntry( nPos ) ) - nPos = ~sal_uLong(0); - return nPos; -} - -void SvtIconWindow_Impl::SetCursorPos( sal_uLong nPos ) -{ - SvxIconChoiceCtrlEntry* pEntry = aIconCtrl.GetEntry( nPos ); - aIconCtrl.SetCursor( pEntry ); - aIconCtrl.Invalidate(); - aIconCtrl.Update(); -} - -void SvtIconWindow_Impl::SetFocus() -{ - aIconCtrl.GrabFocus(); -} - -long SvtIconWindow_Impl::CalcHeight() const -{ - // calculate the required height of the IconControl - long nHeight = 0; - sal_uLong nCount = aIconCtrl.GetEntryCount(); - if ( nCount > 0 ) - // bottom of the last icon - nHeight = aIconCtrl.GetEntry(nCount-1)->GetBoundRect().Bottom(); - - // + headerbar height - nHeight += aDummyHeaderBar.GetSizePixel().Height(); - - return nHeight; -} - -bool SvtIconWindow_Impl::IsRootURL( const OUString& rURL ) const -{ - return rURL == aNewDocumentRootURL || - rURL == aTemplateRootURL || - rURL == aMyDocumentsRootURL || - rURL == aSamplesFolderRootURL; -} - -sal_uLong SvtIconWindow_Impl::GetRootPos( const OUString& rURL ) const -{ - sal_uLong nPos = ~sal_uLong(0); - if ( rURL.startsWith(aNewDocumentRootURL) ) - nPos = 0; - else if ( rURL.startsWith(aTemplateRootURL) ) - nPos = 1; - else if ( rURL.startsWith(aMyDocumentsRootURL) ) - nPos = 2; - else if ( rURL.startsWith(aSamplesFolderRootURL) ) - nPos = 3; - else if ( aMyDocumentsRootURL.startsWith(rURL) ) - nPos = 2; - else - { - DBG_WARNING( "SvtIconWindow_Impl::GetRootPos(): invalid position" ); - nPos = 2; - } - - return nPos; -} - -void SvtIconWindow_Impl::UpdateIcons() -{ - aIconCtrl.GetEntry( ICON_POS_NEWDOC )->SetImage( - Image( SvtResId( IMG_SVT_NEWDOC ) ) ); - aIconCtrl.GetEntry( ICON_POS_TEMPLATES )->SetImage( - Image( SvtResId( IMG_SVT_TEMPLATES ) ) ); - aIconCtrl.GetEntry( ICON_POS_MYDOCS )->SetImage( - Image( SvtResId( IMG_SVT_MYDOCS ) ) ); - aIconCtrl.GetEntry( ICON_POS_SAMPLES )->SetImage( - Image( SvtResId( IMG_SVT_SAMPLES ) ) ); -} - -void SvtIconWindow_Impl::SelectFolder(sal_Int32 nFolderPosition) -{ - SvxIconChoiceCtrlEntry* pEntry = aIconCtrl.GetEntry( nFolderPosition ); - if(pEntry) - { - aIconCtrl.SetCursor( pEntry ); - aIconCtrl.GetClickHdl().Call(&aIconCtrl); - } -} - -// class SvtFileViewWindow_Impl -----------------------------------------_ - -SvtFileViewWindow_Impl::SvtFileViewWindow_Impl( SvtTemplateWindow* pParent ) : - - Window( pParent, WB_DIALOGCONTROL | WB_TABSTOP | WB_BORDER | WB_3DLOOK ), - - rParent ( *pParent ), - aFileView ( this, WB_TABSTOP | WB_3DLOOK, FILEVIEW_SHOW_NONE | FILEVIEW_SHOW_ONLYTITLE ), - bIsTemplateFolder ( false ) - -{ - aFileView.SetStyle( aFileView.GetStyle() | WB_DIALOGCONTROL | WB_TABSTOP ); - aFileView.SetHelpId( HID_TEMPLATEDLG_FILEVIEW ); - aFileView.Show(); - aFileView.EnableAutoResize(); - aFileView.EnableContextMenu( false ); - aFileView.EnableDelete( false ); -} - -SvtFileViewWindow_Impl::~SvtFileViewWindow_Impl() -{ -} - -void GetMenuEntry_Impl -( - Sequence< PropertyValue >& aDynamicMenuEntry, - OUString& rTitle, - OUString& rURL, - OUString& rFrame, - OUString& rImageId -) -{ - for ( int i = 0; i < aDynamicMenuEntry.getLength(); i++ ) - { - if ( aDynamicMenuEntry[i].Name == DYNAMICMENU_PROPERTYNAME_URL ) - aDynamicMenuEntry[i].Value >>= rURL; - else if ( aDynamicMenuEntry[i].Name == DYNAMICMENU_PROPERTYNAME_TITLE ) - aDynamicMenuEntry[i].Value >>= rTitle; - else if ( aDynamicMenuEntry[i].Name == DYNAMICMENU_PROPERTYNAME_IMAGEIDENTIFIER ) - aDynamicMenuEntry[i].Value >>= rImageId; - else if ( aDynamicMenuEntry[i].Name == DYNAMICMENU_PROPERTYNAME_TARGETNAME ) - aDynamicMenuEntry[i].Value >>= rFrame; - } -} - -Sequence< OUString > SvtFileViewWindow_Impl::GetNewDocContents() const -{ - NewDocList_Impl aNewDocs; - Sequence< Sequence< PropertyValue > > aDynamicMenuEntries; - aDynamicMenuEntries = SvtDynamicMenuOptions().GetMenu( E_NEWMENU ); - - OUString aTitle; - OUString aURL; - OUString aImageURL; - OUString aTargetFrame; - - sal_uInt32 i, nCount = aDynamicMenuEntries.getLength(); - OUString sSeparator( "private:separator" ); - OUString sSlotURL( "slot:5500" ); - - for ( i = 0; i < nCount; ++i ) - { - GetMenuEntry_Impl( aDynamicMenuEntries[i], aTitle, aURL, aTargetFrame, aImageURL ); - if( aURL == sSlotURL ) - continue; - if( aURL == sSeparator ) - { - OUString aSeparator( aSeparatorStr ); - aNewDocs.push_back( aSeparator ); - } - else - { - // title - OUString aRow = MnemonicGenerator::EraseAllMnemonicChars( aTitle ); - aRow += "\t"; - // no type - aRow += "\t"; - // no size - aRow += "\t"; - // no date - aRow += "\t"; - // url - aRow += aURL; - aRow += "\t"; - // folder == false - aRow += "0"; - // image url? - if ( !aImageURL.isEmpty() ) - { - aRow += "\t"; - aRow += aImageURL; - } - - aNewDocs.push_back( aRow ); - } - } - - nCount = aNewDocs.size(); - Sequence < OUString > aRet( nCount ); - OUString* pRet = aRet.getArray(); - for ( i = 0; i < nCount; ++i ) - { - pRet[i] = aNewDocs[i]; - } - - return aRet; -} - -void SvtFileViewWindow_Impl::Resize() -{ - aFileView.SetSizePixel(GetOutputSizePixel()); -} - -OUString SvtFileViewWindow_Impl::GetSelectedFile() const -{ - return aFileView.GetCurrentURL(); -} - -void SvtFileViewWindow_Impl::OpenFolder( const OUString& rURL ) -{ - aFolderURL = rURL; - - rParent.SetPrevLevelButtonState( rURL ); - - if ( INetURLObject( rURL ).GetProtocol() == INET_PROT_PRIVATE ) - { - aFileView.EnableNameReplacing( false ); - aFileView.Initialize( GetNewDocContents() ); - } - else - { - sal_Int32 nSampFoldLen = aSamplesFolderURL.getLength(); - aFileView.EnableNameReplacing( - nSampFoldLen && rURL.startsWith( aSamplesFolderURL ) ); - aFileView.Initialize( rURL, "", NULL ); - } - aNewFolderLink.Call( this ); -} - -bool SvtFileViewWindow_Impl::HasPreviousLevel( OUString& rURL ) const -{ - INetURLObject aViewObj( aFileView.GetViewURL() ); - INetURLObject aRootObj( aCurrentRootURL ); - INetURLObject aMyDocObj( aMyDocumentsURL ); - - return ( ( aViewObj != aRootObj || aRootObj == aMyDocObj ) && aFileView.GetParentURL( rURL ) ); -} - -OUString SvtFileViewWindow_Impl::GetFolderTitle() const -{ - OUString aTitle; - ::utl::UCBContentHelper::GetTitle( aFolderURL, &aTitle ); - return aTitle; -} - -void SvtFileViewWindow_Impl::SetFocus() -{ - aFileView.SetFocus(); -} +#include <svtools/svtresid.hxx> +#include "templwin.hxx" // class SvtDocInfoTable_Impl -------------------------------------------- - -SvtDocInfoTable_Impl::SvtDocInfoTable_Impl() : - - ResStringArray( SvtResId( STRARY_SVT_DOCINFO ) ) +SvtDocInfoTable_Impl::SvtDocInfoTable_Impl() + : ResStringArray(SvtResId(STRARY_SVT_DOCINFO)) { } - OUString SvtDocInfoTable_Impl::GetString( long nId ) const { sal_uInt32 nPos( FindIndex( nId ) ); @@ -584,1132 +38,4 @@ OUString SvtDocInfoTable_Impl::GetString( long nId ) const return OUString(); } -// class SvtFrameWindow_Impl --------------------------------------------- - -SvtFrameWindow_Impl::SvtFrameWindow_Impl( Window* pParent ) - : Window(pParent) - , bDocInfo(false) -{ - // create windows and frame - pEditWin = new ODocumentInfoPreview( this ,WB_LEFT | WB_VSCROLL | WB_READONLY | WB_BORDER | WB_3DLOOK); - pTextWin = new Window( this ); - m_xFrame = Frame::create( ::comphelper::getProcessComponentContext() ); - xWindow = VCLUnoHelper::GetInterface( pTextWin ); - m_xFrame->initialize( xWindow ); - - // create docinfo instance - m_xDocProps.set( document::DocumentProperties::create(::comphelper::getProcessComponentContext()) ); - - pEmptyWin = new Window( this, WB_BORDER | WB_3DLOOK ); -} - -SvtFrameWindow_Impl::~SvtFrameWindow_Impl() -{ - delete pEditWin; - delete pEmptyWin; - m_xFrame->dispose(); -} - -void SvtFrameWindow_Impl::ViewEditWin() -{ - pEmptyWin->Hide(); - xWindow->setVisible( sal_False ); - pTextWin->Hide(); - pEditWin->Show(); -} - -void SvtFrameWindow_Impl::ViewTextWin() -{ - pEmptyWin->Hide(); - pEditWin->Hide(); - xWindow->setVisible( sal_True ); - pTextWin->Show(); -} - -void SvtFrameWindow_Impl::ViewEmptyWin() -{ - xWindow->setVisible( sal_False ); - pTextWin->Hide(); - pEditWin->Hide(); - pEmptyWin->Show(); -} - -void SvtFrameWindow_Impl::ViewNonEmptyWin() -{ - if( bDocInfo ) - ViewEditWin(); - else - ViewTextWin(); -} - -void SvtFrameWindow_Impl::ShowDocInfo( const OUString& rURL ) -{ - try - { - uno::Reference < task::XInteractionHandler2 > xInteractionHandler( - task::InteractionHandler::createWithParent(::comphelper::getProcessComponentContext(), 0) ); - uno::Sequence < beans::PropertyValue> aProps(1); - aProps[0].Name = "InteractionHandler"; - aProps[0].Value <<= xInteractionHandler; - m_xDocProps->loadFromMedium( rURL, aProps ); - pEditWin->fill( m_xDocProps, rURL ); - } - catch ( UnknownPropertyException& ) {} - catch ( Exception& ) {} -} - -void SvtFrameWindow_Impl::Resize() -{ - Size aWinSize = GetOutputSizePixel(); - pEditWin->SetSizePixel( aWinSize ); - pTextWin->SetSizePixel( aWinSize ); - pEmptyWin->SetSizePixel( aWinSize ); -} - -void SvtFrameWindow_Impl::OpenFile( const OUString& rURL, bool bPreview, bool bIsTemplate, bool bAsTemplate ) -{ - if ( bPreview ) - aCurrentURL = rURL; - - ViewNonEmptyWin(); - pEditWin->clear(); - - if ( !rURL.isEmpty() && bPreview && m_xDocProps.is() ) - ShowDocInfo( rURL ); - - if ( rURL.isEmpty() ) - { - m_xFrame->setComponent( Reference < com::sun::star::awt::XWindow >(), Reference < XController >() ); - ViewEmptyWin(); - } - else if ( !::utl::UCBContentHelper::IsFolder( rURL ) ) - { - com::sun::star::util::URL aURL; - aURL.Complete = rURL; - Reference< com::sun::star::util::XURLTransformer > xTrans( - com::sun::star::util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); - xTrans->parseStrict( aURL ); - - OUString aTarget; - Reference < XDispatchProvider > xProv( m_xFrame, UNO_QUERY_THROW ); - if ( bPreview ) - aTarget = "_self"; - else - { - // can be removed if the database application change its URL - if ( !rURL.startsWith( "service:" ) ) - // service URL has no default target - aTarget = "_default"; - xProv = Reference < XDispatchProvider >( Desktop::create(::comphelper::getProcessComponentContext() ), - UNO_QUERY_THROW ); - } - - Reference < XDispatch > xDisp = xProv.is() ? - xProv->queryDispatch( aURL, aTarget, 0 ) : Reference < XDispatch >(); - - if ( xDisp.is() ) - { - if ( bPreview ) - { - if ( m_aOpenURL != aURL.Complete ) - { - WaitObject aWaitCursor( GetParent() ); - // disabling must be done here, does not work in ctor because - // execute of the dialog will overwrite it - // ( own execute method would help ) - pTextWin->EnableInput( false, true ); - if ( pTextWin->IsReallyVisible() ) - { - sal_Bool b = sal_True; - Sequence < PropertyValue > aArgs( 4 ); - aArgs[0].Name = "Preview"; - aArgs[0].Value.setValue( &b, ::getBooleanCppuType() ); - aArgs[1].Name = "ReadOnly"; - aArgs[1].Value.setValue( &b, ::getBooleanCppuType() ); - aArgs[2].Name = "AsTemplate"; // prevents getting an empty URL with getURL()! - - uno::Reference < task::XInteractionHandler2 > xInteractionHandler( - task::InteractionHandler::createWithParent(::comphelper::getProcessComponentContext(), 0) ); - aArgs[3].Name = "InteractionHandler"; - aArgs[3].Value <<= xInteractionHandler; - - b = sal_False; - aArgs[2].Value.setValue( &b, ::getBooleanCppuType() ); - xDisp->dispatch( aURL, aArgs ); - - OUString aDispURL; - Reference< ::com::sun::star::frame::XController > xCtrl = m_xFrame->getController(); - if( xCtrl.is() ) - { - Reference< ::com::sun::star::frame::XModel > xMdl = xCtrl->getModel(); - if( xMdl.is() ) - aDispURL = xMdl->getURL(); - } - - if( aDispURL != aURL.Complete ) - { - m_xFrame->setComponent( Reference < com::sun::star::awt::XWindow >(), Reference < XController >() ); - ViewEmptyWin(); - m_aOpenURL = ""; - } - else - m_aOpenURL = aDispURL; - } - } - } - else if ( bIsTemplate ) - { - Sequence < PropertyValue > aArgs( 1 ); - aArgs[0].Name = "AsTemplate"; - aArgs[0].Value <<= bAsTemplate; - xDisp->dispatch( aURL, aArgs ); - m_aOpenURL = ""; - } - else - { - Sequence < PropertyValue > aArgs; - xDisp->dispatch( aURL, aArgs ); - m_aOpenURL = ""; - } - } - } -} - -void SvtFrameWindow_Impl::ToggleView( bool bDI ) -{ - bDocInfo = bDI; - - // view is set properly in OpenFile() - - OpenFile( aCurrentURL, true, false, false ); -} - -// class SvtTemplateWindow ----------------------------------------------- - -SvtTemplateWindow::SvtTemplateWindow( Window* pParent ) : - - Window( pParent, WB_DIALOGCONTROL ), - - aFileViewTB ( this, SvtResId( TB_SVT_FILEVIEW ) ), - aFrameWinTB ( this, SvtResId( TB_SVT_FRAMEWIN ) ), - aSplitWin ( this, WB_DIALOGCONTROL | WB_NOSPLITDRAW ), - pHistoryList ( NULL ) - -{ - // create windows - pIconWin = new SvtIconWindow_Impl( this ); - pFileWin = new SvtFileViewWindow_Impl( this ); - pFileWin->SetMyDocumentsURL( pIconWin->GetMyDocumentsRootURL() ); - pFileWin->SetSamplesFolderURL( pIconWin->GetSamplesFolderURL() ); - pFrameWin = new SvtFrameWindow_Impl( this ); - - // set handlers - pIconWin->SetClickHdl( LINK( this, SvtTemplateWindow, IconClickHdl_Impl ) ); - pFileWin->SetSelectHdl( LINK( this, SvtTemplateWindow, FileSelectHdl_Impl ) ); - pFileWin->SetDoubleClickHdl( LINK( this, SvtTemplateWindow, FileDblClickHdl_Impl ) ); - pFileWin->SetNewFolderHdl( LINK( this, SvtTemplateWindow, NewFolderHdl_Impl ) ); - - // create the split items - aSplitWin.SetAlign( WINDOWALIGN_LEFT ); - long nWidth = pIconWin->GetMaxTextLength() * 8 / 7 + 1; // extra space for border - aSplitWin.InsertItem( ICONWIN_ID, pIconWin, nWidth, SPLITWINDOW_APPEND, 0, SWIB_FIXED ); - aSplitWin.InsertItem( FILEWIN_ID, pFileWin, 50, SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE ); - aSplitWin.InsertItem( FRAMEWIN_ID, pFrameWin, 50, SPLITWINDOW_APPEND, 0, SWIB_PERCENTSIZE ); - aSplitWin.SetSplitHdl( LINK( this, SvtTemplateWindow, ResizeHdl_Impl ) ); - - // show the windows - pIconWin->Show(); - pFileWin->Show(); - pFrameWin->Show(); - aSplitWin.Show(); - - // initialize the timers - aSelectTimer.SetTimeout( 200 ); - aSelectTimer.SetTimeoutHdl( LINK( this, SvtTemplateWindow, TimeoutHdl_Impl ) ); - - // initialize the toolboxes and then show them - InitToolBoxes(); - aFileViewTB.Show(); - aFrameWinTB.Show(); - - ReadViewSettings( ); - - Application::PostUserEvent( LINK( this, SvtTemplateWindow, ResizeHdl_Impl ) ); -} - - - -SvtTemplateWindow::~SvtTemplateWindow() -{ - WriteViewSettings( ); - - delete pIconWin; - delete pFileWin; - delete pFrameWin; - if ( pHistoryList ) - { - for ( size_t i = 0, n = pHistoryList->size(); i < n; ++i ) - delete (*pHistoryList)[ i ]; - pHistoryList->clear(); - delete pHistoryList; - } -} - - - -IMPL_LINK_NOARG(SvtTemplateWindow , IconClickHdl_Impl) -{ - OUString aURL = pIconWin->GetSelectedIconURL(); - if ( aURL.isEmpty() ) - aURL = pIconWin->GetCursorPosIconURL(); - if ( pFileWin->GetRootURL() != aURL ) - { - pFileWin->OpenRoot( aURL ); - pIconWin->InvalidateIconControl(); - aFileViewTB.EnableItem( TI_DOCTEMPLATE_PRINT, false ); - } - return 0; -} - - - -IMPL_LINK_NOARG(SvtTemplateWindow , FileSelectHdl_Impl) -{ - aSelectTimer.Start(); - return 0; -} - - - -IMPL_LINK_NOARG(SvtTemplateWindow , FileDblClickHdl_Impl) -{ - if ( aSelectTimer.IsActive() ) - aSelectTimer.Stop(); - - OUString aURL = pFileWin->GetSelectedFile(); - if ( !aURL.isEmpty() ) - { - if ( ::utl::UCBContentHelper::IsFolder( aURL ) ) - pFileWin->OpenFolder( aURL ); - else - aDoubleClickHdl.Call( this ); - } - - return 0; -} - - - -IMPL_LINK_NOARG(SvtTemplateWindow , NewFolderHdl_Impl) -{ - pFrameWin->OpenFile( "", true, false, false ); - aFileViewTB.EnableItem( TI_DOCTEMPLATE_PRINT, false ); - - OUString sURL = pFileWin->GetFolderURL(); - sal_uLong nPos = pIconWin->GetRootPos( sURL ); - AppendHistoryURL( sURL, nPos ); - - aNewFolderHdl.Call( this ); - return 0; -} - - - -IMPL_LINK_NOARG(SvtTemplateWindow , TimeoutHdl_Impl) -{ - aSelectHdl.Call( this ); - OUString sURL = pFileWin->GetSelectedFile(); - bool bIsNewDoc = ( pIconWin->GetSelectEntryPos() == ICON_POS_NEWDOC ); - bool bIsFile = ( !sURL.isEmpty() && !::utl::UCBContentHelper::IsFolder( sURL ) && - INetURLObject( sURL ).GetProtocol() != INET_PROT_PRIVATE && !bIsNewDoc ); - aFileViewTB.EnableItem( TI_DOCTEMPLATE_PRINT, bIsFile ); - aFrameWinTB.EnableItem( TI_DOCTEMPLATE_PREVIEW, !bIsNewDoc ); - - if ( bIsFile ) - pFrameWin->OpenFile( sURL, true, false, false ); - else if ( bIsNewDoc && aFrameWinTB.IsItemChecked( TI_DOCTEMPLATE_PREVIEW ) ) - { - aFrameWinTB.CheckItem( TI_DOCTEMPLATE_DOCINFO ); - DoAction( TI_DOCTEMPLATE_DOCINFO ); - } - return 0; -} - - - -IMPL_LINK ( SvtTemplateWindow , ClickHdl_Impl, ToolBox *, pToolBox ) -{ - DoAction( pToolBox->GetCurItemId() ); - return 0; -} - - - -IMPL_LINK_NOARG(SvtTemplateWindow , ResizeHdl_Impl) -{ - Resize(); - return 0; -} - - - -void SvtTemplateWindow::PrintFile( const OUString& rURL ) -{ - // open the file readonly and hidden - Sequence < PropertyValue > aArgs( 2 ); - aArgs[0].Name = "ReadOnly"; - aArgs[0].Value <<= sal_True; - aArgs[1].Name = "Hidden"; - aArgs[1].Value <<= sal_True; - - Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); - Reference < XModel > xModel( xDesktop->loadComponentFromURL( - rURL, "_blank", 0, aArgs ), UNO_QUERY ); - if ( xModel.is() ) - { - // print - Reference < XPrintable > xPrintable( xModel, UNO_QUERY ); - if ( xPrintable.is() ) - xPrintable->print( Sequence < PropertyValue >() ); - } -} - - - -void SvtTemplateWindow::AppendHistoryURL( const OUString& rURL, sal_uLong nGroup ) -{ - bool bInsert = true; - if ( !pHistoryList ) - pHistoryList = new HistoryList_Impl; - else if ( pHistoryList->size() > 0 ) - { - FolderHistory* pLastEntry = pHistoryList->back(); - bInsert = ( rURL != pLastEntry->m_sURL); - } - - if ( bInsert ) - { - FolderHistory* pEntry = new FolderHistory( rURL, nGroup ); - pHistoryList->push_back( pEntry ); - aFileViewTB.EnableItem( TI_DOCTEMPLATE_BACK, pHistoryList->size() > 1 ); - } -} - - - -void SvtTemplateWindow::OpenHistory() -{ - delete pHistoryList->back(); - pHistoryList->pop_back(); - FolderHistory* pEntry = pHistoryList->back(); - pHistoryList->pop_back(); - aFileViewTB.EnableItem( TI_DOCTEMPLATE_BACK, pHistoryList->size() > 1 ); - pFileWin->OpenFolder( pEntry->m_sURL ); - pIconWin->SetCursorPos( pEntry->m_nGroup ); - delete pEntry; -} - - - -void SvtTemplateWindow::DoAction( sal_uInt16 nAction ) -{ - switch( nAction ) - { - case TI_DOCTEMPLATE_BACK : - { - if ( pHistoryList && pHistoryList->size() > 1 ) - OpenHistory(); - break; - } - - case TI_DOCTEMPLATE_PREV : - { - OUString aURL; - if ( pFileWin->HasPreviousLevel( aURL ) ) - pFileWin->OpenFolder( aURL ); - break; - } - - case TI_DOCTEMPLATE_PRINT : - { - OUString sPrintFile( pFileWin->GetSelectedFile() ); - if ( !sPrintFile.isEmpty() ) - PrintFile( sPrintFile ); - break; - } - - case TI_DOCTEMPLATE_DOCINFO : - case TI_DOCTEMPLATE_PREVIEW : - { - pFrameWin->ToggleView( TI_DOCTEMPLATE_DOCINFO == nAction ); - break; - } - } -} - - - -void SvtTemplateWindow::InitToolBoxes() -{ - InitToolBoxImages(); - - Size aSize = aFileViewTB.CalcWindowSizePixel(); - aSize.Height() += 4; - aFileViewTB.SetPosSizePixel( Point( 0, 2 ), aSize ); - aSize = aFrameWinTB.CalcWindowSizePixel(); - aSize.Height() += 4; - aFrameWinTB.SetPosSizePixel( Point( pFrameWin->GetPosPixel().X() + 2, 2 ), aSize ); - - bool bFlat = ( SvtMiscOptions().GetToolboxStyle() == TOOLBOX_STYLE_FLAT ); - if ( bFlat ) - { - aFileViewTB.SetOutStyle( TOOLBOX_STYLE_FLAT ); - aFrameWinTB.SetOutStyle( TOOLBOX_STYLE_FLAT ); - } - - aFileViewTB.EnableItem( TI_DOCTEMPLATE_BACK, false ); - aFileViewTB.EnableItem( TI_DOCTEMPLATE_PREV, false ); - aFileViewTB.EnableItem( TI_DOCTEMPLATE_PRINT, false ); - - Link aLink = LINK( this, SvtTemplateWindow, ClickHdl_Impl ); - aFileViewTB.SetClickHdl( aLink ); - aFrameWinTB.SetClickHdl( aLink ); -} - - - -void SvtTemplateWindow::InitToolBoxImages() -{ - SvtMiscOptions aMiscOpt; - bool bLarge = aMiscOpt.AreCurrentSymbolsLarge(); - - aFileViewTB.SetItemImage( TI_DOCTEMPLATE_BACK, Image( SvtResId( - bLarge ? IMG_SVT_DOCTEMPLATE_BACK_LARGE - : IMG_SVT_DOCTEMPLATE_BACK_SMALL ) ) ); - aFileViewTB.SetItemImage( TI_DOCTEMPLATE_PREV, Image( SvtResId( - bLarge ? IMG_SVT_DOCTEMPLATE_PREV_LARGE - : IMG_SVT_DOCTEMPLATE_PREV_SMALL ) ) ); - aFileViewTB.SetItemImage( TI_DOCTEMPLATE_PRINT, Image( SvtResId( - bLarge ? IMG_SVT_DOCTEMPLATE_PRINT_LARGE - : IMG_SVT_DOCTEMPLATE_PRINT_SMALL ) ) ); - - aFrameWinTB.SetItemImage( TI_DOCTEMPLATE_DOCINFO, Image( SvtResId( - bLarge ? IMG_SVT_DOCTEMPLATE_DOCINFO_LARGE - : IMG_SVT_DOCTEMPLATE_DOCINFO_SMALL ) ) ); - aFrameWinTB.SetItemImage( TI_DOCTEMPLATE_PREVIEW, Image( SvtResId( - bLarge ? IMG_SVT_DOCTEMPLATE_PREVIEW_LARGE - : IMG_SVT_DOCTEMPLATE_PREVIEW_SMALL ) ) ); -} - - - -void SvtTemplateWindow::UpdateIcons() -{ - pIconWin->UpdateIcons(); -} - - - -bool SvtTemplateWindow::PreNotify( NotifyEvent& rNEvt ) -{ - sal_uInt16 nType = rNEvt.GetType(); - bool nRet = false; - - if ( EVENT_KEYINPUT == nType && rNEvt.GetKeyEvent() ) - { - const vcl::KeyCode& rKeyCode = rNEvt.GetKeyEvent()->GetKeyCode(); - sal_uInt16 nCode = rKeyCode.GetCode(); - - if ( KEY_BACKSPACE == nCode && !rKeyCode.GetModifier() && pFileWin->HasChildPathFocus() ) - { - DoAction( TI_DOCTEMPLATE_BACK ); - nRet = true; - } - else if ( pIconWin->ProcessKeyEvent( *rNEvt.GetKeyEvent() ) ) - { - nRet = true; - } - } - - return nRet || Window::PreNotify( rNEvt ); -} - - - -void SvtTemplateWindow::DataChanged( const DataChangedEvent& rDCEvt ) -{ - Window::DataChanged( rDCEvt ); - - if ( ( ( rDCEvt.GetType() == DATACHANGED_SETTINGS ) || - ( rDCEvt.GetType() == DATACHANGED_DISPLAY ) ) && - ( rDCEvt.GetFlags() & SETTINGS_STYLE ) ) - { - // update of the background for the area left of the FileView toolbox - SetBackground( Wallpaper( GetSettings().GetStyleSettings().GetFaceColor() ) ); - // update of the images of the IconChoiceControl - UpdateIcons(); - // update of the toolbox images - InitToolBoxImages(); - } -} - - -void SvtTemplateWindow::Resize() -{ - long nItemSize = aSplitWin.GetItemSize( ICONWIN_ID ); - long nSplitterWidth = Splitter( this, 0 ).GetSizePixel().Width(); - - Point aPos = aFileViewTB.GetPosPixel(); - aPos.X() = nItemSize + nSplitterWidth / 2; - aFileViewTB.SetPosPixel( aPos ); - - Size aWinSize = GetOutputSizePixel(); - long nWidth = aWinSize.Width() - aPos.X(); - - nItemSize = nWidth * aSplitWin.GetItemSize( FILEWIN_ID ) / 100; - aPos.X() = pFrameWin->GetPosPixel().X() + 2; - aFrameWinTB.SetPosPixel( aPos ); - - Size aSize = aFileViewTB.GetSizePixel(); - aSize.Width() = nItemSize; - aFileViewTB.SetSizePixel( aSize ); - - aSize = aFrameWinTB.GetSizePixel(); - aSize.Width() = nWidth - nItemSize; - aFrameWinTB.SetSizePixel( aSize ); - - long nToolBoxHeight = aSize.Height() + aFrameWinTB.GetPosPixel().Y(); - aSize = aWinSize; - aSize.Height() -= nToolBoxHeight; - aSplitWin.SetPosSizePixel( Point( 0, nToolBoxHeight ), aSize ); -} - - - -OUString SvtTemplateWindow::GetSelectedFile() const -{ - return pFileWin->GetSelectedFile(); -} - - - -bool SvtTemplateWindow::IsFileSelected() const -{ - OUString aURL = pFileWin->GetSelectedFile(); - bool bRet = ( !aURL.isEmpty() && !::utl::UCBContentHelper::IsFolder( aURL ) ); - return bRet; -} - - - -void SvtTemplateWindow::OpenFile( bool bNotAsTemplate ) -{ - OUString aURL = pFileWin->GetSelectedFile(); - if ( !aURL.isEmpty() && !::utl::UCBContentHelper::IsFolder( aURL ) ) - pFrameWin->OpenFile( aURL, false, pFileWin->IsTemplateFolder(), !bNotAsTemplate ); -} - - - -OUString SvtTemplateWindow::GetFolderTitle() const -{ - OUString sTitle; - OUString sFolderURL = pFileWin->GetFolderURL(); - if ( pIconWin->IsRootURL( sFolderURL ) ) - sTitle = pIconWin->GetIconText( sFolderURL ); - else - sTitle = pFileWin->GetFolderTitle(); - return sTitle; -} - - - -OUString SvtTemplateWindow::GetFolderURL() const -{ - return pFileWin->GetFolderURL(); -} - - - - -void SvtTemplateWindow::SetFocus( bool bIconWin ) -{ - if ( bIconWin ) - pIconWin->SetFocus(); - else - pFileWin->SetFocus(); -} - - - -void SvtTemplateWindow::OpenTemplateRoot() -{ - pFileWin->OpenFolder( pIconWin->GetTemplateRootURL() ); -} - - - -void SvtTemplateWindow::SetPrevLevelButtonState( const OUString& rURL ) -{ - // disable the prev level button on root folder of the icon pane (except My Documents) - // and on the root of all (file:/// -> count == 0) - INetURLObject aObj( rURL ); - sal_Int32 nCount = aObj.getSegmentCount(); - bool bEnable = - ( nCount > 0 && - ( !pIconWin->IsRootURL( rURL ) || rURL == pIconWin->GetMyDocumentsRootURL() ) ); - aFileViewTB.EnableItem( TI_DOCTEMPLATE_PREV, bEnable ); -} - - - -void SvtTemplateWindow::ClearHistory() -{ - if( pHistoryList ) - { - for ( size_t i = 0, n = pHistoryList->size(); i < n; ++i ) - delete (*pHistoryList)[ i ]; - pHistoryList->clear(); - } -} - - - -long SvtTemplateWindow::CalcHeight() const -{ - // toolbox height - long nHeight = aFileViewTB.GetSizePixel().Height(); - // + iconwin height - nHeight += pIconWin->CalcHeight(); - // + little offset - nHeight += 8; - return nHeight; -} - - - -void SvtTemplateWindow::ReadViewSettings() -{ - // defaults - sal_Int32 nSelectedGroup = ICON_POS_TEMPLATES; - sal_Int32 nSelectedView = TI_DOCTEMPLATE_DOCINFO; - double nSplitRatio = 0.5; - OUString sLastFolder; - - SvtViewOptions aViewSettings( E_DIALOG, VIEWSETTING_NEWFROMTEMPLATE ); - if ( aViewSettings.Exists() ) - { - // read the settings - aViewSettings.GetUserItem( VIEWSETTING_SELECTEDGROUP ) >>= nSelectedGroup; - aViewSettings.GetUserItem( VIEWSETTING_SELECTEDVIEW ) >>= nSelectedView; - aViewSettings.GetUserItem( VIEWSETTING_SPLITRATIO ) >>= nSplitRatio; - aViewSettings.GetUserItem( VIEWSETTING_LASTFOLDER ) >>= sLastFolder; - } - // normalize - if ( nSelectedGroup < ICON_POS_NEWDOC ) nSelectedGroup = ICON_POS_NEWDOC; - if ( nSelectedGroup > ICON_POS_SAMPLES ) nSelectedGroup = ICON_POS_SAMPLES; - - if ( ( TI_DOCTEMPLATE_DOCINFO != nSelectedView ) && ( TI_DOCTEMPLATE_PREVIEW != nSelectedView ) ) - nSelectedView = TI_DOCTEMPLATE_DOCINFO; - - if ( nSplitRatio < 0.2 ) nSplitRatio = 0.2; - if ( nSplitRatio > 0.8 ) nSplitRatio = 0.8; - - // change our view according to the settings - - // the selected view (details or preview) - pFrameWin->ToggleView( TI_DOCTEMPLATE_DOCINFO == nSelectedView ); - aFrameWinTB.CheckItem( (sal_uInt16)nSelectedView, true ); - - // the split ratio - sal_Int32 nSplitFileAndFrameSize = aSplitWin.GetItemSize( FILEWIN_ID ) + aSplitWin.GetItemSize( FRAMEWIN_ID ); - sal_Int32 nSplitFileSize = (sal_Int32)(nSplitFileAndFrameSize * nSplitRatio); - sal_Int32 nSplitFrameSize = nSplitFileAndFrameSize - nSplitFileSize; - aSplitWin.SetItemSize( FILEWIN_ID, nSplitFileSize ); - aSplitWin.SetItemSize( FRAMEWIN_ID, nSplitFrameSize ); - Resize(); - - // the selected folder - pIconWin->SetCursorPos( nSelectedGroup ); - - // open the last folder or the selected group - if ( !sLastFolder.isEmpty() ) - pFileWin->OpenFolder( sLastFolder ); - else - IconClickHdl_Impl( NULL ); -} - - - -void SvtTemplateWindow::WriteViewSettings() -{ - // collect - Sequence< NamedValue > aSettings(4); - - // the selected group - aSettings[0].Name = VIEWSETTING_SELECTEDGROUP; - pIconWin->SetFocus(); - aSettings[0].Value <<= (sal_Int32)pIconWin->GetCursorPos( ); - - // the selected view mode - aSettings[1].Name = VIEWSETTING_SELECTEDVIEW; - aSettings[1].Value <<= sal_Int32( aFrameWinTB.IsItemChecked( TI_DOCTEMPLATE_DOCINFO ) ? TI_DOCTEMPLATE_DOCINFO : TI_DOCTEMPLATE_PREVIEW ); - - // the split ratio - aSettings[2].Name = VIEWSETTING_SPLITRATIO; - sal_Int32 nSplitFileSize = aSplitWin.GetItemSize( FILEWIN_ID ); - sal_Int32 nSplitFileAndFrameSize = nSplitFileSize + aSplitWin.GetItemSize( FRAMEWIN_ID ); - aSettings[2].Value <<= double( 1.0 * nSplitFileSize / nSplitFileAndFrameSize ); - - // last folder - aSettings[3].Name = VIEWSETTING_LASTFOLDER; - aSettings[3].Value <<= OUString( pFileWin->GetFolderURL() ); - - // write - SvtViewOptions aViewSettings( E_DIALOG, VIEWSETTING_NEWFROMTEMPLATE ); - aViewSettings.SetUserData( aSettings ); -} - -void SvtTemplateWindow::SelectFolder(sal_Int32 nFolderPosition) -{ - pIconWin->SelectFolder(nFolderPosition); -} - -struct SvtTmplDlg_Impl -{ - SvtTemplateWindow* pWin; - OUString aTitle; - Timer aUpdateTimer; - bool bSelectNoOpen; - - uno::Reference< util::XOfficeInstallationDirectories > m_xOfficeInstDirs; - - - SvtTmplDlg_Impl( Window* pParent ) : pWin( new SvtTemplateWindow( pParent ) ) ,bSelectNoOpen( false ) {} - - ~SvtTmplDlg_Impl() { delete pWin; } -}; - -SvtDocumentTemplateDialog::SvtDocumentTemplateDialog( Window* pParent ) : - - ModalDialog( pParent, SvtResId( DLG_DOCTEMPLATE ) ), - - aMoreTemplatesLink ( this, SvtResId( FT_DOCTEMPLATE_LINK ) ), - aLine ( this, SvtResId( FL_DOCTEMPLATE ) ), - aManageBtn ( this, SvtResId( BTN_DOCTEMPLATE_MANAGE ) ), - aPackageBtn ( this, SvtResId( BTN_DOCTEMPLATE_PACKAGE ) ), - aEditBtn ( this, SvtResId( BTN_DOCTEMPLATE_EDIT ) ), - aOKBtn ( this, SvtResId( BTN_DOCTEMPLATE_OPEN ) ), - aCancelBtn ( this, SvtResId( BTN_DOCTEMPLATE_CANCEL ) ), - aHelpBtn ( this, SvtResId( BTN_DOCTEMPLATE_HELP ) ), - pImpl ( NULL ) -{ - FreeResource(); - InitImpl( ); -} - - - -void SvtDocumentTemplateDialog::InitImpl( ) -{ - pImpl = new SvtTmplDlg_Impl( this ); - pImpl->aTitle = GetText(); - - bool bHideLink = ( SvtExtendedSecurityOptions().GetOpenHyperlinkMode() - == SvtExtendedSecurityOptions::OPEN_NEVER ); - if ( !bHideLink ) - { - aMoreTemplatesLink.SetURL( "http://templates.libreoffice.org/" ); - aMoreTemplatesLink.SetClickHdl( LINK( this, SvtDocumentTemplateDialog, OpenLinkHdl_Impl ) ); - } - else - aMoreTemplatesLink.Hide(); - - aManageBtn.SetClickHdl( LINK( this, SvtDocumentTemplateDialog, OrganizerHdl_Impl ) ); - // Only enable the Package Button, if the service is available - try - { - using namespace org::freedesktop::PackageKit; - Reference< XSyncDbusSessionHelper > xSyncDbusSessionHelper(SyncDbusSessionHelper::create(comphelper::getProcessComponentContext()), UNO_QUERY); - aPackageBtn.SetClickHdl( LINK( this, SvtDocumentTemplateDialog, PackageHdl_Impl ) ); - aPackageBtn.Enable(xSyncDbusSessionHelper.is()); - } - catch (Exception & e) - { - SAL_INFO( - "svtools.contnr", - "disable Install Template Pack, caught " << e.Message); - aPackageBtn.Enable(false); - } - Link aLink = LINK( this, SvtDocumentTemplateDialog, OKHdl_Impl ); - aEditBtn.SetClickHdl( aLink ); - aOKBtn.SetClickHdl( aLink ); - - pImpl->pWin->SetSelectHdl( LINK( this, SvtDocumentTemplateDialog, SelectHdl_Impl ) ); - pImpl->pWin->SetDoubleClickHdl( LINK( this, SvtDocumentTemplateDialog, DoubleClickHdl_Impl ) ); - pImpl->pWin->SetNewFolderHdl( LINK( this, SvtDocumentTemplateDialog, NewFolderHdl_Impl ) ); - pImpl->pWin->SetSendFocusHdl( LINK( this, SvtDocumentTemplateDialog, SendFocusHdl_Impl ) ); - - // dynamic height adjustment - long nHeight = pImpl->pWin->CalcHeight(); - - Size aSize = GetOutputSizePixel(); - Point aPos = aMoreTemplatesLink.GetPosPixel(); - Size a6Size = LogicToPixel( Size( 6, 6 ), MAP_APPFONT ); - if ( bHideLink ) - aPos.Y() += aMoreTemplatesLink.GetSizePixel().Height(); - else - aPos.Y() -= a6Size.Height(); - long nDelta = aPos.Y() - nHeight; - aSize.Height() -= nDelta; - SetOutputSizePixel( aSize ); - - aSize.Height() = nHeight; - aSize.Width() -= ( a6Size.Width() * 2 ); - pImpl->pWin->SetPosSizePixel( Point( a6Size.Width(), 0 ), aSize ); - - aPos = aMoreTemplatesLink.GetPosPixel(); - aPos.Y() -= nDelta; - aMoreTemplatesLink.SetPosPixel( aPos ); - aPos = aLine.GetPosPixel(); - aPos.Y() -= nDelta; - aLine.SetPosPixel( aPos ); - aPos = aManageBtn.GetPosPixel(); - aPos.Y() -= nDelta; - aManageBtn.SetPosPixel( aPos ); - aPos = aEditBtn.GetPosPixel(); - aPos.Y() -= nDelta; - aEditBtn.SetPosPixel( aPos ); - aPos = aOKBtn.GetPosPixel(); - aPos.Y() -= nDelta; - aOKBtn.SetPosPixel( aPos ); - aPos = aCancelBtn.GetPosPixel(); - aPos.Y() -= nDelta; - aCancelBtn.SetPosPixel( aPos ); - aPos = aHelpBtn.GetPosPixel(); - aPos.Y() -= nDelta; - aHelpBtn.SetPosPixel( aPos ); - aPos = aPackageBtn.GetPosPixel(); - aPos.Y() -= nDelta; - aPackageBtn.SetPosPixel( aPos ); - - pImpl->pWin->Show(); - - SelectHdl_Impl( NULL ); - NewFolderHdl_Impl( NULL ); - - UpdateHdl_Impl( NULL ); -} - - - -SvtDocumentTemplateDialog::~SvtDocumentTemplateDialog() -{ - delete pImpl; -} - - - -bool SvtDocumentTemplateDialog::CanEnableEditBtn() const -{ - bool bEnable = false; - - OUString aFolderURL = pImpl->pWin->GetFolderURL(); - if ( pImpl->pWin->IsFileSelected() && !aFolderURL.isEmpty() ) - { - OUString aFileTargetURL = pImpl->pWin->GetSelectedFile(); - bEnable = !aFileTargetURL.isEmpty(); - } - - return bEnable; -} - - - -IMPL_LINK_NOARG(SvtDocumentTemplateDialog , SelectHdl_Impl) -{ - aEditBtn.Enable( pImpl->pWin->IsTemplateFolderOpen() && CanEnableEditBtn() ); - aOKBtn.Enable( pImpl->pWin->IsFileSelected() ); - return 0; -} - - - -IMPL_LINK_NOARG(SvtDocumentTemplateDialog , DoubleClickHdl_Impl) -{ - EndDialog( RET_OK ); - - if ( !pImpl->bSelectNoOpen ) - pImpl->pWin->OpenFile( !pImpl->pWin->IsTemplateFolderOpen() ); - return 0; -} - - - -IMPL_LINK_NOARG(SvtDocumentTemplateDialog , NewFolderHdl_Impl) -{ - OUString aNewTitle( pImpl->aTitle ); - aNewTitle += " - "; - aNewTitle += pImpl->pWin->GetFolderTitle(); - SetText( aNewTitle ); - - SelectHdl_Impl( NULL ); - return 0; -} - - - -IMPL_LINK_NOARG(SvtDocumentTemplateDialog , SendFocusHdl_Impl) -{ - if ( pImpl->pWin->HasIconWinFocus() ) - aHelpBtn.GrabFocus(); - else - { - if ( aEditBtn.IsEnabled() ) - aEditBtn.GrabFocus(); - else if ( aOKBtn.IsEnabled() ) - aOKBtn.GrabFocus(); - else - aCancelBtn.GrabFocus(); - } - - return 0; -} - - - -IMPL_LINK ( SvtDocumentTemplateDialog , OKHdl_Impl, PushButton *, pBtn ) -{ - if ( pImpl->pWin->IsFileSelected() ) - { - EndDialog( RET_OK ); - - if ( !pImpl->bSelectNoOpen ) - pImpl->pWin->OpenFile( &aEditBtn == pBtn ); - } - return 0; -} - - - -IMPL_LINK_NOARG(SvtDocumentTemplateDialog , OrganizerHdl_Impl) -{ - Window* pOldDefWin = Application::GetDefDialogParent(); - Application::SetDefDialogParent( this ); - Reference < XDesktop2 > xDesktop = Desktop::create( ::comphelper::getProcessComponentContext() ); - Reference < XFrame > xFrame( xDesktop->getActiveFrame() ); - if ( !xFrame.is() ) - xFrame = xDesktop; - - com::sun::star::util::URL aTargetURL; - aTargetURL.Complete = "slot:5540"; - Reference< com::sun::star::util::XURLTransformer > xTrans( - com::sun::star::util::URLTransformer::create( ::comphelper::getProcessComponentContext() ) ); - xTrans->parseStrict( aTargetURL ); - - Reference < XDispatchProvider > xProv( xFrame, UNO_QUERY ); - Reference < XDispatch > xDisp; - xDisp = xProv->queryDispatch( aTargetURL, OUString(), 0 ); - - if ( xDisp.is() ) - { - Sequence<PropertyValue> aArgs(1); - PropertyValue* pArg = aArgs.getArray(); - pArg[0].Name = "Referer"; - pArg[0].Value <<= OUString("private:user"); - xDisp->dispatch( aTargetURL, aArgs ); - } - - Application::SetDefDialogParent( pOldDefWin ); - return 0; -} - - -IMPL_LINK_NOARG(SvtDocumentTemplateDialog, PackageHdl_Impl) -{ - try - { - using namespace org::freedesktop::PackageKit; - Reference< XSyncDbusSessionHelper > xSyncDbusSessionHelper(SyncDbusSessionHelper::create(comphelper::getProcessComponentContext()), UNO_QUERY); - Sequence< OUString > vPackages(1); - vPackages[0] = "libreoffice-templates"; - OUString sInteraction(""); - xSyncDbusSessionHelper->InstallPackageNames(0, vPackages, sInteraction); - } - catch (Exception & e) - { - SAL_INFO( - "svtools.contnr", - "trying Install Template Pack, caught " << e.Message); - } - return 0; -} - - - -IMPL_LINK ( SvtDocumentTemplateDialog, UpdateHdl_Impl, Timer*, _pEventSource ) -{ - pImpl->pWin->SetFocus( false ); - 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() ) - { - 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; -} - - - -IMPL_LINK_NOARG(SvtDocumentTemplateDialog, OpenLinkHdl_Impl) -{ - OUString sURL( aMoreTemplatesLink.GetURL() ); - if ( !sURL.isEmpty() ) - { - localizeWebserviceURI(sURL); - try - { - uno::Reference< uno::XComponentContext > xContext = - ::comphelper::getProcessComponentContext(); - uno::Reference< com::sun::star::system::XSystemShellExecute > xSystemShell( - com::sun::star::system::SystemShellExecute::create(xContext) ); - if ( xSystemShell.is() ) - xSystemShell->execute( sURL, OUString(), com::sun::star::system::SystemShellExecuteFlags::URIS_ONLY ); - EndDialog( RET_CANCEL ); - } - catch( const uno::Exception& e ) - { - OSL_TRACE( "Caught exception: %s\n thread terminated.\n", - OUStringToOString(e.Message, RTL_TEXTENCODING_UTF8).getStr()); - } - } - return 0; -} - -void SvtDocumentTemplateDialog::SelectTemplateFolder() -{ - pImpl->pWin->SelectFolder(ICON_POS_TEMPLATES); -} - /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/templwin.hrc b/svtools/source/contnr/templwin.hrc index 34af9102a0d7..8c4168cde08d 100644 --- a/svtools/source/contnr/templwin.hrc +++ b/svtools/source/contnr/templwin.hrc @@ -19,21 +19,6 @@ #ifndef _SVTOOLS_TEMPLWIN_HRC #define _SVTOOLS_TEMPLWIN_HRC -#define FL_DOCTEMPLATE 10 -#define BTN_DOCTEMPLATE_MANAGE 11 -#define BTN_DOCTEMPLATE_EDIT 12 -#define BTN_DOCTEMPLATE_OPEN 13 -#define BTN_DOCTEMPLATE_CANCEL 14 -#define BTN_DOCTEMPLATE_HELP 15 -#define FT_DOCTEMPLATE_LINK 16 -#define BTN_DOCTEMPLATE_PACKAGE 17 - -#define TI_DOCTEMPLATE_BACK 1 -#define TI_DOCTEMPLATE_PREV 2 -#define TI_DOCTEMPLATE_PRINT 3 -#define TI_DOCTEMPLATE_DOCINFO 4 -#define TI_DOCTEMPLATE_PREVIEW 5 - #define DI_TITLE 1 #define DI_FROM 2 #define DI_DATE 3 diff --git a/svtools/source/contnr/templwin.hxx b/svtools/source/contnr/templwin.hxx index 368bc894ad75..edbbb3beef83 100644 --- a/svtools/source/contnr/templwin.hxx +++ b/svtools/source/contnr/templwin.hxx @@ -20,138 +20,6 @@ #define INCLUDED_SVTOOLS_SOURCE_CONTNR_TEMPLWIN_HXX #include <tools/resary.hxx> -#include <vcl/splitwin.hxx> -#include <vcl/toolbox.hxx> -#include <vcl/window.hxx> -#include <svtools/headbar.hxx> -#include <svtools/fileview.hxx> -#include <svtools/ivctrl.hxx> -#include <svtools/svmedit2.hxx> -#include <com/sun/star/frame/XDispatch.hpp> -#include <com/sun/star/lang/Locale.hpp> - -namespace com{ namespace sun { namespace star { namespace awt { class XWindow; } } } } -namespace com{ namespace sun { namespace star { namespace frame { class XFrame2; } } } } -namespace com{ namespace sun { namespace star { namespace document { - class XDocumentProperties; -} } } } -namespace svtools -{ - class ODocumentInfoPreview; -} - -// class SvtDummyHeaderBar_Impl ------------------------------------------ - -class SvtDummyHeaderBar_Impl : public Window -{ -private: - void UpdateBackgroundColor(); - -public: - SvtDummyHeaderBar_Impl( Window* pParent ); - virtual ~SvtDummyHeaderBar_Impl(); - - virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; -}; - -// class SvtIconWindow_Impl ---------------------------------------------- - -class SvtIconWindow_Impl : public Window -{ -private: - SvtDummyHeaderBar_Impl aDummyHeaderBar; // spaceholder instead of HeaderBar - SvtIconChoiceCtrl aIconCtrl; - - OUString aNewDocumentRootURL; - OUString aTemplateRootURL; - OUString aMyDocumentsRootURL; - OUString aSamplesFolderRootURL; - - long nMaxTextLength; - - SvxIconChoiceCtrlEntry* GetEntry( const OUString& rURL ) const; - -public: - SvtIconWindow_Impl( Window* pParent ); - virtual ~SvtIconWindow_Impl(); - - virtual void Resize() SAL_OVERRIDE; - - inline long GetMaxTextLength() const { return nMaxTextLength; } - inline void SetClickHdl( const Link& rLink ) { aIconCtrl.SetClickHdl( rLink ); } - - OUString GetSelectedIconURL() const; - OUString GetCursorPosIconURL() const; - OUString GetIconText( const OUString& rURL ) const; - void InvalidateIconControl(); - void SetCursorPos( sal_uLong nPos ); - sal_uLong GetCursorPos() const; - sal_uLong GetSelectEntryPos() const; - void SetFocus(); - long CalcHeight() const; - bool IsRootURL( const OUString& rURL ) const; - sal_uLong GetRootPos( const OUString& rURL ) const; - void UpdateIcons(); - - inline bool ProcessKeyEvent( const KeyEvent& rKEvt ); - - inline const OUString& GetTemplateRootURL() const { return aTemplateRootURL; } - inline const OUString& GetMyDocumentsRootURL() const { return aMyDocumentsRootURL; } - inline const OUString& GetSamplesFolderURL() const { return aSamplesFolderRootURL; } - - void SelectFolder(sal_Int32 nFolderPos); -}; - -inline bool SvtIconWindow_Impl::ProcessKeyEvent( const KeyEvent& rKEvt ) -{ - return rKEvt.GetKeyCode().IsMod2() && aIconCtrl.DoKeyInput( rKEvt ); -} - -// class SvtFileViewWindow_Impl ------------------------------------------ - -class SvtTemplateWindow; - -class SvtFileViewWindow_Impl : public Window -{ -private: - SvtTemplateWindow& rParent; - SvtFileView aFileView; - Link aNewFolderLink; - OUString aCurrentRootURL; - OUString aFolderURL; - OUString aMyDocumentsURL; - OUString aSamplesFolderURL; - - bool bIsTemplateFolder; - - ::com::sun::star::uno::Sequence< OUString > - GetNewDocContents() const; - -public: - SvtFileViewWindow_Impl( SvtTemplateWindow* pParent ); - virtual ~SvtFileViewWindow_Impl(); - - virtual void Resize() SAL_OVERRIDE; - - inline void SetSelectHdl( const Link& rLink ) { aFileView.SetSelectHdl( rLink ); } - inline void SetDoubleClickHdl( const Link& rLink ) { aFileView.SetDoubleClickHdl( rLink ); } - inline void SetNewFolderHdl( const Link& rLink ) { aNewFolderLink = rLink; } - inline bool IsTemplateFolder() const { return bIsTemplateFolder; } - inline OUString GetFolderURL() const { return aFolderURL; } - inline OUString GetRootURL() const { return aCurrentRootURL; } - inline void OpenRoot( const OUString& rRootURL ) - { aCurrentRootURL = rRootURL; OpenFolder( rRootURL ); } - inline void SetMyDocumentsURL( const OUString& _rNewURL ) { aMyDocumentsURL = _rNewURL; } - inline void SetSamplesFolderURL( const OUString& _rNewURL ) { aSamplesFolderURL = _rNewURL; } - - OUString GetSelectedFile() const; - void OpenFolder( const OUString& rURL ); - bool HasPreviousLevel( OUString& rURL ) const; - OUString GetFolderTitle() const; - void SetFocus(); -}; - -// class SvtFrameWindow_Impl --------------------------------------------- class SvtDocInfoTable_Impl : public ResStringArray { @@ -161,123 +29,6 @@ public: OUString GetString( long nId ) const; }; -class SvtFrameWindow_Impl : public Window -{ -private: - ::com::sun::star::uno::Reference < ::com::sun::star::frame::XFrame2 > - m_xFrame; - ::com::sun::star::uno::Reference < ::com::sun::star::document::XDocumentProperties> - m_xDocProps; - ::com::sun::star::uno::Reference< ::com::sun::star::awt::XWindow > - xWindow; - - ::svtools::ODocumentInfoPreview* - pEditWin; - Window* pTextWin; - Window* pEmptyWin; - ::com::sun::star::lang::Locale aLocale; - SvtDocInfoTable_Impl aInfoTable; - OUString aCurrentURL; - OUString m_aOpenURL; - bool bDocInfo; - - void ShowDocInfo( const OUString& rURL ); - void ViewEditWin(); - void ViewTextWin(); - void ViewEmptyWin(); - void ViewNonEmptyWin(); // views depending on bDocInfo - - struct SvtExecuteInfo - { - ::com::sun::star::uno::Reference< ::com::sun::star::frame::XDispatch > xDispatch; - ::com::sun::star::util::URL aTargetURL; - }; - -public: - SvtFrameWindow_Impl( Window* pParent ); - virtual ~SvtFrameWindow_Impl(); - - virtual void Resize() SAL_OVERRIDE; - - void OpenFile( const OUString& rURL, bool bPreview, bool bIsTemplate, bool bAsTemplate ); - void ToggleView( bool bDocInfo ); -}; - -// class SvtTemplateWindow ----------------------------------------------- - -struct FolderHistory; -typedef ::std::vector< FolderHistory* > HistoryList_Impl; - -class SvtTemplateWindow : public Window -{ -private: - ToolBox aFileViewTB; - ToolBox aFrameWinTB; - SplitWindow aSplitWin; - - SvtIconWindow_Impl* pIconWin; - SvtFileViewWindow_Impl* pFileWin; - SvtFrameWindow_Impl* pFrameWin; - HistoryList_Impl* pHistoryList; - - Link aSelectHdl; - Link aDoubleClickHdl; - Link aNewFolderHdl; - Link aSendFocusHdl; - - Timer aSelectTimer; - - OUString aFolderTitle; - - virtual void Resize() SAL_OVERRIDE; - - DECL_LINK(IconClickHdl_Impl, void *); - DECL_LINK(FileSelectHdl_Impl, void *); - DECL_LINK(FileDblClickHdl_Impl, void *); - DECL_LINK(NewFolderHdl_Impl, void *); - DECL_LINK(TimeoutHdl_Impl, void *); - DECL_LINK( ClickHdl_Impl, ToolBox* ); - DECL_LINK(ResizeHdl_Impl, void *); // used for split and initial setting of toolbar pos - - void PrintFile( const OUString& rURL ); - void AppendHistoryURL( const OUString& rURL, sal_uLong nGroup ); - void OpenHistory(); - void DoAction( sal_uInt16 nAction ); - void InitToolBoxes(); - void InitToolBoxImages(); - void UpdateIcons(); - -protected: - virtual bool PreNotify( NotifyEvent& rNEvt ) SAL_OVERRIDE; - virtual void DataChanged( const DataChangedEvent& rDCEvt ) SAL_OVERRIDE; - -public: - SvtTemplateWindow( Window* pParent ); - virtual ~SvtTemplateWindow(); - - inline void SetSelectHdl( const Link& rLink ) { aSelectHdl = rLink; } - inline void SetDoubleClickHdl( const Link& rLink ) { aDoubleClickHdl = rLink; } - inline void SetNewFolderHdl( const Link& rLink ) { aNewFolderHdl = rLink; } - inline void SetSendFocusHdl( const Link& rLink ) { aSendFocusHdl = rLink; } - inline bool IsTemplateFolderOpen() const { return pFileWin->IsTemplateFolder(); } - inline bool HasIconWinFocus() const { return pIconWin->HasChildPathFocus(); } - - void ReadViewSettings( ); - void WriteViewSettings( ); - bool IsFileSelected() const; - OUString GetSelectedFile() const; - void OpenFile( bool bNotAsTemplate ); - OUString GetFolderTitle() const; - OUString GetFolderURL() const; - void SetFocus( bool bIconWin ); - void OpenTemplateRoot(); - void SetPrevLevelButtonState( const OUString& rURL ); // sets state (enable/disable) for previous level button - void ClearHistory(); - long CalcHeight() const; - - void SelectFolder(sal_Int32 nFolderPosition); -}; - #endif // INCLUDED_SVTOOLS_SOURCE_CONTNR_TEMPLWIN_HXX /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/svtools/source/contnr/templwin.src b/svtools/source/contnr/templwin.src index 7043f18ec008..24e8ae991ece 100644 --- a/svtools/source/contnr/templwin.src +++ b/svtools/source/contnr/templwin.src @@ -22,221 +22,6 @@ #include <svtools/helpid.hrc> #include <svtools/svtools.hrc> -// Magenta and Grey as mask colors -#define MASK_COL_MAGENTA Color { Red = 0xFFFF ; Green = 0x0000 ; Blue = 0xFFFF ; }; - -String STR_SVT_NEWDOC -{ - Text [ en-US ] = "New Document"; -}; - -Image IMG_SVT_NEWDOC -{ - ImageBitmap = Bitmap { File = "new_doc.png" ; }; - MaskColor = MASK_COL_MAGENTA -}; - -String STR_SVT_MYDOCS -{ - Text [ en-US ] = "My Documents"; -}; - -Image IMG_SVT_MYDOCS -{ - ImageBitmap = Bitmap { File = "my_docs.png" ; }; - MaskColor = MASK_COL_MAGENTA -}; - -String STR_SVT_TEMPLATES -{ - Text [ en-US ] = "Templates"; -}; - -Image IMG_SVT_TEMPLATES -{ - ImageBitmap = Bitmap { File = "template.png" ; }; - MaskColor = MASK_COL_MAGENTA -}; - -String STR_SVT_SAMPLES -{ - Text [ en-US ] = "Samples"; -}; - -Image IMG_SVT_SAMPLES -{ - ImageBitmap = Bitmap { File = "samples.png" ; }; - MaskColor = MASK_COL_MAGENTA -}; - -ToolBox TB_SVT_FILEVIEW -{ - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( 100 , 12 ) ; - ItemList = - { - ToolBoxItem - { - Identifier = TI_DOCTEMPLATE_BACK; - HelpId = HID_TEMPLATEDLG_TB_BACK; - Text [ en-US ] = "Back" ; - }; - ToolBoxItem - { - Identifier = TI_DOCTEMPLATE_PREV; - HelpId = HID_TEMPLATEDLG_TB_PREV; - Text [ en-US ] = "Up One Level" ; - }; - ToolBoxItem - { - Type = TOOLBOXITEM_SEPARATOR ; - }; - ToolBoxItem - { - Identifier = TI_DOCTEMPLATE_PRINT; - HelpId = HID_TEMPLATEDLG_TB_PRINT; - Text [ en-US ] = "Print" ; - }; - }; -}; - -Image IMG_SVT_DOCTEMPLATE_BACK_SMALL -{ - ImageBitmap = Bitmap { File = "back_small.png" ; }; - MaskColor = MASK_COL_MAGENTA -}; -Image IMG_SVT_DOCTEMPLATE_BACK_LARGE -{ - ImageBitmap = Bitmap { File = "back_large.png" ; }; - MaskColor = MASK_COL_MAGENTA -}; -Image IMG_SVT_DOCTEMPLATE_PREV_SMALL -{ - ImageBitmap = Bitmap { File = "up_small.png" ; }; - MaskColor = MASK_COL_MAGENTA -}; -Image IMG_SVT_DOCTEMPLATE_PREV_LARGE -{ - ImageBitmap = Bitmap { File = "up_large.png" ; }; - MaskColor = MASK_COL_MAGENTA -}; -Image IMG_SVT_DOCTEMPLATE_PRINT_SMALL -{ - ImageBitmap = Bitmap { File = "sc05509.png" ; }; - MaskColor = MASK_COL_MAGENTA -}; -Image IMG_SVT_DOCTEMPLATE_PRINT_LARGE -{ - ImageBitmap = Bitmap { File = "lc05509.png" ; }; - MaskColor = MASK_COL_MAGENTA -}; - -ToolBox TB_SVT_FRAMEWIN -{ - Pos = MAP_APPFONT ( 0 , 0 ) ; - Size = MAP_APPFONT ( 100 , 12 ) ; - ItemList = - { - ToolBoxItem - { - RadioCheck = TRUE; - AutoCheck = TRUE; - Identifier = TI_DOCTEMPLATE_DOCINFO; - HelpId = HID_TEMPLATEDLG_TB_DOCINFO; - Text [ en-US ] = "Document Properties" ; - }; - ToolBoxItem - { - RadioCheck = TRUE; - AutoCheck = TRUE; - Identifier = TI_DOCTEMPLATE_PREVIEW; - HelpId = HID_TEMPLATEDLG_TB_PREVIEW; - Text [ en-US ] = "Preview" ; - }; - }; -}; - -Image IMG_SVT_DOCTEMPLATE_DOCINFO_SMALL -{ - ImageBitmap = Bitmap { File = "info_small.png" ; }; - MaskColor = MASK_COL_MAGENTA -}; -Image IMG_SVT_DOCTEMPLATE_DOCINFO_LARGE -{ - ImageBitmap = Bitmap { File = "info_large.png" ; }; - MaskColor = MASK_COL_MAGENTA -}; -Image IMG_SVT_DOCTEMPLATE_PREVIEW_SMALL -{ - ImageBitmap = Bitmap { File = "preview_small.png" ; }; - MaskColor = MASK_COL_MAGENTA -}; -Image IMG_SVT_DOCTEMPLATE_PREVIEW_LARGE -{ - ImageBitmap = Bitmap { File = "preview_large.png" ; }; - MaskColor = MASK_COL_MAGENTA -}; - -ModalDialog DLG_DOCTEMPLATE -{ - HelpId = HID_TEMPLATEDLG_DIALOG ; - OutputSize = TRUE ; - SVLook = TRUE ; - Size = MAP_APPFONT( 320, 250 ); - Text [ en-US ] = "Templates and Documents" ; - Moveable = TRUE ; - FixedText FT_DOCTEMPLATE_LINK - { - Left = TRUE ; - Pos = MAP_APPFONT ( 6 , 208 ) ; - Size = MAP_APPFONT ( 200, RSC_CD_FIXEDTEXT_HEIGHT ) ; - Text [ en-US ] = "~Get more templates online..."; - }; - FixedLine FL_DOCTEMPLATE - { - Pos = MAP_APPFONT( 0, 219 ); - Size = MAP_APPFONT( 320, 8 ); - }; - PushButton BTN_DOCTEMPLATE_PACKAGE - { - HelpID = "svtools:PushButton:DLG_DOCTEMPLATE:BTN_DOCTEMPLATE_PACKAGE"; - Pos = MAP_APPFONT( 208, 206 ); - Size = MAP_APPFONT( 106, 14 ); - Text [ en-US ] = "Install Template Pack"; - }; - PushButton BTN_DOCTEMPLATE_MANAGE - { - HelpID = "svtools:PushButton:DLG_DOCTEMPLATE:BTN_DOCTEMPLATE_MANAGE"; - Pos = MAP_APPFONT( 6, 230 ); - Size = MAP_APPFONT( 50, 14 ); - Text [ en-US ] = "Organi~ze..."; - }; - PushButton BTN_DOCTEMPLATE_EDIT - { - HelpID = "svtools:PushButton:DLG_DOCTEMPLATE:BTN_DOCTEMPLATE_EDIT"; - Pos = MAP_APPFONT( 59, 230 ); - Size = MAP_APPFONT( 50, 14 ); - Text [ en-US ] = "~Edit"; - }; - OKButton BTN_DOCTEMPLATE_OPEN - { - Pos = MAP_APPFONT( 155, 230 ); - Size = MAP_APPFONT( 50, 14 ); - DefButton = TRUE; - Text [ en-US ] = "~Open"; - }; - CancelButton BTN_DOCTEMPLATE_CANCEL - { - Pos = MAP_APPFONT( 208, 230 ); - Size = MAP_APPFONT( 50, 14 ); - }; - HelpButton BTN_DOCTEMPLATE_HELP - { - Pos = MAP_APPFONT( 264, 230 ); - Size = MAP_APPFONT( 50, 14 ); - }; -}; - StringArray STRARY_SVT_DOCINFO { ItemList [ en-US ] = @@ -254,23 +39,6 @@ StringArray STRARY_SVT_DOCINFO < "Subject" ; DI_THEME ; > ; < "Size" ; DI_SIZE ; > ; }; - }; - -String STR_SVT_NEWDOC_HELP -{ - Text [ en-US ] = "Click here to create new documents."; -}; -String STR_SVT_MYDOCS_HELP -{ - Text [ en-US ] = "Contains your letters, reports and other documents"; -}; -String STR_SVT_TEMPLATES_HELP -{ - Text [ en-US ] = "Contains templates for creating new documents"; -}; -String STR_SVT_SAMPLES_HELP -{ - Text [ en-US ] = "Contains a selection of sample letters, reports and other documents"; }; /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/sw/inc/pch/precompiled_sw.hxx b/sw/inc/pch/precompiled_sw.hxx index df761323bdef..3d708ce10097 100644 --- a/sw/inc/pch/precompiled_sw.hxx +++ b/sw/inc/pch/precompiled_sw.hxx @@ -807,7 +807,6 @@ #include <svtools/svmedit.hxx> #include <svtools/svparser.hxx> #include <svtools/svtresid.hxx> -#include <svtools/templdlg.hxx> #include <svtools/transfer.hxx> #include <svtools/treelistentry.hxx> #include <svtools/unoevent.hxx> diff --git a/sw/source/uibase/uiview/view2.cxx b/sw/source/uibase/uiview/view2.cxx index c0b6e849fcfe..785bf63bfc7b 100644 --- a/sw/source/uibase/uiview/view2.cxx +++ b/sw/source/uibase/uiview/view2.cxx @@ -118,7 +118,7 @@ #include <app.hrc> #include <fmtclds.hxx> #include <helpid.h> -#include <svtools/templdlg.hxx> +#include <sfx2/templatedlg.hxx> #include <dbconfig.hxx> #include <dbmgr.hxx> #include <reffld.hxx> @@ -2438,10 +2438,9 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument) // call documents and template dialog SfxApplication* pSfxApp = SfxGetpApp(); Window* pTopWin = pSfxApp->GetTopWindow(); - boost::scoped_ptr<SvtDocumentTemplateDialog> pDocTemplDlg(new SvtDocumentTemplateDialog( pTopWin )); - pDocTemplDlg->SelectTemplateFolder(); - int nRet = pDocTemplDlg->Execute(); + SfxTemplateManagerDlg aDocTemplDlg; + int nRet = aDocTemplDlg.Execute(); bool bNewWin = false; if ( nRet == RET_OK ) { @@ -2453,7 +2452,6 @@ void SwView::GenerateFormLetter(bool bUseCurrentDocument) } } - pDocTemplDlg.reset(); if ( bNewWin ) // after the destruction of the dialogue its parent comes to top, // but we want that the new document is on top |