diff options
author | Faisal M. Al-Otaibi <fmalotaibi@kacst.edu.sa> | 2012-12-12 12:38:37 +0300 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2012-12-12 10:56:02 +0000 |
commit | cfa0588e04ee3d132081212ac38fda7c83c45024 (patch) | |
tree | cc5d2587d9ce440206f2d6959bb4022a162ee380 /sdext | |
parent | a77fa7ee84424a5844d836e83978ab0197716bef (diff) |
fdo#57422 - presenter console RTL support needs completion
Fixing the number problem that on Title on standard view.
*Remove duplicate code
Change-Id: Ib310be580766a3197e5481c4185f0261fece0906
Reviewed-on: https://gerrit.libreoffice.org/1305
Reviewed-by: Michael Meeks <michael.meeks@suse.com>
Tested-by: Michael Meeks <michael.meeks@suse.com>
Diffstat (limited to 'sdext')
-rw-r--r-- | sdext/source/presenter/PresenterPaneBorderPainter.cxx | 204 |
1 files changed, 64 insertions, 140 deletions
diff --git a/sdext/source/presenter/PresenterPaneBorderPainter.cxx b/sdext/source/presenter/PresenterPaneBorderPainter.cxx index 6eccd9540587..f683ce1da178 100644 --- a/sdext/source/presenter/PresenterPaneBorderPainter.cxx +++ b/sdext/source/presenter/PresenterPaneBorderPainter.cxx @@ -538,148 +538,72 @@ void PresenterPaneBorderPainter::Renderer::PaintTitle ( return; /// this is responsible of the texts above the slide windows - /// check whether RTL interface or not - if(!Application::GetSettings().GetLayoutRTL()){ - geometry::RealRectangle2D aBox (xLayout->queryTextBounds()); - const double nTextHeight = aBox.Y2 - aBox.Y1; - const double nTextWidth = aBox.X1 + aBox.X2; - double nX = rInnerBox.X + (rInnerBox.Width - nTextWidth)/2; - const sal_Int32 nTitleBarHeight = rInnerBox.Y - rOuterBox.Y - 1; - double nY = rOuterBox.Y + (nTitleBarHeight - nTextHeight) / 2 - aBox.Y1; - if (nY >= rInnerBox.Y) - nY = rInnerBox.Y - 1; - switch (rpStyle->meFontAnchor) - { - default: - case RendererPaneStyle::AnchorLeft: - nX = rInnerBox.X; - break; - case RendererPaneStyle::AnchorRight: - nX = rInnerBox.X + rInnerBox.Width - nTextWidth; - break; - case RendererPaneStyle::AnchorCenter: - nX = rInnerBox.X + (rInnerBox.Width - nTextWidth)/2; - break; - } - nX += rpStyle->mnFontXOffset; - nY += rpStyle->mnFontYOffset; - - if (rUpdateBox.X >= nX+nTextWidth - || rUpdateBox.Y >= nY+nTextHeight - || rUpdateBox.X+rUpdateBox.Width <= nX - || rUpdateBox.Y+rUpdateBox.Height <= nY) - { - return; - } - - rendering::RenderState aRenderState( - geometry::AffineMatrix2D(1,0,nX, 0,1,nY), - NULL, - Sequence<double>(4), - rendering::CompositeOperation::SOURCE); + geometry::RealRectangle2D aBox (xLayout->queryTextBounds()); + const double nTextHeight = aBox.Y2 - aBox.Y1; + const double nTextWidth = aBox.X1 + aBox.X2; + double nX = rInnerBox.X + (rInnerBox.Width - nTextWidth)/2; + const sal_Int32 nTitleBarHeight = rInnerBox.Y - rOuterBox.Y - 1; + double nY = rOuterBox.Y + (nTitleBarHeight - nTextHeight) / 2 - aBox.Y1; + if (nY >= rInnerBox.Y) + nY = rInnerBox.Y - 1; + switch (rpStyle->meFontAnchor) + { + default: + case RendererPaneStyle::AnchorLeft: + nX = rInnerBox.X; + break; + case RendererPaneStyle::AnchorRight: + nX = rInnerBox.X + rInnerBox.Width - nTextWidth; + break; + case RendererPaneStyle::AnchorCenter: + nX = rInnerBox.X + (rInnerBox.Width - nTextWidth)/2; + break; + } + nX += rpStyle->mnFontXOffset; + nY += rpStyle->mnFontYOffset; + + if (rUpdateBox.X >= nX+nTextWidth + || rUpdateBox.Y >= nY+nTextHeight + || rUpdateBox.X+rUpdateBox.Width <= nX + || rUpdateBox.Y+rUpdateBox.Height <= nY) + { + return; + } - if (bPaintBackground) - { - PresenterCanvasHelper::SetDeviceColor(aRenderState, util::Color(0x00ffffff)); - Sequence<Sequence<geometry::RealPoint2D> > aPolygons(1); - aPolygons[0] = Sequence<geometry::RealPoint2D>(4); - aPolygons[0][0] = geometry::RealPoint2D(0, -nTextHeight); - aPolygons[0][1] = geometry::RealPoint2D(0, 0); - aPolygons[0][2] = geometry::RealPoint2D(nTextWidth, 0); - aPolygons[0][3] = geometry::RealPoint2D(nTextWidth, -nTextHeight); - Reference<rendering::XPolyPolygon2D> xPolygon ( - mxCanvas->getDevice()->createCompatibleLinePolyPolygon(aPolygons), UNO_QUERY); - if (xPolygon.is()) - xPolygon->setClosed(0, sal_True); - mxCanvas->fillPolyPolygon( - xPolygon, - maViewState, - aRenderState); - } - else - { - PresenterCanvasHelper::SetDeviceColor( - aRenderState, - rpStyle->mpFont->mnColor); - - mxCanvas->drawText( - aContext, - xFont, - maViewState, - aRenderState, - rendering::TextDirection::WEAK_LEFT_TO_RIGHT); - } + rendering::RenderState aRenderState( + geometry::AffineMatrix2D(1,0,nX, 0,1,nY), + NULL, + Sequence<double>(4), + rendering::CompositeOperation::SOURCE); + + if (bPaintBackground) + { + PresenterCanvasHelper::SetDeviceColor(aRenderState, util::Color(0x00ffffff)); + Sequence<Sequence<geometry::RealPoint2D> > aPolygons(1); + aPolygons[0] = Sequence<geometry::RealPoint2D>(4); + aPolygons[0][0] = geometry::RealPoint2D(0, -nTextHeight); + aPolygons[0][1] = geometry::RealPoint2D(0, 0); + aPolygons[0][2] = geometry::RealPoint2D(nTextWidth, 0); + aPolygons[0][3] = geometry::RealPoint2D(nTextWidth, -nTextHeight); + Reference<rendering::XPolyPolygon2D> xPolygon ( + mxCanvas->getDevice()->createCompatibleLinePolyPolygon(aPolygons), UNO_QUERY); + if (xPolygon.is()) + xPolygon->setClosed(0, sal_True); + mxCanvas->fillPolyPolygon( + xPolygon, + maViewState, + aRenderState); } - else{ - geometry::RealRectangle2D aBox (xLayout->queryTextBounds()); - const double nTextHeight = aBox.Y2 - aBox.Y1; - const double nTextWidth = aBox.X1 - aBox.X2; - double nX = rInnerBox.X + (rInnerBox.Width - nTextWidth)/2; - const sal_Int32 nTitleBarHeight = rInnerBox.Y - rOuterBox.Y - 1; - double nY = rOuterBox.Y + (nTitleBarHeight - nTextHeight) / 2 - aBox.Y1; - if (nY >= rInnerBox.Y) - nY = rInnerBox.Y - 1; - switch (rpStyle->meFontAnchor) - { - default: - case RendererPaneStyle::AnchorLeft: - nX = rInnerBox.X; - break; - case RendererPaneStyle::AnchorRight: - nX = rInnerBox.X + rInnerBox.Width - nTextWidth; - break; - case RendererPaneStyle::AnchorCenter: - nX = rInnerBox.X + (rInnerBox.Width - nTextWidth)/2; - break; - } - nX += rpStyle->mnFontXOffset; - nY += rpStyle->mnFontYOffset; - - if (rUpdateBox.X >= nX+nTextWidth - || rUpdateBox.Y >= nY+nTextHeight - || rUpdateBox.X+rUpdateBox.Width <= nX - || rUpdateBox.Y+rUpdateBox.Height <= nY) - { - return; - } - - rendering::RenderState aRenderState( - geometry::AffineMatrix2D(1,0,nX, 0,1,nY), - NULL, - Sequence<double>(4), - rendering::CompositeOperation::SOURCE); - - if (bPaintBackground) - { - PresenterCanvasHelper::SetDeviceColor(aRenderState, util::Color(0x00ffffff)); - Sequence<Sequence<geometry::RealPoint2D> > aPolygons(1); - aPolygons[0] = Sequence<geometry::RealPoint2D>(4); - aPolygons[0][0] = geometry::RealPoint2D(0, -nTextHeight); - aPolygons[0][1] = geometry::RealPoint2D(0, 0); - aPolygons[0][2] = geometry::RealPoint2D(nTextWidth, 0); - aPolygons[0][3] = geometry::RealPoint2D(nTextWidth, -nTextHeight); - Reference<rendering::XPolyPolygon2D> xPolygon ( - mxCanvas->getDevice()->createCompatibleLinePolyPolygon(aPolygons), UNO_QUERY); - if (xPolygon.is()) - xPolygon->setClosed(0, sal_True); - mxCanvas->fillPolyPolygon( - xPolygon, - maViewState, - aRenderState); - } - else - { - PresenterCanvasHelper::SetDeviceColor( - aRenderState, - rpStyle->mpFont->mnColor); - - mxCanvas->drawText( - aContext, - xFont, - maViewState, - aRenderState, - rendering::TextDirection::WEAK_RIGHT_TO_LEFT); - } + else + { + PresenterCanvasHelper::SetDeviceColor( + aRenderState, + rpStyle->mpFont->mnColor); + + mxCanvas->drawTextLayout ( + xLayout, + maViewState, + aRenderState); } } |