summaryrefslogtreecommitdiff
path: root/sdext/source/presenter/PresenterToolBar.cxx
diff options
context:
space:
mode:
Diffstat (limited to 'sdext/source/presenter/PresenterToolBar.cxx')
-rw-r--r--sdext/source/presenter/PresenterToolBar.cxx377
1 files changed, 274 insertions, 103 deletions
diff --git a/sdext/source/presenter/PresenterToolBar.cxx b/sdext/source/presenter/PresenterToolBar.cxx
index fa3dcacc99bf..60e44faaed9f 100644
--- a/sdext/source/presenter/PresenterToolBar.cxx
+++ b/sdext/source/presenter/PresenterToolBar.cxx
@@ -17,6 +17,7 @@
* the License at http://www.apache.org/licenses/LICENSE-2.0 .
*/
+#include "vcl/svapp.hxx"
#include "PresenterToolBar.hxx"
#include "PresenterBitmapContainer.hxx"
@@ -562,36 +563,39 @@ void SAL_CALL PresenterToolBar::windowPaint (const css::awt::PaintEvent& rEvent)
void SAL_CALL PresenterToolBar::mousePressed (const css::awt::MouseEvent& rEvent)
throw(css::uno::RuntimeException)
{
- CheckMouseOver(rEvent, true, true);
+ ThrowIfDisposed();
+ CheckMouseOver(rEvent, true, true);
}
void SAL_CALL PresenterToolBar::mouseReleased (const css::awt::MouseEvent& rEvent)
throw(css::uno::RuntimeException)
{
- CheckMouseOver(rEvent, true);
+ ThrowIfDisposed();
+ CheckMouseOver(rEvent, true);
}
void SAL_CALL PresenterToolBar::mouseEntered (const css::awt::MouseEvent& rEvent)
throw(css::uno::RuntimeException)
{
- CheckMouseOver(rEvent, true);
+ ThrowIfDisposed();
+ CheckMouseOver(rEvent, true);
}
void SAL_CALL PresenterToolBar::mouseExited (const css::awt::MouseEvent& rEvent)
throw(css::uno::RuntimeException)
{
- CheckMouseOver(rEvent, false);
-}
+ ThrowIfDisposed();
+ CheckMouseOver(rEvent, false);
+ }
//----- XMouseMotionListener --------------------------------------------------
void SAL_CALL PresenterToolBar::mouseMoved (const css::awt::MouseEvent& rEvent)
throw (css::uno::RuntimeException)
{
- ThrowIfDisposed();
-
- CheckMouseOver(rEvent, true);
-}
+ ThrowIfDisposed();
+ CheckMouseOver(rEvent, true);
+ }
void SAL_CALL PresenterToolBar::mouseDragged (const css::awt::MouseEvent& rEvent)
throw (css::uno::RuntimeException)
@@ -726,6 +730,7 @@ void PresenterToolBar::Layout (
const awt::Rectangle aWindowBox (mxWindow->getPosSize());
ElementContainer::iterator iPart;
ElementContainer::iterator iEnd (maElementContainer.end());
+ ElementContainer::iterator iBegin (maElementContainer.begin());
::std::vector<geometry::RealSize2D> aPartSizes (maElementContainer.size());
geometry::RealSize2D aTotalSize (0,0);
bool bIsHorizontal (true);
@@ -793,21 +798,40 @@ void PresenterToolBar::Layout (
maBoundingBox.Y2 = nY + aTotalSize.Height;
/* push front or back ? ... */
-
- for (iPart=maElementContainer.begin(), nIndex=0; iPart!=iEnd; ++iPart,++nIndex)
- {
- geometry::RealRectangle2D aBoundingBox(
- nX, nY,
- nX+aPartSizes[nIndex].Width, nY+aTotalSize.Height);
-
- // Add space for gaps between elements.
- if ((*iPart)->size() > 1)
- if (bIsHorizontal)
- aBoundingBox.X2 += ((*iPart)->size()-1) * nGapWidth;
-
- LayoutPart(rxCanvas, *iPart, aBoundingBox, aPartSizes[nIndex], bIsHorizontal);
- bIsHorizontal = !bIsHorizontal;
- nX += aBoundingBox.X2 - aBoundingBox.X1 + nGapWidth;
+ /// check whether RTL interface or not
+ if(!Application::GetSettings().GetLayoutRTL()){
+ for (iPart=maElementContainer.begin(), nIndex=0; iPart!=iEnd; ++iPart,++nIndex)
+ {
+ geometry::RealRectangle2D aBoundingBox(
+ nX, nY,
+ nX+aPartSizes[nIndex].Width, nY+aTotalSize.Height);
+
+ // Add space for gaps between elements.
+ if ((*iPart)->size() > 1)
+ if (bIsHorizontal)
+ aBoundingBox.X2 += ((*iPart)->size()-1) * nGapWidth;
+
+ LayoutPart(rxCanvas, *iPart, aBoundingBox, aPartSizes[nIndex], bIsHorizontal);
+ bIsHorizontal = !bIsHorizontal;
+ nX += aBoundingBox.X2 - aBoundingBox.X1 + nGapWidth;
+ }
+ }
+ else {
+ for (iPart=maElementContainer.end()-1, nIndex=2; iPart!=iBegin-1; --iPart, --nIndex)
+ {
+ geometry::RealRectangle2D aBoundingBox(
+ nX, nY,
+ nX+aPartSizes[nIndex].Width, nY+aTotalSize.Height);
+
+ // Add space for gaps between elements.
+ if ((*iPart)->size() > 1)
+ if (bIsHorizontal)
+ aBoundingBox.X2 += ((*iPart)->size()-1) * nGapWidth;
+
+ LayoutPart(rxCanvas, *iPart, aBoundingBox, aPartSizes[nIndex], bIsHorizontal);
+ bIsHorizontal = !bIsHorizontal;
+ nX += aBoundingBox.X2 - aBoundingBox.X1 + nGapWidth;
+ }
}
// The whole window has to be repainted.
@@ -870,37 +894,90 @@ void PresenterToolBar::LayoutPart (
ElementContainerPart::const_iterator iElement;
ElementContainerPart::const_iterator iEnd (rpPart->end());
- for (iElement=rpPart->begin(); iElement!=iEnd; ++iElement)
- {
- if (iElement->get() == NULL)
- continue;
+ ElementContainerPart::const_iterator iBegin (rpPart->begin());
- const awt::Size aElementSize ((*iElement)->GetBoundingSize(rxCanvas));
- if (bIsHorizontal)
+ /// check whether RTL interface or not
+ if(!Application::GetSettings().GetLayoutRTL()){
+ for (iElement=rpPart->begin(); iElement!=iEnd; ++iElement)
{
- if ((*iElement)->IsFilling())
+ if (iElement->get() == NULL)
+ continue;
+
+ const awt::Size aElementSize ((*iElement)->GetBoundingSize(rxCanvas));
+ if (bIsHorizontal)
{
- nY = rBoundingBox.Y1;
- (*iElement)->SetSize(geometry::RealSize2D(aElementSize.Width, rBoundingBox.Y2 - rBoundingBox.Y1));
+ if ((*iElement)->IsFilling())
+ {
+ nY = rBoundingBox.Y1;
+ (*iElement)->SetSize(geometry::RealSize2D(aElementSize.Width, rBoundingBox.Y2 - rBoundingBox.Y1));
+ }
+ else
+ nY = rBoundingBox.Y1 + (rBoundingBox.Y2-rBoundingBox.Y1 - aElementSize.Height) / 2;
+ (*iElement)->SetLocation(awt::Point(sal_Int32(0.5 + nX), sal_Int32(0.5 + nY)));
+ nX += aElementSize.Width + nGap;
}
else
- nY = rBoundingBox.Y1 + (rBoundingBox.Y2-rBoundingBox.Y1 - aElementSize.Height) / 2;
- (*iElement)->SetLocation(awt::Point(sal_Int32(0.5 + nX), sal_Int32(0.5 + nY)));
- nX += aElementSize.Width + nGap;
+ {
+ if ((*iElement)->IsFilling())
+ {
+ nX = rBoundingBox.X1;
+ (*iElement)->SetSize(geometry::RealSize2D(rBoundingBox.X2 - rBoundingBox.X1, aElementSize.Height));
+ }
+ else
+ nX = rBoundingBox.X1 + (rBoundingBox.X2-rBoundingBox.X1 - aElementSize.Width) / 2;
+ (*iElement)->SetLocation(awt::Point(sal_Int32(0.5 + nX), sal_Int32(0.5 + nY)));
+ nY += aElementSize.Height + nGap;
+ }
}
- else
+ }
+ else {
+ for (iElement=rpPart->end()-1; iElement!=iBegin-1; --iElement)
{
- if ((*iElement)->IsFilling())
+ if (iElement->get() == NULL)
+ continue;
+
+ const awt::Size aElementSize ((*iElement)->GetBoundingSize(rxCanvas));
+ if (bIsHorizontal)
{
- nX = rBoundingBox.X1;
- (*iElement)->SetSize(geometry::RealSize2D(rBoundingBox.X2 - rBoundingBox.X1, aElementSize.Height));
+ if ((*iElement)->IsFilling())
+ {
+ nY = rBoundingBox.Y1;
+ (*iElement)->SetSize(geometry::RealSize2D(aElementSize.Width, rBoundingBox.Y2 - rBoundingBox.Y1));
+ }
+ else
+ nY = rBoundingBox.Y1 + (rBoundingBox.Y2-rBoundingBox.Y1 - aElementSize.Height) / 2;
+ (*iElement)->SetLocation(awt::Point(sal_Int32(0.5 + nX), sal_Int32(0.5 + nY)));
+ nX += aElementSize.Width + nGap;
}
else
- nX = rBoundingBox.X1 + (rBoundingBox.X2-rBoundingBox.X1 - aElementSize.Width) / 2;
- (*iElement)->SetLocation(awt::Point(sal_Int32(0.5 + nX), sal_Int32(0.5 + nY)));
- nY += aElementSize.Height + nGap;
+ {
+ // reverse presentation time with current time
+ if (iElement==iBegin){
+ iElement=iBegin+2;
+ }
+ else if (iElement==iBegin+2){
+ iElement=iBegin;
+ }
+ const awt::Size aNewElementSize ((*iElement)->GetBoundingSize(rxCanvas));
+ if ((*iElement)->IsFilling())
+ {
+ nX = rBoundingBox.X1;
+ (*iElement)->SetSize(geometry::RealSize2D(rBoundingBox.X2 - rBoundingBox.X1, aNewElementSize.Height));
+ }
+ else
+ nX = rBoundingBox.X1 + (rBoundingBox.X2-rBoundingBox.X1 - aNewElementSize.Width) / 2;
+ (*iElement)->SetLocation(awt::Point(sal_Int32(0.5 + nX), sal_Int32(0.5 + nY)));
+ nY += aNewElementSize.Height + nGap;
+
+ // return the index as it was before the reversing
+ if (iElement==iBegin)
+ iElement=iBegin+2;
+ else if (iElement==iBegin+2)
+ iElement=iBegin;
+ }
}
}
+
}
void PresenterToolBar::Paint (
@@ -950,6 +1027,11 @@ void PresenterToolBar::CheckMouseOver (
const bool bOverWindow,
const bool bMouseDown)
{
+ css::awt::MouseEvent rTemp =rEvent;
+ if(Application::GetSettings().GetLayoutRTL()){
+ awt::Rectangle aWindowBox = mxWindow->getPosSize();
+ rTemp.X=aWindowBox.Width-rTemp.X;
+ }
ElementContainer::iterator iPart;
ElementContainer::const_iterator iEnd (maElementContainer.end());
for (iPart=maElementContainer.begin(); iPart!=iEnd; ++iPart)
@@ -963,13 +1045,13 @@ void PresenterToolBar::CheckMouseOver (
awt::Rectangle aBox ((*iElement)->GetBoundingBox());
const bool bIsOver = bOverWindow
- && aBox.X <= rEvent.X
- && aBox.Width+aBox.X-1 >= rEvent.X
- && aBox.Y <= rEvent.Y
- && aBox.Height+aBox.Y-1 >= rEvent.Y;
+ && aBox.X <= rTemp.X
+ && aBox.Width+aBox.X-1 >= rTemp.X
+ && aBox.Y <= rTemp.Y
+ && aBox.Height+aBox.Y-1 >= rTemp.Y;
(*iElement)->SetState(
bIsOver,
- bIsOver && rEvent.Buttons!=0 && bMouseDown && rEvent.ClickCount>0);
+ bIsOver && rTemp.Buttons!=0 && bMouseDown && rTemp.ClickCount>0);
}
}
}
@@ -1507,16 +1589,31 @@ void Button::PaintIcon (
Reference<rendering::XBitmap> xBitmap (mpMode->mpIcon->GetBitmap(GetMode()));
if (xBitmap.is())
{
- const sal_Int32 nX (maLocation.X
- + (maSize.Width-xBitmap->getSize().Width) / 2);
- const sal_Int32 nY (maLocation.Y
- + (maSize.Height - nTextHeight - xBitmap->getSize().Height) / 2);
- const rendering::RenderState aRenderState(
- geometry::AffineMatrix2D(1,0,nX, 0,1,nY),
- NULL,
- Sequence<double>(4),
- rendering::CompositeOperation::OVER);
- rxCanvas->drawBitmap(xBitmap, rViewState, aRenderState);
+ /// check whether RTL interface or not
+ if(!Application::GetSettings().GetLayoutRTL()){
+ const sal_Int32 nX (maLocation.X
+ + (maSize.Width-xBitmap->getSize().Width) / 2);
+ const sal_Int32 nY (maLocation.Y
+ + (maSize.Height - nTextHeight - xBitmap->getSize().Height) / 2);
+ const rendering::RenderState aRenderState(
+ geometry::AffineMatrix2D(1,0,nX, 0,1,nY),
+ NULL,
+ Sequence<double>(4),
+ rendering::CompositeOperation::OVER);
+ rxCanvas->drawBitmap(xBitmap, rViewState, aRenderState);
+ }
+ else {
+ const sal_Int32 nX (maLocation.X
+ + (maSize.Width+xBitmap->getSize().Width) / 2);
+ const sal_Int32 nY (maLocation.Y
+ + (maSize.Height - nTextHeight - xBitmap->getSize().Height) / 2);
+ const rendering::RenderState aRenderState(
+ geometry::AffineMatrix2D(-1,0,nX, 0,1,nY),
+ NULL,
+ Sequence<double>(4),
+ rendering::CompositeOperation::OVER);
+ rxCanvas->drawBitmap(xBitmap, rViewState, aRenderState);
+ }
}
}
@@ -1669,25 +1766,47 @@ 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;
- 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);
+ 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 Text::GetBoundingBox (const Reference<rendering::XCanvas>& rxCanvas)
@@ -1698,13 +1817,25 @@ geometry::RealRectangle2D Text::GetBoundingBox (const Reference<rendering::XCanv
mpFont->PrepareFont(rxCanvas);
if (mpFont->mxFont.is())
{
- 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();
+ /// 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();
+ }
}
}
return geometry::RealRectangle2D(0,0,0,0);
@@ -1727,31 +1858,71 @@ OUString TimeFormatter::FormatTime (const oslDateTime& rTime)
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)));
-
- sText.append(A2S(":"));
-
- // Minutes
- const OUString sMinutes (OUString::valueOf(nMinutes));
- if (sMinutes.getLength() == 1)
- sText.append(A2S("0"));
- sText.append(sMinutes);
+ /// 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)));
- // Seconds
- if (mbIsShowSeconds)
- {
sText.append(A2S(":"));
- const OUString sSeconds (OUString::valueOf(nSeconds));
- if (sSeconds.getLength() == 1)
+
+ // Minutes
+ const OUString sMinutes (OUString::valueOf(nMinutes));
+ if (sMinutes.getLength() == 1)
sText.append(A2S("0"));
- sText.append(sSeconds);
+ 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(sMinutes[0]);
+ 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]);
+ }
if (mbIsAmPmFormat)
{
if (rTime.Hours < 12)