diff options
author | Rüdiger Timm <rt@openoffice.org> | 2008-12-16 13:30:53 +0000 |
---|---|---|
committer | Rüdiger Timm <rt@openoffice.org> | 2008-12-16 13:30:53 +0000 |
commit | 69b684b12e42bf1396bdffca88ca880ac3c2e00b (patch) | |
tree | 52ad5a6f28df2991ad5635c1ea9d4923229c563e /vcl/source | |
parent | 692b9bb291b9c5efb6c2daf77b213bde07326016 (diff) |
CWS-TOOLING: integrate CWS rtlcontrols
2008-12-11 21:08:49 +0100 fs r265367 : CONTEXT_WRITING_MODE is transient
2008-12-11 21:08:00 +0100 fs r265365 : REGISTER_PROP_3
2008-12-11 20:53:44 +0100 fs r265362 : ContextWritingMode is not MAYBEVOID
2008-12-11 15:29:08 +0100 fs r265315 : prevent a deadlock during complex.dbaccess.DatabaseDocument test
2008-12-11 15:01:13 +0100 fs r265304 : manual RESYNC to m37
2008-12-10 20:04:38 +0100 pl r265230 : #i30631# fix a snafu in mirroring
2008-12-10 19:14:45 +0100 pl r265229 : #i30631# rework PaintToDevice for RTL controls
2008-12-05 10:19:13 +0100 fs r264893 : #i10000# ImplInitSettings => ImplInitWindow (ImplInitSettings clashed with base classes ImplInitSettings on unxsols4)
2008-12-03 12:55:24 +0100 fs r264768 : #i100000#
2008-12-03 07:11:48 +0100 fs r264741 : #i10000#
2008-12-02 10:37:51 +0100 fs r264670 : CWS-TOOLING: rebase CWS rtlcontrols to trunk@264325 (milestone: DEV300:m36)
2008-12-02 09:27:50 +0100 fs r264660 : merge from trunk
2008-11-25 10:28:36 +0100 ama r264277 : Fix #i94572#
2008-11-24 11:46:48 +0100 fs r264218 : #i30631# proper context writing mode
2008-11-24 09:38:04 +0100 fs r264204 : #i30631# (approved by PL)
2008-11-24 09:35:47 +0100 fs r264203 : #i30631# Context/WritingMode
2008-11-24 09:33:36 +0100 fs r264202 : #i30631# Context/WritingMode
2008-11-24 09:31:53 +0100 fs r264200 : #i30631# RTL
2008-11-19 08:51:48 +0100 fs r263963 : #i10000#
2008-11-18 20:58:11 +0100 fs r263878 : #i10000#
2008-11-18 15:30:44 +0100 fs r263778 : migrate the CWS from CVS to SVN
the CVS changes contained in this change set are the ones between the
following two CVS tags:
CWS_DEV300_RTLCONTROLS_ANCHOR
CWS_DEV300_RTLCONTROLS_PRE_MIGRATION
2008-11-18 12:29:04 +0100 ama r263762 : Fix #i94572#: Context direction for drawing objects
2008-11-18 12:25:50 +0100 ama r263761 : Fix #i94572#: Context direction for drawing objects
2008-11-18 12:02:30 +0100 ama r263759 : Fix #i94572#: Context direction for drawing objects
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/control/combobox.cxx | 15 | ||||
-rw-r--r-- | vcl/source/control/edit.cxx | 33 | ||||
-rw-r--r-- | vcl/source/control/ilstbox.cxx | 9 | ||||
-rw-r--r-- | vcl/source/control/lstbox.cxx | 12 | ||||
-rw-r--r-- | vcl/source/control/spinfld.cxx | 14 | ||||
-rw-r--r-- | vcl/source/gdi/outdev.cxx | 32 | ||||
-rw-r--r-- | vcl/source/gdi/outdev3.cxx | 27 | ||||
-rw-r--r-- | vcl/source/gdi/salgdilayout.cxx | 174 | ||||
-rw-r--r-- | vcl/source/window/dndevdis.cxx | 10 | ||||
-rw-r--r-- | vcl/source/window/window.cxx | 122 | ||||
-rw-r--r-- | vcl/source/window/window2.cxx | 16 | ||||
-rw-r--r-- | vcl/source/window/winproc.cxx | 10 |
12 files changed, 285 insertions, 189 deletions
diff --git a/vcl/source/control/combobox.cxx b/vcl/source/control/combobox.cxx index 3038f60267ee..42abe3fd248a 100644 --- a/vcl/source/control/combobox.cxx +++ b/vcl/source/control/combobox.cxx @@ -130,8 +130,6 @@ void ComboBox::ImplInitComboBoxData() mbSyntheticModify = FALSE; mbMatchCase = FALSE; mcMultiSep = ';'; - - EnableRTL( TRUE ); } // ----------------------------------------------------------------------- @@ -671,7 +669,7 @@ void ComboBox::Resize() else { nSBWidth = CalcZoom( nSBWidth ); - mpSubEdit->SetSizePixel( Size( aOutSz.Width() - nSBWidth, aOutSz.Height() ) ); + mpSubEdit->SetPosSizePixel( Point( 0, 0 ), Size( aOutSz.Width() - nSBWidth, aOutSz.Height() ) ); mpBtn->SetPosSizePixel( aOutSz.Width() - nSBWidth, nTop, nSBWidth, (nBottom-nTop) ); } } @@ -766,6 +764,17 @@ void ComboBox::StateChanged( StateChangedType nType ) SetStyle( ImplInitStyle( GetStyle() ) ); mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) ? TRUE : FALSE ); } + else if( nType == STATE_CHANGE_MIRRORING ) + { + if( mpBtn ) + { + mpBtn->EnableRTL( IsRTLEnabled() ); + ImplInitDropDownButton( mpBtn ); + } + mpSubEdit->StateChanged( STATE_CHANGE_MIRRORING ); + mpImplLB->EnableRTL( IsRTLEnabled() ); + Resize(); + } } // ----------------------------------------------------------------------- diff --git a/vcl/source/control/edit.cxx b/vcl/source/control/edit.cxx index 93e707fc562c..173f80ca0f50 100644 --- a/vcl/source/control/edit.cxx +++ b/vcl/source/control/edit.cxx @@ -340,7 +340,7 @@ void Edit::ImplInit( Window* pParent, WinBits nStyle ) mnAlign = EDIT_ALIGN_LEFT; // --- RTL --- hack: right align until keyinput and cursor travelling works - if( Application::GetSettings().GetLayoutRTL() ) + if( IsRTLEnabled() ) mnAlign = EDIT_ALIGN_RIGHT; if ( nStyle & WB_RIGHT ) @@ -1253,7 +1253,10 @@ void Edit::ImplAlign() else if ( mnAlign == EDIT_ALIGN_RIGHT ) { long nMinXOffset = nOutWidth - nTextWidth - 1 - ImplGetExtraOffset(); - if( Application::GetSettings().GetLayoutRTL() ) + bool bRTL = IsRTLEnabled(); + if( mbIsSubEdit && GetParent() ) + bRTL = GetParent()->IsRTLEnabled(); + if( bRTL ) { if( nTextWidth < nOutWidth ) mnXOffset = nMinXOffset; @@ -2258,17 +2261,33 @@ void Edit::StateChanged( StateChangedType nType ) ImplInvalidateOrRepaint( 0, 0xFFFF ); } } - else if ( nType == STATE_CHANGE_STYLE ) + else if ( nType == STATE_CHANGE_STYLE || nType == STATE_CHANGE_MIRRORING ) { - WinBits nStyle = ImplInitStyle( GetStyle() ); - SetStyle( nStyle ); + WinBits nStyle = GetStyle(); + if( nType == STATE_CHANGE_STYLE ) + { + nStyle = ImplInitStyle( GetStyle() ); + SetStyle( nStyle ); + } USHORT nOldAlign = mnAlign; mnAlign = EDIT_ALIGN_LEFT; // --- RTL --- hack: right align until keyinput and cursor travelling works - if( Application::GetSettings().GetLayoutRTL() ) - mnAlign = EDIT_ALIGN_RIGHT; + // edits are always RTL disabled + // however the parent edits contain the correct setting + if( mbIsSubEdit && GetParent()->IsRTLEnabled() ) + { + if( GetParent()->GetStyle() & WB_LEFT ) + mnAlign = EDIT_ALIGN_RIGHT; + if ( nType == STATE_CHANGE_MIRRORING ) + SetLayoutMode( TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_TEXTORIGIN_LEFT ); + } + else if( mbIsSubEdit && !GetParent()->IsRTLEnabled() ) + { + if ( nType == STATE_CHANGE_MIRRORING ) + SetLayoutMode( TEXT_LAYOUT_BIDI_LTR | TEXT_LAYOUT_TEXTORIGIN_LEFT ); + } if ( nStyle & WB_RIGHT ) mnAlign = EDIT_ALIGN_RIGHT; diff --git a/vcl/source/control/ilstbox.cxx b/vcl/source/control/ilstbox.cxx index df77e088a7a4..62ec901bfe25 100644 --- a/vcl/source/control/ilstbox.cxx +++ b/vcl/source/control/ilstbox.cxx @@ -2558,6 +2558,13 @@ void ImplListBox::StateChanged( StateChangedType nType ) { maLBWindow.SetControlBackground( GetControlBackground() ); } + else if( nType == STATE_CHANGE_MIRRORING ) + { + maLBWindow.EnableRTL( IsRTLEnabled() ); + mpHScrollBar->EnableRTL( IsRTLEnabled() ); + mpVScrollBar->EnableRTL( IsRTLEnabled() ); + ImplResizeControls(); + } Control::StateChanged( nType ); } @@ -3200,7 +3207,7 @@ void ImplListBoxFloatingWindow::StartFloat( BOOL bStartTracking ) // check if the control's parent is un-mirrored which is the case for form controls in a mirrored UI // where the document is unmirrored // because StartPopupMode() expects a rectangle in mirrored coordinates we have to re-mirror - if( GetParent()->GetParent()->ImplHasMirroredGraphics() && !GetParent()->GetParent()->IsRTLEnabled() ) + if( GetParent()->GetParent()->ImplIsAntiparallel() ) GetParent()->GetParent()->ImplReMirror( aRect ); StartPopupMode( aRect, FLOATWIN_POPUPMODE_DOWN ); diff --git a/vcl/source/control/lstbox.cxx b/vcl/source/control/lstbox.cxx index 2fcf24478ffe..0accd17489c9 100644 --- a/vcl/source/control/lstbox.cxx +++ b/vcl/source/control/lstbox.cxx @@ -876,6 +876,18 @@ void ListBox::StateChanged( StateChangedType nType ) SetStyle( ImplInitStyle( GetStyle() ) ); mpImplLB->GetMainWindow()->EnableSort( ( GetStyle() & WB_SORT ) ? TRUE : FALSE ); } + else if( nType == STATE_CHANGE_MIRRORING ) + { + if( mpBtn ) + { + mpBtn->EnableRTL( IsRTLEnabled() ); + ImplInitDropDownButton( mpBtn ); + } + mpImplLB->EnableRTL( IsRTLEnabled() ); + if( mpImplWin ) + mpImplWin->EnableRTL( IsRTLEnabled() ); + Resize(); + } Control::StateChanged( nType ); } diff --git a/vcl/source/control/spinfld.cxx b/vcl/source/control/spinfld.cxx index c0bbd62b82c1..3f8779dc2e90 100644 --- a/vcl/source/control/spinfld.cxx +++ b/vcl/source/control/spinfld.cxx @@ -313,7 +313,6 @@ void SpinField::ImplInitSpinFieldData() mbInitialDown = FALSE; mbNoSelect = FALSE; mbInDropDown = FALSE; - EnableRTL( TRUE ); } // -------------------------------------------------------------------- @@ -765,6 +764,7 @@ void SpinField::Resize() { Control::Resize(); Size aSize = GetOutputSizePixel(); + bool bSubEditPositioned = false; if ( GetStyle() & (WB_SPIN|WB_DROPDOWN) ) { @@ -789,6 +789,7 @@ void SpinField::Resize() // use the themes drop down size Rectangle aContentRect = aContent.GetBoundRect(); mpEdit->SetPosPixel( aContentRect.TopLeft() ); + bSubEditPositioned = true; aSize = aContentRect.GetSize(); } else @@ -803,6 +804,11 @@ void SpinField::Resize() } } + if( ! bSubEditPositioned ) + { + // this moves our sub edit if RTL gets switched + mpEdit->SetPosPixel( Point() ); + } mpEdit->SetSizePixel( aSize ); if ( GetStyle() & WB_SPIN ) @@ -868,6 +874,12 @@ void SpinField::StateChanged( StateChangedType nType ) ImplInitSettings( FALSE, FALSE, TRUE ); Invalidate(); } + else if( nType == STATE_CHANGE_MIRRORING ) + { + if( mpEdit ) + mpEdit->StateChanged( STATE_CHANGE_MIRRORING ); + Resize(); + } } // ----------------------------------------------------------------------- diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx index 0d93b538338b..9c94811e0122 100644 --- a/vcl/source/gdi/outdev.cxx +++ b/vcl/source/gdi/outdev.cxx @@ -43,6 +43,7 @@ #include <tools/debug.hxx> #include <vcl/svdata.hxx> #include <vcl/svapp.hxx> +#include <vcl/ctrl.hxx> #ifndef _POLY_HXX #include <tools/poly.hxx> #endif @@ -173,6 +174,22 @@ static void ImplDeleteObjStack( ImplObjStack* pObjStack ) // ----------------------------------------------------------------------- +bool OutputDevice::ImplIsAntiparallel() const +{ + bool bRet = false; + if( ImplGetGraphics() ) + { + if( ( (mpGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) && ! IsRTLEnabled() ) || + ( ! (mpGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) && IsRTLEnabled() ) ) + { + bRet = true; + } + } + return bRet; +} + +// ----------------------------------------------------------------------- + bool OutputDevice::ImplSelectClipRegion( const Region& rRegion, SalGraphics* pGraphics ) { @@ -564,11 +581,18 @@ void OutputDevice::EnableRTL( BOOL bEnable ) // under rare circumstances in the UI, eg the valueset control // because each virdev has its own SalGraphics we can safely switch the SalGraphics here // ...hopefully - if( Application::GetSettings().GetLayoutRTL() ) // allow mirroring only in BiDi Office - if( ImplGetGraphics() ) - mpGraphics->SetLayout( mbEnableRTL ? SAL_LAYOUT_BIDI_RTL : 0 ); + if( ImplGetGraphics() ) + mpGraphics->SetLayout( mbEnableRTL ? SAL_LAYOUT_BIDI_RTL : 0 ); } + // convenience: for controls also switch layout mode + if( dynamic_cast<Control*>(this) != 0 ) + SetLayoutMode( bEnable ? TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_TEXTORIGIN_LEFT : TEXT_LAYOUT_BIDI_LTR | TEXT_LAYOUT_TEXTORIGIN_LEFT); + + Window* pWin = dynamic_cast<Window*>(this); + if( pWin ) + pWin->StateChanged( STATE_CHANGE_MIRRORING ); + if( mpAlphaVDev ) mpAlphaVDev->EnableRTL( bEnable ); } @@ -1019,7 +1043,7 @@ void OutputDevice::ImplInitClipRegion() aRegion = *(pWindow->ImplGetWinChildClipRegion()); // --- RTL -- only this region is in frame coordinates, so re-mirror it // the mpWindowImpl->mpPaintRegion above is already correct (see ImplCallPaint()) ! - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) ImplReMirror ( aRegion ); } if ( mbClipRegion ) diff --git a/vcl/source/gdi/outdev3.cxx b/vcl/source/gdi/outdev3.cxx index 5bb7b0d9afcf..4a682c4cecc9 100644 --- a/vcl/source/gdi/outdev3.cxx +++ b/vcl/source/gdi/outdev3.cxx @@ -118,9 +118,6 @@ using namespace ::vcl; // ======================================================================= -//#ifdef USE_NEW_RTL_IMPLEMENTATION - - static void ImplRotatePos( long nOriginX, long nOriginY, long& rX, long& rY, int nOrientation ) { @@ -4105,7 +4102,7 @@ void OutputDevice::ImplDrawTextLine( long nBaseX, BOOL bNormalLines = TRUE; // TODO: fix rotated text - if( ImplHasMirroredGraphics() && IsRTLEnabled() ) + if( IsRTLEnabled() ) // --- RTL --- mirror at basex nX = nBaseX - nWidth - (nX - nBaseX - 1); @@ -4576,7 +4573,7 @@ void OutputDevice::ImplDrawTextLines( SalLayout& rSalLayout, void OutputDevice::ImplDrawMnemonicLine( long nX, long nY, long nWidth ) { long nBaseX = nX; - if( ImplHasMirroredGraphics() && IsRTLEnabled() ) + if( /*ImplHasMirroredGraphics() &&*/ IsRTLEnabled() ) { // --- RTL --- // add some strange offset @@ -4752,7 +4749,7 @@ void OutputDevice::ImplDrawEmphasisMark( long nBaseX, long nX, long nY, // TODO: pass nWidth as width of this mark long nWidth = 0; - if( ImplHasMirroredGraphics() && IsRTLEnabled() ) + if( IsRTLEnabled() ) // --- RTL --- mirror at basex nX = nBaseX - nWidth - (nX - nBaseX - 1); @@ -4970,16 +4967,20 @@ void OutputDevice::ImplDrawTextDirect( SalLayout& rSalLayout, BOOL bTextLines ) if( !IsRTLEnabled() ) { OutputDevice *pOutDevRef = (OutputDevice *)this; -#ifdef USE_NEW_RTL_IMPLEMENTATION - if( meOutDevType == OUTDEV_WINDOW ) - pOutDevRef = (OutputDevice*) ((Window *) this)->mpDummy4; -#endif - // mirror this window back long devX = w-pOutDevRef->mnOutWidth-pOutDevRef->mnOutOffX; // re-mirrored mnOutOffX rSalLayout.DrawBase().X() = devX + ( pOutDevRef->mnOutWidth - 1 - (rSalLayout.DrawBase().X() - devX) ) ; } } + else if( IsRTLEnabled() ) + { + //long w = meOutDevType == OUTDEV_VIRDEV ? mnOutWidth : mpGraphics->GetGraphicsWidth(); + //long x = rSalLayout.DrawBase().X(); + OutputDevice *pOutDevRef = (OutputDevice *)this; + // mirror this window back + long devX = pOutDevRef->mnOutOffX; // re-mirrored mnOutOffX + rSalLayout.DrawBase().X() = pOutDevRef->mnOutWidth - 1 - (rSalLayout.DrawBase().X() - devX) + devX; + } rSalLayout.DrawText( *mpGraphics ); } @@ -6067,7 +6068,7 @@ bool OutputDevice::GetCaretPositions( const XubString& rStr, sal_Int32* pCaretXA } // handle window mirroring - if( ((OutputDevice*)this)->ImplHasMirroredGraphics() && IsRTLEnabled() ) + if( IsRTLEnabled() ) { for( i = 0; i < 2 * nLen; ++i ) pCaretXArray[i] = nWidth - pCaretXArray[i] - 1; @@ -6213,7 +6214,7 @@ ImplLayoutArgs OutputDevice::ImplPrepareLayoutArgs( String& rStr, // SSA: hack for western office, ie text get right aligned // for debugging purposes of mirrored UI //static const char* pEnv = getenv( "SAL_RTL_MIRRORTEXT" ); - bool bRTLWindow = (((OutputDevice*)this)->ImplHasMirroredGraphics() && IsRTLEnabled()); + bool bRTLWindow = IsRTLEnabled(); bRightAlign ^= bRTLWindow; if( bRightAlign ) nLayoutFlags |= SAL_LAYOUT_RIGHT_ALIGN; diff --git a/vcl/source/gdi/salgdilayout.cxx b/vcl/source/gdi/salgdilayout.cxx index 0c266079c277..339cc875256f 100644 --- a/vcl/source/gdi/salgdilayout.cxx +++ b/vcl/source/gdi/salgdilayout.cxx @@ -59,8 +59,6 @@ #include <vcl/sallayout.hxx> #include "basegfx/polygon/b2dpolygon.hxx" -//#define USE_NEW_RTL_IMPLEMENTATION - // ---------------------------------------------------------------------------- // The only common SalFrame method // ---------------------------------------------------------------------------- @@ -114,22 +112,28 @@ void SalGraphics::mirror( long& x, const OutputDevice *pOutDev, bool bBack ) con if( w ) { - if( pOutDev && !pOutDev->IsRTLEnabled() ) + if( pOutDev && pOutDev->ImplIsAntiparallel() ) { OutputDevice *pOutDevRef = (OutputDevice*) pOutDev; -#ifdef USE_NEW_RTL_IMPLEMENTATION - if( pOutDev->meOutDevType == OUTDEV_WINDOW ) - pOutDevRef = (OutputDevice*) ((Window *) pOutDev)->mpDummy4; // top of non-mirroring hierarchy -#endif - // mirror this window back - long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX - if( bBack ) - x = x - devX + pOutDevRef->GetOutOffXPixel(); + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + { + long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX + if( bBack ) + x = x - devX + pOutDevRef->GetOutOffXPixel(); + else + x = devX + (x - pOutDevRef->GetOutOffXPixel()); + } else - x = devX + (x - pOutDevRef->GetOutOffXPixel()); + { + long devX = pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX + if( bBack ) + x = x - pOutDevRef->GetOutputWidthPixel() + devX - pOutDevRef->GetOutOffXPixel() + 1; + else + x = pOutDevRef->GetOutputWidthPixel() - (x - devX) + pOutDevRef->GetOutOffXPixel() - 1; + } } - else + else if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) x = w-1-x; } } @@ -144,22 +148,28 @@ void SalGraphics::mirror( long& x, long& nWidth, const OutputDevice *pOutDev, bo if( w ) { - if( pOutDev && !pOutDev->IsRTLEnabled() ) + if( pOutDev && pOutDev->ImplIsAntiparallel() ) { OutputDevice *pOutDevRef = (OutputDevice*) pOutDev; -#ifdef USE_NEW_RTL_IMPLEMENTATION - if( pOutDev->meOutDevType == OUTDEV_WINDOW ) - pOutDevRef = (OutputDevice*) ((Window *) pOutDev)->mpDummy4; // top of non-mirroring hierarchy -#endif - // mirror this window back - long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX - if( bBack ) - x = x - devX + pOutDevRef->GetOutOffXPixel(); + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + { + long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX + if( bBack ) + x = x - devX + pOutDevRef->GetOutOffXPixel(); + else + x = devX + (x - pOutDevRef->GetOutOffXPixel()); + } else - x = devX + (x - pOutDevRef->GetOutOffXPixel()); + { + long devX = pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX + if( bBack ) + x = x - pOutDevRef->GetOutputWidthPixel() + devX - pOutDevRef->GetOutOffXPixel() + nWidth; + else + x = pOutDevRef->GetOutputWidthPixel() - (x - devX) + pOutDevRef->GetOutOffXPixel() - nWidth; + } } - else + else if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) x = w-nWidth-x; } @@ -177,38 +187,60 @@ BOOL SalGraphics::mirror( sal_uInt32 nPoints, const SalPoint *pPtAry, SalPoint * { sal_uInt32 i, j; - if( pOutDev && !pOutDev->IsRTLEnabled() ) + if( pOutDev && pOutDev->ImplIsAntiparallel() ) { OutputDevice *pOutDevRef = (OutputDevice*) pOutDev; -#ifdef USE_NEW_RTL_IMPLEMENTATION - if( pOutDev->meOutDevType == OUTDEV_WINDOW ) - pOutDevRef = (OutputDevice*) ((Window *) pOutDev)->mpDummy4; // top of non-mirroring hierarchy -#endif - // mirror this window back - long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX - if( bBack ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) { - for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) + long devX = w-pOutDevRef->GetOutputWidthPixel()-pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX + if( bBack ) { - //long x = w-1-pPtAry[i].mnX; - //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); - pPtAry2[j].mnX = pOutDevRef->GetOutOffXPixel() + (pPtAry[i].mnX - devX); - pPtAry2[j].mnY = pPtAry[i].mnY; + for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) + { + //long x = w-1-pPtAry[i].mnX; + //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); + pPtAry2[j].mnX = pOutDevRef->GetOutOffXPixel() + (pPtAry[i].mnX - devX); + pPtAry2[j].mnY = pPtAry[i].mnY; + } + } + else + { + for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) + { + //long x = w-1-pPtAry[i].mnX; + //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); + pPtAry2[j].mnX = devX + (pPtAry[i].mnX - pOutDevRef->GetOutOffXPixel()); + pPtAry2[j].mnY = pPtAry[i].mnY; + } } } else { - for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) + long devX = pOutDevRef->GetOutOffXPixel(); // re-mirrored mnOutOffX + if( bBack ) + { + for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) + { + //long x = w-1-pPtAry[i].mnX; + //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); + pPtAry2[j].mnX = pPtAry[i].mnX - pOutDevRef->GetOutputWidthPixel() + devX - pOutDevRef->GetOutOffXPixel() + 1; + pPtAry2[j].mnY = pPtAry[i].mnY; + } + } + else { - //long x = w-1-pPtAry[i].mnX; - //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); - pPtAry2[j].mnX = devX + (pPtAry[i].mnX - pOutDevRef->GetOutOffXPixel()); - pPtAry2[j].mnY = pPtAry[i].mnY; + for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) + { + //long x = w-1-pPtAry[i].mnX; + //pPtAry2[j].mnX = devX + ( pOutDevRef->mnOutWidth - 1 - (x - devX) ); + pPtAry2[j].mnX = pOutDevRef->GetOutputWidthPixel() - (pPtAry[i].mnX - devX) + pOutDevRef->GetOutOffXPixel() - 1; + pPtAry2[j].mnY = pPtAry[i].mnY; + } } } } - else + else if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) { for( i=0, j=nPoints-1; i<nPoints; i++,j-- ) { @@ -331,7 +363,7 @@ basegfx::B2DPolyPolygon SalGraphics::mirror( const basegfx::B2DPolyPolygon& i_rP BOOL SalGraphics::UnionClipRegion( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); return unionClipRegion( nX, nY, nWidth, nHeight ); } @@ -349,19 +381,19 @@ BOOL SalGraphics::UnionClipRegion( const ::basegfx::B2DPolyPolygon& rPoly, const void SalGraphics::DrawPixel( long nX, long nY, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, pOutDev ); drawPixel( nX, nY ); } void SalGraphics::DrawPixel( long nX, long nY, SalColor nSalColor, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, pOutDev ); drawPixel( nX, nY, nSalColor ); } void SalGraphics::DrawLine( long nX1, long nY1, long nX2, long nY2, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { mirror( nX1, pOutDev ); mirror( nX2, pOutDev ); @@ -370,7 +402,7 @@ void SalGraphics::DrawLine( long nX1, long nY1, long nX2, long nY2, const Out } void SalGraphics::DrawRect( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); drawRect( nX, nY, nWidth, nHeight ); } @@ -384,7 +416,7 @@ bool SalGraphics::drawPolyLine( void SalGraphics::DrawPolyLine( ULONG nPoints, const SalPoint* pPtAry, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalPoint* pPtAry2 = new SalPoint[nPoints]; BOOL bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); @@ -397,7 +429,7 @@ void SalGraphics::DrawPolyLine( ULONG nPoints, const SalPoint* pPtAry, const Out void SalGraphics::DrawPolygon( ULONG nPoints, const SalPoint* pPtAry, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalPoint* pPtAry2 = new SalPoint[nPoints]; BOOL bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); @@ -410,7 +442,7 @@ void SalGraphics::DrawPolygon( ULONG nPoints, const SalPoint* pPtAry, const Outp void SalGraphics::DrawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { // TODO: optimize, reduce new/delete calls SalPoint **pPtAry2 = new SalPoint*[nPoly]; @@ -527,7 +559,7 @@ void SalGraphics::CopyArea( long nDestX, long nDestY, long nSrcWidth, long nSrcHeight, USHORT nFlags, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { mirror( nDestX, nSrcWidth, pOutDev ); mirror( nSrcX, nSrcWidth, pOutDev ); @@ -537,13 +569,13 @@ void SalGraphics::CopyArea( long nDestX, long nDestY, void SalGraphics::CopyBits( const SalTwoRect* pPosAry, SalGraphics* pSrcGraphics, const OutputDevice *pOutDev, const OutputDevice *pSrcOutDev ) { - if( ( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) || - (pSrcGraphics && (pSrcGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) ) ) + if( ( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) || + (pSrcGraphics && ( (pSrcGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) || (pSrcOutDev && pSrcOutDev->IsRTLEnabled()) ) ) ) { SalTwoRect pPosAry2 = *pPosAry; - if( pSrcGraphics && (pSrcGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) ) + if( pSrcGraphics && (pSrcGraphics->GetLayout() & SAL_LAYOUT_BIDI_RTL) || (pSrcOutDev && pSrcOutDev->IsRTLEnabled()) ) mirror( pPosAry2.mnSrcX, pPosAry2.mnSrcWidth, pSrcOutDev ); - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); copyBits( &pPosAry2, pSrcGraphics ); } @@ -553,7 +585,7 @@ void SalGraphics::CopyBits( const SalTwoRect* pPosAry, void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect pPosAry2 = *pPosAry; mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); @@ -566,7 +598,7 @@ void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap, SalColor nTransparentColor, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect pPosAry2 = *pPosAry; mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); @@ -579,7 +611,7 @@ void SalGraphics::DrawBitmap( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap, const SalBitmap& rTransparentBitmap, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect pPosAry2 = *pPosAry; mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); @@ -592,7 +624,7 @@ void SalGraphics::DrawMask( const SalTwoRect* pPosAry, const SalBitmap& rSalBitmap, SalColor nMaskColor, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect pPosAry2 = *pPosAry; mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); @@ -603,25 +635,25 @@ void SalGraphics::DrawMask( const SalTwoRect* pPosAry, } SalBitmap* SalGraphics::GetBitmap( long nX, long nY, long nWidth, long nHeight, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); return getBitmap( nX, nY, nWidth, nHeight ); } SalColor SalGraphics::GetPixel( long nX, long nY, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, pOutDev ); return getPixel( nX, nY ); } void SalGraphics::Invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); invert( nX, nY, nWidth, nHeight, nFlags ); } void SalGraphics::Invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nFlags, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalPoint* pPtAry2 = new SalPoint[nPoints]; BOOL bCopied = mirror( nPoints, pPtAry, pPtAry2, pOutDev ); @@ -634,7 +666,7 @@ void SalGraphics::Invert( ULONG nPoints, const SalPoint* pPtAry, SalInvert nF BOOL SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, ULONG nSize, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); return drawEPS( nX, nY, nWidth, nHeight, pPtr, nSize ); } @@ -642,7 +674,7 @@ BOOL SalGraphics::DrawEPS( long nX, long nY, long nWidth, long nHeight, void* BOOL SalGraphics::HitTestNativeControl( ControlType nType, ControlPart nPart, const Region& rControlRegion, const Point& aPos, SalControlHandle& rControlHandle, BOOL& rIsInside, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { Point pt( aPos ); Region rgn( rControlRegion ); @@ -690,7 +722,7 @@ BOOL SalGraphics::DrawNativeControl( ControlType nType, ControlPart nPart, const ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& aCaption, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { Region rgn( rControlRegion ); mirror( rgn, pOutDev ); @@ -707,7 +739,7 @@ BOOL SalGraphics::DrawNativeControlText( ControlType nType, ControlPart nPart, c ControlState nState, const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& aCaption, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { Region rgn( rControlRegion ); mirror( rgn, pOutDev ); @@ -724,7 +756,7 @@ BOOL SalGraphics::GetNativeControlRegion( ControlType nType, ControlPart nPart, const ImplControlValue& aValue, SalControlHandle& rControlHandle, const OUString& aCaption, Region &rNativeBoundingRegion, Region &rNativeContentRegion, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { Region rgn( rControlRegion ); mirror( rgn, pOutDev ); @@ -753,7 +785,7 @@ bool SalGraphics::DrawAlphaBitmap( const SalTwoRect& rPosAry, const SalBitmap& rAlphaBitmap, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) { SalTwoRect pPosAry2 = rPosAry; mirror( pPosAry2.mnDestX, pPosAry2.mnDestWidth, pOutDev ); @@ -766,7 +798,7 @@ bool SalGraphics::DrawAlphaBitmap( const SalTwoRect& rPosAry, bool SalGraphics::DrawAlphaRect( long nX, long nY, long nWidth, long nHeight, sal_uInt8 nTransparency, const OutputDevice *pOutDev ) { - if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) ) + if( (m_nLayout & SAL_LAYOUT_BIDI_RTL) || (pOutDev && pOutDev->IsRTLEnabled()) ) mirror( nX, nWidth, pOutDev ); return drawAlphaRect( nX, nY, nWidth, nHeight, nTransparency ); diff --git a/vcl/source/window/dndevdis.cxx b/vcl/source/window/dndevdis.cxx index 168c20fc5188..3b317ab18cae 100644 --- a/vcl/source/window/dndevdis.cxx +++ b/vcl/source/window/dndevdis.cxx @@ -89,7 +89,7 @@ void SAL_CALL DNDEventDispatcher::drop( const DropTargetDropEvent& dtde ) while( pChildWindow->ImplGetClientWindow() ) pChildWindow = pChildWindow->ImplGetClientWindow(); - if( pChildWindow->ImplHasMirroredGraphics() && !pChildWindow->IsRTLEnabled() ) + if( pChildWindow->ImplIsAntiparallel() ) pChildWindow->ImplReMirror( location ); aSolarGuard.clear(); @@ -145,7 +145,7 @@ void SAL_CALL DNDEventDispatcher::dragEnter( const DropTargetDragEnterEvent& dtd while( pChildWindow->ImplGetClientWindow() ) pChildWindow = pChildWindow->ImplGetClientWindow(); - if( pChildWindow->ImplHasMirroredGraphics() && !pChildWindow->IsRTLEnabled() ) + if( pChildWindow->ImplIsAntiparallel() ) pChildWindow->ImplReMirror( location ); aSolarGuard.clear(); @@ -208,7 +208,7 @@ void SAL_CALL DNDEventDispatcher::dragOver( const DropTargetDragEvent& dtde ) while( pChildWindow->ImplGetClientWindow() ) pChildWindow = pChildWindow->ImplGetClientWindow(); - if( pChildWindow->ImplHasMirroredGraphics() && !pChildWindow->IsRTLEnabled() ) + if( pChildWindow->ImplIsAntiparallel() ) pChildWindow->ImplReMirror( location ); aSolarGuard.clear(); @@ -266,7 +266,7 @@ void SAL_CALL DNDEventDispatcher::dropActionChanged( const DropTargetDragEvent& while( pChildWindow->ImplGetClientWindow() ) pChildWindow = pChildWindow->ImplGetClientWindow(); - if( pChildWindow->ImplHasMirroredGraphics() && !pChildWindow->IsRTLEnabled() ) + if( pChildWindow->ImplIsAntiparallel() ) pChildWindow->ImplReMirror( location ); aSolarGuard.clear(); @@ -323,7 +323,7 @@ void SAL_CALL DNDEventDispatcher::dragGestureRecognized( const DragGestureEvent& while( pChildWindow->ImplGetClientWindow() ) pChildWindow = pChildWindow->ImplGetClientWindow(); - if( pChildWindow->ImplHasMirroredGraphics() && !pChildWindow->IsRTLEnabled() ) + if( pChildWindow->ImplIsAntiparallel() ) pChildWindow->ImplReMirror( origin ); aSolarGuard.clear(); diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx index a493fd427baa..cb8e5655c0c6 100644 --- a/vcl/source/window/window.cxx +++ b/vcl/source/window/window.cxx @@ -709,7 +709,7 @@ void Window::ImplInitWindowData( WindowType nType ) mpWindowImpl->mbDisableAccessibleLabelForRelation = FALSE; // TRUE: do not set LabelFor relation on accessible objects mpWindowImpl->mbDisableAccessibleLabeledByRelation = FALSE; // TRUE: do not set LabeledBy relation on accessible objects - mbEnableRTL = TRUE; // TRUE: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active + mbEnableRTL = Application::GetSettings().GetLayoutRTL(); // TRUE: this outdev will be mirrored if RTL window layout (UI mirroring) is globally active } // ----------------------------------------------------------------------- @@ -774,6 +774,9 @@ void Window::ImplInit( Window* pParent, WinBits nStyle, SystemParentData* pSyste mpWindowImpl->mpOverlapData->mnTopLevel = 1; } + if( pParent && ! mpWindowImpl->mbFrame ) + mbEnableRTL = pParent->mbEnableRTL; + // test for frame creation if ( mpWindowImpl->mbFrame ) { @@ -1388,7 +1391,7 @@ Window* Window::ImplFindWindow( const Point& rFramePos ) USHORT Window::ImplHitTest( const Point& rFramePos ) { Point aFramePos( rFramePos ); - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { // - RTL - re-mirror frame pos at this window ImplReMirror( aFramePos ); @@ -2401,7 +2404,7 @@ void Window::ImplCallPaint( const Region* pRegion, USHORT nPaintFlags ) Rectangle aPaintRect = aPaintRegion.GetBoundRect(); // - RTL - re-mirror paint rect and region at this window - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { ImplReMirror( aPaintRect ); ImplReMirror( aPaintRegion ); @@ -2675,7 +2678,7 @@ void Window::ImplInvalidate( const Region* pRegion, USHORT nFlags ) if ( pRegion ) { // --- RTL --- remirror region before intersecting it - if ( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if ( ImplIsAntiparallel() ) { Region aRgn( *pRegion ); ImplReMirror( aRgn ); @@ -2896,7 +2899,7 @@ void Window::ImplScroll( const Rectangle& rRect, bScrollChilds = FALSE; // --- RTL --- check if this window requires special action - BOOL bReMirror = ( ImplHasMirroredGraphics() && !IsRTLEnabled() ); + BOOL bReMirror = ( ImplIsAntiparallel() ); Rectangle aRectMirror( rRect ); if( bReMirror ) @@ -3268,12 +3271,21 @@ void Window::ImplPosSizeWindow( long nX, long nY, // #106948# always mirror our pos if our parent is not mirroring, even // if we are also not mirroring // --- RTL --- check if parent is in different coordinates - if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplHasMirroredGraphics() && !mpWindowImpl->mpParent->IsRTLEnabled() ) + if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() ) + { + // --- RTL --- (re-mirror at parent window) + nX = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - nX; + } + } + else if( !bnXRecycled && mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() ) + { + // mirrored window in LTR UI { // --- RTL --- (re-mirror at parent window) nX = mpWindowImpl->mpParent->mnOutWidth - mnOutWidth - nX; } } + // check maPos as well, as it could have been changed for client windows (ImplCallMove()) if ( mpWindowImpl->mnAbsScreenX != aPtDev.X() || nX != mpWindowImpl->mnX || nOrgX != mpWindowImpl->maPos.X() ) { @@ -6132,7 +6144,7 @@ Region Window::GetWindowClipRegionPixel( USHORT nFlags ) const Region* pWinChildClipRegion = ((Window*)this)->ImplGetWinChildClipRegion(); aWinClipRegion = *pWinChildClipRegion; // --- RTL --- remirror clip region before passing it to somebody - if( ((Window*)this)->ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) ImplReMirror( aWinClipRegion ); } @@ -6180,7 +6192,7 @@ void Window::ExpandPaintClipRegion( const Region& rRegion ) Region aWinChildRegion = *ImplGetWinChildClipRegion(); // --- RTL -- only this region is in frame coordinates, so re-mirror it - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) ImplReMirror( aWinChildRegion ); aDevPixRegion.Intersect( aWinChildRegion ); if( ! aDevPixRegion.IsEmpty() ) @@ -7202,7 +7214,7 @@ void Window::SetPosSizePixel( long nX, long nY, Window* pParent = pWindow->GetParent(); nX += pParent->mnOutOffX; } - if( GetParent() && GetParent()->ImplHasMirroredGraphics() && !GetParent()->IsRTLEnabled() ) + if( GetParent() && GetParent()->ImplIsAntiparallel() ) { // --- RTL --- (re-mirror at parent window) Rectangle aRect( Point ( nX, nY ), Size( nWidth, nHeight ) ); @@ -7324,7 +7336,7 @@ long Window::ImplGetUnmirroredOutOffX() long offx = mnOutOffX; if( ImplHasMirroredGraphics() ) { - if( mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplHasMirroredGraphics() && !mpWindowImpl->mpParent->IsRTLEnabled() ) + if( mpWindowImpl->mpParent && !mpWindowImpl->mpParent->mpWindowImpl->mbFrame && mpWindowImpl->mpParent->ImplIsAntiparallel() ) { if ( !ImplIsOverlapWindow() ) offx -= mpWindowImpl->mpParent->mnOutOffX; @@ -7857,6 +7869,10 @@ void Window::SetPointerPosPixel( const Point& rPos ) // mirroring is required here, SetPointerPos bypasses SalGraphics mpGraphics->mirror( aPos.X(), this ); } + else if( ImplIsAntiparallel() ) + { + ImplReMirror( aPos ); + } mpWindowImpl->mpFrame->SetPointerPos( aPos.X(), aPos.Y() ); } @@ -7867,7 +7883,7 @@ Point Window::GetPointerPosPixel() DBG_CHKTHIS( Window, ImplDbgCheckWindow ); Point aPos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY ); - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { // --- RTL --- (re-mirror mouse pos at this window) ImplReMirror( aPos ); @@ -7882,13 +7898,11 @@ Point Window::GetLastPointerPosPixel() DBG_CHKTHIS( Window, ImplDbgCheckWindow ); Point aPos( mpWindowImpl->mpFrameData->mnBeforeLastMouseX, mpWindowImpl->mpFrameData->mnBeforeLastMouseY ); -#ifndef REMOTE_APPSERVER - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { // --- RTL --- (re-mirror mouse pos at this window) ImplReMirror( aPos ); } -#endif return ImplFrameToOutput( aPos ); } @@ -7920,7 +7934,7 @@ Window::PointerState Window::GetPointerState() SalFrame::SalPointerState aSalPointerState; aSalPointerState = mpWindowImpl->mpFrame->GetPointerState(); - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { // --- RTL --- (re-mirror mouse pos at this window) ImplReMirror( aSalPointerState.maPos ); @@ -9688,7 +9702,7 @@ Reference< ::com::sun::star::rendering::XSpriteCanvas > Window::GetFullscreenSpr return xSpriteCanvas; } -void Window::ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev, const Region* pOuterClip ) +void Window::ImplPaintToDevice( OutputDevice* i_pTargetOutDev, const Point& i_rPos ) { BOOL bRVisible = mpWindowImpl->mbReallyVisible; mpWindowImpl->mbReallyVisible = mpWindowImpl->mbVisible; @@ -9697,8 +9711,8 @@ void Window::ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev long nOldDPIX = ImplGetDPIX(); long nOldDPIY = ImplGetDPIY(); - mnDPIX = pTargetOutDev->ImplGetDPIX(); - mnDPIY = pTargetOutDev->ImplGetDPIY(); + mnDPIX = i_pTargetOutDev->ImplGetDPIX(); + mnDPIY = i_pTargetOutDev->ImplGetDPIY(); BOOL bOutput = IsOutputEnabled(); EnableOutput(); @@ -9710,8 +9724,8 @@ void Window::ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev SetClipRegion(); GDIMetaFile* pOldMtf = GetConnectMetaFile(); - pMtf->WindEnd(); - SetConnectMetaFile( pMtf ); + GDIMetaFile aMtf; + SetConnectMetaFile( &aMtf ); // put a push action to metafile Push(); @@ -9750,8 +9764,6 @@ void Window::ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev SetDigitLanguage( GetDigitLanguage() ); Rectangle aPaintRect( Point( 0, 0 ), GetOutputSizePixel() ); aClipRegion.Intersect( aPaintRect ); - if( pOuterClip ) - aClipRegion.Intersect( *pOuterClip ); SetClipRegion( aClipRegion ); // do the actual paint @@ -9768,37 +9780,30 @@ void Window::ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev EnableOutput( bOutput ); mpWindowImpl->mbReallyVisible = bRVisible; + // paint metafile to VDev + VirtualDevice* pMaskedDevice = new VirtualDevice( *i_pTargetOutDev, 0, 0 ); + pMaskedDevice->SetOutputSizePixel( GetOutputSizePixel() ); + pMaskedDevice->EnableRTL( IsRTLEnabled() ); + aMtf.WindStart(); + aMtf.Play( pMaskedDevice ); + BitmapEx aBmpEx( pMaskedDevice->GetBitmapEx( Point( 0, 0 ), pMaskedDevice->GetOutputSizePixel() ) ); + i_pTargetOutDev->DrawBitmapEx( i_rPos, aBmpEx ); + // get rid of virtual device now so they don't pile up during recursive calls + delete pMaskedDevice, pMaskedDevice = NULL; + + for( Window* pChild = mpWindowImpl->mpFirstChild; pChild; pChild = pChild->mpWindowImpl->mpNext ) { if( pChild->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame && pChild->IsVisible() ) { - Region aClip( aPaintRect ); - if( pOuterClip ) - aClip.Intersect( *pOuterClip ); - sal_Int32 nDeltaX = GetOutOffXPixel() - pChild->GetOutOffXPixel(); - sal_Int32 nDeltaY = GetOutOffYPixel() - pChild->GetOutOffYPixel(); - pMtf->Move( nDeltaX, nDeltaY ); - aClip.Move( nDeltaX, nDeltaY ); - pChild->ImplPaintToMetaFile( pMtf, pTargetOutDev, &aClip ); - pMtf->Move( -nDeltaX, -nDeltaY ); - } - } - - for( Window* pOverlap = mpWindowImpl->mpFirstOverlap; pOverlap; pOverlap = pOverlap->mpWindowImpl->mpNext ) - { - if( pOverlap->mpWindowImpl->mpFrame == mpWindowImpl->mpFrame && pOverlap->IsVisible() ) - { - Region aClip; - sal_Int32 nDeltaX = GetOutOffXPixel() - pOverlap->GetOutOffXPixel(); - sal_Int32 nDeltaY = GetOutOffYPixel() - pOverlap->GetOutOffYPixel(); - pMtf->Move( nDeltaX, nDeltaY ); - if( pOuterClip ) - { - aClip = *pOuterClip; - aClip.Move( nDeltaX, nDeltaY ); - } - pOverlap->ImplPaintToMetaFile( pMtf, pTargetOutDev, pOuterClip ? &aClip : NULL ); - pMtf->Move( -nDeltaX, -nDeltaY ); + long nDeltaX = pChild->mnOutOffX - mnOutOffX; + if( ImplHasMirroredGraphics() ) + nDeltaX = mnOutWidth - nDeltaX - pChild->mnOutWidth; + long nDeltaY = pChild->GetOutOffYPixel() - GetOutOffYPixel(); + Point aPos( i_rPos ); + Point aDelta( nDeltaX, nDeltaY ); + aPos += aDelta; + pChild->ImplPaintToDevice( i_pTargetOutDev, aPos ); } } @@ -9815,7 +9820,11 @@ void Window::ImplPaintToMetaFile( GDIMetaFile* pMtf, OutputDevice* pTargetOutDev void Window::PaintToDevice( OutputDevice* pDev, const Point& rPos, const Size& /*rSize*/ ) { // FIXME: scaling: currently this is for pixel copying only - GDIMetaFile aMF; + + DBG_ASSERT( ! pDev->ImplHasMirroredGraphics(), "PaintToDevice to mirroring graphics" ); + DBG_ASSERT( ! pDev->IsRTLEnabled(), "PaintToDevice to mirroring device" ); + + Point aPos = pDev->LogicToPixel( rPos ); Window* pRealParent = NULL; @@ -9835,23 +9844,14 @@ void Window::PaintToDevice( OutputDevice* pDev, const Point& rPos, const Size& / mpWindowImpl->mbVisible = TRUE; if( mpWindowImpl->mpBorderWindow ) - mpWindowImpl->mpBorderWindow->ImplPaintToMetaFile( &aMF, pDev ); + mpWindowImpl->mpBorderWindow->ImplPaintToDevice( pDev, rPos ); else - ImplPaintToMetaFile( &aMF, pDev ); + ImplPaintToDevice( pDev, rPos ); mpWindowImpl->mbVisible = bVisible; if( pRealParent ) SetParent( pRealParent ); - - pDev->Push(); - pDev->SetMapMode(); - - aMF.Move( aPos.X(), aPos.Y() ); - aMF.WindStart(); - aMF.Play( pDev ); - - pDev->Pop(); } XubString Window::GetSurroundingText() const diff --git a/vcl/source/window/window2.cxx b/vcl/source/window/window2.cxx index 42389fc12e40..0595a7a9ab8a 100644 --- a/vcl/source/window/window2.cxx +++ b/vcl/source/window/window2.cxx @@ -68,8 +68,6 @@ DBG_NAMEEX( Window ) #define IMPL_MAXSAVEBACKSIZE (640*480) #define IMPL_MAXALLSAVEBACKSIZE (800*600*2) -//#define USE_NEW_RTL_IMPLEMENTATION - // ======================================================================= struct ImplFocusDelData : public ImplDelData @@ -690,15 +688,10 @@ IMPL_LINK( Window, ImplTrackTimerHdl, Timer*, pTimer ) // Tracking-Event erzeugen Point aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY ); - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { // - RTL - re-mirror frame pos at pChild -#ifdef USE_NEW_RTL_IMPLEMENTATION - Window *pRefWindow = (Window*) mpDummy4; - pRefWindow->ImplReMirror( aMousePos ); -#else ImplReMirror( aMousePos ); -#endif } MouseEvent aMEvt( ImplFrameToOutput( aMousePos ), mpWindowImpl->mpFrameData->mnClickCount, 0, @@ -768,15 +761,10 @@ void Window::EndTracking( USHORT nFlags ) if ( !(nFlags & ENDTRACK_DONTCALLHDL) ) { Point aMousePos( mpWindowImpl->mpFrameData->mnLastMouseX, mpWindowImpl->mpFrameData->mnLastMouseY ); - if( ImplHasMirroredGraphics() && !IsRTLEnabled() ) + if( ImplIsAntiparallel() ) { // - RTL - re-mirror frame pos at pChild -#ifdef USE_NEW_RTL_IMPLEMENTATION - Window *pRefWindow = (Window*) mpDummy4; - pRefWindow->ImplReMirror( aMousePos ); -#else ImplReMirror( aMousePos ); -#endif } MouseEvent aMEvt( ImplFrameToOutput( aMousePos ), diff --git a/vcl/source/window/winproc.cxx b/vcl/source/window/winproc.cxx index 56fcdee394d3..a8be05bf4909 100644 --- a/vcl/source/window/winproc.cxx +++ b/vcl/source/window/winproc.cxx @@ -80,9 +80,6 @@ extern void MyOutputDebugString( char *s); #endif -//#define USE_NEW_RTL_IMPLEMENTATION - - // ======================================================================= #define IMPL_MIN_NEEDSYSWIN 49 @@ -458,15 +455,10 @@ long ImplHandleMouseEvent( Window* pWindow, USHORT nSVEvent, BOOL bMouseLeave, // Ein paar Test ausfuehren und Message abfangen oder Status umsetzen if ( pChild ) { - if( pChild->ImplHasMirroredGraphics() && !pChild->IsRTLEnabled() ) + if( pChild->ImplIsAntiparallel() ) { // - RTL - re-mirror frame pos at pChild -#ifdef USE_NEW_RTL_IMPLEMENTATION - Window *pRefWindow = (Window*) pChild->mpDummy4; - pRefWindow->ImplReMirror( aMousePos ); -#else pChild->ImplReMirror( aMousePos ); -#endif } // no mouse messages to system object windows ? // !!!KA: Is it OK to comment this out? !!! |