diff options
author | Chris Sherlock <chris.sherlock@collabora.com> | 2015-01-27 02:13:51 +1100 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2015-01-27 11:18:46 +0000 |
commit | 6c3aeeafbfe06b2b3b553dd1ef424f6d88c8a22d (patch) | |
tree | c0a0702403d66b9dfbc0c01f9eca13f48ae07771 | |
parent | 414b118a80c81ef1737958d91331e5b46f4cd3c1 (diff) |
vcl: vcldemo now shows rotated text
Change-Id: I7d701c6b39084b7f4046aed53fb677679709e2f0
Reviewed-on: https://gerrit.libreoffice.org/14192
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
-rw-r--r-- | vcl/workben/vcldemo.cxx | 28 |
1 files changed, 22 insertions, 6 deletions
diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 99bac91df45c..5e5d1e460d5d 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -302,14 +302,17 @@ public: bool mbClip; bool mbArabicText; + bool mbRotate; DrawText() : mbClip (false) - , mbArabicText (false) {} + , mbArabicText (false) + , mbRotate (false) {} - DrawText( bool bClip, bool bArabicText ) + DrawText( bool bClip, bool bArabicText, bool bRotate ) : mbClip (bClip) - , mbArabicText (bArabicText) {} + , mbArabicText (bArabicText) + , mbRotate (bRotate) {} virtual void RenderRegion(OutputDevice &rDev, Rectangle r, const RenderContext &) SAL_OVERRIDE @@ -360,7 +363,11 @@ public: for (int i = 0; i < nPrintNumCopies; i++) { rDev.SetTextColor(Color(nCols[i % SAL_N_ELEMENTS(nCols)])); // random font size to avoid buffering - vcl::Font aFont(maFontNames[i % maFontNames.size()], Size(0, 1 + i * (0.9 + comphelper::rng::uniform_real_distribution(0.0, std::nextafter(0.1, DBL_MAX))) * (r.Top() - r.Bottom()) / nPrintNumCopies)); + vcl::Font aFont( maFontNames[i % maFontNames.size()], Size(0, 1 + i * (0.9 + comphelper::rng::uniform_real_distribution(0.0, std::nextafter(0.1, DBL_MAX))) * (r.Top() - r.Bottom()) / nPrintNumCopies)); + + if (mbRotate) + aFont.SetOrientation(450); + rDev.SetFont(aFont); rDev.DrawText(r, aText.copy(0, 4 + (aText.getLength() - 4) * (nPrintNumCopies - i) / nPrintNumCopies)); } @@ -375,7 +382,7 @@ public: RENDER_DETAILS(cliptext,KEY_T,1) DrawClipText() - : DrawText( true, false ) {} + : DrawText( true, false, false ) {} }; struct DrawArabicText : public DrawText @@ -383,7 +390,15 @@ public: RENDER_DETAILS(arabictext,KEY_T,1) DrawArabicText() - : DrawText( false, true ) {} + : DrawText( false, true, false ) {} + }; + + struct DrawRotatedText : public DrawText + { + RENDER_DETAILS(rotatedtext,KEY_T,1) + + DrawRotatedText() + : DrawText( false, false, true ) {} }; struct DrawCheckered : public RegionRenderer @@ -1182,6 +1197,7 @@ void DemoRenderer::InitRenderers() maRenderers.push_back(new DrawText()); maRenderers.push_back(new DrawClipText()); maRenderers.push_back(new DrawArabicText()); + maRenderers.push_back(new DrawRotatedText()); maRenderers.push_back(new DrawPoly()); maRenderers.push_back(new DrawEllipse()); maRenderers.push_back(new DrawCheckered()); |