summaryrefslogtreecommitdiff
path: root/sfx2
diff options
context:
space:
mode:
authorRafael Dominguez <venccsralph@gmail.com>2012-06-19 11:46:46 -0430
committerRafael Dominguez <venccsralph@gmail.com>2012-06-19 11:46:46 -0430
commit20374eac8afbc583471fc8ad48c973c0f8c966db (patch)
treecace07b1cdecb4b28dbc783364099c1605c536de /sfx2
parentd0854f964170cc10346c829f46903061a837dfa0 (diff)
Load and draw close image for folder overlay.
Change-Id: I5d603187f09a727616133c3c626507d080e889f6
Diffstat (limited to 'sfx2')
-rw-r--r--sfx2/AllLangResTarget_sfx2.mk1
-rw-r--r--sfx2/inc/sfx2/templateview.hxx2
-rw-r--r--sfx2/source/control/templateview.cxx26
-rw-r--r--sfx2/source/control/templateview.hrc9
-rw-r--r--sfx2/source/control/templateview.src17
5 files changed, 54 insertions, 1 deletions
diff --git a/sfx2/AllLangResTarget_sfx2.mk b/sfx2/AllLangResTarget_sfx2.mk
index 4019fb2df1a6..418b7101e73f 100644
--- a/sfx2/AllLangResTarget_sfx2.mk
+++ b/sfx2/AllLangResTarget_sfx2.mk
@@ -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 \
diff --git a/sfx2/inc/sfx2/templateview.hxx b/sfx2/inc/sfx2/templateview.hxx
index a6fbeaafbf1a..e9ea24187041 100644
--- a/sfx2/inc/sfx2/templateview.hxx
+++ b/sfx2/inc/sfx2/templateview.hxx
@@ -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;
diff --git a/sfx2/source/control/templateview.cxx b/sfx2/source/control/templateview.cxx
index 48d778da71de..63fec5d16659 100644
--- a/sfx2/source/control/templateview.cxx
+++ b/sfx2/source/control/templateview.cxx
@@ -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);
}
diff --git a/sfx2/source/control/templateview.hrc b/sfx2/source/control/templateview.hrc
new file mode 100644
index 000000000000..cc26a18784bf
--- /dev/null
+++ b/sfx2/source/control/templateview.hrc
@@ -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
diff --git a/sfx2/source/control/templateview.src b/sfx2/source/control/templateview.src
new file mode 100644
index 000000000000..8252ee9a590b
--- /dev/null
+++ b/sfx2/source/control/templateview.src
@@ -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";
+ };
+};