Kaydet (Commit) af331776 authored tarafından Cédric Bosdonnat's avatar Cédric Bosdonnat

Template Manager: show some icons if there is no thumbnail

üst bdb3c21e
......@@ -169,6 +169,11 @@
#define BT_CHECKOUT (RID_SFX_START+126)
#define STR_ACCTITLE_PRODUCTIVITYTOOLS (RID_SFX_START+157)
#define SFX_THUMBNAIL_TEXT (RID_SFX_START+158)
#define SFX_THUMBNAIL_SHEET (RID_SFX_START+159)
#define SFX_THUMBNAIL_PRESENTATION (RID_SFX_START+160)
#define SFX_THUMBNAIL_DRAWING (RID_SFX_START+161)
//=========================================================================
// group ids
......
......@@ -50,6 +50,8 @@ public:
DECL_LINK(ActivatePageHdl, void*);
static BitmapEx getDefaultThumbnail( const rtl::OUString& rPath );
private:
virtual void MouseButtonDown( const MouseEvent& rMEvt );
......
......@@ -37,3 +37,23 @@ String STR_PASSWD
{
Text [ en-US ] = "Password" ;
};
Bitmap ( SFX_THUMBNAIL_TEXT )
{
File = "odt_48_8.png";
};
Bitmap ( SFX_THUMBNAIL_SHEET )
{
File = "ods_48_8.png";
};
Bitmap ( SFX_THUMBNAIL_PRESENTATION )
{
File = "odp_48_8.png";
};
Bitmap ( SFX_THUMBNAIL_DRAWING )
{
File = "odg_48_8.png";
};
......@@ -7,6 +7,7 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/
#include "templatedlg.hxx"
#include <sfx2/templateview.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
......@@ -63,6 +64,11 @@ void TemplateView::InsertItems (const std::vector<TemplateItemProperties> &rTemp
pItem->maTitle = pCur->aName;
pItem->setPath(pCur->aPath);
pItem->maPreview1 = pCur->aThumbnail;
if ( pCur->aThumbnail.IsEmpty() )
{
// Use the default thumbnail if we have nothing else
pItem->maPreview1 = SfxTemplateManagerDlg::getDefaultThumbnail( pItem->getPath() );
}
pItem->setSelectClickHdl(LINK(this,ThumbnailView,OnItemSelected));
mItemList.push_back(pItem);
......
......@@ -1534,6 +1534,31 @@ void SfxTemplateManagerDlg::syncRepositories() const
}
}
BitmapEx SfxTemplateManagerDlg::getDefaultThumbnail( const OUString& rPath )
{
INetURLObject aUrl(rPath);
OUString aExt = aUrl.getExtension();
BitmapEx aImg;
if ( aExt == "ott" || aExt == "stw" || aExt == "oth" || aExt == "dot" || aExt == "dotx" )
{
aImg = BitmapEx ( SfxResId( SFX_THUMBNAIL_TEXT ) );
}
else if ( aExt == "ots" || aExt == "stc" || aExt == "xlt" || aExt == "xltm" || aExt == "xltx" )
{
aImg = BitmapEx ( SfxResId( SFX_THUMBNAIL_SHEET ) );
}
else if ( aExt == "otp" || aExt == "sti" || aExt == "pot" || aExt == "potm" || aExt == "potx" )
{
aImg = BitmapEx ( SfxResId( SFX_THUMBNAIL_PRESENTATION ) );
}
else if ( aExt == "otg" || aExt == "std" )
{
aImg = BitmapEx ( SfxResId( SFX_THUMBNAIL_DRAWING ) );
}
return aImg;
}
static bool lcl_getServiceName ( const OUString &rFileURL, OUString &rName )
{
bool bRet = false;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment