Kaydet (Commit) 5e5c11c6 authored tarafından Faisal M. Al-Otaibi's avatar Faisal M. Al-Otaibi Kaydeden (comit) Andras Timar

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/1053Tested-by: 's avatarLior Kaplan <kaplanlior@gmail.com>
Reviewed-by: 's avatarAndras Timar <atimar@suse.com>
Tested-by: 's avatarAndras Timar <atimar@suse.com>
üst 4012983d
......@@ -39,6 +39,7 @@ $(eval $(call gb_Library_use_libraries,PresenterScreen,\
cppu \
cppuhelper \
sal \
vcl \
))
$(eval $(call gb_Library_add_exception_objects,PresenterScreen,\
......
......@@ -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<double>(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)
......
......@@ -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<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);
rendering::RenderState aRenderState(
geometry::AffineMatrix2D(1,0,nX, 0,1,nY),
NULL,
Sequence<double>(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<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);
}
}
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);
}
}
}
......
......@@ -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);
......
......@@ -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)
......
......@@ -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)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment