diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2020-12-22 09:54:25 +1100 |
---|---|---|
committer | Mike Kaganski <mike.kaganski@collabora.com> | 2021-01-02 08:48:13 +0100 |
commit | 159d9c30c474c6525643d832a38e640cd442ac7c (patch) | |
tree | 6b3a9516c74ef133d9c084a53a9a61ac2137f8d2 /vcl/source | |
parent | 152b651cd023b7f411affce49ff160c99826abd5 (diff) |
tdf#74702 - vcl: introduce OutputDevice::CanEnableNativeWidget()
Change-Id: Idb43f57078702f64e9a80a2100b12fa0e6c3e155
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/108130
Tested-by: Jenkins
Reviewed-by: Mike Kaganski <mike.kaganski@collabora.com>
Diffstat (limited to 'vcl/source')
-rw-r--r-- | vcl/source/gdi/virdev.cxx | 20 | ||||
-rw-r--r-- | vcl/source/outdev/nativecontrols.cxx | 43 |
2 files changed, 19 insertions, 44 deletions
diff --git a/vcl/source/gdi/virdev.cxx b/vcl/source/gdi/virdev.cxx index 3d63cf90cd41..7a2102b0ad0c 100644 --- a/vcl/source/gdi/virdev.cxx +++ b/vcl/source/gdi/virdev.cxx @@ -17,18 +17,28 @@ * the License at http://www.apache.org/licenses/LICENSE-2.0 . */ +#include <sal/log.hxx> +#include <tools/debug.hxx> + +#include <vcl/pdfextoutdevdata.hxx> +#include <vcl/virdev.hxx> + +#include <outdev.h> +#include <PhysicalFontCollection.hxx> #include <salinst.hxx> #include <salgdi.hxx> #include <salvd.hxx> -#include <outdev.h> -#include <PhysicalFontCollection.hxx> #include <svdata.hxx> -#include <vcl/virdev.hxx> -#include <sal/log.hxx> -#include <tools/debug.hxx> using namespace ::com::sun::star::uno; +bool VirtualDevice::CanEnableNativeWidget() const +{ + const vcl::ExtOutDevData* pOutDevData(GetExtOutDevData()); + const vcl::PDFExtOutDevData* pPDFData(dynamic_cast<const vcl::PDFExtOutDevData*>(pOutDevData)); + return pPDFData == nullptr; +} + bool VirtualDevice::AcquireGraphics() const { DBG_TESTSOLARMUTEX(); diff --git a/vcl/source/outdev/nativecontrols.cxx b/vcl/source/outdev/nativecontrols.cxx index 85b0b58c45d1..4df8328dc921 100644 --- a/vcl/source/outdev/nativecontrols.cxx +++ b/vcl/source/outdev/nativecontrols.cxx @@ -29,41 +29,6 @@ #include <salgdi.hxx> -static bool EnableNativeWidget( const OutputDevice& i_rDevice ) -{ - const OutDevType eType( i_rDevice.GetOutDevType() ); - switch ( eType ) - { - - case OUTDEV_WINDOW: - { - const vcl::Window* pWindow = dynamic_cast< const vcl::Window* >( &i_rDevice ); - if (pWindow) - { - return pWindow->IsNativeWidgetEnabled(); - } - else - { - SAL_WARN ("vcl.gdi", "Could not cast i_rDevice to Window"); - assert (pWindow); - return false; - } - } - - case OUTDEV_PDF: - [[fallthrough]]; - case OUTDEV_VIRDEV: - { - const vcl::ExtOutDevData* pOutDevData( i_rDevice.GetExtOutDevData() ); - const vcl::PDFExtOutDevData* pPDFData( dynamic_cast< const vcl::PDFExtOutDevData* >( pOutDevData ) ); - return pPDFData == nullptr; - } - - default: - return false; - } -} - ImplControlValue::~ImplControlValue() { } @@ -167,7 +132,7 @@ PushButtonValue* PushButtonValue::clone() const bool OutputDevice::IsNativeControlSupported( ControlType nType, ControlPart nPart ) const { - if( !EnableNativeWidget( *this ) ) + if( !CanEnableNativeWidget() ) return false; if ( !mpGraphics && !AcquireGraphics() ) @@ -182,7 +147,7 @@ bool OutputDevice::HitTestNativeScrollbar( const Point& aPos, bool& rIsInside ) const { - if( !EnableNativeWidget( *this ) ) + if( !CanEnableNativeWidget() ) return false; if ( !mpGraphics && !AcquireGraphics() ) @@ -294,7 +259,7 @@ bool OutputDevice::DrawNativeControl( ControlType nType, { assert(!is_double_buffered_window()); - if( !EnableNativeWidget( *this ) ) + if( !CanEnableNativeWidget() ) return false; // make sure the current clip region is initialized correctly @@ -329,7 +294,7 @@ bool OutputDevice::GetNativeControlRegion( ControlType nType, tools::Rectangle &rNativeBoundingRegion, tools::Rectangle &rNativeContentRegion ) const { - if( !EnableNativeWidget( *this ) ) + if( !CanEnableNativeWidget() ) return false; if ( !mpGraphics && !AcquireGraphics() ) |