From 5e5c11c664f67ff9fd1120905b09a32bea3b2f6c Mon Sep 17 00:00:00 2001 From: "Faisal M. Al-Otaibi" Date: Wed, 14 Nov 2012 10:28:17 +0300 Subject: fdo#42070-Fix RTL support in presenter console Problems that still exist: 1-Help layout. 2-Slide sorter view (slides alignment). 3-Note view buttons. 4-Scroll bars. Change-Id: Ie78519358d2f6d847692ee870ecdc1790c5244e6 Reviewed-on: https://gerrit.libreoffice.org/1053 Tested-by: Lior Kaplan Reviewed-by: Andras Timar Tested-by: Andras Timar --- sdext/Library_presenter.mk | 1 + sdext/source/presenter/PresenterButton.cxx | 34 +- .../presenter/PresenterPaneBorderPainter.cxx | 206 +++++++---- sdext/source/presenter/PresenterSlideShowView.cxx | 44 ++- sdext/source/presenter/PresenterSlideSorter.cxx | 26 +- sdext/source/presenter/PresenterToolBar.cxx | 377 +++++++++++++++------ sdext/source/presenter/PresenterWindowManager.cxx | 100 +++++- 7 files changed, 592 insertions(+), 196 deletions(-) diff --git a/sdext/Library_presenter.mk b/sdext/Library_presenter.mk index 7dcb3fd1551a..8153e0d9a845 100644 --- a/sdext/Library_presenter.mk +++ b/sdext/Library_presenter.mk @@ -39,6 +39,7 @@ $(eval $(call gb_Library_use_libraries,PresenterScreen,\ cppu \ cppuhelper \ sal \ + vcl \ )) $(eval $(call gb_Library_add_exception_objects,PresenterScreen,\ diff --git a/sdext/source/presenter/PresenterButton.cxx b/sdext/source/presenter/PresenterButton.cxx index 00e18429c134..ac8e813379d5 100644 --- a/sdext/source/presenter/PresenterButton.cxx +++ b/sdext/source/presenter/PresenterButton.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include "vcl/svapp.hxx" #include "PresenterButton.hxx" #include "PresenterCanvasHelper.hxx" #include "PresenterController.hxx" @@ -301,7 +302,6 @@ void SAL_CALL PresenterButton::mousePressed (const css::awt::MouseEvent& rEvent) { (void)rEvent; ThrowIfDisposed(); - meState = PresenterBitmapDescriptor::ButtonDown; } @@ -413,15 +413,29 @@ void PresenterButton::RenderButton ( rendering::RenderState aRenderState (geometry::AffineMatrix2D(1,0,0, 0,1,0), NULL, Sequence(4), rendering::CompositeOperation::SOURCE); PresenterCanvasHelper::SetDeviceColor(aRenderState, rpFont->mnColor); - aRenderState.AffineTransform.m02 = (rSize.Width - aTextBBox.X2 + aTextBBox.X1)/2; - aRenderState.AffineTransform.m12 = (rSize.Height - aTextBBox.Y2 + aTextBBox.Y1)/2 - aTextBBox.Y1; - - rxCanvas->drawText( - aContext, - rpFont->mxFont, - rendering::ViewState(geometry::AffineMatrix2D(1,0,0, 0,1,0), NULL), - aRenderState, - rendering::TextDirection::WEAK_LEFT_TO_RIGHT); + /// this is responsible of the close button + /// check whether RTL interface or not + if(!Application::GetSettings().GetLayoutRTL()){ + aRenderState.AffineTransform.m02 = (rSize.Width - aTextBBox.X2 + aTextBBox.X1)/2; + aRenderState.AffineTransform.m12 = (rSize.Height - aTextBBox.Y2 + aTextBBox.Y1)/2 - aTextBBox.Y1; + + rxCanvas->drawText( + aContext, + rpFont->mxFont, + rendering::ViewState(geometry::AffineMatrix2D(1,0,0, 0,1,0), NULL), + aRenderState, + rendering::TextDirection::WEAK_LEFT_TO_RIGHT); + }else{ + aRenderState.AffineTransform.m02 = (rSize.Width + aTextBBox.X2 - aTextBBox.X1)/2; + aRenderState.AffineTransform.m12 = (rSize.Height - aTextBBox.Y2 + aTextBBox.Y1)/2 - aTextBBox.Y1; + + rxCanvas->drawText( + aContext, + rpFont->mxFont, + rendering::ViewState(geometry::AffineMatrix2D(1,0,0, 0,1,0), NULL), + aRenderState, + rendering::TextDirection::WEAK_RIGHT_TO_LEFT); + } } void PresenterButton::Invalidate (void) diff --git a/sdext/source/presenter/PresenterPaneBorderPainter.cxx b/sdext/source/presenter/PresenterPaneBorderPainter.cxx index ea1c80c4a87a..6eccd9540587 100644 --- a/sdext/source/presenter/PresenterPaneBorderPainter.cxx +++ b/sdext/source/presenter/PresenterPaneBorderPainter.cxx @@ -17,6 +17,7 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include "vcl/svapp.hxx" #include "PresenterPaneBorderPainter.hxx" #include "PresenterCanvasHelper.hxx" #include "PresenterConfigurationAccess.hxx" @@ -536,74 +537,149 @@ void PresenterPaneBorderPainter::Renderer::PaintTitle ( if ( ! xLayout.is()) return; - geometry::RealRectangle2D aBox (xLayout->queryTextBounds()); - const double nTextHeight = aBox.Y2 - aBox.Y1; - const double nTextWidth = aBox.X2 - aBox.X1; - 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; + /// 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; - } + 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(4), - rendering::CompositeOperation::SOURCE); - - if (bPaintBackground) - { - PresenterCanvasHelper::SetDeviceColor(aRenderState, util::Color(0x00ffffff)); - Sequence > aPolygons(1); - aPolygons[0] = Sequence(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 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); + rendering::RenderState aRenderState( + geometry::AffineMatrix2D(1,0,nX, 0,1,nY), + NULL, + Sequence(4), + rendering::CompositeOperation::SOURCE); - mxCanvas->drawText( - aContext, - xFont, - maViewState, - aRenderState, - rendering::TextDirection::WEAK_LEFT_TO_RIGHT); + if (bPaintBackground) + { + PresenterCanvasHelper::SetDeviceColor(aRenderState, util::Color(0x00ffffff)); + Sequence > aPolygons(1); + aPolygons[0] = Sequence(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 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); + } + } + 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(4), + rendering::CompositeOperation::SOURCE); + + if (bPaintBackground) + { + PresenterCanvasHelper::SetDeviceColor(aRenderState, util::Color(0x00ffffff)); + Sequence > aPolygons(1); + aPolygons[0] = Sequence(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 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); + } } } diff --git a/sdext/source/presenter/PresenterSlideShowView.cxx b/sdext/source/presenter/PresenterSlideShowView.cxx index 2201a1edca2f..894e6d889fe7 100644 --- a/sdext/source/presenter/PresenterSlideShowView.cxx +++ b/sdext/source/presenter/PresenterSlideShowView.cxx @@ -18,7 +18,7 @@ */ #include "PresenterSlideShowView.hxx" - +#include "vcl/svapp.hxx" #include "PresenterCanvasHelper.hxx" #include "PresenterGeometryHelper.hxx" #include "PresenterHelper.hxx" @@ -781,18 +781,36 @@ void PresenterSlideShowView::PaintEndSlide (const awt::Rectangle& rRepaintBox) if (pFont.get() == NULL) break; - PresenterCanvasHelper::SetDeviceColor(aRenderState, util::Color(0x00ffffff)); - aRenderState.AffineTransform.m02 = 20; - aRenderState.AffineTransform.m12 = 40; - const rendering::StringContext aContext ( - msClickToExitPresentationText, 0, msClickToExitPresentationText.getLength()); - pFont->PrepareFont(mxCanvas); - mxCanvas->drawText( - aContext, - pFont->mxFont, - aViewState, - aRenderState, - rendering::TextDirection::WEAK_LEFT_TO_RIGHT); + /// this is responsible of the " presentation exit " text inside the slide windows + /// check whether RTL interface or not + if(!Application::GetSettings().GetLayoutRTL()){ + PresenterCanvasHelper::SetDeviceColor(aRenderState, util::Color(0x00ffffff)); + aRenderState.AffineTransform.m02 = 20; + aRenderState.AffineTransform.m12 = 40; + const rendering::StringContext aContext ( + msClickToExitPresentationText, 0, msClickToExitPresentationText.getLength()); + pFont->PrepareFont(mxCanvas); + mxCanvas->drawText( + aContext, + pFont->mxFont, + aViewState, + aRenderState, + rendering::TextDirection::WEAK_LEFT_TO_RIGHT); + } + else{ + PresenterCanvasHelper::SetDeviceColor(aRenderState, util::Color(0x00ffffff)); + aRenderState.AffineTransform.m02 = rRepaintBox.Width-20; + aRenderState.AffineTransform.m12 = 40; + const rendering::StringContext aContext ( + msClickToExitPresentationText, 0, msClickToExitPresentationText.getLength()); + pFont->PrepareFont(mxCanvas); + mxCanvas->drawText( + aContext, + pFont->mxFont, + aViewState, + aRenderState, + rendering::TextDirection::WEAK_RIGHT_TO_LEFT); + } } while (false); diff --git a/sdext/source/presenter/PresenterSlideSorter.cxx b/sdext/source/presenter/PresenterSlideSorter.cxx index cc00c0960482..6c5d75da837a 100644 --- a/sdext/source/presenter/PresenterSlideSorter.cxx +++ b/sdext/source/presenter/PresenterSlideSorter.cxx @@ -17,6 +17,8 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include "vcl/svapp.hxx" + #include "PresenterSlideSorter.hxx" #include "PresenterButton.hxx" #include "PresenterCanvasHelper.hxx" @@ -512,14 +514,26 @@ void SAL_CALL PresenterSlideSorter::windowPaint (const css::awt::PaintEvent& rEv void SAL_CALL PresenterSlideSorter::mousePressed (const css::awt::MouseEvent& rEvent) throw(css::uno::RuntimeException) { - const geometry::RealPoint2D aPosition (rEvent.X, rEvent.Y); + css::awt::MouseEvent rTemp =rEvent; + /// check whether RTL interface or not + if(Application::GetSettings().GetLayoutRTL()){ + awt::Rectangle aBox = mxWindow->getPosSize(); + rTemp.X=aBox.Width-rEvent.X; + } + const geometry::RealPoint2D aPosition(rTemp.X, rEvent.Y); mnSlideIndexMousePressed = mpLayout->GetSlideIndexForPosition(aPosition); } void SAL_CALL PresenterSlideSorter::mouseReleased (const css::awt::MouseEvent& rEvent) throw(css::uno::RuntimeException) { - const geometry::RealPoint2D aPosition (rEvent.X, rEvent.Y); + css::awt::MouseEvent rTemp =rEvent; + /// check whether RTL interface or not + if(Application::GetSettings().GetLayoutRTL()){ + awt::Rectangle aBox = mxWindow->getPosSize(); + rTemp.X=aBox.Width-rEvent.X; + } + const geometry::RealPoint2D aPosition(rTemp.X, rEvent.Y); const sal_Int32 nSlideIndex (mpLayout->GetSlideIndexForPosition(aPosition)); if (nSlideIndex == mnSlideIndexMousePressed && mnSlideIndexMousePressed >= 0) @@ -563,7 +577,13 @@ void SAL_CALL PresenterSlideSorter::mouseMoved (const css::awt::MouseEvent& rEve { if (mpMouseOverManager.get() != NULL) { - const geometry::RealPoint2D aPosition (rEvent.X, rEvent.Y); + css::awt::MouseEvent rTemp =rEvent; + /// check whether RTL interface or not + if(Application::GetSettings().GetLayoutRTL()){ + awt::Rectangle aBox = mxWindow->getPosSize(); + rTemp.X=aBox.Width-rEvent.X; + } + const geometry::RealPoint2D aPosition(rTemp.X, rEvent.Y); sal_Int32 nSlideIndex (mpLayout->GetSlideIndexForPosition(aPosition)); if (nSlideIndex < 0) 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 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 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(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(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(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(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(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(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& rxCanvas) @@ -1698,13 +1817,25 @@ geometry::RealRectangle2D Text::GetBoundingBox (const ReferencePrepareFont(rxCanvas); if (mpFont->mxFont.is()) { - rendering::StringContext aContext (msText, 0, msText.getLength()); - Reference 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 xLayout ( + mpFont->mxFont->createTextLayout( + aContext, + rendering::TextDirection::WEAK_LEFT_TO_RIGHT, + 0)); + return xLayout->queryTextBounds(); + } + else { + rendering::StringContext aContext (msText, 0, msText.getLength()); + Reference 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(rTime.Minutes)); const sal_Int32 nSeconds(sal::static_int_cast(rTime.Seconds)); - // Hours - if (mbIs24HourFormat) - sText.append(OUString::valueOf(nHours)); - else - sText.append(OUString::valueOf( - sal::static_int_cast(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(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(nHours>12 ? nHours-12 : nHours)); + if (tempHours.getLength() > 1) + sText.append(tempHours[1]); + sText.append(tempHours[0]); + } if (mbIsAmPmFormat) { if (rTime.Hours < 12) diff --git a/sdext/source/presenter/PresenterWindowManager.cxx b/sdext/source/presenter/PresenterWindowManager.cxx index 88359a2f98bb..7d38f1a7ee7f 100644 --- a/sdext/source/presenter/PresenterWindowManager.cxx +++ b/sdext/source/presenter/PresenterWindowManager.cxx @@ -20,6 +20,7 @@ #undef ENABLE_PANE_RESIZING //#define ENABLE_PANE_RESIZING +#include "vcl/svapp.hxx" #include "PresenterWindowManager.hxx" #include "PresenterController.hxx" #include "PresenterGeometryHelper.hxx" @@ -655,7 +656,8 @@ void PresenterWindowManager::LayoutStandardMode (void) const double nGap (20); const double nHorizontalSlideDivide (aBox.Width / nGoldenRatio); double nSlidePreviewTop (0); - + /// check whether RTL interface or not + if(!Application::GetSettings().GetLayoutRTL()){ // For the current slide view calculate the outer height from the outer // width. This takes into acount the slide aspect ratio and thus has to // go over the inner pane size. @@ -691,8 +693,45 @@ void PresenterWindowManager::LayoutStandardMode (void) aNextSlideOuterBox.Width, aNextSlideOuterBox.Height); } + }else{ + + // For the current slide view calculate the outer height from the outer + // width. This takes into acount the slide aspect ratio and thus has to + // go over the inner pane size. + PresenterPaneContainer::SharedPaneDescriptor pPane ( + mpPaneContainer->FindPaneURL(PresenterPaneFactory::msCurrentSlidePreviewPaneURL)); + if (pPane.get() != NULL) + { + const awt::Size aNextSlideOuterBox (CalculatePaneSize( + nHorizontalSlideDivide - 1.5*nGap, + PresenterPaneFactory::msCurrentSlidePreviewPaneURL)); + nSlidePreviewTop = (aBox.Height - aNextSlideOuterBox.Height) / 2; + SetPanePosSizeAbsolute ( + PresenterPaneFactory::msCurrentSlidePreviewPaneURL, + aBox.Width - aNextSlideOuterBox.Width - nGap, + nSlidePreviewTop, + aNextSlideOuterBox.Width, + aNextSlideOuterBox.Height); + } - LayoutToolBar(); + // For the next slide view calculate the outer height from the outer + // width. This takes into acount the slide aspect ratio and thus has to + // go over the inner pane size. + pPane = mpPaneContainer->FindPaneURL(PresenterPaneFactory::msNextSlidePreviewPaneURL); + if (pPane.get() != NULL) + { + const awt::Size aCurrentSlideOuterBox(CalculatePaneSize( + aBox.Width - nHorizontalSlideDivide - 1.5*nGap, + PresenterPaneFactory::msNextSlidePreviewPaneURL)); + SetPanePosSizeAbsolute ( + PresenterPaneFactory::msNextSlidePreviewPaneURL, + nGap, + nSlidePreviewTop, + aCurrentSlideOuterBox.Width, + aCurrentSlideOuterBox.Height); + } + } + LayoutToolBar(); } void PresenterWindowManager::LayoutNotesMode (void) @@ -708,6 +747,8 @@ void PresenterWindowManager::LayoutNotesMode (void) const double nTertiaryWidth (nSecondaryWidth / nGoldenRatio); double nSlidePreviewTop (0); double nNotesViewBottom (aToolBarBox.Y1 - nGap); + /// check whether RTL interface or not + if(!Application::GetSettings().GetLayoutRTL()){ // The notes view has no fixed aspect ratio. PresenterPaneContainer::SharedPaneDescriptor pPane ( @@ -761,6 +802,61 @@ void PresenterWindowManager::LayoutNotesMode (void) aNextSlideOuterBox.Width, aNextSlideOuterBox.Height); } + + + }else { + // The notes view has no fixed aspect ratio. + PresenterPaneContainer::SharedPaneDescriptor pPane ( + mpPaneContainer->FindPaneURL(PresenterPaneFactory::msNotesPaneURL)); + if (pPane.get() != NULL) + { + const geometry::RealSize2D aNotesViewOuterSize( + nPrimaryWidth - 1.5*nGap + 0.5, + nNotesViewBottom); + nSlidePreviewTop = (aBox.Height + - aToolBarBox.Y2 + aToolBarBox.Y1 - aNotesViewOuterSize.Height) / 2; + SetPanePosSizeAbsolute ( + PresenterPaneFactory::msNotesPaneURL, + nGap, + nSlidePreviewTop, + aNotesViewOuterSize.Width, + aNotesViewOuterSize.Height); + nNotesViewBottom = nSlidePreviewTop + aNotesViewOuterSize.Height; + } + + // For the current slide view calculate the outer height from the outer + // width. This takes into acount the slide aspect ratio and thus has to + // go over the inner pane size. + pPane = mpPaneContainer->FindPaneURL(PresenterPaneFactory::msCurrentSlidePreviewPaneURL); + if (pPane.get() != NULL) + { + const awt::Size aCurrentSlideOuterBox(CalculatePaneSize( + nSecondaryWidth - 1.5*nGap, + PresenterPaneFactory::msCurrentSlidePreviewPaneURL)); + SetPanePosSizeAbsolute ( + PresenterPaneFactory::msCurrentSlidePreviewPaneURL, + aBox.Width - aCurrentSlideOuterBox.Width - nGap, + nSlidePreviewTop, + aCurrentSlideOuterBox.Width, + aCurrentSlideOuterBox.Height); + } + + // For the next slide view calculate the outer height from the outer + // width. This takes into acount the slide aspect ratio and thus has to + // go over the inner pane size. + pPane = mpPaneContainer->FindPaneURL(PresenterPaneFactory::msNextSlidePreviewPaneURL); + if (pPane.get() != NULL) + { + const awt::Size aNextSlideOuterBox (CalculatePaneSize( + nTertiaryWidth, + PresenterPaneFactory::msNextSlidePreviewPaneURL)); + SetPanePosSizeAbsolute ( + PresenterPaneFactory::msNextSlidePreviewPaneURL, + aBox.Width - aNextSlideOuterBox.Width - nGap, + nNotesViewBottom - aNextSlideOuterBox.Height, + aNextSlideOuterBox.Width, + aNextSlideOuterBox.Height); + }} } void PresenterWindowManager::LayoutSlideSorterMode (void) -- cgit v1.2.3