diff options
author | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-12-06 18:53:01 +0100 |
---|---|---|
committer | Cédric Bosdonnat <cedric.bosdonnat@free.fr> | 2012-12-10 16:11:58 +0100 |
commit | 1e9261aefd9cf19a12c3ce8fde883b21c3b29fb9 (patch) | |
tree | ac0e3075fa4cfc157455f09ad8d1e0aa5ba284d0 /sfx2 | |
parent | 87e5851af82a11d9880e235c0f66980dcb5e5af7 (diff) |
Template manager: paint white background under thumbnails
Change-Id: I55bbda1a7d04e462737b8cf24aba755b8ce96e8a
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/inc/sfx2/thumbnailviewitem.hxx | 8 | ||||
-rw-r--r-- | sfx2/source/control/templatelocalviewitem.cxx | 64 | ||||
-rw-r--r-- | sfx2/source/control/templateviewitem.cxx | 39 | ||||
-rw-r--r-- | sfx2/source/control/thumbnailviewitem.cxx | 30 |
4 files changed, 73 insertions, 68 deletions
diff --git a/sfx2/inc/sfx2/thumbnailviewitem.hxx b/sfx2/inc/sfx2/thumbnailviewitem.hxx index 0a7f08acd5ec..96096670f36d 100644 --- a/sfx2/inc/sfx2/thumbnailviewitem.hxx +++ b/sfx2/inc/sfx2/thumbnailviewitem.hxx @@ -36,7 +36,7 @@ class Window; class ThumbnailView; namespace basegfx { - class B2DPoint; + class B2DPolygon; } namespace drawinglayer { @@ -45,7 +45,7 @@ namespace drawinglayer { } namespace primitive2d { - class BorderLinePrimitive2D; + class PolygonHairlinePrimitive2D; } } @@ -107,8 +107,8 @@ public: virtual void Paint (drawinglayer::processor2d::BaseProcessor2D *pProcessor, const ThumbnailItemAttributes *pAttrs); - static drawinglayer::primitive2d::BorderLinePrimitive2D* - createBorderLine (const basegfx::B2DPoint &rStart, const basegfx::B2DPoint &rEnd); + static drawinglayer::primitive2d::PolygonHairlinePrimitive2D* + createBorderLine (const basegfx::B2DPolygon &rPolygon); protected: diff --git a/sfx2/source/control/templatelocalviewitem.cxx b/sfx2/source/control/templatelocalviewitem.cxx index 544b86a4a81c..54ba37976453 100644 --- a/sfx2/source/control/templatelocalviewitem.cxx +++ b/sfx2/source/control/templatelocalviewitem.cxx @@ -12,8 +12,8 @@ #include <basegfx/matrix/b2dhommatrixtools.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <drawinglayer/attribute/fillbitmapattribute.hxx> -#include <drawinglayer/primitive2d/borderlineprimitive2d.hxx> #include <drawinglayer/primitive2d/fillbitmapprimitive2d.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <drawinglayer/primitive2d/textlayoutdevice.hxx> #include <drawinglayer/primitive2d/textprimitive2d.hxx> @@ -42,10 +42,10 @@ void TemplateLocalViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *p int nSeqSize = 2; if (!maPreview1.IsEmpty()) - nSeqSize += 5; + nSeqSize += 3; if (!maPreview2.IsEmpty()) - nSeqSize += 5; + nSeqSize += 3; BColor aFillColor = pAttrs->aFillColor; Primitive2DSequence aSeq(nSeqSize); @@ -70,6 +70,20 @@ void TemplateLocalViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *p fScaleX = 0.8f; fScaleY = 0.8f; + float fWidth = aImageSize.Width()*fScaleX; + float fHeight = aImageSize.Height()*fScaleY; + float fPosX = aPos.getX()+35*fScaleX; + float fPosY = aPos.getY()+20*fScaleY; + + B2DPolygon aBounds; + aBounds.append(B2DPoint(fPosX,fPosY)); + aBounds.append(B2DPoint(fPosX+fWidth,fPosY)); + aBounds.append(B2DPoint(fPosX+fWidth,fPosY+fHeight)); + aBounds.append(B2DPoint(fPosX,fPosY+fHeight)); + aBounds.setClosed(true); + + aSeq[nCount++] = Primitive2DReference( new PolyPolygonColorPrimitive2D( + B2DPolyPolygon(aBounds), Color(COL_WHITE).getBColor())); aSeq[nCount++] = Primitive2DReference( new FillBitmapPrimitive2D( createScaleTranslateB2DHomMatrix(fScaleX,fScaleY,aPos.X(),aPos.Y()), FillBitmapAttribute(maPreview2, @@ -79,23 +93,26 @@ void TemplateLocalViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *p )); // draw thumbnail borders - float fWidth = aImageSize.Width()*fScaleX; - float fHeight = aImageSize.Height()*fScaleY; - float fPosX = aPos.getX()+35*fScaleX; - float fPosY = aPos.getY()+20*fScaleY; - - aSeq[nCount++] = Primitive2DReference(createBorderLine(B2DPoint(fPosX,fPosY), - B2DPoint(fPosX+fWidth,fPosY))); - aSeq[nCount++] = Primitive2DReference(createBorderLine(B2DPoint(fPosX+fWidth,fPosY), - B2DPoint(fPosX+fWidth,fPosY+fHeight))); - aSeq[nCount++] = Primitive2DReference(createBorderLine(B2DPoint(fPosX+fWidth,fPosY+fHeight), - B2DPoint(fPosX,fPosY+fHeight))); - aSeq[nCount++] = Primitive2DReference(createBorderLine(B2DPoint(fPosX,fPosY+fHeight), - B2DPoint(fPosX,fPosY))); + aSeq[nCount++] = Primitive2DReference(createBorderLine(aBounds)); } if (!maPreview1.IsEmpty()) { + // draw thumbnail borders + float fWidth = aImageSize.Width()*fScaleX; + float fHeight = aImageSize.Height()*fScaleY; + float fPosX = aPos.getX(); + float fPosY = aPos.getY(); + + B2DPolygon aBounds; + aBounds.append(B2DPoint(fPosX,fPosY)); + aBounds.append(B2DPoint(fPosX+fWidth,fPosY)); + aBounds.append(B2DPoint(fPosX+fWidth,fPosY+fHeight)); + aBounds.append(B2DPoint(fPosX,fPosY+fHeight)); + aBounds.setClosed(true); + + aSeq[nCount++] = Primitive2DReference( new PolyPolygonColorPrimitive2D( + B2DPolyPolygon(aBounds), Color(COL_WHITE).getBColor())); aSeq[nCount++] = Primitive2DReference( new FillBitmapPrimitive2D( createScaleTranslateB2DHomMatrix(fScaleX,fScaleY,aPos.X(),aPos.Y()), FillBitmapAttribute(maPreview1, @@ -104,20 +121,7 @@ void TemplateLocalViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *p false) )); - // draw thumbnail borders - float fWidth = aImageSize.Width()*fScaleX; - float fHeight = aImageSize.Height()*fScaleY; - float fPosX = aPos.getX(); - float fPosY = aPos.getY(); - - aSeq[nCount++] = Primitive2DReference(createBorderLine(B2DPoint(fPosX,fPosY), - B2DPoint(fPosX+fWidth,fPosY))); - aSeq[nCount++] = Primitive2DReference(createBorderLine(B2DPoint(fPosX+fWidth,fPosY), - B2DPoint(fPosX+fWidth,fPosY+fHeight))); - aSeq[nCount++] = Primitive2DReference(createBorderLine(B2DPoint(fPosX+fWidth,fPosY+fHeight), - B2DPoint(fPosX,fPosY+fHeight))); - aSeq[nCount++] = Primitive2DReference(createBorderLine(B2DPoint(fPosX,fPosY+fHeight), - B2DPoint(fPosX,fPosY))); + aSeq[nCount++] = Primitive2DReference(createBorderLine(aBounds)); } // Draw centered text below thumbnail diff --git a/sfx2/source/control/templateviewitem.cxx b/sfx2/source/control/templateviewitem.cxx index e2abf71a8ca2..51a28622e511 100644 --- a/sfx2/source/control/templateviewitem.cxx +++ b/sfx2/source/control/templateviewitem.cxx @@ -12,8 +12,8 @@ #include <basegfx/matrix/b2dhommatrixtools.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <drawinglayer/attribute/fillbitmapattribute.hxx> -#include <drawinglayer/primitive2d/borderlineprimitive2d.hxx> #include <drawinglayer/primitive2d/fillbitmapprimitive2d.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <drawinglayer/primitive2d/textlayoutdevice.hxx> #include <drawinglayer/primitive2d/textprimitive2d.hxx> @@ -68,7 +68,7 @@ void TemplateViewItem::Paint(drawinglayer::processor2d::BaseProcessor2D *pProces { BColor aFillColor = pAttrs->aFillColor; - int nCount = maSubTitle.isEmpty() ? 7 : 8; + int nCount = maSubTitle.isEmpty() ? 5 : 6; Primitive2DSequence aSeq(nCount); // Draw background @@ -82,7 +82,22 @@ void TemplateViewItem::Paint(drawinglayer::processor2d::BaseProcessor2D *pProces // Draw thumbnail Size aImageSize = maPreview1.GetSizePixel(); - aSeq[1] = Primitive2DReference( new FillBitmapPrimitive2D( + float fWidth = aImageSize.Width(); + float fHeight = aImageSize.Height(); + float fPosX = maPrev1Pos.getX(); + float fPosY = maPrev1Pos.getY(); + + B2DPolygon aBounds; + aBounds.append(B2DPoint(fPosX,fPosY)); + aBounds.append(B2DPoint(fPosX+fWidth,fPosY)); + aBounds.append(B2DPoint(fPosX+fWidth,fPosY+fHeight)); + aBounds.append(B2DPoint(fPosX,fPosY+fHeight)); + aBounds.setClosed(true); + + aSeq[1] = Primitive2DReference( new PolyPolygonColorPrimitive2D( + B2DPolyPolygon(aBounds), Color(COL_WHITE).getBColor())); + + aSeq[2] = Primitive2DReference( new FillBitmapPrimitive2D( createTranslateB2DHomMatrix(maPrev1Pos.X(),maPrev1Pos.Y()), FillBitmapAttribute(maPreview1, B2DPoint(0,0), @@ -91,19 +106,7 @@ void TemplateViewItem::Paint(drawinglayer::processor2d::BaseProcessor2D *pProces )); // draw thumbnail borders - float fWidth = aImageSize.Width(); - float fHeight = aImageSize.Height(); - float fPosX = maPrev1Pos.getX(); - float fPosY = maPrev1Pos.getY(); - - aSeq[2] = Primitive2DReference(createBorderLine(B2DPoint(fPosX,fPosY), - B2DPoint(fPosX+fWidth,fPosY))); - aSeq[3] = Primitive2DReference(createBorderLine(B2DPoint(fPosX+fWidth,fPosY), - B2DPoint(fPosX+fWidth,fPosY+fHeight))); - aSeq[4] = Primitive2DReference(createBorderLine(B2DPoint(fPosX+fWidth,fPosY+fHeight), - B2DPoint(fPosX,fPosY+fHeight))); - aSeq[5] = Primitive2DReference(createBorderLine(B2DPoint(fPosX,fPosY+fHeight), - B2DPoint(fPosX,fPosY))); + aSeq[3] = Primitive2DReference(createBorderLine(aBounds)); // Draw centered text below thumbnail @@ -112,7 +115,7 @@ void TemplateViewItem::Paint(drawinglayer::processor2d::BaseProcessor2D *pProces pAttrs->aFontSize.getX(), pAttrs->aFontSize.getY(), double( maTextPos.X() ), double( maTextPos.Y() ) ) ); - aSeq[6] = Primitive2DReference( + aSeq[4] = Primitive2DReference( new TextSimplePortionPrimitive2D(aTitleMatrix, maTitle,0,pAttrs->nMaxTextLenght, std::vector< double >( ), @@ -126,7 +129,7 @@ void TemplateViewItem::Paint(drawinglayer::processor2d::BaseProcessor2D *pProces pAttrs->aFontSize.getX()*SUBTITLE_SCALE_FACTOR, pAttrs->aFontSize.getY()*SUBTITLE_SCALE_FACTOR, double( maSubTitlePos.X() ), double( maSubTitlePos.Y() ) ) ); - aSeq[7] = Primitive2DReference( + aSeq[5] = Primitive2DReference( new TextSimplePortionPrimitive2D(aSubTitleMatrix, maSubTitle,0,pAttrs->nMaxTextLenght, std::vector< double >( ), diff --git a/sfx2/source/control/thumbnailviewitem.cxx b/sfx2/source/control/thumbnailviewitem.cxx index 2410922b5f4d..3f1077ee718b 100644 --- a/sfx2/source/control/thumbnailviewitem.cxx +++ b/sfx2/source/control/thumbnailviewitem.cxx @@ -26,8 +26,8 @@ #include <basegfx/vector/b2dsize.hxx> #include <basegfx/polygon/b2dpolygon.hxx> #include <drawinglayer/attribute/fillbitmapattribute.hxx> -#include <drawinglayer/primitive2d/borderlineprimitive2d.hxx> #include <drawinglayer/primitive2d/fillbitmapprimitive2d.hxx> +#include <drawinglayer/primitive2d/polygonprimitive2d.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <drawinglayer/primitive2d/textlayoutdevice.hxx> #include <drawinglayer/primitive2d/textprimitive2d.hxx> @@ -122,7 +122,7 @@ void ThumbnailViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *pProc const ThumbnailItemAttributes *pAttrs) { BColor aFillColor = pAttrs->aFillColor; - Primitive2DSequence aSeq(7); + Primitive2DSequence aSeq(4); // Draw background if ( mbSelected || mbHover ) @@ -150,14 +150,14 @@ void ThumbnailViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *pProc float fPosX = maPrev1Pos.getX(); float fPosY = maPrev1Pos.getY(); - aSeq[2] = Primitive2DReference(createBorderLine(B2DPoint(fPosX,fPosY), - B2DPoint(fPosX+fWidth,fPosY))); - aSeq[3] = Primitive2DReference(createBorderLine(B2DPoint(fPosX+fWidth,fPosY), - B2DPoint(fPosX+fWidth,fPosY+fHeight))); - aSeq[4] = Primitive2DReference(createBorderLine(B2DPoint(fPosX+fWidth,fPosY+fHeight), - B2DPoint(fPosX,fPosY+fHeight))); - aSeq[5] = Primitive2DReference(createBorderLine(B2DPoint(fPosX,fPosY+fHeight), - B2DPoint(fPosX,fPosY))); + B2DPolygon aBounds; + aBounds.append(B2DPoint(fPosX,fPosY)); + aBounds.append(B2DPoint(fPosX+fWidth,fPosY)); + aBounds.append(B2DPoint(fPosX+fWidth,fPosY+fHeight)); + aBounds.append(B2DPoint(fPosX,fPosY+fHeight)); + aBounds.setClosed(true); + + aSeq[2] = Primitive2DReference(createBorderLine(aBounds)); // Draw centered text below thumbnail aPos = maTextPos; @@ -167,7 +167,7 @@ void ThumbnailViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *pProc pAttrs->aFontSize.getX(), pAttrs->aFontSize.getY(), double( aPos.X() ), double( aPos.Y() ) ) ); - aSeq[6] = Primitive2DReference( + aSeq[3] = Primitive2DReference( new TextSimplePortionPrimitive2D(aTextMatrix, maTitle,0,pAttrs->nMaxTextLenght, std::vector< double >( ), @@ -178,12 +178,10 @@ void ThumbnailViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *pProc pProcessor->process(aSeq); } -drawinglayer::primitive2d::BorderLinePrimitive2D* -ThumbnailViewItem::createBorderLine (const basegfx::B2DPoint &rStart, const basegfx::B2DPoint &rEnd) +drawinglayer::primitive2d::PolygonHairlinePrimitive2D* +ThumbnailViewItem::createBorderLine (const basegfx::B2DPolygon& rPolygon) { - return new BorderLinePrimitive2D(rStart,rEnd,0.5,0,0,0,0,0,0, - BColor(),Color(COL_BLACK).getBColor(),BColor(), - false,STYLE_SOLID); + return new PolygonHairlinePrimitive2D(rPolygon, Color(186,186,186).getBColor()); } /* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |