Load and draw close image for folder overlay.

Change-Id: I5d603187f09a727616133c3c626507d080e889f6
This commit is contained in:
Rafael Dominguez 2012-06-19 11:46:46 -04:30
parent d0854f9641
commit 20374eac8a
5 changed files with 54 additions and 1 deletions

View file

@ -57,6 +57,7 @@ $(eval $(call gb_SrsTarget_add_files,sfx/res,\
sfx2/source/appl/sfx.src \
sfx2/source/bastyp/bastyp.src \
sfx2/source/bastyp/fltfnc.src \
sfx2/source/control/templateview.src \
sfx2/source/dialog/alienwarn.src \
sfx2/source/dialog/dialog.src \
sfx2/source/dialog/dinfdlg.src \

View file

@ -11,6 +11,7 @@
#define TEMPLATEVIEW_HXX
#include <sfx2/thumbnailview.hxx>
#include <vcl/image.hxx>
class SfxDocumentTemplates;
@ -30,6 +31,7 @@ public:
private:
Image maCloseImg;
sal_uInt16 mnRegionId;
rtl::OUString maFolderName;
SfxDocumentTemplates *mpDocTemplates;

View file

@ -10,17 +10,27 @@
#include <sfx2/templateview.hxx>
#include <basegfx/matrix/b2dhommatrixtools.hxx>
#include <basegfx/point/b2dpoint.hxx>
#include <basegfx/vector/b2dvector.hxx>
#include <drawinglayer/attribute/fillbitmapattribute.hxx>
#include <drawinglayer/primitive2d/fillbitmapprimitive2d.hxx>
#include <drawinglayer/primitive2d/textlayoutdevice.hxx>
#include <drawinglayer/primitive2d/textprimitive2d.hxx>
#include <drawinglayer/processor2d/baseprocessor2d.hxx>
#include <sfx2/doctempl.hxx>
#include <sfx2/sfxresid.hxx>
#include <sfx2/thumbnailviewitem.hxx>
#include "templateview.hrc"
using namespace basegfx;
using namespace basegfx::tools;
using namespace drawinglayer::attribute;
using namespace drawinglayer::primitive2d;
TemplateView::TemplateView (Window *pParent, SfxDocumentTemplates *pTemplates)
: ThumbnailView(pParent),
maCloseImg(SfxResId(IMG_TEMPLATE_VIEW_CLOSE)),
mnRegionId(0),
mpDocTemplates(pTemplates)
{
@ -41,7 +51,7 @@ void TemplateView::Paint (const Rectangle &rRect)
{
ThumbnailView::Paint(rRect);
Primitive2DSequence aSeq(1);
Primitive2DSequence aSeq(2);
TextLayouterDevice aTextDev;
// Draw centered region name
@ -63,6 +73,20 @@ void TemplateView::Paint (const Rectangle &rRect)
com::sun::star::lang::Locale(),
Color(COL_BLACK).getBColor() ) );
// Draw close icon
Size aImageSize = maCloseImg.GetSizePixel();
aPos.Y() = (mnHeaderHeight - aImageSize.Height())/2;
aPos.X() = aWinSize.Width() - aImageSize.Width() - aPos.Y();
aSeq[1] = Primitive2DReference( new FillBitmapPrimitive2D(
createTranslateB2DHomMatrix(aPos.X(),aPos.Y()),
FillBitmapAttribute(maCloseImg.GetBitmapEx(),
B2DPoint(0,0),
B2DVector(aImageSize.Width(),aImageSize.Height()),
false)
));
mpProcessor->process(aSeq);
}

View file

@ -0,0 +1,9 @@
/*
* Copyright 2012 LibreOffice contributors.
*
* 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/.
*/
#define IMG_TEMPLATE_VIEW_CLOSE 1

View file

@ -0,0 +1,17 @@
/*
* Copyright 2012 LibreOffice contributors.
*
* 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/.
*/
#include "templateview.hrc"
Image IMG_TEMPLATE_VIEW_CLOSE
{
ImageBitmap = Bitmap
{
File = "closedoc.png";
};
};