diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-10-30 18:45:46 +0100 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2017-11-06 12:05:32 +0100 |
commit | 2ffb83daa4358aaad0cba7ddb67847282ac6fcce (patch) | |
tree | 2bf819492eb68134e8678e8138c983c57845e7e8 /vcl/unx | |
parent | bc00fcc0a05ce2fa9f0e01a291a6917c3630cfab (diff) |
QT5 rename from KF5
Move out of unx, as this will eventually compile on other
OS platforms. At least currently it doesn't contain platform
dependant code.
Change-Id: Iea0bebf574201881ea158381fe7ba8af2a9a6488
Diffstat (limited to 'vcl/unx')
27 files changed, 0 insertions, 3278 deletions
diff --git a/vcl/unx/kf5/Kf5Bitmap.cxx b/vcl/unx/kf5/Kf5Bitmap.cxx deleted file mode 100644 index d1e40ee39887..000000000000 --- a/vcl/unx/kf5/Kf5Bitmap.cxx +++ /dev/null @@ -1,265 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "Kf5Bitmap.hxx" -#include "Kf5Tools.hxx" -#include "Kf5Graphics.hxx" - -#include <QtGui/QImage> -#include <QtCore/QVector> -#include <QtGui/QColor> - -Kf5Bitmap::Kf5Bitmap() -{ -} - -Kf5Bitmap::Kf5Bitmap( const QImage &rImage ) -{ - m_pImage.reset( new QImage( rImage ) ); -} - -Kf5Bitmap::~Kf5Bitmap() -{ -} - -bool Kf5Bitmap::Create( const Size& rSize, sal_uInt16 nBitCount, - const BitmapPalette& rPal ) -{ - assert( - (nBitCount == 1 - || nBitCount == 4 - || nBitCount == 8 - || nBitCount == 16 - || nBitCount == 24 - || nBitCount == 32) - && "Unsupported BitCount!"); - - if ( nBitCount == 1 ) - assert( 2 == rPal.GetEntryCount() ); - if ( nBitCount == 4 ) - assert( 16 == rPal.GetEntryCount() ); - if ( nBitCount == 8 ) - assert( 256 == rPal.GetEntryCount() ); - - if ( nBitCount == 4 ) - { - m_pImage.reset(); - m_aSize = rSize; - m_nScanline = rSize.Width() / 2 + (rSize.Width() % 2) ? 0 : 1; - m_pBuffer.reset( new sal_uInt8[ m_nScanline * rSize.Height() ] ); - } - else - { - m_pImage.reset( new QImage( toQSize( rSize ), getBitFormat( nBitCount ) ) ); - m_pBuffer.reset(); - } - m_aPalette = rPal; - - auto count = rPal.GetEntryCount(); - if( nBitCount != 4 && count ) - { - QVector<QRgb> aColorTable( count ); - for ( unsigned i = 0; i < count; ++i ) - aColorTable[ i ] = qRgb( rPal[ i ].GetRed(), - rPal[ i ].GetGreen(), rPal[ i ].GetBlue() ); - m_pImage->setColorTable( aColorTable ); - } - return true; -} - -bool Kf5Bitmap::Create( const SalBitmap& rSalBmp ) -{ - const Kf5Bitmap *pBitmap = static_cast< const Kf5Bitmap*>( &rSalBmp ); - if ( pBitmap->m_pImage.get() ) - { - m_pImage.reset( new QImage( *pBitmap->m_pImage.get() ) ); - m_pBuffer.reset(); - } - else - { - m_aSize = pBitmap->m_aSize; - m_nScanline = pBitmap->m_nScanline; - m_pBuffer.reset( new sal_uInt8[ m_nScanline * m_aSize.Height() ] ); - memcpy( m_pBuffer.get(), pBitmap->m_pBuffer.get(), m_nScanline ); - m_pImage.reset(); - } - m_aPalette = pBitmap->m_aPalette; - return true; -} - -bool Kf5Bitmap::Create( const SalBitmap& rSalBmp, - SalGraphics* pSalGraphics ) -{ - const Kf5Bitmap *pBitmap = static_cast< const Kf5Bitmap *>( &rSalBmp ); - Kf5Graphics *pGraphics = static_cast< Kf5Graphics* >( pSalGraphics ); - QImage *pImage = pGraphics->m_pQImage; - m_pImage.reset( new QImage( pBitmap->m_pImage->convertToFormat( pImage->format() ) ) ); - m_pBuffer.reset(); - return true; -} - -bool Kf5Bitmap::Create( const SalBitmap& rSalBmp, - sal_uInt16 nNewBitCount ) -{ - assert( - (nNewBitCount == 1 - || nNewBitCount == 4 - || nNewBitCount == 8 - || nNewBitCount == 16 - || nNewBitCount == 24 - || nNewBitCount == 32) - && "Unsupported BitCount!"); - - const Kf5Bitmap *pBitmap = static_cast< const Kf5Bitmap *>( &rSalBmp ); - if ( pBitmap->m_pBuffer.get() ) - return false; - - m_pImage.reset( new QImage( pBitmap->m_pImage->convertToFormat( getBitFormat( nNewBitCount ) ) ) ); - return true; -} - -bool Kf5Bitmap::Create( const css::uno::Reference< css::rendering::XBitmapCanvas >& rBitmapCanvas, - Size& rSize, bool bMask ) -{ - return false; -} - -void Kf5Bitmap::Destroy() -{ - m_pImage.reset(); - m_pBuffer.reset(); -} - -Size Kf5Bitmap::GetSize() const -{ - if ( m_pBuffer.get() ) - return m_aSize; - else if ( m_pImage.get() ) - return toSize( m_pImage->size() ); - return Size(); -} - -sal_uInt16 Kf5Bitmap::GetBitCount() const -{ - if ( m_pBuffer.get() ) - return 4; - else if ( m_pImage.get() ) - return getFormatBits( m_pImage->format() ); - return 0; -} - -BitmapBuffer* Kf5Bitmap::AcquireBuffer( BitmapAccessMode nMode ) -{ - static const BitmapPalette aEmptyPalette; - - if ( !(m_pImage.get() || m_pBuffer.get()) ) - return nullptr; - - BitmapBuffer* pBuffer = new BitmapBuffer; - - if ( m_pBuffer.get() ) - { - pBuffer->mnWidth = m_aSize.Width(); - pBuffer->mnHeight = m_aSize.Height(); - pBuffer->mnBitCount = 4; - pBuffer->mpBits = m_pBuffer.get(); - pBuffer->mnScanlineSize = m_nScanline; - } - else - { - pBuffer->mnWidth = m_pImage->width(); - pBuffer->mnHeight = m_pImage->height(); - pBuffer->mnBitCount = getFormatBits( m_pImage->format() ); - pBuffer->mpBits = m_pImage->bits(); - pBuffer->mnScanlineSize = m_pImage->bytesPerLine(); - } - - switch( pBuffer->mnBitCount ) - { - case 1: - pBuffer->mnFormat = ScanlineFormat::N1BitLsbPal; - pBuffer->maPalette = m_aPalette; - break; - case 4: - pBuffer->mnFormat = ScanlineFormat::N4BitMsnPal; - pBuffer->maPalette = m_aPalette; - break; - case 8: - pBuffer->mnFormat = ScanlineFormat::N8BitPal; - pBuffer->maPalette = m_aPalette; - break; - case 16: - { -#ifdef OSL_BIGENDIAN - pBuffer->mnFormat= ScanlineFormat::N16BitTcMsbMask; -#else - pBuffer->mnFormat= ScanlineFormat::N16BitTcLsbMask; -#endif - ColorMaskElement aRedMask(0xf800); // 5 - aRedMask.CalcMaskShift(); - ColorMaskElement aGreenMask(0x07e0); // 6 - aGreenMask.CalcMaskShift(); - ColorMaskElement aBlueMask(0x001f); // 5 - aBlueMask.CalcMaskShift(); - pBuffer->maColorMask = ColorMask(aRedMask, aGreenMask, aBlueMask); - pBuffer->maPalette = aEmptyPalette; - break; - } - case 24: - pBuffer->mnFormat = ScanlineFormat::N24BitTcRgb; - pBuffer->maPalette = aEmptyPalette; - break; - case 32: - { - pBuffer->mnFormat = ScanlineFormat::N32BitTcArgb; - pBuffer->maPalette = aEmptyPalette; - break; - } - } - - return pBuffer; -} - -void Kf5Bitmap::ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) -{ - m_aPalette = pBuffer->maPalette; - delete pBuffer; -} - -bool Kf5Bitmap::GetSystemData( BitmapSystemData& rData ) -{ - return false; -} - -bool Kf5Bitmap::ScalingSupported() const -{ - return false; -} - -bool Kf5Bitmap::Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag ) -{ - return false; -} - -bool Kf5Bitmap::Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uLong nTol ) -{ - return false; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Bitmap.hxx b/vcl/unx/kf5/Kf5Bitmap.hxx deleted file mode 100644 index 2ea4accc8e9c..000000000000 --- a/vcl/unx/kf5/Kf5Bitmap.hxx +++ /dev/null @@ -1,69 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#pragma once - -#include <salbmp.hxx> - -#include <memory> - -class QImage; - -class VCL_DLLPUBLIC Kf5Bitmap : public SalBitmap -{ - std::unique_ptr< QImage > m_pImage; - BitmapPalette m_aPalette; - - // for 4bit support - std::unique_ptr< sal_uInt8 > m_pBuffer; - Size m_aSize; - sal_uInt32 m_nScanline; - -public: - Kf5Bitmap(); - Kf5Bitmap( const QImage& rQImage ); - virtual ~Kf5Bitmap() override; - - const QImage* GetQImage() const { return m_pImage.get(); } - - virtual bool Create( const Size& rSize, - sal_uInt16 nBitCount, - const BitmapPalette& rPal ) override; - virtual bool Create( const SalBitmap& rSalBmp ) override; - virtual bool Create( const SalBitmap& rSalBmp, - SalGraphics* pGraphics ) override; - virtual bool Create( const SalBitmap& rSalBmp, - sal_uInt16 nNewBitCount ) override; - virtual bool Create( const css::uno::Reference< css::rendering::XBitmapCanvas >& rBitmapCanvas, - Size& rSize, - bool bMask = false ) override; - virtual void Destroy() final override; - virtual Size GetSize() const override; - virtual sal_uInt16 GetBitCount() const override; - - virtual BitmapBuffer* AcquireBuffer( BitmapAccessMode nMode ) override; - virtual void ReleaseBuffer( BitmapBuffer* pBuffer, BitmapAccessMode nMode ) override; - virtual bool GetSystemData( BitmapSystemData& rData ) override; - - virtual bool ScalingSupported() const override; - virtual bool Scale( const double& rScaleX, const double& rScaleY, BmpScaleFlag nScaleFlag ) override; - virtual bool Replace( const Color& rSearchColor, const Color& rReplaceColor, sal_uLong nTol ) override; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Data.cxx b/vcl/unx/kf5/Kf5Data.cxx deleted file mode 100644 index b54054dc4cfe..000000000000 --- a/vcl/unx/kf5/Kf5Data.cxx +++ /dev/null @@ -1,49 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include <QtWidgets/QStyle> -#include <QtWidgets/QApplication> - -#include "Kf5Data.hxx" - -Kf5Data::Kf5Data( SalInstance *pInstance ) - : GenericUnixSalData( SAL_DATA_KF5, pInstance ) -{ - ImplSVData *pSVData = ImplGetSVData(); - - // draw toolbars on separate lines - pSVData->maNWFData.mbDockingAreaSeparateTB = true; - // no borders for menu, theming does that - pSVData->maNWFData.mbFlatMenu = true; -} - -Kf5Data::~Kf5Data() -{ -} - -void Kf5Data::ErrorTrapPush() -{ -} - -bool Kf5Data::ErrorTrapPop( bool bIgnoreError ) -{ - return false; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Data.hxx b/vcl/unx/kf5/Kf5Data.hxx deleted file mode 100644 index 16f1e24ba710..000000000000 --- a/vcl/unx/kf5/Kf5Data.hxx +++ /dev/null @@ -1,34 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#pragma once - -#include <unx/gendata.hxx> - -class Kf5Data : public GenericUnixSalData -{ -public: - explicit Kf5Data( SalInstance *pInstance ); - virtual ~Kf5Data() override; - - virtual void ErrorTrapPush() override; - virtual bool ErrorTrapPop( bool bIgnoreError = true ) override; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5FontFace.cxx b/vcl/unx/kf5/Kf5FontFace.cxx deleted file mode 100644 index 2bfa45cc2348..000000000000 --- a/vcl/unx/kf5/Kf5FontFace.cxx +++ /dev/null @@ -1,126 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "Kf5FontFace.hxx" -#include "Kf5Tools.hxx" - -#include <sft.hxx> -#include <impfontcharmap.hxx> -#include <fontinstance.hxx> -#include <fontselect.hxx> -#include <PhysicalFontCollection.hxx> - -#include <QtGui/QFont> -#include <QtGui/QRawFont> - -using namespace vcl; - -Kf5FontFace::Kf5FontFace( const Kf5FontFace& rSrc ) - : PhysicalFontFace( rSrc ) - , m_aFontId( rSrc.m_aFontId ) -{ - if( rSrc.m_xCharMap.is() ) - m_xCharMap = rSrc.m_xCharMap; -} - -Kf5FontFace* Kf5FontFace::fromQFont( const QFont &rFont ) -{ - FontAttributes aFA; - aFA.SetFamilyName( toOUString( rFont.family() ) ); - aFA.SetStyleName( toOUString( rFont.styleName() ) ); - aFA.SetItalic( rFont.italic() ? ITALIC_NORMAL : ITALIC_NONE ); - - return new Kf5FontFace( aFA, rFont.toString() ) ; -} - -Kf5FontFace::Kf5FontFace( const FontAttributes& rFA, const QString &rFontID ) - : PhysicalFontFace( rFA ) - , m_aFontId( rFontID ) - , m_bFontCapabilitiesRead( false ) -{ -} - -Kf5FontFace::~Kf5FontFace() -{ -} - -sal_IntPtr Kf5FontFace::GetFontId() const -{ - return reinterpret_cast<sal_IntPtr>( &m_aFontId ); -} - -const FontCharMapRef Kf5FontFace::GetFontCharMap() -{ - if( m_xCharMap.is() ) - return m_xCharMap; - - QFont aFont; - aFont.fromString( m_aFontId ); - QRawFont aRawFont( QRawFont::fromFont( aFont ) ); - QByteArray aCMapTable = aRawFont.fontTable( "cmap" ); - if ( aCMapTable.isEmpty() ) - { - m_xCharMap = new FontCharMap(); - return m_xCharMap; - } - - CmapResult aCmapResult; - if( ParseCMAP( reinterpret_cast<const unsigned char*>( aCMapTable.data() ), - aCMapTable.size(), aCmapResult ) ) - m_xCharMap = new FontCharMap( aCmapResult ); - - return m_xCharMap; -} - -bool Kf5FontFace::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) -{ - // read this only once per font - if( m_bFontCapabilitiesRead ) - { - rFontCapabilities = m_aFontCapabilities; - return rFontCapabilities.oUnicodeRange || rFontCapabilities.oCodePageRange; - } - m_bFontCapabilitiesRead = true; - - QFont aFont; - aFont.fromString( m_aFontId ); - QRawFont aRawFont( QRawFont::fromFont( aFont ) ); - QByteArray aOS2Table = aRawFont.fontTable( "OS/2" ); - if ( !aOS2Table.isEmpty() ) - { - vcl::getTTCoverage( m_aFontCapabilities.oUnicodeRange, - m_aFontCapabilities.oCodePageRange, - reinterpret_cast<const unsigned char*>( aOS2Table.data() ), - aOS2Table.size() ); - } - - rFontCapabilities = m_aFontCapabilities; - return rFontCapabilities.oUnicodeRange || rFontCapabilities.oCodePageRange; -} - -PhysicalFontFace* Kf5FontFace::Clone() const -{ - return new Kf5FontFace( *this ); -} - -LogicalFontInstance* Kf5FontFace::CreateFontInstance( const FontSelectPattern& rFSD ) const -{ - return new LogicalFontInstance( rFSD ); -} - diff --git a/vcl/unx/kf5/Kf5FontFace.hxx b/vcl/unx/kf5/Kf5FontFace.hxx deleted file mode 100644 index d2ae8099f345..000000000000 --- a/vcl/unx/kf5/Kf5FontFace.hxx +++ /dev/null @@ -1,62 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#pragma once - -#include <PhysicalFontFace.hxx> - -#include <tools/ref.hxx> -#include <vcl/fontcapabilities.hxx> -#include <vcl/fontcharmap.hxx> - -#include <QtCore/QString> - -class FontAttributes; -class FontSelectPattern; -class QFont; - -class Kf5FontFace : public PhysicalFontFace -{ -public: - virtual ~Kf5FontFace() override; - - static Kf5FontFace* fromQFont( const QFont &rFont ); - - PhysicalFontFace* Clone() const override; - LogicalFontInstance* CreateFontInstance( const FontSelectPattern& ) const override; - sal_IntPtr GetFontId() const override; - - int GetFontTable( const char pTagName[5], unsigned char* ) const; - - const FontCharMapRef GetFontCharMap(); - bool GetFontCapabilities( vcl::FontCapabilities &rFontCapabilities ); - bool HasChar( sal_uInt32 cChar ) const; - -protected: - Kf5FontFace( const Kf5FontFace& ); - Kf5FontFace( const FontAttributes& rFA, const QString &rFontID ); - -private: - const QString m_aFontId; - FontCharMapRef m_xCharMap; - vcl::FontCapabilities m_aFontCapabilities; - bool m_bFontCapabilitiesRead; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Frame.cxx b/vcl/unx/kf5/Kf5Frame.cxx deleted file mode 100644 index 2d73a53b80c8..000000000000 --- a/vcl/unx/kf5/Kf5Frame.cxx +++ /dev/null @@ -1,396 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "Kf5Frame.hxx" - -#include "Kf5Tools.hxx" -#include "Kf5Instance.hxx" -#include "Kf5Graphics.hxx" -#include "Kf5Widget.hxx" - -#include <QtCore/QPoint> -#include <QtCore/QSize> -#include <QtGui/QIcon> -#include <QtGui/QWindow> - -#include <saldatabasic.hxx> -#include <vcl/syswin.hxx> - -Kf5Frame::Kf5Frame( Kf5Frame* pParent, SalFrameStyleFlags nStyle ) - : m_bGraphicsInUse( false ) -{ - Kf5Instance *pInst = static_cast<Kf5Instance*>( GetSalData()->m_pInstance ); - pInst->insertFrame( this ); - - if( nStyle & SalFrameStyleFlags::DEFAULT ) // ensure default style - { - nStyle |= SalFrameStyleFlags::MOVEABLE | SalFrameStyleFlags::SIZEABLE | SalFrameStyleFlags::CLOSEABLE; - nStyle &= ~SalFrameStyleFlags::FLOAT; - } - - m_nStyle = nStyle; - m_pParent = pParent; - - Qt::WindowFlags aWinFlags; - if ( !(nStyle & SalFrameStyleFlags::SYSTEMCHILD) ) - { - if( nStyle & SalFrameStyleFlags::INTRO ) - aWinFlags |= Qt::SplashScreen; - else if( nStyle & (SalFrameStyleFlags::FLOAT | - SalFrameStyleFlags::TOOLTIP) ) - aWinFlags |= Qt::ToolTip; - else if( (nStyle & SalFrameStyleFlags::FLOAT) && - ! (nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION) ) - aWinFlags |= Qt::Popup; - else if( nStyle & SalFrameStyleFlags::DIALOG && pParent ) - aWinFlags |= Qt::Dialog; - else if( nStyle & SalFrameStyleFlags::TOOLWINDOW ) - aWinFlags |= Qt::Tool; - else if( (nStyle & SalFrameStyleFlags::OWNERDRAWDECORATION) ) - aWinFlags |= Qt::Window | Qt::FramelessWindowHint | Qt::WindowDoesNotAcceptFocus; - else - aWinFlags |= Qt::Window; - } - - m_pQWidget.reset( new Kf5Widget( *this, pParent ? pParent->GetQWidget() : nullptr, aWinFlags ) ); - - if (pParent && !(pParent->m_nStyle & SalFrameStyleFlags::PLUG)) - { - QWindow *pParentWindow = pParent->GetQWidget()->window()->windowHandle(); - QWindow *pChildWindow = m_pQWidget->window()->windowHandle(); - if ( pParentWindow != pChildWindow ) - pChildWindow->setTransientParent( pParentWindow ); - } -} - -Kf5Frame::~Kf5Frame() -{ - Kf5Instance *pInst = static_cast<Kf5Instance*>( GetSalData()->m_pInstance ); - pInst->eraseFrame( this ); -} - -void Kf5Frame::TriggerPaintEvent() -{ - QSize aSize( m_pQWidget->size() ); - SalPaintEvent aPaintEvt(0, 0, aSize.width(), aSize.height(), true); - CallCallback(SalEvent::Paint, &aPaintEvt); -} - -SalGraphics* Kf5Frame::AcquireGraphics() -{ - if( m_bGraphicsInUse ) - return nullptr; - - if( !m_pGraphics.get() ) - { - m_pGraphics.reset( new Kf5Graphics( this ) ); - m_pQImage.reset( new QImage( m_pQWidget->size(), QImage::Format_ARGB32 ) ); - m_pGraphics->ChangeQImage( m_pQImage.get() ); - TriggerPaintEvent(); - } - m_bGraphicsInUse = true; - - return m_pGraphics.get(); -} - -void Kf5Frame::ReleaseGraphics( SalGraphics* pSalGraph ) -{ - (void) pSalGraph; - assert( pSalGraph == m_pGraphics.get() ); - m_bGraphicsInUse = false; -} - -bool Kf5Frame::PostEvent( ImplSVEvent* pData ) -{ - Kf5Instance *pInst = static_cast<Kf5Instance*>( GetSalData()->m_pInstance ); - pInst->PostEvent( this, pData, SalEvent::UserEvent ); - return true; -} - -void Kf5Frame::SetTitle( const OUString& rTitle ) -{ - m_pQWidget->window()->setWindowTitle( toQString( rTitle ) ); -} - -void Kf5Frame::SetIcon( sal_uInt16 nIcon ) -{ - if( m_nStyle & (SalFrameStyleFlags::PLUG | - SalFrameStyleFlags::SYSTEMCHILD | - SalFrameStyleFlags::FLOAT | - SalFrameStyleFlags::INTRO | - SalFrameStyleFlags::OWNERDRAWDECORATION) - || !m_pQWidget->isWindow() ) - return; - - const char * appicon; - - if (nIcon == SV_ICON_ID_TEXT) - appicon = "libreoffice-writer"; - else if (nIcon == SV_ICON_ID_SPREADSHEET) - appicon = "libreoffice-calc"; - else if (nIcon == SV_ICON_ID_DRAWING) - appicon = "libreoffice-draw"; - else if (nIcon == SV_ICON_ID_PRESENTATION) - appicon = "libreoffice-impress"; - else if (nIcon == SV_ICON_ID_DATABASE) - appicon = "libreoffice-base"; - else if (nIcon == SV_ICON_ID_FORMULA) - appicon = "libreoffice-math"; - else - appicon = "libreoffice-startcenter"; - - QIcon aIcon = QIcon::fromTheme( appicon ); - m_pQWidget->window()->setWindowIcon( aIcon ); -} - -void Kf5Frame::SetMenu( SalMenu* pMenu ) -{ -} - -void Kf5Frame::DrawMenuBar() -{ -} - -void Kf5Frame::SetExtendedFrameStyle( SalExtStyle nExtStyle ) -{ -} - -void Kf5Frame::Show( bool bVisible, bool bNoActivate ) -{ - assert( m_pQWidget.get() ); - m_pQWidget->setVisible( bVisible ); -} - -void Kf5Frame::SetMinClientSize( long nWidth, long nHeight ) -{ - if( ! isChild() ) - m_pQWidget->setMinimumSize( nWidth, nHeight ); -} - -void Kf5Frame::SetMaxClientSize( long nWidth, long nHeight ) -{ - if( ! isChild() ) - m_pQWidget->setMaximumSize( nWidth, nHeight ); -} - -void Kf5Frame::SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ) -{ -} - -void Kf5Frame::GetClientSize( long& rWidth, long& rHeight ) -{ - rWidth = m_pQWidget->width(); - rHeight = m_pQWidget->height(); -} - -void Kf5Frame::GetWorkArea( tools::Rectangle& rRect ) -{ -} - -SalFrame* Kf5Frame::GetParent() const -{ - return m_pParent; -} - -void Kf5Frame::SetWindowState( const SalFrameState* pState ) -{ - if( !m_pQWidget->isWindow() || !pState || isChild( true, false ) ) - return; - - const WindowStateMask nMaxGeometryMask = - WindowStateMask::X | WindowStateMask::Y | - WindowStateMask::Width | WindowStateMask::Height | - WindowStateMask::MaximizedX | WindowStateMask::MaximizedY | - WindowStateMask::MaximizedWidth | WindowStateMask::MaximizedHeight; - - if( (pState->mnMask & WindowStateMask::State) && - (pState->mnState & WindowStateState::Maximized) && - (pState->mnMask & nMaxGeometryMask) == nMaxGeometryMask ) - m_pQWidget->showMaximized(); - else if( pState->mnMask & (WindowStateMask::X | WindowStateMask::Y | - WindowStateMask::Width | WindowStateMask::Height ) ) - { - QRect rect = m_pQWidget->geometry(); - if ( pState->mnMask & WindowStateMask::X ) - rect.setX( pState->mnX ); - if ( pState->mnMask & WindowStateMask::Y ) - rect.setY( pState->mnY ); - if ( pState->mnMask & WindowStateMask::Width ) - rect.setWidth( pState->mnWidth ); - if ( pState->mnMask & WindowStateMask::Height ) - rect.setHeight( pState->mnHeight ); - m_pQWidget->setGeometry( rect ); - } - else if( pState->mnMask & WindowStateMask::State && ! isChild() ) - { - if( (pState->mnState & WindowStateState::Minimized) && m_pQWidget->isWindow() ) - m_pQWidget->showMinimized(); - else - m_pQWidget->showNormal(); - } -} - -bool Kf5Frame::GetWindowState( SalFrameState* pState ) -{ - pState->mnState = WindowStateState::Normal; - pState->mnMask = WindowStateMask::State; - if( m_pQWidget->isMinimized() || !m_pQWidget->windowHandle() ) - pState->mnState |= WindowStateState::Minimized; - else if( m_pQWidget->isMaximized() ) - { - pState->mnState |= WindowStateState::Maximized; - } - else - { - QRect rect = m_pQWidget->geometry(); - pState->mnX = rect.x(); - pState->mnY = rect.y(); - pState->mnWidth = rect.width(); - pState->mnHeight = rect.height(); - pState->mnMask |= WindowStateMask::X | - WindowStateMask::Y | - WindowStateMask::Width | - WindowStateMask::Height; - } - - TriggerPaintEvent(); - return true; -} - -void Kf5Frame::ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) -{ -} - -void Kf5Frame::StartPresentation( bool bStart ) -{ -} - -void Kf5Frame::SetAlwaysOnTop( bool bOnTop ) -{ -} - -void Kf5Frame::ToTop( SalFrameToTop nFlags ) -{ -} - -void Kf5Frame::SetPointer( PointerStyle ePointerStyle ) -{ -} - -void Kf5Frame::CaptureMouse( bool bMouse ) -{ -} - -void Kf5Frame::SetPointerPos( long nX, long nY ) -{ -} - -void Kf5Frame::Flush() -{ -} - -void Kf5Frame::Flush( const tools::Rectangle& rRect ) -{ -} - -void Kf5Frame::SetInputContext( SalInputContext* pContext ) -{ -} - -void Kf5Frame::EndExtTextInput( EndExtTextInputFlags nFlags ) -{ -} - -OUString Kf5Frame::GetKeyName( sal_uInt16 nKeyCode ) -{ - return OUString(); -} - -bool Kf5Frame::MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, vcl::KeyCode& rKeyCode ) -{ - return false; -} - -LanguageType Kf5Frame::GetInputLanguage() -{ - return LANGUAGE_DONTKNOW; -} - -void Kf5Frame::UpdateSettings( AllSettings& rSettings ) -{ -} - -void Kf5Frame::Beep() -{ -} - -const SystemEnvData* Kf5Frame::GetSystemData() const -{ - return nullptr; -} - -SalFrame::SalPointerState Kf5Frame::GetPointerState() -{ - return SalPointerState(); -} - -KeyIndicatorState Kf5Frame::GetIndicatorState() -{ - return KeyIndicatorState(); -} - -void Kf5Frame::SimulateKeyPress( sal_uInt16 nKeyCode ) -{ -} - -void Kf5Frame::SetParent( SalFrame* pNewParent ) -{ - m_pParent = static_cast< Kf5Frame* >( pNewParent ); -} - -bool Kf5Frame::SetPluginParent( SystemParentData* pNewParent ) -{ - return false; -} - -void Kf5Frame::ResetClipRegion() -{ -} - -void Kf5Frame::BeginSetClipRegion( sal_uLong nRects ) -{ -} - -void Kf5Frame::UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) -{ -} - -void Kf5Frame::EndSetClipRegion() -{ -} - -void Kf5Frame::SetScreenNumber( unsigned int ) -{ -} - -void Kf5Frame::SetApplicationID(const OUString &) -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Frame.hxx b/vcl/unx/kf5/Kf5Frame.hxx deleted file mode 100644 index d7746c9cb5e5..000000000000 --- a/vcl/unx/kf5/Kf5Frame.hxx +++ /dev/null @@ -1,116 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#pragma once - -#include <salframe.hxx> - -#include <memory> - -class Kf5Graphics; -class Kf5Instance; -class Kf5Widget; -class QWidget; -class QPaintDevice; -class QImage; - -class Kf5Frame - : public SalFrame -{ - friend class Kf5Widget; - - std::unique_ptr< QWidget > m_pQWidget; - std::unique_ptr< QImage > m_pQImage; - std::unique_ptr< Kf5Graphics > m_pGraphics; - bool m_bGraphicsInUse; - SalFrameStyleFlags m_nStyle; - Kf5Frame *m_pParent; - - bool isChild( bool bPlug = true, bool bSysChild = true ) - { - SalFrameStyleFlags nMask = SalFrameStyleFlags::NONE; - if( bPlug ) - nMask |= SalFrameStyleFlags::PLUG; - if( bSysChild ) - nMask |= SalFrameStyleFlags::SYSTEMCHILD; - return bool(m_nStyle & nMask); - } - - void TriggerPaintEvent(); - -public: - Kf5Frame( Kf5Frame* pParent, - SalFrameStyleFlags nSalFrameStyle ); - virtual ~Kf5Frame() override; - - QWidget* GetQWidget() const { return m_pQWidget.get(); } - - virtual SalGraphics* AcquireGraphics() override; - virtual void ReleaseGraphics( SalGraphics* pGraphics ) override; - - virtual bool PostEvent(ImplSVEvent* pData) override; - - virtual void SetTitle( const OUString& rTitle ) override; - virtual void SetIcon( sal_uInt16 nIcon ) override; - virtual void SetMenu( SalMenu* pMenu ) override; - virtual void DrawMenuBar() override; - - virtual void SetExtendedFrameStyle( SalExtStyle nExtStyle ) override; - virtual void Show( bool bVisible, bool bNoActivate = false ) override; - virtual void SetMinClientSize( long nWidth, long nHeight ) override; - virtual void SetMaxClientSize( long nWidth, long nHeight ) override; - virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ) override; - virtual void GetClientSize( long& rWidth, long& rHeight ) override; - virtual void GetWorkArea( tools::Rectangle& rRect ) override; - virtual SalFrame* GetParent() const override; - virtual void SetWindowState( const SalFrameState* pState ) override; - virtual bool GetWindowState( SalFrameState* pState ) override; - virtual void ShowFullScreen( bool bFullScreen, sal_Int32 nDisplay ) override; - virtual void StartPresentation( bool bStart ) override; - virtual void SetAlwaysOnTop( bool bOnTop ) override; - virtual void ToTop( SalFrameToTop nFlags ) override; - virtual void SetPointer( PointerStyle ePointerStyle ) override; - virtual void CaptureMouse( bool bMouse ) override; - virtual void SetPointerPos( long nX, long nY ) override; - virtual void Flush() override; - virtual void Flush( const tools::Rectangle& rRect ) override; - virtual void SetInputContext( SalInputContext* pContext ) override; - virtual void EndExtTextInput( EndExtTextInputFlags nFlags ) override; - virtual OUString GetKeyName( sal_uInt16 nKeyCode ) override; - virtual bool MapUnicodeToKeyCode( sal_Unicode aUnicode, LanguageType aLangType, vcl::KeyCode& rKeyCode ) override; - virtual LanguageType GetInputLanguage() override; - virtual void UpdateSettings( AllSettings& rSettings ) override; - virtual void Beep() override; - virtual const SystemEnvData* GetSystemData() const override; - virtual SalPointerState GetPointerState() override; - virtual KeyIndicatorState GetIndicatorState() override; - virtual void SimulateKeyPress( sal_uInt16 nKeyCode ) override; - virtual void SetParent( SalFrame* pNewParent ) override; - virtual bool SetPluginParent( SystemParentData* pNewParent ) override; - virtual void ResetClipRegion() override; - virtual void BeginSetClipRegion( sal_uLong nRects ) override; - virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) override; - virtual void EndSetClipRegion() override; - - virtual void SetScreenNumber( unsigned int ) override; - virtual void SetApplicationID(const OUString &) override; - -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Graphics.cxx b/vcl/unx/kf5/Kf5Graphics.cxx deleted file mode 100644 index 0cd252fe06ff..000000000000 --- a/vcl/unx/kf5/Kf5Graphics.cxx +++ /dev/null @@ -1,117 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "Kf5Graphics.hxx" -#include "Kf5Frame.hxx" - -#include <QtWidgets/QWidget> - -#include <QtGui/QPainter> - -#include <QtGui/QImage> - -Kf5Graphics::Kf5Graphics( Kf5Frame *pFrame ) - : m_pFrame( pFrame ) - , m_pQImage( nullptr ) - , m_pFontCollection( nullptr ) -{ -} - -Kf5Graphics::Kf5Graphics( QImage *pQImage ) - : m_pFrame( nullptr ) - , m_pQImage( pQImage ) - , m_pFontCollection( nullptr ) -{ -} - -Kf5Graphics::~Kf5Graphics() -{ -} - -void Kf5Graphics::PreparePainter() -{ - if ( m_pPainter.get() ) - return; - if ( m_pQImage ) - m_pPainter.reset( new QPainter( m_pQImage ) ); - else - { - assert( dynamic_cast< QPaintDevice* >( m_pFrame->GetQWidget() ) ); - m_pPainter.reset( new QPainter( m_pFrame->GetQWidget() ) ); - } - if (!m_aClipRegion.isEmpty()) - m_pPainter->setClipRegion( m_aClipRegion ); -} - -void Kf5Graphics::ChangeQImage( QImage *pQImage ) -{ - m_pPainter.reset(); - m_pQImage = pQImage; -} - -SalGraphicsImpl* Kf5Graphics::GetImpl() const -{ - return nullptr; -} - -SystemGraphicsData Kf5Graphics::GetGraphicsData() const -{ - return SystemGraphicsData(); -} - -bool Kf5Graphics::supportsOperation( OutDevSupportType ) const -{ - return false; -} - -#if ENABLE_CAIRO_CANVAS - -bool Kf5Graphics::SupportsCairo() const -{ - return false; -} - -cairo::SurfaceSharedPtr Kf5Graphics::CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const -{ - return nullptr; -} - -cairo::SurfaceSharedPtr Kf5Graphics::CreateSurface(const OutputDevice& rRefDevice, int x, int y, int width, int height) const -{ - return nullptr; -} - -cairo::SurfaceSharedPtr Kf5Graphics::CreateBitmapSurface(const OutputDevice& rRefDevice, const BitmapSystemData& rData, const Size& rSize) const -{ - return nullptr; -} - -css::uno::Any Kf5Graphics::GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, const basegfx::B2ISize& rSize) const -{ - return css::uno::Any(); -} - -SystemFontData Kf5Graphics::GetSysFontData( int nFallbacklevel ) const -{ - return SystemFontData(); -} - -#endif - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Graphics.hxx b/vcl/unx/kf5/Kf5Graphics.hxx deleted file mode 100644 index 55f1fc245aff..000000000000 --- a/vcl/unx/kf5/Kf5Graphics.hxx +++ /dev/null @@ -1,200 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#pragma once - -#include <salgdi.hxx> - -#include <memory> - -#include <QtGui/QRegion> - -class Kf5Frame; -class PhysicalFontCollection; -class PhysicalFontFace; -class QImage; -class QPainter; - -class Kf5Graphics : public SalGraphics -{ - friend class Kf5Bitmap; - - Kf5Frame *m_pFrame; - QImage *m_pQImage; - QRegion m_aClipRegion; - std::unique_ptr< QPainter > m_pPainter; - PhysicalFontCollection *m_pFontCollection; - PhysicalFontFace *m_pFont; - - void PreparePainter(); - -public: - Kf5Graphics( Kf5Frame *pFrame ); - Kf5Graphics( QImage *pImage ); - virtual ~Kf5Graphics() override; - - void ChangeQImage( QImage *pImage ); - - virtual SalGraphicsImpl* GetImpl() const override; - virtual SystemGraphicsData GetGraphicsData() const override; - virtual bool supportsOperation( OutDevSupportType ) const override; - -#if ENABLE_CAIRO_CANVAS - virtual bool SupportsCairo() const override; - virtual cairo::SurfaceSharedPtr CreateSurface(const cairo::CairoSurfaceSharedPtr& rSurface) const override; - virtual cairo::SurfaceSharedPtr CreateSurface(const OutputDevice& rRefDevice, - int x, int y, int width, int height) const override; - virtual cairo::SurfaceSharedPtr CreateBitmapSurface(const OutputDevice& rRefDevice, - const BitmapSystemData& rData, const Size& rSize) const override; - virtual css::uno::Any GetNativeSurfaceHandle(cairo::SurfaceSharedPtr& rSurface, - const basegfx::B2ISize& rSize) const override; - virtual SystemFontData GetSysFontData( int nFallbacklevel ) const override; -#endif // ENABLE_CAIRO_CANVAS - - // GDI - - virtual bool setClipRegion( const vcl::Region& ) override; - virtual void ResetClipRegion() override; - - virtual void drawPixel( long nX, long nY ) override; - virtual void drawPixel( long nX, long nY, SalColor nSalColor ) override; - virtual void drawLine( long nX1, long nY1, long nX2, long nY2 ) override; - virtual void drawRect( long nX, long nY, long nWidth, long nHeight ) override; - virtual void drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) override; - virtual void drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) override; - virtual void drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ) override; - virtual bool drawPolyPolygon( const basegfx::B2DPolyPolygon&, double fTransparency ) override; - virtual bool drawPolyLineBezier( sal_uInt32 nPoints, const SalPoint* pPtAry, const PolyFlags* pFlgAry ) override; - virtual bool drawPolygonBezier( sal_uInt32 nPoints, const SalPoint* pPtAry, const PolyFlags* pFlgAry ) override; - virtual bool drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, const SalPoint* const* pPtAry, const PolyFlags* const* pFlgAry ) override; - virtual bool drawPolyLine( - const basegfx::B2DPolygon&, - double fTransparency, - const basegfx::B2DVector& rLineWidths, - basegfx::B2DLineJoin, - css::drawing::LineCap eLineCap, - double fMiterMinimumAngle) override; - virtual bool drawGradient( const tools::PolyPolygon&, const Gradient& ) override; - - virtual void copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, - long nSrcHeight, bool bWindowInvalidate ) override; - - virtual void copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) override; - virtual void drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) override; - virtual void drawBitmap( const SalTwoRect& rPosAry, - const SalBitmap& rSalBitmap, - const SalBitmap& rTransparentBitmap ) override; - virtual void drawMask( const SalTwoRect& rPosAry, - const SalBitmap& rSalBitmap, - SalColor nMaskColor ) override; - - virtual SalBitmap* getBitmap( long nX, long nY, long nWidth, long nHeight ) override; - virtual SalColor getPixel( long nX, long nY ) override; - - virtual void invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags) override; - virtual void invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags ) override; - - virtual bool drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize ) override; - - virtual bool blendBitmap( const SalTwoRect&, - const SalBitmap& rBitmap ) override; - - virtual bool blendAlphaBitmap( const SalTwoRect&, - const SalBitmap& rSrcBitmap, - const SalBitmap& rMaskBitmap, - const SalBitmap& rAlphaBitmap ) override; - - virtual bool drawAlphaBitmap( const SalTwoRect&, - const SalBitmap& rSourceBitmap, - const SalBitmap& rAlphaBitmap ) override; - - bool drawTransformedBitmap( - const basegfx::B2DPoint& rNull, - const basegfx::B2DPoint& rX, - const basegfx::B2DPoint& rY, - const SalBitmap& rSourceBitmap, - const SalBitmap* pAlphaBitmap) override; - - virtual bool drawAlphaRect( long nX, long nY, long nWidth, - long nHeight, sal_uInt8 nTransparency ) override; - - virtual void GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) override; - virtual sal_uInt16 GetBitCount() const override; - virtual long GetGraphicsWidth() const override; - - virtual void SetLineColor() override; - virtual void SetLineColor( SalColor nSalColor ) override; - virtual void SetFillColor() override; - virtual void SetFillColor( SalColor nSalColor ) override; - virtual void SetXORMode( bool bSet ) override; - virtual void SetROPLineColor( SalROPColor nROPColor ) override; - virtual void SetROPFillColor( SalROPColor nROPColor ) override; - - // Text rendering + font support - - virtual void SetTextColor( SalColor nSalColor ) override; - virtual void SetFont( const FontSelectPattern*, int nFallbackLevel ) override; - virtual void GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) override; - virtual const FontCharMapRef GetFontCharMap() const override; - virtual bool GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const override; - virtual void GetDevFontList( PhysicalFontCollection* ) override; - virtual void ClearDevFontCache() override; - virtual bool AddTempDevFont( PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) override; - virtual bool CreateFontSubset( const OUString& rToFile, - const PhysicalFontFace* pFont, - const sal_GlyphId* pGlyphIds, - const sal_uInt8* pEncoding, - sal_Int32* pWidths, - int nGlyphs, - FontSubsetInfo& rInfo // out parameter - ) override; - - virtual const void* GetEmbedFontData(const PhysicalFontFace*, long* pDataLen) override; - virtual void FreeEmbedFontData( const void* pData, long nDataLen ) override; - - virtual void GetGlyphWidths( const PhysicalFontFace*, - bool bVertical, - std::vector< sal_Int32 >& rWidths, - Ucs2UIntMap& rUnicodeEnc ) override; - - virtual bool GetGlyphBoundRect(const GlyphItem&, tools::Rectangle&) override; - virtual bool GetGlyphOutline(const GlyphItem&, basegfx::B2DPolyPolygon&) override; - - virtual SalLayout* GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) override; - virtual void DrawTextLayout( const CommonSalLayout& ) override; - - // Native control support - - virtual bool IsNativeControlSupported( ControlType nType, ControlPart nPart ) override; - virtual bool hitTestNativeControl( ControlType nType, ControlPart nPart, - const tools::Rectangle& rControlRegion, - const Point& aPos, bool& rIsInside ) override; - virtual bool drawNativeControl( ControlType nType, ControlPart nPart, - const tools::Rectangle& rControlRegion, - ControlState nState, const ImplControlValue& aValue, - const OUString& aCaption ) override; - virtual bool getNativeControlRegion( ControlType nType, ControlPart nPart, - const tools::Rectangle& rControlRegion, ControlState nState, - const ImplControlValue& aValue, const OUString& aCaption, - tools::Rectangle &rNativeBoundingRegion, - tools::Rectangle &rNativeContentRegion ) override; - -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Graphics_Controls.cxx b/vcl/unx/kf5/Kf5Graphics_Controls.cxx deleted file mode 100644 index b55f7f190e94..000000000000 --- a/vcl/unx/kf5/Kf5Graphics_Controls.cxx +++ /dev/null @@ -1,51 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "Kf5Graphics.hxx" - -bool Kf5Graphics::IsNativeControlSupported( ControlType nType, ControlPart nPart ) -{ - return false; -} - -bool Kf5Graphics::hitTestNativeControl( ControlType nType, ControlPart nPart, - const tools::Rectangle& rControlRegion, - const Point& aPos, bool& rIsInside ) -{ - return false; -} - -bool Kf5Graphics::drawNativeControl( ControlType nType, ControlPart nPart, - const tools::Rectangle& rControlRegion, - ControlState nState, const ImplControlValue& aValue, - const OUString& aCaption ) -{ - return false; -} - -bool Kf5Graphics::getNativeControlRegion( ControlType nType, ControlPart nPart, - const tools::Rectangle& rControlRegion, ControlState nState, - const ImplControlValue& aValue, const OUString& aCaption, - tools::Rectangle &rNativeBoundingRegion, - tools::Rectangle &rNativeContentRegion ) -{ - return false; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Graphics_GDI.cxx b/vcl/unx/kf5/Kf5Graphics_GDI.cxx deleted file mode 100644 index b1b42fd7adcf..000000000000 --- a/vcl/unx/kf5/Kf5Graphics_GDI.cxx +++ /dev/null @@ -1,335 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "Kf5Graphics.hxx" - -#include "Kf5Bitmap.hxx" -#include "Kf5Frame.hxx" -#include "Kf5Tools.hxx" - -#include <QtGui/QPainter> -#include <QtGui/QScreen> -#include <QtGui/QWindow> -#include <QtWidgets/QWidget> - -bool Kf5Graphics::setClipRegion( const vcl::Region& rRegion ) -{ - PreparePainter(); - if ( rRegion.IsRectangle() ) - m_aClipRegion = toQRect( rRegion.GetBoundRect() ); - else if( !rRegion.HasPolyPolygonOrB2DPolyPolygon() ) - { - QRegion aQRegion; - RectangleVector aRectangles; - rRegion.GetRegionRectangles( aRectangles ); - for ( auto & rRect : aRectangles ) - aQRegion += toQRect( rRect ); - m_aClipRegion = aQRegion; - } - else - { - QPolygon aPolygon; - } - m_pPainter->setClipRegion( m_aClipRegion ); - return true; -} - -void Kf5Graphics::ResetClipRegion() -{ - m_aClipRegion = QRegion( m_pQImage->rect() ); - PreparePainter(); -} - -void Kf5Graphics::drawPixel( long nX, long nY ) -{ - PreparePainter(); - m_pPainter->drawPoint( nX, nY ); -} - -void Kf5Graphics::drawPixel( long nX, long nY, SalColor nSalColor ) -{ - PreparePainter(); - m_pPainter->setPen( QColor( QRgb( nSalColor ) ) ); - m_pPainter->drawPoint( nX, nY ); -} - -void Kf5Graphics::drawLine( long nX1, long nY1, long nX2, long nY2 ) -{ - PreparePainter(); - m_pPainter->drawLine( nX1, nY1, nX2, nY2 ); -} - -void Kf5Graphics::drawRect( long nX, long nY, long nWidth, long nHeight ) -{ - PreparePainter(); - m_pPainter->drawRect( nX, nY, nWidth, nHeight ); -} - -void Kf5Graphics::drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) -{ - PreparePainter(); - QPoint *pPoints = new QPoint[ nPoints ]; - for ( sal_uInt32 i = 0; i < nPoints; ++i, ++pPtAry ) - pPoints[ i ] = QPoint( pPtAry->mnX, pPtAry->mnY ); - m_pPainter->drawPolyline( pPoints, nPoints ); - delete [] pPoints; -} - -void Kf5Graphics::drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) -{ - PreparePainter(); - QPoint *pPoints = new QPoint[ nPoints ]; - for ( sal_uInt32 i = 0; i < nPoints; ++i, ++pPtAry ) - pPoints[ i ] = QPoint( pPtAry->mnX, pPtAry->mnY ); - m_pPainter->drawPolygon( pPoints, nPoints ); - delete [] pPoints; -} - -void Kf5Graphics::drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ) -{ - if( 0 == nPoly ) - return; -} - -bool Kf5Graphics::drawPolyPolygon( const basegfx::B2DPolyPolygon&, double fTransparency ) -{ - return false; -} - -bool Kf5Graphics::drawPolyLineBezier( sal_uInt32 nPoints, const SalPoint* pPtAry, const PolyFlags* pFlgAry ) -{ - return false; -} - -bool Kf5Graphics::drawPolygonBezier( sal_uInt32 nPoints, const SalPoint* pPtAry, const PolyFlags* pFlgAry ) -{ - return false; -} - -bool Kf5Graphics::drawPolyPolygonBezier( sal_uInt32 nPoly, const sal_uInt32* pPoints, - const SalPoint* const* pPtAry, const PolyFlags* const* pFlgAry ) -{ - return false; -} - -bool Kf5Graphics::drawPolyLine( const basegfx::B2DPolygon&, - double fTransparency, - const basegfx::B2DVector& rLineWidths, - basegfx::B2DLineJoin, - css::drawing::LineCap eLineCap, - double fMiterMinimumAngle ) -{ - return false; -} - -bool Kf5Graphics::drawGradient( const tools::PolyPolygon&, const Gradient& ) -{ - return false; -} - -void Kf5Graphics::copyArea( long nDestX, long nDestY, long nSrcX, long nSrcY, long nSrcWidth, - long nSrcHeight, bool bWindowInvalidate ) -{ - if ( nDestX == nSrcX && nDestY == nSrcY ) - return; - - SalTwoRect aTR( nSrcX, nSrcY, nSrcWidth, nSrcHeight, - nDestX, nDestY, nSrcWidth, nSrcHeight ); - copyBits( aTR, this ); -} - -void Kf5Graphics::copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) -{ - if( rPosAry.mnSrcWidth <= 0 || rPosAry.mnSrcHeight <= 0 - || rPosAry.mnDestWidth <= 0 || rPosAry.mnDestHeight <= 0 ) - return; - - assert( rPosAry.mnSrcWidth == rPosAry.mnDestWidth ); - assert( rPosAry.mnSrcHeight == rPosAry.mnDestHeight ); - - QImage *pImage; - QImage aImage; - if ( !pSrcGraphics || this == pSrcGraphics ) - { - if ( rPosAry.mnDestX == rPosAry.mnSrcX - && rPosAry.mnDestY == rPosAry.mnSrcY ) - return; - aImage = pImage->copy( rPosAry.mnSrcX, rPosAry.mnSrcY, - rPosAry.mnSrcWidth, rPosAry.mnSrcHeight ); - pImage = &aImage; - } - else - pImage = static_cast< Kf5Graphics*>( pSrcGraphics )->m_pQImage; - - PreparePainter(); - m_pPainter->drawImage( QPoint( rPosAry.mnDestX, rPosAry.mnDestY ), - *pImage, QRect( rPosAry.mnSrcX, rPosAry.mnSrcY, - rPosAry.mnSrcWidth, rPosAry.mnSrcHeight) ); -} - -void Kf5Graphics::drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) -{ - if( rPosAry.mnSrcWidth <= 0 || rPosAry.mnSrcHeight <= 0 - || rPosAry.mnDestWidth <= 0 || rPosAry.mnDestHeight <= 0 ) - return; - - assert( rPosAry.mnSrcWidth == rPosAry.mnDestWidth ); - assert( rPosAry.mnSrcHeight == rPosAry.mnDestHeight ); - - PreparePainter(); - const QImage *pImage = static_cast< const Kf5Bitmap* >( &rSalBitmap )->GetQImage(); - - m_pPainter->drawImage( QPoint( rPosAry.mnDestX, rPosAry.mnDestY ), - *pImage, QRect( rPosAry.mnSrcX, rPosAry.mnSrcY, - rPosAry.mnSrcWidth, rPosAry.mnSrcHeight) ); - - // Workaround to get updates - if ( m_pFrame ) - m_pFrame->GetQWidget()->update(); -} - -void Kf5Graphics::drawBitmap( const SalTwoRect& rPosAry, - const SalBitmap& rSalBitmap, - const SalBitmap& rTransparentBitmap ) -{ -} - -void Kf5Graphics::drawMask( const SalTwoRect& rPosAry, - const SalBitmap& rSalBitmap, - SalColor nMaskColor ) -{ -} - -SalBitmap* Kf5Graphics::getBitmap( long nX, long nY, long nWidth, long nHeight ) -{ - return new Kf5Bitmap( m_pQImage->copy( nX, nY, nWidth, nHeight ) ); -} - -SalColor Kf5Graphics::getPixel( long nX, long nY ) -{ - return m_pQImage->pixel( nX, nY ); -} - -void Kf5Graphics::invert( long nX, long nY, long nWidth, long nHeight, SalInvert nFlags) -{ -} - -void Kf5Graphics::invert( sal_uInt32 nPoints, const SalPoint* pPtAry, SalInvert nFlags ) -{ -} - -bool Kf5Graphics::drawEPS( long nX, long nY, long nWidth, long nHeight, void* pPtr, sal_uLong nSize ) -{ - return false; -} - -bool Kf5Graphics::blendBitmap( const SalTwoRect&, - const SalBitmap& rBitmap ) -{ - return false; -} - -bool Kf5Graphics::blendAlphaBitmap( const SalTwoRect&, - const SalBitmap& rSrcBitmap, - const SalBitmap& rMaskBitmap, - const SalBitmap& rAlphaBitmap ) -{ - return false; -} - -bool Kf5Graphics::drawAlphaBitmap( const SalTwoRect&, - const SalBitmap& rSourceBitmap, - const SalBitmap& rAlphaBitmap ) -{ - return false; -} - -bool Kf5Graphics::drawTransformedBitmap( - const basegfx::B2DPoint& rNull, - const basegfx::B2DPoint& rX, - const basegfx::B2DPoint& rY, - const SalBitmap& rSourceBitmap, - const SalBitmap* pAlphaBitmap) -{ - return false; -} - -bool Kf5Graphics::drawAlphaRect( long nX, long nY, long nWidth, - long nHeight, sal_uInt8 nTransparency ) -{ - return false; -} - -void Kf5Graphics::GetResolution( sal_Int32& rDPIX, sal_Int32& rDPIY ) -{ - char* pForceDpi; - if ((pForceDpi = getenv("SAL_FORCEDPI"))) - { - OString sForceDPI(pForceDpi); - rDPIX = rDPIY = sForceDPI.toInt32(); - return; - } - - if ( !m_pFrame || !m_pFrame->GetQWidget()->window()->windowHandle() ) - return; - - QScreen *pScreen = m_pFrame->GetQWidget()->window()->windowHandle()->screen(); - rDPIX = pScreen->physicalDotsPerInchX(); - rDPIY = pScreen->physicalDotsPerInchY(); -} - -sal_uInt16 Kf5Graphics::GetBitCount() const -{ - return getFormatBits( m_pQImage->format() ); -} - -long Kf5Graphics::GetGraphicsWidth() const -{ - return m_pQImage->width(); -} - -void Kf5Graphics::SetLineColor() -{ -} - -void Kf5Graphics::SetLineColor( SalColor nSalColor ) -{ -} - -void Kf5Graphics::SetFillColor() -{ -} - -void Kf5Graphics::SetFillColor( SalColor nSalColor ) -{ -} - -void Kf5Graphics::SetXORMode( bool bSet ) -{ -} - -void Kf5Graphics::SetROPLineColor( SalROPColor nROPColor ) -{ -} - -void Kf5Graphics::SetROPFillColor( SalROPColor nROPColor ) -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Graphics_Text.cxx b/vcl/unx/kf5/Kf5Graphics_Text.cxx deleted file mode 100644 index 28af6be1bf65..000000000000 --- a/vcl/unx/kf5/Kf5Graphics_Text.cxx +++ /dev/null @@ -1,118 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "Kf5Graphics.hxx" -#include "Kf5FontFace.hxx" - -#include <vcl/fontcharmap.hxx> - -#include <PhysicalFontCollection.hxx> - -#include <QtGui/QFontDatabase> -#include <QtCore/QStringList> - -void Kf5Graphics::SetTextColor( SalColor nSalColor ) -{ -} - -void Kf5Graphics::SetFont( const FontSelectPattern*, int nFallbackLevel ) -{ -} - -void Kf5Graphics::GetFontMetric( ImplFontMetricDataRef &rFMD, int nFallbackLevel ) -{ -} - -const FontCharMapRef Kf5Graphics::GetFontCharMap() const -{ - return nullptr; -} - -bool Kf5Graphics::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const -{ - return false; -} - -void Kf5Graphics::GetDevFontList( PhysicalFontCollection* pPFC ) -{ - m_pFontCollection = pPFC; - if ( pPFC->Count() ) - return; - - QFontDatabase aFDB; - for ( auto& family : aFDB.families() ) - for ( auto& style : aFDB.styles( family ) ) - { - // Just get any size - we don't care - QList<int> sizes = aFDB.smoothSizes(family, style); - pPFC->Add( Kf5FontFace::fromQFont( aFDB.font( family, style, *sizes.begin() ) ) ); - } -} - -void Kf5Graphics::ClearDevFontCache() -{ -} - -bool Kf5Graphics::AddTempDevFont( PhysicalFontCollection*, const OUString& rFileURL, const OUString& rFontName ) -{ - return false; -} - -bool Kf5Graphics::CreateFontSubset( const OUString& rToFile, const PhysicalFontFace* pFont, - const sal_GlyphId* pGlyphIds, const sal_uInt8* pEncoding, - sal_Int32* pWidths, int nGlyphs, FontSubsetInfo& rInfo ) -{ - return false; -} - -const void* Kf5Graphics::GetEmbedFontData( const PhysicalFontFace*, long* pDataLen ) -{ - return nullptr; -} - -void Kf5Graphics::FreeEmbedFontData( const void* pData, long nDataLen ) -{ -} - -void Kf5Graphics::GetGlyphWidths( const PhysicalFontFace*, bool bVertical, - std::vector< sal_Int32 >& rWidths, - Ucs2UIntMap& rUnicodeEnc ) -{ -} - -bool Kf5Graphics::GetGlyphBoundRect( const GlyphItem&, tools::Rectangle& ) -{ - return false; -} - -bool Kf5Graphics::GetGlyphOutline( const GlyphItem&, basegfx::B2DPolyPolygon& ) -{ - return false; -} - -SalLayout* Kf5Graphics::GetTextLayout( ImplLayoutArgs&, int nFallbackLevel ) -{ - return nullptr; -} - -void Kf5Graphics::DrawTextLayout( const CommonSalLayout& ) -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Instance.cxx b/vcl/unx/kf5/Kf5Instance.cxx deleted file mode 100644 index 3eb7e20cfa4e..000000000000 --- a/vcl/unx/kf5/Kf5Instance.cxx +++ /dev/null @@ -1,298 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "Kf5Instance.hxx" -#include <Kf5Instance.moc> - -#include "Kf5Frame.hxx" -#include "Kf5Data.hxx" -#include "Kf5Timer.hxx" -#include "Kf5VirtualDevice.hxx" -#include "Kf5Object.hxx" -#include "Kf5Bitmap.hxx" - -#include <QtCore/QThread> -#include <QtWidgets/QApplication> -#include <QtCore/QAbstractEventDispatcher> - -#include <vclpluginapi.h> -#include <sal/log.hxx> -#include <osl/process.h> - -#include <headless/svpdummies.hxx> -#include <headless/svpbmp.hxx> - -#include <KAboutData> -#include <KLocalizedString> -#include <KStartupInfo> - -Kf5Instance::Kf5Instance( SalYieldMutex* pMutex ) - : SalGenericInstance( pMutex ) - , m_postUserEventId( -1 ) -{ - m_postUserEventId = QEvent::registerEventType(); - - // this one needs to be blocking, so that the handling in main thread - // is processed before the thread emitting the signal continues - connect( this, SIGNAL( ImplYieldSignal( bool, bool )), - this, SLOT( ImplYield( bool, bool )), Qt::BlockingQueuedConnection ); -} - -Kf5Instance::~Kf5Instance() -{ - // force freeing the QApplication before freeing the arguments, - // as it uses references to the provided arguments! - m_pQApplication.reset(); - for( int i = 0; i < *m_pFakeArgc; i++ ) - free( m_pFakeArgvFreeable[i] ); -} - -SalFrame* Kf5Instance::CreateChildFrame( SystemParentData* /*pParent*/, SalFrameStyleFlags nStyle ) -{ - return new Kf5Frame( nullptr, nStyle ); -} - -SalFrame* Kf5Instance::CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ) -{ - assert( !pParent || dynamic_cast<Kf5Frame*>( pParent ) ); - return new Kf5Frame( static_cast<Kf5Frame*>( pParent ), nStyle ); -} - -void Kf5Instance::DestroyFrame( SalFrame* pFrame ) -{ - delete pFrame; -} - -SalObject* Kf5Instance::CreateObject( SalFrame* pParent, SystemWindowData*, bool bShow ) -{ - assert( !pParent || dynamic_cast<Kf5Frame*>( pParent ) ); - return new Kf5Object( static_cast<Kf5Frame*>( pParent ), bShow ); -} - -void Kf5Instance::DestroyObject( SalObject* pObject ) -{ - delete pObject; -} - -SalVirtualDevice* Kf5Instance::CreateVirtualDevice( SalGraphics* /* pGraphics */, - long &nDX, long &nDY, - DeviceFormat eFormat, - const SystemGraphicsData* /* pData */ ) -{ - Kf5VirtualDevice* pVD = new Kf5VirtualDevice( eFormat, 1 ); - pVD->SetSize( nDX, nDY ); - return pVD; -} - -SalTimer* Kf5Instance::CreateSalTimer() -{ - return new Kf5Timer(); -} - -SalSystem* Kf5Instance::CreateSalSystem() -{ - return new SvpSalSystem(); -} - -SalBitmap* Kf5Instance::CreateSalBitmap() -{ - return new Kf5Bitmap(); -} - -bool Kf5Instance::ImplYield( bool bWait, bool bHandleAllCurrentEvents ) -{ - bool wasEvent = DispatchUserEvents( bHandleAllCurrentEvents ); - if ( !bHandleAllCurrentEvents && wasEvent ) - return true; - - /** - * Quoting the Qt docs: [QAbstractEventDispatcher::processEvents] processes - * pending events that match flags until there are no more events to process. - */ - QAbstractEventDispatcher* dispatcher = QAbstractEventDispatcher::instance( qApp->thread()); - if ( bWait && !wasEvent ) - wasEvent = dispatcher->processEvents( QEventLoop::WaitForMoreEvents ); - else - wasEvent = dispatcher->processEvents( QEventLoop::AllEvents ) || wasEvent; - return wasEvent; -} - -bool Kf5Instance::DoYield(bool bWait, bool bHandleAllCurrentEvents) -{ - bool bWasEvent = false; - if( qApp->thread() == QThread::currentThread() ) - { - bWasEvent = ImplYield( bWait, bHandleAllCurrentEvents ); - if ( bWasEvent ) - m_aWaitingYieldCond.set(); - } - else - { - { - SolarMutexReleaser aReleaser; - bWasEvent = Q_EMIT ImplYieldSignal( false, bHandleAllCurrentEvents ); - } - if ( !bWasEvent && bWait ) - { - m_aWaitingYieldCond.reset(); - SolarMutexReleaser aReleaser; - m_aWaitingYieldCond.wait(); - bWasEvent = true; - } - } - return bWasEvent; -} - -bool Kf5Instance::AnyInput( VclInputFlags nType ) -{ - return false; -} - -SalSession* Kf5Instance::CreateSalSession() -{ - return nullptr; -} - -OUString Kf5Instance::GetConnectionIdentifier() -{ - return OUString(); -} - -void Kf5Instance::AddToRecentDocumentList(const OUString&, const OUString&, const OUString&) -{ -} - -OpenGLContext* Kf5Instance::CreateOpenGLContext() -{ - return nullptr; -} - -bool Kf5Instance::IsMainThread() const -{ - return qApp->thread() != QThread::currentThread(); -} - -void Kf5Instance::TriggerUserEventProcessing() -{ - QApplication::postEvent(this, new QEvent(QEvent::Type( m_postUserEventId ))); -} - -void Kf5Instance::ProcessEvent( SalUserEvent aEvent ) -{ - aEvent.m_pFrame->CallCallback( aEvent.m_nEvent, aEvent.m_pData ); -} - -extern "C" { - VCLPLUG_KF5_PUBLIC SalInstance* create_SalInstance() - { - OString aVersion( qVersion() ); - SAL_INFO( "vcl.kf5", "qt version string is " << aVersion ); - - QApplication *pQApplication; - char **pFakeArgvFreeable = nullptr; - - int nFakeArgc = 2; - const sal_uInt32 nParams = osl_getCommandArgCount(); - OString aDisplay; - OUString aParam, aBin; - - for ( sal_uInt32 nIdx = 0; nIdx < nParams; ++nIdx ) - { - osl_getCommandArg( nIdx, &aParam.pData ); - if ( aParam != "-display" ) - continue; - if ( !pFakeArgvFreeable ) - { - pFakeArgvFreeable = new char*[ nFakeArgc + 2 ]; - pFakeArgvFreeable[ nFakeArgc++ ] = strdup( "-display" ); - } - else - free( pFakeArgvFreeable[ nFakeArgc ] ); - - ++nIdx; - osl_getCommandArg( nIdx, &aParam.pData ); - aDisplay = OUStringToOString( aParam, osl_getThreadTextEncoding() ); - pFakeArgvFreeable[ nFakeArgc ] = strdup( aDisplay.getStr() ); - } - if ( !pFakeArgvFreeable ) - pFakeArgvFreeable = new char*[ nFakeArgc ]; - else - nFakeArgc++; - - osl_getExecutableFile( &aParam.pData ); - osl_getSystemPathFromFileURL( aParam.pData, &aBin.pData ); - OString aExec = OUStringToOString( aBin, osl_getThreadTextEncoding() ); - pFakeArgvFreeable[ 0 ] = strdup( aExec.getStr() ); - pFakeArgvFreeable[ 1 ] = strdup( "--nocrashhandler" ); - - char **pFakeArgv = new char*[ nFakeArgc ]; - for( int i = 0; i < nFakeArgc; i++ ) - pFakeArgv[ i ] = pFakeArgvFreeable[ i ]; - - char* session_manager = nullptr; - if( getenv( "SESSION_MANAGER" ) != nullptr ) - { - session_manager = strdup( getenv( "SESSION_MANAGER" )); - unsetenv( "SESSION_MANAGER" ); - } - - int * pFakeArgc = new int; - *pFakeArgc = nFakeArgc; - pQApplication = new QApplication( *pFakeArgc, pFakeArgv ); - - if( session_manager != nullptr ) - { - // coverity[tainted_string] - trusted source for setenv - setenv( "SESSION_MANAGER", session_manager, 1 ); - free( session_manager ); - } - - KAboutData *kAboutData = new KAboutData( I18N_NOOP("LibreOffice"), - i18n( "LibreOffice" ), - "6.0.0", - i18n( "LibreOffice with KF5 Native Widget Support." ), - KAboutLicense::File, - i18n("Copyright (c) 2017 LibreOffice contributors" ), - i18n( "LibreOffice is an office suite." ), - "http://libreoffice.org", - QLatin1String("libreoffice@lists.freedesktop.org") ); - - kAboutData->addAuthor( i18n( "Jan-Marek Glogowski" ), - i18n( "Original author and maintainer of the KF5 NWF." ), - "glogow@fbihome.de" ); - - KAboutData::setApplicationData( *kAboutData ); - - QApplication::setQuitOnLastWindowClosed(false); - - Kf5Instance* pInstance = new Kf5Instance( new SalYieldMutex() ); - - // initialize SalData - new Kf5Data( pInstance ); - - pInstance->m_pQApplication.reset( pQApplication ); - pInstance->m_pFakeArgvFreeable.reset( pFakeArgvFreeable ); - pInstance->m_pFakeArgv.reset( pFakeArgv ); - pInstance->m_pFakeArgc.reset( pFakeArgc ); - - return pInstance; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Instance.hxx b/vcl/unx/kf5/Kf5Instance.hxx deleted file mode 100644 index 98cfa31c1579..000000000000 --- a/vcl/unx/kf5/Kf5Instance.hxx +++ /dev/null @@ -1,105 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#pragma once - -#include <unx/geninst.h> -#include <salusereventlist.hxx> - -#include <osl/conditn.hxx> - -#include <QtCore/QObject> - -class QApplication; -class SalYieldMutex; -class SalFrame; - -class Kf5Instance - : public QObject - , public SalGenericInstance - , public SalUserEventList -{ - Q_OBJECT - - osl::Condition m_aWaitingYieldCond; - int m_postUserEventId; - -public: - std::unique_ptr< QApplication > m_pQApplication; - std::unique_ptr< char*[] > m_pFakeArgvFreeable; - std::unique_ptr< char*[] > m_pFakeArgv; - std::unique_ptr< int > m_pFakeArgc; - -private Q_SLOTS: - bool ImplYield( bool bWait, bool bHandleAllCurrentEvents ); - -Q_SIGNALS: - bool ImplYieldSignal( bool bWait, bool bHandleAllCurrentEvents ); - -public: - explicit Kf5Instance( SalYieldMutex* pMutex ); - virtual ~Kf5Instance() override; - - virtual SalFrame* CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ) override; - virtual SalFrame* CreateChildFrame( SystemParentData* pParent, SalFrameStyleFlags nStyle ) override; - virtual void DestroyFrame( SalFrame* pFrame ) override; - - virtual SalObject* CreateObject( SalFrame* pParent, SystemWindowData* pWindowData, bool bShow ) override; - virtual void DestroyObject( SalObject* pObject ) override; - - virtual SalVirtualDevice* CreateVirtualDevice( SalGraphics* pGraphics, long &nDX, long &nDY, - DeviceFormat eFormat, const SystemGraphicsData *pData = nullptr ) override; - - virtual SalInfoPrinter* CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, - ImplJobSetup* pSetupData ) override; - virtual void DestroyInfoPrinter( SalInfoPrinter* pPrinter ) override; - virtual SalPrinter* CreatePrinter( SalInfoPrinter* pInfoPrinter ) override; - virtual void DestroyPrinter( SalPrinter* pPrinter ) override; - virtual void GetPrinterQueueInfo( ImplPrnQueueList* pList ) override; - virtual void GetPrinterQueueState( SalPrinterQueueInfo* pInfo ) override; - virtual void DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) override; - virtual OUString GetDefaultPrinter() override; - virtual void PostPrintersChanged() override; - - virtual SalTimer* CreateSalTimer() override; - virtual SalSystem* CreateSalSystem() override; - virtual SalBitmap* CreateSalBitmap() override; - - virtual bool DoYield(bool bWait, bool bHandleAllCurrentEvents) override; - virtual bool AnyInput( VclInputFlags nType ) override; - - virtual SalSession* CreateSalSession() override; - - virtual OpenGLContext* CreateOpenGLContext() override; - - virtual OUString GetConnectionIdentifier() override; - - virtual void AddToRecentDocumentList( const OUString& rFileUrl, const OUString& rMimeType, - const OUString& rDocumentService ) override; - - virtual GenPspGraphics *CreatePrintGraphics() override; - - virtual bool IsMainThread() const override; - - virtual void TriggerUserEventProcessing() override; - virtual void ProcessEvent( SalUserEvent aEvent ) override; - -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Instance_Print.cxx b/vcl/unx/kf5/Kf5Instance_Print.cxx deleted file mode 100644 index e716c8953ec1..000000000000 --- a/vcl/unx/kf5/Kf5Instance_Print.cxx +++ /dev/null @@ -1,265 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "Kf5Instance.hxx" -#include "Kf5Printer.hxx" - -#include <vcl/svapp.hxx> -#include <vcl/timer.hxx> -#include <printerinfomanager.hxx> - -#include <jobset.h> -#include <print.h> -#include <salptype.hxx> -#include <saldatabasic.hxx> - -#include <unx/genpspgraphics.h> - -using namespace psp; - -/* - * static helpers - */ - -static OUString getPdfDir( const PrinterInfo& rInfo ) -{ - OUString aDir; - sal_Int32 nIndex = 0; - while( nIndex != -1 ) - { - OUString aToken( rInfo.m_aFeatures.getToken( 0, ',', nIndex ) ); - if( aToken.startsWith( "pdf=" ) ) - { - sal_Int32 nPos = 0; - aDir = aToken.getToken( 1, '=', nPos ); - if( aDir.isEmpty() ) - aDir = OStringToOUString( OString( getenv( "HOME" ) ), osl_getThreadTextEncoding() ); - break; - } - } - return aDir; -} - -inline int PtTo10Mu( int nPoints ) { return (int)((((double)nPoints)*35.27777778)+0.5); } - -static void copyJobDataToJobSetup( ImplJobSetup* pJobSetup, JobData& rData ) -{ - pJobSetup->SetOrientation( rData.m_eOrientation == orientation::Landscape ? Orientation::Landscape : Orientation::Portrait ); - - // copy page size - OUString aPaper; - int width, height; - - rData.m_aContext.getPageSize( aPaper, width, height ); - pJobSetup->SetPaperFormat( PaperInfo::fromPSName(OUStringToOString( aPaper, RTL_TEXTENCODING_ISO_8859_1 )) ); - pJobSetup->SetPaperWidth( 0 ); - pJobSetup->SetPaperHeight( 0 ); - if( pJobSetup->GetPaperFormat() == PAPER_USER ) - { - // transform to 100dth mm - width = PtTo10Mu( width ); - height = PtTo10Mu( height ); - - if( rData.m_eOrientation == psp::orientation::Portrait ) - { - pJobSetup->SetPaperWidth( width ); - pJobSetup->SetPaperHeight( height ); - } - else - { - pJobSetup->SetPaperWidth( height ); - pJobSetup->SetPaperHeight( width ); - } - } - - // copy input slot - const PPDKey* pKey = nullptr; - const PPDValue* pValue = nullptr; - - pJobSetup->SetPaperBin( 0xffff ); - if( rData.m_pParser ) - pKey = rData.m_pParser->getKey( OUString( "InputSlot" ) ); - if( pKey ) - pValue = rData.m_aContext.getValue( pKey ); - if( pKey && pValue ) - { - int nPaperBin; - for( nPaperBin = 0; - pValue != pKey->getValue( nPaperBin ) && - nPaperBin < pKey->countValues(); - nPaperBin++ ); - pJobSetup->SetPaperBin( - (nPaperBin == pKey->countValues() - || pValue == pKey->getDefaultValue()) - ? 0xffff : nPaperBin); - } - - // copy duplex - pKey = nullptr; - pValue = nullptr; - - pJobSetup->SetDuplexMode( DuplexMode::Unknown ); - if( rData.m_pParser ) - pKey = rData.m_pParser->getKey( OUString( "Duplex" ) ); - if( pKey ) - pValue = rData.m_aContext.getValue( pKey ); - if( pKey && pValue ) - { - if( pValue->m_aOption.equalsIgnoreAsciiCase( "None" ) || - pValue->m_aOption.startsWithIgnoreAsciiCase( "Simplex" ) - ) - { - pJobSetup->SetDuplexMode( DuplexMode::Off ); - } - else if( pValue->m_aOption.equalsIgnoreAsciiCase( "DuplexNoTumble" ) ) - { - pJobSetup->SetDuplexMode( DuplexMode::LongEdge ); - } - else if( pValue->m_aOption.equalsIgnoreAsciiCase( "DuplexTumble" ) ) - { - pJobSetup->SetDuplexMode( DuplexMode::ShortEdge ); - } - } - - // copy the whole context - if( pJobSetup->GetDriverData() ) - rtl_freeMemory( const_cast<sal_uInt8*>(pJobSetup->GetDriverData()) ); - - sal_uInt32 nBytes; - void* pBuffer = nullptr; - if( rData.getStreamBuffer( pBuffer, nBytes ) ) - { - pJobSetup->SetDriverDataLen( nBytes ); - pJobSetup->SetDriverData( static_cast<sal_uInt8*>(pBuffer) ); - } - else - { - pJobSetup->SetDriverDataLen( 0 ); - pJobSetup->SetDriverData( nullptr ); - } -} - -SalInfoPrinter* Kf5Instance::CreateInfoPrinter( SalPrinterQueueInfo* pQueueInfo, - ImplJobSetup* pJobSetup ) -{ - // create and initialize SalInfoPrinter - Kf5InfoPrinter* pPrinter = new Kf5InfoPrinter; - - if( pJobSetup ) - { - PrinterInfoManager& rManager( PrinterInfoManager::get() ); - PrinterInfo aInfo( rManager.getPrinterInfo( pQueueInfo->maPrinterName ) ); - pPrinter->m_aJobData = aInfo; - pPrinter->m_aPrinterGfx.Init( pPrinter->m_aJobData ); - - if( pJobSetup->GetDriverData() ) - JobData::constructFromStreamBuffer( pJobSetup->GetDriverData(), - pJobSetup->GetDriverDataLen(), aInfo ); - - pJobSetup->SetSystem( JOBSETUP_SYSTEM_UNIX ); - pJobSetup->SetPrinterName( pQueueInfo->maPrinterName ); - pJobSetup->SetDriver( aInfo.m_aDriverName ); - copyJobDataToJobSetup( pJobSetup, aInfo ); - } - - return pPrinter; -} - -void Kf5Instance::DestroyInfoPrinter( SalInfoPrinter* pPrinter ) -{ - delete pPrinter; -} - -SalPrinter* Kf5Instance::CreatePrinter( SalInfoPrinter* pInfoPrinter ) -{ - // create and initialize SalPrinter - Kf5Printer* pPrinter = new Kf5Printer( pInfoPrinter ); - pPrinter->m_aJobData = static_cast<Kf5InfoPrinter*>(pInfoPrinter)->m_aJobData; - - return pPrinter; -} - -void Kf5Instance::DestroyPrinter( SalPrinter* pPrinter ) -{ - delete pPrinter; -} - -void Kf5Instance::GetPrinterQueueInfo( ImplPrnQueueList* pList ) -{ - PrinterInfoManager& rManager( PrinterInfoManager::get() ); - static const char* pNoSyncDetection = getenv( "SAL_DISABLE_SYNCHRONOUS_PRINTER_DETECTION" ); - if( ! pNoSyncDetection || ! *pNoSyncDetection ) - { - // #i62663# synchronize possible asynchronouse printer detection now - rManager.checkPrintersChanged( true ); - } - ::std::vector< OUString > aPrinters; - rManager.listPrinters( aPrinters ); - - for( ::std::vector< OUString >::iterator it = aPrinters.begin(); it != aPrinters.end(); ++it ) - { - const PrinterInfo& rInfo( rManager.getPrinterInfo( *it ) ); - // create new entry - SalPrinterQueueInfo* pInfo = new SalPrinterQueueInfo; - pInfo->maPrinterName = *it; - pInfo->maDriver = rInfo.m_aDriverName; - pInfo->maLocation = rInfo.m_aLocation; - pInfo->maComment = rInfo.m_aComment; - pInfo->mpSysData = nullptr; - - sal_Int32 nIndex = 0; - while( nIndex != -1 ) - { - OUString aToken( rInfo.m_aFeatures.getToken( 0, ',', nIndex ) ); - if( aToken.startsWith( "pdf=" ) ) - { - pInfo->maLocation = getPdfDir( rInfo ); - break; - } - } - - pList->Add( pInfo ); - } -} - -void Kf5Instance::DeletePrinterQueueInfo( SalPrinterQueueInfo* pInfo ) -{ - delete pInfo; -} - -void Kf5Instance::GetPrinterQueueState( SalPrinterQueueInfo* ) -{ -} - -OUString Kf5Instance::GetDefaultPrinter() -{ - PrinterInfoManager& rManager( PrinterInfoManager::get() ); - return rManager.getDefaultPrinter(); -} - -void Kf5Instance::PostPrintersChanged() -{ -} - -GenPspGraphics *Kf5Instance::CreatePrintGraphics() -{ - return new GenPspGraphics(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Object.cxx b/vcl/unx/kf5/Kf5Object.cxx deleted file mode 100644 index 5e9a23b1dd4c..000000000000 --- a/vcl/unx/kf5/Kf5Object.cxx +++ /dev/null @@ -1,86 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "Kf5Object.hxx" - -#include "Kf5Frame.hxx" -#include "Kf5Widget.hxx" - -#include <QtWidgets/QWidget> - -Kf5Object::Kf5Object( Kf5Frame* pParent, bool bShow ) - : m_pParent( pParent ) -{ - if ( !m_pParent || !pParent->GetQWidget() ) - return; - m_pQWidget.reset( new QWidget( pParent->GetQWidget() ) ); - if ( bShow ) - m_pQWidget->show(); -} - -Kf5Object::~Kf5Object() -{ -} - -void Kf5Object::ResetClipRegion() -{ - if ( m_pQWidget.get() ) - m_pRegion = QRegion( m_pQWidget->geometry() ); - else - m_pRegion = QRegion(); -} - -void Kf5Object::BeginSetClipRegion( sal_uLong ) -{ - m_pRegion = QRegion(); -} - -void Kf5Object::UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) -{ - m_pRegion += QRect( nX, nY, nWidth, nHeight ); -} - -void Kf5Object::EndSetClipRegion() -{ - if ( m_pQWidget.get() ) - m_pRegion = m_pRegion.intersected( m_pQWidget->geometry() ); -} - -void Kf5Object::SetPosSize( long nX, long nY, long nWidth, long nHeight ) -{ - -} - -void Kf5Object::Show( bool bVisible ) -{ - if( m_pQWidget ) - m_pQWidget->setVisible( bVisible ); -} - -void Kf5Object::SetForwardKey( bool bEnable ) -{ -} - -const SystemEnvData* Kf5Object::GetSystemData() const -{ - return nullptr; -} - - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Object.hxx b/vcl/unx/kf5/Kf5Object.hxx deleted file mode 100644 index f4eceb770725..000000000000 --- a/vcl/unx/kf5/Kf5Object.hxx +++ /dev/null @@ -1,56 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#pragma once - -#include <salobj.hxx> -#include <vcl/sysdata.hxx> - -#include <memory> - -#include <QtGui/QRegion> - -class QWidget; -class Kf5Frame; - -class Kf5Object : public SalObject -{ - SystemEnvData m_aSystemData; - std::unique_ptr< QWidget > m_pQWidget; - Kf5Frame* m_pParent; - QRegion m_pRegion; - -public: - Kf5Object( Kf5Frame* pParent, bool bShow ); - virtual ~Kf5Object() override; - - virtual void ResetClipRegion() override; - virtual void BeginSetClipRegion( sal_uLong nRects ) override; - virtual void UnionClipRegion( long nX, long nY, long nWidth, long nHeight ) override; - virtual void EndSetClipRegion() override; - - virtual void SetPosSize( long nX, long nY, long nWidth, long nHeight ) override; - virtual void Show( bool bVisible ) override; - - virtual void SetForwardKey( bool bEnable ) override; - - virtual const SystemEnvData* GetSystemData() const override; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Printer.cxx b/vcl/unx/kf5/Kf5Printer.cxx deleted file mode 100644 index ffa784280731..000000000000 --- a/vcl/unx/kf5/Kf5Printer.cxx +++ /dev/null @@ -1,32 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "Kf5Printer.hxx" - -bool Kf5InfoPrinter::Setup( SalFrame*, ImplJobSetup* ) -{ - return false; -} - -Kf5Printer::Kf5Printer( SalInfoPrinter* pInfoPrinter ) - : PspSalPrinter( pInfoPrinter ) -{ -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Printer.hxx b/vcl/unx/kf5/Kf5Printer.hxx deleted file mode 100644 index de1487db33a1..000000000000 --- a/vcl/unx/kf5/Kf5Printer.hxx +++ /dev/null @@ -1,39 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#pragma once - -#include <unx/genprn.h> - -class SalFrame; -class ImplJobSetup; - -class Kf5InfoPrinter : public PspSalInfoPrinter -{ -public: - virtual bool Setup( SalFrame* pFrame, ImplJobSetup* pSetupData ) override; -}; - -class Kf5Printer : public PspSalPrinter -{ -public: - Kf5Printer( SalInfoPrinter* pInfoPrinter ); -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Timer.cxx b/vcl/unx/kf5/Kf5Timer.cxx deleted file mode 100644 index 4db725ec5ac3..000000000000 --- a/vcl/unx/kf5/Kf5Timer.cxx +++ /dev/null @@ -1,65 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "Kf5Timer.hxx" -#include <Kf5Timer.moc> - -#include <QtWidgets/QApplication> -#include <QtCore/QThread> - -Kf5Timer::Kf5Timer() -{ - m_aTimer.setSingleShot( true ); - // run the timer itself in the main / creator thread - connect( &m_aTimer, SIGNAL( timeout() ), - this, SLOT( timeoutActivated() ), Qt::QueuedConnection ); - // QTimer::start() can be called only in its creator thread - connect( this, SIGNAL( startTimerSignal() ), - this, SLOT( startTimer() ), Qt::QueuedConnection ); -} - -Kf5Timer::~Kf5Timer() -{ -} - -void Kf5Timer::timeoutActivated() -{ - CallCallback(); -} - -void Kf5Timer::startTimer() -{ - m_aTimer.start(); -} - -void Kf5Timer::Start( sal_uIntPtr nMS ) -{ - m_aTimer.setInterval( nMS ); - if( qApp->thread() == QThread::currentThread() ) - startTimer(); - else - Q_EMIT startTimerSignal(); -} - -void Kf5Timer::Stop() -{ - m_aTimer.stop(); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Timer.hxx b/vcl/unx/kf5/Kf5Timer.hxx deleted file mode 100644 index 0b08968743d9..000000000000 --- a/vcl/unx/kf5/Kf5Timer.hxx +++ /dev/null @@ -1,46 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#pragma once - -#include <saltimer.hxx> -#include <QtCore/QTimer> - -class Kf5Timer final : public QObject, public SalTimer -{ - Q_OBJECT - - QTimer m_aTimer; - -private Q_SLOTS: - void timeoutActivated(); - void startTimer(); - -Q_SIGNALS: - void startTimerSignal(); - -public: - Kf5Timer(); - virtual ~Kf5Timer() override; - - virtual void Start( sal_uIntPtr nMS ) override; - virtual void Stop() override; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Tools.hxx b/vcl/unx/kf5/Kf5Tools.hxx deleted file mode 100644 index 40c34d9d4303..000000000000 --- a/vcl/unx/kf5/Kf5Tools.hxx +++ /dev/null @@ -1,89 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#pragma once - -#include <QtCore/QString> -#include <QtCore/QRect> -#include <QtCore/QSize> -#include <QtGui/QImage> - -#include <rtl/string.hxx> -#include <tools/gen.hxx> - -inline OUString toOUString(const QString& s) -{ - // QString stores UTF16, just like OUString - return OUString(reinterpret_cast<const sal_Unicode*>(s.data()), s.length()); -} - -inline QString toQString(const OUString& s) -{ - return QString::fromUtf16( - reinterpret_cast<ushort const *>(s.getStr()), s.getLength()); -} - -inline QRect toQRect( const tools::Rectangle& rRect ) -{ - return QRect( rRect.Left(), rRect.Top(), - rRect.GetWidth(), rRect.GetHeight() ); -} - -inline QSize toQSize( const Size& rSize ) -{ - return QSize( rSize.Width(), rSize.Height() ); -} - -inline Size toSize( const QSize& rSize ) -{ - return Size( rSize.width(), rSize.height() ); -} - -inline QImage::Format getBitFormat( sal_uInt16 nBitCount ) -{ - switch ( nBitCount ) - { - case 1 : return QImage::Format_Mono; - case 8 : return QImage::Format_Indexed8; - case 16 : return QImage::Format_RGB16; - case 24 : return QImage::Format_RGB888; - case 32 : return QImage::Format_ARGB32; - default : - std::abort(); - break; - } - return QImage::Format_Invalid; -} - -inline sal_uInt16 getFormatBits( QImage::Format eFormat ) -{ - switch ( eFormat ) - { - case QImage::Format_Mono : return 1; - case QImage::Format_Indexed8 : return 8; - case QImage::Format_RGB16 : return 16; - case QImage::Format_RGB888 : return 24; - case QImage::Format_ARGB32 : return 32; - default : - std::abort(); - return 0; - } -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5VirtualDevice.cxx b/vcl/unx/kf5/Kf5VirtualDevice.cxx deleted file mode 100644 index 9c0e4864a55c..000000000000 --- a/vcl/unx/kf5/Kf5VirtualDevice.cxx +++ /dev/null @@ -1,101 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "Kf5VirtualDevice.hxx" - -#include "Kf5Graphics.hxx" - -#include <QtGui/QImage> - -Kf5VirtualDevice::Kf5VirtualDevice( DeviceFormat eFormat, double fScale ) -{ -} - -Kf5VirtualDevice::~Kf5VirtualDevice() -{ -} - -SalGraphics* Kf5VirtualDevice::AcquireGraphics() -{ - assert( m_pImage ); - Kf5Graphics* pGraphics = new Kf5Graphics( m_pImage.get() ); - m_aGraphics.push_back( pGraphics ); - return pGraphics; -} - -void Kf5VirtualDevice::ReleaseGraphics( SalGraphics* pGraphics ) -{ - m_aGraphics.remove( dynamic_cast<Kf5Graphics*>( pGraphics ) ); - delete pGraphics; -} - -bool Kf5VirtualDevice::SetSize( long nNewDX, long nNewDY ) -{ - return SetSizeUsingBuffer( nNewDX, nNewDY, nullptr ); -} - -bool Kf5VirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY, - sal_uInt8 * pBuffer ) -{ - if( nNewDX == 0 ) - nNewDX = 1; - if( nNewDY == 0 ) - nNewDY = 1; - - if( m_pImage && m_aFrameSize.getX() != nNewDX - && m_aFrameSize.getY() != nNewDY ) - return true; - - m_aFrameSize = basegfx::B2IVector( nNewDX, nNewDY ); - - nNewDX *= m_fScale; - nNewDY *= m_fScale; - - if (m_eFormat == DeviceFormat::BITMASK) - { - m_pImage.reset( new QImage( nNewDX, nNewDY, QImage::Format_Mono ) ); - } - else - { - if ( pBuffer ) - m_pImage.reset( new QImage( pBuffer, nNewDX, nNewDY, QImage::Format_ARGB32 ) ); - else - m_pImage.reset( new QImage( nNewDX, nNewDY, QImage::Format_ARGB32 ) ); - } - - m_pImage->setDevicePixelRatio( m_fScale ); - - // update device in existing graphics - for( auto pKf5Graph : m_aGraphics ) - pKf5Graph->ChangeQImage( m_pImage.get() ); - - return true; -} - -long Kf5VirtualDevice::GetWidth() const -{ - return m_pImage ? m_aFrameSize.getX() : 0; -} - -long Kf5VirtualDevice::GetHeight() const -{ - return m_pImage ? m_aFrameSize.getY() : 0; -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5VirtualDevice.hxx b/vcl/unx/kf5/Kf5VirtualDevice.hxx deleted file mode 100644 index 7b50a6e7d2dc..000000000000 --- a/vcl/unx/kf5/Kf5VirtualDevice.hxx +++ /dev/null @@ -1,58 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#pragma once - -#include <salvd.hxx> -#include <basegfx/vector/b2ivector.hxx> - -#include <memory> -#include <list> - -class Kf5Graphics; -class QImage; -enum class DeviceFormat; - -class Kf5VirtualDevice : public SalVirtualDevice -{ - std::list< Kf5Graphics* > m_aGraphics; - std::unique_ptr< QImage > m_pImage; - DeviceFormat m_eFormat; - basegfx::B2IVector m_aFrameSize; - double m_fScale; - -public: - Kf5VirtualDevice( DeviceFormat eFormat, double fScale ); - virtual ~Kf5VirtualDevice() override; - - // SalVirtualDevice - virtual SalGraphics* AcquireGraphics() override; - virtual void ReleaseGraphics( SalGraphics* pGraphics ) override; - - virtual bool SetSize( long nNewDX, long nNewDY ) override; - virtual bool SetSizeUsingBuffer( long nNewDX, long nNewDY, - sal_uInt8 * pBuffer - ) override; - - // SalGeometryProvider - virtual long GetWidth() const override; - virtual long GetHeight() const override; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Widget.cxx b/vcl/unx/kf5/Kf5Widget.cxx deleted file mode 100644 index f40a2e85a2cb..000000000000 --- a/vcl/unx/kf5/Kf5Widget.cxx +++ /dev/null @@ -1,55 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#include "Kf5Widget.hxx" -#include <Kf5Widget.moc> - -#include "Kf5Frame.hxx" -#include "Kf5Graphics.hxx" - -#include <QtGui/QImage> -#include <QtGui/QPainter> -#include <QtGui/QPaintEvent> - -Kf5Widget::Kf5Widget( Kf5Frame &rFrame, QWidget *parent, Qt::WindowFlags f ) - : QWidget( parent, f ) - , m_pFrame( &rFrame ) -{ - create(); -} - -Kf5Widget::~Kf5Widget() -{ -} - -void Kf5Widget::paintEvent( QPaintEvent *pEvent ) -{ - QPainter p( this ); - p.drawImage( pEvent->rect().topLeft(), *m_pFrame->m_pQImage, pEvent->rect() ); -} - -void Kf5Widget::resizeEvent( QResizeEvent* ) -{ - QImage *pImage = new QImage( m_pFrame->m_pQWidget->size(), QImage::Format_ARGB32 ); - m_pFrame->m_pGraphics->ChangeQImage( pImage ); - m_pFrame->m_pQImage.reset( pImage ); - m_pFrame->CallCallback( SalEvent::Resize, nullptr ); -} - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Widget.hxx b/vcl/unx/kf5/Kf5Widget.hxx deleted file mode 100644 index 60296a620fe8..000000000000 --- a/vcl/unx/kf5/Kf5Widget.hxx +++ /dev/null @@ -1,45 +0,0 @@ -/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- */ -/* - * This file is part of the LibreOffice project. - * - * This Source Code Form is subject to the terms of the Mozilla Public - * License, v. 2.0. If a copy of the MPL was not distributed with this - * file, You can obtain one at http://mozilla.org/MPL/2.0/. - * - * This file incorporates work covered by the following license notice: - * - * Licensed to the Apache Software Foundation (ASF) under one or more - * contributor license agreements. See the NOTICE file distributed - * with this work for additional information regarding copyright - * ownership. The ASF licenses this file to you under the Apache - * License, Version 2.0 (the "License"); you may not use this file - * except in compliance with the License. You may obtain a copy of - * the License at http://www.apache.org/licenses/LICENSE-2.0 . - */ - -#pragma once - -#include <QtWidgets/QWidget> - -class Kf5Frame; -class QPaintEvent; -class QResizeEvent; - -class Kf5Widget - : public QWidget -{ - Q_OBJECT - - Kf5Frame *m_pFrame; - - void paintEvent( QPaintEvent* ) override; - void resizeEvent( QResizeEvent* ) override; - -public: - Kf5Widget( Kf5Frame &rFrame, - QWidget *parent = Q_NULLPTR, - Qt::WindowFlags f = Qt::WindowFlags() ); - virtual ~Kf5Widget() override; -}; - -/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ |