summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorChris Sherlock <chris.sherlock79@gmail.com>2014-03-23 18:51:13 +1100
committerChris Sherlock <chris.sherlock79@gmail.com>2014-03-25 12:17:01 +0000
commit977aae0cdec71577cbdc74baea228a5f267e7fd8 (patch)
tree6423514964bef1da9d829c91ba104e08ac68efa5 /vcl
parentb53ba68b6b4a070ec56d02aaacccc6f649ec9482 (diff)
fdo#74702 Moved EnableRTL() logic to specific classes where appropriate
OutputDevice::EnableRTL() is a bit of a mess. It uses a runtime variable to see if it is using a VirtualDevice, and it uses a dynamic_cast to see if the object is a Window or a Control! I have made it virtual and moved the knowledge of class specific functionality from OutputDevice to VirtualDevice, Window and Control as needed. OutputDevice::EnableRTL() functionality is then called. Also: small formatting change to outdev.hxx, also included a note that WindowImpl is a pimpl in window.hxx. Change-Id: I44b66601c4457fb2e0bbc1014fb7acf8f6942f80 Reviewed-on: https://gerrit.libreoffice.org/8721 Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com> Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/control/ctrl.cxx10
-rw-r--r--vcl/source/gdi/outdev.cxx17
-rw-r--r--vcl/source/gdi/virdev.cxx34
-rw-r--r--vcl/source/window/window.cxx19
4 files changed, 28 insertions, 52 deletions
diff --git a/vcl/source/control/ctrl.cxx b/vcl/source/control/ctrl.cxx
index 2fe5c0bd9a87..e1bfbca514f0 100644
--- a/vcl/source/control/ctrl.cxx
+++ b/vcl/source/control/ctrl.cxx
@@ -71,6 +71,16 @@ Control::~Control()
delete mpControlData, mpControlData = NULL;
}
+
+void Control::EnableRTL( bool bEnable )
+{
+ // convenience: for controls also switch layout mode
+ SetLayoutMode( bEnable ? TEXT_LAYOUT_BIDI_RTL | TEXT_LAYOUT_TEXTORIGIN_LEFT :
+ TEXT_LAYOUT_BIDI_LTR | TEXT_LAYOUT_TEXTORIGIN_LEFT );
+ StateChanged( STATE_CHANGE_MIRRORING );
+ OutputDevice::EnableRTL(bEnable);
+}
+
void Control::GetFocus()
{
Window::GetFocus();
diff --git a/vcl/source/gdi/outdev.cxx b/vcl/source/gdi/outdev.cxx
index 8518345772db..385ac40a2f8c 100644
--- a/vcl/source/gdi/outdev.cxx
+++ b/vcl/source/gdi/outdev.cxx
@@ -461,23 +461,6 @@ bool OutputDevice::supportsOperation( OutDevSupportType eType ) const
void OutputDevice::EnableRTL( bool bEnable )
{
mbEnableRTL = bEnable;
- if( meOutDevType == OUTDEV_VIRDEV )
- {
- // virdevs default to not mirroring, they will only be set to mirroring
- // 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( 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 );
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx
index 68789c805e90..aa3f35947785 100644
--- a/vcl/source/gdi/virdev.cxx
+++ b/vcl/source/gdi/virdev.cxx
@@ -200,8 +200,6 @@ void VirtualDevice::ImplInitVirDev( const OutputDevice* pOutDev,
pSVData->maGDIData.mpFirstVirDev = this;
}
-
-
VirtualDevice::VirtualDevice( sal_uInt16 nBitCount )
: mpVirDev( NULL ),
meRefDevMode( REFDEV_NONE )
@@ -213,8 +211,6 @@ VirtualDevice::VirtualDevice( sal_uInt16 nBitCount )
ImplInitVirDev( Application::GetDefaultDevice(), 1, 1, nBitCount );
}
-
-
VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount )
: mpVirDev( NULL ),
meRefDevMode( REFDEV_NONE )
@@ -226,8 +222,6 @@ VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount
ImplInitVirDev( &rCompDev, 1, 1, nBitCount );
}
-
-
VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount, sal_uInt16 nAlphaBitCount )
: mpVirDev( NULL ),
meRefDevMode( REFDEV_NONE )
@@ -243,8 +237,6 @@ VirtualDevice::VirtualDevice( const OutputDevice& rCompDev, sal_uInt16 nBitCount
mnAlphaDepth = sal::static_int_cast<sal_Int8>(nAlphaBitCount);
}
-
-
VirtualDevice::VirtualDevice( const SystemGraphicsData *pData, sal_uInt16 nBitCount )
: mpVirDev( NULL ),
meRefDevMode( REFDEV_NONE )
@@ -254,8 +246,6 @@ VirtualDevice::VirtualDevice( const SystemGraphicsData *pData, sal_uInt16 nBitCo
ImplInitVirDev( Application::GetDefaultDevice(), 1, 1, nBitCount, pData );
}
-
-
VirtualDevice::~VirtualDevice()
{
SAL_INFO( "vcl.gdi", "VirtualDevice::~VirtualDevice()" );
@@ -279,8 +269,6 @@ VirtualDevice::~VirtualDevice()
pSVData->maGDIData.mpLastVirDev = mpPrev;
}
-
-
bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bErase, const basebmp::RawMemorySharedArray &pBuffer )
{
SAL_INFO( "vcl.gdi",
@@ -381,8 +369,6 @@ bool VirtualDevice::InnerImplSetOutputSizePixel( const Size& rNewSize, bool bEra
return bRet;
}
-
-
// #i32109#: Fill opaque areas correctly (without relying on
// fill/linecolor state)
void VirtualDevice::ImplFillOpaqueRectangle( const Rectangle& rRect )
@@ -397,8 +383,6 @@ void VirtualDevice::ImplFillOpaqueRectangle( const Rectangle& rRect )
Pop();
}
-
-
bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, const basebmp::RawMemorySharedArray &pBuffer )
{
if( InnerImplSetOutputSizePixel(rNewSize, bErase, pBuffer) )
@@ -434,6 +418,18 @@ bool VirtualDevice::ImplSetOutputSizePixel( const Size& rNewSize, bool bErase, c
return false;
}
+void VirtualDevice::EnableRTL( bool bEnable )
+{
+ // virdevs default to not mirroring, they will only be set to mirroring
+ // 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( ImplGetGraphics() )
+ mpGraphics->SetLayout( bEnable ? SAL_LAYOUT_BIDI_RTL : 0 );
+
+ OutputDevice::EnableRTL(bEnable);
+}
+
bool VirtualDevice::SetOutputSizePixel( const Size& rNewSize, bool bErase )
{
return ImplSetOutputSizePixel( rNewSize, bErase, basebmp::RawMemorySharedArray() );
@@ -451,8 +447,6 @@ bool VirtualDevice::SetOutputSizePixelScaleOffsetAndBuffer( const Size& rNewSize
return ImplSetOutputSizePixel( rNewSize, true, pBuffer);
}
-
-
void VirtualDevice::SetReferenceDevice( RefDevMode i_eRefDevMode )
{
sal_Int32 nDPIX = 600, nDPIY = 600;
@@ -533,13 +527,9 @@ void VirtualDevice::ImplSetReferenceDevice( RefDevMode i_eRefDevMode, sal_Int32
mpFontCache = new ImplFontCache();
}
-
-
void VirtualDevice::Compat_ZeroExtleadBug()
{
meRefDevMode = (sal_uInt8)meRefDevMode | REFDEV_FORCE_ZERO_EXTLEAD;
}
-
-
/* vim:set shiftwidth=4 softtabstop=4 expandtab: */
diff --git a/vcl/source/window/window.cxx b/vcl/source/window/window.cxx
index abe769a3af65..6736c54995c4 100644
--- a/vcl/source/window/window.cxx
+++ b/vcl/source/window/window.cxx
@@ -106,11 +106,8 @@ using namespace ::com::sun::star::datatransfer::dnd;
using namespace ::com::sun::star;
using namespace com::sun;
-
using ::com::sun::star::awt::XTopWindow;
-
-
#define IMPL_PAINT_PAINT ((sal_uInt16)0x0001)
#define IMPL_PAINT_PAINTALL ((sal_uInt16)0x0002)
#define IMPL_PAINT_PAINTALLCHILDREN ((sal_uInt16)0x0004)
@@ -118,8 +115,6 @@ using ::com::sun::star::awt::XTopWindow;
#define IMPL_PAINT_ERASE ((sal_uInt16)0x0010)
#define IMPL_PAINT_CHECKRTL ((sal_uInt16)0x0020)
-
-
struct ImplCalcToTopData
{
ImplCalcToTopData* mpNext;
@@ -144,7 +139,6 @@ ImplAccessibleInfos::~ImplAccessibleInfos()
}
-
WindowImpl::WindowImpl( WindowType nType )
{
maZoom = Fraction( 1, 1 );
@@ -303,9 +297,6 @@ WindowImpl::~WindowImpl()
delete mpControlFont;
}
-
-
-
// helper method to allow inline constructor even for pWindow!=NULL case
void ImplDelData::AttachToWindow( const Window* pWindow )
{
@@ -313,8 +304,6 @@ void ImplDelData::AttachToWindow( const Window* pWindow )
const_cast<Window*>(pWindow)->ImplAddDel( this );
}
-
-
// define dtor for ImplDelData
ImplDelData::~ImplDelData()
{
@@ -328,8 +317,6 @@ ImplDelData::~ImplDelData()
}
}
-
-
#ifdef DBG_UTIL
const char* ImplDbgCheckWindow( const void* pObj )
{
@@ -420,6 +407,12 @@ bool Window::ImplInitGraphics() const
return mpGraphics ? true : false;
}
+void Window::EnableRTL ( bool bEnable )
+{
+ StateChanged( STATE_CHANGE_MIRRORING );
+ OutputDevice::EnableRTL(bEnable);
+}
+
void Window::CopyAreaFinal( SalTwoRect& aPosAry, sal_uInt32 nFlags )
{
if (aPosAry.mnSrcWidth == 0 || aPosAry.mnSrcHeight == 0 || aPosAry.mnDestWidth == 0 || aPosAry.mnDestHeight == 0)