Display filesystem templates under My Templates folder.

Change-Id: I9d504d62392b30a7eca2be9be5330e6118967a1a
This commit is contained in:
Rafael Dominguez 2012-06-05 21:37:05 -04:30
parent 5b20e0572f
commit 87bbe2b6c9
4 changed files with 47 additions and 4 deletions

View file

@ -15,6 +15,8 @@
#include <vcl/dialog.hxx>
#include <vcl/button.hxx>
class SfxOrganizeMgr;
class SfxTemplateManagerDlg : public ModalDialog
{
public:
@ -38,6 +40,8 @@ private:
PushButton aButtonDraws;
ThumbnailView maView;
SfxOrganizeMgr *mpMgr;
};
#endif // TEMPLATEDLG_HXX

View file

@ -7,13 +7,19 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "templatedlg.hxx"
#include <sfx2/doctempl.hxx>
#include <sfx2/sfxresid.hxx>
#include "templatedlg.hxx"
#include "orgmgr.hxx"
#include "doc.hrc"
#include "templatedlg.hrc"
#define MAX_COLUMN_COUNT 4
#define MAX_LINE_COUNT 2
SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
: ModalDialog(parent, SfxResId(DLG_TEMPLATE_MANAGER)),
aButtonAll(this,SfxResId(BTN_SELECT_ALL)),
@ -21,11 +27,34 @@ SfxTemplateManagerDlg::SfxTemplateManagerDlg (Window *parent)
aButtonPresents(this,SfxResId(BTN_SELECT_PRESENTATIONS)),
aButtonSheets(this,SfxResId(BTN_SELECT_SHEETS)),
aButtonDraws(this,SfxResId(BTN_SELECT_DRAWS)),
maView(this,SfxResId(TEMPLATE_VIEW))
maView(this,SfxResId(TEMPLATE_VIEW)),
mpMgr(new SfxOrganizeMgr(NULL,NULL))
{
maView.SetStyle(WB_RADIOSEL | WB_TABSTOP);
maView.SetColCount(MAX_COLUMN_COUNT);
maView.SetLineCount(MAX_LINE_COUNT);
aButtonAll.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewAllHdl));
aButtonDocs.SetClickHdl(LINK(this,SfxTemplateManagerDlg,ViewDocsHdl));
sal_uInt16 nCount = mpMgr->GetTemplates()->GetRegionCount();
for (sal_uInt16 i = 0; i < nCount; ++i)
{
rtl::OUString aRegionName(mpMgr->GetTemplates()->GetFullRegionName(i));
if (aRegionName == "My Templates")
{
sal_uInt16 nEntries = mpMgr->GetTemplates()->GetCount(i);
for ( sal_uInt16 j = 0; j < nEntries; ++j)
maView.InsertItem(i,mpMgr->GetTemplates()->GetName(i,j),THUMBNAILVIEW_APPEND);
break;
}
}
maView.Show();
FreeResource();
}

View file

@ -13,3 +13,5 @@
#define BTN_SELECT_DRAWS 5
#define TEMPLATE_VIEW 6
#define IMG_ONLINE_REPOSITORY 100

View file

@ -17,7 +17,7 @@ ModalDialog DLG_TEMPLATE_MANAGER
SVLook = TRUE;
Moveable = TRUE;
Closeable = TRUE;
Size = MAP_APPFONT ( 270 , 165 );
Size = MAP_APPFONT ( 270 , 190 );
Text [en-US] = "Template Manager";
PushButton BTN_SELECT_ALL
@ -64,7 +64,15 @@ ModalDialog DLG_TEMPLATE_MANAGER
Control TEMPLATE_VIEW
{
Pos = MAP_APPFONT(5,30);
Size = MAP_APPFONT(50,260);
Size = MAP_APPFONT(260,150);
TabStop = TRUE;
};
Image IMG_ONLINE_REPOSITORY
{
ImageBitmap = Bitmap
{
File = "signet.png";
};
};
};