summaryrefslogtreecommitdiff
path: root/sdext
diff options
context:
space:
mode:
authorFaisal M. Al-Otaibi <fmalotaibi@kacst.edu.sa>2012-12-23 12:18:20 +0300
committerCaolán McNamara <caolanm@redhat.com>2013-01-10 13:08:53 +0000
commitb0a827aa839afefd580c438ea72a7e5ca0b88aea (patch)
tree82885ff50a38e009d6c331ecca7674679b672fcf /sdext
parenteb0d07d3f2937315700dabf72d366f5ef4d4200d (diff)
Fix some errors and remove duplicate code on Presenter
Fix the toolbar text if the interface were RTL. Remove duplicate code from PresenterToolBar.cxx Change-Id: Icd6f71ce2daa896494c8efe76779d49e16c547bf Reviewed-on: https://gerrit.libreoffice.org/1474 Reviewed-by: Caolán McNamara <caolanm@redhat.com> Tested-by: Caolán McNamara <caolanm@redhat.com>
Diffstat (limited to 'sdext')
-rw-r--r--sdext/source/presenter/PresenterToolBar.cxx162
1 files changed, 41 insertions, 121 deletions
diff --git a/sdext/source/presenter/PresenterToolBar.cxx b/sdext/source/presenter/PresenterToolBar.cxx
index ac69c76720a8..34dfb7e0b01c 100644
--- a/sdext/source/presenter/PresenterToolBar.cxx
+++ b/sdext/source/presenter/PresenterToolBar.cxx
@@ -1760,47 +1760,21 @@ void Text::Paint (
aContext,
rendering::TextDirection::WEAK_LEFT_TO_RIGHT,
0));
- /** this responsible of the toolbar and the zoom
- that in the note mode.
- check whether RTL interface or not. */
- if(!Application::GetSettings().GetLayoutRTL()){
- geometry::RealRectangle2D aBox (xLayout->queryTextBounds());
- const double nTextWidth = aBox.X2 - aBox.X1;
- const double nY = rBoundingBox.Y + rBoundingBox.Height - aBox.Y2;
- const double nX = rBoundingBox.X + (rBoundingBox.Width - nTextWidth)/2;
-
- rendering::RenderState aRenderState(
- geometry::AffineMatrix2D(1,0,nX, 0,1,nY),
- NULL,
- Sequence<double>(4),
- rendering::CompositeOperation::SOURCE);
- PresenterCanvasHelper::SetDeviceColor(aRenderState, mpFont->mnColor);
- rxCanvas->drawText(
- aContext,
- mpFont->mxFont,
- rViewState,
- aRenderState,
- rendering::TextDirection::WEAK_LEFT_TO_RIGHT);
- }
- else {
- geometry::RealRectangle2D aBox (xLayout->queryTextBounds());
- const double nTextWidth = aBox.X2 - aBox.X1;
- const double nY = rBoundingBox.Y + rBoundingBox.Height - aBox.Y2;
- const double nX = rBoundingBox.X + (rBoundingBox.Width + nTextWidth)/2;
-
- rendering::RenderState aRenderState(
- geometry::AffineMatrix2D(1,0,nX, 0,1,nY),
- NULL,
- Sequence<double>(4),
- rendering::CompositeOperation::SOURCE);
- PresenterCanvasHelper::SetDeviceColor(aRenderState, mpFont->mnColor);
- rxCanvas->drawText(
- aContext,
- mpFont->mxFont,
- rViewState,
- aRenderState,
- rendering::TextDirection::WEAK_RIGHT_TO_LEFT);
- }
+ geometry::RealRectangle2D aBox (xLayout->queryTextBounds());
+ const double nTextWidth = aBox.X2 - aBox.X1;
+ const double nY = rBoundingBox.Y + rBoundingBox.Height - aBox.Y2;
+ const double nX = rBoundingBox.X + (rBoundingBox.Width - nTextWidth)/2;
+
+ rendering::RenderState aRenderState(
+ geometry::AffineMatrix2D(1,0,nX, 0,1,nY),
+ NULL,
+ Sequence<double>(4),
+ rendering::CompositeOperation::SOURCE);
+ PresenterCanvasHelper::SetDeviceColor(aRenderState, mpFont->mnColor);
+ rxCanvas->drawTextLayout(
+ xLayout,
+ rViewState,
+ aRenderState);
}
geometry::RealRectangle2D Text::GetBoundingBox (const Reference<rendering::XCanvas>& rxCanvas)
@@ -1811,25 +1785,13 @@ geometry::RealRectangle2D Text::GetBoundingBox (const Reference<rendering::XCanv
mpFont->PrepareFont(rxCanvas);
if (mpFont->mxFont.is())
{
- /// check whether RTL interface or not
- if(!Application::GetSettings().GetLayoutRTL()){
- rendering::StringContext aContext (msText, 0, msText.getLength());
- Reference<rendering::XTextLayout> xLayout (
- mpFont->mxFont->createTextLayout(
- aContext,
- rendering::TextDirection::WEAK_LEFT_TO_RIGHT,
- 0));
- return xLayout->queryTextBounds();
- }
- else {
- rendering::StringContext aContext (msText, 0, msText.getLength());
- Reference<rendering::XTextLayout> xLayout (
- mpFont->mxFont->createTextLayout(
- aContext,
- rendering::TextDirection::WEAK_RIGHT_TO_LEFT,
- 0));
- return xLayout->queryTextBounds();
- }
+ rendering::StringContext aContext (msText, 0, msText.getLength());
+ Reference<rendering::XTextLayout> xLayout (
+ mpFont->mxFont->createTextLayout(
+ aContext,
+ rendering::TextDirection::WEAK_LEFT_TO_RIGHT,
+ 0));
+ return xLayout->queryTextBounds();
}
}
return geometry::RealRectangle2D(0,0,0,0);
@@ -1851,71 +1813,29 @@ OUString TimeFormatter::FormatTime (const oslDateTime& rTime)
const sal_Int32 nHours (sal::static_int_cast<sal_Int32>(rTime.Hours));
const sal_Int32 nMinutes (sal::static_int_cast<sal_Int32>(rTime.Minutes));
const sal_Int32 nSeconds(sal::static_int_cast<sal_Int32>(rTime.Seconds));
+ // Hours
+ if (mbIs24HourFormat)
+ sText.append(OUString::valueOf(nHours));
+ else
+ sText.append(OUString::valueOf(
+ sal::static_int_cast<sal_Int32>(nHours>12 ? nHours-12 : nHours)));
- /// check whether RTL interface or not
- if(!Application::GetSettings().GetLayoutRTL()){
- // Hours
- if (mbIs24HourFormat)
- sText.append(OUString::valueOf(nHours));
- else
- sText.append(OUString::valueOf(
- sal::static_int_cast<sal_Int32>(nHours>12 ? nHours-12 : nHours)));
-
- sText.append(A2S(":"));
+ sText.append(A2S(":"));
- // Minutes
- const OUString sMinutes (OUString::valueOf(nMinutes));
- if (sMinutes.getLength() == 1)
- sText.append(A2S("0"));
- sText.append(sMinutes);
-
- // Seconds
- if (mbIsShowSeconds)
- {
- sText.append(A2S(":"));
- const OUString sSeconds (OUString::valueOf(nSeconds));
- if (sSeconds.getLength() == 1)
- sText.append(A2S("0"));
- sText.append(sSeconds);
- }
- }
- else {
- // Seconds
- if (mbIsShowSeconds)
- {
- const OUString sSeconds (OUString::valueOf(nSeconds));
- if (sSeconds.getLength() == 1){
- sText.append(sSeconds[0]);
- sText.append(A2S("0"));
- }
- else {
- sText.append(sSeconds[1]);
- sText.append(sSeconds[0]);
- }
- sText.append(A2S(":"));
- }
+ // Minutes
+ const OUString sMinutes (OUString::valueOf(nMinutes));
+ if (sMinutes.getLength() == 1)
+ sText.append(A2S("0"));
+ sText.append(sMinutes);
- // Minutes
- const OUString sMinutes (OUString::valueOf(nMinutes));
- if (sMinutes.getLength() == 1){
- sText.append(sMinutes[0]);
+ // Seconds
+ if (mbIsShowSeconds)
+ {
+ sText.append(A2S(":"));
+ const OUString sSeconds (OUString::valueOf(nSeconds));
+ if (sSeconds.getLength() == 1)
sText.append(A2S("0"));
- }
- else {
- sText.append(sMinutes[1]);
- sText.append(sMinutes[0]);
- }
- // Hours
- OUString tempHours;
- sText.append(A2S(":"));
- if (mbIs24HourFormat)
- tempHours = OUString::valueOf(nHours);
- else
- tempHours = OUString::valueOf(
- sal::static_int_cast<sal_Int32>(nHours>12 ? nHours-12 : nHours));
- if (tempHours.getLength() > 1)
- sText.append(tempHours[1]);
- sText.append(tempHours[0]);
+ sText.append(sSeconds);
}
if (mbIsAmPmFormat)
{