Change in core[libreoffice-4-0]: Template Manager: show some icons if there is no thumbnail
Bosdonnat Cedric (via Code Review)
gerrit at gerrit.libreoffice.org
Thu Jan 31 07:59:28 PST 2013
Hi,
I have submitted a patch for review:
https://gerrit.libreoffice.org/1948
To pull it, you can do:
git pull ssh://gerrit.libreoffice.org:29418/core refs/changes/48/1948/1
Template Manager: show some icons if there is no thumbnail
Change-Id: I2686d6f1d29862878b5ee0f6ca0d2e746766ef21
---
M sfx2/inc/sfx2/sfx.hrc
M sfx2/inc/templatedlg.hxx
M sfx2/source/appl/sfx.src
M sfx2/source/control/templateview.cxx
M sfx2/source/doc/templatedlg.cxx
5 files changed, 58 insertions(+), 0 deletions(-)
diff --git a/sfx2/inc/sfx2/sfx.hrc b/sfx2/inc/sfx2/sfx.hrc
index 7173366..92bcf1f 100644
--- a/sfx2/inc/sfx2/sfx.hrc
+++ b/sfx2/inc/sfx2/sfx.hrc
@@ -177,6 +177,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
diff --git a/sfx2/inc/templatedlg.hxx b/sfx2/inc/templatedlg.hxx
index 44a6653..47c1989 100644
--- a/sfx2/inc/templatedlg.hxx
+++ b/sfx2/inc/templatedlg.hxx
@@ -49,6 +49,8 @@
DECL_LINK(ActivatePageHdl, void*);
+ static BitmapEx getDefaultThumbnail( const rtl::OUString& rPath );
+
private:
virtual void MouseButtonDown( const MouseEvent& rMEvt );
diff --git a/sfx2/source/appl/sfx.src b/sfx2/source/appl/sfx.src
index 1103841..bffec2b 100644
--- a/sfx2/source/appl/sfx.src
+++ b/sfx2/source/appl/sfx.src
@@ -37,3 +37,23 @@
{
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";
+};
diff --git a/sfx2/source/control/templateview.cxx b/sfx2/source/control/templateview.cxx
index 2efbbda..9758065 100644
--- a/sfx2/source/control/templateview.cxx
+++ b/sfx2/source/control/templateview.cxx
@@ -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 @@
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);
diff --git a/sfx2/source/doc/templatedlg.cxx b/sfx2/source/doc/templatedlg.cxx
index bf51e37..c14a824 100644
--- a/sfx2/source/doc/templatedlg.cxx
+++ b/sfx2/source/doc/templatedlg.cxx
@@ -1533,6 +1533,31 @@
}
}
+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;
--
To view, visit https://gerrit.libreoffice.org/1948
To unsubscribe, visit https://gerrit.libreoffice.org/settings
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2686d6f1d29862878b5ee0f6ca0d2e746766ef21
Gerrit-PatchSet: 1
Gerrit-Project: core
Gerrit-Branch: libreoffice-4-0
Gerrit-Owner: Bosdonnat Cedric <cedric.bosdonnat at free.fr>
More information about the LibreOffice
mailing list