diff options
author | Jan-Marek Glogowski <glogow@fbihome.de> | 2017-10-21 13:50:30 +0000 |
---|---|---|
committer | Thorsten Behrens <Thorsten.Behrens@CIB.de> | 2017-11-06 12:05:31 +0100 |
commit | 9335945c7cb215f387ed1444e28533fac437c6e8 (patch) | |
tree | d4bdbf17d4272f9d4ee32d57275883f79ad200b8 /vcl/unx | |
parent | f69be03d72fbaa535adc8b06475d2806283b79ab (diff) |
KF5 initial VCL plugin
Something that compiles, basically just interface stubs.
All used Svp classes don't use any cairo.
Change-Id: I9a8858c930989438cc2a3f3346c01a7abc579d62
Diffstat (limited to 'vcl/unx')
-rw-r--r-- | vcl/unx/kf5/Kf5Data.cxx | 49 | ||||
-rw-r--r-- | vcl/unx/kf5/Kf5Data.hxx | 34 | ||||
-rw-r--r-- | vcl/unx/kf5/Kf5Frame.cxx | 224 | ||||
-rw-r--r-- | vcl/unx/kf5/Kf5Frame.hxx | 86 | ||||
-rw-r--r-- | vcl/unx/kf5/Kf5Graphics.cxx | 45 | ||||
-rw-r--r-- | vcl/unx/kf5/Kf5Graphics.hxx | 167 | ||||
-rw-r--r-- | vcl/unx/kf5/Kf5Graphics_Controls.cxx | 51 | ||||
-rw-r--r-- | vcl/unx/kf5/Kf5Graphics_GDI.cxx | 223 | ||||
-rw-r--r-- | vcl/unx/kf5/Kf5Graphics_Text.cxx | 100 | ||||
-rw-r--r-- | vcl/unx/kf5/Kf5Instance.cxx | 144 | ||||
-rw-r--r-- | vcl/unx/kf5/Kf5Instance.hxx | 75 | ||||
-rw-r--r-- | vcl/unx/kf5/Kf5Instance_Print.cxx | 265 | ||||
-rw-r--r-- | vcl/unx/kf5/Kf5Printer.cxx | 32 | ||||
-rw-r--r-- | vcl/unx/kf5/Kf5Printer.hxx | 39 | ||||
-rw-r--r-- | vcl/unx/kf5/Kf5Timer.cxx | 65 | ||||
-rw-r--r-- | vcl/unx/kf5/Kf5Timer.hxx | 46 | ||||
-rw-r--r-- | vcl/unx/kf5/Kf5VirtualDevice.cxx | 60 | ||||
-rw-r--r-- | vcl/unx/kf5/Kf5VirtualDevice.hxx | 54 |
18 files changed, 1759 insertions, 0 deletions
diff --git a/vcl/unx/kf5/Kf5Data.cxx b/vcl/unx/kf5/Kf5Data.cxx new file mode 100644 index 000000000000..b54054dc4cfe --- /dev/null +++ b/vcl/unx/kf5/Kf5Data.cxx @@ -0,0 +1,49 @@ +/* -*- 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 new file mode 100644 index 000000000000..16f1e24ba710 --- /dev/null +++ b/vcl/unx/kf5/Kf5Data.hxx @@ -0,0 +1,34 @@ +/* -*- 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/Kf5Frame.cxx b/vcl/unx/kf5/Kf5Frame.cxx new file mode 100644 index 000000000000..c6326b564557 --- /dev/null +++ b/vcl/unx/kf5/Kf5Frame.cxx @@ -0,0 +1,224 @@ +/* -*- 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" + +Kf5Frame::Kf5Frame::Kf5Frame( Kf5Instance* pInstance, + SalFrame* pParent, + SalFrameStyleFlags nSalFrameStyle ) +{ +} + +Kf5Frame::~Kf5Frame() +{ +} + +SalGraphics* Kf5Frame::AcquireGraphics() +{ + return nullptr; +} + +void Kf5Frame::ReleaseGraphics( SalGraphics* pGraphics ) +{ +} + + +bool Kf5Frame::PostEvent(ImplSVEvent* pData) +{ + return false; +} + +void Kf5Frame::SetTitle( const OUString& rTitle ) +{ +} + +void Kf5Frame::SetIcon( sal_uInt16 nIcon ) +{ +} + +void Kf5Frame::SetMenu( SalMenu* pMenu ) +{ +} + +void Kf5Frame::DrawMenuBar() +{ +} + +void Kf5Frame::SetExtendedFrameStyle( SalExtStyle nExtStyle ) +{ +} + +void Kf5Frame::Show( bool bVisible, bool bNoActivate ) +{ +} + +void Kf5Frame::SetMinClientSize( long nWidth, long nHeight ) +{ +} + +void Kf5Frame::SetMaxClientSize( long nWidth, long nHeight ) +{ +} + +void Kf5Frame::SetPosSize( long nX, long nY, long nWidth, long nHeight, sal_uInt16 nFlags ) +{ +} + +void Kf5Frame::GetClientSize( long& rWidth, long& rHeight ) +{ +} + +void Kf5Frame::GetWorkArea( tools::Rectangle& rRect ) +{ +} + +SalFrame* Kf5Frame::GetParent() const +{ + return nullptr; +} + +void Kf5Frame::SetWindowState( const SalFrameState* pState ) +{ +} + +bool Kf5Frame::GetWindowState( SalFrameState* pState ) +{ + return false; +} + +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 ) +{ +} + +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 new file mode 100644 index 000000000000..d08040b23c71 --- /dev/null +++ b/vcl/unx/kf5/Kf5Frame.hxx @@ -0,0 +1,86 @@ +/* -*- 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> + +class Kf5Instance; + +class VCL_DLLPUBLIC Kf5Frame : public SalFrame +{ +public: + Kf5Frame( Kf5Instance* pInstance, + SalFrame* pParent, + SalFrameStyleFlags nSalFrameStyle ); + virtual ~Kf5Frame() override; + + 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 new file mode 100644 index 000000000000..078fff82c31e --- /dev/null +++ b/vcl/unx/kf5/Kf5Graphics.cxx @@ -0,0 +1,45 @@ +/* -*- 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" + +Kf5Graphics::Kf5Graphics() +{ +} + +Kf5Graphics::~Kf5Graphics() +{ +} + +SalGraphicsImpl* Kf5Graphics::GetImpl() const +{ + return nullptr; +} + +SystemGraphicsData Kf5Graphics::GetGraphicsData() const +{ + return SystemGraphicsData(); +} + +bool Kf5Graphics::supportsOperation( OutDevSupportType ) const +{ + return false; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Graphics.hxx b/vcl/unx/kf5/Kf5Graphics.hxx new file mode 100644 index 000000000000..c3058f8f0bc0 --- /dev/null +++ b/vcl/unx/kf5/Kf5Graphics.hxx @@ -0,0 +1,167 @@ +/* -*- 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> + +class Kf5Frame; + +class Kf5Graphics : public SalGraphics +{ + Kf5Frame* mpFrame; + +public: + Kf5Graphics(); + virtual ~Kf5Graphics() override; + + virtual SalGraphicsImpl* GetImpl() const override; + virtual SystemGraphicsData + GetGraphicsData() const override; + virtual bool supportsOperation( OutDevSupportType ) const override; + + 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 new file mode 100644 index 000000000000..b55f7f190e94 --- /dev/null +++ b/vcl/unx/kf5/Kf5Graphics_Controls.cxx @@ -0,0 +1,51 @@ +/* -*- 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 new file mode 100644 index 000000000000..7e4f6b0da183 --- /dev/null +++ b/vcl/unx/kf5/Kf5Graphics_GDI.cxx @@ -0,0 +1,223 @@ +/* -*- 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::setClipRegion( const vcl::Region& ) +{ + return false; +} + +void Kf5Graphics::ResetClipRegion() +{ +} + +void Kf5Graphics::drawPixel( long nX, long nY ) +{ +} + +void Kf5Graphics::drawPixel( long nX, long nY, SalColor nSalColor ) +{ +} + +void Kf5Graphics::drawLine( long nX1, long nY1, long nX2, long nY2 ) +{ +} + +void Kf5Graphics::drawRect( long nX, long nY, long nWidth, long nHeight ) +{ +} + +void Kf5Graphics::drawPolyLine( sal_uInt32 nPoints, const SalPoint* pPtAry ) +{ +} + +void Kf5Graphics::drawPolygon( sal_uInt32 nPoints, const SalPoint* pPtAry ) +{ +} + +void Kf5Graphics::drawPolyPolygon( sal_uInt32 nPoly, const sal_uInt32* pPoints, PCONSTSALPOINT* pPtAry ) +{ +} + +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 ) +{ +} + +void Kf5Graphics::copyBits( const SalTwoRect& rPosAry, SalGraphics* pSrcGraphics ) +{ +} + +void Kf5Graphics::drawBitmap( const SalTwoRect& rPosAry, const SalBitmap& rSalBitmap ) +{ +} + +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 nullptr; +} + +SalColor Kf5Graphics::getPixel( long nX, long nY ) +{ + return SalColor(); +} + +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 ) +{ +} + +sal_uInt16 Kf5Graphics::GetBitCount() const +{ + return 0; +} + +long Kf5Graphics::GetGraphicsWidth() const +{ + return 0; +} + +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 new file mode 100644 index 000000000000..23eacc5ffda8 --- /dev/null +++ b/vcl/unx/kf5/Kf5Graphics_Text.cxx @@ -0,0 +1,100 @@ +/* -*- 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 <vcl/fontcharmap.hxx> + +void Kf5Graphics::SetTextColor( SalColor nSalColor ) +{ +} + +void Kf5Graphics::SetFont( const FontSelectPattern*, int nFallbackLevel ) +{ +} + +void Kf5Graphics::GetFontMetric( ImplFontMetricDataRef&, int nFallbackLevel ) +{ +} + +const FontCharMapRef Kf5Graphics::GetFontCharMap() const +{ + return nullptr; +} + +bool Kf5Graphics::GetFontCapabilities(vcl::FontCapabilities &rFontCapabilities) const +{ + return false; +} + +void Kf5Graphics::GetDevFontList( PhysicalFontCollection* ) +{ +} + +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 new file mode 100644 index 000000000000..344619994419 --- /dev/null +++ b/vcl/unx/kf5/Kf5Instance.cxx @@ -0,0 +1,144 @@ +/* -*- 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 <QtCore/QMetaType> +#include <QtCore/QThread> +#include <QtWidgets/QApplication> + +#include "Kf5Instance.hxx" +#include "Kf5Frame.hxx" +#include "Kf5Data.hxx" +#include "Kf5Timer.hxx" +#include "Kf5VirtualDevice.hxx" + +#include <vclpluginapi.h> +#include <sal/log.hxx> + +#include <headless/svpdummies.hxx> +#include <headless/svpbmp.hxx> + +Kf5Instance::Kf5Instance( SalYieldMutex* pMutex ) + : SalGenericInstance( pMutex ) +{ +} + +Kf5Instance::~Kf5Instance() +{ +} + +SalFrame* Kf5Instance::CreateChildFrame( SystemParentData* /*pParent*/, SalFrameStyleFlags nStyle ) +{ + return new Kf5Frame( this, nullptr, nStyle ); +} + +SalFrame* Kf5Instance::CreateFrame( SalFrame* pParent, SalFrameStyleFlags nStyle ) +{ + return new Kf5Frame( this, pParent, nStyle ); +} + +void Kf5Instance::DestroyFrame( SalFrame* pFrame ) +{ + delete pFrame; +} + +SalObject* Kf5Instance::CreateObject( SalFrame*, SystemWindowData*, bool ) +{ + return new SvpSalObject(); +} + +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 SvpSalBitmap(); +} + +bool Kf5Instance::DoYield(bool bWait, bool bHandleAllCurrentEvents) +{ + return false; +} + +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(); +} + +extern "C" { + VCLPLUG_KF5_PUBLIC SalInstance* create_SalInstance() + { + OString aVersion( qVersion() ); + SAL_INFO( "vcl.kf5", "qt version string is " << aVersion ); + + Kf5Instance* pInstance = new Kf5Instance( new SalYieldMutex() ); + + // initialize SalData + new Kf5Data( pInstance ); + + return pInstance; + } +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Instance.hxx b/vcl/unx/kf5/Kf5Instance.hxx new file mode 100644 index 000000000000..56cc66677284 --- /dev/null +++ b/vcl/unx/kf5/Kf5Instance.hxx @@ -0,0 +1,75 @@ +/* -*- 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> + +class SalYieldMutex; +class SalFrame; + +class Kf5Instance : public SalGenericInstance +{ +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; +}; + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5Instance_Print.cxx b/vcl/unx/kf5/Kf5Instance_Print.cxx new file mode 100644 index 000000000000..e716c8953ec1 --- /dev/null +++ b/vcl/unx/kf5/Kf5Instance_Print.cxx @@ -0,0 +1,265 @@ +/* -*- 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/Kf5Printer.cxx b/vcl/unx/kf5/Kf5Printer.cxx new file mode 100644 index 000000000000..ffa784280731 --- /dev/null +++ b/vcl/unx/kf5/Kf5Printer.cxx @@ -0,0 +1,32 @@ +/* -*- 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 new file mode 100644 index 000000000000..de1487db33a1 --- /dev/null +++ b/vcl/unx/kf5/Kf5Printer.hxx @@ -0,0 +1,39 @@ +/* -*- 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 new file mode 100644 index 000000000000..4db725ec5ac3 --- /dev/null +++ b/vcl/unx/kf5/Kf5Timer.cxx @@ -0,0 +1,65 @@ +/* -*- 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 new file mode 100644 index 000000000000..0b08968743d9 --- /dev/null +++ b/vcl/unx/kf5/Kf5Timer.hxx @@ -0,0 +1,46 @@ +/* -*- 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/Kf5VirtualDevice.cxx b/vcl/unx/kf5/Kf5VirtualDevice.cxx new file mode 100644 index 000000000000..866a49ba28d1 --- /dev/null +++ b/vcl/unx/kf5/Kf5VirtualDevice.cxx @@ -0,0 +1,60 @@ +/* -*- 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" + +Kf5VirtualDevice::Kf5VirtualDevice( DeviceFormat eFormat, double fScale ) +{ +} + +Kf5VirtualDevice::~Kf5VirtualDevice() +{ +} + +SalGraphics* Kf5VirtualDevice::AcquireGraphics() +{ + return nullptr; +} + +void Kf5VirtualDevice::ReleaseGraphics( SalGraphics* pGraphics ) +{ +} + +bool Kf5VirtualDevice::SetSize( long nNewDX, long nNewDY ) +{ + return false; +} + +bool Kf5VirtualDevice::SetSizeUsingBuffer( long nNewDX, long nNewDY, + sal_uInt8 * pBuffer ) +{ + return false; +} + +long Kf5VirtualDevice::GetWidth() const +{ + return 0; +} + +long Kf5VirtualDevice::GetHeight() const +{ + return 0; +} + +/* vim:set shiftwidth=4 softtabstop=4 expandtab: */ diff --git a/vcl/unx/kf5/Kf5VirtualDevice.hxx b/vcl/unx/kf5/Kf5VirtualDevice.hxx new file mode 100644 index 000000000000..9bffaa12861b --- /dev/null +++ b/vcl/unx/kf5/Kf5VirtualDevice.hxx @@ -0,0 +1,54 @@ +/* -*- 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 <list> + +class Kf5Graphics; +enum class DeviceFormat; + +class Kf5VirtualDevice : public SalVirtualDevice +{ + basegfx::B2IVector m_aFrameSize; + std::list< Kf5Graphics* > m_aGraphics; + +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: */ |