summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--include/vcl/outdev.hxx4
-rw-r--r--include/vcl/virdev.hxx2
-rw-r--r--include/vcl/window.hxx2
-rw-r--r--vcl/source/gdi/virdev.cxx20
-rw-r--r--vcl/source/outdev/nativecontrols.cxx43
5 files changed, 27 insertions, 44 deletions
diff --git a/include/vcl/outdev.hxx b/include/vcl/outdev.hxx
index 052b0afb3086..c0e0c8ec12f8 100644
--- a/include/vcl/outdev.hxx
+++ b/include/vcl/outdev.hxx
@@ -1963,6 +1963,10 @@ public:
public:
+ /** Determine if native widgets can be enabled
+ */
+ virtual bool CanEnableNativeWidget() const { return false; }
+
/** Query the platform layer for control support
*/
bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) const;
diff --git a/include/vcl/virdev.hxx b/include/vcl/virdev.hxx
index b13a2a0d9ef8..55a4a7f5ddcb 100644
--- a/include/vcl/virdev.hxx
+++ b/include/vcl/virdev.hxx
@@ -156,6 +156,8 @@ public:
virtual ~VirtualDevice() override;
virtual void dispose() override;
+ bool CanEnableNativeWidget() const override;
+
virtual void EnableRTL( bool bEnable = true ) override;
bool SetOutputSizePixel( const Size& rNewSize, bool bErase = true );
diff --git a/include/vcl/window.hxx b/include/vcl/window.hxx
index 99a1043bb3d3..650503484bc9 100644
--- a/include/vcl/window.hxx
+++ b/include/vcl/window.hxx
@@ -779,6 +779,8 @@ public:
::OutputDevice const* GetOutDev() const;
::OutputDevice* GetOutDev();
+ bool CanEnableNativeWidget() const override { return IsNativeWidgetEnabled(); }
+
Color GetBackgroundColor() const override;
size_t GetSyncCount() const override { return 0x000000ff; }
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() )