diff options
author | Rafael Dominguez <venccsralph@gmail.com> | 2012-08-14 22:42:21 -0430 |
---|---|---|
committer | Rafael Dominguez <venccsralph@gmail.com> | 2012-08-15 07:18:30 -0430 |
commit | f7ca0e46532ba10d91d0e814938423e5995fdf91 (patch) | |
tree | bf0e241131f9d1344214fe89bab5ce50703197f8 /sfx2 | |
parent | 223506761c5cf01c2a114afc2156e94f80464dce (diff) |
Dont draw thumbnail border if theres no thumbnail to paint.
Change-Id: I6ca934ccf2e1fa34e60cae3feb1564c87e69254b
Diffstat (limited to 'sfx2')
-rw-r--r-- | sfx2/source/control/templatelocalviewitem.cxx | 52 |
1 files changed, 29 insertions, 23 deletions
diff --git a/sfx2/source/control/templatelocalviewitem.cxx b/sfx2/source/control/templatelocalviewitem.cxx index f337df8cb3dc..7ba11837de06 100644 --- a/sfx2/source/control/templatelocalviewitem.cxx +++ b/sfx2/source/control/templatelocalviewitem.cxx @@ -39,7 +39,10 @@ void TemplateLocalViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *p const ThumbnailItemAttributes *pAttrs) { int nCount = 0; - int nSeqSize = 7; + int nSeqSize = 2; + + if (!maPreview1.IsEmpty()) + nSeqSize += 5; if (!maPreview2.IsEmpty()) nSeqSize += 5; @@ -91,28 +94,31 @@ void TemplateLocalViewItem::Paint (drawinglayer::processor2d::BaseProcessor2D *p B2DPoint(fPosX,fPosY))); } - aSeq[nCount++] = Primitive2DReference( new FillBitmapPrimitive2D( - createScaleTranslateB2DHomMatrix(fScaleX,fScaleY,aPos.X(),aPos.Y()), - FillBitmapAttribute(maPreview1, - B2DPoint(0,0), - B2DVector(aImageSize.Width(),aImageSize.Height()), - 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))); + if (!maPreview1.IsEmpty()) + { + aSeq[nCount++] = Primitive2DReference( new FillBitmapPrimitive2D( + createScaleTranslateB2DHomMatrix(fScaleX,fScaleY,aPos.X(),aPos.Y()), + FillBitmapAttribute(maPreview1, + B2DPoint(0,0), + B2DVector(aImageSize.Width(),aImageSize.Height()), + 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))); + } // Draw centered text below thumbnail aPos = maTextPos; |